From d1a372e354bb133446d9921d61879faed02edced Mon Sep 17 00:00:00 2001 From: Caido Bot Date: Sun, 11 Jan 2026 23:10:08 +0000 Subject: [PATCH] Update SDK Documentation --- src/reference/modules/index.md | 1 - src/reference/modules/llrt/buffer.md | 1411 +++++++++++++++-- src/reference/modules/llrt/fs/fs/promises.md | 33 +- src/reference/modules/llrt/fs/index.md | 24 +- src/reference/sdks/backend/events.md | 44 + src/reference/sdks/backend/index.md | 7 + src/reference/sdks/backend/net.md | 157 ++ src/reference/sdks/backend/other.md | 31 + src/reference/sdks/backend/projects.md | 40 + src/reference/sdks/backend/requests.md | 80 +- src/reference/sdks/frontend/ai.md | 50 +- src/reference/sdks/frontend/assistant.md | 13 + src/reference/sdks/frontend/automate.md | 162 ++ src/reference/sdks/frontend/backups.md | 13 + src/reference/sdks/frontend/certificate.md | 13 + src/reference/sdks/frontend/environment.md | 18 + src/reference/sdks/frontend/exports.md | 13 + src/reference/sdks/frontend/files.md | 14 + src/reference/sdks/frontend/filters.md | 18 + src/reference/sdks/frontend/findings.md | 34 + src/reference/sdks/frontend/http-history.md | 34 + src/reference/sdks/frontend/index.md | 13 + src/reference/sdks/frontend/intercept.md | 40 + .../sdks/frontend/match-and-replace.md | 50 + src/reference/sdks/frontend/navigation.md | 2 +- src/reference/sdks/frontend/other.md | 50 + src/reference/sdks/frontend/projects.md | 14 + src/reference/sdks/frontend/replay.md | 64 + src/reference/sdks/frontend/response.md | 29 + src/reference/sdks/frontend/scopes.md | 18 + src/reference/sdks/frontend/search.md | 30 + src/reference/sdks/frontend/settings.md | 65 + src/reference/sdks/frontend/sitemap.md | 240 +++ src/reference/sdks/frontend/utils.md | 52 + src/reference/sdks/frontend/websockets.md | 13 + src/reference/sdks/frontend/window.md | 52 + src/reference/sdks/frontend/workflows.md | 14 + src/reference/sdks/workflow/data.md | 58 + src/reference/sdks/workflow/index.md | 7 + src/reference/sdks/workflow/net.md | 157 ++ src/reference/sdks/workflow/other.md | 31 + src/reference/sdks/workflow/projects.md | 40 + src/reference/sdks/workflow/requests.md | 76 +- 43 files changed, 3183 insertions(+), 142 deletions(-) create mode 100644 src/reference/sdks/backend/net.md create mode 100644 src/reference/sdks/frontend/assistant.md create mode 100644 src/reference/sdks/frontend/backups.md create mode 100644 src/reference/sdks/frontend/certificate.md create mode 100644 src/reference/sdks/frontend/exports.md create mode 100644 src/reference/sdks/frontend/response.md create mode 100644 src/reference/sdks/frontend/settings.md create mode 100644 src/reference/sdks/frontend/websockets.md create mode 100644 src/reference/sdks/workflow/net.md diff --git a/src/reference/modules/index.md b/src/reference/modules/index.md index bf18eb5..09daa60 100644 --- a/src/reference/modules/index.md +++ b/src/reference/modules/index.md @@ -12,7 +12,6 @@ | [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) | - | diff --git a/src/reference/modules/llrt/buffer.md b/src/reference/modules/llrt/buffer.md index f3df2a7..9bc5aa2 100644 --- a/src/reference/modules/llrt/buffer.md +++ b/src/reference/modules/llrt/buffer.md @@ -81,138 +81,1048 @@ console.log(buf.toString()); The number of bytes copied. +##### readBigInt64BE() + +> **readBigInt64BE**(`offset?`: `number`): `bigint` + +Reads a signed, big-endian 64-bit integer from `buf` at the specified `offset`. + +Integers read from a `Buffer` are interpreted as two's complement signed +values. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. | + +###### Returns + +`bigint` + +##### readBigInt64LE() + +> **readBigInt64LE**(`offset?`: `number`): `bigint` + +Reads a signed, little-endian 64-bit integer from `buf` at the specified`offset`. + +Integers read from a `Buffer` are interpreted as two's complement signed +values. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. | + +###### Returns + +`bigint` + +##### readBigUint64BE() + +> **readBigUint64BE**(`offset?`: `number`): `bigint` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `offset?` | `number` | + +###### Returns + +`bigint` + +###### Alias + +Buffer.readBigUInt64BE + +##### readBigUInt64BE() + +> **readBigUInt64BE**(`offset?`: `number`): `bigint` + +Reads an unsigned, big-endian 64-bit integer from `buf` at the specified`offset`. + +This function is also available under the `readBigUint64BE` alias. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]); + +console.log(buf.readBigUInt64BE(0)); +// Prints: 4294967295n +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. | + +###### Returns + +`bigint` + +##### readBigUint64LE() + +> **readBigUint64LE**(`offset?`: `number`): `bigint` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `offset?` | `number` | + +###### Returns + +`bigint` + +###### Alias + +Buffer.readBigUInt64LE + +##### readBigUInt64LE() + +> **readBigUInt64LE**(`offset?`: `number`): `bigint` + +Reads an unsigned, little-endian 64-bit integer from `buf` at the specified`offset`. + +This function is also available under the `readBigUint64LE` alias. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]); + +console.log(buf.readBigUInt64LE(0)); +// Prints: 18446744069414584320n +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. | + +###### Returns + +`bigint` + +##### readDoubleBE() + +> **readDoubleBE**(`offset?`: `number`): `number` + +Reads a 64-bit, big-endian double from `buf` at the specified `offset`. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); + +console.log(buf.readDoubleBE(0)); +// Prints: 8.20788039913184e-304 +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`. | + +###### Returns + +`number` + +##### readDoubleLE() + +> **readDoubleLE**(`offset?`: `number`): `number` + +Reads a 64-bit, little-endian double from `buf` at the specified `offset`. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); + +console.log(buf.readDoubleLE(0)); +// Prints: 5.447603722011605e-270 +console.log(buf.readDoubleLE(1)); +// Throws ERR_OUT_OF_RANGE. +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`. | + +###### Returns + +`number` + +##### readFloatBE() + +> **readFloatBE**(`offset?`: `number`): `number` + +Reads a 32-bit, big-endian float from `buf` at the specified `offset`. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.from([1, 2, 3, 4]); + +console.log(buf.readFloatBE(0)); +// Prints: 2.387939260590663e-38 +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. | + +###### Returns + +`number` + +##### readFloatLE() + +> **readFloatLE**(`offset?`: `number`): `number` + +Reads a 32-bit, little-endian float from `buf` at the specified `offset`. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.from([1, 2, 3, 4]); + +console.log(buf.readFloatLE(0)); +// Prints: 1.539989614439558e-36 +console.log(buf.readFloatLE(1)); +// Throws ERR_OUT_OF_RANGE. +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. | + +###### Returns + +`number` + +##### readInt16BE() + +> **readInt16BE**(`offset?`: `number`): `number` + +Reads a signed, big-endian 16-bit integer from `buf` at the specified `offset`. + +Integers read from a `Buffer` are interpreted as two's complement signed values. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.from([0, 5]); + +console.log(buf.readInt16BE(0)); +// Prints: 5 +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. | + +###### Returns + +`number` + +##### readInt16LE() + +> **readInt16LE**(`offset?`: `number`): `number` + +Reads a signed, little-endian 16-bit integer from `buf` at the specified`offset`. + +Integers read from a `Buffer` are interpreted as two's complement signed values. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.from([0, 5]); + +console.log(buf.readInt16LE(0)); +// Prints: 1280 +console.log(buf.readInt16LE(1)); +// Throws ERR_OUT_OF_RANGE. +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. | + +###### Returns + +`number` + +##### readInt32BE() + +> **readInt32BE**(`offset?`: `number`): `number` + +Reads a signed, big-endian 32-bit integer from `buf` at the specified `offset`. + +Integers read from a `Buffer` are interpreted as two's complement signed values. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.from([0, 0, 0, 5]); + +console.log(buf.readInt32BE(0)); +// Prints: 5 +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. | + +###### Returns + +`number` + +##### readInt32LE() + +> **readInt32LE**(`offset?`: `number`): `number` + +Reads a signed, little-endian 32-bit integer from `buf` at the specified`offset`. + +Integers read from a `Buffer` are interpreted as two's complement signed values. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.from([0, 0, 0, 5]); + +console.log(buf.readInt32LE(0)); +// Prints: 83886080 +console.log(buf.readInt32LE(1)); +// Throws ERR_OUT_OF_RANGE. +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. | + +###### Returns + +`number` + +##### readInt8() + +> **readInt8**(`offset?`: `number`): `number` + +Reads a signed 8-bit integer from `buf` at the specified `offset`. + +Integers read from a `Buffer` are interpreted as two's complement signed values. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.from([-1, 5]); + +console.log(buf.readInt8(0)); +// Prints: -1 +console.log(buf.readInt8(1)); +// Prints: 5 +console.log(buf.readInt8(2)); +// Throws ERR_OUT_OF_RANGE. +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`. | + +###### Returns + +`number` + +##### readUint16BE() + +> **readUint16BE**(`offset?`: `number`): `number` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `offset?` | `number` | + +###### Returns + +`number` + +###### Alias + +Buffer.readUInt16BE + +##### readUInt16BE() + +> **readUInt16BE**(`offset?`: `number`): `number` + +Reads an unsigned, big-endian 16-bit integer from `buf` at the specified`offset`. + +This function is also available under the `readUint16BE` alias. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.from([0x12, 0x34, 0x56]); + +console.log(buf.readUInt16BE(0).toString(16)); +// Prints: 1234 +console.log(buf.readUInt16BE(1).toString(16)); +// Prints: 3456 +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. | + +###### Returns + +`number` + +##### readUint16LE() + +> **readUint16LE**(`offset?`: `number`): `number` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `offset?` | `number` | + +###### Returns + +`number` + +###### Alias + +Buffer.readUInt16LE + +##### readUInt16LE() + +> **readUInt16LE**(`offset?`: `number`): `number` + +Reads an unsigned, little-endian 16-bit integer from `buf` at the specified `offset`. + +This function is also available under the `readUint16LE` alias. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.from([0x12, 0x34, 0x56]); + +console.log(buf.readUInt16LE(0).toString(16)); +// Prints: 3412 +console.log(buf.readUInt16LE(1).toString(16)); +// Prints: 5634 +console.log(buf.readUInt16LE(2).toString(16)); +// Throws ERR_OUT_OF_RANGE. +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. | + +###### Returns + +`number` + +##### readUint32LE() + +> **readUint32LE**(`offset?`: `number`): `number` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `offset?` | `number` | + +###### Returns + +`number` + +###### Alias + +Buffer.readUInt32LE + +##### readUInt32LE() + +> **readUInt32LE**(`offset?`: `number`): `number` + +Reads an unsigned, little-endian 32-bit integer from `buf` at the specified`offset`. + +This function is also available under the `readUint32LE` alias. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]); + +console.log(buf.readUInt32LE(0).toString(16)); +// Prints: 78563412 +console.log(buf.readUInt32LE(1).toString(16)); +// Throws ERR_OUT_OF_RANGE. +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. | + +###### Returns + +`number` + +##### readUint8() + +> **readUint8**(`offset?`: `number`): `number` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `offset?` | `number` | + +###### Returns + +`number` + +###### Alias + +Buffer.readUInt8 + +##### readUInt8() + +> **readUInt8**(`offset?`: `number`): `number` + +Reads an unsigned 8-bit integer from `buf` at the specified `offset`. + +This function is also available under the `readUint8` alias. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.from([1, -2]); + +console.log(buf.readUInt8(0)); +// Prints: 1 +console.log(buf.readUInt8(1)); +// Prints: 254 +console.log(buf.readUInt8(2)); +// Throws ERR_OUT_OF_RANGE. +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `offset?` | `number` | Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`. | + +###### Returns + +`number` + ##### subarray() -> **subarray**(`start?`: `number`, `end?`: `number`): [`Buffer`](#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. + +Specifying `end` greater than `buf.length` will return the same result as +that of `end` equal to `buf.length`. + +This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray). + +Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap. + +```js +import { Buffer } from 'buffer'; + +// Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte +// from the original `Buffer`. + +const buf1 = Buffer.alloc(26); + +for (let i = 0; i < 26; i++) { + // 97 is the decimal ASCII value for 'a'. + buf1[i] = i + 97; +} + +const buf2 = buf1.subarray(0, 3); + +console.log(buf2.toString('ascii', 0, buf2.length)); +// Prints: abc + +buf1[0] = 33; + +console.log(buf2.toString('ascii', 0, buf2.length)); +// Prints: !bc +``` + +Specifying negative indexes causes the slice to be generated relative to the +end of `buf` rather than the beginning. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.from('buffer'); + +console.log(buf.subarray(-6, -1).toString()); +// Prints: buffe +// (Equivalent to buf.subarray(0, 5).) + +console.log(buf.subarray(-6, -2).toString()); +// Prints: buff +// (Equivalent to buf.subarray(0, 4).) + +console.log(buf.subarray(-5, -2).toString()); +// Prints: uff +// (Equivalent to buf.subarray(1, 4).) +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `start?` | `number` | Where the new `Buffer` will start. | +| `end?` | `number` | Where the new `Buffer` will end (not inclusive). | + +###### Returns + +[`Buffer`](#buffer) + +###### Overrides + +`Uint8Array.subarray` + +##### toString() + +> **toString**(`encoding?`: [`BufferEncoding`](#bufferencoding), `start?`: `number`, `end?`: `number`): `string` + +Decodes `buf` to a string according to the specified character encoding in`encoding`. `start` and `end` may be passed to decode only a subset of `buf`. + +If `encoding` is `'utf8'` and a byte sequence in the input is not valid UTF-8, +then each invalid byte is replaced with the replacement character `U+FFFD`. + +```js +import { Buffer } from 'node:buffer'; + +const buf1 = Buffer.allocUnsafe(26); + +for (let i = 0; i < 26; i++) { + // 97 is the decimal ASCII value for 'a'. + buf1[i] = i + 97; +} + +console.log(buf1.toString('utf8')); +// Prints: abcdefghijklmnopqrstuvwxyz +console.log(buf1.toString('utf8', 0, 5)); +// Prints: abcde + +const buf2 = Buffer.from('tést'); + +console.log(buf2.toString('hex')); +// Prints: 74c3a97374 +console.log(buf2.toString('utf8', 0, 3)); +// Prints: té +console.log(buf2.toString(undefined, 0, 3)); +// Prints: té +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `encoding?` | [`BufferEncoding`](#bufferencoding) | The character encoding to use. | +| `start?` | `number` | The byte offset to start decoding at. | +| `end?` | `number` | The byte offset to stop decoding at (not inclusive). | + +###### Returns + +`string` + +###### Overrides + +`Uint8Array.toString` + +##### write() + +###### Call Signature + +> **write**(`string`: `string`, `encoding?`: [`BufferEncoding`](#bufferencoding)): `number` + +Writes `string` to `buf` at `offset` according to the character encoding in`encoding`. The `length` parameter is the number of bytes to write. If `buf` did +not contain enough space to fit the entire string, only part of `string` will be +written. However, partially encoded characters will not be written. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.alloc(256); + +const len = buf.write('\u00bd + \u00bc = \u00be', 0); + +console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`); +// Prints: 12 bytes: ½ + ¼ = ¾ + +const buffer = Buffer.alloc(10); + +const length = buffer.write('abcd', 8); + +console.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`); +// Prints: 2 bytes : ab +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `string` | `string` | String to write to `buf`. | +| `encoding?` | [`BufferEncoding`](#bufferencoding) | The character encoding of `string`. | + +###### Returns + +`number` + +Number of bytes written. + +###### Call Signature + +> **write**(`string`: `string`, `offset`: `number`, `encoding?`: [`BufferEncoding`](#bufferencoding)): `number` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `string` | `string` | +| `offset` | `number` | +| `encoding?` | [`BufferEncoding`](#bufferencoding) | + +###### Returns -Returns a new `Buffer` that references the same memory as the original, but -offset and cropped by the `start` and `end` indices. +`number` -Specifying `end` greater than `buf.length` will return the same result as -that of `end` equal to `buf.length`. +###### Call Signature -This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray). +> **write**(`string`: `string`, `offset`: `number`, `length`: `number`, `encoding?`: [`BufferEncoding`](#bufferencoding)): `number` -Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap. +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `string` | `string` | +| `offset` | `number` | +| `length` | `number` | +| `encoding?` | [`BufferEncoding`](#bufferencoding) | + +###### Returns + +`number` + +##### writeBigInt64BE() + +> **writeBigInt64BE**(`value`: `bigint`, `offset?`: `number`): `number` + +Writes `value` to `buf` at the specified `offset` as big-endian. + +`value` is interpreted and written as a two's complement signed integer. ```js import { Buffer } from 'buffer'; -// Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte -// from the original `Buffer`. +const buf = Buffer.allocUnsafe(8); -const buf1 = Buffer.alloc(26); +buf.writeBigInt64BE(0x0102030405060708n, 0); -for (let i = 0; i < 26; i++) { - // 97 is the decimal ASCII value for 'a'. - buf1[i] = i + 97; -} +console.log(buf); +// Prints: +``` -const buf2 = buf1.subarray(0, 3); +###### Parameters -console.log(buf2.toString('ascii', 0, buf2.length)); -// Prints: abc +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `value` | `bigint` | Number to be written to `buf`. | +| `offset?` | `number` | Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. | -buf1[0] = 33; +###### Returns -console.log(buf2.toString('ascii', 0, buf2.length)); -// Prints: !bc +`number` + +`offset` plus the number of bytes written. + +##### writeBigInt64LE() + +> **writeBigInt64LE**(`value`: `bigint`, `offset?`: `number`): `number` + +Writes `value` to `buf` at the specified `offset` as little-endian. + +`value` is interpreted and written as a two's complement signed integer. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.allocUnsafe(8); + +buf.writeBigInt64LE(0x0102030405060708n, 0); + +console.log(buf); +// Prints: ``` -Specifying negative indexes causes the slice to be generated relative to the -end of `buf` rather than the beginning. +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `value` | `bigint` | Number to be written to `buf`. | +| `offset?` | `number` | Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. | + +###### Returns + +`number` + +`offset` plus the number of bytes written. + +##### writeBigUint64BE() + +> **writeBigUint64BE**(`value`: `bigint`, `offset?`: `number`): `number` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `value` | `bigint` | +| `offset?` | `number` | + +###### Returns + +`number` + +###### Alias + +Buffer.writeBigUInt64BE + +##### writeBigUint64LE() + +> **writeBigUint64LE**(`value`: `bigint`, `offset?`: `number`): `number` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `value` | `bigint` | +| `offset?` | `number` | + +###### Returns + +`number` + +###### Alias + +Buffer.writeBigUInt64LE + +##### writeDoubleBE() + +> **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. ```js import { Buffer } from 'buffer'; -const buf = Buffer.from('buffer'); +const buf = Buffer.allocUnsafe(8); -console.log(buf.subarray(-6, -1).toString()); -// Prints: buffe -// (Equivalent to buf.subarray(0, 5).) +buf.writeDoubleBE(123.456, 0); -console.log(buf.subarray(-6, -2).toString()); -// Prints: buff -// (Equivalent to buf.subarray(0, 4).) +console.log(buf); +// Prints: +``` -console.log(buf.subarray(-5, -2).toString()); -// Prints: uff -// (Equivalent to buf.subarray(1, 4).) +###### Parameters + +| 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`. | + +###### Returns + +`number` + +`offset` plus the number of bytes written. + +##### writeDoubleLE() + +> **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. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.allocUnsafe(8); + +buf.writeDoubleLE(123.456, 0); + +console.log(buf); +// Prints: ``` ###### Parameters | Parameter | Type | Description | | ------ | ------ | ------ | -| `start?` | `number` | Where the new `Buffer` will start. | -| `end?` | `number` | Where the new `Buffer` will end (not inclusive). | +| `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`. | ###### Returns -[`Buffer`](#buffer) +`number` -###### Overrides +`offset` plus the number of bytes written. -`Uint8Array.subarray` +##### writeFloatBE() -##### toString() +> **writeFloatBE**(`value`: `number`, `offset?`: `number`): `number` -> **toString**(`encoding?`: [`BufferEncoding`](#bufferencoding)): `string` +Writes `value` to `buf` at the specified `offset` as big-endian. Behavior is +undefined when `value` is anything other than a JavaScript number. -Decodes `buf` to a string according to the specified character encoding in`encoding`. +```js +import { Buffer } from 'buffer'; -If `encoding` is `'utf8'` and a byte sequence in the input is not valid UTF-8, -then each invalid byte is replaced with the replacement character `U+FFFD`. +const buf = Buffer.allocUnsafe(4); + +buf.writeFloatBE(0xcafebabe, 0); + +console.log(buf); +// Prints: +``` + +###### Parameters + +| 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`. | + +###### Returns + +`number` + +`offset` plus the number of bytes written. + +##### writeFloatLE() + +> **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. ```js import { Buffer } from 'buffer'; -const buf1 = Buffer.alloc(26); +const buf = Buffer.allocUnsafe(4); -for (let i = 0; i < 26; i++) { - // 97 is the decimal ASCII value for 'a'. - buf1[i] = i + 97; -} +buf.writeFloatLE(0xcafebabe, 0); -console.log(buf1.toString('utf8')); -// Prints: abcdefghijklmnopqrstuvwxyz +console.log(buf); +// Prints: +``` -const buf2 = Buffer.from('tést'); +###### Parameters -console.log(buf2.toString('hex')); -// Prints: 74c3a97374 +| 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`. | + +###### Returns + +`number` + +`offset` plus the number of bytes written. + +##### writeInt16BE() + +> **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. + +The `value` is interpreted and written as a two's complement signed integer. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.allocUnsafe(2); + +buf.writeInt16BE(0x0102, 0); + +console.log(buf); +// Prints: ``` ###### Parameters | Parameter | Type | Description | | ------ | ------ | ------ | -| `encoding?` | [`BufferEncoding`](#bufferencoding) | The character encoding to use. | +| `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`. | ###### Returns -`string` +`number` -###### Overrides +`offset` plus the number of bytes written. -`Uint8Array.toString` +##### writeInt16LE() -##### writeDoubleBE() +> **writeInt16LE**(`value`: `number`, `offset?`: `number`): `number` -> **writeDoubleBE**(`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. -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. +The `value` is interpreted and written as a two's complement signed integer. ```js import { Buffer } from 'buffer'; -const buf = Buffer.allocUnsafe(8); +const buf = Buffer.allocUnsafe(2); -buf.writeDoubleBE(123.456, 0); +buf.writeInt16LE(0x0304, 0); console.log(buf); -// Prints: +// Prints: ``` ###### Parameters @@ -220,7 +1130,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 - 2`. | ###### Returns @@ -228,30 +1138,32 @@ console.log(buf); `offset` plus the number of bytes written. -##### writeDoubleLE() +##### writeInt32BE() -> **writeDoubleLE**(`value`: `number`, `offset?`: `number`): `number` +> **writeInt32BE**(`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. +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. + +The `value` is interpreted and written as a two's complement signed integer. ```js import { Buffer } from 'buffer'; -const buf = Buffer.allocUnsafe(8); +const buf = Buffer.allocUnsafe(4); -buf.writeDoubleLE(123.456, 0); +buf.writeInt32BE(0x01020304, 0); console.log(buf); -// Prints: +// Prints: ``` ###### Parameters | 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`. | +| `value` | `number` | - | +| `offset?` | `number` | Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. | ###### Returns @@ -259,22 +1171,24 @@ console.log(buf); `offset` plus the number of bytes written. -##### writeFloatBE() +##### writeInt32LE() -> **writeFloatBE**(`value`: `number`, `offset?`: `number`): `number` +> **writeInt32LE**(`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. +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. + +The `value` is interpreted and written as a two's complement signed integer. ```js import { Buffer } from 'buffer'; const buf = Buffer.allocUnsafe(4); -buf.writeFloatBE(0xcafebabe, 0); +buf.writeInt32LE(0x05060708, 0); console.log(buf); -// Prints: +// Prints: ``` ###### Parameters @@ -290,22 +1204,26 @@ console.log(buf); `offset` plus the number of bytes written. -##### writeFloatLE() +##### writeInt8() -> **writeFloatLE**(`value`: `number`, `offset?`: `number`): `number` +> **writeInt8**(`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. +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 +a signed 8-bit integer. + +`value` is interpreted and written as a two's complement signed integer. ```js import { Buffer } from 'buffer'; -const buf = Buffer.allocUnsafe(4); +const buf = Buffer.allocUnsafe(2); -buf.writeFloatLE(0xcafebabe, 0); +buf.writeInt8(2, 0); +buf.writeInt8(-2, 1); console.log(buf); -// Prints: +// Prints: ``` ###### Parameters @@ -313,7 +1231,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 - 1`. | ###### Returns @@ -321,24 +1239,44 @@ console.log(buf); `offset` plus the number of bytes written. -##### writeInt16BE() +##### writeUint16BE() -> **writeInt16BE**(`value`: `number`, `offset?`: `number`): `number` +> **writeUint16BE**(`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. +###### Parameters -The `value` is interpreted and written as a two's complement signed integer. +| Parameter | Type | +| ------ | ------ | +| `value` | `number` | +| `offset?` | `number` | + +###### Returns + +`number` + +###### Alias + +Buffer.writeUInt16BE + +##### writeUInt16BE() + +> **writeUInt16BE**(`value`: `number`, `offset?`: `number`): `number` + +Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid unsigned 16-bit integer. Behavior is undefined when `value`is anything other than an +unsigned 16-bit integer. + +This function is also available under the `writeUint16BE` alias. ```js import { Buffer } from 'buffer'; -const buf = Buffer.allocUnsafe(2); +const buf = Buffer.allocUnsafe(4); -buf.writeInt16BE(0x0102, 0); +buf.writeUInt16BE(0xdead, 0); +buf.writeUInt16BE(0xbeef, 2); console.log(buf); -// Prints: +// Prints: ``` ###### Parameters @@ -354,24 +1292,44 @@ console.log(buf); `offset` plus the number of bytes written. -##### writeInt16LE() +##### writeUint16LE() -> **writeInt16LE**(`value`: `number`, `offset?`: `number`): `number` +> **writeUint16LE**(`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. +###### Parameters -The `value` is interpreted and written as a two's complement signed integer. +| Parameter | Type | +| ------ | ------ | +| `value` | `number` | +| `offset?` | `number` | + +###### Returns + +`number` + +###### Alias + +Buffer.writeUInt16LE + +##### writeUInt16LE() + +> **writeUInt16LE**(`value`: `number`, `offset?`: `number`): `number` + +Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid unsigned 16-bit integer. Behavior is undefined when `value` is +anything other than an unsigned 16-bit integer. + +This function is also available under the `writeUint16LE` alias. ```js import { Buffer } from 'buffer'; -const buf = Buffer.allocUnsafe(2); +const buf = Buffer.allocUnsafe(4); -buf.writeInt16LE(0x0304, 0); +buf.writeUInt16LE(0xdead, 0); +buf.writeUInt16LE(0xbeef, 2); console.log(buf); -// Prints: +// Prints: ``` ###### Parameters @@ -387,31 +1345,50 @@ console.log(buf); `offset` plus the number of bytes written. -##### writeInt32BE() +##### writeUint32BE() -> **writeInt32BE**(`value`: `number`, `offset?`: `number`): `number` +> **writeUint32BE**(`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. +###### Parameters -The `value` is interpreted and written as a two's complement signed integer. +| Parameter | Type | +| ------ | ------ | +| `value` | `number` | +| `offset?` | `number` | + +###### Returns + +`number` + +###### Alias + +Buffer.writeUInt32BE + +##### writeUInt32BE() + +> **writeUInt32BE**(`value`: `number`, `offset?`: `number`): `number` + +Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid unsigned 32-bit integer. Behavior is undefined when `value`is anything other than an +unsigned 32-bit integer. + +This function is also available under the `writeUint32BE` alias. ```js import { Buffer } from 'buffer'; const buf = Buffer.allocUnsafe(4); -buf.writeInt32BE(0x01020304, 0); +buf.writeUInt32BE(0xfeedface, 0); console.log(buf); -// Prints: +// Prints: ``` ###### Parameters | Parameter | Type | Description | | ------ | ------ | ------ | -| `value` | `number` | - | +| `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`. | ###### Returns @@ -420,24 +1397,43 @@ console.log(buf); `offset` plus the number of bytes written. -##### writeInt32LE() +##### writeUint32LE() -> **writeInt32LE**(`value`: `number`, `offset?`: `number`): `number` +> **writeUint32LE**(`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. +###### Parameters -The `value` is interpreted and written as a two's complement signed integer. +| Parameter | Type | +| ------ | ------ | +| `value` | `number` | +| `offset?` | `number` | + +###### Returns + +`number` + +###### Alias + +Buffer.writeUInt32LE + +##### writeUInt32LE() + +> **writeUInt32LE**(`value`: `number`, `offset?`: `number`): `number` + +Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid unsigned 32-bit integer. Behavior is undefined when `value` is +anything other than an unsigned 32-bit integer. + +This function is also available under the `writeUint32LE` alias. ```js import { Buffer } from 'buffer'; const buf = Buffer.allocUnsafe(4); -buf.writeInt32LE(0x05060708, 0); +buf.writeUInt32LE(0xfeedface, 0); console.log(buf); -// Prints: +// Prints: ``` ###### Parameters @@ -453,26 +1449,47 @@ console.log(buf); `offset` plus the number of bytes written. -##### writeInt8() +##### writeUint8() -> **writeInt8**(`value`: `number`, `offset?`: `number`): `number` +> **writeUint8**(`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 -a signed 8-bit integer. +###### Parameters -`value` is interpreted and written as a two's complement signed integer. +| Parameter | Type | +| ------ | ------ | +| `value` | `number` | +| `offset?` | `number` | + +###### Returns + +`number` + +###### Alias + +Buffer.writeUInt8 + +##### writeUInt8() + +> **writeUInt8**(`value`: `number`, `offset?`: `number`): `number` + +Writes `value` to `buf` at the specified `offset`. `value` must be a +valid unsigned 8-bit integer. Behavior is undefined when `value` is anything +other than an unsigned 8-bit integer. + +This function is also available under the `writeUint8` alias. ```js import { Buffer } from 'buffer'; -const buf = Buffer.allocUnsafe(2); +const buf = Buffer.allocUnsafe(4); -buf.writeInt8(2, 0); -buf.writeInt8(-2, 1); +buf.writeUInt8(0x3, 0); +buf.writeUInt8(0x4, 1); +buf.writeUInt8(0x23, 2); +buf.writeUInt8(0x42, 3); console.log(buf); -// Prints: +// Prints: ``` ###### Parameters @@ -544,6 +1561,83 @@ console.log(buf); [`Buffer`](#buffer) +##### allocUnsafe() + +> **allocUnsafe**(`size`: `number`): [`Buffer`](#buffer) + +Allocates a new `Buffer` of `size` bytes. + +The underlying memory for `Buffer` instances created in this way is _not_ +_initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes. + +```js +import { Buffer } from 'buffer'; + +const buf = Buffer.allocUnsafe(10); + +console.log(buf); +// Prints (contents may vary): + +buf.fill(0); + +console.log(buf); +// Prints: +``` + +A `TypeError` will be thrown if `size` is not a number. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `size` | `number` | The desired length of the new `Buffer`. | + +###### Returns + +[`Buffer`](#buffer) + +##### allocUnsafeSlow() + +> **allocUnsafeSlow**(`size`: `number`): [`Buffer`](#buffer) + +Allocates a new `Buffer` of `size` bytes. + +The underlying memory for `Buffer` instances created in this way is _not_ +_initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize +such `Buffer` instances with zeroes. + +```js +import { Buffer } from 'buffer'; + +// Need to keep around a few small chunks of memory. +const store = []; + +socket.on('readable', () => { + let data; + while (null !== (data = readable.read())) { + // Allocate for retained data. + const sb = Buffer.allocUnsafeSlow(10); + + // Copy the data into the new allocation. + data.copy(sb, 0, 0, 10); + + store.push(sb); + } +}); +``` + +A `TypeError` will be thrown if `size` is not a number. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `size` | `number` | The desired length of the new `Buffer`. | + +###### Returns + +[`Buffer`](#buffer) + ##### byteLength() > **byteLength**(`string`: `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](#buffer), `encoding?`: [`BufferEncoding`](#bufferencoding)): `number` @@ -696,11 +1790,70 @@ If not provided, {encoding} defaults to 'utf8'. [`Buffer`](#buffer) +##### isBuffer() + +> **isBuffer**(`obj`: `any`): `obj is Buffer` + +Returns `true` if `obj` is a `Buffer`, `false` otherwise. + +```js +import { Buffer } from 'buffer'; + +Buffer.isBuffer(Buffer.alloc(10)); // true +Buffer.isBuffer(Buffer.from('foo')); // true +Buffer.isBuffer('a string'); // false +Buffer.isBuffer([]); // false +Buffer.isBuffer(new Uint8Array(1024)); // false +``` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `obj` | `any` | + +###### Returns + +`obj is Buffer` + +##### isEncoding() + +> **isEncoding**(`encoding`: `string`): `encoding is BufferEncoding` + +Returns `true` if `encoding` is the name of a supported character encoding, +or `false` otherwise. + +```js +import { Buffer } from 'buffer'; + +console.log(Buffer.isEncoding('utf8')); +// Prints: true + +console.log(Buffer.isEncoding('hex')); +// Prints: true + +console.log(Buffer.isEncoding('utf/8')); +// Prints: false + +console.log(Buffer.isEncoding('')); +// Prints: false +``` + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `encoding` | `string` | A character encoding name to check. | + +###### Returns + +`encoding is BufferEncoding` + ## 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"` \| `"ucs2"` \| `"ucs-2"` \| `"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"` *** diff --git a/src/reference/modules/llrt/fs/fs/promises.md b/src/reference/modules/llrt/fs/fs/promises.md index 81dab7c..73b12a4 100644 --- a/src/reference/modules/llrt/fs/fs/promises.md +++ b/src/reference/modules/llrt/fs/fs/promises.md @@ -903,9 +903,38 @@ Fulfills with the {fs.Stats} object for the given `path`. *** +### symlink() + +> **symlink**(`target`: `string`, `path`: `string`, `type?`: `"dir"` \| `"file"` \| `"junction"` \| `null`): `Promise`\<`void`\> + +Creates a symbolic link. + +The `type` argument is only used on Windows platforms and can be one of `'dir'`, `'file'`, or `'junction'`. If the `type` argument is not a string, LLRT will +autodetect `target` type and use `'file'` or `'dir'`. If the `target` does not +exist, `'file'` will be used. Windows junction points require the destination +path to be absolute. When using `'junction'`, the `target` argument will +automatically be normalized to absolute path. Junction points on NTFS volumes +can only point to directories. + +#### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `target` | `string` | - | +| `path` | `string` | - | +| `type?` | `"dir"` \| `"file"` \| `"junction"` \| `null` | | + +#### Returns + +`Promise`\<`void`\> + +Fulfills with `undefined` upon success. + +*** + ### writeFile() -> **writeFile**(`file`: `string`, `data`: `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](../../globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](../../buffer.md#buffer)): `Promise`\<`void`\> +> **writeFile**(`file`: `string`, `data`: `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](../../globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](../../buffer.md#buffer), `options?`: `object`): `Promise`\<`void`\> Asynchronously writes data to a file, replacing the file if it already exists. @@ -924,6 +953,8 @@ passed to it. | ------ | ------ | ------ | | `file` | `string` | filename or `FileHandle` | | `data` | `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](../../globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](../../buffer.md#buffer) | - | +| `options?` | \{ `mode?`: `number`; \} | - | +| `options.mode?` | `number` | - | #### Returns diff --git a/src/reference/modules/llrt/fs/index.md b/src/reference/modules/llrt/fs/index.md index eb95bc4..d105a47 100644 --- a/src/reference/modules/llrt/fs/index.md +++ b/src/reference/modules/llrt/fs/index.md @@ -937,9 +937,29 @@ Synchronously removes files and directories (modeled on the standard POSIX `rm` *** +### symlinkSync() + +> **symlinkSync**(`target`: `string`, `path`: `string`, `type?`: `"dir"` \| `"file"` \| `"junction"` \| `null`): `void` + +Synchronous symlink(2) - Create a new symbolic link to an existing file. + +#### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `target` | `string` | A path to an existing file. If a URL is provided, it must use the `file:` protocol. | +| `path` | `string` | A path to the new symlink. If a URL is provided, it must use the `file:` protocol. | +| `type?` | `"dir"` \| `"file"` \| `"junction"` \| `null` | | + +#### Returns + +`void` + +*** + ### writeFileSync() -> **writeFileSync**(`file`: `string`, `data`: `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](../globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](../buffer.md#buffer)): `void` +> **writeFileSync**(`file`: `string`, `data`: `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](../globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](../buffer.md#buffer), `options?`: `object`): `void` Returns `undefined`. @@ -952,6 +972,8 @@ this API: [promises.writeFile](fs/promises.md#writefile-2). | ------ | ------ | ------ | | `file` | `string` | A path to a file. | | `data` | `string` \| `ArrayBuffer` \| `SharedArrayBuffer` \| [`ArrayBufferView`](../globals/namespaces/QuickJS.md#arraybufferview) \| [`Buffer`](../buffer.md#buffer) | - | +| `options?` | \{ `mode?`: `number`; \} | - | +| `options.mode?` | `number` | - | #### Returns diff --git a/src/reference/sdks/backend/events.md b/src/reference/sdks/backend/events.md index 546ef79..3e8e7a5 100644 --- a/src/reference/sdks/backend/events.md +++ b/src/reference/sdks/backend/events.md @@ -96,3 +96,47 @@ sdk.events.onProjectChange((sdk, project) => { } }); ``` + +##### onUpstream() + +> **onUpstream**(`callback`: (`sdk`: [`SDK`](index.md#sdk)\<`API`, `Events`\>, `request`: [`RequestSpecRaw`](requests.md#requestspecraw)) => [`MaybePromise`](shared.md#maybepromise)\<[`UpstreamResult`](#upstreamresult)\>): `void` + +Callback called before the request is sent to the target. + +This callback is called synchronously so special care should be taken +to not impact overall performance. + +The callback can return a `Connection` that will then be used to send the request. +It can also return a `RequestSpec` to override the request sent to the target. + +This will only be called if the user has enabled it for a given domain +in the settings for Upstream Plugins. + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `callback` | (`sdk`: [`SDK`](index.md#sdk)\<`API`, `Events`\>, `request`: [`RequestSpecRaw`](requests.md#requestspecraw)) => [`MaybePromise`](shared.md#maybepromise)\<[`UpstreamResult`](#upstreamresult)\> | + +###### Returns + +`void` + +###### Example + +```ts +sdk.events.onUpstream(async (sdk, request) => { + // Send all requests to example.com + return { + connection: await sdk.net.connect("https://example.com"), + }; +}); +``` + +*** + +### UpstreamResult + +> **UpstreamResult** = [`Connection`](net.md#connection) \| [`RequestSpec`](requests.md#requestspec) \| \{ `connection?`: [`Connection`](net.md#connection); `request?`: [`RequestSpec`](requests.md#requestspec); \} \| `undefined` + +The result of an upstream callback. diff --git a/src/reference/sdks/backend/index.md b/src/reference/sdks/backend/index.md index 1c86b2c..447d430 100644 --- a/src/reference/sdks/backend/index.md +++ b/src/reference/sdks/backend/index.md @@ -65,6 +65,12 @@ The SDK for the HostedFile service. The SDK for metadata information about the plugin. +##### net + +> **net**: [`NetSDK`](projects.md#netsdk) + +The SDK for the Net service. + ##### projects > **projects**: [`ProjectsSDK`](projects.md#projectssdk) @@ -108,6 +114,7 @@ The SDK for the Scope service. - [Environment](environment.md) - [GraphQL](graphql.md) - [HostedFile](hostedfile.md) +- [Net](net.md) - [Other](other.md) - [Runtime](runtime.md) - [Scope](scope.md) diff --git a/src/reference/sdks/backend/net.md b/src/reference/sdks/backend/net.md new file mode 100644 index 0000000..17f4735 --- /dev/null +++ b/src/reference/sdks/backend/net.md @@ -0,0 +1,157 @@ +# Net + +### ConnectionInfo + +Information about a target. + +#### Constructors + +##### Constructor + +> **new ConnectionInfo**(`url`: `string`): [`ConnectionInfo`](#connectioninfo) + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `url` | `string` | + +###### Returns + +[`ConnectionInfo`](#connectioninfo) + +#### Accessors + +##### host + +###### Get Signature + +> **get** **host**(): `string` + +###### Returns + +`string` + +###### Set Signature + +> **set** **host**(`value`: `string`): `void` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `value` | `string` | + +###### Returns + +`void` + +##### port + +###### Get Signature + +> **get** **port**(): `number` + +###### Returns + +`number` + +###### Set Signature + +> **set** **port**(`value`: `number`): `void` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `value` | `number` | + +###### Returns + +`void` + +##### sni + +###### Get Signature + +> **get** **sni**(): `string` \| `undefined` + +###### Returns + +`string` \| `undefined` + +###### Set Signature + +> **set** **sni**(`value`: `string` \| `null`): `void` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `value` | `string` \| `null` | + +###### Returns + +`void` + +##### tls + +###### Get Signature + +> **get** **tls**(): `boolean` + +###### Returns + +`boolean` + +###### Set Signature + +> **set** **tls**(`value`: `boolean`): `void` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `value` | `boolean` | + +###### Returns + +`void` + +*** + +### Connection + +> **Connection** = `object` + +A TCP connection. + +#### Methods + +##### receive() + +> **receive**(`size?`: `number`): `Promise`\<`Uint8Array`\> + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `size?` | `number` | + +###### Returns + +`Promise`\<`Uint8Array`\> + +##### send() + +> **send**(`bytes`: [`Bytes`](shared.md#bytes)): `Promise`\<`void`\> + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `bytes` | [`Bytes`](shared.md#bytes) | + +###### Returns + +`Promise`\<`void`\> diff --git a/src/reference/sdks/backend/other.md b/src/reference/sdks/backend/other.md index f34063d..3400077 100644 --- a/src/reference/sdks/backend/other.md +++ b/src/reference/sdks/backend/other.md @@ -268,6 +268,37 @@ Information on the current page of paginated data. #### Properties +##### connection? + +> `optional` **connection**: [`Connection`](net.md#connection) + +The [Connection](net.md#connection) to use for the request. + +If provided, the request will be sent through the connection. + +If not provided, the engine will open a new connection to the target. + +###### Default + +```ts +undefined +``` + +##### plugins? + +> `optional` **plugins**: `boolean` + +If true, the request will be sent through the upstream plugins. + +It defaults to to true most of the time except when called from +a `onUpstream` callback. + +###### Default + +```ts +true +``` + ##### save? > `optional` **save**: `boolean` diff --git a/src/reference/sdks/backend/projects.md b/src/reference/sdks/backend/projects.md index b0af6bb..1844ae3 100644 --- a/src/reference/sdks/backend/projects.md +++ b/src/reference/sdks/backend/projects.md @@ -1,5 +1,45 @@ # Projects +### NetSDK + +> **NetSDK** = `object` + +The SDK for the Projects service. + +#### Methods + +##### connect() + +###### Call Signature + +> **connect**(`info`: [`ConnectionInfo`](net.md#connectioninfo)): `Promise`\<[`Connection`](net.md#connection)\> + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | [`ConnectionInfo`](net.md#connectioninfo) | + +###### Returns + +`Promise`\<[`Connection`](net.md#connection)\> + +###### Call Signature + +> **connect**(`url`: `string`): `Promise`\<[`Connection`](net.md#connection)\> + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `url` | `string` | + +###### Returns + +`Promise`\<[`Connection`](net.md#connection)\> + +*** + ### Project > **Project** = `object` diff --git a/src/reference/sdks/backend/requests.md b/src/reference/sdks/backend/requests.md index d121ed6..36c01e5 100644 --- a/src/reference/sdks/backend/requests.md +++ b/src/reference/sdks/backend/requests.md @@ -174,6 +174,18 @@ Get the host of the request. `string` +##### getInfo() + +> **getInfo**(): [`ConnectionInfo`](net.md#connectioninfo) + +Get the connection information of the request. + +###### Returns + +[`ConnectionInfo`](net.md#connectioninfo) + +The connection information. + ##### getMethod() ###### Call Signature @@ -314,6 +326,16 @@ Get if the request uses TLS (HTTPS). `boolean` +##### getUrl() + +> **getUrl**(): `string` + +The full URL of the request. + +###### Returns + +`string` + ##### removeHeader() > **removeHeader**(`name`: `string`): `void` @@ -610,6 +632,18 @@ Get the host of the request. `string` +##### getInfo() + +> **getInfo**(): [`ConnectionInfo`](net.md#connectioninfo) + +Get the connection information of the request. + +###### Returns + +[`ConnectionInfo`](net.md#connectioninfo) + +The connection information. + ##### getPort() > **getPort**(): `number` @@ -630,7 +664,7 @@ Get the raw bytes of the request. `Uint8Array` -##### getSpec() +##### ~~getSpec()~~ > **getSpec**(): [`RequestSpec`](#requestspec) @@ -640,6 +674,10 @@ This methods converts the [RequestSpecRaw](#requestspecraw) to a [RequestSpec](# [`RequestSpec`](#requestspec) +###### Deprecated + +Use `toSpec` instead. + ###### Throws If the bytes are not a valid HTTP request. @@ -726,6 +764,24 @@ Set if the request uses TLS (HTTPS). `void` +##### toSpec() + +> **toSpec**(): [`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) + *** ### GetHeaderOptions @@ -1063,6 +1119,20 @@ An item in a connection of requests. *** +### RequestSendPayload + +> **RequestSendPayload** = [`RequestResponse`](#requestresponse) & `object` + +A saved Request and Response pair with the connection used to send the request. + +#### Type Declaration + +##### connection + +> **connection**: [`Connection`](net.md#connection) + +*** + ### RequestSendTimeouts > **RequestSendTimeouts** = `object` @@ -1324,7 +1394,7 @@ await sdk.requests.get("1"); ##### inScope() -> **inScope**(`request`: [`Request`](#request) \| [`RequestSpec`](#requestspec), `scopes?`: [`Scope`](scope.md#scope)[] \| [`ID`](shared.md#id)[]): `boolean` +> **inScope**(`request`: [`RequestSpec`](#requestspec) \| [`Request`](#request), `scopes?`: [`Scope`](scope.md#scope)[] \| [`ID`](shared.md#id)[]): `boolean` Checks if a request is in scope. @@ -1332,7 +1402,7 @@ Checks if a request is in scope. | Parameter | Type | Description | | ------ | ------ | ------ | -| `request` | [`Request`](#request) \| [`RequestSpec`](#requestspec) | The request to check | +| `request` | [`RequestSpec`](#requestspec) \| [`Request`](#request) | 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 @@ -1391,7 +1461,7 @@ sdk.console.log(`ID: ${page.items[1].request.getId()}`); ##### send() -> **send**(`request`: [`RequestSpec`](#requestspec) \| [`RequestSpecRaw`](#requestspecraw), `options?`: [`RequestSendOptions`](other.md#requestsendoptions)): `Promise`\<[`RequestResponse`](#requestresponse)\> +> **send**(`request`: [`RequestSpec`](#requestspec) \| [`RequestSpecRaw`](#requestspecraw), `options?`: [`RequestSendOptions`](other.md#requestsendoptions)): `Promise`\<[`RequestSendPayload`](#requestsendpayload)\> Sends an HTTP request, either a [RequestSpec](#requestspec) or [RequestSpecRaw](#requestspecraw). @@ -1406,7 +1476,7 @@ This respects the upstream proxy settings. ###### Returns -`Promise`\<[`RequestResponse`](#requestresponse)\> +`Promise`\<[`RequestSendPayload`](#requestsendpayload)\> ###### Throws diff --git a/src/reference/sdks/frontend/ai.md b/src/reference/sdks/frontend/ai.md index 143a1ae..fe6de89 100644 --- a/src/reference/sdks/frontend/ai.md +++ b/src/reference/sdks/frontend/ai.md @@ -28,7 +28,7 @@ Settings for AI language model. ### AIProvider -> **AIProvider** = `ProviderV2` & (`modelId`: `string`, `settings?`: [`AILanguageModelSettings`](#ailanguagemodelsettings)) => `LanguageModelV2` +> **AIProvider** = `ProviderV3` & (`modelId`: `string`, `settings?`: [`AILanguageModelSettings`](#ailanguagemodelsettings)) => `LanguageModelV3` Official AI Provider to be used by the [ai](https://ai-sdk.dev/) library. @@ -67,3 +67,51 @@ Creates a new AI provider instance that can be used with the [ai](https://ai-sdk [`AIProvider`](#aiprovider) A provider instance compatible with the [ai](https://ai-sdk.dev/) library. + +##### getUpstreamProviders() + +> **getUpstreamProviders**: () => [`AIUpstreamProvider`](#aiupstreamprovider)[] + +Gets the list of upstream AI providers with their configuration status. + +###### Returns + +[`AIUpstreamProvider`](#aiupstreamprovider)[] + +An array of AI upstream providers with their configuration status. + +*** + +### AIUpstreamProvider + +> **AIUpstreamProvider** = `object` + +AI upstream provider information. + +#### Properties + +##### id + +> **id**: [`AIUpstreamProviderId`](#aiupstreamproviderid) + +##### status + +> **status**: [`AIUpstreamProviderStatus`](#aiupstreamproviderstatus) + +*** + +### AIUpstreamProviderId + +> **AIUpstreamProviderId** = `"anthropic"` \| `"google"` \| `"openai"` \| `"openrouter"` + +AI upstream provider ID. + +*** + +### AIUpstreamProviderStatus + +> **AIUpstreamProviderStatus** = `"Ready"` \| `"Missing"` + +AI upstream provider status. +Ready: The upstream provider is ready to use. +Missing: The upstream provider is not configured. diff --git a/src/reference/sdks/frontend/assistant.md b/src/reference/sdks/frontend/assistant.md new file mode 100644 index 0000000..4f506ef --- /dev/null +++ b/src/reference/sdks/frontend/assistant.md @@ -0,0 +1,13 @@ +# Assistant + +### AssistantPageContext + +> **AssistantPageContext** = `object` + +Assistant page context. + +#### Properties + +##### kind + +> **kind**: `"Assistant"` diff --git a/src/reference/sdks/frontend/automate.md b/src/reference/sdks/frontend/automate.md index 57c7f5b..a93ae66 100644 --- a/src/reference/sdks/frontend/automate.md +++ b/src/reference/sdks/frontend/automate.md @@ -1,5 +1,55 @@ # Automate +### AutomateEntry + +> **AutomateEntry** = `object` + +A automate entry. + +#### Properties + +##### createdAt + +> **createdAt**: `Date` + +The date the entry was created. + +##### id + +> **id**: [`ID`](utils.md#id) + +The ID of the entry. + +##### name + +> **name**: `string` + +The name of the entry. + +*** + +### AutomatePageContext + +> **AutomatePageContext** = `object` + +Automate page context. + +#### Properties + +##### kind + +> **kind**: `"Automate"` + +##### requestSelection + +> **requestSelection**: [`Selection`](utils.md#selection)\<[`ID`](utils.md#id)\> + +##### selection + +> **selection**: [`Selection`](utils.md#selection)\<\{ `id`: [`ID`](utils.md#id); `kind`: `"AutomateSession"`; \} \| \{ `id`: [`ID`](utils.md#id); `kind`: `"AutomateEntry"`; \}\> + +*** + ### AutomateSDK > **AutomateSDK** = `object` @@ -8,6 +58,38 @@ Utilities to interact with the Automate page. #### Properties +##### addEntryIndicator() + +> **addEntryIndicator**: (`entryId`: [`ID`](utils.md#id), `indicator`: [`AddIndicatorOptions`](utils.md#addindicatoroptions)) => [`Indicator`](utils.md#indicator) + +Add an indicator to an automate entry. +Indicators are displayed next to the entry name in the collections tree. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `entryId` | [`ID`](utils.md#id) | The ID of the entry to add the indicator to. | +| `indicator` | [`AddIndicatorOptions`](utils.md#addindicatoroptions) | The indicator configuration. | + +###### Returns + +[`Indicator`](utils.md#indicator) + +A handle object with a `remove` method to remove the indicator. + +###### Example + +```ts +const indicator = sdk.automate.addEntryIndicator(entryId, { + icon: "fas fa-exclamation-triangle", + description: "Security warning", +}); + +// Later, remove the indicator +indicator.remove(); +``` + ##### addRequestEditorExtension() > **addRequestEditorExtension**: (`extension`: `Extension`) => `void` @@ -39,3 +121,83 @@ Add a custom request view mode. ###### Returns `void` + +##### addResponseViewMode() + +> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)) => `void` + +Add a custom response view mode. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions) | The view mode options. | + +###### Returns + +`void` + +##### getEntries() + +> **getEntries**: (`sessionId`: [`ID`](utils.md#id)) => [`AutomateEntry`](#automateentry)[] + +Get the list of all automate entries. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `sessionId` | [`ID`](utils.md#id) | The ID of the session to get the entries of. | + +###### Returns + +[`AutomateEntry`](#automateentry)[] + +The list of all automate entries. + +##### getSessions() + +> **getSessions**: () => [`AutomateSession`](#automatesession)[] + +Get the list of all automate sessions. + +###### Returns + +[`AutomateSession`](#automatesession)[] + +The list of all automate sessions. + +*** + +### AutomateSession + +> **AutomateSession** = `object` + +A automate session. + +#### Properties + +##### createdAt + +> **createdAt**: `Date` + +The date the session was created. + +##### 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. diff --git a/src/reference/sdks/frontend/backups.md b/src/reference/sdks/frontend/backups.md new file mode 100644 index 0000000..ccf5c13 --- /dev/null +++ b/src/reference/sdks/frontend/backups.md @@ -0,0 +1,13 @@ +# Backups + +### BackupsPageContext + +> **BackupsPageContext** = `object` + +Backups page context. + +#### Properties + +##### kind + +> **kind**: `"Backups"` diff --git a/src/reference/sdks/frontend/certificate.md b/src/reference/sdks/frontend/certificate.md new file mode 100644 index 0000000..c671707 --- /dev/null +++ b/src/reference/sdks/frontend/certificate.md @@ -0,0 +1,13 @@ +# Certificate + +### CertificatePageContext + +> **CertificatePageContext** = `object` + +Certificate page context. + +#### Properties + +##### kind + +> **kind**: `"Certificate"` diff --git a/src/reference/sdks/frontend/environment.md b/src/reference/sdks/frontend/environment.md index 602d84d..5683c49 100644 --- a/src/reference/sdks/frontend/environment.md +++ b/src/reference/sdks/frontend/environment.md @@ -1,5 +1,23 @@ # Environment +### EnvironmentPageContext + +> **EnvironmentPageContext** = `object` + +Environment page context. + +#### Properties + +##### kind + +> **kind**: `"Environment"` + +##### selection + +> **selection**: [`Selection`](utils.md#selection)\<[`ID`](utils.md#id)\> + +*** + ### EnvironmentSDK > **EnvironmentSDK** = `object` diff --git a/src/reference/sdks/frontend/exports.md b/src/reference/sdks/frontend/exports.md new file mode 100644 index 0000000..34209e9 --- /dev/null +++ b/src/reference/sdks/frontend/exports.md @@ -0,0 +1,13 @@ +# Exports + +### ExportsPageContext + +> **ExportsPageContext** = `object` + +Exports page context. + +#### Properties + +##### kind + +> **kind**: `"Exports"` diff --git a/src/reference/sdks/frontend/files.md b/src/reference/sdks/frontend/files.md index c7246b8..3b9e9d7 100644 --- a/src/reference/sdks/frontend/files.md +++ b/src/reference/sdks/frontend/files.md @@ -76,6 +76,20 @@ The asset file. *** +### FilesPageContext + +> **FilesPageContext** = `object` + +Files page context. + +#### Properties + +##### kind + +> **kind**: `"Files"` + +*** + ### FilesSDK > **FilesSDK** = `object` diff --git a/src/reference/sdks/frontend/filters.md b/src/reference/sdks/frontend/filters.md index 794de3f..1f24370 100644 --- a/src/reference/sdks/frontend/filters.md +++ b/src/reference/sdks/frontend/filters.md @@ -51,6 +51,24 @@ The HTTPQL expression of the filter. *** +### FilterPageContext + +> **FilterPageContext** = `object` + +Filter page context. + +#### Properties + +##### kind + +> **kind**: `"Filter"` + +##### selection + +> **selection**: [`Selection`](utils.md#selection)\<[`ID`](utils.md#id)\> + +*** + ### FiltersSDK > **FiltersSDK** = `object` diff --git a/src/reference/sdks/frontend/findings.md b/src/reference/sdks/frontend/findings.md index f88dfbe..2cf77b3 100644 --- a/src/reference/sdks/frontend/findings.md +++ b/src/reference/sdks/frontend/findings.md @@ -46,6 +46,24 @@ The title of the finding. *** +### FindingsPageContext + +> **FindingsPageContext** = `object` + +Findings page context. + +#### Properties + +##### kind + +> **kind**: `"Findings"` + +##### selection + +> **selection**: [`Selection`](utils.md#selection)\<[`ID`](utils.md#id)\> + +*** + ### FindingsSDK > **FindingsSDK** = `object` @@ -86,6 +104,22 @@ Add a custom request view mode. `void` +##### addResponseViewMode() + +> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)) => `void` + +Add a custom response view mode. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions) | The view mode options. | + +###### Returns + +`void` + ##### createFinding() > **createFinding**: (`requestId`: [`ID`](utils.md#id), `options`: `object`) => `Promise`\<[`Finding`](#finding) \| `undefined`\> diff --git a/src/reference/sdks/frontend/http-history.md b/src/reference/sdks/frontend/http-history.md index cb534ba..69ee21d 100644 --- a/src/reference/sdks/frontend/http-history.md +++ b/src/reference/sdks/frontend/http-history.md @@ -1,5 +1,23 @@ # HTTP History +### HTTPHistoryPageContext + +> **HTTPHistoryPageContext** = `object` + +HTTP history page context. + +#### Properties + +##### kind + +> **kind**: `"HTTPHistory"` + +##### selection + +> **selection**: [`Selection`](utils.md#selection)\<[`ID`](utils.md#id)\> + +*** + ### HTTPHistorySDK > **HTTPHistorySDK** = `object` @@ -56,6 +74,22 @@ Add an extension to the response editor. `void` +##### addResponseViewMode() + +> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)) => `void` + +Add a custom response view mode. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions) | The view mode options. | + +###### Returns + +`void` + ##### addToSlot > **addToSlot**: [`DefineAddToSlotFn`](slots.md#defineaddtoslotfn)\<[`HTTPHistorySlotContent`](other.md#httphistoryslotcontent)\> diff --git a/src/reference/sdks/frontend/index.md b/src/reference/sdks/frontend/index.md index 90aea36..5273a19 100644 --- a/src/reference/sdks/frontend/index.md +++ b/src/reference/sdks/frontend/index.md @@ -155,6 +155,12 @@ Utilities to interact with scopes Utilities to interact with the Search page. +##### settings + +> **settings**: [`SettingsSDK`](settings.md#settingssdk) + +Utilities to interact with the settings page. + ##### shortcuts > **shortcuts**: [`ShortcutsSDK`](shortcuts.md#shortcutssdk) @@ -216,9 +222,13 @@ Utilities to interact with workflows. - [Search](search.md) - [Files](files.md) - [AI](ai.md) +- [Assistant](assistant.md) - [Automate](automate.md) +- [Backups](backups.md) +- [Certificate](certificate.md) - [Editor](editor.md) - [Environment](environment.md) +- [Exports](exports.md) - [Filter](filter.md) - [Filters](filters.md) - [Footer](footer.md) @@ -229,8 +239,11 @@ Utilities to interact with workflows. - [Other](other.md) - [Projects](projects.md) - [Request](request.md) +- [Response](response.md) - [Runtime](runtime.md) +- [Settings](settings.md) - [Sitemap](sitemap.md) - [Slots](slots.md) - [Utils](utils.md) +- [Websockets](websockets.md) - [Workflows](workflows.md) diff --git a/src/reference/sdks/frontend/intercept.md b/src/reference/sdks/frontend/intercept.md index 466bddb..70e9342 100644 --- a/src/reference/sdks/frontend/intercept.md +++ b/src/reference/sdks/frontend/intercept.md @@ -1,5 +1,45 @@ # Intercept +### InterceptMessageId + +> **InterceptMessageId** = `string` & `object` + +A unique intercept message identifier. + +#### Type Declaration + +##### \_\_interceptMessageId? + +> `optional` **\_\_interceptMessageId**: `never` + +*** + +### InterceptPageContext + +> **InterceptPageContext** = `object` + +Intercept page context. + +#### Properties + +##### kind + +> **kind**: `"Intercept"` + +##### requestSelection + +> **requestSelection**: [`Selection`](utils.md#selection)\<[`InterceptMessageId`](#interceptmessageid)\> + +##### responseSelection + +> **responseSelection**: [`Selection`](utils.md#selection)\<[`InterceptMessageId`](#interceptmessageid)\> + +##### websocketSelection + +> **websocketSelection**: [`Selection`](utils.md#selection)\<[`InterceptMessageId`](#interceptmessageid)\> + +*** + ### InterceptSDK > **InterceptSDK** = `object` diff --git a/src/reference/sdks/frontend/match-and-replace.md b/src/reference/sdks/frontend/match-and-replace.md index 3a19490..f6bf36f 100644 --- a/src/reference/sdks/frontend/match-and-replace.md +++ b/src/reference/sdks/frontend/match-and-replace.md @@ -496,6 +496,24 @@ An operation to update the response status code. *** +### MatchReplacePageContext + +> **MatchReplacePageContext** = `object` + +Match and Replace page context. + +#### Properties + +##### kind + +> **kind**: `"MatchReplace"` + +##### selection + +> **selection**: [`Selection`](utils.md#selection)\<[`ID`](utils.md#id)\> + +*** + ### MatchReplaceReplacer > **MatchReplaceReplacer** = [`MatchReplaceReplacerTerm`](#matchreplacereplacerterm) \| [`MatchReplaceReplacerWorkflow`](#matchreplacereplacerworkflow) @@ -597,6 +615,38 @@ Utilities to interact with the Match and Replace page. #### Properties +##### addRuleIndicator() + +> **addRuleIndicator**: (`ruleId`: [`ID`](utils.md#id), `indicator`: [`AddIndicatorOptions`](utils.md#addindicatoroptions)) => [`Indicator`](utils.md#indicator) + +Add an indicator to a rule. +Indicators are displayed next to the session name in the collections tree. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `ruleId` | [`ID`](utils.md#id) | The ID of the rule to add the indicator to. | +| `indicator` | [`AddIndicatorOptions`](utils.md#addindicatoroptions) | The indicator configuration. | + +###### Returns + +[`Indicator`](utils.md#indicator) + +A handle object with a `remove` method to remove the indicator. + +###### Example + +```ts +const indicator = sdk.matchReplace.addRuleIndicator(ruleId, { + icon: "fas fa-exclamation-triangle", + description: "Security warning", +}); + +// Later, remove the indicator +indicator.remove(); +``` + ##### addToSlot > **addToSlot**: [`DefineAddToSlotFn`](slots.md#defineaddtoslotfn)\<[`MatchReplaceSlotContent`](#matchreplaceslotcontent)\> diff --git a/src/reference/sdks/frontend/navigation.md b/src/reference/sdks/frontend/navigation.md index b7a0e5f..bc82c1c 100644 --- a/src/reference/sdks/frontend/navigation.md +++ b/src/reference/sdks/frontend/navigation.md @@ -150,7 +150,7 @@ Available route identifiers in Caido. ##### MatchReplace -> `readonly` **MatchReplace**: `"Tamper"` +> `readonly` **MatchReplace**: `"MatchReplace"` ##### Plugins diff --git a/src/reference/sdks/frontend/other.md b/src/reference/sdks/frontend/other.md index bd65aa8..c3db7ec 100644 --- a/src/reference/sdks/frontend/other.md +++ b/src/reference/sdks/frontend/other.md @@ -1,5 +1,11 @@ # Other +### ChildState + +> **ChildState** = \{ `kind`: `"Empty"`; \} \| \{ `kind`: `"NotLoaded"`; \} \| \{ `items`: [`ID`](utils.md#id)[]; `kind`: `"Loaded"`; \} + +*** + ### CommandID > **CommandID** = `string` & `object` @@ -171,6 +177,50 @@ A unique command identifier. *** +### SettingsSlot + +> **SettingsSlot** = *typeof* [`SettingsSlot`](#settingsslot)\[keyof *typeof* [`SettingsSlot`](#settingsslot-1)\] + +*** + +### SettingsSlotContent + +> **SettingsSlotContent** = `object` + +#### Properties + +##### plugins-section + +> **plugins-section**: [`SettingsPluginSlotContent`](settings.md#settingspluginslotcontent) + +*** + +### SitemapRootEntry + +> **SitemapRootEntry** = `object` + +#### Properties + +##### childState + +> **childState**: [`ChildState`](#childstate) + +The child state of the entry. + +##### id + +> **id**: [`ID`](utils.md#id) + +The ID of the entry. + +##### label + +> **label**: `string` + +The label of the entry. + +*** + ### Source > **Source** = *typeof* [`Source`](match-and-replace.md#source)\[keyof *typeof* [`Source`](#source-1)\] diff --git a/src/reference/sdks/frontend/projects.md b/src/reference/sdks/frontend/projects.md index e2df94a..d70e1f2 100644 --- a/src/reference/sdks/frontend/projects.md +++ b/src/reference/sdks/frontend/projects.md @@ -1,5 +1,19 @@ # Projects +### ProjectsPageContext + +> **ProjectsPageContext** = `object` + +Projects page context. + +#### Properties + +##### kind + +> **kind**: `"Projects"` + +*** + ### ProjectsSDK > **ProjectsSDK** = `object` diff --git a/src/reference/sdks/frontend/replay.md b/src/reference/sdks/frontend/replay.md index 3a675e0..ac9ab56 100644 --- a/src/reference/sdks/frontend/replay.md +++ b/src/reference/sdks/frontend/replay.md @@ -105,6 +105,24 @@ The ID of the session this entry belongs to. *** +### ReplayPageContext + +> **ReplayPageContext** = `object` + +Replay page context. + +#### Properties + +##### kind + +> **kind**: `"Replay"` + +##### selection + +> **selection**: [`Selection`](utils.md#selection)\<[`ReplaySessionId`](#replaysessionid)\> + +*** + ### ReplaySDK > **ReplaySDK** = `object` @@ -145,6 +163,38 @@ Add a custom view mode for requests. `void` +##### addSessionIndicator() + +> **addSessionIndicator**: (`sessionId`: [`ID`](utils.md#id), `indicator`: [`AddIndicatorOptions`](utils.md#addindicatoroptions)) => [`Indicator`](utils.md#indicator) + +Add an indicator to a replay session. +Indicators are displayed next to the session name in the collections tree. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `sessionId` | [`ID`](utils.md#id) | The ID of the session to add the indicator to. | +| `indicator` | [`AddIndicatorOptions`](utils.md#addindicatoroptions) | The indicator configuration. | + +###### Returns + +[`Indicator`](utils.md#indicator) + +A handle object with a `remove` method to remove the indicator. + +###### Example + +```ts +const indicator = sdk.replay.addSessionIndicator(sessionId, { + icon: "fas fa-exclamation-triangle", + description: "Security warning", +}); + +// Later, remove the indicator +indicator.remove(); +``` + ##### addToSlot > **addToSlot**: [`DefineAddToSlotFn`](slots.md#defineaddtoslotfn)\<[`ReplaySlotContent`](other.md#replayslotcontent)\> @@ -623,6 +673,20 @@ The newly created replay session. *** +### ReplaySessionId + +> **ReplaySessionId** = `string` & `object` + +A unique replay session identifier. + +#### Type Declaration + +##### \_\_replaySessionId? + +> `optional` **\_\_replaySessionId**: `never` + +*** + ### ReplayTab > **ReplayTab** = `object` diff --git a/src/reference/sdks/frontend/response.md b/src/reference/sdks/frontend/response.md new file mode 100644 index 0000000..080482f --- /dev/null +++ b/src/reference/sdks/frontend/response.md @@ -0,0 +1,29 @@ +# Response + +### ResponseFull + +> **ResponseFull** = [`Prettify`](utils.md#prettify)\<[`As`](utils.md#as)\<`"ResponseFull"`\> & `object`\> + +A complete response with all metadata and raw content. + +*** + +### ResponseViewModeOptions + +> **ResponseViewModeOptions** = `object` + +Options for defining a custom response 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/scopes.md b/src/reference/sdks/frontend/scopes.md index 905a7af..cfcb5bd 100644 --- a/src/reference/sdks/frontend/scopes.md +++ b/src/reference/sdks/frontend/scopes.md @@ -50,6 +50,24 @@ The name of the scope. *** +### ScopePageContext + +> **ScopePageContext** = `object` + +Scope page context. + +#### Properties + +##### kind + +> **kind**: `"Scope"` + +##### selection + +> **selection**: [`Selection`](utils.md#selection)\<[`ID`](utils.md#id)\> + +*** + ### ScopesSDK > **ScopesSDK** = `object` diff --git a/src/reference/sdks/frontend/search.md b/src/reference/sdks/frontend/search.md index 0e346e6..81d0496 100644 --- a/src/reference/sdks/frontend/search.md +++ b/src/reference/sdks/frontend/search.md @@ -1,5 +1,19 @@ # Search +### SearchPageContext + +> **SearchPageContext** = `object` + +Search page context. + +#### Properties + +##### kind + +> **kind**: `"Search"` + +*** + ### SearchSDK > **SearchSDK** = `object` @@ -40,6 +54,22 @@ Add a custom request view mode. `void` +##### addResponseViewMode() + +> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)) => `void` + +Add a custom response view mode. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions) | The view mode options. | + +###### Returns + +`void` + ##### addToSlot() > **addToSlot**: \<`T`\>(`slot`: `T`, `content`: [`SearchSlotContent`](other.md#searchslotcontent)\[`T`\]) => `void` diff --git a/src/reference/sdks/frontend/settings.md b/src/reference/sdks/frontend/settings.md new file mode 100644 index 0000000..9dbd123 --- /dev/null +++ b/src/reference/sdks/frontend/settings.md @@ -0,0 +1,65 @@ +# Settings + +### SettingsPluginSlotContent + +> **SettingsPluginSlotContent** = [`CustomSlotContent`](slots.md#customslotcontent) & `object` + +Content for a settings plugin slot. + +#### Type Declaration + +##### name + +> **name**: `string` + +The name of the plugin settings page displayed in the sidebar. + +*** + +### SettingsSDK + +> **SettingsSDK** = `object` + +Utilities to interact with the settings page. + +#### Properties + +##### addToSlot + +> **addToSlot**: [`DefineAddToSlotFn`](slots.md#defineaddtoslotfn)\<[`SettingsSlotContent`](other.md#settingsslotcontent)\> + +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.settings.addToSlot(SettingsSlot.PluginsSection, { + type: "Custom", + name: "My Plugin Settings", + definition: MySettingsComponent, +}); +``` + +*** + +### SettingsSlot + +> `const` **SettingsSlot**: `object` + +The slots in the Settings UI. + +#### Type Declaration + +##### PluginsSection + +> `readonly` **PluginsSection**: `"plugins-section"` + +The plugins section in the settings sidebar. diff --git a/src/reference/sdks/frontend/sitemap.md b/src/reference/sdks/frontend/sitemap.md index 68206c9..8e94a04 100644 --- a/src/reference/sdks/frontend/sitemap.md +++ b/src/reference/sdks/frontend/sitemap.md @@ -1,5 +1,107 @@ # Sitemap +### SitemapEntry + +> **SitemapEntry** = `object` + +An entry in sitemap. + +#### Properties + +##### childState + +> **childState**: [`ChildState`](other.md#childstate) + +The child state of the entry. + +##### id + +> **id**: [`ID`](utils.md#id) + +The ID of the entry. + +##### kind + +> **kind**: [`SitemapEntryKind`](#sitemapentrykind) + +The kind of the entry. + +##### label + +> **label**: `string` + +The label of the entry. + +##### parentId? + +> `optional` **parentId**: [`ID`](utils.md#id) + +The ID of the parent entry. + +*** + +### SitemapEntryChildStateUpdateEvent + +> **SitemapEntryChildStateUpdateEvent** = `object` + +Event fired when the child state of a sitemap entry changes. + +#### Properties + +##### entryId + +> **entryId**: [`ID`](utils.md#id) + +The ID of the entry that changed. + +##### newChildState + +> **newChildState**: [`ChildState`](other.md#childstate) + +The new child state of the entry. + +*** + +### SitemapEntryKind + +> **SitemapEntryKind** = *typeof* [`SitemapEntryKind`](#sitemapentrykind)\[keyof *typeof* [`SitemapEntryKind`](#sitemapentrykind-2)\] + +The kind of a sitemap entry. + +#### Example + +```ts +const entry = { + id: "123", + label: "Example", + kind: SitemapEntryKind.Request, +}; +``` + +*** + +### SitemapPageContext + +> **SitemapPageContext** = `object` + +Sitemap page context. + +#### Properties + +##### entrySelection + +> **entrySelection**: [`Selection`](utils.md#selection)\<[`ID`](utils.md#id)\> + +##### kind + +> **kind**: `"Sitemap"` + +##### requestSelection + +> **requestSelection**: [`Selection`](utils.md#selection)\<[`ID`](utils.md#id)\> + +*** + ### SitemapSDK > **SitemapSDK** = `object` @@ -8,6 +110,38 @@ Utilities to interact with the Sitemap page. #### Properties +##### addEntryIndicator() + +> **addEntryIndicator**: (`entryId`: [`ID`](utils.md#id), `indicator`: [`AddIndicatorOptions`](utils.md#addindicatoroptions)) => [`Indicator`](utils.md#indicator) + +Add an indicator to a sitemap session. +Indicators are displayed next to the entry name in the collections tree. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `entryId` | [`ID`](utils.md#id) | The ID of the entry to add the indicator to. | +| `indicator` | [`AddIndicatorOptions`](utils.md#addindicatoroptions) | The indicator configuration. | + +###### Returns + +[`Indicator`](utils.md#indicator) + +A handle object with a `remove` method to remove the indicator. + +###### Example + +```ts +const indicator = sdk.sitemap.addEntryIndicator(entryId, { + icon: "fas fa-exclamation-triangle", + description: "Security warning", +}); + +// Later, remove the indicator +indicator.remove(); +``` + ##### addRequestEditorExtension() > **addRequestEditorExtension**: (`extension`: `Extension`) => `void` @@ -40,6 +174,41 @@ Add a custom request view mode. `void` +##### addResponseViewMode() + +> **addResponseViewMode**: (`options`: [`ResponseViewModeOptions`](response.md#responseviewmodeoptions)) => `void` + +Add a custom response view mode. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | [`ResponseViewModeOptions`](response.md#responseviewmodeoptions) | The view mode options. | + +###### Returns + +`void` + +##### getChildren() + +> **getChildren**: (`entryId`: [`ID`](utils.md#id)) => `Promise`\<[`SitemapEntry`](#sitemapentry)[]\> + +Load children for a sitemap entry. +This will fetch and load children if they haven't been loaded yet. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `entryId` | [`ID`](utils.md#id) | The ID of the entry to load children for. | + +###### Returns + +`Promise`\<[`SitemapEntry`](#sitemapentry)[]\> + +Promise that resolves when children are loaded. + ##### getScopeId() > **getScopeId**: () => [`ID`](utils.md#id) \| `undefined` @@ -52,6 +221,47 @@ Get the current scope ID. The current scope ID. +##### getTreeEntries() + +> **getTreeEntries**: () => [`SitemapRootEntry`](other.md#sitemaprootentry)[] + +Get the list of all sitemap entries in tree format. + +###### Returns + +[`SitemapRootEntry`](other.md#sitemaprootentry)[] + +The list of all sitemap entries. + +##### onEntryChildStateUpdate() + +> **onEntryChildStateUpdate**: (`callback`: (`event`: [`SitemapEntryChildStateUpdateEvent`](#sitemapentrychildstateupdateevent)) => `void`) => [`ListenerHandle`](utils.md#listenerhandle) + +Listen for child state updates on a sitemap entry. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `callback` | (`event`: [`SitemapEntryChildStateUpdateEvent`](#sitemapentrychildstateupdateevent)) => `void` | The callback function that receives the entry ID and new child state. | + +###### Returns + +[`ListenerHandle`](utils.md#listenerhandle) + +A handle object with a `stop` method to stop listening. + +###### Example + +```ts +const handle = sdk.sitemap.onEntryChildStateUpdate((entryId, newChildState) => { + console.log(`Entry ${entryId} child state changed:`, newChildState); +}); + +// Later, stop listening +handle.stop(); +``` + ##### setScope() > **setScope**: (`id`: [`ID`](utils.md#id) \| `undefined`) => `void` @@ -67,3 +277,33 @@ Set the current scope. ###### Returns `void` + +*** + +### SitemapEntryKind + +> `const` **SitemapEntryKind**: `object` + +The kind of a sitemap entry. + +#### Type Declaration + +##### Directory + +> `readonly` **Directory**: `"DIRECTORY"` + +##### Domain + +> `readonly` **Domain**: `"DOMAIN"` + +##### Request + +> `readonly` **Request**: `"REQUEST"` + +##### RequestBody + +> `readonly` **RequestBody**: `"REQUEST_BODY"` + +##### RequestQuery + +> `readonly` **RequestQuery**: `"REQUEST_QUERY"` diff --git a/src/reference/sdks/frontend/utils.md b/src/reference/sdks/frontend/utils.md index 8310ccb..c28b555 100644 --- a/src/reference/sdks/frontend/utils.md +++ b/src/reference/sdks/frontend/utils.md @@ -1,5 +1,24 @@ # Utils +### AddIndicatorOptions + +> **AddIndicatorOptions** = `object` + +Visual indicator displayed next to a item label in a tree component. +Includes an icon and an associated description. + +#### Properties + +##### description + +> **description**: `string` + +##### icon + +> **icon**: [`Icon`](#icon) + +*** + ### As > **As**\<`TType`\> = `object` @@ -96,6 +115,24 @@ A unique Caido identifier per type. *** +### Indicator + +> **Indicator** = `object` + +Providing operations that can be performed on a item indicator. + +#### Properties + +##### remove() + +> **remove**: () => `void` + +###### Returns + +`void` + +*** + ### ListenerHandle > **ListenerHandle** = `object` @@ -141,3 +178,18 @@ Utility type for converting endpoint return types to promises. | Type Parameter | | ------ | | `T` *extends* (...`args`: `unknown`[]) => `unknown` | + +*** + +### Selection + +> **Selection**\<`TId`\> = \{ `kind`: `"Empty"`; \} \| \{ `kind`: `"Selected"`; `main`: `TId`; `secondary`: `TId`[]; \} + +Generic selection type with main and secondary items. +Main represents the primary selected item, secondary represents additional selected items. + +#### Type Parameters + +| Type Parameter | +| ------ | +| `TId` | diff --git a/src/reference/sdks/frontend/websockets.md b/src/reference/sdks/frontend/websockets.md new file mode 100644 index 0000000..4f169fb --- /dev/null +++ b/src/reference/sdks/frontend/websockets.md @@ -0,0 +1,13 @@ +# Websockets + +### WebsocketPageContext + +> **WebsocketPageContext** = `object` + +Certificate page context. + +#### Properties + +##### kind + +> **kind**: `"Websocket"` diff --git a/src/reference/sdks/frontend/window.md b/src/reference/sdks/frontend/window.md index df74634..1df4c60 100644 --- a/src/reference/sdks/frontend/window.md +++ b/src/reference/sdks/frontend/window.md @@ -52,6 +52,28 @@ Options for configuring a dialog. *** +### GlobalContext + +> **GlobalContext** = `object` + +Represents the global context of the application. + +#### Properties + +##### page? + +> `optional` **page**: [`PageContext`](#pagecontext) + +*** + +### PageContext + +> **PageContext** = [`AssistantPageContext`](assistant.md#assistantpagecontext) \| [`AutomatePageContext`](automate.md#automatepagecontext) \| [`BackupsPageContext`](backups.md#backupspagecontext) \| [`CertificatePageContext`](certificate.md#certificatepagecontext) \| [`ExportsPageContext`](exports.md#exportspagecontext) \| [`EnvironmentPageContext`](environment.md#environmentpagecontext) \| [`FilterPageContext`](filters.md#filterpagecontext) \| [`FindingsPageContext`](findings.md#findingspagecontext) \| [`HTTPHistoryPageContext`](http-history.md#httphistorypagecontext) \| [`ReplayPageContext`](replay.md#replaypagecontext) \| [`ScopePageContext`](scopes.md#scopepagecontext) \| [`SearchPageContext`](search.md#searchpagecontext) \| [`WorkflowsPageContext`](workflows.md#workflowspagecontext) \| [`ProjectsPageContext`](projects.md#projectspagecontext) \| [`FilesPageContext`](files.md#filespagecontext) \| [`MatchReplacePageContext`](match-and-replace.md#matchreplacepagecontext) \| [`InterceptPageContext`](intercept.md#interceptpagecontext) \| [`SitemapPageContext`](sitemap.md#sitemappagecontext) \| [`WebsocketPageContext`](websockets.md#websocketpagecontext) + +Represents the context of the current page. + +*** + ### WindowSDK > **WindowSDK** = `object` @@ -72,6 +94,36 @@ Get the active editor. The active editor. +##### getContext() + +> **getContext**: () => [`GlobalContext`](#globalcontext) + +Get the current global context. + +###### Returns + +[`GlobalContext`](#globalcontext) + +The current global context. + +##### onContextChange() + +> **onContextChange**: (`callback`: (`context`: [`GlobalContext`](#globalcontext)) => `void`) => [`ListenerHandle`](utils.md#listenerhandle) + +Subscribe to global context changes. + +###### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `callback` | (`context`: [`GlobalContext`](#globalcontext)) => `void` | The callback to call when the context changes. | + +###### Returns + +[`ListenerHandle`](utils.md#listenerhandle) + +An object with a `stop` method that can be called to stop listening to context changes. + ##### showDialog() > **showDialog**: (`component`: [`ComponentDefinition`](utils.md#componentdefinition), `options?`: [`DialogOptions`](#dialogoptions)) => [`Dialog`](#dialog) diff --git a/src/reference/sdks/frontend/workflows.md b/src/reference/sdks/frontend/workflows.md index 8e9d349..86015f1 100644 --- a/src/reference/sdks/frontend/workflows.md +++ b/src/reference/sdks/frontend/workflows.md @@ -158,3 +158,17 @@ Register a callback to be called when a workflow is updated. ###### Returns [`ListenerHandle`](utils.md#listenerhandle) + +*** + +### WorkflowsPageContext + +> **WorkflowsPageContext** = `object` + +Workflows page context. + +#### Properties + +##### kind + +> **kind**: `"Workflows"` diff --git a/src/reference/sdks/workflow/data.md b/src/reference/sdks/workflow/data.md index 345017b..fc62815 100644 --- a/src/reference/sdks/workflow/data.md +++ b/src/reference/sdks/workflow/data.md @@ -52,6 +52,64 @@ The input for the HTTP Javascript Nodes *** +### NodeInput + +> **NodeInput** = `object` + +The input for the JavaScript V2+ Nodes. + +#### Properties + +##### data? + +> `optional` **data**: [`Bytes`](shared.md#bytes) + +##### extra? + +> `optional` **extra**: `Record`\<`string`, `any`\> + +*** + +### NodeInputHTTP + +> **NodeInputHTTP** = `object` + +The input for HTTP JavaScript Nodes. + +#### Properties + +##### extra? + +> `optional` **extra**: `Record`\<`string`, `any`\> + +##### request? + +> `optional` **request**: [`Request`](requests.md#request) + +##### response? + +> `optional` **response**: [`Response`](requests.md#response) + +*** + +### NodeResult + +> **NodeResult** = `object` + +The result for the JavaScript V2+ Nodes. + +#### Properties + +##### data? + +> `optional` **data**: [`Bytes`](shared.md#bytes) + +##### extra? + +> `optional` **extra**: `Record`\<`string`, `any`\> + +*** + ### ~~PassiveInput~~ > **PassiveInput** = [`HttpInput`](#httpinput) diff --git a/src/reference/sdks/workflow/index.md b/src/reference/sdks/workflow/index.md index 74c73da..99727c6 100644 --- a/src/reference/sdks/workflow/index.md +++ b/src/reference/sdks/workflow/index.md @@ -42,6 +42,12 @@ The SDK for the GraphQL service. The SDK for the HostedFile service. +##### net + +> **net**: [`NetSDK`](projects.md#netsdk) + +The SDK for the Net service. + ##### projects > **projects**: [`ProjectsSDK`](projects.md#projectssdk) @@ -113,6 +119,7 @@ export function run(input, sdk) { - [Environment](environment.md) - [GraphQL](graphql.md) - [HostedFile](hostedfile.md) +- [Net](net.md) - [Other](other.md) - [Runtime](runtime.md) - [Scope](scope.md) diff --git a/src/reference/sdks/workflow/net.md b/src/reference/sdks/workflow/net.md new file mode 100644 index 0000000..17f4735 --- /dev/null +++ b/src/reference/sdks/workflow/net.md @@ -0,0 +1,157 @@ +# Net + +### ConnectionInfo + +Information about a target. + +#### Constructors + +##### Constructor + +> **new ConnectionInfo**(`url`: `string`): [`ConnectionInfo`](#connectioninfo) + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `url` | `string` | + +###### Returns + +[`ConnectionInfo`](#connectioninfo) + +#### Accessors + +##### host + +###### Get Signature + +> **get** **host**(): `string` + +###### Returns + +`string` + +###### Set Signature + +> **set** **host**(`value`: `string`): `void` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `value` | `string` | + +###### Returns + +`void` + +##### port + +###### Get Signature + +> **get** **port**(): `number` + +###### Returns + +`number` + +###### Set Signature + +> **set** **port**(`value`: `number`): `void` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `value` | `number` | + +###### Returns + +`void` + +##### sni + +###### Get Signature + +> **get** **sni**(): `string` \| `undefined` + +###### Returns + +`string` \| `undefined` + +###### Set Signature + +> **set** **sni**(`value`: `string` \| `null`): `void` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `value` | `string` \| `null` | + +###### Returns + +`void` + +##### tls + +###### Get Signature + +> **get** **tls**(): `boolean` + +###### Returns + +`boolean` + +###### Set Signature + +> **set** **tls**(`value`: `boolean`): `void` + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `value` | `boolean` | + +###### Returns + +`void` + +*** + +### Connection + +> **Connection** = `object` + +A TCP connection. + +#### Methods + +##### receive() + +> **receive**(`size?`: `number`): `Promise`\<`Uint8Array`\> + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `size?` | `number` | + +###### Returns + +`Promise`\<`Uint8Array`\> + +##### send() + +> **send**(`bytes`: [`Bytes`](shared.md#bytes)): `Promise`\<`void`\> + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `bytes` | [`Bytes`](shared.md#bytes) | + +###### Returns + +`Promise`\<`void`\> diff --git a/src/reference/sdks/workflow/other.md b/src/reference/sdks/workflow/other.md index ed4f284..950c5b8 100644 --- a/src/reference/sdks/workflow/other.md +++ b/src/reference/sdks/workflow/other.md @@ -117,6 +117,37 @@ Information on the current page of paginated data. #### Properties +##### connection? + +> `optional` **connection**: [`Connection`](net.md#connection) + +The [Connection](net.md#connection) to use for the request. + +If provided, the request will be sent through the connection. + +If not provided, the engine will open a new connection to the target. + +###### Default + +```ts +undefined +``` + +##### plugins? + +> `optional` **plugins**: `boolean` + +If true, the request will be sent through the upstream plugins. + +It defaults to to true most of the time except when called from +a `onUpstream` callback. + +###### Default + +```ts +true +``` + ##### save? > `optional` **save**: `boolean` diff --git a/src/reference/sdks/workflow/projects.md b/src/reference/sdks/workflow/projects.md index b0af6bb..1844ae3 100644 --- a/src/reference/sdks/workflow/projects.md +++ b/src/reference/sdks/workflow/projects.md @@ -1,5 +1,45 @@ # Projects +### NetSDK + +> **NetSDK** = `object` + +The SDK for the Projects service. + +#### Methods + +##### connect() + +###### Call Signature + +> **connect**(`info`: [`ConnectionInfo`](net.md#connectioninfo)): `Promise`\<[`Connection`](net.md#connection)\> + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | [`ConnectionInfo`](net.md#connectioninfo) | + +###### Returns + +`Promise`\<[`Connection`](net.md#connection)\> + +###### Call Signature + +> **connect**(`url`: `string`): `Promise`\<[`Connection`](net.md#connection)\> + +###### Parameters + +| Parameter | Type | +| ------ | ------ | +| `url` | `string` | + +###### Returns + +`Promise`\<[`Connection`](net.md#connection)\> + +*** + ### Project > **Project** = `object` diff --git a/src/reference/sdks/workflow/requests.md b/src/reference/sdks/workflow/requests.md index d121ed6..1fdb02d 100644 --- a/src/reference/sdks/workflow/requests.md +++ b/src/reference/sdks/workflow/requests.md @@ -174,6 +174,18 @@ Get the host of the request. `string` +##### getInfo() + +> **getInfo**(): [`ConnectionInfo`](net.md#connectioninfo) + +Get the connection information of the request. + +###### Returns + +[`ConnectionInfo`](net.md#connectioninfo) + +The connection information. + ##### getMethod() ###### Call Signature @@ -314,6 +326,16 @@ Get if the request uses TLS (HTTPS). `boolean` +##### getUrl() + +> **getUrl**(): `string` + +The full URL of the request. + +###### Returns + +`string` + ##### removeHeader() > **removeHeader**(`name`: `string`): `void` @@ -610,6 +632,18 @@ Get the host of the request. `string` +##### getInfo() + +> **getInfo**(): [`ConnectionInfo`](net.md#connectioninfo) + +Get the connection information of the request. + +###### Returns + +[`ConnectionInfo`](net.md#connectioninfo) + +The connection information. + ##### getPort() > **getPort**(): `number` @@ -630,7 +664,7 @@ Get the raw bytes of the request. `Uint8Array` -##### getSpec() +##### ~~getSpec()~~ > **getSpec**(): [`RequestSpec`](#requestspec) @@ -640,6 +674,10 @@ This methods converts the [RequestSpecRaw](#requestspecraw) to a [RequestSpec](# [`RequestSpec`](#requestspec) +###### Deprecated + +Use `toSpec` instead. + ###### Throws If the bytes are not a valid HTTP request. @@ -726,6 +764,24 @@ Set if the request uses TLS (HTTPS). `void` +##### toSpec() + +> **toSpec**(): [`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) + *** ### GetHeaderOptions @@ -1063,6 +1119,20 @@ An item in a connection of requests. *** +### RequestSendPayload + +> **RequestSendPayload** = [`RequestResponse`](#requestresponse) & `object` + +A saved Request and Response pair with the connection used to send the request. + +#### Type Declaration + +##### connection + +> **connection**: [`Connection`](net.md#connection) + +*** + ### RequestSendTimeouts > **RequestSendTimeouts** = `object` @@ -1391,7 +1461,7 @@ sdk.console.log(`ID: ${page.items[1].request.getId()}`); ##### send() -> **send**(`request`: [`RequestSpec`](#requestspec) \| [`RequestSpecRaw`](#requestspecraw), `options?`: [`RequestSendOptions`](other.md#requestsendoptions)): `Promise`\<[`RequestResponse`](#requestresponse)\> +> **send**(`request`: [`RequestSpec`](#requestspec) \| [`RequestSpecRaw`](#requestspecraw), `options?`: [`RequestSendOptions`](other.md#requestsendoptions)): `Promise`\<[`RequestSendPayload`](#requestsendpayload)\> Sends an HTTP request, either a [RequestSpec](#requestspec) or [RequestSpecRaw](#requestspecraw). @@ -1406,7 +1476,7 @@ This respects the upstream proxy settings. ###### Returns -`Promise`\<[`RequestResponse`](#requestresponse)\> +`Promise`\<[`RequestSendPayload`](#requestsendpayload)\> ###### Throws