Skip to content

Latest commit

 

History

History
588 lines (352 loc) · 14.2 KB

README.md

File metadata and controls

588 lines (352 loc) · 14.2 KB

@onslip/automation

@onslip/automation

Table of contents

Classes

Interfaces

Functions

Functions

collectLines

collectLines(stream): () => Promise<string[]>

Begins collecting and buffering lines from an async iterator, like the one returned by readCommandOutput. When the returned function is called, all lines are returned as an array.

Parameters

Name Type Description
stream (stopSignal: Signal<boolean>) => AsyncIterable<undefined | string> A callback that should create the async iterator and stop generating lines when the provided signal becomes true.

Returns

fn

A function that, when invoked, stops reading and returns all collected lines as an array.

▸ (): Promise<string[]>

Begins collecting and buffering lines from an async iterator, like the one returned by readCommandOutput. When the returned function is called, all lines are returned as an array.

Returns

Promise<string[]>

A function that, when invoked, stops reading and returns all collected lines as an array.

Defined in

src/utils.ts:115


execFile

execFile(file): PromiseWithChild<{ stderr: string ; stdout: string }>

Parameters

Name Type
file string

Returns

PromiseWithChild<{ stderr: string ; stdout: string }>

Defined in

src/utils.ts:7

execFile(file, args): PromiseWithChild<{ stderr: string ; stdout: string }>

Parameters

Name Type
file string
args undefined | null | readonly string[]

Returns

PromiseWithChild<{ stderr: string ; stdout: string }>

Defined in

src/utils.ts:7

execFile(file, options): PromiseWithChild<{ stderr: Buffer ; stdout: Buffer }>

Parameters

Name Type
file string
options ExecFileOptionsWithBufferEncoding

Returns

PromiseWithChild<{ stderr: Buffer ; stdout: Buffer }>

Defined in

src/utils.ts:7

execFile(file, args, options): PromiseWithChild<{ stderr: Buffer ; stdout: Buffer }>

Parameters

Name Type
file string
args undefined | null | readonly string[]
options ExecFileOptionsWithBufferEncoding

Returns

PromiseWithChild<{ stderr: Buffer ; stdout: Buffer }>

Defined in

src/utils.ts:7

execFile(file, options): PromiseWithChild<{ stderr: string ; stdout: string }>

Parameters

Name Type
file string
options ExecFileOptionsWithStringEncoding

Returns

PromiseWithChild<{ stderr: string ; stdout: string }>

Defined in

src/utils.ts:7

execFile(file, args, options): PromiseWithChild<{ stderr: string ; stdout: string }>

Parameters

Name Type
file string
args undefined | null | readonly string[]
options ExecFileOptionsWithStringEncoding

Returns

PromiseWithChild<{ stderr: string ; stdout: string }>

Defined in

src/utils.ts:7

execFile(file, options): PromiseWithChild<{ stderr: string | Buffer ; stdout: string | Buffer }>

Parameters

Name Type
file string
options ExecFileOptionsWithOtherEncoding

Returns

PromiseWithChild<{ stderr: string | Buffer ; stdout: string | Buffer }>

Defined in

src/utils.ts:7

execFile(file, args, options): PromiseWithChild<{ stderr: string | Buffer ; stdout: string | Buffer }>

Parameters

Name Type
file string
args undefined | null | readonly string[]
options ExecFileOptionsWithOtherEncoding

Returns

PromiseWithChild<{ stderr: string | Buffer ; stdout: string | Buffer }>

Defined in

src/utils.ts:7

execFile(file, options): PromiseWithChild<{ stderr: string ; stdout: string }>

Parameters

Name Type
file string
options ExecFileOptions

Returns

PromiseWithChild<{ stderr: string ; stdout: string }>

Defined in

src/utils.ts:7

execFile(file, args, options): PromiseWithChild<{ stderr: string ; stdout: string }>

Parameters

Name Type
file string
args undefined | null | readonly string[]
options ExecFileOptions

Returns

PromiseWithChild<{ stderr: string ; stdout: string }>

Defined in

src/utils.ts:7

execFile(file, options): PromiseWithChild<{ stderr: string | Buffer ; stdout: string | Buffer }>

Parameters

Name Type
file string
options undefined | null | { encoding?: null | string } & ExecFileOptions

Returns

PromiseWithChild<{ stderr: string | Buffer ; stdout: string | Buffer }>

