Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "helpers"

Index

Type aliases

SimpleCompletedAction

SimpleCompletedAction: function

Describes a simple 'completed' action.

param

The occurred error.

param

The result.

Type declaration

    • (err?: any, result?: TResult): void
    • Parameters

      • Optional err: any
      • Optional result: TResult

      Returns void

Variables

Const CompareVersion

CompareVersion: any = require('compare-versions')

Const FTP

FTP: any = require('jsftp')

Const Glob

Glob: any = require('glob')

Const IsBinaryFile

IsBinaryFile: any = require("isbinaryfile")

Const MIME

MIME: any = require('mime')

Const MergeDeep

MergeDeep: any = require('merge-deep')

Let nextHtmlDocId

nextHtmlDocId: number = -1

Functions

applyValues

asArray

  • asArray<T>(val: T | T[]): T[]
  • Returns a value as array.

    Type parameters

    • T

    Parameters

    • val: T | T[]

      The value.

    Returns T[]

    The value as array.

cloneObject

  • cloneObject<T>(val: T): T
  • Clones an object / value deep.

    Type parameters

    • T

    Parameters

    • val: T

      The value / object to clone.

    Returns T

    The cloned value / object.

compareValues

  • compareValues<T>(x: T, y: T): number
  • Compares two values for a sort operation.

    Type parameters

    • T

    Parameters

    • x: T

      The left value.

    • y: T

      The right value.

    Returns number

    The "sort value".

compareValuesBy

  • compareValuesBy<T, U>(x: T, y: T, selector: function): number
  • Compares values by using a selector.

    Type parameters

    • T

    • U

    Parameters

    • x: T

      The left value.

    • y: T

      The right value.

    • selector: function

      The selector.

        • (t: T): U
        • Parameters

          • t: T

          Returns U

    Returns number

    The "sort value".

compareVersions

  • compareVersions(current: any, other: any): number
  • Compares two versions.

    Parameters

    • current: any

      The current value.

    • other: any

      The other value.

    Returns number

    The sort value.

createFileQuickPick

createPackageQuickPick

createSimplePromiseCompletedAction

  • createSimplePromiseCompletedAction<TResult>(resolve: Function, reject?: Function): SimpleCompletedAction<TResult>
  • Creates a simple 'completed' callback for a promise.

    Type parameters

    • TResult

    Parameters

    • resolve: Function

      The 'succeeded' callback.

    • Optional reject: Function

      The 'error' callback.

    Returns SimpleCompletedAction<TResult>

    The created action.

createTargetQuickPick

deployFiles

  • deployFiles(files: string | string[], targets: deploy_contracts.DeployTargetList, sym?: symbol): Promise<DeployFilesEventArguments>
  • Deploys files.

    Parameters

    • files: string | string[]

      The files to deploy.

    • targets: deploy_contracts.DeployTargetList

      The targets to deploy to.

    • Optional sym: symbol

    Returns Promise<DeployFilesEventArguments>

    The promise.

detectMimeByFilename

  • detectMimeByFilename(file: string, defValue?: any): string
  • Tries to detect the MIME type of a file.

    Parameters

    • file: string

      The Filename.

    • Default value defValue: any = "application/octet-stream"

      The default value.

    Returns string

    The MIME type.

distinctArray

  • distinctArray<T>(arr: T[]): T[]
  • Removes duplicate entries from an array.

    Type parameters

    • T

    Parameters

    • arr: T[]

      The input array.

    Returns T[]

    The filtered array.

doesFileMatchByFilter

  • doesFileMatchByFilter(file: string, filter: FileFilter): boolean
  • Checks if a file path does match by any pattern.

    Parameters

    • file: string

      The path to check.

    • filter: FileFilter

      The filter to use.

    Returns boolean

    Does match or not.

filterConditionalItems

filterPlatformItems

  • filterPlatformItems<T>(items: T | T[], platform?: string): T[]
  • Filters items by platform.

    Type parameters

    Parameters

    • items: T | T[]

      The items to filter.

    • Optional platform: string

    Returns T[]

    The new list of filtered items.

