@capbypass/sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +274 -0
- package/dist/index.d.mts +187 -0
- package/dist/index.d.ts +187 -0
- package/dist/index.js +360 -0
- package/dist/index.mjs +309 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CapBypass Development
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# CapBypass TypeScript/JavaScript SDK
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@capbypass/sdk)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
|
|
7
|
+
Official TypeScript/JavaScript SDK for the CapBypass CAPTCHA solving service. Supports reCAPTCHA v2, reCAPTCHA v3, and AWS WAF challenges.
|
|
8
|
+
|
|
9
|
+
Works in both Node.js and browser environments.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- ✅ **Simple API**: One-line `solve()` method or advanced `createTask()`/`getTaskResult()` control
|
|
14
|
+
- 🔄 **Automatic Polling**: Built-in adaptive polling with exponential backoff
|
|
15
|
+
- 🛡️ **Robust Error Handling**: Typed errors for all API and network failures
|
|
16
|
+
- 🔁 **Smart Retry Logic**: Automatic retry on network/gateway errors
|
|
17
|
+
- 🎯 **Full TypeScript Support**: Complete type definitions for excellent IDE support
|
|
18
|
+
- 🌐 **Universal**: Works in Node.js and browser environments
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @capbypass/sdk
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
### TypeScript
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { CapBypassClient, TaskType } from '@capbypass/sdk';
|
|
32
|
+
|
|
33
|
+
const client = new CapBypassClient({ apiKey: 'your-api-key' });
|
|
34
|
+
|
|
35
|
+
const solution = await client.solve({
|
|
36
|
+
type: TaskType.RECAPTCHA_V2_PROXYLESS,
|
|
37
|
+
websiteURL: 'https://www.google.com/recaptcha/api2/demo',
|
|
38
|
+
websiteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
|
|
39
|
+
}, 120);
|
|
40
|
+
|
|
41
|
+
console.log('Token:', solution.gRecaptchaResponse);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### JavaScript (CommonJS)
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
const { CapBypassClient, TaskType } = require('@capbypass/sdk');
|
|
48
|
+
|
|
49
|
+
const client = new CapBypassClient({ apiKey: 'your-api-key' });
|
|
50
|
+
|
|
51
|
+
client.solve({
|
|
52
|
+
type: TaskType.RECAPTCHA_V2_PROXYLESS,
|
|
53
|
+
websiteURL: 'https://www.google.com/recaptcha/api2/demo',
|
|
54
|
+
websiteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
|
|
55
|
+
}, 120).then(solution => {
|
|
56
|
+
console.log('Token:', solution.gRecaptchaResponse);
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### JavaScript (ES Modules)
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
import { CapBypassClient, TaskType } from '@capbypass/sdk';
|
|
64
|
+
|
|
65
|
+
const client = new CapBypassClient({ apiKey: 'your-api-key' });
|
|
66
|
+
|
|
67
|
+
const solution = await client.solve({
|
|
68
|
+
type: TaskType.RECAPTCHA_V2_PROXYLESS,
|
|
69
|
+
websiteURL: 'https://www.google.com/recaptcha/api2/demo',
|
|
70
|
+
websiteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
|
|
71
|
+
}, 120);
|
|
72
|
+
|
|
73
|
+
console.log('Token:', solution.gRecaptchaResponse);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## API Reference
|
|
77
|
+
|
|
78
|
+
### Client Creation
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import { CapBypassClient } from '@capbypass/sdk';
|
|
82
|
+
|
|
83
|
+
// With API key parameter
|
|
84
|
+
const client = new CapBypassClient({ apiKey: 'your-api-key' });
|
|
85
|
+
|
|
86
|
+
// From CAPBYPASS_API_KEY environment variable
|
|
87
|
+
const client = new CapBypassClient();
|
|
88
|
+
|
|
89
|
+
// With custom base URL
|
|
90
|
+
const client = new CapBypassClient({
|
|
91
|
+
apiKey: 'your-api-key',
|
|
92
|
+
baseURL: 'https://custom-gateway.example.com'
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Simple API (Recommended)
|
|
97
|
+
|
|
98
|
+
**solve()** - One-step CAPTCHA solving:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
const solution = await client.solve(task, timeout);
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- `task`: Task configuration (see Task Types below)
|
|
105
|
+
- `timeout`: Maximum wait time in seconds (default: 120)
|
|
106
|
+
- Returns: Promise<Solution>
|
|
107
|
+
|
|
108
|
+
### Advanced API
|
|
109
|
+
|
|
110
|
+
For full control over task lifecycle:
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
// Create task
|
|
114
|
+
const taskId = await client.createTask(task);
|
|
115
|
+
|
|
116
|
+
// Poll for result
|
|
117
|
+
const result = await client.getTaskResult(taskId);
|
|
118
|
+
|
|
119
|
+
// Check balance
|
|
120
|
+
const balance = await client.getBalance();
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Task Types
|
|
124
|
+
|
|
125
|
+
### reCAPTCHA v2
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
const solution = await client.solve({
|
|
129
|
+
type: TaskType.RECAPTCHA_V2_PROXYLESS,
|
|
130
|
+
websiteURL: 'https://example.com',
|
|
131
|
+
websiteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
|
|
132
|
+
}, 120);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Invisible reCAPTCHA v2:**
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
const solution = await client.solve({
|
|
139
|
+
type: TaskType.RECAPTCHA_V2_PROXYLESS,
|
|
140
|
+
websiteURL: 'https://example.com',
|
|
141
|
+
websiteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
|
|
142
|
+
isInvisible: true,
|
|
143
|
+
}, 120);
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### reCAPTCHA v3
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
const solution = await client.solve({
|
|
150
|
+
type: TaskType.RECAPTCHA_V3_PROXYLESS,
|
|
151
|
+
websiteURL: 'https://example.com',
|
|
152
|
+
websiteKey: '6LcR_okUAAAAAPYrPe-HK_0RULO1aZM15ENyM-Mf',
|
|
153
|
+
pageAction: 'submit',
|
|
154
|
+
}, 120);
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### AWS WAF Challenge
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
const solution = await client.solve({
|
|
161
|
+
type: TaskType.ANTI_AWS_WAF_PROXYLESS,
|
|
162
|
+
websiteURL: 'https://example.com',
|
|
163
|
+
awsChallengeJS: 'https://[...].awswaf.com/[...]/challenge.js',
|
|
164
|
+
}, 120);
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### With Proxy
|
|
168
|
+
|
|
169
|
+
All task types support proxy configuration:
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
const solution = await client.solve({
|
|
173
|
+
type: TaskType.RECAPTCHA_V2,
|
|
174
|
+
websiteURL: 'https://example.com',
|
|
175
|
+
websiteKey: '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-',
|
|
176
|
+
proxyType: 'http',
|
|
177
|
+
proxyAddress: 'proxy.example.com',
|
|
178
|
+
proxyPort: 8080,
|
|
179
|
+
proxyLogin: 'username',
|
|
180
|
+
proxyPassword: 'password',
|
|
181
|
+
}, 120);
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Error Handling
|
|
185
|
+
|
|
186
|
+
The SDK uses typed errors for precise error handling:
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
import {
|
|
190
|
+
AuthenticationError,
|
|
191
|
+
InsufficientBalanceError,
|
|
192
|
+
ValidationError,
|
|
193
|
+
TimeoutError,
|
|
194
|
+
SolverError,
|
|
195
|
+
NetworkError,
|
|
196
|
+
GatewayError,
|
|
197
|
+
} from '@capbypass/sdk';
|
|
198
|
+
|
|
199
|
+
try {
|
|
200
|
+
const solution = await client.solve(task, 120);
|
|
201
|
+
} catch (error) {
|
|
202
|
+
if (error instanceof AuthenticationError) {
|
|
203
|
+
// Invalid API key
|
|
204
|
+
} else if (error instanceof InsufficientBalanceError) {
|
|
205
|
+
// No balance
|
|
206
|
+
} else if (error instanceof ValidationError) {
|
|
207
|
+
// Invalid task parameters
|
|
208
|
+
} else if (error instanceof TimeoutError) {
|
|
209
|
+
// Task took too long
|
|
210
|
+
} else if (error instanceof SolverError) {
|
|
211
|
+
// CAPTCHA could not be solved
|
|
212
|
+
} else if (error instanceof NetworkError) {
|
|
213
|
+
// Network/connection error
|
|
214
|
+
} else if (error instanceof GatewayError) {
|
|
215
|
+
// Gateway error (502/503/504)
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Task Type Constants
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
TaskType.ANTI_AWS_WAF // AntiAwsWafTask
|
|
224
|
+
TaskType.ANTI_AWS_WAF_PROXYLESS // AntiAwsWafTaskProxyLess
|
|
225
|
+
TaskType.RECAPTCHA_V2 // ReCaptchaV2Task
|
|
226
|
+
TaskType.RECAPTCHA_V2_PROXYLESS // ReCaptchaV2TaskProxyLess
|
|
227
|
+
TaskType.RECAPTCHA_V3 // ReCaptchaV3Task
|
|
228
|
+
TaskType.RECAPTCHA_V3_PROXYLESS // ReCaptchaV3TaskProxyLess
|
|
229
|
+
TaskType.RECAPTCHA_V3_ENTERPRISE // ReCaptchaV3EnterpriseTask
|
|
230
|
+
TaskType.RECAPTCHA_V3_ENTERPRISE_PROXYLESS // ReCaptchaV3EnterpriseTaskProxyLess
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Examples
|
|
234
|
+
|
|
235
|
+
See the [examples](examples/) directory for complete examples:
|
|
236
|
+
- [recaptcha-v2.ts](examples/recaptcha-v2.ts) - reCAPTCHA v2 solving
|
|
237
|
+
- [recaptcha-v3.ts](examples/recaptcha-v3.ts) - reCAPTCHA v3 solving
|
|
238
|
+
- [aws-waf.ts](examples/aws-waf.ts) - AWS WAF challenge solving
|
|
239
|
+
|
|
240
|
+
## Testing
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# Run tests
|
|
244
|
+
npm test
|
|
245
|
+
|
|
246
|
+
# Run tests with coverage
|
|
247
|
+
npm run test:coverage
|
|
248
|
+
|
|
249
|
+
# Run tests in watch mode
|
|
250
|
+
npm run test:watch
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Building
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# Build the package
|
|
257
|
+
npm run build
|
|
258
|
+
|
|
259
|
+
# This generates:
|
|
260
|
+
# - dist/index.js (CommonJS)
|
|
261
|
+
# - dist/index.mjs (ES Module)
|
|
262
|
+
# - dist/index.d.ts (TypeScript declarations)
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## License
|
|
266
|
+
|
|
267
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
268
|
+
|
|
269
|
+
## Links
|
|
270
|
+
|
|
271
|
+
- [Documentation](https://capbypass.dev/docs/sdks/typescript)
|
|
272
|
+
- [npm Package](https://www.npmjs.com/package/@capbypass/sdk)
|
|
273
|
+
- [GitHub Repository](https://github.com/CapBypass-Development/capbypass-sdk-typescript)
|
|
274
|
+
- [Bug Reports](https://github.com/CapBypass-Development/capbypass-sdk-typescript/issues)
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task type constants for CapBypass API
|
|
3
|
+
*/
|
|
4
|
+
declare const TaskType: {
|
|
5
|
+
readonly ANTI_AWS_WAF: "AntiAwsWafTask";
|
|
6
|
+
readonly ANTI_AWS_WAF_PROXYLESS: "AntiAwsWafTaskProxyLess";
|
|
7
|
+
readonly RECAPTCHA_V2: "ReCaptchaV2Task";
|
|
8
|
+
readonly RECAPTCHA_V2_PROXYLESS: "ReCaptchaV2TaskProxyLess";
|
|
9
|
+
readonly RECAPTCHA_V3: "ReCaptchaV3Task";
|
|
10
|
+
readonly RECAPTCHA_V3_PROXYLESS: "ReCaptchaV3TaskProxyLess";
|
|
11
|
+
readonly RECAPTCHA_V3_ENTERPRISE: "ReCaptchaV3EnterpriseTask";
|
|
12
|
+
readonly RECAPTCHA_V3_ENTERPRISE_PROXYLESS: "ReCaptchaV3EnterpriseTaskProxyLess";
|
|
13
|
+
};
|
|
14
|
+
type TaskTypeValue = typeof TaskType[keyof typeof TaskType];
|
|
15
|
+
/**
|
|
16
|
+
* Base task configuration
|
|
17
|
+
*/
|
|
18
|
+
interface BaseTask {
|
|
19
|
+
type: TaskTypeValue;
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Proxy configuration for tasks
|
|
24
|
+
*/
|
|
25
|
+
interface ProxyConfig {
|
|
26
|
+
proxyType: 'http' | 'https' | 'socks4' | 'socks5';
|
|
27
|
+
proxyAddress: string;
|
|
28
|
+
proxyPort: number;
|
|
29
|
+
proxyLogin?: string;
|
|
30
|
+
proxyPassword?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Task result from getTaskResult
|
|
34
|
+
*/
|
|
35
|
+
interface TaskResult {
|
|
36
|
+
errorId: number;
|
|
37
|
+
errorCode?: string;
|
|
38
|
+
errorDescription?: string;
|
|
39
|
+
status?: 'processing' | 'ready' | 'failed';
|
|
40
|
+
solution?: Record<string, any>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Client configuration options
|
|
44
|
+
*/
|
|
45
|
+
interface ClientOptions {
|
|
46
|
+
apiKey?: string;
|
|
47
|
+
baseURL?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* CapBypass API Client
|
|
52
|
+
*/
|
|
53
|
+
declare class CapBypassClient {
|
|
54
|
+
private apiKey;
|
|
55
|
+
private httpClient;
|
|
56
|
+
/**
|
|
57
|
+
* Create a new CapBypass client
|
|
58
|
+
* @param options - Client configuration options
|
|
59
|
+
*/
|
|
60
|
+
constructor(options?: ClientOptions);
|
|
61
|
+
/**
|
|
62
|
+
* Make HTTP request with retry logic
|
|
63
|
+
*/
|
|
64
|
+
private makeRequest;
|
|
65
|
+
/**
|
|
66
|
+
* Sleep for specified milliseconds
|
|
67
|
+
*/
|
|
68
|
+
private sleep;
|
|
69
|
+
/**
|
|
70
|
+
* Create a new CAPTCHA solving task
|
|
71
|
+
* @param task - Task configuration
|
|
72
|
+
* @returns Task ID
|
|
73
|
+
*/
|
|
74
|
+
createTask(task: BaseTask): Promise<string>;
|
|
75
|
+
/**
|
|
76
|
+
* Get the result of a task
|
|
77
|
+
* @param taskId - Task ID from createTask
|
|
78
|
+
* @returns Task result
|
|
79
|
+
*/
|
|
80
|
+
getTaskResult(taskId: string): Promise<TaskResult>;
|
|
81
|
+
/**
|
|
82
|
+
* Get account balance
|
|
83
|
+
* @returns Account balance
|
|
84
|
+
*/
|
|
85
|
+
getBalance(): Promise<number>;
|
|
86
|
+
/**
|
|
87
|
+
* Create a task and poll until solved or timeout
|
|
88
|
+
* @param task - Task configuration
|
|
89
|
+
* @param timeout - Maximum wait time in seconds (default: 120)
|
|
90
|
+
* @returns Solution object
|
|
91
|
+
*/
|
|
92
|
+
solve(task: BaseTask, timeout?: number): Promise<Record<string, any>>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Base CapBypass error with Capsolver-compatible structure
|
|
97
|
+
*/
|
|
98
|
+
declare class CapBypassError extends Error {
|
|
99
|
+
readonly errorId?: number;
|
|
100
|
+
readonly errorCode?: string;
|
|
101
|
+
readonly errorDescription?: string;
|
|
102
|
+
constructor(errorCode?: string, errorDescription?: string, errorId?: number);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Capsolver API Errors
|
|
106
|
+
*/
|
|
107
|
+
/**
|
|
108
|
+
* Authentication error - invalid API key
|
|
109
|
+
*/
|
|
110
|
+
declare class AuthenticationError extends CapBypassError {
|
|
111
|
+
constructor(errorCode: string, errorDescription: string);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Insufficient balance error
|
|
115
|
+
*/
|
|
116
|
+
declare class InsufficientBalanceError extends CapBypassError {
|
|
117
|
+
constructor(errorCode: string, errorDescription: string);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Validation error - invalid task data
|
|
121
|
+
*/
|
|
122
|
+
declare class ValidationError extends CapBypassError {
|
|
123
|
+
constructor(errorCode: string, errorDescription: string);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Task not found error
|
|
127
|
+
*/
|
|
128
|
+
declare class TaskNotFoundError extends CapBypassError {
|
|
129
|
+
constructor(errorCode: string, errorDescription: string);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Solver error - CAPTCHA could not be solved
|
|
133
|
+
*/
|
|
134
|
+
declare class SolverError extends CapBypassError {
|
|
135
|
+
constructor(errorDescription: string);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Timeout error - task solving exceeded timeout
|
|
139
|
+
*/
|
|
140
|
+
declare class TimeoutError extends CapBypassError {
|
|
141
|
+
constructor();
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Internal server error
|
|
145
|
+
*/
|
|
146
|
+
declare class InternalError extends CapBypassError {
|
|
147
|
+
constructor(errorCode: string, errorDescription: string);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* HTTP-Layer Errors
|
|
151
|
+
*/
|
|
152
|
+
/**
|
|
153
|
+
* Network connection error
|
|
154
|
+
*/
|
|
155
|
+
declare class NetworkError extends Error {
|
|
156
|
+
readonly cause?: Error | undefined;
|
|
157
|
+
constructor(message: string, cause?: Error | undefined);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Gateway error (HTTP 502/503/504)
|
|
161
|
+
*/
|
|
162
|
+
declare class GatewayError extends Error {
|
|
163
|
+
readonly statusCode: number;
|
|
164
|
+
constructor(statusCode: number, message: string);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Server error (HTTP 500)
|
|
168
|
+
*/
|
|
169
|
+
declare class ServerError extends Error {
|
|
170
|
+
readonly statusCode: number;
|
|
171
|
+
constructor(statusCode: number, message: string);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Rate limit error (HTTP 429)
|
|
175
|
+
*/
|
|
176
|
+
declare class RateLimitError extends Error {
|
|
177
|
+
constructor(message: string);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Parse error - JSON parsing failed
|
|
181
|
+
*/
|
|
182
|
+
declare class ParseError extends Error {
|
|
183
|
+
readonly cause?: Error | undefined;
|
|
184
|
+
constructor(message: string, cause?: Error | undefined);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export { AuthenticationError, type BaseTask, CapBypassClient, CapBypassError, type ClientOptions, GatewayError, InsufficientBalanceError, InternalError, NetworkError, ParseError, type ProxyConfig, RateLimitError, ServerError, SolverError, TaskNotFoundError, type TaskResult, TaskType, type TaskTypeValue, TimeoutError, ValidationError };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task type constants for CapBypass API
|
|
3
|
+
*/
|
|
4
|
+
declare const TaskType: {
|
|
5
|
+
readonly ANTI_AWS_WAF: "AntiAwsWafTask";
|
|
6
|
+
readonly ANTI_AWS_WAF_PROXYLESS: "AntiAwsWafTaskProxyLess";
|
|
7
|
+
readonly RECAPTCHA_V2: "ReCaptchaV2Task";
|
|
8
|
+
readonly RECAPTCHA_V2_PROXYLESS: "ReCaptchaV2TaskProxyLess";
|
|
9
|
+
readonly RECAPTCHA_V3: "ReCaptchaV3Task";
|
|
10
|
+
readonly RECAPTCHA_V3_PROXYLESS: "ReCaptchaV3TaskProxyLess";
|
|
11
|
+
readonly RECAPTCHA_V3_ENTERPRISE: "ReCaptchaV3EnterpriseTask";
|
|
12
|
+
readonly RECAPTCHA_V3_ENTERPRISE_PROXYLESS: "ReCaptchaV3EnterpriseTaskProxyLess";
|
|
13
|
+
};
|
|
14
|
+
type TaskTypeValue = typeof TaskType[keyof typeof TaskType];
|
|
15
|
+
/**
|
|
16
|
+
* Base task configuration
|
|
17
|
+
*/
|
|
18
|
+
interface BaseTask {
|
|
19
|
+
type: TaskTypeValue;
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Proxy configuration for tasks
|
|
24
|
+
*/
|
|
25
|
+
interface ProxyConfig {
|
|
26
|
+
proxyType: 'http' | 'https' | 'socks4' | 'socks5';
|
|
27
|
+
proxyAddress: string;
|
|
28
|
+
proxyPort: number;
|
|
29
|
+
proxyLogin?: string;
|
|
30
|
+
proxyPassword?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Task result from getTaskResult
|
|
34
|
+
*/
|
|
35
|
+
interface TaskResult {
|
|
36
|
+
errorId: number;
|
|
37
|
+
errorCode?: string;
|
|
38
|
+
errorDescription?: string;
|
|
39
|
+
status?: 'processing' | 'ready' | 'failed';
|
|
40
|
+
solution?: Record<string, any>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Client configuration options
|
|
44
|
+
*/
|
|
45
|
+
interface ClientOptions {
|
|
46
|
+
apiKey?: string;
|
|
47
|
+
baseURL?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* CapBypass API Client
|
|
52
|
+
*/
|
|
53
|
+
declare class CapBypassClient {
|
|
54
|
+
private apiKey;
|
|
55
|
+
private httpClient;
|
|
56
|
+
/**
|
|
57
|
+
* Create a new CapBypass client
|
|
58
|
+
* @param options - Client configuration options
|
|
59
|
+
*/
|
|
60
|
+
constructor(options?: ClientOptions);
|
|
61
|
+
/**
|
|
62
|
+
* Make HTTP request with retry logic
|
|
63
|
+
*/
|
|
64
|
+
private makeRequest;
|
|
65
|
+
/**
|
|
66
|
+
* Sleep for specified milliseconds
|
|
67
|
+
*/
|
|
68
|
+
private sleep;
|
|
69
|
+
/**
|
|
70
|
+
* Create a new CAPTCHA solving task
|
|
71
|
+
* @param task - Task configuration
|
|
72
|
+
* @returns Task ID
|
|
73
|
+
*/
|
|
74
|
+
createTask(task: BaseTask): Promise<string>;
|
|
75
|
+
/**
|
|
76
|
+
* Get the result of a task
|
|
77
|
+
* @param taskId - Task ID from createTask
|
|
78
|
+
* @returns Task result
|
|
79
|
+
*/
|
|
80
|
+
getTaskResult(taskId: string): Promise<TaskResult>;
|
|
81
|
+
/**
|
|
82
|
+
* Get account balance
|
|
83
|
+
* @returns Account balance
|
|
84
|
+
*/
|
|
85
|
+
getBalance(): Promise<number>;
|
|
86
|
+
/**
|
|
87
|
+
* Create a task and poll until solved or timeout
|
|
88
|
+
* @param task - Task configuration
|
|
89
|
+
* @param timeout - Maximum wait time in seconds (default: 120)
|
|
90
|
+
* @returns Solution object
|
|
91
|
+
*/
|
|
92
|
+
solve(task: BaseTask, timeout?: number): Promise<Record<string, any>>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Base CapBypass error with Capsolver-compatible structure
|
|
97
|
+
*/
|
|
98
|
+
declare class CapBypassError extends Error {
|
|
99
|
+
readonly errorId?: number;
|
|
100
|
+
readonly errorCode?: string;
|
|
101
|
+
readonly errorDescription?: string;
|
|
102
|
+
constructor(errorCode?: string, errorDescription?: string, errorId?: number);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Capsolver API Errors
|
|
106
|
+
*/
|
|
107
|
+
/**
|
|
108
|
+
* Authentication error - invalid API key
|
|
109
|
+
*/
|
|
110
|
+
declare class AuthenticationError extends CapBypassError {
|
|
111
|
+
constructor(errorCode: string, errorDescription: string);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Insufficient balance error
|
|
115
|
+
*/
|
|
116
|
+
declare class InsufficientBalanceError extends CapBypassError {
|
|
117
|
+
constructor(errorCode: string, errorDescription: string);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Validation error - invalid task data
|
|
121
|
+
*/
|
|
122
|
+
declare class ValidationError extends CapBypassError {
|
|
123
|
+
constructor(errorCode: string, errorDescription: string);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Task not found error
|
|
127
|
+
*/
|
|
128
|
+
declare class TaskNotFoundError extends CapBypassError {
|
|
129
|
+
constructor(errorCode: string, errorDescription: string);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Solver error - CAPTCHA could not be solved
|
|
133
|
+
*/
|
|
134
|
+
declare class SolverError extends CapBypassError {
|
|
135
|
+
constructor(errorDescription: string);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Timeout error - task solving exceeded timeout
|
|
139
|
+
*/
|
|
140
|
+
declare class TimeoutError extends CapBypassError {
|
|
141
|
+
constructor();
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Internal server error
|
|
145
|
+
*/
|
|
146
|
+
declare class InternalError extends CapBypassError {
|
|
147
|
+
constructor(errorCode: string, errorDescription: string);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* HTTP-Layer Errors
|
|
151
|
+
*/
|
|
152
|
+
/**
|
|
153
|
+
* Network connection error
|
|
154
|
+
*/
|
|
155
|
+
declare class NetworkError extends Error {
|
|
156
|
+
readonly cause?: Error | undefined;
|
|
157
|
+
constructor(message: string, cause?: Error | undefined);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Gateway error (HTTP 502/503/504)
|
|
161
|
+
*/
|
|
162
|
+
declare class GatewayError extends Error {
|
|
163
|
+
readonly statusCode: number;
|
|
164
|
+
constructor(statusCode: number, message: string);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Server error (HTTP 500)
|
|
168
|
+
*/
|
|
169
|
+
declare class ServerError extends Error {
|
|
170
|
+
readonly statusCode: number;
|
|
171
|
+
constructor(statusCode: number, message: string);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Rate limit error (HTTP 429)
|
|
175
|
+
*/
|
|
176
|
+
declare class RateLimitError extends Error {
|
|
177
|
+
constructor(message: string);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Parse error - JSON parsing failed
|
|
181
|
+
*/
|
|
182
|
+
declare class ParseError extends Error {
|
|
183
|
+
readonly cause?: Error | undefined;
|
|
184
|
+
constructor(message: string, cause?: Error | undefined);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export { AuthenticationError, type BaseTask, CapBypassClient, CapBypassError, type ClientOptions, GatewayError, InsufficientBalanceError, InternalError, NetworkError, ParseError, type ProxyConfig, RateLimitError, ServerError, SolverError, TaskNotFoundError, type TaskResult, TaskType, type TaskTypeValue, TimeoutError, ValidationError };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
AuthenticationError: () => AuthenticationError,
|
|
34
|
+
CapBypassClient: () => CapBypassClient,
|
|
35
|
+
CapBypassError: () => CapBypassError,
|
|
36
|
+
GatewayError: () => GatewayError,
|
|
37
|
+
InsufficientBalanceError: () => InsufficientBalanceError,
|
|
38
|
+
InternalError: () => InternalError,
|
|
39
|
+
NetworkError: () => NetworkError,
|
|
40
|
+
ParseError: () => ParseError,
|
|
41
|
+
RateLimitError: () => RateLimitError,
|
|
42
|
+
ServerError: () => ServerError,
|
|
43
|
+
SolverError: () => SolverError,
|
|
44
|
+
TaskNotFoundError: () => TaskNotFoundError,
|
|
45
|
+
TaskType: () => TaskType,
|
|
46
|
+
TimeoutError: () => TimeoutError,
|
|
47
|
+
ValidationError: () => ValidationError
|
|
48
|
+
});
|
|
49
|
+
module.exports = __toCommonJS(index_exports);
|
|
50
|
+
|
|
51
|
+
// src/client.ts
|
|
52
|
+
var import_axios = __toESM(require("axios"));
|
|
53
|
+
|
|
54
|
+
// src/errors.ts
|
|
55
|
+
var CapBypassError = class extends Error {
|
|
56
|
+
constructor(errorCode, errorDescription, errorId) {
|
|
57
|
+
super(errorDescription || errorCode || "Unknown error");
|
|
58
|
+
this.name = this.constructor.name;
|
|
59
|
+
this.errorId = errorId;
|
|
60
|
+
this.errorCode = errorCode;
|
|
61
|
+
this.errorDescription = errorDescription;
|
|
62
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var AuthenticationError = class extends CapBypassError {
|
|
66
|
+
constructor(errorCode, errorDescription) {
|
|
67
|
+
super(errorCode, errorDescription, 1);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var InsufficientBalanceError = class extends CapBypassError {
|
|
71
|
+
constructor(errorCode, errorDescription) {
|
|
72
|
+
super(errorCode, errorDescription, 1);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
var ValidationError = class extends CapBypassError {
|
|
76
|
+
constructor(errorCode, errorDescription) {
|
|
77
|
+
super(errorCode, errorDescription, 1);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var TaskNotFoundError = class extends CapBypassError {
|
|
81
|
+
constructor(errorCode, errorDescription) {
|
|
82
|
+
super(errorCode, errorDescription, 16);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
var SolverError = class extends CapBypassError {
|
|
86
|
+
constructor(errorDescription) {
|
|
87
|
+
super("SOLVER_FAILED", errorDescription, 0);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
var TimeoutError = class extends CapBypassError {
|
|
91
|
+
constructor() {
|
|
92
|
+
super("TIMEOUT", "Task solving timed out", 0);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
var InternalError = class extends CapBypassError {
|
|
96
|
+
constructor(errorCode, errorDescription) {
|
|
97
|
+
super(errorCode, errorDescription, 1);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
var NetworkError = class _NetworkError extends Error {
|
|
101
|
+
constructor(message, cause) {
|
|
102
|
+
super(`Network error: ${message}`);
|
|
103
|
+
this.cause = cause;
|
|
104
|
+
this.name = "NetworkError";
|
|
105
|
+
Object.setPrototypeOf(this, _NetworkError.prototype);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
var GatewayError = class _GatewayError extends Error {
|
|
109
|
+
constructor(statusCode, message) {
|
|
110
|
+
super(`Gateway error: HTTP ${statusCode} - ${message}`);
|
|
111
|
+
this.statusCode = statusCode;
|
|
112
|
+
this.name = "GatewayError";
|
|
113
|
+
Object.setPrototypeOf(this, _GatewayError.prototype);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
var ServerError = class _ServerError extends Error {
|
|
117
|
+
constructor(statusCode, message) {
|
|
118
|
+
super(`Server error: HTTP ${statusCode} - ${message}`);
|
|
119
|
+
this.statusCode = statusCode;
|
|
120
|
+
this.name = "ServerError";
|
|
121
|
+
Object.setPrototypeOf(this, _ServerError.prototype);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
var RateLimitError = class _RateLimitError extends Error {
|
|
125
|
+
constructor(message) {
|
|
126
|
+
super(`Rate limit exceeded: ${message}`);
|
|
127
|
+
this.name = "RateLimitError";
|
|
128
|
+
Object.setPrototypeOf(this, _RateLimitError.prototype);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
var ParseError = class _ParseError extends Error {
|
|
132
|
+
constructor(message, cause) {
|
|
133
|
+
super(`Parse error: ${message}`);
|
|
134
|
+
this.cause = cause;
|
|
135
|
+
this.name = "ParseError";
|
|
136
|
+
Object.setPrototypeOf(this, _ParseError.prototype);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
function parseError(errorCode, errorDescription) {
|
|
140
|
+
switch (errorCode) {
|
|
141
|
+
case "ERROR_KEY_DOES_NOT_EXIST":
|
|
142
|
+
case "ERROR_KEY_DENIED_ACCESS":
|
|
143
|
+
throw new AuthenticationError(errorCode, errorDescription);
|
|
144
|
+
case "ERROR_ZERO_BALANCE":
|
|
145
|
+
case "ERROR_NO_SLOT_AVAILABLE":
|
|
146
|
+
throw new InsufficientBalanceError(errorCode, errorDescription);
|
|
147
|
+
case "ERROR_INVALID_TASK_DATA":
|
|
148
|
+
case "ERROR_TASK_ABSENT":
|
|
149
|
+
case "ERROR_TASK_NOT_SUPPORTED":
|
|
150
|
+
throw new ValidationError(errorCode, errorDescription);
|
|
151
|
+
case "ERROR_TASK_NOT_FOUND":
|
|
152
|
+
throw new TaskNotFoundError(errorCode, errorDescription);
|
|
153
|
+
default:
|
|
154
|
+
throw new InternalError(errorCode, errorDescription);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// src/client.ts
|
|
159
|
+
var DEFAULT_BASE_URL = "https://gateway.strayder.io";
|
|
160
|
+
var SDK_VERSION = "1.0.0";
|
|
161
|
+
var USER_AGENT = `capbypass-sdk-typescript/${SDK_VERSION}`;
|
|
162
|
+
var CapBypassClient = class {
|
|
163
|
+
/**
|
|
164
|
+
* Create a new CapBypass client
|
|
165
|
+
* @param options - Client configuration options
|
|
166
|
+
*/
|
|
167
|
+
constructor(options = {}) {
|
|
168
|
+
this.apiKey = options.apiKey || process.env.CAPBYPASS_API_KEY || "";
|
|
169
|
+
if (!this.apiKey) {
|
|
170
|
+
throw new Error(
|
|
171
|
+
"API key is required. Provide via constructor or CAPBYPASS_API_KEY environment variable."
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
this.httpClient = import_axios.default.create({
|
|
175
|
+
baseURL: options.baseURL || DEFAULT_BASE_URL,
|
|
176
|
+
timeout: 3e4,
|
|
177
|
+
headers: {
|
|
178
|
+
"Content-Type": "application/json",
|
|
179
|
+
"User-Agent": USER_AGENT
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Make HTTP request with retry logic
|
|
185
|
+
*/
|
|
186
|
+
async makeRequest(endpoint, payload, maxRetries = 3) {
|
|
187
|
+
let lastError;
|
|
188
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
189
|
+
try {
|
|
190
|
+
const response = await this.httpClient.post(endpoint, payload);
|
|
191
|
+
return response.data;
|
|
192
|
+
} catch (error) {
|
|
193
|
+
const axiosError = error;
|
|
194
|
+
if (axiosError.response && [502, 503, 504].includes(axiosError.response.status)) {
|
|
195
|
+
if (attempt < maxRetries) {
|
|
196
|
+
const backoff = Math.min(10, Math.pow(2, attempt)) + Math.random();
|
|
197
|
+
await this.sleep(backoff * 1e3);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
throw new GatewayError(
|
|
201
|
+
axiosError.response.status,
|
|
202
|
+
axiosError.response.data
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
if (axiosError.response) {
|
|
206
|
+
if (axiosError.response.status === 429) {
|
|
207
|
+
throw new RateLimitError(axiosError.response.data);
|
|
208
|
+
}
|
|
209
|
+
if (axiosError.response.status === 500) {
|
|
210
|
+
throw new ServerError(
|
|
211
|
+
axiosError.response.status,
|
|
212
|
+
axiosError.response.data
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
if (axiosError.response.status >= 400) {
|
|
216
|
+
throw new NetworkError(
|
|
217
|
+
`HTTP ${axiosError.response.status}: ${axiosError.response.data}`,
|
|
218
|
+
axiosError
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (axiosError.code === "ECONNREFUSED" || axiosError.code === "ETIMEDOUT") {
|
|
223
|
+
if (attempt < maxRetries) {
|
|
224
|
+
const backoff = Math.min(10, Math.pow(2, attempt)) + Math.random();
|
|
225
|
+
await this.sleep(backoff * 1e3);
|
|
226
|
+
lastError = new NetworkError("Connection failed", axiosError);
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
throw new NetworkError("Connection failed", axiosError);
|
|
230
|
+
}
|
|
231
|
+
throw new NetworkError(axiosError.message, axiosError);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
throw lastError;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Sleep for specified milliseconds
|
|
238
|
+
*/
|
|
239
|
+
sleep(ms) {
|
|
240
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Create a new CAPTCHA solving task
|
|
244
|
+
* @param task - Task configuration
|
|
245
|
+
* @returns Task ID
|
|
246
|
+
*/
|
|
247
|
+
async createTask(task) {
|
|
248
|
+
const request = {
|
|
249
|
+
clientKey: this.apiKey,
|
|
250
|
+
task
|
|
251
|
+
};
|
|
252
|
+
const response = await this.makeRequest(
|
|
253
|
+
"/createTask",
|
|
254
|
+
request
|
|
255
|
+
);
|
|
256
|
+
if (response.errorId !== 0) {
|
|
257
|
+
parseError(response.errorCode, response.errorDescription);
|
|
258
|
+
}
|
|
259
|
+
return response.taskId;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Get the result of a task
|
|
263
|
+
* @param taskId - Task ID from createTask
|
|
264
|
+
* @returns Task result
|
|
265
|
+
*/
|
|
266
|
+
async getTaskResult(taskId) {
|
|
267
|
+
const request = {
|
|
268
|
+
clientKey: this.apiKey,
|
|
269
|
+
taskId
|
|
270
|
+
};
|
|
271
|
+
const response = await this.makeRequest(
|
|
272
|
+
"/getTaskResult",
|
|
273
|
+
request
|
|
274
|
+
);
|
|
275
|
+
if (response.errorId !== 0) {
|
|
276
|
+
parseError(response.errorCode, response.errorDescription);
|
|
277
|
+
}
|
|
278
|
+
return response;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Get account balance
|
|
282
|
+
* @returns Account balance
|
|
283
|
+
*/
|
|
284
|
+
async getBalance() {
|
|
285
|
+
const request = {
|
|
286
|
+
clientKey: this.apiKey
|
|
287
|
+
};
|
|
288
|
+
const response = await this.makeRequest(
|
|
289
|
+
"/getBalance",
|
|
290
|
+
request
|
|
291
|
+
);
|
|
292
|
+
if (response.errorId !== 0) {
|
|
293
|
+
parseError(response.errorCode, response.errorDescription);
|
|
294
|
+
}
|
|
295
|
+
return response.balance;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Create a task and poll until solved or timeout
|
|
299
|
+
* @param task - Task configuration
|
|
300
|
+
* @param timeout - Maximum wait time in seconds (default: 120)
|
|
301
|
+
* @returns Solution object
|
|
302
|
+
*/
|
|
303
|
+
async solve(task, timeout = 120) {
|
|
304
|
+
const taskId = await this.createTask(task);
|
|
305
|
+
const startTime = Date.now();
|
|
306
|
+
let attempt = 0;
|
|
307
|
+
while (true) {
|
|
308
|
+
const elapsed = (Date.now() - startTime) / 1e3;
|
|
309
|
+
if (elapsed > timeout) {
|
|
310
|
+
throw new TimeoutError();
|
|
311
|
+
}
|
|
312
|
+
const result = await this.getTaskResult(taskId);
|
|
313
|
+
if (result.status === "ready") {
|
|
314
|
+
return result.solution;
|
|
315
|
+
}
|
|
316
|
+
if (result.status === "failed") {
|
|
317
|
+
throw new SolverError(
|
|
318
|
+
result.errorDescription || "Task failed"
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
attempt++;
|
|
322
|
+
const pollInterval = Math.min(5, Math.ceil(attempt / 2));
|
|
323
|
+
await this.sleep(pollInterval * 1e3);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
// src/types.ts
|
|
329
|
+
var TaskType = {
|
|
330
|
+
// AWS WAF
|
|
331
|
+
ANTI_AWS_WAF: "AntiAwsWafTask",
|
|
332
|
+
ANTI_AWS_WAF_PROXYLESS: "AntiAwsWafTaskProxyLess",
|
|
333
|
+
// reCAPTCHA v2
|
|
334
|
+
RECAPTCHA_V2: "ReCaptchaV2Task",
|
|
335
|
+
RECAPTCHA_V2_PROXYLESS: "ReCaptchaV2TaskProxyLess",
|
|
336
|
+
// reCAPTCHA v3
|
|
337
|
+
RECAPTCHA_V3: "ReCaptchaV3Task",
|
|
338
|
+
RECAPTCHA_V3_PROXYLESS: "ReCaptchaV3TaskProxyLess",
|
|
339
|
+
// reCAPTCHA v3 Enterprise
|
|
340
|
+
RECAPTCHA_V3_ENTERPRISE: "ReCaptchaV3EnterpriseTask",
|
|
341
|
+
RECAPTCHA_V3_ENTERPRISE_PROXYLESS: "ReCaptchaV3EnterpriseTaskProxyLess"
|
|
342
|
+
};
|
|
343
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
344
|
+
0 && (module.exports = {
|
|
345
|
+
AuthenticationError,
|
|
346
|
+
CapBypassClient,
|
|
347
|
+
CapBypassError,
|
|
348
|
+
GatewayError,
|
|
349
|
+
InsufficientBalanceError,
|
|
350
|
+
InternalError,
|
|
351
|
+
NetworkError,
|
|
352
|
+
ParseError,
|
|
353
|
+
RateLimitError,
|
|
354
|
+
ServerError,
|
|
355
|
+
SolverError,
|
|
356
|
+
TaskNotFoundError,
|
|
357
|
+
TaskType,
|
|
358
|
+
TimeoutError,
|
|
359
|
+
ValidationError
|
|
360
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
// src/client.ts
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
|
|
4
|
+
// src/errors.ts
|
|
5
|
+
var CapBypassError = class extends Error {
|
|
6
|
+
constructor(errorCode, errorDescription, errorId) {
|
|
7
|
+
super(errorDescription || errorCode || "Unknown error");
|
|
8
|
+
this.name = this.constructor.name;
|
|
9
|
+
this.errorId = errorId;
|
|
10
|
+
this.errorCode = errorCode;
|
|
11
|
+
this.errorDescription = errorDescription;
|
|
12
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var AuthenticationError = class extends CapBypassError {
|
|
16
|
+
constructor(errorCode, errorDescription) {
|
|
17
|
+
super(errorCode, errorDescription, 1);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var InsufficientBalanceError = class extends CapBypassError {
|
|
21
|
+
constructor(errorCode, errorDescription) {
|
|
22
|
+
super(errorCode, errorDescription, 1);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var ValidationError = class extends CapBypassError {
|
|
26
|
+
constructor(errorCode, errorDescription) {
|
|
27
|
+
super(errorCode, errorDescription, 1);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var TaskNotFoundError = class extends CapBypassError {
|
|
31
|
+
constructor(errorCode, errorDescription) {
|
|
32
|
+
super(errorCode, errorDescription, 16);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var SolverError = class extends CapBypassError {
|
|
36
|
+
constructor(errorDescription) {
|
|
37
|
+
super("SOLVER_FAILED", errorDescription, 0);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var TimeoutError = class extends CapBypassError {
|
|
41
|
+
constructor() {
|
|
42
|
+
super("TIMEOUT", "Task solving timed out", 0);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var InternalError = class extends CapBypassError {
|
|
46
|
+
constructor(errorCode, errorDescription) {
|
|
47
|
+
super(errorCode, errorDescription, 1);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var NetworkError = class _NetworkError extends Error {
|
|
51
|
+
constructor(message, cause) {
|
|
52
|
+
super(`Network error: ${message}`);
|
|
53
|
+
this.cause = cause;
|
|
54
|
+
this.name = "NetworkError";
|
|
55
|
+
Object.setPrototypeOf(this, _NetworkError.prototype);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var GatewayError = class _GatewayError extends Error {
|
|
59
|
+
constructor(statusCode, message) {
|
|
60
|
+
super(`Gateway error: HTTP ${statusCode} - ${message}`);
|
|
61
|
+
this.statusCode = statusCode;
|
|
62
|
+
this.name = "GatewayError";
|
|
63
|
+
Object.setPrototypeOf(this, _GatewayError.prototype);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var ServerError = class _ServerError extends Error {
|
|
67
|
+
constructor(statusCode, message) {
|
|
68
|
+
super(`Server error: HTTP ${statusCode} - ${message}`);
|
|
69
|
+
this.statusCode = statusCode;
|
|
70
|
+
this.name = "ServerError";
|
|
71
|
+
Object.setPrototypeOf(this, _ServerError.prototype);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var RateLimitError = class _RateLimitError extends Error {
|
|
75
|
+
constructor(message) {
|
|
76
|
+
super(`Rate limit exceeded: ${message}`);
|
|
77
|
+
this.name = "RateLimitError";
|
|
78
|
+
Object.setPrototypeOf(this, _RateLimitError.prototype);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var ParseError = class _ParseError extends Error {
|
|
82
|
+
constructor(message, cause) {
|
|
83
|
+
super(`Parse error: ${message}`);
|
|
84
|
+
this.cause = cause;
|
|
85
|
+
this.name = "ParseError";
|
|
86
|
+
Object.setPrototypeOf(this, _ParseError.prototype);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
function parseError(errorCode, errorDescription) {
|
|
90
|
+
switch (errorCode) {
|
|
91
|
+
case "ERROR_KEY_DOES_NOT_EXIST":
|
|
92
|
+
case "ERROR_KEY_DENIED_ACCESS":
|
|
93
|
+
throw new AuthenticationError(errorCode, errorDescription);
|
|
94
|
+
case "ERROR_ZERO_BALANCE":
|
|
95
|
+
case "ERROR_NO_SLOT_AVAILABLE":
|
|
96
|
+
throw new InsufficientBalanceError(errorCode, errorDescription);
|
|
97
|
+
case "ERROR_INVALID_TASK_DATA":
|
|
98
|
+
case "ERROR_TASK_ABSENT":
|
|
99
|
+
case "ERROR_TASK_NOT_SUPPORTED":
|
|
100
|
+
throw new ValidationError(errorCode, errorDescription);
|
|
101
|
+
case "ERROR_TASK_NOT_FOUND":
|
|
102
|
+
throw new TaskNotFoundError(errorCode, errorDescription);
|
|
103
|
+
default:
|
|
104
|
+
throw new InternalError(errorCode, errorDescription);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// src/client.ts
|
|
109
|
+
var DEFAULT_BASE_URL = "https://gateway.strayder.io";
|
|
110
|
+
var SDK_VERSION = "1.0.0";
|
|
111
|
+
var USER_AGENT = `capbypass-sdk-typescript/${SDK_VERSION}`;
|
|
112
|
+
var CapBypassClient = class {
|
|
113
|
+
/**
|
|
114
|
+
* Create a new CapBypass client
|
|
115
|
+
* @param options - Client configuration options
|
|
116
|
+
*/
|
|
117
|
+
constructor(options = {}) {
|
|
118
|
+
this.apiKey = options.apiKey || process.env.CAPBYPASS_API_KEY || "";
|
|
119
|
+
if (!this.apiKey) {
|
|
120
|
+
throw new Error(
|
|
121
|
+
"API key is required. Provide via constructor or CAPBYPASS_API_KEY environment variable."
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
this.httpClient = axios.create({
|
|
125
|
+
baseURL: options.baseURL || DEFAULT_BASE_URL,
|
|
126
|
+
timeout: 3e4,
|
|
127
|
+
headers: {
|
|
128
|
+
"Content-Type": "application/json",
|
|
129
|
+
"User-Agent": USER_AGENT
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Make HTTP request with retry logic
|
|
135
|
+
*/
|
|
136
|
+
async makeRequest(endpoint, payload, maxRetries = 3) {
|
|
137
|
+
let lastError;
|
|
138
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
139
|
+
try {
|
|
140
|
+
const response = await this.httpClient.post(endpoint, payload);
|
|
141
|
+
return response.data;
|
|
142
|
+
} catch (error) {
|
|
143
|
+
const axiosError = error;
|
|
144
|
+
if (axiosError.response && [502, 503, 504].includes(axiosError.response.status)) {
|
|
145
|
+
if (attempt < maxRetries) {
|
|
146
|
+
const backoff = Math.min(10, Math.pow(2, attempt)) + Math.random();
|
|
147
|
+
await this.sleep(backoff * 1e3);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
throw new GatewayError(
|
|
151
|
+
axiosError.response.status,
|
|
152
|
+
axiosError.response.data
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
if (axiosError.response) {
|
|
156
|
+
if (axiosError.response.status === 429) {
|
|
157
|
+
throw new RateLimitError(axiosError.response.data);
|
|
158
|
+
}
|
|
159
|
+
if (axiosError.response.status === 500) {
|
|
160
|
+
throw new ServerError(
|
|
161
|
+
axiosError.response.status,
|
|
162
|
+
axiosError.response.data
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
if (axiosError.response.status >= 400) {
|
|
166
|
+
throw new NetworkError(
|
|
167
|
+
`HTTP ${axiosError.response.status}: ${axiosError.response.data}`,
|
|
168
|
+
axiosError
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (axiosError.code === "ECONNREFUSED" || axiosError.code === "ETIMEDOUT") {
|
|
173
|
+
if (attempt < maxRetries) {
|
|
174
|
+
const backoff = Math.min(10, Math.pow(2, attempt)) + Math.random();
|
|
175
|
+
await this.sleep(backoff * 1e3);
|
|
176
|
+
lastError = new NetworkError("Connection failed", axiosError);
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
throw new NetworkError("Connection failed", axiosError);
|
|
180
|
+
}
|
|
181
|
+
throw new NetworkError(axiosError.message, axiosError);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
throw lastError;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Sleep for specified milliseconds
|
|
188
|
+
*/
|
|
189
|
+
sleep(ms) {
|
|
190
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Create a new CAPTCHA solving task
|
|
194
|
+
* @param task - Task configuration
|
|
195
|
+
* @returns Task ID
|
|
196
|
+
*/
|
|
197
|
+
async createTask(task) {
|
|
198
|
+
const request = {
|
|
199
|
+
clientKey: this.apiKey,
|
|
200
|
+
task
|
|
201
|
+
};
|
|
202
|
+
const response = await this.makeRequest(
|
|
203
|
+
"/createTask",
|
|
204
|
+
request
|
|
205
|
+
);
|
|
206
|
+
if (response.errorId !== 0) {
|
|
207
|
+
parseError(response.errorCode, response.errorDescription);
|
|
208
|
+
}
|
|
209
|
+
return response.taskId;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Get the result of a task
|
|
213
|
+
* @param taskId - Task ID from createTask
|
|
214
|
+
* @returns Task result
|
|
215
|
+
*/
|
|
216
|
+
async getTaskResult(taskId) {
|
|
217
|
+
const request = {
|
|
218
|
+
clientKey: this.apiKey,
|
|
219
|
+
taskId
|
|
220
|
+
};
|
|
221
|
+
const response = await this.makeRequest(
|
|
222
|
+
"/getTaskResult",
|
|
223
|
+
request
|
|
224
|
+
);
|
|
225
|
+
if (response.errorId !== 0) {
|
|
226
|
+
parseError(response.errorCode, response.errorDescription);
|
|
227
|
+
}
|
|
228
|
+
return response;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Get account balance
|
|
232
|
+
* @returns Account balance
|
|
233
|
+
*/
|
|
234
|
+
async getBalance() {
|
|
235
|
+
const request = {
|
|
236
|
+
clientKey: this.apiKey
|
|
237
|
+
};
|
|
238
|
+
const response = await this.makeRequest(
|
|
239
|
+
"/getBalance",
|
|
240
|
+
request
|
|
241
|
+
);
|
|
242
|
+
if (response.errorId !== 0) {
|
|
243
|
+
parseError(response.errorCode, response.errorDescription);
|
|
244
|
+
}
|
|
245
|
+
return response.balance;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Create a task and poll until solved or timeout
|
|
249
|
+
* @param task - Task configuration
|
|
250
|
+
* @param timeout - Maximum wait time in seconds (default: 120)
|
|
251
|
+
* @returns Solution object
|
|
252
|
+
*/
|
|
253
|
+
async solve(task, timeout = 120) {
|
|
254
|
+
const taskId = await this.createTask(task);
|
|
255
|
+
const startTime = Date.now();
|
|
256
|
+
let attempt = 0;
|
|
257
|
+
while (true) {
|
|
258
|
+
const elapsed = (Date.now() - startTime) / 1e3;
|
|
259
|
+
if (elapsed > timeout) {
|
|
260
|
+
throw new TimeoutError();
|
|
261
|
+
}
|
|
262
|
+
const result = await this.getTaskResult(taskId);
|
|
263
|
+
if (result.status === "ready") {
|
|
264
|
+
return result.solution;
|
|
265
|
+
}
|
|
266
|
+
if (result.status === "failed") {
|
|
267
|
+
throw new SolverError(
|
|
268
|
+
result.errorDescription || "Task failed"
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
attempt++;
|
|
272
|
+
const pollInterval = Math.min(5, Math.ceil(attempt / 2));
|
|
273
|
+
await this.sleep(pollInterval * 1e3);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
// src/types.ts
|
|
279
|
+
var TaskType = {
|
|
280
|
+
// AWS WAF
|
|
281
|
+
ANTI_AWS_WAF: "AntiAwsWafTask",
|
|
282
|
+
ANTI_AWS_WAF_PROXYLESS: "AntiAwsWafTaskProxyLess",
|
|
283
|
+
// reCAPTCHA v2
|
|
284
|
+
RECAPTCHA_V2: "ReCaptchaV2Task",
|
|
285
|
+
RECAPTCHA_V2_PROXYLESS: "ReCaptchaV2TaskProxyLess",
|
|
286
|
+
// reCAPTCHA v3
|
|
287
|
+
RECAPTCHA_V3: "ReCaptchaV3Task",
|
|
288
|
+
RECAPTCHA_V3_PROXYLESS: "ReCaptchaV3TaskProxyLess",
|
|
289
|
+
// reCAPTCHA v3 Enterprise
|
|
290
|
+
RECAPTCHA_V3_ENTERPRISE: "ReCaptchaV3EnterpriseTask",
|
|
291
|
+
RECAPTCHA_V3_ENTERPRISE_PROXYLESS: "ReCaptchaV3EnterpriseTaskProxyLess"
|
|
292
|
+
};
|
|
293
|
+
export {
|
|
294
|
+
AuthenticationError,
|
|
295
|
+
CapBypassClient,
|
|
296
|
+
CapBypassError,
|
|
297
|
+
GatewayError,
|
|
298
|
+
InsufficientBalanceError,
|
|
299
|
+
InternalError,
|
|
300
|
+
NetworkError,
|
|
301
|
+
ParseError,
|
|
302
|
+
RateLimitError,
|
|
303
|
+
ServerError,
|
|
304
|
+
SolverError,
|
|
305
|
+
TaskNotFoundError,
|
|
306
|
+
TaskType,
|
|
307
|
+
TimeoutError,
|
|
308
|
+
ValidationError
|
|
309
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@capbypass/sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Official TypeScript/JavaScript SDK for CapBypass CAPTCHA solving service",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
20
|
+
"test": "jest",
|
|
21
|
+
"test:watch": "jest --watch",
|
|
22
|
+
"test:coverage": "jest --coverage",
|
|
23
|
+
"lint": "eslint src/**/*.ts",
|
|
24
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
25
|
+
"prepublishOnly": "npm run build && npm test"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"captcha",
|
|
29
|
+
"recaptcha",
|
|
30
|
+
"aws-waf",
|
|
31
|
+
"automation",
|
|
32
|
+
"solver",
|
|
33
|
+
"typescript",
|
|
34
|
+
"javascript"
|
|
35
|
+
],
|
|
36
|
+
"author": {
|
|
37
|
+
"name": "CapBypass Development",
|
|
38
|
+
"email": "dev@capbypass.dev"
|
|
39
|
+
},
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/CapBypass-Development/capbypass-sdk-typescript.git"
|
|
44
|
+
},
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/CapBypass-Development/capbypass-sdk-typescript/issues"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://capbypass.dev/docs/sdks/typescript",
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"axios": "^1.6.7"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/jest": "^29.5.12",
|
|
54
|
+
"@types/node": "^20.11.19",
|
|
55
|
+
"@typescript-eslint/eslint-plugin": "^7.0.1",
|
|
56
|
+
"@typescript-eslint/parser": "^7.0.1",
|
|
57
|
+
"axios-mock-adapter": "^1.22.0",
|
|
58
|
+
"eslint": "^8.56.0",
|
|
59
|
+
"jest": "^29.7.0",
|
|
60
|
+
"prettier": "^3.2.5",
|
|
61
|
+
"ts-jest": "^29.1.2",
|
|
62
|
+
"tsup": "^8.0.2",
|
|
63
|
+
"typescript": "^5.3.3"
|
|
64
|
+
},
|
|
65
|
+
"engines": {
|
|
66
|
+
"node": ">=16"
|
|
67
|
+
}
|
|
68
|
+
}
|