@bugbug-io/sdk 14.0.7 → 14.1.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/README.md +30 -69
- package/dist/index.js +15 -2
- 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.1.0",
|
|
9581
9581
|
private: true,
|
|
9582
9582
|
type: "module",
|
|
9583
9583
|
main: "dist/index.js",
|
|
@@ -14971,6 +14971,7 @@ var StepTypeSchema = external_exports.enum([
|
|
|
14971
14971
|
"hover",
|
|
14972
14972
|
"ifCondition",
|
|
14973
14973
|
"mouseDown",
|
|
14974
|
+
"mouseMove",
|
|
14974
14975
|
"mouseUp",
|
|
14975
14976
|
"newTab",
|
|
14976
14977
|
"pageVisualRegression",
|
|
@@ -14982,7 +14983,7 @@ var StepTypeSchema = external_exports.enum([
|
|
|
14982
14983
|
"switchContext",
|
|
14983
14984
|
"type",
|
|
14984
14985
|
"uploadFile"
|
|
14985
|
-
]).describe("Available step types: answerPrompt, assert, change, clear, click, dblClick, rightClick, closeTab, dragAndDrop, elementVisualRegression, execute, goto, goBack, goForward, hover, ifCondition, mouseDown, mouseUp, newTab, pageVisualRegression, pasteFromClipboard, reloadPage, scroll, select, setLocalVariable, switchContext, type, uploadFile.");
|
|
14986
|
+
]).describe("Available step types: answerPrompt, assert, change, clear, click, dblClick, rightClick, closeTab, dragAndDrop, elementVisualRegression, execute, goto, goBack, goForward, hover, ifCondition, mouseDown, mouseMove, mouseUp, newTab, pageVisualRegression, pasteFromClipboard, reloadPage, scroll, select, setLocalVariable, switchContext, type, uploadFile.");
|
|
14986
14987
|
var AssertionTypeSchema = external_exports.enum([
|
|
14987
14988
|
"contain",
|
|
14988
14989
|
"equal",
|
|
@@ -15253,6 +15254,17 @@ var MouseDownStepSchema = StepBaseSchema.extend({
|
|
|
15253
15254
|
interactionPosition: InteractionPositionSchema.describe("Mouse-down position relative to the target element."),
|
|
15254
15255
|
selectorsPresets: external_exports.array(SelectorsPresetSchema).describe("Target selectors used to locate the element.")
|
|
15255
15256
|
});
|
|
15257
|
+
var MouseMoveStepSchema = StepBaseSchema.extend({
|
|
15258
|
+
type: external_exports.literal("mouseMove").describe("Move the mouse to an element or viewport coordinate."),
|
|
15259
|
+
isTargetDocument: external_exports.boolean().optional().describe("Whether to move relative to the viewport instead of a target element."),
|
|
15260
|
+
interactionPosition: InteractionPositionSchema.optional().describe("Position relative to the target element when isTargetDocument is false."),
|
|
15261
|
+
clientX: external_exports.number().nonnegative().nullable().optional().describe("X coordinate. Required by the API when isTargetDocument is true."),
|
|
15262
|
+
clientY: external_exports.number().nonnegative().nullable().optional().describe("Y coordinate. Required by the API when isTargetDocument is true."),
|
|
15263
|
+
mouseMoveSteps: external_exports.number().int().positive().nullable().optional().describe("Optional number of intermediate mouse-move events."),
|
|
15264
|
+
mouseButtons: external_exports.array(external_exports.enum(["left", "right", "middle", "back"])).optional().describe("Mouse buttons held while moving."),
|
|
15265
|
+
modifierKeys: external_exports.array(external_exports.enum(["ctrl", "shift", "alt", "meta"])).optional().describe("Keyboard modifier keys held while moving."),
|
|
15266
|
+
selectorsPresets: external_exports.array(SelectorsPresetSchema).optional().describe("Target selectors when moving relative to an element.")
|
|
15267
|
+
});
|
|
15256
15268
|
var MouseUpStepSchema = StepBaseSchema.extend({
|
|
15257
15269
|
type: external_exports.literal("mouseUp").describe("Release the mouse button on the targeted element."),
|
|
15258
15270
|
interactionPosition: InteractionPositionSchema.describe("Mouse-up position relative to the target element."),
|
|
@@ -15344,6 +15356,7 @@ var allStepsSchemas = [
|
|
|
15344
15356
|
HoverStepSchema,
|
|
15345
15357
|
IfConditionStepSchema,
|
|
15346
15358
|
MouseDownStepSchema,
|
|
15359
|
+
MouseMoveStepSchema,
|
|
15347
15360
|
MouseUpStepSchema,
|
|
15348
15361
|
NewTabStepSchema,
|
|
15349
15362
|
PageVisualRegressionStepSchema,
|
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.1.0",
|
|
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",
|