From 853deb1f46ba82f9feff2c0184e1cdd533c0ff8b Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Tue, 17 Jan 2017 00:41:59 +0000 Subject: [PATCH 001/374] Initial commit of typings for OpenFin API --- openfin/index.d.ts | 1493 ++++++++++++++++++++++++++++++++++++++ openfin/openfin-tests.ts | 718 ++++++++++++++++++ openfin/tsconfig.json | 20 + openfin/tslint.json | 1 + 4 files changed, 2232 insertions(+) create mode 100644 openfin/index.d.ts create mode 100644 openfin/openfin-tests.ts create mode 100644 openfin/tsconfig.json create mode 100644 openfin/tslint.json diff --git a/openfin/index.d.ts b/openfin/index.d.ts new file mode 100644 index 0000000000..2c37e6f9b2 --- /dev/null +++ b/openfin/index.d.ts @@ -0,0 +1,1493 @@ +// Type definitions for OpenFin API 15.0 +// Project: https://openfin.co/ +// Definitions by: Chris Barker +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// based on v6.49.15.18 +// 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 "document" objects. + **/ +declare namespace fin { + const desktop: OpenFinDesktop; + + interface OpenFinDesktop { + main(f: () => any): void; + Application: OpenFinApplication; + ExternalApp: OpenFinExternalApplication; + InterApplicationBus: OpenFinInterApplicationBus; + Notification: OpenFinNotification; + System: OpenFinSystem; + Window: OpenFinWindow; + } + + /** + * 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 { + /** + * 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; + /** + * Returns an Application object that represents an existing application. + */ + getCurrent(): OpenFinApplication; + /** + * Returns an Application object that represents an existing application. + */ + wrap(uuid: string): 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[]) => any, 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[][]) => any, 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) => any, 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) => any, errorCallback?: (reason: string) => void): void; + /** + * Retrieves current configuration of application's shortcuts. + */ + getShortcuts(callback?: (config: ShortCutConfig) => void, errorCallback?: (reason: string) => void): void; + /** + * Determines if the application is currently running. + */ + isRunning(callback?: (running: boolean) => void, errorCallback?: (reason: string) => void): void; + /** + * Passes in custom data that will be relayed to the RVM + */ + registerCustomData(data: any, 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) => any, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => any): 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) => any, 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; + } + + 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 { + url: string; + uuid: string; + name: string; + mainWindowOptions: WindowOptions; + } + + interface WindowOptions { + /** + * Enable keyboard shortcuts for devtools and zoom. Default: false for both. + */ + accelerator?: { + devtools?: boolean, + zoom?: boolean + }; + /** + * A flag to always position the window at the top of the window stack. Default: false. + */ + 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 + */ + contextMenu?: boolean; + /** + * This defines and applies rounded corners for a frameless window. Default for both width and height: 0. + */ + 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. + */ + frame?: boolean; + /** + * A flag to allow a window to be hidden when the close button is clicked.Default: false. + */ + hideOnClose?: boolean; + /** + * A URL for the icon to be shown in the window title bar and the taskbar.Default: The parent application's applicationIcon. + */ + icon?: string; + /** + * The maximum height of a window.Will default to the OS defined value if set to - 1. Default: -1. + */ + maxHeight?: number; + /** + * A flag that lets the window be maximized.Default: true. + */ + maximizable?: boolean; + /** + * The maximum width of a window.Will default to the OS defined value if set to - 1. Default: -1. + */ + maxWidth?: number; + /** + * The minimum height of a window.Default: 0. + */ + 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. + */ + opacity?: number; + /** + * A flag to drop to allow the user to resize the window.Default: true. + */ + resizable?: boolean; + /** + * Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window. + */ + 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[]) => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + /** + * Reads available formats for the clipboard type + */ + readHtml(type: string | null, callback?: (html: string) => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + /** + * Read the content of the clipboard as Rtf + */ + readRtf(type: string | null, callback?: (rtf: string) => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + /** + * Read the content of the clipboard as plain text + */ + readText(type: string | null, callback?: (text: string) => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + /** + * Writes data into the clipboard + */ + write(data: any, type: string | null, callback?: () => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + /** + * Writes data into the clipboard as Html + */ + writeHtml(data: string, type: string | null, callback?: () => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + /** + * Writes data into the clipboard as Rtf + */ + writeRtf(data: string, type: string | null, callback?: () => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + /** + * Writes data into the clipboard as plain text + */ + writeText(data: string, type: string | null, callback?: () => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + } + + /** + * 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 { + /** + * Returns an External Application object that represents an existing external application. + */ + wrap(uuid: string): OpenFinExternalApplication; + /** + * Registers an event listener on the specified event. + */ + addEventListener(type: OpenFinExternalApplicationEventType, listener: () => any, callback?: () => any, errorCallback?: (reason: string, error: ErrorInfo) => any): void; + /** + * Removes a previously registered event listener from the specified event. + */ + removeEventListener(type: OpenFinExternalApplicationEventType, listener: () => any, callback?: () => any, errorCallback?: (reason: string, error: ErrorInfo) => any): 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; + } + + /** + * 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 { + /** + * + */ + 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; + /** + * 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; + /** + * Exits the Runtime. + */ + exit(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; + /** + * 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; + /** + * 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 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 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; + /** + * 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; + /** + * 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; + } + + 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 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 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; + } + + /** + * 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 { + /** + * 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 {any} options - The options of the window + * @param {Function} [callback] - Called if the window creation was successful + * @param {number} [callback.successObj] - httpResponseCode + */ + new (options: WindowOptions, callback?: (successObj: { httpResponseCode: number }) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): OpenFinWindow; + /** + * Name of window + */ + name: string; + /** + * Returns an instance of the current window. + * @returns {OpenFinWindow} Current window + */ + getCurrent(): OpenFinWindow; + /** + * 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 {Window} Native window + */ + getNativeWindow(): Window; + /** + * Gets the parent application. + * @returns {OpenFinApplication} Parent application + */ + getParentApplication(): OpenFinApplication; + /** + * Gets the parent window. + */ + getParentWindow(): OpenFinWindow; + /** + * Returns a Window object that wraps an existing window. + */ + wrap(appUuid: string, windowName: string): 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 {force} 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 {force} 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 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 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 SessionChangedEvent { + /** + * the action that triggered this event: + */ + reason: "lock" + | "unlock" + | "remote-connect" + | "remote-disconnect" + | "unknown"; + topic: "system"; + type: "session-changed"; + } + + 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"; +} \ No newline at end of file diff --git a/openfin/openfin-tests.ts b/openfin/openfin-tests.ts new file mode 100644 index 0000000000..7aa2930089 --- /dev/null +++ b/openfin/openfin-tests.ts @@ -0,0 +1,718 @@ + +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", + mainWindowOptions: { + defaultHeight: 600, + defaultWidth: 800, + defaultTop: 300, + defaultLeft: 300, + autoShow: true + } + }, function (successObj) { + console.log("Application successfully created, HTTP response code:", successObj); + application.run(); + }, function (error) { + console.log("Error creating application:", error); + }); + // getCurrent + application = fin.desktop.Application.getCurrent(); + // wrap + application = fin.desktop.Application.wrap("454C7F31-A915-4EA2-83F2-CFA655453C52"); + // getWindow + application.getWindow(); + // addEventListener + application.addEventListener("closed", function (event) { + console.log("The application has closed"); + }, function () { + console.log("The registration was successful"); + }, function (reason) { + console.log("failure: " + reason); + }); + // close + application.close(); + // getChildWindows + application.getChildWindows(function (children) { + children.forEach(function (childWindow) { + console.log("Showing child: " + childWindow.name); + childWindow.show(); + }); + }); + // getGroups + application.getGroups(function (allGroups) { + console.log("There are a total of " + allGroups.length + " groups."); + + var groupCounter = 1; + allGroups.forEach(function (windowGroup) { + console.log("Group " + groupCounter + " contains " + + windowGroup.length + " windows."); + ++groupCounter; + }); + }); + // getManifest + application.getManifest(function (manifest) { + console.log("Application manifest:"); + console.log(manifest); + }); + // getParentUuid + application.getParentUuid(function (parentUuid) { + console.log("UUID of parent application:"); + console.log(parentUuid); + }); + // getShortcuts + application.getShortcuts(function (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); + }); + // isRunning + application.isRunning(function (running) { + console.log("the application is", running ? "running" : "not running"); + }); + // registerCustomData + application.registerCustomData({ + someData: "this is custom" + }, function () { + console.log("You will not read this."); + }, function (err) { + console.log("failure:", err); + }); + // removeEventListener + let previousCallback = function (event: fin.WindowEvent) { }; + application.removeEventListener("closed", previousCallback, function () { + console.log("The unregistration was successful"); + }, function (err) { + console.log("failure:", err); + }); + // removeTrayIcon + application.removeTrayIcon(function () { + console.log("Removed the tray icon."); + }, function (err) { + console.log("failure:", err); + }); + // restart + application.restart(function () { + console.log("You will not read this."); + }, function (err) { + console.log("failure:", err); + }); + // schedule restart + application.scheduleRestart(function () { + console.log("You will not read this."); + }, function (err) { + console.log("failure:", err); + }); + // setShortcuts + application.setShortcuts({ + desktop: true, + startMenu: false, + systemStartup: true + }, function () { + console.log("Successfully set new shortcut states"); + }, function (error) { + console.log("Failed to set new shortcut states. Error: ", error); + }); + // setTrayIcon + application.setTrayIcon("https://developer.openf.in/download/openfin.png", function (clickInfo) { + console.log("The mouse has clicked at (" + clickInfo.x + "," + clickInfo.y + ")"); + }); + // terminate + application.terminate(); + // wait + application.addEventListener("not-responding", function () { + console.log("waiting for hung application"); + application.wait(); + }); +} + +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 + let previousCallback = function () { }; + externalApp.removeEventListener('connected', previousCallback, () => { + console.log('The unregistration was successful'); + }, (reason, err) => { + console.log(`Error Message: ${err.message} Error Stack: ${err.stack}`); + }); +} + +function test_inter_application_bus() { + // addSubscribeListener + fin.desktop.InterApplicationBus.addSubscribeListener(function (uuid, topic, name) { + console.log("The application " + uuid + " has subscribed to " + topic); + }); + // addUnsubscribeListener + fin.desktop.InterApplicationBus.addUnsubscribeListener(function (uuid, topic, name) { + console.log("The application " + uuid + " has unsubscribed to " + topic); + }); + // removeSubscribeListener + let aRegisteredListener = function (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", function (message, uuid, name) { + console.log("The application " + uuid + " sent this message: " + message); + }); + // unsubscribe + let aRegisteredMessageListener = function (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', function (event) { + console.log("The monitor information has changed to: ", event); + }, function () { + console.log("The registration was successful"); + }, function (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(function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // downloadAsset + let dirAppAsset = { + 'src': 'http://local:8000/dir.zip', + 'alias': 'dirApp', + 'version': '1.23.24', + 'target': 'dir.bat', + 'args': '' + }; + fin.desktop.System.downloadAsset(dirAppAsset, progress => { + let 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); + }); + // exit + fin.desktop.System.exit(function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // getAllApplications + fin.desktop.System.getAllApplications(function (applicationInfoList) { + applicationInfoList.forEach(function (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(function (windowInfoList) { + windowInfoList.forEach(function (windowInfo) { + console.log("Showing information for application with uuid: ", windowInfo.uuid); + console.log("Main window: ", windowInfo.mainWindow); + console.log("Child windows: ", windowInfo.childWindows); + }); + }); + // getCommandLineArguments + fin.desktop.System.getCommandLineArguments(function (args) { + console.log("The command line arguments are " + args); + }); + // getDeviceId + fin.desktop.System.getDeviceId(function (id) { + console.log("The id of the device is: " + id); + }); + // getEnvironmentVariable + fin.desktop.System.getEnvironmentVariable("APPDATA", function (variable) { + console.log("this is the APPDATA value", variable); + }); + // getLog + fin.desktop.System.getLog('debug-2015-01-08-22-27-53.log', function (log) { + console.log(log); + }); + // getLogList + fin.desktop.System.getLogList(function (logList) { + logList.forEach(function (logInfo) { + console.log("The filename of the log is " + + logInfo.name + ", the size is " + + logInfo.size + ", and the date of creation is " + + logInfo.date); + }); + }); + // getMonitorInfo + fin.desktop.System.getMonitorInfo(function (monitorInfo) { + console.log("This object contains information about all monitors: ", monitorInfo); + }); + // getMousePosition + fin.desktop.System.getMousePosition(function (mousePosition) { + console.log("The mouse is located at left: " + mousePosition.left + ", top: " + mousePosition.top); + }); + // getProcessList + fin.desktop.System.getProcessList(function (list) { + list.forEach(function (process) { + console.log("UUID: " + process.uuid + ", Application Name: " + process.name); + }); + }); + // getProxySettings + fin.desktop.System.getProxySettings(function (proxy) { + console.log(proxy); + }); + // getRvmInfo + fin.desktop.System.getRvmInfo(function (rvmInfoObject) { + console.log("RVM version:", rvmInfoObject.version); + console.log("RVM has been running since:", rvmInfoObject["start-time"]); + }, function (err) { + console.log("Failed to get rvm info, error message:", err); + }); + // getVersion + fin.desktop.System.getVersion(function (version) { + console.log("The version is " + version); + }); + // launchExternalProcess + fin.desktop.System.launchExternalProcess({ + path: "notepad", + arguments: "", + listener: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log('Success:', payload.uuid); + }, function (error) { + console.log('Error:', error); + }); + // + 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: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log('Success:', payload.uuid); + }, function (error) { + console.log('Error:', error); + }); + // + fin.desktop.System.launchExternalProcess({ + alias: "myApp", + arguments: "e f g", + listener: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log('Success:', payload.uuid); + }, function (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: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log('Success:', payload.uuid); + }, function (error) { + console.log('Error:', error); + }); + // log + fin.desktop.System.log("info", "An example log message", function () { + console.log("message successfully logged"); + }, function (err) { + console.log(err); + }); + // monitorExternalProcess + fin.desktop.System.monitorExternalProcess({ + pid: 2508, + listener: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log("The process is now being monitored: ", payload.uuid); + }, function (error) { + console.log("Error:", error); + }); + // openUrlWithBrowser + fin.desktop.System.openUrlWithBrowser("https://developer.openf.in/", function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // registerExternalConnection + fin.desktop.System.registerExternalConnection("remote-connection-uuid", function () { + console.log(arguments); + }); + // releaseExternalProcess + fin.desktop.System.launchExternalProcess({ + path: "notepad", + arguments: "", + listener: function (result) { + console.log("The exit code", result.exitCode); + } + }, function (result) { + console.log("Result UUID is " + result.uuid); + + //release it. + fin.desktop.System.releaseExternalProcess(result.uuid, function () { + console.log("Process has been unmapped!"); + }, function (reason) { + console.log("failure: " + reason); + }); + }); + // removeEventListener + let aRegisteredListener = (event: fin.SystemBaseEvent) => { }; + fin.desktop.System.removeEventListener("monitor-info-changed", aRegisteredListener, function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // showDeveloperTools + fin.desktop.System.showDeveloperTools("uuid", "name", function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // terminateExternalProcess + fin.desktop.System.launchExternalProcess({ + // notepad is in the system’s PATH + path: "notepad", + arguments: "", + listener: function (result) { + console.log("The exit code", result.exitCode); + } + }, function (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, function (info) { + console.log("Termination result " + info.result); + }, function (reason) { + console.log("failure: " + reason); + }); + }); + // updateProxySettings + fin.desktop.System.updateProxySettings("type", "proxyAddress", 8080, function () { + console.log('success'); + }, function (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" + }, function () { + var _win = finWindow.getNativeWindow(); + _win.addEventListener("DOMContentLoaded", function () { finWindow.show(); }); + }, function (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", function (event) { + console.log("The window has been moved or resized"); + }, function () { + console.log("The registration was successful"); + }, function (reason) { + console.log("failure:" + reason); + }); + // animate + finWindow.animate({ + opacity: { + opacity: 0.15, + duration: 1000 + }, + position: { + left: 10, + top: 10, + duration: 3000 + } + }, { + interrupt: false + }, function (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(function (bounds) { + console.log("top: " + bounds.top + + "left: " + bounds.left + + "height: " + bounds.height + + "width: " + bounds.width); + }); + // getOptions + finWindow.getOptions(function (options) { + console.log(options); + }); + // getSnapshot + finWindow.getSnapshot(function (base64Snapshot) { + console.log("data:image/png;base64," + base64Snapshot); + }); + // getState + finWindow.getState(function (state) { + console.log("state: " + state); + }); + // getZoomLevel + finWindow.getZoomLevel(function (level) { + console.log("zoom level: " + level); + }, function (error) { + console.log('error:', error); + }); + // hide + finWindow.hide(); + // isShowing + finWindow.isShowing(function (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 + }, function () { + // 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 + }, function () { + // When finWindow moves or is moved, secondWindow moves by the same amount + secondWindow.joinGroup(finWindow, function () { + //once we are in the group, lets leave it. + secondWindow.leaveGroup(); + }); + }); + // maximize + finWindow.maximize(); + // mergeGroups + { + let finWindowOne = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowOne", + autoShow: true + }); + let finWindowTwo = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowTwo", + autoShow: true + }); + let finWindowThree = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowThree", + autoShow: true + }); + let 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 + let aRegisteredListener = (event: fin.WindowBaseEvent) => { }; + finWindow.removeEventListener("bounds-changed", aRegisteredListener); + // 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 + }); +} \ No newline at end of file diff --git a/openfin/tsconfig.json b/openfin/tsconfig.json new file mode 100644 index 0000000000..8785bdb90f --- /dev/null +++ b/openfin/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "openfin-tests.ts" + ] +} diff --git a/openfin/tslint.json b/openfin/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/openfin/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From b24d2ab7d9003eff940302e77edec81a2375c117 Mon Sep 17 00:00:00 2001 From: Olmo del Corral Date: Thu, 2 Feb 2017 21:14:23 +0100 Subject: [PATCH 002/374] rename language to culture in numbro --- numbro/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numbro/index.d.ts b/numbro/index.d.ts index ccb0892a0d..55234aad81 100644 --- a/numbro/index.d.ts +++ b/numbro/index.d.ts @@ -24,7 +24,7 @@ interface Numbro { (value?: any): Numbro; version: string; isNumbro: boolean; - language(key: string, values?: NumbroLanguage): Numbro; + culture(key: string, values?: NumbroLanguage): Numbro; zeroFormat(format: string): string; clone(): Numbro; format(inputString?: string): string; From d09124c0dadba0706409036d1b2948ee5d08496f Mon Sep 17 00:00:00 2001 From: Olmo del Corral Date: Sun, 5 Feb 2017 20:34:10 +0100 Subject: [PATCH 003/374] remove numbro and add it to notNeededPackages.json --- notNeededPackages.json | 6 ++++++ numbro/index.d.ts | 49 ------------------------------------------ numbro/numbro-tests.ts | 43 ------------------------------------ numbro/tsconfig.json | 22 ------------------- 4 files changed, 6 insertions(+), 114 deletions(-) delete mode 100644 numbro/index.d.ts delete mode 100644 numbro/numbro-tests.ts delete mode 100644 numbro/tsconfig.json diff --git a/notNeededPackages.json b/notNeededPackages.json index e671ef4523..ef4e4f7f85 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -5,6 +5,12 @@ "typingsPackageName": "moment", "sourceRepoURL": "https://github.com/moment/moment", "asOfVersion": "2.13.0" + }, + { + "libraryName": "Numbro", + "typingsPackageName": "numbro", + "sourceRepoURL": "https://github.com/foretagsplatsen/numbro/", + "asOfVersion": "1.9.3" }, { "libraryName": "ng-table", diff --git a/numbro/index.d.ts b/numbro/index.d.ts deleted file mode 100644 index 55234aad81..0000000000 --- a/numbro/index.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Type definitions for Numbro.js -// Project: https://github.com/foretagsplatsen/numbro -// Definitions by: Vincent Bortone -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface NumbroLanguage { - delimiters: { - thousands: string; - decimal: string; - }; - abbreviations: { - thousand: string; - million: string; - billion: string; - trillion: string; - }; - ordinal(num: number): string; - currency: { - symbol: string; - }; -} - -interface Numbro { - (value?: any): Numbro; - version: string; - isNumbro: boolean; - culture(key: string, values?: NumbroLanguage): Numbro; - zeroFormat(format: string): string; - clone(): Numbro; - format(inputString?: string): string; - formatCurrency(inputString?: string): string; - unformat(inputString: string): number; - value(): number; - valueOf(): number; - set (value: any): Numbro; - add(value: any): Numbro; - subtract(value: any): Numbro; - multiply(value: any): Numbro; - divide(value: any): Numbro; - difference(value: any): number; -} - -declare var numbro: Numbro; - -declare module "numbro" { - - export = numbro; - -} diff --git a/numbro/numbro-tests.ts b/numbro/numbro-tests.ts deleted file mode 100644 index 5b5b762353..0000000000 --- a/numbro/numbro-tests.ts +++ /dev/null @@ -1,43 +0,0 @@ - - -var valueFormat: string = numbro(1000).format('0,0'); -// '1,000' - -var valueUnformat: number = numbro().unformat('($10,000.00)'); -// '-10000' - -var value3: Numbro = numbro(1000); -var added: Numbro = value3.add(10); -// 1010 - -var value4: Numbro = numbro(1000); -var formatValue4a: string = value4.format('0,0'); -// '1,000' -var formatValue4b: number = value4.value(); -// 1000 - -var value5: Numbro = numbro(); -value5.set(1000); -var value5Num: number = value5.value(); -// 1000 - -var value6: Numbro = numbro(1000); -var value: number = 100; -var difference = value6.difference(value); -// 900 - -var value7: Numbro = numbro(0); -numbro.zeroFormat('N/A'); -var zeroString: string = value7.format('0.0'); -// 'N/A' - -var a: Numbro = numbro(1000); -var b: Numbro = numbro(a); -var c: Numbro = a.clone(); - -var aVal: number = a.set(2000).value(); -// 2000 -var bVal: number = b.value(); -// 1000 -var cVal: number = c.add(10).value(); -// 1010 diff --git a/numbro/tsconfig.json b/numbro/tsconfig.json deleted file mode 100644 index 4a55ffe0ab..0000000000 --- a/numbro/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "numbro-tests.ts" - ] -} \ No newline at end of file From ec4b986bc8641599b223a79efaebafe196aeb2e8 Mon Sep 17 00:00:00 2001 From: Alexey Svetliakov Date: Tue, 14 Feb 2017 01:49:54 +0100 Subject: [PATCH 004/374] enzyme: return any as state for shallow() and mount() --- enzyme/enzyme-tests.tsx | 14 ++++++++++++++ enzyme/index.d.ts | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/enzyme/enzyme-tests.tsx b/enzyme/enzyme-tests.tsx index 82a8dc9822..c7323766f7 100644 --- a/enzyme/enzyme-tests.tsx +++ b/enzyme/enzyme-tests.tsx @@ -37,6 +37,13 @@ namespace ShallowWrapperTest { elementWrapper: ShallowWrapper, {}>, statelessWrapper: ShallowWrapper; + function test_props_state_inferring() { + let wrapper: ShallowWrapper; + wrapper = shallow(); + wrapper.state().stateProperty; + wrapper.props().stringProp.toUpperCase(); + } + function test_shallow_options() { shallow(, { context: { @@ -337,6 +344,13 @@ namespace ReactWrapperTest { elementWrapper: ReactWrapper, {}>, statelessWrapper: ReactWrapper; + function test_prop_state_inferring() { + let wrapper: ReactWrapper; + wrapper = mount(); + wrapper.state().stateProperty; + wrapper.props().stringProp.toUpperCase(); + } + function test_unmount() { reactWrapper = reactWrapper.unmount(); } diff --git a/enzyme/index.d.ts b/enzyme/index.d.ts index 66c86d1166..184b20ec57 100644 --- a/enzyme/index.d.ts +++ b/enzyme/index.d.ts @@ -541,14 +541,14 @@ export interface MountRendererProps { * @param node * @param [options] */ -export function shallow(node: ReactElement

, options?: ShallowRendererProps): ShallowWrapper; +export function shallow(node: ReactElement

, options?: ShallowRendererProps): ShallowWrapper; /** * Mounts and renders a react component into the document and provides a testing wrapper around it. * @param node * @param [options] */ -export function mount(node: ReactElement

, options?: MountRendererProps): ReactWrapper; +export function mount(node: ReactElement

, options?: MountRendererProps): ReactWrapper; /** * Render react components to static HTML and analyze the resulting HTML structure. From 05031f52cfa8e622af5ce154fe3f5c24e99cd298 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Tue, 14 Feb 2017 10:43:10 +0900 Subject: [PATCH 005/374] Remove definitions for redux-persist (shipped with library), update definitions for transformers --- notNeededPackages.json | 8 ++- redux-persist-transform-compress/index.d.ts | 4 +- redux-persist-transform-compress/package.json | 3 +- .../redux-persist-transform-compress-tests.ts | 8 +-- redux-persist-transform-compress/tslint.json | 3 + redux-persist-transform-encrypt/async.d.ts | 3 + redux-persist-transform-encrypt/index.d.ts | 20 ++---- redux-persist-transform-encrypt/package.json | 3 +- .../redux-persist-transform-encrypt-tests.ts | 12 ++-- redux-persist-transform-encrypt/tsconfig.json | 6 +- redux-persist-transform-encrypt/tslint.json | 3 + .../v0.1/index.d.ts | 18 +++++ .../v0.1}/package.json | 0 .../redux-persist-transform-encrypt-tests.ts | 13 ++++ .../v0.1}/tsconfig.json | 4 +- .../v0.1/tslint.json | 3 + redux-persist-transform-filter/index.d.ts | 4 +- redux-persist-transform-filter/package.json | 3 +- .../redux-persist-transform-filter-tests.ts | 8 +-- redux-persist-transform-filter/tsconfig.json | 6 +- redux-persist-transform-filter/tslint.json | 3 + redux-persist/constants.d.ts | 2 - redux-persist/index.d.ts | 66 ------------------- redux-persist/redux-persist-tests.ts | 53 --------------- redux-persist/storages.d.ts | 4 -- 25 files changed, 94 insertions(+), 166 deletions(-) create mode 100644 redux-persist-transform-compress/tslint.json create mode 100644 redux-persist-transform-encrypt/async.d.ts create mode 100644 redux-persist-transform-encrypt/tslint.json create mode 100644 redux-persist-transform-encrypt/v0.1/index.d.ts rename {redux-persist => redux-persist-transform-encrypt/v0.1}/package.json (100%) create mode 100644 redux-persist-transform-encrypt/v0.1/redux-persist-transform-encrypt-tests.ts rename {redux-persist => redux-persist-transform-encrypt/v0.1}/tsconfig.json (83%) create mode 100644 redux-persist-transform-encrypt/v0.1/tslint.json create mode 100644 redux-persist-transform-filter/tslint.json delete mode 100644 redux-persist/constants.d.ts delete mode 100644 redux-persist/index.d.ts delete mode 100644 redux-persist/redux-persist-tests.ts delete mode 100644 redux-persist/storages.d.ts diff --git a/notNeededPackages.json b/notNeededPackages.json index e671ef4523..5a5e864d72 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -293,6 +293,12 @@ "typingsPackageName": "redux-saga", "sourceRepoURL": "https://github.com/redux-saga/redux-saga", "asOfVersion": "0.10.5" + }, + { + "libraryName": "redux-persist", + "typingsPackageName": "redux-persist", + "sourceRepoURL": "https://github.com/rt2zz/redux-persist", + "asOfVersion": "4.3.1" } ] -} +} \ No newline at end of file diff --git a/redux-persist-transform-compress/index.d.ts b/redux-persist-transform-compress/index.d.ts index 2f8fb7f366..81f472d9ba 100644 --- a/redux-persist-transform-compress/index.d.ts +++ b/redux-persist-transform-compress/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import { PersistConfig, PersistTransformer } from "redux-persist"; +import { PersistorConfig, Transform } from "redux-persist"; export = createCompressor; -declare function createCompressor (config?: PersistConfig): PersistTransformer; +declare function createCompressor(config?: PersistorConfig): Transform; diff --git a/redux-persist-transform-compress/package.json b/redux-persist-transform-compress/package.json index 36ce503807..e5b05e9b76 100644 --- a/redux-persist-transform-compress/package.json +++ b/redux-persist-transform-compress/package.json @@ -1,5 +1,6 @@ { "dependencies": { - "redux": "^3.6.0" + "redux": "^3.6.0", + "redux-persist": "^4.3.1" } } diff --git a/redux-persist-transform-compress/redux-persist-transform-compress-tests.ts b/redux-persist-transform-compress/redux-persist-transform-compress-tests.ts index b445171cb9..9c180e664c 100644 --- a/redux-persist-transform-compress/redux-persist-transform-compress-tests.ts +++ b/redux-persist-transform-compress/redux-persist-transform-compress-tests.ts @@ -1,11 +1,11 @@ import { createStore, Reducer, Store } from "redux" -import { createPersistor, Persistor, PersistTransformer } from "redux-persist" +import { createPersistor, Transform } from "redux-persist" import createCompressor = require("redux-persist-transform-compress") -const reducer: Reducer = (state: any, action: any) => ({}) +const reducer: Reducer = (state: any, action: any) => ({ state, action }) -const compressor: PersistTransformer = createCompressor({ whitelist : ["foo"] }) +const compressor: Transform = createCompressor({ whitelist : ["foo"] }) const store: Store = createStore(reducer) -const persistor: Persistor = createPersistor(store, { transforms : [compressor] }) +createPersistor(store, { transforms : [compressor] }) diff --git a/redux-persist-transform-compress/tslint.json b/redux-persist-transform-compress/tslint.json new file mode 100644 index 0000000000..f9e30021f4 --- /dev/null +++ b/redux-persist-transform-compress/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} diff --git a/redux-persist-transform-encrypt/async.d.ts b/redux-persist-transform-encrypt/async.d.ts new file mode 100644 index 0000000000..68bcb6c3b8 --- /dev/null +++ b/redux-persist-transform-encrypt/async.d.ts @@ -0,0 +1,3 @@ +import createAsyncEncryptor from "redux-persist-transform-encrypt"; + +export default createAsyncEncryptor; diff --git a/redux-persist-transform-encrypt/index.d.ts b/redux-persist-transform-encrypt/index.d.ts index 048f02221f..a3d5dc1750 100644 --- a/redux-persist-transform-encrypt/index.d.ts +++ b/redux-persist-transform-encrypt/index.d.ts @@ -1,18 +1,12 @@ -// Type definitions for redux-persist-transform-encrypt 0.1 -// Project: https://github.com/maxdeviant/redux-persist-transform-encrypt#readme +// Type definitions for redux-persist-transform-encrypt 1.0 +// Project: https://github.com/maxdeviant/redux-persist-transform-encrypt // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import { PersistTransformer } from "redux-persist"; +import { Transform } from "redux-persist"; -export as namespace ReduxPersistEncryptor; - -export = createEncryptor; - -declare function createEncryptor (config: createEncryptor.EncryptorConfig): PersistTransformer; - -declare namespace createEncryptor { - export interface EncryptorConfig { - secretKey: string; - } +export interface EncryptorConfig { + secretKey: string; } + +export default function createEncryptor(config: EncryptorConfig): Transform; diff --git a/redux-persist-transform-encrypt/package.json b/redux-persist-transform-encrypt/package.json index 36ce503807..e5b05e9b76 100644 --- a/redux-persist-transform-encrypt/package.json +++ b/redux-persist-transform-encrypt/package.json @@ -1,5 +1,6 @@ { "dependencies": { - "redux": "^3.6.0" + "redux": "^3.6.0", + "redux-persist": "^4.3.1" } } diff --git a/redux-persist-transform-encrypt/redux-persist-transform-encrypt-tests.ts b/redux-persist-transform-encrypt/redux-persist-transform-encrypt-tests.ts index b3a70dc776..76dc7985bd 100644 --- a/redux-persist-transform-encrypt/redux-persist-transform-encrypt-tests.ts +++ b/redux-persist-transform-encrypt/redux-persist-transform-encrypt-tests.ts @@ -1,13 +1,15 @@ import { createStore, Reducer, Store } from "redux" -import { createPersistor, Persistor, PersistTransformer } from "redux-persist" +import { createPersistor, Transform } from "redux-persist" import { EncryptorConfig } from "redux-persist-transform-encrypt" -import * as createEncryptor from "redux-persist-transform-encrypt" +import createEncryptor from "redux-persist-transform-encrypt" +import createAsyncEncryptor from "redux-persist-transform-encrypt/async" -const reducer: Reducer = (state: any, action: any) => ({}) +const reducer: Reducer = (state: any, action: any) => ({ state, action }) const config: EncryptorConfig = { secretKey : "foo" } -const encryptor: PersistTransformer = createEncryptor(config) +const encryptor: Transform = createEncryptor(config) +const asyncEncryptor: Transform = createAsyncEncryptor(config) const store: Store = createStore(reducer) -const persistor: Persistor = createPersistor(store, { transforms : [encryptor] }) +createPersistor(store, { transforms : [encryptor, asyncEncryptor] }) diff --git a/redux-persist-transform-encrypt/tsconfig.json b/redux-persist-transform-encrypt/tsconfig.json index b0a989e85a..0537c9d89a 100644 --- a/redux-persist-transform-encrypt/tsconfig.json +++ b/redux-persist-transform-encrypt/tsconfig.json @@ -13,10 +13,12 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "noUnusedParameters": true, + "noUnusedLocals": true }, "files": [ "index.d.ts", "redux-persist-transform-encrypt-tests.ts" ] -} \ No newline at end of file +} diff --git a/redux-persist-transform-encrypt/tslint.json b/redux-persist-transform-encrypt/tslint.json new file mode 100644 index 0000000000..f9e30021f4 --- /dev/null +++ b/redux-persist-transform-encrypt/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} diff --git a/redux-persist-transform-encrypt/v0.1/index.d.ts b/redux-persist-transform-encrypt/v0.1/index.d.ts new file mode 100644 index 0000000000..048f02221f --- /dev/null +++ b/redux-persist-transform-encrypt/v0.1/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for redux-persist-transform-encrypt 0.1 +// Project: https://github.com/maxdeviant/redux-persist-transform-encrypt#readme +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { PersistTransformer } from "redux-persist"; + +export as namespace ReduxPersistEncryptor; + +export = createEncryptor; + +declare function createEncryptor (config: createEncryptor.EncryptorConfig): PersistTransformer; + +declare namespace createEncryptor { + export interface EncryptorConfig { + secretKey: string; + } +} diff --git a/redux-persist/package.json b/redux-persist-transform-encrypt/v0.1/package.json similarity index 100% rename from redux-persist/package.json rename to redux-persist-transform-encrypt/v0.1/package.json diff --git a/redux-persist-transform-encrypt/v0.1/redux-persist-transform-encrypt-tests.ts b/redux-persist-transform-encrypt/v0.1/redux-persist-transform-encrypt-tests.ts new file mode 100644 index 0000000000..b3a70dc776 --- /dev/null +++ b/redux-persist-transform-encrypt/v0.1/redux-persist-transform-encrypt-tests.ts @@ -0,0 +1,13 @@ +import { createStore, Reducer, Store } from "redux" +import { createPersistor, Persistor, PersistTransformer } from "redux-persist" +import { EncryptorConfig } from "redux-persist-transform-encrypt" +import * as createEncryptor from "redux-persist-transform-encrypt" + +const reducer: Reducer = (state: any, action: any) => ({}) + +const config: EncryptorConfig = { secretKey : "foo" } +const encryptor: PersistTransformer = createEncryptor(config) + +const store: Store = createStore(reducer) + +const persistor: Persistor = createPersistor(store, { transforms : [encryptor] }) diff --git a/redux-persist/tsconfig.json b/redux-persist-transform-encrypt/v0.1/tsconfig.json similarity index 83% rename from redux-persist/tsconfig.json rename to redux-persist-transform-encrypt/v0.1/tsconfig.json index 53bbe4f198..b0a989e85a 100644 --- a/redux-persist/tsconfig.json +++ b/redux-persist-transform-encrypt/v0.1/tsconfig.json @@ -17,8 +17,6 @@ }, "files": [ "index.d.ts", - "constants.d.ts", - "storages.d.ts", - "redux-persist-tests.ts" + "redux-persist-transform-encrypt-tests.ts" ] } \ No newline at end of file diff --git a/redux-persist-transform-encrypt/v0.1/tslint.json b/redux-persist-transform-encrypt/v0.1/tslint.json new file mode 100644 index 0000000000..f9e30021f4 --- /dev/null +++ b/redux-persist-transform-encrypt/v0.1/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} diff --git a/redux-persist-transform-filter/index.d.ts b/redux-persist-transform-filter/index.d.ts index 19e7779bbd..9619c07df7 100644 --- a/redux-persist-transform-filter/index.d.ts +++ b/redux-persist-transform-filter/index.d.ts @@ -3,6 +3,6 @@ // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import { PersistTransformer } from "redux-persist"; +import { Transform } from "redux-persist"; -export default function createFilter (reducerName: string, inboundPaths?: string[], outboundPaths?: string[]): PersistTransformer; +export default function createFilter(reducerName: string, inboundPaths?: string[], outboundPaths?: string[]): Transform; diff --git a/redux-persist-transform-filter/package.json b/redux-persist-transform-filter/package.json index 36ce503807..e5b05e9b76 100644 --- a/redux-persist-transform-filter/package.json +++ b/redux-persist-transform-filter/package.json @@ -1,5 +1,6 @@ { "dependencies": { - "redux": "^3.6.0" + "redux": "^3.6.0", + "redux-persist": "^4.3.1" } } diff --git a/redux-persist-transform-filter/redux-persist-transform-filter-tests.ts b/redux-persist-transform-filter/redux-persist-transform-filter-tests.ts index a19f7610e4..737e4a70a7 100644 --- a/redux-persist-transform-filter/redux-persist-transform-filter-tests.ts +++ b/redux-persist-transform-filter/redux-persist-transform-filter-tests.ts @@ -1,10 +1,10 @@ import { createStore, Reducer, Store } from "redux" -import { createPersistor, Persistor, PersistTransformer } from "redux-persist" +import { createPersistor, Transform } from "redux-persist" import createFilter from "redux-persist-transform-filter" -const reducer: Reducer = (state: any, action: any) => ({}) +const reducer: Reducer = (state: any, action: any) => ({ state, action }) -const filter: PersistTransformer = createFilter( +const filter: Transform = createFilter( "foo", ["foo.bar"], ["fizz.buzz"] @@ -12,4 +12,4 @@ const filter: PersistTransformer = createFilter( const store: Store = createStore(reducer) -const persistor: Persistor = createPersistor(store, { transforms : [filter] }) +createPersistor(store, { transforms : [filter] }) diff --git a/redux-persist-transform-filter/tsconfig.json b/redux-persist-transform-filter/tsconfig.json index ac08736562..a8f712550c 100644 --- a/redux-persist-transform-filter/tsconfig.json +++ b/redux-persist-transform-filter/tsconfig.json @@ -13,10 +13,12 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "noUnusedParameters": true, + "noUnusedLocals": true }, "files": [ "index.d.ts", "redux-persist-transform-filter-tests.ts" ] -} \ No newline at end of file +} diff --git a/redux-persist-transform-filter/tslint.json b/redux-persist-transform-filter/tslint.json new file mode 100644 index 0000000000..f9e30021f4 --- /dev/null +++ b/redux-persist-transform-filter/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} diff --git a/redux-persist/constants.d.ts b/redux-persist/constants.d.ts deleted file mode 100644 index 93d3249dda..0000000000 --- a/redux-persist/constants.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const KEY_PREFIX: string; -export const REHYDRATE: string; diff --git a/redux-persist/index.d.ts b/redux-persist/index.d.ts deleted file mode 100644 index c8d099d5e6..0000000000 --- a/redux-persist/index.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -// Type definitions for redux-persist 4.0 -// Project: https://github.com/rt2zz/redux-persist -// Definitions by: Karol Janyst -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -import { Action, GenericStoreEnhancer, Store } from "redux"; - -export interface PersistAction extends Action { - payload?: S; - error?: any; -} - -export interface PersistorRehydrateOptions { - serial?: boolean; -} - -export interface Persistor { - purge(keys?: string[]): void; - rehydrate(incoming: A, options?: PersistorRehydrateOptions): A; - pause(): void; - resume(): void; -} - -export type PersistCallback = (err: any, response?: A) => void; - -export interface PersistTransformer { - in(state: any, key: string): any; - out(state: any, key: string): any; -} - -export interface PersistStorage { - setItem(key: string, value: any, callback?: PersistCallback): Promise; - getItem(key: string, callback?: PersistCallback): Promise; - removeItem(key: string, callback?: PersistCallback): Promise; - getAllKeys(callback?: PersistCallback): Promise; - [key: string]: any; -} - -export type PersistStateReconciler = (state: A, inboundState: B, reducedState: C, log?: boolean) => C; - -export interface PersistAutoRehydrateConfig { - stateReconcile?: PersistStateReconciler; -} - -export interface PersistConfig { - whitelist?: string[]; - blacklist?: string[]; - transforms?: PersistTransformer[]; - storage?: PersistStorage; - debounce?: number; - keyPrefix?: string; - serialize?: (data: any) => string; - deserialize?: (data: string) => any; -} - -export function autoRehydrate (config?: PersistAutoRehydrateConfig): GenericStoreEnhancer; - -export function createPersistor (store: Store, config?: PersistConfig): Persistor; - -export function createTransform (inbound: any, outbound: any, config?: PersistConfig): PersistTransformer; - -export function getStoredState(config?: PersistConfig, callback?: PersistCallback): Promise; - -export function persistStore (store: Store, config?: PersistConfig, callback?: PersistCallback): Persistor; - -export function purgeStoredState (config?: PersistConfig, keys?: string[]): Promise; diff --git a/redux-persist/redux-persist-tests.ts b/redux-persist/redux-persist-tests.ts deleted file mode 100644 index 59885a292a..0000000000 --- a/redux-persist/redux-persist-tests.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { createStore, Store, Reducer } from "redux" -import { - autoRehydrate, - createPersistor, - createTransform, - getStoredState, - persistStore, - purgeStoredState, - PersistConfig, - PersistAutoRehydrateConfig, - PersistCallback, - Persistor, - PersistorRehydrateOptions, - PersistTransformer -} from "redux-persist" -import { KEY_PREFIX, REHYDRATE } from "redux-persist/constants" -import { asyncLocalStorage, asyncSessionStorage } from "redux-persist/storages" - -const reducer: Reducer = (state: any, action: any) => ({}) - -const persistCallback: PersistCallback = (err: any, response: any) => {} - -const transform: PersistTransformer = createTransform({}, {}, { whitelist : ["foo"] }) - -const persistConfig: PersistConfig = { - blacklist : ["foo"], - whitelist : ["bar"], - storage : asyncLocalStorage, - transforms : [transform], - debounce : 1000, - keyPrefix : KEY_PREFIX -} - -const rehydrateOptions: PersistorRehydrateOptions = { serial : true } - -const autoRehydrateConfig: PersistAutoRehydrateConfig = { - stateReconcile: (state: any, inboundState: any, reducedState: any, log: boolean) => ({}) -} - -const store: Store = createStore(reducer, autoRehydrate(autoRehydrateConfig)) -const persistor: Persistor = persistStore(store, persistConfig, persistCallback) - -purgeStoredState({ whitelist : ["foo"] }, ["bar"]) - -getStoredState(persistConfig, (err: any, restoredState: any) => { - const store: Store = createStore(reducer, restoredState) - const persistor: Persistor = createPersistor(store, persistConfig) - const secondaryPersistor: Persistor = createPersistor(store, { storage : asyncSessionStorage }) - persistor.pause() - persistor.resume() - persistor.purge(["foo", "bar"]) - persistor.rehydrate(restoredState, rehydrateOptions) -}) diff --git a/redux-persist/storages.d.ts b/redux-persist/storages.d.ts deleted file mode 100644 index b798ed2664..0000000000 --- a/redux-persist/storages.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { PersistStorage } from "redux-persist"; - -export const asyncLocalStorage: PersistStorage; -export const asyncSessionStorage: PersistStorage; From 9f74a96b56fcc20ab52d632a0dfe9be3e3d4a7de Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Thu, 16 Feb 2017 09:15:46 +0900 Subject: [PATCH 006/374] Remove unnecessary definitions for redux-persist-transform-compress, update other redux-persist plugins --- notNeededPackages.json | 6 +++++ redux-persist-transform-compress/index.d.ts | 9 -------- redux-persist-transform-compress/package.json | 6 ----- .../redux-persist-transform-compress-tests.ts | 11 ---------- .../tsconfig.json | 22 ------------------- redux-persist-transform-compress/tslint.json | 3 --- redux-persist-transform-encrypt/package.json | 2 +- redux-persist-transform-filter/package.json | 2 +- 8 files changed, 8 insertions(+), 53 deletions(-) delete mode 100644 redux-persist-transform-compress/index.d.ts delete mode 100644 redux-persist-transform-compress/package.json delete mode 100644 redux-persist-transform-compress/redux-persist-transform-compress-tests.ts delete mode 100644 redux-persist-transform-compress/tsconfig.json delete mode 100644 redux-persist-transform-compress/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 5a5e864d72..07a5acf21c 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -299,6 +299,12 @@ "typingsPackageName": "redux-persist", "sourceRepoURL": "https://github.com/rt2zz/redux-persist", "asOfVersion": "4.3.1" + }, + { + "libraryName": "redux-persist-transform-compress", + "typingsPackageName": "redux-persist-transform-compress", + "sourceRepoURL": "https://github.com/rt2zz/redux-persist-transform-compress", + "asOfVersion": "4.2.0" } ] } \ No newline at end of file diff --git a/redux-persist-transform-compress/index.d.ts b/redux-persist-transform-compress/index.d.ts deleted file mode 100644 index 81f472d9ba..0000000000 --- a/redux-persist-transform-compress/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Type definitions for redux-persist-transform-compress 4.1 -// Project: https://github.com/rt2zz/redux-persist-transform-compress -// Definitions by: Karol Janyst -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -import { PersistorConfig, Transform } from "redux-persist"; - -export = createCompressor; -declare function createCompressor(config?: PersistorConfig): Transform; diff --git a/redux-persist-transform-compress/package.json b/redux-persist-transform-compress/package.json deleted file mode 100644 index e5b05e9b76..0000000000 --- a/redux-persist-transform-compress/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "redux": "^3.6.0", - "redux-persist": "^4.3.1" - } -} diff --git a/redux-persist-transform-compress/redux-persist-transform-compress-tests.ts b/redux-persist-transform-compress/redux-persist-transform-compress-tests.ts deleted file mode 100644 index 9c180e664c..0000000000 --- a/redux-persist-transform-compress/redux-persist-transform-compress-tests.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { createStore, Reducer, Store } from "redux" -import { createPersistor, Transform } from "redux-persist" -import createCompressor = require("redux-persist-transform-compress") - -const reducer: Reducer = (state: any, action: any) => ({ state, action }) - -const compressor: Transform = createCompressor({ whitelist : ["foo"] }) - -const store: Store = createStore(reducer) - -createPersistor(store, { transforms : [compressor] }) diff --git a/redux-persist-transform-compress/tsconfig.json b/redux-persist-transform-compress/tsconfig.json deleted file mode 100644 index 5e33f4960f..0000000000 --- a/redux-persist-transform-compress/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "redux-persist-transform-compress-tests.ts" - ] -} \ No newline at end of file diff --git a/redux-persist-transform-compress/tslint.json b/redux-persist-transform-compress/tslint.json deleted file mode 100644 index f9e30021f4..0000000000 --- a/redux-persist-transform-compress/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../tslint.json" -} diff --git a/redux-persist-transform-encrypt/package.json b/redux-persist-transform-encrypt/package.json index e5b05e9b76..e186771ad7 100644 --- a/redux-persist-transform-encrypt/package.json +++ b/redux-persist-transform-encrypt/package.json @@ -1,6 +1,6 @@ { "dependencies": { "redux": "^3.6.0", - "redux-persist": "^4.3.1" + "redux-persist": "^4.4.0" } } diff --git a/redux-persist-transform-filter/package.json b/redux-persist-transform-filter/package.json index e5b05e9b76..e186771ad7 100644 --- a/redux-persist-transform-filter/package.json +++ b/redux-persist-transform-filter/package.json @@ -1,6 +1,6 @@ { "dependencies": { "redux": "^3.6.0", - "redux-persist": "^4.3.1" + "redux-persist": "^4.4.0" } } From b983469a15b61bf259d37d04de304273dcbdc3ef Mon Sep 17 00:00:00 2001 From: sqwk Date: Thu, 16 Feb 2017 10:12:42 +0100 Subject: [PATCH 007/374] Initial Commit --- lowdb/index.d.ts | 536 +++++++++++++++++++++++++++++++++++++++++++ lowdb/lowdb-tests.ts | 12 + lowdb/tsconfig.json | 23 ++ 3 files changed, 571 insertions(+) create mode 100644 lowdb/index.d.ts create mode 100644 lowdb/lowdb-tests.ts create mode 100644 lowdb/tsconfig.json diff --git a/lowdb/index.d.ts b/lowdb/index.d.ts new file mode 100644 index 0000000000..ddd20e89ed --- /dev/null +++ b/lowdb/index.d.ts @@ -0,0 +1,536 @@ +declare module 'lowdb' { + interface PromiseLike { + + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; + } + + interface StringRepresentable { + toString(): string; + } + + interface List { + [index: number]: T; + length: number; + } + + interface Dictionary { + [index: string]: T; + } + + interface DictionaryIterator { + (value: T, key?: string, collection?: Dictionary): TResult; + } + + interface ListIterator { + (value: T, index: number, collection: List): TResult; + } + + interface StringIterator { + (char: string, index?: number, string?: string): TResult; + } + + interface MixinOptions { + chain?: boolean; + } + + interface LoDashWrapper { + + /** + * @see _.has + */ + has(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; + + /** + * @see _.hasIn + */ + hasIn(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; + + /** + * @see _.assign + */ + assign( + source: TSource + ): LoDashWrapper; + + /** + * @see _.assign + */ + assign( + source1: TSource1, + source2: TSource2 + ): LoDashWrapper; + + /** + * @see _.assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3 + ): LoDashWrapper; + + /** + * @see _.assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4 + ): LoDashWrapper; + + /** + * @see _.assign + */ + assign(): LoDashWrapper; + + /** + * @see _.assign + */ + assign(...otherArgs: any[]): LoDashWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep(): LoDashWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep(): LoDashWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeepWith(customizer: (value: any) => any): LoDashWrapper[]; + + /** + * @see _.cloneDeep + */ + cloneDeepWith(customizer: (value: any) => any): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + ...sources: {}[] + ): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + ...sources: {}[] + ): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + ...sources: {}[] + ): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + source4: S4, + ...sources: {}[] + ): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults(): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults(...sources: {}[]): LoDashWrapper; + + /** + * @see _.get + */ + get(object: Object, + path: string | number | boolean | Array, + defaultValue?: TResult + ): LoDashWrapper; + + /** + * @see _.get + */ + get(path: string | number | boolean | Array, + defaultValue?: TResult + ): LoDashWrapper; + + + /** + * @see _.mixin + */ + mixin( + source: Dictionary, + options?: MixinOptions + ): LoDashWrapper; + + /** + * @see _.mixin + */ + mixin( + options?: MixinOptions + ): LoDashWrapper; + + /** + * @see _.set + */ + set( + path: StringRepresentable | StringRepresentable[], + value: any + ): LoDashWrapper; + + /** + * @see _.set + */ + set( + path: StringRepresentable | StringRepresentable[], + value: V + ): LoDashWrapper; + + /** + * @see _.find + */ + find( + predicate?: ListIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.find + */ + find( + predicate?: string, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.find + */ + find( + predicate?: TObject + ): LoDashWrapper; + + /** + * @see _.find + */ + filter( + predicate?: TObject + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter( + predicate?: ListIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter( + predicate: ListIterator | DictionaryIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter( + predicate?: StringIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashWrapper; + /** + * @see _.map + */ + map( + iteratee?: ListIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashWrapper; + /** + * @see _.map + */ + map( + iteratee?: ListIterator | DictionaryIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.range + */ + range( + end?: number, + step?: number + ): LoDashWrapper; + + /** + * @see _.rangeRight + */ + rangeRight( + end?: number, + step?: number + ): LoDashWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator + ): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(...iteratees: (ListIterator | Object | string)[]): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratees: (ListIterator | string | Object)[]): LoDashWrapper; + + /** + * @see _.slice + */ + slice( + start?: number, + end?: number + ): LoDashWrapper; + + /** + * @see _.size + */ + size(): LoDashWrapper; + + /** + * @see _.take + */ + take(n?: number): LoDashWrapper; + + /** + * @see _.times + */ + times( + iteratee: (num: number) => TResult + ): LoDashWrapper; + + /** + * @see _.times + */ + times(): LoDashWrapper; + + /** + * @see _.uniqueId + */ + uniqueId(): LoDashWrapper; + + value(): T; + + pop(): T; + push(...items: T[]): LoDashWrapper; + shift(): T; + sort(compareFn?: (a: T, b: T) => number): LoDashWrapper; + splice(start: number): LoDashWrapper; + splice(start: number, deleteCount: number, ...items: any[]): LoDashWrapper; + unshift(...items: T[]): LoDashWrapper; + } + + interface Storage { + /** + * Reads the database. + * + * @param source The source location. + * @param deserialize The deserialize function to apply. + * @return Returns a promise with the deserialized db object. + */ + read?(source: string, deserialize: any): PromiseLike + /** + * Reads the database. + * + * @param source The source location. + * @param deserialize The deserialize function to apply. + * @return Returns the deserialized db object. + */ + read?(source: string, deserialize: any): Object + /** + * Writes to the database. + * + * @param destination The destination location. + * @param obj The object to write. + * @param serialize The serialize function to apply. + */ + write?(destination: string, obj: any, serialize: any): void + /** + * Writes to the database. + * + * @param destination The destination location. + * @param obj The object to write. + * @param serialize The serialize function to apply. + */ + write?(destination: string, obj: any, serialize: any): PromiseLike + } + + interface Format { + /** + * Writes to the database. + * + * @param obj The object to serialize. + * @return Returns the serialized object string. + */ + serialize(obj: Object): string + /** + * Writes to the database. + * + * @param data The object to deserialize. + * @return Returns the deserialized object. + */ + deserialize(data: string): Object + } + + interface Options { + /** + * The custom "storage" object. + */ + storage?: Storage + /** + * The custom "format" object. + */ + format?: Format + /** + * The flag to automatically persist changes. + */ + writeOnChange?: boolean + } + + export interface Low extends LoDashWrapper, Format { + /** + * Access current database state. + * Returns Returns the database state. + */ + getState(): Object + /** + * Drop or reset database state. + * @param newState New state of the database + */ + setState(newState: Object): void + /** + * Persist database. + * @param source The source location. + */ + write(source: string): void + /** + * Persist database. + * @param source The source location. + */ + write(source: string): PromiseLike + /** + * Read database. + * @param source The source location. + */ + read(source?: string): Object + /** + * Read database. + * @param source The source location. + */ + read(source?: string): PromiseLike + } + +// declare class lowdb { +// new (source?: string, opts?: Options): Low; +// (source?: string, opts?: Options) : Low; +// } + +// declare module "lowdb" { +// export = lowdb; +// } + +} + diff --git a/lowdb/lowdb-tests.ts b/lowdb/lowdb-tests.ts new file mode 100644 index 0000000000..d656c63b62 --- /dev/null +++ b/lowdb/lowdb-tests.ts @@ -0,0 +1,12 @@ +import Lowdb = require('lowdb'); + +Lowdb +let db = new Lowdb(); + +db.defaults({ 'someObject': {}, 'anotherObject': {} }).value(); + +db.get('someObject').set('foo' , 'bar').value(); +db.get('anotherObject').set('foo' , 'bar').value(); +db.set('singleValue', 'foo').value(); + +console.log(db.getState()); diff --git a/lowdb/tsconfig.json b/lowdb/tsconfig.json new file mode 100644 index 0000000000..4a6104842c --- /dev/null +++ b/lowdb/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "lowdb-tests.ts" + ] +} \ No newline at end of file From 3479affcfe6394800fc3562be7461552c3ed1326 Mon Sep 17 00:00:00 2001 From: Yuya Tanaka Date: Wed, 15 Feb 2017 03:06:14 +0900 Subject: [PATCH 008/374] react: Fix SVGAttributes contains all HTMLAttributes --- react/index.d.ts | 21 +++++++++++++++++++-- react/test/index.ts | 3 +++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/react/index.d.ts b/react/index.d.ts index b2be91bf62..61b282dfc7 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -2203,7 +2203,25 @@ declare namespace React { // - "number | string" // - "string" // - union of string literals - interface SVGAttributes extends HTMLAttributes { + interface SVGAttributes extends DOMAttributes { + // Attributes which also defined in HTMLAttributes + // See comment in SVGDOMPropertyConfig.js + className?: string; + color?: string; + height?: number | string; + id?: string; + lang?: string; + max?: number | string; + media?: string; + method?: string; + min?: number | string; + name?: string; + style?: CSSProperties; + target?: string; + type?: string; + width?: number | string; + + // SVG Specific attributes accentHeight?: number | string; accumulate?: "none" | "sum"; additive?: "replace" | "sum"; @@ -2396,7 +2414,6 @@ declare namespace React { textRendering?: number | string; to?: number | string; transform?: string; - type?: string; u1?: number | string; u2?: number | string; underlinePosition?: number | string; diff --git a/react/test/index.ts b/react/test/index.ts index 4b00e988bf..702f1632c9 100644 --- a/react/test/index.ts +++ b/react/test/index.ts @@ -341,6 +341,9 @@ React.DOM.svg({ xmlns: "http://www.w3.org/2000/svg" }, React.DOM.rect({ + className: 'foobar', + id: 'foo', + color: 'black', x: 22, y: 10, width: 4, From a302f69580ad40511c18a61d5e8bcbdabcf4f16a Mon Sep 17 00:00:00 2001 From: Yuya Tanaka Date: Wed, 15 Feb 2017 04:30:20 +0900 Subject: [PATCH 009/374] react: Add type parameter to SVGProps --- react/index.d.ts | 108 +++++++++++++++++++++++------------------------ 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/react/index.d.ts b/react/index.d.ts index 61b282dfc7..867e066c7e 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -437,7 +437,7 @@ declare namespace React { interface ChangeTargetHTMLProps extends ChangeTargetHTMLAttributes, ClassAttributes { } - interface SVGProps extends SVGAttributes, ClassAttributes { + interface SVGProps extends SVGAttributes, ClassAttributes { } interface DOMAttributes { @@ -2810,60 +2810,60 @@ declare global { wbr: React.HTMLProps; // SVG - svg: React.SVGProps; + svg: React.SVGProps; - circle: React.SVGProps; - clipPath: React.SVGProps; - defs: React.SVGProps; - desc: React.SVGProps; - ellipse: React.SVGProps; - feBlend: React.SVGProps; - feColorMatrix: React.SVGProps; - feComponentTransfer: React.SVGProps; - feComposite: React.SVGProps; - feConvolveMatrix: React.SVGProps; - feDiffuseLighting: React.SVGProps; - feDisplacementMap: React.SVGProps; - feDistantLight: React.SVGProps; - feFlood: React.SVGProps; - feFuncA: React.SVGProps; - feFuncB: React.SVGProps; - feFuncG: React.SVGProps; - feFuncR: React.SVGProps; - feGaussianBlur: React.SVGProps; - feImage: React.SVGProps; - feMerge: React.SVGProps; - feMergeNode: React.SVGProps; - feMorphology: React.SVGProps; - feOffset: React.SVGProps; - fePointLight: React.SVGProps; - feSpecularLighting: React.SVGProps; - feSpotLight: React.SVGProps; - feTile: React.SVGProps; - feTurbulence: React.SVGProps; - filter: React.SVGProps; - foreignObject: React.SVGProps; - g: React.SVGProps; - image: React.SVGProps; - line: React.SVGProps; - linearGradient: React.SVGProps; - marker: React.SVGProps; - mask: React.SVGProps; - metadata: React.SVGProps; - path: React.SVGProps; - pattern: React.SVGProps; - polygon: React.SVGProps; - polyline: React.SVGProps; - radialGradient: React.SVGProps; - rect: React.SVGProps; - stop: React.SVGProps; - switch: React.SVGProps; - symbol: React.SVGProps; - text: React.SVGProps; - textPath: React.SVGProps; - tspan: React.SVGProps; - use: React.SVGProps; - view: React.SVGProps; + circle: React.SVGProps; + clipPath: React.SVGProps; + defs: React.SVGProps; + desc: React.SVGProps; + ellipse: React.SVGProps; + feBlend: React.SVGProps; + feColorMatrix: React.SVGProps; + feComponentTransfer: React.SVGProps; + feComposite: React.SVGProps; + feConvolveMatrix: React.SVGProps; + feDiffuseLighting: React.SVGProps; + feDisplacementMap: React.SVGProps; + feDistantLight: React.SVGProps; + feFlood: React.SVGProps; + feFuncA: React.SVGProps; + feFuncB: React.SVGProps; + feFuncG: React.SVGProps; + feFuncR: React.SVGProps; + feGaussianBlur: React.SVGProps; + feImage: React.SVGProps; + feMerge: React.SVGProps; + feMergeNode: React.SVGProps; + feMorphology: React.SVGProps; + feOffset: React.SVGProps; + fePointLight: React.SVGProps; + feSpecularLighting: React.SVGProps; + feSpotLight: React.SVGProps; + feTile: React.SVGProps; + feTurbulence: React.SVGProps; + filter: React.SVGProps; + foreignObject: React.SVGProps; + g: React.SVGProps; + image: React.SVGProps; + line: React.SVGProps; + linearGradient: React.SVGProps; + marker: React.SVGProps; + mask: React.SVGProps; + metadata: React.SVGProps; + path: React.SVGProps; + pattern: React.SVGProps; + polygon: React.SVGProps; + polyline: React.SVGProps; + radialGradient: React.SVGProps; + rect: React.SVGProps; + stop: React.SVGProps; + switch: React.SVGProps; + symbol: React.SVGProps; + text: React.SVGProps; + textPath: React.SVGProps; + tspan: React.SVGProps; + use: React.SVGProps; + view: React.SVGProps; } } } From a7ffc449a43f2ac89a4ee2a57f625663abbb9ba3 Mon Sep 17 00:00:00 2001 From: morrisjdev Date: Sun, 19 Feb 2017 21:26:34 +0100 Subject: [PATCH 010/374] Added declarations for 'linq4js' --- linq4js/index.d.ts | 286 +++++++++++++++++++++++++++++++++++++++ linq4js/linq4js-tests.ts | 5 + linq4js/tsconfig.json | 22 +++ 3 files changed, 313 insertions(+) create mode 100644 linq4js/index.d.ts create mode 100644 linq4js/linq4js-tests.ts create mode 100644 linq4js/tsconfig.json diff --git a/linq4js/index.d.ts b/linq4js/index.d.ts new file mode 100644 index 0000000000..6b98907453 --- /dev/null +++ b/linq4js/index.d.ts @@ -0,0 +1,286 @@ +// Type definitions for Linq4JS 2.0.3 +// Project: https://github.com/morrisjdev/Linq4JS +// Definitions by: Morris Janatzek +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace Linq4JS { + class GeneratedEntity { + _GeneratedId_: number; + Id: number; + } +} +declare namespace Linq4JS { + class Helper { + static ConvertStringFunction: (functionString: string) => any; + static ConvertFunction: (testFunction: any) => T; + static OrderCompareFunction: (valueSelector: (item: T) => any, a: T, b: T, invert: boolean) => number; + } +} +interface Array { + Order: Array; + GroupValue: any; + /** + * Creates a copy of the array + */ + Clone(): Array; + /** + * Gets the index of the first item found by a filter + * @param filter A function (or function-string) that returns a boolean when matching element was found + */ + FindIndex(filter: ((item: T) => boolean) | string): number; + /** + * Gets the index of the last item found by a filter + * @param filter A function (or function-string) that returns a boolean when matching element was found + */ + FindLastIndex(filter: ((item: T) => boolean) | string): number; + /** + * Gets the item with the index + * @param index Item index + */ + Get(index: number): T; + /** + * Executes a method for each item in the array + * @param action A function (or function-string) that gets executed for each element. If it returns false the loop stops. + */ + ForEach(action: ((item: T, index?: number) => boolean | any) | string): Array; + /** + * Updates an object in the array + * @param object The object to update + * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array + */ + Update(object: T, primaryKeySelector?: ((item: T) => any) | string): Array; + /** + * Updates objects in the array + * @param objects The array of objects to update + * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array + */ + UpdateRange(objects: Array, primaryKeySelector?: ((item: T) => any) | string): Array; + /** + * Removes an object from the array + * @param object The object to remove + * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array + */ + Remove(object: T, primaryKeySelector?: ((item: T) => any) | string): Array; + /** + * Removes objects from the array + * @param objects The array of objects to remove + * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array + */ + RemoveRange(objects: Array, primaryKeySelector?: ((item: T) => any) | string): Array; + /** + * Adds an object to the array + * @param object The object to add + * @param generateId Auto-generate a property to identify object in later processes + */ + Add(object: T, generateId?: boolean): Array; + /** + * Adds objects to the array + * @param objects The array of objects to add + */ + AddRange(objects: Array, generateId?: boolean): Array; + /** + * Inserts an entry at a specific position + * @param object The object to insert + * @param index The position to insert + */ + Insert(object: T, index: number): Array; + /** + * Searches for all items in array that match the given filter + * @param filter A function (or function-string) that returns a boolean when matching element was found + */ + Where(filter: ((item: T, index?: number) => boolean) | string): Array; + /** + * Takes items in a specific range + * @param start The start position + * @param length The number of elements to take + */ + Range(start: number, length: number): Array; + /** + * Repeats an object in the array + * @param object The object to repeat + * @param count The count of repeats + */ + Repeat(object: T, count: number): Array; + /** + * Returns the length of the array + * @param filter If set the function returns count of elements matched by the condition + */ + Count(filter?: ((item: T) => boolean) | string): number; + /** + * Tests if all items in the array match the condition + * @param filter A function (or function-string) that returns a boolean when matching element was found + */ + All(filter: ((item: T) => boolean) | string): boolean; + /** + * Tests if any item is in the array + * @param filter If set the function tests if any item in the array matches the condition + */ + Any(filter?: ((item: T) => boolean) | string): boolean; + /** + * Returns the first item of the array - Throws an exception if no item was found + * @param filter If set the function returns the first item that matches the filter + */ + First(filter?: ((item: T) => boolean) | string): T; + /** + * Returns the first item of the array - returns `null` if no suitable item was found + * @param filter If set the function returns the first item that matches the filter + */ + FirstOrDefault(filter?: ((item: T) => boolean) | string): (T | null); + /** + * Returns the last item of the array - Throws an exception if no item was found + * @param filter If set the function returns the last item that matches the filter + */ + Last(filter?: ((item: T) => boolean) | string): T; + /** + * Returns the last item of the array - returns `null` if no suitable item was found + * @param filter If set the function returns the last item that matches the filter + */ + LastOrDefault(filter?: ((item: T) => boolean) | string): (T | null); + /** + * Select the properties for a new array + * @param selector A function (or a function-string) that returns a new object + */ + Select(selector: ((item: T) => any) | string): any[]; + /** + * Limits the number of entries taken + * @param count The count of elements taken + */ + Take(count: number): Array; + /** + * Takes entries as long as a condition is true + * @param condition The condition-function (or function-string) that returns a boolean. All elements until a false gets created are taken + * @param initial A initial-function (or function-string) that gets executed once at the start of the loop + * @param after A function that gets executed after every element-iteration after the condition-function was evaluated + */ + TakeWhile(condition: ((item: T, storage?: any) => boolean) | string, initial?: ((storage: any) => void) | string, after?: ((item: T, storage: any) => void) | string): Array; + /** + * Skips entries + * @param count The count of elements skipped + */ + Skip(count: number): Array; + /** + * Orders array by property or value in ascending direction + * @param valueSelector The selector-function (or function-string) that selects the property for sorting + */ + OrderBy(valueSelector: ((item: T) => any) | string): Array; + /** + * Orders array by additional properties in ascending direction in combination with OrderBy/OrderByDescending + * @param valueSelector The selector-function (or function-string) that selects the property for sorting + */ + ThenBy(valueSelector: ((item: T) => any) | string): Array; + /** + * Orders array by property or value in descending direction + * @param valueSelector The selector-function (or function-string) that selects the property for sorting + */ + OrderByDescending(valueSelector: ((item: T) => any) | string): Array; + /** + * Orders array by additional properties in descending direction in combination with OrderBy/OrderByDescending + * @param valueSelector The selector-function (or function-string) that selects the property for sorting + */ + ThenByDescending(valueSelector: ((item: T) => any) | string): Array; + /** + * Returns the smallest element in array + * @param valueSelector The selector-function (or function-string) that selects the property for comparison + */ + Min(valueSelector?: ((item: T) => any) | string): (T | null); + /** + * Returns the greates element in array + * @param valueSelector The selector-function (or function-string) that selects the property for comparison + */ + Max(valueSelector?: ((item: T) => any) | string): (T | null); + /** + * Groups array by property + * @param selector The selector-function (or function-string) that selects the property for grouping + */ + GroupBy(selector: ((item: T) => any) | string): Array>; + /** + * Moves an item from one index to another + * @param oldIndex The current position of the item + * @param newIndex The new position of the item + */ + Move(oldIndex: number, newIndex: number): Array; + /** + * Makes all values unique + * @param valueSelector A selector-function (or function-string) to select property for comparison and distinction + */ + Distinct(valueSelector?: ((item: T) => any) | string): Array; + /** + * Tests if array contains specific object + * @param object The object to test for + */ + Contains(object: T): boolean; + /** + * Combines two arrays + * @param array The array to combine + */ + Concat(array: Array): Array; + /** + * Combines two arrays but only applies values that are in both arrays + * @param array The array to combine + */ + Intersect(array: Array): Array; + /** + * Joins the entries by a given char + * @param character The character for joining + * @param selector A selector-function (or function-string) to select property for joining + */ + Join(character: string, selector?: ((item: T) => any) | string): string; + /** + * Combines the entries using a custom function + * @param method A function (or function-string) for aggregation + * @param startVal The value to start aggregation + */ + Aggregate(method: ((result: any, item: T) => any) | string, startVal?: any): string; + /** + * Reverses the array + */ + Reverse(): Array; + /** + * Computes the average of the elements + * @param selector A selector-function (or function-string) to select property for average computing + * @param filter If set the function computes the average of elements that match the filter + */ + Average(selector?: ((item: T) => any) | string, filter?: ((item: T) => boolean) | string): number; + /** + * Computes the sum of the elements + * @param selector A selector-function (or function-string) to select property for adding + * @param filter If set the function computes the sum of elements that match the filter + */ + Sum(selector?: ((item: T) => any) | string, filter?: ((item: T) => boolean) | string): number; + /** + * Compares to sequences of objects + * @param array The array to compare + */ + SequenceEqual(array: Array): boolean; + /** + * Combines the entries of two arrays using a custom function + * @param array The array to combine + * @param result The function (or function-string) to combine elements + */ + Zip(array: Array, result: ((first: T, second: X) => any) | string): Array; + /** + * Combines two arrays without duplicates + * @param array The array to combine + */ + Union(array: Array): Array; + /** + * Converts the array to a dictionary + * @param keySelector The selector-function (or function-string) to select property for key + * @param valueSelector A selector-function (or function-string) to select property for value + */ + ToDictionary(keySelector: ((item: T) => any) | string, valueSelector?: ((item: T) => any) | string): any; +} +declare module "linq4js" { + export = Linq4JS; +} +declare namespace Linq4JS { + class OrderEntry { + Direction: OrderDirection; + ValueSelector: (item: any) => any; + constructor(_direction: OrderDirection, _valueSelector: (item: any) => any); + } + enum OrderDirection { + Ascending = 0, + Descending = 1, + } +} diff --git a/linq4js/linq4js-tests.ts b/linq4js/linq4js-tests.ts new file mode 100644 index 0000000000..6d15649c2c --- /dev/null +++ b/linq4js/linq4js-tests.ts @@ -0,0 +1,5 @@ +import * as linq from "linq4js"; + +let array: Array = ["test", "test2", "test3", "test4", "test5"]; + +array.Add("test6").Remove("test3").Insert("test3", 2).Distinct().OrderBy(x => x).OrderByDescending(x => x).Select(x => x.length).Average(); \ No newline at end of file diff --git a/linq4js/tsconfig.json b/linq4js/tsconfig.json new file mode 100644 index 0000000000..fa4dac9326 --- /dev/null +++ b/linq4js/tsconfig.json @@ -0,0 +1,22 @@ +{ + "files": [ + "index.d.ts", + "linq4js-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "strictNullChecks": true, + "alwaysStrict": true, + "target": "es6", + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file From a8a54caf2fa90399a14615348e90d4807e2604ad Mon Sep 17 00:00:00 2001 From: morrisjdev Date: Sun, 19 Feb 2017 22:02:31 +0100 Subject: [PATCH 011/374] fixed lint --- linq4js/index.d.ts | 65 +++++++++++++++++++++------------------------ linq4js/tslint.json | 1 + 2 files changed, 32 insertions(+), 34 deletions(-) create mode 100644 linq4js/tslint.json diff --git a/linq4js/index.d.ts b/linq4js/index.d.ts index 6b98907453..4fe054d5fc 100644 --- a/linq4js/index.d.ts +++ b/linq4js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Linq4JS 2.0.3 +// Type definitions for Linq4JS 2.0 // Project: https://github.com/morrisjdev/Linq4JS // Definitions by: Morris Janatzek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -17,12 +17,12 @@ declare namespace Linq4JS { } } interface Array { - Order: Array; + Order: Linq4JS.OrderEntry[]; GroupValue: any; /** * Creates a copy of the array */ - Clone(): Array; + Clone(): T[]; /** * Gets the index of the first item found by a filter * @param filter A function (or function-string) that returns a boolean when matching element was found @@ -42,65 +42,65 @@ interface Array { * Executes a method for each item in the array * @param action A function (or function-string) that gets executed for each element. If it returns false the loop stops. */ - ForEach(action: ((item: T, index?: number) => boolean | any) | string): Array; + ForEach(action: ((item: T, index?: number) => boolean | any) | string): T[]; /** * Updates an object in the array * @param object The object to update * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array */ - Update(object: T, primaryKeySelector?: ((item: T) => any) | string): Array; + Update(object: T, primaryKeySelector?: ((item: T) => any) | string): T[]; /** * Updates objects in the array * @param objects The array of objects to update * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array */ - UpdateRange(objects: Array, primaryKeySelector?: ((item: T) => any) | string): Array; + UpdateRange(objects: T[], primaryKeySelector?: ((item: T) => any) | string): T[]; /** * Removes an object from the array * @param object The object to remove * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array */ - Remove(object: T, primaryKeySelector?: ((item: T) => any) | string): Array; + Remove(object: T, primaryKeySelector?: ((item: T) => any) | string): T[]; /** * Removes objects from the array * @param objects The array of objects to remove * @param primaryKeySelector A selector-function (or function-string) to define a property to indentify object in array */ - RemoveRange(objects: Array, primaryKeySelector?: ((item: T) => any) | string): Array; + RemoveRange(objects: T[], primaryKeySelector?: ((item: T) => any) | string): T[]; /** * Adds an object to the array * @param object The object to add * @param generateId Auto-generate a property to identify object in later processes */ - Add(object: T, generateId?: boolean): Array; + Add(object: T, generateId?: boolean): T[]; /** * Adds objects to the array * @param objects The array of objects to add */ - AddRange(objects: Array, generateId?: boolean): Array; + AddRange(objects: T[], generateId?: boolean): T[]; /** * Inserts an entry at a specific position * @param object The object to insert * @param index The position to insert */ - Insert(object: T, index: number): Array; + Insert(object: T, index: number): T[]; /** * Searches for all items in array that match the given filter * @param filter A function (or function-string) that returns a boolean when matching element was found */ - Where(filter: ((item: T, index?: number) => boolean) | string): Array; + Where(filter: ((item: T, index?: number) => boolean) | string): T[]; /** * Takes items in a specific range * @param start The start position * @param length The number of elements to take */ - Range(start: number, length: number): Array; + Range(start: number, length: number): T[]; /** * Repeats an object in the array * @param object The object to repeat * @param count The count of repeats */ - Repeat(object: T, count: number): Array; + Repeat(object: T, count: number): T[]; /** * Returns the length of the array * @param filter If set the function returns count of elements matched by the condition @@ -145,39 +145,39 @@ interface Array { * Limits the number of entries taken * @param count The count of elements taken */ - Take(count: number): Array; + Take(count: number): T[]; /** * Takes entries as long as a condition is true * @param condition The condition-function (or function-string) that returns a boolean. All elements until a false gets created are taken * @param initial A initial-function (or function-string) that gets executed once at the start of the loop * @param after A function that gets executed after every element-iteration after the condition-function was evaluated */ - TakeWhile(condition: ((item: T, storage?: any) => boolean) | string, initial?: ((storage: any) => void) | string, after?: ((item: T, storage: any) => void) | string): Array; + TakeWhile(condition: ((item: T, storage?: any) => boolean) | string, initial?: ((storage: any) => void) | string, after?: ((item: T, storage: any) => void) | string): T[]; /** * Skips entries * @param count The count of elements skipped */ - Skip(count: number): Array; + Skip(count: number): T[]; /** * Orders array by property or value in ascending direction * @param valueSelector The selector-function (or function-string) that selects the property for sorting */ - OrderBy(valueSelector: ((item: T) => any) | string): Array; + OrderBy(valueSelector: ((item: T) => any) | string): T[]; /** * Orders array by additional properties in ascending direction in combination with OrderBy/OrderByDescending * @param valueSelector The selector-function (or function-string) that selects the property for sorting */ - ThenBy(valueSelector: ((item: T) => any) | string): Array; + ThenBy(valueSelector: ((item: T) => any) | string): T[]; /** * Orders array by property or value in descending direction * @param valueSelector The selector-function (or function-string) that selects the property for sorting */ - OrderByDescending(valueSelector: ((item: T) => any) | string): Array; + OrderByDescending(valueSelector: ((item: T) => any) | string): T[]; /** * Orders array by additional properties in descending direction in combination with OrderBy/OrderByDescending * @param valueSelector The selector-function (or function-string) that selects the property for sorting */ - ThenByDescending(valueSelector: ((item: T) => any) | string): Array; + ThenByDescending(valueSelector: ((item: T) => any) | string): T[]; /** * Returns the smallest element in array * @param valueSelector The selector-function (or function-string) that selects the property for comparison @@ -192,18 +192,18 @@ interface Array { * Groups array by property * @param selector The selector-function (or function-string) that selects the property for grouping */ - GroupBy(selector: ((item: T) => any) | string): Array>; + GroupBy(selector: ((item: T) => any) | string): T[][]; /** * Moves an item from one index to another * @param oldIndex The current position of the item * @param newIndex The new position of the item */ - Move(oldIndex: number, newIndex: number): Array; + Move(oldIndex: number, newIndex: number): T[]; /** * Makes all values unique * @param valueSelector A selector-function (or function-string) to select property for comparison and distinction */ - Distinct(valueSelector?: ((item: T) => any) | string): Array; + Distinct(valueSelector?: ((item: T) => any) | string): T[]; /** * Tests if array contains specific object * @param object The object to test for @@ -213,12 +213,12 @@ interface Array { * Combines two arrays * @param array The array to combine */ - Concat(array: Array): Array; + Concat(array: T[]): T[]; /** * Combines two arrays but only applies values that are in both arrays * @param array The array to combine */ - Intersect(array: Array): Array; + Intersect(array: T[]): T[]; /** * Joins the entries by a given char * @param character The character for joining @@ -234,7 +234,7 @@ interface Array { /** * Reverses the array */ - Reverse(): Array; + Reverse(): T[]; /** * Computes the average of the elements * @param selector A selector-function (or function-string) to select property for average computing @@ -251,18 +251,18 @@ interface Array { * Compares to sequences of objects * @param array The array to compare */ - SequenceEqual(array: Array): boolean; + SequenceEqual(array: T[]): boolean; /** * Combines the entries of two arrays using a custom function * @param array The array to combine * @param result The function (or function-string) to combine elements */ - Zip(array: Array, result: ((first: T, second: X) => any) | string): Array; + Zip(array: X[], result: ((first: T, second: X) => any) | string): any[]; /** * Combines two arrays without duplicates * @param array The array to combine */ - Union(array: Array): Array; + Union(array: T[]): T[]; /** * Converts the array to a dictionary * @param keySelector The selector-function (or function-string) to select property for key @@ -270,9 +270,6 @@ interface Array { */ ToDictionary(keySelector: ((item: T) => any) | string, valueSelector?: ((item: T) => any) | string): any; } -declare module "linq4js" { - export = Linq4JS; -} declare namespace Linq4JS { class OrderEntry { Direction: OrderDirection; @@ -283,4 +280,4 @@ declare namespace Linq4JS { Ascending = 0, Descending = 1, } -} +} \ No newline at end of file diff --git a/linq4js/tslint.json b/linq4js/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/linq4js/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 0b19c9cf595d7db45f437e035c762addf99f975e Mon Sep 17 00:00:00 2001 From: morrisjdev Date: Sun, 19 Feb 2017 22:03:08 +0100 Subject: [PATCH 012/374] fixed version --- linq4js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linq4js/index.d.ts b/linq4js/index.d.ts index 4fe054d5fc..e108f31a4c 100644 --- a/linq4js/index.d.ts +++ b/linq4js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Linq4JS 2.0 +// Type definitions for Linq4JS 2.1 // Project: https://github.com/morrisjdev/Linq4JS // Definitions by: Morris Janatzek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 36a25dcc742b344e98372f9cff9efadc02f2648c Mon Sep 17 00:00:00 2001 From: morrisjdev Date: Sun, 19 Feb 2017 22:19:41 +0100 Subject: [PATCH 013/374] fixed tsconfig.json --- linq4js/linq4js-tests.ts | 2 +- linq4js/tsconfig.json | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/linq4js/linq4js-tests.ts b/linq4js/linq4js-tests.ts index 6d15649c2c..9e0bbe7be5 100644 --- a/linq4js/linq4js-tests.ts +++ b/linq4js/linq4js-tests.ts @@ -1,4 +1,4 @@ -import * as linq from "linq4js"; +import "linq4js"; let array: Array = ["test", "test2", "test3", "test4", "test5"]; diff --git a/linq4js/tsconfig.json b/linq4js/tsconfig.json index fa4dac9326..2c6f199057 100644 --- a/linq4js/tsconfig.json +++ b/linq4js/tsconfig.json @@ -16,6 +16,9 @@ "../" ], "types": [], + "lib":[ + "es6" + ], "noEmit": true, "forceConsistentCasingInFileNames": true } From 32b84dfb0bb755753ed03a3cafb809cffac2426b Mon Sep 17 00:00:00 2001 From: morrisjdev Date: Sun, 19 Feb 2017 22:25:18 +0100 Subject: [PATCH 014/374] tsconfig.json fix 2 --- linq4js/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/linq4js/tsconfig.json b/linq4js/tsconfig.json index 2c6f199057..f053fa2e23 100644 --- a/linq4js/tsconfig.json +++ b/linq4js/tsconfig.json @@ -9,7 +9,6 @@ "noImplicitReturns": true, "noImplicitThis": true, "strictNullChecks": true, - "alwaysStrict": true, "target": "es6", "baseUrl": "../", "typeRoots": [ From 525ba9bf9cc9f497b1b5cf19438e26361f672feb Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Mon, 20 Feb 2017 13:58:02 +0900 Subject: [PATCH 015/374] Add missing file --- redux-persist-transform-encrypt/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/redux-persist-transform-encrypt/tsconfig.json b/redux-persist-transform-encrypt/tsconfig.json index 0537c9d89a..e101982e56 100644 --- a/redux-persist-transform-encrypt/tsconfig.json +++ b/redux-persist-transform-encrypt/tsconfig.json @@ -18,6 +18,7 @@ "noUnusedLocals": true }, "files": [ + "async.d.ts", "index.d.ts", "redux-persist-transform-encrypt-tests.ts" ] From d8edccd12a27b614e78d88342edde56379963ee8 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Mon, 20 Feb 2017 03:11:11 +0000 Subject: [PATCH 016/374] Initial commit for v17 of openfin api --- openfin/index.d.ts | 45 +- openfin/openfin-tests.ts | 6 +- openfin/v16/index.d.ts | 1581 ++++++++++++++++++++++++++++++++++ openfin/v16/openfin-tests.ts | 724 ++++++++++++++++ openfin/v16/tsconfig.json | 25 + openfin/v16/tslint.json | 1 + 6 files changed, 2373 insertions(+), 9 deletions(-) create mode 100644 openfin/v16/index.d.ts create mode 100644 openfin/v16/openfin-tests.ts create mode 100644 openfin/v16/tsconfig.json create mode 100644 openfin/v16/tslint.json diff --git a/openfin/index.d.ts b/openfin/index.d.ts index 2c1cfd648e..893a253606 100644 --- a/openfin/index.d.ts +++ b/openfin/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for OpenFin API 16.0 +// Type definitions for OpenFin API 17.0 // Project: https://openfin.co/ // Definitions by: Chris Barker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// based on v6.49.16.16 +// based on v6.49.17.14 // see https://openfin.co/support/technical-faq/#what-do-the-numbers-in-the-runtime-version-mean /** @@ -63,7 +63,7 @@ declare namespace fin { */ 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. + * 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; /** @@ -82,6 +82,10 @@ declare namespace fin { * 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; /** * Determines if the application is currently running. */ @@ -95,7 +99,7 @@ declare namespace fin { */ 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. + * Removes the application�s icon from the tray. */ removeTrayIcon(callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -185,10 +189,13 @@ declare namespace fin { */ accelerator?: { devtools?: boolean, - zoom?: 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; /** @@ -197,10 +204,12 @@ declare namespace fin { 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; @@ -232,30 +241,37 @@ declare namespace fin { 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; /** @@ -272,14 +288,17 @@ declare namespace fin { 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?: { /** @@ -989,7 +1008,7 @@ declare namespace fin { bringToFront(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Closes the window. - * @param {force} Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window. + * @param {force} 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; /** @@ -1009,7 +1028,7 @@ declare namespace fin { */ enableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Flashes the window’s frame and taskbar icon until the window is activated. + * Flashes the window�s frame and taskbar icon until the window is activated. */ flash(options?: any, callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -1106,7 +1125,7 @@ declare namespace fin { setZoomLevel(level: number, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Shows the window if it is hidden. - * @param {force} Show will be prevented from closing when force is false and ‘show-requested’ has been subscribed to for application’s main window. + * @param {force} 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; /** @@ -1500,6 +1519,16 @@ 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" diff --git a/openfin/openfin-tests.ts b/openfin/openfin-tests.ts index 81ac24f937..ae5fe587d3 100644 --- a/openfin/openfin-tests.ts +++ b/openfin/openfin-tests.ts @@ -1,6 +1,6 @@ function test_application() { let application: fin.OpenFinApplication; - // constructor + // constructor application = new fin.desktop.Application({ url: "application.html", uuid: "74BED629-2D8E-4141-8582-73E364BDFA74", @@ -69,6 +69,10 @@ 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}`); + }); // isRunning application.isRunning(function (running) { console.log("the application is", running ? "running" : "not running"); diff --git a/openfin/v16/index.d.ts b/openfin/v16/index.d.ts new file mode 100644 index 0000000000..2c1cfd648e --- /dev/null +++ b/openfin/v16/index.d.ts @@ -0,0 +1,1581 @@ +// Type definitions for OpenFin API 16.0 +// Project: https://openfin.co/ +// Definitions by: Chris Barker +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// based on v6.49.16.16 +// 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 "document" objects. + **/ +declare namespace fin { + const desktop: OpenFinDesktop; + + interface OpenFinDesktop { + main(f: () => any): void; + Application: OpenFinApplicationStatic; + ExternalApp: OpenFinExternalApplicationStatic; + InterApplicationBus: OpenFinInterApplicationBus; + Notification: OpenFinNotificationStatic; + System: OpenFinSystem; + Window: OpenFinWindowStatic; + } + + 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; + /** + * 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; + /** + * Determines if the application is currently running. + */ + isRunning(callback?: (running: boolean) => void, errorCallback?: (reason: string) => void): void; + /** + * Passes in custom data that will be relayed to the RVM + */ + registerCustomData(data: any, 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; + } + + 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 + }; + /** + * A flag to always position the window at the top of the window stack. Default: false. + */ + 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 + */ + contextMenu?: boolean; + /** + * This defines and applies rounded corners for a frameless window. Default for both width and height: 0. + */ + 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. + */ + frame?: boolean; + /** + * A flag to allow a window to be hidden when the close button is clicked.Default: false. + */ + hideOnClose?: boolean; + /** + * A URL for the icon to be shown in the window title bar and the taskbar.Default: The parent application's applicationIcon. + */ + icon?: string; + /** + * The maximum height of a window.Will default to the OS defined value if set to - 1. Default: -1. + */ + maxHeight?: number; + /** + * A flag that lets the window be maximized.Default: true. + */ + maximizable?: boolean; + /** + * The maximum width of a window.Will default to the OS defined value if set to - 1. Default: -1. + */ + maxWidth?: number; + /** + * The minimum height of a window.Default: 0. + */ + 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. + */ + opacity?: number; + /** + * A flag to drop to allow the user to resize the window.Default: true. + */ + resizable?: boolean; + /** + * Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window. + */ + 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 { + /** + * 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; + /** + * Exits the Runtime. + */ + exit(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; + /** + * 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; + /** + * 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 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 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; + /** + * 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; + /** + * 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; + } + + 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 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 {any} options - The options of the window + * @param {Function} [callback] - Called if the window creation was successful + * @param {number} [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 {OpenFinWindow} 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 { + /** + * 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 {Window} Native window + */ + getNativeWindow(): Window; + /** + * Gets the parent application. + * @returns {OpenFinApplication} 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 {force} 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 {force} 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 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 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 SessionChangedEvent { + /** + * the action that triggered this event: + */ + reason: "lock" + | "unlock" + | "remote-connect" + | "remote-disconnect" + | "unknown"; + topic: "system"; + type: "session-changed"; + } + + 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"; +} \ No newline at end of file diff --git a/openfin/v16/openfin-tests.ts b/openfin/v16/openfin-tests.ts new file mode 100644 index 0000000000..81ac24f937 --- /dev/null +++ b/openfin/v16/openfin-tests.ts @@ -0,0 +1,724 @@ +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 + } + }, function (successObj) { + console.log("Application successfully created, HTTP response code:", successObj); + application.run(); + }, function (error) { + console.log("Error creating application:", error); + }); + // getCurrent + application = fin.desktop.Application.getCurrent(); + // wrap + application = fin.desktop.Application.wrap("454C7F31-A915-4EA2-83F2-CFA655453C52"); + // getWindow + application.getWindow(); + // addEventListener + application.addEventListener("closed", function (event) { + console.log("The application has closed"); + }, function () { + console.log("The registration was successful"); + }, function (reason) { + console.log("failure: " + reason); + }); + // close + application.close(); + // getChildWindows + application.getChildWindows(function (children) { + children.forEach(function (childWindow) { + console.log("Showing child: " + childWindow.name); + childWindow.show(); + }); + }); + // getGroups + application.getGroups(function (allGroups) { + console.log("There are a total of " + allGroups.length + " groups."); + + var groupCounter = 1; + allGroups.forEach(function (windowGroup) { + console.log("Group " + groupCounter + " contains " + + windowGroup.length + " windows."); + ++groupCounter; + }); + }); + // getManifest + application.getManifest(function (manifest) { + console.log("Application manifest:"); + console.log(manifest); + }); + // getParentUuid + application.getParentUuid(function (parentUuid) { + console.log("UUID of parent application:"); + console.log(parentUuid); + }); + // getShortcuts + application.getShortcuts(function (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); + }); + // isRunning + application.isRunning(function (running) { + console.log("the application is", running ? "running" : "not running"); + }); + // registerCustomData + application.registerCustomData({ + someData: "this is custom" + }, function () { + console.log("You will not read this."); + }, function (err) { + console.log("failure:", err); + }); + // removeEventListener + let previousCallback = function (event: fin.WindowEvent) { }; + application.removeEventListener("closed", previousCallback, function () { + console.log("The unregistration was successful"); + }, function (err) { + console.log("failure:", err); + }); + // removeTrayIcon + application.removeTrayIcon(function () { + console.log("Removed the tray icon."); + }, function (err) { + console.log("failure:", err); + }); + // restart + application.restart(function () { + console.log("You will not read this."); + }, function (err) { + console.log("failure:", err); + }); + // schedule restart + application.scheduleRestart(function () { + console.log("You will not read this."); + }, function (err) { + console.log("failure:", err); + }); + // setShortcuts + application.setShortcuts({ + desktop: true, + startMenu: false, + systemStartup: true + }, function () { + console.log("Successfully set new shortcut states"); + }, function (error) { + console.log("Failed to set new shortcut states. Error: ", error); + }); + // setTrayIcon + application.setTrayIcon("https://developer.openf.in/download/openfin.png", function (clickInfo) { + console.log("The mouse has clicked at (" + clickInfo.x + "," + clickInfo.y + ")"); + }); + // terminate + application.terminate(); + // wait + application.addEventListener("not-responding", function () { + console.log("waiting for hung application"); + application.wait(); + }); +} + +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 + let previousCallback = function () { }; + externalApp.removeEventListener('connected', previousCallback, () => { + console.log('The unregistration was successful'); + }, (reason, err) => { + console.log(`Error Message: ${err.message} Error Stack: ${err.stack}`); + }); +} + +function test_inter_application_bus() { + // addSubscribeListener + fin.desktop.InterApplicationBus.addSubscribeListener(function (uuid, topic, name) { + console.log("The application " + uuid + " has subscribed to " + topic); + }); + // addUnsubscribeListener + fin.desktop.InterApplicationBus.addUnsubscribeListener(function (uuid, topic, name) { + console.log("The application " + uuid + " has unsubscribed to " + topic); + }); + // removeSubscribeListener + let aRegisteredListener = function (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", function (message, uuid, name) { + console.log("The application " + uuid + " sent this message: " + message); + }); + // unsubscribe + let aRegisteredMessageListener = function (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', function (event) { + console.log("The monitor information has changed to: ", event); + }, function () { + console.log("The registration was successful"); + }, function (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(function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // downloadAsset + let dirAppAsset = { + 'src': 'http://local:8000/dir.zip', + 'alias': 'dirApp', + 'version': '1.23.24', + 'target': 'dir.bat', + 'args': '' + }; + fin.desktop.System.downloadAsset(dirAppAsset, progress => { + let 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); + }); + // exit + fin.desktop.System.exit(function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // getAllApplications + fin.desktop.System.getAllApplications(function (applicationInfoList) { + applicationInfoList.forEach(function (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(function (windowInfoList) { + windowInfoList.forEach(function (windowInfo) { + console.log("Showing information for application with uuid: ", windowInfo.uuid); + console.log("Main window: ", windowInfo.mainWindow); + console.log("Child windows: ", windowInfo.childWindows); + }); + }); + // getCommandLineArguments + fin.desktop.System.getCommandLineArguments(function (args) { + console.log("The command line arguments are " + args); + }); + // getDeviceId + fin.desktop.System.getDeviceId(function (id) { + console.log("The id of the device is: " + id); + }); + // getEnvironmentVariable + fin.desktop.System.getEnvironmentVariable("APPDATA", function (variable) { + console.log("this is the APPDATA value", variable); + }); + // getHostSpecs + fin.desktop.System.getHostSpecs(function (info) { + console.log(info); + }, function (error) { + console.log('There was an error:', error); + }); + // getLog + fin.desktop.System.getLog('debug-2015-01-08-22-27-53.log', function (log) { + console.log(log); + }); + // getLogList + fin.desktop.System.getLogList(function (logList) { + logList.forEach(function (logInfo) { + console.log("The filename of the log is " + + logInfo.name + ", the size is " + + logInfo.size + ", and the date of creation is " + + logInfo.date); + }); + }); + // getMonitorInfo + fin.desktop.System.getMonitorInfo(function (monitorInfo) { + console.log("This object contains information about all monitors: ", monitorInfo); + }); + // getMousePosition + fin.desktop.System.getMousePosition(function (mousePosition) { + console.log("The mouse is located at left: " + mousePosition.left + ", top: " + mousePosition.top); + }); + // getProcessList + fin.desktop.System.getProcessList(function (list) { + list.forEach(function (process) { + console.log("UUID: " + process.uuid + ", Application Name: " + process.name); + }); + }); + // getProxySettings + fin.desktop.System.getProxySettings(function (proxy) { + console.log(proxy); + }); + // getRvmInfo + fin.desktop.System.getRvmInfo(function (rvmInfoObject) { + console.log("RVM version:", rvmInfoObject.version); + console.log("RVM has been running since:", rvmInfoObject["start-time"]); + }, function (err) { + console.log("Failed to get rvm info, error message:", err); + }); + // getVersion + fin.desktop.System.getVersion(function (version) { + console.log("The version is " + version); + }); + // launchExternalProcess + fin.desktop.System.launchExternalProcess({ + path: "notepad", + arguments: "", + listener: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log('Success:', payload.uuid); + }, function (error) { + console.log('Error:', error); + }); + // + 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: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log('Success:', payload.uuid); + }, function (error) { + console.log('Error:', error); + }); + // + fin.desktop.System.launchExternalProcess({ + alias: "myApp", + arguments: "e f g", + listener: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log('Success:', payload.uuid); + }, function (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: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log('Success:', payload.uuid); + }, function (error) { + console.log('Error:', error); + }); + // log + fin.desktop.System.log("info", "An example log message", function () { + console.log("message successfully logged"); + }, function (err) { + console.log(err); + }); + // monitorExternalProcess + fin.desktop.System.monitorExternalProcess({ + pid: 2508, + listener: function (result) { + console.log('the exit code', result.exitCode); + } + }, function (payload) { + console.log("The process is now being monitored: ", payload.uuid); + }, function (error) { + console.log("Error:", error); + }); + // openUrlWithBrowser + fin.desktop.System.openUrlWithBrowser("https://developer.openf.in/", function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // registerExternalConnection + fin.desktop.System.registerExternalConnection("remote-connection-uuid", function () { + console.log(arguments); + }); + // releaseExternalProcess + fin.desktop.System.launchExternalProcess({ + path: "notepad", + arguments: "", + listener: function (result) { + console.log("The exit code", result.exitCode); + } + }, function (result) { + console.log("Result UUID is " + result.uuid); + + //release it. + fin.desktop.System.releaseExternalProcess(result.uuid, function () { + console.log("Process has been unmapped!"); + }, function (reason) { + console.log("failure: " + reason); + }); + }); + // removeEventListener + let aRegisteredListener = (event: fin.SystemBaseEvent) => { }; + fin.desktop.System.removeEventListener("monitor-info-changed", aRegisteredListener, function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // showDeveloperTools + fin.desktop.System.showDeveloperTools("uuid", "name", function () { + console.log("successful"); + }, function (err) { + console.log("failure: " + err); + }); + // terminateExternalProcess + fin.desktop.System.launchExternalProcess({ + // notepad is in the system’s PATH + path: "notepad", + arguments: "", + listener: function (result) { + console.log("The exit code", result.exitCode); + } + }, function (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, function (info) { + console.log("Termination result " + info.result); + }, function (reason) { + console.log("failure: " + reason); + }); + }); + // updateProxySettings + fin.desktop.System.updateProxySettings("type", "proxyAddress", 8080, function () { + console.log('success'); + }, function (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" + }, function () { + var _win = finWindow.getNativeWindow(); + _win.addEventListener("DOMContentLoaded", function () { finWindow.show(); }); + }, function (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", function (event) { + console.log("The window has been moved or resized"); + }, function () { + console.log("The registration was successful"); + }, function (reason) { + console.log("failure:" + reason); + }); + // animate + finWindow.animate({ + opacity: { + opacity: 0.15, + duration: 1000 + }, + position: { + left: 10, + top: 10, + duration: 3000 + } + }, { + interrupt: false + }, function (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(function (bounds) { + console.log("top: " + bounds.top + + "left: " + bounds.left + + "height: " + bounds.height + + "width: " + bounds.width); + }); + // getOptions + finWindow.getOptions(function (options) { + console.log(options); + }); + // getSnapshot + finWindow.getSnapshot(function (base64Snapshot) { + console.log("data:image/png;base64," + base64Snapshot); + }); + // getState + finWindow.getState(function (state) { + console.log("state: " + state); + }); + // getZoomLevel + finWindow.getZoomLevel(function (level) { + console.log("zoom level: " + level); + }, function (error) { + console.log('error:', error); + }); + // hide + finWindow.hide(); + // isShowing + finWindow.isShowing(function (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 + }, function () { + // 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 + }, function () { + // When finWindow moves or is moved, secondWindow moves by the same amount + secondWindow.joinGroup(finWindow, function () { + //once we are in the group, lets leave it. + secondWindow.leaveGroup(); + }); + }); + // maximize + finWindow.maximize(); + // mergeGroups + { + let finWindowOne = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowOne", + autoShow: true + }); + let finWindowTwo = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowTwo", + autoShow: true + }); + let finWindowThree = new fin.desktop.Window({ + url: "http://www.openfin.co", + name: "finWindowThree", + autoShow: true + }); + let 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 + let aRegisteredListener = (event: fin.WindowBaseEvent) => { }; + finWindow.removeEventListener("bounds-changed", aRegisteredListener); + // 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 + }); +} \ No newline at end of file diff --git a/openfin/v16/tsconfig.json b/openfin/v16/tsconfig.json new file mode 100644 index 0000000000..24629d90e4 --- /dev/null +++ b/openfin/v16/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "openfin": [ + "openfin/v16" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "openfin-tests.ts" + ] +} diff --git a/openfin/v16/tslint.json b/openfin/v16/tslint.json new file mode 100644 index 0000000000..af53769b6b --- /dev/null +++ b/openfin/v16/tslint.json @@ -0,0 +1 @@ +{ "extends": "../../tslint.json" } From f36d20dcd0aa4f92c02cbdea3638083cfd2a58e2 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Tue, 21 Feb 2017 00:14:41 +0000 Subject: [PATCH 017/374] Fixed tslint and test issue that showed up on travis --- openfin/index.d.ts | 12 ++++++------ openfin/v16/tsconfig.json | 5 ++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/openfin/index.d.ts b/openfin/index.d.ts index 893a253606..f0803864ae 100644 --- a/openfin/index.d.ts +++ b/openfin/index.d.ts @@ -307,8 +307,8 @@ declare namespace fin { size?: number; /** * The size in pixels of an additional - * square resizable region located at the - * bottom right corner of a + * square resizable region located at the + * bottom right corner of a * frameless window. (Default: 4) */ bottomRightCorner?: number; @@ -941,11 +941,11 @@ declare namespace fin { 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 {any} options - The options of the window * @param {Function} [callback] - Called if the window creation was successful @@ -982,7 +982,7 @@ declare namespace fin { * @returns {OpenFinApplication} Parent application */ getParentApplication(): OpenFinApplication; - /** + /** * Gets the parent window. */ getParentWindow(): OpenFinWindow; diff --git a/openfin/v16/tsconfig.json b/openfin/v16/tsconfig.json index 24629d90e4..88e1dbe7fa 100644 --- a/openfin/v16/tsconfig.json +++ b/openfin/v16/tsconfig.json @@ -1,7 +1,10 @@ { "compilerOptions": { "module": "commonjs", - "target": "es6", + "lib": [ + "es6", + "dom" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, From a4ba9a452279b77f8c28d2506093f8956db94740 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Tue, 21 Feb 2017 00:24:31 +0000 Subject: [PATCH 018/374] And fixed one more --- openfin/v16/index.d.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/openfin/v16/index.d.ts b/openfin/v16/index.d.ts index 2c1cfd648e..0b9f3e16ac 100644 --- a/openfin/v16/index.d.ts +++ b/openfin/v16/index.d.ts @@ -63,7 +63,7 @@ declare namespace fin { */ 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. + * 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; /** @@ -95,7 +95,7 @@ declare namespace fin { */ 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. + * Removes the application�s icon from the tray. */ removeTrayIcon(callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -288,8 +288,8 @@ declare namespace fin { size?: number; /** * The size in pixels of an additional - * square resizable region located at the - * bottom right corner of a + * square resizable region located at the + * bottom right corner of a * frameless window. (Default: 4) */ bottomRightCorner?: number; @@ -922,11 +922,11 @@ declare namespace fin { 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 {any} options - The options of the window * @param {Function} [callback] - Called if the window creation was successful @@ -963,7 +963,7 @@ declare namespace fin { * @returns {OpenFinApplication} Parent application */ getParentApplication(): OpenFinApplication; - /** + /** * Gets the parent window. */ getParentWindow(): OpenFinWindow; @@ -989,7 +989,7 @@ declare namespace fin { bringToFront(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Closes the window. - * @param {force} Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window. + * @param {force} 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; /** @@ -1009,7 +1009,7 @@ declare namespace fin { */ enableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Flashes the window’s frame and taskbar icon until the window is activated. + * Flashes the window�s frame and taskbar icon until the window is activated. */ flash(options?: any, callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -1106,7 +1106,7 @@ declare namespace fin { setZoomLevel(level: number, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Shows the window if it is hidden. - * @param {force} Show will be prevented from closing when force is false and ‘show-requested’ has been subscribed to for application’s main window. + * @param {force} 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; /** From 700d3a139d81fb5e7f694aeca54569df37ff0fc6 Mon Sep 17 00:00:00 2001 From: Sean Nolan Date: Wed, 22 Feb 2017 13:11:41 +1300 Subject: [PATCH 019/374] Updated bacbone.marionette to support marionette 3.1.0 Updated tinymce --- backbone.marionette/index.d.ts | 334 ++++++++++----------------------- tinymce/index.d.ts | 172 +++++++++++++++-- 2 files changed, 256 insertions(+), 250 deletions(-) diff --git a/backbone.marionette/index.d.ts b/backbone.marionette/index.d.ts index edaab2c2d6..c9705c53c1 100644 --- a/backbone.marionette/index.d.ts +++ b/backbone.marionette/index.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as Backbone from 'backbone'; +import * as Radio from '../backbone.radio'; export as namespace Marionette; export = Marionette; @@ -22,8 +23,6 @@ declare module 'backbone' { findByIndex(index: number): TView; findByCid(cid: string): TView; remove(view: TView): void; - call(method: any): void; - apply(method: any, args?: any[]): void; //mixins from Collection (copied from Backbone's Collection declaration) @@ -180,6 +179,27 @@ declare namespace Marionette { * backbone conventions and utilities like initialize and Backbone.Events. */ class Object extends Backbone.Events { + + /** + * Defines the Radio channel that will be used for the requests and/or events + */ + channelName: string; + + /** + * Returns a Radio.Channel instance using 'channelName' + */ + getChannel(): Backbone.Radio.Channel; + + /** + * Defines an events hash with the events to be listened and its respective handlers + */ + radioEvents: any; + + /** + * Defines an events hash with the requests to be replied and its respective handlers + */ + radioRequests: any; + /** * Initialize is called immediately after the Object has been instantiated, * and is invoked with the same arguments that the constructor received. @@ -772,12 +792,37 @@ declare namespace Marionette { triggerMethod(name: string, ...args: any[]): any; /** - * Called on the view instance when the view has been rendered and - * displayed. This event can be used to react to when a view has been - * shown via a region. A common use case for the onShow method is to - * use it to add children views. + * Item views will serialize a model or collection, by default, by calling + * .toJSON on either the model or collection. If both a model and + * collection are attached to an item view, the model will be used as the + * data source. The results of the data serialization will be passed to + * the template that is rendered. + * + * If you need custom serialization for your data, you can provide a serializeData + * method on your view. It must return a valid JSON object, as if you had + * called .toJSON on a model or collection. */ - onShow(): void; + serializeData(): any; + + /** + * Renders the view. It is unwise to override the render method of any + * Marionette view. Instead, you should use the onBeforeRender and + * onRender callbacks to layer in additional functionality to the + * rendering of your view. + */ + render(): any; + + /** + * Triggered before an ItemView is rendered. + */ + onBeforeRender(): void; + + /** + * Triggered after the view has been rendered. You can implement this in + * your view to provide custom code for dealing with the view's el after + * it has been rendered. + */ + onRender(): void; /** * Triggered just after the view has been destroyed. @@ -814,49 +859,65 @@ declare namespace Marionette { isDestroyed: boolean; supportsRenderLifecycle: boolean; supportsDestroyLifecycle: boolean; - } - - /** - * An ItemView is a view that represents a single item. That item may be - * a Backbone.Model or may be a Backbone.Collection. Whichever it is though, - * it will be treated as a single item. - */ - class ItemView extends View { - - constructor(options?: Backbone.ViewOptions); /** - * Item views will serialize a model or collection, by default, by calling - * .toJSON on either the model or collection. If both a model and - * collection are attached to an item view, the model will be used as the - * data source. The results of the data serialization will be passed to - * the template that is rendered. - * - * If you need custom serialization for your data, you can provide a serializeData - * method on your view. It must return a valid JSON object, as if you had - * called .toJSON on a model or collection. + * If you have the need to replace the Region with a region class of your + * own implementation, you can specify an alternate class to use with this + * property. */ - serializeData(): any; + regionClass: any; /** - * Renders the view. It is unwise to override the render method of any - * Marionette view. Instead, you should use the onBeforeRender and - * onRender callbacks to layer in additional functionality to the - * rendering of your view. - */ - render(): ItemView; + * Regions hash or a method returning the regions hash that maps + * regions/selectors to methods on your View. + **/ + regions(): any; + + /** Adds a region to the layout view. */ + addRegion(name: string, definition: any): Region; /** - * Triggered before an ItemView is rendered. + * Add multiple regions as a {name: definition, name2: def2} object literal. */ - onBeforeRender(): void; + addRegions(regions: any): any; + + /** Returns a region from the layout view */ + getRegion(name: string): Region; /** - * Triggered after the view has been rendered. You can implement this in - * your view to provide custom code for dealing with the view's el after - * it has been rendered. + * Removes the region with the specified name. + * @param name the name of the region to remove. */ - onRender(): void; + removeRegion(name: string): Region; + + /** Enable easy overriding of the default `RegionManager` + * for customized region interactions and business specific + * view logic for better control over single regions. + */ + getRegionManager(): RegionManager; + + /** + * Show a view into the region specified by `regionName`. + */ + showChildView(regionName: string, view: any, options?: RegionShowOptions): void; + + /** + * Get the current view that is shown in the region specified by + * `regionName`. + */ + getChildView(regionName: string): Backbone.View; + + /** + * Returns all regions from the layout view. The results contains an + * Object hash that has `string`s as keys and `Region`s as values. + */ + getRegions(): {[key: string]: Region}; + + /** + * You can customize the event prefix for events that are forwarded through + * the layout view with this property. + */ + childViewEventPrefix: string; } @@ -928,12 +989,12 @@ declare namespace Marionette { childViewEventPrefix: string; /** - * You can specify a childEvents hash or method which allows you to - * capture all bubbling childEvents without having to manually set bindings. + * You can specify a childViewEvents hash or method which allows you to + * capture all bubbling childViewEvents without having to manually set bindings. * The keys of the hash can either be a function or a string that is the * name of a method on the collection view. */ - childEvents: any; + childViewEvents: any; /** * When a collection has no children, and you need to render a view other than @@ -1034,37 +1095,9 @@ declare namespace Marionette { */ attachHtml(collectionView: CollectionView, childView: TView, index: number): void; - /** - * The value returned by this method is the ChildView class that will be - * instantiated when a Model needs to be initially rendered. This method - * also gives you the ability to customize per Model ChildViews. - */ - getChildView(item: M): new (...args:any[]) => TView; - - /** - * If you need the emptyView's class chosen dynamically, specify - * getEmptyView. - */ - getEmptyView(): any; - /** Serialize a collection by serializing each of its models. */ serializeCollection(): any; - /** - * Attaches the content of a given view. - * This method can be overridden to optimize rendering, - * or to render in a non standard way. - * - * For example, using `innerHTML` instead of `$el.html` - * - * @example - * attachElContent: function(html) { - * this.el.innerHTML = html; - * return this; - * } - */ - attachElContent(html: string): ItemView; - /** * Reorder DOM after sorting. When your element's rendering * do not use their index, you can pass reorderOnSort: true @@ -1132,165 +1165,6 @@ declare namespace Marionette { onRemoveChild(childView: TView): void; } - /** - * A CompositeView extends from CollectionView to be used as a composite view - * for scenarios where it should represent both a branch and leaf in a tree - * structure, or for scenarios where a collection needs to be rendered within - * a wrapper template. - */ - class CompositeView> extends CollectionView { - - constructor(options?: CollectionViewOptions); - - /** - * Each childView will be rendered using the childView's template. The - * CompositeView's template is rendered and the childView's templates are - * added to this. - */ - childView: new (...args:any[]) => TView; - - /** - * By default the composite view uses the same attachHtml method that the - * collection view provides. This means the view will call jQuery's - * .append to move the HTML contents from the child view instance in to - * the collection view's el. - * This is typically not very useful as a composite view will usually render - * a container DOM element in which the child views should be placed. - * This can be either a string or a function returning a string. - */ - childViewContainer: any; - - /** - * Renders the view. - */ - render(): CompositeView; - - /** - * Invoked before the model has been rendered - */ - onBeforeRenderTemplate(): void; - - /** - * Invoked after the model has been rendered. - */ - onRenderTemplate(): void; - - /** - * Invoked before the collection of models is rendered - */ - onBeforeRenderCollection(): void; - - /** - * Invoked after the collection of models has been rendered - */ - onRenderCollection(): void; - } - - interface LayoutViewOptions extends Backbone.ViewOptions { - /** - * The LayoutView takes an additional parameter where you can pass the regions as option on creation. - */ - regions?:any; - - /** - * This option removes the layoutView from the DOM before destroying the - * children preventing repaints as each option is removed. However, it - * makes it difficult to do close animations for a child view (false by - * default) - */ - destroyImmediate?: boolean; - } - - /** - * A LayoutView is a hybrid of an ItemView and a collection of Region objects. - * They are ideal for rendering application layouts with multiple sub-regions - * managed by specified region managers. - * A layoutView can also act as a composite-view to aggregate multiple views - * and sub-application areas of the screen allowing applications to attach - * multiple region managers to dynamically rendered HTML. - * You can create complex views by nesting layoutView managers within Regions. - */ - class LayoutView extends ItemView { - /** - * If you have the need to replace the Region with a region class of your - * own implementation, you can specify an alternate class to use with this - * property. - */ - regionClass: any; - - /** - * Constructor. - * A hash that can contain a regions hash that allows you to specify regions per - * LayoutView instance. - */ - constructor(options?: LayoutViewOptions); - - /** - * Handle destroying regions, and then destroy the view itself. - */ - destroy(): LayoutView; - - /** - * Regions hash or a method returning the regions hash that maps - * regions/selectors to methods on your View. - **/ - regions(): any; - - /** Adds a region to the layout view. */ - addRegion(name: string, definition: any): Region; - - /** - * Add multiple regions as a {name: definition, name2: def2} object literal. - */ - addRegions(regions: any): any; - - /** Returns a region from the layout view */ - getRegion(name: string): Region; - - /** - * Renders the view. It will use the existing region objects the first - * time it is called. Subsequent calls will destroy the views that the - * regions are showing and then reset the `el` for the regions to the - * newly rendered DOM elements. - */ - render(): LayoutView; - - /** - * Removes the region with the specified name. - * @param name the name of the region to remove. - */ - removeRegion(name: string): Region; - - /** Enable easy overriding of the default `RegionManager` - * for customized region interactions and business specific - * view logic for better control over single regions. - */ - getRegionManager(): RegionManager; - - /** - * Show a view into the region specified by `regionName`. - */ - showChildView(regionName: string, view: any, options?: RegionShowOptions): void; - - /** - * Get the current view that is shown in the region specified by - * `regionName`. - */ - getChildView(regionName: string): Backbone.View; - - /** - * Returns all regions from the layout view. The results contains an - * Object hash that has `string`s as keys and `Region`s as values. - */ - getRegions(): {[key: string]: Region}; - - /** - * You can customize the event prefix for events that are forwarded through - * the layout view with this property. - */ - childViewEventPrefix: string; - } - interface AppRouterOptions extends Backbone.RouterOptions { /** * The appRoutes. @@ -1437,7 +1311,7 @@ declare namespace Marionette { options: any; - /** + /** * Behaviors can have their own ui hash, which will be mixed into the ui * hash of its associated View instance. ui elements defined on either the * Behavior or the View will be made available within events and triggers. diff --git a/tinymce/index.d.ts b/tinymce/index.d.ts index f760671a8e..e382910026 100644 --- a/tinymce/index.d.ts +++ b/tinymce/index.d.ts @@ -7,37 +7,169 @@ declare namespace TinyMCE { export interface Observable { - off: (name?: string, callback?: () => void) => any; - on: (name: string, callback: () => void) => any; - fire: (name: string, args?: any, bubble?: boolean) => Event; + off(name?: string, callback?: void): any; + on(name: string, callback: () => void): any; + fire(name: string, args?: any, bubble?: boolean): Event; } export interface Editor extends Observable { - destroy: (automatic: boolean) => void; - remove: () => void; - hide: () => void; - show: () => void; - getContent: (args?: any) => string; - setContent: (content: string, args?: any) => string; - focus: (skip_focus?: boolean) => void; + $: any; + iframeElement: string; + selection: Selection; undoManager: UndoManager; - settings: any; - getDoc: () => Document; - editorUpload: any; + formatter: Formatter; + shortcuts: Shortcuts; + dom: DOMUtils; + notificationManager: NotificationManager; + focus(): void; + getContent(args?: Object): string; + isDirty(): boolean; + insertContent(content: string, args?: any): any; + setContent(content: string, args?: any): any; + reset(): any; + execCommand(command: string, ui?: boolean, value?: any, args?: any): boolean; + remove(): any; + destroy(state?: boolean): void; + getElement(): Element; + getDoc(): Document; + queryCommandSupported(cmd: string): boolean; + getBody(): Element; + setDirty(dirty: boolean): void; + on(eventName: String, handler: Function): void; + addShortcut(pattern: string, desc: string, cmdFunc: string, scope?: any ): boolean; + addButton(name: string, settings: any): void; + addMenuItem(name: string, settings: any): void; + menuItems: any; + initialized: boolean; + } + + export interface Formatter { + remove(name: string): any; + apply(name: string): any; + toggle(name: string): any; + match(name: string, vars?: Object, node?: Node): boolean; + matchAll(names: [string], vars?: Object): [string]; } export interface UndoManager { - undo: () => any; - clear: () => void; - hasUndo: () => boolean; + transact(callback: Function): any; + undo(): any; + redo(): any; + hasRedo(): boolean; + hasUndo(): boolean; + } + + export interface DOMUtils { + DOM: any; + getParent(n: Node, s: string): Node; + setStyle(n: any, na: string, v: string): void; + select(pattern: string, scope ?: Element): Array; + getAttrib(elm: string, name: string, defaultVal ?: string): string; + isEmpty(elements: Object): boolean; + } + + export interface NotificationManager { + getNotifications(): any[]; + open(args: any): any; + close(): any; + } + + export interface Shortcuts { + addShortcut(pattern: string, desc: string, cmdFunc: string, scope?: any): boolean; + remove(pattern: string): boolean; + } + + export interface Collection { + + } + + export interface Container { + add(items: any): Collection; + items(): Collection; + } + + export interface Tooltip { + + } + + export interface Control { + renderTo(node?: Node): void; + innerHtml(html: string): Control; + $el: any; + show(): void; + hide(): void; + visible(state ?: boolean): boolean; + disabled(state: boolean): boolean; + active(state: boolean): boolean; + on(name: string, callback: Function): Control; + parent(parent ?: any): Control; + settings: any; + text(text: string): void; + tooltip(): Tooltip; + } + + export interface Moveable { + moveRel(elm: Node, rel: string): Control; + } + + export interface FloatPanel extends Control, Moveable { + + } + + export interface Menu extends FloatPanel, Control, Container { + + } + + export interface Factory { + create(settings: any): Control; + } + + export interface Tools { + grep(array: any, f: Function): any; + each(o: Object, cb: Function, s?: Object): void; + } + + export interface UI { + Factory: Factory; + Control: Control; + FloatPanel: FloatPanel; + } + + export interface util { + Tools: Tools; + } + + export interface Selection { + getContent(args?: Object): string; + getNode(): any; + getRng(): Range; + collapse(toStart?: boolean): any; + select(node: any, body: boolean): any; + getStart(): any; + getEnd(real ?: boolean): void; + selectorChanged(selector: string, handler: any): void; + getSel(): any; + } + + export interface FocusManager { + isEditorUIElement(elm: Node): boolean; + } + + export interface UI { + Factory: Factory; + Control: Control; + FloatPanel: FloatPanel; } export interface Static extends Observable { - init: (settings: any) => void; - execCommand: (c: string, u: boolean, v: string) => boolean; + init(settings: any): void; + execCommand(c: string, u: boolean, v: string): boolean; activeEditor: Editor; - get: (id: string) => Editor; - triggerSave: () => void; + FocusManager: FocusManager; + get(id: string): Editor; + triggerSave(): void; + ui: UI; + util: util; } } From 44b4d01af14305b1a18f274bb50ef2816ee73754 Mon Sep 17 00:00:00 2001 From: Sean Nolan Date: Wed, 22 Feb 2017 13:16:51 +1300 Subject: [PATCH 020/374] Remove parent relationship --- backbone.marionette/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backbone.marionette/index.d.ts b/backbone.marionette/index.d.ts index c9705c53c1..9fdfd70594 100644 --- a/backbone.marionette/index.d.ts +++ b/backbone.marionette/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as Backbone from 'backbone'; -import * as Radio from '../backbone.radio'; +import * as Radio from 'backbone.radio'; export as namespace Marionette; export = Marionette; From d701bd4a5b05fdb23eb2c23800464bee4885df30 Mon Sep 17 00:00:00 2001 From: Sean Nolan Date: Wed, 22 Feb 2017 14:25:02 +1300 Subject: [PATCH 021/374] Fixed build errors --- .../backbone.marionette-tests.ts | 8 ++--- backbone.marionette/index.d.ts | 2 +- tinymce/index.d.ts | 30 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/backbone.marionette/backbone.marionette-tests.ts b/backbone.marionette/backbone.marionette-tests.ts index b5eb9d07c6..2c1f5b68bd 100644 --- a/backbone.marionette/backbone.marionette-tests.ts +++ b/backbone.marionette/backbone.marionette-tests.ts @@ -66,11 +66,11 @@ namespace MarionetteTests { let regions: {[key: string]: Marionette.Region} = this.layoutView.getRegions(); let prefix: string = this.layoutView.childViewEventPrefix; let region: Marionette.Region = this.layoutView.removeRegion('main'); - let layout: Marionette.LayoutView = this.layoutView.destroy(); + let layout: Marionette.View = this.layoutView.destroy(); } } - class AppLayoutView extends Marionette.LayoutView { + class AppLayoutView extends Marionette.View { constructor() { super({ el: 'body' }); } @@ -111,7 +111,7 @@ namespace MarionetteTests { } - class MyView extends Marionette.ItemView { + class MyView extends Marionette.View { behaviors: any; constructor(model: MyModel) { @@ -189,7 +189,7 @@ namespace MarionetteTests { constructor() { super(); this.childView = MyView; - this.childEvents = { + this.childViewEvents = { render: function () { console.log("a childView has been rendered"); } diff --git a/backbone.marionette/index.d.ts b/backbone.marionette/index.d.ts index 9fdfd70594..d24f9d64f9 100644 --- a/backbone.marionette/index.d.ts +++ b/backbone.marionette/index.d.ts @@ -770,7 +770,7 @@ declare namespace Marionette { /** * View implements a destroy method, which is called by the region managers automatically. As part of the implementation. */ - destroy(...args: any[]): void; + destroy(...args: any[]): View; /** * In several cases you need to access ui elements inside the view to diff --git a/tinymce/index.d.ts b/tinymce/index.d.ts index e382910026..b393c1c20e 100644 --- a/tinymce/index.d.ts +++ b/tinymce/index.d.ts @@ -7,8 +7,8 @@ declare namespace TinyMCE { export interface Observable { - off(name?: string, callback?: void): any; - on(name: string, callback: () => void): any; + off(name?: string, callback?: void): void; + on(name: string, callback: () => void): void; fire(name: string, args?: any, bubble?: boolean): Event; } @@ -22,7 +22,7 @@ declare namespace TinyMCE { dom: DOMUtils; notificationManager: NotificationManager; focus(): void; - getContent(args?: Object): string; + getContent(args?: any): string; isDirty(): boolean; insertContent(content: string, args?: any): any; setContent(content: string, args?: any): any; @@ -35,7 +35,7 @@ declare namespace TinyMCE { queryCommandSupported(cmd: string): boolean; getBody(): Element; setDirty(dirty: boolean): void; - on(eventName: String, handler: Function): void; + on(eventName: string, handler: () => void): void; addShortcut(pattern: string, desc: string, cmdFunc: string, scope?: any ): boolean; addButton(name: string, settings: any): void; addMenuItem(name: string, settings: any): void; @@ -47,12 +47,12 @@ declare namespace TinyMCE { remove(name: string): any; apply(name: string): any; toggle(name: string): any; - match(name: string, vars?: Object, node?: Node): boolean; - matchAll(names: [string], vars?: Object): [string]; + match(name: string, vars?: any, node?: Node): boolean; + matchAll(names: [string], vars?: any): [string]; } export interface UndoManager { - transact(callback: Function): any; + transact(callback: () => void): any; undo(): any; redo(): any; hasRedo(): boolean; @@ -63,9 +63,9 @@ declare namespace TinyMCE { DOM: any; getParent(n: Node, s: string): Node; setStyle(n: any, na: string, v: string): void; - select(pattern: string, scope ?: Element): Array; + select(pattern: string, scope ?: Element): Element[]; getAttrib(elm: string, name: string, defaultVal ?: string): string; - isEmpty(elements: Object): boolean; + isEmpty(elements: any): boolean; } export interface NotificationManager { @@ -80,7 +80,7 @@ declare namespace TinyMCE { } export interface Collection { - + active():Collection; } export interface Container { @@ -89,7 +89,7 @@ declare namespace TinyMCE { } export interface Tooltip { - + repaint(): void; } export interface Control { @@ -101,7 +101,7 @@ declare namespace TinyMCE { visible(state ?: boolean): boolean; disabled(state: boolean): boolean; active(state: boolean): boolean; - on(name: string, callback: Function): Control; + on(name: string, callback: () => void): Control; parent(parent ?: any): Control; settings: any; text(text: string): void; @@ -125,8 +125,8 @@ declare namespace TinyMCE { } export interface Tools { - grep(array: any, f: Function): any; - each(o: Object, cb: Function, s?: Object): void; + grep(array: any, f: () => void): any; + each(o: Object, cb: () => void, s?: any): void; } export interface UI { @@ -140,7 +140,7 @@ declare namespace TinyMCE { } export interface Selection { - getContent(args?: Object): string; + getContent(args?: any): string; getNode(): any; getRng(): Range; collapse(toStart?: boolean): any; From 648d85936ee669957e5d214e00a5cde7c2a3bf88 Mon Sep 17 00:00:00 2001 From: Sean Nolan Date: Wed, 22 Feb 2017 14:30:33 +1300 Subject: [PATCH 022/374] Fixed build errors --- tinymce/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tinymce/index.d.ts b/tinymce/index.d.ts index b393c1c20e..e6a9374ab4 100644 --- a/tinymce/index.d.ts +++ b/tinymce/index.d.ts @@ -7,7 +7,7 @@ declare namespace TinyMCE { export interface Observable { - off(name?: string, callback?: void): void; + off(name?: string, callback ?: () => void): void; on(name: string, callback: () => void): void; fire(name: string, args?: any, bubble?: boolean): Event; } @@ -80,7 +80,7 @@ declare namespace TinyMCE { } export interface Collection { - active():Collection; + active(): Collection; } export interface Container { @@ -126,7 +126,7 @@ declare namespace TinyMCE { export interface Tools { grep(array: any, f: () => void): any; - each(o: Object, cb: () => void, s?: any): void; + each(o: any, cb: () => void, s?: any): void; } export interface UI { From 89e6daabefd894b3fe28a23f1aecb9df4bfc49c5 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Wed, 22 Feb 2017 15:29:23 +0900 Subject: [PATCH 023/374] Fix tsconfig for old module, update dependancy version --- redux-persist-transform-encrypt/package.json | 2 +- redux-persist-transform-encrypt/v0.1/tsconfig.json | 6 +++--- redux-persist-transform-filter/package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/redux-persist-transform-encrypt/package.json b/redux-persist-transform-encrypt/package.json index e186771ad7..058a03ac99 100644 --- a/redux-persist-transform-encrypt/package.json +++ b/redux-persist-transform-encrypt/package.json @@ -1,6 +1,6 @@ { "dependencies": { "redux": "^3.6.0", - "redux-persist": "^4.4.0" + "redux-persist": "^4.4.1" } } diff --git a/redux-persist-transform-encrypt/v0.1/tsconfig.json b/redux-persist-transform-encrypt/v0.1/tsconfig.json index b0a989e85a..dcabb54253 100644 --- a/redux-persist-transform-encrypt/v0.1/tsconfig.json +++ b/redux-persist-transform-encrypt/v0.1/tsconfig.json @@ -7,9 +7,9 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "baseUrl": "../", + "baseUrl": "../../", "typeRoots": [ - "../" + "../../" ], "types": [], "noEmit": true, @@ -19,4 +19,4 @@ "index.d.ts", "redux-persist-transform-encrypt-tests.ts" ] -} \ No newline at end of file +} diff --git a/redux-persist-transform-filter/package.json b/redux-persist-transform-filter/package.json index e186771ad7..058a03ac99 100644 --- a/redux-persist-transform-filter/package.json +++ b/redux-persist-transform-filter/package.json @@ -1,6 +1,6 @@ { "dependencies": { "redux": "^3.6.0", - "redux-persist": "^4.4.0" + "redux-persist": "^4.4.1" } } From e2f0f5b1458f39860ea8bb2f3a1c9e870eef41e0 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Wed, 22 Feb 2017 15:36:29 +0900 Subject: [PATCH 024/374] Add missing path mapping to redux-persist-transform-encrypt --- redux-persist-transform-encrypt/v0.1/tsconfig.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/redux-persist-transform-encrypt/v0.1/tsconfig.json b/redux-persist-transform-encrypt/v0.1/tsconfig.json index dcabb54253..aefe08ae89 100644 --- a/redux-persist-transform-encrypt/v0.1/tsconfig.json +++ b/redux-persist-transform-encrypt/v0.1/tsconfig.json @@ -10,7 +10,10 @@ "baseUrl": "../../", "typeRoots": [ "../../" - ], + ]. + "paths": { + "redux-persist-transform-encrypt": ["redux-persist-transform-encrypt/v0.1"] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true From 49cd3906e630ff5634a2ceda4ec949f834c7b82b Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Wed, 22 Feb 2017 15:44:09 +0900 Subject: [PATCH 025/374] Fix typo --- redux-persist-transform-encrypt/v0.1/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redux-persist-transform-encrypt/v0.1/tsconfig.json b/redux-persist-transform-encrypt/v0.1/tsconfig.json index aefe08ae89..99c5ba41bc 100644 --- a/redux-persist-transform-encrypt/v0.1/tsconfig.json +++ b/redux-persist-transform-encrypt/v0.1/tsconfig.json @@ -10,7 +10,7 @@ "baseUrl": "../../", "typeRoots": [ "../../" - ]. + ], "paths": { "redux-persist-transform-encrypt": ["redux-persist-transform-encrypt/v0.1"] }, From 9d913b0229ffc45ac544433d89a4373bcf934e46 Mon Sep 17 00:00:00 2001 From: morrisjdev Date: Wed, 22 Feb 2017 19:05:16 +0100 Subject: [PATCH 026/374] small changes in function definition --- linq4js/index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/linq4js/index.d.ts b/linq4js/index.d.ts index e108f31a4c..e6b9084ea3 100644 --- a/linq4js/index.d.ts +++ b/linq4js/index.d.ts @@ -11,9 +11,9 @@ declare namespace Linq4JS { } declare namespace Linq4JS { class Helper { - static ConvertStringFunction: (functionString: string) => any; - static ConvertFunction: (testFunction: any) => T; - static OrderCompareFunction: (valueSelector: (item: T) => any, a: T, b: T, invert: boolean) => number; + private static ConvertStringFunction(functionString); + static ConvertFunction(testFunction: string | T): T; + static OrderCompareFunction(valueSelector: (item: T) => any, a: T, b: T, invert: boolean): number; } } interface Array { @@ -148,7 +148,7 @@ interface Array { Take(count: number): T[]; /** * Takes entries as long as a condition is true - * @param condition The condition-function (or function-string) that returns a boolean. All elements until a false gets created are taken + * @param condition The condition-function (or function-string) that returns a boolean. All elements until a false gets thrown are taken * @param initial A initial-function (or function-string) that gets executed once at the start of the loop * @param after A function that gets executed after every element-iteration after the condition-function was evaluated */ @@ -280,4 +280,4 @@ declare namespace Linq4JS { Ascending = 0, Descending = 1, } -} \ No newline at end of file +} From a256a3c1065d73bbdba5280e1a795d5e417d7a66 Mon Sep 17 00:00:00 2001 From: Avi Vahl Date: Wed, 22 Feb 2017 21:02:51 +0200 Subject: [PATCH 027/374] lodash types compatibility with TypeScript 2.2 TypeScript 2.2 changed the built-in type of WeakMap to use the new object type in its generic subtype. Updated compat for target es5 and mark file as requiring TS2.2 --- lodash/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lodash/index.d.ts b/lodash/index.d.ts index 00de563bbb..70b086188c 100644 --- a/lodash/index.d.ts +++ b/lodash/index.d.ts @@ -2,7 +2,7 @@ // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.2 /** ### 4.0.0 Changelog (https://github.com/lodash/lodash/wiki/Changelog) @@ -19446,5 +19446,5 @@ declare global { interface Set { } interface Map { } interface WeakSet { } - interface WeakMap { } + interface WeakMap { } } From 5ac5d244171439468b176efe5948319a557bf779 Mon Sep 17 00:00:00 2001 From: Avi Vahl Date: Wed, 22 Feb 2017 21:25:51 +0200 Subject: [PATCH 028/374] Correct type of WeakMap's key in tests Keys should be an object. see: http://www.ecma-international.org/ecma-262/6.0/#sec-weakmap-objects --- lodash/lodash-tests.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 7d4105df70..588794fab4 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -7446,10 +7446,12 @@ namespace TestIsUndefined { // _.isWeakMap namespace TestIsWeakMap { { - let value: number|WeakMap; + interface Obj { a: string }; - if (_.isWeakMap(value)) { - let result: WeakMap = value; + let value: number|WeakMap; + + if (_.isWeakMap(value)) { + let result: WeakMap = value; } else { let result: number = value; From bdf48eb3a1fb7896b83e80a81863b74e0aec4ecb Mon Sep 17 00:00:00 2001 From: Avi Vahl Date: Wed, 22 Feb 2017 21:26:49 +0200 Subject: [PATCH 029/374] Adapt isWeakMap as well --- lodash/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lodash/index.d.ts b/lodash/index.d.ts index 70b086188c..d5453f4b91 100644 --- a/lodash/index.d.ts +++ b/lodash/index.d.ts @@ -12701,7 +12701,7 @@ declare namespace _ { * @param value The value to check. * @returns Returns true if value is correctly classified, else false. */ - isWeakMap(value?: any): value is WeakMap; + isWeakMap(value?: any): value is WeakMap; } interface LoDashImplicitWrapperBase { From e650a40fac972b3412a7e402f40146b13b691fd1 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Thu, 23 Feb 2017 12:14:22 +0100 Subject: [PATCH 030/374] Add definitions for fetch-jsonp (https://github.com/camsong/fetch-jsonp) --- fetch-jsonp/fetch-jsonp-tests.ts | 48 ++++++++++++++++++++++++++++++++ fetch-jsonp/index.d.ts | 15 ++++++++++ fetch-jsonp/tsconfig.json | 19 +++++++++++++ fetch-jsonp/tslint.json | 1 + 4 files changed, 83 insertions(+) create mode 100644 fetch-jsonp/fetch-jsonp-tests.ts create mode 100644 fetch-jsonp/index.d.ts create mode 100644 fetch-jsonp/tsconfig.json create mode 100644 fetch-jsonp/tslint.json diff --git a/fetch-jsonp/fetch-jsonp-tests.ts b/fetch-jsonp/fetch-jsonp-tests.ts new file mode 100644 index 0000000000..058f47e70c --- /dev/null +++ b/fetch-jsonp/fetch-jsonp-tests.ts @@ -0,0 +1,48 @@ +import * as fetchJsonp from 'fetch-jsonp'; + +/* Taken from https://github.com/camsong/fetch-jsonp/blob/v1.0.2/README.md */ + +fetchJsonp('/users.jsonp') + .then(function(response) { + return response.json() + }).then(function(json) { + console.log('parsed json', json) + }).catch(function(ex) { + console.log('parsing failed', ex) + }) + +fetchJsonp('/users.jsonp', { + jsonpCallback: 'custom_callback' + }) + .then(function(response) { + return response.json() + }).then(function(json) { + console.log('parsed json', json) + }).catch(function(ex) { + console.log('parsing failed', ex) + }) + +fetchJsonp('/users.jsonp', { + timeout: 3000, + jsonpCallback: 'custom_callback' + }) + .then(function(response) { + return response.json() + }).then(function(json) { + console.log('parsed json', json) + }).catch(function(ex) { + console.log('parsing failed', ex) + }) + +// Taken from https://github.com/camsong/fetch-jsonp/blob/v1.0.2/examples/index.html +var result = fetchJsonp('http://www.flickr.com/services/feeds/photos_public.gne?format=json', { + jsonpCallback: 'jsoncallback', + timeout: 3000 +}) +result.then(function(response) { + return response.json() +}).then(function(json) { + document.body.innerHTML = JSON.stringify(json); +})['catch'](function(ex) { + document.body.innerHTML = 'failed:' + ex; +}) diff --git a/fetch-jsonp/index.d.ts b/fetch-jsonp/index.d.ts new file mode 100644 index 0000000000..99867cdda2 --- /dev/null +++ b/fetch-jsonp/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for fetch-jsonp 1.0 +// Project: https://github.com/camsong/fetch-jsonp +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace fetchJsonp { + interface Options { + timeout?: number; + jsonpCallback?: string; + } +} + +declare function fetchJsonp(url: RequestInfo, options?: fetchJsonp.Options): Promise; + +export = fetchJsonp; diff --git a/fetch-jsonp/tsconfig.json b/fetch-jsonp/tsconfig.json new file mode 100644 index 0000000000..0aaee7fbf4 --- /dev/null +++ b/fetch-jsonp/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "lib": ["es6", "dom"], + "noUnusedLocals": true, + "noUnusedParameters": true, + "strictNullChecks": true, + "noImplicitAny": true, + "noImplicitThis": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true + }, + "files": [ + "index.d.ts", + "fetch-jsonp-tests.ts" + ] +} diff --git a/fetch-jsonp/tslint.json b/fetch-jsonp/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/fetch-jsonp/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From b33b361bba6c18b4ce91b1f825bab4198c5be528 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Thu, 23 Feb 2017 12:41:41 +0100 Subject: [PATCH 031/374] Add "module": "commonjs" --- fetch-jsonp/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/fetch-jsonp/tsconfig.json b/fetch-jsonp/tsconfig.json index 0aaee7fbf4..05c3f994ed 100644 --- a/fetch-jsonp/tsconfig.json +++ b/fetch-jsonp/tsconfig.json @@ -3,6 +3,7 @@ "baseUrl": "../", "typeRoots": ["../"], "types": [], + "module": "commonjs", "lib": ["es6", "dom"], "noUnusedLocals": true, "noUnusedParameters": true, From d1a477c46afe174d349d007c1021332d8cfce73c Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Thu, 23 Feb 2017 13:29:09 +0100 Subject: [PATCH 032/374] =?UTF-8?q?Add=20=E2=80=9CTypeScript=20Version:=20?= =?UTF-8?q?2.2=E2=80=9D=20header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fetch-jsonp/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/fetch-jsonp/index.d.ts b/fetch-jsonp/index.d.ts index 99867cdda2..e37094254e 100644 --- a/fetch-jsonp/index.d.ts +++ b/fetch-jsonp/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/camsong/fetch-jsonp // Definitions by: Tanguy Krotoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 declare namespace fetchJsonp { interface Options { From 6305a2105a763fbd859d63c2131a6e8ba249d98d Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Fri, 24 Feb 2017 08:58:26 +0900 Subject: [PATCH 033/374] Delete typings for minor version --- .../v0.1/index.d.ts | 18 ------------- .../v0.1/package.json | 5 ---- .../redux-persist-transform-encrypt-tests.ts | 13 ---------- .../v0.1/tsconfig.json | 25 ------------------- .../v0.1/tslint.json | 3 --- 5 files changed, 64 deletions(-) delete mode 100644 redux-persist-transform-encrypt/v0.1/index.d.ts delete mode 100644 redux-persist-transform-encrypt/v0.1/package.json delete mode 100644 redux-persist-transform-encrypt/v0.1/redux-persist-transform-encrypt-tests.ts delete mode 100644 redux-persist-transform-encrypt/v0.1/tsconfig.json delete mode 100644 redux-persist-transform-encrypt/v0.1/tslint.json diff --git a/redux-persist-transform-encrypt/v0.1/index.d.ts b/redux-persist-transform-encrypt/v0.1/index.d.ts deleted file mode 100644 index 048f02221f..0000000000 --- a/redux-persist-transform-encrypt/v0.1/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Type definitions for redux-persist-transform-encrypt 0.1 -// Project: https://github.com/maxdeviant/redux-persist-transform-encrypt#readme -// Definitions by: Karol Janyst -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -import { PersistTransformer } from "redux-persist"; - -export as namespace ReduxPersistEncryptor; - -export = createEncryptor; - -declare function createEncryptor (config: createEncryptor.EncryptorConfig): PersistTransformer; - -declare namespace createEncryptor { - export interface EncryptorConfig { - secretKey: string; - } -} diff --git a/redux-persist-transform-encrypt/v0.1/package.json b/redux-persist-transform-encrypt/v0.1/package.json deleted file mode 100644 index 36ce503807..0000000000 --- a/redux-persist-transform-encrypt/v0.1/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "redux": "^3.6.0" - } -} diff --git a/redux-persist-transform-encrypt/v0.1/redux-persist-transform-encrypt-tests.ts b/redux-persist-transform-encrypt/v0.1/redux-persist-transform-encrypt-tests.ts deleted file mode 100644 index b3a70dc776..0000000000 --- a/redux-persist-transform-encrypt/v0.1/redux-persist-transform-encrypt-tests.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { createStore, Reducer, Store } from "redux" -import { createPersistor, Persistor, PersistTransformer } from "redux-persist" -import { EncryptorConfig } from "redux-persist-transform-encrypt" -import * as createEncryptor from "redux-persist-transform-encrypt" - -const reducer: Reducer = (state: any, action: any) => ({}) - -const config: EncryptorConfig = { secretKey : "foo" } -const encryptor: PersistTransformer = createEncryptor(config) - -const store: Store = createStore(reducer) - -const persistor: Persistor = createPersistor(store, { transforms : [encryptor] }) diff --git a/redux-persist-transform-encrypt/v0.1/tsconfig.json b/redux-persist-transform-encrypt/v0.1/tsconfig.json deleted file mode 100644 index 99c5ba41bc..0000000000 --- a/redux-persist-transform-encrypt/v0.1/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "redux-persist-transform-encrypt": ["redux-persist-transform-encrypt/v0.1"] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "redux-persist-transform-encrypt-tests.ts" - ] -} diff --git a/redux-persist-transform-encrypt/v0.1/tslint.json b/redux-persist-transform-encrypt/v0.1/tslint.json deleted file mode 100644 index f9e30021f4..0000000000 --- a/redux-persist-transform-encrypt/v0.1/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../tslint.json" -} From 1dfe4c5dada036e164d2114a1cf3ebbb71224bf0 Mon Sep 17 00:00:00 2001 From: Jan Alonzo Date: Sat, 25 Feb 2017 15:55:05 +1100 Subject: [PATCH 034/374] Remove localforage and point to upstream typings instead --- localforage/index.d.ts | 115 ------------------------------ localforage/localforage-tests.ts | 117 ------------------------------- localforage/package.json | 5 ++ localforage/tsconfig.json | 23 ------ notNeededPackages.json | 8 ++- 5 files changed, 12 insertions(+), 256 deletions(-) delete mode 100644 localforage/index.d.ts delete mode 100644 localforage/localforage-tests.ts create mode 100644 localforage/package.json delete mode 100644 localforage/tsconfig.json diff --git a/localforage/index.d.ts b/localforage/index.d.ts deleted file mode 100644 index d0194ec60f..0000000000 --- a/localforage/index.d.ts +++ /dev/null @@ -1,115 +0,0 @@ -// Type definitions for Mozilla's localForage -// Project: https://github.com/mozilla/localforage -// Definitions by: yuichi david pichsenmeister -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface LocalForageOptions { - driver?: string | LocalForageDriver | LocalForageDriver[]; - - name?: string; - - size?: number; - - storeName?: string; - - version?: number; - - description?: string; -} - -interface LocalForageDbMethods { - getItem(key: string): Promise; - getItem(key: string, callback: (err: any, value: T) => void): void; - - setItem(key: string, value: T): Promise; - setItem(key: string, value: T, callback: (err: any, value: T) => void): void; - - removeItem(key: string): Promise; - removeItem(key: string, callback: (err: any) => void): void; - - clear(): Promise; - clear(callback: (err: any) => void): void; - - length(): Promise; - length(callback: (err: any, numberOfKeys: number) => void): void; - - key(keyIndex: number): Promise; - key(keyIndex: number, callback: (err: any, key: string) => void): void; - - keys(): Promise; - keys(callback: (err: any, keys: string[]) => void): void; - - iterate(iteratee: (value: any, key: string, iterationNumber: number) => any): Promise; - iterate(iteratee: (value: any, key: string, iterationNumber: number) => any, - callback: (err: any, result: any) => void): void; -} - -interface LocalForageDriverSupportFunc { - (): Promise; -} - -interface LocalForageDriver extends LocalForageDbMethods { - _driver: string; - - _initStorage(options: LocalForageOptions): void; - - _support?: boolean | LocalForageDriverSupportFunc; -} - -interface LocalForageSerializer { - serialize(value: T | ArrayBuffer | Blob, callback: (value: string, error: any) => void): void; - - deserialize(value: string): T | ArrayBuffer | Blob; - - stringToBuffer(serializedString: string): ArrayBuffer; - - bufferToString(buffer: ArrayBuffer): string; -} - -interface LocalForage extends LocalForageDbMethods { - LOCALSTORAGE: string; - WEBSQL: string; - INDEXEDDB: string; - - /** - * Set and persist localForage options. This must be called before any other calls to localForage are made, but can be called after localForage is loaded. - * If you set any config values with this method they will persist after driver changes, so you can call config() then setDriver() - * @param {LocalForageOptions} options? - */ - config(options: LocalForageOptions): boolean; - - /** - * Create a new instance of localForage to point to a different store. - * All the configuration options used by config are supported. - * @param {LocalForageOptions} options - */ - createInstance(options: LocalForageOptions): LocalForage; - - driver(): string; - /** - * Force usage of a particular driver or drivers, if available. - * @param {string} driver - */ - setDriver(driver: string | string[]): Promise; - setDriver(driver: string | string[], callback: () => void, errorCallback: (error: any) => void): void; - defineDriver(driver: LocalForageDriver): Promise; - defineDriver(driver: LocalForageDriver, callback: () => void, errorCallback: (error: any) => void): void; - /** - * Return a particular driver - * @param {string} driver - */ - getDriver(driver: string): Promise; - - getSerializer(): Promise; - getSerializer(callback: (serializer: LocalForageSerializer) => void): void; - - supports(driverName: string): boolean; - - ready(callback: () => void): void; - ready(): Promise; -} - -declare module "localforage" { - let localforage: LocalForage; - export = localforage; -} diff --git a/localforage/localforage-tests.ts b/localforage/localforage-tests.ts deleted file mode 100644 index e3edeba2d0..0000000000 --- a/localforage/localforage-tests.ts +++ /dev/null @@ -1,117 +0,0 @@ - - -declare let localForage: LocalForage; - -namespace LocalForageTest { - localForage.clear((err: any) => { - let newError: any = err; - }); - - localForage.iterate((str: string, key: string, num: number) => { - let newStr: string = str; - let newKey: string = key; - let newNum: number = num; - }); - - localForage.length((err: any, num: number) => { - let newError: any = err; - let newNumber: number = num; - }); - - localForage.length().then((num: number) => { - var newNumber: number = num; - }); - - localForage.key(0, (err: any, value: string) => { - let newError: any = err; - let newValue: string = value; - }); - - localForage.keys((err: any, keys: Array) => { - let newError: any = err; - let newArray: Array = keys; - }); - - localForage.keys().then((keys: Array) => { - var newArray: Array = keys; - }); - - localForage.getItem("key",(err: any, str: string) => { - let newError: any = err; - let newStr: string = str - }); - - localForage.getItem("key").then((str: string) => { - let newStr: string = str; - }); - - localForage.setItem("key", "value",(err: any, str: string) => { - let newError: any = err; - let newStr: string = str - }); - - localForage.setItem("key", "value").then((str: string) => { - let newStr: string = str; - }); - - localForage.removeItem("key",(err: any) => { - let newError: any = err; - }); - - localForage.removeItem("key").then(() => { - }); - - localForage.getDriver("CustomDriver").then((result: LocalForageDriver) => { - var driver: LocalForageDriver = result; - // we need to use a variable for proper type guards before TS 2.0 - var _support = driver._support; - if (typeof _support === "function") { - // _support = _support.bind(driver); - _support().then((result: boolean) => { - let doesSupport: boolean = result; - }); - } else if (typeof _support === "boolean") { - let doesSupport: boolean = _support; - } - }); - - { - let config: boolean; - - config = localForage.config({ - name: "testyo", - driver: localForage.LOCALSTORAGE - }); - } - - { - let store: LocalForage; - - store = localForage.createInstance({ - name: "da instance", - driver: localForage.LOCALSTORAGE - }); - } - - { - let testSerializer: LocalForageSerializer; - - localForage.getSerializer() - .then((serializer: LocalForageSerializer) => { - testSerializer = serializer; - }); - - localForage.getSerializer((serializer: LocalForageSerializer) => { - testSerializer = serializer; - }); - } - - { - let store: LocalForage; - - store.ready() - .then(() => {}); - - store.ready(() => {}); - } -} \ No newline at end of file diff --git a/localforage/package.json b/localforage/package.json new file mode 100644 index 0000000000..29f45814b2 --- /dev/null +++ b/localforage/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "localforage": ">=1.5.0" + } +} diff --git a/localforage/tsconfig.json b/localforage/tsconfig.json deleted file mode 100644 index 1e3cbf9e63..0000000000 --- a/localforage/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "localforage-tests.ts" - ] -} \ No newline at end of file diff --git a/notNeededPackages.json b/notNeededPackages.json index 0cd56b96d1..bcdf36987a 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -305,6 +305,12 @@ "typingsPackageName": "gaea-model", "sourceRepoURL": "https://github.com/ascoders/gaea-model", "asOfVersion": "0.0.0" + }, + { + "libraryName": "localforage", + "typingsPackageName": "localforage", + "sourceRepoURL": "https://github.com/localForage/localForage", + "asOfVersion": "0.0.34" } ] -} +} \ No newline at end of file From a8059edc7aab2c3ac955fb6049209c102fd3db86 Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Sat, 25 Feb 2017 12:55:26 -0500 Subject: [PATCH 035/374] placeId => placeid As per https://developers.google.com/places/web-service/details --- googlemaps/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googlemaps/index.d.ts b/googlemaps/index.d.ts index 06eba68a94..d4d0935717 100644 --- a/googlemaps/index.d.ts +++ b/googlemaps/index.d.ts @@ -2258,7 +2258,7 @@ declare namespace google.maps { } export interface PlaceDetailsRequest { - placeId: string; + placeid: string; } export interface PlaceGeometry { From d2267ead2004bf3e87d769808ab51532fc5db132 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Mon, 27 Feb 2017 18:00:08 +0100 Subject: [PATCH 036/374] Fix fetch-mock with TypeScript version 2.2 --- fetch-mock/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch-mock/index.d.ts b/fetch-mock/index.d.ts index 4d69096845..bda708ee55 100644 --- a/fetch-mock/index.d.ts +++ b/fetch-mock/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/wheresrhys/fetch-mock // Definitions by: Alexey Svetliakov , Tamir Duberstein , Risto Keravuori // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +// TypeScript Version: 2.2 type MockRequest = Request | RequestInit; From 0238bbea2cf64071e9ef7c616085450febc56246 Mon Sep 17 00:00:00 2001 From: fatsu Date: Mon, 27 Feb 2017 21:48:54 +0100 Subject: [PATCH 037/374] - path should be (string | number)[] - some currying problems with path related functions --- ramda/index.d.ts | 32 +++++++++++++------------- ramda/ramda-tests.ts | 53 +++++++++++++++++++++++++++++++++----------- 2 files changed, 56 insertions(+), 29 deletions(-) diff --git a/ramda/index.d.ts b/ramda/index.d.ts index 114ba38d6d..44d4c33304 100644 --- a/ramda/index.d.ts +++ b/ramda/index.d.ts @@ -8,6 +8,8 @@ declare var R: R.Static; declare namespace R { type Ord = number | string | boolean; + type Path = number | string; + interface ListIterator { (value: T, index: number, list: T[]): TResult; } @@ -221,9 +223,9 @@ declare namespace R { * Makes a shallow clone of an object, setting or overriding the nodes required to create the given path, and * placing the specific value at the tail end of that path. */ - assocPath(path: string[], val: T, obj: U): U; - assocPath(path: string[]): (val: T, obj: U) => U; - assocPath(path: string[], val: T): (obj: U) => U; + assocPath(path: Path[], val: T, obj: U): U; + assocPath(path: Path[], val: T): (obj: U) => U; + assocPath(path: Path[]): CurriedFunction2; /** * Wraps a function of any arity (including nullary) in a function that accepts exactly 2 @@ -439,8 +441,8 @@ declare namespace R { /** * Makes a shallow clone of an object, omitting the property at the given path. */ - dissocPath(path: string[], obj: any): T; - dissocPath(path: string[]): (obj: any) => T; + dissocPath(path: Path[], obj: any): T; + dissocPath(path: Path[]): (obj: any) => T; /** * Divides two numbers. Equivalent to a / b. @@ -838,7 +840,7 @@ declare namespace R { * Returns a lens whose focus is the specified path. * See also view, set, over. */ - lensPath(path: string[]): Lens; + lensPath(path: Path[]): Lens; /** * lensProp creates a lens that will focus on property k of the source object. @@ -1129,26 +1131,24 @@ declare namespace R { /** * Retrieve the value at a given path. */ - path(path: string[], obj: any): T; - path(path: string[]): (obj: any) => T; + path(path: Path[], obj: any): T; + path(path: Path[]): (obj: any) => T; /** * Determines whether a nested path on an object has a specific value, * in `R.equals` terms. Most likely used to filter a list. */ - pathEq(path: string[], val: any, obj: any): boolean; - pathEq(path: string[], val: any): (obj: any) => boolean; - pathEq(path: string[]): (val: any, obj: any) => boolean; - pathEq(path: string[]): (val: any) => (obj: any) => boolean; + pathEq(path: Path[], val: any, obj: any): boolean; + pathEq(path: Path[], val: any): (obj: any) => boolean; + pathEq(path: Path[]): CurriedFunction2; /** * If the given, non-null object has a value at the given path, returns the value at that path. * Otherwise returns the provided default value. */ - pathOr(d: T, p: string[], obj: any): T|any; - pathOr(d: T, p: string[]): (obj: any) => T|any; - pathOr(d: T): (p: string[], obj: any) => T|any; - + pathOr(d: T, p: Path[], obj: any): T|any; + pathOr(d: T, p: Path[]): (obj: any) => T|any; + pathOr(d: T): CurriedFunction2; /** * Returns a partial copy of an object containing only the keys specified. If the key does not exist, the diff --git a/ramda/ramda-tests.ts b/ramda/ramda-tests.ts index e42ae16c63..13aeb222f7 100644 --- a/ramda/ramda-tests.ts +++ b/ramda/ramda-tests.ts @@ -491,6 +491,14 @@ R.times(i, 5); R.findLastIndex((x: number) => x === 1, [1, 2, 3]); } () => { + const testPath = ['x', 0, 'y']; + const testObj = {x: [{y: 2, z: 3}, {y: 4, z: 5}]}; + + R.pathEq(testPath, 2, testObj); // => true + R.pathEq(testPath, 2)(testObj); // => true + R.pathEq(testPath)(2)(testObj); // => true + R.pathEq(testPath)(2, testObj); // => true + var user1 = { address: { zipCode: 90210 } }; var user2 = { address: { zipCode: 55555 } }; var user3 = { name: 'Bob' }; @@ -1028,9 +1036,13 @@ type Pair = KeyValuePair } () => { - const a = R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}} - const b = R.assocPath(['a', 'b', 'c'])(42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}} - const c = R.assocPath(['a', 'b', 'c'], 42)({a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}} + const testPath = ['x', 0, 'y']; + const testObj = {x: [{y: 2, z: 3}, {y: 4, z: 5}]}; + + R.assocPath(testPath, 42, testObj); //=> {x: [{y: 42, z: 3}, {y: 4, z: 5}]} + R.assocPath(testPath, 42)(testObj); //=> {x: [{y: 42, z: 3}, {y: 4, z: 5}]} + R.assocPath(testPath)(42)(testObj); //=> {x: [{y: 42, z: 3}, {y: 4, z: 5}]} + R.assocPath(testPath)(42, testObj); //=> {x: [{y: 42, z: 3}, {y: 4, z: 5}]} } () => { @@ -1038,6 +1050,12 @@ type Pair = KeyValuePair // optionally specify return type const a2 = R.dissocPath<{a :{ b: number}}>(['a', 'b', 'c'], {a: {b: {c: 42}}}); //=> {a: {b: {}}} const a3 = R.dissocPath(['a', 'b', 'c'])({a: {b: {c: 42}}}); //=> {a: {b: {}}} + + const testPath = ['x', 0, 'y']; + const testObj = {x: [{y: 2, z: 3}, {y: 4, z: 5}]}; + + R.dissocPath(testPath, testObj); //=> {x: [{z: 3}, {y: 4, z: 5}]} + R.dissocPath(testPath)(testObj); //=> {x: [{z: 3}, {y: 4, z: 5}]} } () => { @@ -1163,11 +1181,12 @@ class Rectangle { } () => { - const xyLens = R.lensPath(['x', 'y']); + const xyLens = R.lensPath(['x', 0, 'y']); + const testObj = {x: [{y: 2, z: 3}, {y: 4, z: 5}]}; - R.view(xyLens, {x: {y: 2, z: 3}}); //=> 2 - R.set(xyLens, 4, {x: {y: 2, z: 3}}); //=> {x: {y: 4, z: 3}} - R.over(xyLens, R.negate, {x: {y: 2, z: 3}}); //=> {x: {y: -2, z: 3}} + R.view(xyLens, testObj); //=> 2 + R.set(xyLens, 4, testObj); //=> {x: [{y: 4, z: 3}, {y: 4, z: 5}]} + R.over(xyLens, R.negate, testObj); //=> {x: [{y: -2, z: 3}, {y: 4, z: 5}]} } () => { @@ -1242,10 +1261,15 @@ class Rectangle { } () => { - const a1 = R.pathOr('N/A', ['a', 'b'], {a: {b: 2}}); //=> 2 - const a2 = R.pathOr('N/A', ['a', 'b'])({a: {b: 2}}); //=> 2 - const a3 = R.pathOr('N/A', ['a', 'b'], {c: {b: 2}}); //=> "N/A" - const a4 = R.pathOr({c:2})(['a', 'b'], {c: {b: 2}}); //=> "N/A" + const orValue = 'N/A'; + const testPath = ['x', 0, 'y']; + const testObj = {x: [{y: 2, z: 3}, {y: 4, z: 5}]}; + + R.pathOr(orValue, testPath, testObj); //=> 2 + R.pathOr(orValue, testPath)(testObj); //=> 2 + R.pathOr(orValue)(testPath)(testObj); //=> 2 + R.pathOr(orValue)(testPath, testObj); //=> 2 + R.pathOr(orValue, testPath, {c: {b: 2}}); //=> "N/A" } () => { @@ -1586,8 +1610,11 @@ matchPhrases(['foo', 'bar', 'baz']); } () => { - R.path(['a', 'b'], {a: {b: 2}}); //=> 2 - R.path(['a', 'b'])({a: {b: 2}}); //=> 2 + const testPath = ['x', 0, 'y']; + const testObj = {x: [{y: 2, z: 3}, {y: 4, z: 5}]}; + + R.path(testPath, testObj); //=> 2 + R.path(testPath)(testObj); //=> 2 } () => { From 09898b0b428078dd8b0a4335e2e4df04ab1068ab Mon Sep 17 00:00:00 2001 From: Tom Goemaes Date: Tue, 28 Feb 2017 09:49:00 +0100 Subject: [PATCH 038/374] Update index.d.ts --- ramda/index.d.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/ramda/index.d.ts b/ramda/index.d.ts index 44d4c33304..80fad023cc 100644 --- a/ramda/index.d.ts +++ b/ramda/index.d.ts @@ -8,7 +8,7 @@ declare var R: R.Static; declare namespace R { type Ord = number | string | boolean; - type Path = number | string; + type Path = (number | string)[]; interface ListIterator { (value: T, index: number, list: T[]): TResult; @@ -223,9 +223,9 @@ declare namespace R { * Makes a shallow clone of an object, setting or overriding the nodes required to create the given path, and * placing the specific value at the tail end of that path. */ - assocPath(path: Path[], val: T, obj: U): U; - assocPath(path: Path[], val: T): (obj: U) => U; - assocPath(path: Path[]): CurriedFunction2; + assocPath(path: Path, val: T, obj: U): U; + assocPath(path: Path, val: T): (obj: U) => U; + assocPath(path: Path): CurriedFunction2; /** * Wraps a function of any arity (including nullary) in a function that accepts exactly 2 @@ -441,8 +441,8 @@ declare namespace R { /** * Makes a shallow clone of an object, omitting the property at the given path. */ - dissocPath(path: Path[], obj: any): T; - dissocPath(path: Path[]): (obj: any) => T; + dissocPath(path: Path, obj: any): T; + dissocPath(path: Path): (obj: any) => T; /** * Divides two numbers. Equivalent to a / b. @@ -840,7 +840,7 @@ declare namespace R { * Returns a lens whose focus is the specified path. * See also view, set, over. */ - lensPath(path: Path[]): Lens; + lensPath(path: Path): Lens; /** * lensProp creates a lens that will focus on property k of the source object. @@ -1131,24 +1131,24 @@ declare namespace R { /** * Retrieve the value at a given path. */ - path(path: Path[], obj: any): T; - path(path: Path[]): (obj: any) => T; + path(path: Path, obj: any): T; + path(path: Path): (obj: any) => T; /** * Determines whether a nested path on an object has a specific value, * in `R.equals` terms. Most likely used to filter a list. */ - pathEq(path: Path[], val: any, obj: any): boolean; - pathEq(path: Path[], val: any): (obj: any) => boolean; - pathEq(path: Path[]): CurriedFunction2; + pathEq(path: Path, val: any, obj: any): boolean; + pathEq(path: Path, val: any): (obj: any) => boolean; + pathEq(path: Path): CurriedFunction2; /** * If the given, non-null object has a value at the given path, returns the value at that path. * Otherwise returns the provided default value. */ - pathOr(d: T, p: Path[], obj: any): T|any; - pathOr(d: T, p: Path[]): (obj: any) => T|any; - pathOr(d: T): CurriedFunction2; + pathOr(d: T, p: Path, obj: any): T|any; + pathOr(d: T, p: Path): (obj: any) => T|any; + pathOr(d: T): CurriedFunction2; /** * Returns a partial copy of an object containing only the keys specified. If the key does not exist, the From f7ab322332c2a6e3d923402cec1db0811ea753f2 Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Thu, 2 Mar 2017 11:36:31 +0100 Subject: [PATCH 039/374] Modernizr: various fixes. Updated version to 3.3, since all everything new since 3.2 was already added. --- modernizr/index.d.ts | 95 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 77 insertions(+), 18 deletions(-) diff --git a/modernizr/index.d.ts b/modernizr/index.d.ts index 7fd0ffa316..44d3c40775 100644 --- a/modernizr/index.d.ts +++ b/modernizr/index.d.ts @@ -1,19 +1,19 @@ -// Type definitions for Modernizr 3.2 +// Type definitions for Modernizr 3.3 // Project: http://modernizr.com/ // Definitions by: Boris Yankov , Theodore Brown , Leon Yu , Luca Trazzi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface AudioBoolean { - ogg: boolean; - mp3: boolean; - wav: boolean; - m4a: boolean; + ogg: string; + mp3: string; + wav: string; + m4a: string; } interface VideoBoolean { - ogg: boolean; - h264: boolean; - webm: boolean; + ogg: string; + h264: string; + webm: string; } interface InputBoolean { @@ -45,6 +45,66 @@ interface InputTypesBoolean { week: boolean; } +interface CssColumnsBoolean extends Boolean { + breakafter: boolean; + breakbefore: boolean; + breakinside: boolean; + fill: boolean; + gap: boolean; + rule: boolean; + rulecolor: boolean; + rulestyle: boolean; + rulewidth: boolean; + span: boolean; + width: boolean; +} + +interface FlashBoolean extends Boolean { + blocked: boolean; +} + +interface IndexeddbBoolean extends Boolean { + deletedatabase: boolean; +} + +interface WebglextensionsBoolean extends Boolean { + ANGLE_instanced_arrays: boolean; + EXT_blend_minmax: boolean; + EXT_disjoint_timer_query: boolean; + EXT_frag_depth: boolean; + EXT_sRGB: boolean; + EXT_shader_texture_lod: boolean; + EXT_texture_filter_anisotropic: boolean; + OES_element_index_uint: boolean; + OES_standard_derivatives: boolean; + OES_texture_float: boolean; + OES_texture_float_linear: boolean; + OES_texture_half_float: boolean; + OES_texture_half_float_linear: boolean; + OES_vertex_array_object: boolean; + WEBGL_compressed_texture_etc1: boolean; + WEBGL_compressed_texture_s3tc: boolean; + WEBGL_debug_renderer_info: boolean; + WEBGL_debug_shaders: boolean; + WEBGL_depth_texture: boolean; + WEBGL_draw_buffers: boolean; + WEBGL_lose_context: boolean; + WEBKIT_EXT_texture_filter_anisotropic: boolean; + WEBKIT_WEBGL_compressed_texture_s3tc: boolean; + WEBKIT_WEBGL_depth_texture: boolean; + WEBKIT_WEBGL_lose_context: boolean; +} + +interface WebpBoolean extends Boolean { + alpha: boolean; + animation: boolean; + lossless: boolean; +} + +interface DatauriBoolean extends Boolean { + over32kb: boolean; +} + interface FeatureDetects { // Documented @@ -67,7 +127,7 @@ interface FeatureDetects { emoji: boolean; eventlistener: boolean; exiforientation: boolean; - flash: boolean; + flash: false | FlashBoolean; forcetouch: boolean; fullscreen: boolean; gamepads: boolean; @@ -77,7 +137,7 @@ interface FeatureDetects { history: boolean; htmlimports: boolean; ie8compat: boolean; - indexeddb: boolean; + indexeddb: false | IndexeddbBoolean; indexeddbblob: boolean; input: InputBoolean; search: boolean; @@ -143,7 +203,7 @@ interface FeatureDetects { csscalc: boolean; checked: boolean; csschunit: boolean; - csscolumns: boolean; + csscolumns: false | CssColumnsBoolean; cubicbezierrange: boolean; "display-runin": boolean; displaytable: boolean; @@ -266,8 +326,7 @@ interface FeatureDetects { webpalpha: boolean; webpanimation: boolean; webplossless: boolean; - "webp-lossless": boolean; - webp: boolean; + webp: false | WebpBoolean; inputformaction: boolean; inputformenctype: boolean; inputformmethod: boolean; @@ -299,12 +358,12 @@ interface FeatureDetects { smil: boolean; textareamaxlength: boolean; bloburls: boolean; - datauri: boolean; + datauri: false | DatauriBoolean; urlparser: boolean; videoautoplay: boolean; videoloop: boolean; videopreload: boolean; - webglextensions: boolean; + webglextensions: false | WebglextensionsBoolean; datachannel: boolean; getusermedia: boolean; peerconnection: boolean; @@ -344,8 +403,8 @@ interface Dictionary { interface ModernizrAPI { on(feature: string, cb: (result: boolean) => any): void; - addTest(feature: string, test: (() => boolean) | boolean): void; - addTest(feature: Dictionary): void; + addTest(feature: string, test: (() => boolean) | boolean): ModernizrStatic; + addTest(feature: Dictionary): ModernizrStatic; atRule(prop: string): boolean; @@ -360,7 +419,7 @@ interface ModernizrAPI { prefixedCSS(prop: string): string; - prefixedCSSValue(prop: string, value: string): string; + prefixedCSSValue(prop: string, value: string): boolean; _prefixes: string[]; From 52031f3484ee170fcd343fa90a7684855fb6844c Mon Sep 17 00:00:00 2001 From: Lauri Koskela Date: Thu, 2 Mar 2017 18:02:52 +0200 Subject: [PATCH 040/374] Update time scale options - add `minUnit` option - change `round` option to only accept TimeUnits - remove deprecated `format` option --- chart.js/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chart.js/index.d.ts b/chart.js/index.d.ts index 08781f4463..206be68c92 100644 --- a/chart.js/index.d.ts +++ b/chart.js/index.d.ts @@ -410,16 +410,16 @@ declare namespace Chart { } export interface TimeScale extends ChartScales { - format?: string; displayFormats?: TimeDisplayFormat; isoWeekday?: boolean; max?: string; min?: string; parser?: string | ((arg: any) => any); - round?: string; + round?: TimeUnit; tooltipFormat?: string; unit?: TimeUnit; unitStepSize?: number; + minUnit?: TimeUnit; } export interface RadialLinearScale { From 5f56a7e5e1eabe1d55740f3961ca1fa4c7988d6b Mon Sep 17 00:00:00 2001 From: Jed Mao Date: Sun, 5 Mar 2017 08:48:17 -0600 Subject: [PATCH 041/374] Update vinyl-fs options --- vinyl-fs/index.d.ts | 56 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/vinyl-fs/index.d.ts b/vinyl-fs/index.d.ts index 4fa6101b69..52aa5cd506 100644 --- a/vinyl-fs/index.d.ts +++ b/vinyl-fs/index.d.ts @@ -27,32 +27,70 @@ interface SrcOptions extends globStream.Options { /** * Specifies the folder relative to the cwd * This is used to determine the file names when saving in .dest() - * Default is where the glob begins + * Default: where the glob begins */ base?: string; /** * Setting this to false will make file.contents a paused stream * If true it will buffer the file contents - * Defaults to true + * Default: true */ buffer?: boolean; /** - * Setting this to false will ignore the contents of the file and disable writing to disk to speed up operations - * Defaults to true + * The mode the directory should be created with. + * Default: the process mode + */ + dirMode?: number; + + /** + * Whether or not you want globs to match on dot files or not + * (e.g., `.gitignore`). + */ + dot?: boolean; + + /** + * Whether or not to recursively resolve symlinks to their targets. + * Setting to `false` to preserve them as symlinks and make `file.symlink` + * equal the original symlink's target path. + * Default: true + */ + followSymlinks?: boolean; + + /** + * Setting this to false will ignore the contents of the file and disable + * writing to disk to speed up operations + * Default: true */ read?: boolean; - /** Only find files that have been modified since the time specified */ + /** + * Whether or not the symlink should be relative or absolute. + * Default: false + */ + relative?: boolean; + + /** Only find files that have been modified since the time specified */ since?: Date|number; - /** Setting this to true will create a duplex stream, one that passes through items and emits globbed files. - * Defaults to false */ + /** + * Causes the BOM to be stripped on UTF-8 encoded files. Set to `false` + * if you need the BOM for some reason. + */ + stripBOM?: boolean; + + /** + * Setting this to true will create a duplex stream, one that passes + * through items and emits globbed files. + * Default: false + */ passthrough?: boolean; - /** Setting this to true will enable sourcemaps. - * Defaults to false */ + /** + * Setting this to true will enable sourcemaps. + * Default: false + */ sourcemaps?: boolean; } From 638891042fc8b67f9c60022dfe6f7911723eda25 Mon Sep 17 00:00:00 2001 From: Leonidas Arvanitis Date: Sun, 5 Mar 2017 21:26:44 +0200 Subject: [PATCH 042/374] Fix and update according to version 2.1.3 - Added missing methods and options - Removed non-existing options - Expanded comments with default values For this update I used both the site and the code of Toastr to find missing and undocumented (only public ofc.) members. --- toastr/index.d.ts | 381 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 269 insertions(+), 112 deletions(-) diff --git a/toastr/index.d.ts b/toastr/index.d.ts index 5cd8b30c82..767627c95d 100644 --- a/toastr/index.d.ts +++ b/toastr/index.d.ts @@ -8,214 +8,371 @@ interface ToastrOptions { /** - * Optionally override the animation easing to show or hide the toasts. Default is swing. swing and linear are built into jQuery. - */ + * Optionally override the animation easing to show or hide the toasts. + * swing and linear are built into jQuery. + * @default swing + */ showEasing?: string; /** - * Optionally override the animation easing to show or hide the toasts. Default is swing. swing and linear are built into jQuery. - */ + * Optionally override the animation easing to show or hide the toasts. + * swing and linear are built into jQuery. + * @default swing + */ hideEasing?: string; /** - * Use the jQuery show/hide method of your choice. These default to fadeIn/fadeOut. The methods fadeIn/fadeOut, slideDown/slideUp, and show/hide are built into jQuery. - */ + * Use the jQuery show method of your choice. + * The methods fadeIn/fadeOut, slideDown/slideUp, and show/hide are built into jQuery. + * @default fadeIn + */ showMethod?: string; /** - * Use the jQuery show/hide method of your choice. These default to fadeIn/fadeOut. The methods fadeIn/fadeOut, slideDown/slideUp, and show/hide are built into jQuery. - */ + * Use the jQuery hide method of your choice. + * The methods fadeIn/fadeOut, slideDown/slideUp, and show/hide are built into jQuery. + * @default fadeOut + */ hideMethod?: string; /** - * Should a close button be shown - */ + * Should a close button be shown? + * @default undefined + */ closeButton?: boolean; /** - * Html for the close button - */ + * CSS class the close button will be given. + * @default toast-close-button + */ + closeClass?: string; + /** + * Time in milliseconds the toast should take to hide, when the close button is clicked. + * Falls back to hide configuration. + * @default false + */ + closeDuration?: number; + /** + * The animation easing while hiding the toast, when the close button is clicked. + * Falls back to hide configuration. + * swing and linear are built into jQuery. + * @default false + */ + closeEasing?: string; + /** + * Use the jQuery show/hide method of your choice, when the close button is clicked. + * Falls back to hide configuration. + * The methods fadeIn/fadeOut, slideDown/slideUp, and show/hide are built into jQuery. + * @default false + */ + closeMethod?: string; + /** + * Set to false so that the toast hides event if hovered. + * @default true + */ + closeOnHover?: boolean; + /** + * Html for the close button. + */ closeHtml?: string; /** - * Should clicking on toast dismiss it? - */ + * onCloseClick function callback, fired when the close button is clicked. + * Closing cannot be prevented by ev.stopPropagation() etc. + * @default undefined + */ + onCloseClick?: (ev: JQueryMouseEventObject) => void; + /** + * Should clicking on toast dismiss it? + * @default true + */ tapToDismiss?: boolean; /** - * CSS class the toast element will be given - */ + * CSS class the toast element will be given. + * @default toast + */ toastClass?: string; /** - * Id toast container will be given - */ + * Id toast container will be given. + * @default toast-container + */ containerId?: string; /** - * Should debug details be outputted to the console - */ + * Should debug details be outputted to the console? + * @default false + */ debug?: boolean; /** - * Time in milliseconds the toast should take to show - */ + * Time in milliseconds the toast should take to show. + * @default 300 + */ showDuration?: number; /** - * onShown function callback - **/ + * onShown function callback. + * @default undefined + */ onShown?: () => void; /** - * Time in milliseconds the toast should take to hide - */ + * Time in milliseconds the toast should take to hide. + * @default 1000 + */ hideDuration?: number; /** - * onHidden function callback - **/ + * onHidden function callback. + * @default undefined + */ onHidden?: () => void; /** - * Time in milliseconds the toast should be displayed after mouse over - */ + * Time in milliseconds the toast should be displayed after leaving mouse over. + * Set timeOut and extendedTimeOut to 0 to make it sticky. + * @default 1000 + */ extendedTimeOut?: number; + /** + * If specified, you must provide all classes. + */ iconClasses?: { /** - * Icon to use on error toasts - */ + * Icon to use on error toasts. + * @default toast-error + */ error: string; /** - * Icon to use on info toasts - */ + * Icon to use on info toasts. + * @default toast-info + */ info: string; /** - * Icon to use on success toasts - */ + * Icon to use on success toasts. + * @default toast-success + */ success: string; /** - * Icon to use on warning toasts - */ + * Icon to use on warning toasts. + * @default toast-warning + */ warning: string; }; /** - * Icon to use for toast - */ + * Icon to use for toast. + * @default toast-info + */ iconClass?: string; /** - * Where toast should be displayed - */ + * Where toast should be displayed. + * The default stylesheet covers: + * toast-top-left, toast-top-center, toast-top-right, toast-top-full-width, + * toast-bottom-left, toast-bottom-center, toast-bottom-right, toast-bottom-full-width + * @default toast-top-right + */ positionClass?: string; /** - * Where toast should be displayed - background - */ - backgroundpositionClass?: string; - /** - * Time in milliseconds that the toast should be displayed - */ + * Time in milliseconds that the toast should be displayed. + * Set timeOut and extendedTimeOut to 0 to make it sticky. + * @default 5000 + */ timeOut?: number; /** - * CSS class the title element will be given - */ + * CSS class the title element will be given. + * @default toast-title + */ titleClass?: string; /** - * CSS class the message element will be given - */ + * CSS class the message element will be given. + * @default toast-message + */ messageClass?: string; /** - * Set newest toast to appear on top - **/ + * Set newest toast to appear on top. + * @default true + */ newestOnTop?: boolean; /** - * The element to put the toastr container - **/ + * The element to put the toastr container + * @default body + */ target?: string; /** - * Rather than having identical toasts stack, set the preventDuplicates property to true. Duplicates are matched to the previous toast based on their message content. - */ + * Rather than having identical toasts stack, set the preventDuplicates property to true. + * Duplicates are matched to the previous toast based on their message content. + * @default false + */ preventDuplicates?: boolean; /** - * Visually indicates how long before a toast expires. - */ + * Visually indicates how long before a toast expires. + * @default false + */ progressBar?: boolean; /** - * Function to execute on toast click - */ - onclick?: () => void; + * CSS class the progressbar element will be given. + * @default toast-progress + */ + progressClass?: string; /** - * Set if toastr should parse containing html - **/ - allowHtml?: boolean; + * Function to execute on toast click. Closing cannot be prevented by ev.stopPropagation() etc. + * @default undefined + */ + onclick?: (ev: JQueryMouseEventObject) => void; /** - * Set if toastr should escape html - **/ + * Should the title and message text be escaped? + * @default false + */ escapeHtml?: boolean; + /** + * Flip the toastr to be displayed properly for right-to-left languages. + * @default false + */ + rtl?: boolean; } interface ToastrDisplayMethod { /** - * Create a toast - * - * @param message Message to display in toast - */ + * Create a toast + * + * @param message Message to display in toast + */ (message: string): JQuery; /** - * Create a toast - * - * @param message Message to display in toast - * @param title Title to display on toast - */ + * Create a toast + * + * @param message Message to display in toast + * @param title Title to display on toast + */ (message: string, title: string): JQuery; /** - * Create a toast - * - * @param message Message to display in toast - * @param title Title to display on toast - * @param overrides Option values for toast - */ + * Create a toast + * + * @param message Message to display in toast + * @param title Title to display on toast + * @param overrides Option values for toast + */ (message: string, title: string, overrides: ToastrOptions): JQuery; } +type ToastrType = 'error'|'info'|'success'|'warning'; + +interface ToastMap { + /** + * The toast type. + */ + type: ToastrType; + /** + * The toast message. + */ + message: string; + /** + * The toast icon class. + */ + iconClass: string; + /** + * The toast title. + */ + title?: string; + /** + * Any override options specified when the toast was created. + */ + optionsOverride?: ToastrOptions; +} + +interface ToastrResponse { + /** + * The internal toast id. + */ + toastId: number; + /** + * The current state of the toast. + */ + state: 'visible'|'hidden'; + /** + * The datetime the toast was opened. + */ + startTime: Date; + /** + * The datetime the toast was closed, if the state is hidden. + */ + endTime?: Date; + /** + * The toastr options. + */ + options: ToastrOptions; + /** + * The event's toast details. + */ + map: ToastMap; +} + interface Toastr { /** - * Clear toasts - */ + * Clear toasts + */ clear: { /** - * Clear all toasts - */ + * Clear all toasts + */ (): void; /** - * Clear specific toast - * - * @param toast Toast to clear - */ + * Clear specific toast + * + * @param toast Toast to clear + */ (toast: JQuery): void; - /** - * Clear specific toast - * - * @param toast Toast to clear - * @param clearOptions force clearing a toast, ignoring focus - */ - (toast: JQuery, clearOptions: { force: boolean }): void; + /** + * Clear specific toast + * + * @param toast Toast to clear + * @param clearOptions force clearing a toast, ignoring focus + */ + (toast: JQuery, clearOptions: {force: boolean}): void; }; /** - * Removes all toasts (without animation) - */ + * Removes all toasts (without animation) + */ remove: { (): void; }; /** - * Create an error toast - */ + * Create an error toast + */ error: ToastrDisplayMethod; /** - * Create an info toast - */ + * Create an info toast + */ info: ToastrDisplayMethod; /** - * Create an options object - */ + * The toatsr options object + */ options: ToastrOptions; /** - * Create a success toast - */ + * Create a success toast + */ success: ToastrDisplayMethod; /** - * Create a warning toast - */ + * Create a warning toast + */ warning: ToastrDisplayMethod; /** - * Get toastr version - */ + * Get toastr version + */ version: string; + /** + * Get or create a container. + */ + getContainer: { + /** + * Get the container by options.containerId. + * + * @param options Option values for the container + */ + (options?: ToastrOptions): JQuery, + /** + * Get the container by options.containerId. + * If it doesn't exist, it will be created according to options. + * + * @param options Option values for the container + * @param create Use true to create a container, if it doesn't exist + */ + (options: ToastrOptions, create: boolean): JQuery, + }; + /** + * Register a callback to be called when a toast gets created or hidden. + * + * @param callback The function which will be passed the event details. + */ + subscribe: (callback: (response: ToastrResponse) => any) => void; [key: string]: any; } From 92be25fe09e45373607ca5c247622becc08a2751 Mon Sep 17 00:00:00 2001 From: Marcel Good Date: Sun, 5 Mar 2017 17:08:47 -0800 Subject: [PATCH 043/374] Update breeze-client type definitions --- breeze/index.d.ts | 104 ++++++++++++++++++++++++++-------------------- 1 file changed, 60 insertions(+), 44 deletions(-) diff --git a/breeze/index.d.ts b/breeze/index.d.ts index 8cc109d746..323e9a8f87 100644 --- a/breeze/index.d.ts +++ b/breeze/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Breeze 1.5.x +// Type definitions for Breeze 1.6.3 // Project: http://www.breezejs.com/ // Definitions by: Boris Yankov , IdeaBlade // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,7 +12,10 @@ // Updated Jan 20 2015 for Breeze 1.5.2 and merging changes from DefinitelyTyped // Updated Feb 28 2015 add any/all clause on Predicate // Updated Jun 27 2016 - Marcel Good (www.ideablade.com) -// Updated Jul 28 2016 - Serkan "coni2k" Holat +// Updated Jun 29 2016 - Marcel Good (www.ideablade.com) +// Updated Jul 15 2016 - Added methods to JsonResultsAdapter - Steve Schmitt +// Updated Sep 23 2016 - Added core methods +// Updated March 5 2017 - Eliminate promises.IPromise and replace with Promise declare namespace breeze.core { @@ -89,6 +92,19 @@ declare namespace breeze.core { export function stringStartsWith(str: string, prefix: string): boolean; export function stringEndsWith(str: string, suffix: string): boolean; export function formatString(format: string, ...args: any[]): string; + + /** Change text to title case with spaces, e.g. 'myPropertyName12' to 'My Property Name 12' */ + export function titleCase(str: string): string; + + /** Return the ES5 property descriptor for the property, which may be on a prototype of the object */ + export function getPropertyDescriptor(obj: any, propertyName: string): PropertyDescriptor + + /** safely perform toJSON logic on objects with cycles. Replacer function can map or exclude properties. */ + export function toJSONSafe(obj: any, replacer: (prop: string, val: any) => any): any + + /** Default value replacer for toJSONSafe. Replaces entityAspect and other internal properties with undefined. */ + export function toJSONSafeReplacer(prop: string, val: any): any + } declare namespace breeze { @@ -214,19 +230,23 @@ declare namespace breeze { export class DataServiceAdapter { checkForRecomposition(interfaceInitializedArgs: { interfaceName: string; isDefault: boolean }): void; initialize(): void; - fetchMetadata(metadataStore: MetadataStore, dataService: DataService): breeze.promises.IPromise; - executeQuery(mappingContext: { getUrl: () => string; query: EntityQuery; dataService: DataService }): breeze.promises.IPromise; - saveChanges(saveContext: { resourceName: string; dataService: DataService }, saveBundle: Object): breeze.promises.IPromise; + fetchMetadata(metadataStore: MetadataStore, dataService: DataService): Promise; + executeQuery(mappingContext: { getUrl: () => string; query: EntityQuery; dataService: DataService }): Promise; + saveChanges(saveContext: { resourceName: string; dataService: DataService }, saveBundle: Object): Promise; JsonResultsAdapter: JsonResultsAdapter; } export class JsonResultsAdapter { name: string; extractResults: (data: {}) => {}; + extractSaveResults: (data: {}) => any[]; + extractKeyMappings: (data: {}) => KeyMapping[]; visitNode: (node: {}, queryContext: QueryContext, nodeContext: NodeContext) => { entityType?: EntityType; nodeId?: any; nodeRefId?: any; ignore?: boolean; }; constructor(config: { name: string; extractResults?: (data: {}) => {}; + extractSaveResults?: (data: {}) => any[]; + extractKeyMappings?: (data: {}) => KeyMapping[]; visitNode: (node: {}, queryContext: QueryContext, nodeContext: NodeContext) => { entityType?: EntityType; nodeId?: any; nodeRefId?: any; ignore?: boolean; }; }); } @@ -241,6 +261,7 @@ declare namespace breeze { export interface NodeContext { nodeType: string; + propertyName: string; } export class DataTypeSymbol extends breeze.core.EnumSymbol { @@ -333,8 +354,8 @@ declare namespace breeze { isNavigationPropertyLoaded(navigationProperty: string): boolean; isNavigationPropertyLoaded(navigationProperty: NavigationProperty): boolean; - loadNavigationProperty(navigationProperty: string, callback?: Function, errorCallback?: Function): breeze.promises.IPromise; - loadNavigationProperty(navigationProperty: NavigationProperty, callback?: Function, errorCallback?: Function): breeze.promises.IPromise; + loadNavigationProperty(navigationProperty: string, callback?: Function, errorCallback?: Function): Promise; + loadNavigationProperty(navigationProperty: NavigationProperty, callback?: Function, errorCallback?: Function): Promise; rejectChanges(): void; @@ -423,16 +444,16 @@ declare namespace breeze { createEntity(typeName: string, config?: {}, entityState?: EntityStateSymbol, mergeStrategy?: MergeStrategySymbol): Entity; createEntity(entityType: EntityType, config?: {}, entityState?: EntityStateSymbol, mergeStrategy?: MergeStrategySymbol): Entity; detachEntity(entity: Entity): boolean; - executeQuery(query: string, callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): breeze.promises.IPromise; - executeQuery(query: EntityQuery, callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): breeze.promises.IPromise; + executeQuery(query: string, callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): Promise; + executeQuery(query: EntityQuery, callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): Promise; executeQueryLocally(query: EntityQuery): Entity[]; exportEntities(entities?: Entity[], includeMetadata?: boolean): string; exportEntities(entities?: Entity[], options?: ExportEntitiesOptions): any; // string | Object - fetchEntityByKey(typeName: string, keyValue: any, checkLocalCacheFirst?: boolean): breeze.promises.IPromise; - fetchEntityByKey(typeName: string, keyValues: any[], checkLocalCacheFirst?: boolean): breeze.promises.IPromise; - fetchEntityByKey(entityKey: EntityKey): breeze.promises.IPromise; - fetchMetadata(callback?: (schema: any) => void, errorCallback?: breeze.core.ErrorCallback): breeze.promises.IPromise; + fetchEntityByKey(typeName: string, keyValue: any, checkLocalCacheFirst?: boolean): Promise; + fetchEntityByKey(typeName: string, keyValues: any[], checkLocalCacheFirst?: boolean): Promise; + fetchEntityByKey(entityKey: EntityKey): Promise; + fetchMetadata(callback?: (schema: any) => void, errorCallback?: breeze.core.ErrorCallback): Promise; generateTempKeyValue(entity: Entity): any; getChanges(): Entity[]; getChanges(entityTypeName: string): Entity[]; @@ -466,7 +487,7 @@ declare namespace breeze { importEntities(exportedData: Object, config?: { mergeStrategy?: MergeStrategySymbol; metadataVersionFn?: (any: any) => void }): { entities: Entity[]; tempKeyMapping: { [key: string]: EntityKey } }; rejectChanges(): Entity[]; - saveChanges(entities?: Entity[], saveOptions?: SaveOptions, callback?: SaveChangesSuccessCallback, errorCallback?: SaveChangesErrorCallback): breeze.promises.IPromise; + saveChanges(entities?: Entity[], saveOptions?: SaveOptions, callback?: SaveChangesSuccessCallback, errorCallback?: SaveChangesErrorCallback): Promise; setProperties(config: EntityManagerProperties): void; } @@ -554,7 +575,7 @@ declare namespace breeze { /** Create query from an expression tree */ constructor(tree: Object); - execute(callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): breeze.promises.IPromise; + execute(callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): Promise; executeLocally(): Entity[]; expand(propertyPaths: string[]): EntityQuery; expand(propertyPaths: string): EntityQuery; @@ -591,6 +612,8 @@ declare namespace breeze { where(property: string, filterop: FilterQueryOpSymbol, property2: string, filterop2: FilterQueryOpSymbol, value: any): EntityQuery; // for any/all clauses where(property: string, filterop: string, property2: string, filterop2: string, value: any): EntityQuery; // for any/all clauses where(predicate: FilterQueryOpSymbol): EntityQuery; + where(anArray: IRecursiveArray): EntityQuery; + withParameters(params: Object): EntityQuery; toJSON(): string; @@ -721,13 +744,14 @@ declare namespace breeze { addDataService(dataService: DataService, shouldOverwrite?: boolean): void; addEntityType(structuralType: IStructuralType): void; exportMetadata(): string; - fetchMetadata(dataService: string, callback?: (data: any) => void, errorCallback?: breeze.core.ErrorCallback): breeze.promises.IPromise; - fetchMetadata(dataService: DataService, callback?: (data: any) => void, errorCallback?: breeze.core.ErrorCallback): breeze.promises.IPromise; + fetchMetadata(dataService: string, callback?: (data: any) => void, errorCallback?: breeze.core.ErrorCallback): Promise; + fetchMetadata(dataService: DataService, callback?: (data: any) => void, errorCallback?: breeze.core.ErrorCallback): Promise; getDataService(serviceName: string): DataService; getEntityType(entityTypeName: string, okIfNotFound?: boolean): IStructuralType; getEntityTypes(): IStructuralType[]; hasMetadataFor(serviceName: string): boolean; static importMetadata(exportedString: string): MetadataStore; + static normalizeTypeName(typeName: string): string; importMetadata(exportedString: string, allowMerge?: boolean): MetadataStore; isEmpty(): boolean; registerEntityTypeCtor(entityTypeName: string, entityCtor: Function, initializationFn?: (entity: Entity) => void, noTrackingFn?: (node: Object, entityType: EntityType) => Object): void; @@ -796,7 +820,7 @@ declare namespace breeze { export interface IRecursiveArray { [i: number]: T | IRecursiveArray; } - + export class Predicate { constructor(); constructor(property: string, operator: string, value: any); @@ -904,10 +928,16 @@ declare namespace breeze { export interface SaveResult { entities: Entity[]; - keyMappings: any; + keyMappings: KeyMapping[]; XHR: XMLHttpRequest; } + export interface KeyMapping { + entityTypeName: string; + tempValue: any; + realValue: any; + } + export class ValidationError { key: string; context: any; @@ -993,7 +1023,7 @@ declare namespace breeze { /** Creates a regular expression validator with a fixed expression. */ static makeRegExpValidator(validatorName: string, expression: RegExp, defaultMessage: string, context?: any): Validator; - /** Run this validator against the specified value. + /** Run this validator against the specified value. @param value {Object} Value to validate @param additionalContext {Object} Any additional contextual information that the Validator can make use of. @return {ValidationError|null} A ValidationError if validation fails, null otherwise */ @@ -1044,20 +1074,16 @@ declare namespace breeze.config { @return {an instance of the specified adapter} **/ export function getAdapterInstance(interfaceName: string, adapterName?: string): Object; - - export interface Adapter { - getRoutePrefix: Function - } /** - Initializes a single adapter implementation. Initialization means either newing a instance of the + Initializes a single adapter implementation. Initialization means either newing a instance of the specified interface and then calling "initialize" on it or simply calling "initialize" on the instance if it already exists. @param interfaceName {String} The name of the interface to which the adapter to initialize belongs. @param adapterName {String} - The name of a previously registered adapter to initialize. - @param isDefault=true {Boolean} - Whether to make this the default "adapter" for this interface. + @param isDefault=true {Boolean} - Whether to make this the default "adapter" for this interface. @return {an instance of the specified adapter} **/ - export function initializeAdapterInstance(interfaceName: string, adapterName: string, isDefault?: boolean): Adapter; + export function initializeAdapterInstance(interfaceName: string, adapterName: string, isDefault?: boolean): Object; export interface AdapterInstancesConfig { /** the name of a previously registered "ajax" adapter */ @@ -1080,15 +1106,15 @@ declare namespace breeze.config { export var objectRegistry: Object; /** Method use to register implementations of standard breeze interfaces. Calls to this method are usually - made as the last step within an adapter implementation. + made as the last step within an adapter implementation. @param interfaceName {String} - one of the following interface names "ajax", "dataService" or "modelLibrary" - @param adapterCtor {Function} - an ctor function that returns an instance of the specified interface. + @param adapterCtor {Function} - an ctor function that returns an instance of the specified interface. **/ export function registerAdapter(interfaceName: string, adapterCtor: Function): void; export function registerFunction(fn: Function, fnName: string): void; export function registerType(ctor: Function, typeName: string): void; //static setProperties(config: Object): void; //deprecated - /** + /** Set the promise implementation, if Q.js is not found. @param q - implementation of promise. @see http://wiki.commonjs.org/wiki/Promises/A */ @@ -1101,27 +1127,17 @@ declare namespace breeze.config { /** Promises interface used by Breeze. Usually implemented by Q (https://github.com/kriskowal/q) or angular.$q using breeze.config.setQ(impl) */ declare namespace breeze.promises { - export interface IPromise { - then(onFulfill: (value: T) => U, onReject?: (reason: any) => U): IPromise; - then(onFulfill: (value: T) => IPromise, onReject?: (reason: any) => U): IPromise; - then(onFulfill: (value: T) => U, onReject?: (reason: any) => IPromise): IPromise; - then(onFulfill: (value: T) => IPromise, onReject?: (reason: any) => IPromise): IPromise; - catch(onRejected: (reason: any) => U): IPromise; - catch(onRejected: (reason: any) => IPromise): IPromise; - finally(finallyCallback: () => any): IPromise; - } - export interface IDeferred { - promise: IPromise; + promise: Promise; resolve(value: T): void; reject(reason: any): void; } export interface IPromiseService { defer(): IDeferred; - reject(reason?: any): IPromise; - resolve(object: T): IPromise; - resolve(object: IPromise): IPromise; + reject(reason?: any): Promise; + resolve(object: T): Promise; + resolve(object: Promise): Promise; } } From 66bd4290746e62eea9af862b46c22756c61e853a Mon Sep 17 00:00:00 2001 From: Steve Purol Date: Mon, 6 Mar 2017 14:11:17 -0500 Subject: [PATCH 044/374] recompose: withHandlers may take a factory function --- recompose/index.d.ts | 5 +++-- recompose/recompose-tests.tsx | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/recompose/index.d.ts b/recompose/index.d.ts index 3ff504fab3..6cef47160e 100644 --- a/recompose/index.d.ts +++ b/recompose/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Recompose v0.20.3 +// Type definitions for Recompose v0.22.0 // Project: https://github.com/acdlite/recompose // Definitions by: Iskander Sierra // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -50,8 +50,9 @@ declare module 'recompose' { type HandleCreators = { [handlerName: string]: mapper; }; + type HandleCreatorsFactory = (initialProps: TOutter) => HandleCreators; export function withHandlers( - handlerCreators: HandleCreators + handlerCreators: HandleCreators | HandleCreatorsFactory ): ComponentEnhancer; // defaultProps: https://github.com/acdlite/recompose/blob/master/docs/API.md#defaultprops diff --git a/recompose/recompose-tests.tsx b/recompose/recompose-tests.tsx index c4c66b3e2c..01bd1d28f5 100644 --- a/recompose/recompose-tests.tsx +++ b/recompose/recompose-tests.tsx @@ -73,6 +73,12 @@ function testWithHandlers() { onSubmit: (props: OutterProps) => (e: any) => {}, }); const enhanced: React.ComponentClass = enhancer(innerComponent); + + const enhancer2 = withHandlers((props: OutterProps) => ({ + onChange: (props: OutterProps) => (e: any) => {}, + onSubmit: (props: OutterProps) => (e: any) => {}, + })); + const enhanced2: React.ComponentClass = enhancer2(innerComponent); } function testDefaultProps() { From 53fd6a1051a5b6a74f9c5e1335e7286e30adb960 Mon Sep 17 00:00:00 2001 From: sqwk Date: Mon, 6 Mar 2017 23:19:10 +0100 Subject: [PATCH 045/374] Update Lowdb Test --- lowdb/index.d.ts | 1073 +++++++++++++++++++++--------------------- lowdb/lowdb-tests.ts | 5 +- 2 files changed, 547 insertions(+), 531 deletions(-) diff --git a/lowdb/index.d.ts b/lowdb/index.d.ts index ddd20e89ed..2beda1e2ba 100644 --- a/lowdb/index.d.ts +++ b/lowdb/index.d.ts @@ -1,536 +1,553 @@ -declare module 'lowdb' { - interface PromiseLike { - - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; - } - - interface StringRepresentable { - toString(): string; - } - - interface List { - [index: number]: T; - length: number; - } - - interface Dictionary { - [index: string]: T; - } - - interface DictionaryIterator { - (value: T, key?: string, collection?: Dictionary): TResult; - } - - interface ListIterator { - (value: T, index: number, collection: List): TResult; - } - - interface StringIterator { - (char: string, index?: number, string?: string): TResult; - } - - interface MixinOptions { - chain?: boolean; - } - - interface LoDashWrapper { - - /** - * @see _.has - */ - has(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; - - /** - * @see _.hasIn - */ - hasIn(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; - - /** - * @see _.assign - */ - assign( - source: TSource - ): LoDashWrapper; - - /** - * @see _.assign - */ - assign( - source1: TSource1, - source2: TSource2 - ): LoDashWrapper; - - /** - * @see _.assign - */ - assign( - source1: TSource1, - source2: TSource2, - source3: TSource3 - ): LoDashWrapper; - - /** - * @see _.assign - */ - assign( - source1: TSource1, - source2: TSource2, - source3: TSource3, - source4: TSource4 - ): LoDashWrapper; - - /** - * @see _.assign - */ - assign(): LoDashWrapper; - - /** - * @see _.assign - */ - assign(...otherArgs: any[]): LoDashWrapper; - - /** - * @see _.cloneDeep - */ - cloneDeep(): LoDashWrapper; - - /** - * @see _.cloneDeep - */ - cloneDeep(): LoDashWrapper; - - /** - * @see _.cloneDeep - */ - cloneDeepWith(customizer: (value: any) => any): LoDashWrapper[]; - - /** - * @see _.cloneDeep - */ - cloneDeepWith(customizer: (value: any) => any): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults( - source1: S1, - ...sources: {}[] - ): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults( - source1: S1, - source2: S2, - ...sources: {}[] - ): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults( - source1: S1, - source2: S2, - source3: S3, - ...sources: {}[] - ): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults( - source1: S1, - source2: S2, - source3: S3, - source4: S4, - ...sources: {}[] - ): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults(): LoDashWrapper; - - /** - * @see _.defaults - */ - defaults(...sources: {}[]): LoDashWrapper; - - /** - * @see _.get - */ - get(object: Object, - path: string | number | boolean | Array, - defaultValue?: TResult - ): LoDashWrapper; - - /** - * @see _.get - */ - get(path: string | number | boolean | Array, - defaultValue?: TResult - ): LoDashWrapper; - - - /** - * @see _.mixin - */ - mixin( - source: Dictionary, - options?: MixinOptions - ): LoDashWrapper; - - /** - * @see _.mixin - */ - mixin( - options?: MixinOptions - ): LoDashWrapper; - - /** - * @see _.set - */ - set( - path: StringRepresentable | StringRepresentable[], - value: any - ): LoDashWrapper; - - /** - * @see _.set - */ - set( - path: StringRepresentable | StringRepresentable[], - value: V - ): LoDashWrapper; - - /** - * @see _.find - */ - find( - predicate?: ListIterator, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.find - */ - find( - predicate?: string, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.find - */ - find( - predicate?: TObject - ): LoDashWrapper; - - /** - * @see _.find - */ - filter( - predicate?: TObject - ): LoDashWrapper; - - /** - * @see _.filter - */ - filter( - predicate?: ListIterator, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.filter - */ - filter( - predicate: string, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.filter - */ - filter( - predicate: ListIterator | DictionaryIterator, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.filter - */ - filter( - predicate?: StringIterator, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.filter - */ - filter(predicate: W): LoDashWrapper; - /** - * @see _.map - */ - map( - iteratee?: ListIterator, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.map - */ - map( - iteratee?: string - ): LoDashWrapper; - - /** - * @see _.map - */ - map( - iteratee?: TObject - ): LoDashWrapper; - /** - * @see _.map - */ - map( - iteratee?: ListIterator | DictionaryIterator, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.range - */ - range( - end?: number, - step?: number - ): LoDashWrapper; - - /** - * @see _.rangeRight - */ - rangeRight( - end?: number, - step?: number - ): LoDashWrapper; - - /** - * @see _.remove - */ - remove( - predicate?: ListIterator, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.remove - */ - remove( - predicate?: string, - thisArg?: any - ): LoDashWrapper; - - /** - * @see _.remove - */ - remove( - predicate?: W - ): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy( - iteratee?: ListIterator - ): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy(iteratee: string): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy(whereValue: W): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy(): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy(...iteratees: (ListIterator | Object | string)[]): LoDashWrapper; - - /** - * @see _.sortBy - */ - sortBy(iteratees: (ListIterator | string | Object)[]): LoDashWrapper; - - /** - * @see _.slice - */ - slice( - start?: number, - end?: number - ): LoDashWrapper; - - /** - * @see _.size - */ - size(): LoDashWrapper; - - /** - * @see _.take - */ - take(n?: number): LoDashWrapper; - - /** - * @see _.times - */ - times( - iteratee: (num: number) => TResult - ): LoDashWrapper; - - /** - * @see _.times - */ - times(): LoDashWrapper; - - /** - * @see _.uniqueId - */ - uniqueId(): LoDashWrapper; - - value(): T; - - pop(): T; - push(...items: T[]): LoDashWrapper; - shift(): T; - sort(compareFn?: (a: T, b: T) => number): LoDashWrapper; - splice(start: number): LoDashWrapper; - splice(start: number, deleteCount: number, ...items: any[]): LoDashWrapper; - unshift(...items: T[]): LoDashWrapper; - } - - interface Storage { - /** - * Reads the database. - * - * @param source The source location. - * @param deserialize The deserialize function to apply. - * @return Returns a promise with the deserialized db object. - */ - read?(source: string, deserialize: any): PromiseLike - /** - * Reads the database. - * - * @param source The source location. - * @param deserialize The deserialize function to apply. - * @return Returns the deserialized db object. - */ - read?(source: string, deserialize: any): Object - /** - * Writes to the database. - * - * @param destination The destination location. - * @param obj The object to write. - * @param serialize The serialize function to apply. - */ - write?(destination: string, obj: any, serialize: any): void - /** - * Writes to the database. - * - * @param destination The destination location. - * @param obj The object to write. - * @param serialize The serialize function to apply. - */ - write?(destination: string, obj: any, serialize: any): PromiseLike - } - - interface Format { - /** - * Writes to the database. - * - * @param obj The object to serialize. - * @return Returns the serialized object string. - */ - serialize(obj: Object): string - /** - * Writes to the database. - * - * @param data The object to deserialize. - * @return Returns the deserialized object. - */ - deserialize(data: string): Object - } - - interface Options { - /** - * The custom "storage" object. - */ - storage?: Storage - /** - * The custom "format" object. - */ - format?: Format - /** - * The flag to automatically persist changes. - */ - writeOnChange?: boolean - } - - export interface Low extends LoDashWrapper, Format { - /** - * Access current database state. - * Returns Returns the database state. - */ - getState(): Object - /** - * Drop or reset database state. - * @param newState New state of the database - */ - setState(newState: Object): void - /** - * Persist database. - * @param source The source location. - */ - write(source: string): void - /** - * Persist database. - * @param source The source location. - */ - write(source: string): PromiseLike - /** - * Read database. - * @param source The source location. - */ - read(source?: string): Object - /** - * Read database. - * @param source The source location. - */ - read(source?: string): PromiseLike +declare namespace lowdb { + + interface PromiseLike { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; + } + + interface StringRepresentable { + toString(): string; + } + + interface List { + [index: number]: T; + length: number; + } + + interface Dictionary { + [index: string]: T; + } + + interface DictionaryIterator { + (value: T, key?: string, collection?: Dictionary): TResult; + } + + interface ListIterator { + (value: T, index: number, collection: List): TResult; + } + + interface StringIterator { + (char: string, index?: number, string?: string): TResult; + } + + interface MixinOptions { + chain?: boolean; + } + + class LoDashWrapper { + + /** + * @see _.has + */ + has(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; + + /** + * @see _.hasIn + */ + hasIn(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; + + /** + * @see _.assign + */ + assign( + source: TSource + ): LoDashWrapper; + + /** + * @see _.assign + */ + assign( + source1: TSource1, + source2: TSource2 + ): LoDashWrapper; + + /** + * @see _.assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3 + ): LoDashWrapper; + + /** + * @see _.assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4 + ): LoDashWrapper; + + /** + * @see _.assign + */ + assign(): LoDashWrapper; + + /** + * @see _.assign + */ + assign(...otherArgs: any[]): LoDashWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep(): LoDashWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep(): LoDashWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeepWith(customizer: (value: any) => any): LoDashWrapper[]; + + /** + * @see _.cloneDeep + */ + cloneDeepWith(customizer: (value: any) => any): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + ...sources: {}[] + ): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + ...sources: {}[] + ): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + ...sources: {}[] + ): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + source4: S4, + ...sources: {}[] + ): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults(): LoDashWrapper; + + /** + * @see _.defaults + */ + defaults(...sources: {}[]): LoDashWrapper; + + /** + * @see _.get + */ + get(object: Object, + path: string | number | boolean | Array, + defaultValue?: TResult + ): LoDashWrapper; + + /** + * @see _.get + */ + get(path: string | number | boolean | Array, + defaultValue?: TResult + ): LoDashWrapper; + + + /** + * @see _.mixin + */ + mixin( + source: Dictionary, + options?: MixinOptions + ): LoDashWrapper; + + /** + * @see _.mixin + */ + mixin( + options?: MixinOptions + ): LoDashWrapper; + + /** + * @see _.set + */ + set( + path: StringRepresentable | StringRepresentable[], + value: any + ): LoDashWrapper; + + /** + * @see _.set + */ + set( + path: StringRepresentable | StringRepresentable[], + value: V + ): LoDashWrapper; + + /** + * @see _.find + */ + find( + predicate?: ListIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.find + */ + find( + predicate?: string, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.find + */ + find( + predicate?: TObject + ): LoDashWrapper; + + /** + * @see _.find + */ + filter( + predicate?: TObject + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter( + predicate?: ListIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter( + predicate: ListIterator | DictionaryIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter( + predicate?: StringIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashWrapper; + /** + * @see _.map + */ + map( + iteratee?: ListIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashWrapper; + /** + * @see _.map + */ + map( + iteratee?: ListIterator | DictionaryIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.range + */ + range( + end?: number, + step?: number + ): LoDashWrapper; + + /** + * @see _.rangeRight + */ + rangeRight( + end?: number, + step?: number + ): LoDashWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator + ): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(...iteratees: (ListIterator | Object | string)[]): LoDashWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratees: (ListIterator | string | Object)[]): LoDashWrapper; + + /** + * @see _.slice + */ + slice( + start?: number, + end?: number + ): LoDashWrapper; + + /** + * @see _.size + */ + size(): LoDashWrapper; + + /** + * @see _.take + */ + take(n?: number): LoDashWrapper; + + /** + * @see _.times + */ + times( + iteratee: (num: number) => TResult + ): LoDashWrapper; + + /** + * @see _.times + */ + times(): LoDashWrapper; + + /** + * @see _.uniqueId + */ + uniqueId(): LoDashWrapper; + + value(): T; + + pop(): T; + push(...items: T[]): LoDashWrapper; + shift(): T; + sort(compareFn?: (a: T, b: T) => number): LoDashWrapper; + splice(start: number): LoDashWrapper; + splice(start: number, deleteCount: number, ...items: any[]): LoDashWrapper; + unshift(...items: T[]): LoDashWrapper; + } + + export interface Storage { + + /** + * Reads the database. + * + * @param source The source location. + * @param deserialize The deserialize function to apply. + * @return Returns a promise with the deserialized db object. + */ + read?(source: string, deserialize: any): PromiseLike + + /** + * Reads the database. + * + * @param source The source location. + * @param deserialize The deserialize function to apply. + * @return Returns the deserialized db object. + */ + read?(source: string, deserialize: any): Object + + /** + * Writes to the database. + * + * @param destination The destination location. + * @param obj The object to write. + * @param serialize The serialize function to apply. + */ + write?(destination: string, obj: any, serialize: any): void + + /** + * Writes to the database. + * + * @param destination The destination location. + * @param obj The object to write. + * @param serialize The serialize function to apply. + */ + write?(destination: string, obj: any, serialize: any): PromiseLike + } + + export interface Format { + + /** + * Writes to the database. + * + * @param obj The object to serialize. + * @return Returns the serialized object string. + */ + serialize(obj: Object): string + + /** + * Writes to the database. + * + * @param data The object to deserialize. + * @return Returns the deserialized object. + */ + deserialize(data: string): Object + } + + export interface Options { + + /** + * The custom "storage" object. + */ + storage?: Storage + + /** + * The custom "format" object. + */ + format?: Format + + /** + * The flag to automatically persist changes. + */ + writeOnChange?: boolean + + } + + export class Low extends LoDashWrapper { + + constructor(filePath: string, options?: Options); + + /** + * Access current database state. + * Returns Returns the database state. + */ + getState(): Object + + /** + * Drop or reset database state. + * @param newState New state of the database + */ + setState(newState: Object): void + + /** + * Persist database. + * @param source The source location. + */ + write(source: string): void + + /** + * Persist database. + * @param source The source location. + */ + write(source: string): PromiseLike + + /** + * Read database. + * @param source The source location. + */ + read(source?: string): Object + + /** + * Read database. + * @param source The source location. + */ + read(source?: string): PromiseLike + } // declare class lowdb { // new (source?: string, opts?: Options): Low; // (source?: string, opts?: Options) : Low; // } - -// declare module "lowdb" { -// export = lowdb; -// } - } +declare module "lowdb" { + export = lowdb.Low; +} \ No newline at end of file diff --git a/lowdb/lowdb-tests.ts b/lowdb/lowdb-tests.ts index d656c63b62..612288e8dd 100644 --- a/lowdb/lowdb-tests.ts +++ b/lowdb/lowdb-tests.ts @@ -1,9 +1,8 @@ import Lowdb = require('lowdb'); -Lowdb -let db = new Lowdb(); +const db = new Lowdb('db.json'); -db.defaults({ 'someObject': {}, 'anotherObject': {} }).value(); +db.defaults({ someObject: {}, anotherObject: {} }).value(); db.get('someObject').set('foo' , 'bar').value(); db.get('anotherObject').set('foo' , 'bar').value(); From 8bfb64811e76ee7217a78ae355ae6e6d8c6802fb Mon Sep 17 00:00:00 2001 From: sqwk Date: Mon, 6 Mar 2017 23:40:18 +0100 Subject: [PATCH 046/374] Update Lowdb Test --- lowdb/index.d.ts | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/lowdb/index.d.ts b/lowdb/index.d.ts index 2beda1e2ba..4118372647 100644 --- a/lowdb/index.d.ts +++ b/lowdb/index.d.ts @@ -1,3 +1,8 @@ +// Type definitions for Lowdb 0.15 +// Project: https://github.com/typicode/lowdb +// Definitions by: typicode, +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + declare namespace lowdb { interface PromiseLike { @@ -167,7 +172,7 @@ declare namespace lowdb { /** * @see _.get */ - get(object: Object, + get(object: any, path: string | number | boolean | Array, defaultValue?: TResult ): LoDashWrapper; @@ -184,7 +189,7 @@ declare namespace lowdb { * @see _.mixin */ mixin( - source: Dictionary, + source: Dictionary<() => void>, options?: MixinOptions ): LoDashWrapper; @@ -370,12 +375,12 @@ declare namespace lowdb { /** * @see _.sortBy */ - sortBy(...iteratees: (ListIterator | Object | string)[]): LoDashWrapper; + sortBy(...iteratees: (ListIterator | any | string)[]): LoDashWrapper; /** * @see _.sortBy */ - sortBy(iteratees: (ListIterator | string | Object)[]): LoDashWrapper; + sortBy(iteratees: (ListIterator | string | any)[]): LoDashWrapper; /** * @see _.slice @@ -441,7 +446,7 @@ declare namespace lowdb { * @param deserialize The deserialize function to apply. * @return Returns the deserialized db object. */ - read?(source: string, deserialize: any): Object + read?(source: string, deserialize: any): {} /** * Writes to the database. @@ -470,7 +475,7 @@ declare namespace lowdb { * @param obj The object to serialize. * @return Returns the serialized object string. */ - serialize(obj: Object): string + serialize(obj: any): string /** * Writes to the database. @@ -478,7 +483,7 @@ declare namespace lowdb { * @param data The object to deserialize. * @return Returns the deserialized object. */ - deserialize(data: string): Object + deserialize(data: string): any } export interface Options { @@ -508,13 +513,13 @@ declare namespace lowdb { * Access current database state. * Returns Returns the database state. */ - getState(): Object + getState(): any /** * Drop or reset database state. * @param newState New state of the database */ - setState(newState: Object): void + setState(newState: any): void /** * Persist database. @@ -532,13 +537,13 @@ declare namespace lowdb { * Read database. * @param source The source location. */ - read(source?: string): Object + read(source?: string): any /** * Read database. * @param source The source location. */ - read(source?: string): PromiseLike + read(source?: string): PromiseLike } From d581cd13ab2425f27373d4e220932ce9b26bd315 Mon Sep 17 00:00:00 2001 From: Belinda Teh Date: Mon, 6 Mar 2017 16:43:00 -0800 Subject: [PATCH 047/374] Update qs definitions to include 'sort' in its stringify options --- qs/index.d.ts | 4 +++- qs/qs-tests.ts | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/qs/index.d.ts b/qs/index.d.ts index c23c02f871..400cc7a1e4 100644 --- a/qs/index.d.ts +++ b/qs/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for qs 6.2.0 // Project: https://github.com/hapijs/qs -// Definitions by: Roman Korneev , Leon Yu +// Definitions by: Roman Korneev , Leon Yu , +// Belinda Teh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = QueryString; @@ -16,6 +17,7 @@ declare namespace QueryString { filter?: Array | ((prefix: string, value: any) => any); arrayFormat?: 'indices' | 'brackets' | 'repeat'; indices?: boolean; + sort?: (a: any, b: any) => number; } interface IParseOptions { diff --git a/qs/qs-tests.ts b/qs/qs-tests.ts index bcff0a0762..f3d361476e 100644 --- a/qs/qs-tests.ts +++ b/qs/qs-tests.ts @@ -249,3 +249,8 @@ qs.parse('a=b&c=d', { delimiter: '&' }); var obj = qs.parse('a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I', { decoder: decoder }); assert.deepEqual(obj, { a: 'こんにちは!' }); } + +() => { + var sorted = qs.stringify({ a: 1, c: 3, b: 2 }, { sort: (a, b) => a.localeCompare(b) }) + assert.equal(sorted, 'a=1&b=2&c=3') +} From 01e6251cd20e73a71f73207272be11d4bf2e9eff Mon Sep 17 00:00:00 2001 From: Belinda Teh Date: Mon, 6 Mar 2017 16:51:48 -0800 Subject: [PATCH 048/374] Update qs tests to 4 space indent --- qs/qs-tests.ts | 256 ++++++++++++++++++++++++------------------------- 1 file changed, 128 insertions(+), 128 deletions(-) diff --git a/qs/qs-tests.ts b/qs/qs-tests.ts index f3d361476e..10a911c2dc 100644 --- a/qs/qs-tests.ts +++ b/qs/qs-tests.ts @@ -8,82 +8,82 @@ qs.parse('a=b'); qs.parse('a=b&c=d', { delimiter: '&' }); () => { - var obj = qs.parse('a=c'); - assert.deepEqual(obj, { a: 'c' }); + var obj = qs.parse('a=c'); + assert.deepEqual(obj, { a: 'c' }); - var str = qs.stringify(obj); - assert.equal(str, 'a=c'); + var str = qs.stringify(obj); + assert.equal(str, 'a=c'); } () => { - var plainObject = qs.parse('a[hasOwnProperty]=b', { plainObjects: true }); - assert.deepEqual(plainObject, { a: { hasOwnProperty: 'b' } }); + var plainObject = qs.parse('a[hasOwnProperty]=b', { plainObjects: true }); + assert.deepEqual(plainObject, { a: { hasOwnProperty: 'b' } }); } () => { - var protoObject = qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }); - assert.deepEqual(protoObject, { a: { hasOwnProperty: 'b' } }); + var protoObject = qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }); + assert.deepEqual(protoObject, { a: { hasOwnProperty: 'b' } }); } () => { - assert.deepEqual(qs.parse('a%5Bb%5D=c'), { - a: { b: 'c' } - }); + assert.deepEqual(qs.parse('a%5Bb%5D=c'), { + a: { b: 'c' } + }); } () => { - assert.deepEqual(qs.parse('foo[bar][baz]=foobarbaz'), { - foo: { - bar: { - baz: 'foobarbaz' - } - } - }); -} - -() => { - var expected = { - a: { - b: { - c: { - d: { - e: { - f: { - '[g][h][i]': 'j' - } + assert.deepEqual(qs.parse('foo[bar][baz]=foobarbaz'), { + foo: { + bar: { + baz: 'foobarbaz' } - } } - } - } - }; - var string = 'a[b][c][d][e][f][g][h][i]=j'; - assert.deepEqual(qs.parse(string), expected); + }); } () => { - var deep = qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1 }); - assert.deepEqual(deep, { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } }); + var expected = { + a: { + b: { + c: { + d: { + e: { + f: { + '[g][h][i]': 'j' + } + } + } + } + } + } + }; + var string = 'a[b][c][d][e][f][g][h][i]=j'; + assert.deepEqual(qs.parse(string), expected); } () => { - var limited = qs.parse('a=b&c=d', { parameterLimit: 1 }); - assert.deepEqual(limited, { a: 'b' }); + var deep = qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1 }); + assert.deepEqual(deep, { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } }); } () => { - var delimited = qs.parse('a=b;c=d', { delimiter: ';' }); - assert.deepEqual(delimited, { a: 'b', c: 'd' }); + var limited = qs.parse('a=b&c=d', { parameterLimit: 1 }); + assert.deepEqual(limited, { a: 'b' }); } () => { - var regexed = qs.parse('a=b;c=d,e=f', { delimiter: /[;,]/ }); - assert.deepEqual(regexed, { a: 'b', c: 'd', e: 'f' }); + var delimited = qs.parse('a=b;c=d', { delimiter: ';' }); + assert.deepEqual(delimited, { a: 'b', c: 'd' }); } () => { - var withDots = qs.parse('a.b=c', { allowDots: true }); - assert.deepEqual(withDots, { a: { b: 'c' } }); + var regexed = qs.parse('a=b;c=d,e=f', { delimiter: /[;,]/ }); + assert.deepEqual(regexed, { a: 'b', c: 'd', e: 'f' }); +} + +() => { + var withDots = qs.parse('a.b=c', { allowDots: true }); + assert.deepEqual(withDots, { a: { b: 'c' } }); } () => { @@ -92,165 +92,165 @@ qs.parse('a=b&c=d', { delimiter: '&' }); } () => { - var withIndexes = qs.parse('a[1]=c&a[0]=b'); - assert.deepEqual(withIndexes, { a: ['b', 'c'] }); + var withIndexes = qs.parse('a[1]=c&a[0]=b'); + assert.deepEqual(withIndexes, { a: ['b', 'c'] }); } () => { - var noSparse = qs.parse('a[1]=b&a[15]=c'); - assert.deepEqual(noSparse, { a: ['b', 'c'] }); + var noSparse = qs.parse('a[1]=b&a[15]=c'); + assert.deepEqual(noSparse, { a: ['b', 'c'] }); } () => { - var withEmptyString = qs.parse('a[]=&a[]=b'); - assert.deepEqual(withEmptyString, { a: ['', 'b'] }); + var withEmptyString = qs.parse('a[]=&a[]=b'); + assert.deepEqual(withEmptyString, { a: ['', 'b'] }); - var withIndexedEmptyString = qs.parse('a[0]=b&a[1]=&a[2]=c'); - assert.deepEqual(withIndexedEmptyString, { a: ['b', '', 'c'] }); + var withIndexedEmptyString = qs.parse('a[0]=b&a[1]=&a[2]=c'); + assert.deepEqual(withIndexedEmptyString, { a: ['b', '', 'c'] }); } () => { - var withMaxIndex = qs.parse('a[100]=b'); - assert.deepEqual(withMaxIndex, { a: { '100': 'b' } }); + var withMaxIndex = qs.parse('a[100]=b'); + assert.deepEqual(withMaxIndex, { a: { '100': 'b' } }); } () => { - var withArrayLimit = qs.parse('a[1]=b', { arrayLimit: 0 }); - assert.deepEqual(withArrayLimit, { a: { '1': 'b' } }); + var withArrayLimit = qs.parse('a[1]=b', { arrayLimit: 0 }); + assert.deepEqual(withArrayLimit, { a: { '1': 'b' } }); } () => { - var noParsingArrays = qs.parse('a[]=b', { parseArrays: false }); - assert.deepEqual(noParsingArrays, { a: { '0': 'b' } }); + var noParsingArrays = qs.parse('a[]=b', { parseArrays: false }); + assert.deepEqual(noParsingArrays, { a: { '0': 'b' } }); } () => { - var mixedNotation = qs.parse('a[0]=b&a[b]=c'); - assert.deepEqual(mixedNotation, { a: { '0': 'b', b: 'c' } }); + var mixedNotation = qs.parse('a[0]=b&a[b]=c'); + assert.deepEqual(mixedNotation, { a: { '0': 'b', b: 'c' } }); } () => { - var arraysOfObjects = qs.parse('a[][b]=c'); - assert.deepEqual(arraysOfObjects, { a: [{ b: 'c' }] }); + var arraysOfObjects = qs.parse('a[][b]=c'); + assert.deepEqual(arraysOfObjects, { a: [{ b: 'c' }] }); } () => { - assert.equal(qs.stringify({ a: 'b' }), 'a=b'); - assert.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); + assert.equal(qs.stringify({ a: 'b' }), 'a=b'); + assert.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); } () => { - var unencoded = qs.stringify({ a: { b: 'c' } }, { encode: false }); - assert.equal(unencoded, 'a[b]=c'); + var unencoded = qs.stringify({ a: { b: 'c' } }, { encode: false }); + assert.equal(unencoded, 'a[b]=c'); } () => { - var encoded = qs.stringify({ a: { b: 'c' } }, { - encoder: function (str) { - // Passed in values `a`, `b`, `c` - return // Return encoded string - } - }) + var encoded = qs.stringify({ a: { b: 'c' } }, { + encoder: function (str) { + // Passed in values `a`, `b`, `c` + return // Return encoded string + } + }) } () => { - var decoded = qs.parse('x=z', { - decoder: function (str) { - // Passed in values `x`, `z` - return // Return decoded string - } - }) + var decoded = qs.parse('x=z', { + decoder: function (str) { + // Passed in values `x`, `z` + return // Return decoded string + } + }) } () => { - qs.stringify({ a: ['b', 'c', 'd'] }); - // 'a[0]=b&a[1]=c&a[2]=d' + qs.stringify({ a: ['b', 'c', 'd'] }); + // 'a[0]=b&a[1]=c&a[2]=d' } () => { - qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false }); - // 'a=b&a=c&a=d' + qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false }); + // 'a=b&a=c&a=d' } () => { - qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' }) - // 'a[0]=b&a[1]=c' - qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }) - // 'a[]=b&a[]=c' - qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }) - // 'a=b&a=c' + qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' }) + // 'a[0]=b&a[1]=c' + qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }) + // 'a[]=b&a[]=c' + qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }) + // 'a=b&a=c' } () => { - assert.equal(qs.stringify({ a: '' }), 'a='); + assert.equal(qs.stringify({ a: '' }), 'a='); } () => { - assert.equal(qs.stringify({ a: null, b: undefined }), 'a='); + assert.equal(qs.stringify({ a: null, b: undefined }), 'a='); } () => { - assert.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d'); + assert.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d'); } () => { - qs.stringify({ a: 'b', c: 'd', e: { f: new Date(123), g: [2] } }, { filter: function (prefix, value) { - if (prefix == 'b') { - // Return an `undefined` value to omit a property. - return; - } - if (prefix == 'e[f]') { - return value.getTime(); - } - if (prefix == 'e[g][0]') { - return value * 2; - } - return value; - } }); - // 'a=b&c=d&e[f]=123&e[g][0]=4' - qs.stringify({ a: 'b', c: 'd', e: 'f' }, { filter: ['a', 'e'] }); - // 'a=b&e=f' - qs.stringify({ a: ['b', 'c', 'd'], e: 'f' }, { filter: ['a', 0, 2] }); + qs.stringify({ a: 'b', c: 'd', e: { f: new Date(123), g: [2] } }, { filter: function (prefix, value) { + if (prefix == 'b') { + // Return an `undefined` value to omit a property. + return; + } + if (prefix == 'e[f]') { + return value.getTime(); + } + if (prefix == 'e[g][0]') { + return value * 2; + } + return value; + } }); + // 'a=b&c=d&e[f]=123&e[g][0]=4' + qs.stringify({ a: 'b', c: 'd', e: 'f' }, { filter: ['a', 'e'] }); + // 'a=b&e=f' + qs.stringify({ a: ['b', 'c', 'd'], e: 'f' }, { filter: ['a', 0, 2] }); } () => { - var withNull = qs.stringify({ a: null, b: '' }); - assert.equal(withNull, 'a=&b='); + var withNull = qs.stringify({ a: null, b: '' }); + assert.equal(withNull, 'a=&b='); } () => { - var equalsInsensitive = qs.parse('a&b='); - assert.deepEqual(equalsInsensitive, { a: '', b: '' }); + var equalsInsensitive = qs.parse('a&b='); + assert.deepEqual(equalsInsensitive, { a: '', b: '' }); } () => { - var strictNull = qs.stringify({ a: null, b: '' }, { strictNullHandling: true }); - assert.equal(strictNull, 'a&b='); + var strictNull = qs.stringify({ a: null, b: '' }, { strictNullHandling: true }); + assert.equal(strictNull, 'a&b='); } () => { - var parsedStrictNull = qs.parse('a&b=', { strictNullHandling: true }); - assert.deepEqual(parsedStrictNull, { a: null, b: '' }); + var parsedStrictNull = qs.parse('a&b=', { strictNullHandling: true }); + assert.deepEqual(parsedStrictNull, { a: null, b: '' }); } () => { - var nullsSkipped = qs.stringify({ a: 'b', c: null }, { skipNulls: true }); - assert.equal(nullsSkipped, 'a=b'); + var nullsSkipped = qs.stringify({ a: 'b', c: null }, { skipNulls: true }); + assert.equal(nullsSkipped, 'a=b'); } () => { - var encoder = () => {}; - var shiftJISEncoded = qs.stringify({ a: 'こんにちは!' }, { encoder: encoder }); - assert.equal(shiftJISEncoded, 'a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I'); + var encoder = () => {}; + var shiftJISEncoded = qs.stringify({ a: 'こんにちは!' }, { encoder: encoder }); + assert.equal(shiftJISEncoded, 'a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I'); } () => { - var decoder = () => {}; - var obj = qs.parse('a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I', { decoder: decoder }); - assert.deepEqual(obj, { a: 'こんにちは!' }); + var decoder = () => {}; + var obj = qs.parse('a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I', { decoder: decoder }); + assert.deepEqual(obj, { a: 'こんにちは!' }); } () => { - var sorted = qs.stringify({ a: 1, c: 3, b: 2 }, { sort: (a, b) => a.localeCompare(b) }) - assert.equal(sorted, 'a=1&b=2&c=3') + var sorted = qs.stringify({ a: 1, c: 3, b: 2 }, { sort: (a, b) => a.localeCompare(b) }) + assert.equal(sorted, 'a=1&b=2&c=3') } From c87f276f9a6ec3e1c8061ddec297e2d6da21cc61 Mon Sep 17 00:00:00 2001 From: Belinda Teh Date: Mon, 6 Mar 2017 16:52:57 -0800 Subject: [PATCH 049/374] Update qs tests to 4 space indent --- qs/qs-tests.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qs/qs-tests.ts b/qs/qs-tests.ts index 10a911c2dc..f3e5ca3230 100644 --- a/qs/qs-tests.ts +++ b/qs/qs-tests.ts @@ -147,8 +147,8 @@ qs.parse('a=b&c=d', { delimiter: '&' }); () => { var encoded = qs.stringify({ a: { b: 'c' } }, { encoder: function (str) { - // Passed in values `a`, `b`, `c` - return // Return encoded string + // Passed in values `a`, `b`, `c` + return // Return encoded string } }) } @@ -156,8 +156,8 @@ qs.parse('a=b&c=d', { delimiter: '&' }); () => { var decoded = qs.parse('x=z', { decoder: function (str) { - // Passed in values `x`, `z` - return // Return decoded string + // Passed in values `x`, `z` + return // Return decoded string } }) } From 7d3e93b80d9c7d07d986a2e580618c23be99914d Mon Sep 17 00:00:00 2001 From: Mikael Kohlmyr Date: Tue, 7 Mar 2017 13:25:21 +0100 Subject: [PATCH 050/374] Fix es6 import for blueimp-md5. --- blueimp-md5/blueimp-md5-tests.ts | 7 +++---- blueimp-md5/index.d.ts | 8 +++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/blueimp-md5/blueimp-md5-tests.ts b/blueimp-md5/blueimp-md5-tests.ts index 18edc69b57..1e2348dc7b 100644 --- a/blueimp-md5/blueimp-md5-tests.ts +++ b/blueimp-md5/blueimp-md5-tests.ts @@ -1,6 +1,5 @@ +import * as md5 from "blueimp-md5"; -import blueimp = require('blueimp-md5'); - -function hash(): boolean { - return blueimp.md5('hello world') === '5eb63bbbe01eeed093cb22bb8f5acdc3'; +function hash1(): string { + return md5('hello world'); } diff --git a/blueimp-md5/index.d.ts b/blueimp-md5/index.d.ts index b51f554e32..656bd4316b 100644 --- a/blueimp-md5/index.d.ts +++ b/blueimp-md5/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for blueimp-md5 v1.1.0 +// Type definitions for blueimp-md5 v2.7.0 // Project: https://github.com/blueimp/JavaScript-MD5 -// Definitions by: Ray Martone +// Definitions by: Ray Martone , Mikael Kohlmyr // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export declare function md5(value: string, key?: string, raw?: boolean): string; +declare function md5(value: string, key?: string, raw?: boolean): string; +declare namespace md5 { } +export = md5; From cebf787454d64884e1ff2306d62148018eb401ac Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Tue, 7 Mar 2017 23:14:25 -0500 Subject: [PATCH 051/374] react-day-picker add tslint.json --- react-day-picker/tslint.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 react-day-picker/tslint.json diff --git a/react-day-picker/tslint.json b/react-day-picker/tslint.json new file mode 100644 index 0000000000..ec365f164b --- /dev/null +++ b/react-day-picker/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} From a45eb5ec85c5c5ba5183ccf82e75aa75c04e5969 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Tue, 7 Mar 2017 23:22:30 -0500 Subject: [PATCH 052/374] react-day-picker add types react and reformat tsconfig.json --- react-day-picker/tsconfig.json | 46 ++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/react-day-picker/tsconfig.json b/react-day-picker/tsconfig.json index 943c51e1e6..4cf47535ad 100644 --- a/react-day-picker/tsconfig.json +++ b/react-day-picker/tsconfig.json @@ -1,24 +1,26 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "baseUrl": "../", - "jsx": "react", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "react-day-picker-tests.tsx" - ] + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [ + "react" + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-day-picker-tests.tsx" + ] } From 60a8ba65e05048e097fdfa74b7fce9d9f19b92f7 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Tue, 7 Mar 2017 23:23:02 -0500 Subject: [PATCH 053/374] react-day-picker redo types to external module syntax, fix missing fields --- react-day-picker/index.d.ts | 252 +++++++++++++++++++++--------------- 1 file changed, 148 insertions(+), 104 deletions(-) diff --git a/react-day-picker/index.d.ts b/react-day-picker/index.d.ts index 01c5492922..e50ff542b0 100644 --- a/react-day-picker/index.d.ts +++ b/react-day-picker/index.d.ts @@ -1,113 +1,157 @@ -// Type definitions for react-day-picker v1.2.0 +// Type definitions for react-day-picker 1.2 // Project: https://github.com/gpbl/react-day-picker // Definitions by: Giampaolo Bellavite , Jason Killian // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -/// +import * as React from 'react'; -declare module "react-day-picker" { - import DayPicker = ReactDayPicker.DayPicker; - export = DayPicker; +interface LocaleUtils { + formatDay(day: Date, locale: string): string; + formatMonthTitle(month: Date, locale: string): string; + formatWeekdayLong(weekday: number, locale: string): string; + formatWeekdayShort(weekday: number, locale: string): string; + getFirstDayOfWeek(locale: string): number; + getMonths(locale: string): [string, string, string, string, string, string, string, string, string, string, string, string]; } -declare var DayPicker: typeof ReactDayPicker.DayPicker; - -declare namespace ReactDayPicker { - interface LocaleUtils { - formatMonthTitle: (month: Date, locale: string) => string; - formatWeekdayShort: (weekday: number, locale: string) => string; - formatWeekdayLong: (weekday: number, locale: string) => string; - getFirstDayOfWeek: (locale: string) => number; - getMonths: (locale: string) => string[]; - } - - interface DayModifiers { - selected?: boolean; - disabled?: boolean; - [name: string]: boolean | undefined; - } - - interface Modifiers { - [name: string]: (date: Date) => boolean; - } - - interface CaptionElementProps extends React.Props { - date?: Date; - localeUtils?: LocaleUtils; - locale?: string; - onClick?: React.MouseEventHandler<{}>; - } - - interface NavbarElementProps extends React.Props { - className?: string; - previousMonth?: Date; - nextMonth?: Date; - showPreviousButton?: boolean; - showNextButton?: boolean; - onPreviousClick(): void; - onNextClick(): void; - dir?: string; - localeUtils?: LocaleUtils; - locale?: string; - - } - - interface WeekdayElementProps extends React.Props { - weekday?: number; - className?: string; - localeUtils?: LocaleUtils; - locale?: string; - } - - interface Props extends React.Props{ - modifiers?: Modifiers; - initialMonth?: Date; - numberOfMonths?: number; - renderDay?: (date: Date) => number | string | JSX.Element; - enableOutsideDays?: boolean; - firstDayOfWeek?:number; - canChangeMonth?: boolean; - disabledDays?: (date: Date) => boolean; - fixedWeeks?: boolean; - fromMonth?: Date; - reverseMonths?: boolean; - toMonth?: Date; - localeUtils?: LocaleUtils; - locale?: string; - captionElement?: React.ReactElement; - onDayClick?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any; - onDayTouchTap?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any; - onDayMouseEnter?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any; - onDayMouseLeave?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any; - onDayTouchEnd?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any; - onDayTouchStart?: (e: React.SyntheticEvent<{}>, day: Date, modifiers: DayModifiers) => any; - navbarElement?: React.ReactElement; - weekdayElement?: React.ReactElement; - onMonthChange?: (month: Date) => any; - onCaptionClick?: (e: React.SyntheticEvent<{}>, month: Date) => any; - className?: string; - selectedDays?: (date: Date) => boolean; - style?: React.CSSProperties; - tabIndex?: number; - } - - class DayPicker extends React.Component { - showMonth(month: Date): void; - showPreviousMonth(): void; - showNextMonth(): void; - } - - namespace DayPicker { - var LocaleUtils: LocaleUtils; - namespace DateUtils { - function addMonths(d: Date, n: number): Date; - function clone(d: Date): Date; - function isSameDay(d1?: Date, d2?: Date): boolean; - function isPastDay(d: Date): boolean; - function isDayBetween(day: Date, startDate: Date, endDate: Date): boolean; - function addDayToRange(day: Date, range: { from?: Date, to?: Date }): { from?: Date, to?: Date }; - function isDayInRange(day: Date, range: { from?: Date, to?: Date }): boolean; - } - } +interface DateUtils { + addMonths(d: Date, n: number): Date; + clone(d: Date): Date; + isSameDay(d1: Date, d2: Date): Date; + isPastDay(d: Date): boolean; + isFutureDay(d: Date): boolean; + isDayBetween(day: Date, begin: Date, end: Date): boolean; + addDayToRange(day: Date, range: RangeModifier): RangeModifier; + isDayInRange(day: Date, range: RangeModifier): boolean; } + +interface CaptionElementProps { + date: Date; + localeUtils: LocaleUtils; + locale: string; + onClick: typeof Props.onCaptionClick; +} + +interface NavbarElementProps { + className: string; + previousMonth: Date; + nextMonth: Date; + showPreviousButton: boolean; + showNextButton: boolean; + onPreviousClick(): void; + onNextClick(): void; + dir: string; + localeUtils: LocaleUtils; + locale: string; +} + +interface WeekdayElementProps { + weekday: number; + className: string; + localeUtils: LocaleUtils; + locale: string; +} + +interface ClassNames { + container: string; + interactionDisabled: string; + navBar: string; + navButtonPrev: string; + navButtonNext: string; + + month: string; + caption: string; + weekdays: string; + weekdaysRow: string; + weekday: string; + body: string; + week: string; + day: string; + + today: string; + selected: string; + disabled: string; + outside: string; +} + +interface RangeModifier { + from: Date; + to: Date; +} +interface BeforeModifier { + before: Date; +} +interface AfterModifier { + after: Date; +} +interface FunctionModifier { + (date: Date): boolean; +} +type Modifier = RangeModifier | BeforeModifier | AfterModifier | FunctionModifier; + +interface Modifiers { + today: Modifier | Modifier[]; + outside: Modifier | Modifier[]; + [other: string]: Modifier | Modifier[] | undefined; +} + +interface Props { + canChangeMonth?: boolean; + captionElement?: React.SFC; + className?: string; + classNames?: ClassNames; + containerProps?: React.HTMLAttributes; + disabledDays?: Modifier | Modifier[]; + enableOutsideDays?: boolean; + firstDayOfWeek?: number; + fixedWeeks?: boolean; + fromMonth?: Date; + initialMonth?: Date; + labels?: { previousMonth: string; nextMonth: string; }; + locale?: string; + localeUtils?: LocaleUtils; + modifiers?: Modifiers; + month?: Date; + months?: [string, string, string, string, string, string, string, string, string, string, string, string]; + navbarElement?: React.SFC | React.ComponentClass; + numberOfMonths?: number; + onBlur?(e: React.FocusEvent): void; + onCaptionClick?(month: Date, e: React.MouseEvent): void; + onDayClick?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; + onDayKeyDown?(day: Date, modifiers: Modifiers, e: React.KeyboardEvent): void; + onDayMouseEnter?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; + onDayMouseLeave?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; + onDayTouchEnd?(day: Date, modifiers: Modifiers, e: React.TouchEvent): void; + onDayTouchStart?(day: Date, modifiers: Modifiers, e: React.TouchEvent): void; + onFocus?(e: React.FocusEvent): void; + onKeyDown?(e: React.KeyboardEvent): void; + onMonthChange?(month: Date): void; + pagedNavigation?: boolean; + renderDay?(date: Date, modifiers: Modifiers): React.ReactNode; + reverseMonths?: boolean; + selectedDays?: Modifier | Modifier[]; + toMonth?: Date; + weekdayElement?: React.SFC | React.ComponentClass; + weekdaysLong?: [string, string, string, string, string, string, string]; + weekdaysShort?: [string, string, string, string, string, string, string]; +} + + +class DayPicker extends React.Component { + showMonth(month: Date): void; + + showPreviousMonth(): void; + + showNextMonth(): void; + + showPreviousYear(): void; + + showNextYear(): void; + + static readonly VERSION: string; + static readonly LocaleUtils: LocaleUtils; + static readonly DateUtils: DateUtils; +} + +export = DayPicker; From 7d55759e192e42ff871ee148a95b8707fd79c3a6 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Wed, 8 Mar 2017 00:35:03 -0500 Subject: [PATCH 054/374] react-day-picker merge types into namespace for export = syntax --- react-day-picker/index.d.ts | 270 ++++++++++++++++++------------------ 1 file changed, 135 insertions(+), 135 deletions(-) diff --git a/react-day-picker/index.d.ts b/react-day-picker/index.d.ts index e50ff542b0..3f166a0c84 100644 --- a/react-day-picker/index.d.ts +++ b/react-day-picker/index.d.ts @@ -6,139 +6,143 @@ import * as React from 'react'; -interface LocaleUtils { - formatDay(day: Date, locale: string): string; - formatMonthTitle(month: Date, locale: string): string; - formatWeekdayLong(weekday: number, locale: string): string; - formatWeekdayShort(weekday: number, locale: string): string; - getFirstDayOfWeek(locale: string): number; - getMonths(locale: string): [string, string, string, string, string, string, string, string, string, string, string, string]; +declare namespace DayPicker { + export interface LocaleUtils { + formatDay(day: Date, locale: string): string; + formatMonthTitle(month: Date, locale: string): string; + formatWeekdayLong(weekday: number, locale: string): string; + formatWeekdayShort(weekday: number, locale: string): string; + getFirstDayOfWeek(locale: string): number; + getMonths(locale: string): [string, string, string, string, string, string, string, string, string, string, string, string]; + } + + export interface DateUtils { + addMonths(d: Date, n: number): Date; + clone(d: Date): Date; + isSameDay(d1: Date, d2: Date): Date; + isPastDay(d: Date): boolean; + isFutureDay(d: Date): boolean; + isDayBetween(day: Date, begin: Date, end: Date): boolean; + addDayToRange(day: Date, range: RangeModifier): RangeModifier; + isDayInRange(day: Date, range: RangeModifier): boolean; + } + + export interface CaptionElementProps { + date?: Date; + localeUtils?: LocaleUtils; + locale?: string; + onClick?(month: Date, e: React.MouseEvent): void; + } + + export interface NavbarElementProps { + className?: string; + previousMonth?: Date; + nextMonth?: Date; + showPreviousButton?: boolean; + showNextButton?: boolean; + onPreviousClick?(): void; + onNextClick?(): void; + dir?: string; + localeUtils?: LocaleUtils; + locale?: string; + } + + export interface WeekdayElementProps { + weekday?: number; + className?: string; + localeUtils?: LocaleUtils; + locale?: string; + } + + export interface ClassNames { + container: string; + interactionDisabled: string; + navBar: string; + navButtonPrev: string; + navButtonNext: string; + + month: string; + caption: string; + weekdays: string; + weekdaysRow: string; + weekday: string; + body: string; + week: string; + day: string; + + today: string; + selected: string; + disabled: string; + outside: string; + } + + export interface RangeModifier { + from: Date; + to: Date; + } + export interface BeforeModifier { + before: Date; + } + export interface AfterModifier { + after: Date; + } + export interface FunctionModifier { + (date: Date): boolean; + } + export type Modifier = RangeModifier | BeforeModifier | AfterModifier | FunctionModifier; + + export interface Modifiers { + today: Modifier | Modifier[]; + outside: Modifier | Modifier[]; + [other: string]: Modifier | Modifier[] | undefined; + } + + export interface Props { + canChangeMonth?: boolean; + captionElement?: React.ReactElement; + className?: string; + classNames?: ClassNames; + containerProps?: React.HTMLAttributes; + disabledDays?: Modifier | Modifier[]; + enableOutsideDays?: boolean; + firstDayOfWeek?: number; + fixedWeeks?: boolean; + fromMonth?: Date; + initialMonth?: Date; + labels?: { previousMonth: string; nextMonth: string; }; + locale?: string; + localeUtils?: LocaleUtils; + modifiers?: Partial; + month?: Date; + months?: [string, string, string, string, string, string, string, string, string, string, string, string]; + navbarElement?: React.ReactElement; + numberOfMonths?: number; + onBlur?(e: React.FocusEvent): void; + onCaptionClick?(month: Date, e: React.MouseEvent): void; + onDayClick?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; + onDayKeyDown?(day: Date, modifiers: Modifiers, e: React.KeyboardEvent): void; + onDayMouseEnter?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; + onDayMouseLeave?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; + onDayTouchEnd?(day: Date, modifiers: Modifiers, e: React.TouchEvent): void; + onDayTouchStart?(day: Date, modifiers: Modifiers, e: React.TouchEvent): void; + onFocus?(e: React.FocusEvent): void; + onKeyDown?(e: React.KeyboardEvent): void; + onMonthChange?(month: Date): void; + pagedNavigation?: boolean; + renderDay?(date: Date, modifiers: Modifiers): React.ReactNode; + reverseMonths?: boolean; + selectedDays?: Modifier | Modifier[]; + toMonth?: Date; + weekdayElement?: React.ReactElement; + weekdaysLong?: [string, string, string, string, string, string, string]; + weekdaysShort?: [string, string, string, string, string, string, string]; + } + const VERSION: string; + const LocaleUtils: DayPicker.LocaleUtils; + const DateUtils: DayPicker.DateUtils; } -interface DateUtils { - addMonths(d: Date, n: number): Date; - clone(d: Date): Date; - isSameDay(d1: Date, d2: Date): Date; - isPastDay(d: Date): boolean; - isFutureDay(d: Date): boolean; - isDayBetween(day: Date, begin: Date, end: Date): boolean; - addDayToRange(day: Date, range: RangeModifier): RangeModifier; - isDayInRange(day: Date, range: RangeModifier): boolean; -} - -interface CaptionElementProps { - date: Date; - localeUtils: LocaleUtils; - locale: string; - onClick: typeof Props.onCaptionClick; -} - -interface NavbarElementProps { - className: string; - previousMonth: Date; - nextMonth: Date; - showPreviousButton: boolean; - showNextButton: boolean; - onPreviousClick(): void; - onNextClick(): void; - dir: string; - localeUtils: LocaleUtils; - locale: string; -} - -interface WeekdayElementProps { - weekday: number; - className: string; - localeUtils: LocaleUtils; - locale: string; -} - -interface ClassNames { - container: string; - interactionDisabled: string; - navBar: string; - navButtonPrev: string; - navButtonNext: string; - - month: string; - caption: string; - weekdays: string; - weekdaysRow: string; - weekday: string; - body: string; - week: string; - day: string; - - today: string; - selected: string; - disabled: string; - outside: string; -} - -interface RangeModifier { - from: Date; - to: Date; -} -interface BeforeModifier { - before: Date; -} -interface AfterModifier { - after: Date; -} -interface FunctionModifier { - (date: Date): boolean; -} -type Modifier = RangeModifier | BeforeModifier | AfterModifier | FunctionModifier; - -interface Modifiers { - today: Modifier | Modifier[]; - outside: Modifier | Modifier[]; - [other: string]: Modifier | Modifier[] | undefined; -} - -interface Props { - canChangeMonth?: boolean; - captionElement?: React.SFC; - className?: string; - classNames?: ClassNames; - containerProps?: React.HTMLAttributes; - disabledDays?: Modifier | Modifier[]; - enableOutsideDays?: boolean; - firstDayOfWeek?: number; - fixedWeeks?: boolean; - fromMonth?: Date; - initialMonth?: Date; - labels?: { previousMonth: string; nextMonth: string; }; - locale?: string; - localeUtils?: LocaleUtils; - modifiers?: Modifiers; - month?: Date; - months?: [string, string, string, string, string, string, string, string, string, string, string, string]; - navbarElement?: React.SFC | React.ComponentClass; - numberOfMonths?: number; - onBlur?(e: React.FocusEvent): void; - onCaptionClick?(month: Date, e: React.MouseEvent): void; - onDayClick?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; - onDayKeyDown?(day: Date, modifiers: Modifiers, e: React.KeyboardEvent): void; - onDayMouseEnter?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; - onDayMouseLeave?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; - onDayTouchEnd?(day: Date, modifiers: Modifiers, e: React.TouchEvent): void; - onDayTouchStart?(day: Date, modifiers: Modifiers, e: React.TouchEvent): void; - onFocus?(e: React.FocusEvent): void; - onKeyDown?(e: React.KeyboardEvent): void; - onMonthChange?(month: Date): void; - pagedNavigation?: boolean; - renderDay?(date: Date, modifiers: Modifiers): React.ReactNode; - reverseMonths?: boolean; - selectedDays?: Modifier | Modifier[]; - toMonth?: Date; - weekdayElement?: React.SFC | React.ComponentClass; - weekdaysLong?: [string, string, string, string, string, string, string]; - weekdaysShort?: [string, string, string, string, string, string, string]; -} - - -class DayPicker extends React.Component { +declare class DayPicker extends React.Component { showMonth(month: Date): void; showPreviousMonth(): void; @@ -148,10 +152,6 @@ class DayPicker extends React.Component { showPreviousYear(): void; showNextYear(): void; - - static readonly VERSION: string; - static readonly LocaleUtils: LocaleUtils; - static readonly DateUtils: DateUtils; } export = DayPicker; From 99e2521b64f732b59ab658a54673ffa083adbe1e Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Wed, 8 Mar 2017 00:35:31 -0500 Subject: [PATCH 055/374] react-day-picker typing tests passing --- react-day-picker/react-day-picker-tests.tsx | 30 +++++++++------------ 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/react-day-picker/react-day-picker-tests.tsx b/react-day-picker/react-day-picker-tests.tsx index e8a17b5087..deecb3e21a 100644 --- a/react-day-picker/react-day-picker-tests.tsx +++ b/react-day-picker/react-day-picker-tests.tsx @@ -1,37 +1,33 @@ import * as React from 'react'; -import * as DayPicker2 from "react-day-picker"; +import DayPicker = require('react-day-picker'); function isSunday(day: Date) { return day.getDay() === 0; } -// make sure global variable version works -function MyComponent2() { - return +function MyComponent() { + return ( + + ); } DayPicker.DateUtils.clone(new Date()); -DayPicker.DateUtils.isDayInRange(new Date(), {from: new Date()}); +DayPicker.DateUtils.isDayInRange(new Date(), { from: new Date(), to: new Date(2050) }); -// make sure imported version works -function MyComponent() { - return +interface MyCaptionProps extends DayPicker.CaptionElementProps { } -DayPicker2.DateUtils.clone(new Date()); -DayPicker2.DateUtils.isDayInRange(new Date(), { from: new Date() }); - -// test interface for captionElement prop -interface MyCaptionProps extends ReactDayPicker.CaptionElementProps { } class Caption extends React.Component { render() { const { date, locale, localeUtils, onClick } = this.props; - if (!date || !localeUtils || typeof locale === 'undefined') { - return null + if (!date || !localeUtils || !onClick || typeof locale === 'undefined') { + return null; } return ( -
- { localeUtils.formatMonthTitle(date, locale) } +
onClick(date, e) }> + { localeUtils.formatMonthTitle(date, locale) }
); } From 395d4c556b1937ba6820a6c7859b641356a09eb5 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Wed, 8 Mar 2017 00:41:42 -0500 Subject: [PATCH 056/374] react-day-picker update version string --- react-day-picker/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-day-picker/index.d.ts b/react-day-picker/index.d.ts index 3f166a0c84..1e99e1f48b 100644 --- a/react-day-picker/index.d.ts +++ b/react-day-picker/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-day-picker 1.2 +// Type definitions for react-day-picker 5.1 // Project: https://github.com/gpbl/react-day-picker // Definitions by: Giampaolo Bellavite , Jason Killian // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 92c994bf7d1875d50100812e2817234e7cde0351 Mon Sep 17 00:00:00 2001 From: "Lopez, Manuel" Date: Wed, 8 Mar 2017 11:18:44 +0100 Subject: [PATCH 057/374] Update types, in order to allow to reuse params and/or attach in a new custom world --- cucumber/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cucumber/index.d.ts b/cucumber/index.d.ts index 99f31c5372..fb2ed7e138 100644 --- a/cucumber/index.d.ts +++ b/cucumber/index.d.ts @@ -75,7 +75,7 @@ declare namespace cucumber { After(code: HookCode): void; Around(code: AroundCode):void; setDefaultTimeout(time:number): void; - setWorldConstructor(world: () => void): void; + setWorldConstructor(world: (() => void) | ({})): void; registerHandler(handlerOption:string, code:(event:any, callback:CallbackStepDefinition) =>void): void; registerListener(listener: EventListener): void; addTransform(transform: Transform): void; From acb5edf962060577cd4ff68bf2f42b1f8477a304 Mon Sep 17 00:00:00 2001 From: sqwk Date: Wed, 8 Mar 2017 11:48:25 +0100 Subject: [PATCH 058/374] fix: Make Chainable Work --- lowdb/index.d.ts | 130 +++++++++++++++++++++++------------------------ 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/lowdb/index.d.ts b/lowdb/index.d.ts index 4118372647..3ca15155e1 100644 --- a/lowdb/index.d.ts +++ b/lowdb/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: typicode, // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace lowdb { +declare namespace Lowdb { interface PromiseLike { /** @@ -45,24 +45,24 @@ declare namespace lowdb { chain?: boolean; } - class LoDashWrapper { + class LoDashWrapper> { /** * @see _.has */ - has(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; + has(path: StringRepresentable | StringRepresentable[]): LowEntryClass; /** * @see _.hasIn */ - hasIn(path: StringRepresentable | StringRepresentable[]): LoDashWrapper; + hasIn(path: StringRepresentable | StringRepresentable[]): LowEntryClass; /** * @see _.assign */ assign( source: TSource - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.assign @@ -70,7 +70,7 @@ declare namespace lowdb { assign( source1: TSource1, source2: TSource2 - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.assign @@ -79,7 +79,7 @@ declare namespace lowdb { source1: TSource1, source2: TSource2, source3: TSource3 - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.assign @@ -89,37 +89,37 @@ declare namespace lowdb { source2: TSource2, source3: TSource3, source4: TSource4 - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.assign */ - assign(): LoDashWrapper; + assign(): LowEntryClass; /** * @see _.assign */ - assign(...otherArgs: any[]): LoDashWrapper; + assign(...otherArgs: any[]): LowEntryClass; /** * @see _.cloneDeep */ - cloneDeep(): LoDashWrapper; + cloneDeep(): LowEntryClass; /** * @see _.cloneDeep */ - cloneDeep(): LoDashWrapper; + cloneDeep(): LowEntryClass; /** * @see _.cloneDeep */ - cloneDeepWith(customizer: (value: any) => any): LoDashWrapper[]; + cloneDeepWith(customizer: (value: any) => any): LowEntryClass[]; /** * @see _.cloneDeep */ - cloneDeepWith(customizer: (value: any) => any): LoDashWrapper; + cloneDeepWith(customizer: (value: any) => any): LowEntryClass; /** * @see _.defaults @@ -127,7 +127,7 @@ declare namespace lowdb { defaults( source1: S1, ...sources: {}[] - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.defaults @@ -136,7 +136,7 @@ declare namespace lowdb { source1: S1, source2: S2, ...sources: {}[] - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.defaults @@ -146,7 +146,7 @@ declare namespace lowdb { source2: S2, source3: S3, ...sources: {}[] - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.defaults @@ -157,17 +157,17 @@ declare namespace lowdb { source3: S3, source4: S4, ...sources: {}[] - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.defaults */ - defaults(): LoDashWrapper; + defaults(): LowEntryClass; /** * @see _.defaults */ - defaults(...sources: {}[]): LoDashWrapper; + defaults(...sources: {}[]): LowEntryClass; /** * @see _.get @@ -175,14 +175,14 @@ declare namespace lowdb { get(object: any, path: string | number | boolean | Array, defaultValue?: TResult - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.get */ get(path: string | number | boolean | Array, defaultValue?: TResult - ): LoDashWrapper; + ): LowEntryClass; /** @@ -191,14 +191,14 @@ declare namespace lowdb { mixin( source: Dictionary<() => void>, options?: MixinOptions - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.mixin */ mixin( options?: MixinOptions - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.set @@ -206,7 +206,7 @@ declare namespace lowdb { set( path: StringRepresentable | StringRepresentable[], value: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.set @@ -214,7 +214,7 @@ declare namespace lowdb { set( path: StringRepresentable | StringRepresentable[], value: V - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.find @@ -222,7 +222,7 @@ declare namespace lowdb { find( predicate?: ListIterator, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.find @@ -230,21 +230,21 @@ declare namespace lowdb { find( predicate?: string, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.find */ find( predicate?: TObject - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.find */ filter( predicate?: TObject - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.filter @@ -252,7 +252,7 @@ declare namespace lowdb { filter( predicate?: ListIterator, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.filter @@ -260,7 +260,7 @@ declare namespace lowdb { filter( predicate: string, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.filter @@ -268,7 +268,7 @@ declare namespace lowdb { filter( predicate: ListIterator | DictionaryIterator, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.filter @@ -276,40 +276,40 @@ declare namespace lowdb { filter( predicate?: StringIterator, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.filter */ - filter(predicate: W): LoDashWrapper; + filter(predicate: W): LowEntryClass; /** * @see _.map */ map( iteratee?: ListIterator, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.map */ map( iteratee?: string - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.map */ map( iteratee?: TObject - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.map */ map( iteratee?: ListIterator | DictionaryIterator, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.range @@ -317,7 +317,7 @@ declare namespace lowdb { range( end?: number, step?: number - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.rangeRight @@ -325,7 +325,7 @@ declare namespace lowdb { rangeRight( end?: number, step?: number - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.remove @@ -333,7 +333,7 @@ declare namespace lowdb { remove( predicate?: ListIterator, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.remove @@ -341,46 +341,46 @@ declare namespace lowdb { remove( predicate?: string, thisArg?: any - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.remove */ remove( predicate?: W - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.sortBy */ sortBy( iteratee?: ListIterator - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.sortBy */ - sortBy(iteratee: string): LoDashWrapper; + sortBy(iteratee: string): LowEntryClass; /** * @see _.sortBy */ - sortBy(whereValue: W): LoDashWrapper; + sortBy(whereValue: W): LowEntryClass; /** * @see _.sortBy */ - sortBy(): LoDashWrapper; + sortBy(): LowEntryClass; /** * @see _.sortBy */ - sortBy(...iteratees: (ListIterator | any | string)[]): LoDashWrapper; + sortBy(...iteratees: (ListIterator | any | string)[]): LowEntryClass; /** * @see _.sortBy */ - sortBy(iteratees: (ListIterator | string | any)[]): LoDashWrapper; + sortBy(iteratees: (ListIterator | string | any)[]): LowEntryClass; /** * @see _.slice @@ -388,44 +388,44 @@ declare namespace lowdb { slice( start?: number, end?: number - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.size */ - size(): LoDashWrapper; + size(): LowEntryClass; /** * @see _.take */ - take(n?: number): LoDashWrapper; + take(n?: number): LowEntryClass; /** * @see _.times */ times( iteratee: (num: number) => TResult - ): LoDashWrapper; + ): LowEntryClass; /** * @see _.times */ - times(): LoDashWrapper; + times(): LowEntryClass; /** * @see _.uniqueId */ - uniqueId(): LoDashWrapper; + uniqueId(): LowEntryClass; value(): T; pop(): T; - push(...items: T[]): LoDashWrapper; + push(...items: T[]): LowEntryClass; shift(): T; - sort(compareFn?: (a: T, b: T) => number): LoDashWrapper; - splice(start: number): LoDashWrapper; - splice(start: number, deleteCount: number, ...items: any[]): LoDashWrapper; - unshift(...items: T[]): LoDashWrapper; + sort(compareFn?: (a: T, b: T) => number): LowEntryClass; + splice(start: number): LowEntryClass; + splice(start: number, deleteCount: number, ...items: any[]): LowEntryClass; + unshift(...items: T[]): LowEntryClass; } export interface Storage { @@ -505,7 +505,7 @@ declare namespace lowdb { } - export class Low extends LoDashWrapper { + export class Lowdb extends LoDashWrapper { constructor(filePath: string, options?: Options); @@ -525,13 +525,13 @@ declare namespace lowdb { * Persist database. * @param source The source location. */ - write(source: string): void + write(source?: string): void /** * Persist database. * @param source The source location. */ - write(source: string): PromiseLike + write(source?: string): PromiseLike /** * Read database. @@ -554,5 +554,5 @@ declare namespace lowdb { } declare module "lowdb" { - export = lowdb.Low; + export = Lowdb.Lowdb; } \ No newline at end of file From 162688615a8f5e9980b12633e4c19ff54aaefe84 Mon Sep 17 00:00:00 2001 From: sqwk Date: Wed, 8 Mar 2017 11:48:54 +0100 Subject: [PATCH 059/374] fix: Update Tests for v15.5 --- lowdb/lowdb-tests.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lowdb/lowdb-tests.ts b/lowdb/lowdb-tests.ts index 612288e8dd..b7e0f4f5f6 100644 --- a/lowdb/lowdb-tests.ts +++ b/lowdb/lowdb-tests.ts @@ -2,10 +2,15 @@ import Lowdb = require('lowdb'); const db = new Lowdb('db.json'); -db.defaults({ someObject: {}, anotherObject: {} }).value(); +db.defaults({ someObject: {}, anotherObject: {} }).write(); -db.get('someObject').set('foo' , 'bar').value(); -db.get('anotherObject').set('foo' , 'bar').value(); -db.set('singleValue', 'foo').value(); +db.get('someObject').set('foo' , 'bar').write(); +db.get('someObject.foo').value(); + +db.get('anotherObject').set('foo' , 'bar').write(); +db.get('anotherObject.foo').value(); + +db.set('singleValue', 'foo').write(); +db.get('singleValue').value(); console.log(db.getState()); From 673f3c9b72d71b51476be7b072f5d621733c31f3 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Wed, 8 Mar 2017 10:59:34 -0500 Subject: [PATCH 060/374] react-day-picker remove tsconfig.json types react and add reference comment in index.d.ts --- react-day-picker/index.d.ts | 2 ++ react-day-picker/tsconfig.json | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/react-day-picker/index.d.ts b/react-day-picker/index.d.ts index 1e99e1f48b..d1f71a911e 100644 --- a/react-day-picker/index.d.ts +++ b/react-day-picker/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 +/// + import * as React from 'react'; declare namespace DayPicker { diff --git a/react-day-picker/tsconfig.json b/react-day-picker/tsconfig.json index 4cf47535ad..823be84e03 100644 --- a/react-day-picker/tsconfig.json +++ b/react-day-picker/tsconfig.json @@ -13,9 +13,7 @@ "typeRoots": [ "../" ], - "types": [ - "react" - ], + "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, From d6472a73263a821cf19241bd4df444ec01c64668 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Wed, 8 Mar 2017 11:12:26 -0500 Subject: [PATCH 061/374] react-day-picker remove reference type react because it is already imported --- react-day-picker/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/react-day-picker/index.d.ts b/react-day-picker/index.d.ts index d1f71a911e..1e99e1f48b 100644 --- a/react-day-picker/index.d.ts +++ b/react-day-picker/index.d.ts @@ -4,8 +4,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -/// - import * as React from 'react'; declare namespace DayPicker { From eed88053b0ec98c27e50e77b4216053aa455d432 Mon Sep 17 00:00:00 2001 From: abeall Date: Wed, 8 Mar 2017 14:24:11 -0500 Subject: [PATCH 062/374] Added browser name values --- detect-browser/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detect-browser/index.d.ts b/detect-browser/index.d.ts index 0f845cd781..5ca68eabdf 100644 --- a/detect-browser/index.d.ts +++ b/detect-browser/index.d.ts @@ -6,7 +6,7 @@ /** * Browser name */ -export const name: string; +export const name: "edge" | "yandexbrowser" | "chrome" | "crios" | "firefox" | "opera" | "ie" | "bb10" | "android" | "ios" | "safari"; /** * Browser version From 023d4ef9370dc1a7ca348d75cb4b0e42c890dee5 Mon Sep 17 00:00:00 2001 From: abeall Date: Wed, 8 Mar 2017 14:26:53 -0500 Subject: [PATCH 063/374] Updated version --- detect-browser/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detect-browser/index.d.ts b/detect-browser/index.d.ts index 5ca68eabdf..57ed80c411 100644 --- a/detect-browser/index.d.ts +++ b/detect-browser/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for detect-browser v1.3.3 +// Type definitions for detect-browser v1.6.2 // Project: https://github.com/DamonOehlman/detect-browser // Definitions by: Rogier Schouten // Definitions: https://github.com/borisyankov/DefinitelyTyped From 1b95ed269fbbcb34ec770a212147aed1e5c72f03 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Thu, 9 Mar 2017 01:21:15 +0000 Subject: [PATCH 064/374] Fixed magic quotes. --- openfin/index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openfin/index.d.ts b/openfin/index.d.ts index f0803864ae..24f91ab9ca 100644 --- a/openfin/index.d.ts +++ b/openfin/index.d.ts @@ -63,7 +63,7 @@ declare namespace fin { */ 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. + * 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; /** @@ -99,7 +99,7 @@ declare namespace fin { */ 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. + * Removes the application's icon from the tray. */ removeTrayIcon(callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -1008,7 +1008,7 @@ declare namespace fin { bringToFront(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Closes the window. - * @param {force} Close will be prevented from closing when force is false and �close-requested� has been subscribed to for application�s main window. + * @param {force} 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; /** @@ -1028,7 +1028,7 @@ declare namespace fin { */ enableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Flashes the window�s frame and taskbar icon until the window is activated. + * Flashes the window's frame and taskbar icon until the window is activated. */ flash(options?: any, callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -1125,7 +1125,7 @@ declare namespace fin { setZoomLevel(level: number, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Shows the window if it is hidden. - * @param {force} Show will be prevented from closing when force is false and �show-requested� has been subscribed to for application�s main window. + * @param {force} 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; /** From 9fc167714de333821347c5ebcb090f9f78457bf2 Mon Sep 17 00:00:00 2001 From: Chris Barker Date: Thu, 9 Mar 2017 01:45:36 +0000 Subject: [PATCH 065/374] Fixed magic quotes in v16 too. --- openfin/v16/index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openfin/v16/index.d.ts b/openfin/v16/index.d.ts index 0b9f3e16ac..32e980120f 100644 --- a/openfin/v16/index.d.ts +++ b/openfin/v16/index.d.ts @@ -63,7 +63,7 @@ declare namespace fin { */ 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. + * 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; /** @@ -95,7 +95,7 @@ declare namespace fin { */ 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. + * Removes the application's icon from the tray. */ removeTrayIcon(callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -989,7 +989,7 @@ declare namespace fin { bringToFront(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Closes the window. - * @param {force} Close will be prevented from closing when force is false and �close-requested� has been subscribed to for application�s main window. + * @param {force} 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; /** @@ -1009,7 +1009,7 @@ declare namespace fin { */ enableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Flashes the window�s frame and taskbar icon until the window is activated. + * Flashes the window's frame and taskbar icon until the window is activated. */ flash(options?: any, callback?: () => void, errorCallback?: (reason: string) => void): void; /** @@ -1106,7 +1106,7 @@ declare namespace fin { setZoomLevel(level: number, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Shows the window if it is hidden. - * @param {force} Show will be prevented from closing when force is false and �show-requested� has been subscribed to for application�s main window. + * @param {force} 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; /** From d4864b74edfcd79afc9f120e8b7df33c4665bd50 Mon Sep 17 00:00:00 2001 From: Ricky Blankenaufulland Date: Thu, 9 Mar 2017 14:58:30 +0100 Subject: [PATCH 066/374] fixed how the GridStack object is obtained jQuery plugins return the jQuery object, to get the plugin, also in the case of GridStack 0.2.6 (latest) you use the data() method with the correct name --- gridstack/gridstack-tests.ts | 6 +++++- gridstack/index.d.ts | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gridstack/gridstack-tests.ts b/gridstack/gridstack-tests.ts index 96aa14b19f..02e6c1597f 100644 --- a/gridstack/gridstack-tests.ts +++ b/gridstack/gridstack-tests.ts @@ -10,7 +10,11 @@ var options = { float: true }; -var gridstack:GridStack = $(document).gridstack(options); +var element: JQuery = $(document).gridstack(options); +var gridstack: GridStack = $(document).data("gridstack"); +var gsFromElement: GridStack = element.data("gridstack"); + +if (gridstack !== gsFromElement) throw Error('These should match!'); gridstack.addWidget("test", 1, 2, 3, 4, true); gridstack.batchUpdate(); diff --git a/gridstack/index.d.ts b/gridstack/index.d.ts index 75056999e2..19e4bda280 100644 --- a/gridstack/index.d.ts +++ b/gridstack/index.d.ts @@ -4,7 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface JQuery { - gridstack (options: IGridstackOptions):GridStack + gridstack (options: IGridstackOptions): JQuery; + data(key: "gridstack"): GridStack; } interface GridStack { From bd35ad182875e11c8c70c97d1bc40726a62e08e1 Mon Sep 17 00:00:00 2001 From: Ricky Blankenaufulland Date: Thu, 9 Mar 2017 14:59:27 +0100 Subject: [PATCH 067/374] added ZoolWay to the authors --- gridstack/gridstack-tests.ts | 1 + gridstack/index.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/gridstack/gridstack-tests.ts b/gridstack/gridstack-tests.ts index 02e6c1597f..0546bab506 100644 --- a/gridstack/gridstack-tests.ts +++ b/gridstack/gridstack-tests.ts @@ -5,6 +5,7 @@ // Type definitions for Gridstack // Project: http://troolee.github.io/gridstack.js/ // Definitions by: Pascal Senn +// Definitions by: Ricky Blankenaufulland // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped var options = { diff --git a/gridstack/index.d.ts b/gridstack/index.d.ts index 19e4bda280..7f557f4af6 100644 --- a/gridstack/index.d.ts +++ b/gridstack/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Gridstack // Project: http://troolee.github.io/gridstack.js/ // Definitions by: Pascal Senn +// Definitions by: Ricky Blankenaufulland // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface JQuery { From d57893528cfc43ee257764d0d4986a996fa91ac7 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Thu, 9 Mar 2017 13:07:57 -0500 Subject: [PATCH 068/374] add types for react-day-picker 5.2 --- react-day-picker/index.d.ts | 54 ++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/react-day-picker/index.d.ts b/react-day-picker/index.d.ts index 1e99e1f48b..be90f72d07 100644 --- a/react-day-picker/index.d.ts +++ b/react-day-picker/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-day-picker 5.1 +// Type definitions for react-day-picker 5.2 // Project: https://github.com/gpbl/react-day-picker // Definitions by: Giampaolo Bellavite , Jason Killian // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -28,30 +28,34 @@ declare namespace DayPicker { } export interface CaptionElementProps { - date?: Date; - localeUtils?: LocaleUtils; - locale?: string; - onClick?(month: Date, e: React.MouseEvent): void; + date: Date; + classNames: ClassNames, + localeUtils: LocaleUtils; + locale: string; + months: undefined; + onClick?: React.MouseEventHandler; } export interface NavbarElementProps { - className?: string; - previousMonth?: Date; - nextMonth?: Date; - showPreviousButton?: boolean; - showNextButton?: boolean; - onPreviousClick?(): void; - onNextClick?(): void; + className: string; + classNames: ClassNames; + previousMonth: Date; + nextMonth: Date; + showPreviousButton: boolean; + showNextButton: boolean; + onPreviousClick(callback?: () => void): void; + onNextClick(callback?: () => void): void; dir?: string; - localeUtils?: LocaleUtils; - locale?: string; + labels: { previousMonth: string; nextMonth: string; }; + localeUtils: LocaleUtils; + locale: string; } export interface WeekdayElementProps { - weekday?: number; - className?: string; - localeUtils?: LocaleUtils; - locale?: string; + weekday: number; + className: string; + localeUtils: LocaleUtils; + locale: string; } export interface ClassNames { @@ -89,7 +93,7 @@ declare namespace DayPicker { export interface FunctionModifier { (date: Date): boolean; } - export type Modifier = RangeModifier | BeforeModifier | AfterModifier | FunctionModifier; + export type Modifier = Date | RangeModifier | BeforeModifier | AfterModifier | FunctionModifier; export interface Modifiers { today: Modifier | Modifier[]; @@ -99,7 +103,9 @@ declare namespace DayPicker { export interface Props { canChangeMonth?: boolean; - captionElement?: React.ReactElement; + captionElement?: React.ReactElement> | + React.ComponentClass | + React.SFC; className?: string; classNames?: ClassNames; containerProps?: React.HTMLAttributes; @@ -115,7 +121,9 @@ declare namespace DayPicker { modifiers?: Partial; month?: Date; months?: [string, string, string, string, string, string, string, string, string, string, string, string]; - navbarElement?: React.ReactElement; + navbarElement?: React.ReactElement> | + React.ComponentClass | + React.SFC; numberOfMonths?: number; onBlur?(e: React.FocusEvent): void; onCaptionClick?(month: Date, e: React.MouseEvent): void; @@ -133,7 +141,9 @@ declare namespace DayPicker { reverseMonths?: boolean; selectedDays?: Modifier | Modifier[]; toMonth?: Date; - weekdayElement?: React.ReactElement; + weekdayElement?: React.ReactElement> | + React.ComponentClass | + React.SFC; weekdaysLong?: [string, string, string, string, string, string, string]; weekdaysShort?: [string, string, string, string, string, string, string]; } From c0b6319ccf49e2ac3107bfb906456489ab30f9d4 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Thu, 9 Mar 2017 15:22:54 -0500 Subject: [PATCH 069/374] react-day-picker update tests to include new use of Element or React.SFC for captionElement --- react-day-picker/react-day-picker-tests.tsx | 23 ++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/react-day-picker/react-day-picker-tests.tsx b/react-day-picker/react-day-picker-tests.tsx index deecb3e21a..8c2755f9b5 100644 --- a/react-day-picker/react-day-picker-tests.tsx +++ b/react-day-picker/react-day-picker-tests.tsx @@ -8,7 +8,7 @@ function isSunday(day: Date) { function MyComponent() { return ( ); } @@ -26,10 +26,27 @@ class Caption extends React.Component { } return ( -
onClick(date, e) }> +
{ localeUtils.formatMonthTitle(date, locale) }
); } } -}/> + + + +type CaptionElementProps = Partial; +class CaptionElement extends React.Component { + render() { + const { date, locale, localeUtils, onClick } = this.props; + if (!date || !locale || !localeUtils || !onClick) { + return
; + } + return ( +
+ { localeUtils.formatMonthTitle(date, locale) } +
+ ) + } +} + }/> From 79388ead2d06c9f7015d21b7ba35d2d754561e9f Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Fri, 10 Mar 2017 16:16:00 +0900 Subject: [PATCH 070/374] Update package version --- redux-persist-transform-encrypt/package.json | 2 +- redux-persist-transform-filter/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/redux-persist-transform-encrypt/package.json b/redux-persist-transform-encrypt/package.json index 058a03ac99..acaf48dde5 100644 --- a/redux-persist-transform-encrypt/package.json +++ b/redux-persist-transform-encrypt/package.json @@ -1,6 +1,6 @@ { "dependencies": { "redux": "^3.6.0", - "redux-persist": "^4.4.1" + "redux-persist": "^4.4.2" } } diff --git a/redux-persist-transform-filter/package.json b/redux-persist-transform-filter/package.json index 058a03ac99..acaf48dde5 100644 --- a/redux-persist-transform-filter/package.json +++ b/redux-persist-transform-filter/package.json @@ -1,6 +1,6 @@ { "dependencies": { "redux": "^3.6.0", - "redux-persist": "^4.4.1" + "redux-persist": "^4.4.2" } } From 7bd7db4a1cb2f71588354a77c9e25161ca0111a8 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Fri, 10 Mar 2017 17:09:20 +0900 Subject: [PATCH 071/374] Add definitions for redux-auth-wrapper --- redux-auth-wrapper/index.d.ts | 32 +++++++++++++++++++ redux-auth-wrapper/package.json | 5 +++ .../redux-auth-wrapper-tests.tsx | 28 ++++++++++++++++ redux-auth-wrapper/tsconfig.json | 26 +++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 redux-auth-wrapper/index.d.ts create mode 100644 redux-auth-wrapper/package.json create mode 100644 redux-auth-wrapper/redux-auth-wrapper-tests.tsx create mode 100644 redux-auth-wrapper/tsconfig.json diff --git a/redux-auth-wrapper/index.d.ts b/redux-auth-wrapper/index.d.ts new file mode 100644 index 0000000000..a5f8d777a5 --- /dev/null +++ b/redux-auth-wrapper/index.d.ts @@ -0,0 +1,32 @@ +// Type definitions for redux-auth-wrapper 1.0 +// Project: https://github.com/mjrussell/redux-auth-wrapper +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { ComponentClass, StatelessComponent, ReactType } from "react"; +import { Action } from "redux"; +import { Location } from "history"; + +type ComponentConstructor

= ComponentClass

| StatelessComponent

; + +interface InjectedProps { + authData?: AuthData; +} + +export interface AuthWrapperConfig { + allowRedirectBack?: boolean | ((location: Location, redirectPath: string) => boolean); + authenticatingSelector?: (state: State, ownProps?: Props) => boolean; + authSelector: (state: State, ownProps?: Props) => AuthData; + FailureComponent?: ReactType; + failureRedirectPath?: string | ((state: State, ownProps?: Props) => string); + LoadingComponent?: ReactType; + redirectQueryParamName?: string; + wrapperDisplayName?: string; + predicate?: (authData: AuthData) => boolean; + propMapper?: (ownProps: Props) => InjectedProps & Props; + redirectAction?: (...args: any[]) => Action; +} + +type AuthDecorator = (component: ComponentConstructor) => ComponentClass; + +export function UserAuthWrapper(config: AuthWrapperConfig): AuthDecorator; diff --git a/redux-auth-wrapper/package.json b/redux-auth-wrapper/package.json new file mode 100644 index 0000000000..36ce503807 --- /dev/null +++ b/redux-auth-wrapper/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "redux": "^3.6.0" + } +} diff --git a/redux-auth-wrapper/redux-auth-wrapper-tests.tsx b/redux-auth-wrapper/redux-auth-wrapper-tests.tsx new file mode 100644 index 0000000000..a6d363dc06 --- /dev/null +++ b/redux-auth-wrapper/redux-auth-wrapper-tests.tsx @@ -0,0 +1,28 @@ +import * as React from "react"; +import { StatelessComponent } from "react"; +import { UserAuthWrapper } from "redux-auth-wrapper"; + +const Auth = UserAuthWrapper({ + allowRedirectBack: true, + authenticatingSelector(state: any) { + return state.auth.loading + }, + authSelector(state: any) { + return state.auth + }, + FailureComponent: () => (

), + failureRedirectPath: "/401", + LoadingComponent: () => (
), + redirectAction: () => ({ type : "redirect" }), + redirectQueryParamName: "next", + predicate(authData: any) { + return authData.authorized + }, + wrapperDisplayName: "TestAuth" +}); + +export const TestAuthComponent: StatelessComponent = () => { + return (
); +}; + +const TestAuth = Auth(TestAuthComponent); diff --git a/redux-auth-wrapper/tsconfig.json b/redux-auth-wrapper/tsconfig.json new file mode 100644 index 0000000000..844f327d0e --- /dev/null +++ b/redux-auth-wrapper/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": ["../"], + "paths": { + "history": ["history/v3"], + "history/*": ["history/v3/*"] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "redux-auth-wrapper-tests.tsx" + ] +} From d0000c9c8c53775069299deed9705886b6fd1d35 Mon Sep 17 00:00:00 2001 From: Karol Janyst Date: Fri, 10 Mar 2017 17:17:52 +0900 Subject: [PATCH 072/374] Add compiler flag --- redux-auth-wrapper/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/redux-auth-wrapper/index.d.ts b/redux-auth-wrapper/index.d.ts index a5f8d777a5..ffde27da52 100644 --- a/redux-auth-wrapper/index.d.ts +++ b/redux-auth-wrapper/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mjrussell/redux-auth-wrapper // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { ComponentClass, StatelessComponent, ReactType } from "react"; import { Action } from "redux"; From 84a11fea179426c39e5dbd7d577004791f2a957b Mon Sep 17 00:00:00 2001 From: Steven Liekens Date: Fri, 10 Mar 2017 12:42:22 +0100 Subject: [PATCH 073/374] Rename DataTable to Api --- datatables.net-buttons/index.d.ts | 8 +- datatables.net/datatables.net-tests.ts | 12 +- datatables.net/index.d.ts | 152 ++++++++++++------------- 3 files changed, 86 insertions(+), 86 deletions(-) diff --git a/datatables.net-buttons/index.d.ts b/datatables.net-buttons/index.d.ts index b4ed4b0eb5..c405d5093e 100644 --- a/datatables.net-buttons/index.d.ts +++ b/datatables.net-buttons/index.d.ts @@ -86,7 +86,7 @@ declare namespace DataTables { } export interface FunctionButtonAvailable { - (dt: DataTables.DataTable, config: any): boolean + (dt: DataTables.Api, config: any): boolean } export interface ButtonExportOptions { columns?: string; @@ -101,14 +101,14 @@ declare namespace DataTables { } export interface ButtonText { - (dt: DataTables.DataTable, node: JQuery, config: any): string + (dt: DataTables.Api, node: JQuery, config: any): string } export interface FunctionButtonInit { - (dt: DataTables.DataTable, node: JQuery, config: any): void + (dt: DataTables.Api, node: JQuery, config: any): void } // api object? export interface FunctionButtonAction { - (e: any, dt: DataTables.DataTable, node: JQuery, config: any): void + (e: any, dt: DataTables.Api, node: JQuery, config: any): void } export interface FunctionButtonCustomize { diff --git a/datatables.net/datatables.net-tests.ts b/datatables.net/datatables.net-tests.ts index 0134581ee1..72fee9a313 100644 --- a/datatables.net/datatables.net-tests.ts +++ b/datatables.net/datatables.net-tests.ts @@ -324,7 +324,7 @@ $(document).ready(function () { destroy = dt.destroy(true); destroy.$(""); - var draw: DataTables.DataTable = dt.draw(); + var draw: DataTables.Api = dt.draw(); draw = dt.draw(true); draw = dt.draw("page"); draw.$(""); @@ -790,8 +790,8 @@ $(document).ready(function () { var rows_13 = dt.rows.add([{}, {}]); dt.rows().every(function () { }); dt.rows().every(function (rowIdx, tableLoop, rowLoop) { }); - var rows_14: DataTables.DataTable = dt.rows("selector").ids(); - var rows_15: DataTables.DataTable = dt.rows("selector").ids(false); + var rows_14: DataTables.Api = dt.rows("selector").ids(); + var rows_15: DataTables.Api = dt.rows("selector").ids(false); var table3 = $('#example').DataTable(); table3.row.add({ @@ -912,11 +912,11 @@ $(document).ready(function () { var staticFn: DataTables.StaticFunctions; // With boolean parameter type, always returns DataTables.DataTable[]. - var static_1: DataTables.DataTable[] = staticFn.tables(true); + var static_1: DataTables.Api[] = staticFn.tables(true); // With object parameter type, returns DataTables.DataTable[] when "api" property is false. - static_1 = staticFn.tables({ "visible": true, "api": false }); + static_1 = staticFn.tables({ "visible": true, "api": false }); // With object parameter type, returns DataTables.DataTable when "api" property is true. - var static_2: DataTables.DataTable = staticFn.tables({ "visible": true, "api": true }); + var static_2: DataTables.Api = staticFn.tables({ "visible": true, "api": true }); //#endregion "Methods-Static" diff --git a/datatables.net/index.d.ts b/datatables.net/index.d.ts index 2640dbabe6..ab469edf14 100644 --- a/datatables.net/index.d.ts +++ b/datatables.net/index.d.ts @@ -11,7 +11,7 @@ /// interface JQuery { - DataTable(param?: DataTables.Settings): DataTables.DataTable; + DataTable(param?: DataTables.Settings): DataTables.Api; } //TODO: Wrong, as jquery.d.ts has no interface for fn @@ -20,11 +20,11 @@ interface JQuery { //} declare namespace DataTables { - export interface DataTable extends DataTableCore { + export interface Api extends DataTableCore { /** * Get the data for the whole table. */ - data(): DataTable; + data(): Api; /** * Order Methods / Object @@ -128,7 +128,7 @@ declare namespace DataTables { } export interface DataTables extends DataTableCore { - [index: number]: DataTable; + [index: number]: Api; } interface ObjectSelectorModifier { @@ -172,21 +172,21 @@ declare namespace DataTables { /** * Clear the table of all data. */ - clear(): DataTable; + clear(): Api; /** * Destroy the DataTables in the current context. * * @param remove Completely remove the table from the DOM (true) or leave it in the DOM in its original plain un-enhanced HTML state (default, false). */ - destroy(remove?: boolean): DataTable; + destroy(remove?: boolean): Api; /** * Redraw the DataTables in the current context, optionally updating ordering, searching and paging as required. * * @param paging This parameter is used to determine what kind of draw DataTables will perform. */ - draw(paging?: boolean | string): DataTable; + draw(paging?: boolean | string): Api; /* * Look up a language token that was defined in the DataTables' language initialisation object. @@ -210,7 +210,7 @@ declare namespace DataTables { * @param event Event name to remove. * @param callback Specific callback function to remove if you want to unbind a single event listener. */ - off(event: string, callback?: Function): DataTable; + off(event: string, callback?: Function): Api; /** * Table events listener. @@ -218,7 +218,7 @@ declare namespace DataTables { * @param event Event to listen for. * @param callback Specific callback function to remove if you want to unbind a single event listener. */ - on(event: string, callback: Function): DataTable; + on(event: string, callback: Function): Api; /** * Listen for a table event once and then remove the listener. @@ -226,7 +226,7 @@ declare namespace DataTables { * @param event Event to listen for. * @param callback Specific callback function to remove if you want to unbind a single event listener. */ - one(event: string, callback: Function): DataTable; + one(event: string, callback: Function): Api; /** * Page Methods / Object @@ -246,12 +246,12 @@ declare namespace DataTables { * @param smart Perform smart search. * @param caseInsen Do case-insensitive matching (default, true) or not (false). */ - search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): DataTable; + search(input: string, regex?: boolean, smart?: boolean, caseInsen?: boolean): Api; /** * Obtain the table's settings object */ - settings(): DataTable; + settings(): Api; /** * Page Methods / Object @@ -261,14 +261,14 @@ declare namespace DataTables { //#region "ajax-methods" - interface AjaxMethods extends DataTable { + interface AjaxMethods extends Api { /** * Reload the table data from the Ajax data source. * * @param callback Function which is executed when the data as been reloaded and the table fully redrawn. * @param resetPaging Reset (default action or true) or hold the current paging position (false). */ - load(callback?: Function, resetPaging?: boolean): DataTable; + load(callback?: Function, resetPaging?: boolean): Api; } interface AjaxMethodModel { @@ -288,7 +288,7 @@ declare namespace DataTables { * @param callback Function which is executed when the data as been reloaded and the table fully redrawn. * @param resetPaging Reset (default action or true) or hold the current paging position (false). */ - reload(callback?: Function, resetPaging?: boolean): DataTable; + reload(callback?: Function, resetPaging?: boolean): Api; /** * Reload the table data from the Ajax data source @@ -318,9 +318,9 @@ declare namespace DataTables { * * @param order Order Model */ - (order?: (string | number)[]): DataTable; - (order?: (string | number)[][]): DataTable; - (order: (string | number)[], ...args: any[]): DataTable; + (order?: (string | number)[]): Api; + (order?: (string | number)[][]): Api; + (order: (string | number)[], ...args: any[]): Api; /** * Add an ordering listener to an element, for a given column. @@ -329,7 +329,7 @@ declare namespace DataTables { * @param column Column index * @param callback Callback function */ - listener(node: string | Node | JQuery, column: number, callback: Function): DataTable; + listener(node: string | Node | JQuery, column: number, callback: Function): Api; } //#endregion "order-methods" @@ -346,7 +346,7 @@ declare namespace DataTables { * * @param page Index or 'first', 'next', 'previous', 'last' */ - (page: number | string): DataTable; + (page: number | string): Api; /** * Get paging information about the table @@ -363,7 +363,7 @@ declare namespace DataTables { * * @param length Page length to set. use -1 to show all records. */ - len(length: number): DataTable; + len(length: number): Api; } interface PageMethodeModelInfoReturn { @@ -390,7 +390,7 @@ declare namespace DataTables { /** * Clear the saved state of the table. */ - clear(): DataTable; + clear(): Api; /** * Get the table state that was loaded during initialisation. @@ -400,7 +400,7 @@ declare namespace DataTables { /** * Trigger a state save. */ - save(): DataTable; + save(): Api; } interface StateReturnModel { @@ -435,7 +435,7 @@ declare namespace DataTables { * @param a API instance to concatenate to the initial instance. * @param b Additional API instance(s) to concatenate to the initial instance. */ - concat(a: Object, ...b: Object[]): DataTable; + concat(a: Object, ...b: Object[]): Api; /** * Get the number of entries in an API instance's result set, regardless of multi-table grouping (e.g. any data, selected rows, etc). Since: 1.10.8 @@ -447,26 +447,26 @@ declare namespace DataTables { * * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters */ - each(fn: Function): DataTable; + each(fn: Function): Api; /** * Reduce an Api instance to a single context and result set. * * @param idx Index to select */ - eq(idx: number): DataTable; + eq(idx: number): Api; /** * Iterate over the result set of an API instance and test each item, creating a new instance from those items which pass. * * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters. */ - filter(fn: Function): DataTable; + filter(fn: Function): Api; /** * Flatten a 2D array structured API instance to a 1D array structure. */ - flatten(): DataTable; + flatten(): Api; /** * Find the first instance of a value in the API instance's result set. @@ -499,14 +499,14 @@ declare namespace DataTables { * * @param fn Callback function which is called for each item in the API instance result set. The callback is called with three parameters. */ - map(fn: Function): DataTable; + map(fn: Function): Api; /** * Iterate over the result set of an API instance, creating a new API instance from the values retrieved from the original elements. * * @param property Object property name to use from the element in the original result set for the new result set. */ - pluck(property: number | string): DataTable; + pluck(property: number | string): Api; /** * Remove the last item from an API instance's result set. @@ -539,7 +539,7 @@ declare namespace DataTables { /** * Reverse the result set of the API instance and return the original array. */ - reverse(): DataTable; + reverse(): Api; /** * Remove the first item from an API instance's result set. @@ -551,7 +551,7 @@ declare namespace DataTables { * * @param fn This is a standard Javascript sort comparison function. It accepts two parameters. */ - sort(fn?: Function): DataTable; + sort(fn?: Function): Api; /** * Modify the contents of an Api instance's result set, adding or removing items from it as required. @@ -580,7 +580,7 @@ declare namespace DataTables { /** * Create a new API instance containing only the unique items from a the elements in an instance's result set. */ - unique(): DataTable; + unique(): Api; /** * Add one or more items to the start of an API instance's result set. @@ -598,7 +598,7 @@ declare namespace DataTables { * * @param t Specify which cache the data should be read from. Can take one of two values: search or order */ - cache(t: string): DataTable; + cache(t: string): Api; } //#region "cell-methods" @@ -609,7 +609,7 @@ declare namespace DataTables { * * @param source Data source to read the new data from. */ - invalidate(source?: string): DataTable; + invalidate(source?: string): Api; /** * Get data for the selected cell @@ -630,7 +630,7 @@ declare namespace DataTables { * * @param data Value to assign to the data for the cell */ - data(data: any): DataTable; + data(data: any): Api; /** * Get index information about the selected cell @@ -653,24 +653,24 @@ declare namespace DataTables { /** * Get data for the selected cells */ - data(): DataTable; + data(): Api; /** * Iterate over each selected cell, with the function context set to be the cell in question. Since: DataTables 1.10.6 * * @param fn Function to execute for every cell selected. */ - every(fn: (cellRowIdx: number, cellColIdx: number, tableLoop: number, cellLoop: number) => void): DataTable; + every(fn: (cellRowIdx: number, cellColIdx: number, tableLoop: number, cellLoop: number) => void): Api; /** * Get index information about the selected cells */ - indexes(): DataTable; + indexes(): Api; /** * Get the DOM elements for the selected cells */ - nodes(): DataTable; + nodes(): Api; } //#endregion "cell-methods" @@ -692,7 +692,7 @@ declare namespace DataTables { * * @param direction Direction of sort to apply to the selected column - desc (descending) or asc (ascending). */ - order(direction: string): DataTable; + order(direction: string): Api; /** * Get the visibility of the selected column. @@ -705,7 +705,7 @@ declare namespace DataTables { * @param show Specify if the column should be visible (true) or not (false). * @param redrawCalculations Indicate if DataTables should recalculate the column layout (true - default) or not (false). Typically this would be left as the default value, but it can be useful to disable when using the method in a loop - so the calculations are performed on every call as they can hamper performance. */ - visible(show: boolean, redrawCalculations?: boolean): DataTable; + visible(show: boolean, redrawCalculations?: boolean): Api; } interface ColumnMethodsModel { @@ -730,7 +730,7 @@ declare namespace DataTables { /** * Get the data for the cells in the selected column. */ - data(): DataTable; + data(): Api; /** * Get the data source property for the selected column @@ -742,12 +742,12 @@ declare namespace DataTables { * * @param t Specify if you want to get the column data index (default) or the visible index (visible). */ - index(t?: string): DataTable; + index(t?: string): Api; /** * Obtain the th / td nodes for the selected column */ - nodes(): DataTable[]; + nodes(): Api[]; } interface ColumnsMethodsModel { @@ -769,38 +769,38 @@ declare namespace DataTables { /** * Recalculate the column widths for layout. */ - adjust(): DataTable; + adjust(): Api; } interface ColumnsMethods extends DataTableCore, CommonColumnMethod { /** * Obtain the data for the columns from the selector */ - data(): DataTable; + data(): Api; /** * Get the data source property for the selected columns. */ - dataSrc(): DataTable; + dataSrc(): Api; /** * Iterate over each selected column, with the function context set to be the column in question. Since: DataTables 1.10.6 * * @param fn Function to execute for every column selected. */ - every(fn: (colIdx: number, tableLoop: number, colLoop: number) => void): DataTable; + every(fn: (colIdx: number, tableLoop: number, colLoop: number) => void): Api; /** * Get the column indexes of the selected columns. * * @param t Specify if you want to get the column data index (default) or the visible index (visible). */ - indexes(t?: string): DataTable; + indexes(t?: string): Api; /** * Obtain the th / td nodes for the selected columns */ - nodes(): DataTable[][]; + nodes(): Api[][]; } //#endregion "column-methods" @@ -812,7 +812,7 @@ declare namespace DataTables { * * @param source Data source to read the new data from. Values: 'auto', 'data', 'dom' */ - invalidate(source?: string): DataTable; + invalidate(source?: string): Api; } interface RowChildMethodModel { @@ -839,39 +839,39 @@ declare namespace DataTables { /** * Hide the child row(s) of a parent row */ - hide(): DataTable; + hide(): Api; /** * Check if the child rows of a parent row are visible */ - isShown(): DataTable; + isShown(): Api; /** * Remove child row(s) from display and release any allocated memory */ - remove(): DataTable; + remove(): Api; /** * Show the child row(s) of a parent row */ - show(): DataTable; + show(): Api; } interface RowChildMethods extends DataTableCore { /** * Hide the child row(s) of a parent row */ - hide(): DataTable; + hide(): Api; /** * Remove child row(s) from display and release any allocated memory */ - remove(): DataTable; + remove(): Api; /** * Make newly defined child rows visible */ - show(): DataTable; + show(): Api; } interface RowMethodsModel { @@ -888,7 +888,7 @@ declare namespace DataTables { * * @param data Data to use for the new row. This may be an array, object or Javascript object instance, but must be in the same format as the other data in the table */ - add(data: any[] | Object): DataTable; + add(data: any[] | Object): Api; } interface RowMethods extends DataTableCore, CommonRowMethod { @@ -907,7 +907,7 @@ declare namespace DataTables { * * @param d Data to use for the row. */ - data(d: any[] | Object): DataTable; + data(d: any[] | Object): Api; /** @@ -956,28 +956,28 @@ declare namespace DataTables { * * @param data Array of data elements, with each one describing a new row to be added to the table */ - add(data: any[]): DataTable; + add(data: any[]): Api; } interface RowsMethods extends DataTableCore, CommonRowMethod { /** * Get the data for the rows from the selector */ - data(): DataTable; + data(): Api; /** * Set the data for the selected row * * @param d Data to use for the row. */ - data(d: any[] | Object): DataTable; + data(d: any[] | Object): Api; /** * Iterate over each selected row, with the function context set to be the row in question. Since: DataTables 1.10.6 * * @param fn Function to execute for every row selected. */ - every(fn: (rowIdx: number, tableLoop: number, rowLoop: number) => void): DataTable; + every(fn: (rowIdx: number, tableLoop: number, rowLoop: number) => void): Api; /** * Get the ids of the selected rows. Since: 1.10.8 @@ -986,22 +986,22 @@ declare namespace DataTables { * false - Do not modify the id value. * @returns Api instance with the selected rows in its result set. If a row does not have an id available 'undefined' will be returned as the value. */ - ids(hash?: boolean): DataTable; + ids(hash?: boolean): Api; /** * Get the row indexes of the selected rows. */ - indexes(): DataTable; + indexes(): Api; /** * Obtain the tr nodes for the selected rows */ - nodes(): DataTable; + nodes(): Api; /** * Delete the selected rows from the DataTable. */ - remove(): DataTable; + remove(): Api; } //#endregion "row-methods" @@ -1038,27 +1038,27 @@ declare namespace DataTables { /** * Get the tfoot nodes for the tables in the API's context */ - footer(): DataTable; + footer(): Api; /** * Get the thead nodes for the tables in the API's context */ - header(): DataTable; + header(): Api; /** * Get the tbody nodes for the tables in the API's context */ - body(): DataTable; + body(): Api; /** * Get the div container nodes for the tables in the API's context */ - containers(): DataTable; + containers(): Api; /** * Get the table nodes for the tables in the API's context */ - nodes(): DataTable; + nodes(): Api; } //#endregion "table-methods" @@ -1080,7 +1080,7 @@ declare namespace DataTables { * @param visible As a boolean value this options is used to indicate if you want all tables on the page should be returned (false), or visible tables only (true). * Since 1.10.8 this option can also be given as an object. */ - tables(visible?: boolean | ObjectTablesStatic): DataTables.DataTable[] | DataTables.DataTable; + tables(visible?: boolean | ObjectTablesStatic): DataTables.Api[] | DataTables.Api; /** * Version number compatibility check function @@ -1099,7 +1099,7 @@ declare namespace DataTables { * * @param table Selector string for table */ - Api(selector: string | Node | Node[] | JQuery): DataTables.DataTable; + Api(selector: string | Node | Node[] | JQuery): DataTables.Api; } export interface StaticUtilFunctions { From 2a018135f9670e76c20e37c1e231d4a3090a33a9 Mon Sep 17 00:00:00 2001 From: Steven Liekens Date: Fri, 10 Mar 2017 12:46:24 +0100 Subject: [PATCH 074/374] Rename DataTableCore to CoreMethods --- datatables.net/index.d.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/datatables.net/index.d.ts b/datatables.net/index.d.ts index ab469edf14..4088c15b1e 100644 --- a/datatables.net/index.d.ts +++ b/datatables.net/index.d.ts @@ -20,7 +20,7 @@ interface JQuery { //} declare namespace DataTables { - export interface Api extends DataTableCore { + export interface Api extends CoreMethods { /** * Get the data for the whole table. */ @@ -127,7 +127,7 @@ declare namespace DataTables { //#endregion "Table/Tables" } - export interface DataTables extends DataTableCore { + export interface DataTables extends CoreMethods { [index: number]: Api; } @@ -155,7 +155,7 @@ declare namespace DataTables { //#region "core-methods" - interface DataTableCore extends UtilityMethods { + interface CoreMethods extends UtilityMethods { /** * Get jquery object */ @@ -619,7 +619,7 @@ declare namespace DataTables { render(t: string): any; } - interface CellMethods extends DataTableCore, CommonCellMethods { + interface CellMethods extends CoreMethods, CommonCellMethods { /** * Get data for the selected cell */ @@ -649,7 +649,7 @@ declare namespace DataTables { columnVisible: number; } - interface CellsMethods extends DataTableCore, CommonCellMethods { + interface CellsMethods extends CoreMethods, CommonCellMethods { /** * Get data for the selected cells */ @@ -726,7 +726,7 @@ declare namespace DataTables { index(t: string, index: number): number; } - interface ColumnMethods extends DataTableCore, CommonColumnMethod { + interface ColumnMethods extends CoreMethods, CommonColumnMethod { /** * Get the data for the cells in the selected column. */ @@ -772,7 +772,7 @@ declare namespace DataTables { adjust(): Api; } - interface ColumnsMethods extends DataTableCore, CommonColumnMethod { + interface ColumnsMethods extends CoreMethods, CommonColumnMethod { /** * Obtain the data for the columns from the selector */ @@ -857,7 +857,7 @@ declare namespace DataTables { show(): Api; } - interface RowChildMethods extends DataTableCore { + interface RowChildMethods extends CoreMethods { /** * Hide the child row(s) of a parent row */ @@ -891,7 +891,7 @@ declare namespace DataTables { add(data: any[] | Object): Api; } - interface RowMethods extends DataTableCore, CommonRowMethod { + interface RowMethods extends CoreMethods, CommonRowMethod { /** * Order Methods / Object */ @@ -959,7 +959,7 @@ declare namespace DataTables { add(data: any[]): Api; } - interface RowsMethods extends DataTableCore, CommonRowMethod { + interface RowsMethods extends CoreMethods, CommonRowMethod { /** * Get the data for the rows from the selector */ @@ -1007,7 +1007,7 @@ declare namespace DataTables { //#region "table-methods" - interface TableMethods extends DataTableCore { + interface TableMethods extends CoreMethods { /** * Get the tfoot node for the table in the API's context */ @@ -1034,7 +1034,7 @@ declare namespace DataTables { node(): Node; } - interface TablesMethods extends DataTableCore { + interface TablesMethods extends CoreMethods { /** * Get the tfoot nodes for the tables in the API's context */ From 443cbaad2cbc1fcfc949ff4801a659d4fd20904a Mon Sep 17 00:00:00 2001 From: Steven Liekens Date: Fri, 10 Mar 2017 12:52:47 +0100 Subject: [PATCH 075/374] Rename constructor argument 'param' to 'opts' --- datatables.net/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datatables.net/index.d.ts b/datatables.net/index.d.ts index 4088c15b1e..c0aaf9cc6c 100644 --- a/datatables.net/index.d.ts +++ b/datatables.net/index.d.ts @@ -11,7 +11,7 @@ /// interface JQuery { - DataTable(param?: DataTables.Settings): DataTables.Api; + DataTable(opts?: DataTables.Settings): DataTables.Api; } //TODO: Wrong, as jquery.d.ts has no interface for fn From a2a2083f840bc8b5c0d05a3ed779802c4f1e5e90 Mon Sep 17 00:00:00 2001 From: Andre Wiggins Date: Mon, 20 Feb 2017 05:13:22 -0800 Subject: [PATCH 076/374] Improve PrismJS types Convert PrismJS types to [module.d.ts][1] pattern and fix linting errors. Also fix bugs in a couple types. [1]: http://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-d-ts.html --- prismjs/index.d.ts | 346 ++++++++++++++++++-------------- prismjs/prismjs-module-tests.ts | 26 +++ prismjs/prismjs-tests.ts | 18 +- prismjs/tsconfig.json | 7 +- prismjs/tslint.json | 1 + 5 files changed, 243 insertions(+), 155 deletions(-) create mode 100644 prismjs/prismjs-module-tests.ts create mode 100644 prismjs/tslint.json diff --git a/prismjs/index.d.ts b/prismjs/index.d.ts index c3bbffae02..f95cabe990 100644 --- a/prismjs/index.d.ts +++ b/prismjs/index.d.ts @@ -1,164 +1,210 @@ -// Type definitions for prism v1.4.4 +// Type definitions for prism 1.6 // Project: http://prismjs.com/ -// Definitions by: Erik Lieben +// Definitions by: Erik Lieben , Andre Wiggins // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace PrismJS { +export as namespace Prism; - /** - * The Prism object - */ - interface Prism { +/** + * @deprecated + * Use the Prism namespace directly directly + */ +export as namespace PrismJS; - util: Util; - languages: Languages; - plugins: any; +export const util: Util; +export const languages: Languages; +export const plugins: any; +export const hooks: Hooks; - /** - * This is the most high-level function in Prism’s API. It fetches all the elements that have a .language-xxxx class and then calls Prism.highlightElement() on each one of them. - * - * @param {boolean} async - Whether to use Web Workers to improve performance and avoid blocking the UI when highlighting very large chunks of code. False by default. - * @param {(element:Element)=>void} callback? - An optional callback to be invoked after the highlighting is done. Mostly useful when async is true, since in that case, the highlighting is done asynchronously. - * @returns void - */ - highlightAll(async: boolean, callback?: (element: Element) => void): void; +/** + * This is the most high-level function in Prism’s API. It fetches all the elements that have a .language-xxxx class and then calls Prism.highlightElement() on each one of them. + * + * @param {boolean} async - Whether to use Web Workers to improve performance and avoid blocking the UI when highlighting very large chunks of code. False by default. + * @param {(element:Element)=>void} callback? - An optional callback to be invoked after the highlighting is done. Mostly useful when async is true, since in that case, the highlighting is done asynchronously. + * @returns void + */ +export function highlightAll(async: boolean, callback?: (element: Element) => void): void; - /** - * Highlights the code inside a single element. - * - * @param {Element} element - The element containing the code. It must have a class of language-xxxx to be processed, where xxxx is a valid language identifier. - * @param {boolean} async - Whether to use Web Workers to improve performance and avoid blocking the UI when highlighting very large chunks of code. False by default. - * @param {(element:Element)=>void} callback? - An optional callback to be invoked after the highlighting is done. Mostly useful when async is true, since in that case, the highlighting is done asynchronously. - * @returns void - */ - highlightElement(element: Element, async: boolean, callback?: (element: Element) => void): void; +/** + * Highlights the code inside a single element. + * + * @param {Element} element - The element containing the code. It must have a class of language-xxxx to be processed, where xxxx is a valid language identifier. + * @param {boolean} async - Whether to use Web Workers to improve performance and avoid blocking the UI when highlighting very large chunks of code. False by default. + * @param {(element:Element)=>void} callback? - An optional callback to be invoked after the highlighting is done. Mostly useful when async is true, since in that case, the highlighting is done asynchronously. + * @returns void + */ +export function highlightElement(element: Element, async: boolean, callback?: (element: Element) => void): void; - /** - * Low-level function, only use if you know what you’re doing. It accepts a string of text as input and the language definitions to use, and returns a string with the HTML produced. - * - * @param {string} text - A string with the code to be highlighted. - * @param {LanguageDefinition} grammer - An object containing the tokens to use. Usually a language definition like Prism.languages.markup - * @param {LanguageDefinition} language - * @returns string - The highlighted HTML - */ - highlight(text: string, grammer: LanguageDefinition, language?: LanguageDefinition): string; +/** + * Low-level function, only use if you know what you’re doing. It accepts a string of text as input and the language definitions to use, and returns a string with the HTML produced. + * + * @param {string} text - A string with the code to be highlighted. + * @param {LanguageDefinition} grammer - An object containing the tokens to use. Usually a language definition like Prism.languages.markup + * @param {LanguageDefinition} language + * @returns string - The highlighted HTML + */ +export function highlight(text: string, grammer: LanguageDefinition, language?: LanguageDefinition): string; - /** - * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input and the language definitions to use, - * and returns an array with the tokenized code. When the language definition includes nested tokens, the function is called recursively on each of - * these tokens. This method could be useful in other contexts as well, as a very crude parser. - * - * @param {string} text - A string with the code to be highlighted. - * @param {LanguageDefinition} grammar - An object containing the tokens to use. Usually a language definition like Prism.languages.markup - * @param {LanguageDefinition} language - * @returns Array - An array of strings, tokens (class Prism.Token) and other arrays. - */ - tokenize(text: string, grammar: LanguageDefinition, language?: LanguageDefinition): Array; +/** + * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input and the language definitions to use, + * and returns an array with the tokenized code. When the language definition includes nested tokens, the function is called recursively on each of + * these tokens. This method could be useful in other contexts as well, as a very crude parser. + * + * @param {string} text - A string with the code to be highlighted. + * @param {LanguageDefinition} grammar - An object containing the tokens to use. Usually a language definition like Prism.languages.markup + * @returns Array - An array of strings, tokens (class Prism.Token) and other arrays. + */ +export function tokenize(text: string, grammar: LanguageDefinition): Array; - fileHighlight(): void; +export function fileHighlight(): void; - hooks: Hooks; - } - - interface Environment { - element?: Element; - language?: LanguageDefinition; - grammer?: any; - code?: any; - highlightedCode?: any; - type?: string; - content?:string; - tag?: string; - classes?: Array; - attributes?: Array | Object; - parent?: Element; - } - - interface Identifier { - value: number; - } - - interface Util { - encode(tokens:Token | Array | string): Token | Array | string; - type(o: Object): string; - objId(obj: Object): Identifier; - clone(o: LanguageDefinition): LanguageDefinition; - } - - interface LanguageDefinition { - keyword?: RegExp | LanguageDefinition; - number?: RegExp | LanguageDefinition; - function?: RegExp | LanguageDefinition; - string?: RegExp | LanguageDefinition; - boolean?: RegExp | LanguageDefinition; - operator?: RegExp | LanguageDefinition; - punctuation?: RegExp | LanguageDefinition; - atrule?: RegExp | LanguageDefinition; - url?: RegExp | LanguageDefinition; - selector?: RegExp | LanguageDefinition; - property?: RegExp | LanguageDefinition; - important?: RegExp | LanguageDefinition; - style?: RegExp | LanguageDefinition; - - /** - * This option can be used to define one or more aliases for the matched token. The result will be, that the styles - * of the token and its aliases are combined. This can be useful, to combine the styling of a well known token, - * which is already supported by most of the themes, with a semantically correct token name. The option can be - * set to a string literal or an array of string literals. In the following example the token name latex-equation - * is not supported by any theme, but it will be highlighted the same as a string. - */ - alias?: string; - - pattern?: RegExp; - - /** - * This option mitigates JavaScript’s lack of lookbehind. When set to true, the first capturing group in the regex - * pattern is discarded when matching this token, so it effectively behaves as if it was lookbehind - */ - lookbehind?: boolean; - - /** - * This property accepts another object literal, with tokens that are allowed to be nested in this token. - * This makes it easier to define certain languages. However, keep in mind that they’re slower and if coded poorly, - * can even result in infinite recursion. For an example of nested tokens, check out the Markup language definition - */ - inside?: LanguageDefinition; - - /** - * Accepts an object literal with tokens and appends them to the end of the current object literal. - */ - rest?: Array; - } - - interface Languages extends Array { - - extend(id: string, redef: LanguageDefinition): LanguageDefinition; - - /** - * Insert a token before another token in a language literal - * As this needs to recreate the object (we cannot actually insert before keys in object literals), - * we cannot just provide an object, we need anobject and a key. - * @param inside The key (or language id) of the parent - * @param before The key to insert before. If not provided, the function appends instead. - * @param insert Object with the key/value pairs to insert - * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted. - */ - insertBefore(inside: string, before: string, insert: LanguageDefinition, root: Object): any; - } - - interface Hooks { - all: Array void>>; - add(name: string, callback: (env: Environment) => void):void; - run(name: string, env: Environment): void; - } - - interface Token { - type: string; - content: Token | Array | string; - alias: string; - stringify(o:string| Array, language: LanguageDefinition, parent: HTMLPreElement): string; - } +interface Environment { + element?: Element; + language?: LanguageDefinition; + grammar?: any; + code?: any; + highlightedCode?: any; + type?: string; + content?: string; + tag?: string; + classes?: string[]; + attributes?: any; + parent?: Element; } -declare var Prism : PrismJS.Prism; \ No newline at end of file +interface Identifier { + value: number; +} + +interface Util { + /** Encode raw strings in tokens in preparation to display as HTML */ + encode(tokens: TokenNode): TokenNode; + + /** Determine the type of the object */ + type(o: any): string; + + /** Get the unique id of this object or give it one if it does not have one */ + objId(obj: any): Identifier; + + /** Deep clone a language definition (e.g. to extend it) */ + clone(o: LanguageDefinition): LanguageDefinition; +} + +interface LanguageDefinition { + keyword?: RegExp | LanguageDefinition; + number?: RegExp | LanguageDefinition; + function?: RegExp | LanguageDefinition; + string?: RegExp | LanguageDefinition; + boolean?: RegExp | LanguageDefinition; + operator?: RegExp | LanguageDefinition; + punctuation?: RegExp | LanguageDefinition; + atrule?: RegExp | LanguageDefinition; + url?: RegExp | LanguageDefinition; + selector?: RegExp | LanguageDefinition; + property?: RegExp | LanguageDefinition; + important?: RegExp | LanguageDefinition; + style?: RegExp | LanguageDefinition; + + /** + * This option can be used to define one or more aliases for the matched token. The result will be, that the styles + * of the token and its aliases are combined. This can be useful, to combine the styling of a well known token, + * which is already supported by most of the themes, with a semantically correct token name. The option can be + * set to a string literal or an array of string literals. In the following example the token name latex-equation + * is not supported by any theme, but it will be highlighted the same as a string. + */ + alias?: string; + + pattern?: RegExp; + + /** + * This option mitigates JavaScript’s lack of lookbehind. When set to true, the first capturing group in the regex + * pattern is discarded when matching this token, so it effectively behaves as if it was lookbehind + */ + lookbehind?: boolean; + + /** + * This property accepts another object literal, with tokens that are allowed to be nested in this token. + * This makes it easier to define certain languages. However, keep in mind that they’re slower and if coded poorly, + * can even result in infinite recursion. For an example of nested tokens, check out the Markup language definition + */ + inside?: LanguageDefinition; + + /** + * Accepts an object literal with tokens and appends them to the end of the current object literal. + */ + rest?: Token[]; +} + +interface Languages { + + /** Get a defined language's definition */ + [key: string]: LanguageDefinition; + + /** + * Extend a language definition + * @param id The language definition to extend + * @param redef The new language definition to extend the original + */ + extend(id: string, redef: LanguageDefinition): LanguageDefinition; + + /** + * Insert a token before another token in a language literal + * As this needs to recreate the object (we cannot actually insert before keys in object literals), + * we cannot just provide an object, we need anobject and a key. + * @param inside The key (or language id) of the parent + * @param before The key to insert before. If not provided, the function appends instead. + * @param insert Object with the key/value pairs to insert + * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted. + */ + insertBefore(inside: string, before: string, insert: LanguageDefinition, root: LanguageDefinition): any; +} + +type HookCallback = (env: Environment) => void; +type AvailableHooks = "before-highlightall" + | "before-sanity-check" + | "before-highlight" + | "before-insert" + | "after-highlight" + | "complete" + | "wrap"; + +interface Hooks { + all: Array void>>; + + add(name: AvailableHooks | string, callback: HookCallback): void; + + run(name: AvailableHooks | string, env: Environment): void; +} + +type TokenNode = Token | string | Array; + +export class Token { + /** + * Given a token or string input, convert it to highlighted HTML + * @param type The token(s) to stringify + * @param language The language definition that understands the given token(s) + * @param parent The parent element element to pass into hook callbacks + * @returns The HTML that represents the given token(s) + */ + static stringify(token: TokenNode, language: LanguageDefinition, parent: HTMLPreElement): string; + + /** + * The constructor for the Prism Token class + * @param type The type of the token + * @param content The contents of the token + * @param alias Aliases for the current token (added as classes to this token's HTML) + * @param matchedStr The matched string that generated this token + * @param greedy Value that determines whether or not this token was generated using a greedy parsing algorithm + */ + constructor(type: string, content: TokenNode, alias: any, matchedStr: string, greedy: boolean); + + /** The type of the token */ + type: string; + + /** The content of the token */ + content: TokenNode; + + /** Other names for this token (added as classes to this token's HTML) */ + alias: string; +} diff --git a/prismjs/prismjs-module-tests.ts b/prismjs/prismjs-module-tests.ts new file mode 100644 index 0000000000..3c48e476c5 --- /dev/null +++ b/prismjs/prismjs-module-tests.ts @@ -0,0 +1,26 @@ +import * as Prism from "prismjs"; + +var element = document.createElement("code"); +var callback = (element: Element) => console.log(element); + +Prism.highlightElement(element, false, callback); +Prism.highlightElement(element, false); +Prism.highlightAll(true, callback); +Prism.highlightAll(true); + +const hookCallback: Prism.HookCallback = env => null; +Prism.hooks.add("before-highlightall", hookCallback); +Prism.hooks.add("future-hook", hookCallback); + +var language = "js"; +var tokens = Prism.tokenize("var n = 1;", Prism.languages[language]); +(function visit(token: Prism.TokenNode): Prism.TokenNode { + if (typeof token === "string") { + return token; + } else if (Array.isArray(token)) { + return token.map(visit) as Prism.TokenNode; + } else { + token.alias += "visited"; + return token; + } +})(tokens); diff --git a/prismjs/prismjs-tests.ts b/prismjs/prismjs-tests.ts index 6d87b9b217..feadde4c51 100644 --- a/prismjs/prismjs-tests.ts +++ b/prismjs/prismjs-tests.ts @@ -1,5 +1,3 @@ - - var element = document.createElement("code"); var callback = (element: Element) => console.log(element); @@ -8,3 +6,19 @@ Prism.highlightElement(element, false); Prism.highlightAll(true, callback); Prism.highlightAll(true); +const hookCallback: PrismJS.HookCallback = env => null; +Prism.hooks.add("before-highlightall", hookCallback); +Prism.hooks.add("future-hook", hookCallback); + +var language = "js"; +var tokens = Prism.tokenize("var n = 1;", Prism.languages[language]); +(function visit(token: PrismJS.TokenNode): PrismJS.TokenNode { + if (typeof token === "string") { + return token; + } else if (Array.isArray(token)) { + return token.map(visit) as PrismJS.TokenNode; + } else { + token.alias += "visited"; + return token; + } +})(tokens); diff --git a/prismjs/tsconfig.json b/prismjs/tsconfig.json index b01a635b30..5a528ed4a4 100644 --- a/prismjs/tsconfig.json +++ b/prismjs/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -18,6 +18,7 @@ }, "files": [ "index.d.ts", - "prismjs-tests.ts" + "prismjs-tests.ts", + "prismjs-module-tests.ts" ] -} \ No newline at end of file +} diff --git a/prismjs/tslint.json b/prismjs/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/prismjs/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 9a6a2e54636f2dbd365892945409323bfc76e203 Mon Sep 17 00:00:00 2001 From: Andre Wiggins Date: Mon, 20 Feb 2017 05:57:33 -0800 Subject: [PATCH 077/374] Remove extra module import test --- prismjs/prismjs-module-tests.ts | 26 -------------------------- prismjs/prismjs-tests.ts | 6 +++--- prismjs/tsconfig.json | 3 +-- 3 files changed, 4 insertions(+), 31 deletions(-) delete mode 100644 prismjs/prismjs-module-tests.ts diff --git a/prismjs/prismjs-module-tests.ts b/prismjs/prismjs-module-tests.ts deleted file mode 100644 index 3c48e476c5..0000000000 --- a/prismjs/prismjs-module-tests.ts +++ /dev/null @@ -1,26 +0,0 @@ -import * as Prism from "prismjs"; - -var element = document.createElement("code"); -var callback = (element: Element) => console.log(element); - -Prism.highlightElement(element, false, callback); -Prism.highlightElement(element, false); -Prism.highlightAll(true, callback); -Prism.highlightAll(true); - -const hookCallback: Prism.HookCallback = env => null; -Prism.hooks.add("before-highlightall", hookCallback); -Prism.hooks.add("future-hook", hookCallback); - -var language = "js"; -var tokens = Prism.tokenize("var n = 1;", Prism.languages[language]); -(function visit(token: Prism.TokenNode): Prism.TokenNode { - if (typeof token === "string") { - return token; - } else if (Array.isArray(token)) { - return token.map(visit) as Prism.TokenNode; - } else { - token.alias += "visited"; - return token; - } -})(tokens); diff --git a/prismjs/prismjs-tests.ts b/prismjs/prismjs-tests.ts index feadde4c51..137dad7ece 100644 --- a/prismjs/prismjs-tests.ts +++ b/prismjs/prismjs-tests.ts @@ -6,17 +6,17 @@ Prism.highlightElement(element, false); Prism.highlightAll(true, callback); Prism.highlightAll(true); -const hookCallback: PrismJS.HookCallback = env => null; +const hookCallback: Prism.HookCallback = env => null; Prism.hooks.add("before-highlightall", hookCallback); Prism.hooks.add("future-hook", hookCallback); var language = "js"; var tokens = Prism.tokenize("var n = 1;", Prism.languages[language]); -(function visit(token: PrismJS.TokenNode): PrismJS.TokenNode { +(function visit(token: Prism.TokenNode): Prism.TokenNode { if (typeof token === "string") { return token; } else if (Array.isArray(token)) { - return token.map(visit) as PrismJS.TokenNode; + return token.map(visit) as Prism.TokenNode; } else { token.alias += "visited"; return token; diff --git a/prismjs/tsconfig.json b/prismjs/tsconfig.json index 5a528ed4a4..0bd8440986 100644 --- a/prismjs/tsconfig.json +++ b/prismjs/tsconfig.json @@ -18,7 +18,6 @@ }, "files": [ "index.d.ts", - "prismjs-tests.ts", - "prismjs-module-tests.ts" + "prismjs-tests.ts" ] } From 6b90165d6011d9f5149c294a0b5d6178c9b6a3b2 Mon Sep 17 00:00:00 2001 From: Andre Wiggins Date: Fri, 10 Mar 2017 17:40:45 -0800 Subject: [PATCH 078/374] Rewrap long comments --- prismjs/index.d.ts | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/prismjs/index.d.ts b/prismjs/index.d.ts index f95cabe990..14197acf73 100644 --- a/prismjs/index.d.ts +++ b/prismjs/index.d.ts @@ -6,8 +6,7 @@ export as namespace Prism; /** - * @deprecated - * Use the Prism namespace directly directly + * @deprecated Use the Prism namespace directly directly */ export as namespace PrismJS; @@ -17,10 +16,13 @@ export const plugins: any; export const hooks: Hooks; /** - * This is the most high-level function in Prism’s API. It fetches all the elements that have a .language-xxxx class and then calls Prism.highlightElement() on each one of them. + * This is the most high-level function in Prism’s API. It fetches all the elements that have a .language-xxxx class and + * then calls Prism.highlightElement() on each one of them. * - * @param {boolean} async - Whether to use Web Workers to improve performance and avoid blocking the UI when highlighting very large chunks of code. False by default. - * @param {(element:Element)=>void} callback? - An optional callback to be invoked after the highlighting is done. Mostly useful when async is true, since in that case, the highlighting is done asynchronously. + * @param {boolean} async - Whether to use Web Workers to improve performance and avoid blocking the UI when + * highlighting very large chunks of code. False by default. + * @param {(element:Element)=>void} callback? - An optional callback to be invoked after the highlighting is done. + * Mostly useful when async is true, since in that case, the highlighting is done asynchronously. * @returns void */ export function highlightAll(async: boolean, callback?: (element: Element) => void): void; @@ -28,31 +30,38 @@ export function highlightAll(async: boolean, callback?: (element: Element) => vo /** * Highlights the code inside a single element. * - * @param {Element} element - The element containing the code. It must have a class of language-xxxx to be processed, where xxxx is a valid language identifier. - * @param {boolean} async - Whether to use Web Workers to improve performance and avoid blocking the UI when highlighting very large chunks of code. False by default. - * @param {(element:Element)=>void} callback? - An optional callback to be invoked after the highlighting is done. Mostly useful when async is true, since in that case, the highlighting is done asynchronously. + * @param {Element} element - The element containing the code. It must have a class of language-xxxx to be processed, + * where xxxx is a valid language identifier. + * @param {boolean} async - Whether to use Web Workers to improve performance and avoid blocking the UI when + * highlighting very large chunks of code. False by default. + * @param {(element:Element)=>void} callback? - An optional callback to be invoked after the highlighting is done. + * Mostly useful when async is true, since in that case, the highlighting is done asynchronously. * @returns void */ export function highlightElement(element: Element, async: boolean, callback?: (element: Element) => void): void; /** - * Low-level function, only use if you know what you’re doing. It accepts a string of text as input and the language definitions to use, and returns a string with the HTML produced. + * Low-level function, only use if you know what you’re doing. It accepts a string of text as input and the language + * definitions to use, and returns a string with the HTML produced. * * @param {string} text - A string with the code to be highlighted. - * @param {LanguageDefinition} grammer - An object containing the tokens to use. Usually a language definition like Prism.languages.markup + * @param {LanguageDefinition} grammer - An object containing the tokens to use. Usually a language definition like + * Prism.languages.markup * @param {LanguageDefinition} language * @returns string - The highlighted HTML */ export function highlight(text: string, grammer: LanguageDefinition, language?: LanguageDefinition): string; /** - * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input and the language definitions to use, - * and returns an array with the tokenized code. When the language definition includes nested tokens, the function is called recursively on each of - * these tokens. This method could be useful in other contexts as well, as a very crude parser. + * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input and the + * language definitions to use, and returns an array with the tokenized code. When the language definition includes + * nested tokens, the function is called recursively on each of these tokens. This method could be useful in other + * contexts as well, as a very crude parser. * * @param {string} text - A string with the code to be highlighted. - * @param {LanguageDefinition} grammar - An object containing the tokens to use. Usually a language definition like Prism.languages.markup + * @param {LanguageDefinition} grammar - An object containing the tokens to use. Usually a language definition like + * Prism.languages.markup * @returns Array - An array of strings, tokens (class Prism.Token) and other arrays. */ export function tokenize(text: string, grammar: LanguageDefinition): Array; From f403fb6bdda69f1e720c914e56da1cf37540c9d2 Mon Sep 17 00:00:00 2001 From: Andre Wiggins Date: Fri, 10 Mar 2017 17:58:22 -0800 Subject: [PATCH 079/374] Clean up comments --- prismjs/index.d.ts | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/prismjs/index.d.ts b/prismjs/index.d.ts index 14197acf73..531dfe9b8f 100644 --- a/prismjs/index.d.ts +++ b/prismjs/index.d.ts @@ -19,24 +19,22 @@ export const hooks: Hooks; * This is the most high-level function in Prism’s API. It fetches all the elements that have a .language-xxxx class and * then calls Prism.highlightElement() on each one of them. * - * @param {boolean} async - Whether to use Web Workers to improve performance and avoid blocking the UI when - * highlighting very large chunks of code. False by default. - * @param {(element:Element)=>void} callback? - An optional callback to be invoked after the highlighting is done. - * Mostly useful when async is true, since in that case, the highlighting is done asynchronously. - * @returns void + * @param {boolean} async Whether to use Web Workers to improve performance and avoid blocking the UI when highlighting + * very large chunks of code. False by default. + * @param {Function} callback An optional callback to be invoked after the highlighting is done. Mostly useful when async + * is true, since in that case, the highlighting is done asynchronously. */ export function highlightAll(async: boolean, callback?: (element: Element) => void): void; /** * Highlights the code inside a single element. * - * @param {Element} element - The element containing the code. It must have a class of language-xxxx to be processed, + * @param {Elment} element The element containing the code. It must have a class of language-xxxx to be processed, * where xxxx is a valid language identifier. - * @param {boolean} async - Whether to use Web Workers to improve performance and avoid blocking the UI when + * @param {boolean} async Whether to use Web Workers to improve performance and avoid blocking the UI when * highlighting very large chunks of code. False by default. - * @param {(element:Element)=>void} callback? - An optional callback to be invoked after the highlighting is done. + * @param {Function} callback An optional callback to be invoked after the highlighting is done. * Mostly useful when async is true, since in that case, the highlighting is done asynchronously. - * @returns void */ export function highlightElement(element: Element, async: boolean, callback?: (element: Element) => void): void; @@ -45,11 +43,11 @@ export function highlightElement(element: Element, async: boolean, callback?: (e * Low-level function, only use if you know what you’re doing. It accepts a string of text as input and the language * definitions to use, and returns a string with the HTML produced. * - * @param {string} text - A string with the code to be highlighted. - * @param {LanguageDefinition} grammer - An object containing the tokens to use. Usually a language definition like + * @param {string} text A string with the code to be highlighted. + * @param {LanguageDefinition} grammer - An object containing the tokens to use. Usually a language definition like * Prism.languages.markup - * @param {LanguageDefinition} language - * @returns string - The highlighted HTML + * @param {LanguageDefinition} language + * @returns {string} The highlighted HTML */ export function highlight(text: string, grammer: LanguageDefinition, language?: LanguageDefinition): string; @@ -59,10 +57,10 @@ export function highlight(text: string, grammer: LanguageDefinition, language?: * nested tokens, the function is called recursively on each of these tokens. This method could be useful in other * contexts as well, as a very crude parser. * - * @param {string} text - A string with the code to be highlighted. - * @param {LanguageDefinition} grammar - An object containing the tokens to use. Usually a language definition like + * @param {string} text A string with the code to be highlighted. + * @param {LanguageDefinition} grammar An object containing the tokens to use. Usually a language definition like * Prism.languages.markup - * @returns Array - An array of strings, tokens (class Prism.Token) and other arrays. + * @returns {Array} An array of strings, tokens (class Prism.Token) and other arrays. */ export function tokenize(text: string, grammar: LanguageDefinition): Array; From 5dc3a5eb9caab465735a863f8d53feaa9e09dc68 Mon Sep 17 00:00:00 2001 From: Jan Alonzo Date: Sat, 11 Mar 2017 16:04:46 +1100 Subject: [PATCH 080/374] Remove localforage folder --- localforage/package.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 localforage/package.json diff --git a/localforage/package.json b/localforage/package.json deleted file mode 100644 index 29f45814b2..0000000000 --- a/localforage/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "localforage": ">=1.5.0" - } -} From 056d64da8b563002ca0fa2c3d7836fed15f8204a Mon Sep 17 00:00:00 2001 From: LKay Date: Sat, 11 Mar 2017 14:41:56 +0900 Subject: [PATCH 081/374] Enable strict null checks, add tslint.json --- redux-auth-wrapper/tsconfig.json | 2 +- redux-auth-wrapper/tslint.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 redux-auth-wrapper/tslint.json diff --git a/redux-auth-wrapper/tsconfig.json b/redux-auth-wrapper/tsconfig.json index 844f327d0e..5aae706c27 100644 --- a/redux-auth-wrapper/tsconfig.json +++ b/redux-auth-wrapper/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": ["../"], "paths": { diff --git a/redux-auth-wrapper/tslint.json b/redux-auth-wrapper/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/redux-auth-wrapper/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 6969dc0304f5e55d8408db7b8bc108d84da4f4c0 Mon Sep 17 00:00:00 2001 From: rzymek Date: Wed, 1 Mar 2017 22:57:24 +0100 Subject: [PATCH 082/374] lodash - Add _.nth --- lodash/index.d.ts | 51 ++++++++++++++++++++++++++++++++++++++++++ lodash/lodash-tests.ts | 31 +++++++++++++++++++++++++ lodash/nth/index.d.ts | 2 ++ lodash/tsconfig.json | 3 ++- 4 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 lodash/nth/index.d.ts diff --git a/lodash/index.d.ts b/lodash/index.d.ts index da5710a7de..0acf1d8726 100644 --- a/lodash/index.d.ts +++ b/lodash/index.d.ts @@ -2679,6 +2679,57 @@ declare namespace _ { ): LoDashExplicitWrapper; } + //_.nth + interface LoDashStatic { + /** + * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. + * + * @param array array The array to query. + * @param value The index of the element to return. + * @return Returns the nth element of `array`. + */ + nth( + array: List, + n?: number + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.nth + */ + nth( + n?: number + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.nth + */ + nth( + n?:number + ): TResult; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.nth + */ + nth( + n?:number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.nth + */ + nth( + n?:number + ): LoDashExplicitWrapper; + } + //_.pull interface LoDashStatic { /** diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 8accba65c0..2f5cf2ac57 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1289,6 +1289,37 @@ namespace TestLastIndexOf { } } +// _.nth +namespace TestNth { + let array: TResult[]; + let list: _.List; + let value: number; + + { + let result: TResult; + + result = _.nth(array); + + result = _.nth(array, 42); + + result = _(array).nth(); + result = _(array).nth(42); + + result = _(list).nth(); + result = _(list).nth(42); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(array).chain().nth(); + result = _(array).chain().nth(42); + + result = _(list).chain().nth(); + result = _(list).chain().nth(42); + } +} + // _.pull namespace TestPull { let array: TResult[]; diff --git a/lodash/nth/index.d.ts b/lodash/nth/index.d.ts new file mode 100644 index 0000000000..afbe952398 --- /dev/null +++ b/lodash/nth/index.d.ts @@ -0,0 +1,2 @@ +import { nth } from "../index"; +export = nth; \ No newline at end of file diff --git a/lodash/tsconfig.json b/lodash/tsconfig.json index 3a760cfd1a..419b6142b1 100644 --- a/lodash/tsconfig.json +++ b/lodash/tsconfig.json @@ -171,6 +171,7 @@ "noConflict/index.d.ts", "noop/index.d.ts", "now/index.d.ts", + "nth/index.d.ts", "nthArg/index.d.ts", "omit/index.d.ts", "omitBy/index.d.ts", @@ -306,4 +307,4 @@ "noEmit": true, "forceConsistentCasingInFileNames": true } -} \ No newline at end of file +} From 8fcc61d878839c2166a9ededf4cda7aced43a030 Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Thu, 23 Feb 2017 19:41:04 +0100 Subject: [PATCH 083/374] Added export for nodejs Closes #14815 --- jointjs/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jointjs/index.d.ts b/jointjs/index.d.ts index 95e2b2b7e3..cd9d722ec5 100644 --- a/jointjs/index.d.ts +++ b/jointjs/index.d.ts @@ -6,6 +6,9 @@ /// +declare module "jointjs" { + export = joint; +} declare namespace joint { export var g: any; From 8dd3e03bedbb3e94a25761ab5cfea65b4b728abb Mon Sep 17 00:00:00 2001 From: CaselIT Date: Thu, 23 Feb 2017 20:45:45 +0100 Subject: [PATCH 084/374] Changed to export as namespace --- jointjs/index.d.ts | 1684 ++++++++++++++++++++++---------------------- rappid/index.d.ts | 49 +- 2 files changed, 867 insertions(+), 866 deletions(-) diff --git a/jointjs/index.d.ts b/jointjs/index.d.ts index cd9d722ec5..5ce0f187f0 100644 --- a/jointjs/index.d.ts +++ b/jointjs/index.d.ts @@ -6,894 +6,892 @@ /// -declare module "jointjs" { - export = joint; +import * as Backbone from "backbone"; + +export as namespace joint; + +export var g: any; +export var V: any; + +export namespace dia { + interface Size { + width: number; + height: number; + } + + interface Point { + x: number; + y: number; + } + + interface BBox extends Point, Size { } + + interface TranslateOptions { + restrictedArea?: BBox; + transition?: TransitionOptions; + } + + interface TransitionOptions { + delay?: number; + duration?: number; + timingFunction?: (t: number) => number; + valueFunction?: (a: any, b: any) => (t: number) => any; + } + + interface DfsBfsOptions { + inbound?: boolean; + outbound?: boolean; + deep?: boolean; + } + + interface ExploreOptions { + breadthFirst?: boolean; + deep?: boolean; + } + + class Graph extends Backbone.Model { + constructor(attributes?: any, options?: { cellNamespace: any }); + addCell(cell: Cell | Cell[]): this; + addCells(cells: Cell[]): this; + resetCells(cells: Cell[], options?: any): this; + getCell(id: string): Cell; + getElements(): Element[]; + getLinks(): Link[]; + getCells(): Cell[]; + getFirstCell(): Cell; + getLastCell(): Cell; + getConnectedLinks(element: Cell, options?: { inbound?: boolean, outbound?: boolean, deep?: boolean }): Link[]; + disconnectLinks(cell: Cell, options?: any): void; + removeLinks(cell: Cell, options?: any): void; + translate(tx: number, ty?: number, options?: TranslateOptions): void; + cloneCells(cells: Cell[]): { [id: string]: Cell }; + getSubgraph(cells: Cell[], options?: { deep?: boolean }): Cell[]; + cloneSubgraph(cells: Cell[], options?: { deep?: boolean }): { [id: string]: Cell }; + dfs(element: Element, iteratee: (element: Element, distance: number) => boolean, options?: DfsBfsOptions, visited?: Object, distance?: number): void; + bfs(element: Element, iteratee: (element: Element, distance: number) => boolean, options?: DfsBfsOptions): void; + search(element: Element, iteratee: (element: Element, distance: number) => boolean, options?: { breadthFirst?: boolean }): void; + getSuccessors(element: Element, options?: ExploreOptions): Element[]; + getPredecessors(element: Element, options?: ExploreOptions): Element[]; + isSuccessor(elementA: Element, elementB: Element): boolean; + isPredecessor(elementA: Element, elementB: Element): boolean; + isSource(element: Element): boolean; + isSink(element: Element): boolean; + getSources(): Element[]; + getSinks(): Element[]; + getNeighbors(element: Element, options?: DfsBfsOptions): Element[]; + isNeighbor(elementA: Element, elementB: Element, options?: { inbound?: boolean, outbound?: boolean; }): boolean; + getCommonAncestor(...cells: Cell[]): Element; + toJSON(): any; + fromJSON(json: any, options?: any): this; + clear(options?: any): this; + findModelsFromPoint(rect: BBox): Element[]; + findModelsUnderElement(element: Element, options?: { searchBy?: 'bbox' | 'center' | 'origin' | 'corner' | 'topRight' | 'bottomLeft' }): Element[]; + getBBox(elements: Element[], options?: any): BBox; + toGraphLib(): any; // graphlib graph object + findModelsInArea(rect: BBox, options?: any): BBox | boolean; + getCellsBBox(cells: Cell[], options?: any): BBox; + getInboundEdges(node: string): Object; + getOutboundEdges(node: string): Object; + hasActiveBatch(name?: string): number | boolean; + maxZIndex(): number; + removeCells(cells: Cell[], options?: any): this; + resize(width: number, height: number, options?: number): this; + resizeCells(width: number, height: number, cells: Cell[], options?: number): this; + set(key: Object | string, value: any, options?: any): this; + startBatch(name: string, data?: Object): any; + stopBatch(name: string, data?: Object): any; + } + + class Cell extends Backbone.Model { + id: string; + toJSON(): any; + remove(options?: { disconnectLinks?: boolean }): this; + toFront(options?: { deep?: boolean }): this; + toBack(options?: { deep?: boolean }): this; + getAncestors(): Cell[]; + isEmbeddedIn(element: Element, options?: { deep: boolean }): boolean; + prop(key: string): any; + prop(object: any): this; + prop(key: string, value: any, options?: any): this; + removeProp(path: string, options?: any): this; + attr(key: string): any; + attr(object: SVGAttributes): this; + attr(key: string, value: any): this; + clone(): Cell; + clone(opt: { deep?: boolean }): Cell | Cell[]; + removeAttr(path: string | string[], options?: any): this; + transition(path: string, value?: any, options?: TransitionOptions, delim?: string): number; + getTransitions(): string[]; + stopTransitions(path?: string, delim?: string): this; + addTo(graph: Graph, options?: any): this; + isLink(): boolean; + embed(cell: Cell, options?: any): this; + findView(paper: Paper): CellView; + getEmbeddedCells(options?: any): Cell[]; + initialize(options?: any): void; + isElement(): boolean; + isEmbedded(): boolean; + processPorts(): void; + startBatch(name: string, options?: any): this; + stopBatch(name: string, options?: any): this; + unembed(cell: Cell, options?: any): this; + } + + type Padding = number | { + top?: number; + right?: number; + bottom?: number; + left?: number + }; + + class Element extends Cell { + translate(tx: number, ty?: number, options?: TranslateOptions): this; + position(options?: { parentRelative: boolean }): Point; + position(x: number, y: number, options?: { parentRelative?: boolean }): this; + resize(width: number, height: number, options?: { direction?: 'left' | 'right' | 'top' | 'bottom' | 'top-right' | 'top-left' | 'bottom-left' | 'bottom-right' }): this; + rotate(deg: number, absolute?: boolean, origin?: Point): this; + embed(cell: Cell): this; + unembed(cell: Cell): this; + getEmbeddedCells(options?: ExploreOptions): Cell[]; + fitEmbeds(options?: { deep?: boolean, padding?: Padding }): this; + getBBox(options?: any): BBox; + findView(paper: Paper): ElementView; + isElement(): boolean; + scale(scaleX: number, scaleY: number, origin?: Point, options?: any): this; + addPort(port: any, opt?: any): this; + addPorts(ports: any[], opt?: any): this; + removePort(port: any, opt?: any): this; + hasPorts(): boolean; + hasPort(id: string): boolean; + getPorts(): any[]; + getPort(id: string): any; + getPortIndex(port: any): number; + portProp(portId: string, path: any, value?: any, opt?: any): joint.dia.Element; + } + + interface CSSSelector { + [key: string]: string | number | Object; // Object added to support special attributes like filter http://jointjs.com/api#SpecialAttributes:filter + } + + interface SVGAttributes { + [selector: string]: CSSSelector; + } + + interface CellAttributes { + [key: string]: any; + } + + interface TextAttrs extends SVGAttributes { + text?: { + [key: string]: string | number; + text?: string; + }; + } + + interface Label { + position: number; + attrs?: TextAttrs; + } + interface LinkAttributes extends CellAttributes { + source?: Point | { id: string, selector?: string, port?: string }; + target?: Point | { id: string, selector?: string, port?: string }; + labels?: Label[]; + vertices?: Point[]; + smooth?: boolean; + attrs?: TextAttrs; + z?: number; + } + + class Link extends Cell { + markup: string; + labelMarkup: string; + toolMakup: string; + vertexMarkup: string; + arrowHeadMarkup: string; + + constructor(attributes?: LinkAttributes, options?: Object); + disconnect(): this; + label(index?: number): any; + label(index: number, value: Label): this; + reparent(options?: any): Element; + findView(paper: Paper): LinkView; + getSourceElement(): Element; + getTargetElement(): Element; + hasLoop(options?: { deep?: boolean }): boolean; + applyToPoints(fn: Function, options?: any): this; + getRelationshipAncestor(): Element; + isLink(): boolean; + isRelationshipEmbeddedIn(element: Element): boolean; + scale(sx: number, sy: number, origin: Point, optionts?: any): this; + translate(tx: number, ty: number, options?: any): this; + } + + interface ManhattanRouterArgs { + excludeTypes?: string[]; + excludeEnds?: 'source' | 'target'; + startDirections?: ['left' | 'right' | 'top' | 'bottom']; + endDirections?: ['left' | 'right' | 'top' | 'bottom']; + } + + interface PaperOptions extends Backbone.ViewOptions { + el?: string | JQuery | HTMLElement; + width?: number; + height?: number; + origin?: Point; + gridSize?: number; + perpendicularLinks?: boolean; + elementView?: (element: Element) => ElementView | ElementView; + linkView?: (link: Link) => LinkView | LinkView; + defaultLink?: ((cellView: CellView, magnet: SVGElement) => Link) | Link; + defaultRouter?: ((vertices: Point[], args: Object, linkView: LinkView) => Point[]) | { name: string, args?: ManhattanRouterArgs }; + defaultConnector?: ((sourcePoint: Point, targetPoint: Point, vertices: Point[], args: Object, linkView: LinkView) => string) | { name: string, args?: { radius?: number } }; + interactive?: ((cellView: CellView, event: string) => boolean) | boolean | { vertexAdd?: boolean, vertexMove?: boolean, vertexRemove?: boolean, arrowheadMove?: boolean }; + validateMagnet?: (cellView: CellView, magnet: SVGElement) => boolean; + validateConnection?: (cellViewS: CellView, magnetS: SVGElement, cellViewT: CellView, magnetT: SVGElement, end: 'source' | 'target', linkView: LinkView) => boolean; + linkConnectionPoint?: (linkView: LinkView, view: ElementView, magnet: SVGElement, reference: Point) => Point; + snapLinks?: boolean | { radius: number }; + linkPinning?: boolean; + markAvailable?: boolean; + async?: boolean | { batchZise: number }; + embeddingMode?: boolean; + validateEmbedding?: (childView: ElementView, parentView: ElementView) => boolean; + restrictTranslate?: ((elementView: ElementView) => BBox) | boolean; + guard?: (evt: Event, view: CellView) => boolean; + multiLinks?: boolean; + cellViewNamespace?: Object; + /** useful undocumented option */ + clickThreshold?: number; + highlighting?: any; + } + + interface ScaleContentOptions { + padding?: number; + preserveAspectRatio?: boolean; + minScale?: number; + minScaleX?: number; + minScaleY?: number; + maxScale?: number; + maxScaleX?: number; + maxScaleY?: number; + scaleGrid?: number; + fittingBBox?: BBox; + } + + interface FitToContentOptions { + gridWidth?: number; + gridHeight?: number; + padding?: Padding; + allowNewOrigin?: 'negative' | 'positive' | 'any'; + minWidth?: number; + minHeight?: number; + maxWidth?: number; + maxHeight?: number; + } + + class Paper extends Backbone.View { + constructor(options?: PaperOptions); + options: PaperOptions; + svg: SVGElement; + viewport: SVGGElement; + defs: SVGDefsElement; + setDimensions(width: number, height: number): void; + setOrigin(x: number, y: number): void; + scale(sx: number, sy?: number, ox?: number, oy?: number): this; + findView(element: any): CellView; + findViewByModel(model: Cell | string): CellView; + findViewsFromPoint(point: Point): ElementView[]; + findViewsInArea(rect: BBox, options?: { strict?: boolean }): CellView[]; + fitToContent(options?: FitToContentOptions): void; + scaleContentToFit(options?: ScaleContentOptions): void; + getContentBBox(): BBox; + clientToLocalPoint(p: Point): Point; + + rotate(deg: number, ox?: number, oy?: number): Paper; // @todo not released yet though it's in the source code already + + afterRenderViews(): void; + asyncRenderViews(cells: Cell[], options?: any): void; + beforeRenderViews(cells: Cell[]): Cell[]; + cellMouseout(evt: Event): void; + cellMouseover(evt: Event): void; + clearGrid(): this; + contextmenu(evt: Event): void; + createViewForModel(cell: Cell): CellView; + drawGrid(options?: any): this; + fitToContent(gridWidth?: number, gridHeight?: number, padding?: number, options?: any): void; + getArea(): BBox; + getDefaultLink(cellView: CellView, magnet: HTMLElement): Link; + getModelById(id: string): Cell; + getRestrictedArea(): BBox; + guard(evt: Event, view: CellView): boolean; + linkAllowed(linkViewOrModel: LinkView | Link): boolean; + mouseclick(evt: Event): void; + mousedblclick(evt: Event): void; + mousewheel(evt: Event): void; + onCellAdded(cell: Cell, graph: Graph, options: Object): void; + onCellHighlight(cellView: CellView, magnetEl: HTMLElement, options?: any): void; + onCellUnhighlight(cellView: CellView, magnetEl: HTMLElement, options?: any): void; + onRemove(): void; + pointerdown(evt: Event): void; + pointermove(evt: Event): void; + pointerup(evt: Event): void; + remove(): this; + removeView(cell: Cell): CellView; + removeViews(): void; + renderView(cell: Cell): CellView; + resetViews(cellsCollection: Cell[], options: any): void; + resolveHighlighter(options?: any): boolean | Object; + setGridSize(gridSize: number): this; + setInteractivity(value: any): void; + snapToGrid(p: Point): Point; + sortViews(): void; + } + + + interface GradientOptions { + type: 'linearGradient' | 'radialGradient'; + stops: Array<{ + offset: string; + color: string; + opacity?: number; + }>; + } + class CellViewGeneric extends Backbone.View { + getBBox(options?: { useModelGeometry?: boolean }): BBox; + highlight(el?: any, options?: any): this; + unhighlight(el?: any, options?: any): this; + applyFilter(selector: string | HTMLElement, filter: Object): void; + applyGradient(selector: string | HTMLElement, attr: 'fill' | 'stroke', gradient: GradientOptions): void; + can(feature: string): boolean; + findBySelector(selector: string): JQuery; + findMagnet(el: any): HTMLElement; + getSelector(el: HTMLElement, prevSelector: string): string; + getStrokeBBox(el: any): BBox; // string|HTMLElement|Vectorizer + mouseout(evt: Event): void; + mouseover(evt: Event): void; + mousewheel(evt: Event, x: number, y: number, delta: number): void + notify(eventName: string): void; + onChangeAttrs(cell: Cell, attrs: Backbone.ViewOptions, options?: any): this; + onSetTheme(oldTheme: string, newTheme: string): void; + pointerclick(evt: Event, x: number, y: number): void; + pointerdblclick(evt: Event, x: number, y: number): void; + pointerdown(evt: Event, x: number, y: number): void; + pointermove(evt: Event, x: number, y: number): void; + pointerup(evt: Event, x: number, y: number): void; + remove(): this; + setInteractivity(value: any): void; + setTheme(theme: string, options?: any): this; + } + + class CellView extends CellViewGeneric { } + + interface ElementViewAttributes { + style?: string; + text?: string; + html?: string; + "ref-x"?: string | number; + "ref-y"?: string | number; + "ref-dx"?: number; + "ref-dy"?: number; + "ref-width"?: string | number; + "ref-height"?: string | number; + ref?: string; + "x-alignment"?: 'middle' | 'right' | number; + "y-alignment"?: 'middle' | 'bottom' | number; + port?: string; + } + class ElementView extends CellViewGeneric { + scale(sx: number, sy: number): void; // @todo Documented in source but not released + finalizeEmbedding(options?: any): void; + getBBox(options?: any): BBox; + pointerdown(evt: Event, x: number, y: number): void; + pointermove(evt: Event, x: number, y: number): void; + pointerup(evt: Event, x: number, y: number): void; + positionRelative(vel: any, bbox: BBox, attributes: ElementViewAttributes, nodesBySelector?: Object): void; // Vectorizer + prepareEmbedding(options?: any): void; + processEmbedding(options?: any): void; + render(): this; + renderMarkup(): void; + resize(): void; + rotate(): void; + translate(model: Backbone.Model, changes?: any, options?: any): void; + update(cell: Cell, renderingOnlyAttrs?: Object): void; + } + + class LinkView extends CellViewGeneric { + options: { + shortLinkLength?: number, + doubleLinkTools?: boolean, + longLinkLength?: number, + linkToolsOffset?: number, + doubleLinkToolsOffset?: number, + sampleInterval: number + }; + getConnectionLength(): number; + sendToken(token: SVGElement, duration?: number, callback?: () => void): void; + addVertex(vertex: Point): number; + getPointAtLength(length: number): Point; // Marked as public api in source but not in the documents + createWatcher(endType: { id: string }): Function; + findRoute(oldVertices: Point[]): Point[]; + getConnectionPoint(end: 'source' | 'target', selectorOrPoint: Element | Point, referenceSelectorOrPoint: Element | Point): Point; + getPathData(vertices: Point[]): any; + onEndModelChange(endType: 'source' | 'target', endModel?: Element, opt?: any): void; + onLabelsChange(): void; + onSourceChange(cell: Cell, sourceEnd: { id: string }, options: any): void; + onTargetChange(cell: Cell, targetEnd: { id: string }, options: any): void; + onToolsChange(): void; + onVerticesChange(cell: Cell, changed: any, options: any): void; + pointerdown(evt: Event, x: number, y: number): void; + pointermove(evt: Event, x: number, y: number): void; + pointerup(evt: Event, x: number, y: number): void; + removeVertex(idx: number): this; + render(): this; + renderArrowheadMarkers(): this; + renderLabels(): this; + renderTools(): this; + renderVertexMarkers(): this; + startArrowheadMove(end: 'source' | 'target', options?: any): void; + startListening(): void; + update(model: any, attributes: any, options?: any): this; + updateArrowheadMarkers(): this; + updateAttributes(): void; + updateConnection(options?: any): void; + updateLabelPositions(): this; + updateToolsPosition(): this; + } } -declare namespace joint { - export var g: any; - export var V: any; +export namespace ui { } - namespace dia { - interface Size { - width: number; - height: number; +export namespace shapes { + interface GenericAttributes extends dia.CellAttributes { + position?: dia.Point; + size?: dia.Size; + angle?: number; + attrs?: T; + } + interface ShapeAttrs extends dia.CSSSelector { + fill?: string; + stroke?: string; + r?: string | number; + rx?: string | number; + ry?: string | number; + cx?: string | number; + cy?: string | number; + height?: string | number; + width?: string | number; + transform?: string; + points?: string; + 'stroke-width'?: string | number; + 'ref-x'?: string | number; + 'ref-y'?: string | number; + ref?: string + } + + namespace basic { + class Generic extends dia.Element { + constructor(attributes?: GenericAttributes, options?: Object); } - - interface Point { - x: number; - y: number; + interface RectAttrs extends dia.TextAttrs { + rect?: ShapeAttrs; } - - interface BBox extends Point, Size { } - - interface TranslateOptions { - restrictedArea?: BBox; - transition?: TransitionOptions; + class Rect extends Generic { + constructor(attributes?: GenericAttributes, options?: Object); } - - interface TransitionOptions { - delay?: number; - duration?: number; - timingFunction?: (t: number) => number; - valueFunction?: (a: any, b: any) => (t: number) => any; + class Text extends Generic { + constructor(attributes?: GenericAttributes, options?: Object); } - - interface DfsBfsOptions { - inbound?: boolean; - outbound?: boolean; - deep?: boolean; + interface CircleAttrs extends dia.TextAttrs { + circle?: ShapeAttrs; } - - interface ExploreOptions { - breadthFirst?: boolean; - deep?: boolean; + class Circle extends Generic { + constructor(attributes?: GenericAttributes, options?: Object); } - - class Graph extends Backbone.Model { - constructor(attributes?: any, options?: { cellNamespace: any }); - addCell(cell: Cell | Cell[]): this; - addCells(cells: Cell[]): this; - resetCells(cells: Cell[], options?: any): this; - getCell(id: string): Cell; - getElements(): Element[]; - getLinks(): Link[]; - getCells(): Cell[]; - getFirstCell(): Cell; - getLastCell(): Cell; - getConnectedLinks(element: Cell, options?: { inbound?: boolean, outbound?: boolean, deep?: boolean }): Link[]; - disconnectLinks(cell: Cell, options?: any): void; - removeLinks(cell: Cell, options?: any): void; - translate(tx: number, ty?: number, options?: TranslateOptions): void; - cloneCells(cells: Cell[]): { [id: string]: Cell }; - getSubgraph(cells: Cell[], options?: { deep?: boolean }): Cell[]; - cloneSubgraph(cells: Cell[], options?: { deep?: boolean }): { [id: string]: Cell }; - dfs(element: Element, iteratee: (element: Element, distance: number) => boolean, options?: DfsBfsOptions, visited?: Object, distance?: number): void; - bfs(element: Element, iteratee: (element: Element, distance: number) => boolean, options?: DfsBfsOptions): void; - search(element: Element, iteratee: (element: Element, distance: number) => boolean, options?: { breadthFirst?: boolean }): void; - getSuccessors(element: Element, options?: ExploreOptions): Element[]; - getPredecessors(element: Element, options?: ExploreOptions): Element[]; - isSuccessor(elementA: Element, elementB: Element): boolean; - isPredecessor(elementA: Element, elementB: Element): boolean; - isSource(element: Element): boolean; - isSink(element: Element): boolean; - getSources(): Element[]; - getSinks(): Element[]; - getNeighbors(element: Element, options?: DfsBfsOptions): Element[]; - isNeighbor(elementA: Element, elementB: Element, options?: { inbound?: boolean, outbound?: boolean; }): boolean; - getCommonAncestor(...cells: Cell[]): Element; - toJSON(): any; - fromJSON(json: any, options?: any): this; - clear(options?: any): this; - findModelsFromPoint(rect: BBox): Element[]; - findModelsUnderElement(element: Element, options?: { searchBy?: 'bbox' | 'center' | 'origin' | 'corner' | 'topRight' | 'bottomLeft' }): Element[]; - getBBox(elements: Element[], options?: any): BBox; - toGraphLib(): any; // graphlib graph object - findModelsInArea(rect: BBox, options?: any): BBox | boolean; - getCellsBBox(cells: Cell[], options?: any): BBox; - getInboundEdges(node: string): Object; - getOutboundEdges(node: string): Object; - hasActiveBatch(name?: string): number | boolean; - maxZIndex(): number; - removeCells(cells: Cell[], options?: any): this; - resize(width: number, height: number, options?: number): this; - resizeCells(width: number, height: number, cells: Cell[], options?: number): this; - set(key: Object | string, value: any, options?: any): this; - startBatch(name: string, data?: Object): any; - stopBatch(name: string, data?: Object): any; + interface EllipseAttrs extends dia.TextAttrs { + ellipse?: ShapeAttrs; } - - class Cell extends Backbone.Model { - id: string; - toJSON(): any; - remove(options?: { disconnectLinks?: boolean }): this; - toFront(options?: { deep?: boolean }): this; - toBack(options?: { deep?: boolean }): this; - getAncestors(): Cell[]; - isEmbeddedIn(element: Element, options?: { deep: boolean }): boolean; - prop(key: string): any; - prop(object: any): this; - prop(key: string, value: any, options?: any): this; - removeProp(path: string, options?: any): this; - attr(key: string): any; - attr(object: SVGAttributes): this; - attr(key: string, value: any): this; - clone(): Cell; - clone(opt: { deep?: boolean }): Cell | Cell[]; - removeAttr(path: string | string[], options?: any): this; - transition(path: string, value?: any, options?: TransitionOptions, delim?: string): number; - getTransitions(): string[]; - stopTransitions(path?: string, delim?: string): this; - addTo(graph: Graph, options?: any): this; - isLink(): boolean; - embed(cell: Cell, options?: any): this; - findView(paper: Paper): CellView; - getEmbeddedCells(options?: any): Cell[]; - initialize(options?: any): void; - isElement(): boolean; - isEmbedded(): boolean; - processPorts(): void; - startBatch(name: string, options?: any): this; - stopBatch(name: string, options?: any): this; - unembed(cell: Cell, options?: any): this; + class Ellipse extends Generic { + constructor(attributes?: GenericAttributes, options?: Object); } - - type Padding = number | { - top?: number; - right?: number; - bottom?: number; - left?: number - }; - - class Element extends Cell { - translate(tx: number, ty?: number, options?: TranslateOptions): this; - position(options?: { parentRelative: boolean }): Point; - position(x: number, y: number, options?: { parentRelative?: boolean }): this; - resize(width: number, height: number, options?: { direction?: 'left' | 'right' | 'top' | 'bottom' | 'top-right' | 'top-left' | 'bottom-left' | 'bottom-right' }): this; - rotate(deg: number, absolute?: boolean, origin?: Point): this; - embed(cell: Cell): this; - unembed(cell: Cell): this; - getEmbeddedCells(options?: ExploreOptions): Cell[]; - fitEmbeds(options?: { deep?: boolean, padding?: Padding }): this; - getBBox(options?: any): BBox; - findView(paper: Paper): ElementView; - isElement(): boolean; - scale(scaleX: number, scaleY: number, origin?: Point, options?: any): this; - addPort(port: any, opt?: any): this; - addPorts(ports: any[], opt?: any): this; - removePort(port: any, opt?: any): this; - hasPorts(): boolean; - hasPort(id: string): boolean; - getPorts(): any[]; - getPort(id: string): any; - getPortIndex(port: any): number; - portProp(portId: string, path: any, value?: any, opt?: any): joint.dia.Element; + interface PolygonAttrs extends dia.TextAttrs { + polygon?: ShapeAttrs; } - - interface CSSSelector { - [key: string]: string | number | Object; // Object added to support special attributes like filter http://jointjs.com/api#SpecialAttributes:filter + class Polygon extends Generic { + constructor(attributes?: GenericAttributes, options?: Object); } - - interface SVGAttributes { - [selector: string]: CSSSelector; + interface PolylineAttrs extends dia.TextAttrs { + polyline?: ShapeAttrs; } - - interface CellAttributes { - [key: string]: any; + class Polyline extends Generic { + constructor(attributes?: GenericAttributes, options?: Object); } - - interface TextAttrs extends SVGAttributes { - text?: { - [key: string]: string | number; - text?: string; - }; + class Image extends Generic { + constructor(attributes?: GenericAttributes, options?: Object); } - - interface Label { - position: number; - attrs?: TextAttrs; + interface PathAttrs extends dia.TextAttrs { + path?: ShapeAttrs; } - interface LinkAttributes extends CellAttributes { - source?: Point | { id: string, selector?: string, port?: string }; - target?: Point | { id: string, selector?: string, port?: string }; - labels?: Label[]; - vertices?: Point[]; - smooth?: boolean; - attrs?: TextAttrs; - z?: number; + class Path extends Generic { + constructor(attributes?: GenericAttributes, options?: Object); } - - class Link extends Cell { - markup: string; - labelMarkup: string; - toolMakup: string; - vertexMarkup: string; - arrowHeadMarkup: string; - - constructor(attributes?: LinkAttributes, options?: Object); - disconnect(): this; - label(index?: number): any; - label(index: number, value: Label): this; - reparent(options?: any): Element; - findView(paper: Paper): LinkView; - getSourceElement(): Element; - getTargetElement(): Element; - hasLoop(options?: { deep?: boolean }): boolean; - applyToPoints(fn: Function, options?: any): this; - getRelationshipAncestor(): Element; - isLink(): boolean; - isRelationshipEmbeddedIn(element: Element): boolean; - scale(sx: number, sy: number, origin: Point, optionts?: any): this; - translate(tx: number, ty: number, options?: any): this; + interface RhombusAttrs extends dia.TextAttrs { + path?: ShapeAttrs; } - - interface ManhattanRouterArgs { - excludeTypes?: string[]; - excludeEnds?: 'source' | 'target'; - startDirections?: ['left' | 'right' | 'top' | 'bottom']; - endDirections?: ['left' | 'right' | 'top' | 'bottom']; + class Rhombus extends Generic { + constructor(attributes?: GenericAttributes, options?: Object); } - - interface PaperOptions extends Backbone.ViewOptions { - el?: string | JQuery | HTMLElement; - width?: number; - height?: number; - origin?: Point; - gridSize?: number; - perpendicularLinks?: boolean; - elementView?: (element: Element) => ElementView | ElementView; - linkView?: (link: Link) => LinkView | LinkView; - defaultLink?: ((cellView: CellView, magnet: SVGElement) => Link) | Link; - defaultRouter?: ((vertices: Point[], args: Object, linkView: LinkView) => Point[]) | { name: string, args?: ManhattanRouterArgs }; - defaultConnector?: ((sourcePoint: Point, targetPoint: Point, vertices: Point[], args: Object, linkView: LinkView) => string) | { name: string, args?: { radius?: number } }; - interactive?: ((cellView: CellView, event: string) => boolean) | boolean | { vertexAdd?: boolean, vertexMove?: boolean, vertexRemove?: boolean, arrowheadMove?: boolean }; - validateMagnet?: (cellView: CellView, magnet: SVGElement) => boolean; - validateConnection?: (cellViewS: CellView, magnetS: SVGElement, cellViewT: CellView, magnetT: SVGElement, end: 'source' | 'target', linkView: LinkView) => boolean; - linkConnectionPoint?: (linkView: LinkView, view: ElementView, magnet: SVGElement, reference: Point) => Point; - snapLinks?: boolean | { radius: number }; - linkPinning?: boolean; - markAvailable?: boolean; - async?: boolean | { batchZise: number }; - embeddingMode?: boolean; - validateEmbedding?: (childView: ElementView, parentView: ElementView) => boolean; - restrictTranslate?: ((elementView: ElementView) => BBox) | boolean; - guard?: (evt: Event, view: CellView) => boolean; - multiLinks?: boolean; - cellViewNamespace?: Object; - /** useful undocumented option */ - clickThreshold?: number; - highlighting?: any; + interface TextBlockAttrs extends dia.TextAttrs { + rect?: ShapeAttrs; } - - interface ScaleContentOptions { - padding?: number; - preserveAspectRatio?: boolean; - minScale?: number; - minScaleX?: number; - minScaleY?: number; - maxScale?: number; - maxScaleX?: number; - maxScaleY?: number; - scaleGrid?: number; - fittingBBox?: BBox; + class TextBlock extends Generic { + constructor(attributes?: GenericAttributes, options?: Object); + updateSize(cell: dia.Cell, size: dia.Size): void; + updateContent(cell: dia.Cell, content: string): void; } + } - interface FitToContentOptions { - gridWidth?: number; - gridHeight?: number; - padding?: Padding; - allowNewOrigin?: 'negative' | 'positive' | 'any'; - minWidth?: number; - minHeight?: number; - maxWidth?: number; - maxHeight?: number; + namespace chess { + class KingWhite extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } - - class Paper extends Backbone.View { - constructor(options?: PaperOptions); - options: PaperOptions; - svg: SVGElement; - viewport: SVGGElement; - defs: SVGDefsElement; - setDimensions(width: number, height: number): void; - setOrigin(x: number, y: number): void; - scale(sx: number, sy?: number, ox?: number, oy?: number): this; - findView(element: any): CellView; - findViewByModel(model: Cell | string): CellView; - findViewsFromPoint(point: Point): ElementView[]; - findViewsInArea(rect: BBox, options?: { strict?: boolean }): CellView[]; - fitToContent(options?: FitToContentOptions): void; - scaleContentToFit(options?: ScaleContentOptions): void; - getContentBBox(): BBox; - clientToLocalPoint(p: Point): Point; - - rotate(deg: number, ox?: number, oy?: number): Paper; // @todo not released yet though it's in the source code already - - afterRenderViews(): void; - asyncRenderViews(cells: Cell[], options?: any): void; - beforeRenderViews(cells: Cell[]): Cell[]; - cellMouseout(evt: Event): void; - cellMouseover(evt: Event): void; - clearGrid(): this; - contextmenu(evt: Event): void; - createViewForModel(cell: Cell): CellView; - drawGrid(options?: any): this; - fitToContent(gridWidth?: number, gridHeight?: number, padding?: number, options?: any): void; - getArea(): BBox; - getDefaultLink(cellView: CellView, magnet: HTMLElement): Link; - getModelById(id: string): Cell; - getRestrictedArea(): BBox; - guard(evt: Event, view: CellView): boolean; - linkAllowed(linkViewOrModel: LinkView | Link): boolean; - mouseclick(evt: Event): void; - mousedblclick(evt: Event): void; - mousewheel(evt: Event): void; - onCellAdded(cell: Cell, graph: Graph, options: Object): void; - onCellHighlight(cellView: CellView, magnetEl: HTMLElement, options?: any): void; - onCellUnhighlight(cellView: CellView, magnetEl: HTMLElement, options?: any): void; - onRemove(): void; - pointerdown(evt: Event): void; - pointermove(evt: Event): void; - pointerup(evt: Event): void; - remove(): this; - removeView(cell: Cell): CellView; - removeViews(): void; - renderView(cell: Cell): CellView; - resetViews(cellsCollection: Cell[], options: any): void; - resolveHighlighter(options?: any): boolean | Object; - setGridSize(gridSize: number): this; - setInteractivity(value: any): void; - snapToGrid(p: Point): Point; - sortViews(): void; + class KingBlack extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } - - - interface GradientOptions { - type: 'linearGradient' | 'radialGradient'; - stops: Array<{ - offset: string; - color: string; - opacity?: number; - }>; + class QueenWhite extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } - class CellViewGeneric extends Backbone.View { - getBBox(options?: { useModelGeometry?: boolean }): BBox; - highlight(el?: any, options?: any): this; - unhighlight(el?: any, options?: any): this; - applyFilter(selector: string | HTMLElement, filter: Object): void; - applyGradient(selector: string | HTMLElement, attr: 'fill' | 'stroke', gradient: GradientOptions): void; - can(feature: string): boolean; - findBySelector(selector: string): JQuery; - findMagnet(el: any): HTMLElement; - getSelector(el: HTMLElement, prevSelector: string): string; - getStrokeBBox(el: any): BBox; // string|HTMLElement|Vectorizer - mouseout(evt: Event): void; - mouseover(evt: Event): void; - mousewheel(evt: Event, x: number, y: number, delta: number): void - notify(eventName: string): void; - onChangeAttrs(cell: Cell, attrs: Backbone.ViewOptions, options?: any): this; - onSetTheme(oldTheme: string, newTheme: string): void; - pointerclick(evt: Event, x: number, y: number): void; - pointerdblclick(evt: Event, x: number, y: number): void; - pointerdown(evt: Event, x: number, y: number): void; - pointermove(evt: Event, x: number, y: number): void; - pointerup(evt: Event, x: number, y: number): void; - remove(): this; - setInteractivity(value: any): void; - setTheme(theme: string, options?: any): this; + class QueenBlack extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); } + class RookWhite extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); + } + class RookBlack extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); + } + class BishopWhite extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); + } + class BishopBlack extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); + } + class KnightWhite extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); + } + class KnightBlack extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); + } + class PawnWhite extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); + } + class PawnBlack extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); + } + } - class CellView extends CellViewGeneric { } + namespace devs { + interface ModelAttributes extends GenericAttributes { + inPorts?: string[]; + outPorts?: string[]; + ports?: Object; + } + class Model extends basic.Generic { + constructor(attributes?: ModelAttributes, options?: Object); + changeInGroup(properties: any, opt?: any): boolean; + changeOutGroup(properties: any, opt?: any): boolean; + createPortItem(group: string, port: string): any; + createPortItems(group: string, ports: string[]): any[]; + addOutPort(port: string, opt?: any): this; + addInPort(port: string, opt?: any): this; + removeOutPort(port: string, opt?: any): this; + removeInPort(port: string, opt?: any): this; + } + class Coupled extends Model { + constructor(attributes?: ModelAttributes, options?: Object); + } + class Atomic extends Model { + constructor(attributes?: ModelAttributes, options?: Object); + } + class Link extends dia.Link { + constructor(attributes?: dia.LinkAttributes, options?: Object); + } + } - interface ElementViewAttributes { - style?: string; - text?: string; - html?: string; - "ref-x"?: string | number; - "ref-y"?: string | number; - "ref-dx"?: number; - "ref-dy"?: number; - "ref-width"?: string | number; - "ref-height"?: string | number; + namespace erd { + class Entity extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); + } + class WeakEntity extends Entity { + constructor(attributes?: GenericAttributes, options?: Object); + } + class Relationship extends dia.Element { + constructor(attributes?: GenericAttributes, options?: Object); + } + class IdentifyingRelationship extends Relationship { + constructor(attributes?: GenericAttributes, options?: Object); + } + interface AttributeAttrs extends dia.TextAttrs { + ellipse?: ShapeAttrs; + } + class Attribute extends dia.Element { + constructor(attributes?: GenericAttributes, options?: Object); + } + class Multivalued extends Attribute { + constructor(attributes?: GenericAttributes, options?: Object); + } + class Derived extends Attribute { + constructor(attributes?: GenericAttributes, options?: Object); + } + class Key extends Attribute { + constructor(attributes?: GenericAttributes, options?: Object); + } + class Normal extends Attribute { + constructor(attributes?: GenericAttributes, options?: Object); + } + interface ISAAttrs extends dia.Element { + polygon?: ShapeAttrs; + } + class ISA extends dia.Element { + constructor(attributes?: GenericAttributes, options?: Object); + } + class Line extends dia.Link { + constructor(attributes?: dia.LinkAttributes, options?: Object); + cardinality(value: string | number): void; + } + } + + namespace fsa { + class State extends basic.Circle { + constructor(attributes?: GenericAttributes, options?: Object); + } + class StartState extends dia.Element { + constructor(attributes?: GenericAttributes, options?: Object); + } + class EndState extends dia.Element { + constructor(attributes?: GenericAttributes, options?: Object); + } + class Arrow extends dia.Link { + constructor(attributes?: dia.LinkAttributes, options?: Object); + } + } + + namespace logic { + interface LogicAttrs extends ShapeAttrs { ref?: string; - "x-alignment"?: 'middle' | 'right' | number; - "y-alignment"?: 'middle' | 'bottom' | number; + 'ref-x'?: number | string; + 'ref-dx'?: number | string; + 'ref-y'?: number | string; + 'ref-dy'?: number | string; + magnet?: boolean; + 'class'?: string; port?: string; } - class ElementView extends CellViewGeneric { - scale(sx: number, sy: number): void; // @todo Documented in source but not released - finalizeEmbedding(options?: any): void; - getBBox(options?: any): BBox; - pointerdown(evt: Event, x: number, y: number): void; - pointermove(evt: Event, x: number, y: number): void; - pointerup(evt: Event, x: number, y: number): void; - positionRelative(vel: any, bbox: BBox, attributes: ElementViewAttributes, nodesBySelector?: Object): void; // Vectorizer - prepareEmbedding(options?: any): void; - processEmbedding(options?: any): void; - render(): this; - renderMarkup(): void; - resize(): void; - rotate(): void; - translate(model: Backbone.Model, changes?: any, options?: any): void; - update(cell: Cell, renderingOnlyAttrs?: Object): void; + interface IOAttrs extends dia.TextAttrs { + circle?: LogicAttrs; } - - class LinkView extends CellViewGeneric { - options: { - shortLinkLength?: number, - doubleLinkTools?: boolean, - longLinkLength?: number, - linkToolsOffset?: number, - doubleLinkToolsOffset?: number, - sampleInterval: number - }; - getConnectionLength(): number; - sendToken(token: SVGElement, duration?: number, callback?: () => void): void; - addVertex(vertex: Point): number; - getPointAtLength(length: number): Point; // Marked as public api in source but not in the documents - createWatcher(endType: { id: string }): Function; - findRoute(oldVertices: Point[]): Point[]; - getConnectionPoint(end: 'source' | 'target', selectorOrPoint: Element | Point, referenceSelectorOrPoint: Element | Point): Point; - getPathData(vertices: Point[]): any; - onEndModelChange(endType: 'source' | 'target', endModel?: Element, opt?: any): void; - onLabelsChange(): void; - onSourceChange(cell: Cell, sourceEnd: { id: string }, options: any): void; - onTargetChange(cell: Cell, targetEnd: { id: string }, options: any): void; - onToolsChange(): void; - onVerticesChange(cell: Cell, changed: any, options: any): void; - pointerdown(evt: Event, x: number, y: number): void; - pointermove(evt: Event, x: number, y: number): void; - pointerup(evt: Event, x: number, y: number): void; - removeVertex(idx: number): this; - render(): this; - renderArrowheadMarkers(): this; - renderLabels(): this; - renderTools(): this; - renderVertexMarkers(): this; - startArrowheadMove(end: 'source' | 'target', options?: any): void; - startListening(): void; - update(model: any, attributes: any, options?: any): this; - updateArrowheadMarkers(): this; - updateAttributes(): void; - updateConnection(options?: any): void; - updateLabelPositions(): this; - updateToolsPosition(): this; + class Gate extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); + } + class IO extends Gate { + constructor(attributes?: GenericAttributes, options?: Object); + } + class Input extends IO { + constructor(attributes?: GenericAttributes, options?: Object); + } + class Output extends IO { + constructor(attributes?: GenericAttributes, options?: Object); + } + class Gate11 extends Gate { + constructor(attributes?: GenericAttributes, options?: Object); + } + class Gate21 extends Gate { + constructor(attributes?: GenericAttributes, options?: Object); + } + interface Image { + 'xlink:href'?: string; + } + interface ImageAttrs extends LogicAttrs { + image?: Image; + } + class Repeater extends Gate11 { + constructor(attributes?: GenericAttributes, options?: Object); + operation(input: any): any; + } + class Note extends Gate11 { + constructor(attributes?: GenericAttributes, options?: Object); + operation(input: any): boolean; + } + class Or extends Gate21 { + constructor(attributes?: GenericAttributes, options?: Object); + operation(input1: any, input2: any): boolean; + } + class And extends Gate21 { + constructor(attributes?: GenericAttributes, options?: Object); + operation(input1: any, input2: any): boolean; + } + class Nor extends Gate21 { + constructor(attributes?: GenericAttributes, options?: Object); + operation(input1: any, input2: any): boolean; + } + class Nand extends Gate21 { + constructor(attributes?: GenericAttributes, options?: Object); + operation(input1: any, input2: any): boolean; + } + class Xor extends Gate21 { + constructor(attributes?: GenericAttributes, options?: Object); + operation(input1: any, input2: any): boolean; + } + class Xnor extends Gate21 { + constructor(attributes?: GenericAttributes, options?: Object); + operation(input1: any, input2: any): boolean; + } + interface WireArgs extends dia.LinkAttributes { + router?: Object; + connector?: Object; + } + class Wire extends dia.Link { + constructor(attributes?: WireArgs, options?: Object); } } - namespace ui { } - - namespace shapes { - interface GenericAttributes extends dia.CellAttributes { - position?: dia.Point; - size?: dia.Size; - angle?: number; - attrs?: T; + namespace org { + interface MemberAttrs { + rect?: ShapeAttrs; + image?: ShapeAttrs; } - interface ShapeAttrs extends dia.CSSSelector { - fill?: string; - stroke?: string; - r?: string | number; - rx?: string | number; - ry?: string | number; - cx?: string | number; - cy?: string | number; - height?: string | number; - width?: string | number; - transform?: string; - points?: string; - 'stroke-width'?: string | number; - 'ref-x'?: string | number; - 'ref-y'?: string | number; - ref?: string + class Member extends dia.Element { + constructor(attributes?: GenericAttributes, options?: Object); } - - namespace basic { - class Generic extends dia.Element { - constructor(attributes?: GenericAttributes, options?: Object); - } - interface RectAttrs extends dia.TextAttrs { - rect?: ShapeAttrs; - } - class Rect extends Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class Text extends Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - interface CircleAttrs extends dia.TextAttrs { - circle?: ShapeAttrs; - } - class Circle extends Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - interface EllipseAttrs extends dia.TextAttrs { - ellipse?: ShapeAttrs; - } - class Ellipse extends Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - interface PolygonAttrs extends dia.TextAttrs { - polygon?: ShapeAttrs; - } - class Polygon extends Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - interface PolylineAttrs extends dia.TextAttrs { - polyline?: ShapeAttrs; - } - class Polyline extends Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class Image extends Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - interface PathAttrs extends dia.TextAttrs { - path?: ShapeAttrs; - } - class Path extends Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - interface RhombusAttrs extends dia.TextAttrs { - path?: ShapeAttrs; - } - class Rhombus extends Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - interface TextBlockAttrs extends dia.TextAttrs { - rect?: ShapeAttrs; - } - class TextBlock extends Generic { - constructor(attributes?: GenericAttributes, options?: Object); - updateSize(cell: dia.Cell, size: dia.Size): void; - updateContent(cell: dia.Cell, content: string): void; - } - } - - namespace chess { - class KingWhite extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class KingBlack extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class QueenWhite extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class QueenBlack extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class RookWhite extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class RookBlack extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class BishopWhite extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class BishopBlack extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class KnightWhite extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class KnightBlack extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class PawnWhite extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class PawnBlack extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - } - - namespace devs { - interface ModelAttributes extends GenericAttributes { - inPorts?: string[]; - outPorts?: string[]; - ports?: Object; - } - class Model extends basic.Generic { - constructor(attributes?: ModelAttributes, options?: Object); - changeInGroup(properties: any, opt?: any): boolean; - changeOutGroup(properties: any, opt?: any): boolean; - createPortItem(group: string, port: string): any; - createPortItems(group: string, ports: string[]): any[]; - addOutPort(port: string, opt?: any): this; - addInPort(port: string, opt?: any): this; - removeOutPort(port: string, opt?: any): this; - removeInPort(port: string, opt?: any): this; - } - class Coupled extends Model { - constructor(attributes?: ModelAttributes, options?: Object); - } - class Atomic extends Model { - constructor(attributes?: ModelAttributes, options?: Object); - } - class Link extends dia.Link { - constructor(attributes?: dia.LinkAttributes, options?: Object); - } - } - - namespace erd { - class Entity extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class WeakEntity extends Entity { - constructor(attributes?: GenericAttributes, options?: Object); - } - class Relationship extends dia.Element { - constructor(attributes?: GenericAttributes, options?: Object); - } - class IdentifyingRelationship extends Relationship { - constructor(attributes?: GenericAttributes, options?: Object); - } - interface AttributeAttrs extends dia.TextAttrs { - ellipse?: ShapeAttrs; - } - class Attribute extends dia.Element { - constructor(attributes?: GenericAttributes, options?: Object); - } - class Multivalued extends Attribute { - constructor(attributes?: GenericAttributes, options?: Object); - } - class Derived extends Attribute { - constructor(attributes?: GenericAttributes, options?: Object); - } - class Key extends Attribute { - constructor(attributes?: GenericAttributes, options?: Object); - } - class Normal extends Attribute { - constructor(attributes?: GenericAttributes, options?: Object); - } - interface ISAAttrs extends dia.Element { - polygon?: ShapeAttrs; - } - class ISA extends dia.Element { - constructor(attributes?: GenericAttributes, options?: Object); - } - class Line extends dia.Link { - constructor(attributes?: dia.LinkAttributes, options?: Object); - cardinality(value: string | number): void; - } - } - - namespace fsa { - class State extends basic.Circle { - constructor(attributes?: GenericAttributes, options?: Object); - } - class StartState extends dia.Element { - constructor(attributes?: GenericAttributes, options?: Object); - } - class EndState extends dia.Element { - constructor(attributes?: GenericAttributes, options?: Object); - } - class Arrow extends dia.Link { - constructor(attributes?: dia.LinkAttributes, options?: Object); - } - } - - namespace logic { - interface LogicAttrs extends ShapeAttrs { - ref?: string; - 'ref-x'?: number | string; - 'ref-dx'?: number | string; - 'ref-y'?: number | string; - 'ref-dy'?: number | string; - magnet?: boolean; - 'class'?: string; - port?: string; - } - interface IOAttrs extends dia.TextAttrs { - circle?: LogicAttrs; - } - class Gate extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class IO extends Gate { - constructor(attributes?: GenericAttributes, options?: Object); - } - class Input extends IO { - constructor(attributes?: GenericAttributes, options?: Object); - } - class Output extends IO { - constructor(attributes?: GenericAttributes, options?: Object); - } - class Gate11 extends Gate { - constructor(attributes?: GenericAttributes, options?: Object); - } - class Gate21 extends Gate { - constructor(attributes?: GenericAttributes, options?: Object); - } - interface Image { - 'xlink:href'?: string; - } - interface ImageAttrs extends LogicAttrs { - image?: Image; - } - class Repeater extends Gate11 { - constructor(attributes?: GenericAttributes, options?: Object); - operation(input: any): any; - } - class Note extends Gate11 { - constructor(attributes?: GenericAttributes, options?: Object); - operation(input: any): boolean; - } - class Or extends Gate21 { - constructor(attributes?: GenericAttributes, options?: Object); - operation(input1: any, input2: any): boolean; - } - class And extends Gate21 { - constructor(attributes?: GenericAttributes, options?: Object); - operation(input1: any, input2: any): boolean; - } - class Nor extends Gate21 { - constructor(attributes?: GenericAttributes, options?: Object); - operation(input1: any, input2: any): boolean; - } - class Nand extends Gate21 { - constructor(attributes?: GenericAttributes, options?: Object); - operation(input1: any, input2: any): boolean; - } - class Xor extends Gate21 { - constructor(attributes?: GenericAttributes, options?: Object); - operation(input1: any, input2: any): boolean; - } - class Xnor extends Gate21 { - constructor(attributes?: GenericAttributes, options?: Object); - operation(input1: any, input2: any): boolean; - } - interface WireArgs extends dia.LinkAttributes { - router?: Object; - connector?: Object; - } - class Wire extends dia.Link { - constructor(attributes?: WireArgs, options?: Object); - } - } - - namespace org { - interface MemberAttrs { - rect?: ShapeAttrs; - image?: ShapeAttrs; - } - class Member extends dia.Element { - constructor(attributes?: GenericAttributes, options?: Object); - } - class Arrow extends dia.Link { - constructor(attributes?: dia.LinkAttributes, options?: Object); - } - } - - namespace pn { - class Place extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class PlaceView extends dia.ElementView { - renderTokens(): void; - } - class Transition extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class Link extends dia.Link { - constructor(attributes?: dia.LinkAttributes, options?: Object); - } - } - - namespace uml { - interface ClassAttributes extends GenericAttributes { - name: string[]; - attributes: string[]; - methods: string[]; - } - class Class extends basic.Generic { - constructor(attributes?: ClassAttributes, options?: Object); - getClassName(): string[]; - updateRectangles(): void; - } - class ClassView extends dia.ElementView { - } - class Abstract extends Class { - constructor(attributes?: ClassAttributes, options?: Object); - } - class AbstractView extends ClassView { - constructor(attributes?: ClassAttributes, options?: Object); - } - class Interface extends Class { - constructor(attributes?: ClassAttributes, options?: Object); - } - class InterfaceView extends ClassView { - constructor(attributes?: ClassAttributes, options?: Object); - } - class Generalization extends dia.Link { - constructor(attributes?: dia.LinkAttributes, options?: Object); - } - class Implementation extends dia.Link { - constructor(attributes?: dia.LinkAttributes, options?: Object); - } - class Aggregation extends dia.Link { - constructor(attributes?: dia.LinkAttributes, options?: Object); - } - class Composition extends dia.Link { - constructor(attributes?: dia.LinkAttributes, options?: Object); - } - class Association extends dia.Link { - constructor(attributes?: dia.LinkAttributes, options?: Object); - } - interface StateAttributes extends GenericAttributes { - events?: string[]; - } - class State extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - updateName(): void; - updateEvents(): void; - updatePath(): void; - } - class StartState extends basic.Circle { - constructor(attributes?: GenericAttributes, options?: Object); - } - class EndState extends basic.Generic { - constructor(attributes?: GenericAttributes, options?: Object); - } - class Transition extends dia.Link { - constructor(attributes?: dia.LinkAttributes, options?: Object); - } + class Arrow extends dia.Link { + constructor(attributes?: dia.LinkAttributes, options?: Object); } } - namespace util { - - namespace format { - export function number(specifier: string, value: number): string; + namespace pn { + class Place extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); + } + class PlaceView extends dia.ElementView { + renderTokens(): void; + } + class Transition extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); + } + class Link extends dia.Link { + constructor(attributes?: dia.LinkAttributes, options?: Object); } - - export function uuid(): string; - export function guid(obj?: Object): string; - export function nextFrame(callback: () => void, context?: Object): number; - export function cancelFrame(requestId: number): void; - export function flattenObject(object: Object, delim: string, stop: (node: any) => boolean): any; - export function getByPath(object: Object, path: string, delim: string): any; - export function setByPath(object: Object, path: string, value: Object, delim: string): any; - export function unsetByPath(object: Object, path: string, delim: string): any; - export function breakText(text: string, size: dia.Size, attrs?: dia.SVGAttributes, options?: { svgDocument?: SVGElement }): string; - export function normalizeSides(box: number | { x?: number, y?: number, height?: number, width?: number }): dia.BBox; - export function getElementBBox(el: Element): dia.BBox; - export function setAttributesBySelector(el: Element, attrs: dia.SVGAttributes): void; - export function sortElements(elements: Element[] | string | JQuery, comparator: (a: Element, b: Element) => number): Element[]; - export function shapePerimeterConnectionPoint(linkView: dia.LinkView, view: dia.ElementView, magnet: SVGElement, ref: dia.Point): dia.Point; - export function imageToDataUri(url: string, callback: (err: Error, dataUri: string) => void): void; - - // Not documented but used in examples - /** @deprecated use lodash _.defaultsDeep */ - export function deepSupplement(objects: any, defaultIndicator?: any): any; - - // Private functions - /** @deprecated use lodash _.assign */ - export function mixin(objects: any[]): any; - /** @deprecated use lodash _.defaults */ - export function supplement(objects: any[]): any; - /** @deprecated use lodash _.mixin */ - export function deepMixin(objects: any[]): any; } - namespace layout { - - interface LayoutOptions { - nodeSep?: number; - edgeSep?: number; - rankSep?: number; - rankDir?: 'TB' | 'BT' | 'LR' | 'RL'; - marginX?: number; - marginY?: number; - resizeCluster?: boolean; - setPosition?: (element: dia.Element, position: dia.BBox) => void; - setLinkVertices?: (link: dia.Link, vertices: Position[]) => void; + namespace uml { + interface ClassAttributes extends GenericAttributes { + name: string[]; + attributes: string[]; + methods: string[]; } - - export class DirectedGraph { - static layout(graph: dia.Graph | dia.Cell[], options?: LayoutOptions): dia.BBox; + class Class extends basic.Generic { + constructor(attributes?: ClassAttributes, options?: Object); + getClassName(): string[]; + updateRectangles(): void; + } + class ClassView extends dia.ElementView { + } + class Abstract extends Class { + constructor(attributes?: ClassAttributes, options?: Object); + } + class AbstractView extends ClassView { + constructor(attributes?: ClassAttributes, options?: Object); + } + class Interface extends Class { + constructor(attributes?: ClassAttributes, options?: Object); + } + class InterfaceView extends ClassView { + constructor(attributes?: ClassAttributes, options?: Object); + } + class Generalization extends dia.Link { + constructor(attributes?: dia.LinkAttributes, options?: Object); + } + class Implementation extends dia.Link { + constructor(attributes?: dia.LinkAttributes, options?: Object); + } + class Aggregation extends dia.Link { + constructor(attributes?: dia.LinkAttributes, options?: Object); + } + class Composition extends dia.Link { + constructor(attributes?: dia.LinkAttributes, options?: Object); + } + class Association extends dia.Link { + constructor(attributes?: dia.LinkAttributes, options?: Object); + } + interface StateAttributes extends GenericAttributes { + events?: string[]; + } + class State extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); + updateName(): void; + updateEvents(): void; + updatePath(): void; + } + class StartState extends basic.Circle { + constructor(attributes?: GenericAttributes, options?: Object); + } + class EndState extends basic.Generic { + constructor(attributes?: GenericAttributes, options?: Object); + } + class Transition extends dia.Link { + constructor(attributes?: dia.LinkAttributes, options?: Object); } } } + +export namespace util { + + namespace format { + export function number(specifier: string, value: number): string; + } + + export function uuid(): string; + export function guid(obj?: Object): string; + export function nextFrame(callback: () => void, context?: Object): number; + export function cancelFrame(requestId: number): void; + export function flattenObject(object: Object, delim: string, stop: (node: any) => boolean): any; + export function getByPath(object: Object, path: string, delim: string): any; + export function setByPath(object: Object, path: string, value: Object, delim: string): any; + export function unsetByPath(object: Object, path: string, delim: string): any; + export function breakText(text: string, size: dia.Size, attrs?: dia.SVGAttributes, options?: { svgDocument?: SVGElement }): string; + export function normalizeSides(box: number | { x?: number, y?: number, height?: number, width?: number }): dia.BBox; + export function getElementBBox(el: Element): dia.BBox; + export function setAttributesBySelector(el: Element, attrs: dia.SVGAttributes): void; + export function sortElements(elements: Element[] | string | JQuery, comparator: (a: Element, b: Element) => number): Element[]; + export function shapePerimeterConnectionPoint(linkView: dia.LinkView, view: dia.ElementView, magnet: SVGElement, ref: dia.Point): dia.Point; + export function imageToDataUri(url: string, callback: (err: Error, dataUri: string) => void): void; + + // Not documented but used in examples + /** @deprecated use lodash _.defaultsDeep */ + export function deepSupplement(objects: any, defaultIndicator?: any): any; + + // Private functions + /** @deprecated use lodash _.assign */ + export function mixin(objects: any[]): any; + /** @deprecated use lodash _.defaults */ + export function supplement(objects: any[]): any; + /** @deprecated use lodash _.mixin */ + export function deepMixin(objects: any[]): any; +} + +export namespace layout { + + interface LayoutOptions { + nodeSep?: number; + edgeSep?: number; + rankSep?: number; + rankDir?: 'TB' | 'BT' | 'LR' | 'RL'; + marginX?: number; + marginY?: number; + resizeCluster?: boolean; + setPosition?: (element: dia.Element, position: dia.BBox) => void; + setLinkVertices?: (link: dia.Link, vertices: Position[]) => void; + } + + class DirectedGraph { + static layout(graph: dia.Graph | dia.Cell[], options?: LayoutOptions): dia.BBox; + } +} diff --git a/rappid/index.d.ts b/rappid/index.d.ts index 5cbf07b995..d70023e055 100644 --- a/rappid/index.d.ts +++ b/rappid/index.d.ts @@ -5,33 +5,36 @@ /// -declare namespace joint { - namespace ui { - interface Handle { - name: string; - position: string; - icon: string; - } +import * as joint from 'jointjs'; +import * as Backbone from "backbone"; - class SelectionView extends Backbone.Model { +export as namespace joint; + +export namespace ui { + interface Handle { + name: string; + position: string; + icon: string; + } + + class SelectionView extends Backbone.Model { + paper: joint.dia.Paper; + graph: joint.dia.Graph; + model: Backbone.Collection; + + constructor(opt: { paper: joint.dia.Paper; graph: joint.dia.Graph; - model: Backbone.Collection; + model: Backbone.Collection + }); - constructor(opt: { - paper: joint.dia.Paper; - graph: joint.dia.Graph; - model: Backbone.Collection - }); + createSelectionBox(cellView: joint.dia.CellView): void; + destroySelectionBox(cellView: joint.dia.CellView): void; + startSelecting(evt: any): void; + cancelSelection(): void; - createSelectionBox(cellView: joint.dia.CellView): void; - destroySelectionBox(cellView: joint.dia.CellView): void; - startSelecting(evt: any): void; - cancelSelection(): void; - - addHandle(handle: Handle): void; - removeHandle(name: string): void; - changeHandle(name: string, handle: Handle): void; - } + addHandle(handle: Handle): void; + removeHandle(name: string): void; + changeHandle(name: string, handle: Handle): void; } } From a9e873e31f9879fa70c746f389086c42ff4108c0 Mon Sep 17 00:00:00 2001 From: Anatoliy Gordienko Date: Sat, 11 Mar 2017 17:45:11 +0200 Subject: [PATCH 085/374] material-ui definition for Tooltip component fix --- material-ui/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/material-ui/index.d.ts b/material-ui/index.d.ts index 05512e2e9d..7475374530 100644 --- a/material-ui/index.d.ts +++ b/material-ui/index.d.ts @@ -522,6 +522,7 @@ declare namespace __MaterialUI { namespace propTypes { type horizontal = 'left' | 'middle' | 'right'; + type tooltipHorizontal = 'left' | 'center' | 'right'; type vertical = 'top' | 'center' | 'bottom'; type direction = 'left' | 'right' | 'up' | 'down'; @@ -8689,7 +8690,7 @@ declare module 'material-ui/internal/SlideInChild' { declare module 'material-ui/internal/Tooltip' { interface TooltipProps extends React.Props { className?: string; - horizontalPosition?: __MaterialUI.propTypes.horizontal; + horizontalPosition?: __MaterialUI.propTypes.tooltipHorizontal; label: any; show?: boolean; style?: React.CSSProperties; From 98c9f30fc39e375ab07e4ebbd0a7a55f150d8e72 Mon Sep 17 00:00:00 2001 From: Joshua Ball Date: Sat, 11 Mar 2017 11:10:23 -0800 Subject: [PATCH 086/374] AsyncCompleter for readline Previous Completer interface required implementation of BOTH types (sync and async). Sync type could be assigned to async type, but not vice versa, forcing implementers to always implement the sync interface. --- node/index.d.ts | 10 ++++------ node/node-tests.ts | 6 ++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/node/index.d.ts b/node/index.d.ts index ca6e83a267..55f1fd947f 100644 --- a/node/index.d.ts +++ b/node/index.d.ts @@ -1546,22 +1546,20 @@ declare module "readline" { prependOnceListener(event: "SIGTSTP", listener: () => void): this; } - export interface Completer { - (line: string): CompleterResult; - (line: string, callback: (err: any, result: CompleterResult) => void): any; - } + type Completer = (line: string) => CompleterResult; + type AsyncCompleter = (line: string, callback: (err: any, result: CompleterResult) => void) => any; export type CompleterResult = [string[], string]; export interface ReadLineOptions { input: NodeJS.ReadableStream; output?: NodeJS.WritableStream; - completer?: Completer; + completer?: Completer | AsyncCompleter; terminal?: boolean; historySize?: number; } - export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer, terminal?: boolean): ReadLine; + export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): ReadLine; export function createInterface(options: ReadLineOptions): ReadLine; export function cursorTo(stream: NodeJS.WritableStream, x: number, y: number): void; diff --git a/node/node-tests.ts b/node/node-tests.ts index 04166bc006..325b95f266 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -1265,6 +1265,12 @@ namespace readline_tests { return [['test'], 'test']; } }); + result = readline.createInterface({ + input: input, + completer: function(str: string, callback: (err: any, result: readline.CompleterResult) => void): any { + callback(null, [['test'], 'test']); + } + }); } { From 194de55441957216363799df3e647f0da475c9f3 Mon Sep 17 00:00:00 2001 From: DMan577 Date: Sun, 12 Mar 2017 09:21:11 +0200 Subject: [PATCH 087/374] Update index.d.ts --- xlsx/index.d.ts | 216 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 174 insertions(+), 42 deletions(-) diff --git a/xlsx/index.d.ts b/xlsx/index.d.ts index 4e4eb060f7..6af79112e8 100644 --- a/xlsx/index.d.ts +++ b/xlsx/index.d.ts @@ -3,9 +3,15 @@ // Definitions by: themauveavenger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/** Attempts to read filename and parse */ export declare function readFile(filename: string, opts?: IParsingOptions): IWorkBook; +/** Attempts to parse data */ export declare function read(data: any, opts?: IParsingOptions): IWorkBook; -export declare function write(data: any, opts?: IParsingOptions): any; +/** Attempts to write workbook data to filename */ +export declare function writeFile(data: IWorkBook, filename: string, opts?: IWritingOptions): any; +/** Attempts to write the workbook data */ +export declare function write(data: IWorkBook, opts?: IWritingOptions): any; + export declare var utils: IUtils; export interface IProperties { @@ -27,25 +33,125 @@ export interface IProperties { } export interface IParsingOptions { - cellFormula?: boolean; - cellHTML?: boolean; - cellNF?: boolean; - cellStyles?: boolean; - cellDates?: boolean; - sheetStubs?: boolean; - sheetRows?: number; - bookDeps?: boolean; - bookFiles?: boolean; - bookProps?: boolean; - bookSheets?: boolean; - bookVBA?: boolean; - password?: string; - bookType?: string; + /** + * Input data encoding + */ + type?: 'base64' | 'binary' | 'buffer' | 'array' | 'file'; /** - * Possible options: 'binary', 'base64', 'buffer', 'file' + * Save formulae to the .f field + * @default true */ - type?: string; + cellFormula?: boolean; + + /** + * Parse rich text and save HTML to the .h field + * @default true + */ + cellHTML?: boolean; + + /** + * Save number format string to the .z field + * @default false + */ + cellNF?: boolean; + + /** + * Save style/theme info to the .s field + * @default false + */ + cellStyles?: boolean; + + /** + * Store dates as type d (default is n) + * @default false + */ + cellDates?: boolean; + + /** + * Create cell objects for stub cells + * @default false + */ + sheetStubs?: boolean; + + /** + * If >0, read the first sheetRows rows + * @default 0 + */ + sheetRows?: number; + + /** + * If true, parse calculation chains + * @default false + */ + bookDeps?: boolean; + + /** + * If true, add raw files to book object + * @default false + */ + bookFiles?: boolean; + + /** + * If true, only parse enough to get book metadata + * @default false + */ + bookProps?: boolean; + + /** + * If true, only parse enough to get the sheet names + * @default false + */ + bookSheets?: boolean; + + /** + * If true, expose vbaProject.bin to vbaraw field + * @default false + */ + bookVBA?: boolean; + + /** + * If defined and file is encrypted, use password + * @default '' + */ + password?: string; +} + +export interface IWritingOptions { + /** + * Output data encoding + */ + type?: 'base64' | 'binary' | 'buffer' | 'file'; + + /** + * Store dates as type d (default is n) + * @default false + */ + cellDates?: boolean; + + /** + * Generate Shared String Table + * @default false + */ + bookSST?: boolean; + + /** + * Type of Workbook + * @default 'xlsx' + */ + bookType?: 'xlsx' | 'xlsm' | 'xlsb' | 'ods' | 'biff2' | 'fods' | 'csv'; + + /** + * Name of Worksheet for single-sheet formats + * @default '' + */ + sheet?: string; + + /** + * Use ZIP compression for ZIP-based formats + * @default false + */ + compression?: boolean; } export interface IWorkBook { @@ -75,19 +181,34 @@ export interface IWorkSheet { } export interface IWorkSheetCell { - /** - * The Excel Data Type of the cell. - * b Boolean, n Number, e error, s String, d Date - */ - t: string; - /** * The raw value of the cell. */ - v: string; + v: string | number | boolean | Date; /** - * rich text encoding (if applicable) + * Formatted text (if applicable) + */ + w?: string; + + /** + * The Excel Data Type of the cell. + * b Boolean, n Number, e error, s String, d Date + */ + t: 'b' | 'n' | 'e' | 's' | 'd'; + + /** + * Cell formula (if applicable) + */ + f?: string; + + /** + * Range of enclosing array if formula is array formula (if applicable) + */ + F?: string; + + /** + * Rich text encoding (if applicable) */ r?: string; @@ -97,56 +218,67 @@ export interface IWorkSheetCell { h?: string; /** - * formatted text (if applicable) - */ - w?: string; - - /** - * cell formula (if applicable) - */ - f?: string; - - /** - * comments associated with the cell ** + * Comments associated with the cell ** */ c?: string; /** - * number format string associated with the cell (if requested) + * Number format string associated with the cell (if requested) */ z?: string; /** - * cell hyperlink object (.Target holds link, .tooltip is tooltip) + * Cell hyperlink object (.Target holds link, .tooltip is tooltip) */ - l?: string; + l?: string | Object; /** - * the style/theme of the cell (if applicable) + * The style/theme of the cell (if applicable) */ s?: string; } export interface ICell { + /** Column number */ c: number; + /** Row number */ r: number; } export interface IRange { + /** Starting cell */ s: ICell; + /** Ending cell */ e: ICell; } export interface IUtils { + /** Converts a worksheet object to an array of JSON objects */ sheet_to_json(worksheet:IWorkSheet, opts?: { raw?: boolean; range?: any; header?: "A"|number|string[]; }):T[]; + /** Generates delimiter-separated-values output */ sheet_to_csv(worksheet: IWorkSheet, options?: { FS: string, RS: string }): string; + /** Generates a list of the formulae (with value fallbacks) */ sheet_to_formulae(worksheet: IWorkSheet):any; - encode_cell(cell: ICell): any; - encode_range(s: ICell, e: ICell): any; + + /** Converts 0-indexed cell address to A1 form */ + encode_cell(cell: ICell): string; + /** Converts 0-indexed row to A1 form */ + encode_row(row: number): string; + /** Converts 0-indexed column to A1 form */ + encode_col(col: number): string; + /** Converts 0-indexed range to A1 form */ + encode_range(s: ICell, e: ICell): string; + + /** Converts A1 cell address to 0-indexed form */ decode_cell(address: string): ICell; + /** Converts A1 row to 0-indexed form */ + decode_row(row: string): number; + /** Converts A1 column to 0-indexed form */ + decode_col(col: string): number; + /** Converts A1 range to 0-indexed form */ decode_range(range: string): IRange; } From 68d2209e33d8ad9373faf240be20e508dee03c1c Mon Sep 17 00:00:00 2001 From: Wayne Dela Cruz Date: Sun, 12 Mar 2017 17:56:40 +0800 Subject: [PATCH 088/374] Set compile target to es6 --- async/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/async/tsconfig.json b/async/tsconfig.json index 851293fccf..d02dd8ee4d 100644 --- a/async/tsconfig.json +++ b/async/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "target": "es6", "module": "commonjs", "lib": [ "es6" @@ -20,4 +21,4 @@ "test/index.ts", "test/explicit.ts" ] -} \ No newline at end of file +} From da7e47127b163fb19d067d73e2d4b2768bd12dad Mon Sep 17 00:00:00 2001 From: Wayne Dela Cruz Date: Sun, 12 Mar 2017 17:58:23 +0800 Subject: [PATCH 089/374] Collection functions accept IterableIterator --- async/index.d.ts | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/async/index.d.ts b/async/index.d.ts index e3fbe7e512..424eb3b935 100644 --- a/async/index.d.ts +++ b/async/index.d.ts @@ -91,34 +91,34 @@ interface AsyncCargo { interface Async { // Collections - each(arr: T[], iterator: AsyncIterator, callback?: ErrorCallback): void; + each(arr: T[] | IterableIterator, iterator: AsyncIterator, callback?: ErrorCallback): void; each(arr: Dictionary, iterator: AsyncIterator, callback?: ErrorCallback): void; eachSeries: typeof async.each; - eachLimit(arr: T[], limit: number, iterator: AsyncIterator, callback?: ErrorCallback): void; + eachLimit(arr: T[] | IterableIterator, limit: number, iterator: AsyncIterator, callback?: ErrorCallback): void; eachLimit(arr: Dictionary, limit: number, iterator: AsyncIterator, callback?: ErrorCallback): void; forEach: typeof async.each; forEachSeries: typeof async.each; forEachLimit: typeof async.eachLimit; - forEachOf(obj: T[], iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; + forEachOf(obj: T[] | IterableIterator, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; forEachOf(obj: Dictionary, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; forEachOfSeries: typeof async.forEachOf; - forEachOfLimit(obj: T[], limit: number, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; + forEachOfLimit(obj: T[] | IterableIterator, limit: number, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; forEachOfLimit(obj: Dictionary, limit: number, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; eachOf: typeof async.forEachOf; eachOfSeries: typeof async.forEachOf; eachOfLimit: typeof async.forEachOfLimit; - map(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + map(arr: T[] | IterableIterator, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; map(arr: Dictionary, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; mapSeries: typeof async.map; - mapLimit(arr: T[], limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + mapLimit(arr: T[] | IterableIterator, limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; mapLimit(arr: Dictionary, limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; mapValuesLimit(obj: Dictionary, limit: number, iteratee: (value: T, key: string, callback: AsyncResultCallback) => void, callback: AsyncResultObjectCallback): void; mapValues(obj: Dictionary, iteratee: (value: T, key: string, callback: AsyncResultCallback) => void, callback: AsyncResultObjectCallback): void; mapValuesSeries: typeof async.mapValues; - filter(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; + filter(arr: T[] | IterableIterator, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; filter(arr: Dictionary, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; filterSeries: typeof async.filter; - filterLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; + filterLimit(arr: T[] | IterableIterator, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; filterLimit(arr: Dictionary, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; select: typeof async.filter; selectSeries: typeof async.filter; @@ -126,38 +126,38 @@ interface Async { reject: typeof async.filter; rejectSeries: typeof async.filter; rejectLimit: typeof async.filterLimit; - reduce(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): void; + reduce(arr: T[] | IterableIterator, memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): void; inject: typeof async.reduce; foldl: typeof async.reduce; reduceRight: typeof async.reduce; foldr: typeof async.reduce; - detect(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; + detect(arr: T[] | IterableIterator, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; detect(arr: Dictionary, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; detectSeries: typeof async.detect; - detectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; + detectLimit(arr: T[] | IterableIterator, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; detectLimit(arr: Dictionary, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; find: typeof async.detect; findSeries: typeof async.detect; findLimit: typeof async.detectLimit; - sortBy(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; - some(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + sortBy(arr: T[] | IterableIterator, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + some(arr: T[] | IterableIterator, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; some(arr: Dictionary, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; someSeries: typeof async.some; - someLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + someLimit(arr: T[] | IterableIterator, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; someLimit(arr: Dictionary, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; any: typeof async.some; anySeries: typeof async.someSeries; anyLimit: typeof async.someLimit; - every(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + every(arr: T[] | IterableIterator, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; every(arr: Dictionary, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; everySeries: typeof async.every; - everyLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + everyLimit(arr: T[] | IterableIterator, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; everyLimit(arr: Dictionary, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; all: typeof async.every; allSeries: typeof async.every; allLimit: typeof async.everyLimit; - concat(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + concat(arr: T[] | IterableIterator, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; concat(arr: Dictionary, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; concatSeries: typeof async.concat; From ea071735a0adf6d9e183c75ae51e2c8345a7bac2 Mon Sep 17 00:00:00 2001 From: Wayne Dela Cruz Date: Sun, 12 Mar 2017 18:11:56 +0800 Subject: [PATCH 090/374] Create files for testing generators --- async/test/es6-generators.ts | 0 async/tsconfig.json | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 async/test/es6-generators.ts diff --git a/async/test/es6-generators.ts b/async/test/es6-generators.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/async/tsconfig.json b/async/tsconfig.json index d02dd8ee4d..787f7207f9 100644 --- a/async/tsconfig.json +++ b/async/tsconfig.json @@ -19,6 +19,7 @@ "files": [ "index.d.ts", "test/index.ts", - "test/explicit.ts" + "test/explicit.ts", + "test/es6-generators.ts" ] } From d5104ae56383a99d9df4a464240e0de6fb9800f6 Mon Sep 17 00:00:00 2001 From: Wayne Dela Cruz Date: Sun, 12 Mar 2017 18:12:12 +0800 Subject: [PATCH 091/374] Create tests for map functions --- async/test/es6-generators.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/async/test/es6-generators.ts b/async/test/es6-generators.ts index e69de29bb2..2068f480b3 100644 --- a/async/test/es6-generators.ts +++ b/async/test/es6-generators.ts @@ -0,0 +1,8 @@ +function* funcCollection(): IterableIterator { } + +function funcMapIterator(value: T, callback: AsyncResultCallback) { } +function funcMapComplete(error: E, results: T[]) { } + +async.map(funcCollection(), funcMapIterator, funcMapComplete) +async.mapSeries(funcCollection(), funcMapIterator, funcMapComplete) +async.mapLimit(funcCollection(), 2, funcMapIterator, funcMapComplete) From 44063a39a648f6131aae9fbb66b063474d091c18 Mon Sep 17 00:00:00 2001 From: Wayne Dela Cruz Date: Sun, 12 Mar 2017 18:23:07 +0800 Subject: [PATCH 092/374] Create tests for filters, selects, and rejects * filter * filterSeries * filterLimit * select * selectSeries * selectLimit * reject * rejectSeries * rejectLimit --- async/test/es6-generators.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/async/test/es6-generators.ts b/async/test/es6-generators.ts index 2068f480b3..be48e652b4 100644 --- a/async/test/es6-generators.ts +++ b/async/test/es6-generators.ts @@ -3,6 +3,19 @@ function* funcCollection(): IterableIterator { } function funcMapIterator(value: T, callback: AsyncResultCallback) { } function funcMapComplete(error: E, results: T[]) { } +function funcCbErrBoolean(v: T, cb: (err: Error, res: boolean) => void) { } + async.map(funcCollection(), funcMapIterator, funcMapComplete) async.mapSeries(funcCollection(), funcMapIterator, funcMapComplete) async.mapLimit(funcCollection(), 2, funcMapIterator, funcMapComplete) + +async.filter(funcCollection(), funcCbErrBoolean, function (err: Error, results: any[]) { }) +async.filterSeries(funcCollection(), funcCbErrBoolean, function (err: Error, results: any[]) { }) +async.filterLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, results: any[]) { }) +async.select(funcCollection(), funcCbErrBoolean, function (err: Error, results: any[]) { }) +async.selectSeries(funcCollection(), funcCbErrBoolean, function (err: Error, results: any[]) { }) +async.selectLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, results: any[]) { }) + +async.reject(funcCollection(), funcCbErrBoolean, function (err: Error, results: any[]) { }) +async.rejectSeries(funcCollection(), funcCbErrBoolean, function (err: Error, results: any[]) { }) +async.rejectLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, results: any[]) { }) From 2b867f834a5b9317ef052fd45cc8ff562639e9fd Mon Sep 17 00:00:00 2001 From: Wayne Dela Cruz Date: Sun, 12 Mar 2017 20:03:07 +0800 Subject: [PATCH 093/374] Create tests for each and eachOf, etc. --- async/test/es6-generators.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/async/test/es6-generators.ts b/async/test/es6-generators.ts index be48e652b4..dfb7840737 100644 --- a/async/test/es6-generators.ts +++ b/async/test/es6-generators.ts @@ -5,6 +5,9 @@ function funcMapComplete(error: E, results: T[]) { } function funcCbErrBoolean(v: T, cb: (err: Error, res: boolean) => void) { } +function eachIterator(item: T, callback: (err: Error) => void) { } +function eachOfIterator(item: T, key: K, callback: (err: Error) => void) { } + async.map(funcCollection(), funcMapIterator, funcMapComplete) async.mapSeries(funcCollection(), funcMapIterator, funcMapComplete) async.mapLimit(funcCollection(), 2, funcMapIterator, funcMapComplete) @@ -19,3 +22,16 @@ async.selectLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, r async.reject(funcCollection(), funcCbErrBoolean, function (err: Error, results: any[]) { }) async.rejectSeries(funcCollection(), funcCbErrBoolean, function (err: Error, results: any[]) { }) async.rejectLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, results: any[]) { }) + +async.each(funcCollection(), eachIterator, function (err: Error) { }) +async.eachLimit(funcCollection(), 2, eachIterator, function (err: Error) { }) +async.eachSeries(funcCollection(), eachIterator, function (err: Error) { }) +async.eachOf(funcCollection(), eachOfIterator, function (err: Error) { }) +async.eachOfLimit(funcCollection(), 2, eachOfIterator, function (err: Error) { }) +async.eachOfSeries(funcCollection(), eachOfIterator, function (err: Error) { }) +async.forEach(funcCollection(), eachIterator, function (err: Error) { }) +async.forEachLimit(funcCollection(), 2, eachIterator, function (err: Error) { }) +async.forEachSeries(funcCollection(), eachIterator, function (err: Error) { }) +async.forEachOf(funcCollection(), eachOfIterator, function (err: Error) { }) +async.forEachOfLimit(funcCollection(), 2, eachOfIterator, function (err: Error) { }) +async.forEachOfSeries(funcCollection(), eachOfIterator, function (err: Error) { }) From 393e69180f2b36318299b4abb4607f53054b2fac Mon Sep 17 00:00:00 2001 From: Wayne Dela Cruz Date: Sun, 12 Mar 2017 20:22:26 +0800 Subject: [PATCH 094/374] Create tests for every, everyLimit, everySeries --- async/test/es6-generators.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/async/test/es6-generators.ts b/async/test/es6-generators.ts index dfb7840737..7a85ed5ff3 100644 --- a/async/test/es6-generators.ts +++ b/async/test/es6-generators.ts @@ -35,3 +35,7 @@ async.forEachSeries(funcCollection(), eachIterator, function (err: Error) { }) async.forEachOf(funcCollection(), eachOfIterator, function (err: Error) { }) async.forEachOfLimit(funcCollection(), 2, eachOfIterator, function (err: Error) { }) async.forEachOfSeries(funcCollection(), eachOfIterator, function (err: Error) { }) + +async.every(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) +async.everyLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, res: boolean) { }) +async.everySeries(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) From 1ebd2d32fc57d5c65e26042588c9a75ad04bf819 Mon Sep 17 00:00:00 2001 From: Wayne Dela Cruz Date: Sun, 12 Mar 2017 20:25:10 +0800 Subject: [PATCH 095/374] Create tests for some, someLimit, someSeries --- async/test/es6-generators.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/async/test/es6-generators.ts b/async/test/es6-generators.ts index 7a85ed5ff3..b14d1baf23 100644 --- a/async/test/es6-generators.ts +++ b/async/test/es6-generators.ts @@ -39,3 +39,7 @@ async.forEachOfSeries(funcCollection(), eachOfIterator, function (err: Error) { async.every(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) async.everyLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, res: boolean) { }) async.everySeries(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) + +async.some(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) +async.someLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, res: boolean) { }) +async.someSeries(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) From c33147893d94874e715fb13214f5ac2b1d262f77 Mon Sep 17 00:00:00 2001 From: Wayne Dela Cruz Date: Sun, 12 Mar 2017 20:27:14 +0800 Subject: [PATCH 096/374] Create tests for detect, detectLimit, detectSeries --- async/test/es6-generators.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/async/test/es6-generators.ts b/async/test/es6-generators.ts index b14d1baf23..65b97909d0 100644 --- a/async/test/es6-generators.ts +++ b/async/test/es6-generators.ts @@ -43,3 +43,7 @@ async.everySeries(funcCollection(), funcCbErrBoolean, function (err: Error, res: async.some(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) async.someLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, res: boolean) { }) async.someSeries(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) + +async.detect(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) +async.detectLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, res: boolean) { }) +async.detectSeries(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) From 54fb7a9dd321a37820d41783c0ac70c75f6e4d19 Mon Sep 17 00:00:00 2001 From: Wayne Dela Cruz Date: Sun, 12 Mar 2017 20:38:23 +0800 Subject: [PATCH 097/374] Create test for concat --- async/test/es6-generators.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/async/test/es6-generators.ts b/async/test/es6-generators.ts index 65b97909d0..721ae2e78c 100644 --- a/async/test/es6-generators.ts +++ b/async/test/es6-generators.ts @@ -8,6 +8,8 @@ function funcCbErrBoolean(v: T, cb: (err: Error, res: boolean) => void) { } function eachIterator(item: T, callback: (err: Error) => void) { } function eachOfIterator(item: T, key: K, callback: (err: Error) => void) { } +function concatIterator(item: T, callback: (err: E, res: R[]) => void) { } + async.map(funcCollection(), funcMapIterator, funcMapComplete) async.mapSeries(funcCollection(), funcMapIterator, funcMapComplete) async.mapLimit(funcCollection(), 2, funcMapIterator, funcMapComplete) @@ -47,3 +49,6 @@ async.someSeries(funcCollection(), funcCbErrBoolean, function (err: Error, res: async.detect(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) async.detectLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, res: boolean) { }) async.detectSeries(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) + +async.concat(funcCollection(), concatIterator, (err: Error, res) => { }) +async.concatSeries(funcCollection(), concatIterator, (err: Error, res) => { }) From 7f38aadb264590c92cbd6fd590ca2e2decab3a8a Mon Sep 17 00:00:00 2001 From: Wayne Dela Cruz Date: Sun, 12 Mar 2017 20:39:32 +0800 Subject: [PATCH 098/374] Rename funcCbErrBoolean to booleanIterator This is so that the naming styles are more uniform --- async/test/es6-generators.ts | 38 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/async/test/es6-generators.ts b/async/test/es6-generators.ts index 721ae2e78c..f269902b60 100644 --- a/async/test/es6-generators.ts +++ b/async/test/es6-generators.ts @@ -3,7 +3,7 @@ function* funcCollection(): IterableIterator { } function funcMapIterator(value: T, callback: AsyncResultCallback) { } function funcMapComplete(error: E, results: T[]) { } -function funcCbErrBoolean(v: T, cb: (err: Error, res: boolean) => void) { } +function booleanIterator(v: T, cb: (err: Error, res: boolean) => void) { } function eachIterator(item: T, callback: (err: Error) => void) { } function eachOfIterator(item: T, key: K, callback: (err: Error) => void) { } @@ -14,16 +14,16 @@ async.map(funcCollection(), funcMapIterator, funcMapComplete) async.mapSeries(funcCollection(), funcMapIterator, funcMapComplete) async.mapLimit(funcCollection(), 2, funcMapIterator, funcMapComplete) -async.filter(funcCollection(), funcCbErrBoolean, function (err: Error, results: any[]) { }) -async.filterSeries(funcCollection(), funcCbErrBoolean, function (err: Error, results: any[]) { }) -async.filterLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, results: any[]) { }) -async.select(funcCollection(), funcCbErrBoolean, function (err: Error, results: any[]) { }) -async.selectSeries(funcCollection(), funcCbErrBoolean, function (err: Error, results: any[]) { }) -async.selectLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, results: any[]) { }) +async.filter(funcCollection(), booleanIterator, function (err: Error, results: any[]) { }) +async.filterSeries(funcCollection(), booleanIterator, function (err: Error, results: any[]) { }) +async.filterLimit(funcCollection(), 2, booleanIterator, function (err: Error, results: any[]) { }) +async.select(funcCollection(), booleanIterator, function (err: Error, results: any[]) { }) +async.selectSeries(funcCollection(), booleanIterator, function (err: Error, results: any[]) { }) +async.selectLimit(funcCollection(), 2, booleanIterator, function (err: Error, results: any[]) { }) -async.reject(funcCollection(), funcCbErrBoolean, function (err: Error, results: any[]) { }) -async.rejectSeries(funcCollection(), funcCbErrBoolean, function (err: Error, results: any[]) { }) -async.rejectLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, results: any[]) { }) +async.reject(funcCollection(), booleanIterator, function (err: Error, results: any[]) { }) +async.rejectSeries(funcCollection(), booleanIterator, function (err: Error, results: any[]) { }) +async.rejectLimit(funcCollection(), 2, booleanIterator, function (err: Error, results: any[]) { }) async.each(funcCollection(), eachIterator, function (err: Error) { }) async.eachLimit(funcCollection(), 2, eachIterator, function (err: Error) { }) @@ -38,17 +38,17 @@ async.forEachOf(funcCollection(), eachOfIterator, function (err: Error) { }) async.forEachOfLimit(funcCollection(), 2, eachOfIterator, function (err: Error) { }) async.forEachOfSeries(funcCollection(), eachOfIterator, function (err: Error) { }) -async.every(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) -async.everyLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, res: boolean) { }) -async.everySeries(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) +async.every(funcCollection(), booleanIterator, function (err: Error, res: boolean) { }) +async.everyLimit(funcCollection(), 2, booleanIterator, function (err: Error, res: boolean) { }) +async.everySeries(funcCollection(), booleanIterator, function (err: Error, res: boolean) { }) -async.some(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) -async.someLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, res: boolean) { }) -async.someSeries(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) +async.some(funcCollection(), booleanIterator, function (err: Error, res: boolean) { }) +async.someLimit(funcCollection(), 2, booleanIterator, function (err: Error, res: boolean) { }) +async.someSeries(funcCollection(), booleanIterator, function (err: Error, res: boolean) { }) -async.detect(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) -async.detectLimit(funcCollection(), 2, funcCbErrBoolean, function (err: Error, res: boolean) { }) -async.detectSeries(funcCollection(), funcCbErrBoolean, function (err: Error, res: boolean) { }) +async.detect(funcCollection(), booleanIterator, function (err: Error, res: boolean) { }) +async.detectLimit(funcCollection(), 2, booleanIterator, function (err: Error, res: boolean) { }) +async.detectSeries(funcCollection(), booleanIterator, function (err: Error, res: boolean) { }) async.concat(funcCollection(), concatIterator, (err: Error, res) => { }) async.concatSeries(funcCollection(), concatIterator, (err: Error, res) => { }) From a36360d8adb31eddb8e5a1304b4bf50cad814f62 Mon Sep 17 00:00:00 2001 From: Wayne Dela Cruz Date: Sun, 12 Mar 2017 20:40:35 +0800 Subject: [PATCH 099/374] Rename funcCollection to collectionGenerator This makes the purpose of the function more easily understood --- async/test/es6-generators.ts | 72 ++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/async/test/es6-generators.ts b/async/test/es6-generators.ts index f269902b60..998a1823e5 100644 --- a/async/test/es6-generators.ts +++ b/async/test/es6-generators.ts @@ -1,4 +1,4 @@ -function* funcCollection(): IterableIterator { } +function* collectionGenerator(): IterableIterator { } function funcMapIterator(value: T, callback: AsyncResultCallback) { } function funcMapComplete(error: E, results: T[]) { } @@ -10,45 +10,45 @@ function eachOfIterator(item: T, key: K, callback: (err: Error) => void function concatIterator(item: T, callback: (err: E, res: R[]) => void) { } -async.map(funcCollection(), funcMapIterator, funcMapComplete) -async.mapSeries(funcCollection(), funcMapIterator, funcMapComplete) -async.mapLimit(funcCollection(), 2, funcMapIterator, funcMapComplete) +async.map(collectionGenerator(), funcMapIterator, funcMapComplete) +async.mapSeries(collectionGenerator(), funcMapIterator, funcMapComplete) +async.mapLimit(collectionGenerator(), 2, funcMapIterator, funcMapComplete) -async.filter(funcCollection(), booleanIterator, function (err: Error, results: any[]) { }) -async.filterSeries(funcCollection(), booleanIterator, function (err: Error, results: any[]) { }) -async.filterLimit(funcCollection(), 2, booleanIterator, function (err: Error, results: any[]) { }) -async.select(funcCollection(), booleanIterator, function (err: Error, results: any[]) { }) -async.selectSeries(funcCollection(), booleanIterator, function (err: Error, results: any[]) { }) -async.selectLimit(funcCollection(), 2, booleanIterator, function (err: Error, results: any[]) { }) +async.filter(collectionGenerator(), booleanIterator, function (err: Error, results: any[]) { }) +async.filterSeries(collectionGenerator(), booleanIterator, function (err: Error, results: any[]) { }) +async.filterLimit(collectionGenerator(), 2, booleanIterator, function (err: Error, results: any[]) { }) +async.select(collectionGenerator(), booleanIterator, function (err: Error, results: any[]) { }) +async.selectSeries(collectionGenerator(), booleanIterator, function (err: Error, results: any[]) { }) +async.selectLimit(collectionGenerator(), 2, booleanIterator, function (err: Error, results: any[]) { }) -async.reject(funcCollection(), booleanIterator, function (err: Error, results: any[]) { }) -async.rejectSeries(funcCollection(), booleanIterator, function (err: Error, results: any[]) { }) -async.rejectLimit(funcCollection(), 2, booleanIterator, function (err: Error, results: any[]) { }) +async.reject(collectionGenerator(), booleanIterator, function (err: Error, results: any[]) { }) +async.rejectSeries(collectionGenerator(), booleanIterator, function (err: Error, results: any[]) { }) +async.rejectLimit(collectionGenerator(), 2, booleanIterator, function (err: Error, results: any[]) { }) -async.each(funcCollection(), eachIterator, function (err: Error) { }) -async.eachLimit(funcCollection(), 2, eachIterator, function (err: Error) { }) -async.eachSeries(funcCollection(), eachIterator, function (err: Error) { }) -async.eachOf(funcCollection(), eachOfIterator, function (err: Error) { }) -async.eachOfLimit(funcCollection(), 2, eachOfIterator, function (err: Error) { }) -async.eachOfSeries(funcCollection(), eachOfIterator, function (err: Error) { }) -async.forEach(funcCollection(), eachIterator, function (err: Error) { }) -async.forEachLimit(funcCollection(), 2, eachIterator, function (err: Error) { }) -async.forEachSeries(funcCollection(), eachIterator, function (err: Error) { }) -async.forEachOf(funcCollection(), eachOfIterator, function (err: Error) { }) -async.forEachOfLimit(funcCollection(), 2, eachOfIterator, function (err: Error) { }) -async.forEachOfSeries(funcCollection(), eachOfIterator, function (err: Error) { }) +async.each(collectionGenerator(), eachIterator, function (err: Error) { }) +async.eachLimit(collectionGenerator(), 2, eachIterator, function (err: Error) { }) +async.eachSeries(collectionGenerator(), eachIterator, function (err: Error) { }) +async.eachOf(collectionGenerator(), eachOfIterator, function (err: Error) { }) +async.eachOfLimit(collectionGenerator(), 2, eachOfIterator, function (err: Error) { }) +async.eachOfSeries(collectionGenerator(), eachOfIterator, function (err: Error) { }) +async.forEach(collectionGenerator(), eachIterator, function (err: Error) { }) +async.forEachLimit(collectionGenerator(), 2, eachIterator, function (err: Error) { }) +async.forEachSeries(collectionGenerator(), eachIterator, function (err: Error) { }) +async.forEachOf(collectionGenerator(), eachOfIterator, function (err: Error) { }) +async.forEachOfLimit(collectionGenerator(), 2, eachOfIterator, function (err: Error) { }) +async.forEachOfSeries(collectionGenerator(), eachOfIterator, function (err: Error) { }) -async.every(funcCollection(), booleanIterator, function (err: Error, res: boolean) { }) -async.everyLimit(funcCollection(), 2, booleanIterator, function (err: Error, res: boolean) { }) -async.everySeries(funcCollection(), booleanIterator, function (err: Error, res: boolean) { }) +async.every(collectionGenerator(), booleanIterator, function (err: Error, res: boolean) { }) +async.everyLimit(collectionGenerator(), 2, booleanIterator, function (err: Error, res: boolean) { }) +async.everySeries(collectionGenerator(), booleanIterator, function (err: Error, res: boolean) { }) -async.some(funcCollection(), booleanIterator, function (err: Error, res: boolean) { }) -async.someLimit(funcCollection(), 2, booleanIterator, function (err: Error, res: boolean) { }) -async.someSeries(funcCollection(), booleanIterator, function (err: Error, res: boolean) { }) +async.some(collectionGenerator(), booleanIterator, function (err: Error, res: boolean) { }) +async.someLimit(collectionGenerator(), 2, booleanIterator, function (err: Error, res: boolean) { }) +async.someSeries(collectionGenerator(), booleanIterator, function (err: Error, res: boolean) { }) -async.detect(funcCollection(), booleanIterator, function (err: Error, res: boolean) { }) -async.detectLimit(funcCollection(), 2, booleanIterator, function (err: Error, res: boolean) { }) -async.detectSeries(funcCollection(), booleanIterator, function (err: Error, res: boolean) { }) +async.detect(collectionGenerator(), booleanIterator, function (err: Error, res: boolean) { }) +async.detectLimit(collectionGenerator(), 2, booleanIterator, function (err: Error, res: boolean) { }) +async.detectSeries(collectionGenerator(), booleanIterator, function (err: Error, res: boolean) { }) -async.concat(funcCollection(), concatIterator, (err: Error, res) => { }) -async.concatSeries(funcCollection(), concatIterator, (err: Error, res) => { }) +async.concat(collectionGenerator(), concatIterator, (err: Error, res) => { }) +async.concatSeries(collectionGenerator(), concatIterator, (err: Error, res) => { }) From 7e7c310f87207c3dc005bee3639f96c186eab033 Mon Sep 17 00:00:00 2001 From: Wayne Dela Cruz Date: Sun, 12 Mar 2017 20:53:01 +0800 Subject: [PATCH 100/374] Remove no-implicit-any errors --- async/test/es6-generators.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/async/test/es6-generators.ts b/async/test/es6-generators.ts index 998a1823e5..2a7328a09a 100644 --- a/async/test/es6-generators.ts +++ b/async/test/es6-generators.ts @@ -50,5 +50,5 @@ async.detect(collectionGenerator(), booleanIterator, function (err: Error, res: async.detectLimit(collectionGenerator(), 2, booleanIterator, function (err: Error, res: boolean) { }) async.detectSeries(collectionGenerator(), booleanIterator, function (err: Error, res: boolean) { }) -async.concat(collectionGenerator(), concatIterator, (err: Error, res) => { }) -async.concatSeries(collectionGenerator(), concatIterator, (err: Error, res) => { }) +async.concat(collectionGenerator(), concatIterator, (err: Error, res: any[]) => { }) +async.concatSeries(collectionGenerator(), concatIterator, (err: Error, res: any[]) => { }) From 2c270dee7720720459599e136f86c522b00024d3 Mon Sep 17 00:00:00 2001 From: Flavien Charlon Date: Sun, 12 Mar 2017 15:20:37 +0000 Subject: [PATCH 101/374] Ensure the HelloSign object can be imported --- hellosign-embedded/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hellosign-embedded/index.d.ts b/hellosign-embedded/index.d.ts index ec77a92b92..a290a6c508 100644 --- a/hellosign-embedded/index.d.ts +++ b/hellosign-embedded/index.d.ts @@ -268,3 +268,5 @@ declare module HelloSign { } declare var HelloSign: HelloSign.HelloSignStatic; + +export = HelloSign; From e349d2591137d677ea424d37fd7ac9a76a2d7ed7 Mon Sep 17 00:00:00 2001 From: Flavien Charlon Date: Sun, 12 Mar 2017 17:50:02 +0000 Subject: [PATCH 102/374] Update the tests for the hellosign-embedded types --- hellosign-embedded/hellosign-embedded-tests.ts | 2 ++ hellosign-embedded/index.d.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hellosign-embedded/hellosign-embedded-tests.ts b/hellosign-embedded/hellosign-embedded-tests.ts index 281bbef2ab..0ae16b73fa 100644 --- a/hellosign-embedded/hellosign-embedded-tests.ts +++ b/hellosign-embedded/hellosign-embedded-tests.ts @@ -1,3 +1,5 @@ +import HelloSign from 'hellosign-embedded'; + HelloSign.init('abc123'); // some options diff --git a/hellosign-embedded/index.d.ts b/hellosign-embedded/index.d.ts index a290a6c508..db96673cd7 100644 --- a/hellosign-embedded/index.d.ts +++ b/hellosign-embedded/index.d.ts @@ -269,4 +269,4 @@ declare module HelloSign { declare var HelloSign: HelloSign.HelloSignStatic; -export = HelloSign; +export default HelloSign; From f53a8097259619551288716f1a29649f32cd78ac Mon Sep 17 00:00:00 2001 From: Flavien Charlon Date: Sun, 12 Mar 2017 18:07:59 +0000 Subject: [PATCH 103/374] Fix an export issue --- hellosign-embedded/hellosign-embedded-tests.ts | 2 +- hellosign-embedded/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hellosign-embedded/hellosign-embedded-tests.ts b/hellosign-embedded/hellosign-embedded-tests.ts index 0ae16b73fa..1ca8f3aafd 100644 --- a/hellosign-embedded/hellosign-embedded-tests.ts +++ b/hellosign-embedded/hellosign-embedded-tests.ts @@ -1,4 +1,4 @@ -import HelloSign from 'hellosign-embedded'; +import HelloSign = require('hellosign-embedded'); HelloSign.init('abc123'); diff --git a/hellosign-embedded/index.d.ts b/hellosign-embedded/index.d.ts index db96673cd7..a290a6c508 100644 --- a/hellosign-embedded/index.d.ts +++ b/hellosign-embedded/index.d.ts @@ -269,4 +269,4 @@ declare module HelloSign { declare var HelloSign: HelloSign.HelloSignStatic; -export default HelloSign; +export = HelloSign; From b39d713ac0095831075c9a5b5828c4e76f05bf5d Mon Sep 17 00:00:00 2001 From: Kalle Ott Date: Mon, 13 Mar 2017 10:32:27 +0100 Subject: [PATCH 104/374] added details to Grid and Table class fixed type infos for cache removed some private props --- react-virtualized/index.d.ts | 109 +++++++++++++++++++++-------------- 1 file changed, 66 insertions(+), 43 deletions(-) diff --git a/react-virtualized/index.d.ts b/react-virtualized/index.d.ts index 1994466f8c..f89183c90f 100644 --- a/react-virtualized/index.d.ts +++ b/react-virtualized/index.d.ts @@ -26,19 +26,7 @@ export interface AutoSizerProps { export class AutoSizer extends React.PureComponent { } export interface CellMeasurerProps { - cellRenderer: (info: { columnIndex: number, rowIndex: number }) => React.ReactNode; - cellSizeCache?: { - clearAllColumnWidths(): void; - clearAllRowHeights(): void; - clearColumnWidth(index: number): void; - clearRowHeight(index: number): void; - getColumnWidth(index: number): number; - getRowHeight(index: number): number; - hasColumnWidth(index: number): boolean; - hasRowHeight(index: number): boolean; - setColumnWidth(index: number, width: number): void; - setRowHeight(index: number, height: number): void; - }; + cache?: CellMeasurerCache; children?: React.StatelessComponent<{ getColumnWidth: () => number, getRowHeight: () => number, @@ -46,11 +34,10 @@ export interface CellMeasurerProps { resetMeasurementsForColumn: (index: number) => any, resetMeasurementsForRow: (index: number) => any, }>; - columnCount: number; - container?: React.ReactType; - height?: number; - rowCount: number; - width?: number; + columnIndex: number; + parent?: React.ReactType; + rowIndex: number; + style?: React.CSSProperties; } export class CellMeasurer extends React.PureComponent { } @@ -74,17 +61,6 @@ export type CellMeasurerCacheParams = { keyMapper?: KeyMapper } export class CellMeasurerCache { - _cellHeightCache: Cache; - _cellWidthCache: Cache; - _columnWidthCache: Cache; - _defaultHeight?: number; - _defaultWidth?: number; - _minHeight?: number; - _minWidth?: number; - _keyMapper: KeyMapper; - _rowHeightCache: Cache; - _hasFixedHeight: boolean; - _hasFixedWidth: boolean; constructor(params: CellMeasurerCacheParams); clear( rowIndex: number, @@ -113,10 +89,6 @@ export class CellMeasurerCache { width: number, height: number ): void; - _updateCachedColumnAndRowSizes( - rowIndex: number, - columnIndex: number - ): void; } export type CollectionCellSizeAndPosition = { height: number, width: number, x: number, y: number }; @@ -220,8 +192,17 @@ export interface ColumnProps { } export class Column extends React.Component { } +export type RowClickHandlerParams = { + rowData: { + columnData: Object, + id: string, + index: number + } +} + // ref: https://github.com/bvaughn/react-virtualized/blob/master/docs/Table.md export interface TableProps { + deferredMeasurementCache?: CellMeasurerCache; autoHeight?: boolean; children?: React.ReactChildren; className?: string; @@ -232,15 +213,15 @@ export interface TableProps { headerClassName?: string; headerHeight: number; headerStyle?: any; - height: number; + height?: number; id?: string; noRowsRender?: () => void; onHeaderClick?: (dataKey: string, columnData: any) => void; - onRowClick?: (info: IndexParam) => void; - onRowDoubleClick?: (info: IndexParam) => void; - onRowMouseOut?: (info: IndexParam) => void; - onRowMouseOver?: (info: IndexParam) => void; - onRowsRendered?: (info: IndexParam) => void; + onRowClick?: (info: RowClickHandlerParams) => void; + onRowDoubleClick?: (info: RowClickHandlerParams) => void; + onRowMouseOut?: (info: RowClickHandlerParams) => void; + onRowMouseOver?: (info: RowClickHandlerParams) => void; + onRowsRendered?: (info: RowClickHandlerParams) => void; overscanRowCount?: number; onScroll?: (info: { clientHeight: number, scrollHeight: number, scrollTop: number }) => void; rowClassName?: string | ((info: IndexParam) => string); @@ -258,9 +239,18 @@ export interface TableProps { sortDirection?: SortDirectionType; style?: React.CSSProperties; tabIndex?: number; - width: number; + width?: number; +} +export class Table extends React.PureComponent { + forceUpdateGrid(): void; + /** See Grid#measureAllCells */ + measureAllRows(): void; + /** See Grid#recomputeGridSize */ + recomputeRowHeights(index?: number): void; + /** See Grid#scrollToCell */ + scrollToRow(index?: number): void; + Grid: Grid; } -export class Table extends React.PureComponent { } export const defaultTableCellDataGetter: TableCellDataGetter; export const defaultTableCellRenderer: TableCellRenderer; @@ -418,7 +408,7 @@ export type GridProps = { columnCount: number; columnWidth: number | ((params: IndexParam) => number); containerStyle?: React.CSSProperties; - deferredMeasurementCache?: Object; + deferredMeasurementCache?: CellMeasurerCache; estimatedColumnSize?: number; estimatedRowSize?: number; getScrollbarSize?: () => number; @@ -448,7 +438,40 @@ export type GridProps = { tabIndex?: number; width: number; }; -export class Grid extends React.PureComponent { } +export class Grid extends React.PureComponent { + /** + * Invalidate Grid size and recompute visible cells. + * This is a deferred wrapper for recomputeGridSize(). + * It sets a flag to be evaluated on cDM/cDU to avoid unnecessary renders. + * This method is intended for advanced use-cases like CellMeasurer. + */ + invalidateCellSizeAfterRender(params: { + columnIndex: number, + rowIndex: number + }): void; + /** + * Pre-measure all columns and rows in a Grid. + * Typically cells are only measured as needed and estimated sizes are used for cells that have not yet been measured. + * This method ensures that the next call to getTotalSize() returns an exact size (as opposed to just an estimated one). + */ + measureAllCells(): void; + /** + * Forced recompute of row heights and column widths. + * This function should be called if dynamic column or row sizes have changed but nothing else has. + * Since Grid only receives :columnCount and :rowCount it has no way of detecting when the underlying data changes. + */ + recomputeGridSize(params?: { + columnIndex?: number, + rowIndex?: number + }): void; + /** + * Ensure column and row are visible. + */ + scrollToCell(params: { + columnIndex: number, + rowIndex: number + }): void; +} export type InfiniteLoaderProps = { children?: React.StatelessComponent<{ From 58fb00ab113c8e40d3975a791dbfd12acd911981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Mon, 13 Mar 2017 19:41:52 +0900 Subject: [PATCH 105/374] class Socket extends EventEmitter https://github.com/socketio/socket.io/blob/master/lib/socket.js#L81 --- socket.io/index.d.ts | 60 +------------------------------------------- 1 file changed, 1 insertion(+), 59 deletions(-) diff --git a/socket.io/index.d.ts b/socket.io/index.d.ts index 2333dc8fe2..f6c94363ec 100644 --- a/socket.io/index.d.ts +++ b/socket.io/index.d.ts @@ -472,7 +472,7 @@ declare namespace SocketIO { * as we have a problem with the emit() event (as it's overridden with a * different return) */ - interface Socket { + interface Socket extends NodeJS.EventEmitter{ /** * The namespace that this socket is for @@ -613,17 +613,6 @@ declare namespace SocketIO { */ broadcast: Socket; - /** - * Emits an event to this client. If the 'broadcast' flag was set, this will - * emit to all other clients, except for this one - * @param event The event that we want to emit - * @param args Any number of optional arguments to pass with the event. If the - * last argument is a function, it will be called as an ack. The ack should - * take whatever data was sent with the packet - * @return This Socket - */ - emit( event: string, ...args: any[]): Socket; - /** * Targets a room when broadcasting * @param room The name of the room that we're targeting @@ -677,53 +666,6 @@ declare namespace SocketIO { */ disconnect( close?: boolean ): Socket; - /** - * Adds a listener for a particular event. Calling multiple times will add - * multiple listeners - * @param event The event that we're listening for - * @param fn The function to call when we get the event. Parameters depend on the - * event in question - * @return This Socket - */ - on( event: string, fn: Function ): Socket; - - /** - * @see on( event, fn ) - */ - addListener( event: string, fn: Function ): Socket; - - /** - * Adds a listener for a particular event that will be invoked - * a single time before being automatically removed - * @param event The event that we're listening for - * @param fn The function to call when we get the event. Parameters depend on - * the event in question - * @return This Socket - */ - once( event: string, fn: Function ): Socket; - - /** - * Removes a listener for a particular type of event. This will either - * remove a specific listener, or all listeners for this type of event - * @param event The event that we want to remove the listener of - * @param fn The function to remove, or null if we want to remove all functions - * @return This Socket - */ - removeListener( event: string, fn?: Function ): Socket; - - /** - * Removes all event listeners on this object - * @return This Socket - */ - removeAllListeners( event?: string ): Socket; - - /** - * Sets the maximum number of listeners this instance can have - * @param n The max number of listeners we can add to this emitter - * @return This Socket - */ - setMaxListeners( n: number ): Socket; - /** * Returns all the callbacks for a particular event * @param event The event that we're looking for the callbacks of From f133fc0c1e9f34236a2caa0c79570b1bd25c7895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Mon, 13 Mar 2017 19:46:15 +0900 Subject: [PATCH 106/374] Client#conn, Socket#conn is an instance of engine.Socket, including properties "request" and "upgraded". https://github.com/socketio/socket.io/blob/master/docs/API.md#socketconn https://github.com/socketio/socket.io/blob/master/docs/API.md#clientconn https://github.com/socketio/engine.io#properties-2 --- socket.io/index.d.ts | 86 ++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 44 deletions(-) diff --git a/socket.io/index.d.ts b/socket.io/index.d.ts index f6c94363ec..8e2ec2aade 100644 --- a/socket.io/index.d.ts +++ b/socket.io/index.d.ts @@ -509,28 +509,7 @@ declare namespace SocketIO { /** * The underlying Engine.io Socket instance */ - conn: { - - /** - * The ID for this socket - matches Client.id - */ - id: string; - - /** - * The Engine.io Server for this socket - */ - server: any; - - /** - * The ready state for the client. Either 'opening', 'open', 'closing', or 'closed' - */ - readyState: string; - - /** - * The remote IP for this connection - */ - remoteAddress: string; - }; + conn: EngineSocket; /** * The list of rooms that this Socket is currently in, where @@ -751,28 +730,7 @@ declare namespace SocketIO { /** * The underlying Engine.io Socket instance */ - conn: { - - /** - * The ID for this socket - matches Client.id - */ - id: string; - - /** - * The Engine.io Server for this socket - */ - server: any; - - /** - * The ready state for the client. Either 'opening', 'open', 'closing', or 'closed' - */ - readyState: string; - - /** - * The remote IP for this connection - */ - remoteAddress: string; - }; + conn: EngineSocket; /** * The ID for this client. Regenerated at every connection @@ -797,4 +755,44 @@ declare namespace SocketIO { */ nsps: {[nsp: string]: Socket}; } + + /** + * A reference to the underlying engine.io Socket connection. + */ + interface EngineSocket extends NodeJS.EventEmitter { + /** + * The ID for this socket - matches Client.id + */ + id: string; + + /** + * The Engine.io Server for this socket + */ + server: any; + + /** + * The ready state for the client. Either 'opening', 'open', 'closing', or 'closed' + */ + readyState: string; + + /** + * The remote IP for this connection + */ + remoteAddress: string; + + /** + * whether the transport has been upgraded + */ + upgraded: boolean; + + /** + * (http.IncomingMessage): request that originated the Socket + */ + request: any; + + /** + * (Transport): transport reference + */ + transport: any; + } } From fe5c8722e7c313ee4822fc2fbbf9a1f02d609ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Mon, 13 Mar 2017 19:58:55 +0900 Subject: [PATCH 107/374] Add a test. --- socket.io/socket.io-tests.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/socket.io/socket.io-tests.ts b/socket.io/socket.io-tests.ts index ea3d97e21f..23c4a6d996 100644 --- a/socket.io/socket.io-tests.ts +++ b/socket.io/socket.io-tests.ts @@ -144,6 +144,22 @@ function testUsingItJustAsACrossBrowserWebSocket() { }); } +function testSocketConnection() { + var io = socketIO.listen(80); + + io.sockets.on('connection', function (socket) { + console.log(socket.client.conn === socket.conn); + console.log(socket.client.request.httpVersion); + console.log(socket.conn.id); + console.log(socket.conn.upgraded); + console.log(socket.conn.readyState); + + socket.on('packet', function(message :string, ping :string){ + console.log(message, ping); + });; + }); +} + function testClosingServerWithCallback() { var io = socketIO.listen(80); io.close(function() { From 7713b5342f34ae611da631117143a627050f05d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Mon, 13 Mar 2017 20:08:30 +0900 Subject: [PATCH 108/374] Add my credit. --- socket.io/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/socket.io/index.d.ts b/socket.io/index.d.ts index 8e2ec2aade..9eafcec6a1 100644 --- a/socket.io/index.d.ts +++ b/socket.io/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for socket.io 1.4.4 // Project: http://socket.io/ -// Definitions by: PROGRE , Damian Connolly , Florent Poujol +// Definitions by: PROGRE , Damian Connolly , Florent Poujol , KentarouTakeda // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 21b4f7907c8514ead404321a9ae806a359ca9640 Mon Sep 17 00:00:00 2001 From: "Sergey A. Kilimnik" Date: Mon, 13 Mar 2017 14:59:45 +0200 Subject: [PATCH 109/374] ConsumerGroupOptions & ConsumerGroup fixes ConsumerGroupOptions & ConsumerGroup fixed according co js code: ConsumerGroupOptions - added missing fields, optional values marked as optional ConsumerGroup - fixed class hierarchy, it extends HighLevelConsumer in js code. --- kafka-node/index.d.ts | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/kafka-node/index.d.ts b/kafka-node/index.d.ts index a9992ccc52..7523f88c6f 100644 --- a/kafka-node/index.d.ts +++ b/kafka-node/index.d.ts @@ -63,7 +63,7 @@ export declare class HighLevelConsumer { close(force: boolean, cb: () => any): void; } -export declare class ConsumerGroup { +export declare class ConsumerGroup extends HighLevelConsumer { constructor(options: ConsumerGroupOptions, topics: string[]); on(eventName: string, cb: (message: string) => any): void; on(eventName: string, cb: (error: any) => any): void; @@ -131,11 +131,22 @@ export interface ConsumerGroupOptions { ssl?: boolean; id: string; groupId: string; - sessionTimeout: number; - protocol: Array<"roundrobin" | "range" | CustomPartitionAssignmentProtocol>; - fromOffset: "earliest" | "latest" | "none"; - migrateHLC: false; - migrateRolling: true; + sessionTimeout?: number; + protocol?: Array<"roundrobin" | "range" | CustomPartitionAssignmentProtocol>; + fromOffset?: "earliest" | "latest" | "none"; + migrateHLC?: boolean; + migrateRolling?: boolean; + autoCommit?: boolean; + autoCommitIntervalMs?: number; + fetchMaxWaitMs?: number; + paused?: boolean; + maxNumSegments?: number; + fetchMinBytes?: number; + fetchMaxBytes?: number; + retries?: number; + retryFactor?: number; + retryMinTimeout?: number; + connectOnReady?: boolean; } export interface Topic { From ed267c404e2dbd082a6bad045ca53a9b071d93f5 Mon Sep 17 00:00:00 2001 From: "Lopez, Manuel" Date: Mon, 13 Mar 2017 14:34:42 +0100 Subject: [PATCH 110/374] - Update test --- cucumber/cucumber-tests.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cucumber/cucumber-tests.ts b/cucumber/cucumber-tests.ts index 3eb86b223f..19e4824e6f 100644 --- a/cucumber/cucumber-tests.ts +++ b/cucumber/cucumber-tests.ts @@ -9,11 +9,13 @@ function StepSample() { var step = this; var hook = this; - hook.setWorldConstructor(function() { + hook.setWorldConstructor(function({attach, parameters}) { + this.attach = attach; + this.parameters = parameters; this.visit = function(url: string, callback: Callback) { callback(null, 'pending'); } - }) + }); hook.Before(function(scenario: HookScenario, callback: Callback){ scenario.isFailed() && callback.pending(); From 9c140d435b84abc9eef37dcb178b21b0de5a4b22 Mon Sep 17 00:00:00 2001 From: Andrey Kurdyumov Date: Mon, 13 Mar 2017 19:56:06 +0600 Subject: [PATCH 111/374] Mostly row/column spanning improvements --- react-bootstrap-table/index.d.ts | 29 ++++++++++++++++++- .../react-bootstrap-table-tests.tsx | 29 +++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/react-bootstrap-table/index.d.ts b/react-bootstrap-table/index.d.ts index 9adfacf8c8..bd2a356d91 100644 --- a/react-bootstrap-table/index.d.ts +++ b/react-bootstrap-table/index.d.ts @@ -448,7 +448,7 @@ export interface TableHeaderColumnProps extends Props { /** The field of data you want to show on column. */ - dataField: string; + dataField?: string; /** Use isKey to tell table which column is unique. This is same as keyField in Tips: You need choose one configuration to set key field: isKey or keyField in @@ -462,6 +462,11 @@ export interface TableHeaderColumnProps extends Props { Set align in column, value is left, center, right, start and end. */ dataAlign?: DataAlignType; + + /** + * Alignment of text in the column header. + */ + headerAlign?: DataAlignType; /** True to enable table sorting. Default is disabled. */ @@ -550,10 +555,32 @@ export interface TableHeaderColumnProps extends Props { filter?: Filter; onSort?: Function; + + /** + * Header for column in generated CSV file + */ + csvHeader?: string; csvFormat?: Function; columnTitle?: boolean; sort?: SortOrder; formatExtraData?: any; + + /** + * Row in the header on which this header column present. + */ + row?: number; + + /** + * Indicates how many rows this column takes. + * Default: 1 + */ + rowSpan?: number; + + /** + * Indicates how many columns this column takes. + * Default: 1 + */ + colSpan?: number; } export interface Editable { type?: string;//edit type, avaiable value is textarea, select, checkbox diff --git a/react-bootstrap-table/react-bootstrap-table-tests.tsx b/react-bootstrap-table/react-bootstrap-table-tests.tsx index 2151f14c78..0b5d58166c 100644 --- a/react-bootstrap-table/react-bootstrap-table-tests.tsx +++ b/react-bootstrap-table/react-bootstrap-table-tests.tsx @@ -80,3 +80,32 @@ class CustomFilter extends React.Component { ); } } + +// Adopted from https://github.com/AllenFang/react-bootstrap-table/blob/master/examples/js/column-header-span/column-header-span-complex.js +export default class ColumnHeaderSpanComplex extends React.Component { + render() { + const selectRow = { + mode: 'checkbox', + bgColor: 'rgb(238, 193, 213)' + }; + + const cellEdit = { + mode: 'click', + blurToSave: true + }; + return ( + + ID + Product + name + price + Coupon + In stock + Customer + name + order + + ); + } +} From 38f2dcaf65a50c7cfa5768f3f3455aa439e3d982 Mon Sep 17 00:00:00 2001 From: Simon Ramsay Date: Wed, 8 Mar 2017 16:12:52 -0500 Subject: [PATCH 112/374] added S3 lambda event definition - doc: https://docs.aws.amazon.com/AmazonS3/latest/dev/notification-content-structure.html --- aws-lambda/aws-lambda-tests.ts | 47 +++++++++++++++++++++++++++++++--- aws-lambda/index.d.ts | 45 +++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 5 deletions(-) diff --git a/aws-lambda/aws-lambda-tests.ts b/aws-lambda/aws-lambda-tests.ts index 1ffdb2980b..3aede36d4c 100644 --- a/aws-lambda/aws-lambda-tests.ts +++ b/aws-lambda/aws-lambda-tests.ts @@ -12,11 +12,50 @@ var context: AWSLambda.Context; var identity: AWSLambda.CognitoIdentity; var proxyResult: AWSLambda.ProxyResult; var snsEvt: AWSLambda.SNSEvent; -var snsEvtRecs: Array; +var snsEvtRecs: AWSLambda.SNSEventRecord[]; var snsEvtRec: AWSLambda.SNSEventRecord; var snsMsg: AWSLambda.SNSMessage; var snsMsgAttr: AWSLambda.SNSMessageAttribute; var snsMsgAttrs: AWSLambda.SNSMessageAttributes; +var S3CreateEvent: AWSLambda.S3CreateEvent = { + Records: [{ + eventVersion: 'string', + eventSource: 'string', + awsRegion: 'string', + eventTime: 'string', + eventName: 'string', + userIdentity: { + principalId: 'string' + }, + requestParameters: { + sourceIPAddress: 'string' + }, + responseElements: { + 'x-amz-request-id': 'string', + 'x-amz-id-2': 'string' + }, + s3: { + s3SchemaVersion: 'string', + configurationId: 'string', + bucket: { + name: 'string', + ownerIdentity: { + principalId: 'string' + }, + arn: 'string' + }, + object: { + key: 'string', + size: 1, + eTag: 'string', + versionId: 'string', + sequencer: 'string' + } + } + } + ] +}; + /* API Gateway Event */ str = apiGwEvt.body; @@ -78,7 +117,7 @@ num = proxyResult.statusCode; proxyResult.headers["example"] = str; proxyResult.headers["example"] = b; proxyResult.headers["example"] = num; -str = proxyResult.body +str = proxyResult.body; /* Context */ b = context.callbackWaitsForEmptyEventLoop; @@ -142,5 +181,5 @@ context.fail(error); context.fail(str); /* Handler */ -let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; -let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => {}; +let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => { }; +let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => { }; diff --git a/aws-lambda/index.d.ts b/aws-lambda/index.d.ts index 83579b4d0d..c5e49d54c6 100644 --- a/aws-lambda/index.d.ts +++ b/aws-lambda/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for AWS Lambda // Project: http://docs.aws.amazon.com/lambda -// Definitions by: James Darbyshire , Michael Skarum , Stef Heyenrath , Toby Hede , Rich Buggy +// Definitions by: James Darbyshire , Michael Skarum , Stef Heyenrath , Toby Hede , Rich Buggy , Simon Ramsay // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // API Gateway "event" @@ -74,6 +74,49 @@ interface SNSEvent { Records: Array; } +/** + * S3Create event + * https://docs.aws.amazon.com/AmazonS3/latest/dev/notification-content-structure.html + */ +interface S3CreateEvent { + Records: [{ + eventVersion: string; + eventSource: string; + awsRegion: string + eventTime: string; + eventName: string; + userIdentity: { + principalId: string; + }, + requestParameters: { + sourceIPAddress: string; + }, + responseElements: { + 'x-amz-request-id': string; + 'x-amz-id-2': string; + }, + s3: { + s3SchemaVersion: string; + configurationId: string; + bucket: { + name: string; + ownerIdentity: { + principalId: string; + }, + arn: string; + }, + object: { + key: string; + size: number; + eTag: string; + versionId: string; + sequencer: string; + } + } + } + ]; +} + // Context // http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html interface Context { From 7e3123bb9c54b24b3a116e703768a0a139d0ba64 Mon Sep 17 00:00:00 2001 From: Kalle Ott Date: Mon, 13 Mar 2017 16:31:39 +0100 Subject: [PATCH 113/374] fixed test of cell measurer to respect new typings --- react-virtualized/react-virtualized-tests.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/react-virtualized/react-virtualized-tests.tsx b/react-virtualized/react-virtualized-tests.tsx index 1ab6654c18..aa1dc087a9 100644 --- a/react-virtualized/react-virtualized-tests.tsx +++ b/react-virtualized/react-virtualized-tests.tsx @@ -203,10 +203,8 @@ function CellMeasurerTest() { ReactDOM.render( {({ getColumnWidth }) => ( Date: Mon, 13 Mar 2017 20:48:46 +0100 Subject: [PATCH 114/374] angular-ui-bootstrap rename IModalServiceInstance angular-ui-bootstrap IModalServiceInstance should be IModaInstanceService see #15142 --- angular-ui-bootstrap/index.d.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/angular-ui-bootstrap/index.d.ts b/angular-ui-bootstrap/index.d.ts index bc80d96b5a..1e4d15d282 100644 --- a/angular-ui-bootstrap/index.d.ts +++ b/angular-ui-bootstrap/index.d.ts @@ -15,6 +15,7 @@ export type IDropdownConfig = angular.ui.bootstrap.IDropdownConfig; export type IModalProvider = angular.ui.bootstrap.IModalProvider; export type IModalService = angular.ui.bootstrap.IModalService; export type IModalServiceInstance = angular.ui.bootstrap.IModalServiceInstance; +export type IModalInstanceService = angular.ui.bootstrap.IModalInstanceService; export type IModalScope = angular.ui.bootstrap.IModalScope; export type IModalSettings = angular.ui.bootstrap.IModalSettings; export type IModalStackService = angular.ui.bootstrap.IModalStackService; @@ -320,12 +321,12 @@ declare module 'angular' { interface IModalService { /** * @param {IModalSettings} options - * @returns {IModalServiceInstance} + * @returns {IModalInstanceService} */ - open(options: IModalSettings): IModalServiceInstance; + open(options: IModalSettings): IModalInstanceService; } - interface IModalServiceInstance { + interface IModalInstanceService { /** * A method that can be used to close a modal, passing a result. If `preventDefault` is called on the `modal.closing` event then the modal will remain open. */ @@ -357,6 +358,11 @@ declare module 'angular' { closed: angular.IPromise; } + /** + * @deprecated use IModalInstanceService instead. + */ + interface IModalServiceInstance extends IModalInstanceService { } + interface IModalScope extends angular.IScope { /** * Dismiss the dialog without assigning a value to the promise output. If `preventDefault` is called on the `modal.closing` event then the modal will remain open. @@ -512,17 +518,17 @@ declare module 'angular' { /** * Opens a new modal instance. */ - open(modalInstance: IModalServiceInstance, modal: any): void; + open(modalInstance: IModalInstanceService, modal: any): void; /** * Closes a modal instance with an optional result. */ - close(modalInstance: IModalServiceInstance, result?: any): void; + close(modalInstance: IModalInstanceService, result?: any): void; /** * Dismisses a modal instance with an optional reason. */ - dismiss(modalInstance: IModalServiceInstance, reason?: any): void; + dismiss(modalInstance: IModalInstanceService, reason?: any): void; /** * Dismiss all open modal instances with an optional reason that will be passed to each instance. @@ -536,7 +542,7 @@ declare module 'angular' { } interface IModalStackedMapKeyValuePair { - key: IModalServiceInstance; + key: IModalInstanceService; value: any; } From 61169aac6ad75a198e3d6a41ee91db6a6ef2cc35 Mon Sep 17 00:00:00 2001 From: Marcus Longmuir Date: Mon, 13 Mar 2017 16:17:06 +0000 Subject: [PATCH 115/374] google-protobuf - added built-in protos --- google-protobuf/google-protobuf-tests.ts | 454 ++++++++- google-protobuf/google/protobuf/any_pb.d.ts | 24 + google-protobuf/google/protobuf/api_pb.d.ts | 94 ++ .../google/protobuf/compiler/plugin_pb.d.ts | 113 +++ .../google/protobuf/descriptor_pb.d.ts | 908 ++++++++++++++++++ .../google/protobuf/duration_pb.d.ts | 18 + google-protobuf/google/protobuf/empty_pb.d.ts | 12 + .../google/protobuf/field_mask_pb.d.ts | 17 + .../google/protobuf/source_context_pb.d.ts | 15 + .../google/protobuf/struct_pb.d.ts | 101 ++ .../google/protobuf/timestamp_pb.d.ts | 21 + google-protobuf/google/protobuf/type_pb.d.ts | 191 ++++ .../google/protobuf/wrappers_pb.d.ts | 129 +++ 13 files changed, 2063 insertions(+), 34 deletions(-) create mode 100644 google-protobuf/google/protobuf/any_pb.d.ts create mode 100644 google-protobuf/google/protobuf/api_pb.d.ts create mode 100644 google-protobuf/google/protobuf/compiler/plugin_pb.d.ts create mode 100644 google-protobuf/google/protobuf/descriptor_pb.d.ts create mode 100644 google-protobuf/google/protobuf/duration_pb.d.ts create mode 100644 google-protobuf/google/protobuf/empty_pb.d.ts create mode 100644 google-protobuf/google/protobuf/field_mask_pb.d.ts create mode 100644 google-protobuf/google/protobuf/source_context_pb.d.ts create mode 100644 google-protobuf/google/protobuf/struct_pb.d.ts create mode 100644 google-protobuf/google/protobuf/timestamp_pb.d.ts create mode 100644 google-protobuf/google/protobuf/type_pb.d.ts create mode 100644 google-protobuf/google/protobuf/wrappers_pb.d.ts diff --git a/google-protobuf/google-protobuf-tests.ts b/google-protobuf/google-protobuf-tests.ts index 76d4f19fcc..b53d59c595 100644 --- a/google-protobuf/google-protobuf-tests.ts +++ b/google-protobuf/google-protobuf-tests.ts @@ -1,4 +1,17 @@ -import * as jspb from "google-protobuf"; +import * as jspb from "./index"; + +import * as google_protobuf_compiler_plugin_pb from "./google/protobuf/compiler/plugin_pb"; +import * as google_protobuf_any_pb from "./google/protobuf/any_pb"; +import * as google_protobuf_api_pb from "./google/protobuf/api_pb"; +import * as google_protobuf_descriptor_pb from "./google/protobuf/descriptor_pb"; +import * as google_protobuf_duration_pb from "./google/protobuf/duration_pb"; +import * as google_protobuf_empty_pb from "./google/protobuf/empty_pb"; +import * as google_protobuf_field_mask_pb from "./google/protobuf/field_mask_pb"; +import * as google_protobuf_source_context_pb from "./google/protobuf/source_context_pb"; +import * as google_protobuf_struct_pb from "./google/protobuf/struct_pb"; +import * as google_protobuf_timestamp_pb from "./google/protobuf/timestamp_pb"; +import * as google_protobuf_type_pb from "./google/protobuf/type_pb"; +import * as google_protobuf_wrappers_pb from "./google/protobuf/wrappers_pb"; /* This is a typescript version of a simple generated class from a proto file that is shown below. In order to make this ES5 JS file into TypeScript there have been quite a few modifications, but the same calls are made to the library @@ -13,6 +26,18 @@ import * as jspb from "google-protobuf"; string my_string = 1; bool my_bool = 2; repeated string some_labels = 3; + google.protobuf.compiler.CodeGeneratorRequest some_code_generator_request = 4; + google.protobuf.Any some_any = 5; + google.protobuf.Method some_method = 6; + google.protobuf.GeneratedCodeInfo some_generated_code_info = 7; + google.protobuf.Duration some_duration = 8; + google.protobuf.Empty some_empty = 9; + google.protobuf.FieldMask some_field_mask = 10; + google.protobuf.SourceContext some_source_context = 11; + google.protobuf.Struct some_struct = 12; + google.protobuf.Timestamp some_timestamp = 13; + google.protobuf.Type some_type = 14; + google.protobuf.DoubleValue some_double_value = 15; } */ @@ -24,15 +49,27 @@ class MySimple extends jspb.Message { static repeatedFields_ = [3]; - toObject(opt_includeInstance: boolean): {} { - return MySimple.toObject(opt_includeInstance, this); + toObject(opt_includeInstance?: boolean): {} { + return MySimple.toObject(opt_includeInstance || false, this); }; static toObject(includeInstance: boolean, msg: MySimple): {} { - const obj: {} = { + var f, obj = { myString: jspb.Message.getFieldWithDefault(msg, 1, ""), myBool: jspb.Message.getFieldWithDefault(msg, 2, false), someLabelsList: jspb.Message.getField(msg, 3), + someCodeGeneratorRequest: (f = msg.getSomeCodeGeneratorRequest()) && google_protobuf_compiler_plugin_pb.CodeGeneratorRequest.toObject(includeInstance, f), + someAny: (f = msg.getSomeAny()) && google_protobuf_any_pb.Any.toObject(includeInstance, f), + someMethod: (f = msg.getSomeMethod()) && google_protobuf_api_pb.Method.toObject(includeInstance, f), + someGeneratedCodeInfo: (f = msg.getSomeGeneratedCodeInfo()) && google_protobuf_descriptor_pb.GeneratedCodeInfo.toObject(includeInstance, f), + someDuration: (f = msg.getSomeDuration()) && google_protobuf_duration_pb.Duration.toObject(includeInstance, f), + someEmpty: (f = msg.getSomeEmpty()) && google_protobuf_empty_pb.Empty.toObject(includeInstance, f), + someFieldMask: (f = msg.getSomeFieldMask()) && google_protobuf_field_mask_pb.FieldMask.toObject(includeInstance, f), + someSourceContext: (f = msg.getSomeSourceContext()) && google_protobuf_source_context_pb.SourceContext.toObject(includeInstance, f), + someStruct: (f = msg.getSomeStruct()) && google_protobuf_struct_pb.Struct.toObject(includeInstance, f), + someTimestamp: (f = msg.getSomeTimestamp()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + someType: (f = msg.getSomeType()) && google_protobuf_type_pb.Type.toObject(includeInstance, f), + someDoubleValue: (f = msg.getSomeDoubleValue()) && google_protobuf_wrappers_pb.DoubleValue.toObject(includeInstance, f) }; if (includeInstance) { @@ -42,31 +79,91 @@ class MySimple extends jspb.Message { return obj; }; - static deserializeBinary(bytes: Uint8Array) { - const reader = new jspb.BinaryReader(bytes); - const msg = new MySimple(); + static deserializeBinary(bytes: Uint8Array): MySimple { + var reader = new jspb.BinaryReader(bytes); + var msg = new MySimple; return MySimple.deserializeBinaryFromReader(msg, reader); }; - static deserializeBinaryFromReader(msg: MySimple, reader: jspb.BinaryReader) { + static deserializeBinaryFromReader(msg: MySimple, reader: jspb.BinaryReader): MySimple { while (reader.nextField()) { if (reader.isEndGroup()) { break; } - const field = reader.getFieldNumber(); + var field = reader.getFieldNumber(); switch (field) { case 1: - const value1 = (reader.readString()); + var value1 = /** @type {string} */ (reader.readString()); msg.setMyString(value1); break; case 2: - const value2 = (reader.readBool()); + var value2 = /** @type {boolean} */ (reader.readBool()); msg.setMyBool(value2); break; case 3: - const value3 = (reader.readString()); + var value3 = /** @type {string} */ (reader.readString()); msg.addSomeLabels(value3); break; + case 4: + var value4 = new google_protobuf_compiler_plugin_pb.CodeGeneratorRequest; + reader.readMessage(value4, google_protobuf_compiler_plugin_pb.CodeGeneratorRequest.deserializeBinaryFromReader); + msg.setSomeCodeGeneratorRequest(value4); + break; + case 5: + var value5 = new google_protobuf_any_pb.Any; + reader.readMessage(value5, google_protobuf_any_pb.Any.deserializeBinaryFromReader); + msg.setSomeAny(value5); + break; + case 6: + var value6 = new google_protobuf_api_pb.Method; + reader.readMessage(value6, google_protobuf_api_pb.Method.deserializeBinaryFromReader); + msg.setSomeMethod(value6); + break; + case 7: + var value7 = new google_protobuf_descriptor_pb.GeneratedCodeInfo; + reader.readMessage(value7, google_protobuf_descriptor_pb.GeneratedCodeInfo.deserializeBinaryFromReader); + msg.setSomeGeneratedCodeInfo(value7); + break; + case 8: + var value8 = new google_protobuf_duration_pb.Duration; + reader.readMessage(value8, google_protobuf_duration_pb.Duration.deserializeBinaryFromReader); + msg.setSomeDuration(value8); + break; + case 9: + var value9 = new google_protobuf_empty_pb.Empty; + reader.readMessage(value9, google_protobuf_empty_pb.Empty.deserializeBinaryFromReader); + msg.setSomeEmpty(value9); + break; + case 10: + var value10 = new google_protobuf_field_mask_pb.FieldMask; + reader.readMessage(value10, google_protobuf_field_mask_pb.FieldMask.deserializeBinaryFromReader); + msg.setSomeFieldMask(value10); + break; + case 11: + var value11 = new google_protobuf_source_context_pb.SourceContext; + reader.readMessage(value11, google_protobuf_source_context_pb.SourceContext.deserializeBinaryFromReader); + msg.setSomeSourceContext(value11); + break; + case 12: + var value12 = new google_protobuf_struct_pb.Struct; + reader.readMessage(value12, google_protobuf_struct_pb.Struct.deserializeBinaryFromReader); + msg.setSomeStruct(value12); + break; + case 13: + var value13 = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value13, google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setSomeTimestamp(value13); + break; + case 14: + var value14 = new google_protobuf_type_pb.Type; + reader.readMessage(value14, google_protobuf_type_pb.Type.deserializeBinaryFromReader); + msg.setSomeType(value14); + break; + case 15: + var value15 = new google_protobuf_wrappers_pb.DoubleValue; + reader.readMessage(value15, google_protobuf_wrappers_pb.DoubleValue.deserializeBinaryFromReader); + msg.setSomeDoubleValue(value15); + break; default: reader.skipField(); break; @@ -76,64 +173,353 @@ class MySimple extends jspb.Message { }; serializeBinary(): Uint8Array { - const writer = new jspb.BinaryWriter(); + var writer = new jspb.BinaryWriter(); MySimple.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; static serializeBinaryToWriter(message: MySimple, writer: jspb.BinaryWriter) { - let f1 = message.getMyString(); - if (f1.length > 0) { + var f = undefined; + f = message.getMyString(); + if (f.length > 0) { writer.writeString( 1, - f1, + f ); } - const f2 = message.getMyBool(); - if (f2) { + f = message.getMyBool(); + if (f) { writer.writeBool( 2, - f2, + f ); } - const f3 = message.getSomeLabelsList(); - if (f3.length > 0) { + f = message.getSomeLabelsList(); + if (f.length > 0) { writer.writeRepeatedString( 3, - f3, + f ); } - } + f = message.getSomeCodeGeneratorRequest(); + if (f != null) { + writer.writeMessage( + 4, + f, + google_protobuf_compiler_plugin_pb.CodeGeneratorRequest.serializeBinaryToWriter + ); + } + f = message.getSomeAny(); + if (f != null) { + writer.writeMessage( + 5, + f, + google_protobuf_any_pb.Any.serializeBinaryToWriter + ); + } + f = message.getSomeMethod(); + if (f != null) { + writer.writeMessage( + 6, + f, + google_protobuf_api_pb.Method.serializeBinaryToWriter + ); + } + f = message.getSomeGeneratedCodeInfo(); + if (f != null) { + writer.writeMessage( + 7, + f, + google_protobuf_descriptor_pb.GeneratedCodeInfo.serializeBinaryToWriter + ); + } + f = message.getSomeDuration(); + if (f != null) { + writer.writeMessage( + 8, + f, + google_protobuf_duration_pb.Duration.serializeBinaryToWriter + ); + } + f = message.getSomeEmpty(); + if (f != null) { + writer.writeMessage( + 9, + f, + google_protobuf_empty_pb.Empty.serializeBinaryToWriter + ); + } + f = message.getSomeFieldMask(); + if (f != null) { + writer.writeMessage( + 10, + f, + google_protobuf_field_mask_pb.FieldMask.serializeBinaryToWriter + ); + } + f = message.getSomeSourceContext(); + if (f != null) { + writer.writeMessage( + 11, + f, + google_protobuf_source_context_pb.SourceContext.serializeBinaryToWriter + ); + } + f = message.getSomeStruct(); + if (f != null) { + writer.writeMessage( + 12, + f, + google_protobuf_struct_pb.Struct.serializeBinaryToWriter + ); + } + f = message.getSomeTimestamp(); + if (f != null) { + writer.writeMessage( + 13, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getSomeType(); + if (f != null) { + writer.writeMessage( + 14, + f, + google_protobuf_type_pb.Type.serializeBinaryToWriter + ); + } + f = message.getSomeDoubleValue(); + if (f != null) { + writer.writeMessage( + 15, + f, + google_protobuf_wrappers_pb.DoubleValue.serializeBinaryToWriter + ); + } + }; getMyString(): string { return jspb.Message.getFieldWithDefault(this, 1, ""); - } + }; setMyString(value: string) { jspb.Message.setField(this, 1, value); - } + }; getMyBool(): boolean { return jspb.Message.getFieldWithDefault(this, 2, false); - } + }; setMyBool(value: boolean) { jspb.Message.setField(this, 2, value); - } + }; - getSomeLabelsList(): string[] { + getSomeLabelsList(): Array { return jspb.Message.getField(this, 3); - } + }; - setSomeLabelsList(value: string[]) { + setSomeLabelsList(value: Array) { jspb.Message.setField(this, 3, value || []); - } + }; addSomeLabels(value: string, opt_index?: number) { jspb.Message.addToRepeatedField(this, 3, value, opt_index); - } + }; clearSomeLabelsList() { this.setSomeLabelsList([]); - } -} + }; + + getSomeCodeGeneratorRequest(): google_protobuf_compiler_plugin_pb.CodeGeneratorRequest | undefined { + return jspb.Message.getWrapperField(this, google_protobuf_compiler_plugin_pb.CodeGeneratorRequest, 4) as google_protobuf_compiler_plugin_pb.CodeGeneratorRequest | undefined; + }; + + setSomeCodeGeneratorRequest(value?: google_protobuf_compiler_plugin_pb.CodeGeneratorRequest) { + jspb.Message.setWrapperField(this, 4, value); + }; + + clearSomeCodeGeneratorRequest() { + this.setSomeCodeGeneratorRequest(undefined); + }; + + hasSomeCodeGeneratorRequest(): boolean { + return jspb.Message.getField(this, 4) != null; + }; + + getSomeAny(): google_protobuf_any_pb.Any | undefined { + return jspb.Message.getWrapperField(this, google_protobuf_any_pb.Any, 5) as google_protobuf_any_pb.Any | undefined; + }; + + setSomeAny(value?: google_protobuf_any_pb.Any) { + jspb.Message.setWrapperField(this, 5, value); + }; + + clearSomeAny() { + this.setSomeAny(undefined); + }; + + hasSomeAny(): boolean { + return jspb.Message.getField(this, 5) != null; + }; + + getSomeMethod(): google_protobuf_api_pb.Method | undefined { + return jspb.Message.getWrapperField(this, google_protobuf_api_pb.Method, 6) as google_protobuf_api_pb.Method | undefined; + }; + + setSomeMethod(value?: google_protobuf_api_pb.Method) { + jspb.Message.setWrapperField(this, 6, value); + }; + + clearSomeMethod() { + this.setSomeMethod(undefined); + }; + + hasSomeMethod(): boolean { + return jspb.Message.getField(this, 6) != null; + }; + + getSomeGeneratedCodeInfo(): google_protobuf_descriptor_pb.GeneratedCodeInfo|undefined { + return jspb.Message.getWrapperField(this, google_protobuf_descriptor_pb.GeneratedCodeInfo, 7) as google_protobuf_descriptor_pb.GeneratedCodeInfo | undefined; + }; + + setSomeGeneratedCodeInfo(value?: google_protobuf_descriptor_pb.GeneratedCodeInfo) { + jspb.Message.setWrapperField(this, 7, value); + }; + + clearSomeGeneratedCodeInfo() { + this.setSomeGeneratedCodeInfo(undefined); + }; + + hasSomeGeneratedCodeInfo(): boolean { + return jspb.Message.getField(this, 7) != null; + }; + + getSomeDuration(): google_protobuf_duration_pb.Duration | undefined { + return jspb.Message.getWrapperField(this, google_protobuf_duration_pb.Duration, 8) as google_protobuf_duration_pb.Duration | undefined; + }; + + setSomeDuration(value?: google_protobuf_duration_pb.Duration) { + jspb.Message.setWrapperField(this, 8, value); + }; + + clearSomeDuration() { + this.setSomeDuration(undefined); + }; + + hasSomeDuration(): boolean { + return jspb.Message.getField(this, 8) != null; + }; + + getSomeEmpty(): google_protobuf_empty_pb.Empty | undefined { + return jspb.Message.getWrapperField(this, google_protobuf_empty_pb.Empty, 9) as google_protobuf_empty_pb.Empty | undefined; + }; + + setSomeEmpty(value?: google_protobuf_empty_pb.Empty) { + jspb.Message.setWrapperField(this, 9, value); + }; + + clearSomeEmpty() { + this.setSomeEmpty(undefined); + }; + + hasSomeEmpty(): boolean { + return jspb.Message.getField(this, 9) != null; + }; + + getSomeFieldMask(): google_protobuf_field_mask_pb.FieldMask | undefined { + return jspb.Message.getWrapperField(this, google_protobuf_field_mask_pb.FieldMask, 10) as google_protobuf_field_mask_pb.FieldMask | undefined; + }; + + setSomeFieldMask(value?: google_protobuf_field_mask_pb.FieldMask) { + jspb.Message.setWrapperField(this, 10, value); + }; + + clearSomeFieldMask() { + this.setSomeFieldMask(undefined); + }; + + hasSomeFieldMask(): boolean { + return jspb.Message.getField(this, 10) != null; + }; + + getSomeSourceContext(): google_protobuf_source_context_pb.SourceContext | undefined { + return jspb.Message.getWrapperField(this, google_protobuf_source_context_pb.SourceContext, 11) as google_protobuf_source_context_pb.SourceContext | undefined; + }; + + setSomeSourceContext(value?: google_protobuf_source_context_pb.SourceContext) { + jspb.Message.setWrapperField(this, 11, value); + }; + + clearSomeSourceContext() { + this.setSomeSourceContext(undefined); + }; + + hasSomeSourceContext(): boolean { + return jspb.Message.getField(this, 11) != null; + }; + + getSomeStruct(): google_protobuf_struct_pb.Struct | undefined { + return jspb.Message.getWrapperField(this, google_protobuf_struct_pb.Struct, 12) as google_protobuf_struct_pb.Struct | undefined; + }; + + setSomeStruct(value?: google_protobuf_struct_pb.Struct) { + jspb.Message.setWrapperField(this, 12, value); + }; + + clearSomeStruct() { + this.setSomeStruct(undefined); + }; + + hasSomeStruct(): boolean { + return jspb.Message.getField(this, 12) != null; + }; + + getSomeTimestamp(): google_protobuf_timestamp_pb.Timestamp | undefined { + return jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 13) as google_protobuf_timestamp_pb.Timestamp | undefined; + }; + + setSomeTimestamp(value?: google_protobuf_timestamp_pb.Timestamp) { + jspb.Message.setWrapperField(this, 13, value); + }; + + clearSomeTimestamp() { + this.setSomeTimestamp(undefined); + }; + + hasSomeTimestamp(): boolean { + return jspb.Message.getField(this, 13) != null; + }; + + getSomeType(): google_protobuf_type_pb.Type | undefined { + return jspb.Message.getWrapperField(this, google_protobuf_type_pb.Type, 14) as google_protobuf_type_pb.Type | undefined; + }; + + setSomeType(value?: google_protobuf_type_pb.Type) { + jspb.Message.setWrapperField(this, 14, value); + }; + + clearSomeType() { + this.setSomeType(undefined); + }; + + hasSomeType(): boolean { + return jspb.Message.getField(this, 14) != null; + }; + + getSomeDoubleValue(): google_protobuf_wrappers_pb.DoubleValue | undefined { + return jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.DoubleValue, 15) as google_protobuf_wrappers_pb.DoubleValue | undefined; + }; + + setSomeDoubleValue(value?: google_protobuf_wrappers_pb.DoubleValue) { + jspb.Message.setWrapperField(this, 15, value); + }; + + clearSomeDoubleValue() { + this.setSomeDoubleValue(undefined); + }; + + hasSomeDoubleValue(): boolean { + return jspb.Message.getField(this, 15) != null; + }; +}; diff --git a/google-protobuf/google/protobuf/any_pb.d.ts b/google-protobuf/google/protobuf/any_pb.d.ts new file mode 100644 index 0000000000..97d49054a2 --- /dev/null +++ b/google-protobuf/google/protobuf/any_pb.d.ts @@ -0,0 +1,24 @@ +import * as jspb from "../../index"; + +export class Any extends jspb.Message { + getTypeUrl(): string; + setTypeUrl(value: string): void; + + getValue(): Uint8Array | string; + getValue_asU8(): Uint8Array; + getValue_asB64(): string; + setValue(value: Uint8Array | string): void; + + getTypeName(): string; + pack(serialized: Uint8Array, name: string, typeUrlPrefix?: string): void; + unpack(deserialize: (packed: Uint8Array) => T, name: string): T | null; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: Any): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Any, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Any; + static deserializeBinaryFromReader(message: Any, reader: jspb.BinaryReader): Any; +} diff --git a/google-protobuf/google/protobuf/api_pb.d.ts b/google-protobuf/google/protobuf/api_pb.d.ts new file mode 100644 index 0000000000..dd89e7782f --- /dev/null +++ b/google-protobuf/google/protobuf/api_pb.d.ts @@ -0,0 +1,94 @@ +import * as jspb from "../../index"; +import * as google_protobuf_source_context_pb from "./source_context_pb"; +import * as google_protobuf_type_pb from "./type_pb"; + +export class Api extends jspb.Message { + getName(): string; + setName(value: string): void; + + clearMethodsList(): void; + getMethodsList(): Array; + setMethodsList(value: Array): void; + addMethods(value?: Method, index?: number): void; + + clearOptionsList(): void; + getOptionsList(): Array; + setOptionsList(value: Array): void; + addOptions(value?: google_protobuf_type_pb.Option, index?: number): void; + + getVersion(): string; + setVersion(value: string): void; + + hasSourceContext(): boolean; + clearSourceContext(): void; + getSourceContext(): google_protobuf_source_context_pb.SourceContext; + setSourceContext(value: google_protobuf_source_context_pb.SourceContext): void; + + clearMixinsList(): void; + getMixinsList(): Array; + setMixinsList(value: Array): void; + addMixins(value?: Mixin, index?: number): void; + + getSyntax(): google_protobuf_type_pb.Syntax; + setSyntax(value: google_protobuf_type_pb.Syntax): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: Api): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Api, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Api; + static deserializeBinaryFromReader(message: Api, reader: jspb.BinaryReader): Api; +} + +export class Method extends jspb.Message { + getName(): string; + setName(value: string): void; + + getRequestTypeUrl(): string; + setRequestTypeUrl(value: string): void; + + getRequestStreaming(): boolean; + setRequestStreaming(value: boolean): void; + + getResponseTypeUrl(): string; + setResponseTypeUrl(value: string): void; + + getResponseStreaming(): boolean; + setResponseStreaming(value: boolean): void; + + clearOptionsList(): void; + getOptionsList(): Array; + setOptionsList(value: Array): void; + addOptions(value?: google_protobuf_type_pb.Option, index?: number): void; + + getSyntax(): google_protobuf_type_pb.Syntax; + setSyntax(value: google_protobuf_type_pb.Syntax): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: Method): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Method, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Method; + static deserializeBinaryFromReader(message: Method, reader: jspb.BinaryReader): Method; +} + +export class Mixin extends jspb.Message { + getName(): string; + setName(value: string): void; + + getRoot(): string; + setRoot(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: Mixin): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Mixin, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Mixin; + static deserializeBinaryFromReader(message: Mixin, reader: jspb.BinaryReader): Mixin; +} diff --git a/google-protobuf/google/protobuf/compiler/plugin_pb.d.ts b/google-protobuf/google/protobuf/compiler/plugin_pb.d.ts new file mode 100644 index 0000000000..be1f4c28fb --- /dev/null +++ b/google-protobuf/google/protobuf/compiler/plugin_pb.d.ts @@ -0,0 +1,113 @@ +import * as jspb from "../../../index"; +import * as google_protobuf_descriptor_pb from "../descriptor_pb"; + +export class Version extends jspb.Message { + hasMajor(): boolean; + clearMajor(): void; + getMajor(): number; + setMajor(value: number): void; + + hasMinor(): boolean; + clearMinor(): void; + getMinor(): number; + setMinor(value: number): void; + + hasPatch(): boolean; + clearPatch(): void; + getPatch(): number; + setPatch(value: number): void; + + hasSuffix(): boolean; + clearSuffix(): void; + getSuffix(): string; + setSuffix(value: string): void; + + static deserializeBinary(bytes: Uint8Array): Version; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: Version): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Version, writer: jspb.BinaryWriter): void; + static deserializeBinaryFromReader(message: Version, reader: jspb.BinaryReader): Version; +} + +export class CodeGeneratorRequest extends jspb.Message { + clearFileToGenerateList(): void; + getFileToGenerateList(): Array; + setFileToGenerateList(value: Array): void; + addFileToGenerate(value: string, index?: number): void; + + hasParameter(): boolean; + clearParameter(): void; + getParameter(): string; + setParameter(value: string): void; + + clearProtoFileList(): void; + getProtoFileList(): Array; + setProtoFileList(value: Array): void; + addProtoFile(value?: google_protobuf_descriptor_pb.FileDescriptorProto, index?: number): void; + + hasCompilerVersion(): boolean; + clearCompilerVersion(): void; + getCompilerVersion(): Version; + setCompilerVersion(value: Version): void; + + static deserializeBinary(bytes: Uint8Array): CodeGeneratorRequest; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: CodeGeneratorRequest): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CodeGeneratorRequest, writer: jspb.BinaryWriter): void; + static deserializeBinaryFromReader(message: CodeGeneratorRequest, reader: jspb.BinaryReader): CodeGeneratorRequest; +} + +export class CodeGeneratorResponse extends jspb.Message { + hasError(): boolean; + clearError(): void; + getError(): string; + setError(value: string): void; + + clearFileList(): void; + getFileList(): Array; + setFileList(value: Array): void; + addFile(value?: CodeGeneratorResponse.File, index?: number): void; + + static deserializeBinary(bytes: Uint8Array): CodeGeneratorResponse; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: CodeGeneratorResponse): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: CodeGeneratorResponse, writer: jspb.BinaryWriter): void; + static deserializeBinaryFromReader(message: CodeGeneratorResponse, reader: jspb.BinaryReader): CodeGeneratorResponse; +} + +export namespace CodeGeneratorResponse { + export class File extends jspb.Message { + hasName(): boolean; + clearName(): void; + getName(): string; + setName(value: string): void; + + hasInsertionPoint(): boolean; + clearInsertionPoint(): void; + getInsertionPoint(): string; + setInsertionPoint(value: string): void; + + hasContent(): boolean; + clearContent(): void; + getContent(): string; + setContent(value: string): void; + + static deserializeBinary(bytes: Uint8Array): File; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: File): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: File, writer: jspb.BinaryWriter): void; + static deserializeBinaryFromReader(message: File, reader: jspb.BinaryReader): File; + } +} diff --git a/google-protobuf/google/protobuf/descriptor_pb.d.ts b/google-protobuf/google/protobuf/descriptor_pb.d.ts new file mode 100644 index 0000000000..d5fe011e9f --- /dev/null +++ b/google-protobuf/google/protobuf/descriptor_pb.d.ts @@ -0,0 +1,908 @@ +import * as jspb from "../../index"; + +export class FileDescriptorSet extends jspb.Message { + clearFileList(): void; + getFileList(): Array; + setFileList(value: Array): void; + addFile(value?: FileDescriptorProto, index?: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: FileDescriptorSet): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: FileDescriptorSet, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FileDescriptorSet; + static deserializeBinaryFromReader(message: FileDescriptorSet, reader: jspb.BinaryReader): FileDescriptorSet; +} + +export class FileDescriptorProto extends jspb.Message { + hasName(): boolean; + clearName(): void; + getName(): string; + setName(value: string): void; + + hasPackage(): boolean; + clearPackage(): void; + getPackage(): string; + setPackage(value: string): void; + + clearDependencyList(): void; + getDependencyList(): Array; + setDependencyList(value: Array): void; + addDependency(value: string, index?: number): void; + + clearPublicDependencyList(): void; + getPublicDependencyList(): Array; + setPublicDependencyList(value: Array): void; + addPublicDependency(value: number, index?: number): void; + + clearWeakDependencyList(): void; + getWeakDependencyList(): Array; + setWeakDependencyList(value: Array): void; + addWeakDependency(value: number, index?: number): void; + + clearMessageTypeList(): void; + getMessageTypeList(): Array; + setMessageTypeList(value: Array): void; + addMessageType(value?: DescriptorProto, index?: number): void; + + clearEnumTypeList(): void; + getEnumTypeList(): Array; + setEnumTypeList(value: Array): void; + addEnumType(value?: EnumDescriptorProto, index?: number): void; + + clearServiceList(): void; + getServiceList(): Array; + setServiceList(value: Array): void; + addService(value?: ServiceDescriptorProto, index?: number): void; + + clearExtensionList(): void; + getExtensionList(): Array; + setExtensionList(value: Array): void; + addExtension(value?: FieldDescriptorProto, index?: number): void; + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): FileOptions; + setOptions(value: FileOptions): void; + + hasSourceCodeInfo(): boolean; + clearSourceCodeInfo(): void; + getSourceCodeInfo(): SourceCodeInfo; + setSourceCodeInfo(value: SourceCodeInfo): void; + + hasSyntax(): boolean; + clearSyntax(): void; + getSyntax(): string; + setSyntax(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: FileDescriptorProto): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: FileDescriptorProto, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FileDescriptorProto; + static deserializeBinaryFromReader(message: FileDescriptorProto, reader: jspb.BinaryReader): FileDescriptorProto; +} + +export class DescriptorProto extends jspb.Message { + hasName(): boolean; + clearName(): void; + getName(): string; + setName(value: string): void; + + clearFieldList(): void; + getFieldList(): Array; + setFieldList(value: Array): void; + addField(value?: FieldDescriptorProto, index?: number): void; + + clearExtensionList(): void; + getExtensionList(): Array; + setExtensionList(value: Array): void; + addExtension(value?: FieldDescriptorProto, index?: number): void; + + clearNestedTypeList(): void; + getNestedTypeList(): Array; + setNestedTypeList(value: Array): void; + addNestedType(value?: DescriptorProto, index?: number): void; + + clearEnumTypeList(): void; + getEnumTypeList(): Array; + setEnumTypeList(value: Array): void; + addEnumType(value?: EnumDescriptorProto, index?: number): void; + + clearExtensionRangeList(): void; + getExtensionRangeList(): Array; + setExtensionRangeList(value: Array): void; + addExtensionRange(value?: DescriptorProto.ExtensionRange, index?: number): void; + + clearOneofDeclList(): void; + getOneofDeclList(): Array; + setOneofDeclList(value: Array): void; + addOneofDecl(value?: OneofDescriptorProto, index?: number): void; + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): MessageOptions; + setOptions(value: MessageOptions): void; + + clearReservedRangeList(): void; + getReservedRangeList(): Array; + setReservedRangeList(value: Array): void; + addReservedRange(value?: DescriptorProto.ReservedRange, index?: number): void; + + clearReservedNameList(): void; + getReservedNameList(): Array; + setReservedNameList(value: Array): void; + addReservedName(value: string, index?: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: DescriptorProto): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: DescriptorProto, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DescriptorProto; + static deserializeBinaryFromReader(message: DescriptorProto, reader: jspb.BinaryReader): DescriptorProto; +} + +export namespace DescriptorProto { + export class ExtensionRange extends jspb.Message { + hasStart(): boolean; + clearStart(): void; + getStart(): number; + setStart(value: number): void; + + hasEnd(): boolean; + clearEnd(): void; + getEnd(): number; + setEnd(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: ExtensionRange): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ExtensionRange, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ExtensionRange; + static deserializeBinaryFromReader(message: ExtensionRange, reader: jspb.BinaryReader): ExtensionRange; + } + + export class ReservedRange extends jspb.Message { + hasStart(): boolean; + clearStart(): void; + getStart(): number; + setStart(value: number): void; + + hasEnd(): boolean; + clearEnd(): void; + getEnd(): number; + setEnd(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: ReservedRange): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ReservedRange, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ReservedRange; + static deserializeBinaryFromReader(message: ReservedRange, reader: jspb.BinaryReader): ReservedRange; + } +} + +export class FieldDescriptorProto extends jspb.Message { + hasName(): boolean; + clearName(): void; + getName(): string; + setName(value: string): void; + + hasNumber(): boolean; + clearNumber(): void; + getNumber(): number; + setNumber(value: number): void; + + hasLabel(): boolean; + clearLabel(): void; + getLabel(): FieldDescriptorProto.Label; + setLabel(value: FieldDescriptorProto.Label): void; + + hasType(): boolean; + clearType(): void; + getType(): FieldDescriptorProto.Type; + setType(value: FieldDescriptorProto.Type): void; + + hasTypeName(): boolean; + clearTypeName(): void; + getTypeName(): string; + setTypeName(value: string): void; + + hasExtendee(): boolean; + clearExtendee(): void; + getExtendee(): string; + setExtendee(value: string): void; + + hasDefaultValue(): boolean; + clearDefaultValue(): void; + getDefaultValue(): string; + setDefaultValue(value: string): void; + + hasOneofIndex(): boolean; + clearOneofIndex(): void; + getOneofIndex(): number; + setOneofIndex(value: number): void; + + hasJsonName(): boolean; + clearJsonName(): void; + getJsonName(): string; + setJsonName(value: string): void; + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): FieldOptions; + setOptions(value: FieldOptions): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: FieldDescriptorProto): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: FieldDescriptorProto, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FieldDescriptorProto; + static deserializeBinaryFromReader(message: FieldDescriptorProto, reader: jspb.BinaryReader): FieldDescriptorProto; +} + +export namespace FieldDescriptorProto { + export enum Type { + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + TYPE_GROUP = 10, + TYPE_MESSAGE = 11, + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + TYPE_SINT32 = 17, + TYPE_SINT64 = 18, + } + export enum Label { + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3, + } +} + +export class OneofDescriptorProto extends jspb.Message { + hasName(): boolean; + clearName(): void; + getName(): string; + setName(value: string): void; + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): OneofOptions; + setOptions(value: OneofOptions): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: OneofDescriptorProto): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: OneofDescriptorProto, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): OneofDescriptorProto; + static deserializeBinaryFromReader(message: OneofDescriptorProto, reader: jspb.BinaryReader): OneofDescriptorProto; +} + +export class EnumDescriptorProto extends jspb.Message { + hasName(): boolean; + clearName(): void; + getName(): string; + setName(value: string): void; + + clearValueList(): void; + getValueList(): Array; + setValueList(value: Array): void; + addValue(value?: EnumValueDescriptorProto, index?: number): void; + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): EnumOptions; + setOptions(value: EnumOptions): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: EnumDescriptorProto): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EnumDescriptorProto, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EnumDescriptorProto; + static deserializeBinaryFromReader(message: EnumDescriptorProto, reader: jspb.BinaryReader): EnumDescriptorProto; +} + +export class EnumValueDescriptorProto extends jspb.Message { + hasName(): boolean; + clearName(): void; + getName(): string; + setName(value: string): void; + + hasNumber(): boolean; + clearNumber(): void; + getNumber(): number; + setNumber(value: number): void; + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): EnumValueOptions; + setOptions(value: EnumValueOptions): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: EnumValueDescriptorProto): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EnumValueDescriptorProto, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EnumValueDescriptorProto; + static deserializeBinaryFromReader(message: EnumValueDescriptorProto, reader: jspb.BinaryReader): EnumValueDescriptorProto; +} + +export class ServiceDescriptorProto extends jspb.Message { + hasName(): boolean; + clearName(): void; + getName(): string; + setName(value: string): void; + + clearMethodList(): void; + getMethodList(): Array; + setMethodList(value: Array): void; + addMethod(value?: MethodDescriptorProto, index?: number): void; + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): ServiceOptions; + setOptions(value: ServiceOptions): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: ServiceDescriptorProto): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ServiceDescriptorProto, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ServiceDescriptorProto; + static deserializeBinaryFromReader(message: ServiceDescriptorProto, reader: jspb.BinaryReader): ServiceDescriptorProto; +} + +export class MethodDescriptorProto extends jspb.Message { + hasName(): boolean; + clearName(): void; + getName(): string; + setName(value: string): void; + + hasInputType(): boolean; + clearInputType(): void; + getInputType(): string; + setInputType(value: string): void; + + hasOutputType(): boolean; + clearOutputType(): void; + getOutputType(): string; + setOutputType(value: string): void; + + hasOptions(): boolean; + clearOptions(): void; + getOptions(): MethodOptions; + setOptions(value: MethodOptions): void; + + hasClientStreaming(): boolean; + clearClientStreaming(): void; + getClientStreaming(): boolean; + setClientStreaming(value: boolean): void; + + hasServerStreaming(): boolean; + clearServerStreaming(): void; + getServerStreaming(): boolean; + setServerStreaming(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: MethodDescriptorProto): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MethodDescriptorProto, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MethodDescriptorProto; + static deserializeBinaryFromReader(message: MethodDescriptorProto, reader: jspb.BinaryReader): MethodDescriptorProto; +} + +export class FileOptions extends jspb.Message { + hasJavaPackage(): boolean; + clearJavaPackage(): void; + getJavaPackage(): string; + setJavaPackage(value: string): void; + + hasJavaOuterClassname(): boolean; + clearJavaOuterClassname(): void; + getJavaOuterClassname(): string; + setJavaOuterClassname(value: string): void; + + hasJavaMultipleFiles(): boolean; + clearJavaMultipleFiles(): void; + getJavaMultipleFiles(): boolean; + setJavaMultipleFiles(value: boolean): void; + + hasJavaGenerateEqualsAndHash(): boolean; + clearJavaGenerateEqualsAndHash(): void; + getJavaGenerateEqualsAndHash(): boolean; + setJavaGenerateEqualsAndHash(value: boolean): void; + + hasJavaStringCheckUtf8(): boolean; + clearJavaStringCheckUtf8(): void; + getJavaStringCheckUtf8(): boolean; + setJavaStringCheckUtf8(value: boolean): void; + + hasOptimizeFor(): boolean; + clearOptimizeFor(): void; + getOptimizeFor(): FileOptions.OptimizeMode; + setOptimizeFor(value: FileOptions.OptimizeMode): void; + + hasGoPackage(): boolean; + clearGoPackage(): void; + getGoPackage(): string; + setGoPackage(value: string): void; + + hasCcGenericServices(): boolean; + clearCcGenericServices(): void; + getCcGenericServices(): boolean; + setCcGenericServices(value: boolean): void; + + hasJavaGenericServices(): boolean; + clearJavaGenericServices(): void; + getJavaGenericServices(): boolean; + setJavaGenericServices(value: boolean): void; + + hasPyGenericServices(): boolean; + clearPyGenericServices(): void; + getPyGenericServices(): boolean; + setPyGenericServices(value: boolean): void; + + hasDeprecated(): boolean; + clearDeprecated(): void; + getDeprecated(): boolean; + setDeprecated(value: boolean): void; + + hasCcEnableArenas(): boolean; + clearCcEnableArenas(): void; + getCcEnableArenas(): boolean; + setCcEnableArenas(value: boolean): void; + + hasObjcClassPrefix(): boolean; + clearObjcClassPrefix(): void; + getObjcClassPrefix(): string; + setObjcClassPrefix(value: string): void; + + hasCsharpNamespace(): boolean; + clearCsharpNamespace(): void; + getCsharpNamespace(): string; + setCsharpNamespace(value: string): void; + + hasSwiftPrefix(): boolean; + clearSwiftPrefix(): void; + getSwiftPrefix(): string; + setSwiftPrefix(value: string): void; + + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): void; + addUninterpretedOption(value?: UninterpretedOption, index?: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: FileOptions): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: FileOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FileOptions; + static deserializeBinaryFromReader(message: FileOptions, reader: jspb.BinaryReader): FileOptions; +} + +export namespace FileOptions { + export enum OptimizeMode { + SPEED = 1, + CODE_SIZE = 2, + LITE_RUNTIME = 3, + } +} + +export class MessageOptions extends jspb.Message { + hasMessageSetWireFormat(): boolean; + clearMessageSetWireFormat(): void; + getMessageSetWireFormat(): boolean; + setMessageSetWireFormat(value: boolean): void; + + hasNoStandardDescriptorAccessor(): boolean; + clearNoStandardDescriptorAccessor(): void; + getNoStandardDescriptorAccessor(): boolean; + setNoStandardDescriptorAccessor(value: boolean): void; + + hasDeprecated(): boolean; + clearDeprecated(): void; + getDeprecated(): boolean; + setDeprecated(value: boolean): void; + + hasMapEntry(): boolean; + clearMapEntry(): void; + getMapEntry(): boolean; + setMapEntry(value: boolean): void; + + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): void; + addUninterpretedOption(value?: UninterpretedOption, index?: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: MessageOptions): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MessageOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MessageOptions; + static deserializeBinaryFromReader(message: MessageOptions, reader: jspb.BinaryReader): MessageOptions; +} + +export class FieldOptions extends jspb.Message { + hasCtype(): boolean; + clearCtype(): void; + getCtype(): FieldOptions.CType; + setCtype(value: FieldOptions.CType): void; + + hasPacked(): boolean; + clearPacked(): void; + getPacked(): boolean; + setPacked(value: boolean): void; + + hasJstype(): boolean; + clearJstype(): void; + getJstype(): FieldOptions.JSType; + setJstype(value: FieldOptions.JSType): void; + + hasLazy(): boolean; + clearLazy(): void; + getLazy(): boolean; + setLazy(value: boolean): void; + + hasDeprecated(): boolean; + clearDeprecated(): void; + getDeprecated(): boolean; + setDeprecated(value: boolean): void; + + hasWeak(): boolean; + clearWeak(): void; + getWeak(): boolean; + setWeak(value: boolean): void; + + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): void; + addUninterpretedOption(value?: UninterpretedOption, index?: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: FieldOptions): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: FieldOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FieldOptions; + static deserializeBinaryFromReader(message: FieldOptions, reader: jspb.BinaryReader): FieldOptions; +} + +export namespace FieldOptions { + export enum CType { + STRING = 0, + CORD = 1, + STRING_PIECE = 2, + } + export enum JSType { + JS_NORMAL = 0, + JS_STRING = 1, + JS_NUMBER = 2, + } +} + +export class OneofOptions extends jspb.Message { + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): void; + addUninterpretedOption(value?: UninterpretedOption, index?: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: OneofOptions): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: OneofOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): OneofOptions; + static deserializeBinaryFromReader(message: OneofOptions, reader: jspb.BinaryReader): OneofOptions; +} + +export class EnumOptions extends jspb.Message { + hasAllowAlias(): boolean; + clearAllowAlias(): void; + getAllowAlias(): boolean; + setAllowAlias(value: boolean): void; + + hasDeprecated(): boolean; + clearDeprecated(): void; + getDeprecated(): boolean; + setDeprecated(value: boolean): void; + + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): void; + addUninterpretedOption(value?: UninterpretedOption, index?: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: EnumOptions): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EnumOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EnumOptions; + static deserializeBinaryFromReader(message: EnumOptions, reader: jspb.BinaryReader): EnumOptions; +} + +export class EnumValueOptions extends jspb.Message { + hasDeprecated(): boolean; + clearDeprecated(): void; + getDeprecated(): boolean; + setDeprecated(value: boolean): void; + + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): void; + addUninterpretedOption(value?: UninterpretedOption, index?: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: EnumValueOptions): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: EnumValueOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EnumValueOptions; + static deserializeBinaryFromReader(message: EnumValueOptions, reader: jspb.BinaryReader): EnumValueOptions; +} + +export class ServiceOptions extends jspb.Message { + hasDeprecated(): boolean; + clearDeprecated(): void; + getDeprecated(): boolean; + setDeprecated(value: boolean): void; + + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): void; + addUninterpretedOption(value?: UninterpretedOption, index?: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: ServiceOptions): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ServiceOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ServiceOptions; + static deserializeBinaryFromReader(message: ServiceOptions, reader: jspb.BinaryReader): ServiceOptions; +} + +export class MethodOptions extends jspb.Message { + hasDeprecated(): boolean; + clearDeprecated(): void; + getDeprecated(): boolean; + setDeprecated(value: boolean): void; + + hasIdempotencyLevel(): boolean; + clearIdempotencyLevel(): void; + getIdempotencyLevel(): MethodOptions.IdempotencyLevel; + setIdempotencyLevel(value: MethodOptions.IdempotencyLevel): void; + + clearUninterpretedOptionList(): void; + getUninterpretedOptionList(): Array; + setUninterpretedOptionList(value: Array): void; + addUninterpretedOption(value?: UninterpretedOption, index?: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: MethodOptions): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: MethodOptions, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): MethodOptions; + static deserializeBinaryFromReader(message: MethodOptions, reader: jspb.BinaryReader): MethodOptions; +} + +export namespace MethodOptions { + export enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + NO_SIDE_EFFECTS = 1, + IDEMPOTENT = 2, + } +} + +export class UninterpretedOption extends jspb.Message { + clearNameList(): void; + getNameList(): Array; + setNameList(value: Array): void; + addName(value?: UninterpretedOption.NamePart, index?: number): void; + + hasIdentifierValue(): boolean; + clearIdentifierValue(): void; + getIdentifierValue(): string; + setIdentifierValue(value: string): void; + + hasPositiveIntValue(): boolean; + clearPositiveIntValue(): void; + getPositiveIntValue(): number; + setPositiveIntValue(value: number): void; + + hasNegativeIntValue(): boolean; + clearNegativeIntValue(): void; + getNegativeIntValue(): number; + setNegativeIntValue(value: number): void; + + hasDoubleValue(): boolean; + clearDoubleValue(): void; + getDoubleValue(): number; + setDoubleValue(value: number): void; + + hasStringValue(): boolean; + clearStringValue(): void; + getStringValue(): Uint8Array | string; + getStringValue_asU8(): Uint8Array; + getStringValue_asB64(): string; + setStringValue(value: Uint8Array | string): void; + + hasAggregateValue(): boolean; + clearAggregateValue(): void; + getAggregateValue(): string; + setAggregateValue(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: UninterpretedOption): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: UninterpretedOption, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): UninterpretedOption; + static deserializeBinaryFromReader(message: UninterpretedOption, reader: jspb.BinaryReader): UninterpretedOption; +} + +export namespace UninterpretedOption { + export class NamePart extends jspb.Message { + hasNamePart(): boolean; + clearNamePart(): void; + getNamePart(): string; + setNamePart(value: string): void; + + hasIsExtension(): boolean; + clearIsExtension(): void; + getIsExtension(): boolean; + setIsExtension(value: boolean): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: NamePart): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: NamePart, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): NamePart; + static deserializeBinaryFromReader(message: NamePart, reader: jspb.BinaryReader): NamePart; + } +} + +export class SourceCodeInfo extends jspb.Message { + clearLocationList(): void; + getLocationList(): Array; + setLocationList(value: Array): void; + addLocation(value?: SourceCodeInfo.Location, index?: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: SourceCodeInfo): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SourceCodeInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SourceCodeInfo; + static deserializeBinaryFromReader(message: SourceCodeInfo, reader: jspb.BinaryReader): SourceCodeInfo; +} + +export namespace SourceCodeInfo { + export class Location extends jspb.Message { + clearPathList(): void; + getPathList(): Array; + setPathList(value: Array): void; + addPath(value: number, index?: number): void; + + clearSpanList(): void; + getSpanList(): Array; + setSpanList(value: Array): void; + addSpan(value: number, index?: number): void; + + hasLeadingComments(): boolean; + clearLeadingComments(): void; + getLeadingComments(): string; + setLeadingComments(value: string): void; + + hasTrailingComments(): boolean; + clearTrailingComments(): void; + getTrailingComments(): string; + setTrailingComments(value: string): void; + + clearLeadingDetachedCommentsList(): void; + getLeadingDetachedCommentsList(): Array; + setLeadingDetachedCommentsList(value: Array): void; + addLeadingDetachedComments(value: string, index?: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: Location): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Location, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Location; + static deserializeBinaryFromReader(message: Location, reader: jspb.BinaryReader): Location; + } +} + +export class GeneratedCodeInfo extends jspb.Message { + clearAnnotationList(): void; + getAnnotationList(): Array; + setAnnotationList(value: Array): void; + addAnnotation(value?: GeneratedCodeInfo.Annotation, index?: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: GeneratedCodeInfo): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: GeneratedCodeInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GeneratedCodeInfo; + static deserializeBinaryFromReader(message: GeneratedCodeInfo, reader: jspb.BinaryReader): GeneratedCodeInfo; +} + +export namespace GeneratedCodeInfo { + export class Annotation extends jspb.Message { + clearPathList(): void; + getPathList(): Array; + setPathList(value: Array): void; + addPath(value: number, index?: number): void; + + hasSourceFile(): boolean; + clearSourceFile(): void; + getSourceFile(): string; + setSourceFile(value: string): void; + + hasBegin(): boolean; + clearBegin(): void; + getBegin(): number; + setBegin(value: number): void; + + hasEnd(): boolean; + clearEnd(): void; + getEnd(): number; + setEnd(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: Annotation): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Annotation, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Annotation; + static deserializeBinaryFromReader(message: Annotation, reader: jspb.BinaryReader): Annotation; + } +} diff --git a/google-protobuf/google/protobuf/duration_pb.d.ts b/google-protobuf/google/protobuf/duration_pb.d.ts new file mode 100644 index 0000000000..1f2c6003d5 --- /dev/null +++ b/google-protobuf/google/protobuf/duration_pb.d.ts @@ -0,0 +1,18 @@ +import * as jspb from "../../index"; + +export class Duration extends jspb.Message { + getSeconds(): number; + setSeconds(value: number): void; + + getNanos(): number; + setNanos(value: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: Duration): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Duration, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Duration; + static deserializeBinaryFromReader(message: Duration, reader: jspb.BinaryReader): Duration; +} diff --git a/google-protobuf/google/protobuf/empty_pb.d.ts b/google-protobuf/google/protobuf/empty_pb.d.ts new file mode 100644 index 0000000000..1f06a3136c --- /dev/null +++ b/google-protobuf/google/protobuf/empty_pb.d.ts @@ -0,0 +1,12 @@ +import * as jspb from "../../index"; + +export class Empty extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: Empty): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Empty, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Empty; + static deserializeBinaryFromReader(message: Empty, reader: jspb.BinaryReader): Empty; +} diff --git a/google-protobuf/google/protobuf/field_mask_pb.d.ts b/google-protobuf/google/protobuf/field_mask_pb.d.ts new file mode 100644 index 0000000000..a639513909 --- /dev/null +++ b/google-protobuf/google/protobuf/field_mask_pb.d.ts @@ -0,0 +1,17 @@ +import * as jspb from "../../index"; + +export class FieldMask extends jspb.Message { + clearPathsList(): void; + getPathsList(): Array; + setPathsList(value: Array): void; + addPaths(value: string, index?: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: FieldMask): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: FieldMask, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FieldMask; + static deserializeBinaryFromReader(message: FieldMask, reader: jspb.BinaryReader): FieldMask; +} diff --git a/google-protobuf/google/protobuf/source_context_pb.d.ts b/google-protobuf/google/protobuf/source_context_pb.d.ts new file mode 100644 index 0000000000..03d8edec38 --- /dev/null +++ b/google-protobuf/google/protobuf/source_context_pb.d.ts @@ -0,0 +1,15 @@ +import * as jspb from "../../index"; + +export class SourceContext extends jspb.Message { + getFileName(): string; + setFileName(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: SourceContext): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: SourceContext, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SourceContext; + static deserializeBinaryFromReader(message: SourceContext, reader: jspb.BinaryReader): SourceContext; +} diff --git a/google-protobuf/google/protobuf/struct_pb.d.ts b/google-protobuf/google/protobuf/struct_pb.d.ts new file mode 100644 index 0000000000..0391801a70 --- /dev/null +++ b/google-protobuf/google/protobuf/struct_pb.d.ts @@ -0,0 +1,101 @@ +import * as jspb from "../../index"; + +export class Struct extends jspb.Message { + getFieldsMap(): jspb.Map; + clearFieldsMap(): void; + + toJavaScript(): {[key: string]: JavaScriptValue}; + static fromJavaScript(value: {[key: string]: JavaScriptValue}): Struct; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: Struct): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Struct, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Struct; + static deserializeBinaryFromReader(message: Struct, reader: jspb.BinaryReader): Struct; +} + +export class Value extends jspb.Message { + hasNullValue(): boolean; + clearNullValue(): void; + getNullValue(): NullValue; + setNullValue(value: NullValue): void; + + hasNumberValue(): boolean; + clearNumberValue(): void; + getNumberValue(): number; + setNumberValue(value: number): void; + + hasStringValue(): boolean; + clearStringValue(): void; + getStringValue(): string; + setStringValue(value: string): void; + + hasBoolValue(): boolean; + clearBoolValue(): void; + getBoolValue(): boolean; + setBoolValue(value: boolean): void; + + hasStructValue(): boolean; + clearStructValue(): void; + getStructValue(): Struct; + setStructValue(value: Struct): void; + + hasListValue(): boolean; + clearListValue(): void; + getListValue(): ListValue; + setListValue(value: ListValue): void; + + getKindCase(): Value.KindCase; + + toJavaScript(): JavaScriptValue; + static fromJavaScript(value: JavaScriptValue): Value; + + static deserializeBinary(bytes: Uint8Array): Value; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: Value): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Value, writer: jspb.BinaryWriter): void; + static deserializeBinaryFromReader(message: Value, reader: jspb.BinaryReader): Value; +} + +export namespace Value { + export enum KindCase { + KIND_NOT_SET = 0, + NULL_VALUE = 1, + NUMBER_VALUE = 2, + STRING_VALUE = 3, + BOOL_VALUE = 4, + STRUCT_VALUE = 5, + LIST_VALUE = 6, + } +} + +export class ListValue extends jspb.Message { + clearValuesList(): void; + getValuesList(): Array; + setValuesList(value: Array): void; + addValues(value?: Value, index?: number): void; + + toJavaScript(): Array; + static fromJavaScript(value: Array): ListValue; + + static deserializeBinary(bytes: Uint8Array): ListValue; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: ListValue): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: ListValue, writer: jspb.BinaryWriter): void; + static deserializeBinaryFromReader(message: ListValue, reader: jspb.BinaryReader): ListValue; +} + +export enum NullValue { + NULL_VALUE = 0, +} + +export type JavaScriptValue = null | number | string | boolean | Array | {}; diff --git a/google-protobuf/google/protobuf/timestamp_pb.d.ts b/google-protobuf/google/protobuf/timestamp_pb.d.ts new file mode 100644 index 0000000000..5ddee20d0c --- /dev/null +++ b/google-protobuf/google/protobuf/timestamp_pb.d.ts @@ -0,0 +1,21 @@ +import * as jspb from "../../index"; + +export class Timestamp extends jspb.Message { + getSeconds(): number; + setSeconds(value: number): void; + + getNanos(): number; + setNanos(value: number): void; + + toDate(): Date; + fromDate(date: Date): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): {}; + static toObject(includeInstance: boolean, msg: Timestamp): {}; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Timestamp, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Timestamp; + static deserializeBinaryFromReader(message: Timestamp, reader: jspb.BinaryReader): Timestamp; +} diff --git a/google-protobuf/google/protobuf/type_pb.d.ts b/google-protobuf/google/protobuf/type_pb.d.ts new file mode 100644 index 0000000000..1e857a05a6 --- /dev/null +++ b/google-protobuf/google/protobuf/type_pb.d.ts @@ -0,0 +1,191 @@ +import * as jspb from "../../index"; +import * as google_protobuf_any_pb from "./any_pb"; +import * as google_protobuf_source_context_pb from "./source_context_pb"; + +export class Type extends jspb.Message { + getName(): string; + setName(value: string): void; + + clearFieldsList(): void; + getFieldsList(): Array; + setFieldsList(value: Array): void; + addFields(value?: Field, index?: number): void; + + clearOneofsList(): void; + getOneofsList(): Array; + setOneofsList(value: Array): void; + addOneofs(value: string, index?: number): void; + + clearOptionsList(): void; + getOptionsList(): Array