@bugbug-io/sdk 14.0.4 → 14.0.8
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/README.md +30 -69
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,75 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-

|
|
1
|
+

|
|
4
2
|
|
|
5
3
|
# BugBug SDK
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
A comprehensive TypeScript SDK for interacting with the [BugBug](https://bugbug.io) API, featuring rate limiting, error handling, and built-in progress watching utilities.
|
|
10
|
-
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
## Features
|
|
5
|
+
`@bugbug-io/sdk` is the TypeScript client for building integrations with the
|
|
6
|
+
BugBug API. SDK access requires a BugBug Business plan.
|
|
14
7
|
|
|
15
|
-
|
|
16
|
-
- **Type-safe** - Full TypeScript support with comprehensive type definitions
|
|
17
|
-
- **Rate limiting** - Built-in exponential backoff and request throttling
|
|
18
|
-
- **Error handling** - Comprehensive error types and automatic retries
|
|
19
|
-
- **Request cancellation** - AbortController support for all requests
|
|
20
|
-
- **Progress watching utilities** - Built-in polling for test and suite completion
|
|
21
|
-
- **Verbose logging** - Detailed request/response logging for debugging
|
|
22
|
-
- **Metrics collection** - Optional telemetry and performance tracking
|
|
23
|
-
|
|
24
|
-
## Installation
|
|
25
|
-
|
|
26
|
-
```bash
|
|
8
|
+
```sh
|
|
27
9
|
npm install @bugbug-io/sdk
|
|
28
10
|
```
|
|
29
11
|
|
|
30
|
-
## Quick
|
|
12
|
+
## Quick start
|
|
31
13
|
|
|
32
|
-
```
|
|
14
|
+
```ts
|
|
33
15
|
import { createBugBug } from '@bugbug-io/sdk';
|
|
34
16
|
|
|
35
|
-
const bugbug = createBugBug({
|
|
36
|
-
apiToken: 'your-api-token',
|
|
37
|
-
verbose: true, // Enable detailed logging
|
|
38
|
-
});
|
|
17
|
+
const bugbug = createBugBug({ apiToken: process.env.BUGBUG_API_TOKEN! });
|
|
39
18
|
|
|
40
|
-
|
|
41
|
-
const result = await bugbug.tests.startRun('my-test', {
|
|
19
|
+
const run = await bugbug.tests.startRun('test-id', {
|
|
42
20
|
watchProgress: true,
|
|
43
|
-
onProgress: (
|
|
21
|
+
onProgress: (state) => console.log(state.status),
|
|
44
22
|
});
|
|
45
23
|
|
|
46
|
-
console.log(
|
|
24
|
+
console.log(run.status);
|
|
25
|
+
```
|
|
47
26
|
|
|
48
|
-
|
|
49
|
-
const recentTests = await bugbug.tests.getRecentRuns({ hours: 24 });
|
|
27
|
+
## What it supports
|
|
50
28
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```
|
|
29
|
+
- Tests, suites, runs, profiles, project settings, and reusable components.
|
|
30
|
+
- Typed API responses and Zod-backed validation.
|
|
31
|
+
- Rate-limit retries, request cancellation, timeout handling, and run-progress
|
|
32
|
+
watching.
|
|
56
33
|
|
|
57
34
|
## Configuration
|
|
58
35
|
|
|
59
|
-
|
|
36
|
+
Pass an API token when creating the client. You can also set `BUGBUG_API_TOKEN`
|
|
37
|
+
and optionally `BUGBUG_API_URL`; the production API base URL is
|
|
38
|
+
`https://app.bugbug.io/api/v2`.
|
|
60
39
|
|
|
61
|
-
```
|
|
40
|
+
```ts
|
|
62
41
|
const bugbug = createBugBug({
|
|
63
|
-
apiToken:
|
|
42
|
+
apiToken: process.env.BUGBUG_API_TOKEN!,
|
|
43
|
+
apiUrl: 'https://app.bugbug.io/api/v2',
|
|
64
44
|
});
|
|
65
45
|
```
|
|
66
46
|
|
|
67
|
-
### Advanced
|
|
47
|
+
### Advanced configuration
|
|
68
48
|
|
|
69
|
-
```
|
|
49
|
+
```ts
|
|
70
50
|
const bugbug = createBugBug({
|
|
71
51
|
apiToken: 'your-api-token',
|
|
72
52
|
apiUrl: 'https://app.bugbug.io/api/v2', // Full API base URL. Default: https://app.bugbug.io/api/v2
|
|
53
|
+
projectId: 'project-id', // Active project for organization/user tokens
|
|
73
54
|
verbose: false, // Enable detailed logging
|
|
74
55
|
logLevel: 'info', // 'debug' | 'info' | 'warn' | 'error'
|
|
75
56
|
timeout: 30000, // Request timeout in milliseconds
|
|
@@ -78,6 +59,7 @@ const bugbug = createBugBug({
|
|
|
78
59
|
rateLimit: {
|
|
79
60
|
maxRequests: 100, // Max requests per window
|
|
80
61
|
windowMs: 60000, // Time window in milliseconds
|
|
62
|
+
retryServer429: true, // Retry server-side 429s. Default: true
|
|
81
63
|
exponentialBackoff: {
|
|
82
64
|
baseDelay: 1000, // Base delay for retries (ms)
|
|
83
65
|
maxDelay: 30000, // Maximum delay (ms)
|
|
@@ -89,33 +71,12 @@ const bugbug = createBugBug({
|
|
|
89
71
|
|
|
90
72
|
> **Note on `apiUrl`:** The SDK treats `apiUrl` as the **full API base URL** and does not auto-append `/api/v2` or rewrite the value in any way. Pass a complete URL like `https://app.bugbug.io/api/v2`. Host-only values will route to the wrong endpoint.
|
|
91
73
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
### Auth
|
|
74
|
+
> **Note on `retryServer429`:** When enabled, a 429 returned mid-POST is retried transparently, which can create **duplicate resources** for non-idempotent calls such as `tests.startRun` or `tests.create`. Set it to `false` in integrations that mutate data and retry idempotently yourself.
|
|
95
75
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
BUGBUG_CLI_OAUTH_CLIENT_ID,
|
|
99
|
-
BUGBUG_OAUTH_CODE_CHALLENGE_METHOD,
|
|
100
|
-
createOAuthCodeChallenge,
|
|
101
|
-
createOAuthCodeVerifier,
|
|
102
|
-
createOAuthState,
|
|
103
|
-
createBugBug,
|
|
104
|
-
} from '@bugbug-io/sdk';
|
|
76
|
+
Use `bugbug.tests`, `bugbug.suites`, `bugbug.profiles`, `bugbug.groups`, and
|
|
77
|
+
`bugbug.config` for the respective API areas.
|
|
105
78
|
|
|
106
|
-
|
|
107
|
-
const codeVerifier = createOAuthCodeVerifier();
|
|
108
|
-
const authorize = await bugbug.auth.getAuth({
|
|
109
|
-
clientId: BUGBUG_CLI_OAUTH_CLIENT_ID,
|
|
110
|
-
redirectUri: 'http://127.0.0.1:48123/callback',
|
|
111
|
-
codeChallenge: createOAuthCodeChallenge(codeVerifier),
|
|
112
|
-
codeChallengeMethod: BUGBUG_OAUTH_CODE_CHALLENGE_METHOD,
|
|
113
|
-
state: createOAuthState(),
|
|
114
|
-
});
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
`auth.getAuth` and `auth.exchangeCode` call root `/auth/...` endpoints and do
|
|
118
|
-
not send the configured API token. `auth.identity` validates the configured token.
|
|
79
|
+
## API Reference
|
|
119
80
|
|
|
120
81
|
### Tests
|
|
121
82
|
|
package/dist/index.js
CHANGED
|
@@ -9577,7 +9577,7 @@ var buildUserAgent = (clientType, version) => `BugBug ${clientType.toUpperCase()
|
|
|
9577
9577
|
// ../core/package.json
|
|
9578
9578
|
var package_default = {
|
|
9579
9579
|
name: "@bugbug-io/core",
|
|
9580
|
-
version: "14.0.
|
|
9580
|
+
version: "14.0.8",
|
|
9581
9581
|
private: true,
|
|
9582
9582
|
type: "module",
|
|
9583
9583
|
main: "dist/index.js",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bugbug-io/sdk",
|
|
3
|
-
"version": "14.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "14.0.8",
|
|
4
|
+
"description": "TypeScript SDK for building integrations with the BugBug API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|