Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TypeScript types #4

Open
nathanvogel opened this issue Sep 10, 2021 · 0 comments
Open

Add TypeScript types #4

nathanvogel opened this issue Sep 10, 2021 · 0 comments

Comments

@nathanvogel
Copy link

nathanvogel commented Sep 10, 2021

Hi,
I used this library (thanks!) and made some types, so I thought I'd share (sorry for the lack of PR / DefinitelyTyped PR).
Cheers

My node-rdp.d.ts:

declare module "node-rdp" {
  interface RDPOptions {
    /**
     * address to connect to (defaults to the empty string '')
     */
    address?: string;
    /**
     * username to use for connection (defaults to the empty string '')
     */
    username?: string;
    /**
     * password to use for connection (defaults to the empty string '')
     */
    password?: string;
    /**
     * deletes credentials and temporary files after disconnection (defaults to true)
     */
    deleteCredentialsAfter?: boolean;
    /**
     * enables a "safe mode" for handling the connection (see caveats) (defaults to false)
     */
    safeMode?: boolean;
    /**
     * auto-reconnect after an erroneous disconnection (defaults to true)
     */
    autoReconnect?: boolean;
    /**
     * launch as a fullscreen application (defaults to true)
     */
    fullscreen?: boolean;
    /**
     * color depth in bits (defaults to 32)
     */
    colors?: number;
    /**
     * determines if the connection must be compressed (defaults to true)
     */
    compression?: boolean;
    /**
     * the type of the connection, can be one of 'modem', 'low', 'satellite', 'high', 'wan', 'lan', 'auto' (defaults to 'auto')
     */
    connectionType?:
      | "modem"
      | "low"
      | "satellite"
      | "high"
      | "wan"
      | "lan"
      | "auto";
    /**
     * set some connection parameters automatically depending on the detected network type (defaults to true)
     */
    networkAutoDetect?: boolean;
    /**
     * set some connection parameters automatically depending on the detected bandwidth type (defaults to true)
     */
    bandwidthAutoDetect?: boolean;
    /**
     * show the wallpaper on the remote computer (defaults to false)
     */
    showWallpaper?: boolean;
    /**
     * enable font smoothing (defaults to false)
     */
    fontSmoothing?: boolean;
    /**
     * enable desktop composition, useful for Aero (defaults to false)
     */
    desktopComposition?: boolean;
    /**
     * show full window contents while dragging (defaults to false)
     */
    showDraggedWindow?: boolean;
    /**
     * show menu animations (defaults to false)
     */
    showMenuAnimations?: boolean;
    /**
     * show themes (defaults to true)
     */
    showThemes?: boolean;
    /**
     * show blinking cursor on input controls (defaults to true)
     */
    showBlinkingCursor?: boolean;
    /**
     * determine which audio stream is played, can be one of 'local', 'remote', 'none' (defaults to 'local')
     */
    audioPlayMode?: "local" | "remove" | "none";
    /**
     * enable capturing audio on the local computer (defaults to false)
     */
    audioCaptureMode?: boolean;
    /**
     * enable local printers on the remote computer (defaults to true)
     */
    enableLocalPrinters?: boolean;
    /**
     * enable local COM ports on the remote computer (defaults to false)
     */
    enableLocalCOMPorts?: boolean;
    /**
     * enable local smart cards on the remote computer (defaults to true)
     */
    enableSmartCards?: boolean;
    /**
     * enable clipboard sharing between the local and remote computers (defaults to true)
     */
    enableClipboard?: boolean;
    /**
     * determine a subset of Plug And Play devices (separated by a semi-colon ;) based on the specified HIDs or the wildcard * (defaults to the empty string '')
     */
    enablePlugAndPlayDevices?: string;
    /**
     * determine a subset of local drives (separated by a semi-colon ;) for use on the remote computer, based on the labels or the wildcard * (defaults to the empty string '')
     */
    enableDrives?: string;
    /**
     * enable local Point of Service on the remote computer (defaults to false)
     */
    enablePos?: boolean;
    /**
     * application to launch upon connection (defaults to the empty string '')
     */
    launch?: string;
    /**
     * working directory for the application to be launched upon connection (defaults to the empty string '')
     */
    launchWorkingDirectory?: string;
  }

  /**
   * The return value will be a Promise object that will be resolved as soon as the connection is terminated.
   *
   * @param options
   */
  function rdp(options: RDPOptions): Promise<undefined>;

  export default rdp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant