bugstack-sdk 1.0.0 → 2.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/README.md +310 -317
- package/dist/adapters/express/index.d.mts +80 -0
- package/dist/adapters/express/index.d.ts +80 -0
- package/dist/adapters/express/index.js +887 -0
- package/dist/adapters/express/index.js.map +1 -0
- package/dist/adapters/express/index.mjs +881 -0
- package/dist/adapters/express/index.mjs.map +1 -0
- package/dist/adapters/generic/index.d.mts +127 -0
- package/dist/adapters/generic/index.d.ts +127 -0
- package/dist/adapters/generic/index.js +833 -0
- package/dist/adapters/generic/index.js.map +1 -0
- package/dist/adapters/generic/index.mjs +824 -0
- package/dist/adapters/generic/index.mjs.map +1 -0
- package/dist/adapters/nextjs/index.d.mts +50 -0
- package/dist/adapters/nextjs/index.d.ts +50 -0
- package/dist/adapters/nextjs/index.js +1003 -0
- package/dist/adapters/nextjs/index.js.map +1 -0
- package/dist/adapters/nextjs/index.mjs +998 -0
- package/dist/adapters/nextjs/index.mjs.map +1 -0
- package/dist/client-9EMqVMOl.d.mts +622 -0
- package/dist/client-9EMqVMOl.d.ts +622 -0
- package/dist/index.d.mts +44 -360
- package/dist/index.d.ts +44 -360
- package/dist/index.js +535 -150
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +529 -149
- package/dist/index.mjs.map +1 -1
- package/package.json +90 -71
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ErrorRequestHandler, Request, Response, NextFunction } from 'express';
|
|
2
|
+
import { b as ErrorCaptureConfig } from '../../client-9EMqVMOl.mjs';
|
|
3
|
+
export { B as BugStackClient, C as CapturedError, E as ErrorCaptureClient } from '../../client-9EMqVMOl.mjs';
|
|
4
|
+
import 'next/server';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* BugStack SDK - Express Adapter
|
|
8
|
+
*
|
|
9
|
+
* Error capture middleware for Express.js applications
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Express error handling middleware
|
|
14
|
+
*
|
|
15
|
+
* This middleware captures errors and reports them to BugStack.
|
|
16
|
+
* It must be registered AFTER all routes and other middleware.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import express from 'express';
|
|
21
|
+
* import { bugstackErrorHandler } from '@bugstack/sdk/express';
|
|
22
|
+
*
|
|
23
|
+
* const app = express();
|
|
24
|
+
*
|
|
25
|
+
* // ... your routes and middleware
|
|
26
|
+
*
|
|
27
|
+
* // Register BugStack error handler (must be last)
|
|
28
|
+
* app.use(bugstackErrorHandler({
|
|
29
|
+
* apiKey: 'your-api-key',
|
|
30
|
+
* projectId: 'your-project-id',
|
|
31
|
+
* autoFix: true
|
|
32
|
+
* }));
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare function bugstackErrorHandler(config?: ErrorCaptureConfig): ErrorRequestHandler;
|
|
36
|
+
/**
|
|
37
|
+
* Express middleware to initialize BugStack client
|
|
38
|
+
*
|
|
39
|
+
* Use this if you want to initialize the client separately from the error handler
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* import express from 'express';
|
|
44
|
+
* import { initBugStack, bugstackErrorHandler } from '@bugstack/sdk/express';
|
|
45
|
+
*
|
|
46
|
+
* const app = express();
|
|
47
|
+
*
|
|
48
|
+
* // Initialize client early
|
|
49
|
+
* app.use(initBugStack({
|
|
50
|
+
* apiKey: 'your-api-key',
|
|
51
|
+
* projectId: 'your-project-id',
|
|
52
|
+
* autoFix: true
|
|
53
|
+
* }));
|
|
54
|
+
*
|
|
55
|
+
* // ... your routes
|
|
56
|
+
*
|
|
57
|
+
* // Register error handler
|
|
58
|
+
* app.use(bugstackErrorHandler());
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
declare function initBugStack(config: ErrorCaptureConfig): (_req: Request, _res: Response, next: NextFunction) => void;
|
|
62
|
+
/**
|
|
63
|
+
* Wrap an Express route handler with error capture
|
|
64
|
+
*
|
|
65
|
+
* This is an alternative to using the error middleware. It catches errors
|
|
66
|
+
* in async route handlers and reports them to BugStack.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* import { wrapExpressHandler } from '@bugstack/sdk/express';
|
|
71
|
+
*
|
|
72
|
+
* app.get('/api/users/:id', wrapExpressHandler(async (req, res) => {
|
|
73
|
+
* const user = await getUser(req.params.id);
|
|
74
|
+
* res.json(user);
|
|
75
|
+
* }));
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
declare function wrapExpressHandler(handler: (req: Request, res: Response, next: NextFunction) => Promise<void> | void): (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
79
|
+
|
|
80
|
+
export { ErrorCaptureConfig, bugstackErrorHandler, initBugStack, wrapExpressHandler };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ErrorRequestHandler, Request, Response, NextFunction } from 'express';
|
|
2
|
+
import { b as ErrorCaptureConfig } from '../../client-9EMqVMOl.js';
|
|
3
|
+
export { B as BugStackClient, C as CapturedError, E as ErrorCaptureClient } from '../../client-9EMqVMOl.js';
|
|
4
|
+
import 'next/server';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* BugStack SDK - Express Adapter
|
|
8
|
+
*
|
|
9
|
+
* Error capture middleware for Express.js applications
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Express error handling middleware
|
|
14
|
+
*
|
|
15
|
+
* This middleware captures errors and reports them to BugStack.
|
|
16
|
+
* It must be registered AFTER all routes and other middleware.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import express from 'express';
|
|
21
|
+
* import { bugstackErrorHandler } from '@bugstack/sdk/express';
|
|
22
|
+
*
|
|
23
|
+
* const app = express();
|
|
24
|
+
*
|
|
25
|
+
* // ... your routes and middleware
|
|
26
|
+
*
|
|
27
|
+
* // Register BugStack error handler (must be last)
|
|
28
|
+
* app.use(bugstackErrorHandler({
|
|
29
|
+
* apiKey: 'your-api-key',
|
|
30
|
+
* projectId: 'your-project-id',
|
|
31
|
+
* autoFix: true
|
|
32
|
+
* }));
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare function bugstackErrorHandler(config?: ErrorCaptureConfig): ErrorRequestHandler;
|
|
36
|
+
/**
|
|
37
|
+
* Express middleware to initialize BugStack client
|
|
38
|
+
*
|
|
39
|
+
* Use this if you want to initialize the client separately from the error handler
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* import express from 'express';
|
|
44
|
+
* import { initBugStack, bugstackErrorHandler } from '@bugstack/sdk/express';
|
|
45
|
+
*
|
|
46
|
+
* const app = express();
|
|
47
|
+
*
|
|
48
|
+
* // Initialize client early
|
|
49
|
+
* app.use(initBugStack({
|
|
50
|
+
* apiKey: 'your-api-key',
|
|
51
|
+
* projectId: 'your-project-id',
|
|
52
|
+
* autoFix: true
|
|
53
|
+
* }));
|
|
54
|
+
*
|
|
55
|
+
* // ... your routes
|
|
56
|
+
*
|
|
57
|
+
* // Register error handler
|
|
58
|
+
* app.use(bugstackErrorHandler());
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
declare function initBugStack(config: ErrorCaptureConfig): (_req: Request, _res: Response, next: NextFunction) => void;
|
|
62
|
+
/**
|
|
63
|
+
* Wrap an Express route handler with error capture
|
|
64
|
+
*
|
|
65
|
+
* This is an alternative to using the error middleware. It catches errors
|
|
66
|
+
* in async route handlers and reports them to BugStack.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* import { wrapExpressHandler } from '@bugstack/sdk/express';
|
|
71
|
+
*
|
|
72
|
+
* app.get('/api/users/:id', wrapExpressHandler(async (req, res) => {
|
|
73
|
+
* const user = await getUser(req.params.id);
|
|
74
|
+
* res.json(user);
|
|
75
|
+
* }));
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
declare function wrapExpressHandler(handler: (req: Request, res: Response, next: NextFunction) => Promise<void> | void): (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
79
|
+
|
|
80
|
+
export { ErrorCaptureConfig, bugstackErrorHandler, initBugStack, wrapExpressHandler };
|