API ReferenceType Aliases
SnapcapClientOpts
Type Alias: SnapcapClientOpts
type SnapcapClientOpts = {
browser: BrowserContext;
credentials?: Credentials;
dataStore: DataStore;
throttle?: | ThrottleConfig
| ThrottleGate;
};Defined in: client.ts:70
Public constructor options for SnapcapClient.
Remarks
Four top-level concerns:
dataStore— persistence backbone (cookies, bearer, sandbox storage).credentials— login identity (username|email|phone + password). Optional for warm-start scenarios.browser— browser-context fingerprint (UA required, others optional).throttle— opt-in HTTP rate limiting (off by default).
Credentials are NOT persisted to the DataStore — pass them again on subsequent process boots if you want to be able to recover from a session expiry.
See
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
browser | BrowserContext | Browser-context fingerprint. REQUIRED — userAgent inside is the key field. See BrowserContext for the full shape and the fingerprint-hygiene rationale. | client.ts:93 |
credentials? | Credentials | Login credentials. Optional — warm-start with cached cookies works without credentials, but cold-login (no cookies) requires them. See Credentials for shape (username | |
dataStore | DataStore | Persistence backbone. Cookies, bearer, sandbox storage (local_* / session_* / indexdb_*), and SDK-side blobs all land in this store under stable keys. See DataStore | client.ts:78 |
throttle? | | ThrottleConfig | ThrottleGate | Optional opt-in HTTP throttling. Default: no throttle (browser-cadence, zero overhead). Two valid shapes: 1. ThrottleConfig — per-instance. Each SnapcapClient builds its own gate from this config. Fine for single-tenant or N=1-2 clients. Aggregate rate scales with N (each client throttles independently). 2. ThrottleGate — shared across instances. Build via createSharedThrottle(config) once, pass the same gate into every client. All clients coordinate, aggregate rate stays constant in N. Recommended for multi-tenant runners (N > 2). See transport/throttle.ts for the full picture, trade-offs, and recommended rule sets (RECOMMENDED_THROTTLE_RULES). Examples new SnapcapClient({ dataStore, browser, throttle: { rules: RECOMMENDED_THROTTLE_RULES }, }); const gate = createSharedThrottle({ rules: RECOMMENDED_THROTTLE_RULES }); // pass throttle: gate into every SnapcapClient new SnapcapClient({ dataStore, browser, throttle: gate }); | client.ts:126 |