Defined in

src/utils.ts:7

execFile(file, args, options): PromiseWithChild<{ stderr: string | Buffer ; stdout: string | Buffer }>

Parameters

Name Type
file string
args undefined | null | readonly string[]
options undefined | null | { encoding?: null | string } & ExecFileOptions

Returns

PromiseWithChild<{ stderr: string | Buffer ; stdout: string | Buffer }>

Defined in

src/utils.ts:7


findWebViewContexts

findWebViewContexts(options): Promise<AutomationContext[]>

Finds and returns a description of all matching web contexts.

Useful to find out what AutomationOptions.ctxId value to specify when calling openWebView.

Parameters

Name Type Description
options AutomationOptions Where to look for contexts.

Returns

Promise<AutomationContext[]>

A list of matching contexts.

Defined in

src/api.ts:36


mkdir

mkdir(path, options?): Promise<void>

Parameters

Name Type
path PathLike
options? null | string | number | MakeDirectoryOptions

Returns

Promise<void>

Defined in

src/utils.ts:8


openWebView

openWebView(options): Promise<Page>

Connects to a web context and return a Page.

Parameters

Name Type Description
options AutomationOptions Specify what context to use.

Returns

Promise<Page>

A new Page object which can be used to interact with the web page.

Defined in

src/api.ts:46


pipeline

pipeline(stream1, stream2): Promise<void>

Parameters

Name Type
stream1 ReadableStream
stream2 WritableStream

Returns

Promise<void>

Defined in

src/utils.ts:9

pipeline(stream1, stream2, stream3): Promise<void>

Parameters

Name Type
stream1 ReadableStream
stream2 ReadWriteStream
stream3 WritableStream

Returns

Promise<void>

Defined in

src/utils.ts:9

pipeline(stream1, stream2, stream3, stream4): Promise<void>

Parameters

Name Type
stream1 ReadableStream
stream2 ReadWriteStream
stream3 ReadWriteStream
stream4 WritableStream

Returns

Promise<void>

Defined in

src/utils.ts:9

pipeline(stream1, stream2, stream3, stream4, stream5): Promise<void>

Parameters

Name Type
stream1 ReadableStream
stream2 ReadWriteStream
stream3 ReadWriteStream
stream4 ReadWriteStream
stream5 WritableStream

Returns

Promise<void>

Defined in

src/utils.ts:9

pipeline(streams): Promise<void>

Parameters

Name Type
streams readonly (ReadableStream | WritableStream | ReadWriteStream)[]

Returns

Promise<void>

Defined in

src/utils.ts:9

pipeline(stream1, stream2, ...streams): Promise<void>

Parameters

Name Type
stream1 ReadableStream
stream2 WritableStream | ReadWriteStream
...streams (WritableStream | ReadWriteStream)[]

Returns

Promise<void>

Defined in

src/utils.ts:9


readCommandOutput

readCommandOutput(command, args, options?): AsyncGenerator<string>

Spawns a command and reads its standard output line by line.

Parameters

Name Type Description
command string The command to executed.
args string[] Command arguments.
options? ReaderOptions Reader options.

Returns

AsyncGenerator<string>

An async iterator generating one line at a time.

Defined in

src/utils.ts:47

readCommandOutput(command, args, options?, timeout?): AsyncGenerator<string | undefined>

Spawns a command and reads its standard output line by line, with heartbeats.

Parameters

Name Type Description
command string The command to executed.
args string[] Command arguments.
options? ReaderOptions Reader options.
timeout? number The timeout, in milliseconds. If no lines has been produced within this time, an undefined value is generated instead of a string.

Returns

AsyncGenerator<string | undefined>

An async iterator generating one line at a time, or undefined on timeouts.

Defined in

src/utils.ts:59


sleep

sleep(timeout): Promise<void>

Does nothing for a while.

Parameters

Name Type Description
timeout number The sleep duration in milliseconds

Returns

Promise<void>

Defined in

src/utils.ts:27


throwError

throwError(error): never

Throws an error.

throws The provided error.

Parameters

Name Type Description
error Error The error to throw.

Returns

never

Defined in

src/utils.ts:18


writeFile

writeFile(path, data, options?): Promise<void>

Parameters

Name Type
path number | PathLike
data any
options? WriteFileOptions

Returns

Promise<void>

Defined in

src/utils.ts:10