format

  • format(formatStr: any, ...args: any[]): string
  • Formats a string.

    Parameters

    • formatStr: any

      The value that represents the format string.

    • Rest ...args: any[]

    Returns string

    The formated string.

formatArray

  • formatArray(formatStr: any, args: any[]): string
  • Formats a string.

    Parameters

    • formatStr: any

      The value that represents the format string.

    • args: any[]

    Returns string

    The formated string.

getFilesByFilter

  • getFilesByFilter(filter: FileFilter, useGitIgnoreStylePatterns: boolean): string[]
  • Returns the list of files by a filter that should be deployed.

    Parameters

    • filter: FileFilter

      The filter.

    • useGitIgnoreStylePatterns: boolean

      Also check directory patterns, like in .gitignore files, or not.

    Returns string[]

    The list of files.

getFilesByFilterAsync

  • getFilesByFilterAsync(filter: FileFilter, useGitIgnoreStylePatterns: boolean): Promise<string[]>
  • Returns the list of files by a filter that should be deployed.

    Parameters

    • filter: FileFilter

      The filter.

    • useGitIgnoreStylePatterns: boolean

      Also check directory patterns, like in .gitignore files, or not.

    Returns Promise<string[]>

    The promise.

getFilesOfPackage

  • getFilesOfPackage(pkg: DeployPackage, useGitIgnoreStylePatterns: boolean): string[]
  • Returns the list of files of a package that should be deployed.

    Parameters

    • pkg: DeployPackage

      The package.

    • useGitIgnoreStylePatterns: boolean

      Also check directory patterns, like in .gitignore files, or not.

    Returns string[]

    The list of files.

getHttpBody

  • getHttpBody(resp: IncomingMessage): Promise<Buffer>
  • Loads the body from a HTTP response.

    Parameters

    • resp: IncomingMessage

      The response.

    Returns Promise<Buffer>

    The promise.

getSortValue

  • getSortValue(s: Sortable, nameProvider?: deploy_contracts.ValueProvider<string>): any
  • Returns the sort value from a sortable.

    Parameters

    • s: Sortable

      The sortable object.

    • Optional nameProvider: deploy_contracts.ValueProvider<string>

    Returns any

    The sort value.

getStatusBarItemColor

  • getStatusBarItemColor(err: any, succeedCount: number, failedCount: number): string
  • Returns the color for a status bar item based an operation result.

    Parameters

    • err: any

      The error.

    • succeedCount: number

      The number of successed operations.

    • failedCount: number

      The number of failed operations.

    Returns string

    The color.

getUrlParam

  • getUrlParam(params: Object, name: string): string
  • Returns the value from a "parameter" object.

    Parameters

    • params: Object

      The object.

    • name: string

      The name of the parameter.

    Returns string

    The value of the parameter (if found).

isBinaryContent

  • isBinaryContent(data: Buffer): Promise<boolean>
  • Checks if data is binary or text content.

    Parameters

    • data: Buffer

      The data to check.

    Returns Promise<boolean>

    The promise.

isEmptyString

  • isEmptyString(val: any): boolean
  • Checks if the string representation of a value is empty or contains whitespaces only.

    Parameters

    • val: any

      The value to check.

    Returns boolean

    Is empty or not.

isFileIgnored

  • isFileIgnored(file: string, patterns: string | string[], useGitIgnoreStylePatterns: boolean, fastCheck?: boolean): boolean
  • Checks if a file (or directory) path is ignored.

    Parameters

    • file: string
    • patterns: string | string[]

      One or more (glob) pattern to use.

    • useGitIgnoreStylePatterns: boolean

      Also check directory patterns, like in .gitignore files, or not.

    • Optional fastCheck: boolean

    Returns boolean

    Is ignored or not.

isNullOrUndefined

  • isNullOrUndefined(val: any): boolean
  • Checks if a value is (null) or (undefined).

    Parameters

    • val: any

      The value to check.

    Returns boolean

    Is (null)/(undefined) or not.

isNullUndefinedOrEmptyString

  • isNullUndefinedOrEmptyString(val: any): boolean
  • Checks if a value is (null), (undefined) or an empty string.

    Parameters

    • val: any

      The value to check.

    Returns boolean

    Is (null)/(undefined)/empty string or not.

