diff --git a/.vitepress/sidebars/reference.ts b/.vitepress/sidebars/reference.ts index 2eef46b..7e89c48 100644 --- a/.vitepress/sidebars/reference.ts +++ b/.vitepress/sidebars/reference.ts @@ -15,15 +15,277 @@ export const referenceSidebar: DefaultTheme.SidebarItem[] = [ items: [ { text: "Backend", - link: "/reference/sdks/backend/", + collapsed: false, + items: [ + { + text: "@caido/sdk-backend", + link: "/reference/sdks/backend/", + }, + { + text: "API", + link: "/reference/sdks/backend/api", + }, + { + text: "Environment", + link: "/reference/sdks/backend/environment", + }, + { + text: "Events", + link: "/reference/sdks/backend/events", + }, + { + text: "Findings", + link: "/reference/sdks/backend/findings", + }, + { + text: "GraphQL", + link: "/reference/sdks/backend/graphql", + }, + { + text: "HostedFile", + link: "/reference/sdks/backend/hostedfile", + }, + { + text: "Meta", + link: "/reference/sdks/backend/meta", + }, + { + text: "Other", + link: "/reference/sdks/backend/other", + }, + { + text: "Projects", + link: "/reference/sdks/backend/projects", + }, + { + text: "Replay", + link: "/reference/sdks/backend/replay", + }, + { + text: "Requests", + link: "/reference/sdks/backend/requests", + }, + { + text: "Runtime", + link: "/reference/sdks/backend/runtime", + }, + { + text: "Scope", + link: "/reference/sdks/backend/scope", + }, + { + text: "Shared", + link: "/reference/sdks/backend/shared", + }, + ], }, { text: "Frontend", - link: "/reference/sdks/frontend/", + collapsed: false, + items: [ + { + text: "@caido/sdk-frontend", + link: "/reference/sdks/frontend/", + }, + { + text: "AI", + link: "/reference/sdks/frontend/ai", + }, + { + text: "Automate", + link: "/reference/sdks/frontend/automate", + }, + { + text: "Backend", + link: "/reference/sdks/frontend/backend", + }, + { + text: "Command Palette", + link: "/reference/sdks/frontend/command-palette", + }, + { + text: "Commands", + link: "/reference/sdks/frontend/commands", + }, + { + text: "Editor", + link: "/reference/sdks/frontend/editor", + }, + { + text: "Environment", + link: "/reference/sdks/frontend/environment", + }, + { + text: "Files", + link: "/reference/sdks/frontend/files", + }, + { + text: "Filter", + link: "/reference/sdks/frontend/filter", + }, + { + text: "Filters", + link: "/reference/sdks/frontend/filters", + }, + { + text: "Findings", + link: "/reference/sdks/frontend/findings", + }, + { + text: "Footer", + link: "/reference/sdks/frontend/footer", + }, + { + text: "HTTP History", + link: "/reference/sdks/frontend/http-history", + }, + { + text: "Intercept", + link: "/reference/sdks/frontend/intercept", + }, + { + text: "JSON", + link: "/reference/sdks/frontend/json", + }, + { + text: "Log", + link: "/reference/sdks/frontend/log", + }, + { + text: "Match and Replace", + link: "/reference/sdks/frontend/match-and-replace", + }, + { + text: "Menu", + link: "/reference/sdks/frontend/menu", + }, + { + text: "Navigation", + link: "/reference/sdks/frontend/navigation", + }, + { + text: "Other", + link: "/reference/sdks/frontend/other", + }, + { + text: "Projects", + link: "/reference/sdks/frontend/projects", + }, + { + text: "Replay", + link: "/reference/sdks/frontend/replay", + }, + { + text: "Request", + link: "/reference/sdks/frontend/request", + }, + { + text: "Runtime", + link: "/reference/sdks/frontend/runtime", + }, + { + text: "Scopes", + link: "/reference/sdks/frontend/scopes", + }, + { + text: "Search", + link: "/reference/sdks/frontend/search", + }, + { + text: "Shortcuts", + link: "/reference/sdks/frontend/shortcuts", + }, + { + text: "Sidebar", + link: "/reference/sdks/frontend/sidebar", + }, + { + text: "Sitemap", + link: "/reference/sdks/frontend/sitemap", + }, + { + text: "Slots", + link: "/reference/sdks/frontend/slots", + }, + { + text: "Storage", + link: "/reference/sdks/frontend/storage", + }, + { + text: "UI", + link: "/reference/sdks/frontend/ui", + }, + { + text: "Utils", + link: "/reference/sdks/frontend/utils", + }, + { + text: "Window", + link: "/reference/sdks/frontend/window", + }, + { + text: "Workflows", + link: "/reference/sdks/frontend/workflows", + }, + ], }, { text: "Workflow", - link: "/reference/sdks/workflow/", + collapsed: false, + items: [ + { + text: "@caido/sdk-workflow", + link: "/reference/sdks/workflow/", + }, + { + text: "Data", + link: "/reference/sdks/workflow/data", + }, + { + text: "Environment", + link: "/reference/sdks/workflow/environment", + }, + { + text: "Findings", + link: "/reference/sdks/workflow/findings", + }, + { + text: "GraphQL", + link: "/reference/sdks/workflow/graphql", + }, + { + text: "HostedFile", + link: "/reference/sdks/workflow/hostedfile", + }, + { + text: "Other", + link: "/reference/sdks/workflow/other", + }, + { + text: "Projects", + link: "/reference/sdks/workflow/projects", + }, + { + text: "Replay", + link: "/reference/sdks/workflow/replay", + }, + { + text: "Requests", + link: "/reference/sdks/workflow/requests", + }, + { + text: "Runtime", + link: "/reference/sdks/workflow/runtime", + }, + { + text: "Scope", + link: "/reference/sdks/workflow/scope", + }, + { + text: "Shared", + link: "/reference/sdks/workflow/shared", + }, + ], }, ], }, diff --git a/src/reference/modules/caido/http.md b/src/reference/modules/caido/http.md index 7811037..6fba7dd 100644 --- a/src/reference/modules/caido/http.md +++ b/src/reference/modules/caido/http.md @@ -10,13 +10,13 @@ A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates i #### Extended by -- [`File`](http.md#file) +- [`File`](#file) #### Constructors -##### new Blob() +##### Constructor -> **new Blob**(`parts`: (`string` \| `ArrayBuffer` \| [`Blob`](http.md#blob))[], `opts`?: [`BlobOpts`](http.md#blobopts)): [`Blob`](http.md#blob) +> **new Blob**(`parts`: (`string` \| `ArrayBuffer` \| [`Blob`](#blob))[], `opts?`: [`BlobOpts`](#blobopts)): [`Blob`](#blob) Creates a new `Blob` object containing a concatenation of the given sources. @@ -29,12 +29,12 @@ String sources are also copied into the `Blob`. | Parameter | Type | | ------ | ------ | -| `parts` | (`string` \| `ArrayBuffer` \| [`Blob`](http.md#blob))[] | -| `opts`? | [`BlobOpts`](http.md#blobopts) | +| `parts` | (`string` \| `ArrayBuffer` \| [`Blob`](#blob))[] | +| `opts?` | [`BlobOpts`](#blobopts) | ###### Returns -[`Blob`](http.md#blob) +[`Blob`](#blob) #### Properties @@ -75,7 +75,7 @@ Returns a promise that resolves with an Uint8Array containing the contents of th ##### slice() -> **slice**(`start`?: `number`, `end`?: `number`, `type`?: `string`): [`Blob`](http.md#blob) +> **slice**(`start?`: `number`, `end?`: `number`, `type?`: `string`): [`Blob`](#blob) Creates and returns a new `Blob` containing a subset of this `Blob` objects data. The original `Blob` is not altered. @@ -84,13 +84,13 @@ data. The original `Blob` is not altered. | Parameter | Type | Description | | ------ | ------ | ------ | -| `start`? | `number` | The starting index. | -| `end`? | `number` | The ending index. | -| `type`? | `string` | The content-type for the new `Blob` | +| `start?` | `number` | The starting index. | +| `end?` | `number` | The ending index. | +| `type?` | `string` | The content-type for the new `Blob` | ###### Returns -[`Blob`](http.md#blob) +[`Blob`](#blob) ##### text() @@ -110,13 +110,13 @@ A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates i #### Extends -- [`Blob`](http.md#blob) +- [`Blob`](#blob) #### Constructors -##### new File() +##### Constructor -> **new File**(`data`: (`string` \| `ArrayBuffer` \| [`Blob`](http.md#blob))[], `fileName`: `string`, `opts`?: [`FileOpts`](http.md#fileopts)): [`File`](http.md#file) +> **new File**(`data`: (`string` \| `ArrayBuffer` \| [`Blob`](#blob))[], `fileName`: `string`, `opts?`: [`FileOpts`](#fileopts)): [`File`](#file) Returns a newly constructed File. @@ -124,17 +124,17 @@ Returns a newly constructed File. | Parameter | Type | | ------ | ------ | -| `data` | (`string` \| `ArrayBuffer` \| [`Blob`](http.md#blob))[] | +| `data` | (`string` \| `ArrayBuffer` \| [`Blob`](#blob))[] | | `fileName` | `string` | -| `opts`? | [`FileOpts`](http.md#fileopts) | +| `opts?` | [`FileOpts`](#fileopts) | ###### Returns -[`File`](http.md#file) +[`File`](#file) ###### Overrides -[`Blob`](http.md#blob).[`constructor`](http.md#constructors) +[`Blob`](#blob).[`constructor`](#constructor) #### Properties @@ -159,7 +159,7 @@ The total size of the `Blob` in bytes. ###### Inherited from -[`Blob`](http.md#blob).[`size`](http.md#size) +[`Blob`](#blob).[`size`](#size) ##### type @@ -169,7 +169,7 @@ The content-type of the `Blob`. ###### Inherited from -[`Blob`](http.md#blob).[`type`](http.md#type) +[`Blob`](#blob).[`type`](#type) #### Methods @@ -186,7 +186,7 @@ the `Blob` data. ###### Inherited from -[`Blob`](http.md#blob).[`arrayBuffer`](http.md#arraybuffer) +[`Blob`](#blob).[`arrayBuffer`](#arraybuffer) ##### bytes() @@ -200,11 +200,11 @@ Returns a promise that resolves with an Uint8Array containing the contents of th ###### Inherited from -[`Blob`](http.md#blob).[`bytes`](http.md#bytes) +[`Blob`](#blob).[`bytes`](#bytes) ##### slice() -> **slice**(`start`?: `number`, `end`?: `number`, `type`?: `string`): [`Blob`](http.md#blob) +> **slice**(`start?`: `number`, `end?`: `number`, `type?`: `string`): [`Blob`](#blob) Creates and returns a new `Blob` containing a subset of this `Blob` objects data. The original `Blob` is not altered. @@ -213,17 +213,17 @@ data. The original `Blob` is not altered. | Parameter | Type | Description | | ------ | ------ | ------ | -| `start`? | `number` | The starting index. | -| `end`? | `number` | The ending index. | -| `type`? | `string` | The content-type for the new `Blob` | +| `start?` | `number` | The starting index. | +| `end?` | `number` | The ending index. | +| `type?` | `string` | The content-type for the new `Blob` | ###### Returns -[`Blob`](http.md#blob) +[`Blob`](#blob) ###### Inherited from -[`Blob`](http.md#blob).[`slice`](http.md#slice) +[`Blob`](#blob).[`slice`](#slice) ##### text() @@ -237,7 +237,7 @@ Returns a promise that fulfills with the contents of the `Blob` decoded as a UTF ###### Inherited from -[`Blob`](http.md#blob).[`text`](http.md#text) +[`Blob`](#blob).[`text`](#text) *** @@ -249,9 +249,9 @@ Returns a promise that fulfills with the contents of the `Blob` decoded as a UTF #### Constructors -##### new Headers() +##### Constructor -> **new Headers**(`opts`?: [`HeadersOpts`](http.md#headersopts)): [`Headers`](http.md#headers) +> **new Headers**(`opts?`: [`HeadersOpts`](#headersopts)): [`Headers`](#headers) Creates a new Headers object. @@ -259,11 +259,11 @@ Creates a new Headers object. | Parameter | Type | | ------ | ------ | -| `opts`? | [`HeadersOpts`](http.md#headersopts) | +| `opts?` | [`HeadersOpts`](#headersopts) | ###### Returns -[`Headers`](http.md#headers) +[`Headers`](#headers) #### Properties @@ -340,7 +340,7 @@ Executes a provided function once for each key/value pair in this Headers object ##### get() -> `readonly` **get**: (`name`: `string`) => `null` \| `string` +> `readonly` **get**: (`name`: `string`) => `string` \| `null` A String sequence representing the values of the retrieved header or null if this header is not set. @@ -352,7 +352,7 @@ A String sequence representing the values of the retrieved header or null if thi ###### Returns -`null` \| `string` +`string` \| `null` ##### getSetCookie() @@ -425,9 +425,9 @@ The Request interface of the Fetch API represents a resource request. #### Constructors -##### new Request() +##### Constructor -> **new Request**(`input`: `string` \| [`Request`](http.md#request), `init`?: [`RequestOpts`](http.md#requestopts)): [`Request`](http.md#request) +> **new Request**(`input`: `string` \| [`Request`](#request), `init?`: [`RequestOpts`](#requestopts)): [`Request`](#request) Creates a new Request object. @@ -435,12 +435,12 @@ Creates a new Request object. | Parameter | Type | | ------ | ------ | -| `input` | `string` \| [`Request`](http.md#request) | -| `init`? | [`RequestOpts`](http.md#requestopts) | +| `input` | `string` \| [`Request`](#request) | +| `init?` | [`RequestOpts`](#requestopts) | ###### Returns -[`Request`](http.md#request) +[`Request`](#request) #### Properties @@ -456,17 +456,17 @@ Returns a promise that resolves with an ArrayBuffer representation of the reques ##### blob() -> `readonly` **blob**: () => `Promise`\<[`Blob`](http.md#blob)\> +> `readonly` **blob**: () => `Promise`\<[`Blob`](#blob)\> -Returns a promise that resolves with a [Blob](http.md#blob) representation of the request body. +Returns a promise that resolves with a [Blob](#blob) representation of the request body. ###### Returns -`Promise`\<[`Blob`](http.md#blob)\> +`Promise`\<[`Blob`](#blob)\> ##### body -> `readonly` **body**: [`Body`](http.md#body-3) +> `readonly` **body**: [`Body`](#body-3) The body content. @@ -494,17 +494,17 @@ Contains the cache mode of the request ##### clone() -> `readonly` **clone**: () => [`Request`](http.md#request) +> `readonly` **clone**: () => [`Request`](#request) -Creates a copy of the current [Request](http.md#request) object. +Creates a copy of the current [Request](#request) object. ###### Returns -[`Request`](http.md#request) +[`Request`](#request) ##### headers -> `readonly` **headers**: [`Headers`](http.md#headers) +> `readonly` **headers**: [`Headers`](#headers) Contains the associated Headers object of the request. @@ -567,9 +567,9 @@ The Response interface of the Fetch API represents the response to a request. #### Constructors -##### new Response() +##### Constructor -> **new Response**(`body`?: [`Body`](http.md#body-3), `opts`?: [`ResponseOpts`](http.md#responseopts)): [`Response`](http.md#response) +> **new Response**(`body?`: [`Body`](#body-3), `opts?`: [`ResponseOpts`](#responseopts)): [`Response`](#response) Creates a new Response object. @@ -577,12 +577,12 @@ Creates a new Response object. | Parameter | Type | | ------ | ------ | -| `body`? | [`Body`](http.md#body-3) | -| `opts`? | [`ResponseOpts`](http.md#responseopts) | +| `body?` | [`Body`](#body-3) | +| `opts?` | [`ResponseOpts`](#responseopts) | ###### Returns -[`Response`](http.md#response) +[`Response`](#response) #### Properties @@ -598,13 +598,13 @@ Returns a promise that resolves with an ArrayBuffer representation of the respon ##### blob() -> `readonly` **blob**: () => `Promise`\<[`Blob`](http.md#blob)\> +> `readonly` **blob**: () => `Promise`\<[`Blob`](#blob)\> -Returns a promise that resolves with a [Blob](http.md#blob) representation of the response body. +Returns a promise that resolves with a [Blob](#blob) representation of the response body. ###### Returns -`Promise`\<[`Blob`](http.md#blob)\> +`Promise`\<[`Blob`](#blob)\> ##### body @@ -620,19 +620,19 @@ Stores a boolean value that declares whether the body has been used in a respons ##### clone() -> `readonly` **clone**: () => [`Response`](http.md#response) +> `readonly` **clone**: () => [`Response`](#response) -Creates a clone of a [Response](http.md#response) object. +Creates a clone of a [Response](#response) object. ###### Returns -[`Response`](http.md#response) +[`Response`](#response) ##### headers -> `readonly` **headers**: [`Headers`](http.md#headers) +> `readonly` **headers**: [`Headers`](#headers) -The [Headers](http.md#headers) object associated with the response. +The [Headers](#headers) object associated with the response. ##### json() @@ -680,7 +680,7 @@ Returns a promise that resolves with a text representation of the response body. ##### type -> `readonly` **type**: [`ResponseType`](http.md#responsetype) +> `readonly` **type**: [`ResponseType`](#responsetype-1) The type of the response. @@ -692,47 +692,47 @@ The type of the response. ##### error() -> `static` **error**(): [`Response`](http.md#response) +> `static` **error**(): [`Response`](#response) -Returns a new [Response](http.md#response) object associated with a network error. +Returns a new [Response](#response) object associated with a network error. ###### Returns -[`Response`](http.md#response) +[`Response`](#response) ##### json() -> `static` **json**(`data`: `any`, `init`?: [`ResponseInit`](http.md#responseinit)): [`Response`](http.md#response) +> `static` **json**(`data`: `any`, `init?`: [`ResponseInit`](#responseinit)): [`Response`](#response) -Returns a new [Response](http.md#response) object for returning the provided JSON encoded data. +Returns a new [Response](#response) object for returning the provided JSON encoded data. ###### Parameters | Parameter | Type | | ------ | ------ | | `data` | `any` | -| `init`? | [`ResponseInit`](http.md#responseinit) | +| `init?` | [`ResponseInit`](#responseinit) | ###### Returns -[`Response`](http.md#response) +[`Response`](#response) ##### redirect() -> `static` **redirect**(`url`: `string`, `status`?: `number`): [`Response`](http.md#response) +> `static` **redirect**(`url`: `string`, `status?`: `number`): [`Response`](#response) -Returns a new [Response](http.md#response) with a different URL. +Returns a new [Response](#response) with a different URL. ###### Parameters | Parameter | Type | | ------ | ------ | | `url` | `string` | -| `status`? | `number` | +| `status?` | `number` | ###### Returns -[`Response`](http.md#response) +[`Response`](#response) ## Interfaces @@ -740,7 +740,7 @@ Returns a new [Response](http.md#response) with a different URL. #### Extended by -- [`FileOpts`](http.md#fileopts) +- [`FileOpts`](#fileopts) #### Properties @@ -764,7 +764,7 @@ however no validation of the type format is performed. #### Extends -- [`BlobOpts`](http.md#blobopts) +- [`BlobOpts`](#blobopts) #### Properties @@ -777,7 +777,7 @@ will be converted to the platform native line-ending as specified by `import { E ###### Inherited from -[`BlobOpts`](http.md#blobopts).[`endings`](http.md#endings) +[`BlobOpts`](#blobopts).[`endings`](#endings) ##### lastModified? @@ -795,7 +795,7 @@ however no validation of the type format is performed. ###### Inherited from -[`BlobOpts`](http.md#blobopts).[`type`](http.md#type-3) +[`BlobOpts`](#blobopts).[`type`](#type-3) *** @@ -805,11 +805,11 @@ however no validation of the type format is performed. ##### body? -> `optional` **body**: [`Blob`](http.md#blob) +> `optional` **body**: [`Blob`](#blob) ##### headers? -> `optional` **headers**: [`HeadersLike`](http.md#headerslike) +> `optional` **headers**: [`HeadersLike`](#headerslike) ##### method? @@ -829,13 +829,13 @@ however no validation of the type format is performed. #### Extended by -- [`ResponseOpts`](http.md#responseopts) +- [`ResponseOpts`](#responseopts) #### Properties ##### headers? -> `readonly` `optional` **headers**: [`HeadersLike`](http.md#headerslike) +> `readonly` `optional` **headers**: [`HeadersLike`](#headerslike) ##### status? @@ -851,17 +851,17 @@ however no validation of the type format is performed. #### Extends -- [`ResponseInit`](http.md#responseinit) +- [`ResponseInit`](#responseinit) #### Properties ##### headers? -> `readonly` `optional` **headers**: [`HeadersLike`](http.md#headerslike) +> `readonly` `optional` **headers**: [`HeadersLike`](#headerslike) ###### Inherited from -[`ResponseInit`](http.md#responseinit).[`headers`](http.md#headers-4) +[`ResponseInit`](#responseinit).[`headers`](#headers-4) ##### signal? @@ -873,7 +873,7 @@ however no validation of the type format is performed. ###### Inherited from -[`ResponseInit`](http.md#responseinit).[`status`](http.md#status-1) +[`ResponseInit`](#responseinit).[`status`](#status-1) ##### statusText? @@ -881,7 +881,7 @@ however no validation of the type format is performed. ###### Inherited from -[`ResponseInit`](http.md#responseinit).[`statusText`](http.md#statustext-1) +[`ResponseInit`](#responseinit).[`statusText`](#statustext-1) ##### url? @@ -891,54 +891,54 @@ however no validation of the type format is performed. ### Body -> **Body**: [`ArrayBufferView`](../llrt/globals/namespaces/QuickJS.md#arraybufferview) \| [`Blob`](http.md#blob) \| `null` +> **Body** = [`ArrayBufferView`](../llrt/globals/namespaces/QuickJS.md#arraybufferview) \| [`Blob`](#blob) \| `null` -The `Body` of a [Response](http.md#response) or [Request](http.md#request). +The `Body` of a [Response](#response) or [Request](#request). Currently NOT a `ReadableStream`. *** ### HeadersLike -> **HeadersLike**: `Record`\<`string`, `string`\> \| [`Headers`](http.md#headers) +> **HeadersLike** = `Record`\<`string`, `string`\> \| [`Headers`](#headers) *** ### HeadersOpts -> **HeadersOpts**: `string`[][] \| [`HeadersLike`](http.md#headerslike) +> **HeadersOpts** = `string`[][] \| [`HeadersLike`](#headerslike) *** ### RequestCache -> **RequestCache**: `"no-cache"` +> **RequestCache** = `"no-cache"` *** ### RequestMode -> **RequestMode**: `"navigate"` +> **RequestMode** = `"navigate"` *** ### ResponseType -> **ResponseType**: `"basic"` \| `"error"` +> **ResponseType** = `"basic"` \| `"error"` ## Functions ### fetch() -> **fetch**(`input`: `string` \| [`Request`](http.md#request), `init`?: [`RequestOpts`](http.md#requestopts)): `Promise`\<[`Response`](http.md#response)\> +> **fetch**(`input`: `string` \| [`Request`](#request), `init?`: [`RequestOpts`](#requestopts)): `Promise`\<[`Response`](#response)\> #### Parameters | Parameter | Type | | ------ | ------ | -| `input` | `string` \| [`Request`](http.md#request) | -| `init`? | [`RequestOpts`](http.md#requestopts) | +| `input` | `string` \| [`Request`](#request) | +| `init?` | [`RequestOpts`](#requestopts) | #### Returns -`Promise`\<[`Response`](http.md#response)\> +`Promise`\<[`Response`](#response)\> diff --git a/src/reference/modules/extra/console.md b/src/reference/modules/extra/console.md index 8cacfa1..86966fe 100644 --- a/src/reference/modules/extra/console.md +++ b/src/reference/modules/extra/console.md @@ -6,17 +6,19 @@ ### Console -> **Console**: `object` +> **Console** = `object` Console interface for logging. Currently logs are only available in the backend logs. See the [documentation](https://docs.caido.io/report_bug.html#1-backend-logs) on how to retrieve them. -#### Type declaration +#### Methods ##### debug() +> **debug**(`message`: `any`): `void` + Log a message with the debug level. Usually used for troubleshooting purposes. @@ -33,6 +35,8 @@ Usually used for troubleshooting purposes. ##### error() +> **error**(`message`: `any`): `void` + Log a message with the error level. Usually used for critical errors. @@ -49,6 +53,8 @@ Usually used for critical errors. ##### log() +> **log**(`message`: `any`): `void` + Log a message with the info level. Usually used for general information. @@ -65,6 +71,8 @@ Usually used for general information. ##### warn() +> **warn**(`message`: `any`): `void` + Log a message with the warn level. Usually used for unexpected behaviors. @@ -83,4 +91,4 @@ Usually used for unexpected behaviors. ### console -> **console**: [`Console`](console.md#console) +> **console**: [`Console`](#console) diff --git a/src/reference/modules/extra/sqlite.md b/src/reference/modules/extra/sqlite.md index 9667639..6cb941f 100644 --- a/src/reference/modules/extra/sqlite.md +++ b/src/reference/modules/extra/sqlite.md @@ -21,13 +21,13 @@ await db.exec("INSERT INTO test (name) VALUES ('foo');"); #### Constructors -##### new Database() +##### Constructor -> **new Database**(): [`Database`](sqlite.md#database) +> **new Database**(): [`Database`](#database) ###### Returns -[`Database`](sqlite.md#database) +[`Database`](#database) #### Methods @@ -49,7 +49,7 @@ This method allows one or more SQL statements to be executed without returning a ##### prepare() -> **prepare**(`sql`: `string`): `Promise`\<[`Statement`](sqlite.md#statement)\> +> **prepare**(`sql`: `string`): `Promise`\<[`Statement`](#statement)\> Compiles a SQL statement into a [prepared statement](https://www.sqlite.org/c3ref/stmt.html). @@ -61,7 +61,7 @@ Compiles a SQL statement into a [prepared statement](https://www.sqlite.org/c3re ###### Returns -`Promise`\<[`Statement`](sqlite.md#statement)\> +`Promise`\<[`Statement`](#statement)\> *** @@ -72,19 +72,19 @@ Instead, instances are created via the database.prepare() method. #### Constructors -##### new Statement() +##### Constructor -> **new Statement**(): [`Statement`](sqlite.md#statement) +> **new Statement**(): [`Statement`](#statement) ###### Returns -[`Statement`](sqlite.md#statement) +[`Statement`](#statement) #### Methods ##### all() -> **all**\<`T`\>(...`params`: [`Parameter`](sqlite.md#parameter)[]): `Promise`\<`T`[]\> +> **all**\<`T`\>(...`params`: [`Parameter`](#parameter)[]): `Promise`\<`T`[]\> This method executes a prepared statement and returns all results as an array of objects. If the prepared statement does not return any results, this method returns an empty array. @@ -100,7 +100,7 @@ The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_ | Parameter | Type | Description | | ------ | ------ | ------ | -| ...`params` | [`Parameter`](sqlite.md#parameter)[] | The values to bind to the prepared statement. Named parameters are not supported. | +| ...`params` | [`Parameter`](#parameter)[] | The values to bind to the prepared statement. Named parameters are not supported. | ###### Returns @@ -108,7 +108,7 @@ The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_ ##### get() -> **get**\<`T`\>(...`params`: [`Parameter`](sqlite.md#parameter)[]): `Promise`\<`undefined` \| `T`\> +> **get**\<`T`\>(...`params`: [`Parameter`](#parameter)[]): `Promise`\<`T` \| `undefined`\> This method executes a prepared statement and returns the first result as an object. If the prepared statement does not return any results, this method returns undefined. @@ -124,15 +124,15 @@ The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_ | Parameter | Type | Description | | ------ | ------ | ------ | -| ...`params` | [`Parameter`](sqlite.md#parameter)[] | The values to bind to the prepared statement. Named parameters are not supported. | +| ...`params` | [`Parameter`](#parameter)[] | The values to bind to the prepared statement. Named parameters are not supported. | ###### Returns -`Promise`\<`undefined` \| `T`\> +`Promise`\<`T` \| `undefined`\> ##### run() -> **run**(...`params`: [`Parameter`](sqlite.md#parameter)[]): `Promise`\<[`Result`](sqlite.md#result)\> +> **run**(...`params`: [`Parameter`](#parameter)[]): `Promise`\<[`Result`](#result)\> This method executes a prepared statement and returns an object summarizing the resulting changes. The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the values in params. @@ -141,19 +141,19 @@ The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_ | Parameter | Type | Description | | ------ | ------ | ------ | -| ...`params` | [`Parameter`](sqlite.md#parameter)[] | The values to bind to the prepared statement. Named parameters are not supported. | +| ...`params` | [`Parameter`](#parameter)[] | The values to bind to the prepared statement. Named parameters are not supported. | ###### Returns -`Promise`\<[`Result`](sqlite.md#result)\> +`Promise`\<[`Result`](#result)\> ## Type Aliases ### OpenOptions -> **OpenOptions**: `object` +> **OpenOptions** = `object` -#### Type declaration +#### Properties ##### busyTimeout? @@ -268,15 +268,15 @@ true ### Parameter -> **Parameter**: `null` \| `number` \| `bigint` \| `string` \| `Uint8Array` +> **Parameter** = `null` \| `number` \| `bigint` \| `string` \| `Uint8Array` *** ### Result -> **Result**: `object` +> **Result** = `object` -#### Type declaration +#### Properties ##### changes @@ -290,7 +290,7 @@ true ### open() -> **open**(`options`: [`OpenOptions`](sqlite.md#openoptions)): `Promise`\<[`Database`](sqlite.md#database)\> +> **open**(`options`: [`OpenOptions`](#openoptions)): `Promise`\<[`Database`](#database)\> Open a SQLite database. @@ -298,8 +298,8 @@ Open a SQLite database. | Parameter | Type | Description | | ------ | ------ | ------ | -| `options` | [`OpenOptions`](sqlite.md#openoptions) | The options to open the database. | +| `options` | [`OpenOptions`](#openoptions) | The options to open the database. | #### Returns -`Promise`\<[`Database`](sqlite.md#database)\> +`Promise`\<[`Database`](#database)\> diff --git a/src/reference/modules/extra/timers.md b/src/reference/modules/extra/timers.md index d31efe6..bc70190 100644 --- a/src/reference/modules/extra/timers.md +++ b/src/reference/modules/extra/timers.md @@ -11,19 +11,19 @@ scheduled actions. #### Constructors -##### new Timeout() +##### Constructor -> **new Timeout**(): [`Timeout`](timers.md#timeout) +> **new Timeout**(): [`Timeout`](#timeout) ###### Returns -[`Timeout`](timers.md#timeout) +[`Timeout`](#timeout) ## Functions ### clearInterval() -> **clearInterval**(`interval`: [`Timeout`](timers.md#timeout)): `void` +> **clearInterval**(`interval`: [`Timeout`](#timeout)): `void` Cancels a `Timeout` object created by `setInterval()`. @@ -31,7 +31,7 @@ Cancels a `Timeout` object created by `setInterval()`. | Parameter | Type | | ------ | ------ | -| `interval` | [`Timeout`](timers.md#timeout) | +| `interval` | [`Timeout`](#timeout) | #### Returns @@ -41,7 +41,7 @@ Cancels a `Timeout` object created by `setInterval()`. ### clearTimeout() -> **clearTimeout**(`timeout`: [`Timeout`](timers.md#timeout)): `void` +> **clearTimeout**(`timeout`: [`Timeout`](#timeout)): `void` Cancels a `Timeout` object created by `setTimeout()`. @@ -49,7 +49,7 @@ Cancels a `Timeout` object created by `setTimeout()`. | Parameter | Type | Description | | ------ | ------ | ------ | -| `timeout` | [`Timeout`](timers.md#timeout) | A `Timeout` object as returned by [setTimeout](timers.md#settimeout). | +| `timeout` | [`Timeout`](#timeout) | A `Timeout` object as returned by [setTimeout](#settimeout). | #### Returns @@ -86,7 +86,7 @@ for use with clearImmediate ### setInterval() -> **setInterval**\<`TArgs`\>(`callback`: (...`args`: `TArgs`) => `void`, `ms`?: `number`): [`Timeout`](timers.md#timeout) +> **setInterval**\<`TArgs`\>(`callback`: (...`args`: `TArgs`) => `void`, `ms?`: `number`): [`Timeout`](#timeout) Schedules repeated execution of `callback` every `delay` milliseconds. @@ -103,19 +103,19 @@ When `delay` isless than `4`, the `delay` will be set to `4`. | Parameter | Type | Description | | ------ | ------ | ------ | | `callback` | (...`args`: `TArgs`) => `void` | The function to call when the timer elapses. | -| `ms`? | `number` | - | +| `ms?` | `number` | - | #### Returns -[`Timeout`](timers.md#timeout) +[`Timeout`](#timeout) -for use with [clearInterval](timers.md#clearinterval) +for use with [clearInterval](#clearinterval) *** ### setTimeout() -> **setTimeout**\<`TArgs`\>(`callback`: (...`args`: `TArgs`) => `void`, `ms`?: `number`): [`Timeout`](timers.md#timeout) +> **setTimeout**\<`TArgs`\>(`callback`: (...`args`: `TArgs`) => `void`, `ms?`: `number`): [`Timeout`](#timeout) Schedules execution of a one-time `callback` after `delay` milliseconds. @@ -137,10 +137,10 @@ When `delay` is less than `4`, the `delay` will be set to `4`. | Parameter | Type | Description | | ------ | ------ | ------ | | `callback` | (...`args`: `TArgs`) => `void` | The function to call when the timer elapses. | -| `ms`? | `number` | - | +| `ms?` | `number` | - | #### Returns -[`Timeout`](timers.md#timeout) +[`Timeout`](#timeout) -for use with [clearTimeout](timers.md#cleartimeout) +for use with [clearTimeout](#cleartimeout) diff --git a/src/reference/modules/index.md b/src/reference/modules/index.md index dc0a70b..bf18eb5 100644 --- a/src/reference/modules/index.md +++ b/src/reference/modules/index.md @@ -1,29 +1,22 @@ -# QuickJS Modules - -Here is the reference of the modules available in our engine. - -This documentation is auto-generated from the Typescript typing ([`@caido/quickjs-types`](https://www.npmjs.com/package/@caido/quickjs-types)) which is the source of truth. - -Some elements are similar to `Node.JS`, but some imports will be different and start with `caido:`. +# @caido/quickjs-types ## Modules -| Module | Description | Import | Global | -| -------------------------------------- | ------------------------ | ------------------ | ------ | -| [url](extra/url.md) | URL utilities | N/A | ✔︎ | -| [abort](llrt/abort.md) | Abort signaling | N/A | ✔︎ | -| [buffer](llrt/buffer.md) | Buffers | `buffer` | ✔︎ | -| [child_process](llrt/child_process.md) | Process spawning | `child_process` | ✘ | -| [console](extra/console.md) | Console logging | N/A | ✔︎ | -| [crypto](llrt/crypto.md) | Cryptographic primitives | `crypto` | ✘ | -| [dom-events](llrt/dom-events.md) | Events | N/A | ✔︎ | -| [fs](llrt/fs/index.md) | File system | `fs`, `fs/promise` | ✘ | -| [http](caido/http.md) | Fetch implementation | `caido:http` | ✘ | -| [globals](llrt/globals/index.md) | Global classes | N/A | ✔︎ | -| [net](llrt/net.md) | Sockets | `net` | ✘ | -| [os](extra/os.md) | OS information | `os` | ✘ | -| [path](llrt/path/index.md) | Path transformation | `path` | ✘ | -| [process](llrt/process.md) | Process information | `process` | ✔︎ | -| [sqlite](extra/sqlite.md) | SQlite access | `sqlite` | ✘ | -| [stream](llrt/stream.md) | Streams (basic) | `stream` | ✔︎ | -| [timers](extra/timers.md) | Timers | N/A | ✔︎ | +| Module | Description | +| ------ | ------ | +| [caido/http](caido/http.md) | - | +| [extra/console](extra/console.md) | - | +| [extra/os](extra/os.md) | - | +| [extra/sqlite](extra/sqlite.md) | - | +| [extra/timers](extra/timers.md) | - | +| [llrt/abort](llrt/abort.md) | - | +| [llrt/buffer](llrt/buffer.md) | - | +| [llrt/child\_process](llrt/child_process.md) | - | +| [llrt/crypto](llrt/crypto.md) | - | +| [llrt/dom-events](llrt/dom-events.md) | - | +| [llrt/fs](llrt/fs/index.md) | - | +| [llrt/globals](llrt/globals/index.md) | - | +| [llrt/net](llrt/net.md) | - | +| [llrt/path](llrt/path/index.md) | - | +| [llrt/process](llrt/process/index.md) | - | +| [llrt/stream](llrt/stream/index.md) | - | diff --git a/src/reference/modules/llrt/abort.md b/src/reference/modules/llrt/abort.md index e6ea6fb..8db6ece 100644 --- a/src/reference/modules/llrt/abort.md +++ b/src/reference/modules/llrt/abort.md @@ -8,21 +8,21 @@ #### Constructors -##### new AbortController() +##### Constructor -> **new AbortController**(): [`AbortController`](abort.md#abortcontroller) +> **new AbortController**(): [`AbortController`](#abortcontroller) Creates a new `AbortController` object instance. ###### Returns -[`AbortController`](abort.md#abortcontroller) +[`AbortController`](#abortcontroller) #### Properties ##### signal -> `readonly` **signal**: [`AbortSignal`](abort.md#abortsignal) +> `readonly` **signal**: [`AbortSignal`](#abortsignal) Returns the AbortSignal object associated with this object. @@ -30,7 +30,7 @@ Returns the AbortSignal object associated with this object. ##### abort() -> **abort**(`reason`?: `any`): `void` +> **abort**(`reason?`: `any`): `void` Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. @@ -38,7 +38,7 @@ Invoking this method will set this object's AbortSignal's aborted flag and signa | Parameter | Type | | ------ | ------ | -| `reason`? | `any` | +| `reason?` | `any` | ###### Returns @@ -56,19 +56,19 @@ A signal object that allows you to communicate with a DOM request (such as a Fet #### Constructors -##### new AbortSignal() +##### Constructor -> **new AbortSignal**(): [`AbortSignal`](abort.md#abortsignal) +> **new AbortSignal**(): [`AbortSignal`](#abortsignal) Creates a new `AbortSignal` object instance. ###### Returns -[`AbortSignal`](abort.md#abortsignal) +[`AbortSignal`](#abortsignal) ###### Overrides -[`EventTarget`](dom-events.md#eventtarget).[`constructor`](dom-events.md#constructors-1) +[`EventTarget`](dom-events.md#eventtarget).[`constructor`](dom-events.md#constructor-1) #### Properties @@ -80,7 +80,7 @@ Returns true if this AbortSignal's AbortController has signaled to abort, and fa ##### onabort -> **onabort**: `null` \| (`this`: [`AbortSignal`](abort.md#abortsignal), `event`: [`Event`](dom-events.md#event)) => `any` +> **onabort**: (`this`: [`AbortSignal`](#abortsignal), `event`: [`Event`](dom-events.md#event)) => `any` \| `null` Registers an event listener callback to execute when an `abort` event is observed. @@ -94,7 +94,7 @@ A JavaScript value providing the abort reason, once the signal has aborted. ##### addEventListener() -> **addEventListener**(`type`: [`EventKey`](dom-events.md#eventkey), `listener`: [`EventListener`](dom-events.md#eventlistener), `options`?: [`AddEventListenerOptions`](dom-events.md#addeventlisteneroptions)): `void` +> **addEventListener**(`type`: [`EventKey`](dom-events.md#eventkey), `listener`: [`EventListener`](dom-events.md#eventlistener), `options?`: [`AddEventListenerOptions`](dom-events.md#addeventlisteneroptions)): `void` Adds a new handler for the `type` event. Any given `listener` is added only once per `type`. @@ -106,7 +106,7 @@ If the `once` option is true, the `listener` is removed after the next time a `t | ------ | ------ | | `type` | [`EventKey`](dom-events.md#eventkey) | | `listener` | [`EventListener`](dom-events.md#eventlistener) | -| `options`? | [`AddEventListenerOptions`](dom-events.md#addeventlisteneroptions) | +| `options?` | [`AddEventListenerOptions`](dom-events.md#addeventlisteneroptions) | ###### Returns @@ -169,7 +169,7 @@ Throws the signal's abort reason if the signal has been aborted; otherwise it do ##### abort() -> `static` **abort**(`reason`?: `any`): [`AbortSignal`](abort.md#abortsignal) +> `static` **abort**(`reason?`: `any`): [`AbortSignal`](#abortsignal) Returns an `AbortSignal` instance that is already set as aborted. @@ -177,15 +177,15 @@ Returns an `AbortSignal` instance that is already set as aborted. | Parameter | Type | Description | | ------ | ------ | ------ | -| `reason`? | `any` | The reason for the abort. | +| `reason?` | `any` | The reason for the abort. | ###### Returns -[`AbortSignal`](abort.md#abortsignal) +[`AbortSignal`](#abortsignal) ##### any() -> `static` **any**(`signals`: [`AbortSignal`](abort.md#abortsignal)[]): [`AbortSignal`](abort.md#abortsignal) +> `static` **any**(`signals`: [`AbortSignal`](#abortsignal)[]): [`AbortSignal`](#abortsignal) Returns an `AbortSignal` that aborts when any of the given abort signals abort. @@ -193,15 +193,15 @@ Returns an `AbortSignal` that aborts when any of the given abort signals abort. | Parameter | Type | Description | | ------ | ------ | ------ | -| `signals` | [`AbortSignal`](abort.md#abortsignal)[] | An array of `AbortSignal` objects to observe. | +| `signals` | [`AbortSignal`](#abortsignal)[] | An array of `AbortSignal` objects to observe. | ###### Returns -[`AbortSignal`](abort.md#abortsignal) +[`AbortSignal`](#abortsignal) ##### timeout() -> `static` **timeout**(`milliseconds`: `number`): [`AbortSignal`](abort.md#abortsignal) +> `static` **timeout**(`milliseconds`: `number`): [`AbortSignal`](#abortsignal) Returns an `AbortSignal` instance that will automatically abort after a specified time. @@ -213,4 +213,4 @@ Returns an `AbortSignal` instance that will automatically abort after a specifie ###### Returns -[`AbortSignal`](abort.md#abortsignal) +[`AbortSignal`](#abortsignal) diff --git a/src/reference/modules/llrt/buffer.md b/src/reference/modules/llrt/buffer.md index 7c154ab..f3df2a7 100644 --- a/src/reference/modules/llrt/buffer.md +++ b/src/reference/modules/llrt/buffer.md @@ -18,7 +18,7 @@ ##### copy() -> **copy**(`target`: `Uint8Array`, `targetStart`?: `number`, `sourceStart`?: `number`, `sourceEnd`?: `number`): `number` +> **copy**(`target`: `Uint8Array`, `targetStart?`: `number`, `sourceStart?`: `number`, `sourceEnd?`: `number`): `number` Copies data from a region of `buf` to a region in `target`, even if the `target`memory region overlaps with `buf`. @@ -71,9 +71,9 @@ console.log(buf.toString()); | Parameter | Type | Description | | ------ | ------ | ------ | | `target` | `Uint8Array` | A `Buffer` or Uint8Array to copy into. | -| `targetStart`? | `number` | The offset within `target` at which to begin writing. | -| `sourceStart`? | `number` | The offset within `buf` from which to begin copying. | -| `sourceEnd`? | `number` | The offset within `buf` at which to stop copying (not inclusive). | +| `targetStart?` | `number` | The offset within `target` at which to begin writing. | +| `sourceStart?` | `number` | The offset within `buf` from which to begin copying. | +| `sourceEnd?` | `number` | The offset within `buf` at which to stop copying (not inclusive). | ###### Returns @@ -83,7 +83,7 @@ The number of bytes copied. ##### subarray() -> **subarray**(`start`?: `number`, `end`?: `number`): [`Buffer`](buffer.md#buffer) +> **subarray**(`start?`: `number`, `end?`: `number`): [`Buffer`](#buffer) Returns a new `Buffer` that references the same memory as the original, but offset and cropped by the `start` and `end` indices. @@ -144,12 +144,12 @@ console.log(buf.subarray(-5, -2).toString()); | Parameter | Type | Description | | ------ | ------ | ------ | -| `start`? | `number` | Where the new `Buffer` will start. | -| `end`? | `number` | Where the new `Buffer` will end (not inclusive). | +| `start?` | `number` | Where the new `Buffer` will start. | +| `end?` | `number` | Where the new `Buffer` will end (not inclusive). | ###### Returns -[`Buffer`](buffer.md#buffer) +[`Buffer`](#buffer) ###### Overrides @@ -157,7 +157,7 @@ console.log(buf.subarray(-5, -2).toString()); ##### toString() -> **toString**(`encoding`?: [`BufferEncoding`](buffer.md#bufferencoding)): `string` +> **toString**(`encoding?`: [`BufferEncoding`](#bufferencoding)): `string` Decodes `buf` to a string according to the specified character encoding in`encoding`. @@ -187,7 +187,7 @@ console.log(buf2.toString('hex')); | Parameter | Type | Description | | ------ | ------ | ------ | -| `encoding`? | [`BufferEncoding`](buffer.md#bufferencoding) | The character encoding to use. | +| `encoding?` | [`BufferEncoding`](#bufferencoding) | The character encoding to use. | ###### Returns @@ -199,7 +199,7 @@ console.log(buf2.toString('hex')); ##### writeDoubleBE() -> **writeDoubleBE**(`value`: `number`, `offset`?: `number`): `number` +> **writeDoubleBE**(`value`: `number`, `offset?`: `number`): `number` Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a JavaScript number. Behavior is undefined when `value` is anything other than a JavaScript number. @@ -220,7 +220,7 @@ console.log(buf); | Parameter | Type | Description | | ------ | ------ | ------ | | `value` | `number` | Number to be written to `buf`. | -| `offset`? | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`. | +| `offset?` | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`. | ###### Returns @@ -230,7 +230,7 @@ console.log(buf); ##### writeDoubleLE() -> **writeDoubleLE**(`value`: `number`, `offset`?: `number`): `number` +> **writeDoubleLE**(`value`: `number`, `offset?`: `number`): `number` Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a JavaScript number. Behavior is undefined when `value` is anything other than a JavaScript number. @@ -251,7 +251,7 @@ console.log(buf); | Parameter | Type | Description | | ------ | ------ | ------ | | `value` | `number` | Number to be written to `buf`. | -| `offset`? | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`. | +| `offset?` | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`. | ###### Returns @@ -261,7 +261,7 @@ console.log(buf); ##### writeFloatBE() -> **writeFloatBE**(`value`: `number`, `offset`?: `number`): `number` +> **writeFloatBE**(`value`: `number`, `offset?`: `number`): `number` Writes `value` to `buf` at the specified `offset` as big-endian. Behavior is undefined when `value` is anything other than a JavaScript number. @@ -282,7 +282,7 @@ console.log(buf); | Parameter | Type | Description | | ------ | ------ | ------ | | `value` | `number` | Number to be written to `buf`. | -| `offset`? | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. | +| `offset?` | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. | ###### Returns @@ -292,7 +292,7 @@ console.log(buf); ##### writeFloatLE() -> **writeFloatLE**(`value`: `number`, `offset`?: `number`): `number` +> **writeFloatLE**(`value`: `number`, `offset?`: `number`): `number` Writes `value` to `buf` at the specified `offset` as little-endian. Behavior is undefined when `value` is anything other than a JavaScript number. @@ -313,7 +313,7 @@ console.log(buf); | Parameter | Type | Description | | ------ | ------ | ------ | | `value` | `number` | Number to be written to `buf`. | -| `offset`? | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. | +| `offset?` | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. | ###### Returns @@ -323,7 +323,7 @@ console.log(buf); ##### writeInt16BE() -> **writeInt16BE**(`value`: `number`, `offset`?: `number`): `number` +> **writeInt16BE**(`value`: `number`, `offset?`: `number`): `number` Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid signed 16-bit integer. Behavior is undefined when `value` is anything other than a signed 16-bit integer. @@ -346,7 +346,7 @@ console.log(buf); | Parameter | Type | Description | | ------ | ------ | ------ | | `value` | `number` | Number to be written to `buf`. | -| `offset`? | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. | +| `offset?` | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. | ###### Returns @@ -356,7 +356,7 @@ console.log(buf); ##### writeInt16LE() -> **writeInt16LE**(`value`: `number`, `offset`?: `number`): `number` +> **writeInt16LE**(`value`: `number`, `offset?`: `number`): `number` Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid signed 16-bit integer. Behavior is undefined when `value` is anything other than a signed 16-bit integer. @@ -379,7 +379,7 @@ console.log(buf); | Parameter | Type | Description | | ------ | ------ | ------ | | `value` | `number` | Number to be written to `buf`. | -| `offset`? | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. | +| `offset?` | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. | ###### Returns @@ -389,7 +389,7 @@ console.log(buf); ##### writeInt32BE() -> **writeInt32BE**(`value`: `number`, `offset`?: `number`): `number` +> **writeInt32BE**(`value`: `number`, `offset?`: `number`): `number` Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid signed 32-bit integer. Behavior is undefined when `value` is anything other than a signed 32-bit integer. @@ -412,7 +412,7 @@ console.log(buf); | Parameter | Type | Description | | ------ | ------ | ------ | | `value` | `number` | - | -| `offset`? | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. | +| `offset?` | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. | ###### Returns @@ -422,7 +422,7 @@ console.log(buf); ##### writeInt32LE() -> **writeInt32LE**(`value`: `number`, `offset`?: `number`): `number` +> **writeInt32LE**(`value`: `number`, `offset?`: `number`): `number` Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid signed 32-bit integer. Behavior is undefined when `value` is anything other than a signed 32-bit integer. @@ -445,7 +445,7 @@ console.log(buf); | Parameter | Type | Description | | ------ | ------ | ------ | | `value` | `number` | Number to be written to `buf`. | -| `offset`? | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. | +| `offset?` | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. | ###### Returns @@ -455,7 +455,7 @@ console.log(buf); ##### writeInt8() -> **writeInt8**(`value`: `number`, `offset`?: `number`): `number` +> **writeInt8**(`value`: `number`, `offset?`: `number`): `number` Writes `value` to `buf` at the specified `offset`. `value` must be a valid signed 8-bit integer. Behavior is undefined when `value` is anything other than @@ -480,7 +480,7 @@ console.log(buf); | Parameter | Type | Description | | ------ | ------ | ------ | | `value` | `number` | Number to be written to `buf`. | -| `offset`? | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`. | +| `offset?` | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`. | ###### Returns @@ -496,7 +496,7 @@ console.log(buf); ##### alloc() -> **alloc**(`size`: `number`, `fill`?: `string` \| `number` \| `Uint8Array`, `encoding`?: [`BufferEncoding`](buffer.md#bufferencoding)): [`Buffer`](buffer.md#buffer) +> **alloc**(`size`: `number`, `fill?`: `string` \| `number` \| `Uint8Array`, `encoding?`: [`BufferEncoding`](#bufferencoding)): [`Buffer`](#buffer) Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the `Buffer` will be zero-filled. @@ -537,16 +537,16 @@ console.log(buf); | Parameter | Type | Description | | ------ | ------ | ------ | | `size` | `number` | The desired length of the new `Buffer`. | -| `fill`? | `string` \| `number` \| `Uint8Array` | A value to pre-fill the new `Buffer` with. | -| `encoding`? | [`BufferEncoding`](buffer.md#bufferencoding) | If `fill` is a string, this is its encoding. | +| `fill?` | `string` \| `number` \| `Uint8Array` | A value to pre-fill the new `Buffer` with. | +| `encoding?` | [`BufferEncoding`](#bufferencoding) | If `fill` is a string, this is its encoding. | ###### Returns -[`Buffer`](buffer.md#buffer) +[`Buffer`](#buffer) ##### byteLength() -> **byteLength**(`string`: `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](buffer.md#buffer), `encoding`?: [`BufferEncoding`](buffer.md#bufferencoding)): `number` +> **byteLength**(`string`: `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](#buffer), `encoding?`: [`BufferEncoding`](#bufferencoding)): `number` Returns the byte length of a string when encoded using `encoding`. This is not the same as [`String.prototype.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length), which does not account @@ -571,8 +571,8 @@ er.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuf | Parameter | Type | Description | | ------ | ------ | ------ | -| `string` | `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](buffer.md#buffer) | A value to calculate the length of. | -| `encoding`? | [`BufferEncoding`](buffer.md#bufferencoding) | If `string` is a string, this is its encoding. | +| `string` | `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](#buffer) | A value to calculate the length of. | +| `encoding?` | [`BufferEncoding`](#bufferencoding) | If `string` is a string, this is its encoding. | ###### Returns @@ -582,7 +582,7 @@ The number of bytes contained within `string`. ##### concat() -> **concat**(`list`: readonly `Uint8Array`[], `totalLength`?: `number`): [`Buffer`](buffer.md#buffer) +> **concat**(`list`: readonly `Uint8Array`[], `totalLength?`: `number`): [`Buffer`](#buffer) Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together. @@ -621,17 +621,17 @@ console.log(bufA.length); | Parameter | Type | Description | | ------ | ------ | ------ | | `list` | readonly `Uint8Array`[] | List of `Buffer` or Uint8Array instances to concatenate. | -| `totalLength`? | `number` | Total length of the `Buffer` instances in `list` when concatenated. | +| `totalLength?` | `number` | Total length of the `Buffer` instances in `list` when concatenated. | ###### Returns -[`Buffer`](buffer.md#buffer) +[`Buffer`](#buffer) ##### from() ###### Call Signature -> **from**(`arrayBuffer`: [`WithImplicitCoercion`](buffer.md#withimplicitcoerciont)\<`ArrayBuffer` \| `SharedArrayBuffer`\>, `byteOffset`?: `number`, `length`?: `number`): [`Buffer`](buffer.md#buffer) +> **from**(`arrayBuffer`: [`WithImplicitCoercion`](#withimplicitcoercion)\<`ArrayBuffer` \| `SharedArrayBuffer`\>, `byteOffset?`: `number`, `length?`: `number`): [`Buffer`](#buffer) Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`. @@ -639,17 +639,17 @@ Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`. | Parameter | Type | | ------ | ------ | -| `arrayBuffer` | [`WithImplicitCoercion`](buffer.md#withimplicitcoerciont)\<`ArrayBuffer` \| `SharedArrayBuffer`\> | -| `byteOffset`? | `number` | -| `length`? | `number` | +| `arrayBuffer` | [`WithImplicitCoercion`](#withimplicitcoercion)\<`ArrayBuffer` \| `SharedArrayBuffer`\> | +| `byteOffset?` | `number` | +| `length?` | `number` | ###### Returns -[`Buffer`](buffer.md#buffer) +[`Buffer`](#buffer) ###### Call Signature -> **from**(`data`: `Uint8Array` \| readonly `number`[]): [`Buffer`](buffer.md#buffer) +> **from**(`data`: `Uint8Array` \| readonly `number`[]): [`Buffer`](#buffer) Creates a new Buffer using the passed {data} @@ -661,25 +661,25 @@ Creates a new Buffer using the passed {data} ###### Returns -[`Buffer`](buffer.md#buffer) +[`Buffer`](#buffer) ###### Call Signature -> **from**(`data`: [`WithImplicitCoercion`](buffer.md#withimplicitcoerciont)\<`string` \| `Uint8Array` \| readonly `number`[]\>): [`Buffer`](buffer.md#buffer) +> **from**(`data`: [`WithImplicitCoercion`](#withimplicitcoercion)\<`string` \| `Uint8Array` \| readonly `number`[]\>): [`Buffer`](#buffer) ###### Parameters | Parameter | Type | | ------ | ------ | -| `data` | [`WithImplicitCoercion`](buffer.md#withimplicitcoerciont)\<`string` \| `Uint8Array` \| readonly `number`[]\> | +| `data` | [`WithImplicitCoercion`](#withimplicitcoercion)\<`string` \| `Uint8Array` \| readonly `number`[]\> | ###### Returns -[`Buffer`](buffer.md#buffer) +[`Buffer`](#buffer) ###### Call Signature -> **from**(`str`: [`WithImplicitCoercion`](buffer.md#withimplicitcoerciont)\<`string`\> \| \{ `[toPrimitive]`: `string`; \}, `encoding`?: [`BufferEncoding`](buffer.md#bufferencoding)): [`Buffer`](buffer.md#buffer) +> **from**(`str`: [`WithImplicitCoercion`](#withimplicitcoercion)\<`string`\> \| \{ `[toPrimitive]`: `string`; \}, `encoding?`: [`BufferEncoding`](#bufferencoding)): [`Buffer`](#buffer) Creates a new Buffer containing the given JavaScript string {str}. If provided, the {encoding} parameter identifies the character encoding. @@ -689,24 +689,24 @@ If not provided, {encoding} defaults to 'utf8'. | Parameter | Type | | ------ | ------ | -| `str` | [`WithImplicitCoercion`](buffer.md#withimplicitcoerciont)\<`string`\> \| \{ `[toPrimitive]`: `string`; \} | -| `encoding`? | [`BufferEncoding`](buffer.md#bufferencoding) | +| `str` | [`WithImplicitCoercion`](#withimplicitcoercion)\<`string`\> \| \{ `[toPrimitive]`: `string`; \} | +| `encoding?` | [`BufferEncoding`](#bufferencoding) | ###### Returns -[`Buffer`](buffer.md#buffer) +[`Buffer`](#buffer) ## Type Aliases ### BufferEncoding -> **BufferEncoding**: `"hex"` \| `"base64"` \| `"utf-8"` \| `"utf8"` \| `"unicode-1-1-utf8"` \| `"utf-16le"` \| `"utf16le"` \| `"utf-16"` \| `"utf16"` \| `"utf-16be"` \| `"utf16be"` \| `"windows-1252"` \| `"ansi_x3.4-1968"` \| `"ascii"` \| `"cp1252"` \| `"cp819"` \| `"csisolatin1"` \| `"ibm819"` \| `"iso-8859-1"` \| `"iso-ir-100"` \| `"iso8859-1"` \| `"iso88591"` \| `"iso_8859-1"` \| `"iso_8859-1:1987"` \| `"l1"` \| `"latin1"` \| `"us-ascii"` \| `"x-cp1252"` +> **BufferEncoding** = `"hex"` \| `"base64"` \| `"utf-8"` \| `"utf8"` \| `"unicode-1-1-utf8"` \| `"utf-16le"` \| `"utf16le"` \| `"utf-16"` \| `"utf16"` \| `"utf-16be"` \| `"utf16be"` \| `"windows-1252"` \| `"ansi_x3.4-1968"` \| `"ascii"` \| `"cp1252"` \| `"cp819"` \| `"csisolatin1"` \| `"ibm819"` \| `"iso-8859-1"` \| `"iso-ir-100"` \| `"iso8859-1"` \| `"iso88591"` \| `"iso_8859-1"` \| `"iso_8859-1:1987"` \| `"l1"` \| `"latin1"` \| `"us-ascii"` \| `"x-cp1252"` *** -### WithImplicitCoercion\ +### WithImplicitCoercion -> **WithImplicitCoercion**\<`T`\>: `T` \| \{ `valueOf`: `T`; \} +> **WithImplicitCoercion**\<`T`\> = `T` \| \{ `valueOf`: `T`; \} #### Type Parameters @@ -718,7 +718,7 @@ If not provided, {encoding} defaults to 'utf8'. ### Buffer -> **Buffer**: [`BufferConstructor`](buffer.md#bufferconstructor) +> **Buffer**: [`BufferConstructor`](#bufferconstructor) *** @@ -726,7 +726,7 @@ If not provided, {encoding} defaults to 'utf8'. > `const` **constants**: `object` -#### Type declaration +#### Type Declaration ##### MAX\_LENGTH diff --git a/src/reference/modules/llrt/child_process.md b/src/reference/modules/llrt/child_process.md index 66fcd45..484262b 100644 --- a/src/reference/modules/llrt/child_process.md +++ b/src/reference/modules/llrt/child_process.md @@ -9,30 +9,30 @@ Instances of the `ChildProcess` represent spawned child processes. Instances of `ChildProcess` are not intended to be created directly. Rather, -use the [spawn](child_process.md#spawn) method to create instances of `ChildProcess`. +use the [spawn](#spawn) method to create instances of `ChildProcess`. #### Extends -- [`EventEmitter`](globals/index.md#eventemittert) +- [`EventEmitter`](globals/index.md#eventemitter) #### Extended by -- [`ChildProcessWithoutNullStreams`](child_process.md#childprocesswithoutnullstreams) -- [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e) +- [`ChildProcessWithoutNullStreams`](#childprocesswithoutnullstreams) +- [`ChildProcessByStdio`](#childprocessbystdio) #### Constructors -##### new ChildProcess() +##### Constructor -> **new ChildProcess**(): [`ChildProcess`](child_process.md#childprocess) +> **new ChildProcess**(): [`ChildProcess`](#childprocess) ###### Returns -[`ChildProcess`](child_process.md#childprocess) +[`ChildProcess`](#childprocess) ###### Inherited from -[`EventEmitter`](globals/index.md#eventemittert).[`constructor`](globals/index.md#constructors) +[`EventEmitter`](globals/index.md#eventemitter).[`constructor`](globals/index.md#constructor) #### Properties @@ -54,7 +54,7 @@ grep.stdin.end(); ##### stderr -> **stderr**: `null` \| [`DefaultReadableStream`](stream.md#defaultreadablestream) +> **stderr**: [`DefaultReadableStream`](stream/stream.md#defaultreadablestream) \| `null` A `Readable Stream` that represents the child process's `stderr`. @@ -68,7 +68,7 @@ The `subprocess.stderr` property can be `null` or `undefined` if the child proce ##### stdin -> **stdin**: `null` \| [`DefaultWritableStream`](stream.md#defaultwritablestream) +> **stdin**: [`DefaultWritableStream`](stream/stream.md#defaultwritablestream) \| `null` A `Writable Stream` that represents the child process's `stdin`. @@ -85,7 +85,7 @@ The `subprocess.stdin` property can be `null` or `undefined` if the child proces ##### stdout -> **stdout**: `null` \| [`DefaultReadableStream`](stream.md#defaultreadablestream) +> **stdout**: [`DefaultReadableStream`](stream/stream.md#defaultreadablestream) \| `null` A `Readable Stream` that represents the child process's `stdout`. @@ -113,7 +113,7 @@ The `subprocess.stdout` property can be `null` or `undefined` if the child proce > **\[dispose\]**(): `void` -Calls [ChildProcess.kill](child_process.md#kill) with `'SIGTERM'`. +Calls [ChildProcess.kill](#kill) with `'SIGTERM'`. ###### Returns @@ -143,11 +143,11 @@ events.EventEmitter ###### Overrides -[`EventEmitter`](globals/index.md#eventemittert).[`addListener`](globals/index.md#addlistener) +[`EventEmitter`](globals/index.md#eventemitter).[`addListener`](globals/index.md#addlistener) ###### Call Signature -> **addListener**(`event`: `"close"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **addListener**(`event`: `"close"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` events.EventEmitter 1. close @@ -159,7 +159,7 @@ events.EventEmitter | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -195,7 +195,7 @@ events.EventEmitter ###### Call Signature -> **addListener**(`event`: `"exit"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **addListener**(`event`: `"exit"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` events.EventEmitter 1. close @@ -207,7 +207,7 @@ events.EventEmitter | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -265,19 +265,19 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Overrides -[`EventEmitter`](globals/index.md#eventemittert).[`emit`](globals/index.md#emit) +[`EventEmitter`](globals/index.md#eventemitter).[`emit`](globals/index.md#emit) ###### Call Signature -> **emit**(`event`: `"close"`, `code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)): `boolean` +> **emit**(`event`: `"close"`, `code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`): `boolean` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `code` | `null` \| `number` | -| `signal` | `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals) | +| `code` | `number` \| `null` | +| `signal` | [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null` | ###### Returns @@ -308,15 +308,15 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Call Signature -> **emit**(`event`: `"exit"`, `code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)): `boolean` +> **emit**(`event`: `"exit"`, `code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`): `boolean` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `code` | `null` \| `number` | -| `signal` | `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals) | +| `code` | `number` \| `null` | +| `signal` | [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null` | ###### Returns @@ -353,11 +353,11 @@ console.log(myEE.eventNames()); ###### Inherited from -[`EventEmitter`](globals/index.md#eventemittert).[`eventNames`](globals/index.md#eventnames) +[`EventEmitter`](globals/index.md#eventemitter).[`eventNames`](globals/index.md#eventnames) ##### kill() -> **kill**(`signal`?: `number` \| [`Signals`](globals/namespaces/QuickJS.md#signals)): `boolean` +> **kill**(`signal?`: `number` \| [`Signals`](globals/namespaces/QuickJS.md#signals)): `boolean` The `subprocess.kill()` method sends a signal to the child process. If no argument is given, the process will be sent the `'SIGTERM'` signal. See [`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html) for a list of available signals. This function @@ -420,7 +420,7 @@ setTimeout(() => { | Parameter | Type | | ------ | ------ | -| `signal`? | `number` \| [`Signals`](globals/namespaces/QuickJS.md#signals) | +| `signal?` | `number` \| [`Signals`](globals/namespaces/QuickJS.md#signals) | ###### Returns @@ -451,7 +451,7 @@ Alias for `emitter.removeListener()`. ###### Inherited from -[`EventEmitter`](globals/index.md#eventemittert).[`off`](globals/index.md#off) +[`EventEmitter`](globals/index.md#eventemitter).[`off`](globals/index.md#off) ##### on() @@ -499,18 +499,18 @@ myEE.emit('foo'); ###### Overrides -[`EventEmitter`](globals/index.md#eventemittert).[`on`](globals/index.md#on) +[`EventEmitter`](globals/index.md#eventemitter).[`on`](globals/index.md#on) ###### Call Signature -> **on**(`event`: `"close"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **on**(`event`: `"close"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -541,14 +541,14 @@ myEE.emit('foo'); ###### Call Signature -> **on**(`event`: `"exit"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **on**(`event`: `"exit"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -600,18 +600,18 @@ v0.3.0 ###### Overrides -[`EventEmitter`](globals/index.md#eventemittert).[`once`](globals/index.md#once) +[`EventEmitter`](globals/index.md#eventemitter).[`once`](globals/index.md#once) ###### Call Signature -> **once**(`event`: `"close"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **once**(`event`: `"close"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -642,14 +642,14 @@ v0.3.0 ###### Call Signature -> **once**(`event`: `"exit"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **once**(`event`: `"exit"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -685,18 +685,18 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Overrides -[`EventEmitter`](globals/index.md#eventemittert).[`prependListener`](globals/index.md#prependlistener) +[`EventEmitter`](globals/index.md#eventemitter).[`prependListener`](globals/index.md#prependlistener) ###### Call Signature -> **prependListener**(`event`: `"close"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **prependListener**(`event`: `"close"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -727,14 +727,14 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Call Signature -> **prependListener**(`event`: `"exit"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **prependListener**(`event`: `"exit"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -768,18 +768,18 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Overrides -[`EventEmitter`](globals/index.md#eventemittert).[`prependOnceListener`](globals/index.md#prependoncelistener) +[`EventEmitter`](globals/index.md#eventemitter).[`prependOnceListener`](globals/index.md#prependoncelistener) ###### Call Signature -> **prependOnceListener**(`event`: `"close"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **prependOnceListener**(`event`: `"close"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -810,14 +810,14 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Call Signature -> **prependOnceListener**(`event`: `"exit"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **prependOnceListener**(`event`: `"exit"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -921,28 +921,28 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`EventEmitter`](globals/index.md#eventemittert).[`removeListener`](globals/index.md#removelistener) +[`EventEmitter`](globals/index.md#eventemitter).[`removeListener`](globals/index.md#removelistener) ## Interfaces -### ChildProcessByStdio\ +### ChildProcessByStdio Instances of the `ChildProcess` represent spawned child processes. Instances of `ChildProcess` are not intended to be created directly. Rather, -use the [spawn](child_process.md#spawn) method to create instances of `ChildProcess`. +use the [spawn](#spawn) method to create instances of `ChildProcess`. #### Extends -- [`ChildProcess`](child_process.md#childprocess) +- [`ChildProcess`](#childprocess) #### Type Parameters | Type Parameter | | ------ | -| `I` *extends* `null` \| [`DefaultWritableStream`](stream.md#defaultwritablestream) | -| `O` *extends* `null` \| [`DefaultReadableStream`](stream.md#defaultreadablestream) | -| `E` *extends* `null` \| [`DefaultReadableStream`](stream.md#defaultreadablestream) | +| `I` *extends* `null` \| [`DefaultWritableStream`](stream/stream.md#defaultwritablestream) | +| `O` *extends* `null` \| [`DefaultReadableStream`](stream/stream.md#defaultreadablestream) | +| `E` *extends* `null` \| [`DefaultReadableStream`](stream/stream.md#defaultreadablestream) | #### Properties @@ -964,7 +964,7 @@ grep.stdin.end(); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`pid`](child_process.md#pid) +[`ChildProcessWithoutNullStreams`](#childprocesswithoutnullstreams).[`pid`](#pid-2) ##### stderr @@ -982,7 +982,7 @@ The `subprocess.stderr` property can be `null` or `undefined` if the child proce ###### Overrides -[`ChildProcess`](child_process.md#childprocess).[`stderr`](child_process.md#stderr) +[`ChildProcess`](#childprocess).[`stderr`](#stderr) ##### stdin @@ -1003,7 +1003,7 @@ The `subprocess.stdin` property can be `null` or `undefined` if the child proces ###### Overrides -[`ChildProcess`](child_process.md#childprocess).[`stdin`](child_process.md#stdin) +[`ChildProcess`](#childprocess).[`stdin`](#stdin) ##### stdout @@ -1031,7 +1031,7 @@ The `subprocess.stdout` property can be `null` or `undefined` if the child proce ###### Overrides -[`ChildProcess`](child_process.md#childprocess).[`stdout`](child_process.md#stdout) +[`ChildProcess`](#childprocess).[`stdout`](#stdout) #### Methods @@ -1039,7 +1039,7 @@ The `subprocess.stdout` property can be `null` or `undefined` if the child proce > **\[dispose\]**(): `void` -Calls [ChildProcess.kill](child_process.md#kill) with `'SIGTERM'`. +Calls [ChildProcess.kill](#kill) with `'SIGTERM'`. ###### Returns @@ -1047,7 +1047,7 @@ Calls [ChildProcess.kill](child_process.md#kill) with `'SIGTERM'`. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`[dispose]`](child_process.md#dispose) +[`ChildProcess`](#childprocess).[`[dispose]`](#dispose) ##### addListener() @@ -1073,11 +1073,11 @@ events.EventEmitter ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`addListener`](child_process.md#addlistener) +[`ChildProcess`](#childprocess).[`addListener`](#addlistener) ###### Call Signature -> **addListener**(`event`: `"close"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **addListener**(`event`: `"close"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` events.EventEmitter 1. close @@ -1089,7 +1089,7 @@ events.EventEmitter | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -1097,7 +1097,7 @@ events.EventEmitter ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`addListener`](child_process.md#addlistener) +[`ChildProcess`](#childprocess).[`addListener`](#addlistener) ###### Call Signature @@ -1121,11 +1121,11 @@ events.EventEmitter ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`addListener`](child_process.md#addlistener) +[`ChildProcess`](#childprocess).[`addListener`](#addlistener) ###### Call Signature -> **addListener**(`event`: `"exit"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **addListener**(`event`: `"exit"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` events.EventEmitter 1. close @@ -1137,7 +1137,7 @@ events.EventEmitter | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -1145,7 +1145,7 @@ events.EventEmitter ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`addListener`](child_process.md#addlistener) +[`ChildProcess`](#childprocess).[`addListener`](#addlistener) ##### emit() @@ -1195,19 +1195,19 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`emit`](child_process.md#emit) +[`ChildProcess`](#childprocess).[`emit`](#emit) ###### Call Signature -> **emit**(`event`: `"close"`, `code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)): `boolean` +> **emit**(`event`: `"close"`, `code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`): `boolean` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `code` | `null` \| `number` | -| `signal` | `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals) | +| `code` | `number` \| `null` | +| `signal` | [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null` | ###### Returns @@ -1215,7 +1215,7 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`emit`](child_process.md#emit) +[`ChildProcess`](#childprocess).[`emit`](#emit) ###### Call Signature @@ -1234,19 +1234,19 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`emit`](child_process.md#emit) +[`ChildProcess`](#childprocess).[`emit`](#emit) ###### Call Signature -> **emit**(`event`: `"exit"`, `code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)): `boolean` +> **emit**(`event`: `"exit"`, `code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`): `boolean` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `code` | `null` \| `number` | -| `signal` | `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals) | +| `code` | `number` \| `null` | +| `signal` | [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null` | ###### Returns @@ -1254,7 +1254,7 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`emit`](child_process.md#emit) +[`ChildProcess`](#childprocess).[`emit`](#emit) ##### eventNames() @@ -1283,11 +1283,11 @@ console.log(myEE.eventNames()); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`eventNames`](child_process.md#eventnames) +[`ChildProcess`](#childprocess).[`eventNames`](#eventnames) ##### kill() -> **kill**(`signal`?: `number` \| [`Signals`](globals/namespaces/QuickJS.md#signals)): `boolean` +> **kill**(`signal?`: `number` \| [`Signals`](globals/namespaces/QuickJS.md#signals)): `boolean` The `subprocess.kill()` method sends a signal to the child process. If no argument is given, the process will be sent the `'SIGTERM'` signal. See [`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html) for a list of available signals. This function @@ -1350,7 +1350,7 @@ setTimeout(() => { | Parameter | Type | | ------ | ------ | -| `signal`? | `number` \| [`Signals`](globals/namespaces/QuickJS.md#signals) | +| `signal?` | `number` \| [`Signals`](globals/namespaces/QuickJS.md#signals) | ###### Returns @@ -1358,7 +1358,7 @@ setTimeout(() => { ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`kill`](child_process.md#kill) +[`ChildProcess`](#childprocess).[`kill`](#kill) ##### off() @@ -1385,7 +1385,7 @@ Alias for `emitter.removeListener()`. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`off`](child_process.md#off) +[`ChildProcess`](#childprocess).[`off`](#off) ##### on() @@ -1433,18 +1433,18 @@ myEE.emit('foo'); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`on`](child_process.md#on) +[`ChildProcess`](#childprocess).[`on`](#on) ###### Call Signature -> **on**(`event`: `"close"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **on**(`event`: `"close"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -1452,7 +1452,7 @@ myEE.emit('foo'); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`on`](child_process.md#on) +[`ChildProcess`](#childprocess).[`on`](#on) ###### Call Signature @@ -1471,18 +1471,18 @@ myEE.emit('foo'); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`on`](child_process.md#on) +[`ChildProcess`](#childprocess).[`on`](#on) ###### Call Signature -> **on**(`event`: `"exit"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **on**(`event`: `"exit"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -1490,7 +1490,7 @@ myEE.emit('foo'); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`on`](child_process.md#on) +[`ChildProcess`](#childprocess).[`on`](#on) ##### once() @@ -1534,18 +1534,18 @@ v0.3.0 ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`once`](child_process.md#once) +[`ChildProcess`](#childprocess).[`once`](#once) ###### Call Signature -> **once**(`event`: `"close"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **once**(`event`: `"close"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -1553,7 +1553,7 @@ v0.3.0 ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`once`](child_process.md#once) +[`ChildProcess`](#childprocess).[`once`](#once) ###### Call Signature @@ -1572,18 +1572,18 @@ v0.3.0 ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`once`](child_process.md#once) +[`ChildProcess`](#childprocess).[`once`](#once) ###### Call Signature -> **once**(`event`: `"exit"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **once**(`event`: `"exit"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -1591,7 +1591,7 @@ v0.3.0 ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`once`](child_process.md#once) +[`ChildProcess`](#childprocess).[`once`](#once) ##### prependListener() @@ -1619,18 +1619,18 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`prependListener`](child_process.md#prependlistener) +[`ChildProcess`](#childprocess).[`prependListener`](#prependlistener) ###### Call Signature -> **prependListener**(`event`: `"close"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **prependListener**(`event`: `"close"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -1638,7 +1638,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`prependListener`](child_process.md#prependlistener) +[`ChildProcess`](#childprocess).[`prependListener`](#prependlistener) ###### Call Signature @@ -1657,18 +1657,18 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`prependListener`](child_process.md#prependlistener) +[`ChildProcess`](#childprocess).[`prependListener`](#prependlistener) ###### Call Signature -> **prependListener**(`event`: `"exit"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **prependListener**(`event`: `"exit"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -1676,7 +1676,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`prependListener`](child_process.md#prependlistener) +[`ChildProcess`](#childprocess).[`prependListener`](#prependlistener) ##### prependOnceListener() @@ -1702,18 +1702,18 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`prependOnceListener`](child_process.md#prependoncelistener) +[`ChildProcess`](#childprocess).[`prependOnceListener`](#prependoncelistener) ###### Call Signature -> **prependOnceListener**(`event`: `"close"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **prependOnceListener**(`event`: `"close"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -1721,7 +1721,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`prependOnceListener`](child_process.md#prependoncelistener) +[`ChildProcess`](#childprocess).[`prependOnceListener`](#prependoncelistener) ###### Call Signature @@ -1740,18 +1740,18 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`prependOnceListener`](child_process.md#prependoncelistener) +[`ChildProcess`](#childprocess).[`prependOnceListener`](#prependoncelistener) ###### Call Signature -> **prependOnceListener**(`event`: `"exit"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **prependOnceListener**(`event`: `"exit"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -1759,7 +1759,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`prependOnceListener`](child_process.md#prependoncelistener) +[`ChildProcess`](#childprocess).[`prependOnceListener`](#prependoncelistener) ##### removeListener() @@ -1855,7 +1855,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`removeListener`](child_process.md#removelistener) +[`ChildProcess`](#childprocess).[`removeListener`](#removelistener) *** @@ -1864,11 +1864,11 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. Instances of the `ChildProcess` represent spawned child processes. Instances of `ChildProcess` are not intended to be created directly. Rather, -use the [spawn](child_process.md#spawn) method to create instances of `ChildProcess`. +use the [spawn](#spawn) method to create instances of `ChildProcess`. #### Extends -- [`ChildProcess`](child_process.md#childprocess) +- [`ChildProcess`](#childprocess) #### Properties @@ -1890,11 +1890,11 @@ grep.stdin.end(); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`pid`](child_process.md#pid) +[`ChildProcessWithoutNullStreams`](#childprocesswithoutnullstreams).[`pid`](#pid-2) ##### stderr -> **stderr**: [`DefaultReadableStream`](stream.md#defaultreadablestream) +> **stderr**: [`DefaultReadableStream`](stream/stream.md#defaultreadablestream) A `Readable Stream` that represents the child process's `stderr`. @@ -1908,11 +1908,11 @@ The `subprocess.stderr` property can be `null` or `undefined` if the child proce ###### Overrides -[`ChildProcess`](child_process.md#childprocess).[`stderr`](child_process.md#stderr) +[`ChildProcess`](#childprocess).[`stderr`](#stderr) ##### stdin -> **stdin**: [`DefaultWritableStream`](stream.md#defaultwritablestream) +> **stdin**: [`DefaultWritableStream`](stream/stream.md#defaultwritablestream) A `Writable Stream` that represents the child process's `stdin`. @@ -1929,11 +1929,11 @@ The `subprocess.stdin` property can be `null` or `undefined` if the child proces ###### Overrides -[`ChildProcess`](child_process.md#childprocess).[`stdin`](child_process.md#stdin) +[`ChildProcess`](#childprocess).[`stdin`](#stdin) ##### stdout -> **stdout**: [`DefaultReadableStream`](stream.md#defaultreadablestream) +> **stdout**: [`DefaultReadableStream`](stream/stream.md#defaultreadablestream) A `Readable Stream` that represents the child process's `stdout`. @@ -1957,7 +1957,7 @@ The `subprocess.stdout` property can be `null` or `undefined` if the child proce ###### Overrides -[`ChildProcess`](child_process.md#childprocess).[`stdout`](child_process.md#stdout) +[`ChildProcess`](#childprocess).[`stdout`](#stdout) #### Methods @@ -1965,7 +1965,7 @@ The `subprocess.stdout` property can be `null` or `undefined` if the child proce > **\[dispose\]**(): `void` -Calls [ChildProcess.kill](child_process.md#kill) with `'SIGTERM'`. +Calls [ChildProcess.kill](#kill) with `'SIGTERM'`. ###### Returns @@ -1973,7 +1973,7 @@ Calls [ChildProcess.kill](child_process.md#kill) with `'SIGTERM'`. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`[dispose]`](child_process.md#dispose) +[`ChildProcess`](#childprocess).[`[dispose]`](#dispose) ##### addListener() @@ -1999,11 +1999,11 @@ events.EventEmitter ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`addListener`](child_process.md#addlistener) +[`ChildProcess`](#childprocess).[`addListener`](#addlistener) ###### Call Signature -> **addListener**(`event`: `"close"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **addListener**(`event`: `"close"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` events.EventEmitter 1. close @@ -2015,7 +2015,7 @@ events.EventEmitter | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -2023,7 +2023,7 @@ events.EventEmitter ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`addListener`](child_process.md#addlistener) +[`ChildProcess`](#childprocess).[`addListener`](#addlistener) ###### Call Signature @@ -2047,11 +2047,11 @@ events.EventEmitter ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`addListener`](child_process.md#addlistener) +[`ChildProcess`](#childprocess).[`addListener`](#addlistener) ###### Call Signature -> **addListener**(`event`: `"exit"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **addListener**(`event`: `"exit"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` events.EventEmitter 1. close @@ -2063,7 +2063,7 @@ events.EventEmitter | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -2071,7 +2071,7 @@ events.EventEmitter ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`addListener`](child_process.md#addlistener) +[`ChildProcess`](#childprocess).[`addListener`](#addlistener) ##### emit() @@ -2121,19 +2121,19 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`emit`](child_process.md#emit) +[`ChildProcess`](#childprocess).[`emit`](#emit) ###### Call Signature -> **emit**(`event`: `"close"`, `code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)): `boolean` +> **emit**(`event`: `"close"`, `code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`): `boolean` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `code` | `null` \| `number` | -| `signal` | `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals) | +| `code` | `number` \| `null` | +| `signal` | [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null` | ###### Returns @@ -2141,7 +2141,7 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`emit`](child_process.md#emit) +[`ChildProcess`](#childprocess).[`emit`](#emit) ###### Call Signature @@ -2160,19 +2160,19 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`emit`](child_process.md#emit) +[`ChildProcess`](#childprocess).[`emit`](#emit) ###### Call Signature -> **emit**(`event`: `"exit"`, `code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)): `boolean` +> **emit**(`event`: `"exit"`, `code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`): `boolean` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `code` | `null` \| `number` | -| `signal` | `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals) | +| `code` | `number` \| `null` | +| `signal` | [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null` | ###### Returns @@ -2180,7 +2180,7 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`emit`](child_process.md#emit) +[`ChildProcess`](#childprocess).[`emit`](#emit) ##### eventNames() @@ -2209,11 +2209,11 @@ console.log(myEE.eventNames()); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`eventNames`](child_process.md#eventnames) +[`ChildProcess`](#childprocess).[`eventNames`](#eventnames) ##### kill() -> **kill**(`signal`?: `number` \| [`Signals`](globals/namespaces/QuickJS.md#signals)): `boolean` +> **kill**(`signal?`: `number` \| [`Signals`](globals/namespaces/QuickJS.md#signals)): `boolean` The `subprocess.kill()` method sends a signal to the child process. If no argument is given, the process will be sent the `'SIGTERM'` signal. See [`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html) for a list of available signals. This function @@ -2276,7 +2276,7 @@ setTimeout(() => { | Parameter | Type | | ------ | ------ | -| `signal`? | `number` \| [`Signals`](globals/namespaces/QuickJS.md#signals) | +| `signal?` | `number` \| [`Signals`](globals/namespaces/QuickJS.md#signals) | ###### Returns @@ -2284,7 +2284,7 @@ setTimeout(() => { ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`kill`](child_process.md#kill) +[`ChildProcess`](#childprocess).[`kill`](#kill) ##### off() @@ -2311,7 +2311,7 @@ Alias for `emitter.removeListener()`. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`off`](child_process.md#off) +[`ChildProcess`](#childprocess).[`off`](#off) ##### on() @@ -2359,18 +2359,18 @@ myEE.emit('foo'); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`on`](child_process.md#on) +[`ChildProcess`](#childprocess).[`on`](#on) ###### Call Signature -> **on**(`event`: `"close"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **on**(`event`: `"close"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -2378,7 +2378,7 @@ myEE.emit('foo'); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`on`](child_process.md#on) +[`ChildProcess`](#childprocess).[`on`](#on) ###### Call Signature @@ -2397,18 +2397,18 @@ myEE.emit('foo'); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`on`](child_process.md#on) +[`ChildProcess`](#childprocess).[`on`](#on) ###### Call Signature -> **on**(`event`: `"exit"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **on**(`event`: `"exit"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -2416,7 +2416,7 @@ myEE.emit('foo'); ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`on`](child_process.md#on) +[`ChildProcess`](#childprocess).[`on`](#on) ##### once() @@ -2460,18 +2460,18 @@ v0.3.0 ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`once`](child_process.md#once) +[`ChildProcess`](#childprocess).[`once`](#once) ###### Call Signature -> **once**(`event`: `"close"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **once**(`event`: `"close"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -2479,7 +2479,7 @@ v0.3.0 ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`once`](child_process.md#once) +[`ChildProcess`](#childprocess).[`once`](#once) ###### Call Signature @@ -2498,18 +2498,18 @@ v0.3.0 ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`once`](child_process.md#once) +[`ChildProcess`](#childprocess).[`once`](#once) ###### Call Signature -> **once**(`event`: `"exit"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **once**(`event`: `"exit"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -2517,7 +2517,7 @@ v0.3.0 ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`once`](child_process.md#once) +[`ChildProcess`](#childprocess).[`once`](#once) ##### prependListener() @@ -2545,18 +2545,18 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`prependListener`](child_process.md#prependlistener) +[`ChildProcess`](#childprocess).[`prependListener`](#prependlistener) ###### Call Signature -> **prependListener**(`event`: `"close"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **prependListener**(`event`: `"close"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -2564,7 +2564,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`prependListener`](child_process.md#prependlistener) +[`ChildProcess`](#childprocess).[`prependListener`](#prependlistener) ###### Call Signature @@ -2583,18 +2583,18 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`prependListener`](child_process.md#prependlistener) +[`ChildProcess`](#childprocess).[`prependListener`](#prependlistener) ###### Call Signature -> **prependListener**(`event`: `"exit"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **prependListener**(`event`: `"exit"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -2602,7 +2602,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`prependListener`](child_process.md#prependlistener) +[`ChildProcess`](#childprocess).[`prependListener`](#prependlistener) ##### prependOnceListener() @@ -2628,18 +2628,18 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`prependOnceListener`](child_process.md#prependoncelistener) +[`ChildProcess`](#childprocess).[`prependOnceListener`](#prependoncelistener) ###### Call Signature -> **prependOnceListener**(`event`: `"close"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **prependOnceListener**(`event`: `"close"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"close"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -2647,7 +2647,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`prependOnceListener`](child_process.md#prependoncelistener) +[`ChildProcess`](#childprocess).[`prependOnceListener`](#prependoncelistener) ###### Call Signature @@ -2666,18 +2666,18 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`prependOnceListener`](child_process.md#prependoncelistener) +[`ChildProcess`](#childprocess).[`prependOnceListener`](#prependoncelistener) ###### Call Signature -> **prependOnceListener**(`event`: `"exit"`, `listener`: (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void`): `this` +> **prependOnceListener**(`event`: `"exit"`, `listener`: (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"exit"` | -| `listener` | (`code`: `null` \| `number`, `signal`: `null` \| [`Signals`](globals/namespaces/QuickJS.md#signals)) => `void` | +| `listener` | (`code`: `number` \| `null`, `signal`: [`Signals`](globals/namespaces/QuickJS.md#signals) \| `null`) => `void` | ###### Returns @@ -2685,7 +2685,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`prependOnceListener`](child_process.md#prependoncelistener) +[`ChildProcess`](#childprocess).[`prependOnceListener`](#prependoncelistener) ##### removeListener() @@ -2781,7 +2781,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ChildProcess`](child_process.md#childprocess).[`removeListener`](child_process.md#removelistener) +[`ChildProcess`](#childprocess).[`removeListener`](#removelistener) *** @@ -2789,7 +2789,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. #### Extended by -- [`SpawnOptions`](child_process.md#spawnoptions) +- [`SpawnOptions`](#spawnoptions) #### Properties @@ -2811,12 +2811,12 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. #### Extends -- [`ProcessEnvOptions`](child_process.md#processenvoptions) +- [`ProcessEnvOptions`](#processenvoptions) #### Extended by -- [`SpawnOptionsWithoutStdio`](child_process.md#spawnoptionswithoutstdio) -- [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr) +- [`SpawnOptionsWithoutStdio`](#spawnoptionswithoutstdio) +- [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple) #### Properties @@ -2826,7 +2826,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ProcessEnvOptions`](child_process.md#processenvoptions).[`cwd`](child_process.md#cwd) +[`ProcessEnvOptions`](#processenvoptions).[`cwd`](#cwd) ##### gid? @@ -2834,7 +2834,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`ProcessEnvOptions`](child_process.md#processenvoptions).[`gid`](child_process.md#gid) +[`ProcessEnvOptions`](#processenvoptions).[`gid`](#gid) ##### shell? @@ -2842,7 +2842,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ##### stdio? -> `optional` **stdio**: [`StdioOptions`](child_process.md#stdiooptions) +> `optional` **stdio**: [`StdioOptions`](#stdiooptions) Can be set to 'pipe', 'inherit', or 'ignore', or an array of these strings. If passed as an array, the first element is used for `stdin`, the second for @@ -2860,7 +2860,7 @@ If passed as an array, the first element is used for `stdin`, the second for ###### Inherited from -[`ProcessEnvOptions`](child_process.md#processenvoptions).[`uid`](child_process.md#uid) +[`ProcessEnvOptions`](#processenvoptions).[`uid`](#uid) ##### windowsVerbatimArguments? @@ -2872,7 +2872,7 @@ If passed as an array, the first element is used for `stdin`, the second for #### Extends -- [`SpawnOptions`](child_process.md#spawnoptions) +- [`SpawnOptions`](#spawnoptions) #### Properties @@ -2882,7 +2882,7 @@ If passed as an array, the first element is used for `stdin`, the second for ###### Inherited from -[`SpawnOptions`](child_process.md#spawnoptions).[`cwd`](child_process.md#cwd-1) +[`SpawnOptions`](#spawnoptions).[`cwd`](#cwd-1) ##### gid? @@ -2890,7 +2890,7 @@ If passed as an array, the first element is used for `stdin`, the second for ###### Inherited from -[`SpawnOptions`](child_process.md#spawnoptions).[`gid`](child_process.md#gid-1) +[`SpawnOptions`](#spawnoptions).[`gid`](#gid-1) ##### shell? @@ -2898,11 +2898,11 @@ If passed as an array, the first element is used for `stdin`, the second for ###### Inherited from -[`SpawnOptions`](child_process.md#spawnoptions).[`shell`](child_process.md#shell) +[`SpawnOptions`](#spawnoptions).[`shell`](#shell) ##### stdio? -> `optional` **stdio**: `"pipe"` \| [`StdioPipe`](child_process.md#stdiopipe)[] +> `optional` **stdio**: `"pipe"` \| [`StdioPipe`](#stdiopipe)[] Can be set to 'pipe', 'inherit', or 'ignore', or an array of these strings. If passed as an array, the first element is used for `stdin`, the second for @@ -2916,7 +2916,7 @@ If passed as an array, the first element is used for `stdin`, the second for ###### Overrides -[`SpawnOptions`](child_process.md#spawnoptions).[`stdio`](child_process.md#stdio) +[`SpawnOptions`](#spawnoptions).[`stdio`](#stdio) ##### uid? @@ -2924,7 +2924,7 @@ If passed as an array, the first element is used for `stdin`, the second for ###### Inherited from -[`SpawnOptions`](child_process.md#spawnoptions).[`uid`](child_process.md#uid-1) +[`SpawnOptions`](#spawnoptions).[`uid`](#uid-1) ##### windowsVerbatimArguments? @@ -2932,23 +2932,23 @@ If passed as an array, the first element is used for `stdin`, the second for ###### Inherited from -[`SpawnOptions`](child_process.md#spawnoptions).[`windowsVerbatimArguments`](child_process.md#windowsverbatimarguments) +[`SpawnOptions`](#spawnoptions).[`windowsVerbatimArguments`](#windowsverbatimarguments) *** -### SpawnOptionsWithStdioTuple\ +### SpawnOptionsWithStdioTuple #### Extends -- [`SpawnOptions`](child_process.md#spawnoptions) +- [`SpawnOptions`](#spawnoptions) #### Type Parameters | Type Parameter | | ------ | -| `Stdin` *extends* [`StdioNull`](child_process.md#stdionull) \| [`StdioPipe`](child_process.md#stdiopipe) | -| `Stdout` *extends* [`StdioNull`](child_process.md#stdionull) \| [`StdioPipe`](child_process.md#stdiopipe) | -| `Stderr` *extends* [`StdioNull`](child_process.md#stdionull) \| [`StdioPipe`](child_process.md#stdiopipe) | +| `Stdin` *extends* [`StdioNull`](#stdionull) \| [`StdioPipe`](#stdiopipe) | +| `Stdout` *extends* [`StdioNull`](#stdionull) \| [`StdioPipe`](#stdiopipe) | +| `Stderr` *extends* [`StdioNull`](#stdionull) \| [`StdioPipe`](#stdiopipe) | #### Properties @@ -2958,7 +2958,7 @@ If passed as an array, the first element is used for `stdin`, the second for ###### Inherited from -[`SpawnOptions`](child_process.md#spawnoptions).[`cwd`](child_process.md#cwd-1) +[`SpawnOptions`](#spawnoptions).[`cwd`](#cwd-1) ##### gid? @@ -2966,7 +2966,7 @@ If passed as an array, the first element is used for `stdin`, the second for ###### Inherited from -[`SpawnOptions`](child_process.md#spawnoptions).[`gid`](child_process.md#gid-1) +[`SpawnOptions`](#spawnoptions).[`gid`](#gid-1) ##### shell? @@ -2974,7 +2974,7 @@ If passed as an array, the first element is used for `stdin`, the second for ###### Inherited from -[`SpawnOptions`](child_process.md#spawnoptions).[`shell`](child_process.md#shell) +[`SpawnOptions`](#spawnoptions).[`shell`](#shell) ##### stdio @@ -2992,7 +2992,7 @@ If passed as an array, the first element is used for `stdin`, the second for ###### Overrides -[`SpawnOptions`](child_process.md#spawnoptions).[`stdio`](child_process.md#stdio) +[`SpawnOptions`](#spawnoptions).[`stdio`](#stdio) ##### uid? @@ -3000,7 +3000,7 @@ If passed as an array, the first element is used for `stdin`, the second for ###### Inherited from -[`SpawnOptions`](child_process.md#spawnoptions).[`uid`](child_process.md#uid-1) +[`SpawnOptions`](#spawnoptions).[`uid`](#uid-1) ##### windowsVerbatimArguments? @@ -3008,37 +3008,37 @@ If passed as an array, the first element is used for `stdin`, the second for ###### Inherited from -[`SpawnOptions`](child_process.md#spawnoptions).[`windowsVerbatimArguments`](child_process.md#windowsverbatimarguments) +[`SpawnOptions`](#spawnoptions).[`windowsVerbatimArguments`](#windowsverbatimarguments) ## Type Aliases ### IOType -> **IOType**: `"pipe"` \| `"ignore"` \| `"inherit"` +> **IOType** = `"pipe"` \| `"ignore"` \| `"inherit"` *** ### StdioNull -> **StdioNull**: `"inherit"` \| `"ignore"` +> **StdioNull** = `"inherit"` \| `"ignore"` *** ### StdioOptions -> **StdioOptions**: [`IOType`](child_process.md#iotype) \| ([`IOType`](child_process.md#iotype) \| `number` \| `null` \| `undefined`)[] +> **StdioOptions** = [`IOType`](#iotype) \| ([`IOType`](#iotype) \| `number` \| `null` \| `undefined`)[] *** ### StdioPipe -> **StdioPipe**: `undefined` \| `null` \| [`StdioPipeNamed`](child_process.md#stdiopipenamed) +> **StdioPipe** = `undefined` \| `null` \| [`StdioPipeNamed`](#stdiopipenamed) *** ### StdioPipeNamed -> **StdioPipeNamed**: `"pipe"` +> **StdioPipeNamed** = `"pipe"` ## Functions @@ -3046,7 +3046,7 @@ If passed as an array, the first element is used for `stdin`, the second for #### Call Signature -> **spawn**(`command`: `string`, `options`?: [`SpawnOptionsWithoutStdio`](child_process.md#spawnoptionswithoutstdio)): [`ChildProcessWithoutNullStreams`](child_process.md#childprocesswithoutnullstreams) +> **spawn**(`command`: `string`, `options?`: [`SpawnOptionsWithoutStdio`](#spawnoptionswithoutstdio)): [`ChildProcessWithoutNullStreams`](#childprocesswithoutnullstreams) The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -3139,15 +3139,15 @@ title while others (Windows, SunOS) will use `command`. | Parameter | Type | Description | | ------ | ------ | ------ | | `command` | `string` | The command to run. | -| `options`? | [`SpawnOptionsWithoutStdio`](child_process.md#spawnoptionswithoutstdio) | - | +| `options?` | [`SpawnOptionsWithoutStdio`](#spawnoptionswithoutstdio) | - | ##### Returns -[`ChildProcessWithoutNullStreams`](child_process.md#childprocesswithoutnullstreams) +[`ChildProcessWithoutNullStreams`](#childprocesswithoutnullstreams) #### Call Signature -> **spawn**(`command`: `string`, `options`: [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioPipe`](child_process.md#stdiopipe), [`StdioPipe`](child_process.md#stdiopipe), [`StdioPipe`](child_process.md#stdiopipe)\>): [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<[`DefaultWritableStream`](stream.md#defaultwritablestream), [`DefaultReadableStream`](stream.md#defaultreadablestream), [`DefaultReadableStream`](stream.md#defaultreadablestream)\> +> **spawn**(`command`: `string`, `options`: [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioPipe`](#stdiopipe), [`StdioPipe`](#stdiopipe), [`StdioPipe`](#stdiopipe)\>): [`ChildProcessByStdio`](#childprocessbystdio)\<[`DefaultWritableStream`](stream/stream.md#defaultwritablestream), [`DefaultReadableStream`](stream/stream.md#defaultreadablestream), [`DefaultReadableStream`](stream/stream.md#defaultreadablestream)\> The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -3240,15 +3240,15 @@ title while others (Windows, SunOS) will use `command`. | Parameter | Type | Description | | ------ | ------ | ------ | | `command` | `string` | The command to run. | -| `options` | [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioPipe`](child_process.md#stdiopipe), [`StdioPipe`](child_process.md#stdiopipe), [`StdioPipe`](child_process.md#stdiopipe)\> | - | +| `options` | [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioPipe`](#stdiopipe), [`StdioPipe`](#stdiopipe), [`StdioPipe`](#stdiopipe)\> | - | ##### Returns -[`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<[`DefaultWritableStream`](stream.md#defaultwritablestream), [`DefaultReadableStream`](stream.md#defaultreadablestream), [`DefaultReadableStream`](stream.md#defaultreadablestream)\> +[`ChildProcessByStdio`](#childprocessbystdio)\<[`DefaultWritableStream`](stream/stream.md#defaultwritablestream), [`DefaultReadableStream`](stream/stream.md#defaultreadablestream), [`DefaultReadableStream`](stream/stream.md#defaultreadablestream)\> #### Call Signature -> **spawn**(`command`: `string`, `options`: [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioPipe`](child_process.md#stdiopipe), [`StdioPipe`](child_process.md#stdiopipe), [`StdioNull`](child_process.md#stdionull)\>): [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<[`DefaultWritableStream`](stream.md#defaultwritablestream), [`DefaultReadableStream`](stream.md#defaultreadablestream), `null`\> +> **spawn**(`command`: `string`, `options`: [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioPipe`](#stdiopipe), [`StdioPipe`](#stdiopipe), [`StdioNull`](#stdionull)\>): [`ChildProcessByStdio`](#childprocessbystdio)\<[`DefaultWritableStream`](stream/stream.md#defaultwritablestream), [`DefaultReadableStream`](stream/stream.md#defaultreadablestream), `null`\> The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -3341,15 +3341,15 @@ title while others (Windows, SunOS) will use `command`. | Parameter | Type | Description | | ------ | ------ | ------ | | `command` | `string` | The command to run. | -| `options` | [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioPipe`](child_process.md#stdiopipe), [`StdioPipe`](child_process.md#stdiopipe), [`StdioNull`](child_process.md#stdionull)\> | - | +| `options` | [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioPipe`](#stdiopipe), [`StdioPipe`](#stdiopipe), [`StdioNull`](#stdionull)\> | - | ##### Returns -[`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<[`DefaultWritableStream`](stream.md#defaultwritablestream), [`DefaultReadableStream`](stream.md#defaultreadablestream), `null`\> +[`ChildProcessByStdio`](#childprocessbystdio)\<[`DefaultWritableStream`](stream/stream.md#defaultwritablestream), [`DefaultReadableStream`](stream/stream.md#defaultreadablestream), `null`\> #### Call Signature -> **spawn**(`command`: `string`, `options`: [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioPipe`](child_process.md#stdiopipe), [`StdioNull`](child_process.md#stdionull), [`StdioPipe`](child_process.md#stdiopipe)\>): [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<[`DefaultWritableStream`](stream.md#defaultwritablestream), `null`, [`DefaultReadableStream`](stream.md#defaultreadablestream)\> +> **spawn**(`command`: `string`, `options`: [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioPipe`](#stdiopipe), [`StdioNull`](#stdionull), [`StdioPipe`](#stdiopipe)\>): [`ChildProcessByStdio`](#childprocessbystdio)\<[`DefaultWritableStream`](stream/stream.md#defaultwritablestream), `null`, [`DefaultReadableStream`](stream/stream.md#defaultreadablestream)\> The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -3442,15 +3442,15 @@ title while others (Windows, SunOS) will use `command`. | Parameter | Type | Description | | ------ | ------ | ------ | | `command` | `string` | The command to run. | -| `options` | [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioPipe`](child_process.md#stdiopipe), [`StdioNull`](child_process.md#stdionull), [`StdioPipe`](child_process.md#stdiopipe)\> | - | +| `options` | [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioPipe`](#stdiopipe), [`StdioNull`](#stdionull), [`StdioPipe`](#stdiopipe)\> | - | ##### Returns -[`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<[`DefaultWritableStream`](stream.md#defaultwritablestream), `null`, [`DefaultReadableStream`](stream.md#defaultreadablestream)\> +[`ChildProcessByStdio`](#childprocessbystdio)\<[`DefaultWritableStream`](stream/stream.md#defaultwritablestream), `null`, [`DefaultReadableStream`](stream/stream.md#defaultreadablestream)\> #### Call Signature -> **spawn**(`command`: `string`, `options`: [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioNull`](child_process.md#stdionull), [`StdioPipe`](child_process.md#stdiopipe), [`StdioPipe`](child_process.md#stdiopipe)\>): [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<`null`, [`DefaultReadableStream`](stream.md#defaultreadablestream), [`DefaultReadableStream`](stream.md#defaultreadablestream)\> +> **spawn**(`command`: `string`, `options`: [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioNull`](#stdionull), [`StdioPipe`](#stdiopipe), [`StdioPipe`](#stdiopipe)\>): [`ChildProcessByStdio`](#childprocessbystdio)\<`null`, [`DefaultReadableStream`](stream/stream.md#defaultreadablestream), [`DefaultReadableStream`](stream/stream.md#defaultreadablestream)\> The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -3543,15 +3543,15 @@ title while others (Windows, SunOS) will use `command`. | Parameter | Type | Description | | ------ | ------ | ------ | | `command` | `string` | The command to run. | -| `options` | [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioNull`](child_process.md#stdionull), [`StdioPipe`](child_process.md#stdiopipe), [`StdioPipe`](child_process.md#stdiopipe)\> | - | +| `options` | [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioNull`](#stdionull), [`StdioPipe`](#stdiopipe), [`StdioPipe`](#stdiopipe)\> | - | ##### Returns -[`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<`null`, [`DefaultReadableStream`](stream.md#defaultreadablestream), [`DefaultReadableStream`](stream.md#defaultreadablestream)\> +[`ChildProcessByStdio`](#childprocessbystdio)\<`null`, [`DefaultReadableStream`](stream/stream.md#defaultreadablestream), [`DefaultReadableStream`](stream/stream.md#defaultreadablestream)\> #### Call Signature -> **spawn**(`command`: `string`, `options`: [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioPipe`](child_process.md#stdiopipe), [`StdioNull`](child_process.md#stdionull), [`StdioNull`](child_process.md#stdionull)\>): [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<[`DefaultWritableStream`](stream.md#defaultwritablestream), `null`, `null`\> +> **spawn**(`command`: `string`, `options`: [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioPipe`](#stdiopipe), [`StdioNull`](#stdionull), [`StdioNull`](#stdionull)\>): [`ChildProcessByStdio`](#childprocessbystdio)\<[`DefaultWritableStream`](stream/stream.md#defaultwritablestream), `null`, `null`\> The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -3644,15 +3644,15 @@ title while others (Windows, SunOS) will use `command`. | Parameter | Type | Description | | ------ | ------ | ------ | | `command` | `string` | The command to run. | -| `options` | [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioPipe`](child_process.md#stdiopipe), [`StdioNull`](child_process.md#stdionull), [`StdioNull`](child_process.md#stdionull)\> | - | +| `options` | [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioPipe`](#stdiopipe), [`StdioNull`](#stdionull), [`StdioNull`](#stdionull)\> | - | ##### Returns -[`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<[`DefaultWritableStream`](stream.md#defaultwritablestream), `null`, `null`\> +[`ChildProcessByStdio`](#childprocessbystdio)\<[`DefaultWritableStream`](stream/stream.md#defaultwritablestream), `null`, `null`\> #### Call Signature -> **spawn**(`command`: `string`, `options`: [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioNull`](child_process.md#stdionull), [`StdioPipe`](child_process.md#stdiopipe), [`StdioNull`](child_process.md#stdionull)\>): [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<`null`, [`DefaultReadableStream`](stream.md#defaultreadablestream), `null`\> +> **spawn**(`command`: `string`, `options`: [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioNull`](#stdionull), [`StdioPipe`](#stdiopipe), [`StdioNull`](#stdionull)\>): [`ChildProcessByStdio`](#childprocessbystdio)\<`null`, [`DefaultReadableStream`](stream/stream.md#defaultreadablestream), `null`\> The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -3745,15 +3745,15 @@ title while others (Windows, SunOS) will use `command`. | Parameter | Type | Description | | ------ | ------ | ------ | | `command` | `string` | The command to run. | -| `options` | [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioNull`](child_process.md#stdionull), [`StdioPipe`](child_process.md#stdiopipe), [`StdioNull`](child_process.md#stdionull)\> | - | +| `options` | [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioNull`](#stdionull), [`StdioPipe`](#stdiopipe), [`StdioNull`](#stdionull)\> | - | ##### Returns -[`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<`null`, [`DefaultReadableStream`](stream.md#defaultreadablestream), `null`\> +[`ChildProcessByStdio`](#childprocessbystdio)\<`null`, [`DefaultReadableStream`](stream/stream.md#defaultreadablestream), `null`\> #### Call Signature -> **spawn**(`command`: `string`, `options`: [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioNull`](child_process.md#stdionull), [`StdioNull`](child_process.md#stdionull), [`StdioPipe`](child_process.md#stdiopipe)\>): [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<`null`, `null`, [`DefaultReadableStream`](stream.md#defaultreadablestream)\> +> **spawn**(`command`: `string`, `options`: [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioNull`](#stdionull), [`StdioNull`](#stdionull), [`StdioPipe`](#stdiopipe)\>): [`ChildProcessByStdio`](#childprocessbystdio)\<`null`, `null`, [`DefaultReadableStream`](stream/stream.md#defaultreadablestream)\> The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -3846,15 +3846,15 @@ title while others (Windows, SunOS) will use `command`. | Parameter | Type | Description | | ------ | ------ | ------ | | `command` | `string` | The command to run. | -| `options` | [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioNull`](child_process.md#stdionull), [`StdioNull`](child_process.md#stdionull), [`StdioPipe`](child_process.md#stdiopipe)\> | - | +| `options` | [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioNull`](#stdionull), [`StdioNull`](#stdionull), [`StdioPipe`](#stdiopipe)\> | - | ##### Returns -[`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<`null`, `null`, [`DefaultReadableStream`](stream.md#defaultreadablestream)\> +[`ChildProcessByStdio`](#childprocessbystdio)\<`null`, `null`, [`DefaultReadableStream`](stream/stream.md#defaultreadablestream)\> #### Call Signature -> **spawn**(`command`: `string`, `options`: [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioNull`](child_process.md#stdionull), [`StdioNull`](child_process.md#stdionull), [`StdioNull`](child_process.md#stdionull)\>): [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<`null`, `null`, `null`\> +> **spawn**(`command`: `string`, `options`: [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioNull`](#stdionull), [`StdioNull`](#stdionull), [`StdioNull`](#stdionull)\>): [`ChildProcessByStdio`](#childprocessbystdio)\<`null`, `null`, `null`\> The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -3947,15 +3947,15 @@ title while others (Windows, SunOS) will use `command`. | Parameter | Type | Description | | ------ | ------ | ------ | | `command` | `string` | The command to run. | -| `options` | [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioNull`](child_process.md#stdionull), [`StdioNull`](child_process.md#stdionull), [`StdioNull`](child_process.md#stdionull)\> | - | +| `options` | [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioNull`](#stdionull), [`StdioNull`](#stdionull), [`StdioNull`](#stdionull)\> | - | ##### Returns -[`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<`null`, `null`, `null`\> +[`ChildProcessByStdio`](#childprocessbystdio)\<`null`, `null`, `null`\> #### Call Signature -> **spawn**(`command`: `string`, `options`: [`SpawnOptions`](child_process.md#spawnoptions)): [`ChildProcess`](child_process.md#childprocess) +> **spawn**(`command`: `string`, `options`: [`SpawnOptions`](#spawnoptions)): [`ChildProcess`](#childprocess) The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -4048,15 +4048,15 @@ title while others (Windows, SunOS) will use `command`. | Parameter | Type | Description | | ------ | ------ | ------ | | `command` | `string` | The command to run. | -| `options` | [`SpawnOptions`](child_process.md#spawnoptions) | - | +| `options` | [`SpawnOptions`](#spawnoptions) | - | ##### Returns -[`ChildProcess`](child_process.md#childprocess) +[`ChildProcess`](#childprocess) #### Call Signature -> **spawn**(`command`: `string`, `args`?: readonly `string`[], `options`?: [`SpawnOptionsWithoutStdio`](child_process.md#spawnoptionswithoutstdio)): [`ChildProcessWithoutNullStreams`](child_process.md#childprocesswithoutnullstreams) +> **spawn**(`command`: `string`, `args?`: readonly `string`[], `options?`: [`SpawnOptionsWithoutStdio`](#spawnoptionswithoutstdio)): [`ChildProcessWithoutNullStreams`](#childprocesswithoutnullstreams) The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -4149,16 +4149,16 @@ title while others (Windows, SunOS) will use `command`. | Parameter | Type | Description | | ------ | ------ | ------ | | `command` | `string` | The command to run. | -| `args`? | readonly `string`[] | List of string arguments. | -| `options`? | [`SpawnOptionsWithoutStdio`](child_process.md#spawnoptionswithoutstdio) | - | +| `args?` | readonly `string`[] | List of string arguments. | +| `options?` | [`SpawnOptionsWithoutStdio`](#spawnoptionswithoutstdio) | - | ##### Returns -[`ChildProcessWithoutNullStreams`](child_process.md#childprocesswithoutnullstreams) +[`ChildProcessWithoutNullStreams`](#childprocesswithoutnullstreams) #### Call Signature -> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioPipe`](child_process.md#stdiopipe), [`StdioPipe`](child_process.md#stdiopipe), [`StdioPipe`](child_process.md#stdiopipe)\>): [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<[`DefaultWritableStream`](stream.md#defaultwritablestream), [`DefaultReadableStream`](stream.md#defaultreadablestream), [`DefaultReadableStream`](stream.md#defaultreadablestream)\> +> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioPipe`](#stdiopipe), [`StdioPipe`](#stdiopipe), [`StdioPipe`](#stdiopipe)\>): [`ChildProcessByStdio`](#childprocessbystdio)\<[`DefaultWritableStream`](stream/stream.md#defaultwritablestream), [`DefaultReadableStream`](stream/stream.md#defaultreadablestream), [`DefaultReadableStream`](stream/stream.md#defaultreadablestream)\> The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -4252,15 +4252,15 @@ title while others (Windows, SunOS) will use `command`. | ------ | ------ | ------ | | `command` | `string` | The command to run. | | `args` | readonly `string`[] | List of string arguments. | -| `options` | [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioPipe`](child_process.md#stdiopipe), [`StdioPipe`](child_process.md#stdiopipe), [`StdioPipe`](child_process.md#stdiopipe)\> | - | +| `options` | [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioPipe`](#stdiopipe), [`StdioPipe`](#stdiopipe), [`StdioPipe`](#stdiopipe)\> | - | ##### Returns -[`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<[`DefaultWritableStream`](stream.md#defaultwritablestream), [`DefaultReadableStream`](stream.md#defaultreadablestream), [`DefaultReadableStream`](stream.md#defaultreadablestream)\> +[`ChildProcessByStdio`](#childprocessbystdio)\<[`DefaultWritableStream`](stream/stream.md#defaultwritablestream), [`DefaultReadableStream`](stream/stream.md#defaultreadablestream), [`DefaultReadableStream`](stream/stream.md#defaultreadablestream)\> #### Call Signature -> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioPipe`](child_process.md#stdiopipe), [`StdioPipe`](child_process.md#stdiopipe), [`StdioNull`](child_process.md#stdionull)\>): [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<[`DefaultWritableStream`](stream.md#defaultwritablestream), [`DefaultReadableStream`](stream.md#defaultreadablestream), `null`\> +> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioPipe`](#stdiopipe), [`StdioPipe`](#stdiopipe), [`StdioNull`](#stdionull)\>): [`ChildProcessByStdio`](#childprocessbystdio)\<[`DefaultWritableStream`](stream/stream.md#defaultwritablestream), [`DefaultReadableStream`](stream/stream.md#defaultreadablestream), `null`\> The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -4354,15 +4354,15 @@ title while others (Windows, SunOS) will use `command`. | ------ | ------ | ------ | | `command` | `string` | The command to run. | | `args` | readonly `string`[] | List of string arguments. | -| `options` | [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioPipe`](child_process.md#stdiopipe), [`StdioPipe`](child_process.md#stdiopipe), [`StdioNull`](child_process.md#stdionull)\> | - | +| `options` | [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioPipe`](#stdiopipe), [`StdioPipe`](#stdiopipe), [`StdioNull`](#stdionull)\> | - | ##### Returns -[`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<[`DefaultWritableStream`](stream.md#defaultwritablestream), [`DefaultReadableStream`](stream.md#defaultreadablestream), `null`\> +[`ChildProcessByStdio`](#childprocessbystdio)\<[`DefaultWritableStream`](stream/stream.md#defaultwritablestream), [`DefaultReadableStream`](stream/stream.md#defaultreadablestream), `null`\> #### Call Signature -> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioPipe`](child_process.md#stdiopipe), [`StdioNull`](child_process.md#stdionull), [`StdioPipe`](child_process.md#stdiopipe)\>): [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<[`DefaultWritableStream`](stream.md#defaultwritablestream), `null`, [`DefaultReadableStream`](stream.md#defaultreadablestream)\> +> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioPipe`](#stdiopipe), [`StdioNull`](#stdionull), [`StdioPipe`](#stdiopipe)\>): [`ChildProcessByStdio`](#childprocessbystdio)\<[`DefaultWritableStream`](stream/stream.md#defaultwritablestream), `null`, [`DefaultReadableStream`](stream/stream.md#defaultreadablestream)\> The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -4456,15 +4456,15 @@ title while others (Windows, SunOS) will use `command`. | ------ | ------ | ------ | | `command` | `string` | The command to run. | | `args` | readonly `string`[] | List of string arguments. | -| `options` | [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioPipe`](child_process.md#stdiopipe), [`StdioNull`](child_process.md#stdionull), [`StdioPipe`](child_process.md#stdiopipe)\> | - | +| `options` | [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioPipe`](#stdiopipe), [`StdioNull`](#stdionull), [`StdioPipe`](#stdiopipe)\> | - | ##### Returns -[`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<[`DefaultWritableStream`](stream.md#defaultwritablestream), `null`, [`DefaultReadableStream`](stream.md#defaultreadablestream)\> +[`ChildProcessByStdio`](#childprocessbystdio)\<[`DefaultWritableStream`](stream/stream.md#defaultwritablestream), `null`, [`DefaultReadableStream`](stream/stream.md#defaultreadablestream)\> #### Call Signature -> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioNull`](child_process.md#stdionull), [`StdioPipe`](child_process.md#stdiopipe), [`StdioPipe`](child_process.md#stdiopipe)\>): [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<`null`, [`DefaultReadableStream`](stream.md#defaultreadablestream), [`DefaultReadableStream`](stream.md#defaultreadablestream)\> +> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioNull`](#stdionull), [`StdioPipe`](#stdiopipe), [`StdioPipe`](#stdiopipe)\>): [`ChildProcessByStdio`](#childprocessbystdio)\<`null`, [`DefaultReadableStream`](stream/stream.md#defaultreadablestream), [`DefaultReadableStream`](stream/stream.md#defaultreadablestream)\> The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -4558,15 +4558,15 @@ title while others (Windows, SunOS) will use `command`. | ------ | ------ | ------ | | `command` | `string` | The command to run. | | `args` | readonly `string`[] | List of string arguments. | -| `options` | [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioNull`](child_process.md#stdionull), [`StdioPipe`](child_process.md#stdiopipe), [`StdioPipe`](child_process.md#stdiopipe)\> | - | +| `options` | [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioNull`](#stdionull), [`StdioPipe`](#stdiopipe), [`StdioPipe`](#stdiopipe)\> | - | ##### Returns -[`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<`null`, [`DefaultReadableStream`](stream.md#defaultreadablestream), [`DefaultReadableStream`](stream.md#defaultreadablestream)\> +[`ChildProcessByStdio`](#childprocessbystdio)\<`null`, [`DefaultReadableStream`](stream/stream.md#defaultreadablestream), [`DefaultReadableStream`](stream/stream.md#defaultreadablestream)\> #### Call Signature -> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioPipe`](child_process.md#stdiopipe), [`StdioNull`](child_process.md#stdionull), [`StdioNull`](child_process.md#stdionull)\>): [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<[`DefaultWritableStream`](stream.md#defaultwritablestream), `null`, `null`\> +> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioPipe`](#stdiopipe), [`StdioNull`](#stdionull), [`StdioNull`](#stdionull)\>): [`ChildProcessByStdio`](#childprocessbystdio)\<[`DefaultWritableStream`](stream/stream.md#defaultwritablestream), `null`, `null`\> The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -4660,15 +4660,15 @@ title while others (Windows, SunOS) will use `command`. | ------ | ------ | ------ | | `command` | `string` | The command to run. | | `args` | readonly `string`[] | List of string arguments. | -| `options` | [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioPipe`](child_process.md#stdiopipe), [`StdioNull`](child_process.md#stdionull), [`StdioNull`](child_process.md#stdionull)\> | - | +| `options` | [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioPipe`](#stdiopipe), [`StdioNull`](#stdionull), [`StdioNull`](#stdionull)\> | - | ##### Returns -[`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<[`DefaultWritableStream`](stream.md#defaultwritablestream), `null`, `null`\> +[`ChildProcessByStdio`](#childprocessbystdio)\<[`DefaultWritableStream`](stream/stream.md#defaultwritablestream), `null`, `null`\> #### Call Signature -> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioNull`](child_process.md#stdionull), [`StdioPipe`](child_process.md#stdiopipe), [`StdioNull`](child_process.md#stdionull)\>): [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<`null`, [`DefaultReadableStream`](stream.md#defaultreadablestream), `null`\> +> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioNull`](#stdionull), [`StdioPipe`](#stdiopipe), [`StdioNull`](#stdionull)\>): [`ChildProcessByStdio`](#childprocessbystdio)\<`null`, [`DefaultReadableStream`](stream/stream.md#defaultreadablestream), `null`\> The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -4762,15 +4762,15 @@ title while others (Windows, SunOS) will use `command`. | ------ | ------ | ------ | | `command` | `string` | The command to run. | | `args` | readonly `string`[] | List of string arguments. | -| `options` | [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioNull`](child_process.md#stdionull), [`StdioPipe`](child_process.md#stdiopipe), [`StdioNull`](child_process.md#stdionull)\> | - | +| `options` | [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioNull`](#stdionull), [`StdioPipe`](#stdiopipe), [`StdioNull`](#stdionull)\> | - | ##### Returns -[`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<`null`, [`DefaultReadableStream`](stream.md#defaultreadablestream), `null`\> +[`ChildProcessByStdio`](#childprocessbystdio)\<`null`, [`DefaultReadableStream`](stream/stream.md#defaultreadablestream), `null`\> #### Call Signature -> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioNull`](child_process.md#stdionull), [`StdioNull`](child_process.md#stdionull), [`StdioPipe`](child_process.md#stdiopipe)\>): [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<`null`, `null`, [`DefaultReadableStream`](stream.md#defaultreadablestream)\> +> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioNull`](#stdionull), [`StdioNull`](#stdionull), [`StdioPipe`](#stdiopipe)\>): [`ChildProcessByStdio`](#childprocessbystdio)\<`null`, `null`, [`DefaultReadableStream`](stream/stream.md#defaultreadablestream)\> The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -4864,15 +4864,15 @@ title while others (Windows, SunOS) will use `command`. | ------ | ------ | ------ | | `command` | `string` | The command to run. | | `args` | readonly `string`[] | List of string arguments. | -| `options` | [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioNull`](child_process.md#stdionull), [`StdioNull`](child_process.md#stdionull), [`StdioPipe`](child_process.md#stdiopipe)\> | - | +| `options` | [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioNull`](#stdionull), [`StdioNull`](#stdionull), [`StdioPipe`](#stdiopipe)\> | - | ##### Returns -[`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<`null`, `null`, [`DefaultReadableStream`](stream.md#defaultreadablestream)\> +[`ChildProcessByStdio`](#childprocessbystdio)\<`null`, `null`, [`DefaultReadableStream`](stream/stream.md#defaultreadablestream)\> #### Call Signature -> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioNull`](child_process.md#stdionull), [`StdioNull`](child_process.md#stdionull), [`StdioNull`](child_process.md#stdionull)\>): [`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<`null`, `null`, `null`\> +> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioNull`](#stdionull), [`StdioNull`](#stdionull), [`StdioNull`](#stdionull)\>): [`ChildProcessByStdio`](#childprocessbystdio)\<`null`, `null`, `null`\> The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -4966,15 +4966,15 @@ title while others (Windows, SunOS) will use `command`. | ------ | ------ | ------ | | `command` | `string` | The command to run. | | `args` | readonly `string`[] | List of string arguments. | -| `options` | [`SpawnOptionsWithStdioTuple`](child_process.md#spawnoptionswithstdiotuplestdin-stdout-stderr)\<[`StdioNull`](child_process.md#stdionull), [`StdioNull`](child_process.md#stdionull), [`StdioNull`](child_process.md#stdionull)\> | - | +| `options` | [`SpawnOptionsWithStdioTuple`](#spawnoptionswithstdiotuple)\<[`StdioNull`](#stdionull), [`StdioNull`](#stdionull), [`StdioNull`](#stdionull)\> | - | ##### Returns -[`ChildProcessByStdio`](child_process.md#childprocessbystdioi-o-e)\<`null`, `null`, `null`\> +[`ChildProcessByStdio`](#childprocessbystdio)\<`null`, `null`, `null`\> #### Call Signature -> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptions`](child_process.md#spawnoptions)): [`ChildProcess`](child_process.md#childprocess) +> **spawn**(`command`: `string`, `args`: readonly `string`[], `options`: [`SpawnOptions`](#spawnoptions)): [`ChildProcess`](#childprocess) The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults to an empty array. @@ -5068,8 +5068,8 @@ title while others (Windows, SunOS) will use `command`. | ------ | ------ | ------ | | `command` | `string` | The command to run. | | `args` | readonly `string`[] | List of string arguments. | -| `options` | [`SpawnOptions`](child_process.md#spawnoptions) | - | +| `options` | [`SpawnOptions`](#spawnoptions) | - | ##### Returns -[`ChildProcess`](child_process.md#childprocess) +[`ChildProcess`](#childprocess) diff --git a/src/reference/modules/llrt/crypto.md b/src/reference/modules/llrt/crypto.md index a650df2..14706b8 100644 --- a/src/reference/modules/llrt/crypto.md +++ b/src/reference/modules/llrt/crypto.md @@ -11,7 +11,7 @@ The `Hash` class is a utility for creating hash digests of data. Using the `hash.update()` and `hash.digest()` methods to produce the computed hash. -The [createHash](crypto.md#createhash) method is used to create `Hash` instances. +The [createHash](#createhash) method is used to create `Hash` instances. `Hash`objects are not to be created directly using the `new` keyword. Example: Using the `hash.update()` and `hash.digest()` methods: @@ -48,7 +48,7 @@ called. Multiple calls will cause an error to be thrown. ###### Call Signature -> **digest**(`encoding`: [`BinaryToTextEncoding`](crypto.md#binarytotextencoding)): `string` +> **digest**(`encoding`: [`BinaryToTextEncoding`](#binarytotextencoding)): `string` Calculates the digest of all of the data passed to be hashed (using the `hash.update()` method). If `encoding` is provided a string will be returned; otherwise @@ -61,7 +61,7 @@ called. Multiple calls will cause an error to be thrown. | Parameter | Type | Description | | ------ | ------ | ------ | -| `encoding` | [`BinaryToTextEncoding`](crypto.md#binarytotextencoding) | The `encoding` of the return value. | +| `encoding` | [`BinaryToTextEncoding`](#binarytotextencoding) | The `encoding` of the return value. | ###### Returns @@ -71,7 +71,7 @@ called. Multiple calls will cause an error to be thrown. ###### Call Signature -> **update**(`data`: [`BinaryLike`](crypto.md#binarylike)): [`Hash`](crypto.md#hash) +> **update**(`data`: [`BinaryLike`](#binarylike)): [`Hash`](#hash) Updates the hash content with the given `data`, the encoding of which is given in `inputEncoding`. @@ -85,15 +85,15 @@ This can be called many times with new data as it is streamed. | Parameter | Type | | ------ | ------ | -| `data` | [`BinaryLike`](crypto.md#binarylike) | +| `data` | [`BinaryLike`](#binarylike) | ###### Returns -[`Hash`](crypto.md#hash) +[`Hash`](#hash) ###### Call Signature -> **update**(`data`: `string`, `inputEncoding`: [`Encoding`](crypto.md#encoding)): [`Hash`](crypto.md#hash) +> **update**(`data`: `string`, `inputEncoding`: [`Encoding`](#encoding)): [`Hash`](#hash) Updates the hash content with the given `data`, the encoding of which is given in `inputEncoding`. @@ -108,11 +108,11 @@ This can be called many times with new data as it is streamed. | Parameter | Type | Description | | ------ | ------ | ------ | | `data` | `string` | - | -| `inputEncoding` | [`Encoding`](crypto.md#encoding) | The `encoding` of the `data` string. | +| `inputEncoding` | [`Encoding`](#encoding) | The `encoding` of the `data` string. | ###### Returns -[`Hash`](crypto.md#hash) +[`Hash`](#hash) *** @@ -123,7 +123,7 @@ The `Hmac` class is a utility for creating cryptographic HMAC digests. Using the `hmac.update()` and `hmac.digest()` methods to produce the computed HMAC digest. -The [createHmac](crypto.md#createhmac) method is used to create `Hmac` instances. +The [createHmac](#createhmac) method is used to create `Hmac` instances. `Hmac`objects are not to be created directly using the `new` keyword. Example: Using the `hmac.update()` and `hmac.digest()` methods: @@ -160,7 +160,7 @@ called. Multiple calls to `hmac.digest()` will result in an error being thrown. ###### Call Signature -> **digest**(`encoding`: [`BinaryToTextEncoding`](crypto.md#binarytotextencoding)): `string` +> **digest**(`encoding`: [`BinaryToTextEncoding`](#binarytotextencoding)): `string` Calculates the HMAC digest of all of the data passed using `hmac.update()`. If `encoding` is @@ -173,7 +173,7 @@ called. Multiple calls to `hmac.digest()` will result in an error being thrown. | Parameter | Type | Description | | ------ | ------ | ------ | -| `encoding` | [`BinaryToTextEncoding`](crypto.md#binarytotextencoding) | The `encoding` of the return value. | +| `encoding` | [`BinaryToTextEncoding`](#binarytotextencoding) | The `encoding` of the return value. | ###### Returns @@ -183,7 +183,7 @@ called. Multiple calls to `hmac.digest()` will result in an error being thrown. ###### Call Signature -> **update**(`data`: [`BinaryLike`](crypto.md#binarylike)): [`Hmac`](crypto.md#hmac) +> **update**(`data`: [`BinaryLike`](#binarylike)): [`Hmac`](#hmac) Updates the `Hmac` content with the given `data`, the encoding of which is given in `inputEncoding`. @@ -197,15 +197,15 @@ This can be called many times with new data as it is streamed. | Parameter | Type | | ------ | ------ | -| `data` | [`BinaryLike`](crypto.md#binarylike) | +| `data` | [`BinaryLike`](#binarylike) | ###### Returns -[`Hmac`](crypto.md#hmac) +[`Hmac`](#hmac) ###### Call Signature -> **update**(`data`: `string`, `inputEncoding`: [`Encoding`](crypto.md#encoding)): [`Hmac`](crypto.md#hmac) +> **update**(`data`: `string`, `inputEncoding`: [`Encoding`](#encoding)): [`Hmac`](#hmac) Updates the `Hmac` content with the given `data`, the encoding of which is given in `inputEncoding`. @@ -220,53 +220,53 @@ This can be called many times with new data as it is streamed. | Parameter | Type | Description | | ------ | ------ | ------ | | `data` | `string` | - | -| `inputEncoding` | [`Encoding`](crypto.md#encoding) | The `encoding` of the `data` string. | +| `inputEncoding` | [`Encoding`](#encoding) | The `encoding` of the `data` string. | ###### Returns -[`Hmac`](crypto.md#hmac) +[`Hmac`](#hmac) ## Type Aliases ### BinaryLike -> **BinaryLike**: `string` \| [`ArrayBufferView`](globals/namespaces/QuickJS.md#arraybufferview) +> **BinaryLike** = `string` \| [`ArrayBufferView`](globals/namespaces/QuickJS.md#arraybufferview) *** ### BinaryToTextEncoding -> **BinaryToTextEncoding**: `"base64"` \| `"hex"` +> **BinaryToTextEncoding** = `"base64"` \| `"hex"` *** ### CharacterEncoding -> **CharacterEncoding**: `"utf8"` \| `"utf-8"` \| `"utf16le"` \| `"utf-16le"` \| `"latin1"` +> **CharacterEncoding** = `"utf8"` \| `"utf-8"` \| `"utf16le"` \| `"utf-16le"` \| `"latin1"` *** ### Encoding -> **Encoding**: [`BinaryToTextEncoding`](crypto.md#binarytotextencoding) \| [`CharacterEncoding`](crypto.md#characterencoding) \| [`LegacyCharacterEncoding`](crypto.md#legacycharacterencoding) +> **Encoding** = [`BinaryToTextEncoding`](#binarytotextencoding) \| [`CharacterEncoding`](#characterencoding) \| [`LegacyCharacterEncoding`](#legacycharacterencoding) *** ### LegacyCharacterEncoding -> **LegacyCharacterEncoding**: `"ascii"` +> **LegacyCharacterEncoding** = `"ascii"` *** ### UUID -> **UUID**: `` `${string}-${string}-${string}-${string}-${string}` `` +> **UUID** = `` `${string}-${string}-${string}-${string}-${string}` `` ## Functions ### createHash() -> **createHash**(`algorithm`: `string`): [`Hash`](crypto.md#hash) +> **createHash**(`algorithm`: `string`): [`Hash`](#hash) Creates and returns a `Hash` object that can be used to generate hash digests using the given `algorithm`. @@ -281,13 +281,13 @@ The `algorithm` is supported by `'sha1'`, `'sha256'`,`'sha384'` and `'sha512'`. #### Returns -[`Hash`](crypto.md#hash) +[`Hash`](#hash) *** ### createHmac() -> **createHmac**(`algorithm`: `string`, `key`: [`BinaryLike`](crypto.md#binarylike)): [`Hmac`](crypto.md#hmac) +> **createHmac**(`algorithm`: `string`, `key`: [`BinaryLike`](#binarylike)): [`Hmac`](#hmac) Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. @@ -295,7 +295,7 @@ The `algorithm` is supported by `'sha1'`, `'sha256'`,`'sha384'` and `'sha512'`. The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is a string, please consider `caveats when using strings as inputs to cryptographic APIs`. -If it was obtained from a cryptographically secure source of entropy, such as [randomBytes](crypto.md#randombytes) +If it was obtained from a cryptographically secure source of entropy, such as [randomBytes](#randombytes) or generateKey, its length should not exceed the block size of `algorithm` (e.g., 512 bits for SHA-256). @@ -304,11 +304,11 @@ or generateKey, its length should not exceed the block size of `algorithm` | Parameter | Type | | ------ | ------ | | `algorithm` | `string` | -| `key` | [`BinaryLike`](crypto.md#binarylike) | +| `key` | [`BinaryLike`](#binarylike) | #### Returns -[`Hmac`](crypto.md#hmac) +[`Hmac`](#hmac) *** @@ -381,9 +381,9 @@ time is right after boot, when the whole system is still low on entropy. #### Call Signature -> **randomFill**\<`T`\>(`buffer`: `T`, `callback`: (`err`: `null` \| `Error`, `buf`: `T`) => `void`): `void` +> **randomFill**\<`T`\>(`buffer`: `T`, `callback`: (`err`: `Error` \| `null`, `buf`: `T`) => `void`): `void` -This function is similar to [randomBytes](crypto.md#randombytes) but requires the first +This function is similar to [randomBytes](#randombytes) but requires the first argument to be a `Buffer` that will be filled. It also requires that a callback is passed in. @@ -455,7 +455,7 @@ randomFill(c, (err, buf) => { | Parameter | Type | Description | | ------ | ------ | ------ | | `buffer` | `T` | Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`. | -| `callback` | (`err`: `null` \| `Error`, `buf`: `T`) => `void` | `function(err, buf) {}`. | +| `callback` | (`err`: `Error` \| `null`, `buf`: `T`) => `void` | `function(err, buf) {}`. | ##### Returns @@ -463,9 +463,9 @@ randomFill(c, (err, buf) => { #### Call Signature -> **randomFill**\<`T`\>(`buffer`: `T`, `offset`: `number`, `callback`: (`err`: `null` \| `Error`, `buf`: `T`) => `void`): `void` +> **randomFill**\<`T`\>(`buffer`: `T`, `offset`: `number`, `callback`: (`err`: `Error` \| `null`, `buf`: `T`) => `void`): `void` -This function is similar to [randomBytes](crypto.md#randombytes) but requires the first +This function is similar to [randomBytes](#randombytes) but requires the first argument to be a `Buffer` that will be filled. It also requires that a callback is passed in. @@ -538,7 +538,7 @@ randomFill(c, (err, buf) => { | ------ | ------ | ------ | | `buffer` | `T` | Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`. | | `offset` | `number` | | -| `callback` | (`err`: `null` \| `Error`, `buf`: `T`) => `void` | `function(err, buf) {}`. | +| `callback` | (`err`: `Error` \| `null`, `buf`: `T`) => `void` | `function(err, buf) {}`. | ##### Returns @@ -546,9 +546,9 @@ randomFill(c, (err, buf) => { #### Call Signature -> **randomFill**\<`T`\>(`buffer`: `T`, `offset`: `number`, `size`: `number`, `callback`: (`err`: `null` \| `Error`, `buf`: `T`) => `void`): `void` +> **randomFill**\<`T`\>(`buffer`: `T`, `offset`: `number`, `size`: `number`, `callback`: (`err`: `Error` \| `null`, `buf`: `T`) => `void`): `void` -This function is similar to [randomBytes](crypto.md#randombytes) but requires the first +This function is similar to [randomBytes](#randombytes) but requires the first argument to be a `Buffer` that will be filled. It also requires that a callback is passed in. @@ -622,7 +622,7 @@ randomFill(c, (err, buf) => { | `buffer` | `T` | Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`. | | `offset` | `number` | | | `size` | `number` | | -| `callback` | (`err`: `null` \| `Error`, `buf`: `T`) => `void` | `function(err, buf) {}`. | +| `callback` | (`err`: `Error` \| `null`, `buf`: `T`) => `void` | `function(err, buf) {}`. | ##### Returns @@ -632,9 +632,9 @@ randomFill(c, (err, buf) => { ### randomFillSync() -> **randomFillSync**\<`T`\>(`buffer`: `T`, `offset`?: `number`, `size`?: `number`): `T` +> **randomFillSync**\<`T`\>(`buffer`: `T`, `offset?`: `number`, `size?`: `number`): `T` -Synchronous version of [randomFill](crypto.md#randomfill). +Synchronous version of [randomFill](#randomfill). ```js import { Buffer } from 'buffer'; @@ -680,8 +680,8 @@ console.log(Buffer.from(randomFillSync(c)).toString('hex')); | Parameter | Type | Description | | ------ | ------ | ------ | | `buffer` | `T` | Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`. | -| `offset`? | `number` | | -| `size`? | `number` | | +| `offset?` | `number` | | +| `size?` | `number` | | #### Returns @@ -770,11 +770,11 @@ console.log(`The dice rolled: ${n}`); ### randomUUID() -> **randomUUID**(): [`UUID`](crypto.md#uuid) +> **randomUUID**(): `` `${string}-${string}-${string}-${string}-${string}` `` Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a cryptographic pseudorandom number generator. #### Returns -[`UUID`](crypto.md#uuid) +`` `${string}-${string}-${string}-${string}-${string}` `` diff --git a/src/reference/modules/llrt/dom-events.md b/src/reference/modules/llrt/dom-events.md index 3255178..33b0a88 100644 --- a/src/reference/modules/llrt/dom-events.md +++ b/src/reference/modules/llrt/dom-events.md @@ -4,7 +4,7 @@ ## Classes -### CustomEvent\ +### CustomEvent An event which takes place in the system. @@ -16,31 +16,31 @@ An event which takes place in the system. #### Implements -- [`Event`](dom-events.md#event) +- [`Event`](#event) #### Constructors -##### new CustomEvent() +##### Constructor -> **new CustomEvent**\<`D`\>(`type`: `string`, `opts`?: `object`): [`CustomEvent`](dom-events.md#customeventd)\<`D`\> +> **new CustomEvent**\<`D`\>(`type`: `string`, `opts?`: `object`): [`CustomEvent`](#customevent)\<`D`\> ###### Parameters | Parameter | Type | | ------ | ------ | | `type` | `string` | -| `opts`? | \{ `details`: `D`; \} | -| `opts.details`? | `D` | +| `opts?` | \{ `details?`: `D`; \} | +| `opts.details?` | `D` | ###### Returns -[`CustomEvent`](dom-events.md#customeventd)\<`D`\> +[`CustomEvent`](#customevent)\<`D`\> #### Properties ##### details -> `readonly` **details**: `null` \| `D` +> `readonly` **details**: `D` \| `null` ##### type @@ -50,7 +50,7 @@ Returns the type of event, e.g. "click", "hashchange", or "submit". ###### Implementation of -[`Event`](dom-events.md#event).[`type`](dom-events.md#type-1) +[`Event`](#event).[`type`](#type-1) *** @@ -65,19 +65,19 @@ receive events and may have listeners for them. #### Constructors -##### new EventTarget() +##### Constructor -> **new EventTarget**(): [`EventTarget`](dom-events.md#eventtarget) +> **new EventTarget**(): [`EventTarget`](#eventtarget) ###### Returns -[`EventTarget`](dom-events.md#eventtarget) +[`EventTarget`](#eventtarget) #### Methods ##### addEventListener() -> **addEventListener**(`type`: [`EventKey`](dom-events.md#eventkey), `listener`: [`EventListener`](dom-events.md#eventlistener), `options`?: [`AddEventListenerOptions`](dom-events.md#addeventlisteneroptions)): `void` +> **addEventListener**(`type`: [`EventKey`](#eventkey), `listener`: [`EventListener`](#eventlistener), `options?`: [`AddEventListenerOptions`](#addeventlisteneroptions)): `void` Adds a new handler for the `type` event. Any given `listener` is added only once per `type`. @@ -87,9 +87,9 @@ If the `once` option is true, the `listener` is removed after the next time a `t | Parameter | Type | | ------ | ------ | -| `type` | [`EventKey`](dom-events.md#eventkey) | -| `listener` | [`EventListener`](dom-events.md#eventlistener) | -| `options`? | [`AddEventListenerOptions`](dom-events.md#addeventlisteneroptions) | +| `type` | [`EventKey`](#eventkey) | +| `listener` | [`EventListener`](#eventlistener) | +| `options?` | [`AddEventListenerOptions`](#addeventlisteneroptions) | ###### Returns @@ -97,7 +97,7 @@ If the `once` option is true, the `listener` is removed after the next time a `t ##### dispatchEvent() -> **dispatchEvent**(`event`: [`Event`](dom-events.md#event)): `void` +> **dispatchEvent**(`event`: [`Event`](#event)): `void` Dispatches a synthetic event event to target @@ -105,7 +105,7 @@ Dispatches a synthetic event event to target | Parameter | Type | | ------ | ------ | -| `event` | [`Event`](dom-events.md#event) | +| `event` | [`Event`](#event) | ###### Returns @@ -113,7 +113,7 @@ Dispatches a synthetic event event to target ##### removeEventListener() -> **removeEventListener**(`type`: [`EventKey`](dom-events.md#eventkey), `listener`: [`EventListener`](dom-events.md#eventlistener)): `void` +> **removeEventListener**(`type`: [`EventKey`](#eventkey), `listener`: [`EventListener`](#eventlistener)): `void` Removes the event listener in target's event listener list with the same type and callback @@ -121,8 +121,8 @@ Removes the event listener in target's event listener list with the same type an | Parameter | Type | | ------ | ------ | -| `type` | [`EventKey`](dom-events.md#eventkey) | -| `listener` | [`EventListener`](dom-events.md#eventlistener) | +| `type` | [`EventKey`](#eventkey) | +| `listener` | [`EventListener`](#eventlistener) | ###### Returns @@ -150,7 +150,7 @@ An event which takes place in the system. ##### type -> `readonly` **type**: [`EventKey`](dom-events.md#eventkey) +> `readonly` **type**: [`EventKey`](#eventkey) Returns the type of event, e.g. "click", "hashchange", or "submit". @@ -158,13 +158,13 @@ Returns the type of event, e.g. "click", "hashchange", or "submit". ### EventListener() -> **EventListener**(`evt`: [`Event`](dom-events.md#event)): `void` +> **EventListener**(`evt`: [`Event`](#event)): `void` #### Parameters | Parameter | Type | | ------ | ------ | -| `evt` | [`Event`](dom-events.md#event) | +| `evt` | [`Event`](#event) | #### Returns @@ -174,4 +174,4 @@ Returns the type of event, e.g. "click", "hashchange", or "submit". ### EventKey -> **EventKey**: `string` \| `symbol` +> **EventKey** = `string` \| `symbol` diff --git a/src/reference/modules/llrt/fs/fs/promises.md b/src/reference/modules/llrt/fs/fs/promises.md index 9117871..81dab7c 100644 --- a/src/reference/modules/llrt/fs/fs/promises.md +++ b/src/reference/modules/llrt/fs/fs/promises.md @@ -8,13 +8,13 @@ #### Constructors -##### new FileHandle() +##### Constructor -> **new FileHandle**(): [`FileHandle`](promises.md#filehandle) +> **new FileHandle**(): [`FileHandle`](#filehandle) ###### Returns -[`FileHandle`](promises.md#filehandle) +[`FileHandle`](#filehandle) #### Properties @@ -106,7 +106,7 @@ Fulfills with `undefined` upon success. ###### Call Signature -> **read**\<`T`\>(`buffer`: `T`, `offset`?: `null` \| `number`, `length`?: `null` \| `number`, `position`?: `null` \| `number`): `Promise`\<[`FileReadResult`](promises.md#filereadresultt)\<`T`\>\> +> **read**\<`T`\>(`buffer`: `T`, `offset?`: `number` \| `null`, `length?`: `number` \| `null`, `position?`: `number` \| `null`): `Promise`\<[`FileReadResult`](#filereadresult)\<`T`\>\> Reads data from the file and stores that in the given buffer. @@ -124,19 +124,19 @@ number of bytes read is zero. | Parameter | Type | Description | | ------ | ------ | ------ | | `buffer` | `T` | A buffer that will be filled with the file data read. | -| `offset`? | `null` \| `number` | The location in the buffer at which to start filling. | -| `length`? | `null` \| `number` | The number of bytes to read. | -| `position`? | `null` \| `number` | The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an integer, the current file position will remain unchanged. | +| `offset?` | `number` \| `null` | The location in the buffer at which to start filling. | +| `length?` | `number` \| `null` | The number of bytes to read. | +| `position?` | `number` \| `null` | The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an integer, the current file position will remain unchanged. | ###### Returns -`Promise`\<[`FileReadResult`](promises.md#filereadresultt)\<`T`\>\> +`Promise`\<[`FileReadResult`](#filereadresult)\<`T`\>\> Fulfills upon success with an object with two properties: bytesRead and buffer ###### Call Signature -> **read**\<`T`\>(`buffer`: `T`, `options`?: [`FileReadOptions`](promises.md#filereadoptionst)\<`T`\>): `Promise`\<[`FileReadResult`](promises.md#filereadresultt)\<`T`\>\> +> **read**\<`T`\>(`buffer`: `T`, `options?`: [`FileReadOptions`](#filereadoptions)\<`T`\>): `Promise`\<[`FileReadResult`](#filereadresult)\<`T`\>\> Reads data from the file and stores that in the given buffer. @@ -154,17 +154,17 @@ number of bytes read is zero. | Parameter | Type | Description | | ------ | ------ | ------ | | `buffer` | `T` | A buffer that will be filled with the file data read. | -| `options`? | [`FileReadOptions`](promises.md#filereadoptionst)\<`T`\> | - | +| `options?` | [`FileReadOptions`](#filereadoptions)\<`T`\> | - | ###### Returns -`Promise`\<[`FileReadResult`](promises.md#filereadresultt)\<`T`\>\> +`Promise`\<[`FileReadResult`](#filereadresult)\<`T`\>\> Fulfills upon success with an object with two properties: bytesRead and buffer ###### Call Signature -> **read**\<`T`\>(`options`?: [`FileReadOptions`](promises.md#filereadoptionst)\<`T`\>): `Promise`\<[`FileReadResult`](promises.md#filereadresultt)\<`T`\>\> +> **read**\<`T`\>(`options?`: [`FileReadOptions`](#filereadoptions)\<`T`\>): `Promise`\<[`FileReadResult`](#filereadresult)\<`T`\>\> Reads data from the file and stores that in the given buffer. @@ -181,11 +181,11 @@ number of bytes read is zero. | Parameter | Type | | ------ | ------ | -| `options`? | [`FileReadOptions`](promises.md#filereadoptionst)\<`T`\> | +| `options?` | [`FileReadOptions`](#filereadoptions)\<`T`\> | ###### Returns -`Promise`\<[`FileReadResult`](promises.md#filereadresultt)\<`T`\>\> +`Promise`\<[`FileReadResult`](#filereadresult)\<`T`\>\> Fulfills upon success with an object with two properties: bytesRead and buffer @@ -193,7 +193,7 @@ Fulfills upon success with an object with two properties: bytesRead and buffer ###### Call Signature -> **readFile**(`options`?: `null` \| \{ `encoding`: `null`; \}): `Promise`\<[`Buffer`](../../buffer.md#buffer)\> +> **readFile**(`options?`: \{ `encoding?`: `null`; \} \| `null`): `Promise`\<[`Buffer`](../../buffer.md#buffer)\> Asynchronously reads the entire contents of a file. @@ -209,7 +209,7 @@ of the file. | Parameter | Type | | ------ | ------ | -| `options`? | `null` \| \{ `encoding`: `null`; \} | +| `options?` | \{ `encoding?`: `null`; \} \| `null` | ###### Returns @@ -273,7 +273,7 @@ Fulfills with `undefined` upon success. ##### truncate() -> **truncate**(`len`?: `number`): `Promise`\<`void`\> +> **truncate**(`len?`: `number`): `Promise`\<`void`\> Truncates the file. @@ -301,7 +301,7 @@ extended part is filled with null bytes (`'\0'`): | Parameter | Type | Description | | ------ | ------ | ------ | -| `len`? | `number` | | +| `len?` | `number` | | ###### Returns @@ -313,7 +313,7 @@ Fulfills with `undefined` upon success. ###### Call Signature -> **write**\<`TBuffer`\>(`buffer`: `TBuffer`, `offset`?: `null` \| `number`, `length`?: `null` \| `number`, `position`?: `null` \| `number`): `Promise`\<\{ `buffer`: `TBuffer`; `bytesWritten`: `number`; \}\> +> **write**\<`TBuffer`\>(`buffer`: `TBuffer`, `offset?`: `number` \| `null`, `length?`: `number` \| `null`, `position?`: `number` \| `null`): `Promise`\<\{ `buffer`: `TBuffer`; `bytesWritten`: `number`; \}\> Write `buffer` to the file. @@ -338,9 +338,9 @@ the end of the file. | Parameter | Type | Description | | ------ | ------ | ------ | | `buffer` | `TBuffer` | - | -| `offset`? | `null` \| `number` | The start position from within `buffer` where the data to write begins. | -| `length`? | `null` \| `number` | The number of bytes from `buffer` to write. | -| `position`? | `null` \| `number` | The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current position. See the POSIX pwrite(2) documentation for more detail. | +| `offset?` | `number` \| `null` | The start position from within `buffer` where the data to write begins. | +| `length?` | `number` \| `null` | The number of bytes from `buffer` to write. | +| `position?` | `number` \| `null` | The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current position. See the POSIX pwrite(2) documentation for more detail. | ###### Returns @@ -348,7 +348,7 @@ the end of the file. ###### Call Signature -> **write**\<`TBuffer`\>(`buffer`: `TBuffer`, `options`?: `null` \| \{ `length`: `null` \| `number`; `offset`: `null` \| `number`; `position`: `null` \| `number`; \}): `Promise`\<\{ `buffer`: `TBuffer`; `bytesWritten`: `number`; \}\> +> **write**\<`TBuffer`\>(`buffer`: `TBuffer`, `options?`: \{ `length?`: `number` \| `null`; `offset?`: `number` \| `null`; `position?`: `number` \| `null`; \} \| `null`): `Promise`\<\{ `buffer`: `TBuffer`; `bytesWritten`: `number`; \}\> Write `buffer` to the file. @@ -373,7 +373,7 @@ the end of the file. | Parameter | Type | | ------ | ------ | | `buffer` | `TBuffer` | -| `options`? | `null` \| \{ `length`: `null` \| `number`; `offset`: `null` \| `number`; `position`: `null` \| `number`; \} | +| `options?` | \{ `length?`: `number` \| `null`; `offset?`: `number` \| `null`; `position?`: `number` \| `null`; \} \| `null` | ###### Returns @@ -381,7 +381,7 @@ the end of the file. ###### Call Signature -> **write**(`data`: `string`, `position`?: `null` \| `number`, `encoding`?: `null` \| [`BufferEncoding`](../../buffer.md#bufferencoding)): `Promise`\<\{ `buffer`: `string`; `bytesWritten`: `number`; \}\> +> **write**(`data`: `string`, `position?`: `number` \| `null`, `encoding?`: [`BufferEncoding`](../../buffer.md#bufferencoding) \| `null`): `Promise`\<\{ `buffer`: `string`; `bytesWritten`: `number`; \}\> Write `buffer` to the file. @@ -400,8 +400,8 @@ the end of the file. | Parameter | Type | Description | | ------ | ------ | ------ | | `data` | `string` | - | -| `position`? | `null` \| `number` | The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current position. See the POSIX pwrite(2) documentation for more detail. | -| `encoding`? | `null` \| [`BufferEncoding`](../../buffer.md#bufferencoding) | - | +| `position?` | `number` \| `null` | The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current position. See the POSIX pwrite(2) documentation for more detail. | +| `encoding?` | [`BufferEncoding`](../../buffer.md#bufferencoding) \| `null` | - | ###### Returns @@ -409,7 +409,7 @@ the end of the file. ##### writeFile() -> **writeFile**(`data`: `string` \| [`ArrayBufferView`](../../globals/namespaces/QuickJS.md#arraybufferview), `options`?: `null` \| [`BufferEncoding`](../../buffer.md#bufferencoding) \| \{ `encoding`: BufferEncoding \| null \| undefined; \}): `Promise`\<`void`\> +> **writeFile**(`data`: `string` \| [`ArrayBufferView`](../../globals/namespaces/QuickJS.md#arraybufferview), `options?`: [`BufferEncoding`](../../buffer.md#bufferencoding) \| \{ `encoding?`: BufferEncoding \| null \| undefined; \} \| `null`): `Promise`\<`void`\> Asynchronously writes data to a file, replacing the file if it already exists. @@ -428,7 +428,7 @@ current position till the end of the file. It doesn't always write from the begi | Parameter | Type | | ------ | ------ | | `data` | `string` \| [`ArrayBufferView`](../../globals/namespaces/QuickJS.md#arraybufferview) | -| `options`? | `null` \| [`BufferEncoding`](../../buffer.md#bufferencoding) \| \{ `encoding`: BufferEncoding \| null \| undefined; \} | +| `options?` | [`BufferEncoding`](../../buffer.md#bufferencoding) \| \{ `encoding?`: BufferEncoding \| null \| undefined; \} \| `null` | ###### Returns @@ -436,7 +436,7 @@ current position till the end of the file. It doesn't always write from the begi ## Interfaces -### FileReadOptions\ +### FileReadOptions #### Type Parameters @@ -456,7 +456,7 @@ current position till the end of the file. It doesn't always write from the begi ##### length? -> `optional` **length**: `null` \| `number` +> `optional` **length**: `number` \| `null` ###### Default @@ -464,7 +464,7 @@ current position till the end of the file. It doesn't always write from the begi ##### offset? -> `optional` **offset**: `null` \| `number` +> `optional` **offset**: `number` \| `null` ###### Default @@ -474,11 +474,11 @@ current position till the end of the file. It doesn't always write from the begi ##### position? -> `optional` **position**: `null` \| `number` +> `optional` **position**: `number` \| `null` *** -### FileReadResult\ +### FileReadResult #### Type Parameters @@ -500,7 +500,7 @@ current position till the end of the file. It doesn't always write from the begi ### FileSystemFlags -> **FileSystemFlags**: `"a"` \| `"ax"` \| `"a+"` \| `"r"` \| `"r+"` \| `"w"` \| `"wx"` \| `"w+"` \| `"wx+"` +> **FileSystemFlags** = `"a"` \| `"ax"` \| `"a+"` \| `"r"` \| `"r+"` \| `"w"` \| `"wx"` \| `"w+"` \| `"wx+"` ## Variables @@ -512,7 +512,7 @@ current position till the end of the file. It doesn't always write from the begi ### access() -> **access**(`path`: `string`, `mode`?: `number`): `Promise`\<`void`\> +> **access**(`path`: `string`, `mode?`: `number`): `Promise`\<`void`\> Tests a user's permissions for the file or directory specified by `path`. The `mode` argument is an optional integer that specifies the accessibility @@ -547,7 +547,7 @@ the error raised if the file is not accessible. | Parameter | Type | Description | | ------ | ------ | ------ | | `path` | `string` | - | -| `mode`? | `number` | | +| `mode?` | `number` | | #### Returns @@ -580,7 +580,7 @@ Fulfills with `undefined` upon success. ### mkdir() -> **mkdir**(`path`: `string`, `options`?: [`MakeDirectoryOptions`](../index.md#makedirectoryoptions)): `Promise`\<`string`\> +> **mkdir**(`path`: `string`, `options?`: [`MakeDirectoryOptions`](../index.md#makedirectoryoptions)): `Promise`\<`string`\> Asynchronously creates a directory. @@ -605,7 +605,7 @@ try { | Parameter | Type | | ------ | ------ | | `path` | `string` | -| `options`? | [`MakeDirectoryOptions`](../index.md#makedirectoryoptions) | +| `options?` | [`MakeDirectoryOptions`](../index.md#makedirectoryoptions) | #### Returns @@ -658,7 +658,7 @@ Fulfills with a string containing the file system path of the newly created temp ### open() -> **open**(`path`: `string`, `flags`?: [`FileSystemFlags`](promises.md#filesystemflags), `mode`?: `number`): `Promise`\<[`FileHandle`](promises.md#filehandle)\> +> **open**(`path`: `string`, `flags?`: [`FileSystemFlags`](#filesystemflags), `mode?`: `number`): `Promise`\<[`FileHandle`](#filehandle)\> Opens a `FileHandle`. @@ -672,12 +672,12 @@ by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/window | Parameter | Type | Description | | ------ | ------ | ------ | | `path` | `string` | - | -| `flags`? | [`FileSystemFlags`](promises.md#filesystemflags) | See {FileSystemFlags}. | -| `mode`? | `number` | Sets the file mode if the file is created (UNIX). | +| `flags?` | [`FileSystemFlags`](#filesystemflags) | See {FileSystemFlags}. | +| `mode?` | `number` | Sets the file mode if the file is created (UNIX). | #### Returns -`Promise`\<[`FileHandle`](promises.md#filehandle)\> +`Promise`\<[`FileHandle`](#filehandle)\> Fulfills with a {FileHandle} object. @@ -687,7 +687,7 @@ Fulfills with a {FileHandle} object. #### Call Signature -> **readdir**(`path`: `string`, `options`?: `object`): `Promise`\<`string`[]\> +> **readdir**(`path`: `string`, `options?`: `object`): `Promise`\<`string`[]\> Reads the contents of a directory. @@ -710,9 +710,9 @@ try { | Parameter | Type | | ------ | ------ | | `path` | `string` | -| `options`? | \{ `recursive`: `boolean`; `withFileTypes`: `false`; \} | -| `options.recursive`? | `boolean` | -| `options.withFileTypes`? | `false` | +| `options?` | \{ `recursive?`: `boolean`; `withFileTypes?`: `false`; \} | +| `options.recursive?` | `boolean` | +| `options.withFileTypes?` | `false` | ##### Returns @@ -731,8 +731,8 @@ Asynchronous readdir(2) - read a directory. | Parameter | Type | Description | | ------ | ------ | ------ | | `path` | `string` | A path to a file. If a URL is provided, it must use the `file:` protocol. | -| `options` | \{ `recursive`: `boolean`; `withFileTypes`: `true`; \} | If called with `withFileTypes: true` the result data will be an array of Dirent. | -| `options.recursive`? | `boolean` | - | +| `options` | \{ `recursive?`: `boolean`; `withFileTypes`: `true`; \} | If called with `withFileTypes: true` the result data will be an array of Dirent. | +| `options.recursive?` | `boolean` | - | | `options.withFileTypes` | `true` | - | ##### Returns @@ -745,7 +745,7 @@ Asynchronous readdir(2) - read a directory. #### Call Signature -> **readFile**(`path`: `string`, `options`?: `null` \| \{ `encoding`: `null`; \}): `Promise`\<[`Buffer`](../../buffer.md#buffer)\> +> **readFile**(`path`: `string`, `options?`: \{ `encoding?`: `null`; \} \| `null`): `Promise`\<[`Buffer`](../../buffer.md#buffer)\> Asynchronously reads the entire contents of a file. @@ -777,7 +777,7 @@ try { | Parameter | Type | Description | | ------ | ------ | ------ | | `path` | `string` | filename or `FileHandle` | -| `options`? | `null` \| \{ `encoding`: `null`; \} | - | +| `options?` | \{ `encoding?`: `null`; \} \| `null` | - | ##### Returns @@ -838,7 +838,7 @@ Fulfills with `undefined` upon success. ### rm() -> **rm**(`path`: `string`, `options`?: [`RmOptions`](../index.md#rmoptions)): `Promise`\<`void`\> +> **rm**(`path`: `string`, `options?`: [`RmOptions`](../index.md#rmoptions)): `Promise`\<`void`\> Removes files and directories (modeled on the standard POSIX `rm` utility). @@ -847,7 +847,7 @@ Removes files and directories (modeled on the standard POSIX `rm` utility). | Parameter | Type | | ------ | ------ | | `path` | `string` | -| `options`? | [`RmOptions`](../index.md#rmoptions) | +| `options?` | [`RmOptions`](../index.md#rmoptions) | #### Returns @@ -859,7 +859,7 @@ Fulfills with `undefined` upon success. ### rmdir() -> **rmdir**(`path`: `string`, `options`?: [`RmDirOptions`](../index.md#rmdiroptions)): `Promise`\<`void`\> +> **rmdir**(`path`: `string`, `options?`: [`RmDirOptions`](../index.md#rmdiroptions)): `Promise`\<`void`\> Removes the directory identified by `path`. @@ -873,7 +873,7 @@ To get a behavior similar to the `rm -rf` Unix command, use `fsPromises.rm()` wi | Parameter | Type | | ------ | ------ | | `path` | `string` | -| `options`? | [`RmDirOptions`](../index.md#rmdiroptions) | +| `options?` | [`RmDirOptions`](../index.md#rmdiroptions) | #### Returns diff --git a/src/reference/modules/llrt/fs/index.md b/src/reference/modules/llrt/fs/index.md index 30af947..eb95bc4 100644 --- a/src/reference/modules/llrt/fs/index.md +++ b/src/reference/modules/llrt/fs/index.md @@ -21,18 +21,18 @@ A representation of a directory entry, which can be a file or a subdirectory within the directory. A directory entry is a combination of the file name and file type pairs. -Additionally, when [promises.readdir](fs/promises.md#readdir) or [readdirSync](index.md#readdirsync) is called with +Additionally, when [promises.readdir](fs/promises.md#readdir) or [readdirSync](#readdirsync) is called with the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings. #### Constructors -##### new Dirent() +##### Constructor -> **new Dirent**(): [`Dirent`](index.md#dirent) +> **new Dirent**(): [`Dirent`](#dirent) ###### Returns -[`Dirent`](index.md#dirent) +[`Dirent`](#dirent) #### Properties @@ -154,17 +154,17 @@ Stats { #### Extends -- [`StatsBase`](index.md#statsbaset)\<`number`\> +- [`StatsBase`](#statsbase)\<`number`\> #### Constructors -##### new Stats() +##### Constructor -> **new Stats**(): [`Stats`](index.md#stats) +> **new Stats**(): [`Stats`](#stats) ###### Returns -[`Stats`](index.md#stats) +[`Stats`](#stats) ###### Inherited from @@ -178,7 +178,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`atime`](index.md#atime-1) +[`StatsBase`](#statsbase).[`atime`](#atime-1) ##### atimeMs @@ -186,7 +186,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`atimeMs`](index.md#atimems-1) +[`StatsBase`](#statsbase).[`atimeMs`](#atimems-1) ##### birthtime @@ -194,7 +194,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`birthtime`](index.md#birthtime-1) +[`StatsBase`](#statsbase).[`birthtime`](#birthtime-1) ##### birthtimeMs @@ -202,7 +202,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`birthtimeMs`](index.md#birthtimems-1) +[`StatsBase`](#statsbase).[`birthtimeMs`](#birthtimems-1) ##### blksize @@ -210,7 +210,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`blksize`](index.md#blksize-1) +[`StatsBase`](#statsbase).[`blksize`](#blksize-1) ##### blocks @@ -218,7 +218,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`blocks`](index.md#blocks-1) +[`StatsBase`](#statsbase).[`blocks`](#blocks-1) ##### ctime @@ -226,7 +226,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`ctime`](index.md#ctime-1) +[`StatsBase`](#statsbase).[`ctime`](#ctime-1) ##### ctimeMs @@ -234,7 +234,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`ctimeMs`](index.md#ctimems-1) +[`StatsBase`](#statsbase).[`ctimeMs`](#ctimems-1) ##### dev @@ -242,7 +242,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`dev`](index.md#dev-1) +[`StatsBase`](#statsbase).[`dev`](#dev-1) ##### gid @@ -250,7 +250,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`gid`](index.md#gid-1) +[`StatsBase`](#statsbase).[`gid`](#gid-1) ##### ino @@ -258,7 +258,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`ino`](index.md#ino-1) +[`StatsBase`](#statsbase).[`ino`](#ino-1) ##### mode @@ -266,7 +266,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`mode`](index.md#mode-2) +[`StatsBase`](#statsbase).[`mode`](#mode-2) ##### mtime @@ -274,7 +274,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`mtime`](index.md#mtime-1) +[`StatsBase`](#statsbase).[`mtime`](#mtime-1) ##### mtimeMs @@ -282,7 +282,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`mtimeMs`](index.md#mtimems-1) +[`StatsBase`](#statsbase).[`mtimeMs`](#mtimems-1) ##### nlink @@ -290,7 +290,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`nlink`](index.md#nlink-1) +[`StatsBase`](#statsbase).[`nlink`](#nlink-1) ##### rdev @@ -298,7 +298,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`rdev`](index.md#rdev-1) +[`StatsBase`](#statsbase).[`rdev`](#rdev-1) ##### size @@ -306,7 +306,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`size`](index.md#size-1) +[`StatsBase`](#statsbase).[`size`](#size-1) ##### uid @@ -314,7 +314,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`uid`](index.md#uid-1) +[`StatsBase`](#statsbase).[`uid`](#uid-1) #### Methods @@ -328,7 +328,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`isBlockDevice`](index.md#isblockdevice-2) +[`StatsBase`](#statsbase).[`isBlockDevice`](#isblockdevice-4) ##### isCharacterDevice() @@ -340,7 +340,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`isCharacterDevice`](index.md#ischaracterdevice-2) +[`StatsBase`](#statsbase).[`isCharacterDevice`](#ischaracterdevice-4) ##### isDirectory() @@ -352,7 +352,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`isDirectory`](index.md#isdirectory-2) +[`StatsBase`](#statsbase).[`isDirectory`](#isdirectory-4) ##### isFIFO() @@ -364,7 +364,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`isFIFO`](index.md#isfifo-2) +[`StatsBase`](#statsbase).[`isFIFO`](#isfifo-4) ##### isFile() @@ -376,7 +376,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`isFile`](index.md#isfile-2) +[`StatsBase`](#statsbase).[`isFile`](#isfile-4) ##### isSocket() @@ -388,7 +388,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`isSocket`](index.md#issocket-2) +[`StatsBase`](#statsbase).[`isSocket`](#issocket-4) ##### isSymbolicLink() @@ -400,7 +400,7 @@ Stats { ###### Inherited from -[`StatsBase`](index.md#statsbaset).[`isSymbolicLink`](index.md#issymboliclink-2) +[`StatsBase`](#statsbase).[`isSymbolicLink`](#issymboliclink-4) ## Interfaces @@ -489,11 +489,11 @@ false *** -### StatsBase\ +### StatsBase #### Extended by -- [`Stats`](index.md#stats) +- [`Stats`](#stats) #### Type Parameters @@ -641,7 +641,7 @@ false - `Function` -> **StatSyncFn**(`path`: `string`): [`Stats`](index.md#stats) +> **StatSyncFn**(`path`: `string`): [`Stats`](#stats) #### Parameters @@ -651,27 +651,39 @@ false #### Returns -[`Stats`](index.md#stats) +[`Stats`](#stats) ## Type Aliases ### Mode -> **Mode**: `number` +> **Mode** = `number` *** ### PathLike -> **PathLike**: `string` +> **PathLike** = `string` Valid types for path values in "fs". +## Variables + +### statSync + +> `const` **statSync**: [`StatSyncFn`](#statsyncfn) + +Synchronous stat - Get file status. + +#### Param + +A path to a file. + ## Functions ### accessSync() -> **accessSync**(`path`: `string`, `mode`?: `number`): `void` +> **accessSync**(`path`: `string`, `mode?`: `number`): `void` Synchronously tests a user's permissions for the file or directory specified by `path`. The `mode` argument is an optional integer that specifies the @@ -698,7 +710,7 @@ try { | Parameter | Type | Description | | ------ | ------ | ------ | | `path` | `string` | - | -| `mode`? | `number` | | +| `mode?` | `number` | | #### Returns @@ -730,7 +742,7 @@ See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) do ### mkdirSync() -> **mkdirSync**(`path`: `string`, `options`?: [`MakeDirectoryOptions`](index.md#makedirectoryoptions)): `string` +> **mkdirSync**(`path`: `string`, `options?`: [`MakeDirectoryOptions`](#makedirectoryoptions)): `string` Synchronously creates a directory. Returns the `path`. @@ -741,7 +753,7 @@ See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) do | Parameter | Type | | ------ | ------ | | `path` | `string` | -| `options`? | [`MakeDirectoryOptions`](index.md#makedirectoryoptions) | +| `options?` | [`MakeDirectoryOptions`](#makedirectoryoptions) | #### Returns @@ -774,7 +786,7 @@ this API: [promises.mkdtemp](fs/promises.md#mkdtemp). #### Call Signature -> **readdirSync**(`path`: `string`, `options`?: `object`): `string`[] +> **readdirSync**(`path`: `string`, `options?`: `object`): `string`[] Reads the contents of the directory. @@ -787,9 +799,9 @@ If `options.withFileTypes` is set to `true`, the result will contain `fs.Dirent` | Parameter | Type | | ------ | ------ | | `path` | `string` | -| `options`? | \{ `recursive`: `boolean`; `withFileTypes`: `false`; \} | -| `options.recursive`? | `boolean` | -| `options.withFileTypes`? | `false` | +| `options?` | \{ `recursive?`: `boolean`; `withFileTypes?`: `false`; \} | +| `options.recursive?` | `boolean` | +| `options.withFileTypes?` | `false` | ##### Returns @@ -797,7 +809,7 @@ If `options.withFileTypes` is set to `true`, the result will contain `fs.Dirent` #### Call Signature -> **readdirSync**(`path`: `string`, `options`: `object`): [`Dirent`](index.md#dirent)[] +> **readdirSync**(`path`: `string`, `options`: `object`): [`Dirent`](#dirent)[] Synchronous readdir (2) - read a directory. @@ -806,13 +818,13 @@ Synchronous readdir (2) - read a directory. | Parameter | Type | Description | | ------ | ------ | ------ | | `path` | `string` | A path to a file. If a URL is provided, it must use the `file:` protocol. | -| `options` | \{ `recursive`: `boolean`; `withFileTypes`: `true`; \} | If called with `withFileTypes: true` the result data will be an array of Dirent. | -| `options.recursive`? | `boolean` | - | +| `options` | \{ `recursive?`: `boolean`; `withFileTypes`: `true`; \} | If called with `withFileTypes: true` the result data will be an array of Dirent. | +| `options.recursive?` | `boolean` | - | | `options.withFileTypes` | `true` | - | ##### Returns -[`Dirent`](index.md#dirent)[] +[`Dirent`](#dirent)[] *** @@ -820,12 +832,12 @@ Synchronous readdir (2) - read a directory. #### Call Signature -> **readFileSync**(`path`: `string`, `options`?: `null` \| \{ `encoding`: `null`; \}): [`Buffer`](../buffer.md#buffer) +> **readFileSync**(`path`: `string`, `options?`: \{ `encoding?`: `null`; \} \| `null`): [`Buffer`](../buffer.md#buffer) Returns the contents of the `path`. For detailed information, see the documentation of the asynchronous version of -this API: [promises.readFile](fs/promises.md#readfile-1). +this API: [promises.readFile](fs/promises.md#readfile-3). If the `encoding` option is specified then this function returns a string. Otherwise it returns a buffer. @@ -835,7 +847,7 @@ string. Otherwise it returns a buffer. | Parameter | Type | Description | | ------ | ------ | ------ | | `path` | `string` | A path to a file. | -| `options`? | `null` \| \{ `encoding`: `null`; \} | - | +| `options?` | \{ `encoding?`: `null`; \} \| `null` | - | ##### Returns @@ -884,21 +896,21 @@ this API: [promises.rename](fs/promises.md#rename). ### rmdirSync() -> **rmdirSync**(`path`: `string`, `options`?: [`RmDirOptions`](index.md#rmdiroptions)): `void` +> **rmdirSync**(`path`: `string`, `options?`: [`RmDirOptions`](#rmdiroptions)): `void` Synchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). Returns `undefined`. Using `fs.rmdirSync()` on a file (not a directory) results in an `ENOENT` error on Windows and an `ENOTDIR` error on POSIX. -To get a behavior similar to the `rm -rf` Unix command, use [rmSync](index.md#rmsync) with options `{ recursive: true, force: true }`. +To get a behavior similar to the `rm -rf` Unix command, use [rmSync](#rmsync) with options `{ recursive: true, force: true }`. #### Parameters | Parameter | Type | | ------ | ------ | | `path` | `string` | -| `options`? | [`RmDirOptions`](index.md#rmdiroptions) | +| `options?` | [`RmDirOptions`](#rmdiroptions) | #### Returns @@ -908,7 +920,7 @@ To get a behavior similar to the `rm -rf` Unix command, use [rmSync](index.md#rm ### rmSync() -> **rmSync**(`path`: `string`, `options`?: [`RmOptions`](index.md#rmoptions)): `void` +> **rmSync**(`path`: `string`, `options?`: [`RmOptions`](#rmoptions)): `void` Synchronously removes files and directories (modeled on the standard POSIX `rm` utility). Returns `undefined`. @@ -917,7 +929,7 @@ Synchronously removes files and directories (modeled on the standard POSIX `rm` | Parameter | Type | | ------ | ------ | | `path` | `string` | -| `options`? | [`RmOptions`](index.md#rmoptions) | +| `options?` | [`RmOptions`](#rmoptions) | #### Returns @@ -925,24 +937,6 @@ Synchronously removes files and directories (modeled on the standard POSIX `rm` *** -### statSync() - -> **statSync**(`path`: `string`): [`Stats`](index.md#stats) - -Synchronous stat - Get file status. - -#### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `path` | `string` | A path to a file. | - -#### Returns - -[`Stats`](index.md#stats) - -*** - ### writeFileSync() > **writeFileSync**(`file`: `string`, `data`: `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](../globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](../buffer.md#buffer)): `void` @@ -950,7 +944,7 @@ Synchronous stat - Get file status. Returns `undefined`. For detailed information, see the documentation of the asynchronous version of -this API: [promises.writeFile](fs/promises.md#writefile-1). +this API: [promises.writeFile](fs/promises.md#writefile-2). #### Parameters diff --git a/src/reference/modules/llrt/globals/index.md b/src/reference/modules/llrt/globals/index.md index 29ddc35..04f7b2e 100644 --- a/src/reference/modules/llrt/globals/index.md +++ b/src/reference/modules/llrt/globals/index.md @@ -10,14 +10,14 @@ ## Classes -### EventEmitter\ +### EventEmitter #### Extended by - [`ChildProcess`](../child_process.md#childprocess) - [`Server`](../net.md#server) -- [`ReadableStreamInner`](../stream.md#readablestreaminner) -- [`WritableStreamInner`](../stream.md#writablestreaminner) +- [`ReadableStreamInner`](../stream/stream.md#readablestreaminner) +- [`WritableStreamInner`](../stream/stream.md#writablestreaminner) - [`ReadableStream`](namespaces/QuickJS.md#readablestream) - [`WritableStream`](namespaces/QuickJS.md#writablestream) @@ -25,23 +25,23 @@ | Type Parameter | Default type | | ------ | ------ | -| `T` *extends* [`EventMap`](index.md#eventmapt)\<`T`\> | [`DefaultEventMap`](index.md#defaulteventmap) | +| `T` *extends* [`EventMap`](#eventmap)\<`T`\> | [`DefaultEventMap`](#defaulteventmap) | #### Constructors -##### new EventEmitter() +##### Constructor -> **new EventEmitter**\<`T`\>(): [`EventEmitter`](index.md#eventemittert)\<`T`\> +> **new EventEmitter**\<`T`\>(): [`EventEmitter`](#eventemitter)\<`T`\> ###### Returns -[`EventEmitter`](index.md#eventemittert)\<`T`\> +[`EventEmitter`](#eventemitter)\<`T`\> #### Methods ##### addListener() -> **addListener**\<`K`\>(`eventName`: [`Key`](index.md#keyk-t)\<`K`, `T`\>, `listener`: [`Listener`](index.md#listenerk-t-f)\<`K`, `T`, (...`args`: `any`[]) => `void`\>): `this` +> **addListener**\<`K`\>(`eventName`: [`Key`](#key)\<`K`, `T`\>, `listener`: [`Listener`](#listener)\<`K`, `T`\>): `this` Alias for `emitter.on(eventName, listener)`. @@ -55,8 +55,8 @@ Alias for `emitter.on(eventName, listener)`. | Parameter | Type | | ------ | ------ | -| `eventName` | [`Key`](index.md#keyk-t)\<`K`, `T`\> | -| `listener` | [`Listener`](index.md#listenerk-t-f)\<`K`, `T`, (...`args`: `any`[]) => `void`\> | +| `eventName` | [`Key`](#key)\<`K`, `T`\> | +| `listener` | [`Listener`](#listener)\<`K`, `T`\> | ###### Returns @@ -64,7 +64,7 @@ Alias for `emitter.on(eventName, listener)`. ##### emit() -> **emit**\<`K`\>(`eventName`: [`Key`](index.md#keyk-t)\<`K`, `T`\>, ...`args`: [`Args`](index.md#argsk-t)\<`K`, `T`\>): `void` +> **emit**\<`K`\>(`eventName`: [`Key`](#key)\<`K`, `T`\>, ...`args`: [`Args`](#args)\<`K`, `T`\>): `void` Synchronously calls each of the listeners registered for the event named `eventName`, in the order they were registered, passing the supplied arguments to each. @@ -105,8 +105,8 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); | Parameter | Type | | ------ | ------ | -| `eventName` | [`Key`](index.md#keyk-t)\<`K`, `T`\> | -| ...`args` | [`Args`](index.md#argsk-t)\<`K`, `T`\> | +| `eventName` | [`Key`](#key)\<`K`, `T`\> | +| ...`args` | [`Args`](#args)\<`K`, `T`\> | ###### Returns @@ -114,7 +114,7 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ##### eventNames() -> **eventNames**(): [`EventKey`](../dom-events.md#eventkey) & [`Key2`](index.md#key2k-t)\<`unknown`, `T`\>[] +> **eventNames**(): [`EventKey`](../dom-events.md#eventkey) & [`Key2`](#key2)\<`unknown`, `T`\>[] Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or `Symbol`s. @@ -135,11 +135,11 @@ console.log(myEE.eventNames()); ###### Returns -[`EventKey`](../dom-events.md#eventkey) & [`Key2`](index.md#key2k-t)\<`unknown`, `T`\>[] +[`EventKey`](../dom-events.md#eventkey) & [`Key2`](#key2)\<`unknown`, `T`\>[] ##### off() -> **off**\<`K`\>(`eventName`: [`Key`](index.md#keyk-t)\<`K`, `T`\>, `listener`: [`Listener`](index.md#listenerk-t-f)\<`K`, `T`, (...`args`: `any`[]) => `void`\>): `this` +> **off**\<`K`\>(`eventName`: [`Key`](#key)\<`K`, `T`\>, `listener`: [`Listener`](#listener)\<`K`, `T`\>): `this` Alias for `emitter.removeListener()`. @@ -153,8 +153,8 @@ Alias for `emitter.removeListener()`. | Parameter | Type | | ------ | ------ | -| `eventName` | [`Key`](index.md#keyk-t)\<`K`, `T`\> | -| `listener` | [`Listener`](index.md#listenerk-t-f)\<`K`, `T`, (...`args`: `any`[]) => `void`\> | +| `eventName` | [`Key`](#key)\<`K`, `T`\> | +| `listener` | [`Listener`](#listener)\<`K`, `T`\> | ###### Returns @@ -162,7 +162,7 @@ Alias for `emitter.removeListener()`. ##### on() -> **on**\<`K`\>(`eventName`: [`Key`](index.md#keyk-t)\<`K`, `T`\>, `listener`: [`Listener`](index.md#listenerk-t-f)\<`K`, `T`, (...`args`: `any`[]) => `void`\>): `this` +> **on**\<`K`\>(`eventName`: [`Key`](#key)\<`K`, `T`\>, `listener`: [`Listener`](#listener)\<`K`, `T`\>): `this` Adds the `listener` function to the end of the listeners array for the event named `eventName`. No checks are made to see if the `listener` has already @@ -201,8 +201,8 @@ myEE.emit('foo'); | Parameter | Type | Description | | ------ | ------ | ------ | -| `eventName` | [`Key`](index.md#keyk-t)\<`K`, `T`\> | The name of the event. | -| `listener` | [`Listener`](index.md#listenerk-t-f)\<`K`, `T`, (...`args`: `any`[]) => `void`\> | The callback function | +| `eventName` | [`Key`](#key)\<`K`, `T`\> | The name of the event. | +| `listener` | [`Listener`](#listener)\<`K`, `T`\> | The callback function | ###### Returns @@ -210,7 +210,7 @@ myEE.emit('foo'); ##### once() -> **once**\<`K`\>(`eventName`: [`Key`](index.md#keyk-t)\<`K`, `T`\>, `listener`: [`Listener`](index.md#listenerk-t-f)\<`K`, `T`, (...`args`: `any`[]) => `void`\>): `this` +> **once**\<`K`\>(`eventName`: [`Key`](#key)\<`K`, `T`\>, `listener`: [`Listener`](#listener)\<`K`, `T`\>): `this` Adds a **one-time** `listener` function for the event named `eventName`. The next time `eventName` is triggered, this listener is removed and then invoked. @@ -241,8 +241,8 @@ myEE.emit('foo'); | Parameter | Type | Description | | ------ | ------ | ------ | -| `eventName` | [`Key`](index.md#keyk-t)\<`K`, `T`\> | The name of the event. | -| `listener` | [`Listener`](index.md#listenerk-t-f)\<`K`, `T`, (...`args`: `any`[]) => `void`\> | The callback function | +| `eventName` | [`Key`](#key)\<`K`, `T`\> | The name of the event. | +| `listener` | [`Listener`](#listener)\<`K`, `T`\> | The callback function | ###### Returns @@ -254,7 +254,7 @@ v0.3.0 ##### prependListener() -> **prependListener**\<`K`\>(`eventName`: [`Key`](index.md#keyk-t)\<`K`, `T`\>, `listener`: [`Listener`](index.md#listenerk-t-f)\<`K`, `T`, (...`args`: `any`[]) => `void`\>): `this` +> **prependListener**\<`K`\>(`eventName`: [`Key`](#key)\<`K`, `T`\>, `listener`: [`Listener`](#listener)\<`K`, `T`\>): `this` Adds the `listener` function to the _beginning_ of the listeners array for the event named `eventName`. No checks are made to see if the `listener` has @@ -273,8 +273,8 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. | Parameter | Type | Description | | ------ | ------ | ------ | -| `eventName` | [`Key`](index.md#keyk-t)\<`K`, `T`\> | The name of the event. | -| `listener` | [`Listener`](index.md#listenerk-t-f)\<`K`, `T`, (...`args`: `any`[]) => `void`\> | The callback function | +| `eventName` | [`Key`](#key)\<`K`, `T`\> | The name of the event. | +| `listener` | [`Listener`](#listener)\<`K`, `T`\> | The callback function | ###### Returns @@ -282,7 +282,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ##### prependOnceListener() -> **prependOnceListener**\<`K`\>(`eventName`: [`Key`](index.md#keyk-t)\<`K`, `T`\>, `listener`: [`Listener`](index.md#listenerk-t-f)\<`K`, `T`, (...`args`: `any`[]) => `void`\>): `this` +> **prependOnceListener**\<`K`\>(`eventName`: [`Key`](#key)\<`K`, `T`\>, `listener`: [`Listener`](#listener)\<`K`, `T`\>): `this` Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. The next time `eventName` is triggered, this listener is removed, and then invoked. @@ -299,8 +299,8 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. | Parameter | Type | Description | | ------ | ------ | ------ | -| `eventName` | [`Key`](index.md#keyk-t)\<`K`, `T`\> | The name of the event. | -| `listener` | [`Listener`](index.md#listenerk-t-f)\<`K`, `T`, (...`args`: `any`[]) => `void`\> | The callback function | +| `eventName` | [`Key`](#key)\<`K`, `T`\> | The name of the event. | +| `listener` | [`Listener`](#listener)\<`K`, `T`\> | The callback function | ###### Returns @@ -308,7 +308,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ##### removeListener() -> **removeListener**\<`K`\>(`eventName`: [`Key`](index.md#keyk-t)\<`K`, `T`\>, `listener`: [`Listener`](index.md#listenerk-t-f)\<`K`, `T`, (...`args`: `any`[]) => `void`\>): `this` +> **removeListener**\<`K`\>(`eventName`: [`Key`](#key)\<`K`, `T`\>, `listener`: [`Listener`](#listener)\<`K`, `T`\>): `this` Removes the specified `listener` from the listener array for the event named `eventName`. @@ -391,24 +391,50 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. | Parameter | Type | | ------ | ------ | -| `eventName` | [`Key`](index.md#keyk-t)\<`K`, `T`\> | -| `listener` | [`Listener`](index.md#listenerk-t-f)\<`K`, `T`, (...`args`: `any`[]) => `void`\> | +| `eventName` | [`Key`](#key)\<`K`, `T`\> | +| `listener` | [`Listener`](#listener)\<`K`, `T`\> | ###### Returns `this` +## Interfaces + +### SymbolConstructor() + +> **SymbolConstructor**(`description?`: `string` \| `number`): `symbol` + +Returns a new unique Symbol value. + +#### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `description?` | `string` \| `number` | Description of the new Symbol object. | + +#### Returns + +`symbol` + +#### Properties + +##### dispose + +> `readonly` **dispose**: *typeof* [`dispose`](#dispose) + +A method that is used to release resources held by an object. Called by the semantics of the `using` statement. + ## Type Aliases ### AnyRest -> **AnyRest**: \[`any`[]\] +> **AnyRest** = \[`any`[]\] *** -### Args\ +### Args -> **Args**\<`K`, `T`\>: `T` *extends* [`DefaultEventMap`](index.md#defaulteventmap) ? [`AnyRest`](index.md#anyrest) : `K` *extends* keyof `T` ? `T`\[`K`\] : `never` +> **Args**\<`K`, `T`\> = `T` *extends* [`DefaultEventMap`](#defaulteventmap) ? [`AnyRest`](#anyrest) : `K` *extends* keyof `T` ? `T`\[`K`\] : `never` #### Type Parameters @@ -421,13 +447,13 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ### DefaultEventMap -> **DefaultEventMap**: \[`never`\] +> **DefaultEventMap** = \[`never`\] *** -### EventMap\ +### EventMap -> **EventMap**\<`T`\>: `Record`\ \| [`DefaultEventMap`](index.md#defaulteventmap) +> **EventMap**\<`T`\> = `Record`\ \| [`DefaultEventMap`](#defaulteventmap) #### Type Parameters @@ -437,9 +463,9 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. *** -### Key\ +### Key -> **Key**\<`K`, `T`\>: `T` *extends* [`DefaultEventMap`](index.md#defaulteventmap) ? [`EventKey`](../dom-events.md#eventkey) : `K` \| keyof `T` +> **Key**\<`K`, `T`\> = `T` *extends* [`DefaultEventMap`](#defaulteventmap) ? [`EventKey`](../dom-events.md#eventkey) : `K` \| keyof `T` #### Type Parameters @@ -450,9 +476,9 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. *** -### Key2\ +### Key2 -> **Key2**\<`K`, `T`\>: `T` *extends* [`DefaultEventMap`](index.md#defaulteventmap) ? [`EventKey`](../dom-events.md#eventkey) : `K` & keyof `T` +> **Key2**\<`K`, `T`\> = `T` *extends* [`DefaultEventMap`](#defaulteventmap) ? [`EventKey`](../dom-events.md#eventkey) : `K` & keyof `T` #### Type Parameters @@ -463,9 +489,9 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. *** -### Listener\ +### Listener -> **Listener**\<`K`, `T`, `F`\>: `T` *extends* [`DefaultEventMap`](index.md#defaulteventmap) ? `F` : `K` *extends* keyof `T` ? `T`\[`K`\] *extends* `unknown`[] ? (...`args`: `T`\[`K`\]) => `void` : `never` : `never` +> **Listener**\<`K`, `T`, `F`\> = `T` *extends* [`DefaultEventMap`](#defaulteventmap) ? `F` : `K` *extends* keyof `T` ? `T`\[`K`\] *extends* `unknown`[] ? (...`args`: `T`\[`K`\]) => `void` : `never` : `never` #### Type Parameters diff --git a/src/reference/modules/llrt/globals/namespaces/QuickJS.md b/src/reference/modules/llrt/globals/namespaces/QuickJS.md index 98f104f..f5a0a85 100644 --- a/src/reference/modules/llrt/globals/namespaces/QuickJS.md +++ b/src/reference/modules/llrt/globals/namespaces/QuickJS.md @@ -8,7 +8,7 @@ #### Extends -- [`EventEmitter`](../index.md#eventemittert) +- [`EventEmitter`](../index.md#eventemitter) #### Methods @@ -37,7 +37,7 @@ Alias for `emitter.on(eventName, listener)`. ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`addListener`](../index.md#addlistener) +[`EventEmitter`](../index.md#eventemitter).[`addListener`](../index.md#addlistener) ##### emit() @@ -91,7 +91,7 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`emit`](../index.md#emit) +[`EventEmitter`](../index.md#eventemitter).[`emit`](../index.md#emit) ##### eventNames() @@ -120,7 +120,7 @@ console.log(myEE.eventNames()); ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`eventNames`](../index.md#eventnames) +[`EventEmitter`](../index.md#eventemitter).[`eventNames`](../index.md#eventnames) ##### off() @@ -147,7 +147,7 @@ Alias for `emitter.removeListener()`. ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`off`](../index.md#off) +[`EventEmitter`](../index.md#eventemitter).[`off`](../index.md#off) ##### on() @@ -199,7 +199,7 @@ myEE.emit('foo'); ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`on`](../index.md#on) +[`EventEmitter`](../index.md#eventemitter).[`on`](../index.md#on) ##### once() @@ -247,7 +247,7 @@ v0.3.0 ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`once`](../index.md#once) +[`EventEmitter`](../index.md#eventemitter).[`once`](../index.md#once) ##### prependListener() @@ -279,7 +279,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`prependListener`](../index.md#prependlistener) +[`EventEmitter`](../index.md#eventemitter).[`prependListener`](../index.md#prependlistener) ##### prependOnceListener() @@ -309,21 +309,21 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`prependOnceListener`](../index.md#prependoncelistener) +[`EventEmitter`](../index.md#eventemitter).[`prependOnceListener`](../index.md#prependoncelistener) ##### read() -> **read**(`size`?: `number`): `null` \| [`Buffer`](../../buffer.md#buffer) +> **read**(`size?`: `number`): [`Buffer`](../../buffer.md#buffer) \| `null` ###### Parameters | Parameter | Type | | ------ | ------ | -| `size`? | `number` | +| `size?` | `number` | ###### Returns -`null` \| [`Buffer`](../../buffer.md#buffer) +[`Buffer`](../../buffer.md#buffer) \| `null` ##### removeListener() @@ -419,7 +419,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`removeListener`](../index.md#removelistener) +[`EventEmitter`](../index.md#eventemitter).[`removeListener`](../index.md#removelistener) *** @@ -427,7 +427,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. #### Extends -- [`EventEmitter`](../index.md#eventemittert) +- [`EventEmitter`](../index.md#eventemitter) #### Methods @@ -456,7 +456,7 @@ Alias for `emitter.on(eventName, listener)`. ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`addListener`](../index.md#addlistener) +[`EventEmitter`](../index.md#eventemitter).[`addListener`](../index.md#addlistener) ##### emit() @@ -510,7 +510,7 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`emit`](../index.md#emit) +[`EventEmitter`](../index.md#eventemitter).[`emit`](../index.md#emit) ##### end() @@ -547,7 +547,7 @@ console.log(myEE.eventNames()); ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`eventNames`](../index.md#eventnames) +[`EventEmitter`](../index.md#eventemitter).[`eventNames`](../index.md#eventnames) ##### off() @@ -574,7 +574,7 @@ Alias for `emitter.removeListener()`. ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`off`](../index.md#off) +[`EventEmitter`](../index.md#eventemitter).[`off`](../index.md#off) ##### on() @@ -626,7 +626,7 @@ myEE.emit('foo'); ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`on`](../index.md#on) +[`EventEmitter`](../index.md#eventemitter).[`on`](../index.md#on) ##### once() @@ -674,7 +674,7 @@ v0.3.0 ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`once`](../index.md#once) +[`EventEmitter`](../index.md#eventemitter).[`once`](../index.md#once) ##### prependListener() @@ -706,7 +706,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`prependListener`](../index.md#prependlistener) +[`EventEmitter`](../index.md#eventemitter).[`prependListener`](../index.md#prependlistener) ##### prependOnceListener() @@ -736,7 +736,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`prependOnceListener`](../index.md#prependoncelistener) +[`EventEmitter`](../index.md#eventemitter).[`prependOnceListener`](../index.md#prependoncelistener) ##### removeListener() @@ -832,18 +832,18 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`EventEmitter`](../index.md#eventemittert).[`removeListener`](../index.md#removelistener) +[`EventEmitter`](../index.md#eventemitter).[`removeListener`](../index.md#removelistener) ##### write() -> **write**(`chunk`: `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](QuickJS.md#arraybufferview) \| [`Buffer`](../../buffer.md#buffer), `callback`?: (`err`?: `null` \| `Error`) => `void`): `void` +> **write**(`chunk`: `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](#arraybufferview) \| [`Buffer`](../../buffer.md#buffer), `callback?`: (`err?`: `Error` \| `null`) => `void`): `void` ###### Parameters | Parameter | Type | | ------ | ------ | -| `chunk` | `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](QuickJS.md#arraybufferview) \| [`Buffer`](../../buffer.md#buffer) | -| `callback`? | (`err`?: `null` \| `Error`) => `void` | +| `chunk` | `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](#arraybufferview) \| [`Buffer`](../../buffer.md#buffer) | +| `callback?` | (`err?`: `Error` \| `null`) => `void` | ###### Returns @@ -853,22 +853,22 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ### ArrayBufferView -> **ArrayBufferView**: [`TypedArray`](QuickJS.md#typedarray) \| `DataView` +> **ArrayBufferView** = [`TypedArray`](#typedarray) \| `DataView` *** ### Platform -> **Platform**: `"darwin"` \| `"linux"` \| `"win32"` +> **Platform** = `"darwin"` \| `"linux"` \| `"win32"` *** ### Signals -> **Signals**: `"SIGABRT"` \| `"SIGALRM"` \| `"SIGFPE"` \| `"SIGHUP"` \| `"SIGILL"` \| `"SIGINT"` \| `"SIGKILL"` \| `"SIGPIPE"` \| `"SIGQUIT"` \| `"SIGSEGV"` \| `"SIGTERM"` +> **Signals** = `"SIGABRT"` \| `"SIGALRM"` \| `"SIGFPE"` \| `"SIGHUP"` \| `"SIGILL"` \| `"SIGINT"` \| `"SIGKILL"` \| `"SIGPIPE"` \| `"SIGQUIT"` \| `"SIGSEGV"` \| `"SIGTERM"` *** ### TypedArray -> **TypedArray**: `Uint8Array` \| `Uint8ClampedArray` \| `Uint16Array` \| `Uint32Array` \| `Int8Array` \| `Int16Array` \| `Int32Array` \| `BigUint64Array` \| `BigInt64Array` \| `Float32Array` \| `Float64Array` +> **TypedArray** = `Uint8Array` \| `Uint8ClampedArray` \| `Uint16Array` \| `Uint32Array` \| `Int8Array` \| `Int16Array` \| `Int32Array` \| `BigUint64Array` \| `BigInt64Array` \| `Float32Array` \| `Float64Array` diff --git a/src/reference/modules/llrt/net.md b/src/reference/modules/llrt/net.md index 3ed42b6..bdd279f 100644 --- a/src/reference/modules/llrt/net.md +++ b/src/reference/modules/llrt/net.md @@ -10,42 +10,42 @@ This class is used to create a TCP or `IPC` server. #### Extends -- [`EventEmitter`](globals/index.md#eventemittert) +- [`EventEmitter`](globals/index.md#eventemitter) #### Constructors -##### new Server() +##### Constructor -> **new Server**(`connectionListener`?: (`socket`: [`Socket`](net.md#socket)) => `void`): [`Server`](net.md#server) +> **new Server**(`connectionListener?`: (`socket`: [`Socket`](#socket)) => `void`): [`Server`](#server) ###### Parameters | Parameter | Type | | ------ | ------ | -| `connectionListener`? | (`socket`: [`Socket`](net.md#socket)) => `void` | +| `connectionListener?` | (`socket`: [`Socket`](#socket)) => `void` | ###### Returns -[`Server`](net.md#server) +[`Server`](#server) ###### Overrides -[`EventEmitter`](globals/index.md#eventemittert).[`constructor`](globals/index.md#constructors) +[`EventEmitter`](globals/index.md#eventemitter).[`constructor`](globals/index.md#constructor) -##### new Server() +##### Constructor -> **new Server**(`options`?: [`ServerOpts`](net.md#serveropts), `connectionListener`?: (`socket`: [`Socket`](net.md#socket)) => `void`): [`Server`](net.md#server) +> **new Server**(`options?`: [`ServerOpts`](#serveropts), `connectionListener?`: (`socket`: [`Socket`](#socket)) => `void`): [`Server`](#server) ###### Parameters | Parameter | Type | | ------ | ------ | -| `options`? | [`ServerOpts`](net.md#serveropts) | -| `connectionListener`? | (`socket`: [`Socket`](net.md#socket)) => `void` | +| `options?` | [`ServerOpts`](#serveropts) | +| `connectionListener?` | (`socket`: [`Socket`](#socket)) => `void` | ###### Returns -[`Server`](net.md#server) +[`Server`](#server) ###### Overrides @@ -78,7 +78,7 @@ events.EventEmitter ###### Overrides -[`EventEmitter`](globals/index.md#eventemittert).[`addListener`](globals/index.md#addlistener) +[`EventEmitter`](globals/index.md#eventemitter).[`addListener`](globals/index.md#addlistener) ###### Call Signature @@ -107,7 +107,7 @@ events.EventEmitter ###### Call Signature -> **addListener**(`event`: `"connection"`, `listener`: (`socket`: [`Socket`](net.md#socket)) => `void`): `this` +> **addListener**(`event`: `"connection"`, `listener`: (`socket`: [`Socket`](#socket)) => `void`): `this` events.EventEmitter 1. close @@ -120,7 +120,7 @@ events.EventEmitter | Parameter | Type | | ------ | ------ | | `event` | `"connection"` | -| `listener` | (`socket`: [`Socket`](net.md#socket)) => `void` | +| `listener` | (`socket`: [`Socket`](#socket)) => `void` | ###### Returns @@ -182,7 +182,7 @@ events.EventEmitter ##### address() -> **address**(): `null` \| `string` \| [`AddressInfo`](net.md#addressinfo) +> **address**(): `string` \| [`AddressInfo`](#addressinfo) \| `null` Returns the bound `address`, the address `family` name, and `port` of the server as reported by the operating system if listening on an IP socket @@ -210,11 +210,11 @@ emitted or after calling `server.close()`. ###### Returns -`null` \| `string` \| [`AddressInfo`](net.md#addressinfo) +`string` \| [`AddressInfo`](#addressinfo) \| `null` ##### close() -> **close**(`callback`?: (`err`?: `Error`) => `void`): `this` +> **close**(`callback?`: (`err?`: `Error`) => `void`): `this` Stops the server from accepting new connections and keeps existing connections. This function is asynchronous, the server is finally closed @@ -227,7 +227,7 @@ was not open when it was closed. | Parameter | Type | Description | | ------ | ------ | ------ | -| `callback`? | (`err`?: `Error`) => `void` | Called when the server is closed. | +| `callback?` | (`err?`: `Error`) => `void` | Called when the server is closed. | ###### Returns @@ -281,7 +281,7 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Overrides -[`EventEmitter`](globals/index.md#eventemittert).[`emit`](globals/index.md#emit) +[`EventEmitter`](globals/index.md#eventemitter).[`emit`](globals/index.md#emit) ###### Call Signature @@ -303,14 +303,14 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Call Signature -> **emit**(`event`: `"connection"`, `socket`: [`Socket`](net.md#socket)): `boolean` +> **emit**(`event`: `"connection"`, `socket`: [`Socket`](#socket)): `boolean` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"connection"` | -| `socket` | [`Socket`](net.md#socket) | +| `socket` | [`Socket`](#socket) | ###### Returns @@ -384,13 +384,13 @@ console.log(myEE.eventNames()); ###### Inherited from -[`EventEmitter`](globals/index.md#eventemittert).[`eventNames`](globals/index.md#eventnames) +[`EventEmitter`](globals/index.md#eventemitter).[`eventNames`](globals/index.md#eventnames) ##### listen() ###### Call Signature -> **listen**(`listeningListener`?: () => `void`): `void` +> **listen**(`listeningListener?`: () => `void`): `void` Start a server listening for connections. A `net.Server` can be a TCP or an `IPC` server depending on what it listens to. @@ -407,7 +407,7 @@ event. All `listen()` methods can take a `backlog` parameter to specify the maximum length of the queue of pending connections. Currently this parameter is IGNORED, support will be added in the future. -All [Socket](net.md#socket) are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for details). +All [Socket](#socket) are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for details). The `server.listen()` method can be called again if and only if there was an error during the first `server.listen()` call or `server.close()` has been called. Otherwise, an error will be thrown. @@ -416,7 +416,7 @@ call or `server.close()` has been called. Otherwise, an error will be thrown. | Parameter | Type | | ------ | ------ | -| `listeningListener`? | () => `void` | +| `listeningListener?` | () => `void` | ###### Returns @@ -424,7 +424,7 @@ call or `server.close()` has been called. Otherwise, an error will be thrown. ###### Call Signature -> **listen**(`port`?: `number`, `hostname`?: `string`, `backlog`?: `number`, `listeningListener`?: () => `void`): `void` +> **listen**(`port?`: `number`, `hostname?`: `string`, `backlog?`: `number`, `listeningListener?`: () => `void`): `void` Start a server listening for connections. A `net.Server` can be a TCP or an `IPC` server depending on what it listens to. @@ -441,7 +441,7 @@ event. All `listen()` methods can take a `backlog` parameter to specify the maximum length of the queue of pending connections. Currently this parameter is IGNORED, support will be added in the future. -All [Socket](net.md#socket) are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for details). +All [Socket](#socket) are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for details). The `server.listen()` method can be called again if and only if there was an error during the first `server.listen()` call or `server.close()` has been called. Otherwise, an error will be thrown. @@ -450,10 +450,10 @@ call or `server.close()` has been called. Otherwise, an error will be thrown. | Parameter | Type | | ------ | ------ | -| `port`? | `number` | -| `hostname`? | `string` | -| `backlog`? | `number` | -| `listeningListener`? | () => `void` | +| `port?` | `number` | +| `hostname?` | `string` | +| `backlog?` | `number` | +| `listeningListener?` | () => `void` | ###### Returns @@ -461,7 +461,7 @@ call or `server.close()` has been called. Otherwise, an error will be thrown. ###### Call Signature -> **listen**(`port`?: `number`, `hostname`?: `string`, `listeningListener`?: () => `void`): `void` +> **listen**(`port?`: `number`, `hostname?`: `string`, `listeningListener?`: () => `void`): `void` Start a server listening for connections. A `net.Server` can be a TCP or an `IPC` server depending on what it listens to. @@ -478,7 +478,7 @@ event. All `listen()` methods can take a `backlog` parameter to specify the maximum length of the queue of pending connections. Currently this parameter is IGNORED, support will be added in the future. -All [Socket](net.md#socket) are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for details). +All [Socket](#socket) are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for details). The `server.listen()` method can be called again if and only if there was an error during the first `server.listen()` call or `server.close()` has been called. Otherwise, an error will be thrown. @@ -487,9 +487,9 @@ call or `server.close()` has been called. Otherwise, an error will be thrown. | Parameter | Type | | ------ | ------ | -| `port`? | `number` | -| `hostname`? | `string` | -| `listeningListener`? | () => `void` | +| `port?` | `number` | +| `hostname?` | `string` | +| `listeningListener?` | () => `void` | ###### Returns @@ -497,7 +497,7 @@ call or `server.close()` has been called. Otherwise, an error will be thrown. ###### Call Signature -> **listen**(`port`?: `number`, `backlog`?: `number`, `listeningListener`?: () => `void`): `void` +> **listen**(`port?`: `number`, `backlog?`: `number`, `listeningListener?`: () => `void`): `void` Start a server listening for connections. A `net.Server` can be a TCP or an `IPC` server depending on what it listens to. @@ -514,7 +514,7 @@ event. All `listen()` methods can take a `backlog` parameter to specify the maximum length of the queue of pending connections. Currently this parameter is IGNORED, support will be added in the future. -All [Socket](net.md#socket) are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for details). +All [Socket](#socket) are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for details). The `server.listen()` method can be called again if and only if there was an error during the first `server.listen()` call or `server.close()` has been called. Otherwise, an error will be thrown. @@ -523,9 +523,9 @@ call or `server.close()` has been called. Otherwise, an error will be thrown. | Parameter | Type | | ------ | ------ | -| `port`? | `number` | -| `backlog`? | `number` | -| `listeningListener`? | () => `void` | +| `port?` | `number` | +| `backlog?` | `number` | +| `listeningListener?` | () => `void` | ###### Returns @@ -533,7 +533,7 @@ call or `server.close()` has been called. Otherwise, an error will be thrown. ###### Call Signature -> **listen**(`port`?: `number`, `listeningListener`?: () => `void`): `void` +> **listen**(`port?`: `number`, `listeningListener?`: () => `void`): `void` Start a server listening for connections. A `net.Server` can be a TCP or an `IPC` server depending on what it listens to. @@ -550,7 +550,7 @@ event. All `listen()` methods can take a `backlog` parameter to specify the maximum length of the queue of pending connections. Currently this parameter is IGNORED, support will be added in the future. -All [Socket](net.md#socket) are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for details). +All [Socket](#socket) are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for details). The `server.listen()` method can be called again if and only if there was an error during the first `server.listen()` call or `server.close()` has been called. Otherwise, an error will be thrown. @@ -559,8 +559,8 @@ call or `server.close()` has been called. Otherwise, an error will be thrown. | Parameter | Type | | ------ | ------ | -| `port`? | `number` | -| `listeningListener`? | () => `void` | +| `port?` | `number` | +| `listeningListener?` | () => `void` | ###### Returns @@ -568,7 +568,7 @@ call or `server.close()` has been called. Otherwise, an error will be thrown. ###### Call Signature -> **listen**(`path`: `string`, `backlog`?: `number`, `listeningListener`?: () => `void`): `void` +> **listen**(`path`: `string`, `backlog?`: `number`, `listeningListener?`: () => `void`): `void` Start a server listening for connections. A `net.Server` can be a TCP or an `IPC` server depending on what it listens to. @@ -585,7 +585,7 @@ event. All `listen()` methods can take a `backlog` parameter to specify the maximum length of the queue of pending connections. Currently this parameter is IGNORED, support will be added in the future. -All [Socket](net.md#socket) are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for details). +All [Socket](#socket) are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for details). The `server.listen()` method can be called again if and only if there was an error during the first `server.listen()` call or `server.close()` has been called. Otherwise, an error will be thrown. @@ -595,8 +595,8 @@ call or `server.close()` has been called. Otherwise, an error will be thrown. | Parameter | Type | | ------ | ------ | | `path` | `string` | -| `backlog`? | `number` | -| `listeningListener`? | () => `void` | +| `backlog?` | `number` | +| `listeningListener?` | () => `void` | ###### Returns @@ -604,7 +604,7 @@ call or `server.close()` has been called. Otherwise, an error will be thrown. ###### Call Signature -> **listen**(`path`: `string`, `listeningListener`?: () => `void`): `void` +> **listen**(`path`: `string`, `listeningListener?`: () => `void`): `void` Start a server listening for connections. A `net.Server` can be a TCP or an `IPC` server depending on what it listens to. @@ -621,7 +621,7 @@ event. All `listen()` methods can take a `backlog` parameter to specify the maximum length of the queue of pending connections. Currently this parameter is IGNORED, support will be added in the future. -All [Socket](net.md#socket) are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for details). +All [Socket](#socket) are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for details). The `server.listen()` method can be called again if and only if there was an error during the first `server.listen()` call or `server.close()` has been called. Otherwise, an error will be thrown. @@ -631,7 +631,7 @@ call or `server.close()` has been called. Otherwise, an error will be thrown. | Parameter | Type | | ------ | ------ | | `path` | `string` | -| `listeningListener`? | () => `void` | +| `listeningListener?` | () => `void` | ###### Returns @@ -639,7 +639,7 @@ call or `server.close()` has been called. Otherwise, an error will be thrown. ###### Call Signature -> **listen**(`options`: [`ListenOptions`](net.md#listenoptions), `listeningListener`?: () => `void`): `void` +> **listen**(`options`: [`ListenOptions`](#listenoptions), `listeningListener?`: () => `void`): `void` Start a server listening for connections. A `net.Server` can be a TCP or an `IPC` server depending on what it listens to. @@ -656,7 +656,7 @@ event. All `listen()` methods can take a `backlog` parameter to specify the maximum length of the queue of pending connections. Currently this parameter is IGNORED, support will be added in the future. -All [Socket](net.md#socket) are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for details). +All [Socket](#socket) are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for details). The `server.listen()` method can be called again if and only if there was an error during the first `server.listen()` call or `server.close()` has been called. Otherwise, an error will be thrown. @@ -665,8 +665,8 @@ call or `server.close()` has been called. Otherwise, an error will be thrown. | Parameter | Type | | ------ | ------ | -| `options` | [`ListenOptions`](net.md#listenoptions) | -| `listeningListener`? | () => `void` | +| `options` | [`ListenOptions`](#listenoptions) | +| `listeningListener?` | () => `void` | ###### Returns @@ -697,7 +697,7 @@ Alias for `emitter.removeListener()`. ###### Inherited from -[`EventEmitter`](globals/index.md#eventemittert).[`off`](globals/index.md#off) +[`EventEmitter`](globals/index.md#eventemitter).[`off`](globals/index.md#off) ##### on() @@ -745,7 +745,7 @@ myEE.emit('foo'); ###### Overrides -[`EventEmitter`](globals/index.md#eventemittert).[`on`](globals/index.md#on) +[`EventEmitter`](globals/index.md#eventemitter).[`on`](globals/index.md#on) ###### Call Signature @@ -768,14 +768,14 @@ myEE.emit('foo'); ###### Call Signature -> **on**(`event`: `"connection"`, `listener`: (`socket`: [`Socket`](net.md#socket)) => `void`): `this` +> **on**(`event`: `"connection"`, `listener`: (`socket`: [`Socket`](#socket)) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"connection"` | -| `listener` | (`socket`: [`Socket`](net.md#socket)) => `void` | +| `listener` | (`socket`: [`Socket`](#socket)) => `void` | ###### Returns @@ -865,7 +865,7 @@ v0.3.0 ###### Overrides -[`EventEmitter`](globals/index.md#eventemittert).[`once`](globals/index.md#once) +[`EventEmitter`](globals/index.md#eventemitter).[`once`](globals/index.md#once) ###### Call Signature @@ -888,14 +888,14 @@ v0.3.0 ###### Call Signature -> **once**(`event`: `"connection"`, `listener`: (`socket`: [`Socket`](net.md#socket)) => `void`): `this` +> **once**(`event`: `"connection"`, `listener`: (`socket`: [`Socket`](#socket)) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"connection"` | -| `listener` | (`socket`: [`Socket`](net.md#socket)) => `void` | +| `listener` | (`socket`: [`Socket`](#socket)) => `void` | ###### Returns @@ -969,7 +969,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Overrides -[`EventEmitter`](globals/index.md#eventemittert).[`prependListener`](globals/index.md#prependlistener) +[`EventEmitter`](globals/index.md#eventemitter).[`prependListener`](globals/index.md#prependlistener) ###### Call Signature @@ -992,14 +992,14 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Call Signature -> **prependListener**(`event`: `"connection"`, `listener`: (`socket`: [`Socket`](net.md#socket)) => `void`): `this` +> **prependListener**(`event`: `"connection"`, `listener`: (`socket`: [`Socket`](#socket)) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"connection"` | -| `listener` | (`socket`: [`Socket`](net.md#socket)) => `void` | +| `listener` | (`socket`: [`Socket`](#socket)) => `void` | ###### Returns @@ -1071,7 +1071,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Overrides -[`EventEmitter`](globals/index.md#eventemittert).[`prependOnceListener`](globals/index.md#prependoncelistener) +[`EventEmitter`](globals/index.md#eventemitter).[`prependOnceListener`](globals/index.md#prependoncelistener) ###### Call Signature @@ -1094,14 +1094,14 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Call Signature -> **prependOnceListener**(`event`: `"connection"`, `listener`: (`socket`: [`Socket`](net.md#socket)) => `void`): `this` +> **prependOnceListener**(`event`: `"connection"`, `listener`: (`socket`: [`Socket`](#socket)) => `void`): `this` ###### Parameters | Parameter | Type | | ------ | ------ | | `event` | `"connection"` | -| `listener` | (`socket`: [`Socket`](net.md#socket)) => `void` | +| `listener` | (`socket`: [`Socket`](#socket)) => `void` | ###### Returns @@ -1243,7 +1243,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`EventEmitter`](globals/index.md#eventemittert).[`removeListener`](globals/index.md#removelistener) +[`EventEmitter`](globals/index.md#eventemitter).[`removeListener`](globals/index.md#removelistener) *** @@ -1252,35 +1252,35 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. This class is an abstraction of a TCP socket or a streaming `IPC` endpoint (only available on Unix with domain sockets). It is also an `EventEmitter`. -A `net.Socket` can be created by the user and used directly to interact with a server. For example, it is returned by [createConnection](net.md#createconnection), +A `net.Socket` can be created by the user and used directly to interact with a server. For example, it is returned by [createConnection](#createconnection), so the user can use it to talk to the server. It can also be created by LLRT and passed to the user when a connection is received. -For example, it is passed to the listeners of a `'connection'` event emitted on a [Server](net.md#server), so the user can use it to interact with the client. +For example, it is passed to the listeners of a `'connection'` event emitted on a [Server](#server), so the user can use it to interact with the client. #### Extends -- [`DefaultDuplexStream`](stream.md#defaultduplexstream) +- [`DefaultDuplexStream`](stream/stream.md#defaultduplexstream) #### Constructors -##### new Socket() +##### Constructor -> **new Socket**(`options`?: [`SocketConstructorOpts`](net.md#socketconstructoropts)): [`Socket`](net.md#socket) +> **new Socket**(`options?`: [`SocketConstructorOpts`](#socketconstructoropts)): [`Socket`](#socket) ###### Parameters | Parameter | Type | | ------ | ------ | -| `options`? | [`SocketConstructorOpts`](net.md#socketconstructoropts) | +| `options?` | [`SocketConstructorOpts`](#socketconstructoropts) | ###### Returns -[`Socket`](net.md#socket) +[`Socket`](#socket) ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`constructor`](stream.md#constructors) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`constructor`](stream/stream.md#constructor) #### Properties @@ -1322,7 +1322,7 @@ This is `true` if the socket is not connected yet, either because `.connect()`ha ##### readyState -> `readonly` **readyState**: [`SocketReadyState`](net.md#socketreadystate) +> `readonly` **readyState**: [`SocketReadyState`](#socketreadystate-1) This property represents the state of the connection as a string. @@ -1366,7 +1366,7 @@ Calls `readable.destroy()`. ###### Inherited from -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`[dispose]`](stream.md#dispose) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`[dispose]`](stream/stream.md#dispose) ##### addListener() @@ -1394,7 +1394,7 @@ events.EventEmitter ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`addListener`](stream.md#addlistener) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`addListener`](stream/stream.md#addlistener) ###### Call Signature @@ -1420,7 +1420,7 @@ events.EventEmitter ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`addListener`](stream.md#addlistener) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`addListener`](stream/stream.md#addlistener) ###### Call Signature @@ -1446,7 +1446,7 @@ events.EventEmitter ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`addListener`](stream.md#addlistener) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`addListener`](stream/stream.md#addlistener) ###### Call Signature @@ -1472,7 +1472,7 @@ events.EventEmitter ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`addListener`](stream.md#addlistener) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`addListener`](stream/stream.md#addlistener) ###### Call Signature @@ -1554,14 +1554,14 @@ events.EventEmitter ##### address() -> **address**(): \{\} \| [`AddressInfo`](net.md#addressinfo) +> **address**(): \{ \} \| [`AddressInfo`](#addressinfo) Returns the bound `address`, the address `family` name and `port` of the socket as reported by the operating system:`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` ###### Returns -\{\} \| [`AddressInfo`](net.md#addressinfo) +\{ \} \| [`AddressInfo`](#addressinfo) ###### Since @@ -1571,7 +1571,7 @@ v0.1.90 ###### Call Signature -> **connect**(`options`: [`SocketConnectOpts`](net.md#socketconnectopts), `connectionListener`?: () => `void`): `this` +> **connect**(`options`: [`SocketConnectOpts`](#socketconnectopts), `connectionListener?`: () => `void`): `this` Initiate a connection on a given socket. @@ -1595,8 +1595,8 @@ behavior. | Parameter | Type | | ------ | ------ | -| `options` | [`SocketConnectOpts`](net.md#socketconnectopts) | -| `connectionListener`? | () => `void` | +| `options` | [`SocketConnectOpts`](#socketconnectopts) | +| `connectionListener?` | () => `void` | ###### Returns @@ -1604,7 +1604,7 @@ behavior. ###### Call Signature -> **connect**(`port`: `number`, `host`: `string`, `connectionListener`?: () => `void`): `this` +> **connect**(`port`: `number`, `host`: `string`, `connectionListener?`: () => `void`): `this` Initiate a connection on a given socket. @@ -1630,7 +1630,7 @@ behavior. | ------ | ------ | | `port` | `number` | | `host` | `string` | -| `connectionListener`? | () => `void` | +| `connectionListener?` | () => `void` | ###### Returns @@ -1638,7 +1638,7 @@ behavior. ###### Call Signature -> **connect**(`port`: `number`, `connectionListener`?: () => `void`): `this` +> **connect**(`port`: `number`, `connectionListener?`: () => `void`): `this` Initiate a connection on a given socket. @@ -1663,7 +1663,7 @@ behavior. | Parameter | Type | | ------ | ------ | | `port` | `number` | -| `connectionListener`? | () => `void` | +| `connectionListener?` | () => `void` | ###### Returns @@ -1671,7 +1671,7 @@ behavior. ###### Call Signature -> **connect**(`path`: `string`, `connectionListener`?: () => `void`): `this` +> **connect**(`path`: `string`, `connectionListener?`: () => `void`): `this` Initiate a connection on a given socket. @@ -1696,7 +1696,7 @@ behavior. | Parameter | Type | | ------ | ------ | | `path` | `string` | -| `connectionListener`? | () => `void` | +| `connectionListener?` | () => `void` | ###### Returns @@ -1704,7 +1704,7 @@ behavior. ##### destroy() -> **destroy**(`error`?: `Error`): `this` +> **destroy**(`error?`: `Error`): `this` Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` event. After this call, the readable stream will release any internal resources and subsequent calls to `push()` will be ignored. @@ -1718,7 +1718,7 @@ Implementors should not override this method, but instead implement `readable._d | Parameter | Type | Description | | ------ | ------ | ------ | -| `error`? | `Error` | Error which will be passed as payload in `'error'` event | +| `error?` | `Error` | Error which will be passed as payload in `'error'` event | ###### Returns @@ -1726,7 +1726,7 @@ Implementors should not override this method, but instead implement `readable._d ###### Inherited from -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`destroy`](stream.md#destroy) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`destroy`](stream/stream.md#destroy) ##### emit() @@ -1776,7 +1776,7 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`emit`](stream.md#emit) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`emit`](stream/stream.md#emit) ###### Call Signature @@ -1795,7 +1795,7 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`emit`](stream.md#emit) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`emit`](stream/stream.md#emit) ###### Call Signature @@ -1813,7 +1813,7 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`emit`](stream.md#emit) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`emit`](stream/stream.md#emit) ###### Call Signature @@ -1832,7 +1832,7 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`emit`](stream.md#emit) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`emit`](stream/stream.md#emit) ###### Call Signature @@ -1873,7 +1873,7 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); ##### end() -> **end**(`callback`?: () => `void`): `this` +> **end**(`callback?`: () => `void`): `this` Half-closes the socket. i.e., it sends a FIN packet. It is possible the server will still send some data. @@ -1881,7 +1881,7 @@ Half-closes the socket. i.e., it sends a FIN packet. It is possible the server w | Parameter | Type | Description | | ------ | ------ | ------ | -| `callback`? | () => `void` | Optional callback for when the socket is finished. | +| `callback?` | () => `void` | Optional callback for when the socket is finished. | ###### Returns @@ -1891,7 +1891,7 @@ The socket itself. ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`end`](stream.md#end) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`end`](stream/stream.md#end) ##### eventNames() @@ -1920,7 +1920,7 @@ console.log(myEE.eventNames()); ###### Inherited from -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`eventNames`](stream.md#eventnames) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`eventNames`](stream/stream.md#eventnames) ##### off() @@ -1947,7 +1947,7 @@ Alias for `emitter.removeListener()`. ###### Inherited from -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`off`](stream.md#off) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`off`](stream/stream.md#off) ##### on() @@ -1995,7 +1995,7 @@ myEE.emit('foo'); ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`on`](stream.md#on) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`on`](stream/stream.md#on) ###### Call Signature @@ -2014,7 +2014,7 @@ myEE.emit('foo'); ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`on`](stream.md#on) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`on`](stream/stream.md#on) ###### Call Signature @@ -2033,7 +2033,7 @@ myEE.emit('foo'); ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`on`](stream.md#on) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`on`](stream/stream.md#on) ###### Call Signature @@ -2052,7 +2052,7 @@ myEE.emit('foo'); ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`on`](stream.md#on) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`on`](stream/stream.md#on) ###### Call Signature @@ -2134,7 +2134,7 @@ v0.3.0 ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`once`](stream.md#once) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`once`](stream/stream.md#once) ###### Call Signature @@ -2153,7 +2153,7 @@ v0.3.0 ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`once`](stream.md#once) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`once`](stream/stream.md#once) ###### Call Signature @@ -2172,7 +2172,7 @@ v0.3.0 ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`once`](stream.md#once) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`once`](stream/stream.md#once) ###### Call Signature @@ -2191,7 +2191,7 @@ v0.3.0 ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`once`](stream.md#once) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`once`](stream/stream.md#once) ###### Call Signature @@ -2257,7 +2257,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`prependListener`](stream.md#prependlistener) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`prependListener`](stream/stream.md#prependlistener) ###### Call Signature @@ -2276,7 +2276,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`prependListener`](stream.md#prependlistener) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`prependListener`](stream/stream.md#prependlistener) ###### Call Signature @@ -2295,7 +2295,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`prependListener`](stream.md#prependlistener) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`prependListener`](stream/stream.md#prependlistener) ###### Call Signature @@ -2314,7 +2314,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`prependListener`](stream.md#prependlistener) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`prependListener`](stream/stream.md#prependlistener) ###### Call Signature @@ -2378,7 +2378,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`prependOnceListener`](stream.md#prependoncelistener) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`prependOnceListener`](stream/stream.md#prependoncelistener) ###### Call Signature @@ -2397,7 +2397,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`prependOnceListener`](stream.md#prependoncelistener) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`prependOnceListener`](stream/stream.md#prependoncelistener) ###### Call Signature @@ -2416,7 +2416,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`prependOnceListener`](stream.md#prependoncelistener) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`prependOnceListener`](stream/stream.md#prependoncelistener) ###### Call Signature @@ -2435,7 +2435,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Overrides -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`prependOnceListener`](stream.md#prependoncelistener) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`prependOnceListener`](stream/stream.md#prependoncelistener) ###### Call Signature @@ -2477,7 +2477,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ##### read() -> **read**(`size`?: `number`): `null` \| [`Buffer`](buffer.md#buffer) +> **read**(`size?`: `number`): [`Buffer`](buffer.md#buffer) \| `null` The `readable.read()` method reads data out of the internal buffer and returns it. If no data is available to be read, `null` is returned. By default, @@ -2550,22 +2550,22 @@ a call to `readable.read(size)`, regardless of the value of the `size` argument. If the `readable.read()` method returns a chunk of data, a `'data'` event will also be emitted. -Calling [read](stream.md#read-2) after the `'end'` event has +Calling [read](stream/stream.md#read-4) after the `'end'` event has been emitted will return `null`. No runtime error will be raised. ###### Parameters | Parameter | Type | Description | | ------ | ------ | ------ | -| `size`? | `number` | Optional argument to specify how much data to read. | +| `size?` | `number` | Optional argument to specify how much data to read. | ###### Returns -`null` \| [`Buffer`](buffer.md#buffer) +[`Buffer`](buffer.md#buffer) \| `null` ###### Inherited from -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`read`](stream.md#read) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`read`](stream/stream.md#read) ##### removeListener() @@ -2657,7 +2657,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`removeListener`](stream.md#removelistener) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`removeListener`](stream/stream.md#removelistener) ###### Call Signature @@ -2676,7 +2676,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`removeListener`](stream.md#removelistener) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`removeListener`](stream/stream.md#removelistener) ###### Call Signature @@ -2695,7 +2695,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`removeListener`](stream.md#removelistener) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`removeListener`](stream/stream.md#removelistener) ###### Call Signature @@ -2714,11 +2714,11 @@ Returns a reference to the `EventEmitter`, so that calls can be chained. ###### Inherited from -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`removeListener`](stream.md#removelistener) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`removeListener`](stream/stream.md#removelistener) ##### write() -> **write**(`chunk`: `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](buffer.md#buffer), `callback`?: (`error`?: `null` \| `Error`) => `void`): `void` +> **write**(`chunk`: `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](buffer.md#buffer), `callback?`: (`error?`: `Error` \| `null`) => `void`): `void` The `writable.write()` method writes some data to the stream, and calls the supplied `callback` once the data has been fully handled. If an error @@ -2748,7 +2748,7 @@ A `Writable` stream in object mode will always ignore the `encoding` argument. | Parameter | Type | Description | | ------ | ------ | ------ | | `chunk` | `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](buffer.md#buffer) | Optional data to write. `chunk` must be a {string}, {Buffer}, {TypedArray} or {DataView}. | -| `callback`? | (`error`?: `null` \| `Error`) => `void` | Callback for when this chunk of data is flushed. | +| `callback?` | (`error?`: `Error` \| `null`) => `void` | Callback for when this chunk of data is flushed. | ###### Returns @@ -2762,7 +2762,7 @@ v0.9.4 ###### Inherited from -[`DefaultDuplexStream`](stream.md#defaultduplexstream).[`write`](stream.md#write) +[`DefaultDuplexStream`](stream/stream.md#defaultduplexstream).[`write`](stream/stream.md#write) ## Interfaces @@ -2860,19 +2860,19 @@ false ### NetConnectOpts -> **NetConnectOpts**: [`TcpSocketConnectOpts`](net.md#tcpsocketconnectopts) \| [`IpcSocketConnectOpts`](net.md#ipcsocketconnectopts) +> **NetConnectOpts** = [`TcpSocketConnectOpts`](#tcpsocketconnectopts) \| [`IpcSocketConnectOpts`](#ipcsocketconnectopts) *** ### SocketConnectOpts -> **SocketConnectOpts**: [`TcpSocketConnectOpts`](net.md#tcpsocketconnectopts) \| [`IpcSocketConnectOpts`](net.md#ipcsocketconnectopts) +> **SocketConnectOpts** = [`TcpSocketConnectOpts`](#tcpsocketconnectopts) \| [`IpcSocketConnectOpts`](#ipcsocketconnectopts) *** ### SocketReadyState -> **SocketReadyState**: `"opening"` \| `"open"` \| `"readOnly"` \| `"writeOnly"` \| `"closed"` +> **SocketReadyState** = `"opening"` \| `"open"` \| `"readOnly"` \| `"writeOnly"` \| `"closed"` ## Functions @@ -2880,38 +2880,38 @@ false #### Call Signature -> **connect**(`options`: [`NetConnectOpts`](net.md#netconnectopts), `connectionListener`?: () => `void`): [`Socket`](net.md#socket) +> **connect**(`options`: [`NetConnectOpts`](#netconnectopts), `connectionListener?`: () => `void`): [`Socket`](#socket) -Aliases to [createConnection](net.md#createconnection). +Aliases to [createConnection](#createconnection). Possible signatures: -* [connect](net.md#connect-1) -* [connect](net.md#connect-1) for `IPC` connections. -* [connect](net.md#connect-1) for TCP connections. +* [connect](#connect-5) +* [connect](#connect-5) for `IPC` connections. +* [connect](#connect-5) for TCP connections. ##### Parameters | Parameter | Type | | ------ | ------ | -| `options` | [`NetConnectOpts`](net.md#netconnectopts) | -| `connectionListener`? | () => `void` | +| `options` | [`NetConnectOpts`](#netconnectopts) | +| `connectionListener?` | () => `void` | ##### Returns -[`Socket`](net.md#socket) +[`Socket`](#socket) #### Call Signature -> **connect**(`port`: `number`, `host`: `string`, `connectionListener`?: () => `void`): [`Socket`](net.md#socket) +> **connect**(`port`: `number`, `host`: `string`, `connectionListener?`: () => `void`): [`Socket`](#socket) -Aliases to [createConnection](net.md#createconnection). +Aliases to [createConnection](#createconnection). Possible signatures: -* [connect](net.md#connect-1) -* [connect](net.md#connect-1) for `IPC` connections. -* [connect](net.md#connect-1) for TCP connections. +* [connect](#connect-5) +* [connect](#connect-5) for `IPC` connections. +* [connect](#connect-5) for TCP connections. ##### Parameters @@ -2919,57 +2919,57 @@ Possible signatures: | ------ | ------ | | `port` | `number` | | `host` | `string` | -| `connectionListener`? | () => `void` | +| `connectionListener?` | () => `void` | ##### Returns -[`Socket`](net.md#socket) +[`Socket`](#socket) #### Call Signature -> **connect**(`port`: `number`, `connectionListener`?: () => `void`): [`Socket`](net.md#socket) +> **connect**(`port`: `number`, `connectionListener?`: () => `void`): [`Socket`](#socket) -Aliases to [createConnection](net.md#createconnection). +Aliases to [createConnection](#createconnection). Possible signatures: -* [connect](net.md#connect-1) -* [connect](net.md#connect-1) for `IPC` connections. -* [connect](net.md#connect-1) for TCP connections. +* [connect](#connect-5) +* [connect](#connect-5) for `IPC` connections. +* [connect](#connect-5) for TCP connections. ##### Parameters | Parameter | Type | | ------ | ------ | | `port` | `number` | -| `connectionListener`? | () => `void` | +| `connectionListener?` | () => `void` | ##### Returns -[`Socket`](net.md#socket) +[`Socket`](#socket) #### Call Signature -> **connect**(`path`: `string`, `connectionListener`?: () => `void`): [`Socket`](net.md#socket) +> **connect**(`path`: `string`, `connectionListener?`: () => `void`): [`Socket`](#socket) -Aliases to [createConnection](net.md#createconnection). +Aliases to [createConnection](#createconnection). Possible signatures: -* [connect](net.md#connect-1) -* [connect](net.md#connect-1) for `IPC` connections. -* [connect](net.md#connect-1) for TCP connections. +* [connect](#connect-5) +* [connect](#connect-5) for `IPC` connections. +* [connect](#connect-5) for TCP connections. ##### Parameters | Parameter | Type | | ------ | ------ | | `path` | `string` | -| `connectionListener`? | () => `void` | +| `connectionListener?` | () => `void` | ##### Returns -[`Socket`](net.md#socket) +[`Socket`](#socket) *** @@ -2977,9 +2977,9 @@ Possible signatures: #### Call Signature -> **createConnection**(`options`: [`NetConnectOpts`](net.md#netconnectopts), `connectionListener`?: () => `void`): [`Socket`](net.md#socket) +> **createConnection**(`options`: [`NetConnectOpts`](#netconnectopts), `connectionListener?`: () => `void`): [`Socket`](#socket) -A factory function, which creates a new [Socket](net.md#socket), +A factory function, which creates a new [Socket](#socket), immediately initiates connection with `socket.connect()`, then returns the `net.Socket` that starts the connection. @@ -2989,28 +2989,28 @@ will be added as a listener for the `'connect'` event **once**. Possible signatures: -* [createConnection](net.md#createconnection) -* [createConnection](net.md#createconnection) for `IPC` connections. -* [createConnection](net.md#createconnection) for TCP connections. +* [createConnection](#createconnection) +* [createConnection](#createconnection) for `IPC` connections. +* [createConnection](#createconnection) for TCP connections. -The [connect](net.md#connect-1) function is an alias to this function. +The [connect](#connect-5) function is an alias to this function. ##### Parameters | Parameter | Type | | ------ | ------ | -| `options` | [`NetConnectOpts`](net.md#netconnectopts) | -| `connectionListener`? | () => `void` | +| `options` | [`NetConnectOpts`](#netconnectopts) | +| `connectionListener?` | () => `void` | ##### Returns -[`Socket`](net.md#socket) +[`Socket`](#socket) #### Call Signature -> **createConnection**(`port`: `number`, `host`: `string`, `connectionListener`?: () => `void`): [`Socket`](net.md#socket) +> **createConnection**(`port`: `number`, `host`: `string`, `connectionListener?`: () => `void`): [`Socket`](#socket) -A factory function, which creates a new [Socket](net.md#socket), +A factory function, which creates a new [Socket](#socket), immediately initiates connection with `socket.connect()`, then returns the `net.Socket` that starts the connection. @@ -3020,11 +3020,11 @@ will be added as a listener for the `'connect'` event **once**. Possible signatures: -* [createConnection](net.md#createconnection) -* [createConnection](net.md#createconnection) for `IPC` connections. -* [createConnection](net.md#createconnection) for TCP connections. +* [createConnection](#createconnection) +* [createConnection](#createconnection) for `IPC` connections. +* [createConnection](#createconnection) for TCP connections. -The [connect](net.md#connect-1) function is an alias to this function. +The [connect](#connect-5) function is an alias to this function. ##### Parameters @@ -3032,17 +3032,17 @@ The [connect](net.md#connect-1) function is an alias to this function. | ------ | ------ | | `port` | `number` | | `host` | `string` | -| `connectionListener`? | () => `void` | +| `connectionListener?` | () => `void` | ##### Returns -[`Socket`](net.md#socket) +[`Socket`](#socket) #### Call Signature -> **createConnection**(`port`: `number`, `connectionListener`?: () => `void`): [`Socket`](net.md#socket) +> **createConnection**(`port`: `number`, `connectionListener?`: () => `void`): [`Socket`](#socket) -A factory function, which creates a new [Socket](net.md#socket), +A factory function, which creates a new [Socket](#socket), immediately initiates connection with `socket.connect()`, then returns the `net.Socket` that starts the connection. @@ -3052,28 +3052,28 @@ will be added as a listener for the `'connect'` event **once**. Possible signatures: -* [createConnection](net.md#createconnection) -* [createConnection](net.md#createconnection) for `IPC` connections. -* [createConnection](net.md#createconnection) for TCP connections. +* [createConnection](#createconnection) +* [createConnection](#createconnection) for `IPC` connections. +* [createConnection](#createconnection) for TCP connections. -The [connect](net.md#connect-1) function is an alias to this function. +The [connect](#connect-5) function is an alias to this function. ##### Parameters | Parameter | Type | | ------ | ------ | | `port` | `number` | -| `connectionListener`? | () => `void` | +| `connectionListener?` | () => `void` | ##### Returns -[`Socket`](net.md#socket) +[`Socket`](#socket) #### Call Signature -> **createConnection**(`path`: `string`, `connectionListener`?: () => `void`): [`Socket`](net.md#socket) +> **createConnection**(`path`: `string`, `connectionListener?`: () => `void`): [`Socket`](#socket) -A factory function, which creates a new [Socket](net.md#socket), +A factory function, which creates a new [Socket](#socket), immediately initiates connection with `socket.connect()`, then returns the `net.Socket` that starts the connection. @@ -3083,22 +3083,22 @@ will be added as a listener for the `'connect'` event **once**. Possible signatures: -* [createConnection](net.md#createconnection) -* [createConnection](net.md#createconnection) for `IPC` connections. -* [createConnection](net.md#createconnection) for TCP connections. +* [createConnection](#createconnection) +* [createConnection](#createconnection) for `IPC` connections. +* [createConnection](#createconnection) for TCP connections. -The [connect](net.md#connect-1) function is an alias to this function. +The [connect](#connect-5) function is an alias to this function. ##### Parameters | Parameter | Type | | ------ | ------ | | `path` | `string` | -| `connectionListener`? | () => `void` | +| `connectionListener?` | () => `void` | ##### Returns -[`Socket`](net.md#socket) +[`Socket`](#socket) *** @@ -3106,7 +3106,7 @@ The [connect](net.md#connect-1) function is an alias to this function. #### Call Signature -> **createServer**(`connectionListener`?: (`socket`: [`Socket`](net.md#socket)) => `void`): [`Server`](net.md#server) +> **createServer**(`connectionListener?`: (`socket`: [`Socket`](#socket)) => `void`): [`Server`](#server) Creates a new TCP or `IPC` server. @@ -3170,15 +3170,15 @@ nc -U /tmp/echo.sock | Parameter | Type | Description | | ------ | ------ | ------ | -| `connectionListener`? | (`socket`: [`Socket`](net.md#socket)) => `void` | Automatically set as a listener for the 'connection' event. | +| `connectionListener?` | (`socket`: [`Socket`](#socket)) => `void` | Automatically set as a listener for the 'connection' event. | ##### Returns -[`Server`](net.md#server) +[`Server`](#server) #### Call Signature -> **createServer**(`options`?: [`ServerOpts`](net.md#serveropts), `connectionListener`?: (`socket`: [`Socket`](net.md#socket)) => `void`): [`Server`](net.md#server) +> **createServer**(`options?`: [`ServerOpts`](#serveropts), `connectionListener?`: (`socket`: [`Socket`](#socket)) => `void`): [`Server`](#server) Creates a new TCP or `IPC` server. @@ -3242,9 +3242,9 @@ nc -U /tmp/echo.sock | Parameter | Type | Description | | ------ | ------ | ------ | -| `options`? | [`ServerOpts`](net.md#serveropts) | - | -| `connectionListener`? | (`socket`: [`Socket`](net.md#socket)) => `void` | Automatically set as a listener for the 'connection' event. | +| `options?` | [`ServerOpts`](#serveropts) | - | +| `connectionListener?` | (`socket`: [`Socket`](#socket)) => `void` | Automatically set as a listener for the 'connection' event. | ##### Returns -[`Server`](net.md#server) +[`Server`](#server) diff --git a/src/reference/modules/llrt/path/index.md b/src/reference/modules/llrt/path/index.md index 1d0c40c..4bcb0af 100644 --- a/src/reference/modules/llrt/path/index.md +++ b/src/reference/modules/llrt/path/index.md @@ -8,22 +8,275 @@ | ------ | ------ | | [export=](namespaces/export=.md) | - | -## Variables +## Interfaces -### export= +### FormatInputPathObject -> **export=**: [`PlatformPath`](namespaces/export=.md#platformpath) +#### Properties -## References +##### base? -### FormatInputPathObject +> `optional` **base**: `string` + +The file name including extension (if any) such as 'index.html' + +##### dir? + +> `optional` **dir**: `string` + +The full directory path such as '/home/user/dir' or 'c:\path\dir' + +##### ext? + +> `optional` **ext**: `string` + +The file extension (if any) such as '.html' + +##### name? + +> `optional` **name**: `string` + +The file name without extension (if any) such as 'index' + +##### root? -Re-exports [FormatInputPathObject](namespaces/export=.md#formatinputpathobject) +> `optional` **root**: `string` + +The root of the path such as '/' or 'c:\' + +*** ### ParsedPath -Re-exports [ParsedPath](namespaces/export=.md#parsedpath) +A parsed path object generated by path.parse() or consumed by path.format(). + +#### Properties + +##### base + +> **base**: `string` + +The file name including extension (if any) such as 'index.html' + +##### dir + +> **dir**: `string` + +The full directory path such as '/home/user/dir' or 'c:\path\dir' + +##### ext + +> **ext**: `string` + +The file extension (if any) such as '.html' + +##### name + +> **name**: `string` + +The file name without extension (if any) such as 'index' + +##### root + +> **root**: `string` + +The root of the path such as '/' or 'c:\' + +*** ### PlatformPath -Re-exports [PlatformPath](namespaces/export=.md#platformpath) +#### Properties + +##### delimiter + +> `readonly` **delimiter**: `";"` \| `":"` + +The platform-specific file delimiter. ';' or ':'. + +##### sep + +> `readonly` **sep**: "\\" \| `"/"` + +The platform-specific file separator. '\\' or '/'. + +#### Methods + +##### basename() + +> **basename**(`path`: `string`, `suffix?`: `string`): `string` + +Return the last portion of a path. Similar to the Unix basename command. +Often used to extract the file name from a fully qualified path. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `path` | `string` | the path to evaluate. | +| `suffix?` | `string` | optionally, an extension to remove from the result. | + +###### Returns + +`string` + +##### dirname() + +> **dirname**(`path`: `string`): `string` + +Return the directory name of a path. Similar to the Unix dirname command. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `path` | `string` | the path to evaluate. | + +###### Returns + +`string` + +##### extname() + +> **extname**(`path`: `string`): `string` + +Return the extension of the path, from the last '.' to end of string in the last portion of the path. +If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `path` | `string` | the path to evaluate. | + +###### Returns + +`string` + +##### format() + +> **format**(`pathObject`: [`FormatInputPathObject`](#formatinputpathobject)): `string` + +Returns a path string from an object - the opposite of parse(). + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `pathObject` | [`FormatInputPathObject`](#formatinputpathobject) | path to evaluate. | + +###### Returns + +`string` + +##### isAbsolute() + +> **isAbsolute**(`path`: `string`): `boolean` + +Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. + +If the given {path} is a zero-length string, `false` will be returned. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `path` | `string` | path to test. | + +###### Returns + +`boolean` + +##### join() + +> **join**(...`paths`: `string`[]): `string` + +Join all arguments together and normalize the resulting path. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| ...`paths` | `string`[] | paths to join. | + +###### Returns + +`string` + +###### Throws + +if any of the path segments is not a string. + +##### normalize() + +> **normalize**(`path`: `string`): `string` + +Normalize a string path, reducing '..' and '.' parts. +When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `path` | `string` | string path to normalize. | + +###### Returns + +`string` + +###### Throws + +if `path` is not a string. + +##### parse() + +> **parse**(`path`: `string`): [`ParsedPath`](#parsedpath) + +Returns an object from a path string - the opposite of format(). + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `path` | `string` | path to evaluate. | + +###### Returns + +[`ParsedPath`](#parsedpath) + +###### Throws + +if `path` is not a string. + +##### resolve() + +> **resolve**(...`paths`: `string`[]): `string` + +The right-most parameter is considered {to}. Other parameters are considered an array of {from}. + +Starting from leftmost {from} parameter, resolves {to} to an absolute path. + +If {to} isn't already absolute, {from} arguments are prepended in right to left order, +until an absolute path is found. If after using all {from} paths still no absolute path is found, +the current working directory is used as well. The resulting path is normalized, +and trailing slashes are removed unless the path gets resolved to the root directory. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| ...`paths` | `string`[] | A sequence of paths or path segments. | + +###### Returns + +`string` + +###### Throws + +if any of the arguments is not a string. + +## Variables + +### export= + +> **export=**: [`PlatformPath`](#platformpath) diff --git a/src/reference/modules/llrt/path/namespaces/export=.md b/src/reference/modules/llrt/path/namespaces/export=.md index 9476124..6415a74 100644 --- a/src/reference/modules/llrt/path/namespaces/export=.md +++ b/src/reference/modules/llrt/path/namespaces/export=.md @@ -2,269 +2,20 @@ # export= -## Interfaces +## References ### FormatInputPathObject -#### Properties - -##### base? - -> `optional` **base**: `string` - -The file name including extension (if any) such as 'index.html' - -##### dir? - -> `optional` **dir**: `string` - -The full directory path such as '/home/user/dir' or 'c:\path\dir' - -##### ext? - -> `optional` **ext**: `string` - -The file extension (if any) such as '.html' - -##### name? - -> `optional` **name**: `string` - -The file name without extension (if any) such as 'index' - -##### root? - -> `optional` **root**: `string` - -The root of the path such as '/' or 'c:\' +Re-exports [FormatInputPathObject](../index.md#formatinputpathobject) *** ### ParsedPath -A parsed path object generated by path.parse() or consumed by path.format(). - -#### Properties - -##### base - -> **base**: `string` - -The file name including extension (if any) such as 'index.html' - -##### dir - -> **dir**: `string` - -The full directory path such as '/home/user/dir' or 'c:\path\dir' - -##### ext - -> **ext**: `string` - -The file extension (if any) such as '.html' - -##### name - -> **name**: `string` - -The file name without extension (if any) such as 'index' - -##### root - -> **root**: `string` - -The root of the path such as '/' or 'c:\' +Re-exports [ParsedPath](../index.md#parsedpath) *** ### PlatformPath -#### Properties - -##### delimiter - -> `readonly` **delimiter**: `";"` \| `":"` - -The platform-specific file delimiter. ';' or ':'. - -##### sep - -> `readonly` **sep**: "\\" \| `"/"` - -The platform-specific file separator. '\\' or '/'. - -#### Methods - -##### basename() - -> **basename**(`path`: `string`, `suffix`?: `string`): `string` - -Return the last portion of a path. Similar to the Unix basename command. -Often used to extract the file name from a fully qualified path. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `path` | `string` | the path to evaluate. | -| `suffix`? | `string` | optionally, an extension to remove from the result. | - -###### Returns - -`string` - -##### dirname() - -> **dirname**(`path`: `string`): `string` - -Return the directory name of a path. Similar to the Unix dirname command. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `path` | `string` | the path to evaluate. | - -###### Returns - -`string` - -##### extname() - -> **extname**(`path`: `string`): `string` - -Return the extension of the path, from the last '.' to end of string in the last portion of the path. -If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `path` | `string` | the path to evaluate. | - -###### Returns - -`string` - -##### format() - -> **format**(`pathObject`: [`FormatInputPathObject`](export=.md#formatinputpathobject)): `string` - -Returns a path string from an object - the opposite of parse(). - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `pathObject` | [`FormatInputPathObject`](export=.md#formatinputpathobject) | path to evaluate. | - -###### Returns - -`string` - -##### isAbsolute() - -> **isAbsolute**(`path`: `string`): `boolean` - -Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. - -If the given {path} is a zero-length string, `false` will be returned. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `path` | `string` | path to test. | - -###### Returns - -`boolean` - -##### join() - -> **join**(...`paths`: `string`[]): `string` - -Join all arguments together and normalize the resulting path. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| ...`paths` | `string`[] | paths to join. | - -###### Returns - -`string` - -###### Throws - -if any of the path segments is not a string. - -##### normalize() - -> **normalize**(`path`: `string`): `string` - -Normalize a string path, reducing '..' and '.' parts. -When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `path` | `string` | string path to normalize. | - -###### Returns - -`string` - -###### Throws - -if `path` is not a string. - -##### parse() - -> **parse**(`path`: `string`): [`ParsedPath`](export=.md#parsedpath) - -Returns an object from a path string - the opposite of format(). - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `path` | `string` | path to evaluate. | - -###### Returns - -[`ParsedPath`](export=.md#parsedpath) - -###### Throws - -if `path` is not a string. - -##### resolve() - -> **resolve**(...`paths`: `string`[]): `string` - -The right-most parameter is considered {to}. Other parameters are considered an array of {from}. - -Starting from leftmost {from} parameter, resolves {to} to an absolute path. - -If {to} isn't already absolute, {from} arguments are prepended in right to left order, -until an absolute path is found. If after using all {from} paths still no absolute path is found, -the current working directory is used as well. The resulting path is normalized, -and trailing slashes are removed unless the path gets resolved to the root directory. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| ...`paths` | `string`[] | A sequence of paths or path segments. | - -###### Returns - -`string` - -###### Throws - -if any of the arguments is not a string. +Re-exports [PlatformPath](../index.md#platformpath) diff --git a/src/reference/modules/llrt/process/index.md b/src/reference/modules/llrt/process/index.md new file mode 100644 index 0000000..b4fa3b9 --- /dev/null +++ b/src/reference/modules/llrt/process/index.md @@ -0,0 +1,15 @@ +[@caido/quickjs-types](../../index.md) / llrt/process + +# llrt/process + +## Modules + +| Module | Description | +| ------ | ------ | +| [process](process.md) | - | + +## References + +### QuickJS + +Re-exports [QuickJS](../globals/namespaces/QuickJS.md) diff --git a/src/reference/modules/llrt/process/process.md b/src/reference/modules/llrt/process/process.md new file mode 100644 index 0000000..4865704 --- /dev/null +++ b/src/reference/modules/llrt/process/process.md @@ -0,0 +1,3 @@ +[@caido/quickjs-types](../../index.md) / [llrt/process](index.md) / process + +# process diff --git a/src/reference/modules/llrt/stream/index.md b/src/reference/modules/llrt/stream/index.md new file mode 100644 index 0000000..e176c4d --- /dev/null +++ b/src/reference/modules/llrt/stream/index.md @@ -0,0 +1,15 @@ +[@caido/quickjs-types](../../index.md) / llrt/stream + +# llrt/stream + +## Modules + +| Module | Description | +| ------ | ------ | +| [stream](stream.md) | - | + +## References + +### QuickJS + +Re-exports [QuickJS](../globals/namespaces/QuickJS.md) diff --git a/src/reference/modules/llrt/stream/stream.md b/src/reference/modules/llrt/stream/stream.md new file mode 100644 index 0000000..8446777 --- /dev/null +++ b/src/reference/modules/llrt/stream/stream.md @@ -0,0 +1,5658 @@ +[@caido/quickjs-types](../../index.md) / [llrt/stream](index.md) / stream + +# stream + +## Classes + +### DefaultDuplexStream + +#### Extends + +- [`DefaultReadableStream`](#defaultreadablestream) + +#### Extended by + +- [`Socket`](../net.md#socket) + +#### Implements + +- [`DefaultWritableStream`](#defaultwritablestream) + +#### Constructors + +##### Constructor + +> **new DefaultDuplexStream**(): [`DefaultDuplexStream`](#defaultduplexstream) + +###### Returns + +[`DefaultDuplexStream`](#defaultduplexstream) + +###### Inherited from + +[`DefaultReadableStream`](#defaultreadablestream).[`constructor`](#constructor-1) + +#### Methods + +##### \[dispose\]() + +> **\[dispose\]**(): `void` + +Calls `readable.destroy()`. + +###### Returns + +`void` + +###### Inherited from + +[`DefaultReadableStream`](#defaultreadablestream).[`[dispose]`](#dispose-2) + +##### addListener() + +###### Call Signature + +> **addListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. error +3. finish + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | +| `listener` | (...`args`: `any`[]) => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`addListener`](#addlistener-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`addListener`](#addlistener-5) + +###### Call Signature + +> **addListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. error +3. finish + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`addListener`](#addlistener-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`addListener`](#addlistener-5) + +###### Call Signature + +> **addListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. error +3. finish + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`addListener`](#addlistener-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`addListener`](#addlistener-5) + +###### Call Signature + +> **addListener**(`event`: `"finish"`, `listener`: () => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. error +3. finish + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`addListener`](#addlistener-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`addListener`](#addlistener-5) + +##### destroy() + +> **destroy**(`error?`: `Error`): `this` + +Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` event. After this call, the readable +stream will release any internal resources and subsequent calls to `push()` will be ignored. + +Once `destroy()` has been called any further calls will be a no-op and no +further errors except from `_destroy()` may be emitted as `'error'`. + +Implementors should not override this method, but instead implement `readable._destroy()`. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `error?` | `Error` | Error which will be passed as payload in `'error'` event | + +###### Returns + +`this` + +###### Inherited from + +[`DefaultReadableStream`](#defaultreadablestream).[`destroy`](#destroy-2) + +##### emit() + +###### Call Signature + +> **emit**(`event`: [`EventKey`](../dom-events.md#eventkey), ...`args`: `any`[]): `boolean` + +Synchronously calls each of the listeners registered for the event named `eventName`, in the order they were registered, passing the supplied arguments +to each. + +```js +import { EventEmitter } from 'events'; +const myEmitter = new EventEmitter(); + +// First listener +myEmitter.on('event', function firstListener() { + console.log('Helloooo! first listener'); +}); +// Second listener +myEmitter.on('event', function secondListener(arg1, arg2) { + console.log(`event with parameters ${arg1}, ${arg2} in second listener`); +}); +// Third listener +myEmitter.on('event', function thirdListener(...args) { + const parameters = args.join(', '); + console.log(`event with parameters ${parameters} in third listener`); +}); + +myEmitter.emit('event', 1, 2, 3, 4, 5); + +// Prints: +// Helloooo! first listener +// event with parameters 1, 2 in second listener +// event with parameters 1, 2, 3, 4, 5 in third listener +``` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | +| ...`args` | `any`[] | + +###### Returns + +`boolean` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`emit`](#emit-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`emit`](#emit-5) + +###### Call Signature + +> **emit**(`event`: `"close"`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | + +###### Returns + +`boolean` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`emit`](#emit-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`emit`](#emit-5) + +###### Call Signature + +> **emit**(`event`: `"error"`, `err`: `Error`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `err` | `Error` | + +###### Returns + +`boolean` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`emit`](#emit-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`emit`](#emit-5) + +###### Call Signature + +> **emit**(`event`: `"finish"`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | + +###### Returns + +`boolean` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`emit`](#emit-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`emit`](#emit-5) + +##### end() + +> **end**(): `this` + +Calling the `writable.end()` method signals that no more data will be written +to the `Writable`. + +Calling the [write](#write) method after calling [end](#end) will raise an error. + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`end`](#end-2) + +##### eventNames() + +> **eventNames**(): [`EventKey`](../dom-events.md#eventkey)[] + +Returns an array listing the events for which the emitter has registered +listeners. The values in the array are strings or `Symbol`s. + +```js +import { EventEmitter } from 'events'; + +const myEE = new EventEmitter(); +myEE.on('foo', () => {}); +myEE.on('bar', () => {}); + +const sym = Symbol('symbol'); +myEE.on(sym, () => {}); + +console.log(myEE.eventNames()); +// Prints: [ 'foo', 'bar', Symbol(symbol) ] +``` + +###### Returns + +[`EventKey`](../dom-events.md#eventkey)[] + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`eventNames`](#eventnames-4) + +###### Inherited from + +[`DefaultReadableStream`](#defaultreadablestream).[`eventNames`](#eventnames-2) + +##### off() + +> **off**\<`K`\>(`eventName`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Alias for `emitter.removeListener()`. + +###### Type Parameters + +| Type Parameter | +| ------ | +| `K` | + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `eventName` | [`EventKey`](../dom-events.md#eventkey) | +| `listener` | (...`args`: `any`[]) => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`off`](#off-4) + +###### Inherited from + +[`DefaultReadableStream`](#defaultreadablestream).[`off`](#off-2) + +##### on() + +###### Call Signature + +> **on**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds the `listener` function to the end of the listeners array for the event +named `eventName`. No checks are made to see if the `listener` has already +been added. Multiple calls passing the same combination of `eventName` and +`listener` will result in the `listener` being added, and called, multiple times. + +```js +server.on('connection', (stream) => { + console.log('someone connected!'); +}); +``` + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +By default, event listeners are invoked in the order they are added. The `emitter.prependListener()` method can be used as an alternative to add the +event listener to the beginning of the listeners array. + +```js +import { EventEmitter } from 'events'; +const myEE = new EventEmitter(); +myEE.on('foo', () => console.log('a')); +myEE.prependListener('foo', () => console.log('b')); +myEE.emit('foo'); +// Prints: +// b +// a +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`on`](#on-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`on`](#on-5) + +###### Call Signature + +> **on**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`on`](#on-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`on`](#on-5) + +###### Call Signature + +> **on**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`on`](#on-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`on`](#on-5) + +###### Call Signature + +> **on**(`event`: `"finish"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`on`](#on-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`on`](#on-5) + +##### once() + +###### Call Signature + +> **once**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds a **one-time** `listener` function for the event named `eventName`. The +next time `eventName` is triggered, this listener is removed and then invoked. + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +By default, event listeners are invoked in the order they are added. The `emitter.prependOnceListener()` method can be used as an alternative to add the +event listener to the beginning of the listeners array. + +```js +import { EventEmitter } from 'events'; +const myEE = new EventEmitter(); +myEE.once('foo', () => console.log('a')); +myEE.prependOnceListener('foo', () => console.log('b')); +myEE.emit('foo'); +// Prints: +// b +// a +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Since + +v0.3.0 + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`once`](#once-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`once`](#once-5) + +###### Call Signature + +> **once**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`once`](#once-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`once`](#once-5) + +###### Call Signature + +> **once**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`once`](#once-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`once`](#once-5) + +###### Call Signature + +> **once**(`event`: `"finish"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`once`](#once-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`once`](#once-5) + +##### prependListener() + +###### Call Signature + +> **prependListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds the `listener` function to the _beginning_ of the listeners array for the +event named `eventName`. No checks are made to see if the `listener` has +already been added. Multiple calls passing the same combination of `eventName` +and `listener` will result in the `listener` being added, and called, multiple times. + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`prependListener`](#prependlistener-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`prependListener`](#prependlistener-5) + +###### Call Signature + +> **prependListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`prependListener`](#prependlistener-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`prependListener`](#prependlistener-5) + +###### Call Signature + +> **prependListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`prependListener`](#prependlistener-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`prependListener`](#prependlistener-5) + +###### Call Signature + +> **prependListener**(`event`: `"finish"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`prependListener`](#prependlistener-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`prependListener`](#prependlistener-5) + +##### prependOnceListener() + +###### Call Signature + +> **prependOnceListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. +The next time `eventName` is triggered, this listener is removed, and then invoked. + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`prependOnceListener`](#prependoncelistener-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`prependOnceListener`](#prependoncelistener-5) + +###### Call Signature + +> **prependOnceListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`prependOnceListener`](#prependoncelistener-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`prependOnceListener`](#prependoncelistener-5) + +###### Call Signature + +> **prependOnceListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`prependOnceListener`](#prependoncelistener-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`prependOnceListener`](#prependoncelistener-5) + +###### Call Signature + +> **prependOnceListener**(`event`: `"finish"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`prependOnceListener`](#prependoncelistener-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`prependOnceListener`](#prependoncelistener-5) + +##### read() + +> **read**(`size?`: `number`): [`Buffer`](../buffer.md#buffer) \| `null` + +The `readable.read()` method reads data out of the internal buffer and +returns it. If no data is available to be read, `null` is returned. By default, +the data is returned as a `Buffer` object unless an encoding has been +specified using the `readable.setEncoding()` method or the stream is operating +in object mode. + +The optional `size` argument specifies a specific number of bytes to read. If +`size` bytes are not available to be read, `null` will be returned _unless_ the +stream has ended, in which case all of the data remaining in the internal buffer +will be returned. + +If the `size` argument is not specified, all of the data contained in the +internal buffer will be returned. + +The `size` argument must be less than or equal to 1 GiB. + +The `readable.read()` method should only be called on `Readable` streams +operating in paused mode. In flowing mode, `readable.read()` is called +automatically until the internal buffer is fully drained. + +```js +const readable = getReadableStreamSomehow(); + +// 'readable' may be triggered multiple times as data is buffered in +readable.on('readable', () => { + let chunk; + console.log('Stream is readable (new data received in buffer)'); + // Use a loop to make sure we read all currently available data + while (null !== (chunk = readable.read())) { + console.log(`Read ${chunk.length} bytes of data...`); + } +}); + +// 'end' will be triggered once when there is no more data available +readable.on('end', () => { + console.log('Reached end of stream.'); +}); +``` + +Each call to `readable.read()` returns a chunk of data, or `null`. The chunks +are not concatenated. A `while` loop is necessary to consume all data +currently in the buffer. When reading a large file `.read()` may return `null`, +having consumed all buffered content so far, but there is still more data to +come not yet buffered. In this case a new `'readable'` event will be emitted +when there is more data in the buffer. Finally the `'end'` event will be +emitted when there is no more data to come. + +Therefore to read a file's whole contents from a `readable`, it is necessary +to collect chunks across multiple `'readable'` events: + +```js +const chunks = []; + +readable.on('readable', () => { + let chunk; + while (null !== (chunk = readable.read())) { + chunks.push(chunk); + } +}); + +readable.on('end', () => { + const content = chunks.join(''); +}); +``` + +A `Readable` stream in object mode will always return a single item from +a call to `readable.read(size)`, regardless of the value of the `size` argument. + +If the `readable.read()` method returns a chunk of data, a `'data'` event will +also be emitted. + +Calling [read](#read-4) after the `'end'` event has +been emitted will return `null`. No runtime error will be raised. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `size?` | `number` | Optional argument to specify how much data to read. | + +###### Returns + +[`Buffer`](../buffer.md#buffer) \| `null` + +###### Inherited from + +[`DefaultReadableStream`](#defaultreadablestream).[`read`](#read-2) + +##### removeListener() + +###### Call Signature + +> **removeListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Removes the specified `listener` from the listener array for the event named `eventName`. + +`removeListener()` will remove, at most, one instance of a listener from the +listener array. If any single listener has been added multiple times to the +listener array for the specified `eventName`, then `removeListener()` must be +called multiple times to remove each instance. + +Once an event is emitted, all listeners attached to it at the time of emitting are called in order. +This implies that any `removeListener()` calls _after_ emitting and _before_ the last listener finishes execution +will not remove them from `emit()` in progress. Subsequent events behave as expected. + +```js +import { EventEmitter } from 'events'; +class MyEmitter extends EventEmitter {} +const myEmitter = new MyEmitter(); + +const callbackA = () => { + console.log('A'); + myEmitter.removeListener('event', callbackB); +}; + +const callbackB = () => { + console.log('B'); +}; + +myEmitter.on('event', callbackA); + +myEmitter.on('event', callbackB); + +// callbackA removes listener callbackB but it will still be called. +// Internal listener array at time of emit [callbackA, callbackB] +myEmitter.emit('event'); +// Prints: +// A +// B + +// callbackB is now removed. +// Internal listener array [callbackA] +myEmitter.emit('event'); +// Prints: +// A +``` + +Because listeners are managed using an internal array, calling this will +change the position indices of any listener registered _after_ the listener +being removed. This will not impact the order in which listeners are called, +but it means that any copies of the listener array as returned by +the `emitter.listeners()` method will need to be recreated. + +When a single function has been added as a handler multiple times for a single +event (as in the example below), `removeListener()` will remove the most +recently added instance. In the example the `once('ping')` listener is removed: + +```js +import { EventEmitter } from 'events'; +const ee = new EventEmitter(); + +function pong() { + console.log('pong'); +} + +ee.on('ping', pong); +ee.once('ping', pong); +ee.removeListener('ping', pong); + +ee.emit('ping'); +ee.emit('ping'); +``` + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | +| `listener` | (...`args`: `any`[]) => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`removeListener`](#removelistener-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`removeListener`](#removelistener-5) + +###### Call Signature + +> **removeListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`removeListener`](#removelistener-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`removeListener`](#removelistener-5) + +###### Call Signature + +> **removeListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`removeListener`](#removelistener-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`removeListener`](#removelistener-5) + +###### Call Signature + +> **removeListener**(`event`: `"finish"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`removeListener`](#removelistener-12) + +###### Overrides + +[`DefaultReadableStream`](#defaultreadablestream).[`removeListener`](#removelistener-5) + +##### write() + +> **write**(`chunk`: `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](../globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](../buffer.md#buffer), `callback?`: (`error?`: `Error` \| `null`) => `void`): `void` + +The `writable.write()` method writes some data to the stream, and calls the +supplied `callback` once the data has been fully handled. If an error +occurs, the `callback` will be called with the error as its +first argument. The `callback` is usually called asynchronously and before `'error'` +is emitted. + +```js +function write(data, cb) { + if (!stream.write(data)) { + stream.once('drain', cb); + } else { + process.nextTick(cb); + } +} + +// Wait for cb to be called before doing any other write. +write('hello', () => { + console.log('Write completed, do more writes now.'); +}); +``` + +A `Writable` stream in object mode will always ignore the `encoding` argument. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `chunk` | `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](../globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](../buffer.md#buffer) | Optional data to write. `chunk` must be a {string}, {Buffer}, {TypedArray} or {DataView}. | +| `callback?` | (`error?`: `Error` \| `null`) => `void` | Callback for when this chunk of data is flushed. | + +###### Returns + +`void` + +`false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + +###### Since + +v0.9.4 + +###### Implementation of + +[`DefaultWritableStream`](#defaultwritablestream).[`write`](#write-2) + +*** + +### DefaultReadableStream + +#### Extends + +- [`ReadableStreamInner`](#readablestreaminner) + +#### Extended by + +- [`DefaultDuplexStream`](#defaultduplexstream) + +#### Constructors + +##### Constructor + +> **new DefaultReadableStream**(): [`DefaultReadableStream`](#defaultreadablestream) + +###### Returns + +[`DefaultReadableStream`](#defaultreadablestream) + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`constructor`](#constructor-3) + +#### Methods + +##### \[dispose\]() + +> **\[dispose\]**(): `void` + +Calls `readable.destroy()`. + +###### Returns + +`void` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`[dispose]`](#dispose-4) + +##### addListener() + +###### Call Signature + +> **addListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. data +3. end +4. error +5. readable + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | +| `listener` | (...`args`: `any`[]) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`addListener`](#addlistener-17) + +###### Call Signature + +> **addListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. data +3. end +4. error +5. readable + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`addListener`](#addlistener-17) + +###### Call Signature + +> **addListener**(`event`: `"data"`, `listener`: (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. data +3. end +4. error +5. readable + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"data"` | +| `listener` | (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`addListener`](#addlistener-17) + +###### Call Signature + +> **addListener**(`event`: `"end"`, `listener`: () => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. data +3. end +4. error +5. readable + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"end"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`addListener`](#addlistener-17) + +###### Call Signature + +> **addListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. data +3. end +4. error +5. readable + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`addListener`](#addlistener-17) + +###### Call Signature + +> **addListener**(`event`: `"readable"`, `listener`: () => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. data +3. end +4. error +5. readable + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"readable"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`addListener`](#addlistener-17) + +##### destroy() + +> **destroy**(`error?`: `Error`): `this` + +Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` event. After this call, the readable +stream will release any internal resources and subsequent calls to `push()` will be ignored. + +Once `destroy()` has been called any further calls will be a no-op and no +further errors except from `_destroy()` may be emitted as `'error'`. + +Implementors should not override this method, but instead implement `readable._destroy()`. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `error?` | `Error` | Error which will be passed as payload in `'error'` event | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`destroy`](#destroy-4) + +##### emit() + +###### Call Signature + +> **emit**(`event`: [`EventKey`](../dom-events.md#eventkey), ...`args`: `any`[]): `boolean` + +Synchronously calls each of the listeners registered for the event named `eventName`, in the order they were registered, passing the supplied arguments +to each. + +```js +import { EventEmitter } from 'events'; +const myEmitter = new EventEmitter(); + +// First listener +myEmitter.on('event', function firstListener() { + console.log('Helloooo! first listener'); +}); +// Second listener +myEmitter.on('event', function secondListener(arg1, arg2) { + console.log(`event with parameters ${arg1}, ${arg2} in second listener`); +}); +// Third listener +myEmitter.on('event', function thirdListener(...args) { + const parameters = args.join(', '); + console.log(`event with parameters ${parameters} in third listener`); +}); + +myEmitter.emit('event', 1, 2, 3, 4, 5); + +// Prints: +// Helloooo! first listener +// event with parameters 1, 2 in second listener +// event with parameters 1, 2, 3, 4, 5 in third listener +``` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | +| ...`args` | `any`[] | + +###### Returns + +`boolean` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`emit`](#emit-17) + +###### Call Signature + +> **emit**(`event`: `"close"`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | + +###### Returns + +`boolean` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`emit`](#emit-17) + +###### Call Signature + +> **emit**(`event`: `"data"`, `chunk`: [`Buffer`](../buffer.md#buffer)): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"data"` | +| `chunk` | [`Buffer`](../buffer.md#buffer) | + +###### Returns + +`boolean` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`emit`](#emit-17) + +###### Call Signature + +> **emit**(`event`: `"end"`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"end"` | + +###### Returns + +`boolean` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`emit`](#emit-17) + +###### Call Signature + +> **emit**(`event`: `"error"`, `err`: `Error`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `err` | `Error` | + +###### Returns + +`boolean` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`emit`](#emit-17) + +###### Call Signature + +> **emit**(`event`: `"readable"`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"readable"` | + +###### Returns + +`boolean` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`emit`](#emit-17) + +##### eventNames() + +> **eventNames**(): [`EventKey`](../dom-events.md#eventkey)[] + +Returns an array listing the events for which the emitter has registered +listeners. The values in the array are strings or `Symbol`s. + +```js +import { EventEmitter } from 'events'; + +const myEE = new EventEmitter(); +myEE.on('foo', () => {}); +myEE.on('bar', () => {}); + +const sym = Symbol('symbol'); +myEE.on(sym, () => {}); + +console.log(myEE.eventNames()); +// Prints: [ 'foo', 'bar', Symbol(symbol) ] +``` + +###### Returns + +[`EventKey`](../dom-events.md#eventkey)[] + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`eventNames`](#eventnames-6) + +##### off() + +> **off**\<`K`\>(`eventName`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Alias for `emitter.removeListener()`. + +###### Type Parameters + +| Type Parameter | +| ------ | +| `K` | + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `eventName` | [`EventKey`](../dom-events.md#eventkey) | +| `listener` | (...`args`: `any`[]) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`off`](#off-6) + +##### on() + +###### Call Signature + +> **on**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds the `listener` function to the end of the listeners array for the event +named `eventName`. No checks are made to see if the `listener` has already +been added. Multiple calls passing the same combination of `eventName` and +`listener` will result in the `listener` being added, and called, multiple times. + +```js +server.on('connection', (stream) => { + console.log('someone connected!'); +}); +``` + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +By default, event listeners are invoked in the order they are added. The `emitter.prependListener()` method can be used as an alternative to add the +event listener to the beginning of the listeners array. + +```js +import { EventEmitter } from 'events'; +const myEE = new EventEmitter(); +myEE.on('foo', () => console.log('a')); +myEE.prependListener('foo', () => console.log('b')); +myEE.emit('foo'); +// Prints: +// b +// a +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`on`](#on-17) + +###### Call Signature + +> **on**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`on`](#on-17) + +###### Call Signature + +> **on**(`event`: `"data"`, `listener`: (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"data"` | +| `listener` | (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`on`](#on-17) + +###### Call Signature + +> **on**(`event`: `"end"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"end"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`on`](#on-17) + +###### Call Signature + +> **on**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`on`](#on-17) + +###### Call Signature + +> **on**(`event`: `"readable"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"readable"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`on`](#on-17) + +##### once() + +###### Call Signature + +> **once**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds a **one-time** `listener` function for the event named `eventName`. The +next time `eventName` is triggered, this listener is removed and then invoked. + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +By default, event listeners are invoked in the order they are added. The `emitter.prependOnceListener()` method can be used as an alternative to add the +event listener to the beginning of the listeners array. + +```js +import { EventEmitter } from 'events'; +const myEE = new EventEmitter(); +myEE.once('foo', () => console.log('a')); +myEE.prependOnceListener('foo', () => console.log('b')); +myEE.emit('foo'); +// Prints: +// b +// a +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Since + +v0.3.0 + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`once`](#once-17) + +###### Call Signature + +> **once**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`once`](#once-17) + +###### Call Signature + +> **once**(`event`: `"data"`, `listener`: (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"data"` | +| `listener` | (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`once`](#once-17) + +###### Call Signature + +> **once**(`event`: `"end"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"end"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`once`](#once-17) + +###### Call Signature + +> **once**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`once`](#once-17) + +###### Call Signature + +> **once**(`event`: `"readable"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"readable"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`once`](#once-17) + +##### prependListener() + +###### Call Signature + +> **prependListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds the `listener` function to the _beginning_ of the listeners array for the +event named `eventName`. No checks are made to see if the `listener` has +already been added. Multiple calls passing the same combination of `eventName` +and `listener` will result in the `listener` being added, and called, multiple times. + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`prependListener`](#prependlistener-17) + +###### Call Signature + +> **prependListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`prependListener`](#prependlistener-17) + +###### Call Signature + +> **prependListener**(`event`: `"data"`, `listener`: (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"data"` | +| `listener` | (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`prependListener`](#prependlistener-17) + +###### Call Signature + +> **prependListener**(`event`: `"end"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"end"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`prependListener`](#prependlistener-17) + +###### Call Signature + +> **prependListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`prependListener`](#prependlistener-17) + +###### Call Signature + +> **prependListener**(`event`: `"readable"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"readable"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`prependListener`](#prependlistener-17) + +##### prependOnceListener() + +###### Call Signature + +> **prependOnceListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. +The next time `eventName` is triggered, this listener is removed, and then invoked. + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`prependOnceListener`](#prependoncelistener-17) + +###### Call Signature + +> **prependOnceListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`prependOnceListener`](#prependoncelistener-17) + +###### Call Signature + +> **prependOnceListener**(`event`: `"data"`, `listener`: (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"data"` | +| `listener` | (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`prependOnceListener`](#prependoncelistener-17) + +###### Call Signature + +> **prependOnceListener**(`event`: `"end"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"end"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`prependOnceListener`](#prependoncelistener-17) + +###### Call Signature + +> **prependOnceListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`prependOnceListener`](#prependoncelistener-17) + +###### Call Signature + +> **prependOnceListener**(`event`: `"readable"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"readable"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`prependOnceListener`](#prependoncelistener-17) + +##### read() + +> **read**(`size?`: `number`): [`Buffer`](../buffer.md#buffer) \| `null` + +The `readable.read()` method reads data out of the internal buffer and +returns it. If no data is available to be read, `null` is returned. By default, +the data is returned as a `Buffer` object unless an encoding has been +specified using the `readable.setEncoding()` method or the stream is operating +in object mode. + +The optional `size` argument specifies a specific number of bytes to read. If +`size` bytes are not available to be read, `null` will be returned _unless_ the +stream has ended, in which case all of the data remaining in the internal buffer +will be returned. + +If the `size` argument is not specified, all of the data contained in the +internal buffer will be returned. + +The `size` argument must be less than or equal to 1 GiB. + +The `readable.read()` method should only be called on `Readable` streams +operating in paused mode. In flowing mode, `readable.read()` is called +automatically until the internal buffer is fully drained. + +```js +const readable = getReadableStreamSomehow(); + +// 'readable' may be triggered multiple times as data is buffered in +readable.on('readable', () => { + let chunk; + console.log('Stream is readable (new data received in buffer)'); + // Use a loop to make sure we read all currently available data + while (null !== (chunk = readable.read())) { + console.log(`Read ${chunk.length} bytes of data...`); + } +}); + +// 'end' will be triggered once when there is no more data available +readable.on('end', () => { + console.log('Reached end of stream.'); +}); +``` + +Each call to `readable.read()` returns a chunk of data, or `null`. The chunks +are not concatenated. A `while` loop is necessary to consume all data +currently in the buffer. When reading a large file `.read()` may return `null`, +having consumed all buffered content so far, but there is still more data to +come not yet buffered. In this case a new `'readable'` event will be emitted +when there is more data in the buffer. Finally the `'end'` event will be +emitted when there is no more data to come. + +Therefore to read a file's whole contents from a `readable`, it is necessary +to collect chunks across multiple `'readable'` events: + +```js +const chunks = []; + +readable.on('readable', () => { + let chunk; + while (null !== (chunk = readable.read())) { + chunks.push(chunk); + } +}); + +readable.on('end', () => { + const content = chunks.join(''); +}); +``` + +A `Readable` stream in object mode will always return a single item from +a call to `readable.read(size)`, regardless of the value of the `size` argument. + +If the `readable.read()` method returns a chunk of data, a `'data'` event will +also be emitted. + +Calling [read](#read-4) after the `'end'` event has +been emitted will return `null`. No runtime error will be raised. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `size?` | `number` | Optional argument to specify how much data to read. | + +###### Returns + +[`Buffer`](../buffer.md#buffer) \| `null` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`read`](#read-4) + +##### removeListener() + +###### Call Signature + +> **removeListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Removes the specified `listener` from the listener array for the event named `eventName`. + +`removeListener()` will remove, at most, one instance of a listener from the +listener array. If any single listener has been added multiple times to the +listener array for the specified `eventName`, then `removeListener()` must be +called multiple times to remove each instance. + +Once an event is emitted, all listeners attached to it at the time of emitting are called in order. +This implies that any `removeListener()` calls _after_ emitting and _before_ the last listener finishes execution +will not remove them from `emit()` in progress. Subsequent events behave as expected. + +```js +import { EventEmitter } from 'events'; +class MyEmitter extends EventEmitter {} +const myEmitter = new MyEmitter(); + +const callbackA = () => { + console.log('A'); + myEmitter.removeListener('event', callbackB); +}; + +const callbackB = () => { + console.log('B'); +}; + +myEmitter.on('event', callbackA); + +myEmitter.on('event', callbackB); + +// callbackA removes listener callbackB but it will still be called. +// Internal listener array at time of emit [callbackA, callbackB] +myEmitter.emit('event'); +// Prints: +// A +// B + +// callbackB is now removed. +// Internal listener array [callbackA] +myEmitter.emit('event'); +// Prints: +// A +``` + +Because listeners are managed using an internal array, calling this will +change the position indices of any listener registered _after_ the listener +being removed. This will not impact the order in which listeners are called, +but it means that any copies of the listener array as returned by +the `emitter.listeners()` method will need to be recreated. + +When a single function has been added as a handler multiple times for a single +event (as in the example below), `removeListener()` will remove the most +recently added instance. In the example the `once('ping')` listener is removed: + +```js +import { EventEmitter } from 'events'; +const ee = new EventEmitter(); + +function pong() { + console.log('pong'); +} + +ee.on('ping', pong); +ee.once('ping', pong); +ee.removeListener('ping', pong); + +ee.emit('ping'); +ee.emit('ping'); +``` + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | +| `listener` | (...`args`: `any`[]) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`removeListener`](#removelistener-17) + +###### Call Signature + +> **removeListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`removeListener`](#removelistener-17) + +###### Call Signature + +> **removeListener**(`event`: `"data"`, `listener`: (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"data"` | +| `listener` | (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`removeListener`](#removelistener-17) + +###### Call Signature + +> **removeListener**(`event`: `"end"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"end"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`removeListener`](#removelistener-17) + +###### Call Signature + +> **removeListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`removeListener`](#removelistener-17) + +###### Call Signature + +> **removeListener**(`event`: `"readable"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"readable"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`ReadableStreamInner`](#readablestreaminner).[`removeListener`](#removelistener-17) + +*** + +### DefaultWritableStream + +#### Extends + +- [`WritableStreamInner`](#writablestreaminner) + +#### Constructors + +##### Constructor + +> **new DefaultWritableStream**(): [`DefaultWritableStream`](#defaultwritablestream) + +###### Returns + +[`DefaultWritableStream`](#defaultwritablestream) + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`constructor`](#constructor-4) + +#### Methods + +##### addListener() + +###### Call Signature + +> **addListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. error +3. finish + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | +| `listener` | (...`args`: `any`[]) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`addListener`](#addlistener-24) + +###### Call Signature + +> **addListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. error +3. finish + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`addListener`](#addlistener-24) + +###### Call Signature + +> **addListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. error +3. finish + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`addListener`](#addlistener-24) + +###### Call Signature + +> **addListener**(`event`: `"finish"`, `listener`: () => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. error +3. finish + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`addListener`](#addlistener-24) + +##### emit() + +###### Call Signature + +> **emit**(`event`: [`EventKey`](../dom-events.md#eventkey), ...`args`: `any`[]): `boolean` + +Synchronously calls each of the listeners registered for the event named `eventName`, in the order they were registered, passing the supplied arguments +to each. + +```js +import { EventEmitter } from 'events'; +const myEmitter = new EventEmitter(); + +// First listener +myEmitter.on('event', function firstListener() { + console.log('Helloooo! first listener'); +}); +// Second listener +myEmitter.on('event', function secondListener(arg1, arg2) { + console.log(`event with parameters ${arg1}, ${arg2} in second listener`); +}); +// Third listener +myEmitter.on('event', function thirdListener(...args) { + const parameters = args.join(', '); + console.log(`event with parameters ${parameters} in third listener`); +}); + +myEmitter.emit('event', 1, 2, 3, 4, 5); + +// Prints: +// Helloooo! first listener +// event with parameters 1, 2 in second listener +// event with parameters 1, 2, 3, 4, 5 in third listener +``` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | +| ...`args` | `any`[] | + +###### Returns + +`boolean` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`emit`](#emit-24) + +###### Call Signature + +> **emit**(`event`: `"close"`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | + +###### Returns + +`boolean` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`emit`](#emit-24) + +###### Call Signature + +> **emit**(`event`: `"error"`, `err`: `Error`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `err` | `Error` | + +###### Returns + +`boolean` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`emit`](#emit-24) + +###### Call Signature + +> **emit**(`event`: `"finish"`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | + +###### Returns + +`boolean` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`emit`](#emit-24) + +##### end() + +> **end**(): `this` + +Calling the `writable.end()` method signals that no more data will be written +to the `Writable`. + +Calling the [write](#write-4) method after calling [end](#end-4) will raise an error. + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`end`](#end-4) + +##### eventNames() + +> **eventNames**(): [`EventKey`](../dom-events.md#eventkey)[] + +Returns an array listing the events for which the emitter has registered +listeners. The values in the array are strings or `Symbol`s. + +```js +import { EventEmitter } from 'events'; + +const myEE = new EventEmitter(); +myEE.on('foo', () => {}); +myEE.on('bar', () => {}); + +const sym = Symbol('symbol'); +myEE.on(sym, () => {}); + +console.log(myEE.eventNames()); +// Prints: [ 'foo', 'bar', Symbol(symbol) ] +``` + +###### Returns + +[`EventKey`](../dom-events.md#eventkey)[] + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`eventNames`](#eventnames-8) + +##### off() + +> **off**\<`K`\>(`eventName`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Alias for `emitter.removeListener()`. + +###### Type Parameters + +| Type Parameter | +| ------ | +| `K` | + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `eventName` | [`EventKey`](../dom-events.md#eventkey) | +| `listener` | (...`args`: `any`[]) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`off`](#off-8) + +##### on() + +###### Call Signature + +> **on**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds the `listener` function to the end of the listeners array for the event +named `eventName`. No checks are made to see if the `listener` has already +been added. Multiple calls passing the same combination of `eventName` and +`listener` will result in the `listener` being added, and called, multiple times. + +```js +server.on('connection', (stream) => { + console.log('someone connected!'); +}); +``` + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +By default, event listeners are invoked in the order they are added. The `emitter.prependListener()` method can be used as an alternative to add the +event listener to the beginning of the listeners array. + +```js +import { EventEmitter } from 'events'; +const myEE = new EventEmitter(); +myEE.on('foo', () => console.log('a')); +myEE.prependListener('foo', () => console.log('b')); +myEE.emit('foo'); +// Prints: +// b +// a +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`on`](#on-24) + +###### Call Signature + +> **on**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`on`](#on-24) + +###### Call Signature + +> **on**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`on`](#on-24) + +###### Call Signature + +> **on**(`event`: `"finish"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`on`](#on-24) + +##### once() + +###### Call Signature + +> **once**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds a **one-time** `listener` function for the event named `eventName`. The +next time `eventName` is triggered, this listener is removed and then invoked. + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +By default, event listeners are invoked in the order they are added. The `emitter.prependOnceListener()` method can be used as an alternative to add the +event listener to the beginning of the listeners array. + +```js +import { EventEmitter } from 'events'; +const myEE = new EventEmitter(); +myEE.once('foo', () => console.log('a')); +myEE.prependOnceListener('foo', () => console.log('b')); +myEE.emit('foo'); +// Prints: +// b +// a +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Since + +v0.3.0 + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`once`](#once-24) + +###### Call Signature + +> **once**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`once`](#once-24) + +###### Call Signature + +> **once**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`once`](#once-24) + +###### Call Signature + +> **once**(`event`: `"finish"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`once`](#once-24) + +##### prependListener() + +###### Call Signature + +> **prependListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds the `listener` function to the _beginning_ of the listeners array for the +event named `eventName`. No checks are made to see if the `listener` has +already been added. Multiple calls passing the same combination of `eventName` +and `listener` will result in the `listener` being added, and called, multiple times. + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`prependListener`](#prependlistener-24) + +###### Call Signature + +> **prependListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`prependListener`](#prependlistener-24) + +###### Call Signature + +> **prependListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`prependListener`](#prependlistener-24) + +###### Call Signature + +> **prependListener**(`event`: `"finish"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`prependListener`](#prependlistener-24) + +##### prependOnceListener() + +###### Call Signature + +> **prependOnceListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. +The next time `eventName` is triggered, this listener is removed, and then invoked. + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`prependOnceListener`](#prependoncelistener-24) + +###### Call Signature + +> **prependOnceListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`prependOnceListener`](#prependoncelistener-24) + +###### Call Signature + +> **prependOnceListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`prependOnceListener`](#prependoncelistener-24) + +###### Call Signature + +> **prependOnceListener**(`event`: `"finish"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`prependOnceListener`](#prependoncelistener-24) + +##### removeListener() + +###### Call Signature + +> **removeListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Removes the specified `listener` from the listener array for the event named `eventName`. + +`removeListener()` will remove, at most, one instance of a listener from the +listener array. If any single listener has been added multiple times to the +listener array for the specified `eventName`, then `removeListener()` must be +called multiple times to remove each instance. + +Once an event is emitted, all listeners attached to it at the time of emitting are called in order. +This implies that any `removeListener()` calls _after_ emitting and _before_ the last listener finishes execution +will not remove them from `emit()` in progress. Subsequent events behave as expected. + +```js +import { EventEmitter } from 'events'; +class MyEmitter extends EventEmitter {} +const myEmitter = new MyEmitter(); + +const callbackA = () => { + console.log('A'); + myEmitter.removeListener('event', callbackB); +}; + +const callbackB = () => { + console.log('B'); +}; + +myEmitter.on('event', callbackA); + +myEmitter.on('event', callbackB); + +// callbackA removes listener callbackB but it will still be called. +// Internal listener array at time of emit [callbackA, callbackB] +myEmitter.emit('event'); +// Prints: +// A +// B + +// callbackB is now removed. +// Internal listener array [callbackA] +myEmitter.emit('event'); +// Prints: +// A +``` + +Because listeners are managed using an internal array, calling this will +change the position indices of any listener registered _after_ the listener +being removed. This will not impact the order in which listeners are called, +but it means that any copies of the listener array as returned by +the `emitter.listeners()` method will need to be recreated. + +When a single function has been added as a handler multiple times for a single +event (as in the example below), `removeListener()` will remove the most +recently added instance. In the example the `once('ping')` listener is removed: + +```js +import { EventEmitter } from 'events'; +const ee = new EventEmitter(); + +function pong() { + console.log('pong'); +} + +ee.on('ping', pong); +ee.once('ping', pong); +ee.removeListener('ping', pong); + +ee.emit('ping'); +ee.emit('ping'); +``` + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | +| `listener` | (...`args`: `any`[]) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`removeListener`](#removelistener-24) + +###### Call Signature + +> **removeListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`removeListener`](#removelistener-24) + +###### Call Signature + +> **removeListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`removeListener`](#removelistener-24) + +###### Call Signature + +> **removeListener**(`event`: `"finish"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`removeListener`](#removelistener-24) + +##### write() + +> **write**(`chunk`: `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](../globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](../buffer.md#buffer), `callback?`: (`error?`: `Error` \| `null`) => `void`): `void` + +The `writable.write()` method writes some data to the stream, and calls the +supplied `callback` once the data has been fully handled. If an error +occurs, the `callback` will be called with the error as its +first argument. The `callback` is usually called asynchronously and before `'error'` +is emitted. + +```js +function write(data, cb) { + if (!stream.write(data)) { + stream.once('drain', cb); + } else { + process.nextTick(cb); + } +} + +// Wait for cb to be called before doing any other write. +write('hello', () => { + console.log('Write completed, do more writes now.'); +}); +``` + +A `Writable` stream in object mode will always ignore the `encoding` argument. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `chunk` | `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](../globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](../buffer.md#buffer) | Optional data to write. `chunk` must be a {string}, {Buffer}, {TypedArray} or {DataView}. | +| `callback?` | (`error?`: `Error` \| `null`) => `void` | Callback for when this chunk of data is flushed. | + +###### Returns + +`void` + +`false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + +###### Since + +v0.9.4 + +###### Inherited from + +[`WritableStreamInner`](#writablestreaminner).[`write`](#write-4) + +*** + +### ReadableStreamInner + +#### Extends + +- [`EventEmitter`](../globals/index.md#eventemitter) + +#### Extended by + +- [`DefaultReadableStream`](#defaultreadablestream) + +#### Implements + +- [`ReadableStream`](../globals/namespaces/QuickJS.md#readablestream) + +#### Constructors + +##### Constructor + +> **new ReadableStreamInner**(): [`ReadableStreamInner`](#readablestreaminner) + +###### Returns + +[`ReadableStreamInner`](#readablestreaminner) + +###### Inherited from + +[`EventEmitter`](../globals/index.md#eventemitter).[`constructor`](../globals/index.md#constructor) + +#### Methods + +##### \[dispose\]() + +> **\[dispose\]**(): `void` + +Calls `readable.destroy()`. + +###### Returns + +`void` + +##### addListener() + +###### Call Signature + +> **addListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. data +3. end +4. error +5. readable + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | +| `listener` | (...`args`: `any`[]) => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`ReadableStream`](../globals/namespaces/QuickJS.md#readablestream).[`addListener`](../globals/namespaces/QuickJS.md#addlistener) + +###### Overrides + +[`EventEmitter`](../globals/index.md#eventemitter).[`addListener`](../globals/index.md#addlistener) + +###### Call Signature + +> **addListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. data +3. end +4. error +5. readable + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.addListener` + +###### Overrides + +`EventEmitter.addListener` + +###### Call Signature + +> **addListener**(`event`: `"data"`, `listener`: (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. data +3. end +4. error +5. readable + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"data"` | +| `listener` | (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.addListener` + +###### Overrides + +`EventEmitter.addListener` + +###### Call Signature + +> **addListener**(`event`: `"end"`, `listener`: () => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. data +3. end +4. error +5. readable + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"end"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.addListener` + +###### Overrides + +`EventEmitter.addListener` + +###### Call Signature + +> **addListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. data +3. end +4. error +5. readable + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.addListener` + +###### Overrides + +`EventEmitter.addListener` + +###### Call Signature + +> **addListener**(`event`: `"readable"`, `listener`: () => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. data +3. end +4. error +5. readable + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"readable"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.addListener` + +###### Overrides + +`EventEmitter.addListener` + +##### destroy() + +> **destroy**(`error?`: `Error`): `this` + +Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` event. After this call, the readable +stream will release any internal resources and subsequent calls to `push()` will be ignored. + +Once `destroy()` has been called any further calls will be a no-op and no +further errors except from `_destroy()` may be emitted as `'error'`. + +Implementors should not override this method, but instead implement `readable._destroy()`. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `error?` | `Error` | Error which will be passed as payload in `'error'` event | + +###### Returns + +`this` + +##### emit() + +###### Call Signature + +> **emit**(`event`: [`EventKey`](../dom-events.md#eventkey), ...`args`: `any`[]): `boolean` + +Synchronously calls each of the listeners registered for the event named `eventName`, in the order they were registered, passing the supplied arguments +to each. + +```js +import { EventEmitter } from 'events'; +const myEmitter = new EventEmitter(); + +// First listener +myEmitter.on('event', function firstListener() { + console.log('Helloooo! first listener'); +}); +// Second listener +myEmitter.on('event', function secondListener(arg1, arg2) { + console.log(`event with parameters ${arg1}, ${arg2} in second listener`); +}); +// Third listener +myEmitter.on('event', function thirdListener(...args) { + const parameters = args.join(', '); + console.log(`event with parameters ${parameters} in third listener`); +}); + +myEmitter.emit('event', 1, 2, 3, 4, 5); + +// Prints: +// Helloooo! first listener +// event with parameters 1, 2 in second listener +// event with parameters 1, 2, 3, 4, 5 in third listener +``` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | +| ...`args` | `any`[] | + +###### Returns + +`boolean` + +###### Implementation of + +[`ReadableStream`](../globals/namespaces/QuickJS.md#readablestream).[`emit`](../globals/namespaces/QuickJS.md#emit) + +###### Overrides + +[`EventEmitter`](../globals/index.md#eventemitter).[`emit`](../globals/index.md#emit) + +###### Call Signature + +> **emit**(`event`: `"close"`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | + +###### Returns + +`boolean` + +###### Implementation of + +`QuickJS.ReadableStream.emit` + +###### Overrides + +`EventEmitter.emit` + +###### Call Signature + +> **emit**(`event`: `"data"`, `chunk`: [`Buffer`](../buffer.md#buffer)): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"data"` | +| `chunk` | [`Buffer`](../buffer.md#buffer) | + +###### Returns + +`boolean` + +###### Implementation of + +`QuickJS.ReadableStream.emit` + +###### Overrides + +`EventEmitter.emit` + +###### Call Signature + +> **emit**(`event`: `"end"`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"end"` | + +###### Returns + +`boolean` + +###### Implementation of + +`QuickJS.ReadableStream.emit` + +###### Overrides + +`EventEmitter.emit` + +###### Call Signature + +> **emit**(`event`: `"error"`, `err`: `Error`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `err` | `Error` | + +###### Returns + +`boolean` + +###### Implementation of + +`QuickJS.ReadableStream.emit` + +###### Overrides + +`EventEmitter.emit` + +###### Call Signature + +> **emit**(`event`: `"readable"`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"readable"` | + +###### Returns + +`boolean` + +###### Implementation of + +`QuickJS.ReadableStream.emit` + +###### Overrides + +`EventEmitter.emit` + +##### eventNames() + +> **eventNames**(): [`EventKey`](../dom-events.md#eventkey)[] + +Returns an array listing the events for which the emitter has registered +listeners. The values in the array are strings or `Symbol`s. + +```js +import { EventEmitter } from 'events'; + +const myEE = new EventEmitter(); +myEE.on('foo', () => {}); +myEE.on('bar', () => {}); + +const sym = Symbol('symbol'); +myEE.on(sym, () => {}); + +console.log(myEE.eventNames()); +// Prints: [ 'foo', 'bar', Symbol(symbol) ] +``` + +###### Returns + +[`EventKey`](../dom-events.md#eventkey)[] + +###### Implementation of + +[`ReadableStream`](../globals/namespaces/QuickJS.md#readablestream).[`eventNames`](../globals/namespaces/QuickJS.md#eventnames) + +###### Inherited from + +[`EventEmitter`](../globals/index.md#eventemitter).[`eventNames`](../globals/index.md#eventnames) + +##### off() + +> **off**\<`K`\>(`eventName`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Alias for `emitter.removeListener()`. + +###### Type Parameters + +| Type Parameter | +| ------ | +| `K` | + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `eventName` | [`EventKey`](../dom-events.md#eventkey) | +| `listener` | (...`args`: `any`[]) => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`ReadableStream`](../globals/namespaces/QuickJS.md#readablestream).[`off`](../globals/namespaces/QuickJS.md#off) + +###### Inherited from + +[`EventEmitter`](../globals/index.md#eventemitter).[`off`](../globals/index.md#off) + +##### on() + +###### Call Signature + +> **on**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds the `listener` function to the end of the listeners array for the event +named `eventName`. No checks are made to see if the `listener` has already +been added. Multiple calls passing the same combination of `eventName` and +`listener` will result in the `listener` being added, and called, multiple times. + +```js +server.on('connection', (stream) => { + console.log('someone connected!'); +}); +``` + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +By default, event listeners are invoked in the order they are added. The `emitter.prependListener()` method can be used as an alternative to add the +event listener to the beginning of the listeners array. + +```js +import { EventEmitter } from 'events'; +const myEE = new EventEmitter(); +myEE.on('foo', () => console.log('a')); +myEE.prependListener('foo', () => console.log('b')); +myEE.emit('foo'); +// Prints: +// b +// a +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Implementation of + +[`ReadableStream`](../globals/namespaces/QuickJS.md#readablestream).[`on`](../globals/namespaces/QuickJS.md#on) + +###### Overrides + +[`EventEmitter`](../globals/index.md#eventemitter).[`on`](../globals/index.md#on) + +###### Call Signature + +> **on**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.on` + +###### Overrides + +`EventEmitter.on` + +###### Call Signature + +> **on**(`event`: `"data"`, `listener`: (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"data"` | +| `listener` | (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.on` + +###### Overrides + +`EventEmitter.on` + +###### Call Signature + +> **on**(`event`: `"end"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"end"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.on` + +###### Overrides + +`EventEmitter.on` + +###### Call Signature + +> **on**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.on` + +###### Overrides + +`EventEmitter.on` + +###### Call Signature + +> **on**(`event`: `"readable"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"readable"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.on` + +###### Overrides + +`EventEmitter.on` + +##### once() + +###### Call Signature + +> **once**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds a **one-time** `listener` function for the event named `eventName`. The +next time `eventName` is triggered, this listener is removed and then invoked. + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +By default, event listeners are invoked in the order they are added. The `emitter.prependOnceListener()` method can be used as an alternative to add the +event listener to the beginning of the listeners array. + +```js +import { EventEmitter } from 'events'; +const myEE = new EventEmitter(); +myEE.once('foo', () => console.log('a')); +myEE.prependOnceListener('foo', () => console.log('b')); +myEE.emit('foo'); +// Prints: +// b +// a +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Since + +v0.3.0 + +###### Implementation of + +[`ReadableStream`](../globals/namespaces/QuickJS.md#readablestream).[`once`](../globals/namespaces/QuickJS.md#once) + +###### Overrides + +[`EventEmitter`](../globals/index.md#eventemitter).[`once`](../globals/index.md#once) + +###### Call Signature + +> **once**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.once` + +###### Overrides + +`EventEmitter.once` + +###### Call Signature + +> **once**(`event`: `"data"`, `listener`: (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"data"` | +| `listener` | (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.once` + +###### Overrides + +`EventEmitter.once` + +###### Call Signature + +> **once**(`event`: `"end"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"end"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.once` + +###### Overrides + +`EventEmitter.once` + +###### Call Signature + +> **once**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.once` + +###### Overrides + +`EventEmitter.once` + +###### Call Signature + +> **once**(`event`: `"readable"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"readable"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.once` + +###### Overrides + +`EventEmitter.once` + +##### prependListener() + +###### Call Signature + +> **prependListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds the `listener` function to the _beginning_ of the listeners array for the +event named `eventName`. No checks are made to see if the `listener` has +already been added. Multiple calls passing the same combination of `eventName` +and `listener` will result in the `listener` being added, and called, multiple times. + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Implementation of + +[`ReadableStream`](../globals/namespaces/QuickJS.md#readablestream).[`prependListener`](../globals/namespaces/QuickJS.md#prependlistener) + +###### Overrides + +[`EventEmitter`](../globals/index.md#eventemitter).[`prependListener`](../globals/index.md#prependlistener) + +###### Call Signature + +> **prependListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.prependListener` + +###### Overrides + +`EventEmitter.prependListener` + +###### Call Signature + +> **prependListener**(`event`: `"data"`, `listener`: (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"data"` | +| `listener` | (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.prependListener` + +###### Overrides + +`EventEmitter.prependListener` + +###### Call Signature + +> **prependListener**(`event`: `"end"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"end"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.prependListener` + +###### Overrides + +`EventEmitter.prependListener` + +###### Call Signature + +> **prependListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.prependListener` + +###### Overrides + +`EventEmitter.prependListener` + +###### Call Signature + +> **prependListener**(`event`: `"readable"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"readable"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.prependListener` + +###### Overrides + +`EventEmitter.prependListener` + +##### prependOnceListener() + +###### Call Signature + +> **prependOnceListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. +The next time `eventName` is triggered, this listener is removed, and then invoked. + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Implementation of + +[`ReadableStream`](../globals/namespaces/QuickJS.md#readablestream).[`prependOnceListener`](../globals/namespaces/QuickJS.md#prependoncelistener) + +###### Overrides + +[`EventEmitter`](../globals/index.md#eventemitter).[`prependOnceListener`](../globals/index.md#prependoncelistener) + +###### Call Signature + +> **prependOnceListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.prependOnceListener` + +###### Overrides + +`EventEmitter.prependOnceListener` + +###### Call Signature + +> **prependOnceListener**(`event`: `"data"`, `listener`: (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"data"` | +| `listener` | (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.prependOnceListener` + +###### Overrides + +`EventEmitter.prependOnceListener` + +###### Call Signature + +> **prependOnceListener**(`event`: `"end"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"end"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.prependOnceListener` + +###### Overrides + +`EventEmitter.prependOnceListener` + +###### Call Signature + +> **prependOnceListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.prependOnceListener` + +###### Overrides + +`EventEmitter.prependOnceListener` + +###### Call Signature + +> **prependOnceListener**(`event`: `"readable"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"readable"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.prependOnceListener` + +###### Overrides + +`EventEmitter.prependOnceListener` + +##### read() + +> **read**(`size?`: `number`): [`Buffer`](../buffer.md#buffer) \| `null` + +The `readable.read()` method reads data out of the internal buffer and +returns it. If no data is available to be read, `null` is returned. By default, +the data is returned as a `Buffer` object unless an encoding has been +specified using the `readable.setEncoding()` method or the stream is operating +in object mode. + +The optional `size` argument specifies a specific number of bytes to read. If +`size` bytes are not available to be read, `null` will be returned _unless_ the +stream has ended, in which case all of the data remaining in the internal buffer +will be returned. + +If the `size` argument is not specified, all of the data contained in the +internal buffer will be returned. + +The `size` argument must be less than or equal to 1 GiB. + +The `readable.read()` method should only be called on `Readable` streams +operating in paused mode. In flowing mode, `readable.read()` is called +automatically until the internal buffer is fully drained. + +```js +const readable = getReadableStreamSomehow(); + +// 'readable' may be triggered multiple times as data is buffered in +readable.on('readable', () => { + let chunk; + console.log('Stream is readable (new data received in buffer)'); + // Use a loop to make sure we read all currently available data + while (null !== (chunk = readable.read())) { + console.log(`Read ${chunk.length} bytes of data...`); + } +}); + +// 'end' will be triggered once when there is no more data available +readable.on('end', () => { + console.log('Reached end of stream.'); +}); +``` + +Each call to `readable.read()` returns a chunk of data, or `null`. The chunks +are not concatenated. A `while` loop is necessary to consume all data +currently in the buffer. When reading a large file `.read()` may return `null`, +having consumed all buffered content so far, but there is still more data to +come not yet buffered. In this case a new `'readable'` event will be emitted +when there is more data in the buffer. Finally the `'end'` event will be +emitted when there is no more data to come. + +Therefore to read a file's whole contents from a `readable`, it is necessary +to collect chunks across multiple `'readable'` events: + +```js +const chunks = []; + +readable.on('readable', () => { + let chunk; + while (null !== (chunk = readable.read())) { + chunks.push(chunk); + } +}); + +readable.on('end', () => { + const content = chunks.join(''); +}); +``` + +A `Readable` stream in object mode will always return a single item from +a call to `readable.read(size)`, regardless of the value of the `size` argument. + +If the `readable.read()` method returns a chunk of data, a `'data'` event will +also be emitted. + +Calling [read](#read-4) after the `'end'` event has +been emitted will return `null`. No runtime error will be raised. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `size?` | `number` | Optional argument to specify how much data to read. | + +###### Returns + +[`Buffer`](../buffer.md#buffer) \| `null` + +###### Implementation of + +[`ReadableStream`](../globals/namespaces/QuickJS.md#readablestream).[`read`](../globals/namespaces/QuickJS.md#read) + +##### removeListener() + +###### Call Signature + +> **removeListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Removes the specified `listener` from the listener array for the event named `eventName`. + +`removeListener()` will remove, at most, one instance of a listener from the +listener array. If any single listener has been added multiple times to the +listener array for the specified `eventName`, then `removeListener()` must be +called multiple times to remove each instance. + +Once an event is emitted, all listeners attached to it at the time of emitting are called in order. +This implies that any `removeListener()` calls _after_ emitting and _before_ the last listener finishes execution +will not remove them from `emit()` in progress. Subsequent events behave as expected. + +```js +import { EventEmitter } from 'events'; +class MyEmitter extends EventEmitter {} +const myEmitter = new MyEmitter(); + +const callbackA = () => { + console.log('A'); + myEmitter.removeListener('event', callbackB); +}; + +const callbackB = () => { + console.log('B'); +}; + +myEmitter.on('event', callbackA); + +myEmitter.on('event', callbackB); + +// callbackA removes listener callbackB but it will still be called. +// Internal listener array at time of emit [callbackA, callbackB] +myEmitter.emit('event'); +// Prints: +// A +// B + +// callbackB is now removed. +// Internal listener array [callbackA] +myEmitter.emit('event'); +// Prints: +// A +``` + +Because listeners are managed using an internal array, calling this will +change the position indices of any listener registered _after_ the listener +being removed. This will not impact the order in which listeners are called, +but it means that any copies of the listener array as returned by +the `emitter.listeners()` method will need to be recreated. + +When a single function has been added as a handler multiple times for a single +event (as in the example below), `removeListener()` will remove the most +recently added instance. In the example the `once('ping')` listener is removed: + +```js +import { EventEmitter } from 'events'; +const ee = new EventEmitter(); + +function pong() { + console.log('pong'); +} + +ee.on('ping', pong); +ee.once('ping', pong); +ee.removeListener('ping', pong); + +ee.emit('ping'); +ee.emit('ping'); +``` + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | +| `listener` | (...`args`: `any`[]) => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`ReadableStream`](../globals/namespaces/QuickJS.md#readablestream).[`removeListener`](../globals/namespaces/QuickJS.md#removelistener) + +###### Overrides + +[`EventEmitter`](../globals/index.md#eventemitter).[`removeListener`](../globals/index.md#removelistener) + +###### Call Signature + +> **removeListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.removeListener` + +###### Overrides + +`EventEmitter.removeListener` + +###### Call Signature + +> **removeListener**(`event`: `"data"`, `listener`: (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"data"` | +| `listener` | (`chunk`: [`Buffer`](../buffer.md#buffer)) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.removeListener` + +###### Overrides + +`EventEmitter.removeListener` + +###### Call Signature + +> **removeListener**(`event`: `"end"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"end"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.removeListener` + +###### Overrides + +`EventEmitter.removeListener` + +###### Call Signature + +> **removeListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.removeListener` + +###### Overrides + +`EventEmitter.removeListener` + +###### Call Signature + +> **removeListener**(`event`: `"readable"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"readable"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.ReadableStream.removeListener` + +###### Overrides + +`EventEmitter.removeListener` + +*** + +### WritableStreamInner + +#### Extends + +- [`EventEmitter`](../globals/index.md#eventemitter) + +#### Extended by + +- [`DefaultWritableStream`](#defaultwritablestream) + +#### Implements + +- [`WritableStream`](../globals/namespaces/QuickJS.md#writablestream) + +#### Constructors + +##### Constructor + +> **new WritableStreamInner**(): [`WritableStreamInner`](#writablestreaminner) + +###### Returns + +[`WritableStreamInner`](#writablestreaminner) + +###### Inherited from + +[`EventEmitter`](../globals/index.md#eventemitter).[`constructor`](../globals/index.md#constructor) + +#### Methods + +##### addListener() + +###### Call Signature + +> **addListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. error +3. finish + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | +| `listener` | (...`args`: `any`[]) => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`WritableStream`](../globals/namespaces/QuickJS.md#writablestream).[`addListener`](../globals/namespaces/QuickJS.md#addlistener-2) + +###### Overrides + +[`EventEmitter`](../globals/index.md#eventemitter).[`addListener`](../globals/index.md#addlistener) + +###### Call Signature + +> **addListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. error +3. finish + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.addListener` + +###### Overrides + +`EventEmitter.addListener` + +###### Call Signature + +> **addListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. error +3. finish + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.addListener` + +###### Overrides + +`EventEmitter.addListener` + +###### Call Signature + +> **addListener**(`event`: `"finish"`, `listener`: () => `void`): `this` + +Event emitter +The defined events on documents including: +1. close +2. error +3. finish + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.addListener` + +###### Overrides + +`EventEmitter.addListener` + +##### emit() + +###### Call Signature + +> **emit**(`event`: [`EventKey`](../dom-events.md#eventkey), ...`args`: `any`[]): `boolean` + +Synchronously calls each of the listeners registered for the event named `eventName`, in the order they were registered, passing the supplied arguments +to each. + +```js +import { EventEmitter } from 'events'; +const myEmitter = new EventEmitter(); + +// First listener +myEmitter.on('event', function firstListener() { + console.log('Helloooo! first listener'); +}); +// Second listener +myEmitter.on('event', function secondListener(arg1, arg2) { + console.log(`event with parameters ${arg1}, ${arg2} in second listener`); +}); +// Third listener +myEmitter.on('event', function thirdListener(...args) { + const parameters = args.join(', '); + console.log(`event with parameters ${parameters} in third listener`); +}); + +myEmitter.emit('event', 1, 2, 3, 4, 5); + +// Prints: +// Helloooo! first listener +// event with parameters 1, 2 in second listener +// event with parameters 1, 2, 3, 4, 5 in third listener +``` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | +| ...`args` | `any`[] | + +###### Returns + +`boolean` + +###### Implementation of + +[`WritableStream`](../globals/namespaces/QuickJS.md#writablestream).[`emit`](../globals/namespaces/QuickJS.md#emit-2) + +###### Overrides + +[`EventEmitter`](../globals/index.md#eventemitter).[`emit`](../globals/index.md#emit) + +###### Call Signature + +> **emit**(`event`: `"close"`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | + +###### Returns + +`boolean` + +###### Implementation of + +`QuickJS.WritableStream.emit` + +###### Overrides + +`EventEmitter.emit` + +###### Call Signature + +> **emit**(`event`: `"error"`, `err`: `Error`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `err` | `Error` | + +###### Returns + +`boolean` + +###### Implementation of + +`QuickJS.WritableStream.emit` + +###### Overrides + +`EventEmitter.emit` + +###### Call Signature + +> **emit**(`event`: `"finish"`): `boolean` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | + +###### Returns + +`boolean` + +###### Implementation of + +`QuickJS.WritableStream.emit` + +###### Overrides + +`EventEmitter.emit` + +##### end() + +> **end**(): `this` + +Calling the `writable.end()` method signals that no more data will be written +to the `Writable`. + +Calling the [write](#write-4) method after calling [end](#end-4) will raise an error. + +###### Returns + +`this` + +###### Implementation of + +[`WritableStream`](../globals/namespaces/QuickJS.md#writablestream).[`end`](../globals/namespaces/QuickJS.md#end) + +##### eventNames() + +> **eventNames**(): [`EventKey`](../dom-events.md#eventkey)[] + +Returns an array listing the events for which the emitter has registered +listeners. The values in the array are strings or `Symbol`s. + +```js +import { EventEmitter } from 'events'; + +const myEE = new EventEmitter(); +myEE.on('foo', () => {}); +myEE.on('bar', () => {}); + +const sym = Symbol('symbol'); +myEE.on(sym, () => {}); + +console.log(myEE.eventNames()); +// Prints: [ 'foo', 'bar', Symbol(symbol) ] +``` + +###### Returns + +[`EventKey`](../dom-events.md#eventkey)[] + +###### Implementation of + +[`WritableStream`](../globals/namespaces/QuickJS.md#writablestream).[`eventNames`](../globals/namespaces/QuickJS.md#eventnames-2) + +###### Inherited from + +[`EventEmitter`](../globals/index.md#eventemitter).[`eventNames`](../globals/index.md#eventnames) + +##### off() + +> **off**\<`K`\>(`eventName`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Alias for `emitter.removeListener()`. + +###### Type Parameters + +| Type Parameter | +| ------ | +| `K` | + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `eventName` | [`EventKey`](../dom-events.md#eventkey) | +| `listener` | (...`args`: `any`[]) => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`WritableStream`](../globals/namespaces/QuickJS.md#writablestream).[`off`](../globals/namespaces/QuickJS.md#off-2) + +###### Inherited from + +[`EventEmitter`](../globals/index.md#eventemitter).[`off`](../globals/index.md#off) + +##### on() + +###### Call Signature + +> **on**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds the `listener` function to the end of the listeners array for the event +named `eventName`. No checks are made to see if the `listener` has already +been added. Multiple calls passing the same combination of `eventName` and +`listener` will result in the `listener` being added, and called, multiple times. + +```js +server.on('connection', (stream) => { + console.log('someone connected!'); +}); +``` + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +By default, event listeners are invoked in the order they are added. The `emitter.prependListener()` method can be used as an alternative to add the +event listener to the beginning of the listeners array. + +```js +import { EventEmitter } from 'events'; +const myEE = new EventEmitter(); +myEE.on('foo', () => console.log('a')); +myEE.prependListener('foo', () => console.log('b')); +myEE.emit('foo'); +// Prints: +// b +// a +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Implementation of + +[`WritableStream`](../globals/namespaces/QuickJS.md#writablestream).[`on`](../globals/namespaces/QuickJS.md#on-2) + +###### Overrides + +[`EventEmitter`](../globals/index.md#eventemitter).[`on`](../globals/index.md#on) + +###### Call Signature + +> **on**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.on` + +###### Overrides + +`EventEmitter.on` + +###### Call Signature + +> **on**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.on` + +###### Overrides + +`EventEmitter.on` + +###### Call Signature + +> **on**(`event`: `"finish"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.on` + +###### Overrides + +`EventEmitter.on` + +##### once() + +###### Call Signature + +> **once**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds a **one-time** `listener` function for the event named `eventName`. The +next time `eventName` is triggered, this listener is removed and then invoked. + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +By default, event listeners are invoked in the order they are added. The `emitter.prependOnceListener()` method can be used as an alternative to add the +event listener to the beginning of the listeners array. + +```js +import { EventEmitter } from 'events'; +const myEE = new EventEmitter(); +myEE.once('foo', () => console.log('a')); +myEE.prependOnceListener('foo', () => console.log('b')); +myEE.emit('foo'); +// Prints: +// b +// a +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Since + +v0.3.0 + +###### Implementation of + +[`WritableStream`](../globals/namespaces/QuickJS.md#writablestream).[`once`](../globals/namespaces/QuickJS.md#once-2) + +###### Overrides + +[`EventEmitter`](../globals/index.md#eventemitter).[`once`](../globals/index.md#once) + +###### Call Signature + +> **once**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.once` + +###### Overrides + +`EventEmitter.once` + +###### Call Signature + +> **once**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.once` + +###### Overrides + +`EventEmitter.once` + +###### Call Signature + +> **once**(`event`: `"finish"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.once` + +###### Overrides + +`EventEmitter.once` + +##### prependListener() + +###### Call Signature + +> **prependListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds the `listener` function to the _beginning_ of the listeners array for the +event named `eventName`. No checks are made to see if the `listener` has +already been added. Multiple calls passing the same combination of `eventName` +and `listener` will result in the `listener` being added, and called, multiple times. + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Implementation of + +[`WritableStream`](../globals/namespaces/QuickJS.md#writablestream).[`prependListener`](../globals/namespaces/QuickJS.md#prependlistener-2) + +###### Overrides + +[`EventEmitter`](../globals/index.md#eventemitter).[`prependListener`](../globals/index.md#prependlistener) + +###### Call Signature + +> **prependListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.prependListener` + +###### Overrides + +`EventEmitter.prependListener` + +###### Call Signature + +> **prependListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.prependListener` + +###### Overrides + +`EventEmitter.prependListener` + +###### Call Signature + +> **prependListener**(`event`: `"finish"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.prependListener` + +###### Overrides + +`EventEmitter.prependListener` + +##### prependOnceListener() + +###### Call Signature + +> **prependOnceListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. +The next time `eventName` is triggered, this listener is removed, and then invoked. + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | - | +| `listener` | (...`args`: `any`[]) => `void` | The callback function | + +###### Returns + +`this` + +###### Implementation of + +[`WritableStream`](../globals/namespaces/QuickJS.md#writablestream).[`prependOnceListener`](../globals/namespaces/QuickJS.md#prependoncelistener-2) + +###### Overrides + +[`EventEmitter`](../globals/index.md#eventemitter).[`prependOnceListener`](../globals/index.md#prependoncelistener) + +###### Call Signature + +> **prependOnceListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.prependOnceListener` + +###### Overrides + +`EventEmitter.prependOnceListener` + +###### Call Signature + +> **prependOnceListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.prependOnceListener` + +###### Overrides + +`EventEmitter.prependOnceListener` + +###### Call Signature + +> **prependOnceListener**(`event`: `"finish"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.prependOnceListener` + +###### Overrides + +`EventEmitter.prependOnceListener` + +##### removeListener() + +###### Call Signature + +> **removeListener**(`event`: [`EventKey`](../dom-events.md#eventkey), `listener`: (...`args`: `any`[]) => `void`): `this` + +Removes the specified `listener` from the listener array for the event named `eventName`. + +`removeListener()` will remove, at most, one instance of a listener from the +listener array. If any single listener has been added multiple times to the +listener array for the specified `eventName`, then `removeListener()` must be +called multiple times to remove each instance. + +Once an event is emitted, all listeners attached to it at the time of emitting are called in order. +This implies that any `removeListener()` calls _after_ emitting and _before_ the last listener finishes execution +will not remove them from `emit()` in progress. Subsequent events behave as expected. + +```js +import { EventEmitter } from 'events'; +class MyEmitter extends EventEmitter {} +const myEmitter = new MyEmitter(); + +const callbackA = () => { + console.log('A'); + myEmitter.removeListener('event', callbackB); +}; + +const callbackB = () => { + console.log('B'); +}; + +myEmitter.on('event', callbackA); + +myEmitter.on('event', callbackB); + +// callbackA removes listener callbackB but it will still be called. +// Internal listener array at time of emit [callbackA, callbackB] +myEmitter.emit('event'); +// Prints: +// A +// B + +// callbackB is now removed. +// Internal listener array [callbackA] +myEmitter.emit('event'); +// Prints: +// A +``` + +Because listeners are managed using an internal array, calling this will +change the position indices of any listener registered _after_ the listener +being removed. This will not impact the order in which listeners are called, +but it means that any copies of the listener array as returned by +the `emitter.listeners()` method will need to be recreated. + +When a single function has been added as a handler multiple times for a single +event (as in the example below), `removeListener()` will remove the most +recently added instance. In the example the `once('ping')` listener is removed: + +```js +import { EventEmitter } from 'events'; +const ee = new EventEmitter(); + +function pong() { + console.log('pong'); +} + +ee.on('ping', pong); +ee.once('ping', pong); +ee.removeListener('ping', pong); + +ee.emit('ping'); +ee.emit('ping'); +``` + +Returns a reference to the `EventEmitter`, so that calls can be chained. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | [`EventKey`](../dom-events.md#eventkey) | +| `listener` | (...`args`: `any`[]) => `void` | + +###### Returns + +`this` + +###### Implementation of + +[`WritableStream`](../globals/namespaces/QuickJS.md#writablestream).[`removeListener`](../globals/namespaces/QuickJS.md#removelistener-2) + +###### Overrides + +[`EventEmitter`](../globals/index.md#eventemitter).[`removeListener`](../globals/index.md#removelistener) + +###### Call Signature + +> **removeListener**(`event`: `"close"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"close"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.removeListener` + +###### Overrides + +`EventEmitter.removeListener` + +###### Call Signature + +> **removeListener**(`event`: `"error"`, `listener`: (`err`: `Error`) => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"error"` | +| `listener` | (`err`: `Error`) => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.removeListener` + +###### Overrides + +`EventEmitter.removeListener` + +###### Call Signature + +> **removeListener**(`event`: `"finish"`, `listener`: () => `void`): `this` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | `"finish"` | +| `listener` | () => `void` | + +###### Returns + +`this` + +###### Implementation of + +`QuickJS.WritableStream.removeListener` + +###### Overrides + +`EventEmitter.removeListener` + +##### write() + +> **write**(`chunk`: `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](../globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](../buffer.md#buffer), `callback?`: (`error?`: `Error` \| `null`) => `void`): `void` + +The `writable.write()` method writes some data to the stream, and calls the +supplied `callback` once the data has been fully handled. If an error +occurs, the `callback` will be called with the error as its +first argument. The `callback` is usually called asynchronously and before `'error'` +is emitted. + +```js +function write(data, cb) { + if (!stream.write(data)) { + stream.once('drain', cb); + } else { + process.nextTick(cb); + } +} + +// Wait for cb to be called before doing any other write. +write('hello', () => { + console.log('Write completed, do more writes now.'); +}); +``` + +A `Writable` stream in object mode will always ignore the `encoding` argument. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `chunk` | `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](../globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](../buffer.md#buffer) | Optional data to write. `chunk` must be a {string}, {Buffer}, {TypedArray} or {DataView}. | +| `callback?` | (`error?`: `Error` \| `null`) => `void` | Callback for when this chunk of data is flushed. | + +###### Returns + +`void` + +`false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. + +###### Since + +v0.9.4 + +###### Implementation of + +[`WritableStream`](../globals/namespaces/QuickJS.md#writablestream).[`write`](../globals/namespaces/QuickJS.md#write) diff --git a/src/reference/sdks/backend/api.md b/src/reference/sdks/backend/api.md new file mode 100644 index 0000000..ed6d9f9 --- /dev/null +++ b/src/reference/sdks/backend/api.md @@ -0,0 +1,64 @@ +# API + +### APISDK + +> **APISDK**\<`API`, `Events`\> = `object` + +The SDK for the API RPC service. + +#### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `API` | `object` | +| `Events` | `object` | + +#### Methods + +##### register() + +> **register**(`name`: keyof `API`, `callback`: (`sdk`: [`SDK`](index.md#sdk), ...`args`: `any`[]) => `any`): `void` + +Registers a new backend function for the RPC. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `name` | keyof `API` | +| `callback` | (`sdk`: [`SDK`](index.md#sdk), ...`args`: `any`[]) => `any` | + +###### Returns + +`void` + +###### Example + +```ts +sdk.api.register("multiply", (sdk: SDK, a: number, b: number) => { + return a * b; +}); +``` + +##### send() + +> **send**(`event`: keyof `Events`, ...`args`: `any`[]): `void` + +Sends an event to the frontend plugin. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | keyof `Events` | +| ...`args` | `any`[] | + +###### Returns + +`void` + +###### Example + +```ts +sdk.api.send("myEvent", 5, "hello"); +``` diff --git a/src/reference/sdks/backend/environment.md b/src/reference/sdks/backend/environment.md new file mode 100644 index 0000000..e9a110f --- /dev/null +++ b/src/reference/sdks/backend/environment.md @@ -0,0 +1,163 @@ +# Environment + +### EnvironmentSDK + +> **EnvironmentSDK** = `object` + +The SDK for the Environment service. + +#### Methods + +##### getVar() + +> **getVar**(`name`: `string`): `string` \| `undefined` + +Get the value of an environment variable. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `name` | `string` | The name of the environment variable. | + +###### Returns + +`string` \| `undefined` + +The value of the environment variable. + +##### getVars() + +> **getVars**(): [`EnvironmentVariable`](#environmentvariable)[] + +Get all the environment variables. +It includes the global environment and the selected environment. +Those variables can change over time so avoid caching them. + +###### Returns + +[`EnvironmentVariable`](#environmentvariable)[] + +An array of [EnvironmentVariable](#environmentvariable) + +##### setVar() + +> **setVar**(`input`: [`SetVarInput`](#setvarinput)): `Promise`\<`void`\> + +Sets an environment variable to a given value. +This will override any existing value. +The environment variable can be set either on the currently +selected environment or the global environment. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `input` | [`SetVarInput`](#setvarinput) | + +###### Returns + +`Promise`\<`void`\> + +###### Throws + +If trying to set when a project is not selected. + +###### Throws + +If trying to set when an environment is not selected (with `global: false`). + +###### Example + +```js +await sdk.env.setVar({ + name: "USER_SECRET", + value: "my secret value", + secret: true, + global: false +}); +``` + +*** + +### EnvironmentVariable + +> **EnvironmentVariable** = `object` + +A saved immutable Finding. + +#### Properties + +##### isSecret + +> `readonly` **isSecret**: `boolean` + +If the environment variable is a secret + +##### name + +> `readonly` **name**: `string` + +The name of the environment variable + +##### value + +> `readonly` **value**: `string` + +The value of the environment variable + +*** + +### SetVarInput + +> **SetVarInput** = `object` + +Input for the `setVar` of [EnvironmentSDK](#environmentsdk). + +#### Properties + +##### env? + +> `optional` **env**: `string` + +The `name` of the Environment to set the variable on. +This will take precedence over the `global` flag if provided. + +##### global + +> **global**: `boolean` + +If the environment variable should be set on the global +environment or the currently selected environment. +By default, it will be set globally. + +###### Default + +```ts +true +``` + +##### name + +> **name**: `string` + +Name of the environment variable + +##### secret + +> **secret**: `boolean` + +If the environment variable should be treated as secret. +Secrets are encrypted on the disk. + +###### Default + +```ts +false +``` + +##### value + +> **value**: `string` + +Value of the environment variable diff --git a/src/reference/sdks/backend/events.md b/src/reference/sdks/backend/events.md new file mode 100644 index 0000000..546ef79 --- /dev/null +++ b/src/reference/sdks/backend/events.md @@ -0,0 +1,98 @@ +# Events + +### EventsSDK + +> **EventsSDK**\<`API`, `Events`\> = `object` + +The SDK for the API RPC service. + +#### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `API` | `object` | +| `Events` | `object` | + +#### Methods + +##### onInterceptRequest() + +> **onInterceptRequest**(`callback`: (`sdk`: [`SDK`](index.md#sdk)\<`API`, `Events`\>, `request`: [`Request`](requests.md#request)) => [`MaybePromise`](shared.md#maybepromise)\<`void`\>): `void` + +Registers an callback on new intercepted requests. + +This callback is called asynchronously and cannot modify requests. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `callback` | (`sdk`: [`SDK`](index.md#sdk)\<`API`, `Events`\>, `request`: [`Request`](requests.md#request)) => [`MaybePromise`](shared.md#maybepromise)\<`void`\> | + +###### Returns + +`void` + +###### Example + +```ts +sdk.events.onInterceptRequest((sdk, request) => { + // Do something with the request +}); +``` + +##### onInterceptResponse() + +> **onInterceptResponse**(`callback`: (`sdk`: [`SDK`](index.md#sdk)\<`API`, `Events`\>, `request`: [`Request`](requests.md#request), `response`: [`Response`](requests.md#response)) => [`MaybePromise`](shared.md#maybepromise)\<`void`\>): `void` + +Registers an callback on new intercepted responses. + +This callback is called asynchronously and cannot modify responses. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `callback` | (`sdk`: [`SDK`](index.md#sdk)\<`API`, `Events`\>, `request`: [`Request`](requests.md#request), `response`: [`Response`](requests.md#response)) => [`MaybePromise`](shared.md#maybepromise)\<`void`\> | + +###### Returns + +`void` + +###### Example + +```ts +sdk.events.onInterceptResponse((sdk, request, response) => { + // Do something with the request/response +}); +``` + +##### onProjectChange() + +> **onProjectChange**(`callback`: (`sdk`: [`SDK`](index.md#sdk)\<`API`, `Events`\>, `project`: [`Project`](projects.md#project) \| `null`) => [`MaybePromise`](shared.md#maybepromise)\<`void`\>): `void` + +Registers an callback on project change. + +This callback is called asynchronously and cannot modify the project. + +It can happen that the project is null if the user deleted the currently selected one. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `callback` | (`sdk`: [`SDK`](index.md#sdk)\<`API`, `Events`\>, `project`: [`Project`](projects.md#project) \| `null`) => [`MaybePromise`](shared.md#maybepromise)\<`void`\> | + +###### Returns + +`void` + +###### Example + +```ts +sdk.events.onProjectChange((sdk, project) => { + if (project !== null) { + // Do something with the project + } +}); +``` diff --git a/src/reference/sdks/backend/findings.md b/src/reference/sdks/backend/findings.md new file mode 100644 index 0000000..aaa0d59 --- /dev/null +++ b/src/reference/sdks/backend/findings.md @@ -0,0 +1,246 @@ +# Findings + +### DedupeKey + +> **DedupeKey** = `string` & `object` + +A deduplication key. + +#### Type Declaration + +##### \_\_dedupeKey? + +> `optional` **\_\_dedupeKey**: `never` + +*** + +### Finding + +> **Finding** = `object` + +A saved immutable Finding. + +#### Methods + +##### getDedupeKey() + +> **getDedupeKey**(): [`DedupeKey`](#dedupekey) \| `undefined` + +The deduplication key of the finding. + +###### Returns + +[`DedupeKey`](#dedupekey) \| `undefined` + +##### getDescription() + +> **getDescription**(): `string` \| `undefined` + +The description of the finding. + +###### Returns + +`string` \| `undefined` + +##### getId() + +> **getId**(): [`ID`](shared.md#id) + +The unique Caido [ID](shared.md#id) of the finding. + +###### Returns + +[`ID`](shared.md#id) + +##### getReporter() + +> **getReporter**(): `string` + +The name of the reporter. + +###### Returns + +`string` + +##### getRequestId() + +> **getRequestId**(): `string` + +The ID of the associated [Request](requests.md#request). + +###### Returns + +`string` + +##### getTitle() + +> **getTitle**(): `string` + +The title of the finding. + +###### Returns + +`string` + +*** + +### FindingSpec + +> **FindingSpec** = `object` + +A mutable Finding not yet created. + +#### Properties + +##### dedupeKey? + +> `optional` **dedupeKey**: [`DedupeKey`](#dedupekey) + +Deduplication key for findings. +If a finding with the same dedupe key already exists, it will not be created. + +##### description? + +> `optional` **description**: `string` + +The description of the finding. + +##### reporter + +> **reporter**: `string` + +The name of the reporter. +It will be used to group findings. + +##### request + +> **request**: [`Request`](requests.md#request) + +The associated [Request](requests.md#request). + +##### title + +> **title**: `string` + +The title of the finding. + +*** + +### FindingsSDK + +> **FindingsSDK** = `object` + +The SDK for the Findings service. + +#### Methods + +##### create() + +> **create**(`spec`: [`FindingSpec`](#findingspec)): `Promise`\<[`Finding`](#finding)\> + +Creates a new Finding. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `spec` | [`FindingSpec`](#findingspec) | + +###### Returns + +`Promise`\<[`Finding`](#finding)\> + +###### Throws + +If the request cannot be saved. + +###### Example + +```js +await sdk.findings.create({ + title: "Title", + description: "Description", + reporter: "Reporter", + dedupeKey: `${request.getHost()}-${request.getPath()}`, + request, +}); +``` + +##### exists() + +> **exists**(`input`: [`GetFindingInput`](#getfindinginput)): `Promise`\<`boolean`\> + +Check if a [Finding](#finding) exists. +Similar to `get`, but returns a boolean. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `input` | [`GetFindingInput`](#getfindinginput) | + +###### Returns + +`Promise`\<`boolean`\> + +###### Example + +```js +await sdk.findings.exists("my-dedupe-key"); +``` + +##### get() + +> **get**(`input`: [`GetFindingInput`](#getfindinginput)): `Promise`\<[`Finding`](#finding) \| `undefined`\> + +Try to get a [Finding](#finding) for a request. + +Since a request can have multiple findings, this will return the first one found. +You can also filter by reporter to get a specific finding. + +Finally, you can use a deduplication key to get a specific finding. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `input` | [`GetFindingInput`](#getfindinginput) | + +###### Returns + +`Promise`\<[`Finding`](#finding) \| `undefined`\> + +###### Example + +```js +await sdk.findings.get({ + reporter: "Reporter", + request, +}); +``` + +*** + +### GetFindingInput + +> **GetFindingInput** = [`DedupeKey`](#dedupekey) \| \{ `reporter?`: `string`; `request`: [`Request`](requests.md#request); \} + +Input to get a [Finding](#finding). + +#### Type Declaration + +[`DedupeKey`](#dedupekey) + +\{ `reporter?`: `string`; `request`: [`Request`](requests.md#request); \} + +##### reporter? + +> `optional` **reporter**: `string` + +The name of the reporter. + +##### request + +> **request**: [`Request`](requests.md#request) + +The associated [Request](requests.md#request). diff --git a/src/reference/sdks/backend/graphql.md b/src/reference/sdks/backend/graphql.md new file mode 100644 index 0000000..95552f6 --- /dev/null +++ b/src/reference/sdks/backend/graphql.md @@ -0,0 +1,118 @@ +# GraphQL + +### GraphQLError + +> **GraphQLError** = `object` + +An error from a GraphQL query. + +#### Properties + +##### extensions + +> **extensions**: `Record`\<`string`, `any`\> + +##### locations + +> **locations**: [`GraphQLLocation`](#graphqllocation)[] + +##### message + +> **message**: `string` + +##### path + +> **path**: [`GraphQLPathSegment`](#graphqlpathsegment)[] + +*** + +### GraphQLLocation + +> **GraphQLLocation** = `object` + +A location in a GraphQL query. + +#### Properties + +##### column + +> **column**: `number` + +##### line + +> **line**: `number` + +*** + +### GraphQLPathSegment + +> **GraphQLPathSegment** = `string` \| `number` + +A segment of a path in a GraphQL query. + +*** + +### GraphQLResponse + +> **GraphQLResponse**\<`T`\> = `object` + +The response from a GraphQL query. + +#### Type Parameters + +| Type Parameter | +| ------ | +| `T` | + +#### Properties + +##### data? + +> `optional` **data**: `T` + +##### errors? + +> `optional` **errors**: [`GraphQLError`](#graphqlerror)[] + +*** + +### GraphQLSDK + +> **GraphQLSDK** = `object` + +The SDK for the GraphQL service. + +#### Methods + +##### execute() + +> **execute**\<`T`\>(`query`: `string`, `variables?`: `Record`\<`string`, `any`\>): `Promise`\<[`GraphQLResponse`](#graphqlresponse)\<`T`\>\> + +Executes a GraphQL query. + +###### Type Parameters + +| Type Parameter | +| ------ | +| `T` | + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `query` | `string` | +| `variables?` | `Record`\<`string`, `any`\> | + +###### Returns + +`Promise`\<[`GraphQLResponse`](#graphqlresponse)\<`T`\>\> + +###### Example + +```js +await sdk.graphql.execute(` + query { + viewer + } +`); +``` diff --git a/src/reference/sdks/backend/hostedfile.md b/src/reference/sdks/backend/hostedfile.md new file mode 100644 index 0000000..aca072e --- /dev/null +++ b/src/reference/sdks/backend/hostedfile.md @@ -0,0 +1,93 @@ +# HostedFile + +### HostedFile + +> **HostedFile** = `object` + +A hosted file. + +#### Properties + +##### id + +> **id**: `string` + +The unique Caido [ID](shared.md#id) of the project. + +##### name + +> **name**: `string` + +The name of the project. + +##### path + +> **path**: `string` + +The path of the file. + +*** + +### HostedFileSDK + +> **HostedFileSDK** = `object` + +The SDK for the HostedFile service. + +#### Methods + +##### create() + +> **create**(`spec`: [`HostedFileSpec`](#hostedfilespec)): `Promise`\<[`HostedFile`](#hostedfile)\> + +Create a hosted file. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `spec` | [`HostedFileSpec`](#hostedfilespec) | + +###### Returns + +`Promise`\<[`HostedFile`](#hostedfile)\> + +###### Example + +```js +await sdk.hostedFile.create({ name: "My File", content: "Hello, world!" }); +``` + +##### getAll() + +> **getAll**(): `Promise`\<[`HostedFile`](#hostedfile)[]\> + +Get all hosted files. + +###### Returns + +`Promise`\<[`HostedFile`](#hostedfile)[]\> + +###### Example + +```js +await sdk.hostedFile.getAll(); +``` + +*** + +### HostedFileSpec + +> **HostedFileSpec** = `object` + +A specification for creating a hosted file. + +#### Properties + +##### content + +> **content**: [`Bytes`](shared.md#bytes) + +##### name + +> **name**: `string` diff --git a/src/reference/sdks/backend/index.md b/src/reference/sdks/backend/index.md index 6239c40..1c86b2c 100644 --- a/src/reference/sdks/backend/index.md +++ b/src/reference/sdks/backend/index.md @@ -1,11 +1,8 @@ # @caido/sdk-backend -This is the reference for the backend SDK used by backend plugins. -[SDK](#events) is the main interface that provides access to various services and functionalities. - ## SDK -### SDK\ +### SDK The SDK object available to all scripts. @@ -20,13 +17,13 @@ The SDK object available to all scripts. ##### api -> **api**: [`APISDK`](index.md#apisdkapi-events)\<`API`, `Events`\> +> **api**: [`APISDK`](api.md#apisdk)\<`API`, `Events`\> The SDK for the API RPC service. ##### console -> **console**: [`Console`](index.md#console-1) +> **console**: [`Console`](other.md#console) The console. @@ -34,2967 +31,83 @@ This is currently the same as the global `console`. ##### env -> **env**: [`EnvironmentSDK`](index.md#environmentsdk) +> **env**: [`EnvironmentSDK`](environment.md#environmentsdk) The SDK for the Environment service. ##### events -> **events**: [`EventsSDK`](index.md#eventssdkapi-events)\<`API`, `Events`\> +> **events**: [`EventsSDK`](events.md#eventssdk)\<`API`, `Events`\> The SDK for the Events service. ##### findings -> **findings**: [`FindingsSDK`](index.md#findingssdk) +> **findings**: [`FindingsSDK`](findings.md#findingssdk) The SDK for the Findings service. ##### graphql -> **graphql**: [`GraphQLSDK`](index.md#graphqlsdk) +> **graphql**: [`GraphQLSDK`](graphql.md#graphqlsdk) The SDK for the GraphQL service. +##### hostedFile + +> **hostedFile**: [`HostedFileSDK`](hostedfile.md#hostedfilesdk) + +The SDK for the HostedFile service. + ##### meta -> **meta**: [`MetaSDK`](index.md#metasdk) +> **meta**: [`MetaSDK`](meta.md#metasdk) The SDK for metadata information about the plugin. ##### projects -> **projects**: [`ProjectsSDK`](index.md#projectssdk) +> **projects**: [`ProjectsSDK`](projects.md#projectssdk) The SDK for the Projects service. ##### replay -> **replay**: [`ReplaySDK`](index.md#replaysdk) +> **replay**: [`ReplaySDK`](replay.md#replaysdk) The SDK for the Replay service. ##### requests -> **requests**: [`RequestsSDK`](index.md#requestssdk) +> **requests**: [`RequestsSDK`](requests.md#requestssdk) The SDK for the Requests service. ##### runtime -> **runtime**: [`RuntimeSDK`](index.md#runtimesdk) +> **runtime**: [`RuntimeSDK`](runtime.md#runtimesdk) The SDK for the runtime information. ##### scope -> **scope**: [`ScopeSDK`](index.md#scopesdk) +> **scope**: [`ScopeSDK`](scope.md#scopesdk) The SDK for the Scope service. -## Meta - -### MetaSDK - -> **MetaSDK**: `object` - -The SDK for metadata information about the plugin. - -#### Type declaration - -##### assetsPath() - -The directory of the plugin's assets in Caido Data. -You can read static data from your plugin in this directory. -You shouldn't write anything there, as the contents can be reset at any time. - -###### Returns - -`string` - -##### db() - -Get a sqlite database for the plugin stored in Caido Data. -You can use this to store data related to your plugin. - -###### Returns - -`Promise`\<[`Database`](index.md#database)\> - -##### path() - -The directory of the plugin in Caido Data. -You can store data related to your plugin in this directory. - -###### Returns - -`string` - -##### updateAvailable() - -Check if an update is available for the plugin. - -###### Returns - -`Promise`\<`boolean`\> - -###### Throws - -If Caido Cloud is offline. - -##### version() - -Get the version of the plugin. -This uses the semver format. - -###### Returns - -`string` - -## API - -### APISDK\ - -> **APISDK**\<`API`, `Events`\>: `object` - -The SDK for the API RPC service. - -#### Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `API` | `object` | -| `Events` | `object` | - -#### Type declaration - -##### register() - -Registers a new backend function for the RPC. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `name` | keyof `API` | -| `callback` | (`sdk`: [`SDK`](index.md#sdkapi-events), ...`args`: `any`[]) => `any` | - -###### Returns - -`void` - -###### Example - -```ts -sdk.api.register("multiply", (sdk: SDK, a: number, b: number) => { - return a * b; -}); -``` - -##### send() - -Sends an event to the frontend plugin. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `event` | keyof `Events` | -| ...`args` | `any`[] | - -###### Returns - -`void` - -###### Example - -```ts -sdk.api.send("myEvent", 5, "hello"); -``` - -## Events - -### EventsSDK\ - -> **EventsSDK**\<`API`, `Events`\>: `object` - -The SDK for the API RPC service. - -#### Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `API` | `object` | -| `Events` | `object` | - -#### Type declaration - -##### onInterceptRequest() - -Registers an callback on new intercepted requests. - -This callback is called asynchronously and cannot modify requests. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `callback` | (`sdk`: [`SDK`](index.md#sdkapi-events)\<`API`, `Events`\>, `request`: [`Request`](index.md#request-1)) => [`MaybePromise`](index.md#maybepromiset-1)\<`void`\> | - -###### Returns - -`void` - -###### Example - -```ts -sdk.events.onInterceptRequest((sdk, request) => { - // Do something with the request -}); -``` - -##### onInterceptResponse() - -Registers an callback on new intercepted responses. - -This callback is called asynchronously and cannot modify responses. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `callback` | (`sdk`: [`SDK`](index.md#sdkapi-events)\<`API`, `Events`\>, `request`: [`Request`](index.md#request-1), `response`: [`Response`](index.md#response-4)) => [`MaybePromise`](index.md#maybepromiset-1)\<`void`\> | - -###### Returns - -`void` - -###### Example - -```ts -sdk.events.onInterceptResponse((sdk, request, response) => { - // Do something with the request/response -}); -``` - -##### onProjectChange() - -Registers an callback on project change. - -This callback is called asynchronously and cannot modify the project. - -It can happen that the project is null if the user deleted the currently selected one. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `callback` | (`sdk`: [`SDK`](index.md#sdkapi-events)\<`API`, `Events`\>, `project`: `null` \| [`Project`](index.md#project)) => [`MaybePromise`](index.md#maybepromiset-1)\<`void`\> | - -###### Returns - -`void` - -###### Example - -```ts -sdk.events.onProjectChange((sdk, project) => { - if (project !== null) { - // Do something with the project - } -}); -``` - -## Requests - -### Body - -The body of a [Request](index.md#request-1) or [Response](index.md#response-4). - -Calling `to` will try to convert the body to the desired format. - -#### Constructors - -##### new Body() - -> **new Body**(`data`: `string` \| `number`[] \| `Uint8Array`): [`Body`](index.md#body) - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `data` | `string` \| `number`[] \| `Uint8Array` | - -###### Returns - -[`Body`](index.md#body) - -#### Properties - -##### length - -> `readonly` **length**: `number` - -The length of the body in bytes. - -#### Methods - -##### toJson() - -> **toJson**(): `unknown` - -Try to parse the body as JSON. - -###### Returns - -`unknown` - -###### Throws - -If the body is not valid JSON. - -##### toRaw() - -> **toRaw**(): `Uint8Array` - -Get the raw body as an array of bytes. - -###### Returns - -`Uint8Array` - -##### toText() - -> **toText**(): `string` - -Parse the body as a string. - -Unprintable characters will be replaced with `�`. - -###### Returns - -`string` - -*** - -### RequestSpec - -A mutable Request that has not yet been sent. - -#### Constructors - -##### new RequestSpec() - -> **new RequestSpec**(`url`: `string`): [`RequestSpec`](index.md#requestspec) - -Build a new [RequestSpec](index.md#requestspec) from a URL string. -We try to infer as much information as possible from the URL, including the scheme, host, path and query. - -You can convert a saved immutable [Request](index.md#request-1) object into a [RequestSpec](index.md#requestspec) object by using the `toSpec()` method. - -By default: - -- Method is `GET`. -- Path is `/`. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `url` | `string` | - -###### Returns - -[`RequestSpec`](index.md#requestspec) - -###### Throws - -If the URL is invalid. - -###### Example - -```js -const spec = new RequestSpec("https://example.com"); -``` - -#### Methods - -##### getBody() - -> **getBody**(): `undefined` \| [`Body`](index.md#body) - -The body of the request. - -###### Returns - -`undefined` \| [`Body`](index.md#body) - -##### getHeader() - -> **getHeader**(`name`: `string`): `undefined` \| `string`[] - -Get a header value. - -Header name is case-insensitive. -The header might have multiple values. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `name` | `string` | - -###### Returns - -`undefined` \| `string`[] - -##### getHeaders() - -> **getHeaders**(): `Record`\<`string`, `string`[]\> - -The headers of the request. - -Header names are case-insensitive. -Each header might have multiple values. - -###### Returns - -`Record`\<`string`, `string`[]\> - -###### Example - -```json -{ - "Host": ["caido.io"], - "Connection": ["keep-alive"], - "Content-Length": ["95"] -} -``` - -##### getHost() - -> **getHost**(): `string` - -Get the host of the request. - -###### Returns - -`string` - -##### getMethod() - -###### Call Signature - -> **getMethod**(): `string` - -Get the HTTP method of the request. - -Get the raw version by passing `{ raw: true }` in the options. - -###### Returns - -`string` - -###### Call Signature - -> **getMethod**(`options`: [`RawOption`](index.md#rawoption)): `Uint8Array` - -Get the HTTP method of the request. - -Get the raw version by passing `{ raw: true }` in the options. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `options` | [`RawOption`](index.md#rawoption) | - -###### Returns - -`Uint8Array` - -##### getPath() - -###### Call Signature - -> **getPath**(): `string` - -Get the path of the request. - -Get the raw version by passing `{ raw: true }` in the options. - -###### Returns - -`string` - -###### Call Signature - -> **getPath**(`options`: [`RawOption`](index.md#rawoption)): `Uint8Array` - -Get the path of the request. - -Get the raw version by passing `{ raw: true }` in the options. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `options` | [`RawOption`](index.md#rawoption) | - -###### Returns - -`Uint8Array` - -##### getPort() - -> **getPort**(): `number` - -Get the port of the request. - -###### Returns - -`number` - -##### getQuery() - -###### Call Signature - -> **getQuery**(): `string` - -Get the unparsed query of the request. - -Get the raw version by passing `{ raw: true }` in the options. - -Excludes the leading `?`. - -###### Returns - -`string` - -###### Call Signature - -> **getQuery**(`options`: [`RawOption`](index.md#rawoption)): `Uint8Array` - -Get the unparsed query of the request. - -Get the raw version by passing `{ raw: true }` in the options. - -Excludes the leading `?`. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `options` | [`RawOption`](index.md#rawoption) | - -###### Returns - -`Uint8Array` - -##### getRaw() - -> **getRaw**(): [`RequestSpecRaw`](index.md#requestspecraw) - -This methods converts the [RequestSpec](index.md#requestspec) to a [RequestSpecRaw](index.md#requestspecraw). - -This is useful to retrieve the raw bytes of the request. - -###### Returns - -[`RequestSpecRaw`](index.md#requestspecraw) - -###### Example - -```js -const spec = new RequestSpec("https://example.com"); -const specRaw = spec.getRaw(); -const bytes = specRaw.getRaw(); // GET / HTTP/1.1\r\nHost: example.com\r\n\r\n -``` - -##### getTls() - -> **getTls**(): `boolean` - -Get if the request uses TLS (HTTPS). - -###### Returns - -`boolean` - -##### removeHeader() - -> **removeHeader**(`name`: `string`): `void` - -Removes a header. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `name` | `string` | - -###### Returns - -`void` - -##### setBody() - -> **setBody**(`body`: [`Body`](index.md#body) \| [`Bytes`](index.md#bytes), `options`?: [`SetBodyOptions`](index.md#setbodyoptions)): `void` - -Set the body of the request. - -The body can either be a [Body](index.md#body) or any type that can be converted to [Bytes](index.md#bytes). - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `body` | [`Body`](index.md#body) \| [`Bytes`](index.md#bytes) | -| `options`? | [`SetBodyOptions`](index.md#setbodyoptions) | - -###### Returns - -`void` - -###### Example - -```js -const body = new Body("Hello world."); -const options = { updateContentLength: true }; -request.setBody(body, options); -``` - -##### setHeader() - -> **setHeader**(`name`: `string`, `value`: `string`): `void` - -Set a header value. - -This will overwrite any existing values. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `name` | `string` | -| `value` | `string` | - -###### Returns - -`void` - -##### setHost() - -> **setHost**(`host`: `string`): `void` - -Set the host of the request. - -It will also update the `Host` header. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `host` | `string` | - -###### Returns - -`void` - -##### setMethod() - -> **setMethod**(`method`: [`Bytes`](index.md#bytes)): `void` - -Set the HTTP method of the request. - -All strings are accepted. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `method` | [`Bytes`](index.md#bytes) | - -###### Returns - -`void` - -##### setPath() - -> **setPath**(`path`: [`Bytes`](index.md#bytes)): `void` - -Set the path of the request. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `path` | [`Bytes`](index.md#bytes) | - -###### Returns - -`void` - -##### setPort() - -> **setPort**(`port`: `number`): `void` - -Set the port of the request. - -The port number must be between 1 and 65535. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `port` | `number` | - -###### Returns - -`void` - -##### setQuery() - -> **setQuery**(`query`: [`Bytes`](index.md#bytes)): `void` - -Set the unparsed query of the request. - -The query string should not include the leading `?`. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `query` | [`Bytes`](index.md#bytes) | - -###### Returns - -`void` - -###### Example - -```js -spec.setQuery("q=hello"); -``` - -##### setRaw() - -> **setRaw**(`raw`: [`Bytes`](index.md#bytes)): [`RequestSpecRaw`](index.md#requestspecraw) - -This method sets the raw [Bytes](index.md#bytes) of the request and converts it to a [RequestSpecRaw](index.md#requestspecraw). - -This is useful when you have a prepared [RequestSpec](index.md#requestspec) and you just want to modify the raw data. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `raw` | [`Bytes`](index.md#bytes) | - -###### Returns - -[`RequestSpecRaw`](index.md#requestspecraw) - -###### Example - -```js -const rawBytes = []; // RAW BYTES HERE -const request = new RequestSpec("https://example.com"); -const rawRequest = request.setRaw(rawBytes); -``` - -##### setTls() - -> **setTls**(`tls`: `boolean`): `void` - -Set if the request uses TLS (HTTPS). - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `tls` | `boolean` | - -###### Returns - -`void` - -##### parse() - -###### Call Signature - -> `static` **parse**(`bytes`: [`Bytes`](index.md#bytes)): [`RequestSpec`](index.md#requestspec) - -Parses raw bytes into a [RequestSpec](index.md#requestspec). - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `bytes` | [`Bytes`](index.md#bytes) | - -###### Returns - -[`RequestSpec`](index.md#requestspec) - -###### Throws - -If the bytes are not a valid HTTP request. - -###### Example - -```js -const rawInput = 'GET / HTTP/1.1\r\nHost: example.com\r\n\r\n'; -const spec = RequestSpec.parse(rawInput); -spec.setHeader('x-caido', 'test'); -const specRaw = spec.getRaw(); -const rawOutput = specRaw.getRaw(); // Will contain the new header -``` - -###### Call Signature - -> `static` **parse**(`raw`: [`RequestSpecRaw`](index.md#requestspecraw)): [`RequestSpec`](index.md#requestspec) - -Parses the raw bytes of a [RequestSpecRaw](index.md#requestspecraw) into a [RequestSpec](index.md#requestspec). - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `raw` | [`RequestSpecRaw`](index.md#requestspecraw) | - -###### Returns - -[`RequestSpec`](index.md#requestspec) - -###### Throws - -If the bytes are not a valid HTTP request. - -*** - -### RequestSpecRaw - -A mutable raw Request that has not yet been sent. - -#### Constructors - -##### new RequestSpecRaw() - -> **new RequestSpecRaw**(`url`: `string`): [`RequestSpecRaw`](index.md#requestspecraw) - -Build a new [RequestSpecRaw](index.md#requestspecraw) from a URL string. Only the host, port and scheme will be parsed. - -You can convert a saved immutable [Request](index.md#request-1) object into a [RequestSpecRaw](index.md#requestspecraw) object by using the `toSpecRaw()` method. - -You MUST use `setRaw` to set the raw bytes of the request. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `url` | `string` | - -###### Returns - -[`RequestSpecRaw`](index.md#requestspecraw) - -###### Example - -```js -const spec = new RequestSpecRaw("https://example.com"); -``` - -#### Methods - -##### getHost() - -> **getHost**(): `string` - -Get the host of the request. - -###### Returns - -`string` - -##### getPort() - -> **getPort**(): `number` - -Get the port of the request. - -###### Returns - -`number` - -##### getRaw() - -> **getRaw**(): `Uint8Array` - -Get the raw bytes of the request. - -###### Returns - -`Uint8Array` - -##### getSpec() - -> **getSpec**(): [`RequestSpec`](index.md#requestspec) - -This methods converts the [RequestSpecRaw](index.md#requestspecraw) to a [RequestSpec](index.md#requestspec). - -###### Returns - -[`RequestSpec`](index.md#requestspec) - -###### Throws - -If the bytes are not a valid HTTP request. - -###### See - -[RequestSpec.parse](index.md#parse) - -##### getTls() - -> **getTls**(): `boolean` - -Get if the request uses TLS (HTTPS). - -###### Returns - -`boolean` - -##### setHost() - -> **setHost**(`host`: `string`): `void` - -Set the host of the request. - -It will NOT update the `Host` header. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `host` | `string` | - -###### Returns - -`void` - -##### setPort() - -> **setPort**(`port`: `number`): `void` - -Set the port of the request. - -The port number must be between 1 and 65535. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `port` | `number` | - -###### Returns - -`void` - -##### setRaw() - -> **setRaw**(`raw`: [`Bytes`](index.md#bytes)): `void` - -Set the raw [Bytes](index.md#bytes) of the request. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `raw` | [`Bytes`](index.md#bytes) | - -###### Returns - -`void` - -##### setTls() - -> **setTls**(`tls`: `boolean`): `void` - -Set if the request uses TLS (HTTPS). - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `tls` | `boolean` | - -###### Returns - -`void` - -*** - -### Request - -> **Request**: `object` - -An immutable saved Request. - -To modify, use `toSpec` to get a `RequestSpec` object. - -#### Type declaration - -##### getBody() - -The body of the request. - -###### Returns - -`undefined` \| [`Body`](index.md#body) - -##### getCreatedAt() - -The datetime the request was recorded by the proxy. - -###### Returns - -`Date` - -##### getHeader() - -Get a header value. - -Header name is case-insensitive. -The header might have multiple values. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `name` | `string` | - -###### Returns - -`undefined` \| `string`[] - -##### getHeaders() - -The headers of the request. - -Header names are case-insensitive. -Each header might have multiple values. - -###### Returns - -`Record`\<`string`, `string`[]\> - -###### Example - -```json -{ - "Host": ["caido.io"], - "Connection": ["keep-alive"], - "Content-Length": ["95"] -} -``` - -##### getHost() - -The target host of the request. - -###### Returns - -`string` - -##### getId() - -The unique Caido [ID](index.md#id) of the request. - -###### Returns - -[`ID`](index.md#id) - -##### getMethod() - -The HTTP method of the request. - -###### Returns - -`string` - -##### getPath() - -The path of the request. - -###### Returns - -`string` - -##### getPort() - -The target port of the request. - -###### Returns - -`number` - -##### getQuery() - -The unparsed query of the request. - -Excludes the leading `?`. - -###### Returns - -`string` - -##### getRaw() - -The raw version of the request. - -Used to access the bytes directly. - -###### Returns - -[`RequestRaw`](index.md#requestraw) - -##### getTls() - -If the request uses TLS (HTTPS). - -###### Returns - -`boolean` - -##### getUrl() - -The full URL of the request. - -###### Returns - -`string` - -##### toSpec() - -Copied the request to a mutable un-saved [RequestSpec](index.md#requestspec). -This enables you to make modify a request before re-sending it. - -###### Returns - -[`RequestSpec`](index.md#requestspec) - -##### toSpecRaw() - -Copied the request to a mutable un-saved [RequestSpecRaw](index.md#requestspecraw). -The raw requests are not parsed and can be used to send invalid HTTP Requests. - -###### Returns - -[`RequestSpecRaw`](index.md#requestspecraw) - -*** - -### RequestOrderField - -> **RequestOrderField**: `"ext"` \| `"host"` \| `"id"` \| `"method"` \| `"path"` \| `"query"` \| `"created_at"` \| `"source"` - -Field to order requests by. - -*** - -### RequestRaw - -> **RequestRaw**: `object` - -An immutable saved raw Request. - -#### Type declaration - -##### toBytes() - -Get the raw request as an array of bytes. - -###### Returns - -`Uint8Array` - -##### toText() - -Parse the raw request as a string. - -Unprintable characters will be replaced with `�`. - -###### Returns - -`string` - -*** - -### RequestResponse - -> **RequestResponse**: `object` - -An immutable saved Request and Response pair. - -#### Type declaration - -##### request - -> **request**: [`Request`](index.md#request-1) - -##### response - -> **response**: [`Response`](index.md#response-4) - -*** - -### RequestResponseOpt - -> **RequestResponseOpt**: `object` - -An immutable saved Request and optional Response pair. - -#### Type declaration - -##### request - -> **request**: [`Request`](index.md#request-1) - -##### response? - -> `optional` **response**: [`Response`](index.md#response-4) - -*** - -### RequestsConnection - -> **RequestsConnection**: `object` - -A connection of requests. - -#### Type declaration - -##### items - -> **items**: [`RequestsConnectionItem`](index.md#requestsconnectionitem)[] - -##### pageInfo - -> **pageInfo**: [`PageInfo`](index.md#pageinfo) - -*** - -### RequestsConnectionItem - -> **RequestsConnectionItem**: `object` - -An item in a connection of requests. - -#### Type declaration - -##### cursor - -> **cursor**: [`Cursor`](index.md#cursor) - -##### request - -> **request**: [`Request`](index.md#request-1) - -##### response? - -> `optional` **response**: [`Response`](index.md#response-4) - -*** - -### RequestSendTimeouts - -> **RequestSendTimeouts**: `object` - -Timeouts for sending a request and receiving a response. - -#### Type declaration - -##### connect? - -> `optional` **connect**: `number` - -The timeout to open the TCP connection to the target host -and perform the TLS handshake. - -Defaults to 30s. - -##### extra? - -> `optional` **extra**: `number` - -The timeout to read data after we have a read the full response. - -This is useful if you believe the server will send more data -than implied by the Content-Length header. - -Defaults to 0s (no timeout). - -##### global? - -> `optional` **global**: `number` - -The global timeout for sending a request and receiving a response. - -No default value. - -##### partial? - -> `optional` **partial**: `number` - -The timeout between each read attempt for the response. -On a slow connection, this is important to increase. - -Defaults to 5s. - -##### response? - -> `optional` **response**: `number` - -The timeout to receive the first byte of the response. - -After the first byte is received, the partial timeout will be used. - -Defaults to 30s. - -*** - -### RequestsQuery - -> **RequestsQuery**: `object` - -Query builder to fetch requests. - -#### Type declaration - -##### after() - -Requests after a given cursor. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `cursor` | [`Cursor`](index.md#cursor) | [Cursor](index.md#cursor) of the request | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -##### ascending() - -###### Call Signature - -Ascending ordering. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `target` | `"req"` | Target of the ordering: req or resp. | -| `field` | [`RequestOrderField`](index.md#requestorderfield) | Field to order by. | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -###### Call Signature - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `target` | `"resp"` | -| `field` | [`ResponseOrderField`](index.md#responseorderfield) | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -##### before() - -Requests before a given cursor. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `cursor` | [`Cursor`](index.md#cursor) | [Cursor](index.md#cursor) of the request | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -##### descending() - -###### Call Signature - -Descending ordering. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `target` | `"req"` | Target of the ordering: req or resp. | -| `field` | [`RequestOrderField`](index.md#requestorderfield) | Field to order by. | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -###### Call Signature - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `target` | `"resp"` | -| `field` | [`ResponseOrderField`](index.md#responseorderfield) | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -##### execute() - -Execute the query. - -###### Returns - -`Promise`\<[`RequestsConnection`](index.md#requestsconnection)\> - -###### Throws - -If a query parameter is invalid or the query cannot be executed. - -##### filter() - -Filter requests. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `filter` | `string` | HTTPQL filter | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -##### first() - -First n requests. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `n` | `number` | Number of requests to return | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -##### last() - -Last n requests. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `n` | `number` | Number of requests to return | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -*** - -### RequestsSDK - -> **RequestsSDK**: `object` - -The SDK for the Requests service. - -#### Type declaration - -##### get() - -Get a request by its unique [ID](index.md#id). - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `id` | [`ID`](index.md#id) | - -###### Returns - -`Promise`\<`undefined` \| [`RequestResponseOpt`](index.md#requestresponseopt)\> - -###### Example - -```js -await sdk.requests.get("1"); -``` - -##### inScope() - -Checks if a request is in scope. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `request` | [`Request`](index.md#request-1) \| [`RequestSpec`](index.md#requestspec) | - -###### Returns - -`boolean` - -###### Example - -```js -if (sdk.requests.inScope(request)) { - sdk.console.log("In scope"); -} -``` - -##### matches() - -Checks if a request/response matches an HTTPQL filter. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `filter` | `string` | HTTPQL filter | -| `request` | [`Request`](index.md#request-1) | The [Request](index.md#request-1) to match against | -| `response`? | [`Response`](index.md#response-4) | The [Response](index.md#response-4) to match against | - -###### Returns - -`boolean` - -##### query() - -Query requests of the current project. - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -###### Example - -```js -const page = await sqk.requests.query().first(2).execute(); -sdk.console.log(`ID: ${page.items[1].request.getId()}`); -``` - -##### send() - -Sends an HTTP request, either a [RequestSpec](index.md#requestspec) or [RequestSpecRaw](index.md#requestspecraw). - -This respects the upstream proxy settings. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `request` | [`RequestSpec`](index.md#requestspec) \| [`RequestSpecRaw`](index.md#requestspecraw) | -| `options`? | [`RequestSendOptions`](index.md#requestsendoptions) | - -###### Returns - -`Promise`\<[`RequestResponse`](index.md#requestresponse)\> - -###### Throws - -If the request cannot be sent. -If the request times out, the error message will contain the word "Timeout". - -###### Example - -```js -const spec = new RequestSpec("https://example.com"); -try { - const res = await sdk.requests.send(request) - sdk.console.log(res.request.getId()); - sdk.console.log(res.response.getCode()); -} catch (err) { - sdk.console.error(err); -} -``` - -*** - -### Response - -> **Response**: `object` - -An immutable saved Response. - -#### Type declaration - -##### getBody() - -The body of the response - -###### Returns - -`undefined` \| [`Body`](index.md#body) - -##### getCode() - -The status code of the response. - -###### Returns - -`number` - -##### getCreatedAt() - -The datetime the response was recorded by the proxy. - -###### Returns - -`Date` - -##### getHeader() - -Get a header value. - -Header name is case-insensitive. -The header might have multiple values. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `name` | `string` | - -###### Returns - -`undefined` \| `string`[] - -##### getHeaders() - -The headers of the response. - -Header names are case-insensitive. -Each header might have multiple values. - -###### Returns - -`Record`\<`string`, `string`[]\> - -###### Example - -```json -{ - "Date": ["Sun, 26 May 2024 10:59:21 GMT"], - "Content-Type": ["text/html"] -} -``` - -##### getId() - -The unique Caido [ID](index.md#id) of the response. - -###### Returns - -[`ID`](index.md#id) - -##### getRaw() - -The raw version of the response. - -Used to access the bytes directly. - -###### Returns - -[`ResponseRaw`](index.md#responseraw) - -##### getRoundtripTime() - -The time it took to send the request and receive the response in milliseconds. - -###### Returns - -`number` - -*** - -### ResponseOrderField - -> **ResponseOrderField**: `"length"` \| `"roundtrip"` \| `"code"` - -Field to order responses by. - -*** - -### ResponseRaw - -> **ResponseRaw**: `object` - -An immutable saved raw Response. - -#### Type declaration - -##### toBytes() - -Get the raw response as an array of bytes. - -###### Returns - -`Uint8Array` - -##### toText() - -Parse the raw response as a string. - -Unprintable characters will be replaced with `�`. - -###### Returns - -`string` - -*** - -### SetBodyOptions - -> **SetBodyOptions**: `object` - -Options when setting the body of a Request. - -#### Type declaration - -##### updateContentLength - -> **updateContentLength**: `boolean` - -Should update the Content-export type header. - -###### Default - -```ts -true -``` - -## Findings - -### DedupeKey - -> **DedupeKey**: `string` & `object` - -A deduplication key. - -#### Type declaration - -##### \_\_dedupeKey? - -> `optional` **\_\_dedupeKey**: `never` - -*** - -### Finding - -> **Finding**: `object` - -A saved immutable Finding. - -#### Type declaration - -##### getDedupeKey() - -The deduplication key of the finding. - -###### Returns - -`undefined` \| [`DedupeKey`](index.md#dedupekey) - -##### getDescription() - -The description of the finding. - -###### Returns - -`undefined` \| `string` - -##### getId() - -The unique Caido [ID](index.md#id) of the finding. - -###### Returns - -[`ID`](index.md#id) - -##### getReporter() - -The name of the reporter. - -###### Returns - -`string` - -##### getRequestId() - -The ID of the associated [Request](index.md#request-1). - -###### Returns - -`string` - -##### getTitle() - -The title of the finding. - -###### Returns - -`string` - -*** - -### FindingSpec - -> **FindingSpec**: `object` - -A mutable Finding not yet created. - -#### Type declaration - -##### dedupeKey? - -> `optional` **dedupeKey**: [`DedupeKey`](index.md#dedupekey) - -Deduplication key for findings. -If a finding with the same dedupe key already exists, it will not be created. - -##### description? - -> `optional` **description**: `string` - -The description of the finding. - -##### reporter - -> **reporter**: `string` - -The name of the reporter. -It will be used to group findings. - -##### request - -> **request**: [`Request`](index.md#request-1) - -The associated [Request](index.md#request-1). - -##### title - -> **title**: `string` - -The title of the finding. - -*** - -### FindingsSDK - -> **FindingsSDK**: `object` - -The SDK for the Findings service. - -#### Type declaration - -##### create() - -Creates a new Finding. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `spec` | [`FindingSpec`](index.md#findingspec) | - -###### Returns - -`Promise`\<[`Finding`](index.md#finding)\> - -###### Throws - -If the request cannot be saved. - -###### Example - -```js -await sdk.findings.create({ - title: "Title", - description: "Description", - reporter: "Reporter", - dedupeKey: `${request.getHost()}-${request.getPath()}`, - request, -}); -``` - -##### exists() - -Check if a [Finding](index.md#finding) exists. -Similar to `get`, but returns a boolean. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `input` | [`GetFindingInput`](index.md#getfindinginput) | - -###### Returns - -`Promise`\<`boolean`\> - -###### Example - -```js -await sdk.findings.exists("my-dedupe-key"); -``` - -##### get() - -Try to get a [Finding](index.md#finding) for a request. - -Since a request can have multiple findings, this will return the first one found. -You can also filter by reporter to get a specific finding. - -Finally, you can use a deduplication key to get a specific finding. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `input` | [`GetFindingInput`](index.md#getfindinginput) | - -###### Returns - -`Promise`\<`undefined` \| [`Finding`](index.md#finding)\> - -###### Example - -```js -await sdk.findings.get({ - reporter: "Reporter", - request, -}); -``` - -*** - -### GetFindingInput - -> **GetFindingInput**: [`DedupeKey`](index.md#dedupekey) \| \{ `reporter`: `string`; `request`: [`Request`](index.md#request-1); \} - -Input to get a [Finding](index.md#finding). - -#### Type declaration - -[`DedupeKey`](index.md#dedupekey) - -\{ `reporter`: `string`; `request`: [`Request`](index.md#request-1); \} - -##### reporter? - -> `optional` **reporter**: `string` - -The name of the reporter. - -##### request - -> **request**: [`Request`](index.md#request-1) - -The associated [Request](index.md#request-1). - -## Replay - -### ReplayCollection - -> **ReplayCollection**: `object` - -A collection of replay sessions. - -#### Type declaration - -##### getId() - -The unique Caido [ID](index.md#id) of the replay collection. - -###### Returns - -[`ID`](index.md#id) - -##### getName() - -The name of the replay collection. - -###### Returns - -`string` - -*** - -### ReplaySDK - -> **ReplaySDK**: `object` - -The SDK for the Replay service. - -#### Type declaration - -##### createSession() - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `source`? | [`RequestSource`](index.md#requestsource) | -| `collection`? | [`ID`](index.md#id) \| [`ReplayCollection`](index.md#replaycollection) | - -###### Returns - -`Promise`\<[`ReplaySession`](index.md#replaysession)\> - -##### getCollections() - -###### Returns - -`Promise`\<[`ReplayCollection`](index.md#replaycollection)[]\> - -*** - -### ReplaySession - -> **ReplaySession**: `object` - -A replay session. - -#### Type declaration - -##### getId() - -The unique Caido [ID](index.md#id) of the replay session. - -###### Returns - -[`ID`](index.md#id) - -##### getName() - -The name of the replay session. - -###### Returns - -`string` - -## Projects - -### Project - -> **Project**: `object` - -A saved immutable Project. - -#### Type declaration - -##### getId() - -The unique Caido [ID](index.md#id) of the project. - -###### Returns - -[`ID`](index.md#id) - -##### getName() - -The name of the project. - -###### Returns - -`string` - -##### getPath() - -The directory where the project is located. - -###### Returns - -`string` - -##### getStatus() - -The status of the project. - -###### Returns - -[`ProjectStatus`](index.md#projectstatus) - -##### getVersion() - -The version of the project. -The format is `MAJOR.MINOR.PATCH`. - -###### Returns - -`string` - -*** - -### ProjectsSDK - -> **ProjectsSDK**: `object` - -The SDK for the Projects service. - -#### Type declaration - -##### getCurrent() - -Get the currently selected [Project](index.md#project) if any. - -###### Returns - -`Promise`\<`undefined` \| [`Project`](index.md#project)\> - -###### Example - -```js -await sdk.projects.getCurrent(); -``` - -*** - -### ProjectStatus - -> **ProjectStatus**: `"ready"` \| `"restoring"` \| `"error"` - -A [Project](index.md#project) status. - -## Shared - -### Bytes - -> **Bytes**: `string` \| `number`[] \| `Uint8Array` - -Types that can be converted to bytes in inputs. - -*** - -### Cursor - -> **Cursor**: `string` & `object` - -A cursor for pagination. - -#### Type declaration - -##### \_\_cursor? - -> `optional` **\_\_cursor**: `never` - -*** - -### DefineAPI\ - -> **DefineAPI**\<`API`\>: `{ [K in keyof API]: DefineAPICallback }` - -Define a Plugin backend functions that are callable from the frontend. - -#### Type Parameters - -| Type Parameter | -| ------ | -| `API` *extends* `Record`\<`string`, (...`args`: `any`[]) => [`MaybePromise`](index.md#maybepromiset)\<`any`\>\> | - -#### Example - -```typescript -function generateNumber(sdk: SDK, min: number, max: number): number { - return Math.floor(Math.random() * (max - min + 1) + min); -} - -export type API = DefineAPI<{ - generateNumber: typeof generateNumber; -}>; - -export function init(sdk: SDK) { - sdk.api.register("generateNumber", generateNumber); -} -``` - -*** - -### DefineAPICallback\ - -> **DefineAPICallback**\<`F`\>: `F` *extends* (`sdk`: [`SDK`](index.md#sdkapi-events), ...`args`: infer A) => infer R ? (...`args`: `A`) => `R` : `"Your callback must respect the format (sdk: SDK, ...args: unknown[]) => MaybePromise"` - -Parser for Plugin backend callable functions - -#### Type Parameters - -| Type Parameter | -| ------ | -| `F` | - -*** - -### DefineEventCallback\ - -> **DefineEventCallback**\<`F`\>: `F` *extends* (...`args`: infer A) => [`MaybePromise`](index.md#maybepromiset)\<`void`\> ? (...`args`: `A`) => [`MaybePromise`](index.md#maybepromiset)\<`void`\> : `"Your callback must respect the format (...args: unknown[]) => MaybePromise"` - -Parser for Plugin backend events callbacks. - -#### Type Parameters - -| Type Parameter | -| ------ | -| `F` | - -*** - -### DefineEvents\ - -> **DefineEvents**\<`Events`\>: `{ [K in keyof Events]: DefineEventCallback }` - -Define a Plugin backend events that the frontend can receive. - -#### Type Parameters - -| Type Parameter | -| ------ | -| `Events` *extends* `Record`\<`string`, (...`args`: `any`[]) => [`MaybePromise`](index.md#maybepromiset)\<`void`\>\> | - -#### Example - -```typescript -type MyEventData = { id: string; name: string }; - -export type BackendEvents = DefineEvents<{ - "myevent": (data: MyEventData) => void; -}>; - -export function init(sdk: SDK<{}, BackendEvents>) { - sdk.api.send("myevent", { id: "1", name: "hello" }); -} -``` - -*** - -### ID - -> **ID**: `string` & `object` - -A unique identifier. - -#### Type declaration - -##### \_\_id? - -> `optional` **\_\_id**: `never` - -*** - -### MaybePromise\ - -> **MaybePromise**\<`T`\>: `T` \| `Promise`\<`T`\> - -Promise or value. - -#### Type Parameters - -| Type Parameter | -| ------ | -| `T` | - -*** - -### MaybePromise\ - -> **MaybePromise**\<`T`\>: `T` \| `Promise`\<`T`\> - -Promise or value. - -#### Type Parameters - -| Type Parameter | -| ------ | -| `T` | - -*** - -### RawOption - -> **RawOption**: `object` - -Option to return raw value - -#### Type declaration - -##### raw - -> **raw**: `true` - -*** - -### RequestSource - -> **RequestSource**: [`ID`](index.md#id) \| [`Request`](index.md#request-1) \| [`RequestSpec`](index.md#requestspec) \| [`RequestSpecRaw`](index.md#requestspecraw) - -The source of a request. - -## Environment - -### EnvironmentSDK - -> **EnvironmentSDK**: `object` - -The SDK for the Environment service. - -#### Type declaration - -##### getVar() - -Get the value of an environment variable. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `name` | `string` | The name of the environment variable. | - -###### Returns - -`undefined` \| `string` - -The value of the environment variable. - -##### getVars() - -Get all the environment variables. -It includes the global environment and the selected environment. -Those variables can change over time so avoid caching them. - -###### Returns - -[`EnvironmentVariable`](index.md#environmentvariable)[] - -An array of [EnvironmentVariable](index.md#environmentvariable) - -##### setVar() - -Sets an environment variable to a given value. -This will override any existing value. -The environment variable can be set either on the currently -selected environment or the global environment. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `input` | [`SetVarInput`](index.md#setvarinput) | - -###### Returns - -`Promise`\<`void`\> - -###### Throws - -If trying to set when a project is not selected. - -###### Throws - -If trying to set when an environment is not selected (with `global: false`). - -###### Example - -```js -await sdk.env.setVar({ - name: "USER_SECRET", - value: "my secret value", - secret: true, - global: false -}); -``` - -*** - -### EnvironmentVariable - -> **EnvironmentVariable**: `object` - -A saved immutable Finding. - -#### Type declaration - -##### isSecret - -> `readonly` **isSecret**: `boolean` - -If the environment variable is a secret - -##### name - -> `readonly` **name**: `string` - -The name of the environment variable - -##### value - -> `readonly` **value**: `string` - -The value of the environment variable - -*** - -### SetVarInput - -> **SetVarInput**: `object` - -Input for the `setVar` of [EnvironmentSDK](index.md#environmentsdk). - -#### Type declaration - -##### env? - -> `optional` **env**: `string` - -The `name` of the Environment to set the variable on. -This will take precedence over the `global` flag if provided. - -##### global - -> **global**: `boolean` - -If the environment variable should be set on the global -environment or the currently selected environment. -By default, it will be set globally. - -###### Default - -```ts -true -``` - -##### name - -> **name**: `string` - -Name of the environment variable - -##### secret - -> **secret**: `boolean` - -If the environment variable should be treated as secret. -Secrets are encrypted on the disk. - -###### Default - -```ts -false -``` - -##### value - -> **value**: `string` - -Value of the environment variable - -## GraphQL - -### GraphQLSDK - -> **GraphQLSDK**: `object` - -The SDK for the GraphQL service. - -#### Type declaration - -##### execute() - -Executes a GraphQL query. - -###### Type Parameters - -| Type Parameter | -| ------ | -| `T` | - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `query` | `string` | -| `variables`? | `Record`\<`string`, `any`\> | - -###### Returns - -`Promise`\<[`GraphQLResponse`](index.md#graphqlresponset)\<`T`\>\> - -###### Example - -```js -await sdk.graphql.execute(` - query { - viewer - } -`); -``` - -## Other - -### Database - -A SQLite database. - -The implementation uses a connection pool and is fully asynchronous. -Each connection will be spawned in a worker thread. - -#### Example - -```ts -const db = await open({ filename: "path/to/database.sqlite" }); -await db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT);"); -await db.exec("INSERT INTO test (name) VALUES ('foo');"); -``` - -#### Constructors - -##### new Database() - -> **new Database**(): [`Database`](index.md#database) - -###### Returns - -[`Database`](index.md#database) - -#### Methods - -##### exec() - -> **exec**(`sql`: `string`): `Promise`\<`void`\> - -This method allows one or more SQL statements to be executed without returning any results. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `sql` | `string` | - -###### Returns - -`Promise`\<`void`\> - -##### prepare() - -> **prepare**(`sql`: `string`): `Promise`\<[`Statement`](index.md#statement)\> - -Compiles a SQL statement into a [prepared statement](https://www.sqlite.org/c3ref/stmt.html). - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `sql` | `string` | - -###### Returns - -`Promise`\<[`Statement`](index.md#statement)\> - -*** - -### Statement - -This class represents a single prepared statement. This class cannot be instantiated via its constructor. -Instead, instances are created via the database.prepare() method. - -#### Constructors - -##### new Statement() - -> **new Statement**(): [`Statement`](index.md#statement) - -###### Returns - -[`Statement`](index.md#statement) - -#### Methods - -##### all() - -> **all**\<`T`\>(...`params`: [`Parameter`](index.md#parameter)[]): `Promise`\<`T`[]\> - -This method executes a prepared statement and returns all results as an array of objects. -If the prepared statement does not return any results, this method returns an empty array. -The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the values in `params`. - -###### Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `T` *extends* `object` | `object` | - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| ...`params` | [`Parameter`](index.md#parameter)[] | The values to bind to the prepared statement. Named parameters are not supported. | - -###### Returns - -`Promise`\<`T`[]\> - -##### get() - -> **get**\<`T`\>(...`params`: [`Parameter`](index.md#parameter)[]): `Promise`\<`undefined` \| `T`\> - -This method executes a prepared statement and returns the first result as an object. -If the prepared statement does not return any results, this method returns undefined. -The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the values in params. - -###### Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `T` *extends* `object` | `object` | - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| ...`params` | [`Parameter`](index.md#parameter)[] | The values to bind to the prepared statement. Named parameters are not supported. | - -###### Returns - -`Promise`\<`undefined` \| `T`\> - -##### run() - -> **run**(...`params`: [`Parameter`](index.md#parameter)[]): `Promise`\<[`Result`](index.md#result)\> - -This method executes a prepared statement and returns an object summarizing the resulting changes. -The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the values in params. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| ...`params` | [`Parameter`](index.md#parameter)[] | The values to bind to the prepared statement. Named parameters are not supported. | - -###### Returns - -`Promise`\<[`Result`](index.md#result)\> - -*** - -### Console - -> **Console**: `object` - -Console interface for logging. - -Currently logs are only available in the backend logs. -See the [documentation](https://docs.caido.io/report_bug.html#1-backend-logs) on how to retrieve them. - -#### Type declaration - -##### debug() - -Log a message with the debug level. - -Usually used for troubleshooting purposes. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `message` | `any` | - -###### Returns - -`void` - -##### error() - -Log a message with the error level. - -Usually used for critical errors. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `message` | `any` | - -###### Returns - -`void` - -##### log() - -Log a message with the info level. - -Usually used for general information. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `message` | `any` | - -###### Returns - -`void` - -##### warn() - -Log a message with the warn level. - -Usually used for unexpected behaviors. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `message` | `any` | - -###### Returns - -`void` - -*** - -### GraphQLError - -> **GraphQLError**: `object` - -#### Type declaration - -##### extensions - -> **extensions**: `Record`\<`string`, `any`\> - -##### locations - -> **locations**: [`GraphQLLocation`](index.md#graphqllocation)[] - -##### message - -> **message**: `string` - -##### path - -> **path**: [`GraphQLPathSegment`](index.md#graphqlpathsegment)[] - -*** - -### GraphQLLocation - -> **GraphQLLocation**: `object` - -#### Type declaration - -##### column - -> **column**: `number` - -##### line - -> **line**: `number` - -*** - -### GraphQLPathSegment - -> **GraphQLPathSegment**: `string` \| `number` - -*** - -### GraphQLResponse\ - -> **GraphQLResponse**\<`T`\>: `object` - -#### Type Parameters - -| Type Parameter | -| ------ | -| `T` | - -#### Type declaration - -##### data? - -> `optional` **data**: `T` - -##### errors? - -> `optional` **errors**: [`GraphQLError`](index.md#graphqlerror)[] - -*** - -### PageInfo - -> **PageInfo**: `object` - -Information on the current page of paginated data. - -#### Type declaration - -##### endCursor - -> **endCursor**: [`Cursor`](index.md#cursor) - -##### hasNextPage - -> **hasNextPage**: `boolean` - -##### hasPreviousPage - -> **hasPreviousPage**: `boolean` - -##### startCursor - -> **startCursor**: [`Cursor`](index.md#cursor) - -*** - -### Parameter - -> **Parameter**: `null` \| `number` \| `bigint` \| `string` \| `Uint8Array` - -*** - -### RequestSendOptions - -> **RequestSendOptions**: `object` - -#### Type declaration - -##### save? - -> `optional` **save**: `boolean` - -If true, the request and response will be saved to the database -and the user will see them in the Search tab. - -If you do not save, the request and response IDs will be set to 0. - -###### Default - -```ts -true -``` - -##### timeouts? - -> `optional` **timeouts**: [`RequestSendTimeouts`](index.md#requestsendtimeouts) \| `number` - -The timeouts to use for sending a request and receiving a response. - -If a number is provided, it will be used as the global timeout and -the other timeouts will be set to infinity. - -See the [RequestSendTimeouts](index.md#requestsendtimeouts) for the default values. - -*** - -### Result - -> **Result**: `object` - -#### Type declaration - -##### changes - -> **changes**: `number` - -##### lastInsertRowid - -> **lastInsertRowid**: `number` - -## Runtime - -### RuntimeSDK - -> **RuntimeSDK**: `object` - -The SDK for the runtime information. - -#### Type declaration - -##### version - -###### Get Signature - -> **get** **version**(): `string` - -Get the current version of Caido. - -###### Returns - -`string` - -## Scope - -### Scope - -> **Scope**: `object` - -A saved immutable Scope. - -#### Type declaration - -##### allowlist - -> `readonly` **allowlist**: `string`[] - -The allowlist of the scope. - -##### denylist - -> `readonly` **denylist**: `string`[] - -The denylist of the scope. - -##### id - -> `readonly` **id**: [`ID`](index.md#id) - -The unique Caido [ID](index.md#id) of the scope. - -##### name - -> `readonly` **name**: `string` - -The name of the scope. - -*** - -### ScopeSDK - -> **ScopeSDK**: `object` - -The SDK for the Scope service. - -#### Type declaration - -##### getAll() - -Get all the scopes. - -###### Returns - -`Promise`\<[`Scope`](index.md#scope-1)[]\> - -An array of [Scope](index.md#scope-1) +## API Reference + +- [Meta](meta.md) +- [API](api.md) +- [Events](events.md) +- [Requests](requests.md) +- [Findings](findings.md) +- [Replay](replay.md) +- [Projects](projects.md) +- [Shared](shared.md) +- [Environment](environment.md) +- [GraphQL](graphql.md) +- [HostedFile](hostedfile.md) +- [Other](other.md) +- [Runtime](runtime.md) +- [Scope](scope.md) diff --git a/src/reference/sdks/backend/meta.md b/src/reference/sdks/backend/meta.md new file mode 100644 index 0000000..7b4c20c --- /dev/null +++ b/src/reference/sdks/backend/meta.md @@ -0,0 +1,68 @@ +# Meta + +### MetaSDK + +> **MetaSDK** = `object` + +The SDK for metadata information about the plugin. + +#### Methods + +##### assetsPath() + +> **assetsPath**(): `string` + +The directory of the plugin's assets in Caido Data. +You can read static data from your plugin in this directory. +You shouldn't write anything there, as the contents can be reset at any time. + +###### Returns + +`string` + +##### db() + +> **db**(): `Promise`\<[`Database`](other.md#database)\> + +Get a sqlite database for the plugin stored in Caido Data. +You can use this to store data related to your plugin. + +###### Returns + +`Promise`\<[`Database`](other.md#database)\> + +##### path() + +> **path**(): `string` + +The directory of the plugin in Caido Data. +You can store data related to your plugin in this directory. + +###### Returns + +`string` + +##### updateAvailable() + +> **updateAvailable**(): `Promise`\<`boolean`\> + +Check if an update is available for the plugin. + +###### Returns + +`Promise`\<`boolean`\> + +###### Throws + +If Caido Cloud is offline. + +##### version() + +> **version**(): `string` + +Get the version of the plugin. +This uses the semver format. + +###### Returns + +`string` diff --git a/src/reference/sdks/backend/other.md b/src/reference/sdks/backend/other.md new file mode 100644 index 0000000..f34063d --- /dev/null +++ b/src/reference/sdks/backend/other.md @@ -0,0 +1,311 @@ +# Other + +### Database + +A SQLite database. + +The implementation uses a connection pool and is fully asynchronous. +Each connection will be spawned in a worker thread. + +#### Example + +```ts +const db = await open({ filename: "path/to/database.sqlite" }); +await db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT);"); +await db.exec("INSERT INTO test (name) VALUES ('foo');"); +``` + +#### Constructors + +##### Constructor + +> **new Database**(): [`Database`](#database) + +###### Returns + +[`Database`](#database) + +#### Methods + +##### exec() + +> **exec**(`sql`: `string`): `Promise`\<`void`\> + +This method allows one or more SQL statements to be executed without returning any results. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `sql` | `string` | + +###### Returns + +`Promise`\<`void`\> + +##### prepare() + +> **prepare**(`sql`: `string`): `Promise`\<[`Statement`](#statement)\> + +Compiles a SQL statement into a [prepared statement](https://www.sqlite.org/c3ref/stmt.html). + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `sql` | `string` | + +###### Returns + +`Promise`\<[`Statement`](#statement)\> + +*** + +### Statement + +This class represents a single prepared statement. This class cannot be instantiated via its constructor. +Instead, instances are created via the database.prepare() method. + +#### Constructors + +##### Constructor + +> **new Statement**(): [`Statement`](#statement) + +###### Returns + +[`Statement`](#statement) + +#### Methods + +##### all() + +> **all**\<`T`\>(...`params`: [`Parameter`](#parameter)[]): `Promise`\<`T`[]\> + +This method executes a prepared statement and returns all results as an array of objects. +If the prepared statement does not return any results, this method returns an empty array. +The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the values in `params`. + +###### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `T` *extends* `object` | `object` | + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| ...`params` | [`Parameter`](#parameter)[] | The values to bind to the prepared statement. Named parameters are not supported. | + +###### Returns + +`Promise`\<`T`[]\> + +##### get() + +> **get**\<`T`\>(...`params`: [`Parameter`](#parameter)[]): `Promise`\<`T` \| `undefined`\> + +This method executes a prepared statement and returns the first result as an object. +If the prepared statement does not return any results, this method returns undefined. +The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the values in params. + +###### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `T` *extends* `object` | `object` | + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| ...`params` | [`Parameter`](#parameter)[] | The values to bind to the prepared statement. Named parameters are not supported. | + +###### Returns + +`Promise`\<`T` \| `undefined`\> + +##### run() + +> **run**(...`params`: [`Parameter`](#parameter)[]): `Promise`\<[`Result`](#result)\> + +This method executes a prepared statement and returns an object summarizing the resulting changes. +The prepared statement [parameters are bound](https://www.sqlite.org/c3ref/bind_blob.html) using the values in params. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| ...`params` | [`Parameter`](#parameter)[] | The values to bind to the prepared statement. Named parameters are not supported. | + +###### Returns + +`Promise`\<[`Result`](#result)\> + +*** + +### Console + +> **Console** = `object` + +Console interface for logging. + +Currently logs are only available in the backend logs. +See the [documentation](https://docs.caido.io/report_bug.html#1-backend-logs) on how to retrieve them. + +#### Methods + +##### debug() + +> **debug**(`message`: `any`): `void` + +Log a message with the debug level. + +Usually used for troubleshooting purposes. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `message` | `any` | + +###### Returns + +`void` + +##### error() + +> **error**(`message`: `any`): `void` + +Log a message with the error level. + +Usually used for critical errors. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `message` | `any` | + +###### Returns + +`void` + +##### log() + +> **log**(`message`: `any`): `void` + +Log a message with the info level. + +Usually used for general information. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `message` | `any` | + +###### Returns + +`void` + +##### warn() + +> **warn**(`message`: `any`): `void` + +Log a message with the warn level. + +Usually used for unexpected behaviors. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `message` | `any` | + +###### Returns + +`void` + +*** + +### PageInfo + +> **PageInfo** = `object` + +Information on the current page of paginated data. + +#### Properties + +##### endCursor + +> **endCursor**: [`Cursor`](shared.md#cursor) + +##### hasNextPage + +> **hasNextPage**: `boolean` + +##### hasPreviousPage + +> **hasPreviousPage**: `boolean` + +##### startCursor + +> **startCursor**: [`Cursor`](shared.md#cursor) + +*** + +### Parameter + +> **Parameter** = `null` \| `number` \| `bigint` \| `string` \| `Uint8Array` + +*** + +### RequestSendOptions + +> **RequestSendOptions** = `object` + +#### Properties + +##### save? + +> `optional` **save**: `boolean` + +If true, the request and response will be saved to the database +and the user will see them in the Search tab. + +If you do not save, the request and response IDs will be set to 0. + +###### Default + +```ts +true +``` + +##### timeouts? + +> `optional` **timeouts**: [`RequestSendTimeouts`](requests.md#requestsendtimeouts) \| `number` + +The timeouts to use for sending a request and receiving a response. + +If a number is provided, it will be used as the global timeout and +the other timeouts will be set to infinity. + +See the [RequestSendTimeouts](requests.md#requestsendtimeouts) for the default values. + +*** + +### Result + +> **Result** = `object` + +#### Properties + +##### changes + +> **changes**: `number` + +##### lastInsertRowid + +> **lastInsertRowid**: `number` diff --git a/src/reference/sdks/backend/projects.md b/src/reference/sdks/backend/projects.md new file mode 100644 index 0000000..b0af6bb --- /dev/null +++ b/src/reference/sdks/backend/projects.md @@ -0,0 +1,94 @@ +# Projects + +### Project + +> **Project** = `object` + +A saved immutable Project. + +#### Methods + +##### getId() + +> **getId**(): [`ID`](shared.md#id) + +The unique Caido [ID](shared.md#id) of the project. + +###### Returns + +[`ID`](shared.md#id) + +##### getName() + +> **getName**(): `string` + +The name of the project. + +###### Returns + +`string` + +##### getPath() + +> **getPath**(): `string` + +The directory where the project is located. + +###### Returns + +`string` + +##### getStatus() + +> **getStatus**(): [`ProjectStatus`](#projectstatus) + +The status of the project. + +###### Returns + +[`ProjectStatus`](#projectstatus) + +##### getVersion() + +> **getVersion**(): `string` + +The version of the project. +The format is `MAJOR.MINOR.PATCH`. + +###### Returns + +`string` + +*** + +### ProjectsSDK + +> **ProjectsSDK** = `object` + +The SDK for the Projects service. + +#### Methods + +##### getCurrent() + +> **getCurrent**(): `Promise`\<[`Project`](#project) \| `undefined`\> + +Get the currently selected [Project](#project) if any. + +###### Returns + +`Promise`\<[`Project`](#project) \| `undefined`\> + +###### Example + +```js +await sdk.projects.getCurrent(); +``` + +*** + +### ProjectStatus + +> **ProjectStatus** = `"ready"` \| `"restoring"` \| `"error"` + +A [Project](#project) status. diff --git a/src/reference/sdks/backend/replay.md b/src/reference/sdks/backend/replay.md new file mode 100644 index 0000000..85befdd --- /dev/null +++ b/src/reference/sdks/backend/replay.md @@ -0,0 +1,92 @@ +# Replay + +### ReplayCollection + +> **ReplayCollection** = `object` + +A collection of replay sessions. + +#### Methods + +##### getId() + +> **getId**(): [`ID`](shared.md#id) + +The unique Caido [ID](shared.md#id) of the replay collection. + +###### Returns + +[`ID`](shared.md#id) + +##### getName() + +> **getName**(): `string` + +The name of the replay collection. + +###### Returns + +`string` + +*** + +### ReplaySDK + +> **ReplaySDK** = `object` + +The SDK for the Replay service. + +#### Methods + +##### createSession() + +> **createSession**(`source?`: [`RequestSource`](shared.md#requestsource), `collection?`: [`ID`](shared.md#id) \| [`ReplayCollection`](#replaycollection)): `Promise`\<[`ReplaySession`](#replaysession)\> + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `source?` | [`RequestSource`](shared.md#requestsource) | +| `collection?` | [`ID`](shared.md#id) \| [`ReplayCollection`](#replaycollection) | + +###### Returns + +`Promise`\<[`ReplaySession`](#replaysession)\> + +##### getCollections() + +> **getCollections**(): `Promise`\<[`ReplayCollection`](#replaycollection)[]\> + +###### Returns + +`Promise`\<[`ReplayCollection`](#replaycollection)[]\> + +*** + +### ReplaySession + +> **ReplaySession** = `object` + +A replay session. + +#### Methods + +##### getId() + +> **getId**(): [`ID`](shared.md#id) + +The unique Caido [ID](shared.md#id) of the replay session. + +###### Returns + +[`ID`](shared.md#id) + +##### getName() + +> **getName**(): `string` + +The name of the replay session. + +###### Returns + +`string` diff --git a/src/reference/sdks/backend/requests.md b/src/reference/sdks/backend/requests.md new file mode 100644 index 0000000..d121ed6 --- /dev/null +++ b/src/reference/sdks/backend/requests.md @@ -0,0 +1,1602 @@ +# Requests + +### Body + +The body of a [Request](#request) or [Response](#response). + +Calling `to` will try to convert the body to the desired format. + +#### Constructors + +##### Constructor + +> **new Body**(`data`: `string` \| `number`[] \| `Uint8Array`): [`Body`](#body) + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `data` | `string` \| `number`[] \| `Uint8Array` | + +###### Returns + +[`Body`](#body) + +#### Properties + +##### length + +> `readonly` **length**: `number` + +The length of the body in bytes. + +#### Methods + +##### toJson() + +> **toJson**(): `unknown` + +Try to parse the body as JSON. + +###### Returns + +`unknown` + +###### Throws + +If the body is not valid JSON. + +##### toRaw() + +> **toRaw**(): `Uint8Array` + +Get the raw body as an array of bytes. + +###### Returns + +`Uint8Array` + +##### toText() + +> **toText**(): `string` + +Parse the body as a string. + +Unprintable characters will be replaced with `�`. + +###### Returns + +`string` + +*** + +### RequestSpec + +A mutable Request that has not yet been sent. + +#### Constructors + +##### Constructor + +> **new RequestSpec**(`url`: `string`): [`RequestSpec`](#requestspec) + +Build a new [RequestSpec](#requestspec) from a URL string. +We try to infer as much information as possible from the URL, including the scheme, host, path and query. + +You can convert a saved immutable [Request](#request) object into a [RequestSpec](#requestspec) object by using the `toSpec()` method. + +By default: + +- Method is `GET`. +- Path is `/`. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `url` | `string` | + +###### Returns + +[`RequestSpec`](#requestspec) + +###### Throws + +If the URL is invalid. + +###### Example + +```js +const spec = new RequestSpec("https://example.com"); +``` + +#### Methods + +##### getBody() + +> **getBody**(): [`Body`](#body) \| `undefined` + +The body of the request. + +###### Returns + +[`Body`](#body) \| `undefined` + +##### getHeader() + +> **getHeader**(`name`: `string` \| [`GetHeaderOptions`](#getheaderoptions)): `string`[] \| `undefined` + +Get a header value. + +Header name is case-insensitive. +The header might have multiple values. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `name` | `string` \| [`GetHeaderOptions`](#getheaderoptions) | + +###### Returns + +`string`[] \| `undefined` + +##### getHeaders() + +> **getHeaders**(): `Record`\<`string`, `string`[]\> + +The headers of the request. + +Header names are case-insensitive. +Each header might have multiple values. + +###### Returns + +`Record`\<`string`, `string`[]\> + +###### Example + +```json +{ + "Host": ["caido.io"], + "Connection": ["keep-alive"], + "Content-Length": ["95"] +} +``` + +##### getHost() + +> **getHost**(): `string` + +Get the host of the request. + +###### Returns + +`string` + +##### getMethod() + +###### Call Signature + +> **getMethod**(): `string` + +Get the HTTP method of the request. + +Get the raw version by passing `{ raw: true }` in the options. + +###### Returns + +`string` + +###### Call Signature + +> **getMethod**(`options`: [`RawOption`](shared.md#rawoption)): `Uint8Array` + +Get the HTTP method of the request. + +Get the raw version by passing `{ raw: true }` in the options. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `options` | [`RawOption`](shared.md#rawoption) | + +###### Returns + +`Uint8Array` + +##### getPath() + +###### Call Signature + +> **getPath**(): `string` + +Get the path of the request. + +Get the raw version by passing `{ raw: true }` in the options. + +###### Returns + +`string` + +###### Call Signature + +> **getPath**(`options`: [`RawOption`](shared.md#rawoption)): `Uint8Array` + +Get the path of the request. + +Get the raw version by passing `{ raw: true }` in the options. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `options` | [`RawOption`](shared.md#rawoption) | + +###### Returns + +`Uint8Array` + +##### getPort() + +> **getPort**(): `number` + +Get the port of the request. + +###### Returns + +`number` + +##### getQuery() + +###### Call Signature + +> **getQuery**(): `string` + +Get the unparsed query of the request. + +Get the raw version by passing `{ raw: true }` in the options. + +Excludes the leading `?`. + +###### Returns + +`string` + +###### Call Signature + +> **getQuery**(`options`: [`RawOption`](shared.md#rawoption)): `Uint8Array` + +Get the unparsed query of the request. + +Get the raw version by passing `{ raw: true }` in the options. + +Excludes the leading `?`. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `options` | [`RawOption`](shared.md#rawoption) | + +###### Returns + +`Uint8Array` + +##### getRaw() + +> **getRaw**(): [`RequestSpecRaw`](#requestspecraw) + +This methods converts the [RequestSpec](#requestspec) to a [RequestSpecRaw](#requestspecraw). + +This is useful to retrieve the raw bytes of the request. + +###### Returns + +[`RequestSpecRaw`](#requestspecraw) + +###### Example + +```js +const spec = new RequestSpec("https://example.com"); +const specRaw = spec.getRaw(); +const bytes = specRaw.getRaw(); // GET / HTTP/1.1\r\nHost: example.com\r\n\r\n +``` + +##### getTls() + +> **getTls**(): `boolean` + +Get if the request uses TLS (HTTPS). + +###### Returns + +`boolean` + +##### removeHeader() + +> **removeHeader**(`name`: `string`): `void` + +Removes a header. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `name` | `string` | + +###### Returns + +`void` + +##### setBody() + +> **setBody**(`body`: [`Bytes`](shared.md#bytes) \| [`Body`](#body), `options?`: [`SetBodyOptions`](#setbodyoptions)): `void` + +Set the body of the request. + +The body can either be a [Body](#body) or any type that can be converted to [Bytes](shared.md#bytes). + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `body` | [`Bytes`](shared.md#bytes) \| [`Body`](#body) | +| `options?` | [`SetBodyOptions`](#setbodyoptions) | + +###### Returns + +`void` + +###### Example + +```js +const body = new Body("Hello world."); +const options = { updateContentLength: true }; +request.setBody(body, options); +``` + +##### setHeader() + +> **setHeader**(`name`: `string`, `value`: `string`): `void` + +Set a header value. + +This will overwrite any existing values. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `name` | `string` | +| `value` | `string` | + +###### Returns + +`void` + +##### setHost() + +> **setHost**(`host`: `string`): `void` + +Set the host of the request. + +It will also update the `Host` header. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `host` | `string` | + +###### Returns + +`void` + +##### setMethod() + +> **setMethod**(`method`: [`Bytes`](shared.md#bytes)): `void` + +Set the HTTP method of the request. + +All strings are accepted. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `method` | [`Bytes`](shared.md#bytes) | + +###### Returns + +`void` + +##### setPath() + +> **setPath**(`path`: [`Bytes`](shared.md#bytes)): `void` + +Set the path of the request. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `path` | [`Bytes`](shared.md#bytes) | + +###### Returns + +`void` + +##### setPort() + +> **setPort**(`port`: `number`): `void` + +Set the port of the request. + +The port number must be between 1 and 65535. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `port` | `number` | + +###### Returns + +`void` + +##### setQuery() + +> **setQuery**(`query`: [`Bytes`](shared.md#bytes)): `void` + +Set the unparsed query of the request. + +The query string should not include the leading `?`. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `query` | [`Bytes`](shared.md#bytes) | + +###### Returns + +`void` + +###### Example + +```js +spec.setQuery("q=hello"); +``` + +##### setRaw() + +> **setRaw**(`raw`: [`Bytes`](shared.md#bytes)): [`RequestSpecRaw`](#requestspecraw) + +This method sets the raw [Bytes](shared.md#bytes) of the request and converts it to a [RequestSpecRaw](#requestspecraw). + +This is useful when you have a prepared [RequestSpec](#requestspec) and you just want to modify the raw data. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `raw` | [`Bytes`](shared.md#bytes) | + +###### Returns + +[`RequestSpecRaw`](#requestspecraw) + +###### Example + +```js +const rawBytes = []; // RAW BYTES HERE +const request = new RequestSpec("https://example.com"); +const rawRequest = request.setRaw(rawBytes); +``` + +##### setTls() + +> **setTls**(`tls`: `boolean`): `void` + +Set if the request uses TLS (HTTPS). + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `tls` | `boolean` | + +###### Returns + +`void` + +##### parse() + +###### Call Signature + +> `static` **parse**(`bytes`: [`Bytes`](shared.md#bytes)): [`RequestSpec`](#requestspec) + +Parses raw bytes into a [RequestSpec](#requestspec). + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `bytes` | [`Bytes`](shared.md#bytes) | + +###### Returns + +[`RequestSpec`](#requestspec) + +###### Throws + +If the bytes are not a valid HTTP request. + +###### Example + +```js +const rawInput = 'GET / HTTP/1.1\r\nHost: example.com\r\n\r\n'; +const spec = RequestSpec.parse(rawInput); +spec.setHeader('x-caido', 'test'); +const specRaw = spec.getRaw(); +const rawOutput = specRaw.getRaw(); // Will contain the new header +``` + +###### Call Signature + +> `static` **parse**(`raw`: [`RequestSpecRaw`](#requestspecraw)): [`RequestSpec`](#requestspec) + +Parses the raw bytes of a [RequestSpecRaw](#requestspecraw) into a [RequestSpec](#requestspec). + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `raw` | [`RequestSpecRaw`](#requestspecraw) | + +###### Returns + +[`RequestSpec`](#requestspec) + +###### Throws + +If the bytes are not a valid HTTP request. + +*** + +### RequestSpecRaw + +A mutable raw Request that has not yet been sent. + +#### Constructors + +##### Constructor + +> **new RequestSpecRaw**(`url`: `string`): [`RequestSpecRaw`](#requestspecraw) + +Build a new [RequestSpecRaw](#requestspecraw) from a URL string. Only the host, port and scheme will be parsed. + +You can convert a saved immutable [Request](#request) object into a [RequestSpecRaw](#requestspecraw) object by using the `toSpecRaw()` method. + +You MUST use `setRaw` to set the raw bytes of the request. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `url` | `string` | + +###### Returns + +[`RequestSpecRaw`](#requestspecraw) + +###### Example + +```js +const spec = new RequestSpecRaw("https://example.com"); +``` + +#### Methods + +##### getHost() + +> **getHost**(): `string` + +Get the host of the request. + +###### Returns + +`string` + +##### getPort() + +> **getPort**(): `number` + +Get the port of the request. + +###### Returns + +`number` + +##### getRaw() + +> **getRaw**(): `Uint8Array` + +Get the raw bytes of the request. + +###### Returns + +`Uint8Array` + +##### getSpec() + +> **getSpec**(): [`RequestSpec`](#requestspec) + +This methods converts the [RequestSpecRaw](#requestspecraw) to a [RequestSpec](#requestspec). + +###### Returns + +[`RequestSpec`](#requestspec) + +###### Throws + +If the bytes are not a valid HTTP request. + +###### See + +[RequestSpec.parse](#parse) + +##### getTls() + +> **getTls**(): `boolean` + +Get if the request uses TLS (HTTPS). + +###### Returns + +`boolean` + +##### setHost() + +> **setHost**(`host`: `string`): `void` + +Set the host of the request. + +It will NOT update the `Host` header. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `host` | `string` | + +###### Returns + +`void` + +##### setPort() + +> **setPort**(`port`: `number`): `void` + +Set the port of the request. + +The port number must be between 1 and 65535. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `port` | `number` | + +###### Returns + +`void` + +##### setRaw() + +> **setRaw**(`raw`: [`Bytes`](shared.md#bytes)): `void` + +Set the raw [Bytes](shared.md#bytes) of the request. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `raw` | [`Bytes`](shared.md#bytes) | + +###### Returns + +`void` + +##### setTls() + +> **setTls**(`tls`: `boolean`): `void` + +Set if the request uses TLS (HTTPS). + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `tls` | `boolean` | + +###### Returns + +`void` + +*** + +### GetHeaderOptions + +> **GetHeaderOptions** = `object` + +Options for getting a header value. + +#### Properties + +##### name + +> **name**: `string` + +The name of the header to get. +Header name is case-insensitive. + +##### split? + +> `optional` **split**: `boolean` + +Whether to split the header value on commas. + +###### Default + +```ts +false +``` + +*** + +### Request + +> **Request** = `object` + +An immutable saved Request. + +To modify, use `toSpec` to get a `RequestSpec` object. + +#### Methods + +##### getBody() + +> **getBody**(): [`Body`](#body) \| `undefined` + +The body of the request. + +###### Returns + +[`Body`](#body) \| `undefined` + +##### getCreatedAt() + +> **getCreatedAt**(): `Date` + +The datetime the request was recorded by the proxy. + +###### Returns + +`Date` + +##### getHeader() + +> **getHeader**(`name`: `string` \| [`GetHeaderOptions`](#getheaderoptions)): `string`[] \| `undefined` + +Get a header value. + +Header name is case-insensitive. +The header might have multiple values. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `name` | `string` \| [`GetHeaderOptions`](#getheaderoptions) | + +###### Returns + +`string`[] \| `undefined` + +##### getHeaders() + +> **getHeaders**(): `Record`\<`string`, `string`[]\> + +The headers of the request. + +Header names are case-insensitive. +Each header might have multiple values. + +###### Returns + +`Record`\<`string`, `string`[]\> + +###### Example + +```json +{ + "Host": ["caido.io"], + "Connection": ["keep-alive"], + "Content-Length": ["95"] +} +``` + +##### getHost() + +> **getHost**(): `string` + +The target host of the request. + +###### Returns + +`string` + +##### getId() + +> **getId**(): [`ID`](shared.md#id) + +The unique Caido [ID](shared.md#id) of the request. + +###### Returns + +[`ID`](shared.md#id) + +##### getMethod() + +> **getMethod**(): `string` + +The HTTP method of the request. + +###### Returns + +`string` + +##### getPath() + +> **getPath**(): `string` + +The path of the request. + +###### Returns + +`string` + +##### getPort() + +> **getPort**(): `number` + +The target port of the request. + +###### Returns + +`number` + +##### getQuery() + +> **getQuery**(): `string` + +The unparsed query of the request. + +Excludes the leading `?`. + +###### Returns + +`string` + +##### getRaw() + +> **getRaw**(): [`RequestRaw`](#requestraw) + +The raw version of the request. + +Used to access the bytes directly. + +###### Returns + +[`RequestRaw`](#requestraw) + +##### getTls() + +> **getTls**(): `boolean` + +If the request uses TLS (HTTPS). + +###### Returns + +`boolean` + +##### getUrl() + +> **getUrl**(): `string` + +The full URL of the request. + +###### Returns + +`string` + +##### toSpec() + +> **toSpec**(): [`RequestSpec`](#requestspec) + +Copied the request to a mutable un-saved [RequestSpec](#requestspec). +This enables you to make modify a request before re-sending it. + +###### Returns + +[`RequestSpec`](#requestspec) + +##### toSpecRaw() + +> **toSpecRaw**(): [`RequestSpecRaw`](#requestspecraw) + +Copied the request to a mutable un-saved [RequestSpecRaw](#requestspecraw). +The raw requests are not parsed and can be used to send invalid HTTP Requests. + +###### Returns + +[`RequestSpecRaw`](#requestspecraw) + +*** + +### RequestOrderField + +> **RequestOrderField** = `"ext"` \| `"host"` \| `"id"` \| `"method"` \| `"path"` \| `"query"` \| `"created_at"` \| `"source"` + +Field to order requests by. + +*** + +### RequestRaw + +> **RequestRaw** = `object` + +An immutable saved raw Request. + +#### Methods + +##### toBytes() + +> **toBytes**(): `Uint8Array` + +Get the raw request as an array of bytes. + +###### Returns + +`Uint8Array` + +##### toText() + +> **toText**(): `string` + +Parse the raw request as a string. + +Unprintable characters will be replaced with `�`. + +###### Returns + +`string` + +*** + +### RequestResponse + +> **RequestResponse** = `object` + +An immutable saved Request and Response pair. + +#### Properties + +##### request + +> **request**: [`Request`](#request) + +##### response + +> **response**: [`Response`](#response) + +*** + +### RequestResponseOpt + +> **RequestResponseOpt** = `object` + +An immutable saved Request and optional Response pair. + +#### Properties + +##### request + +> **request**: [`Request`](#request) + +##### response? + +> `optional` **response**: [`Response`](#response) + +*** + +### RequestsConnection + +> **RequestsConnection** = `object` + +A connection of requests. + +#### Properties + +##### items + +> **items**: [`RequestsConnectionItem`](#requestsconnectionitem)[] + +##### pageInfo + +> **pageInfo**: [`PageInfo`](other.md#pageinfo) + +*** + +### RequestsConnectionItem + +> **RequestsConnectionItem** = `object` + +An item in a connection of requests. + +#### Properties + +##### cursor + +> **cursor**: [`Cursor`](shared.md#cursor) + +##### request + +> **request**: [`Request`](#request) + +##### response? + +> `optional` **response**: [`Response`](#response) + +*** + +### RequestSendTimeouts + +> **RequestSendTimeouts** = `object` + +Timeouts for sending a request and receiving a response. + +#### Properties + +##### connect? + +> `optional` **connect**: `number` + +The timeout to open the TCP connection to the target host +and perform the TLS handshake. + +Defaults to 30s. + +##### extra? + +> `optional` **extra**: `number` + +The timeout to read data after we have a read the full response. + +This is useful if you believe the server will send more data +than implied by the Content-Length header. + +Defaults to 0s (no timeout). + +##### global? + +> `optional` **global**: `number` + +The global timeout for sending a request and receiving a response. + +No default value. + +##### partial? + +> `optional` **partial**: `number` + +The timeout between each read attempt for the response. +On a slow connection, this is important to increase. + +Defaults to 5s. + +##### response? + +> `optional` **response**: `number` + +The timeout to receive the first byte of the response. + +After the first byte is received, the partial timeout will be used. + +Defaults to 30s. + +*** + +### RequestsQuery + +> **RequestsQuery** = `object` + +Query builder to fetch requests. + +#### Methods + +##### after() + +> **after**(`cursor`: [`Cursor`](shared.md#cursor)): [`RequestsQuery`](#requestsquery) + +Requests after a given cursor. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `cursor` | [`Cursor`](shared.md#cursor) | [Cursor](shared.md#cursor) of the request | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +##### ascending() + +###### Call Signature + +> **ascending**(`target`: `"req"`, `field`: [`RequestOrderField`](#requestorderfield)): [`RequestsQuery`](#requestsquery) + +Ascending ordering. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `target` | `"req"` | Target of the ordering: req or resp. | +| `field` | [`RequestOrderField`](#requestorderfield) | Field to order by. | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +###### Call Signature + +> **ascending**(`target`: `"resp"`, `field`: [`ResponseOrderField`](#responseorderfield)): [`RequestsQuery`](#requestsquery) + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `target` | `"resp"` | +| `field` | [`ResponseOrderField`](#responseorderfield) | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +##### before() + +> **before**(`cursor`: [`Cursor`](shared.md#cursor)): [`RequestsQuery`](#requestsquery) + +Requests before a given cursor. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `cursor` | [`Cursor`](shared.md#cursor) | [Cursor](shared.md#cursor) of the request | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +##### descending() + +###### Call Signature + +> **descending**(`target`: `"req"`, `field`: [`RequestOrderField`](#requestorderfield)): [`RequestsQuery`](#requestsquery) + +Descending ordering. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `target` | `"req"` | Target of the ordering: req or resp. | +| `field` | [`RequestOrderField`](#requestorderfield) | Field to order by. | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +###### Call Signature + +> **descending**(`target`: `"resp"`, `field`: [`ResponseOrderField`](#responseorderfield)): [`RequestsQuery`](#requestsquery) + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `target` | `"resp"` | +| `field` | [`ResponseOrderField`](#responseorderfield) | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +##### execute() + +> **execute**(): `Promise`\<[`RequestsConnection`](#requestsconnection)\> + +Execute the query. + +###### Returns + +`Promise`\<[`RequestsConnection`](#requestsconnection)\> + +###### Throws + +If a query parameter is invalid or the query cannot be executed. + +##### filter() + +> **filter**(`filter`: `string`): [`RequestsQuery`](#requestsquery) + +Filter requests. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `filter` | `string` | HTTPQL filter | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +##### first() + +> **first**(`n`: `number`): [`RequestsQuery`](#requestsquery) + +First n requests. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `n` | `number` | Number of requests to return | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +##### last() + +> **last**(`n`: `number`): [`RequestsQuery`](#requestsquery) + +Last n requests. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `n` | `number` | Number of requests to return | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +*** + +### RequestsSDK + +> **RequestsSDK** = `object` + +The SDK for the Requests service. + +#### Methods + +##### get() + +> **get**(`id`: [`ID`](shared.md#id)): `Promise`\<[`RequestResponseOpt`](#requestresponseopt) \| `undefined`\> + +Get a request by its unique [ID](shared.md#id). + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `id` | [`ID`](shared.md#id) | + +###### Returns + +`Promise`\<[`RequestResponseOpt`](#requestresponseopt) \| `undefined`\> + +###### Example + +```js +await sdk.requests.get("1"); +``` + +##### inScope() + +> **inScope**(`request`: [`Request`](#request) \| [`RequestSpec`](#requestspec), `scopes?`: [`Scope`](scope.md#scope)[] \| [`ID`](shared.md#id)[]): `boolean` + +Checks if a request is in scope. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `request` | [`Request`](#request) \| [`RequestSpec`](#requestspec) | The request to check | +| `scopes?` | [`Scope`](scope.md#scope)[] \| [`ID`](shared.md#id)[] | Optional scopes or scope IDs to check against. If not provided, checks against the default scope. | + +###### Returns + +`boolean` + +True if the request is in scope + +###### Example + +```js +// Check against default scope +if (sdk.requests.inScope(request)) { + sdk.console.log("In scope"); +} + +// Check against specific scopes +const isInScope = sdk.requests.inScope(request, [scope1, scope2]); +sdk.console.log(isInScope); // true or false +``` + +##### matches() + +> **matches**(`filter`: `string`, `request`: [`Request`](#request), `response?`: [`Response`](#response)): `boolean` + +Checks if a request/response matches an HTTPQL filter. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `filter` | `string` | HTTPQL filter | +| `request` | [`Request`](#request) | The [Request](#request) to match against | +| `response?` | [`Response`](#response) | The [Response](#response) to match against | + +###### Returns + +`boolean` + +##### query() + +> **query**(): [`RequestsQuery`](#requestsquery) + +Query requests of the current project. + +###### Returns + +[`RequestsQuery`](#requestsquery) + +###### Example + +```js +const page = await sqk.requests.query().first(2).execute(); +sdk.console.log(`ID: ${page.items[1].request.getId()}`); +``` + +##### send() + +> **send**(`request`: [`RequestSpec`](#requestspec) \| [`RequestSpecRaw`](#requestspecraw), `options?`: [`RequestSendOptions`](other.md#requestsendoptions)): `Promise`\<[`RequestResponse`](#requestresponse)\> + +Sends an HTTP request, either a [RequestSpec](#requestspec) or [RequestSpecRaw](#requestspecraw). + +This respects the upstream proxy settings. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `request` | [`RequestSpec`](#requestspec) \| [`RequestSpecRaw`](#requestspecraw) | +| `options?` | [`RequestSendOptions`](other.md#requestsendoptions) | + +###### Returns + +`Promise`\<[`RequestResponse`](#requestresponse)\> + +###### Throws + +If the request cannot be sent. +If the request times out, the error message will contain the word "Timeout". + +###### Example + +```js +const spec = new RequestSpec("https://example.com"); +try { + const res = await sdk.requests.send(request) + sdk.console.log(res.request.getId()); + sdk.console.log(res.response.getCode()); +} catch (err) { + sdk.console.error(err); +} +``` + +*** + +### Response + +> **Response** = `object` + +An immutable saved Response. + +#### Methods + +##### getBody() + +> **getBody**(): [`Body`](#body) \| `undefined` + +The body of the response + +###### Returns + +[`Body`](#body) \| `undefined` + +##### getCode() + +> **getCode**(): `number` + +The status code of the response. + +###### Returns + +`number` + +##### getCreatedAt() + +> **getCreatedAt**(): `Date` + +The datetime the response was recorded by the proxy. + +###### Returns + +`Date` + +##### getHeader() + +> **getHeader**(`name`: `string` \| [`GetHeaderOptions`](#getheaderoptions)): `string`[] \| `undefined` + +Get a header value. + +Header name is case-insensitive. +The header might have multiple values. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `name` | `string` \| [`GetHeaderOptions`](#getheaderoptions) | + +###### Returns + +`string`[] \| `undefined` + +##### getHeaders() + +> **getHeaders**(): `Record`\<`string`, `string`[]\> + +The headers of the response. + +Header names are case-insensitive. +Each header might have multiple values. + +###### Returns + +`Record`\<`string`, `string`[]\> + +###### Example + +```json +{ + "Date": ["Sun, 26 May 2024 10:59:21 GMT"], + "Content-Type": ["text/html"] +} +``` + +##### getId() + +> **getId**(): [`ID`](shared.md#id) + +The unique Caido [ID](shared.md#id) of the response. + +###### Returns + +[`ID`](shared.md#id) + +##### getRaw() + +> **getRaw**(): [`ResponseRaw`](#responseraw) + +The raw version of the response. + +Used to access the bytes directly. + +###### Returns + +[`ResponseRaw`](#responseraw) + +##### getRoundtripTime() + +> **getRoundtripTime**(): `number` + +The time it took to send the request and receive the response in milliseconds. + +###### Returns + +`number` + +*** + +### ResponseOrderField + +> **ResponseOrderField** = `"length"` \| `"roundtrip"` \| `"code"` + +Field to order responses by. + +*** + +### ResponseRaw + +> **ResponseRaw** = `object` + +An immutable saved raw Response. + +#### Methods + +##### toBytes() + +> **toBytes**(): `Uint8Array` + +Get the raw response as an array of bytes. + +###### Returns + +`Uint8Array` + +##### toText() + +> **toText**(): `string` + +Parse the raw response as a string. + +Unprintable characters will be replaced with `�`. + +###### Returns + +`string` + +*** + +### SetBodyOptions + +> **SetBodyOptions** = `object` + +Options when setting the body of a Request. + +#### Properties + +##### updateContentLength + +> **updateContentLength**: `boolean` + +Should update the Content-export type header. + +###### Default + +```ts +true +``` diff --git a/src/reference/sdks/backend/runtime.md b/src/reference/sdks/backend/runtime.md new file mode 100644 index 0000000..25fbd73 --- /dev/null +++ b/src/reference/sdks/backend/runtime.md @@ -0,0 +1,21 @@ +# Runtime + +### RuntimeSDK + +> **RuntimeSDK** = `object` + +The SDK for the runtime information. + +#### Accessors + +##### version + +###### Get Signature + +> **get** **version**(): `string` + +Get the current version of Caido. + +###### Returns + +`string` diff --git a/src/reference/sdks/backend/scope.md b/src/reference/sdks/backend/scope.md new file mode 100644 index 0000000..723e6ac --- /dev/null +++ b/src/reference/sdks/backend/scope.md @@ -0,0 +1,55 @@ +# Scope + +### Scope + +> **Scope** = `object` + +A saved immutable Scope. + +#### Properties + +##### allowlist + +> `readonly` **allowlist**: `string`[] + +The allowlist of the scope. + +##### denylist + +> `readonly` **denylist**: `string`[] + +The denylist of the scope. + +##### id + +> `readonly` **id**: [`ID`](shared.md#id) + +The unique Caido [ID](shared.md#id) of the scope. + +##### name + +> `readonly` **name**: `string` + +The name of the scope. + +*** + +### ScopeSDK + +> **ScopeSDK** = `object` + +The SDK for the Scope service. + +#### Methods + +##### getAll() + +> **getAll**(): `Promise`\<[`Scope`](#scope)[]\> + +Get all the scopes. + +###### Returns + +`Promise`\<[`Scope`](#scope)[]\> + +An array of [Scope](#scope) diff --git a/src/reference/sdks/backend/shared.md b/src/reference/sdks/backend/shared.md new file mode 100644 index 0000000..3efce17 --- /dev/null +++ b/src/reference/sdks/backend/shared.md @@ -0,0 +1,171 @@ +# Shared + +### Bytes + +> **Bytes** = `string` \| `number`[] \| `Uint8Array` + +Types that can be converted to bytes in inputs. + +*** + +### Cursor + +> **Cursor** = `string` & `object` + +A cursor for pagination. + +#### Type Declaration + +##### \_\_cursor? + +> `optional` **\_\_cursor**: `never` + +*** + +### DefineAPI + +> **DefineAPI**\<`API`\> = `{ [K in keyof API]: DefineAPICallback }` + +Define a Plugin backend functions that are callable from the frontend. + +#### Type Parameters + +| Type Parameter | +| ------ | +| `API` *extends* `Record`\<`string`, (...`args`: `any`[]) => [`MaybePromise`](#maybepromise)\<`any`\>\> | + +#### Example + +```typescript +function generateNumber(sdk: SDK, min: number, max: number): number { + return Math.floor(Math.random() * (max - min + 1) + min); +} + +export type API = DefineAPI<{ + generateNumber: typeof generateNumber; +}>; + +export function init(sdk: SDK) { + sdk.api.register("generateNumber", generateNumber); +} +``` + +*** + +### DefineAPICallback + +> **DefineAPICallback**\<`F`\> = `F` *extends* (`sdk`: [`SDK`](index.md#sdk), ...`args`: infer A) => infer R ? (...`args`: `A`) => `R` : `"Your callback must respect the format (sdk: SDK, ...args: unknown[]) => MaybePromise"` + +Parser for Plugin backend callable functions + +#### Type Parameters + +| Type Parameter | +| ------ | +| `F` | + +*** + +### DefineEventCallback + +> **DefineEventCallback**\<`F`\> = `F` *extends* (...`args`: infer A) => [`MaybePromise`](#maybepromise)\<`void`\> ? (...`args`: `A`) => [`MaybePromise`](#maybepromise)\<`void`\> : `"Your callback must respect the format (...args: unknown[]) => MaybePromise"` + +Parser for Plugin backend events callbacks. + +#### Type Parameters + +| Type Parameter | +| ------ | +| `F` | + +*** + +### DefineEvents + +> **DefineEvents**\<`Events`\> = `{ [K in keyof Events]: DefineEventCallback }` + +Define a Plugin backend events that the frontend can receive. + +#### Type Parameters + +| Type Parameter | +| ------ | +| `Events` *extends* `Record`\<`string`, (...`args`: `any`[]) => [`MaybePromise`](#maybepromise)\<`void`\>\> | + +#### Example + +```typescript +type MyEventData = { id: string; name: string }; + +export type BackendEvents = DefineEvents<{ + "myevent": (data: MyEventData) => void; +}>; + +export function init(sdk: SDK<{}, BackendEvents>) { + sdk.api.send("myevent", { id: "1", name: "hello" }); +} +``` + +*** + +### ID + +> **ID** = `string` & `object` + +A unique identifier. + +#### Type Declaration + +##### \_\_id? + +> `optional` **\_\_id**: `never` + +*** + +### MaybePromise + +> **MaybePromise**\<`T`\> = `T` \| `Promise`\<`T`\> + +Promise or value. + +#### Type Parameters + +| Type Parameter | +| ------ | +| `T` | + +*** + +### MaybePromise + +> **MaybePromise**\<`T`\> = `T` \| `Promise`\<`T`\> + +Promise or value. + +#### Type Parameters + +| Type Parameter | +| ------ | +| `T` | + +*** + +### RawOption + +> **RawOption** = `object` + +Option to return raw value + +#### Properties + +##### raw + +> **raw**: `true` + +*** + +### RequestSource + +> **RequestSource** = [`ID`](#id) \| [`Request`](requests.md#request) \| [`RequestSpec`](requests.md#requestspec) \| [`RequestSpecRaw`](requests.md#requestspecraw) + +The source of a request. diff --git a/src/reference/sdks/frontend/ai.md b/src/reference/sdks/frontend/ai.md new file mode 100644 index 0000000..6b8bbfe --- /dev/null +++ b/src/reference/sdks/frontend/ai.md @@ -0,0 +1,57 @@ +# AI + +### AILanguageModelSettings + +> **AILanguageModelSettings** = `object` + +Settings for AI language model. + +#### Properties + +##### reasoning? + +> `optional` **reasoning**: [`AIReasoningSettings`](#aireasoningsettings) + +*** + +### AIProvider + +> **AIProvider** = `ProviderV2` & (`modelId`: `string`, `settings?`: [`AILanguageModelSettings`](#ailanguagemodelsettings)) => `LanguageModelV2` + +Official AI Provider to be used by the [ai](https://ai-sdk.dev/) library. + +*** + +### AIReasoningSettings + +> **AIReasoningSettings** = `object` + +Settings for AI reasoning. + +#### Properties + +##### effort + +> **effort**: `"low"` \| `"medium"` \| `"high"` + +*** + +### AiSDK + +> **AiSDK** = `object` + +Utilities to interact with AI. + +#### Properties + +##### createProvider() + +> **createProvider**: () => [`AIProvider`](#aiprovider) + +Creates a new AI provider instance that can be used with the [ai](https://ai-sdk.dev/) library. + +###### Returns + +[`AIProvider`](#aiprovider) + +A provider instance compatible with the [ai](https://ai-sdk.dev/) library. diff --git a/src/reference/sdks/frontend/automate.md b/src/reference/sdks/frontend/automate.md new file mode 100644 index 0000000..57c7f5b --- /dev/null +++ b/src/reference/sdks/frontend/automate.md @@ -0,0 +1,41 @@ +# Automate + +### AutomateSDK + +> **AutomateSDK** = `object` + +Utilities to interact with the Automate page. + +#### Properties + +##### addRequestEditorExtension() + +> **addRequestEditorExtension**: (`extension`: `Extension`) => `void` + +Add an extension to the request editor. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `extension` | `Extension` | The extension to add. | + +###### Returns + +`void` + +##### addRequestViewMode() + +> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)) => `void` + +Add a custom request view mode. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions) | The view mode options. | + +###### Returns + +`void` diff --git a/src/reference/sdks/frontend/backend.md b/src/reference/sdks/frontend/backend.md new file mode 100644 index 0000000..54b83a6 --- /dev/null +++ b/src/reference/sdks/frontend/backend.md @@ -0,0 +1,73 @@ +# Backend + +### BackendEndpoints + +> **BackendEndpoints** = `object` + +Endpoints provided by the backend plugin. + +#### Index Signature + +\[`key`: `string`\]: (...`args`: `any`[]) => `any` + +*** + +### BackendEvents + +> **BackendEvents** = `object` + +Events emitted by the backend plugin. + +#### Index Signature + +\[`key`: `string`\]: (...`args`: `any`[]) => `void` + +*** + +### BackendSDK + +> **BackendSDK**\<`T`, `E`\> = `{ [K in keyof T]: (args: Parameters) => PromisifiedReturnType }` & `object` + +Utilities to interact with the backend plugin. + +#### Type Declaration + +##### onEvent() + +> **onEvent**: \<`K`\>(`event`: `K`, `callback`: `E`\[`K`\]) => `object` + +Subscribe to a backend event. + +###### Type Parameters + +| Type Parameter | +| ------ | +| `K` *extends* keyof `E` | + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `event` | `K` | The event to subscribe to. | +| `callback` | `E`\[`K`\] | The callback to call when the event is emitted. | + +###### Returns + +`object` + +An object with a `stop` method that can be called to stop listening to the event. + +###### stop() + +> **stop**: () => `void` + +###### Returns + +`void` + +#### Type Parameters + +| Type Parameter | +| ------ | +| `T` *extends* [`BackendEndpoints`](#backendendpoints) | +| `E` *extends* [`BackendEvents`](#backendevents) | diff --git a/src/reference/sdks/frontend/command-palette.md b/src/reference/sdks/frontend/command-palette.md new file mode 100644 index 0000000..0d6f920 --- /dev/null +++ b/src/reference/sdks/frontend/command-palette.md @@ -0,0 +1,59 @@ +# Command Palette + +### CommandPaletteSDK + +> **CommandPaletteSDK** = `object` + +Utilities to interact with the command palette. + +#### Properties + +##### pushView() + +> **pushView**: (`view`: [`CommandPaletteView`](#commandpaletteview)) => `void` + +Push a new view onto the command palette view stack. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `view` | [`CommandPaletteView`](#commandpaletteview) | The view to push onto the stack. | + +###### Returns + +`void` + +##### register() + +> **register**: (`commandId`: [`CommandID`](other.md#commandid)) => `void` + +Register a command. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `commandId` | [`CommandID`](other.md#commandid) | The id of the command to register. | + +###### Returns + +`void` + +*** + +### CommandPaletteView + +> **CommandPaletteView** = `object` + +Command palette view definition for custom UI content. + +#### Properties + +##### definition + +> **definition**: [`ComponentDefinition`](utils.md#componentdefinition) + +##### type + +> **type**: `"Custom"` diff --git a/src/reference/sdks/frontend/commands.md b/src/reference/sdks/frontend/commands.md new file mode 100644 index 0000000..4ff6a89 --- /dev/null +++ b/src/reference/sdks/frontend/commands.md @@ -0,0 +1,158 @@ +# Commands + +### CommandContext + +> **CommandContext** = [`CommandContextBase`](#commandcontextbase) \| [`CommandContextRequestRow`](#commandcontextrequestrow) \| [`CommandContextRequest`](#commandcontextrequest) \| [`CommandContextResponse`](#commandcontextresponse) + +Represents the context in which a command is executed. + +*** + +### CommandContextBase + +> **CommandContextBase** = `object` + +The base context for a command. +This context is used for commands that are not executed in a specific context, such as via shortcuts and the command palette. + +#### Properties + +##### type + +> **type**: `"BaseContext"` + +*** + +### CommandContextRequest + +> **CommandContextRequest** = `object` + +The context for a command that is executed on a request pane. + +#### Properties + +##### request + +> **request**: [`RequestDraft`](request.md#requestdraft) \| [`RequestFull`](request.md#requestfull) + +The request that is currently open in the request pane. +If the request has not yet been saved in the database, the id will be undefined. + +##### selection + +> **selection**: `string` + +The currently selected text in the request pane. + +##### type + +> **type**: `"RequestContext"` + +*** + +### CommandContextRequestRow + +> **CommandContextRequestRow** = `object` + +The context for a command that is executed on a row in the request table. + +#### Properties + +##### requests + +> **requests**: [`RequestMeta`](request.md#requestmeta)[] + +The requests that are selected in the request table. + +##### type + +> **type**: `"RequestRowContext"` + +*** + +### CommandContextResponse + +> **CommandContextResponse** = `object` + +The context for a command that is executed on a response pane. + +#### Properties + +##### request + +> **request**: [`RequestMeta`](request.md#requestmeta) + +The request that is associated with the response. + +##### response + +> **response**: `object` + +The response that is currently open in the response pane. + +###### id + +> **id**: [`ID`](utils.md#id) + +###### raw + +> **raw**: `string` + +###### roundtripTime + +> **roundtripTime**: `number` + +###### statusCode + +> **statusCode**: `number` + +##### selection + +> **selection**: `string` + +The currently selected text in the response pane. + +##### type + +> **type**: `"ResponseContext"` + +*** + +### CommandsSDK + +> **CommandsSDK** = `object` + +Utilities to interact with commands + +#### Properties + +##### register() + +> **register**: (`id`: [`CommandID`](other.md#commandid), `options`: `object`) => `void` + +Register a command. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`CommandID`](other.md#commandid) | The id of the command. | +| `options` | \{ `group?`: `string`; `name`: `string`; `run`: (`context`: [`CommandContext`](#commandcontext)) => `Promise`\<`void`\> \| `void`; `when?`: (`context`: [`CommandContext`](#commandcontext)) => `Promise`\<`boolean`\> \| `boolean`; \} | Options for the command. | +| `options.group?` | `string` | The group this command belongs to. | +| `options.name` | `string` | The name of the command. | +| `options.run` | (`context`: [`CommandContext`](#commandcontext)) => `Promise`\<`void`\> \| `void` | The function to run when the command is executed. | +| `options.when?` | (`context`: [`CommandContext`](#commandcontext)) => `Promise`\<`boolean`\> \| `boolean` | A function to determine if the command is available. | + +###### Returns + +`void` + +###### Example + +```ts +sdk.commands.register("hello", { + name: "Print to console.", + run: () => console.log("Hello world!"), + group: "Custom Commands", +}); +``` diff --git a/src/reference/sdks/frontend/editor.md b/src/reference/sdks/frontend/editor.md new file mode 100644 index 0000000..7f42544 --- /dev/null +++ b/src/reference/sdks/frontend/editor.md @@ -0,0 +1,139 @@ +# Editor + +### Editor + +> **Editor** = `object` + +Generic editor interface. + +#### Properties + +##### focus() + +> **focus**: () => `void` + +Focus the editor. + +###### Returns + +`void` + +##### getEditorView() + +> **getEditorView**: () => `EditorView` + +Get the editor view. + +###### Returns + +`EditorView` + +The CodeMirror [EditorView](https://codemirror.net/docs/ref/#view.EditorView). + +##### getSelectedText() + +> **getSelectedText**: () => `string` + +Get the currently selected text of the editor. + +###### Returns + +`string` + +##### isReadOnly() + +> **isReadOnly**: () => `boolean` + +Check whether the editor is read-only. + +###### Returns + +`boolean` + +Whether the editor is read-only. + +##### replaceSelectedText() + +> **replaceSelectedText**: (`text`: `string`) => `void` + +Replace the currently selected text of the editor. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `text` | `string` | The text to replace the selection with. | + +###### Returns + +`void` + +*** + +### HTTPRequestEditor + +> **HTTPRequestEditor** = `object` + +An HTTP request editor interface. + +#### Properties + +##### getEditorView() + +> **getEditorView**: () => `EditorView` + +Get the editor view. + +###### Returns + +`EditorView` + +The CodeMirror [EditorView](https://codemirror.net/docs/ref/#view.EditorView). + +##### getElement() + +> **getElement**: () => `HTMLElement` + +Get the editor element. +Append this to your DOM to display the editor. + +###### Returns + +`HTMLElement` + +The editor element. + +*** + +### HTTPResponseEditor + +> **HTTPResponseEditor** = `object` + +An HTTP response editor interface. + +#### Properties + +##### getEditorView() + +> **getEditorView**: () => `EditorView` + +Get the editor view. + +###### Returns + +`EditorView` + +The CodeMirror [EditorView](https://codemirror.net/docs/ref/#view.EditorView). + +##### getElement() + +> **getElement**: () => `HTMLElement` + +Get the editor element. +Append this to your DOM to display the editor. + +###### Returns + +`HTMLElement` + +The editor element. diff --git a/src/reference/sdks/frontend/environment.md b/src/reference/sdks/frontend/environment.md new file mode 100644 index 0000000..602d84d --- /dev/null +++ b/src/reference/sdks/frontend/environment.md @@ -0,0 +1,67 @@ +# Environment + +### EnvironmentSDK + +> **EnvironmentSDK** = `object` + +Utilities to interact with the environment. + +#### Properties + +##### getVar() + +> **getVar**: (`name`: `string`) => `string` \| `undefined` + +Get the value of an environment variable. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `name` | `string` | The name of the environment variable. | + +###### Returns + +`string` \| `undefined` + +The value of the environment variable. + +##### getVars() + +> **getVars**: () => [`EnvironmentVariable`](#environmentvariable)[] + +Get all environment variables available in the global environment and the selected environment. + +###### Returns + +[`EnvironmentVariable`](#environmentvariable)[] + +All environment variables. + +*** + +### EnvironmentVariable + +> **EnvironmentVariable** = `object` + +Represents an environment variable. + +#### Properties + +##### isSecret + +> **isSecret**: `boolean` + +Whether the environment variable is a secret. + +##### name + +> **name**: `string` + +The name of the environment variable. + +##### value + +> **value**: `string` + +The value of the environment variable. diff --git a/src/reference/sdks/frontend/files.md b/src/reference/sdks/frontend/files.md new file mode 100644 index 0000000..c7246b8 --- /dev/null +++ b/src/reference/sdks/frontend/files.md @@ -0,0 +1,204 @@ +# Files + +### Asset + +> **Asset** = `object` + +A static asset. + +#### Properties + +##### asArrayBuffer() + +> **asArrayBuffer**: () => `Promise`\<`ArrayBuffer`\> + +###### Returns + +`Promise`\<`ArrayBuffer`\> + +##### asJson() + +> **asJson**: \<`T`\>() => `Promise`\<`T`\> + +###### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `T` | `unknown` | + +###### Returns + +`Promise`\<`T`\> + +##### asReadableStream() + +> **asReadableStream**: () => `ReadableStream` + +###### Returns + +`ReadableStream` + +##### asString() + +> **asString**: () => `Promise`\<`string`\> + +###### Returns + +`Promise`\<`string`\> + +*** + +### AssetsSDK + +> **AssetsSDK** = `object` + +Utilities to interact with the plugin's static assets. + +#### Properties + +##### get() + +> **get**: (`path`: `string`) => `Promise`\<[`Asset`](#asset)\> + +Get a file from the assets folder. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `path` | `string` | + +###### Returns + +`Promise`\<[`Asset`](#asset)\> + +The asset file. + +*** + +### FilesSDK + +> **FilesSDK** = `object` + +SDK for interacting with the Files page. + +#### Properties + +##### create() + +> **create**: (`file`: `File`) => `Promise`\<[`HostedFile`](#hostedfile)\> + +Uploads a file to the host. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `file` | `File` | The file to upload. | + +###### Returns + +`Promise`\<[`HostedFile`](#hostedfile)\> + +The uploaded file. + +##### delete() + +> **delete**: (`id`: `string`) => `Promise`\<`void`\> + +Deletes a file from the host. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | `string` | The ID of the file to delete. | + +###### Returns + +`Promise`\<`void`\> + +The deleted file. + +##### getAll() + +> **getAll**: () => [`HostedFile`](#hostedfile)[] + +Gets all hosted files. + +###### Returns + +[`HostedFile`](#hostedfile)[] + +The files. + +##### rename() + +> **rename**: (`id`: `string`, `name`: `string`) => `Promise`\<[`HostedFile`](#hostedfile)\> + +Renames a file on the host. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | `string` | The ID of the file to rename. | +| `name` | `string` | The new name of the file. | + +###### Returns + +`Promise`\<[`HostedFile`](#hostedfile)\> + +The renamed file. + +*** + +### HostedFile + +> **HostedFile** = `object` + +A hosted file. + +#### Properties + +##### createdAt + +> **createdAt**: `Date` + +The date the file was created. + +##### id + +> **id**: `string` + +The ID of the file. + +##### name + +> **name**: `string` + +The name of the file. + +##### path + +> **path**: `string` + +The path of the file. + +##### size + +> **size**: `number` + +The size of the file in bytes. + +##### status + +> **status**: `"ready"` \| `"error"` + +The status of the file. + +##### updatedAt + +> **updatedAt**: `Date` + +The date the file was updated. diff --git a/src/reference/sdks/frontend/filter.md b/src/reference/sdks/frontend/filter.md new file mode 100644 index 0000000..5d968a1 --- /dev/null +++ b/src/reference/sdks/frontend/filter.md @@ -0,0 +1,17 @@ +# Filter + +### FilterSlotContent + +> **FilterSlotContent** = `object` + +Content that can be added to filter slots. + +#### Properties + +##### create-header + +> **create-header**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) + +##### update-header + +> **update-header**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) diff --git a/src/reference/sdks/frontend/filters.md b/src/reference/sdks/frontend/filters.md new file mode 100644 index 0000000..f16d33d --- /dev/null +++ b/src/reference/sdks/frontend/filters.md @@ -0,0 +1,175 @@ +# Filters + +### Filter + +> **Filter** = `object` + +Represents a filter. + +#### Properties + +##### alias + +> **alias**: `string` + +The alias of the filter. +This alias is used when referencing the filter in an HTTPQL query (e.g. `preset:my-alias`). + +##### id + +> **id**: [`ID`](utils.md#id) + +The ID of the filter. + +##### name + +> **name**: `string` + +The name of the filter. + +##### query + +> **query**: [`HTTPQL`](utils.md#httpql) + +The HTTPQL expression of the filter. + +*** + +### FiltersSDK + +> **FiltersSDK** = `object` + +SDK for interacting with the Filters page. + +#### Properties + +##### addToSlot + +> **addToSlot**: [`DefineAddToSlotFn`](slots.md#defineaddtoslotfn)\<[`FilterSlotContent`](filter.md#filterslotcontent)\> + +Add a component to a slot. + +###### Param + +The slot to add the component to. + +###### Param + +The content to add to the slot. + +###### Example + +```ts +sdk.filters.addToSlot(FilterSlot.UpdateHeader, { + type: "Button", + label: "My Button", + icon: "my-icon", + onClick: () => { + console.log("Button clicked"); + }, +}); + +sdk.filters.addToSlot(FilterSlot.CreateHeader, { + type: "Custom", + definition: MyComponent, +}); + +sdk.filters.addToSlot(FilterSlot.UpdateHeader, { + type: "Command", + commandId: "my-command", + icon: "my-icon", +}); +``` + +##### create() + +> **create**: (`options`: `object`) => `Promise`\<[`Filter`](#filter)\> + +Creates a filter. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | \{ `alias`: `string`; `name`: `string`; `query`: [`HTTPQL`](utils.md#httpql); \} | Options for the filter. | +| `options.alias` | `string` | The alias of the filter. Used when referencing the filter in an HTTPQL query (e.g. `preset:my-alias`). Should be unique and follow the format `[a-zA-Z0-9_-]+`. | +| `options.name` | `string` | The name of the filter. Should be unique. | +| `options.query` | [`HTTPQL`](utils.md#httpql) | The HTTPQL query of the filter. | + +###### Returns + +`Promise`\<[`Filter`](#filter)\> + +The created filter. + +##### delete() + +> **delete**: (`id`: [`ID`](utils.md#id)) => `Promise`\<`void`\> + +Deletes a filter. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) | The ID of the filter to delete. | + +###### Returns + +`Promise`\<`void`\> + +##### getAll() + +> **getAll**: () => [`Filter`](#filter)[] + +Gets all filters. + +###### Returns + +[`Filter`](#filter)[] + +The filters. + +##### update() + +> **update**: (`id`: [`ID`](utils.md#id), `options`: `object`) => `Promise`\<[`Filter`](#filter)\> + +Updates a filter. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) | The ID of the filter to update. | +| `options` | \{ `alias`: `string`; `name`: `string`; `query`: [`HTTPQL`](utils.md#httpql); \} | Options for the filter. | +| `options.alias` | `string` | The alias of the filter. | +| `options.name` | `string` | The name of the filter. | +| `options.query` | [`HTTPQL`](utils.md#httpql) | The HTTPQL query of the filter. | + +###### Returns + +`Promise`\<[`Filter`](#filter)\> + +The updated filter. + +*** + +### FilterSlot + +> `const` **FilterSlot**: `object` + +The slots in the Filters UI. + +#### Type Declaration + +##### CreateHeader + +> `readonly` **CreateHeader**: `"create-header"` + +The header area of the preset form create component. + +##### UpdateHeader + +> `readonly` **UpdateHeader**: `"update-header"` + +The header area of the preset form update component. diff --git a/src/reference/sdks/frontend/findings.md b/src/reference/sdks/frontend/findings.md new file mode 100644 index 0000000..f88dfbe --- /dev/null +++ b/src/reference/sdks/frontend/findings.md @@ -0,0 +1,110 @@ +# Findings + +### Finding + +> **Finding** = `object` + +Represents a [https://docs.caido.io/reference/features/logging/findings\|Finding](https://docs.caido.io/reference/features/logging/findings|Finding). + +#### Properties + +##### description? + +> `optional` **description**: `string` + +The description of the finding. + +##### host + +> **host**: `string` + +The host of the request attached to this finding + +##### id + +> **id**: [`ID`](utils.md#id) + +The ID of the finding. + +##### path + +> **path**: `string` + +The path of the request attached to this finding + +##### reporter + +> **reporter**: `string` + +The reporter of the finding. + +##### title + +> **title**: `string` + +The title of the finding. + +*** + +### FindingsSDK + +> **FindingsSDK** = `object` + +Utilities to interact with findings + +#### Properties + +##### addRequestEditorExtension() + +> **addRequestEditorExtension**: (`extension`: `Extension`) => `void` + +Add an extension to the request editor. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `extension` | `Extension` | The extension to add. | + +###### Returns + +`void` + +##### addRequestViewMode() + +> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)) => `void` + +Add a custom request view mode. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions) | The view mode options. | + +###### Returns + +`void` + +##### createFinding() + +> **createFinding**: (`requestId`: [`ID`](utils.md#id), `options`: `object`) => `Promise`\<[`Finding`](#finding) \| `undefined`\> + +Create a [Finding](#finding). + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `requestId` | [`ID`](utils.md#id) | The id of the request the finding is associated with. | +| `options` | \{ `dedupeKey?`: `string`; `description?`: `string`; `reporter`: `string`; `title`: `string`; \} | Options for the finding. | +| `options.dedupeKey?` | `string` | If a finding with the same deduplication key already exists, it will not create a new finding. | +| `options.description?` | `string` | The description of the finding. | +| `options.reporter` | `string` | The reporter of the finding. | +| `options.title` | `string` | The title of the finding. | + +###### Returns + +`Promise`\<[`Finding`](#finding) \| `undefined`\> + +The created finding. diff --git a/src/reference/sdks/frontend/footer.md b/src/reference/sdks/frontend/footer.md new file mode 100644 index 0000000..9611381 --- /dev/null +++ b/src/reference/sdks/frontend/footer.md @@ -0,0 +1,83 @@ +# Footer + +### FooterSDK + +> **FooterSDK** = `object` + +Utilities to interact with the footer. + +#### Properties + +##### addToSlot + +> **addToSlot**: [`DefineAddToSlotFn`](slots.md#defineaddtoslotfn)\<[`FooterSlotContent`](#footerslotcontent)\> + +Add a component to a slot. + +###### Param + +The slot to add the component to. + +###### Param + +The content to add to the slot. + +###### Example + +```ts +addToSlot(FooterSlot.FooterSlotPrimary, { + kind: "Command", + commandId: "my-command", + icon: "my-icon", +}); + +addToSlot(FooterSlot.FooterSlotPrimary, { + kind: "Button", + label: "My button", + icon: "fas fa-rocket", + onClick: () => { + console.log("Button clicked"); + }, +}); + +addToSlot(FooterSlot.FooterSlotSecondary, { + kind: "Custom", + component: MyComponent, +}); +``` + +*** + +### FooterSlotContent + +> **FooterSlotContent** = `object` + +Content that can be added to footer slots. + +#### Properties + +##### footer-primary + +> **footer-primary**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) + +##### footer-secondary + +> **footer-secondary**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) + +*** + +### FooterSlot + +> `const` **FooterSlot**: `object` + +The slots in the Footer UI. + +#### Type Declaration + +##### FooterSlotPrimary + +> `readonly` **FooterSlotPrimary**: `"footer-primary"` + +##### FooterSlotSecondary + +> `readonly` **FooterSlotSecondary**: `"footer-secondary"` diff --git a/src/reference/sdks/frontend/http-history.md b/src/reference/sdks/frontend/http-history.md new file mode 100644 index 0000000..cb534ba --- /dev/null +++ b/src/reference/sdks/frontend/http-history.md @@ -0,0 +1,183 @@ +# HTTP History + +### HTTPHistorySDK + +> **HTTPHistorySDK** = `object` + +Utilities to interact with the HTTP History page. + +#### Properties + +##### addRequestEditorExtension() + +> **addRequestEditorExtension**: (`extension`: `Extension`) => `void` + +Add an extension to the request editor. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `extension` | `Extension` | The extension to add. | + +###### Returns + +`void` + +##### addRequestViewMode() + +> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)) => `void` + +Add a custom request view mode. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions) | The view mode options. | + +###### Returns + +`void` + +##### addResponseEditorExtension() + +> **addResponseEditorExtension**: (`extension`: `Extension`) => `void` + +Add an extension to the response editor. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `extension` | `Extension` | The extension to add. | + +###### Returns + +`void` + +##### addToSlot + +> **addToSlot**: [`DefineAddToSlotFn`](slots.md#defineaddtoslotfn)\<[`HTTPHistorySlotContent`](other.md#httphistoryslotcontent)\> + +Add a component to a slot. + +###### Param + +The slot to add the component to. + +###### Param + +The content to add to the slot. + +###### Example + +```ts +sdk.httpHistory.addToSlot(HTTPHistorySlot.ToolbarPrimary, { + type: "Button", + label: "My Button", + icon: "my-icon", + onClick: () => { + console.log("Button clicked"); + }, +}); + +sdk.httpHistory.addToSlot(HTTPHistorySlot.ToolbarPrimary, { + type: "Custom", + definition: MyComponent, +}); + +sdk.httpHistory.addToSlot(HTTPHistorySlot.ToolbarPrimary, { + type: "Command", + commandId: "my-command", + icon: "my-icon", +}); +``` + +##### getQuery() + +> **getQuery**: () => [`HTTPQL`](utils.md#httpql) + +Get the current HTTPQL query. + +###### Returns + +[`HTTPQL`](utils.md#httpql) + +The current HTTPQL query. + +##### getScopeId() + +> **getScopeId**: () => [`ID`](utils.md#id) \| `undefined` + +Get the current scope ID. + +###### Returns + +[`ID`](utils.md#id) \| `undefined` + +The current scope ID. + +##### scrollTo() + +> **scrollTo**: (`id`: [`ID`](utils.md#id)) => `void` + +Scrolls the HTTP History table to a specific entry. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) | The ID of the entry to scroll to. | + +###### Returns + +`void` + +##### setQuery() + +> **setQuery**: (`query`: [`HTTPQL`](utils.md#httpql)) => `void` + +Set the HTTPQL query that will be applied on the HTTP History table results. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `query` | [`HTTPQL`](utils.md#httpql) | The HTTPQL query. | + +###### Returns + +`void` + +##### setScope() + +> **setScope**: (`id`: [`ID`](utils.md#id) \| `undefined`) => `Promise`\<`void`\> + +Set the current scope. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) \| `undefined` | The ID of the scope to set. | + +###### Returns + +`Promise`\<`void`\> + +*** + +### HTTPHistorySlot + +> `const` **HTTPHistorySlot**: `object` + +The slots in the HTTP History UI. + +#### Type Declaration + +##### ToolbarPrimary + +> `readonly` **ToolbarPrimary**: `"toolbar-primary"` + +The toolbar. diff --git a/src/reference/sdks/frontend/index.md b/src/reference/sdks/frontend/index.md index 8584fee..90aea36 100644 --- a/src/reference/sdks/frontend/index.md +++ b/src/reference/sdks/frontend/index.md @@ -1,13 +1,10 @@ # @caido/sdk-frontend -This is the reference for the frontend SDK used by frontend plugins. -[Caido](#caido-t-e) is the main interface that provides access to various services and functionalities. - ## SDK -### Caido\ +### Caido -> **Caido**\<`T`, `E`\>: `object` +> **Caido**\<`T`, `E`\> = `object` Utilities for frontend plugins. @@ -15,74 +12,74 @@ Utilities for frontend plugins. | Type Parameter | Default type | | ------ | ------ | -| `T` *extends* [`BackendEndpoints`](index.md#backendendpoints) | `Record`\<`string`, `never`\> | -| `E` *extends* [`BackendEvents`](index.md#backendevents) | `Record`\<`string`, `never`\> | +| `T` *extends* [`BackendEndpoints`](backend.md#backendendpoints) | `Record`\<`string`, `never`\> | +| `E` *extends* [`BackendEvents`](backend.md#backendevents) | `Record`\<`string`, `never`\> | -#### Type declaration +#### Properties ##### ai -> **ai**: [`AiSDK`](index.md#aisdk) +> **ai**: [`AiSDK`](ai.md#aisdk) Utilities to interact with AI. ##### assets -> **assets**: [`AssetsSDK`](index.md#assetssdk) +> **assets**: [`AssetsSDK`](files.md#assetssdk) Utilities to interact with the plugin's static assets. ##### automate -> **automate**: [`AutomateSDK`](index.md#automatesdk) +> **automate**: [`AutomateSDK`](automate.md#automatesdk) Utilities to interact with the Automate page. ##### backend -> **backend**: [`BackendSDK`](index.md#backendsdkt-e)\<`T`, `E`\> +> **backend**: [`BackendSDK`](backend.md#backendsdk)\<`T`, `E`\> Utilities to interact with the backend plugin. ##### commandPalette -> **commandPalette**: [`CommandPaletteSDK`](index.md#commandpalettesdk) +> **commandPalette**: [`CommandPaletteSDK`](command-palette.md#commandpalettesdk) Utilities to interact with the command palette. ##### commands -> **commands**: [`CommandsSDK`](index.md#commandssdk) +> **commands**: [`CommandsSDK`](commands.md#commandssdk) Utilities to interact with commands ##### env -> **env**: [`EnvironmentSDK`](index.md#environmentsdk) +> **env**: [`EnvironmentSDK`](environment.md#environmentsdk) Utilities to interact with the environment. ##### files -> **files**: [`FilesSDK`](index.md#filessdk) +> **files**: [`FilesSDK`](files.md#filessdk) Utilities to interact with the Files page. ##### filters -> **filters**: [`FiltersSDK`](index.md#filterssdk) +> **filters**: [`FiltersSDK`](filters.md#filterssdk) Utilities to interact with Filters page. ##### findings -> **findings**: [`FindingsSDK`](index.md#findingssdk) +> **findings**: [`FindingsSDK`](findings.md#findingssdk) Utilities to interact with findings ##### footer -> **footer**: [`FooterSDK`](index.md#footersdk) +> **footer**: [`FooterSDK`](footer.md#footersdk) Utilities to interact with the footer. @@ -94,4525 +91,146 @@ Utilities to interact with the GraphQL API. ##### httpHistory -> **httpHistory**: [`HTTPHistorySDK`](index.md#httphistorysdk) +> **httpHistory**: [`HTTPHistorySDK`](http-history.md#httphistorysdk) Utilities to interact with the HTTP History page. ##### intercept -> **intercept**: [`InterceptSDK`](index.md#interceptsdk) +> **intercept**: [`InterceptSDK`](intercept.md#interceptsdk) Utilities to interact with the Intercept page. ##### log -> **log**: [`LogSDK`](index.md#logsdk) +> **log**: [`LogSDK`](log.md#logsdk) Utilities for logging messages to the console. ##### matchReplace -> **matchReplace**: [`MatchReplaceSDK`](index.md#matchreplacesdk) +> **matchReplace**: [`MatchReplaceSDK`](match-and-replace.md#matchreplacesdk) Utilities to interact with Match and Replace page. ##### menu -> **menu**: [`MenuSDK`](index.md#menusdk) +> **menu**: [`MenuSDK`](menu.md#menusdk) Utilities to insert menu items and context-menus throughout the UI. ##### navigation -> **navigation**: [`NavigationSDK`](index.md#navigationsdk) +> **navigation**: [`NavigationSDK`](navigation.md#navigationsdk) Utilities to interact with navigation. ##### projects -> **projects**: [`ProjectsSDK`](index.md#projectssdk) +> **projects**: [`ProjectsSDK`](projects.md#projectssdk) Utilities to interact with projects. ##### replay -> **replay**: [`ReplaySDK`](index.md#replaysdk) +> **replay**: [`ReplaySDK`](replay.md#replaysdk) Utilities to interact with the Replay page. ##### runtime -> **runtime**: [`RuntimeSDK`](index.md#runtimesdk) +> **runtime**: [`RuntimeSDK`](runtime.md#runtimesdk) Utilities to interact with the runtime. ##### scopes -> **scopes**: [`ScopesSDK`](index.md#scopessdk) +> **scopes**: [`ScopesSDK`](scopes.md#scopessdk) Utilities to interact with scopes ##### search -> **search**: [`SearchSDK`](index.md#searchsdk) +> **search**: [`SearchSDK`](search.md#searchsdk) Utilities to interact with the Search page. ##### shortcuts -> **shortcuts**: [`ShortcutsSDK`](index.md#shortcutssdk) +> **shortcuts**: [`ShortcutsSDK`](shortcuts.md#shortcutssdk) Utilities to interact with shortcuts. ##### sidebar -> **sidebar**: [`SidebarSDK`](index.md#sidebarsdk) +> **sidebar**: [`SidebarSDK`](sidebar.md#sidebarsdk) Utilities to interact with the sidebar. ##### sitemap -> **sitemap**: [`SitemapSDK`](index.md#sitemapsdk) +> **sitemap**: [`SitemapSDK`](sitemap.md#sitemapsdk) Utilities to interact with the Sitemap page. ##### storage -> **storage**: [`StorageSDK`](index.md#storagesdk) +> **storage**: [`StorageSDK`](storage.md#storagesdk) Utilities to interact with frontend-plugin storage. ##### ui -> **ui**: [`UISDK`](index.md#uisdk) +> **ui**: [`UISDK`](ui.md#uisdk) Utilities to create UI components. ##### window -> **window**: [`WindowSDK`](index.md#windowsdk) +> **window**: [`WindowSDK`](window.md#windowsdk) Utilities to interact with the active page. ##### workflows -> **workflows**: [`WorkflowSDK`](index.md#workflowsdk) +> **workflows**: [`WorkflowSDK`](workflows.md#workflowsdk) Utilities to interact with workflows. -## Backend - -### BackendEndpoints - -> **BackendEndpoints**: `object` - -Endpoints provided by the backend plugin. - -#### Index Signature - -\[`key`: `string`\]: (...`args`: `any`[]) => `any` - -*** - -### BackendEvents - -> **BackendEvents**: `object` - -Events emitted by the backend plugin. - -#### Index Signature - -\[`key`: `string`\]: (...`args`: `any`[]) => `void` - -*** - -### BackendSDK\ - -> **BackendSDK**\<`T`, `E`\>: `{ [K in keyof T]: (args: Parameters) => PromisifiedReturnType }` & `object` - -Utilities to interact with the backend plugin. - -#### Type declaration - -##### onEvent() - -> **onEvent**: \<`K`\>(`event`: `K`, `callback`: `E`\[`K`\]) => `object` - -Subscribe to a backend event. - -###### Type Parameters - -| Type Parameter | -| ------ | -| `K` *extends* keyof `E` | - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `event` | `K` | The event to subscribe to. | -| `callback` | `E`\[`K`\] | The callback to call when the event is emitted. | - -###### Returns - -`object` - -An object with a `stop` method that can be called to stop listening to the event. - -###### stop() - -> **stop**: () => `void` - -###### Returns - -`void` - -#### Type Parameters - -| Type Parameter | -| ------ | -| `T` *extends* [`BackendEndpoints`](index.md#backendendpoints) | -| `E` *extends* [`BackendEvents`](index.md#backendevents) | - -## UI - -### UISDK - -> **UISDK**: `object` - -Utilities to create UI components. - -#### Type declaration - -##### button() - -> **button**: (`options`?: `object`) => `HTMLElement` - -Create a button. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `options`? | \{ `label`: `string`; `leadingIcon`: [`Icon`](index.md#icon); `size`: `"small"` \| `"medium"` \| `"large"`; `trailingIcon`: [`Icon`](index.md#icon); `variant`: `"primary"` \| `"secondary"` \| `"tertiary"`; \} | Options for the button. | -| `options.label`? | `string` | The label of the button. | -| `options.leadingIcon`? | [`Icon`](index.md#icon) | The leading icon of the button. | -| `options.size`? | `"small"` \| `"medium"` \| `"large"` | The size of the button. | -| `options.trailingIcon`? | [`Icon`](index.md#icon) | The trailing icon of the button. | -| `options.variant`? | `"primary"` \| `"secondary"` \| `"tertiary"` | The variant of the button. | - -###### Returns - -`HTMLElement` - -The button element. - -###### Example - -```ts -const deleteButton = sdk.ui.button({ - variant: "primary", - label: "Delete", - trailingIcon: "fas fa-trash-can", - size: "small", -}); -``` - -##### card() - -> **card**: (`options`?: `object`) => `HTMLElement` - -Create a card. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `options`? | \{ `body`: `HTMLElement`; `footer`: `HTMLElement`; `header`: `HTMLElement`; \} | Options for the card. | -| `options.body`? | `HTMLElement` | The body of the card. | -| `options.footer`? | `HTMLElement` | The footer of the card. | -| `options.header`? | `HTMLElement` | The header of the card. | - -###### Returns - -`HTMLElement` - -The card element. - -##### httpRequestEditor() - -> **httpRequestEditor**: () => [`HTTPRequestEditor`](index.md#httprequesteditor) - -Create an HTTP request editor - -###### Returns - -[`HTTPRequestEditor`](index.md#httprequesteditor) - -The HTTP request editor. - -##### httpResponseEditor() - -> **httpResponseEditor**: () => [`HTTPResponseEditor`](index.md#httpresponseeditor) - -Create an HTTP response editor - -###### Returns - -[`HTTPResponseEditor`](index.md#httpresponseeditor) - -The HTTP response editor. - -##### well() - -> **well**: (`options`?: `object`) => `HTMLElement` - -Create a well. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `options`? | \{ `body`: `HTMLElement`; `footer`: `HTMLElement`; `header`: `HTMLElement`; \} | Options for the well. | -| `options.body`? | `HTMLElement` | The body of the well. | -| `options.footer`? | `HTMLElement` | The footer of the well. | -| `options.header`? | `HTMLElement` | The header of the well. | - -###### Returns - -`HTMLElement` - -The well element. - -## Scopes - -### Scope - -> **Scope**: `object` - -Represents a scope. - -#### Type declaration - -##### allowlist - -> **allowlist**: `string`[] - -The list of included items. - -##### denylist - -> **denylist**: `string`[] - -The list of excluded items. - -##### id - -> **id**: [`ID`](index.md#id-3) - -The unique ID of the scope. - -##### name - -> **name**: `string` - -The name of the scope. - -*** - -### ScopesSDK - -> **ScopesSDK**: `object` - -Utilities to interact with scopes - -#### Type declaration - -##### createScope() - -> **createScope**: (`options`: `object`) => `Promise`\<[`Scope`](index.md#scope) \| `undefined`\> - -Create a scope. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `options` | \{ `allowlist`: `string`[]; `denylist`: `string`[]; `name`: `string`; \} | Options for the scope. | -| `options.allowlist` | `string`[] | The list of included items in the scope. | -| `options.denylist` | `string`[] | The list of excluded items in the scope. | -| `options.name` | `string` | The name of the scope. | - -###### Returns - -`Promise`\<[`Scope`](index.md#scope) \| `undefined`\> - -The created scope. - -###### Example - -```ts -const newScope = await sdk.scopes.createScope({ - name: "Example", - allowlist: ["*example.com", "*github.com"], - denylist: ["*caido.io"], -}); -``` - -##### deleteScope() - -> **deleteScope**: (`id`: [`ID`](index.md#id-3)) => `Promise`\<`boolean`\> - -Delete a scope. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) | The id of the scope to delete. | - -###### Returns - -`Promise`\<`boolean`\> - -Whether the scope was deleted. - -##### getScopes() - -> **getScopes**: () => [`Scope`](index.md#scope)[] - -Get all scopes. - -###### Returns - -[`Scope`](index.md#scope)[] - -A list of scopes. - -##### updateScope() - -> **updateScope**: (`id`: [`ID`](index.md#id-3), `options`: `object`) => `Promise`\<[`Scope`](index.md#scope) \| `undefined`\> - -Update a scope. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) | The id of the scope to update. | -| `options` | \{ `allowlist`: `string`[]; `denylist`: `string`[]; `name`: `string`; \} | Options for the scope. | -| `options.allowlist`? | `string`[] | The list of included items in the scope. | -| `options.denylist`? | `string`[] | The list of excluded items in the scope. | -| `options.name`? | `string` | The name of the scope. | - -###### Returns - -`Promise`\<[`Scope`](index.md#scope) \| `undefined`\> - -The updated scope. - -## Findings - -### Finding - -> **Finding**: `object` - -Represents a [https://docs.caido.io/reference/features/logging/findings\|Finding](https://docs.caido.io/reference/features/logging/findings|Finding). - -#### Type declaration - -##### description? - -> `optional` **description**: `string` - -The description of the finding. - -##### host - -> **host**: `string` - -The host of the request attached to this finding - -##### id - -> **id**: [`ID`](index.md#id-3) - -The ID of the finding. - -##### path - -> **path**: `string` - -The path of the request attached to this finding - -##### reporter - -> **reporter**: `string` - -The reporter of the finding. - -##### title - -> **title**: `string` - -The title of the finding. - -*** - -### FindingsSDK - -> **FindingsSDK**: `object` - -Utilities to interact with findings - -#### Type declaration - -##### addRequestEditorExtension() - -> **addRequestEditorExtension**: (`extension`: `Extension`) => `void` - -Add an extension to the request editor. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `extension` | `Extension` | The extension to add. | - -###### Returns - -`void` - -##### addRequestViewMode() - -> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](index.md#requestviewmodeoptions)) => `void` - -Add a custom request view mode. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `options` | [`RequestViewModeOptions`](index.md#requestviewmodeoptions) | The view mode options. | - -###### Returns - -`void` - -##### createFinding() - -> **createFinding**: (`requestId`: [`ID`](index.md#id-3), `options`: `object`) => `Promise`\<[`Finding`](index.md#finding) \| `undefined`\> - -Create a [Finding](index.md#finding). - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `requestId` | [`ID`](index.md#id-3) | The id of the request the finding is associated with. | -| `options` | \{ `dedupeKey`: `string`; `description`: `string`; `reporter`: `string`; `title`: `string`; \} | Options for the finding. | -| `options.dedupeKey`? | `string` | If a finding with the same deduplication key already exists, it will not create a new finding. | -| `options.description`? | `string` | The description of the finding. | -| `options.reporter` | `string` | The reporter of the finding. | -| `options.title` | `string` | The title of the finding. | - -###### Returns - -`Promise`\<[`Finding`](index.md#finding) \| `undefined`\> - -The created finding. - -## Commands - -### CommandContext - -> **CommandContext**: [`CommandContextBase`](index.md#commandcontextbase) \| [`CommandContextRequestRow`](index.md#commandcontextrequestrow) \| [`CommandContextRequest`](index.md#commandcontextrequest) \| [`CommandContextResponse`](index.md#commandcontextresponse) - -Represents the context in which a command is executed. - -*** - -### CommandContextBase - -> **CommandContextBase**: `object` - -The base context for a command. -This context is used for commands that are not executed in a specific context, such as via shortcuts and the command palette. - -#### Type declaration - -##### type - -> **type**: `"BaseContext"` - -*** - -### CommandContextRequest - -> **CommandContextRequest**: `object` - -The context for a command that is executed on a request pane. - -#### Type declaration - -##### request - -> **request**: [`RequestDraft`](index.md#requestdraft) \| [`RequestFull`](index.md#requestfull) - -The request that is currently open in the request pane. -If the request has not yet been saved in the database, the id will be undefined. - -##### selection - -> **selection**: `string` - -The currently selected text in the request pane. - -##### type - -> **type**: `"RequestContext"` - -*** - -### CommandContextRequestRow - -> **CommandContextRequestRow**: `object` - -The context for a command that is executed on a row in the request table. - -#### Type declaration - -##### requests - -> **requests**: [`RequestMeta`](index.md#requestmeta)[] - -The requests that are selected in the request table. - -##### type - -> **type**: `"RequestRowContext"` - -*** - -### CommandContextResponse - -> **CommandContextResponse**: `object` - -The context for a command that is executed on a response pane. - -#### Type declaration - -##### request - -> **request**: [`RequestMeta`](index.md#requestmeta) - -The request that is associated with the response. - -##### response - -> **response**: `object` - -The response that is currently open in the response pane. - -###### response.id - -> **id**: [`ID`](index.md#id-3) - -###### response.raw - -> **raw**: `string` - -###### response.roundtripTime - -> **roundtripTime**: `number` - -###### response.statusCode - -> **statusCode**: `number` - -##### selection - -> **selection**: `string` - -The currently selected text in the response pane. - -##### type - -> **type**: `"ResponseContext"` - -*** - -### CommandsSDK - -> **CommandsSDK**: `object` - -Utilities to interact with commands - -#### Type declaration - -##### register() - -> **register**: (`id`: [`CommandID`](index.md#commandid), `options`: `object`) => `void` - -Register a command. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`CommandID`](index.md#commandid) | The id of the command. | -| `options` | \{ `group`: `string`; `name`: `string`; `run`: (`context`: [`CommandContext`](index.md#commandcontext)) => `Promise`\<`void`\> \| `void`; `when`: (`context`: [`CommandContext`](index.md#commandcontext)) => `Promise`\<`boolean`\> \| `boolean`; \} | Options for the command. | -| `options.group`? | `string` | The group this command belongs to. | -| `options.name` | `string` | The name of the command. | -| `options.run` | (`context`: [`CommandContext`](index.md#commandcontext)) => `Promise`\<`void`\> \| `void` | The function to run when the command is executed. | -| `options.when`? | (`context`: [`CommandContext`](index.md#commandcontext)) => `Promise`\<`boolean`\> \| `boolean` | A function to determine if the command is available. | - -###### Returns - -`void` - -###### Example - -```ts -sdk.commands.register("hello", { - name: "Print to console.", - run: () => console.log("Hello world!"), - group: "Custom Commands", -}); -``` - -## Menu - -### MenuItem - -> **MenuItem**: [`RequestRowMenuItem`](index.md#requestrowmenuitem) \| [`SettingsMenuItem`](index.md#settingsmenuitem) \| [`RequestMenuItem`](index.md#requestmenuitem) \| [`ResponseMenuItem`](index.md#responsemenuitem) - -A content-menu item. - -*** - -### MenuSDK - -> **MenuSDK**: `object` - -Utilities to insert menu items and context-menus throughout the UI. - -#### Type declaration - -##### registerItem() - -> **registerItem**: (`item`: [`MenuItem`](index.md#menuitem)) => `void` - -Register a menu item. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `item` | [`MenuItem`](index.md#menuitem) | The menu item to register. | - -###### Returns - -`void` - -###### Example - -```ts -sdk.menu.registerItem({ - type: "Request", - commandId: "hello", - leadingIcon: "fas fa-hand", -}); -``` - -*** - -### RequestMenuItem - -> **RequestMenuItem**: `object` - -A context-menu item that appears when right-clicking a request pane. - -#### Type declaration - -##### commandId - -> **commandId**: [`CommandID`](index.md#commandid) - -The command ID to execute when the menu item is clicked. - -##### leadingIcon? - -> `optional` **leadingIcon**: `string` - -The icon to display to the left of the menu item. - -##### type - -> **type**: `"Request"` - -*** - -### RequestRowMenuItem - -> **RequestRowMenuItem**: `object` - -A context-menu item that appears when right-clicking a request row. - -#### Type declaration - -##### commandId - -> **commandId**: [`CommandID`](index.md#commandid) - -The command ID to execute when the menu item is clicked. - -##### leadingIcon? - -> `optional` **leadingIcon**: `string` - -The icon to display to the left of the menu item. - -##### type - -> **type**: `"RequestRow"` - -*** - -### ResponseMenuItem - -> **ResponseMenuItem**: `object` - -A context-menu item that appears when right-clicking a response pane. - -#### Type declaration - -##### commandId - -> **commandId**: [`CommandID`](index.md#commandid) - -The command ID to execute when the menu item is - -##### leadingIcon? - -> `optional` **leadingIcon**: `string` - -The icon to display to the left of the menu item. - -##### type - -> **type**: `"Response"` - -*** - -### SettingsMenuItem - -> **SettingsMenuItem**: `object` - -A menu item that appears in the settings menu. - -#### Type declaration - -##### label - -> **label**: `string` - -The label of the menu item. - -##### leadingIcon? - -> `optional` **leadingIcon**: [`Icon`](index.md#icon) - -The [Icon](index.md#icon) to display to the left of the menu item. - -##### path - -> **path**: `string` - -The path that the user will be navigated to when the menu item is clicked -The path must start with "/settings/". - -##### type - -> **type**: `"Settings"` - -## Navigation - -### NavigationSDK - -> **NavigationSDK**: `object` - -Utilities to interact with navigation. - -#### Type declaration - -##### addPage() - -> **addPage**: (`path`: `string`, `options`: `object`) => `void` - -Add a page to the navigation. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `path` | `string` | The path of the page. | -| `options` | \{ `body`: `HTMLElement`; `onEnter`: () => `void`; `topbar`: `HTMLElement`; \} | Options for the page. | -| `options.body` | `HTMLElement` | The body of the page. | -| `options.onEnter`? | () => `void` | The callback to execute when the page is entered. | -| `options.topbar`? | `HTMLElement` | The topbar of the page. | - -###### Returns - -`void` - -##### goTo() - -> **goTo**: (`route`: `string` \| \{ `id`: [`Routes`](index.md#routes); \}) => `void` - -Navigate to a route or path. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `route` | `string` \| \{ `id`: [`Routes`](index.md#routes); \} | The route to navigate to. Can be a route ID object or a custom path string. | - -###### Returns - -`void` - -###### Example - -```ts -sdk.navigation.goTo({ id: Routes.Replay }); -sdk.navigation.goTo({ id: Routes.Projects }); -sdk.navigation.goTo("/my-plugin-page"); -``` - -##### onPageChange() - -> **onPageChange**: (`callback`: (`route`: [`PageChangeEvent`](index.md#pagechangeevent)) => `void`) => [`ListenerHandle`](index.md#listenerhandle) - -Subscribe to page changes. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `callback` | (`route`: [`PageChangeEvent`](index.md#pagechangeevent)) => `void` | The callback to call when the page changes. | - -###### Returns - -[`ListenerHandle`](index.md#listenerhandle) - -An object with a `stop` method that can be called to stop listening to page changes. - -###### Example - -```ts -const handler = sdk.navigation.onPageChange((event) => { - console.log('Page changed to:', event.routeId); - console.log('- path:', event.path); -}); - -// Later, stop listening -handler.stop(); -``` - -## Window - -### WindowSDK - -> **WindowSDK**: `object` - -Utilities to interact with the active page. - -#### Type declaration - -##### getActiveEditor() - -> **getActiveEditor**: () => [`Editor`](index.md#editor) \| `undefined` - -Get the active editor. - -###### Returns - -[`Editor`](index.md#editor) \| `undefined` - -The active editor. - -##### showDialog() - -> **showDialog**: (`component`: [`ComponentDefinition`](index.md#componentdefinition), `options`?: [`DialogOptions`](index.md#dialogoptions)) => [`Dialog`](index.md#dialog) - -Show a dialog component. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `component` | [`ComponentDefinition`](index.md#componentdefinition) | The custom slot content to display in the dialog. | -| `options`? | [`DialogOptions`](index.md#dialogoptions) | Options for the dialog. | - -###### Returns - -[`Dialog`](index.md#dialog) - -A dialog object that can be used to close the dialog. - -##### showToast() - -> **showToast**: (`message`: `string`, `options`?: `object`) => `void` - -Show a toast message. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `message` | `string` | The message to show. | -| `options`? | \{ `duration`: `number`; `variant`: `"success"` \| `"error"` \| `"warning"` \| `"info"`; \} | Options for the toast message. | -| `options.duration`? | `number` | The duration of the toast message in milliseconds. | -| `options.variant`? | `"success"` \| `"error"` \| `"warning"` \| `"info"` | The variant of the toast message. | - -###### Returns - -`void` - -## Storage - -### StorageSDK - -> **StorageSDK**: `object` - -Utilities to interact with frontend-plugin storage. - -#### Type declaration - -##### get() - -> **get**: () => [`JSONValue`](index.md#jsonvalue) - -Get the storage. - -###### Returns - -[`JSONValue`](index.md#jsonvalue) - -The storage. - -##### onChange() - -> **onChange**: (`callback`: (`value`: [`JSONValue`](index.md#jsonvalue)) => `void`) => `void` - -Subscribe to storage changes. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `callback` | (`value`: [`JSONValue`](index.md#jsonvalue)) => `void` | The callback to call when the storage changes. | - -###### Returns - -`void` - -##### set() - -> **set**: \<`T`\>(`value`: [`JSONCompatible`](index.md#jsoncompatiblet)\<`T`\>) => `Promise`\<`void`\> - -Set the storage. - -###### Type Parameters - -| Type Parameter | -| ------ | -| `T` | - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `value` | [`JSONCompatible`](index.md#jsoncompatiblet)\<`T`\> | The value to set the storage to | - -###### Returns - -`Promise`\<`void`\> - -A promise that resolves when the storage has been set. - -## Shortcuts - -### ShortcutsSDK - -> **ShortcutsSDK**: `object` - -Utilities to interact with shortcuts. - -#### Type declaration - -##### register() - -> **register**: (`commandId`: [`CommandID`](index.md#commandid), `keys`: `string`[]) => `void` - -Register a shortcut. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `commandId` | [`CommandID`](index.md#commandid) | The id of the command to run when the shortcut is triggered. | -| `keys` | `string`[] | The keys of the shortcut. Check out [KeyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values) for the list of supported keys. | - -###### Returns - -`void` - -## Command Palette - -### CommandPaletteSDK - -> **CommandPaletteSDK**: `object` - -Utilities to interact with the command palette. - -#### Type declaration - -##### pushView() - -> **pushView**: (`view`: [`CommandPaletteView`](index.md#commandpaletteview)) => `void` - -Push a new view onto the command palette view stack. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `view` | [`CommandPaletteView`](index.md#commandpaletteview) | The view to push onto the stack. | - -###### Returns - -`void` - -##### register() - -> **register**: (`commandId`: [`CommandID`](index.md#commandid)) => `void` - -Register a command. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `commandId` | [`CommandID`](index.md#commandid) | The id of the command to register. | - -###### Returns - -`void` - -*** - -### CommandPaletteView - -> **CommandPaletteView**: `object` - -Command palette view definition for custom UI content. - -#### Type declaration - -##### definition - -> **definition**: [`ComponentDefinition`](index.md#componentdefinition) - -##### type - -> **type**: `"Custom"` - -## Sidebar - -### SidebarItem - -> **SidebarItem**: `object` - -Represents a sidebar item. - -#### Type declaration - -##### setCount() - -> **setCount**: (`count`: `number`) => `void` - -Set the value of a notification badge next to the sidebar item. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `count` | `number` | The number to display in the badge. A value of 0 will hide the badge. | - -###### Returns - -`void` - -*** - -### SidebarSDK - -> **SidebarSDK**: `object` - -Utilities to interact with the sidebar. - -#### Type declaration - -##### registerItem() - -> **registerItem**: (`name`: `string`, `path`: `string`, `options`?: `object`) => [`SidebarItem`](index.md#sidebaritem) - -Register a sidebar item. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `name` | `string` | The name of the sidebar item. | -| `path` | `string` | The path that the user will be navigated to when the sidebar item is clicked. | -| `options`? | \{ `group`: `string`; `icon`: [`Icon`](index.md#icon); `isExternal`: `boolean`; \} | Options for the sidebar item. | -| `options.group`? | `string` | The group the sidebar item belongs to. | -| `options.icon`? | [`Icon`](index.md#icon) | The [Icon](index.md#icon) of the sidebar item. | -| `options.isExternal`? | `boolean` | Whether the path points to an external URL. | - -###### Returns - -[`SidebarItem`](index.md#sidebaritem) - -The created sidebar item. - -###### Example - -```ts -sdk.sidebar.registerItem("My Plugin", "/my-plugin-page", { - icon: "fas fa-rocket", -}); -``` - -## Replay - -### CurrentReplaySessionChangeEvent - -> **CurrentReplaySessionChangeEvent**: `object` - -Event fired when the current replay session changes. - -#### Type declaration - -##### sessionId - -> **sessionId**: [`ID`](index.md#id-3) \| `undefined` - -The ID of the newly selected session, or undefined if no session is selected. - -*** - -### OpenTabOptions - -> **OpenTabOptions**: `object` - -Options for opening a tab. - -#### Type declaration - -##### select? - -> `optional` **select**: `boolean` - -Whether to select the tab after opening it. -Defaults to true. - -*** - -### ReplayCollection - -> **ReplayCollection**: `object` - -A collection in Replay. - -#### Type declaration - -##### id - -> **id**: [`ID`](index.md#id-3) - -The ID of the collection. - -##### name - -> **name**: `string` - -The name of the collection. - -##### sessionIds - -> **sessionIds**: [`ID`](index.md#id-3)[] - -The sessions in the collection. - -*** - -### ReplaySDK - -> **ReplaySDK**: `object` - -Utilities to interact with Replay. - -#### Type declaration - -##### addRequestEditorExtension() - -> **addRequestEditorExtension**: (`extension`: `Extension`) => `void` - -Add an extension to the request editor. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `extension` | `Extension` | The extension to add. | - -###### Returns - -`void` - -##### addRequestViewMode() - -> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](index.md#requestviewmodeoptions)) => `void` - -Add a custom view mode for requests. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `options` | [`RequestViewModeOptions`](index.md#requestviewmodeoptions) | The view mode options. | - -###### Returns - -`void` - -##### addToSlot - -> **addToSlot**: [`DefineAddToSlotFn`](index.md#defineaddtoslotfntmap)\<[`ReplaySlotContent`](index.md#replayslotcontent)\> - -Add a component to a slot. - -###### Param - -The slot to add the component to. - -###### Param - -The content to add to the slot. - -###### Example - -```ts -addToSlot(ReplaySlot.SessionToolbarPrimary, { - kind: "Command", - commandId: "my-command", - icon: "my-icon", -}); - -addToSlot(ReplaySlot.SessionToolbarSecondary, { - kind: "Custom", - component: MyComponent, -}); - -addToSlot(ReplaySlot.Topbar, { - kind: "Button", - label: "My Button", - icon: "my-icon", - onClick: () => { - console.log("Button clicked"); - }, -}); -``` - -##### closeTab() - -> **closeTab**: (`sessionId`: [`ID`](index.md#id-3)) => `void` - -Close a replay tab for the given session. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `sessionId` | [`ID`](index.md#id-3) | The ID of the session to close. | - -###### Returns - -`void` - -##### createCollection() - -> **createCollection**: (`name`: `string`) => `Promise`\<[`ReplayCollection`](index.md#replaycollection)\> - -Create a new collection. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `name` | `string` | The name of the collection to create. | - -###### Returns - -`Promise`\<[`ReplayCollection`](index.md#replaycollection)\> - -##### createSession() - -> **createSession**: (`source`: [`RequestSource`](index.md#requestsource), `collectionId`?: [`ID`](index.md#id-3)) => `Promise`\<`void`\> - -Create a session. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `source` | [`RequestSource`](index.md#requestsource) | - | -| `collectionId`? | [`ID`](index.md#id-3) | The ID of the collection to add the request. | - -###### Returns - -`Promise`\<`void`\> - -##### deleteCollection() - -> **deleteCollection**: (`id`: [`ID`](index.md#id-3)) => `Promise`\<`boolean`\> - -Delete a collection. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) | The ID of the collection to delete. | - -###### Returns - -`Promise`\<`boolean`\> - -Whether the collection was deleted. - -##### deleteSessions() - -> **deleteSessions**: (`sessionIds`: [`ID`](index.md#id-3)[]) => `Promise`\<[`ID`](index.md#id-3)[]\> - -Delete a session. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `sessionIds` | [`ID`](index.md#id-3)[] | The IDs of the sessions to delete. | - -###### Returns - -`Promise`\<[`ID`](index.md#id-3)[]\> - -##### getCollections() - -> **getCollections**: () => [`ReplayCollection`](index.md#replaycollection)[] - -Get the list of all replay collections. - -###### Returns - -[`ReplayCollection`](index.md#replaycollection)[] - -The list of all replay collections. - -##### getSessions() - -> **getSessions**: () => [`ReplaySession`](index.md#replaysession)[] - -Get the list of all replay sessions. - -###### Returns - -[`ReplaySession`](index.md#replaysession)[] - -The list of all replay sessions. - -##### getTabs() - -> **getTabs**: () => [`ReplayTab`](index.md#replaytab)[] - -Get the list of all open replay tabs. - -###### Returns - -[`ReplayTab`](index.md#replaytab)[] - -The list of all open replay tabs. - -##### moveSession() - -> **moveSession**: (`sessionId`: [`ID`](index.md#id-3), `collectionId`: [`ID`](index.md#id-3)) => `Promise`\<[`ReplaySession`](index.md#replaysession)\> - -Move a session to a different collection. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `sessionId` | [`ID`](index.md#id-3) | The ID of the session to move. | -| `collectionId` | [`ID`](index.md#id-3) | The ID of the collection to move the session to. | - -###### Returns - -`Promise`\<[`ReplaySession`](index.md#replaysession)\> - -The updated session. - -##### onCurrentSessionChange() - -> **onCurrentSessionChange**: (`callback`: (`event`: [`CurrentReplaySessionChangeEvent`](index.md#currentreplaysessionchangeevent)) => `void`) => [`ListenerHandle`](index.md#listenerhandle) - -Subscribe to current replay session changes. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `callback` | (`event`: [`CurrentReplaySessionChangeEvent`](index.md#currentreplaysessionchangeevent)) => `void` | The callback to call when the selected session changes. | - -###### Returns - -[`ListenerHandle`](index.md#listenerhandle) - -An object with a `stop` method that can be called to stop listening to session changes. - -###### Example - -```ts -const handler = sdk.replay.onCurrentSessionChange((event) => { - console.log(`Session ${event.sessionId} got selected!`); -}); - -// Later, stop listening -handler.stop(); -``` - -##### openTab() - -> **openTab**: (`sessionId`: [`ID`](index.md#id-3), `options`?: [`OpenTabOptions`](index.md#opentaboptions)) => `void` - -Open a replay tab for the given session. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `sessionId` | [`ID`](index.md#id-3) | The ID of the session to open. | -| `options`? | [`OpenTabOptions`](index.md#opentaboptions) | The options for opening the tab. | - -###### Returns - -`void` - -##### renameCollection() - -> **renameCollection**: (`id`: [`ID`](index.md#id-3), `name`: `string`) => `Promise`\<[`ReplayCollection`](index.md#replaycollection)\> - -Rename a collection. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) | The ID of the collection to rename. | -| `name` | `string` | The new name of the collection. | - -###### Returns - -`Promise`\<[`ReplayCollection`](index.md#replaycollection)\> - -The updated collection. - -##### renameSession() - -> **renameSession**: (`id`: [`ID`](index.md#id-3), `name`: `string`) => `Promise`\<[`ReplaySession`](index.md#replaysession)\> - -Rename a session. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) | The ID of the session to rename. | -| `name` | `string` | The new name of the session. | - -###### Returns - -`Promise`\<[`ReplaySession`](index.md#replaysession)\> - -The updated session. - -##### sendRequest() - -> **sendRequest**: (`sessionId`: [`ID`](index.md#id-3), `options`: [`SendRequestOptions`](index.md#sendrequestoptions)) => `Promise`\<`void`\> - -Send a request to the Replay backend. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `sessionId` | [`ID`](index.md#id-3) | - | -| `options` | [`SendRequestOptions`](index.md#sendrequestoptions) | The options for sending the request. | - -###### Returns - -`Promise`\<`void`\> - -###### Example - -```ts -sendRequest(sessionId, { - connectionInfo: { - SNI: "example.com", - host: "example.com", - isTLS: true, - port: 443, - }, - raw: "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n", - updateContentLength: false, -}); -``` - -*** - -### ReplaySession - -> **ReplaySession**: `object` - -A session in Replay. - -#### Type declaration - -##### collectionId - -> **collectionId**: [`ID`](index.md#id-3) - -The ID of the collection the session belongs to. - -##### id - -> **id**: [`ID`](index.md#id-3) - -The ID of the session. - -##### name - -> **name**: `string` - -The name of the session. - -*** - -### ReplayTab - -> **ReplayTab**: `object` - -A replay tab. - -#### Type declaration - -##### sessionId - -> **sessionId**: [`ID`](index.md#id-3) - -The ID of the session associated with this tab. - -*** - -### RequestSource - -> **RequestSource**: \{ `connectionInfo`: [`SendRequestOptions`](index.md#sendrequestoptions)\[`"connectionInfo"`\]; `raw`: `string`; `type`: `"Raw"`; \} \| \{ `id`: `string`; `type`: `"ID"`; \} - -#### Remarks - -This type is a discriminated union with two possible shapes: -- A raw request, containing the raw HTTP request string and connection information. -- A reference to an existing request ID. - -#### Example - -```ts -// Using a raw request -const source: RequestSource = { - type: "Raw", - raw: "GET /api/data HTTP/1.1", - connectionInfo: { ... } -}; -// Using an ID -const source: RequestSource = { - type: "ID", - id: "request-123" -}; -``` - -*** - -### SendRequestOptions - -> **SendRequestOptions**: `object` - -Options for sending a request. - -#### Type declaration - -##### background? - -> `optional` **background**: `boolean` - -Whether to send the request in the background without updating the UI. -If true, the request will not update the UI. -If false, the UI will be updated to display the session and the new request. -Defaults to false. - -##### connectionClose? - -> `optional` **connectionClose**: `boolean` - -Whether to force close the connection by setting Connection: close header. -Defaults to true. - -##### connectionInfo - -> **connectionInfo**: `object` - -The connection information to use for the request. - -###### connectionInfo.host - -> **host**: `string` - -The host to use for the request. - -###### connectionInfo.isTLS - -> **isTLS**: `boolean` - -Whether the request is TLS. - -###### connectionInfo.port - -> **port**: `number` - -The port to use for the request. - -###### connectionInfo.SNI? - -> `optional` **SNI**: `string` - -The SNI to use for the request. -If not provided, the SNI will be inferred from the host. - -##### overwriteDraft? - -> `optional` **overwriteDraft**: `boolean` - -Whether to overwrite the editor's draft content. -If true, draft content will be overwritten with the new request. -If false, the draft will be kept. -Defaults to true. - -##### raw - -> **raw**: `string` - -The raw request to send. - -##### updateContentLength? - -> `optional` **updateContentLength**: `boolean` - -Whether to update the content length automatically to match the body. -Defaults to true. - -*** - -### ReplaySlot - -> `const` **ReplaySlot**: `object` - -The slots in the Replay UI. - -#### Type declaration - -##### SessionToolbarPrimary - -> `readonly` **SessionToolbarPrimary**: `"session-toolbar-primary"` - -The left side of the session toolbar. - -##### SessionToolbarSecondary - -> `readonly` **SessionToolbarSecondary**: `"session-toolbar-secondary"` - -The right side of the session toolbar. - -##### Topbar - -> `readonly` **Topbar**: `"topbar"` - -The left side of the topbar. - -## HTTP History - -### HTTPHistorySDK - -> **HTTPHistorySDK**: `object` - -Utilities to interact with the HTTP History page. - -#### Type declaration - -##### addRequestEditorExtension() - -> **addRequestEditorExtension**: (`extension`: `Extension`) => `void` - -Add an extension to the request editor. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `extension` | `Extension` | The extension to add. | - -###### Returns - -`void` - -##### addRequestViewMode() - -> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](index.md#requestviewmodeoptions)) => `void` - -Add a custom request view mode. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `options` | [`RequestViewModeOptions`](index.md#requestviewmodeoptions) | The view mode options. | - -###### Returns - -`void` - -##### addResponseEditorExtension() - -> **addResponseEditorExtension**: (`extension`: `Extension`) => `void` - -Add an extension to the response editor. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `extension` | `Extension` | The extension to add. | - -###### Returns - -`void` - -##### getQuery() - -> **getQuery**: () => [`HTTPQL`](index.md#httpql) - -Get the current HTTPQL query. - -###### Returns - -[`HTTPQL`](index.md#httpql) - -The current HTTPQL query. - -##### getScopeId() - -> **getScopeId**: () => [`ID`](index.md#id-3) \| `undefined` - -Get the current scope ID. - -###### Returns - -[`ID`](index.md#id-3) \| `undefined` - -The current scope ID. - -##### scrollTo() - -> **scrollTo**: (`id`: [`ID`](index.md#id-3)) => `void` - -Scrolls the HTTP History table to a specific entry. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) | The ID of the entry to scroll to. | - -###### Returns - -`void` - -##### setQuery() - -> **setQuery**: (`query`: [`HTTPQL`](index.md#httpql)) => `void` - -Set the HTTPQL query that will be applied on the HTTP History table results. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `query` | [`HTTPQL`](index.md#httpql) | The HTTPQL query. | - -###### Returns - -`void` - -##### setScope() - -> **setScope**: (`id`: [`ID`](index.md#id-3) \| `undefined`) => `Promise`\<`void`\> - -Set the current scope. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) \| `undefined` | The ID of the scope to set. | - -###### Returns - -`Promise`\<`void`\> - -## Search - -### SearchSDK - -> **SearchSDK**: `object` - -Utilities to interact with the Search page. - -#### Type declaration - -##### addRequestEditorExtension() - -> **addRequestEditorExtension**: (`extension`: `Extension`) => `void` - -Add an extension to the request editor. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `extension` | `Extension` | The extension to add. | - -###### Returns - -`void` - -##### addRequestViewMode() - -> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](index.md#requestviewmodeoptions)) => `void` - -Add a custom request view mode. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `options` | [`RequestViewModeOptions`](index.md#requestviewmodeoptions) | The view mode options. | - -###### Returns - -`void` - -##### getQuery() - -> **getQuery**: () => [`HTTPQL`](index.md#httpql) - -Get the current HTTPQL query. - -###### Returns - -[`HTTPQL`](index.md#httpql) - -The current HTTPQL query. - -##### getScopeId() - -> **getScopeId**: () => [`ID`](index.md#id-3) \| `undefined` - -Get the current scope ID. - -###### Returns - -[`ID`](index.md#id-3) \| `undefined` - -The current scope ID. - -##### scrollTo() - -> **scrollTo**: (`id`: [`ID`](index.md#id-3)) => `void` - -Scrolls the Search table to a specific request. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) | The ID of the request to scroll to. | - -###### Returns - -`void` - -##### setQuery() - -> **setQuery**: (`query`: [`HTTPQL`](index.md#httpql)) => `void` - -Set the HTTPQL query that will be applied on the search table results. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `query` | [`HTTPQL`](index.md#httpql) | The HTTPQL query. | - -###### Returns - -`void` - -##### setScope() - -> **setScope**: (`id`: [`ID`](index.md#id-3) \| `undefined`) => `Promise`\<`void`\> - -Set the current scope. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) \| `undefined` | The ID of the scope to set. | - -###### Returns - -`Promise`\<`void`\> - -## Files - -### Asset - -> **Asset**: `object` - -A static asset. - -#### Type declaration - -##### asArrayBuffer() - -> **asArrayBuffer**: () => `Promise`\<`ArrayBuffer`\> - -###### Returns - -`Promise`\<`ArrayBuffer`\> - -##### asJson() - -> **asJson**: \<`T`\>() => `Promise`\<`T`\> - -###### Type Parameters - -| Type Parameter | Default type | -| ------ | ------ | -| `T` | `unknown` | - -###### Returns - -`Promise`\<`T`\> - -##### asReadableStream() - -> **asReadableStream**: () => `ReadableStream` - -###### Returns - -`ReadableStream` - -##### asString() - -> **asString**: () => `Promise`\<`string`\> - -###### Returns - -`Promise`\<`string`\> - -*** - -### AssetsSDK - -> **AssetsSDK**: `object` - -Utilities to interact with the plugin's static assets. - -#### Type declaration - -##### get() - -> **get**: (`path`: `string`) => `Promise`\<[`Asset`](index.md#asset)\> - -Get a file from the assets folder. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `path` | `string` | - -###### Returns - -`Promise`\<[`Asset`](index.md#asset)\> - -The asset file. - -*** - -### FilesSDK - -> **FilesSDK**: `object` - -SDK for interacting with the Files page. - -#### Type declaration - -##### create() - -> **create**: (`file`: `File`) => `Promise`\<[`HostedFile`](index.md#hostedfile)\> - -Uploads a file to the host. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `file` | `File` | The file to upload. | - -###### Returns - -`Promise`\<[`HostedFile`](index.md#hostedfile)\> - -The uploaded file. - -##### delete() - -> **delete**: (`id`: `string`) => `Promise`\<`void`\> - -Deletes a file from the host. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | `string` | The ID of the file to delete. | - -###### Returns - -`Promise`\<`void`\> - -The deleted file. - -##### getAll() - -> **getAll**: () => [`HostedFile`](index.md#hostedfile)[] - -Gets all hosted files. - -###### Returns - -[`HostedFile`](index.md#hostedfile)[] - -The files. - -##### rename() - -> **rename**: (`id`: `string`, `name`: `string`) => `Promise`\<[`HostedFile`](index.md#hostedfile)\> - -Renames a file on the host. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | `string` | The ID of the file to rename. | -| `name` | `string` | The new name of the file. | - -###### Returns - -`Promise`\<[`HostedFile`](index.md#hostedfile)\> - -The renamed file. - -*** - -### HostedFile - -> **HostedFile**: `object` - -A hosted file. - -#### Type declaration - -##### createdAt - -> **createdAt**: `Date` - -The date the file was created. - -##### id - -> **id**: `string` - -The ID of the file. - -##### name - -> **name**: `string` - -The name of the file. - -##### path - -> **path**: `string` - -The path of the file. - -##### size - -> **size**: `number` - -The size of the file in bytes. - -##### status - -> **status**: `"ready"` \| `"error"` - -The status of the file. - -##### updatedAt - -> **updatedAt**: `Date` - -The date the file was updated. - -## AI - -### AIProvider - -> **AIProvider**: `ProviderV2` & (`modelId`: `string`) => `LanguageModelV2` - -Official AI Provider to be used by the [ai](https://ai-sdk.dev/) library. - -*** - -### AiSDK - -> **AiSDK**: `object` - -Utilities to interact with AI. - -#### Type declaration - -##### createProvider() - -> **createProvider**: () => [`AIProvider`](index.md#aiprovider) - -Creates a new AI provider instance that can be used with the [ai](https://ai-sdk.dev/) library. - -###### Returns - -[`AIProvider`](index.md#aiprovider) - -A provider instance compatible with the [ai](https://ai-sdk.dev/) library. - -## Automate - -### AutomateSDK - -> **AutomateSDK**: `object` - -Utilities to interact with the Automate page. - -#### Type declaration - -##### addRequestEditorExtension() - -> **addRequestEditorExtension**: (`extension`: `Extension`) => `void` - -Add an extension to the request editor. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `extension` | `Extension` | The extension to add. | - -###### Returns - -`void` - -##### addRequestViewMode() - -> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](index.md#requestviewmodeoptions)) => `void` - -Add a custom request view mode. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `options` | [`RequestViewModeOptions`](index.md#requestviewmodeoptions) | The view mode options. | - -###### Returns - -`void` - -## Environment - -### EnvironmentSDK - -> **EnvironmentSDK**: `object` - -Utilities to interact with the environment. - -#### Type declaration - -##### getVar() - -> **getVar**: (`name`: `string`) => `string` \| `undefined` - -Get the value of an environment variable. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `name` | `string` | The name of the environment variable. | - -###### Returns - -`string` \| `undefined` - -The value of the environment variable. - -##### getVars() - -> **getVars**: () => [`EnvironmentVariable`](index.md#environmentvariable)[] - -Get all environment variables available in the global environment and the selected environment. - -###### Returns - -[`EnvironmentVariable`](index.md#environmentvariable)[] - -All environment variables. - -## Filters - -### Filter - -> **Filter**: `object` - -Represents a filter. - -#### Type declaration - -##### alias - -> **alias**: `string` - -The alias of the filter. -This alias is used when referencing the filter in an HTTPQL query (e.g. `preset:my-alias`). - -##### id - -> **id**: [`ID`](index.md#id-3) - -The ID of the filter. - -##### name - -> **name**: `string` - -The name of the filter. - -##### query - -> **query**: [`HTTPQL`](index.md#httpql) - -The HTTPQL expression of the filter. - -*** - -### FiltersSDK - -> **FiltersSDK**: `object` - -SDK for interacting with the Filters page. - -#### Type declaration - -##### create() - -> **create**: (`options`: `object`) => `Promise`\<[`Filter`](index.md#filter)\> - -Creates a filter. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `options` | \{ `alias`: `string`; `name`: `string`; `query`: [`HTTPQL`](index.md#httpql); \} | Options for the filter. | -| `options.alias` | `string` | The alias of the filter. Used when referencing the filter in an HTTPQL query (e.g. `preset:my-alias`). Should be unique and follow the format `[a-zA-Z0-9_-]+`. | -| `options.name` | `string` | The name of the filter. Should be unique. | -| `options.query` | [`HTTPQL`](index.md#httpql) | The HTTPQL query of the filter. | - -###### Returns - -`Promise`\<[`Filter`](index.md#filter)\> - -The created filter. - -##### delete() - -> **delete**: (`id`: [`ID`](index.md#id-3)) => `Promise`\<`void`\> - -Deletes a filter. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) | The ID of the filter to delete. | - -###### Returns - -`Promise`\<`void`\> - -##### getAll() - -> **getAll**: () => [`Filter`](index.md#filter)[] - -Gets all filters. - -###### Returns - -[`Filter`](index.md#filter)[] - -The filters. - -##### update() - -> **update**: (`id`: [`ID`](index.md#id-3), `options`: `object`) => `Promise`\<[`Filter`](index.md#filter)\> - -Updates a filter. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) | The ID of the filter to update. | -| `options` | \{ `alias`: `string`; `name`: `string`; `query`: [`HTTPQL`](index.md#httpql); \} | Options for the filter. | -| `options.alias` | `string` | The alias of the filter. | -| `options.name` | `string` | The name of the filter. | -| `options.query` | [`HTTPQL`](index.md#httpql) | The HTTPQL query of the filter. | - -###### Returns - -`Promise`\<[`Filter`](index.md#filter)\> - -The updated filter. - -## Footer - -### FooterSDK - -> **FooterSDK**: `object` - -Utilities to interact with the footer. - -#### Type declaration - -##### addToSlot - -> **addToSlot**: [`DefineAddToSlotFn`](index.md#defineaddtoslotfntmap)\<[`FooterSlotContent`](index.md#footerslotcontent)\> - -Add a component to a slot. - -###### Param - -The slot to add the component to. - -###### Param - -The content to add to the slot. - -###### Example - -```ts -addToSlot(FooterSlot.FooterSlotPrimary, { - kind: "Command", - commandId: "my-command", - icon: "my-icon", -}); - -addToSlot(FooterSlot.FooterSlotPrimary, { - kind: "Button", - label: "My button", - icon: "fas fa-rocket", - onClick: () => { - console.log("Button clicked"); - }, -}); - -addToSlot(FooterSlot.FooterSlotSecondary, { - kind: "Custom", - component: MyComponent, -}); -``` - -## Intercept - -### InterceptSDK - -> **InterceptSDK**: `object` - -Utilities to interact with the Intercept page. - -#### Type declaration - -##### addRequestViewMode() - -> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](index.md#requestviewmodeoptions)) => `void` - -Add a custom request view mode. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `options` | [`RequestViewModeOptions`](index.md#requestviewmodeoptions) | The view mode options. | - -###### Returns - -`void` - -##### getScopeId() - -> **getScopeId**: () => [`ID`](index.md#id-3) \| `undefined` - -Get the current scope ID. - -###### Returns - -[`ID`](index.md#id-3) \| `undefined` - -The current scope ID. - -##### setScope() - -> **setScope**: (`id`: [`ID`](index.md#id-3) \| `undefined`) => `void` - -Set the current scope. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `id` | [`ID`](index.md#id-3) \| `undefined` | - -###### Returns - -`void` - -## Log - -### LogSDK - -> **LogSDK**: `object` - -Utilities to log messages to the console. - -#### Type declaration - -##### debug() - -> **debug**: (...`data`: `unknown`[]) => `void` - -Log debug message with variable arguments - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| ...`data` | `unknown`[] | - -###### Returns - -`void` - -##### error() - -> **error**: (...`data`: `unknown`[]) => `void` - -Log error message with variable arguments - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| ...`data` | `unknown`[] | - -###### Returns - -`void` - -##### info() - -> **info**: (...`data`: `unknown`[]) => `void` - -Log info message with variable arguments - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| ...`data` | `unknown`[] | - -###### Returns - -`void` - -##### warn() - -> **warn**: (...`data`: `unknown`[]) => `void` - -Log warning message with variable arguments - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| ...`data` | `unknown`[] | - -###### Returns - -`void` - -## Match and Replace - -### MatchReplaceCollection - -> **MatchReplaceCollection**: `object` - -A collection in Match and Replace. - -#### Type declaration - -##### id - -> **id**: [`ID`](index.md#id-3) - -##### name - -> **name**: `string` - -##### ruleIds - -> **ruleIds**: [`ID`](index.md#id-3)[] - -*** - -### MatchReplaceMatcherRaw - -> **MatchReplaceMatcherRaw**: [`MatchReplaceMatcherRawRegex`](index.md#matchreplacematcherrawregex) \| [`MatchReplaceMatcherRawValue`](index.md#matchreplacematcherrawvalue) \| [`MatchReplaceMatcherRawFull`](index.md#matchreplacematcherrawfull) - -A matcher for raw operations in Match and Replace. - -*** - -### MatchReplaceMatcherRawFull - -> **MatchReplaceMatcherRawFull**: `object` - -This matcher will match the entire section. - -#### Type declaration - -##### kind - -> **kind**: `"MatcherRawFull"` - -*** - -### MatchReplaceMatcherRawRegex - -> **MatchReplaceMatcherRawRegex**: `object` - -This matcher will match using a regex over the section. - -#### Type declaration - -##### kind - -> **kind**: `"MatcherRawRegex"` - -##### regex - -> **regex**: `string` - -*** - -### MatchReplaceMatcherRawValue - -> **MatchReplaceMatcherRawValue**: `object` - -This matcher will match the value if present in the section. - -#### Type declaration - -##### kind - -> **kind**: `"MatcherRawValue"` - -##### value - -> **value**: `string` - -*** - -### MatchReplaceOperationBody - -> **MatchReplaceOperationBody**: [`KeepOperation`](index.md#keepoperationt)\<[`MatchReplaceOperationBodyRaw`](index.md#matchreplaceoperationbodyraw)\> - -An operation for the body section. - -*** - -### MatchReplaceOperationBodyRaw - -> **MatchReplaceOperationBodyRaw**: `object` - -A raw operation for the body section. - -#### Type declaration - -##### kind - -> **kind**: `"OperationBodyRaw"` - -##### matcher - -> **matcher**: [`MatchReplaceMatcherRaw`](index.md#matchreplacematcherraw) - -##### replacer - -> **replacer**: [`MatchReplaceReplacer`](index.md#matchreplacereplacer) - -*** - -### MatchReplaceOperationFirstLineRaw - -> **MatchReplaceOperationFirstLineRaw**: `object` - -A raw operation for the request first line. - -#### Type declaration - -##### kind - -> **kind**: `"OperationFirstLineRaw"` - -##### matcher - -> **matcher**: [`MatchReplaceMatcherRaw`](index.md#matchreplacematcherraw) - -##### replacer - -> **replacer**: [`MatchReplaceReplacer`](index.md#matchreplacereplacer) - -*** - -### MatchReplaceOperationHeader - -> **MatchReplaceOperationHeader**: [`MatchReplaceOperationHeaderRaw`](index.md#matchreplaceoperationheaderraw) \| [`MatchReplaceOperationHeaderAdd`](index.md#matchreplaceoperationheaderadd) \| [`MatchReplaceOperationHeaderRemove`](index.md#matchreplaceoperationheaderremove) \| [`MatchReplaceOperationHeaderUpdate`](index.md#matchreplaceoperationheaderupdate) - -An operation for the header section. - -*** - -### MatchReplaceReplacer - -> **MatchReplaceReplacer**: [`MatchReplaceReplacerTerm`](index.md#matchreplacereplacerterm) \| [`MatchReplaceReplacerWorkflow`](index.md#matchreplacereplacerworkflow) - -A replacer in Match and Replace. - -*** - -### MatchReplaceReplacerTerm - -> **MatchReplaceReplacerTerm**: `object` - -A replacer that replaces with a term. -If the matcher is a regex, groups will be interpolated. - -#### Type declaration - -##### kind - -> **kind**: `"ReplacerTerm"` - -##### term - -> **term**: `string` - -*** - -### MatchReplaceReplacerWorkflow - -> **MatchReplaceReplacerWorkflow**: `object` - -A replacer that replaces with the result of a workflow. -The input of the workflow depends on the operation and matcher. - -#### Type declaration - -##### kind - -> **kind**: `"ReplacerWorkflow"` - -##### workflowId - -> **workflowId**: [`ID`](index.md#id-3) - -*** - -### MatchReplaceRule - -> **MatchReplaceRule**: `object` - -A rule in Match and Replace. - -#### Type declaration - -##### collectionId - -> **collectionId**: [`ID`](index.md#id-3) - -The ID of the collection the rule belongs to. - -##### id - -> **id**: [`ID`](index.md#id-3) - -The ID of the rule. - -##### isEnabled - -> **isEnabled**: `boolean` - -Whether the rule is enabled. - -##### name - -> **name**: `string` - -The name of the rule. - -##### query - -> **query**: [`HTTPQL`](index.md#httpql) - -The HTTPQL query to match the rule against. -Only requests that match the query will be affected by the rule. - -##### section - -> **section**: [`MatchReplaceSection`](index.md#matchreplacesection) - -The section of the rule. - -*** - -### MatchReplaceSDK - -> **MatchReplaceSDK**: `object` - -Utilities to interact with the Match and Replace page. - -#### Type declaration - -##### createCollection() - -> **createCollection**: (`options`: `object`) => `Promise`\<[`MatchReplaceCollection`](index.md#matchreplacecollection)\> - -Create a collection. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `options` | \{ `name`: `string`; \} | The options for the collection. | -| `options.name` | `string` | The name of the collection. | - -###### Returns - -`Promise`\<[`MatchReplaceCollection`](index.md#matchreplacecollection)\> - -##### createRule() - -> **createRule**: (`options`: `object`) => `Promise`\<[`MatchReplaceRule`](index.md#matchreplacerule)\> - -Create a rule. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `options` | \{ `collectionId`: [`ID`](index.md#id-3); `name`: `string`; `query`: [`HTTPQL`](index.md#httpql); `section`: [`MatchReplaceSection`](index.md#matchreplacesection); \} | The options for the rule. | -| `options.collectionId` | [`ID`](index.md#id-3) | The ID of the collection the rule belongs to. | -| `options.name` | `string` | The name of the rule. | -| `options.query` | [`HTTPQL`](index.md#httpql) | The HTTPQL query to match the rule against. | -| `options.section` | [`MatchReplaceSection`](index.md#matchreplacesection) | - | - -###### Returns - -`Promise`\<[`MatchReplaceRule`](index.md#matchreplacerule)\> - -##### deleteCollection() - -> **deleteCollection**: (`id`: [`ID`](index.md#id-3)) => `Promise`\<`void`\> - -Delete a collection. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) | The ID of the collection. | - -###### Returns - -`Promise`\<`void`\> - -##### deleteRule() - -> **deleteRule**: (`id`: [`ID`](index.md#id-3)) => `Promise`\<`void`\> - -Delete a rule. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) | The ID of the rule. | - -###### Returns - -`Promise`\<`void`\> - -##### getActiveRules() - -> **getActiveRules**: () => [`MatchReplaceRule`](index.md#matchreplacerule)[] - -Get all active rules. -Rules are ordered in priority from highest to lowest. - -###### Returns - -[`MatchReplaceRule`](index.md#matchreplacerule)[] - -All active rules. - -##### getCollections() - -> **getCollections**: () => [`MatchReplaceCollection`](index.md#matchreplacecollection)[] - -Get all collections. - -###### Returns - -[`MatchReplaceCollection`](index.md#matchreplacecollection)[] - -##### getRules() - -> **getRules**: () => [`MatchReplaceRule`](index.md#matchreplacerule)[] - -Get all rules. - -###### Returns - -[`MatchReplaceRule`](index.md#matchreplacerule)[] - -All rules. - -##### selectRule() - -> **selectRule**: (`id`: [`ID`](index.md#id-3) \| `undefined`) => `void` - -Select a rule to be displayed in the UI. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) \| `undefined` | The ID of the rule, or undefined to clear the selection. | - -###### Returns - -`void` - -##### toggleRule() - -> **toggleRule**: (`id`: [`ID`](index.md#id-3), `enabled`: `boolean`) => `Promise`\<`void`\> - -Toggle a rule. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) | The ID of the rule. | -| `enabled` | `boolean` | Whether the rule should be enabled. | - -###### Returns - -`Promise`\<`void`\> - -##### updateCollection() - -> **updateCollection**: (`id`: [`ID`](index.md#id-3), `options`: `object`) => `Promise`\<[`MatchReplaceCollection`](index.md#matchreplacecollection)\> - -Update a collection. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) | The ID of the collection. | -| `options` | \{ `name`: `string`; \} | The new values for the collection. | -| `options.name` | `string` | The new name of the collection. | - -###### Returns - -`Promise`\<[`MatchReplaceCollection`](index.md#matchreplacecollection)\> - -##### updateRule() - -> **updateRule**: (`id`: [`ID`](index.md#id-3), `options`: `object`) => `Promise`\<[`MatchReplaceRule`](index.md#matchreplacerule)\> - -Update a rule. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) | The ID of the rule. | -| `options` | \{ `name`: `string`; `query`: [`HTTPQL`](index.md#httpql); `section`: [`MatchReplaceSection`](index.md#matchreplacesection); \} | The new values for the rule. | -| `options.name` | `string` | The new name of the rule. | -| `options.query`? | [`HTTPQL`](index.md#httpql) | The new HTTPQL query of the rule. | -| `options.section` | [`MatchReplaceSection`](index.md#matchreplacesection) | The new section of the rule. | - -###### Returns - -`Promise`\<[`MatchReplaceRule`](index.md#matchreplacerule)\> - -*** - -### MatchReplaceSectionRequestFirstLine - -> **MatchReplaceSectionRequestFirstLine**: `object` - -A section for the request first line. - -#### Type declaration - -##### kind - -> **kind**: `"SectionRequestFirstLine"` - -##### operation - -> **operation**: [`MatchReplaceOperationFirstLine`](index.md#matchreplaceoperationfirstline) - -*** - -### MatchReplaceSectionResponseFirstLine - -> **MatchReplaceSectionResponseFirstLine**: `object` - -A section for the response first line. - -#### Type declaration - -##### kind - -> **kind**: `"SectionResponseFirstLine"` - -##### operation - -> **operation**: [`MatchReplaceOperationFirstLine`](index.md#matchreplaceoperationfirstline) - -## Other - -### As\ - -> **As**\<`TType`\>: `object` - -#### Type Parameters - -| Type Parameter | -| ------ | -| `TType` *extends* `string` | - -#### Type declaration - -##### type - -> **type**: `TType` - -*** - -### ButtonSlotContent - -> **ButtonSlotContent**: [`DefineSlotContent`](index.md#defineslotcontentttype-p)\<`"Button"`, \{ `icon`: `string`; `label`: `string`; `onClick`: () => `void`; \}\> - -*** - -### CommandID - -> **CommandID**: `string` & `object` - -A unique command identifier. - -#### Type declaration - -##### \_\_commandId? - -> `optional` **\_\_commandId**: `never` - -#### Example - -```ts -"my-super-command" -``` - -*** - -### CommandSlotContent - -> **CommandSlotContent**: [`DefineSlotContent`](index.md#defineslotcontentttype-p)\<`"Command"`, \{ `commandId`: [`CommandID`](index.md#commandid); `icon`: `string`; \}\> - -*** - -### ComponentDefinition - -> **ComponentDefinition**: `object` - -A custom component that will be rendered in the UI. - -#### Type declaration - -##### component - -> **component**: `VueComponent` - -##### events? - -> `optional` **events**: `Record`\<`string`, (...`args`: `unknown`[]) => `void`\> - -##### props? - -> `optional` **props**: `Record`\<`string`, `unknown`\> - -*** - -### CustomSlotContent - -> **CustomSlotContent**: [`DefineSlotContent`](index.md#defineslotcontentttype-p)\<`"Custom"`, \{ `definition`: [`ComponentDefinition`](index.md#componentdefinition); \}\> - -*** - -### DefineAddToSlotFn()\ - -> **DefineAddToSlotFn**\<`TMap`\>: \<`K`\>(`slot`: `K`, `spec`: `TMap`\[`K`\]) => `void` - -#### Type Parameters - -| Type Parameter | -| ------ | -| `TMap` *extends* `Record`\<`string`, [`DefineSlotContent`](index.md#defineslotcontentttype-p)\<`string`, `Record`\<`string`, `unknown`\>\>\> | - -#### Type Parameters - -| Type Parameter | -| ------ | -| `K` *extends* `string` \| `number` \| `symbol` | - -#### Parameters - -| Parameter | Type | -| ------ | ------ | -| `slot` | `K` | -| `spec` | `TMap`\[`K`\] | - -#### Returns - -`void` - -*** - -### DefineSlotContent\ - -> **DefineSlotContent**\<`TType`, `P`\>: [`Prettify`](index.md#prettifyt)\<`object` & `P`\> - -#### Type Parameters - -| Type Parameter | -| ------ | -| `TType` *extends* `string` | -| `P` *extends* `Record`\<`string`, `unknown`\> | - -*** - -### Dialog - -> **Dialog**: `object` - -#### Type declaration - -##### close() - -> **close**: () => `void` - -###### Returns - -`void` - -*** - -### DialogOptions - -> **DialogOptions**: `object` - -#### Type declaration - -##### closable? - -> `optional` **closable**: `boolean` - -##### closeOnEscape? - -> `optional` **closeOnEscape**: `boolean` - -##### draggable? - -> `optional` **draggable**: `boolean` - -##### modal? - -> `optional` **modal**: `boolean` - -##### position? - -> `optional` **position**: `"left"` \| `"right"` \| `"top"` \| `"bottom"` \| `"center"` \| `"topleft"` \| `"topright"` \| `"bottomleft"` \| `"bottomright"` - -##### title? - -> `optional` **title**: `string` - -*** - -### Editor - -> **Editor**: `object` - -Generic editor interface. - -#### Type declaration - -##### focus() - -> **focus**: () => `void` - -Focus the editor. - -###### Returns - -`void` - -##### getEditorView() - -> **getEditorView**: () => `EditorView` - -Get the editor view. - -###### Returns - -`EditorView` - -The CodeMirror [EditorView](https://codemirror.net/docs/ref/#view.EditorView). - -##### getSelectedText() - -> **getSelectedText**: () => `string` - -Get the currently selected text of the editor. - -###### Returns - -`string` - -##### isReadOnly() - -> **isReadOnly**: () => `boolean` - -Check whether the editor is read-only. - -###### Returns - -`boolean` - -Whether the editor is read-only. - -##### replaceSelectedText() - -> **replaceSelectedText**: (`text`: `string`) => `void` - -Replace the currently selected text of the editor. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `text` | `string` | The text to replace the selection with. | - -###### Returns - -`void` - -*** - -### EnvironmentVariable - -> **EnvironmentVariable**: `object` - -#### Type declaration - -##### isSecret - -> **isSecret**: `boolean` - -Whether the environment variable is a secret. - -##### name - -> **name**: `string` - -The name of the environment variable. - -##### value - -> **value**: `string` - -The value of the environment variable. - -*** - -### FooterSlot - -> **FooterSlot**: *typeof* [`FooterSlot`](index.md#footerslot-1)\[keyof *typeof* [`FooterSlot`](index.md#footerslot-1)\] - -*** - -### FooterSlotContent - -> **FooterSlotContent**: `object` - -#### Type declaration - -##### footer-primary - -> **footer-primary**: [`ButtonSlotContent`](index.md#buttonslotcontent) \| [`CustomSlotContent`](index.md#customslotcontent) \| [`CommandSlotContent`](index.md#commandslotcontent) - -##### footer-secondary - -> **footer-secondary**: [`ButtonSlotContent`](index.md#buttonslotcontent) \| [`CustomSlotContent`](index.md#customslotcontent) \| [`CommandSlotContent`](index.md#commandslotcontent) - -*** - -### HTTPQL - -> **HTTPQL**: `string` & `object` - -An HTTPQL expression. - -#### Type declaration - -##### \_\_httpql? - -> `optional` **\_\_httpql**: `never` - -#### Example - -```ts -`req.method.eq:"POST"` -``` - -*** - -### HTTPRequestEditor - -> **HTTPRequestEditor**: `object` - -#### Type declaration - -##### getEditorView() - -> **getEditorView**: () => `EditorView` - -Get the editor view. - -###### Returns - -`EditorView` - -The CodeMirror [EditorView](https://codemirror.net/docs/ref/#view.EditorView). - -##### getElement() - -> **getElement**: () => `HTMLElement` - -Get the editor element. -Append this to your DOM to display the editor. - -###### Returns - -`HTMLElement` - -The editor element. - -*** - -### HTTPResponseEditor - -> **HTTPResponseEditor**: `object` - -#### Type declaration - -##### getEditorView() - -> **getEditorView**: () => `EditorView` - -Get the editor view. - -###### Returns - -`EditorView` - -The CodeMirror [EditorView](https://codemirror.net/docs/ref/#view.EditorView). - -##### getElement() - -> **getElement**: () => `HTMLElement` - -Get the editor element. -Append this to your DOM to display the editor. - -###### Returns - -`HTMLElement` - -The editor element. - -*** - -### Icon - -> **Icon**: `string` & `object` - -A [https://fontawesome.com/icons\|FontAwesome](https://fontawesome.com/icons|FontAwesome) icon class. - -#### Type declaration - -##### \_\_icon? - -> `optional` **\_\_icon**: `never` - -#### Example - -```ts -"fas fa-rocket" -``` - -*** - -### ID - -> **ID**: `string` & `object` - -A unique Caido identifier per type. - -#### Type declaration - -##### \_\_id? - -> `optional` **\_\_id**: `never` - -*** - -### JSONCompatible\ - -> **JSONCompatible**\<`T`\>: `unknown` *extends* `T` ? `never` : `{ [P in keyof T]: T[P] extends JSONValue ? T[P] : T[P] extends NotAssignableToJson ? never : JSONCompatible }` - -#### Type Parameters - -| Type Parameter | -| ------ | -| `T` | - -*** - -### JSONPrimitive - -> **JSONPrimitive**: `string` \| `number` \| `boolean` \| `null` \| `undefined` - -*** - -### JSONValue - -> **JSONValue**: [`JSONPrimitive`](index.md#jsonprimitive) \| [`JSONValue`](index.md#jsonvalue)[] \| \{\} - -*** - -### KeepOperation\ - -> **KeepOperation**\<`T`\>: `T` & `object` - -#### Type declaration - -##### \_\_operation? - -> `optional` **\_\_operation**: `never` - -#### Type Parameters - -| Type Parameter | -| ------ | -| `T` | - -*** - -### ListenerHandle - -> **ListenerHandle**: `object` - -A handle for a listener. - -#### Type declaration - -##### stop() - -> **stop**: () => `void` - -Stop the listener. - -###### Returns - -`void` - -*** - -### MatchReplaceMatcherName - -> **MatchReplaceMatcherName**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"MatcherName"` - -##### name - -> **name**: `string` - -*** - -### MatchReplaceOperationAll - -> **MatchReplaceOperationAll**: [`KeepOperation`](index.md#keepoperationt)\<[`MatchReplaceOperationAllRaw`](index.md#matchreplaceoperationallraw)\> - -*** - -### MatchReplaceOperationAllRaw - -> **MatchReplaceOperationAllRaw**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"OperationAllRaw"` - -##### matcher - -> **matcher**: [`MatchReplaceMatcherRaw`](index.md#matchreplacematcherraw) - -##### replacer - -> **replacer**: [`MatchReplaceReplacer`](index.md#matchreplacereplacer) - -*** - -### MatchReplaceOperationFirstLine - -> **MatchReplaceOperationFirstLine**: [`KeepOperation`](index.md#keepoperationt)\<[`MatchReplaceOperationFirstLineRaw`](index.md#matchreplaceoperationfirstlineraw)\> - -*** - -### MatchReplaceOperationHeaderAdd - -> **MatchReplaceOperationHeaderAdd**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"OperationHeaderAdd"` - -##### matcher - -> **matcher**: [`MatchReplaceMatcherName`](index.md#matchreplacematchername) - -##### replacer - -> **replacer**: [`MatchReplaceReplacer`](index.md#matchreplacereplacer) - -*** - -### MatchReplaceOperationHeaderRaw - -> **MatchReplaceOperationHeaderRaw**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"OperationHeaderRaw"` - -##### matcher - -> **matcher**: [`MatchReplaceMatcherRaw`](index.md#matchreplacematcherraw) - -##### replacer - -> **replacer**: [`MatchReplaceReplacer`](index.md#matchreplacereplacer) - -*** - -### MatchReplaceOperationHeaderRemove - -> **MatchReplaceOperationHeaderRemove**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"OperationHeaderRemove"` - -##### matcher - -> **matcher**: [`MatchReplaceMatcherName`](index.md#matchreplacematchername) - -*** - -### MatchReplaceOperationHeaderUpdate - -> **MatchReplaceOperationHeaderUpdate**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"OperationHeaderUpdate"` - -##### matcher - -> **matcher**: [`MatchReplaceMatcherName`](index.md#matchreplacematchername) - -##### replacer - -> **replacer**: [`MatchReplaceReplacer`](index.md#matchreplacereplacer) - -*** - -### MatchReplaceOperationMethod - -> **MatchReplaceOperationMethod**: [`KeepOperation`](index.md#keepoperationt)\<[`MatchReplaceOperationMethodUpdate`](index.md#matchreplaceoperationmethodupdate)\> - -*** - -### MatchReplaceOperationMethodUpdate - -> **MatchReplaceOperationMethodUpdate**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"OperationMethodUpdate"` - -##### replacer - -> **replacer**: [`MatchReplaceReplacer`](index.md#matchreplacereplacer) - -*** - -### MatchReplaceOperationPath - -> **MatchReplaceOperationPath**: [`KeepOperation`](index.md#keepoperationt)\<[`MatchReplaceOperationPathRaw`](index.md#matchreplaceoperationpathraw)\> - -*** - -### MatchReplaceOperationPathRaw - -> **MatchReplaceOperationPathRaw**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"OperationPathRaw"` - -##### matcher - -> **matcher**: [`MatchReplaceMatcherRaw`](index.md#matchreplacematcherraw) - -##### replacer - -> **replacer**: [`MatchReplaceReplacer`](index.md#matchreplacereplacer) - -*** - -### MatchReplaceOperationQuery - -> **MatchReplaceOperationQuery**: [`MatchReplaceOperationQueryRaw`](index.md#matchreplaceoperationqueryraw) \| [`MatchReplaceOperationQueryAdd`](index.md#matchreplaceoperationqueryadd) \| [`MatchReplaceOperationQueryRemove`](index.md#matchreplaceoperationqueryremove) \| [`MatchReplaceOperationQueryUpdate`](index.md#matchreplaceoperationqueryupdate) - -*** - -### MatchReplaceOperationQueryAdd - -> **MatchReplaceOperationQueryAdd**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"OperationQueryAdd"` - -##### matcher - -> **matcher**: [`MatchReplaceMatcherName`](index.md#matchreplacematchername) - -##### replacer - -> **replacer**: [`MatchReplaceReplacer`](index.md#matchreplacereplacer) - -*** - -### MatchReplaceOperationQueryRaw - -> **MatchReplaceOperationQueryRaw**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"OperationQueryRaw"` - -##### matcher - -> **matcher**: [`MatchReplaceMatcherRaw`](index.md#matchreplacematcherraw) - -##### replacer - -> **replacer**: [`MatchReplaceReplacer`](index.md#matchreplacereplacer) - -*** - -### MatchReplaceOperationQueryRemove - -> **MatchReplaceOperationQueryRemove**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"OperationQueryRemove"` - -##### matcher - -> **matcher**: [`MatchReplaceMatcherName`](index.md#matchreplacematchername) - -*** - -### MatchReplaceOperationQueryUpdate - -> **MatchReplaceOperationQueryUpdate**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"OperationQueryUpdate"` - -##### matcher - -> **matcher**: [`MatchReplaceMatcherName`](index.md#matchreplacematchername) - -##### replacer - -> **replacer**: [`MatchReplaceReplacer`](index.md#matchreplacereplacer) - -*** - -### MatchReplaceOperationStatusCode - -> **MatchReplaceOperationStatusCode**: [`KeepOperation`](index.md#keepoperationt)\<[`MatchReplaceOperationStatusCodeUpdate`](index.md#matchreplaceoperationstatuscodeupdate)\> - -*** - -### MatchReplaceOperationStatusCodeUpdate - -> **MatchReplaceOperationStatusCodeUpdate**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"OperationStatusCodeUpdate"` - -##### replacer - -> **replacer**: [`MatchReplaceReplacer`](index.md#matchreplacereplacer) - -*** - -### MatchReplaceSection - -> **MatchReplaceSection**: [`MatchReplaceSectionRequestAll`](index.md#matchreplacesectionrequestall) \| [`MatchReplaceSectionRequestBody`](index.md#matchreplacesectionrequestbody) \| [`MatchReplaceSectionRequestFirstLine`](index.md#matchreplacesectionrequestfirstline) \| [`MatchReplaceSectionRequestHeader`](index.md#matchreplacesectionrequestheader) \| [`MatchReplaceSectionRequestMethod`](index.md#matchreplacesectionrequestmethod) \| [`MatchReplaceSectionRequestPath`](index.md#matchreplacesectionrequestpath) \| [`MatchReplaceSectionRequestQuery`](index.md#matchreplacesectionrequestquery) \| [`MatchReplaceSectionResponseAll`](index.md#matchreplacesectionresponseall) \| [`MatchReplaceSectionResponseBody`](index.md#matchreplacesectionresponsebody) \| [`MatchReplaceSectionResponseFirstLine`](index.md#matchreplacesectionresponsefirstline) \| [`MatchReplaceSectionResponseHeader`](index.md#matchreplacesectionresponseheader) \| [`MatchReplaceSectionResponseStatusCode`](index.md#matchreplacesectionresponsestatuscode) - -*** - -### MatchReplaceSectionRequestAll - -> **MatchReplaceSectionRequestAll**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"SectionRequestAll"` - -##### operation - -> **operation**: [`MatchReplaceOperationAll`](index.md#matchreplaceoperationall) - -*** - -### MatchReplaceSectionRequestBody - -> **MatchReplaceSectionRequestBody**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"SectionRequestBody"` - -##### operation - -> **operation**: [`MatchReplaceOperationBody`](index.md#matchreplaceoperationbody) - -*** - -### MatchReplaceSectionRequestHeader - -> **MatchReplaceSectionRequestHeader**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"SectionRequestHeader"` - -##### operation - -> **operation**: [`MatchReplaceOperationHeader`](index.md#matchreplaceoperationheader) - -*** - -### MatchReplaceSectionRequestMethod - -> **MatchReplaceSectionRequestMethod**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"SectionRequestMethod"` - -##### operation - -> **operation**: [`MatchReplaceOperationMethod`](index.md#matchreplaceoperationmethod) - -*** - -### MatchReplaceSectionRequestPath - -> **MatchReplaceSectionRequestPath**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"SectionRequestPath"` - -##### operation - -> **operation**: [`MatchReplaceOperationPath`](index.md#matchreplaceoperationpath) - -*** - -### MatchReplaceSectionRequestQuery - -> **MatchReplaceSectionRequestQuery**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"SectionRequestQuery"` - -##### operation - -> **operation**: [`MatchReplaceOperationQuery`](index.md#matchreplaceoperationquery) - -*** - -### MatchReplaceSectionResponseAll - -> **MatchReplaceSectionResponseAll**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"SectionResponseAll"` - -##### operation - -> **operation**: [`MatchReplaceOperationAll`](index.md#matchreplaceoperationall) - -*** - -### MatchReplaceSectionResponseBody - -> **MatchReplaceSectionResponseBody**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"SectionResponseBody"` - -##### operation - -> **operation**: [`MatchReplaceOperationBody`](index.md#matchreplaceoperationbody) - -*** - -### MatchReplaceSectionResponseHeader - -> **MatchReplaceSectionResponseHeader**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"SectionResponseHeader"` - -##### operation - -> **operation**: [`MatchReplaceOperationHeader`](index.md#matchreplaceoperationheader) - -*** - -### MatchReplaceSectionResponseStatusCode - -> **MatchReplaceSectionResponseStatusCode**: `object` - -#### Type declaration - -##### kind - -> **kind**: `"SectionResponseStatusCode"` - -##### operation - -> **operation**: [`MatchReplaceOperationStatusCode`](index.md#matchreplaceoperationstatuscode) - -*** - -### NotAssignableToJson - -> **NotAssignableToJson**: `bigint` \| `symbol` \| `Function` - -*** - -### OnCreatedWorkflowCallback() - -> **OnCreatedWorkflowCallback**: (`event`: `object`) => `void` - -#### Parameters - -| Parameter | Type | -| ------ | ------ | -| `event` | \{ `workflow`: [`Workflow`](index.md#workflow); \} | -| `event.workflow` | [`Workflow`](index.md#workflow) | - -#### Returns - -`void` - -*** - -### OnDeletedWorkflowCallback() - -> **OnDeletedWorkflowCallback**: (`event`: `object`) => `void` - -#### Parameters - -| Parameter | Type | -| ------ | ------ | -| `event` | \{ `id`: [`ID`](index.md#id-3); \} | -| `event.id` | [`ID`](index.md#id-3) | - -#### Returns - -`void` - -*** - -### OnUpdatedWorkflowCallback() - -> **OnUpdatedWorkflowCallback**: (`event`: `object`) => `void` - -#### Parameters - -| Parameter | Type | -| ------ | ------ | -| `event` | \{ `workflow`: [`Workflow`](index.md#workflow); \} | -| `event.workflow` | [`Workflow`](index.md#workflow) | - -#### Returns - -`void` - -*** - -### PageChangeEvent - -> **PageChangeEvent**: \{ `path`: `string`; `routeId`: [`Routes`](index.md#routes); `type`: `"Core"`; \} \| \{ `path`: `string`; `type`: `"Plugin"`; \} - -*** - -### Prettify\ - -> **Prettify**\<`T`\>: `{ [K in keyof T]: T[K] }` & `object` - -#### Type Parameters - -| Type Parameter | -| ------ | -| `T` | - -*** - -### PromisifiedReturnType\ - -> **PromisifiedReturnType**\<`T`\>: `ReturnType`\<`T`\> *extends* `Promise`\ ? `Promise`\<`U`\> : `Promise`\<`ReturnType`\<`T`\>\> - -#### Type Parameters - -| Type Parameter | -| ------ | -| `T` *extends* (...`args`: `unknown`[]) => `unknown` | - -*** - -### ReplaySlot - -> **ReplaySlot**: *typeof* [`ReplaySlot`](index.md#replayslot-1)\[keyof *typeof* [`ReplaySlot`](index.md#replayslot-1)\] - -*** - -### ReplaySlotContent - -> **ReplaySlotContent**: `object` - -#### Type declaration - -##### session-toolbar-primary - -> **session-toolbar-primary**: [`ButtonSlotContent`](index.md#buttonslotcontent) \| [`CustomSlotContent`](index.md#customslotcontent) \| [`CommandSlotContent`](index.md#commandslotcontent) - -##### session-toolbar-secondary - -> **session-toolbar-secondary**: [`ButtonSlotContent`](index.md#buttonslotcontent) \| [`CustomSlotContent`](index.md#customslotcontent) \| [`CommandSlotContent`](index.md#commandslotcontent) - -##### topbar - -> **topbar**: [`ButtonSlotContent`](index.md#buttonslotcontent) \| [`CustomSlotContent`](index.md#customslotcontent) \| [`CommandSlotContent`](index.md#commandslotcontent) - -*** - -### RequestDraft - -> **RequestDraft**: [`Prettify`](index.md#prettifyt)\<[`As`](index.md#asttype)\<`"RequestDraft"`\> & `object`\> - -*** - -### RequestFull - -> **RequestFull**: [`Prettify`](index.md#prettifyt)\<[`As`](index.md#asttype)\<`"RequestFull"`\> & `object`\> - -*** - -### RequestMeta - -> **RequestMeta**: [`Prettify`](index.md#prettifyt)\<[`As`](index.md#asttype)\<`"RequestMeta"`\> & `object`\> - -*** - -### RequestViewModeOptions - -> **RequestViewModeOptions**: `object` - -#### Type declaration - -##### label - -> **label**: `string` - -The label of the view mode. - -##### view - -> **view**: [`ComponentDefinition`](index.md#componentdefinition) - -The component to render when the view mode is selected. - -*** - -### Routes - -> **Routes**: *typeof* [`Routes`](index.md#routes-1)\[keyof *typeof* [`Routes`](index.md#routes-1)\] - -*** - -### SlotContent - -> **SlotContent**: [`ButtonSlotContent`](index.md#buttonslotcontent) \| [`CustomSlotContent`](index.md#customslotcontent) \| [`CommandSlotContent`](index.md#commandslotcontent) - -*** - -### FooterSlot - -> `const` **FooterSlot**: `object` - -#### Type declaration - -##### FooterSlotPrimary - -> `readonly` **FooterSlotPrimary**: `"footer-primary"` - -##### FooterSlotSecondary - -> `readonly` **FooterSlotSecondary**: `"footer-secondary"` - -*** - -### Routes - -> `const` **Routes**: `object` - -#### Type declaration - -##### About - -> `readonly` **About**: `"About"` - -##### Assistant - -> `readonly` **Assistant**: `"Assistant"` - -##### Automate - -> `readonly` **Automate**: `"Automate"` - -##### Backups - -> `readonly` **Backups**: `"Backups"` - -##### Certificate - -> `readonly` **Certificate**: `"Certificate"` - -##### Environment - -> `readonly` **Environment**: `"Environment"` - -##### Exports - -> `readonly` **Exports**: `"Exports"` - -##### Files - -> `readonly` **Files**: `"Files"` - -##### Filter - -> `readonly` **Filter**: `"Filter"` - -##### Findings - -> `readonly` **Findings**: `"Findings"` - -##### HTTPHistory - -> `readonly` **HTTPHistory**: `"HTTPHistory"` - -##### Intercept - -> `readonly` **Intercept**: `"Intercept"` - -##### MatchReplace - -> `readonly` **MatchReplace**: `"Tamper"` - -##### Plugins - -> `readonly` **Plugins**: `"Plugins"` - -##### Projects - -> `readonly` **Projects**: `"Projects"` - -##### Replay - -> `readonly` **Replay**: `"Replay"` - -##### Scope - -> `readonly` **Scope**: `"Scope"` - -##### Search - -> `readonly` **Search**: `"Search"` - -##### Settings - -> `readonly` **Settings**: `"Settings"` - -##### Sitemap - -> `readonly` **Sitemap**: `"Sitemap"` - -##### Websockets - -> `readonly` **Websockets**: `"Websockets"` - -##### Workflows - -> `readonly` **Workflows**: `"Workflows"` - -*** - -### API - -Renames and re-exports [Caido](index.md#caidot-e) - -## Projects - -### ProjectsSDK - -> **ProjectsSDK**: `object` - -Utilities to interact with projects. - -#### Type declaration - -##### onCurrentProjectChange() - -> **onCurrentProjectChange**: (`callback`: (`event`: [`SelectedProjectChangeEvent`](index.md#selectedprojectchangeevent)) => `void`) => [`ListenerHandle`](index.md#listenerhandle) - -Subscribe to selected project changes. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `callback` | (`event`: [`SelectedProjectChangeEvent`](index.md#selectedprojectchangeevent)) => `void` | The callback to call when the selected project changes. | - -###### Returns - -[`ListenerHandle`](index.md#listenerhandle) - -An object with a `stop` method that can be called to stop listening to project changes. - -###### Example - -```ts -const handler = sdk.projects.onCurrentProjectChange((event) => { - console.log('Selected project changed to:', event.projectId); -}); - -// Later, stop listening -handler.stop(); -``` - -*** - -### SelectedProjectChangeEvent - -> **SelectedProjectChangeEvent**: `object` - -Event fired when the selected project changes. - -#### Type declaration - -##### projectId - -> **projectId**: [`ID`](index.md#id-3) \| `undefined` - -## Runtime - -### RuntimeSDK - -> **RuntimeSDK**: `object` - -Utilities to interact with the runtime. - -#### Type declaration - -##### version - -###### Get Signature - -> **get** **version**(): `string` - -Get the current version of Caido. - -###### Returns - -`string` - -## Sitemap - -### SitemapSDK - -> **SitemapSDK**: `object` - -Utilities to interact with the Sitemap page. - -#### Type declaration - -##### addRequestEditorExtension() - -> **addRequestEditorExtension**: (`extension`: `Extension`) => `void` - -Add an extension to the request editor. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `extension` | `Extension` | The extension to add. | - -###### Returns - -`void` - -##### addRequestViewMode() - -> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](index.md#requestviewmodeoptions)) => `void` - -Add a custom request view mode. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `options` | [`RequestViewModeOptions`](index.md#requestviewmodeoptions) | The view mode options. | - -###### Returns - -`void` - -##### getScopeId() - -> **getScopeId**: () => [`ID`](index.md#id-3) \| `undefined` - -Get the current scope ID. - -###### Returns - -[`ID`](index.md#id-3) \| `undefined` - -The current scope ID. - -##### setScope() - -> **setScope**: (`id`: [`ID`](index.md#id-3) \| `undefined`) => `void` - -Set the current scope. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `id` | [`ID`](index.md#id-3) \| `undefined` | The ID of the scope to set. | - -###### Returns - -`void` - -## Workflows - -### Workflow - -> **Workflow**: `object` - -A workflow - -#### Type declaration - -##### description - -> **description**: `string` - -##### id - -> **id**: `string` - -##### kind - -> **kind**: [`WorkflowKind`](index.md#workflowkind) - -##### name - -> **name**: `string` - -*** - -### WorkflowKind - -> **WorkflowKind**: `"Convert"` \| `"Active"` \| `"Passive"` - -The kind of workflow. - -*** - -### WorkflowSDK - -> **WorkflowSDK**: `object` - -Utilities to interact with workflows. - -#### Type declaration - -##### getWorkflows() - -> **getWorkflows**: () => [`Workflow`](index.md#workflow)[] - -Get all workflows. - -###### Returns - -[`Workflow`](index.md#workflow)[] - -All workflows. - -##### onCreatedWorkflow() - -> **onCreatedWorkflow**: (`callback`: [`OnCreatedWorkflowCallback`](index.md#oncreatedworkflowcallback)) => [`ListenerHandle`](index.md#listenerhandle) - -Register a callback to be called when a workflow is created. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `callback` | [`OnCreatedWorkflowCallback`](index.md#oncreatedworkflowcallback) | The callback to be called. | - -###### Returns - -[`ListenerHandle`](index.md#listenerhandle) - -##### onDeletedWorkflow() - -> **onDeletedWorkflow**: (`callback`: [`OnDeletedWorkflowCallback`](index.md#ondeletedworkflowcallback)) => [`ListenerHandle`](index.md#listenerhandle) - -Register a callback to be called when a workflow is deleted. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `callback` | [`OnDeletedWorkflowCallback`](index.md#ondeletedworkflowcallback) | The callback to be called. | - -###### Returns - -[`ListenerHandle`](index.md#listenerhandle) - -##### onUpdatedWorkflow() - -> **onUpdatedWorkflow**: (`callback`: [`OnUpdatedWorkflowCallback`](index.md#onupdatedworkflowcallback)) => [`ListenerHandle`](index.md#listenerhandle) - -Register a callback to be called when a workflow is updated. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `callback` | [`OnUpdatedWorkflowCallback`](index.md#onupdatedworkflowcallback) | The callback to be called. | - -###### Returns - -[`ListenerHandle`](index.md#listenerhandle) +## API Reference + +- [Backend](backend.md) +- [UI](ui.md) +- [Scopes](scopes.md) +- [Findings](findings.md) +- [Commands](commands.md) +- [Menu](menu.md) +- [Navigation](navigation.md) +- [Window](window.md) +- [Storage](storage.md) +- [Shortcuts](shortcuts.md) +- [Command Palette](command-palette.md) +- [Sidebar](sidebar.md) +- [Replay](replay.md) +- [HTTP History](http-history.md) +- [Search](search.md) +- [Files](files.md) +- [AI](ai.md) +- [Automate](automate.md) +- [Editor](editor.md) +- [Environment](environment.md) +- [Filter](filter.md) +- [Filters](filters.md) +- [Footer](footer.md) +- [Intercept](intercept.md) +- [JSON](json.md) +- [Log](log.md) +- [Match and Replace](match-and-replace.md) +- [Other](other.md) +- [Projects](projects.md) +- [Request](request.md) +- [Runtime](runtime.md) +- [Sitemap](sitemap.md) +- [Slots](slots.md) +- [Utils](utils.md) +- [Workflows](workflows.md) diff --git a/src/reference/sdks/frontend/intercept.md b/src/reference/sdks/frontend/intercept.md new file mode 100644 index 0000000..466bddb --- /dev/null +++ b/src/reference/sdks/frontend/intercept.md @@ -0,0 +1,53 @@ +# Intercept + +### InterceptSDK + +> **InterceptSDK** = `object` + +Utilities to interact with the Intercept page. + +#### Properties + +##### addRequestViewMode() + +> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)) => `void` + +Add a custom request view mode. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions) | The view mode options. | + +###### Returns + +`void` + +##### getScopeId() + +> **getScopeId**: () => [`ID`](utils.md#id) \| `undefined` + +Get the current scope ID. + +###### Returns + +[`ID`](utils.md#id) \| `undefined` + +The current scope ID. + +##### setScope() + +> **setScope**: (`id`: [`ID`](utils.md#id) \| `undefined`) => `void` + +Set the current scope. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `id` | [`ID`](utils.md#id) \| `undefined` | + +###### Returns + +`void` diff --git a/src/reference/sdks/frontend/json.md b/src/reference/sdks/frontend/json.md new file mode 100644 index 0000000..4e9007b --- /dev/null +++ b/src/reference/sdks/frontend/json.md @@ -0,0 +1,21 @@ +# JSON + +### JSONCompatible + +> **JSONCompatible**\<`T`\> = `unknown` *extends* `T` ? `never` : `{ [P in keyof T]: T[P] extends JSONValue ? T[P] : T[P] extends NotAssignableToJson ? never : JSONCompatible }` + +A type that ensures all properties of T are JSON-compatible. + +#### Type Parameters + +| Type Parameter | +| ------ | +| `T` | + +*** + +### JSONValue + +> **JSONValue** = [`JSONPrimitive`](other.md#jsonprimitive) \| [`JSONValue`](#jsonvalue)[] \| \{\[`key`: `string`\]: [`JSONValue`](#jsonvalue); \} + +A JSON-serializable value. diff --git a/src/reference/sdks/frontend/log.md b/src/reference/sdks/frontend/log.md new file mode 100644 index 0000000..d276df7 --- /dev/null +++ b/src/reference/sdks/frontend/log.md @@ -0,0 +1,73 @@ +# Log + +### LogSDK + +> **LogSDK** = `object` + +Utilities to log messages to the console. + +#### Properties + +##### debug() + +> **debug**: (...`data`: `unknown`[]) => `void` + +Log debug message with variable arguments + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| ...`data` | `unknown`[] | + +###### Returns + +`void` + +##### error() + +> **error**: (...`data`: `unknown`[]) => `void` + +Log error message with variable arguments + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| ...`data` | `unknown`[] | + +###### Returns + +`void` + +##### info() + +> **info**: (...`data`: `unknown`[]) => `void` + +Log info message with variable arguments + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| ...`data` | `unknown`[] | + +###### Returns + +`void` + +##### warn() + +> **warn**: (...`data`: `unknown`[]) => `void` + +Log warning message with variable arguments + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| ...`data` | `unknown`[] | + +###### Returns + +`void` diff --git a/src/reference/sdks/frontend/match-and-replace.md b/src/reference/sdks/frontend/match-and-replace.md new file mode 100644 index 0000000..818a0c3 --- /dev/null +++ b/src/reference/sdks/frontend/match-and-replace.md @@ -0,0 +1,1113 @@ +# Match and Replace + +### MatchReplaceCollection + +> **MatchReplaceCollection** = `object` + +A collection in Match and Replace. + +#### Properties + +##### id + +> **id**: [`ID`](utils.md#id) + +##### name + +> **name**: `string` + +##### ruleIds + +> **ruleIds**: [`ID`](utils.md#id)[] + +*** + +### MatchReplaceMatcherName + +> **MatchReplaceMatcherName** = `object` + +A matcher that matches by name (for headers, query parameters, etc.). + +#### Properties + +##### kind + +> **kind**: `"MatcherName"` + +##### name + +> **name**: `string` + +*** + +### MatchReplaceMatcherRaw + +> **MatchReplaceMatcherRaw** = [`MatchReplaceMatcherRawRegex`](#matchreplacematcherrawregex) \| [`MatchReplaceMatcherRawValue`](#matchreplacematcherrawvalue) \| [`MatchReplaceMatcherRawFull`](#matchreplacematcherrawfull) + +A matcher for raw operations in Match and Replace. + +*** + +### MatchReplaceMatcherRawFull + +> **MatchReplaceMatcherRawFull** = `object` + +This matcher will match the entire section. + +#### Properties + +##### kind + +> **kind**: `"MatcherRawFull"` + +*** + +### MatchReplaceMatcherRawRegex + +> **MatchReplaceMatcherRawRegex** = `object` + +This matcher will match using a regex over the section. + +#### Properties + +##### kind + +> **kind**: `"MatcherRawRegex"` + +##### regex + +> **regex**: `string` + +*** + +### MatchReplaceMatcherRawValue + +> **MatchReplaceMatcherRawValue** = `object` + +This matcher will match the value if present in the section. + +#### Properties + +##### kind + +> **kind**: `"MatcherRawValue"` + +##### value + +> **value**: `string` + +*** + +### MatchReplaceOperationAll + +> **MatchReplaceOperationAll** = [`KeepOperation`](other.md#keepoperation)\<[`MatchReplaceOperationAllRaw`](#matchreplaceoperationallraw)\> + +An operation for the entire request/response section. + +*** + +### MatchReplaceOperationAllRaw + +> **MatchReplaceOperationAllRaw** = `object` + +A raw operation for the entire request/response section. + +#### Properties + +##### kind + +> **kind**: `"OperationAllRaw"` + +##### matcher + +> **matcher**: [`MatchReplaceMatcherRaw`](#matchreplacematcherraw) + +##### replacer + +> **replacer**: [`MatchReplaceReplacer`](#matchreplacereplacer) + +*** + +### MatchReplaceOperationBody + +> **MatchReplaceOperationBody** = [`KeepOperation`](other.md#keepoperation)\<[`MatchReplaceOperationBodyRaw`](#matchreplaceoperationbodyraw)\> + +An operation for the body section. + +*** + +### MatchReplaceOperationBodyRaw + +> **MatchReplaceOperationBodyRaw** = `object` + +A raw operation for the body section. + +#### Properties + +##### kind + +> **kind**: `"OperationBodyRaw"` + +##### matcher + +> **matcher**: [`MatchReplaceMatcherRaw`](#matchreplacematcherraw) + +##### replacer + +> **replacer**: [`MatchReplaceReplacer`](#matchreplacereplacer) + +*** + +### MatchReplaceOperationFirstLine + +> **MatchReplaceOperationFirstLine** = [`KeepOperation`](other.md#keepoperation)\<[`MatchReplaceOperationFirstLineRaw`](#matchreplaceoperationfirstlineraw)\> + +An operation for the first line section. + +*** + +### MatchReplaceOperationFirstLineRaw + +> **MatchReplaceOperationFirstLineRaw** = `object` + +A raw operation for the request first line. + +#### Properties + +##### kind + +> **kind**: `"OperationFirstLineRaw"` + +##### matcher + +> **matcher**: [`MatchReplaceMatcherRaw`](#matchreplacematcherraw) + +##### replacer + +> **replacer**: [`MatchReplaceReplacer`](#matchreplacereplacer) + +*** + +### MatchReplaceOperationHeader + +> **MatchReplaceOperationHeader** = [`MatchReplaceOperationHeaderRaw`](#matchreplaceoperationheaderraw) \| [`MatchReplaceOperationHeaderAdd`](#matchreplaceoperationheaderadd) \| [`MatchReplaceOperationHeaderRemove`](#matchreplaceoperationheaderremove) \| [`MatchReplaceOperationHeaderUpdate`](#matchreplaceoperationheaderupdate) + +An operation for the header section. + +*** + +### MatchReplaceOperationHeaderAdd + +> **MatchReplaceOperationHeaderAdd** = `object` + +An operation to add a header. + +#### Properties + +##### kind + +> **kind**: `"OperationHeaderAdd"` + +##### matcher + +> **matcher**: [`MatchReplaceMatcherName`](#matchreplacematchername) + +##### replacer + +> **replacer**: [`MatchReplaceReplacer`](#matchreplacereplacer) + +*** + +### MatchReplaceOperationHeaderRaw + +> **MatchReplaceOperationHeaderRaw** = `object` + +A raw operation for the header section. + +#### Properties + +##### kind + +> **kind**: `"OperationHeaderRaw"` + +##### matcher + +> **matcher**: [`MatchReplaceMatcherRaw`](#matchreplacematcherraw) + +##### replacer + +> **replacer**: [`MatchReplaceReplacer`](#matchreplacereplacer) + +*** + +### MatchReplaceOperationHeaderRemove + +> **MatchReplaceOperationHeaderRemove** = `object` + +An operation to remove a header. + +#### Properties + +##### kind + +> **kind**: `"OperationHeaderRemove"` + +##### matcher + +> **matcher**: [`MatchReplaceMatcherName`](#matchreplacematchername) + +*** + +### MatchReplaceOperationHeaderUpdate + +> **MatchReplaceOperationHeaderUpdate** = `object` + +An operation to update a header. + +#### Properties + +##### kind + +> **kind**: `"OperationHeaderUpdate"` + +##### matcher + +> **matcher**: [`MatchReplaceMatcherName`](#matchreplacematchername) + +##### replacer + +> **replacer**: [`MatchReplaceReplacer`](#matchreplacereplacer) + +*** + +### MatchReplaceOperationMethod + +> **MatchReplaceOperationMethod** = [`KeepOperation`](other.md#keepoperation)\<[`MatchReplaceOperationMethodUpdate`](#matchreplaceoperationmethodupdate)\> + +An operation for the request method section. + +*** + +### MatchReplaceOperationMethodUpdate + +> **MatchReplaceOperationMethodUpdate** = `object` + +An operation to update the request method. + +#### Properties + +##### kind + +> **kind**: `"OperationMethodUpdate"` + +##### replacer + +> **replacer**: [`MatchReplaceReplacer`](#matchreplacereplacer) + +*** + +### MatchReplaceOperationPath + +> **MatchReplaceOperationPath** = [`KeepOperation`](other.md#keepoperation)\<[`MatchReplaceOperationPathRaw`](#matchreplaceoperationpathraw)\> + +An operation for the request path section. + +*** + +### MatchReplaceOperationPathRaw + +> **MatchReplaceOperationPathRaw** = `object` + +A raw operation for the request path section. + +#### Properties + +##### kind + +> **kind**: `"OperationPathRaw"` + +##### matcher + +> **matcher**: [`MatchReplaceMatcherRaw`](#matchreplacematcherraw) + +##### replacer + +> **replacer**: [`MatchReplaceReplacer`](#matchreplacereplacer) + +*** + +### MatchReplaceOperationQuery + +> **MatchReplaceOperationQuery** = [`MatchReplaceOperationQueryRaw`](#matchreplaceoperationqueryraw) \| [`MatchReplaceOperationQueryAdd`](#matchreplaceoperationqueryadd) \| [`MatchReplaceOperationQueryRemove`](#matchreplaceoperationqueryremove) \| [`MatchReplaceOperationQueryUpdate`](#matchreplaceoperationqueryupdate) + +An operation for the request query section. + +*** + +### MatchReplaceOperationQueryAdd + +> **MatchReplaceOperationQueryAdd** = `object` + +An operation to add a query parameter. + +#### Properties + +##### kind + +> **kind**: `"OperationQueryAdd"` + +##### matcher + +> **matcher**: [`MatchReplaceMatcherName`](#matchreplacematchername) + +##### replacer + +> **replacer**: [`MatchReplaceReplacer`](#matchreplacereplacer) + +*** + +### MatchReplaceOperationQueryRaw + +> **MatchReplaceOperationQueryRaw** = `object` + +A raw operation for the request query section. + +#### Properties + +##### kind + +> **kind**: `"OperationQueryRaw"` + +##### matcher + +> **matcher**: [`MatchReplaceMatcherRaw`](#matchreplacematcherraw) + +##### replacer + +> **replacer**: [`MatchReplaceReplacer`](#matchreplacereplacer) + +*** + +### MatchReplaceOperationQueryRemove + +> **MatchReplaceOperationQueryRemove** = `object` + +An operation to remove a query parameter. + +#### Properties + +##### kind + +> **kind**: `"OperationQueryRemove"` + +##### matcher + +> **matcher**: [`MatchReplaceMatcherName`](#matchreplacematchername) + +*** + +### MatchReplaceOperationQueryUpdate + +> **MatchReplaceOperationQueryUpdate** = `object` + +An operation to update a query parameter. + +#### Properties + +##### kind + +> **kind**: `"OperationQueryUpdate"` + +##### matcher + +> **matcher**: [`MatchReplaceMatcherName`](#matchreplacematchername) + +##### replacer + +> **replacer**: [`MatchReplaceReplacer`](#matchreplacereplacer) + +*** + +### MatchReplaceOperationSNI + +> **MatchReplaceOperationSNI** = [`KeepOperation`](other.md#keepoperation)\<[`MatchReplaceOperationSNIRaw`](#matchreplaceoperationsniraw)\> + +An operation for the request SNI section. + +*** + +### MatchReplaceOperationSNIRaw + +> **MatchReplaceOperationSNIRaw** = `object` + +A raw operation for the request SNI. + +#### Properties + +##### kind + +> **kind**: `"OperationSNIRaw"` + +##### replacer + +> **replacer**: [`MatchReplaceReplacer`](#matchreplacereplacer) + +*** + +### MatchReplaceOperationStatusCode + +> **MatchReplaceOperationStatusCode** = [`KeepOperation`](other.md#keepoperation)\<[`MatchReplaceOperationStatusCodeUpdate`](#matchreplaceoperationstatuscodeupdate)\> + +An operation for the response status code section. + +*** + +### MatchReplaceOperationStatusCodeUpdate + +> **MatchReplaceOperationStatusCodeUpdate** = `object` + +An operation to update the response status code. + +#### Properties + +##### kind + +> **kind**: `"OperationStatusCodeUpdate"` + +##### replacer + +> **replacer**: [`MatchReplaceReplacer`](#matchreplacereplacer) + +*** + +### MatchReplaceReplacer + +> **MatchReplaceReplacer** = [`MatchReplaceReplacerTerm`](#matchreplacereplacerterm) \| [`MatchReplaceReplacerWorkflow`](#matchreplacereplacerworkflow) + +A replacer in Match and Replace. + +*** + +### MatchReplaceReplacerTerm + +> **MatchReplaceReplacerTerm** = `object` + +A replacer that replaces with a term. +If the matcher is a regex, groups will be interpolated. + +#### Properties + +##### kind + +> **kind**: `"ReplacerTerm"` + +##### term + +> **term**: `string` + +*** + +### MatchReplaceReplacerWorkflow + +> **MatchReplaceReplacerWorkflow** = `object` + +A replacer that replaces with the result of a workflow. +The input of the workflow depends on the operation and matcher. + +#### Properties + +##### kind + +> **kind**: `"ReplacerWorkflow"` + +##### workflowId + +> **workflowId**: [`ID`](utils.md#id) + +*** + +### MatchReplaceRule + +> **MatchReplaceRule** = `object` + +A rule in Match and Replace. + +#### Properties + +##### collectionId + +> **collectionId**: [`ID`](utils.md#id) + +The ID of the collection the rule belongs to. + +##### id + +> **id**: [`ID`](utils.md#id) + +The ID of the rule. + +##### isEnabled + +> **isEnabled**: `boolean` + +Whether the rule is enabled. + +##### name + +> **name**: `string` + +The name of the rule. + +##### query + +> **query**: [`HTTPQL`](utils.md#httpql) + +The HTTPQL query to match the rule against. +Only requests that match the query will be affected by the rule. + +##### section + +> **section**: [`MatchReplaceSection`](#matchreplacesection) + +The section of the rule. + +*** + +### MatchReplaceSDK + +> **MatchReplaceSDK** = `object` + +Utilities to interact with the Match and Replace page. + +#### Properties + +##### addToSlot + +> **addToSlot**: [`DefineAddToSlotFn`](slots.md#defineaddtoslotfn)\<[`MatchReplaceSlotContent`](#matchreplaceslotcontent)\> + +Add a component to a slot. + +###### Param + +The slot to add the component to. + +###### Param + +The content to add to the slot. + +###### Example + +```ts +sdk.matchReplace.addToSlot(MatchReplaceSlot.UpdateHeader, { + type: "Button", + label: "My Button", + icon: "my-icon", + onClick: () => { + console.log("Button clicked"); + }, +}); + +sdk.matchReplace.addToSlot(MatchReplaceSlot.CreateHeader, { + type: "Custom", + definition: MyComponent, +}); + +sdk.matchReplace.addToSlot(MatchReplaceSlot.UpdateHeader, { + type: "Command", + commandId: "my-command", + icon: "my-icon", +}); +``` + +##### createCollection() + +> **createCollection**: (`options`: `object`) => `Promise`\<[`MatchReplaceCollection`](#matchreplacecollection)\> + +Create a collection. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | \{ `name`: `string`; \} | The options for the collection. | +| `options.name` | `string` | The name of the collection. | + +###### Returns + +`Promise`\<[`MatchReplaceCollection`](#matchreplacecollection)\> + +##### createRule() + +> **createRule**: (`options`: `object`) => `Promise`\<[`MatchReplaceRule`](#matchreplacerule)\> + +Create a rule. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | \{ `collectionId`: [`ID`](utils.md#id); `name`: `string`; `query`: [`HTTPQL`](utils.md#httpql); `section`: [`MatchReplaceSection`](#matchreplacesection); `sources`: [`Source`](#source)[]; \} | The options for the rule. | +| `options.collectionId` | [`ID`](utils.md#id) | The ID of the collection the rule belongs to. | +| `options.name` | `string` | The name of the rule. | +| `options.query` | [`HTTPQL`](utils.md#httpql) | The HTTPQL query to match the rule against. | +| `options.section` | [`MatchReplaceSection`](#matchreplacesection) | - | +| `options.sources` | [`Source`](#source)[] | The sources the rule belongs to. | + +###### Returns + +`Promise`\<[`MatchReplaceRule`](#matchreplacerule)\> + +##### deleteCollection() + +> **deleteCollection**: (`id`: [`ID`](utils.md#id)) => `Promise`\<`void`\> + +Delete a collection. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) | The ID of the collection. | + +###### Returns + +`Promise`\<`void`\> + +##### deleteRule() + +> **deleteRule**: (`id`: [`ID`](utils.md#id)) => `Promise`\<`void`\> + +Delete a rule. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) | The ID of the rule. | + +###### Returns + +`Promise`\<`void`\> + +##### getActiveRules() + +> **getActiveRules**: () => [`MatchReplaceRule`](#matchreplacerule)[] + +Get all active rules. +Rules are ordered in priority from highest to lowest. + +###### Returns + +[`MatchReplaceRule`](#matchreplacerule)[] + +All active rules. + +##### getCollections() + +> **getCollections**: () => [`MatchReplaceCollection`](#matchreplacecollection)[] + +Get all collections. + +###### Returns + +[`MatchReplaceCollection`](#matchreplacecollection)[] + +##### getRules() + +> **getRules**: () => [`MatchReplaceRule`](#matchreplacerule)[] + +Get all rules. + +###### Returns + +[`MatchReplaceRule`](#matchreplacerule)[] + +All rules. + +##### selectRule() + +> **selectRule**: (`id`: [`ID`](utils.md#id) \| `undefined`) => `void` + +Select a rule to be displayed in the UI. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) \| `undefined` | The ID of the rule, or undefined to clear the selection. | + +###### Returns + +`void` + +##### toggleRule() + +> **toggleRule**: (`id`: [`ID`](utils.md#id), `enabled`: `boolean`) => `Promise`\<`void`\> + +Toggle a rule. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) | The ID of the rule. | +| `enabled` | `boolean` | Whether the rule should be enabled. | + +###### Returns + +`Promise`\<`void`\> + +##### updateCollection() + +> **updateCollection**: (`id`: [`ID`](utils.md#id), `options`: `object`) => `Promise`\<[`MatchReplaceCollection`](#matchreplacecollection)\> + +Update a collection. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) | The ID of the collection. | +| `options` | \{ `name`: `string`; \} | The new values for the collection. | +| `options.name` | `string` | The new name of the collection. | + +###### Returns + +`Promise`\<[`MatchReplaceCollection`](#matchreplacecollection)\> + +##### updateRule() + +> **updateRule**: (`id`: [`ID`](utils.md#id), `options`: `object`) => `Promise`\<[`MatchReplaceRule`](#matchreplacerule)\> + +Update a rule. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) | The ID of the rule. | +| `options` | \{ `name`: `string`; `query?`: [`HTTPQL`](utils.md#httpql); `section`: [`MatchReplaceSection`](#matchreplacesection); `sources`: [`Source`](#source)[]; \} | The new values for the rule. | +| `options.name` | `string` | The new name of the rule. | +| `options.query?` | [`HTTPQL`](utils.md#httpql) | The new HTTPQL query of the rule. | +| `options.section` | [`MatchReplaceSection`](#matchreplacesection) | The new section of the rule. | +| `options.sources` | [`Source`](#source)[] | The new sources of the rule. | + +###### Returns + +`Promise`\<[`MatchReplaceRule`](#matchreplacerule)\> + +*** + +### MatchReplaceSection + +> **MatchReplaceSection** = [`MatchReplaceSectionRequestAll`](#matchreplacesectionrequestall) \| [`MatchReplaceSectionRequestBody`](#matchreplacesectionrequestbody) \| [`MatchReplaceSectionRequestFirstLine`](#matchreplacesectionrequestfirstline) \| [`MatchReplaceSectionRequestHeader`](#matchreplacesectionrequestheader) \| [`MatchReplaceSectionRequestMethod`](#matchreplacesectionrequestmethod) \| [`MatchReplaceSectionRequestPath`](#matchreplacesectionrequestpath) \| [`MatchReplaceSectionRequestQuery`](#matchreplacesectionrequestquery) \| [`MatchReplaceSectionRequestSNI`](#matchreplacesectionrequestsni) \| [`MatchReplaceSectionResponseAll`](#matchreplacesectionresponseall) \| [`MatchReplaceSectionResponseBody`](#matchreplacesectionresponsebody) \| [`MatchReplaceSectionResponseFirstLine`](#matchreplacesectionresponsefirstline) \| [`MatchReplaceSectionResponseHeader`](#matchreplacesectionresponseheader) \| [`MatchReplaceSectionResponseStatusCode`](#matchreplacesectionresponsestatuscode) + +A discriminated union of all possible match and replace sections. + +*** + +### MatchReplaceSectionRequestAll + +> **MatchReplaceSectionRequestAll** = `object` + +A section for the entire request. + +#### Properties + +##### kind + +> **kind**: `"SectionRequestAll"` + +##### operation + +> **operation**: [`MatchReplaceOperationAll`](#matchreplaceoperationall) + +*** + +### MatchReplaceSectionRequestBody + +> **MatchReplaceSectionRequestBody** = `object` + +A section for the request body. + +#### Properties + +##### kind + +> **kind**: `"SectionRequestBody"` + +##### operation + +> **operation**: [`MatchReplaceOperationBody`](#matchreplaceoperationbody) + +*** + +### MatchReplaceSectionRequestFirstLine + +> **MatchReplaceSectionRequestFirstLine** = `object` + +A section for the request first line. + +#### Properties + +##### kind + +> **kind**: `"SectionRequestFirstLine"` + +##### operation + +> **operation**: [`MatchReplaceOperationFirstLine`](#matchreplaceoperationfirstline) + +*** + +### MatchReplaceSectionRequestHeader + +> **MatchReplaceSectionRequestHeader** = `object` + +A section for the request headers. + +#### Properties + +##### kind + +> **kind**: `"SectionRequestHeader"` + +##### operation + +> **operation**: [`MatchReplaceOperationHeader`](#matchreplaceoperationheader) + +*** + +### MatchReplaceSectionRequestMethod + +> **MatchReplaceSectionRequestMethod** = `object` + +A section for the request method. + +#### Properties + +##### kind + +> **kind**: `"SectionRequestMethod"` + +##### operation + +> **operation**: [`MatchReplaceOperationMethod`](#matchreplaceoperationmethod) + +*** + +### MatchReplaceSectionRequestPath + +> **MatchReplaceSectionRequestPath** = `object` + +A section for the request path. + +#### Properties + +##### kind + +> **kind**: `"SectionRequestPath"` + +##### operation + +> **operation**: [`MatchReplaceOperationPath`](#matchreplaceoperationpath) + +*** + +### MatchReplaceSectionRequestQuery + +> **MatchReplaceSectionRequestQuery** = `object` + +A section for the request query string. + +#### Properties + +##### kind + +> **kind**: `"SectionRequestQuery"` + +##### operation + +> **operation**: [`MatchReplaceOperationQuery`](#matchreplaceoperationquery) + +*** + +### MatchReplaceSectionRequestSNI + +> **MatchReplaceSectionRequestSNI** = `object` + +A section for the request SNI. + +#### Properties + +##### kind + +> **kind**: `"SectionRequestSNI"` + +##### operation + +> **operation**: [`MatchReplaceOperationSNI`](#matchreplaceoperationsni) + +*** + +### MatchReplaceSectionResponseAll + +> **MatchReplaceSectionResponseAll** = `object` + +A section for the entire response. + +#### Properties + +##### kind + +> **kind**: `"SectionResponseAll"` + +##### operation + +> **operation**: [`MatchReplaceOperationAll`](#matchreplaceoperationall) + +*** + +### MatchReplaceSectionResponseBody + +> **MatchReplaceSectionResponseBody** = `object` + +A section for the response body. + +#### Properties + +##### kind + +> **kind**: `"SectionResponseBody"` + +##### operation + +> **operation**: [`MatchReplaceOperationBody`](#matchreplaceoperationbody) + +*** + +### MatchReplaceSectionResponseFirstLine + +> **MatchReplaceSectionResponseFirstLine** = `object` + +A section for the response first line. + +#### Properties + +##### kind + +> **kind**: `"SectionResponseFirstLine"` + +##### operation + +> **operation**: [`MatchReplaceOperationFirstLine`](#matchreplaceoperationfirstline) + +*** + +### MatchReplaceSectionResponseHeader + +> **MatchReplaceSectionResponseHeader** = `object` + +A section for the response headers. + +#### Properties + +##### kind + +> **kind**: `"SectionResponseHeader"` + +##### operation + +> **operation**: [`MatchReplaceOperationHeader`](#matchreplaceoperationheader) + +*** + +### MatchReplaceSectionResponseStatusCode + +> **MatchReplaceSectionResponseStatusCode** = `object` + +A section for the response status code. + +#### Properties + +##### kind + +> **kind**: `"SectionResponseStatusCode"` + +##### operation + +> **operation**: [`MatchReplaceOperationStatusCode`](#matchreplaceoperationstatuscode) + +*** + +### MatchReplaceSlotContent + +> **MatchReplaceSlotContent** = `object` + +Content that can be added to match and replace slots. + +#### Properties + +##### create-header + +> **create-header**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) + +##### update-header + +> **update-header**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) + +*** + +### MatchReplaceSlot + +> `const` **MatchReplaceSlot**: `object` + +The slots in the Match and Replace UI. + +#### Type Declaration + +##### CreateHeader + +> `readonly` **CreateHeader**: `"create-header"` + +The header area of the rule form create component. + +##### UpdateHeader + +> `readonly` **UpdateHeader**: `"update-header"` + +The header area of the rule form update component. + +*** + +### Source + +> `const` **Source**: `object` + +The source of a match and replace rule. + +#### Type Declaration + +##### Automate + +> `readonly` **Automate**: `"AUTOMATE"` + +##### Intercept + +> `readonly` **Intercept**: `"INTERCEPT"` + +##### Plugin + +> `readonly` **Plugin**: `"PLUGIN"` + +##### Replay + +> `readonly` **Replay**: `"REPLAY"` + +##### Sample + +> `readonly` **Sample**: `"SAMPLE"` + +##### Workflow + +> `readonly` **Workflow**: `"WORKFLOW"` diff --git a/src/reference/sdks/frontend/menu.md b/src/reference/sdks/frontend/menu.md new file mode 100644 index 0000000..04fc6c4 --- /dev/null +++ b/src/reference/sdks/frontend/menu.md @@ -0,0 +1,154 @@ +# Menu + +### MenuItem + +> **MenuItem** = [`RequestRowMenuItem`](#requestrowmenuitem) \| [`SettingsMenuItem`](#settingsmenuitem) \| [`RequestMenuItem`](#requestmenuitem) \| [`ResponseMenuItem`](#responsemenuitem) + +A content-menu item. + +*** + +### MenuSDK + +> **MenuSDK** = `object` + +Utilities to insert menu items and context-menus throughout the UI. + +#### Properties + +##### registerItem() + +> **registerItem**: (`item`: [`MenuItem`](#menuitem)) => `void` + +Register a menu item. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `item` | [`MenuItem`](#menuitem) | The menu item to register. | + +###### Returns + +`void` + +###### Example + +```ts +sdk.menu.registerItem({ + type: "Request", + commandId: "hello", + leadingIcon: "fas fa-hand", +}); +``` + +*** + +### RequestMenuItem + +> **RequestMenuItem** = `object` + +A context-menu item that appears when right-clicking a request pane. + +#### Properties + +##### commandId + +> **commandId**: [`CommandID`](other.md#commandid) + +The command ID to execute when the menu item is clicked. + +##### leadingIcon? + +> `optional` **leadingIcon**: `string` + +The icon to display to the left of the menu item. + +##### type + +> **type**: `"Request"` + +*** + +### RequestRowMenuItem + +> **RequestRowMenuItem** = `object` + +A context-menu item that appears when right-clicking a request row. + +#### Properties + +##### commandId + +> **commandId**: [`CommandID`](other.md#commandid) + +The command ID to execute when the menu item is clicked. + +##### leadingIcon? + +> `optional` **leadingIcon**: `string` + +The icon to display to the left of the menu item. + +##### type + +> **type**: `"RequestRow"` + +*** + +### ResponseMenuItem + +> **ResponseMenuItem** = `object` + +A context-menu item that appears when right-clicking a response pane. + +#### Properties + +##### commandId + +> **commandId**: [`CommandID`](other.md#commandid) + +The command ID to execute when the menu item is + +##### leadingIcon? + +> `optional` **leadingIcon**: `string` + +The icon to display to the left of the menu item. + +##### type + +> **type**: `"Response"` + +*** + +### SettingsMenuItem + +> **SettingsMenuItem** = `object` + +A menu item that appears in the settings menu. + +#### Properties + +##### label + +> **label**: `string` + +The label of the menu item. + +##### leadingIcon? + +> `optional` **leadingIcon**: [`Icon`](utils.md#icon) + +The [Icon](utils.md#icon) to display to the left of the menu item. + +##### path + +> **path**: `string` + +The path that the user will be navigated to when the menu item is clicked +The path must start with "/settings/". + +##### type + +> **type**: `"Settings"` diff --git a/src/reference/sdks/frontend/navigation.md b/src/reference/sdks/frontend/navigation.md new file mode 100644 index 0000000..b7a0e5f --- /dev/null +++ b/src/reference/sdks/frontend/navigation.md @@ -0,0 +1,189 @@ +# Navigation + +### NavigationSDK + +> **NavigationSDK** = `object` + +Utilities to interact with navigation. + +#### Properties + +##### addPage() + +> **addPage**: (`path`: `string`, `options`: `object`) => `void` + +Add a page to the navigation. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `path` | `string` | The path of the page. | +| `options` | \{ `body`: `HTMLElement`; `onEnter?`: () => `void`; `topbar?`: `HTMLElement`; \} | Options for the page. | +| `options.body` | `HTMLElement` | The body of the page. | +| `options.onEnter?` | () => `void` | The callback to execute when the page is entered. | +| `options.topbar?` | `HTMLElement` | The topbar of the page. | + +###### Returns + +`void` + +##### goTo() + +> **goTo**: (`route`: `string` \| \{ `id`: [`Routes`](#routes); \}) => `void` + +Navigate to a route or path. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `route` | `string` \| \{ `id`: [`Routes`](#routes); \} | The route to navigate to. Can be a route ID object or a custom path string. | + +###### Returns + +`void` + +###### Example + +```ts +sdk.navigation.goTo({ id: Routes.Replay }); +sdk.navigation.goTo({ id: Routes.Projects }); +sdk.navigation.goTo("/my-plugin-page"); +``` + +##### onPageChange() + +> **onPageChange**: (`callback`: (`route`: [`PageChangeEvent`](#pagechangeevent)) => `void`) => [`ListenerHandle`](utils.md#listenerhandle) + +Subscribe to page changes. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `callback` | (`route`: [`PageChangeEvent`](#pagechangeevent)) => `void` | The callback to call when the page changes. | + +###### Returns + +[`ListenerHandle`](utils.md#listenerhandle) + +An object with a `stop` method that can be called to stop listening to page changes. + +###### Example + +```ts +const handler = sdk.navigation.onPageChange((event) => { + console.log('Page changed to:', event.routeId); + console.log('- path:', event.path); +}); + +// Later, stop listening +handler.stop(); +``` + +*** + +### PageChangeEvent + +> **PageChangeEvent** = \{ `path`: `string`; `routeId`: [`Routes`](#routes); `type`: `"Core"`; \} \| \{ `path`: `string`; `type`: `"Plugin"`; \} + +Event fired when the page changes. + +*** + +### Routes + +> `const` **Routes**: `object` + +Available route identifiers in Caido. + +#### Type Declaration + +##### About + +> `readonly` **About**: `"About"` + +##### Assistant + +> `readonly` **Assistant**: `"Assistant"` + +##### Automate + +> `readonly` **Automate**: `"Automate"` + +##### Backups + +> `readonly` **Backups**: `"Backups"` + +##### Certificate + +> `readonly` **Certificate**: `"Certificate"` + +##### Environment + +> `readonly` **Environment**: `"Environment"` + +##### Exports + +> `readonly` **Exports**: `"Exports"` + +##### Files + +> `readonly` **Files**: `"Files"` + +##### Filter + +> `readonly` **Filter**: `"Filter"` + +##### Findings + +> `readonly` **Findings**: `"Findings"` + +##### HTTPHistory + +> `readonly` **HTTPHistory**: `"HTTPHistory"` + +##### Intercept + +> `readonly` **Intercept**: `"Intercept"` + +##### MatchReplace + +> `readonly` **MatchReplace**: `"Tamper"` + +##### Plugins + +> `readonly` **Plugins**: `"Plugins"` + +##### Projects + +> `readonly` **Projects**: `"Projects"` + +##### Replay + +> `readonly` **Replay**: `"Replay"` + +##### Scope + +> `readonly` **Scope**: `"Scope"` + +##### Search + +> `readonly` **Search**: `"Search"` + +##### Settings + +> `readonly` **Settings**: `"Settings"` + +##### Sitemap + +> `readonly` **Sitemap**: `"Sitemap"` + +##### Websockets + +> `readonly` **Websockets**: `"Websockets"` + +##### Workflows + +> `readonly` **Workflows**: `"Workflows"` diff --git a/src/reference/sdks/frontend/other.md b/src/reference/sdks/frontend/other.md new file mode 100644 index 0000000..bd65aa8 --- /dev/null +++ b/src/reference/sdks/frontend/other.md @@ -0,0 +1,182 @@ +# Other + +### CommandID + +> **CommandID** = `string` & `object` + +A unique command identifier. + +#### Type Declaration + +##### \_\_commandId? + +> `optional` **\_\_commandId**: `never` + +#### Example + +```ts +"my-super-command" +``` + +*** + +### DefineSlotContent + +> **DefineSlotContent**\<`TType`, `P`\> = [`Prettify`](utils.md#prettify)\<`object` & `P`\> + +#### Type Parameters + +| Type Parameter | +| ------ | +| `TType` *extends* `string` | +| `P` *extends* `Record`\<`string`, `unknown`\> | + +*** + +### FilterSlot + +> **FilterSlot** = *typeof* [`FilterSlot`](filters.md#filterslot)\[keyof *typeof* [`FilterSlot`](#filterslot-1)\] + +*** + +### FooterSlot + +> **FooterSlot** = *typeof* [`FooterSlot`](footer.md#footerslot)\[keyof *typeof* [`FooterSlot`](#footerslot-1)\] + +*** + +### HTTPHistorySlot + +> **HTTPHistorySlot** = *typeof* [`HTTPHistorySlot`](http-history.md#httphistoryslot)\[keyof *typeof* [`HTTPHistorySlot`](#httphistoryslot-1)\] + +*** + +### HTTPHistorySlotContent + +> **HTTPHistorySlotContent** = `object` + +#### Properties + +##### toolbar-primary + +> **toolbar-primary**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) + +*** + +### JSONPrimitive + +> **JSONPrimitive** = `string` \| `number` \| `boolean` \| `null` \| `undefined` + +*** + +### KeepOperation + +> **KeepOperation**\<`T`\> = `T` & `object` + +#### Type Declaration + +##### \_\_operation? + +> `optional` **\_\_operation**: `never` + +#### Type Parameters + +| Type Parameter | +| ------ | +| `T` | + +*** + +### MatchReplaceSlot + +> **MatchReplaceSlot** = *typeof* [`MatchReplaceSlot`](match-and-replace.md#matchreplaceslot)\[keyof *typeof* [`MatchReplaceSlot`](#matchreplaceslot-1)\] + +*** + +### NotAssignableToJson + +> **NotAssignableToJson** = `bigint` \| `symbol` \| `Function` + +*** + +### ReplaySlot + +> **ReplaySlot** = *typeof* [`ReplaySlot`](replay.md#replayslot)\[keyof *typeof* [`ReplaySlot`](#replayslot-1)\] + +*** + +### ReplaySlotContent + +> **ReplaySlotContent** = `object` + +#### Properties + +##### session-toolbar-primary + +> **session-toolbar-primary**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) + +##### session-toolbar-secondary + +> **session-toolbar-secondary**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) + +##### topbar + +> **topbar**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) + +*** + +### Routes + +> **Routes** = *typeof* [`Routes`](navigation.md#routes)\[keyof *typeof* [`Routes`](#routes-1)\] + +*** + +### ScopeSlot + +> **ScopeSlot** = *typeof* [`ScopeSlot`](scopes.md#scopeslot)\[keyof *typeof* [`ScopeSlot`](#scopeslot-1)\] + +*** + +### ScopeSlotContent + +> **ScopeSlotContent** = `object` + +#### Properties + +##### create-header + +> **create-header**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) + +##### update-header + +> **update-header**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) + +*** + +### SearchSlot + +> **SearchSlot** = *typeof* [`SearchSlot`](search.md#searchslot)\[keyof *typeof* [`SearchSlot`](#searchslot-1)\] + +*** + +### SearchSlotContent + +> **SearchSlotContent** = `object` + +#### Properties + +##### search-toolbar-primary + +> **search-toolbar-primary**: [`ButtonSlotContent`](slots.md#buttonslotcontent) \| [`CustomSlotContent`](slots.md#customslotcontent) \| [`CommandSlotContent`](slots.md#commandslotcontent) + +*** + +### Source + +> **Source** = *typeof* [`Source`](match-and-replace.md#source)\[keyof *typeof* [`Source`](#source-1)\] + +*** + +### API + +Renames and re-exports [Caido](index.md#caido) diff --git a/src/reference/sdks/frontend/projects.md b/src/reference/sdks/frontend/projects.md new file mode 100644 index 0000000..e2df94a --- /dev/null +++ b/src/reference/sdks/frontend/projects.md @@ -0,0 +1,52 @@ +# Projects + +### ProjectsSDK + +> **ProjectsSDK** = `object` + +Utilities to interact with projects. + +#### Properties + +##### onCurrentProjectChange() + +> **onCurrentProjectChange**: (`callback`: (`event`: [`SelectedProjectChangeEvent`](#selectedprojectchangeevent)) => `void`) => [`ListenerHandle`](utils.md#listenerhandle) + +Subscribe to selected project changes. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `callback` | (`event`: [`SelectedProjectChangeEvent`](#selectedprojectchangeevent)) => `void` | The callback to call when the selected project changes. | + +###### Returns + +[`ListenerHandle`](utils.md#listenerhandle) + +An object with a `stop` method that can be called to stop listening to project changes. + +###### Example + +```ts +const handler = sdk.projects.onCurrentProjectChange((event) => { + console.log('Selected project changed to:', event.projectId); +}); + +// Later, stop listening +handler.stop(); +``` + +*** + +### SelectedProjectChangeEvent + +> **SelectedProjectChangeEvent** = `object` + +Event fired when the selected project changes. + +#### Properties + +##### projectId + +> **projectId**: [`ID`](utils.md#id) \| `undefined` diff --git a/src/reference/sdks/frontend/replay.md b/src/reference/sdks/frontend/replay.md new file mode 100644 index 0000000..3a675e0 --- /dev/null +++ b/src/reference/sdks/frontend/replay.md @@ -0,0 +1,773 @@ +# Replay + +### CurrentReplaySessionChangeEvent + +> **CurrentReplaySessionChangeEvent** = `object` + +Event fired when the current replay session changes. + +#### Properties + +##### sessionId + +> **sessionId**: [`ID`](utils.md#id) \| `undefined` + +The ID of the newly selected session, or undefined if no session is selected. + +*** + +### OpenTabOptions + +> **OpenTabOptions** = `object` + +Options for opening a tab. + +#### Properties + +##### select? + +> `optional` **select**: `boolean` + +Whether to select the tab after opening it. +Defaults to true. + +*** + +### ReplayCollection + +> **ReplayCollection** = `object` + +A collection in Replay. + +#### Properties + +##### id + +> **id**: [`ID`](utils.md#id) + +The ID of the collection. + +##### name + +> **name**: `string` + +The name of the collection. + +##### sessionIds + +> **sessionIds**: [`ID`](utils.md#id)[] + +The sessions in the collection. + +*** + +### ReplayCollectionCreatedEvent + +> **ReplayCollectionCreatedEvent** = `object` + +Event fired when a replay collection is created. + +#### Properties + +##### collection + +> **collection**: [`ReplayCollection`](#replaycollection) + +The newly created replay collection. + +*** + +### ReplayEntry + +> **ReplayEntry** = `object` + +A replay entry. + +#### Properties + +##### id + +> **id**: [`ID`](utils.md#id) + +The ID of the entry. + +##### requestId? + +> `optional` **requestId**: [`ID`](utils.md#id) + +The ID of the request associated with this entry, if any. + +##### sessionId + +> **sessionId**: [`ID`](utils.md#id) + +The ID of the session this entry belongs to. + +*** + +### ReplaySDK + +> **ReplaySDK** = `object` + +Utilities to interact with Replay. + +#### Properties + +##### addRequestEditorExtension() + +> **addRequestEditorExtension**: (`extension`: `Extension`) => `void` + +Add an extension to the request editor. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `extension` | `Extension` | The extension to add. | + +###### Returns + +`void` + +##### addRequestViewMode() + +> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)) => `void` + +Add a custom view mode for requests. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions) | The view mode options. | + +###### Returns + +`void` + +##### addToSlot + +> **addToSlot**: [`DefineAddToSlotFn`](slots.md#defineaddtoslotfn)\<[`ReplaySlotContent`](other.md#replayslotcontent)\> + +Add a component to a slot. + +###### Param + +The slot to add the component to. + +###### Param + +The content to add to the slot. + +###### Example + +```ts +addToSlot(ReplaySlot.SessionToolbarPrimary, { + kind: "Command", + commandId: "my-command", + icon: "my-icon", +}); + +addToSlot(ReplaySlot.SessionToolbarSecondary, { + kind: "Custom", + component: MyComponent, +}); + +addToSlot(ReplaySlot.Topbar, { + kind: "Button", + label: "My Button", + icon: "my-icon", + onClick: () => { + console.log("Button clicked"); + }, +}); +``` + +##### closeTab() + +> **closeTab**: (`sessionId`: [`ID`](utils.md#id)) => `void` + +Close a replay tab for the given session. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `sessionId` | [`ID`](utils.md#id) | The ID of the session to close. | + +###### Returns + +`void` + +##### createCollection() + +> **createCollection**: (`name`: `string`) => `Promise`\<[`ReplayCollection`](#replaycollection)\> + +Create a new collection. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `name` | `string` | The name of the collection to create. | + +###### Returns + +`Promise`\<[`ReplayCollection`](#replaycollection)\> + +##### createSession() + +> **createSession**: (`source`: [`RequestSource`](#requestsource), `collectionId?`: [`ID`](utils.md#id)) => `Promise`\<`void`\> + +Create a session. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `source` | [`RequestSource`](#requestsource) | - | +| `collectionId?` | [`ID`](utils.md#id) | The ID of the collection to add the request. | + +###### Returns + +`Promise`\<`void`\> + +##### deleteCollection() + +> **deleteCollection**: (`id`: [`ID`](utils.md#id)) => `Promise`\<`boolean`\> + +Delete a collection. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) | The ID of the collection to delete. | + +###### Returns + +`Promise`\<`boolean`\> + +Whether the collection was deleted. + +##### deleteSessions() + +> **deleteSessions**: (`sessionIds`: [`ID`](utils.md#id)[]) => `Promise`\<[`ID`](utils.md#id)[]\> + +Delete a session. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `sessionIds` | [`ID`](utils.md#id)[] | The IDs of the sessions to delete. | + +###### Returns + +`Promise`\<[`ID`](utils.md#id)[]\> + +##### getCollections() + +> **getCollections**: () => [`ReplayCollection`](#replaycollection)[] + +Get the list of all replay collections. + +###### Returns + +[`ReplayCollection`](#replaycollection)[] + +The list of all replay collections. + +##### getCurrentSession() + +> **getCurrentSession**: () => [`ReplaySession`](#replaysession) \| `undefined` + +Get the currently selected replay session. + +###### Returns + +[`ReplaySession`](#replaysession) \| `undefined` + +The currently selected replay session, or undefined if no session is selected. + +###### Example + +```ts +const currentSession = sdk.replay.getCurrentSession(); +if (currentSession) { + console.log(`Current session: ${currentSession.name}`); +} else { + console.log("No session is currently selected"); +} +``` + +##### getEntry() + +> **getEntry**: (`entryId`: [`ID`](utils.md#id)) => [`ReplayEntry`](#replayentry) + +Get a replay entry by its ID. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `entryId` | [`ID`](utils.md#id) | The ID of the entry to get. | + +###### Returns + +[`ReplayEntry`](#replayentry) + +The replay entry. + +###### Example + +```ts +const entry = await sdk.replay.getEntry(entryId); +console.log(entry.id, entry.sessionId, entry.requestId); +``` + +##### getSessions() + +> **getSessions**: () => [`ReplaySession`](#replaysession)[] + +Get the list of all replay sessions. + +###### Returns + +[`ReplaySession`](#replaysession)[] + +The list of all replay sessions. + +##### getTabs() + +> **getTabs**: () => [`ReplayTab`](#replaytab)[] + +Get the list of all open replay tabs. + +###### Returns + +[`ReplayTab`](#replaytab)[] + +The list of all open replay tabs. + +##### moveSession() + +> **moveSession**: (`sessionId`: [`ID`](utils.md#id), `collectionId`: [`ID`](utils.md#id)) => `Promise`\<[`ReplaySession`](#replaysession)\> + +Move a session to a different collection. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `sessionId` | [`ID`](utils.md#id) | The ID of the session to move. | +| `collectionId` | [`ID`](utils.md#id) | The ID of the collection to move the session to. | + +###### Returns + +`Promise`\<[`ReplaySession`](#replaysession)\> + +The updated session. + +##### onCollectionCreate() + +> **onCollectionCreate**: (`callback`: (`event`: [`ReplayCollectionCreatedEvent`](#replaycollectioncreatedevent)) => `void`) => [`ListenerHandle`](utils.md#listenerhandle) + +Subscribe to replay collection creation events. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `callback` | (`event`: [`ReplayCollectionCreatedEvent`](#replaycollectioncreatedevent)) => `void` | The callback to call when a collection is created. | + +###### Returns + +[`ListenerHandle`](utils.md#listenerhandle) + +An object with a `stop` method that can be called to stop listening to collection creation events. + +###### Example + +```ts +const handler = sdk.replay.onCollectionCreate((event) => { + console.log(`Collection ${event.collection.id} was created!`); +}); + +// Later, stop listening +handler.stop(); +``` + +##### onCurrentSessionChange() + +> **onCurrentSessionChange**: (`callback`: (`event`: [`CurrentReplaySessionChangeEvent`](#currentreplaysessionchangeevent)) => `void`) => [`ListenerHandle`](utils.md#listenerhandle) + +Subscribe to current replay session changes. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `callback` | (`event`: [`CurrentReplaySessionChangeEvent`](#currentreplaysessionchangeevent)) => `void` | The callback to call when the selected session changes. | + +###### Returns + +[`ListenerHandle`](utils.md#listenerhandle) + +An object with a `stop` method that can be called to stop listening to session changes. + +###### Example + +```ts +const handler = sdk.replay.onCurrentSessionChange((event) => { + console.log(`Session ${event.sessionId} got selected!`); +}); + +// Later, stop listening +handler.stop(); +``` + +##### onSessionCreate() + +> **onSessionCreate**: (`callback`: (`event`: [`ReplaySessionCreatedEvent`](#replaysessioncreatedevent)) => `void`) => [`ListenerHandle`](utils.md#listenerhandle) + +Subscribe to replay session creation events. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `callback` | (`event`: [`ReplaySessionCreatedEvent`](#replaysessioncreatedevent)) => `void` | The callback to call when a session is created. | + +###### Returns + +[`ListenerHandle`](utils.md#listenerhandle) + +An object with a `stop` method that can be called to stop listening to session creation events. + +###### Example + +```ts +const handler = sdk.replay.onSessionCreate((event) => { + console.log(`Session ${event.session.id} was created!`); +}); + +// Later, stop listening +handler.stop(); +``` + +##### openTab() + +> **openTab**: (`sessionId`: [`ID`](utils.md#id), `options?`: [`OpenTabOptions`](#opentaboptions)) => `void` + +Open a replay tab for the given session. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `sessionId` | [`ID`](utils.md#id) | The ID of the session to open. | +| `options?` | [`OpenTabOptions`](#opentaboptions) | The options for opening the tab. | + +###### Returns + +`void` + +##### renameCollection() + +> **renameCollection**: (`id`: [`ID`](utils.md#id), `name`: `string`) => `Promise`\<[`ReplayCollection`](#replaycollection)\> + +Rename a collection. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) | The ID of the collection to rename. | +| `name` | `string` | The new name of the collection. | + +###### Returns + +`Promise`\<[`ReplayCollection`](#replaycollection)\> + +The updated collection. + +##### renameSession() + +> **renameSession**: (`id`: [`ID`](utils.md#id), `name`: `string`) => `Promise`\<[`ReplaySession`](#replaysession)\> + +Rename a session. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) | The ID of the session to rename. | +| `name` | `string` | The new name of the session. | + +###### Returns + +`Promise`\<[`ReplaySession`](#replaysession)\> + +The updated session. + +##### sendRequest() + +> **sendRequest**: (`sessionId`: [`ID`](utils.md#id), `options`: [`SendRequestOptions`](#sendrequestoptions)) => `Promise`\<`void`\> + +Send a request to the Replay backend. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `sessionId` | [`ID`](utils.md#id) | - | +| `options` | [`SendRequestOptions`](#sendrequestoptions) | The options for sending the request. | + +###### Returns + +`Promise`\<`void`\> + +###### Example + +```ts +sendRequest(sessionId, { + connectionInfo: { + SNI: "example.com", + host: "example.com", + isTLS: true, + port: 443, + }, + raw: "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n", + updateContentLength: false, +}); +``` + +##### showEntry() + +> **showEntry**: (`sessionId`: [`ID`](utils.md#id), `entryId`: [`ID`](utils.md#id), `options?`: `object`) => `Promise`\<`void`\> + +Show a specific entry in a replay session. +This will open the session tab if not already open, set it as the selected session, and display the specified entry. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `sessionId` | [`ID`](utils.md#id) | The ID of the session containing the entry. | +| `entryId` | [`ID`](utils.md#id) | The ID of the entry to show. | +| `options?` | \{ `overwriteDraft?`: `boolean`; \} | The options for showing the entry. | +| `options.overwriteDraft?` | `boolean` | Whether to overwrite the request draft. If true, the draft will be removed and the entry's raw request will be shown. If false, the draft will be kept. | + +###### Returns + +`Promise`\<`void`\> + +###### Example + +```ts +await sdk.replay.showEntry(sessionId, entryId, { + overwriteDraft: true, +}); +``` + +*** + +### ReplaySession + +> **ReplaySession** = `object` + +A session in Replay. + +#### Properties + +##### collectionId + +> **collectionId**: [`ID`](utils.md#id) + +The ID of the collection the session belongs to. + +##### entryIds + +> **entryIds**: [`ID`](utils.md#id)[] + +The IDs of all entries in this session. + +##### id + +> **id**: [`ID`](utils.md#id) + +The ID of the session. + +##### name + +> **name**: `string` + +The name of the session. + +*** + +### ReplaySessionCreatedEvent + +> **ReplaySessionCreatedEvent** = `object` + +Event fired when a replay session is created. + +#### Properties + +##### session + +> **session**: [`ReplaySession`](#replaysession) + +The newly created replay session. + +*** + +### ReplayTab + +> **ReplayTab** = `object` + +A replay tab. + +#### Properties + +##### sessionId + +> **sessionId**: [`ID`](utils.md#id) + +The ID of the session associated with this tab. + +*** + +### RequestSource + +> **RequestSource** = \{ `connectionInfo`: [`SendRequestOptions`](#sendrequestoptions)\[`"connectionInfo"`\]; `raw`: `string`; `type`: `"Raw"`; \} \| \{ `id`: `string`; `type`: `"ID"`; \} + +#### Remarks + +This type is a discriminated union with two possible shapes: +- A raw request, containing the raw HTTP request string and connection information. +- A reference to an existing request ID. + +#### Example + +```ts +// Using a raw request +const source: RequestSource = { + type: "Raw", + raw: "GET /api/data HTTP/1.1", + connectionInfo: { ... } +}; +// Using an ID +const source: RequestSource = { + type: "ID", + id: "request-123" +}; +``` + +*** + +### SendRequestOptions + +> **SendRequestOptions** = `object` + +Options for sending a request. + +#### Properties + +##### background? + +> `optional` **background**: `boolean` + +Whether to send the request in the background without updating the UI. +If true, the request will not update the UI. +If false, the UI will be updated to display the session and the new request. +Defaults to false. + +##### connectionClose? + +> `optional` **connectionClose**: `boolean` + +Whether to force close the connection by setting Connection: close header. +Defaults to true. + +##### connectionInfo + +> **connectionInfo**: `object` + +The connection information to use for the request. + +###### host + +> **host**: `string` + +The host to use for the request. + +###### isTLS + +> **isTLS**: `boolean` + +Whether the request is TLS. + +###### port + +> **port**: `number` + +The port to use for the request. + +###### SNI? + +> `optional` **SNI**: `string` + +The SNI to use for the request. +If not provided, the SNI will be inferred from the host. + +##### overwriteDraft? + +> `optional` **overwriteDraft**: `boolean` + +Whether to overwrite the editor's draft content. +If true, draft content will be overwritten with the new request. +If false, the draft will be kept. +Defaults to true. + +##### raw + +> **raw**: `string` + +The raw request to send. + +##### updateContentLength? + +> `optional` **updateContentLength**: `boolean` + +Whether to update the content length automatically to match the body. +Defaults to true. + +*** + +### ReplaySlot + +> `const` **ReplaySlot**: `object` + +The slots in the Replay UI. + +#### Type Declaration + +##### SessionToolbarPrimary + +> `readonly` **SessionToolbarPrimary**: `"session-toolbar-primary"` + +The left side of the session toolbar. + +##### SessionToolbarSecondary + +> `readonly` **SessionToolbarSecondary**: `"session-toolbar-secondary"` + +The right side of the session toolbar. + +##### Topbar + +> `readonly` **Topbar**: `"topbar"` + +The left side of the topbar. diff --git a/src/reference/sdks/frontend/request.md b/src/reference/sdks/frontend/request.md new file mode 100644 index 0000000..1a14325 --- /dev/null +++ b/src/reference/sdks/frontend/request.md @@ -0,0 +1,45 @@ +# Request + +### RequestDraft + +> **RequestDraft** = [`Prettify`](utils.md#prettify)\<[`As`](utils.md#as)\<`"RequestDraft"`\> & `object`\> + +A draft request that has not yet been saved to the database. + +*** + +### RequestFull + +> **RequestFull** = [`Prettify`](utils.md#prettify)\<[`As`](utils.md#as)\<`"RequestFull"`\> & `object`\> + +A complete request with all metadata and raw content. + +*** + +### RequestMeta + +> **RequestMeta** = [`Prettify`](utils.md#prettify)\<[`As`](utils.md#as)\<`"RequestMeta"`\> & `object`\> + +Metadata about a request without the raw content. + +*** + +### RequestViewModeOptions + +> **RequestViewModeOptions** = `object` + +Options for defining a custom request view mode. + +#### Properties + +##### label + +> **label**: `string` + +The label of the view mode. + +##### view + +> **view**: [`ComponentDefinition`](utils.md#componentdefinition) + +The component to render when the view mode is selected. diff --git a/src/reference/sdks/frontend/runtime.md b/src/reference/sdks/frontend/runtime.md new file mode 100644 index 0000000..0623a6c --- /dev/null +++ b/src/reference/sdks/frontend/runtime.md @@ -0,0 +1,21 @@ +# Runtime + +### RuntimeSDK + +> **RuntimeSDK** = `object` + +Utilities to interact with the runtime. + +#### Accessors + +##### version + +###### Get Signature + +> **get** **version**(): `string` + +Get the current version of Caido. + +###### Returns + +`string` diff --git a/src/reference/sdks/frontend/scopes.md b/src/reference/sdks/frontend/scopes.md new file mode 100644 index 0000000..7d3ba15 --- /dev/null +++ b/src/reference/sdks/frontend/scopes.md @@ -0,0 +1,186 @@ +# Scopes + +### Scope + +> **Scope** = `object` + +Represents a scope. + +#### Properties + +##### allowlist + +> **allowlist**: `string`[] + +The list of included items. + +##### denylist + +> **denylist**: `string`[] + +The list of excluded items. + +##### id + +> **id**: [`ID`](utils.md#id) + +The unique ID of the scope. + +##### name + +> **name**: `string` + +The name of the scope. + +*** + +### ScopesSDK + +> **ScopesSDK** = `object` + +Utilities to interact with scopes + +#### Properties + +##### addToSlot + +> **addToSlot**: [`DefineAddToSlotFn`](slots.md#defineaddtoslotfn)\<[`ScopeSlotContent`](other.md#scopeslotcontent)\> + +Add a component to a slot. + +###### Param + +The slot to add the component to. + +###### Param + +The content to add to the slot. + +###### Example + +```ts +sdk.scopes.addToSlot(ScopeSlot.UpdateHeader, { + type: "Button", + label: "My Button", + icon: "my-icon", + onClick: () => { + console.log("Button clicked"); + }, +}); + +sdk.scopes.addToSlot(ScopeSlot.CreateHeader, { + type: "Custom", + definition: MyComponent, +}); + +sdk.scopes.addToSlot(ScopeSlot.UpdateHeader, { + type: "Command", + commandId: "my-command", + icon: "my-icon", +}); +``` + +##### createScope() + +> **createScope**: (`options`: `object`) => `Promise`\<[`Scope`](#scope) \| `undefined`\> + +Create a scope. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | \{ `allowlist`: `string`[]; `denylist`: `string`[]; `name`: `string`; \} | Options for the scope. | +| `options.allowlist` | `string`[] | The list of included items in the scope. | +| `options.denylist` | `string`[] | The list of excluded items in the scope. | +| `options.name` | `string` | The name of the scope. | + +###### Returns + +`Promise`\<[`Scope`](#scope) \| `undefined`\> + +The created scope. + +###### Example + +```ts +const newScope = await sdk.scopes.createScope({ + name: "Example", + allowlist: ["*example.com", "*github.com"], + denylist: ["*caido.io"], +}); +``` + +##### deleteScope() + +> **deleteScope**: (`id`: [`ID`](utils.md#id)) => `Promise`\<`boolean`\> + +Delete a scope. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) | The id of the scope to delete. | + +###### Returns + +`Promise`\<`boolean`\> + +Whether the scope was deleted. + +##### getScopes() + +> **getScopes**: () => [`Scope`](#scope)[] + +Get all scopes. + +###### Returns + +[`Scope`](#scope)[] + +A list of scopes. + +##### updateScope() + +> **updateScope**: (`id`: [`ID`](utils.md#id), `options`: `object`) => `Promise`\<[`Scope`](#scope) \| `undefined`\> + +Update a scope. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) | The id of the scope to update. | +| `options` | \{ `allowlist?`: `string`[]; `denylist?`: `string`[]; `name?`: `string`; \} | Options for the scope. | +| `options.allowlist?` | `string`[] | The list of included items in the scope. | +| `options.denylist?` | `string`[] | The list of excluded items in the scope. | +| `options.name?` | `string` | The name of the scope. | + +###### Returns + +`Promise`\<[`Scope`](#scope) \| `undefined`\> + +The updated scope. + +*** + +### ScopeSlot + +> `const` **ScopeSlot**: `object` + +The slots in the Scopes UI. + +#### Type Declaration + +##### CreateHeader + +> `readonly` **CreateHeader**: `"create-header"` + +The header area of the preset form create component, to the left of the ScopeTooltip. + +##### UpdateHeader + +> `readonly` **UpdateHeader**: `"update-header"` + +The header area of the preset form update component, to the left of the ScopeTooltip. diff --git a/src/reference/sdks/frontend/search.md b/src/reference/sdks/frontend/search.md new file mode 100644 index 0000000..0e346e6 --- /dev/null +++ b/src/reference/sdks/frontend/search.md @@ -0,0 +1,152 @@ +# Search + +### SearchSDK + +> **SearchSDK** = `object` + +Utilities to interact with the Search page. + +#### Properties + +##### addRequestEditorExtension() + +> **addRequestEditorExtension**: (`extension`: `Extension`) => `void` + +Add an extension to the request editor. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `extension` | `Extension` | The extension to add. | + +###### Returns + +`void` + +##### addRequestViewMode() + +> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)) => `void` + +Add a custom request view mode. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions) | The view mode options. | + +###### Returns + +`void` + +##### addToSlot() + +> **addToSlot**: \<`T`\>(`slot`: `T`, `content`: [`SearchSlotContent`](other.md#searchslotcontent)\[`T`\]) => `void` + +Add content to a slot in the Search UI. + +###### Type Parameters + +| Type Parameter | +| ------ | +| `T` *extends* [`SearchSlot`](#searchslot) | + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `slot` | `T` | The slot to add content to. | +| `content` | [`SearchSlotContent`](other.md#searchslotcontent)\[`T`\] | The content to add. | + +###### Returns + +`void` + +##### getQuery() + +> **getQuery**: () => [`HTTPQL`](utils.md#httpql) + +Get the current HTTPQL query. + +###### Returns + +[`HTTPQL`](utils.md#httpql) + +The current HTTPQL query. + +##### getScopeId() + +> **getScopeId**: () => [`ID`](utils.md#id) \| `undefined` + +Get the current scope ID. + +###### Returns + +[`ID`](utils.md#id) \| `undefined` + +The current scope ID. + +##### scrollTo() + +> **scrollTo**: (`id`: [`ID`](utils.md#id)) => `void` + +Scrolls the Search table to a specific request. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) | The ID of the request to scroll to. | + +###### Returns + +`void` + +##### setQuery() + +> **setQuery**: (`query`: [`HTTPQL`](utils.md#httpql)) => `void` + +Set the HTTPQL query that will be applied on the search table results. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `query` | [`HTTPQL`](utils.md#httpql) | The HTTPQL query. | + +###### Returns + +`void` + +##### setScope() + +> **setScope**: (`id`: [`ID`](utils.md#id) \| `undefined`) => `Promise`\<`void`\> + +Set the current scope. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) \| `undefined` | The ID of the scope to set. | + +###### Returns + +`Promise`\<`void`\> + +*** + +### SearchSlot + +> `const` **SearchSlot**: `object` + +The slots in the Search UI. + +#### Type Declaration + +##### ToolbarPrimary + +> `readonly` **ToolbarPrimary**: `"search-toolbar-primary"` + +The primary slot in the search toolbar. diff --git a/src/reference/sdks/frontend/shortcuts.md b/src/reference/sdks/frontend/shortcuts.md new file mode 100644 index 0000000..bdbac92 --- /dev/null +++ b/src/reference/sdks/frontend/shortcuts.md @@ -0,0 +1,26 @@ +# Shortcuts + +### ShortcutsSDK + +> **ShortcutsSDK** = `object` + +Utilities to interact with shortcuts. + +#### Properties + +##### register() + +> **register**: (`commandId`: [`CommandID`](other.md#commandid), `keys`: `string`[]) => `void` + +Register a shortcut. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `commandId` | [`CommandID`](other.md#commandid) | The id of the command to run when the shortcut is triggered. | +| `keys` | `string`[] | The keys of the shortcut. Check out [KeyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values) for the list of supported keys. | + +###### Returns + +`void` diff --git a/src/reference/sdks/frontend/sidebar.md b/src/reference/sdks/frontend/sidebar.md new file mode 100644 index 0000000..4b486aa --- /dev/null +++ b/src/reference/sdks/frontend/sidebar.md @@ -0,0 +1,66 @@ +# Sidebar + +### SidebarItem + +> **SidebarItem** = `object` + +Represents a sidebar item. + +#### Properties + +##### setCount() + +> **setCount**: (`count`: `number`) => `void` + +Set the value of a notification badge next to the sidebar item. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `count` | `number` | The number to display in the badge. A value of 0 will hide the badge. | + +###### Returns + +`void` + +*** + +### SidebarSDK + +> **SidebarSDK** = `object` + +Utilities to interact with the sidebar. + +#### Properties + +##### registerItem() + +> **registerItem**: (`name`: `string`, `path`: `string`, `options?`: `object`) => [`SidebarItem`](#sidebaritem) + +Register a sidebar item. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `name` | `string` | The name of the sidebar item. | +| `path` | `string` | The path that the user will be navigated to when the sidebar item is clicked. | +| `options?` | \{ `group?`: `string`; `icon?`: [`Icon`](utils.md#icon); `isExternal?`: `boolean`; \} | Options for the sidebar item. | +| `options.group?` | `string` | The group the sidebar item belongs to. | +| `options.icon?` | [`Icon`](utils.md#icon) | The [Icon](utils.md#icon) of the sidebar item. | +| `options.isExternal?` | `boolean` | Whether the path points to an external URL. | + +###### Returns + +[`SidebarItem`](#sidebaritem) + +The created sidebar item. + +###### Example + +```ts +sdk.sidebar.registerItem("My Plugin", "/my-plugin-page", { + icon: "fas fa-rocket", +}); +``` diff --git a/src/reference/sdks/frontend/sitemap.md b/src/reference/sdks/frontend/sitemap.md new file mode 100644 index 0000000..68206c9 --- /dev/null +++ b/src/reference/sdks/frontend/sitemap.md @@ -0,0 +1,69 @@ +# Sitemap + +### SitemapSDK + +> **SitemapSDK** = `object` + +Utilities to interact with the Sitemap page. + +#### Properties + +##### addRequestEditorExtension() + +> **addRequestEditorExtension**: (`extension`: `Extension`) => `void` + +Add an extension to the request editor. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `extension` | `Extension` | The extension to add. | + +###### Returns + +`void` + +##### addRequestViewMode() + +> **addRequestViewMode**: (`options`: [`RequestViewModeOptions`](request.md#requestviewmodeoptions)) => `void` + +Add a custom request view mode. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | [`RequestViewModeOptions`](request.md#requestviewmodeoptions) | The view mode options. | + +###### Returns + +`void` + +##### getScopeId() + +> **getScopeId**: () => [`ID`](utils.md#id) \| `undefined` + +Get the current scope ID. + +###### Returns + +[`ID`](utils.md#id) \| `undefined` + +The current scope ID. + +##### setScope() + +> **setScope**: (`id`: [`ID`](utils.md#id) \| `undefined`) => `void` + +Set the current scope. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `id` | [`ID`](utils.md#id) \| `undefined` | The ID of the scope to set. | + +###### Returns + +`void` diff --git a/src/reference/sdks/frontend/slots.md b/src/reference/sdks/frontend/slots.md new file mode 100644 index 0000000..2632206 --- /dev/null +++ b/src/reference/sdks/frontend/slots.md @@ -0,0 +1,62 @@ +# Slots + +### ButtonSlotContent + +> **ButtonSlotContent** = [`DefineSlotContent`](other.md#defineslotcontent)\<`"Button"`, \{ `icon?`: `string`; `label`: `string`; `onClick`: () => `void`; \}\> + +Content for a button slot. + +*** + +### CommandSlotContent + +> **CommandSlotContent** = [`DefineSlotContent`](other.md#defineslotcontent)\<`"Command"`, \{ `commandId`: [`CommandID`](other.md#commandid); `icon?`: `string`; \}\> + +Content for a command slot. + +*** + +### CustomSlotContent + +> **CustomSlotContent** = [`DefineSlotContent`](other.md#defineslotcontent)\<`"Custom"`, \{ `definition`: [`ComponentDefinition`](utils.md#componentdefinition); \}\> + +Content for a custom component slot. + +*** + +### DefineAddToSlotFn() + +> **DefineAddToSlotFn**\<`TMap`\> = \<`K`\>(`slot`: `K`, `spec`: `TMap`\[`K`\]) => `void` + +A function type for adding content to slots. + +#### Type Parameters + +| Type Parameter | +| ------ | +| `TMap` *extends* `Record`\<`string`, [`DefineSlotContent`](other.md#defineslotcontent)\<`string`, `Record`\<`string`, `unknown`\>\>\> | + +#### Type Parameters + +| Type Parameter | +| ------ | +| `K` *extends* `string` \| `number` \| `symbol` | + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `slot` | `K` | +| `spec` | `TMap`\[`K`\] | + +#### Returns + +`void` + +*** + +### SlotContent + +> **SlotContent** = [`ButtonSlotContent`](#buttonslotcontent) \| [`CustomSlotContent`](#customslotcontent) \| [`CommandSlotContent`](#commandslotcontent) + +Union type of all possible slot content types. diff --git a/src/reference/sdks/frontend/storage.md b/src/reference/sdks/frontend/storage.md new file mode 100644 index 0000000..490c9e2 --- /dev/null +++ b/src/reference/sdks/frontend/storage.md @@ -0,0 +1,61 @@ +# Storage + +### StorageSDK + +> **StorageSDK** = `object` + +Utilities to interact with frontend-plugin storage. + +#### Properties + +##### get() + +> **get**: () => [`JSONValue`](json.md#jsonvalue) + +Get the storage. + +###### Returns + +[`JSONValue`](json.md#jsonvalue) + +The storage. + +##### onChange() + +> **onChange**: (`callback`: (`value`: [`JSONValue`](json.md#jsonvalue)) => `void`) => `void` + +Subscribe to storage changes. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `callback` | (`value`: [`JSONValue`](json.md#jsonvalue)) => `void` | The callback to call when the storage changes. | + +###### Returns + +`void` + +##### set() + +> **set**: \<`T`\>(`value`: [`JSONCompatible`](json.md#jsoncompatible)\<`T`\>) => `Promise`\<`void`\> + +Set the storage. + +###### Type Parameters + +| Type Parameter | +| ------ | +| `T` | + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `value` | [`JSONCompatible`](json.md#jsoncompatible)\<`T`\> | The value to set the storage to | + +###### Returns + +`Promise`\<`void`\> + +A promise that resolves when the storage has been set. diff --git a/src/reference/sdks/frontend/ui.md b/src/reference/sdks/frontend/ui.md new file mode 100644 index 0000000..0d7c36e --- /dev/null +++ b/src/reference/sdks/frontend/ui.md @@ -0,0 +1,109 @@ +# UI + +### UISDK + +> **UISDK** = `object` + +Utilities to create UI components. + +#### Properties + +##### button() + +> **button**: (`options?`: `object`) => `HTMLElement` + +Create a button. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options?` | \{ `label?`: `string`; `leadingIcon?`: [`Icon`](utils.md#icon); `size?`: `"small"` \| `"medium"` \| `"large"`; `trailingIcon?`: [`Icon`](utils.md#icon); `variant?`: `"primary"` \| `"secondary"` \| `"tertiary"`; \} | Options for the button. | +| `options.label?` | `string` | The label of the button. | +| `options.leadingIcon?` | [`Icon`](utils.md#icon) | The leading icon of the button. | +| `options.size?` | `"small"` \| `"medium"` \| `"large"` | The size of the button. | +| `options.trailingIcon?` | [`Icon`](utils.md#icon) | The trailing icon of the button. | +| `options.variant?` | `"primary"` \| `"secondary"` \| `"tertiary"` | The variant of the button. | + +###### Returns + +`HTMLElement` + +The button element. + +###### Example + +```ts +const deleteButton = sdk.ui.button({ + variant: "primary", + label: "Delete", + trailingIcon: "fas fa-trash-can", + size: "small", +}); +``` + +##### card() + +> **card**: (`options?`: `object`) => `HTMLElement` + +Create a card. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options?` | \{ `body?`: `HTMLElement`; `footer?`: `HTMLElement`; `header?`: `HTMLElement`; \} | Options for the card. | +| `options.body?` | `HTMLElement` | The body of the card. | +| `options.footer?` | `HTMLElement` | The footer of the card. | +| `options.header?` | `HTMLElement` | The header of the card. | + +###### Returns + +`HTMLElement` + +The card element. + +##### httpRequestEditor() + +> **httpRequestEditor**: () => [`HTTPRequestEditor`](editor.md#httprequesteditor) + +Create an HTTP request editor + +###### Returns + +[`HTTPRequestEditor`](editor.md#httprequesteditor) + +The HTTP request editor. + +##### httpResponseEditor() + +> **httpResponseEditor**: () => [`HTTPResponseEditor`](editor.md#httpresponseeditor) + +Create an HTTP response editor + +###### Returns + +[`HTTPResponseEditor`](editor.md#httpresponseeditor) + +The HTTP response editor. + +##### well() + +> **well**: (`options?`: `object`) => `HTMLElement` + +Create a well. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options?` | \{ `body?`: `HTMLElement`; `footer?`: `HTMLElement`; `header?`: `HTMLElement`; \} | Options for the well. | +| `options.body?` | `HTMLElement` | The body of the well. | +| `options.footer?` | `HTMLElement` | The footer of the well. | +| `options.header?` | `HTMLElement` | The header of the well. | + +###### Returns + +`HTMLElement` + +The well element. diff --git a/src/reference/sdks/frontend/utils.md b/src/reference/sdks/frontend/utils.md new file mode 100644 index 0000000..8310ccb --- /dev/null +++ b/src/reference/sdks/frontend/utils.md @@ -0,0 +1,143 @@ +# Utils + +### As + +> **As**\<`TType`\> = `object` + +Utility type that adds a type discriminator to a type. + +#### Type Parameters + +| Type Parameter | +| ------ | +| `TType` *extends* `string` | + +#### Properties + +##### type + +> **type**: `TType` + +*** + +### ComponentDefinition + +> **ComponentDefinition** = `object` + +A custom component that will be rendered in the UI. + +#### Properties + +##### component + +> **component**: `VueComponent` + +##### events? + +> `optional` **events**: `Record`\<`string`, (...`args`: `unknown`[]) => `void`\> + +##### props? + +> `optional` **props**: `Record`\<`string`, `unknown`\> + +*** + +### HTTPQL + +> **HTTPQL** = `string` & `object` + +An HTTPQL expression. + +#### Type Declaration + +##### \_\_httpql? + +> `optional` **\_\_httpql**: `never` + +#### Example + +```ts +`req.method.eq:"POST"` +``` + +*** + +### Icon + +> **Icon** = `string` & `object` + +A [https://fontawesome.com/icons\|FontAwesome](https://fontawesome.com/icons|FontAwesome) icon class. + +#### Type Declaration + +##### \_\_icon? + +> `optional` **\_\_icon**: `never` + +#### Example + +```ts +"fas fa-rocket" +``` + +*** + +### ID + +> **ID** = `string` & `object` + +A unique Caido identifier per type. + +#### Type Declaration + +##### \_\_id? + +> `optional` **\_\_id**: `never` + +*** + +### ListenerHandle + +> **ListenerHandle** = `object` + +A handle for a listener. + +#### Properties + +##### stop() + +> **stop**: () => `void` + +Stop the listener. + +###### Returns + +`void` + +*** + +### Prettify + +> **Prettify**\<`T`\> = `{ [K in keyof T]: T[K] }` & `object` + +Utility type that prettifies complex types for better IDE display. + +#### Type Parameters + +| Type Parameter | +| ------ | +| `T` | + +*** + +### PromisifiedReturnType + +> **PromisifiedReturnType**\<`T`\> = `ReturnType`\<`T`\> *extends* `Promise`\ ? `Promise`\<`U`\> : `Promise`\<`ReturnType`\<`T`\>\> + +Utility type for converting endpoint return types to promises. + +#### Type Parameters + +| Type Parameter | +| ------ | +| `T` *extends* (...`args`: `unknown`[]) => `unknown` | diff --git a/src/reference/sdks/frontend/window.md b/src/reference/sdks/frontend/window.md new file mode 100644 index 0000000..df74634 --- /dev/null +++ b/src/reference/sdks/frontend/window.md @@ -0,0 +1,111 @@ +# Window + +### Dialog + +> **Dialog** = `object` + +A dialog instance that can be closed programmatically. + +#### Properties + +##### close() + +> **close**: () => `void` + +###### Returns + +`void` + +*** + +### DialogOptions + +> **DialogOptions** = `object` + +Options for configuring a dialog. + +#### Properties + +##### closable? + +> `optional` **closable**: `boolean` + +##### closeOnEscape? + +> `optional` **closeOnEscape**: `boolean` + +##### draggable? + +> `optional` **draggable**: `boolean` + +##### modal? + +> `optional` **modal**: `boolean` + +##### position? + +> `optional` **position**: `"left"` \| `"right"` \| `"top"` \| `"bottom"` \| `"center"` \| `"topleft"` \| `"topright"` \| `"bottomleft"` \| `"bottomright"` + +##### title? + +> `optional` **title**: `string` + +*** + +### WindowSDK + +> **WindowSDK** = `object` + +Utilities to interact with the active page. + +#### Properties + +##### getActiveEditor() + +> **getActiveEditor**: () => [`Editor`](editor.md#editor) \| `undefined` + +Get the active editor. + +###### Returns + +[`Editor`](editor.md#editor) \| `undefined` + +The active editor. + +##### showDialog() + +> **showDialog**: (`component`: [`ComponentDefinition`](utils.md#componentdefinition), `options?`: [`DialogOptions`](#dialogoptions)) => [`Dialog`](#dialog) + +Show a dialog component. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `component` | [`ComponentDefinition`](utils.md#componentdefinition) | The custom slot content to display in the dialog. | +| `options?` | [`DialogOptions`](#dialogoptions) | Options for the dialog. | + +###### Returns + +[`Dialog`](#dialog) + +A dialog object that can be used to close the dialog. + +##### showToast() + +> **showToast**: (`message`: `string`, `options?`: `object`) => `void` + +Show a toast message. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `message` | `string` | The message to show. | +| `options?` | \{ `duration?`: `number`; `variant?`: `"success"` \| `"error"` \| `"warning"` \| `"info"`; \} | Options for the toast message. | +| `options.duration?` | `number` | The duration of the toast message in milliseconds. | +| `options.variant?` | `"success"` \| `"error"` \| `"warning"` \| `"info"` | The variant of the toast message. | + +###### Returns + +`void` diff --git a/src/reference/sdks/frontend/workflows.md b/src/reference/sdks/frontend/workflows.md new file mode 100644 index 0000000..8e9d349 --- /dev/null +++ b/src/reference/sdks/frontend/workflows.md @@ -0,0 +1,160 @@ +# Workflows + +### OnCreatedWorkflowCallback() + +> **OnCreatedWorkflowCallback** = (`event`: `object`) => `void` + +Callback function called when a workflow is created. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | \{ `workflow`: [`Workflow`](#workflow); \} | +| `event.workflow` | [`Workflow`](#workflow) | + +#### Returns + +`void` + +*** + +### OnDeletedWorkflowCallback() + +> **OnDeletedWorkflowCallback** = (`event`: `object`) => `void` + +Callback function called when a workflow is deleted. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | \{ `id`: [`ID`](utils.md#id); \} | +| `event.id` | [`ID`](utils.md#id) | + +#### Returns + +`void` + +*** + +### OnUpdatedWorkflowCallback() + +> **OnUpdatedWorkflowCallback** = (`event`: `object`) => `void` + +Callback function called when a workflow is updated. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `event` | \{ `workflow`: [`Workflow`](#workflow); \} | +| `event.workflow` | [`Workflow`](#workflow) | + +#### Returns + +`void` + +*** + +### Workflow + +> **Workflow** = `object` + +A workflow + +#### Properties + +##### description + +> **description**: `string` + +##### id + +> **id**: `string` + +##### kind + +> **kind**: [`WorkflowKind`](#workflowkind) + +##### name + +> **name**: `string` + +*** + +### WorkflowKind + +> **WorkflowKind** = `"Convert"` \| `"Active"` \| `"Passive"` + +The kind of workflow. + +*** + +### WorkflowSDK + +> **WorkflowSDK** = `object` + +Utilities to interact with workflows. + +#### Properties + +##### getWorkflows() + +> **getWorkflows**: () => [`Workflow`](#workflow)[] + +Get all workflows. + +###### Returns + +[`Workflow`](#workflow)[] + +All workflows. + +##### onCreatedWorkflow() + +> **onCreatedWorkflow**: (`callback`: [`OnCreatedWorkflowCallback`](#oncreatedworkflowcallback)) => [`ListenerHandle`](utils.md#listenerhandle) + +Register a callback to be called when a workflow is created. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `callback` | [`OnCreatedWorkflowCallback`](#oncreatedworkflowcallback) | The callback to be called. | + +###### Returns + +[`ListenerHandle`](utils.md#listenerhandle) + +##### onDeletedWorkflow() + +> **onDeletedWorkflow**: (`callback`: [`OnDeletedWorkflowCallback`](#ondeletedworkflowcallback)) => [`ListenerHandle`](utils.md#listenerhandle) + +Register a callback to be called when a workflow is deleted. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `callback` | [`OnDeletedWorkflowCallback`](#ondeletedworkflowcallback) | The callback to be called. | + +###### Returns + +[`ListenerHandle`](utils.md#listenerhandle) + +##### onUpdatedWorkflow() + +> **onUpdatedWorkflow**: (`callback`: [`OnUpdatedWorkflowCallback`](#onupdatedworkflowcallback)) => [`ListenerHandle`](utils.md#listenerhandle) + +Register a callback to be called when a workflow is updated. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `callback` | [`OnUpdatedWorkflowCallback`](#onupdatedworkflowcallback) | The callback to be called. | + +###### Returns + +[`ListenerHandle`](utils.md#listenerhandle) diff --git a/src/reference/sdks/workflow/data.md b/src/reference/sdks/workflow/data.md new file mode 100644 index 0000000..345017b --- /dev/null +++ b/src/reference/sdks/workflow/data.md @@ -0,0 +1,61 @@ +# Data + +### BytesInput + +> **BytesInput** = `number`[] + +The input for the Javascript Nodes. + +*** + +### ~~ConvertInput~~ + +> **ConvertInput** = [`BytesInput`](#bytesinput) + +#### Deprecated + +Use BytesInput instead. + +*** + +### Data + +> **Data** = [`Bytes`](shared.md#bytes) + +The output for the Javascript Nodes. + +*** + +### Decision + +> **Decision** = `boolean` + +The output for the If/Else Javascript Nodes. + +*** + +### HttpInput + +> **HttpInput** = `object` + +The input for the HTTP Javascript Nodes + +#### Properties + +##### request + +> **request**: [`Request`](requests.md#request) \| `undefined` + +##### response + +> **response**: [`Response`](requests.md#response) \| `undefined` + +*** + +### ~~PassiveInput~~ + +> **PassiveInput** = [`HttpInput`](#httpinput) + +#### Deprecated + +Use HttpInput instead. diff --git a/src/reference/sdks/workflow/environment.md b/src/reference/sdks/workflow/environment.md new file mode 100644 index 0000000..e9a110f --- /dev/null +++ b/src/reference/sdks/workflow/environment.md @@ -0,0 +1,163 @@ +# Environment + +### EnvironmentSDK + +> **EnvironmentSDK** = `object` + +The SDK for the Environment service. + +#### Methods + +##### getVar() + +> **getVar**(`name`: `string`): `string` \| `undefined` + +Get the value of an environment variable. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `name` | `string` | The name of the environment variable. | + +###### Returns + +`string` \| `undefined` + +The value of the environment variable. + +##### getVars() + +> **getVars**(): [`EnvironmentVariable`](#environmentvariable)[] + +Get all the environment variables. +It includes the global environment and the selected environment. +Those variables can change over time so avoid caching them. + +###### Returns + +[`EnvironmentVariable`](#environmentvariable)[] + +An array of [EnvironmentVariable](#environmentvariable) + +##### setVar() + +> **setVar**(`input`: [`SetVarInput`](#setvarinput)): `Promise`\<`void`\> + +Sets an environment variable to a given value. +This will override any existing value. +The environment variable can be set either on the currently +selected environment or the global environment. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `input` | [`SetVarInput`](#setvarinput) | + +###### Returns + +`Promise`\<`void`\> + +###### Throws + +If trying to set when a project is not selected. + +###### Throws + +If trying to set when an environment is not selected (with `global: false`). + +###### Example + +```js +await sdk.env.setVar({ + name: "USER_SECRET", + value: "my secret value", + secret: true, + global: false +}); +``` + +*** + +### EnvironmentVariable + +> **EnvironmentVariable** = `object` + +A saved immutable Finding. + +#### Properties + +##### isSecret + +> `readonly` **isSecret**: `boolean` + +If the environment variable is a secret + +##### name + +> `readonly` **name**: `string` + +The name of the environment variable + +##### value + +> `readonly` **value**: `string` + +The value of the environment variable + +*** + +### SetVarInput + +> **SetVarInput** = `object` + +Input for the `setVar` of [EnvironmentSDK](#environmentsdk). + +#### Properties + +##### env? + +> `optional` **env**: `string` + +The `name` of the Environment to set the variable on. +This will take precedence over the `global` flag if provided. + +##### global + +> **global**: `boolean` + +If the environment variable should be set on the global +environment or the currently selected environment. +By default, it will be set globally. + +###### Default + +```ts +true +``` + +##### name + +> **name**: `string` + +Name of the environment variable + +##### secret + +> **secret**: `boolean` + +If the environment variable should be treated as secret. +Secrets are encrypted on the disk. + +###### Default + +```ts +false +``` + +##### value + +> **value**: `string` + +Value of the environment variable diff --git a/src/reference/sdks/workflow/findings.md b/src/reference/sdks/workflow/findings.md new file mode 100644 index 0000000..aaa0d59 --- /dev/null +++ b/src/reference/sdks/workflow/findings.md @@ -0,0 +1,246 @@ +# Findings + +### DedupeKey + +> **DedupeKey** = `string` & `object` + +A deduplication key. + +#### Type Declaration + +##### \_\_dedupeKey? + +> `optional` **\_\_dedupeKey**: `never` + +*** + +### Finding + +> **Finding** = `object` + +A saved immutable Finding. + +#### Methods + +##### getDedupeKey() + +> **getDedupeKey**(): [`DedupeKey`](#dedupekey) \| `undefined` + +The deduplication key of the finding. + +###### Returns + +[`DedupeKey`](#dedupekey) \| `undefined` + +##### getDescription() + +> **getDescription**(): `string` \| `undefined` + +The description of the finding. + +###### Returns + +`string` \| `undefined` + +##### getId() + +> **getId**(): [`ID`](shared.md#id) + +The unique Caido [ID](shared.md#id) of the finding. + +###### Returns + +[`ID`](shared.md#id) + +##### getReporter() + +> **getReporter**(): `string` + +The name of the reporter. + +###### Returns + +`string` + +##### getRequestId() + +> **getRequestId**(): `string` + +The ID of the associated [Request](requests.md#request). + +###### Returns + +`string` + +##### getTitle() + +> **getTitle**(): `string` + +The title of the finding. + +###### Returns + +`string` + +*** + +### FindingSpec + +> **FindingSpec** = `object` + +A mutable Finding not yet created. + +#### Properties + +##### dedupeKey? + +> `optional` **dedupeKey**: [`DedupeKey`](#dedupekey) + +Deduplication key for findings. +If a finding with the same dedupe key already exists, it will not be created. + +##### description? + +> `optional` **description**: `string` + +The description of the finding. + +##### reporter + +> **reporter**: `string` + +The name of the reporter. +It will be used to group findings. + +##### request + +> **request**: [`Request`](requests.md#request) + +The associated [Request](requests.md#request). + +##### title + +> **title**: `string` + +The title of the finding. + +*** + +### FindingsSDK + +> **FindingsSDK** = `object` + +The SDK for the Findings service. + +#### Methods + +##### create() + +> **create**(`spec`: [`FindingSpec`](#findingspec)): `Promise`\<[`Finding`](#finding)\> + +Creates a new Finding. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `spec` | [`FindingSpec`](#findingspec) | + +###### Returns + +`Promise`\<[`Finding`](#finding)\> + +###### Throws + +If the request cannot be saved. + +###### Example + +```js +await sdk.findings.create({ + title: "Title", + description: "Description", + reporter: "Reporter", + dedupeKey: `${request.getHost()}-${request.getPath()}`, + request, +}); +``` + +##### exists() + +> **exists**(`input`: [`GetFindingInput`](#getfindinginput)): `Promise`\<`boolean`\> + +Check if a [Finding](#finding) exists. +Similar to `get`, but returns a boolean. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `input` | [`GetFindingInput`](#getfindinginput) | + +###### Returns + +`Promise`\<`boolean`\> + +###### Example + +```js +await sdk.findings.exists("my-dedupe-key"); +``` + +##### get() + +> **get**(`input`: [`GetFindingInput`](#getfindinginput)): `Promise`\<[`Finding`](#finding) \| `undefined`\> + +Try to get a [Finding](#finding) for a request. + +Since a request can have multiple findings, this will return the first one found. +You can also filter by reporter to get a specific finding. + +Finally, you can use a deduplication key to get a specific finding. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `input` | [`GetFindingInput`](#getfindinginput) | + +###### Returns + +`Promise`\<[`Finding`](#finding) \| `undefined`\> + +###### Example + +```js +await sdk.findings.get({ + reporter: "Reporter", + request, +}); +``` + +*** + +### GetFindingInput + +> **GetFindingInput** = [`DedupeKey`](#dedupekey) \| \{ `reporter?`: `string`; `request`: [`Request`](requests.md#request); \} + +Input to get a [Finding](#finding). + +#### Type Declaration + +[`DedupeKey`](#dedupekey) + +\{ `reporter?`: `string`; `request`: [`Request`](requests.md#request); \} + +##### reporter? + +> `optional` **reporter**: `string` + +The name of the reporter. + +##### request + +> **request**: [`Request`](requests.md#request) + +The associated [Request](requests.md#request). diff --git a/src/reference/sdks/workflow/graphql.md b/src/reference/sdks/workflow/graphql.md new file mode 100644 index 0000000..95552f6 --- /dev/null +++ b/src/reference/sdks/workflow/graphql.md @@ -0,0 +1,118 @@ +# GraphQL + +### GraphQLError + +> **GraphQLError** = `object` + +An error from a GraphQL query. + +#### Properties + +##### extensions + +> **extensions**: `Record`\<`string`, `any`\> + +##### locations + +> **locations**: [`GraphQLLocation`](#graphqllocation)[] + +##### message + +> **message**: `string` + +##### path + +> **path**: [`GraphQLPathSegment`](#graphqlpathsegment)[] + +*** + +### GraphQLLocation + +> **GraphQLLocation** = `object` + +A location in a GraphQL query. + +#### Properties + +##### column + +> **column**: `number` + +##### line + +> **line**: `number` + +*** + +### GraphQLPathSegment + +> **GraphQLPathSegment** = `string` \| `number` + +A segment of a path in a GraphQL query. + +*** + +### GraphQLResponse + +> **GraphQLResponse**\<`T`\> = `object` + +The response from a GraphQL query. + +#### Type Parameters + +| Type Parameter | +| ------ | +| `T` | + +#### Properties + +##### data? + +> `optional` **data**: `T` + +##### errors? + +> `optional` **errors**: [`GraphQLError`](#graphqlerror)[] + +*** + +### GraphQLSDK + +> **GraphQLSDK** = `object` + +The SDK for the GraphQL service. + +#### Methods + +##### execute() + +> **execute**\<`T`\>(`query`: `string`, `variables?`: `Record`\<`string`, `any`\>): `Promise`\<[`GraphQLResponse`](#graphqlresponse)\<`T`\>\> + +Executes a GraphQL query. + +###### Type Parameters + +| Type Parameter | +| ------ | +| `T` | + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `query` | `string` | +| `variables?` | `Record`\<`string`, `any`\> | + +###### Returns + +`Promise`\<[`GraphQLResponse`](#graphqlresponse)\<`T`\>\> + +###### Example + +```js +await sdk.graphql.execute(` + query { + viewer + } +`); +``` diff --git a/src/reference/sdks/workflow/hostedfile.md b/src/reference/sdks/workflow/hostedfile.md new file mode 100644 index 0000000..aca072e --- /dev/null +++ b/src/reference/sdks/workflow/hostedfile.md @@ -0,0 +1,93 @@ +# HostedFile + +### HostedFile + +> **HostedFile** = `object` + +A hosted file. + +#### Properties + +##### id + +> **id**: `string` + +The unique Caido [ID](shared.md#id) of the project. + +##### name + +> **name**: `string` + +The name of the project. + +##### path + +> **path**: `string` + +The path of the file. + +*** + +### HostedFileSDK + +> **HostedFileSDK** = `object` + +The SDK for the HostedFile service. + +#### Methods + +##### create() + +> **create**(`spec`: [`HostedFileSpec`](#hostedfilespec)): `Promise`\<[`HostedFile`](#hostedfile)\> + +Create a hosted file. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `spec` | [`HostedFileSpec`](#hostedfilespec) | + +###### Returns + +`Promise`\<[`HostedFile`](#hostedfile)\> + +###### Example + +```js +await sdk.hostedFile.create({ name: "My File", content: "Hello, world!" }); +``` + +##### getAll() + +> **getAll**(): `Promise`\<[`HostedFile`](#hostedfile)[]\> + +Get all hosted files. + +###### Returns + +`Promise`\<[`HostedFile`](#hostedfile)[]\> + +###### Example + +```js +await sdk.hostedFile.getAll(); +``` + +*** + +### HostedFileSpec + +> **HostedFileSpec** = `object` + +A specification for creating a hosted file. + +#### Properties + +##### content + +> **content**: [`Bytes`](shared.md#bytes) + +##### name + +> **name**: `string` diff --git a/src/reference/sdks/workflow/index.md b/src/reference/sdks/workflow/index.md index d866f4e..74c73da 100644 --- a/src/reference/sdks/workflow/index.md +++ b/src/reference/sdks/workflow/index.md @@ -1,21 +1,18 @@ # @caido/sdk-workflow -This is the reference for the workflow SDK used by JS Nodes. -[SDK](#sdk-1) is the main interface that provides access to various services and functionalities. - ## SDK ### SDK -> **SDK**: `object` +> **SDK** = `object` The SDK object available to all scripts. -#### Type declaration +#### Properties ##### console -> **console**: [`Console`](index.md#console) +> **console**: [`Console`](other.md#console) The console for logging. @@ -23,54 +20,64 @@ This is currently the same as the global `console`. ##### env -> **env**: [`EnvironmentSDK`](index.md#environmentsdk) +> **env**: [`EnvironmentSDK`](environment.md#environmentsdk) The SDK for the Environment service. ##### findings -> **findings**: [`FindingsSDK`](index.md#findingssdk) +> **findings**: [`FindingsSDK`](findings.md#findingssdk) The SDK for the Findings service. ##### graphql -> **graphql**: [`GraphQLSDK`](index.md#graphqlsdk) +> **graphql**: [`GraphQLSDK`](graphql.md#graphqlsdk) The SDK for the GraphQL service. +##### hostedFile + +> **hostedFile**: [`HostedFileSDK`](hostedfile.md#hostedfilesdk) + +The SDK for the HostedFile service. + ##### projects -> **projects**: [`ProjectsSDK`](index.md#projectssdk) +> **projects**: [`ProjectsSDK`](projects.md#projectssdk) The SDK for the Projects service. ##### replay -> **replay**: [`ReplaySDK`](index.md#replaysdk) +> **replay**: [`ReplaySDK`](replay.md#replaysdk) The SDK for the Replay service. ##### requests -> **requests**: [`RequestsSDK`](index.md#requestssdk) +> **requests**: [`RequestsSDK`](requests.md#requestssdk) The SDK for the Requests service. ##### runtime -> **runtime**: [`RuntimeSDK`](index.md#runtimesdk) +> **runtime**: [`RuntimeSDK`](runtime.md#runtimesdk) The SDK for the runtime information. ##### scope -> **scope**: [`ScopeSDK`](index.md#scopesdk) +> **scope**: [`ScopeSDK`](scope.md#scopesdk) The SDK for the Scope service. +#### Methods + ##### asString() +> **asString**(`array`: [`Bytes`](shared.md#bytes)): `string` + Converts bytes to a string. Unprintable characters will be replaced with `�`. @@ -79,7 +86,7 @@ Unprintable characters will be replaced with `�`. | Parameter | Type | | ------ | ------ | -| `array` | [`Bytes`](index.md#bytes) | +| `array` | [`Bytes`](shared.md#bytes) | ###### Returns @@ -95,2477 +102,17 @@ export function run(input, sdk) { } ``` -## Data - -### BytesInput - -> **BytesInput**: `number`[] - -The input for the Javascript Nodes. - -*** - -### ~~ConvertInput~~ - -> **ConvertInput**: [`BytesInput`](index.md#bytesinput) - -#### Deprecated - -Use BytesInput instead. - -*** - -### Data - -> **Data**: [`Bytes`](index.md#bytes) - -The output for the Javascript Nodes. - -*** - -### Decision - -> **Decision**: `boolean` - -The output for the If/Else Javascript Nodes. - -*** - -### HttpInput - -> **HttpInput**: `object` - -The input for the HTTP Javascript Nodes - -#### Type declaration - -##### request - -> **request**: [`Request`](index.md#request-2) \| `undefined` - -##### response - -> **response**: [`Response`](index.md#response-5) \| `undefined` - -*** - -### ~~PassiveInput~~ - -> **PassiveInput**: [`HttpInput`](index.md#httpinput) - -#### Deprecated - -Use HttpInput instead. - -## Requests - -### Body - -The body of a [Request](index.md#request-2) or [Response](index.md#response-5). - -Calling `to` will try to convert the body to the desired format. - -#### Constructors - -##### new Body() - -> **new Body**(`data`: `string` \| `number`[] \| `Uint8Array`): [`Body`](index.md#body) - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `data` | `string` \| `number`[] \| `Uint8Array` | - -###### Returns - -[`Body`](index.md#body) - -#### Properties - -##### length - -> `readonly` **length**: `number` - -The length of the body in bytes. - -#### Methods - -##### toJson() - -> **toJson**(): `unknown` - -Try to parse the body as JSON. - -###### Returns - -`unknown` - -###### Throws - -If the body is not valid JSON. - -##### toRaw() - -> **toRaw**(): `Uint8Array` - -Get the raw body as an array of bytes. - -###### Returns - -`Uint8Array` - -##### toText() - -> **toText**(): `string` - -Parse the body as a string. - -Unprintable characters will be replaced with `�`. - -###### Returns - -`string` - -*** - -### RequestSpec - -A mutable Request that has not yet been sent. - -#### Constructors - -##### new RequestSpec() - -> **new RequestSpec**(`url`: `string`): [`RequestSpec`](index.md#requestspec) - -Build a new [RequestSpec](index.md#requestspec) from a URL string. -We try to infer as much information as possible from the URL, including the scheme, host, path and query. - -You can convert a saved immutable [Request](index.md#request-2) object into a [RequestSpec](index.md#requestspec) object by using the `toSpec()` method. - -By default: - -- Method is `GET`. -- Path is `/`. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `url` | `string` | - -###### Returns - -[`RequestSpec`](index.md#requestspec) - -###### Throws - -If the URL is invalid. - -###### Example - -```js -const spec = new RequestSpec("https://example.com"); -``` - -#### Methods - -##### getBody() - -> **getBody**(): `undefined` \| [`Body`](index.md#body) - -The body of the request. - -###### Returns - -`undefined` \| [`Body`](index.md#body) - -##### getHeader() - -> **getHeader**(`name`: `string`): `undefined` \| `string`[] - -Get a header value. - -Header name is case-insensitive. -The header might have multiple values. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `name` | `string` | - -###### Returns - -`undefined` \| `string`[] - -##### getHeaders() - -> **getHeaders**(): `Record`\<`string`, `string`[]\> - -The headers of the request. - -Header names are case-insensitive. -Each header might have multiple values. - -###### Returns - -`Record`\<`string`, `string`[]\> - -###### Example - -```json -{ - "Host": ["caido.io"], - "Connection": ["keep-alive"], - "Content-Length": ["95"] -} -``` - -##### getHost() - -> **getHost**(): `string` - -Get the host of the request. - -###### Returns - -`string` - -##### getMethod() - -###### Call Signature - -> **getMethod**(): `string` - -Get the HTTP method of the request. - -Get the raw version by passing `{ raw: true }` in the options. - -###### Returns - -`string` - -###### Call Signature - -> **getMethod**(`options`: [`RawOption`](index.md#rawoption)): `Uint8Array` - -Get the HTTP method of the request. - -Get the raw version by passing `{ raw: true }` in the options. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `options` | [`RawOption`](index.md#rawoption) | - -###### Returns - -`Uint8Array` - -##### getPath() - -###### Call Signature - -> **getPath**(): `string` - -Get the path of the request. - -Get the raw version by passing `{ raw: true }` in the options. - -###### Returns - -`string` - -###### Call Signature - -> **getPath**(`options`: [`RawOption`](index.md#rawoption)): `Uint8Array` - -Get the path of the request. - -Get the raw version by passing `{ raw: true }` in the options. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `options` | [`RawOption`](index.md#rawoption) | - -###### Returns - -`Uint8Array` - -##### getPort() - -> **getPort**(): `number` - -Get the port of the request. - -###### Returns - -`number` - -##### getQuery() - -###### Call Signature - -> **getQuery**(): `string` - -Get the unparsed query of the request. - -Get the raw version by passing `{ raw: true }` in the options. - -Excludes the leading `?`. - -###### Returns - -`string` - -###### Call Signature - -> **getQuery**(`options`: [`RawOption`](index.md#rawoption)): `Uint8Array` - -Get the unparsed query of the request. - -Get the raw version by passing `{ raw: true }` in the options. - -Excludes the leading `?`. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `options` | [`RawOption`](index.md#rawoption) | - -###### Returns - -`Uint8Array` - -##### getRaw() - -> **getRaw**(): [`RequestSpecRaw`](index.md#requestspecraw) - -This methods converts the [RequestSpec](index.md#requestspec) to a [RequestSpecRaw](index.md#requestspecraw). - -This is useful to retrieve the raw bytes of the request. - -###### Returns - -[`RequestSpecRaw`](index.md#requestspecraw) - -###### Example - -```js -const spec = new RequestSpec("https://example.com"); -const specRaw = spec.getRaw(); -const bytes = specRaw.getRaw(); // GET / HTTP/1.1\r\nHost: example.com\r\n\r\n -``` - -##### getTls() - -> **getTls**(): `boolean` - -Get if the request uses TLS (HTTPS). - -###### Returns - -`boolean` - -##### removeHeader() - -> **removeHeader**(`name`: `string`): `void` - -Removes a header. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `name` | `string` | - -###### Returns - -`void` - -##### setBody() - -> **setBody**(`body`: [`Bytes`](index.md#bytes) \| [`Body`](index.md#body), `options`?: [`SetBodyOptions`](index.md#setbodyoptions)): `void` - -Set the body of the request. - -The body can either be a [Body](index.md#body) or any type that can be converted to [Bytes](index.md#bytes). - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `body` | [`Bytes`](index.md#bytes) \| [`Body`](index.md#body) | -| `options`? | [`SetBodyOptions`](index.md#setbodyoptions) | - -###### Returns - -`void` - -###### Example - -```js -const body = new Body("Hello world."); -const options = { updateContentLength: true }; -request.setBody(body, options); -``` - -##### setHeader() - -> **setHeader**(`name`: `string`, `value`: `string`): `void` - -Set a header value. - -This will overwrite any existing values. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `name` | `string` | -| `value` | `string` | - -###### Returns - -`void` - -##### setHost() - -> **setHost**(`host`: `string`): `void` - -Set the host of the request. - -It will also update the `Host` header. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `host` | `string` | - -###### Returns - -`void` - -##### setMethod() - -> **setMethod**(`method`: [`Bytes`](index.md#bytes)): `void` - -Set the HTTP method of the request. - -All strings are accepted. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `method` | [`Bytes`](index.md#bytes) | - -###### Returns - -`void` - -##### setPath() - -> **setPath**(`path`: [`Bytes`](index.md#bytes)): `void` - -Set the path of the request. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `path` | [`Bytes`](index.md#bytes) | - -###### Returns - -`void` - -##### setPort() - -> **setPort**(`port`: `number`): `void` - -Set the port of the request. - -The port number must be between 1 and 65535. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `port` | `number` | - -###### Returns - -`void` - -##### setQuery() - -> **setQuery**(`query`: [`Bytes`](index.md#bytes)): `void` - -Set the unparsed query of the request. - -The query string should not include the leading `?`. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `query` | [`Bytes`](index.md#bytes) | - -###### Returns - -`void` - -###### Example - -```js -spec.setQuery("q=hello"); -``` - -##### setRaw() - -> **setRaw**(`raw`: [`Bytes`](index.md#bytes)): [`RequestSpecRaw`](index.md#requestspecraw) - -This method sets the raw [Bytes](index.md#bytes) of the request and converts it to a [RequestSpecRaw](index.md#requestspecraw). - -This is useful when you have a prepared [RequestSpec](index.md#requestspec) and you just want to modify the raw data. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `raw` | [`Bytes`](index.md#bytes) | - -###### Returns - -[`RequestSpecRaw`](index.md#requestspecraw) - -###### Example - -```js -const rawBytes = []; // RAW BYTES HERE -const request = new RequestSpec("https://example.com"); -const rawRequest = request.setRaw(rawBytes); -``` - -##### setTls() - -> **setTls**(`tls`: `boolean`): `void` - -Set if the request uses TLS (HTTPS). - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `tls` | `boolean` | - -###### Returns - -`void` - -##### parse() - -###### Call Signature - -> `static` **parse**(`bytes`: [`Bytes`](index.md#bytes)): [`RequestSpec`](index.md#requestspec) - -Parses raw bytes into a [RequestSpec](index.md#requestspec). - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `bytes` | [`Bytes`](index.md#bytes) | - -###### Returns - -[`RequestSpec`](index.md#requestspec) - -###### Throws - -If the bytes are not a valid HTTP request. - -###### Example - -```js -const rawInput = 'GET / HTTP/1.1\r\nHost: example.com\r\n\r\n'; -const spec = RequestSpec.parse(rawInput); -spec.setHeader('x-caido', 'test'); -const specRaw = spec.getRaw(); -const rawOutput = specRaw.getRaw(); // Will contain the new header -``` - -###### Call Signature - -> `static` **parse**(`raw`: [`RequestSpecRaw`](index.md#requestspecraw)): [`RequestSpec`](index.md#requestspec) - -Parses the raw bytes of a [RequestSpecRaw](index.md#requestspecraw) into a [RequestSpec](index.md#requestspec). - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `raw` | [`RequestSpecRaw`](index.md#requestspecraw) | - -###### Returns - -[`RequestSpec`](index.md#requestspec) - -###### Throws - -If the bytes are not a valid HTTP request. - -*** - -### RequestSpecRaw - -A mutable raw Request that has not yet been sent. - -#### Constructors - -##### new RequestSpecRaw() - -> **new RequestSpecRaw**(`url`: `string`): [`RequestSpecRaw`](index.md#requestspecraw) - -Build a new [RequestSpecRaw](index.md#requestspecraw) from a URL string. Only the host, port and scheme will be parsed. - -You can convert a saved immutable [Request](index.md#request-2) object into a [RequestSpecRaw](index.md#requestspecraw) object by using the `toSpecRaw()` method. - -You MUST use `setRaw` to set the raw bytes of the request. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `url` | `string` | - -###### Returns - -[`RequestSpecRaw`](index.md#requestspecraw) - -###### Example - -```js -const spec = new RequestSpecRaw("https://example.com"); -``` - -#### Methods - -##### getHost() - -> **getHost**(): `string` - -Get the host of the request. - -###### Returns - -`string` - -##### getPort() - -> **getPort**(): `number` - -Get the port of the request. - -###### Returns - -`number` - -##### getRaw() - -> **getRaw**(): `Uint8Array` - -Get the raw bytes of the request. - -###### Returns - -`Uint8Array` - -##### getSpec() - -> **getSpec**(): [`RequestSpec`](index.md#requestspec) - -This methods converts the [RequestSpecRaw](index.md#requestspecraw) to a [RequestSpec](index.md#requestspec). - -###### Returns - -[`RequestSpec`](index.md#requestspec) - -###### Throws - -If the bytes are not a valid HTTP request. - -###### See - -[RequestSpec.parse](index.md#parse) - -##### getTls() - -> **getTls**(): `boolean` - -Get if the request uses TLS (HTTPS). - -###### Returns - -`boolean` - -##### setHost() - -> **setHost**(`host`: `string`): `void` - -Set the host of the request. - -It will NOT update the `Host` header. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `host` | `string` | - -###### Returns - -`void` - -##### setPort() - -> **setPort**(`port`: `number`): `void` - -Set the port of the request. - -The port number must be between 1 and 65535. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `port` | `number` | - -###### Returns - -`void` - -##### setRaw() - -> **setRaw**(`raw`: [`Bytes`](index.md#bytes)): `void` - -Set the raw [Bytes](index.md#bytes) of the request. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `raw` | [`Bytes`](index.md#bytes) | - -###### Returns - -`void` - -##### setTls() - -> **setTls**(`tls`: `boolean`): `void` - -Set if the request uses TLS (HTTPS). - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `tls` | `boolean` | - -###### Returns - -`void` - -*** - -### Request - -> **Request**: `object` - -An immutable saved Request. - -To modify, use `toSpec` to get a `RequestSpec` object. - -#### Type declaration - -##### getBody() - -The body of the request. - -###### Returns - -`undefined` \| [`Body`](index.md#body) - -##### getCreatedAt() - -The datetime the request was recorded by the proxy. - -###### Returns - -`Date` - -##### getHeader() - -Get a header value. - -Header name is case-insensitive. -The header might have multiple values. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `name` | `string` | - -###### Returns - -`undefined` \| `string`[] - -##### getHeaders() - -The headers of the request. - -Header names are case-insensitive. -Each header might have multiple values. - -###### Returns - -`Record`\<`string`, `string`[]\> - -###### Example - -```json -{ - "Host": ["caido.io"], - "Connection": ["keep-alive"], - "Content-Length": ["95"] -} -``` - -##### getHost() - -The target host of the request. - -###### Returns - -`string` - -##### getId() - -The unique Caido [ID](index.md#id) of the request. - -###### Returns - -[`ID`](index.md#id) - -##### getMethod() - -The HTTP method of the request. - -###### Returns - -`string` - -##### getPath() - -The path of the request. - -###### Returns - -`string` - -##### getPort() - -The target port of the request. - -###### Returns - -`number` - -##### getQuery() - -The unparsed query of the request. - -Excludes the leading `?`. - -###### Returns - -`string` - -##### getRaw() - -The raw version of the request. - -Used to access the bytes directly. - -###### Returns - -[`RequestRaw`](index.md#requestraw) - -##### getTls() - -If the request uses TLS (HTTPS). - -###### Returns - -`boolean` - -##### getUrl() - -The full URL of the request. - -###### Returns - -`string` - -##### toSpec() - -Copied the request to a mutable un-saved [RequestSpec](index.md#requestspec). -This enables you to make modify a request before re-sending it. - -###### Returns - -[`RequestSpec`](index.md#requestspec) - -##### toSpecRaw() - -Copied the request to a mutable un-saved [RequestSpecRaw](index.md#requestspecraw). -The raw requests are not parsed and can be used to send invalid HTTP Requests. - -###### Returns - -[`RequestSpecRaw`](index.md#requestspecraw) - -*** - -### RequestOrderField - -> **RequestOrderField**: `"ext"` \| `"host"` \| `"id"` \| `"method"` \| `"path"` \| `"query"` \| `"created_at"` \| `"source"` - -Field to order requests by. - -*** - -### RequestRaw - -> **RequestRaw**: `object` - -An immutable saved raw Request. - -#### Type declaration - -##### toBytes() - -Get the raw request as an array of bytes. - -###### Returns - -`Uint8Array` - -##### toText() - -Parse the raw request as a string. - -Unprintable characters will be replaced with `�`. - -###### Returns - -`string` - -*** - -### RequestResponse - -> **RequestResponse**: `object` - -An immutable saved Request and Response pair. - -#### Type declaration - -##### request - -> **request**: [`Request`](index.md#request-2) - -##### response - -> **response**: [`Response`](index.md#response-5) - -*** - -### RequestResponseOpt - -> **RequestResponseOpt**: `object` - -An immutable saved Request and optional Response pair. - -#### Type declaration - -##### request - -> **request**: [`Request`](index.md#request-2) - -##### response? - -> `optional` **response**: [`Response`](index.md#response-5) - -*** - -### RequestsConnection - -> **RequestsConnection**: `object` - -A connection of requests. - -#### Type declaration - -##### items - -> **items**: [`RequestsConnectionItem`](index.md#requestsconnectionitem)[] - -##### pageInfo - -> **pageInfo**: [`PageInfo`](index.md#pageinfo) - -*** - -### RequestsConnectionItem - -> **RequestsConnectionItem**: `object` - -An item in a connection of requests. - -#### Type declaration - -##### cursor - -> **cursor**: [`Cursor`](index.md#cursor) - -##### request - -> **request**: [`Request`](index.md#request-2) - -##### response? - -> `optional` **response**: [`Response`](index.md#response-5) - -*** - -### RequestSendTimeouts - -> **RequestSendTimeouts**: `object` - -Timeouts for sending a request and receiving a response. - -#### Type declaration - -##### connect? - -> `optional` **connect**: `number` - -The timeout to open the TCP connection to the target host -and perform the TLS handshake. - -Defaults to 30s. - -##### extra? - -> `optional` **extra**: `number` - -The timeout to read data after we have a read the full response. - -This is useful if you believe the server will send more data -than implied by the Content-Length header. - -Defaults to 0s (no timeout). - -##### global? - -> `optional` **global**: `number` - -The global timeout for sending a request and receiving a response. - -No default value. - -##### partial? - -> `optional` **partial**: `number` - -The timeout between each read attempt for the response. -On a slow connection, this is important to increase. - -Defaults to 5s. - -##### response? - -> `optional` **response**: `number` - -The timeout to receive the first byte of the response. - -After the first byte is received, the partial timeout will be used. - -Defaults to 30s. - -*** - -### RequestsQuery - -> **RequestsQuery**: `object` - -Query builder to fetch requests. - -#### Type declaration - -##### after() - -Requests after a given cursor. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `cursor` | [`Cursor`](index.md#cursor) | [Cursor](index.md#cursor) of the request | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -##### ascending() - -###### Call Signature - -Ascending ordering. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `target` | `"req"` | Target of the ordering: req or resp. | -| `field` | [`RequestOrderField`](index.md#requestorderfield) | Field to order by. | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -###### Call Signature - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `target` | `"resp"` | -| `field` | [`ResponseOrderField`](index.md#responseorderfield) | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -##### before() - -Requests before a given cursor. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `cursor` | [`Cursor`](index.md#cursor) | [Cursor](index.md#cursor) of the request | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -##### descending() - -###### Call Signature - -Descending ordering. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `target` | `"req"` | Target of the ordering: req or resp. | -| `field` | [`RequestOrderField`](index.md#requestorderfield) | Field to order by. | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -###### Call Signature - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `target` | `"resp"` | -| `field` | [`ResponseOrderField`](index.md#responseorderfield) | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -##### execute() - -Execute the query. - -###### Returns - -`Promise`\<[`RequestsConnection`](index.md#requestsconnection)\> - -###### Throws - -If a query parameter is invalid or the query cannot be executed. - -##### filter() - -Filter requests. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `filter` | `string` | HTTPQL filter | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -##### first() - -First n requests. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `n` | `number` | Number of requests to return | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -##### last() - -Last n requests. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `n` | `number` | Number of requests to return | - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -*** - -### RequestsSDK - -> **RequestsSDK**: `object` - -The SDK for the Requests service. - -#### Type declaration - -##### get() - -Get a request by its unique [ID](index.md#id). - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `id` | [`ID`](index.md#id) | - -###### Returns - -`Promise`\<`undefined` \| [`RequestResponseOpt`](index.md#requestresponseopt)\> - -###### Example - -```js -await sdk.requests.get("1"); -``` - -##### inScope() - -Checks if a request is in scope. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `request` | [`Request`](index.md#request-2) \| [`RequestSpec`](index.md#requestspec) | - -###### Returns - -`boolean` - -###### Example - -```js -if (sdk.requests.inScope(request)) { - sdk.console.log("In scope"); -} -``` - -##### matches() - -Checks if a request/response matches an HTTPQL filter. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `filter` | `string` | HTTPQL filter | -| `request` | [`Request`](index.md#request-2) | The [Request](index.md#request-2) to match against | -| `response`? | [`Response`](index.md#response-5) | The [Response](index.md#response-5) to match against | - -###### Returns - -`boolean` - -##### query() - -Query requests of the current project. - -###### Returns - -[`RequestsQuery`](index.md#requestsquery) - -###### Example - -```js -const page = await sqk.requests.query().first(2).execute(); -sdk.console.log(`ID: ${page.items[1].request.getId()}`); -``` - -##### send() - -Sends an HTTP request, either a [RequestSpec](index.md#requestspec) or [RequestSpecRaw](index.md#requestspecraw). - -This respects the upstream proxy settings. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `request` | [`RequestSpec`](index.md#requestspec) \| [`RequestSpecRaw`](index.md#requestspecraw) | -| `options`? | [`RequestSendOptions`](index.md#requestsendoptions) | - -###### Returns - -`Promise`\<[`RequestResponse`](index.md#requestresponse)\> - -###### Throws - -If the request cannot be sent. -If the request times out, the error message will contain the word "Timeout". - -###### Example - -```js -const spec = new RequestSpec("https://example.com"); -try { - const res = await sdk.requests.send(request) - sdk.console.log(res.request.getId()); - sdk.console.log(res.response.getCode()); -} catch (err) { - sdk.console.error(err); -} -``` - -*** - -### Response - -> **Response**: `object` - -An immutable saved Response. - -#### Type declaration - -##### getBody() - -The body of the response - -###### Returns - -`undefined` \| [`Body`](index.md#body) - -##### getCode() - -The status code of the response. - -###### Returns - -`number` - -##### getCreatedAt() - -The datetime the response was recorded by the proxy. - -###### Returns - -`Date` - -##### getHeader() - -Get a header value. - -Header name is case-insensitive. -The header might have multiple values. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `name` | `string` | - -###### Returns - -`undefined` \| `string`[] - -##### getHeaders() - -The headers of the response. - -Header names are case-insensitive. -Each header might have multiple values. - -###### Returns - -`Record`\<`string`, `string`[]\> - -###### Example - -```json -{ - "Date": ["Sun, 26 May 2024 10:59:21 GMT"], - "Content-Type": ["text/html"] -} -``` - -##### getId() - -The unique Caido [ID](index.md#id) of the response. - -###### Returns - -[`ID`](index.md#id) - -##### getRaw() - -The raw version of the response. - -Used to access the bytes directly. - -###### Returns - -[`ResponseRaw`](index.md#responseraw) - -##### getRoundtripTime() - -The time it took to send the request and receive the response in milliseconds. - -###### Returns - -`number` - -*** - -### ResponseOrderField - -> **ResponseOrderField**: `"length"` \| `"roundtrip"` \| `"code"` - -Field to order responses by. - -*** - -### ResponseRaw - -> **ResponseRaw**: `object` - -An immutable saved raw Response. - -#### Type declaration - -##### toBytes() - -Get the raw response as an array of bytes. - -###### Returns - -`Uint8Array` - -##### toText() - -Parse the raw response as a string. - -Unprintable characters will be replaced with `�`. - -###### Returns - -`string` - -*** - -### SetBodyOptions - -> **SetBodyOptions**: `object` - -Options when setting the body of a Request. - -#### Type declaration - -##### updateContentLength - -> **updateContentLength**: `boolean` - -Should update the Content-export type header. - -###### Default - -```ts -true -``` - -## Findings - -### DedupeKey - -> **DedupeKey**: `string` & `object` - -A deduplication key. - -#### Type declaration - -##### \_\_dedupeKey? - -> `optional` **\_\_dedupeKey**: `never` - -*** - -### Finding - -> **Finding**: `object` - -A saved immutable Finding. - -#### Type declaration - -##### getDedupeKey() - -The deduplication key of the finding. - -###### Returns - -`undefined` \| [`DedupeKey`](index.md#dedupekey) - -##### getDescription() - -The description of the finding. - -###### Returns - -`undefined` \| `string` - -##### getId() - -The unique Caido [ID](index.md#id) of the finding. - -###### Returns - -[`ID`](index.md#id) - -##### getReporter() - -The name of the reporter. - -###### Returns - -`string` - -##### getRequestId() - -The ID of the associated [Request](index.md#request-2). - -###### Returns - -`string` - -##### getTitle() - -The title of the finding. - -###### Returns - -`string` - -*** - -### FindingSpec - -> **FindingSpec**: `object` - -A mutable Finding not yet created. - -#### Type declaration - -##### dedupeKey? - -> `optional` **dedupeKey**: [`DedupeKey`](index.md#dedupekey) - -Deduplication key for findings. -If a finding with the same dedupe key already exists, it will not be created. - -##### description? - -> `optional` **description**: `string` - -The description of the finding. - -##### reporter - -> **reporter**: `string` - -The name of the reporter. -It will be used to group findings. - -##### request - -> **request**: [`Request`](index.md#request-2) - -The associated [Request](index.md#request-2). - -##### title - -> **title**: `string` - -The title of the finding. - -*** - -### FindingsSDK - -> **FindingsSDK**: `object` - -The SDK for the Findings service. - -#### Type declaration - -##### create() - -Creates a new Finding. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `spec` | [`FindingSpec`](index.md#findingspec) | - -###### Returns - -`Promise`\<[`Finding`](index.md#finding)\> - -###### Throws - -If the request cannot be saved. - -###### Example - -```js -await sdk.findings.create({ - title: "Title", - description: "Description", - reporter: "Reporter", - dedupeKey: `${request.getHost()}-${request.getPath()}`, - request, -}); -``` - -##### exists() - -Check if a [Finding](index.md#finding) exists. -Similar to `get`, but returns a boolean. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `input` | [`GetFindingInput`](index.md#getfindinginput) | - -###### Returns - -`Promise`\<`boolean`\> - -###### Example - -```js -await sdk.findings.exists("my-dedupe-key"); -``` - -##### get() - -Try to get a [Finding](index.md#finding) for a request. - -Since a request can have multiple findings, this will return the first one found. -You can also filter by reporter to get a specific finding. - -Finally, you can use a deduplication key to get a specific finding. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `input` | [`GetFindingInput`](index.md#getfindinginput) | - -###### Returns - -`Promise`\<`undefined` \| [`Finding`](index.md#finding)\> - -###### Example - -```js -await sdk.findings.get({ - reporter: "Reporter", - request, -}); -``` - -*** - -### GetFindingInput - -> **GetFindingInput**: [`DedupeKey`](index.md#dedupekey) \| \{ `reporter`: `string`; `request`: [`Request`](index.md#request-2); \} - -Input to get a [Finding](index.md#finding). - -#### Type declaration - -[`DedupeKey`](index.md#dedupekey) - -\{ `reporter`: `string`; `request`: [`Request`](index.md#request-2); \} - -##### reporter? - -> `optional` **reporter**: `string` - -The name of the reporter. - -##### request - -> **request**: [`Request`](index.md#request-2) - -The associated [Request](index.md#request-2). - -## Replay - -### ReplayCollection - -> **ReplayCollection**: `object` - -A collection of replay sessions. - -#### Type declaration - -##### getId() - -The unique Caido [ID](index.md#id) of the replay collection. - -###### Returns - -[`ID`](index.md#id) - -##### getName() - -The name of the replay collection. - -###### Returns - -`string` - -*** - -### ReplaySDK - -> **ReplaySDK**: `object` - -The SDK for the Replay service. - -#### Type declaration - -##### createSession() - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `source`? | [`RequestSource`](index.md#requestsource) | -| `collection`? | [`ID`](index.md#id) \| [`ReplayCollection`](index.md#replaycollection) | - -###### Returns - -`Promise`\<[`ReplaySession`](index.md#replaysession)\> - -##### getCollections() - -###### Returns - -`Promise`\<[`ReplayCollection`](index.md#replaycollection)[]\> - -*** - -### ReplaySession - -> **ReplaySession**: `object` - -A replay session. - -#### Type declaration - -##### getId() - -The unique Caido [ID](index.md#id) of the replay session. - -###### Returns - -[`ID`](index.md#id) - -##### getName() - -The name of the replay session. - -###### Returns - -`string` - -## Projects - -### Project - -> **Project**: `object` - -A saved immutable Project. - -#### Type declaration - -##### getId() - -The unique Caido [ID](index.md#id) of the project. - -###### Returns - -[`ID`](index.md#id) - -##### getName() - -The name of the project. - -###### Returns - -`string` - -##### getPath() - -The directory where the project is located. - -###### Returns - -`string` - -##### getStatus() - -The status of the project. - -###### Returns - -[`ProjectStatus`](index.md#projectstatus) - -##### getVersion() - -The version of the project. -The format is `MAJOR.MINOR.PATCH`. - -###### Returns - -`string` - -*** - -### ProjectsSDK - -> **ProjectsSDK**: `object` - -The SDK for the Projects service. - -#### Type declaration - -##### getCurrent() - -Get the currently selected [Project](index.md#project) if any. - -###### Returns - -`Promise`\<`undefined` \| [`Project`](index.md#project)\> - -###### Example - -```js -await sdk.projects.getCurrent(); -``` - -*** - -### ProjectStatus - -> **ProjectStatus**: `"ready"` \| `"restoring"` \| `"error"` - -A [Project](index.md#project) status. - -## Shared - -### Bytes - -> **Bytes**: `string` \| `number`[] \| `Uint8Array` - -Types that can be converted to bytes in inputs. - -*** - -### Cursor - -> **Cursor**: `string` & `object` - -A cursor for pagination. - -#### Type declaration - -##### \_\_cursor? - -> `optional` **\_\_cursor**: `never` - -*** - -### ID - -> **ID**: `string` & `object` - -A unique identifier. - -#### Type declaration - -##### \_\_id? - -> `optional` **\_\_id**: `never` - -*** - -### RawOption - -> **RawOption**: `object` - -Option to return raw value - -#### Type declaration - -##### raw - -> **raw**: `true` - -*** - -### RequestSource - -> **RequestSource**: [`ID`](index.md#id) \| [`Request`](index.md#request-2) \| [`RequestSpec`](index.md#requestspec) \| [`RequestSpecRaw`](index.md#requestspecraw) - -The source of a request. - -## Environment - -### EnvironmentSDK - -> **EnvironmentSDK**: `object` - -The SDK for the Environment service. - -#### Type declaration - -##### getVar() - -Get the value of an environment variable. - -###### Parameters - -| Parameter | Type | Description | -| ------ | ------ | ------ | -| `name` | `string` | The name of the environment variable. | - -###### Returns - -`undefined` \| `string` - -The value of the environment variable. - -##### getVars() - -Get all the environment variables. -It includes the global environment and the selected environment. -Those variables can change over time so avoid caching them. - -###### Returns - -[`EnvironmentVariable`](index.md#environmentvariable)[] - -An array of [EnvironmentVariable](index.md#environmentvariable) - -##### setVar() - -Sets an environment variable to a given value. -This will override any existing value. -The environment variable can be set either on the currently -selected environment or the global environment. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `input` | [`SetVarInput`](index.md#setvarinput) | - -###### Returns - -`Promise`\<`void`\> - -###### Throws - -If trying to set when a project is not selected. - -###### Throws - -If trying to set when an environment is not selected (with `global: false`). - -###### Example - -```js -await sdk.env.setVar({ - name: "USER_SECRET", - value: "my secret value", - secret: true, - global: false -}); -``` - -*** - -### EnvironmentVariable - -> **EnvironmentVariable**: `object` - -A saved immutable Finding. - -#### Type declaration - -##### isSecret - -> `readonly` **isSecret**: `boolean` - -If the environment variable is a secret - -##### name - -> `readonly` **name**: `string` - -The name of the environment variable - -##### value - -> `readonly` **value**: `string` - -The value of the environment variable - -*** - -### SetVarInput - -> **SetVarInput**: `object` - -Input for the `setVar` of [EnvironmentSDK](index.md#environmentsdk). - -#### Type declaration - -##### env? - -> `optional` **env**: `string` - -The `name` of the Environment to set the variable on. -This will take precedence over the `global` flag if provided. - -##### global - -> **global**: `boolean` - -If the environment variable should be set on the global -environment or the currently selected environment. -By default, it will be set globally. - -###### Default - -```ts -true -``` - -##### name - -> **name**: `string` - -Name of the environment variable - -##### secret - -> **secret**: `boolean` - -If the environment variable should be treated as secret. -Secrets are encrypted on the disk. - -###### Default - -```ts -false -``` - -##### value - -> **value**: `string` - -Value of the environment variable - -## GraphQL - -### GraphQLSDK - -> **GraphQLSDK**: `object` - -The SDK for the GraphQL service. - -#### Type declaration - -##### execute() - -Executes a GraphQL query. - -###### Type Parameters - -| Type Parameter | -| ------ | -| `T` | - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `query` | `string` | -| `variables`? | `Record`\<`string`, `any`\> | - -###### Returns - -`Promise`\<[`GraphQLResponse`](index.md#graphqlresponset)\<`T`\>\> - -###### Example - -```js -await sdk.graphql.execute(` - query { - viewer - } -`); -``` - -## Other - -### Console - -> **Console**: `object` - -Console interface for logging. - -Currently logs are only available in the backend logs. -See the [documentation](https://docs.caido.io/report_bug.html#1-backend-logs) on how to retrieve them. - -#### Type declaration - -##### debug() - -Log a message with the debug level. - -Usually used for troubleshooting purposes. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `message` | `any` | - -###### Returns - -`void` - -##### error() - -Log a message with the error level. - -Usually used for critical errors. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `message` | `any` | - -###### Returns - -`void` - -##### log() - -Log a message with the info level. - -Usually used for general information. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `message` | `any` | - -###### Returns - -`void` - -##### warn() - -Log a message with the warn level. - -Usually used for unexpected behaviors. - -###### Parameters - -| Parameter | Type | -| ------ | ------ | -| `message` | `any` | - -###### Returns - -`void` - -*** - -### GraphQLError - -> **GraphQLError**: `object` - -#### Type declaration - -##### extensions - -> **extensions**: `Record`\<`string`, `any`\> - -##### locations - -> **locations**: [`GraphQLLocation`](index.md#graphqllocation)[] - -##### message - -> **message**: `string` - -##### path - -> **path**: [`GraphQLPathSegment`](index.md#graphqlpathsegment)[] - -*** - -### GraphQLLocation - -> **GraphQLLocation**: `object` - -#### Type declaration - -##### column - -> **column**: `number` - -##### line - -> **line**: `number` - -*** - -### GraphQLPathSegment - -> **GraphQLPathSegment**: `string` \| `number` - -*** - -### GraphQLResponse\ - -> **GraphQLResponse**\<`T`\>: `object` - -#### Type Parameters - -| Type Parameter | -| ------ | -| `T` | - -#### Type declaration - -##### data? - -> `optional` **data**: `T` - -##### errors? - -> `optional` **errors**: [`GraphQLError`](index.md#graphqlerror)[] - -*** - -### PageInfo - -> **PageInfo**: `object` - -Information on the current page of paginated data. - -#### Type declaration - -##### endCursor - -> **endCursor**: [`Cursor`](index.md#cursor) - -##### hasNextPage - -> **hasNextPage**: `boolean` - -##### hasPreviousPage - -> **hasPreviousPage**: `boolean` - -##### startCursor - -> **startCursor**: [`Cursor`](index.md#cursor) - -*** - -### RequestSendOptions - -> **RequestSendOptions**: `object` - -#### Type declaration - -##### save? - -> `optional` **save**: `boolean` - -If true, the request and response will be saved to the database -and the user will see them in the Search tab. - -If you do not save, the request and response IDs will be set to 0. - -###### Default - -```ts -true -``` - -##### timeouts? - -> `optional` **timeouts**: [`RequestSendTimeouts`](index.md#requestsendtimeouts) \| `number` - -The timeouts to use for sending a request and receiving a response. - -If a number is provided, it will be used as the global timeout and -the other timeouts will be set to infinity. - -See the [RequestSendTimeouts](index.md#requestsendtimeouts) for the default values. - -## Runtime - -### RuntimeSDK - -> **RuntimeSDK**: `object` - -The SDK for the runtime information. - -#### Type declaration - -##### version - -###### Get Signature - -> **get** **version**(): `string` - -Get the current version of Caido. - -###### Returns - -`string` - -## Scope - -### Scope - -> **Scope**: `object` - -A saved immutable Scope. - -#### Type declaration - -##### allowlist - -> `readonly` **allowlist**: `string`[] - -The allowlist of the scope. - -##### denylist - -> `readonly` **denylist**: `string`[] - -The denylist of the scope. - -##### id - -> `readonly` **id**: [`ID`](index.md#id) - -The unique Caido [ID](index.md#id) of the scope. - -##### name - -> `readonly` **name**: `string` - -The name of the scope. - -*** - -### ScopeSDK - -> **ScopeSDK**: `object` - -The SDK for the Scope service. - -#### Type declaration - -##### getAll() - -Get all the scopes. - -###### Returns - -`Promise`\<[`Scope`](index.md#scope)[]\> - -An array of [Scope](index.md#scope) +## API Reference + +- [Data](data.md) +- [Requests](requests.md) +- [Findings](findings.md) +- [Replay](replay.md) +- [Projects](projects.md) +- [Shared](shared.md) +- [Environment](environment.md) +- [GraphQL](graphql.md) +- [HostedFile](hostedfile.md) +- [Other](other.md) +- [Runtime](runtime.md) +- [Scope](scope.md) diff --git a/src/reference/sdks/workflow/other.md b/src/reference/sdks/workflow/other.md new file mode 100644 index 0000000..ed4f284 --- /dev/null +++ b/src/reference/sdks/workflow/other.md @@ -0,0 +1,144 @@ +# Other + +### Console + +> **Console** = `object` + +Console interface for logging. + +Currently logs are only available in the backend logs. +See the [documentation](https://docs.caido.io/report_bug.html#1-backend-logs) on how to retrieve them. + +#### Methods + +##### debug() + +> **debug**(`message`: `any`): `void` + +Log a message with the debug level. + +Usually used for troubleshooting purposes. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `message` | `any` | + +###### Returns + +`void` + +##### error() + +> **error**(`message`: `any`): `void` + +Log a message with the error level. + +Usually used for critical errors. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `message` | `any` | + +###### Returns + +`void` + +##### log() + +> **log**(`message`: `any`): `void` + +Log a message with the info level. + +Usually used for general information. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `message` | `any` | + +###### Returns + +`void` + +##### warn() + +> **warn**(`message`: `any`): `void` + +Log a message with the warn level. + +Usually used for unexpected behaviors. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `message` | `any` | + +###### Returns + +`void` + +*** + +### PageInfo + +> **PageInfo** = `object` + +Information on the current page of paginated data. + +#### Properties + +##### endCursor + +> **endCursor**: [`Cursor`](shared.md#cursor) + +##### hasNextPage + +> **hasNextPage**: `boolean` + +##### hasPreviousPage + +> **hasPreviousPage**: `boolean` + +##### startCursor + +> **startCursor**: [`Cursor`](shared.md#cursor) + +*** + +### RequestSendOptions + +> **RequestSendOptions** = `object` + +#### Properties + +##### save? + +> `optional` **save**: `boolean` + +If true, the request and response will be saved to the database +and the user will see them in the Search tab. + +If you do not save, the request and response IDs will be set to 0. + +###### Default + +```ts +true +``` + +##### timeouts? + +> `optional` **timeouts**: [`RequestSendTimeouts`](requests.md#requestsendtimeouts) \| `number` + +The timeouts to use for sending a request and receiving a response. + +If a number is provided, it will be used as the global timeout and +the other timeouts will be set to infinity. + +See the [RequestSendTimeouts](requests.md#requestsendtimeouts) for the default values. diff --git a/src/reference/sdks/workflow/projects.md b/src/reference/sdks/workflow/projects.md new file mode 100644 index 0000000..b0af6bb --- /dev/null +++ b/src/reference/sdks/workflow/projects.md @@ -0,0 +1,94 @@ +# Projects + +### Project + +> **Project** = `object` + +A saved immutable Project. + +#### Methods + +##### getId() + +> **getId**(): [`ID`](shared.md#id) + +The unique Caido [ID](shared.md#id) of the project. + +###### Returns + +[`ID`](shared.md#id) + +##### getName() + +> **getName**(): `string` + +The name of the project. + +###### Returns + +`string` + +##### getPath() + +> **getPath**(): `string` + +The directory where the project is located. + +###### Returns + +`string` + +##### getStatus() + +> **getStatus**(): [`ProjectStatus`](#projectstatus) + +The status of the project. + +###### Returns + +[`ProjectStatus`](#projectstatus) + +##### getVersion() + +> **getVersion**(): `string` + +The version of the project. +The format is `MAJOR.MINOR.PATCH`. + +###### Returns + +`string` + +*** + +### ProjectsSDK + +> **ProjectsSDK** = `object` + +The SDK for the Projects service. + +#### Methods + +##### getCurrent() + +> **getCurrent**(): `Promise`\<[`Project`](#project) \| `undefined`\> + +Get the currently selected [Project](#project) if any. + +###### Returns + +`Promise`\<[`Project`](#project) \| `undefined`\> + +###### Example + +```js +await sdk.projects.getCurrent(); +``` + +*** + +### ProjectStatus + +> **ProjectStatus** = `"ready"` \| `"restoring"` \| `"error"` + +A [Project](#project) status. diff --git a/src/reference/sdks/workflow/replay.md b/src/reference/sdks/workflow/replay.md new file mode 100644 index 0000000..85befdd --- /dev/null +++ b/src/reference/sdks/workflow/replay.md @@ -0,0 +1,92 @@ +# Replay + +### ReplayCollection + +> **ReplayCollection** = `object` + +A collection of replay sessions. + +#### Methods + +##### getId() + +> **getId**(): [`ID`](shared.md#id) + +The unique Caido [ID](shared.md#id) of the replay collection. + +###### Returns + +[`ID`](shared.md#id) + +##### getName() + +> **getName**(): `string` + +The name of the replay collection. + +###### Returns + +`string` + +*** + +### ReplaySDK + +> **ReplaySDK** = `object` + +The SDK for the Replay service. + +#### Methods + +##### createSession() + +> **createSession**(`source?`: [`RequestSource`](shared.md#requestsource), `collection?`: [`ID`](shared.md#id) \| [`ReplayCollection`](#replaycollection)): `Promise`\<[`ReplaySession`](#replaysession)\> + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `source?` | [`RequestSource`](shared.md#requestsource) | +| `collection?` | [`ID`](shared.md#id) \| [`ReplayCollection`](#replaycollection) | + +###### Returns + +`Promise`\<[`ReplaySession`](#replaysession)\> + +##### getCollections() + +> **getCollections**(): `Promise`\<[`ReplayCollection`](#replaycollection)[]\> + +###### Returns + +`Promise`\<[`ReplayCollection`](#replaycollection)[]\> + +*** + +### ReplaySession + +> **ReplaySession** = `object` + +A replay session. + +#### Methods + +##### getId() + +> **getId**(): [`ID`](shared.md#id) + +The unique Caido [ID](shared.md#id) of the replay session. + +###### Returns + +[`ID`](shared.md#id) + +##### getName() + +> **getName**(): `string` + +The name of the replay session. + +###### Returns + +`string` diff --git a/src/reference/sdks/workflow/requests.md b/src/reference/sdks/workflow/requests.md new file mode 100644 index 0000000..d121ed6 --- /dev/null +++ b/src/reference/sdks/workflow/requests.md @@ -0,0 +1,1602 @@ +# Requests + +### Body + +The body of a [Request](#request) or [Response](#response). + +Calling `to` will try to convert the body to the desired format. + +#### Constructors + +##### Constructor + +> **new Body**(`data`: `string` \| `number`[] \| `Uint8Array`): [`Body`](#body) + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `data` | `string` \| `number`[] \| `Uint8Array` | + +###### Returns + +[`Body`](#body) + +#### Properties + +##### length + +> `readonly` **length**: `number` + +The length of the body in bytes. + +#### Methods + +##### toJson() + +> **toJson**(): `unknown` + +Try to parse the body as JSON. + +###### Returns + +`unknown` + +###### Throws + +If the body is not valid JSON. + +##### toRaw() + +> **toRaw**(): `Uint8Array` + +Get the raw body as an array of bytes. + +###### Returns + +`Uint8Array` + +##### toText() + +> **toText**(): `string` + +Parse the body as a string. + +Unprintable characters will be replaced with `�`. + +###### Returns + +`string` + +*** + +### RequestSpec + +A mutable Request that has not yet been sent. + +#### Constructors + +##### Constructor + +> **new RequestSpec**(`url`: `string`): [`RequestSpec`](#requestspec) + +Build a new [RequestSpec](#requestspec) from a URL string. +We try to infer as much information as possible from the URL, including the scheme, host, path and query. + +You can convert a saved immutable [Request](#request) object into a [RequestSpec](#requestspec) object by using the `toSpec()` method. + +By default: + +- Method is `GET`. +- Path is `/`. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `url` | `string` | + +###### Returns + +[`RequestSpec`](#requestspec) + +###### Throws + +If the URL is invalid. + +###### Example + +```js +const spec = new RequestSpec("https://example.com"); +``` + +#### Methods + +##### getBody() + +> **getBody**(): [`Body`](#body) \| `undefined` + +The body of the request. + +###### Returns + +[`Body`](#body) \| `undefined` + +##### getHeader() + +> **getHeader**(`name`: `string` \| [`GetHeaderOptions`](#getheaderoptions)): `string`[] \| `undefined` + +Get a header value. + +Header name is case-insensitive. +The header might have multiple values. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `name` | `string` \| [`GetHeaderOptions`](#getheaderoptions) | + +###### Returns + +`string`[] \| `undefined` + +##### getHeaders() + +> **getHeaders**(): `Record`\<`string`, `string`[]\> + +The headers of the request. + +Header names are case-insensitive. +Each header might have multiple values. + +###### Returns + +`Record`\<`string`, `string`[]\> + +###### Example + +```json +{ + "Host": ["caido.io"], + "Connection": ["keep-alive"], + "Content-Length": ["95"] +} +``` + +##### getHost() + +> **getHost**(): `string` + +Get the host of the request. + +###### Returns + +`string` + +##### getMethod() + +###### Call Signature + +> **getMethod**(): `string` + +Get the HTTP method of the request. + +Get the raw version by passing `{ raw: true }` in the options. + +###### Returns + +`string` + +###### Call Signature + +> **getMethod**(`options`: [`RawOption`](shared.md#rawoption)): `Uint8Array` + +Get the HTTP method of the request. + +Get the raw version by passing `{ raw: true }` in the options. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `options` | [`RawOption`](shared.md#rawoption) | + +###### Returns + +`Uint8Array` + +##### getPath() + +###### Call Signature + +> **getPath**(): `string` + +Get the path of the request. + +Get the raw version by passing `{ raw: true }` in the options. + +###### Returns + +`string` + +###### Call Signature + +> **getPath**(`options`: [`RawOption`](shared.md#rawoption)): `Uint8Array` + +Get the path of the request. + +Get the raw version by passing `{ raw: true }` in the options. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `options` | [`RawOption`](shared.md#rawoption) | + +###### Returns + +`Uint8Array` + +##### getPort() + +> **getPort**(): `number` + +Get the port of the request. + +###### Returns + +`number` + +##### getQuery() + +###### Call Signature + +> **getQuery**(): `string` + +Get the unparsed query of the request. + +Get the raw version by passing `{ raw: true }` in the options. + +Excludes the leading `?`. + +###### Returns + +`string` + +###### Call Signature + +> **getQuery**(`options`: [`RawOption`](shared.md#rawoption)): `Uint8Array` + +Get the unparsed query of the request. + +Get the raw version by passing `{ raw: true }` in the options. + +Excludes the leading `?`. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `options` | [`RawOption`](shared.md#rawoption) | + +###### Returns + +`Uint8Array` + +##### getRaw() + +> **getRaw**(): [`RequestSpecRaw`](#requestspecraw) + +This methods converts the [RequestSpec](#requestspec) to a [RequestSpecRaw](#requestspecraw). + +This is useful to retrieve the raw bytes of the request. + +###### Returns + +[`RequestSpecRaw`](#requestspecraw) + +###### Example + +```js +const spec = new RequestSpec("https://example.com"); +const specRaw = spec.getRaw(); +const bytes = specRaw.getRaw(); // GET / HTTP/1.1\r\nHost: example.com\r\n\r\n +``` + +##### getTls() + +> **getTls**(): `boolean` + +Get if the request uses TLS (HTTPS). + +###### Returns + +`boolean` + +##### removeHeader() + +> **removeHeader**(`name`: `string`): `void` + +Removes a header. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `name` | `string` | + +###### Returns + +`void` + +##### setBody() + +> **setBody**(`body`: [`Bytes`](shared.md#bytes) \| [`Body`](#body), `options?`: [`SetBodyOptions`](#setbodyoptions)): `void` + +Set the body of the request. + +The body can either be a [Body](#body) or any type that can be converted to [Bytes](shared.md#bytes). + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `body` | [`Bytes`](shared.md#bytes) \| [`Body`](#body) | +| `options?` | [`SetBodyOptions`](#setbodyoptions) | + +###### Returns + +`void` + +###### Example + +```js +const body = new Body("Hello world."); +const options = { updateContentLength: true }; +request.setBody(body, options); +``` + +##### setHeader() + +> **setHeader**(`name`: `string`, `value`: `string`): `void` + +Set a header value. + +This will overwrite any existing values. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `name` | `string` | +| `value` | `string` | + +###### Returns + +`void` + +##### setHost() + +> **setHost**(`host`: `string`): `void` + +Set the host of the request. + +It will also update the `Host` header. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `host` | `string` | + +###### Returns + +`void` + +##### setMethod() + +> **setMethod**(`method`: [`Bytes`](shared.md#bytes)): `void` + +Set the HTTP method of the request. + +All strings are accepted. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `method` | [`Bytes`](shared.md#bytes) | + +###### Returns + +`void` + +##### setPath() + +> **setPath**(`path`: [`Bytes`](shared.md#bytes)): `void` + +Set the path of the request. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `path` | [`Bytes`](shared.md#bytes) | + +###### Returns + +`void` + +##### setPort() + +> **setPort**(`port`: `number`): `void` + +Set the port of the request. + +The port number must be between 1 and 65535. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `port` | `number` | + +###### Returns + +`void` + +##### setQuery() + +> **setQuery**(`query`: [`Bytes`](shared.md#bytes)): `void` + +Set the unparsed query of the request. + +The query string should not include the leading `?`. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `query` | [`Bytes`](shared.md#bytes) | + +###### Returns + +`void` + +###### Example + +```js +spec.setQuery("q=hello"); +``` + +##### setRaw() + +> **setRaw**(`raw`: [`Bytes`](shared.md#bytes)): [`RequestSpecRaw`](#requestspecraw) + +This method sets the raw [Bytes](shared.md#bytes) of the request and converts it to a [RequestSpecRaw](#requestspecraw). + +This is useful when you have a prepared [RequestSpec](#requestspec) and you just want to modify the raw data. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `raw` | [`Bytes`](shared.md#bytes) | + +###### Returns + +[`RequestSpecRaw`](#requestspecraw) + +###### Example + +```js +const rawBytes = []; // RAW BYTES HERE +const request = new RequestSpec("https://example.com"); +const rawRequest = request.setRaw(rawBytes); +``` + +##### setTls() + +> **setTls**(`tls`: `boolean`): `void` + +Set if the request uses TLS (HTTPS). + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `tls` | `boolean` | + +###### Returns + +`void` + +##### parse() + +###### Call Signature + +> `static` **parse**(`bytes`: [`Bytes`](shared.md#bytes)): [`RequestSpec`](#requestspec) + +Parses raw bytes into a [RequestSpec](#requestspec). + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `bytes` | [`Bytes`](shared.md#bytes) | + +###### Returns + +[`RequestSpec`](#requestspec) + +###### Throws + +If the bytes are not a valid HTTP request. + +###### Example + +```js +const rawInput = 'GET / HTTP/1.1\r\nHost: example.com\r\n\r\n'; +const spec = RequestSpec.parse(rawInput); +spec.setHeader('x-caido', 'test'); +const specRaw = spec.getRaw(); +const rawOutput = specRaw.getRaw(); // Will contain the new header +``` + +###### Call Signature + +> `static` **parse**(`raw`: [`RequestSpecRaw`](#requestspecraw)): [`RequestSpec`](#requestspec) + +Parses the raw bytes of a [RequestSpecRaw](#requestspecraw) into a [RequestSpec](#requestspec). + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `raw` | [`RequestSpecRaw`](#requestspecraw) | + +###### Returns + +[`RequestSpec`](#requestspec) + +###### Throws + +If the bytes are not a valid HTTP request. + +*** + +### RequestSpecRaw + +A mutable raw Request that has not yet been sent. + +#### Constructors + +##### Constructor + +> **new RequestSpecRaw**(`url`: `string`): [`RequestSpecRaw`](#requestspecraw) + +Build a new [RequestSpecRaw](#requestspecraw) from a URL string. Only the host, port and scheme will be parsed. + +You can convert a saved immutable [Request](#request) object into a [RequestSpecRaw](#requestspecraw) object by using the `toSpecRaw()` method. + +You MUST use `setRaw` to set the raw bytes of the request. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `url` | `string` | + +###### Returns + +[`RequestSpecRaw`](#requestspecraw) + +###### Example + +```js +const spec = new RequestSpecRaw("https://example.com"); +``` + +#### Methods + +##### getHost() + +> **getHost**(): `string` + +Get the host of the request. + +###### Returns + +`string` + +##### getPort() + +> **getPort**(): `number` + +Get the port of the request. + +###### Returns + +`number` + +##### getRaw() + +> **getRaw**(): `Uint8Array` + +Get the raw bytes of the request. + +###### Returns + +`Uint8Array` + +##### getSpec() + +> **getSpec**(): [`RequestSpec`](#requestspec) + +This methods converts the [RequestSpecRaw](#requestspecraw) to a [RequestSpec](#requestspec). + +###### Returns + +[`RequestSpec`](#requestspec) + +###### Throws + +If the bytes are not a valid HTTP request. + +###### See + +[RequestSpec.parse](#parse) + +##### getTls() + +> **getTls**(): `boolean` + +Get if the request uses TLS (HTTPS). + +###### Returns + +`boolean` + +##### setHost() + +> **setHost**(`host`: `string`): `void` + +Set the host of the request. + +It will NOT update the `Host` header. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `host` | `string` | + +###### Returns + +`void` + +##### setPort() + +> **setPort**(`port`: `number`): `void` + +Set the port of the request. + +The port number must be between 1 and 65535. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `port` | `number` | + +###### Returns + +`void` + +##### setRaw() + +> **setRaw**(`raw`: [`Bytes`](shared.md#bytes)): `void` + +Set the raw [Bytes](shared.md#bytes) of the request. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `raw` | [`Bytes`](shared.md#bytes) | + +###### Returns + +`void` + +##### setTls() + +> **setTls**(`tls`: `boolean`): `void` + +Set if the request uses TLS (HTTPS). + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `tls` | `boolean` | + +###### Returns + +`void` + +*** + +### GetHeaderOptions + +> **GetHeaderOptions** = `object` + +Options for getting a header value. + +#### Properties + +##### name + +> **name**: `string` + +The name of the header to get. +Header name is case-insensitive. + +##### split? + +> `optional` **split**: `boolean` + +Whether to split the header value on commas. + +###### Default + +```ts +false +``` + +*** + +### Request + +> **Request** = `object` + +An immutable saved Request. + +To modify, use `toSpec` to get a `RequestSpec` object. + +#### Methods + +##### getBody() + +> **getBody**(): [`Body`](#body) \| `undefined` + +The body of the request. + +###### Returns + +[`Body`](#body) \| `undefined` + +##### getCreatedAt() + +> **getCreatedAt**(): `Date` + +The datetime the request was recorded by the proxy. + +###### Returns + +`Date` + +##### getHeader() + +> **getHeader**(`name`: `string` \| [`GetHeaderOptions`](#getheaderoptions)): `string`[] \| `undefined` + +Get a header value. + +Header name is case-insensitive. +The header might have multiple values. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `name` | `string` \| [`GetHeaderOptions`](#getheaderoptions) | + +###### Returns + +`string`[] \| `undefined` + +##### getHeaders() + +> **getHeaders**(): `Record`\<`string`, `string`[]\> + +The headers of the request. + +Header names are case-insensitive. +Each header might have multiple values. + +###### Returns + +`Record`\<`string`, `string`[]\> + +###### Example + +```json +{ + "Host": ["caido.io"], + "Connection": ["keep-alive"], + "Content-Length": ["95"] +} +``` + +##### getHost() + +> **getHost**(): `string` + +The target host of the request. + +###### Returns + +`string` + +##### getId() + +> **getId**(): [`ID`](shared.md#id) + +The unique Caido [ID](shared.md#id) of the request. + +###### Returns + +[`ID`](shared.md#id) + +##### getMethod() + +> **getMethod**(): `string` + +The HTTP method of the request. + +###### Returns + +`string` + +##### getPath() + +> **getPath**(): `string` + +The path of the request. + +###### Returns + +`string` + +##### getPort() + +> **getPort**(): `number` + +The target port of the request. + +###### Returns + +`number` + +##### getQuery() + +> **getQuery**(): `string` + +The unparsed query of the request. + +Excludes the leading `?`. + +###### Returns + +`string` + +##### getRaw() + +> **getRaw**(): [`RequestRaw`](#requestraw) + +The raw version of the request. + +Used to access the bytes directly. + +###### Returns + +[`RequestRaw`](#requestraw) + +##### getTls() + +> **getTls**(): `boolean` + +If the request uses TLS (HTTPS). + +###### Returns + +`boolean` + +##### getUrl() + +> **getUrl**(): `string` + +The full URL of the request. + +###### Returns + +`string` + +##### toSpec() + +> **toSpec**(): [`RequestSpec`](#requestspec) + +Copied the request to a mutable un-saved [RequestSpec](#requestspec). +This enables you to make modify a request before re-sending it. + +###### Returns + +[`RequestSpec`](#requestspec) + +##### toSpecRaw() + +> **toSpecRaw**(): [`RequestSpecRaw`](#requestspecraw) + +Copied the request to a mutable un-saved [RequestSpecRaw](#requestspecraw). +The raw requests are not parsed and can be used to send invalid HTTP Requests. + +###### Returns + +[`RequestSpecRaw`](#requestspecraw) + +*** + +### RequestOrderField + +> **RequestOrderField** = `"ext"` \| `"host"` \| `"id"` \| `"method"` \| `"path"` \| `"query"` \| `"created_at"` \| `"source"` + +Field to order requests by. + +*** + +### RequestRaw + +> **RequestRaw** = `object` + +An immutable saved raw Request. + +#### Methods + +##### toBytes() + +> **toBytes**(): `Uint8Array` + +Get the raw request as an array of bytes. + +###### Returns + +`Uint8Array` + +##### toText() + +> **toText**(): `string` + +Parse the raw request as a string. + +Unprintable characters will be replaced with `�`. + +###### Returns + +`string` + +*** + +### RequestResponse + +> **RequestResponse** = `object` + +An immutable saved Request and Response pair. + +#### Properties + +##### request + +> **request**: [`Request`](#request) + +##### response + +> **response**: [`Response`](#response) + +*** + +### RequestResponseOpt + +> **RequestResponseOpt** = `object` + +An immutable saved Request and optional Response pair. + +#### Properties + +##### request + +> **request**: [`Request`](#request) + +##### response? + +> `optional` **response**: [`Response`](#response) + +*** + +### RequestsConnection + +> **RequestsConnection** = `object` + +A connection of requests. + +#### Properties + +##### items + +> **items**: [`RequestsConnectionItem`](#requestsconnectionitem)[] + +##### pageInfo + +> **pageInfo**: [`PageInfo`](other.md#pageinfo) + +*** + +### RequestsConnectionItem + +> **RequestsConnectionItem** = `object` + +An item in a connection of requests. + +#### Properties + +##### cursor + +> **cursor**: [`Cursor`](shared.md#cursor) + +##### request + +> **request**: [`Request`](#request) + +##### response? + +> `optional` **response**: [`Response`](#response) + +*** + +### RequestSendTimeouts + +> **RequestSendTimeouts** = `object` + +Timeouts for sending a request and receiving a response. + +#### Properties + +##### connect? + +> `optional` **connect**: `number` + +The timeout to open the TCP connection to the target host +and perform the TLS handshake. + +Defaults to 30s. + +##### extra? + +> `optional` **extra**: `number` + +The timeout to read data after we have a read the full response. + +This is useful if you believe the server will send more data +than implied by the Content-Length header. + +Defaults to 0s (no timeout). + +##### global? + +> `optional` **global**: `number` + +The global timeout for sending a request and receiving a response. + +No default value. + +##### partial? + +> `optional` **partial**: `number` + +The timeout between each read attempt for the response. +On a slow connection, this is important to increase. + +Defaults to 5s. + +##### response? + +> `optional` **response**: `number` + +The timeout to receive the first byte of the response. + +After the first byte is received, the partial timeout will be used. + +Defaults to 30s. + +*** + +### RequestsQuery + +> **RequestsQuery** = `object` + +Query builder to fetch requests. + +#### Methods + +##### after() + +> **after**(`cursor`: [`Cursor`](shared.md#cursor)): [`RequestsQuery`](#requestsquery) + +Requests after a given cursor. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `cursor` | [`Cursor`](shared.md#cursor) | [Cursor](shared.md#cursor) of the request | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +##### ascending() + +###### Call Signature + +> **ascending**(`target`: `"req"`, `field`: [`RequestOrderField`](#requestorderfield)): [`RequestsQuery`](#requestsquery) + +Ascending ordering. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `target` | `"req"` | Target of the ordering: req or resp. | +| `field` | [`RequestOrderField`](#requestorderfield) | Field to order by. | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +###### Call Signature + +> **ascending**(`target`: `"resp"`, `field`: [`ResponseOrderField`](#responseorderfield)): [`RequestsQuery`](#requestsquery) + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `target` | `"resp"` | +| `field` | [`ResponseOrderField`](#responseorderfield) | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +##### before() + +> **before**(`cursor`: [`Cursor`](shared.md#cursor)): [`RequestsQuery`](#requestsquery) + +Requests before a given cursor. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `cursor` | [`Cursor`](shared.md#cursor) | [Cursor](shared.md#cursor) of the request | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +##### descending() + +###### Call Signature + +> **descending**(`target`: `"req"`, `field`: [`RequestOrderField`](#requestorderfield)): [`RequestsQuery`](#requestsquery) + +Descending ordering. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `target` | `"req"` | Target of the ordering: req or resp. | +| `field` | [`RequestOrderField`](#requestorderfield) | Field to order by. | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +###### Call Signature + +> **descending**(`target`: `"resp"`, `field`: [`ResponseOrderField`](#responseorderfield)): [`RequestsQuery`](#requestsquery) + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `target` | `"resp"` | +| `field` | [`ResponseOrderField`](#responseorderfield) | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +##### execute() + +> **execute**(): `Promise`\<[`RequestsConnection`](#requestsconnection)\> + +Execute the query. + +###### Returns + +`Promise`\<[`RequestsConnection`](#requestsconnection)\> + +###### Throws + +If a query parameter is invalid or the query cannot be executed. + +##### filter() + +> **filter**(`filter`: `string`): [`RequestsQuery`](#requestsquery) + +Filter requests. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `filter` | `string` | HTTPQL filter | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +##### first() + +> **first**(`n`: `number`): [`RequestsQuery`](#requestsquery) + +First n requests. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `n` | `number` | Number of requests to return | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +##### last() + +> **last**(`n`: `number`): [`RequestsQuery`](#requestsquery) + +Last n requests. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `n` | `number` | Number of requests to return | + +###### Returns + +[`RequestsQuery`](#requestsquery) + +*** + +### RequestsSDK + +> **RequestsSDK** = `object` + +The SDK for the Requests service. + +#### Methods + +##### get() + +> **get**(`id`: [`ID`](shared.md#id)): `Promise`\<[`RequestResponseOpt`](#requestresponseopt) \| `undefined`\> + +Get a request by its unique [ID](shared.md#id). + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `id` | [`ID`](shared.md#id) | + +###### Returns + +`Promise`\<[`RequestResponseOpt`](#requestresponseopt) \| `undefined`\> + +###### Example + +```js +await sdk.requests.get("1"); +``` + +##### inScope() + +> **inScope**(`request`: [`Request`](#request) \| [`RequestSpec`](#requestspec), `scopes?`: [`Scope`](scope.md#scope)[] \| [`ID`](shared.md#id)[]): `boolean` + +Checks if a request is in scope. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `request` | [`Request`](#request) \| [`RequestSpec`](#requestspec) | The request to check | +| `scopes?` | [`Scope`](scope.md#scope)[] \| [`ID`](shared.md#id)[] | Optional scopes or scope IDs to check against. If not provided, checks against the default scope. | + +###### Returns + +`boolean` + +True if the request is in scope + +###### Example + +```js +// Check against default scope +if (sdk.requests.inScope(request)) { + sdk.console.log("In scope"); +} + +// Check against specific scopes +const isInScope = sdk.requests.inScope(request, [scope1, scope2]); +sdk.console.log(isInScope); // true or false +``` + +##### matches() + +> **matches**(`filter`: `string`, `request`: [`Request`](#request), `response?`: [`Response`](#response)): `boolean` + +Checks if a request/response matches an HTTPQL filter. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `filter` | `string` | HTTPQL filter | +| `request` | [`Request`](#request) | The [Request](#request) to match against | +| `response?` | [`Response`](#response) | The [Response](#response) to match against | + +###### Returns + +`boolean` + +##### query() + +> **query**(): [`RequestsQuery`](#requestsquery) + +Query requests of the current project. + +###### Returns + +[`RequestsQuery`](#requestsquery) + +###### Example + +```js +const page = await sqk.requests.query().first(2).execute(); +sdk.console.log(`ID: ${page.items[1].request.getId()}`); +``` + +##### send() + +> **send**(`request`: [`RequestSpec`](#requestspec) \| [`RequestSpecRaw`](#requestspecraw), `options?`: [`RequestSendOptions`](other.md#requestsendoptions)): `Promise`\<[`RequestResponse`](#requestresponse)\> + +Sends an HTTP request, either a [RequestSpec](#requestspec) or [RequestSpecRaw](#requestspecraw). + +This respects the upstream proxy settings. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `request` | [`RequestSpec`](#requestspec) \| [`RequestSpecRaw`](#requestspecraw) | +| `options?` | [`RequestSendOptions`](other.md#requestsendoptions) | + +###### Returns + +`Promise`\<[`RequestResponse`](#requestresponse)\> + +###### Throws + +If the request cannot be sent. +If the request times out, the error message will contain the word "Timeout". + +###### Example + +```js +const spec = new RequestSpec("https://example.com"); +try { + const res = await sdk.requests.send(request) + sdk.console.log(res.request.getId()); + sdk.console.log(res.response.getCode()); +} catch (err) { + sdk.console.error(err); +} +``` + +*** + +### Response + +> **Response** = `object` + +An immutable saved Response. + +#### Methods + +##### getBody() + +> **getBody**(): [`Body`](#body) \| `undefined` + +The body of the response + +###### Returns + +[`Body`](#body) \| `undefined` + +##### getCode() + +> **getCode**(): `number` + +The status code of the response. + +###### Returns + +`number` + +##### getCreatedAt() + +> **getCreatedAt**(): `Date` + +The datetime the response was recorded by the proxy. + +###### Returns + +`Date` + +##### getHeader() + +> **getHeader**(`name`: `string` \| [`GetHeaderOptions`](#getheaderoptions)): `string`[] \| `undefined` + +Get a header value. + +Header name is case-insensitive. +The header might have multiple values. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `name` | `string` \| [`GetHeaderOptions`](#getheaderoptions) | + +###### Returns + +`string`[] \| `undefined` + +##### getHeaders() + +> **getHeaders**(): `Record`\<`string`, `string`[]\> + +The headers of the response. + +Header names are case-insensitive. +Each header might have multiple values. + +###### Returns + +`Record`\<`string`, `string`[]\> + +###### Example + +```json +{ + "Date": ["Sun, 26 May 2024 10:59:21 GMT"], + "Content-Type": ["text/html"] +} +``` + +##### getId() + +> **getId**(): [`ID`](shared.md#id) + +The unique Caido [ID](shared.md#id) of the response. + +###### Returns + +[`ID`](shared.md#id) + +##### getRaw() + +> **getRaw**(): [`ResponseRaw`](#responseraw) + +The raw version of the response. + +Used to access the bytes directly. + +###### Returns + +[`ResponseRaw`](#responseraw) + +##### getRoundtripTime() + +> **getRoundtripTime**(): `number` + +The time it took to send the request and receive the response in milliseconds. + +###### Returns + +`number` + +*** + +### ResponseOrderField + +> **ResponseOrderField** = `"length"` \| `"roundtrip"` \| `"code"` + +Field to order responses by. + +*** + +### ResponseRaw + +> **ResponseRaw** = `object` + +An immutable saved raw Response. + +#### Methods + +##### toBytes() + +> **toBytes**(): `Uint8Array` + +Get the raw response as an array of bytes. + +###### Returns + +`Uint8Array` + +##### toText() + +> **toText**(): `string` + +Parse the raw response as a string. + +Unprintable characters will be replaced with `�`. + +###### Returns + +`string` + +*** + +### SetBodyOptions + +> **SetBodyOptions** = `object` + +Options when setting the body of a Request. + +#### Properties + +##### updateContentLength + +> **updateContentLength**: `boolean` + +Should update the Content-export type header. + +###### Default + +```ts +true +``` diff --git a/src/reference/sdks/workflow/runtime.md b/src/reference/sdks/workflow/runtime.md new file mode 100644 index 0000000..25fbd73 --- /dev/null +++ b/src/reference/sdks/workflow/runtime.md @@ -0,0 +1,21 @@ +# Runtime + +### RuntimeSDK + +> **RuntimeSDK** = `object` + +The SDK for the runtime information. + +#### Accessors + +##### version + +###### Get Signature + +> **get** **version**(): `string` + +Get the current version of Caido. + +###### Returns + +`string` diff --git a/src/reference/sdks/workflow/scope.md b/src/reference/sdks/workflow/scope.md new file mode 100644 index 0000000..723e6ac --- /dev/null +++ b/src/reference/sdks/workflow/scope.md @@ -0,0 +1,55 @@ +# Scope + +### Scope + +> **Scope** = `object` + +A saved immutable Scope. + +#### Properties + +##### allowlist + +> `readonly` **allowlist**: `string`[] + +The allowlist of the scope. + +##### denylist + +> `readonly` **denylist**: `string`[] + +The denylist of the scope. + +##### id + +> `readonly` **id**: [`ID`](shared.md#id) + +The unique Caido [ID](shared.md#id) of the scope. + +##### name + +> `readonly` **name**: `string` + +The name of the scope. + +*** + +### ScopeSDK + +> **ScopeSDK** = `object` + +The SDK for the Scope service. + +#### Methods + +##### getAll() + +> **getAll**(): `Promise`\<[`Scope`](#scope)[]\> + +Get all the scopes. + +###### Returns + +`Promise`\<[`Scope`](#scope)[]\> + +An array of [Scope](#scope) diff --git a/src/reference/sdks/workflow/shared.md b/src/reference/sdks/workflow/shared.md new file mode 100644 index 0000000..7540c10 --- /dev/null +++ b/src/reference/sdks/workflow/shared.md @@ -0,0 +1,57 @@ +# Shared + +### Bytes + +> **Bytes** = `string` \| `number`[] \| `Uint8Array` + +Types that can be converted to bytes in inputs. + +*** + +### Cursor + +> **Cursor** = `string` & `object` + +A cursor for pagination. + +#### Type Declaration + +##### \_\_cursor? + +> `optional` **\_\_cursor**: `never` + +*** + +### ID + +> **ID** = `string` & `object` + +A unique identifier. + +#### Type Declaration + +##### \_\_id? + +> `optional` **\_\_id**: `never` + +*** + +### RawOption + +> **RawOption** = `object` + +Option to return raw value + +#### Properties + +##### raw + +> **raw**: `true` + +*** + +### RequestSource + +> **RequestSource** = [`ID`](#id) \| [`Request`](requests.md#request) \| [`RequestSpec`](requests.md#requestspec) \| [`RequestSpecRaw`](requests.md#requestspecraw) + +The source of a request.