Appearance
node
Namespaces
Classes
Client
Defined in: src/node/request/Client.ts:59
HTTP/HTTPS request client with optional retry logic, HMAC signing, and minimum latency enforcement. Exposes post, get, and delete convenience methods, plus a low-level request method.
Example
ts
const client = new Client({ baseUrl: 'https://api.example.com', retry: true });
const { data } = await client.get('/users', { query: { page: 1 } });Constructors
Constructor
ts
new Client(options?): Client;Defined in: src/node/request/Client.ts:60
Parameters
| Parameter | Type |
|---|---|
options | TClientOptions |
Returns
Properties
| Property | Type | Defined in |
|---|---|---|
delete | TRequestFn | src/node/request/Client.ts:255 |
get | TRequestFn | src/node/request/Client.ts:254 |
post | TRequestFn | src/node/request/Client.ts:253 |
request | (method, path, options) => Promise<TResponse> | src/node/request/Client.ts:252 |
Response
Defined in: src/node/request/Response.ts:28
Wraps a Node.js http.IncomingMessage and provides lazy bytes(), text(), and json() accessors. Transparently decompresses gzip and deflate content encodings.
Example
ts
const response = Response.provider(incomingMessage);
const data = await response.json();Constructors
Constructor
ts
new Response(origin?): Response;Defined in: src/node/request/Response.ts:41
Parameters
| Parameter | Type |
|---|---|
origin? | any |
Returns
Properties
| Property | Type | Defined in |
|---|---|---|
_json | any | src/node/request/Response.ts:35 |
_text | string | src/node/request/Response.ts:34 |
headers | Record<string, string> | src/node/request/Response.ts:38 |
status | string | src/node/request/Response.ts:37 |
Methods
bytes()
ts
bytes(): Promise<any>;Defined in: src/node/request/Response.ts:51
Returns
Promise<any>
json()
ts
json(): any;Defined in: src/node/request/Response.ts:108
Returns
any
text()
ts
text(): any;Defined in: src/node/request/Response.ts:80
Returns
any
provider()
ts
static provider(origin?): Response;Defined in: src/node/request/Response.ts:47
Parameters
| Parameter | Type |
|---|---|
origin? | any |
Returns
Interfaces
IScanPathOptions
Defined in: src/node/scanPath.ts:5
Indexable
ts
[key: string]: anyProperties
| Property | Type | Defined in |
|---|---|---|
each? | (event, path) => void | src/node/scanPath.ts:7 |
exclude? | (path) => boolean | src/node/scanPath.ts:8 |
path | string | src/node/scanPath.ts:6 |
ISearchFilesOptions
Defined in: src/node/searchFiles/each.ts:5
Properties
| Property | Type | Defined in |
|---|---|---|
filter? | (name, isDir, depth) => boolean | src/node/searchFiles/each.ts:6 |
iteratee? | (path) => void | src/node/searchFiles/each.ts:7 |
Type Aliases
TClientOptions
ts
type TClientOptions = {
apiSecret?: string;
baseUrl?: string;
defaultHeaders?: Record<string, string>;
minLatency?: number;
retry?: boolean;
retryLimit?: number;
retryTimeoutSec?: number;
timestampKey?: string;
};Defined in: src/node/request/Client.ts:19
Properties
apiSecret?
ts
optional apiSecret?: string;Defined in: src/node/request/Client.ts:25
baseUrl?
ts
optional baseUrl?: string;Defined in: src/node/request/Client.ts:27
defaultHeaders?
ts
optional defaultHeaders?: Record<string, string>;Defined in: src/node/request/Client.ts:26
minLatency?
ts
optional minLatency?: number;Defined in: src/node/request/Client.ts:21
retry?
ts
optional retry?: boolean;Defined in: src/node/request/Client.ts:20
retryLimit?
ts
optional retryLimit?: number;Defined in: src/node/request/Client.ts:23
retryTimeoutSec?
ts
optional retryTimeoutSec?: number;Defined in: src/node/request/Client.ts:22
timestampKey?
ts
optional timestampKey?: string;Defined in: src/node/request/Client.ts:24
TRequestFn
ts
type TRequestFn = (path, options?) => Promise<TResponse>;Defined in: src/node/request/Client.ts:36
Parameters
| Parameter | Type |
|---|---|
path | string |
options? | TRequestOptions |
Returns
Promise<TResponse>
TRequestOptions
ts
type TRequestOptions = {
body?: any;
headers?: Record<string, string>;
query?: Record<string, any>;
sign?: boolean;
};Defined in: src/node/request/Client.ts:12
Properties
body?
ts
optional body?: any;Defined in: src/node/request/Client.ts:13
headers?
ts
optional headers?: Record<string, string>;Defined in: src/node/request/Client.ts:16
query?
ts
optional query?: Record<string, any>;Defined in: src/node/request/Client.ts:15
sign?
ts
optional sign?: boolean;Defined in: src/node/request/Client.ts:14
TResponse
ts
type TResponse = {
data: any;
headers: Record<string, any>;
status: number;
};Defined in: src/node/request/Client.ts:30
Properties
data
ts
data: any;Defined in: src/node/request/Client.ts:33
headers
ts
headers: Record<string, any>;Defined in: src/node/request/Client.ts:32
status
ts
status: number;Defined in: src/node/request/Client.ts:31
Functions
each()
ts
function each(folderPath, options?): Promise<void>;Defined in: src/node/searchFiles/each.ts:22
Recursively walks over files starting from folderPath, calling iteratee for each file that passes filter.
Parameters
| Parameter | Type | Description |
|---|---|---|
folderPath | string | Root directory path to walk. |
options | ISearchFilesOptions | Optional filter and iteratee callbacks. |
Returns
Promise<void>
Promise resolved when the full walk is complete.
Example
ts
await each('./src', {
iteratee: (path) => console.log(path),
});scanPath()
ts
function scanPath(options): Promise<void>;Defined in: src/node/scanPath.ts:24
Scans directory tree and calls each('found', path) for every file that is not excluded by exclude(path).
Parameters
| Parameter | Type | Description |
|---|---|---|
options | IScanPathOptions | Scan options including path, optional each callback and exclude predicate. |
Returns
Promise<void>
Promise resolved when the full scan is complete.
Example
ts
await scanPath({
path: './src',
each: (event, filePath) => console.log(filePath),
});searchFilesIndex()
ts
function searchFilesIndex(folderPath, options?): Promise<string[]>;Defined in: src/node/searchFiles/index.ts:13
Recursively collects file paths starting from folderPath using each.
Parameters
| Parameter | Type | Description |
|---|---|---|
folderPath | string | Root folder to scan. |
options? | Record<string, any> | Options forwarded to each, plus any additional settings. |
Returns
Promise<string[]>
Promise resolved with an array of collected paths.