loadBaseSettingsFromFiles

  • loadBaseSettingsFromFiles<T>(objs: T | T[], values?: ValueBase | ValueBase[], cloneObjects?: boolean): T[]
  • Loads base settings for object from files.

    Type parameters

    Parameters

    • objs: T | T[]

      The objects.

    • Optional values: ValueBase | ValueBase[]

      The values to use for the file path(s).

    • Default value cloneObjects: boolean = true

      Clone objects or not.

    Returns T[]

    The new list.

loadDataTransformerModule

  • Loads a "data transformer" module.

    Parameters

    • file: string

      The path of the module's file.

    • Default value useCache: boolean = false

      Use cache or not.

    Returns DataTransformModule

    The loaded module.

loadDeployScriptOperationModule

  • Loads a module for a deploy operation.

    Parameters

    • file: string

      The path of the module's file.

    • Default value useCache: boolean = false

      Use cache or not.

    Returns DeployScriptOperationModule

    The loaded module.

loadFrom

  • Loads data from a source.

    Parameters

    • src: string

      The path or URL to the source.

    Returns Promise<DownloadResult>

    The promise.

loadModule

  • loadModule<TModule>(file: string, useCache?: boolean): TModule
  • Loads a module.

    Type parameters

    • TModule

    Parameters

    • file: string

      The path of the module's file.

    • Default value useCache: boolean = false

      Use cache or not.

    Returns TModule

    The loaded module.

loadScriptCommandModule

  • Loads a script based command module.

    Parameters

    • file: string

      The path of the module's file.

    • Default value useCache: boolean = false

      Use cache or not.

    Returns ScriptCommandModule

    The loaded module.

loadValidatorModule

  • loadValidatorModule<T>(file: string, useCache?: boolean): ValidatorModule<T>
  • Loads a "validator" module.

    Type parameters

    • T

    Parameters

    • file: string

      The path of the module's file.

    • Default value useCache: boolean = false

      Use cache or not.

    Returns ValidatorModule<T>

    The loaded module.

log

  • log(msg: any): void
  • Logs a message.

    Parameters

    • msg: any

      The message to log.

    Returns void

makeEnvVarsForProcess

  • Creates a storage of nvironment variables for a process object.

    Parameters

    Returns object

    The created storage.

    • [name: string]: any

mergeInheritables

  • mergeInheritables<T>(objs: T | T[]): T[]
  • Merge inheritable objects.

    Type parameters

    Parameters

    • objs: T | T[]

      The objects to merge.

    Returns T[]

    The new and normalized list of merged objects.

normalizeString

  • normalizeString(val: any, normalizer?: function): string
  • Normalizes a value as string so that is comparable.

    Parameters

    • val: any

      The value to convert.

    • Optional normalizer: function
        • (str: string): string
        • Parameters

          • str: string

          Returns string

    Returns string

    The normalized value.

open

  • open(target: string, opts?: OpenOptions): Promise<ChildProcess>
  • Opens a target.

    Parameters

    • target: string

      The target to open.

    • Optional opts: OpenOptions

    Returns Promise<ChildProcess>

openHtmlDocument

  • openHtmlDocument(storage: Document[], html: string, title?: string, id?: any): Promise<any>
  • Opens a HTML document in a new tab for a document storage.

    Parameters

    • storage: Document[]

      The storage to open for.

    • html: string

      The HTML document (source code).

    • Optional title: string
    • Optional id: any

    Returns Promise<any>

    The promise.

parseTargetType

  • parseTargetType(str: string): string
  • Parse a value to use as "target type" value.

    Parameters

    • str: string

    Returns string

    The output value.

readHttpBody

  • readHttpBody(msg: IncomingMessage): Promise<Buffer>
  • Reads the content of the HTTP request body.

    Parameters

    • msg: IncomingMessage

      The HTTP message with the body.

    Returns Promise<Buffer>

    The promise.

readSocket

  • readSocket(socket: Socket, numberOfBytes: number): Promise<Buffer>
  • Reads a number of bytes from a socket.

    Parameters

    • socket: Socket

      The socket.

    • numberOfBytes: number

      The amount of bytes to read.

    Returns Promise<Buffer>

    The promise.

removeDocuments

replaceAllStrings

  • replaceAllStrings(str: string, searchValue: string, replaceValue: string): string
  • Replaces all occurrences of a string.

    Parameters

    • str: string

      The input string.

    • searchValue: string

      The value to search for.

    • replaceValue: string

      The value to replace 'searchValue' with.

    Returns string

    The output string.

sortPackages

  • Sorts a list of packages.

    Parameters

    • pkgs: DeployPackage[]

      The input list.

    • Optional nameProvider: deploy_contracts.ValueProvider<string>

    Returns DeployPackage[]

    The sorted list.

sortTargets

  • Sorts a list of targets.

    Parameters

    • targets: DeployTarget[]

      The input list.

    • Optional nameProvider: deploy_contracts.ValueProvider<string>

    Returns DeployTarget[]

    The sorted list.

toArray

  • toArray<T>(arr: ArrayLike<T>, normalize?: boolean): T[]
  • Returns an array like object as new array.

    Type parameters

    • T

    Parameters

    • arr: ArrayLike<T>

      The input object.

    • Default value normalize: boolean = true

    Returns T[]

    The input object as array.

toBooleanSafe

  • toBooleanSafe(val: any, defaultValue?: any): boolean
  • Converts a value to a boolean.

    Parameters

    • val: any

      The value to convert.

    • Default value defaultValue: any = false

      The value to return if 'val' is (null) or (undefined).

    Returns boolean

    The converted value.

toDataTransformerSafe

  • toDataTransformerSafe(transformer: deploy_contracts.DataTransformer): deploy_contracts.DataTransformer
  • Keeps sure to return a "data transformer" that is NOT (null) or (undefined).

    Parameters

    • transformer: deploy_contracts.DataTransformer

      The input value.

    Returns deploy_contracts.DataTransformer

    The output value.

toRelativePath

  • toRelativePath(path: string, baseDir?: string): string | false
  • Tries to convert a file path to a relative path.

    Parameters

    • path: string

      The path to convert.

    • Optional baseDir: string

    Returns string | false

    The relative path or (false) if not possible.

toRelativeTargetPath

  • toRelativeTargetPath(path: string, target: DeployTarget, baseDir?: string): string | false
  • Tries to convert a file path to a relative path by using the mappings of a target.

    Parameters

    • path: string

      The path to convert.

    • target: DeployTarget

      The target.

    • Optional baseDir: string

    Returns string | false

    The relative path or (false) if not possible.

toRelativeTargetPathWithValues

  • Tries to convert a file path to a relative path by using the mappings of a target and placeholders / values.

    Parameters

    Returns string | false

    The relative path or (false) if not possible.

toStringSafe

  • toStringSafe(str: any, defValue?: any): string
  • Converts a value to a string that is NOT (null) or (undefined).

    Parameters

    • str: any

      The input value.

    • Default value defValue: any = ""

      The default value.

    Returns string

    The output value.

toValidatorSafe

  • toValidatorSafe<T>(validator: deploy_contracts.Validator<T>): deploy_contracts.Validator<T>
  • Keeps sure to return a "validator" that is NOT (null) or (undefined).

    Type parameters

    • T

    Parameters

    • validator: deploy_contracts.Validator<T>

      The input value.

    Returns deploy_contracts.Validator<T>

    The output value.

tryClearTimeout

  • tryClearTimeout(timeoutId: Timer): boolean
  • Tries to clear a timeout.

    Parameters

    • timeoutId: Timer

      The timeout (ID).

    Returns boolean

    Operation was successful or not.

tryDispose

  • tryDispose(obj: vscode.Disposable): boolean
  • Tries to dispose an object.

    Parameters

    • obj: vscode.Disposable

      The object to dispose.

    Returns boolean

    Operation was successful or not.

uriParamsToObject

  • uriParamsToObject(uri: vscode.Uri): Object
  • Extracts the query parameters of an URI to an object.

    Parameters

    • uri: vscode.Uri

      The URI.

    Returns Object

    The parameters of the URI as object.

Generated using TypeDoc