@drawbridge/drawbridge-telemetry 0.0.3 → 0.0.5

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/dist/bullmq.cjs CHANGED
@@ -35,10 +35,9 @@ __export(bullmq_exports, {
35
35
  });
36
36
  module.exports = __toCommonJS(bullmq_exports);
37
37
  var import_crypto = require("crypto");
38
- var Sentry2 = __toESM(require("@sentry/core"), 1);
39
38
 
40
39
  // index.js
41
- var Sentry = __toESM(require("@sentry/core"), 1);
40
+ var Sentry = __toESM(require("@sentry/node"), 1);
42
41
  var withTraceScope = (traceId, fn) => Sentry.withScope((scope) => {
43
42
  if (traceId) scope.setTag("traceId", traceId);
44
43
  return fn(scope);
@@ -77,17 +76,17 @@ var enqueueFromWorker = async (queue, name, data, options = {}) => {
77
76
  options
78
77
  );
79
78
  };
80
- var attachQueueEventsLogger = (queueEvents, queueName, logger) => {
81
- if (!(logger == null ? void 0 : logger.event)) return;
79
+ var attachQueueEventsLogger = (queueEvents, queueName, logger2) => {
80
+ if (!(logger2 == null ? void 0 : logger2.event)) return;
82
81
  queueEvents.on("completed", ({ jobId, returnvalue, prev }) => {
83
- logger.event("job.completed", {
82
+ logger2.event("job.completed", {
84
83
  jobId,
85
84
  queue: queueName,
86
85
  prev
87
86
  });
88
87
  });
89
88
  queueEvents.on("failed", ({ jobId, failedReason, prev }) => {
90
- logger.event("job.failed", {
89
+ logger2.event("job.failed", {
91
90
  jobId,
92
91
  queue: queueName,
93
92
  failedReason,
@@ -95,7 +94,7 @@ var attachQueueEventsLogger = (queueEvents, queueName, logger) => {
95
94
  });
96
95
  });
97
96
  queueEvents.on("stalled", ({ jobId }) => {
98
- logger.event("job.stalled", {
97
+ logger2.event("job.stalled", {
99
98
  jobId,
100
99
  queue: queueName
101
100
  });
package/dist/bullmq.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { randomUUID } from 'crypto';
2
2
  import { currentTraceId, withTraceScope } from './index.cjs';
3
- import '@sentry/core';
3
+ import '@sentry/node';
4
4
 
5
5
  // Wrap a BullMQ worker handler so it runs inside a Sentry scope tagged
6
6
  // with the job's traceId, queue name, and job name. Matches BullMQ's
package/dist/bullmq.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { randomUUID } from 'crypto';
2
2
  import { currentTraceId, withTraceScope } from './index.js';
3
- import '@sentry/core';
3
+ import '@sentry/node';
4
4
 
5
5
  // Wrap a BullMQ worker handler so it runs inside a Sentry scope tagged
6
6
  // with the job's traceId, queue name, and job name. Matches BullMQ's
package/dist/bullmq.js CHANGED
@@ -1,11 +1,10 @@
1
1
  import {
2
2
  currentTraceId,
3
3
  withTraceScope
4
- } from "./chunk-SRV5HFQT.js";
4
+ } from "./chunk-O6EHU4U7.js";
5
5
 
6
6
  // bullmq.js
7
7
  import { randomUUID } from "crypto";
8
- import * as Sentry from "@sentry/core";
9
8
  var wrapWorkerHandler = (handler) => async (job) => {
10
9
  var _a;
11
10
  const traceId = ((_a = job == null ? void 0 : job.data) == null ? void 0 : _a.__traceId) || randomUUID();
@@ -1,5 +1,16 @@
1
1
  // index.js
2
- import * as Sentry from "@sentry/core";
2
+ import * as Sentry from "@sentry/node";
3
+ var init2 = (config = {}) => Sentry.init({
4
+ dsn: process.env.SENTRY_DSN,
5
+ enableLogs: true,
6
+ environment: process.env.SENTRY_ENVIRONMENT || "localhost",
7
+ tracesSampleRate: 0.1,
8
+ profilesSampleRate: 0.05,
9
+ ...config
10
+ });
11
+ var captureException2 = (error, options) => Sentry.captureException(error, options);
12
+ var captureMessage2 = (message, options) => Sentry.captureMessage(message, options);
13
+ var logger2 = Sentry.logger;
3
14
  var attached = false;
4
15
  var attachProcessHandlers = () => {
5
16
  if (attached) return;
@@ -44,6 +55,11 @@ var currentTraceId = () => {
44
55
  };
45
56
 
46
57
  export {
58
+ Sentry,
59
+ init2 as init,
60
+ captureException2 as captureException,
61
+ captureMessage2 as captureMessage,
62
+ logger2 as logger,
47
63
  attachProcessHandlers,
48
64
  withTraceScope,
49
65
  currentTraceId
package/dist/express.cjs CHANGED
@@ -33,31 +33,30 @@ __export(express_exports, {
33
33
  expressContextMiddleware: () => expressContextMiddleware
34
34
  });
35
35
  module.exports = __toCommonJS(express_exports);
36
- var Sentry = __toESM(require("@sentry/core"), 1);
36
+ var Sentry = __toESM(require("@sentry/node"), 1);
37
37
  var applyRequestContext = (req) => {
38
- const scope = Sentry.getCurrentScope();
39
38
  if (req == null ? void 0 : req.id) {
40
- scope.setTag("traceId", req.id);
39
+ Sentry.setTag("traceId", req.id);
41
40
  }
42
41
  ;
43
42
  if (req == null ? void 0 : req.method) {
44
- scope.setTag("method", req.method);
43
+ Sentry.setTag("method", req.method);
45
44
  }
46
45
  ;
47
46
  if (req == null ? void 0 : req.path) {
48
- scope.setTag("route", req.path);
47
+ Sentry.setTag("route", req.path);
49
48
  }
50
49
  ;
51
50
  const user = (req == null ? void 0 : req.authenticated) || (req == null ? void 0 : req.user);
52
51
  if (user) {
53
- scope.setUser({
52
+ Sentry.setUser({
54
53
  id: user.id || user._id,
55
54
  email: user.email
56
55
  });
57
56
  }
58
57
  ;
59
58
  if (req == null ? void 0 : req.organization) {
60
- scope.setTag("organization", req.organization.id || req.organization._id);
59
+ Sentry.setTag("organization", req.organization.id || req.organization._id);
61
60
  }
62
61
  ;
63
62
  };
@@ -1,25 +1,30 @@
1
- import * as Sentry from '@sentry/core';
1
+ import * as Sentry from '@sentry/node';
2
2
 
3
- // Apply all available context tags from a request to the active Sentry
4
- // scope. Idempotent — safe to call multiple times as the request enriches
5
- // (e.g. once at request entry for traceId/method/path, again from auth
6
- // middleware once req.authenticated and req.organization are populated).
3
+ // Apply all available context tags from a request to the per-request
4
+ // Sentry isolation scope. Idempotent — safe to call multiple times as
5
+ // the request enriches (e.g. once at request entry for
6
+ // traceId/method/path, again from auth middleware once req.authenticated
7
+ // and req.organization are populated).
7
8
  //
8
9
  // Reads from req.authenticated first (drawbridge-api convention) and
9
10
  // falls back to req.user for compatibility with other services.
11
+ //
12
+ // Uses Sentry.setTag / Sentry.setUser (which target the isolation scope
13
+ // in v8+) rather than getCurrentScope().setTag, because errors captured
14
+ // later in the request from a different async fork only inherit the
15
+ // isolation scope. Setting tags on the current scope at middleware time
16
+ // can leave them out of the captureException event payload.
10
17
 
11
18
  const applyRequestContext = ( req ) => {
12
19
 
13
- const scope = Sentry.getCurrentScope();
14
-
15
20
  if( req?.id ){
16
21
 
17
- scope.setTag( 'traceId', req.id );
22
+ Sentry.setTag( 'traceId', req.id );
18
23
 
19
24
  }
20
25
  if( req?.method ){
21
26
 
22
- scope.setTag( 'method', req.method );
27
+ Sentry.setTag( 'method', req.method );
23
28
 
24
29
  }
25
30
  // req.route is set by Express only AFTER route matching, which hasn't
@@ -28,14 +33,14 @@ const applyRequestContext = ( req ) => {
28
33
  // future res.on('finish') refinement.
29
34
  if( req?.path ){
30
35
 
31
- scope.setTag( 'route', req.path );
36
+ Sentry.setTag( 'route', req.path );
32
37
 
33
38
  }
34
39
  const user = req?.authenticated || req?.user;
35
40
 
36
41
  if( user ){
37
42
 
38
- scope.setUser({
43
+ Sentry.setUser({
39
44
  id : user.id || user._id,
40
45
  email : user.email
41
46
  });
@@ -43,7 +48,7 @@ const applyRequestContext = ( req ) => {
43
48
  }
44
49
  if( req?.organization ){
45
50
 
46
- scope.setTag( 'organization', req.organization.id || req.organization._id );
51
+ Sentry.setTag( 'organization', req.organization.id || req.organization._id );
47
52
 
48
53
  }
49
54
  };
package/dist/express.d.ts CHANGED
@@ -1,25 +1,30 @@
1
- import * as Sentry from '@sentry/core';
1
+ import * as Sentry from '@sentry/node';
2
2
 
3
- // Apply all available context tags from a request to the active Sentry
4
- // scope. Idempotent — safe to call multiple times as the request enriches
5
- // (e.g. once at request entry for traceId/method/path, again from auth
6
- // middleware once req.authenticated and req.organization are populated).
3
+ // Apply all available context tags from a request to the per-request
4
+ // Sentry isolation scope. Idempotent — safe to call multiple times as
5
+ // the request enriches (e.g. once at request entry for
6
+ // traceId/method/path, again from auth middleware once req.authenticated
7
+ // and req.organization are populated).
7
8
  //
8
9
  // Reads from req.authenticated first (drawbridge-api convention) and
9
10
  // falls back to req.user for compatibility with other services.
11
+ //
12
+ // Uses Sentry.setTag / Sentry.setUser (which target the isolation scope
13
+ // in v8+) rather than getCurrentScope().setTag, because errors captured
14
+ // later in the request from a different async fork only inherit the
15
+ // isolation scope. Setting tags on the current scope at middleware time
16
+ // can leave them out of the captureException event payload.
10
17
 
11
18
  const applyRequestContext = ( req ) => {
12
19
 
13
- const scope = Sentry.getCurrentScope();
14
-
15
20
  if( req?.id ){
16
21
 
17
- scope.setTag( 'traceId', req.id );
22
+ Sentry.setTag( 'traceId', req.id );
18
23
 
19
24
  }
20
25
  if( req?.method ){
21
26
 
22
- scope.setTag( 'method', req.method );
27
+ Sentry.setTag( 'method', req.method );
23
28
 
24
29
  }
25
30
  // req.route is set by Express only AFTER route matching, which hasn't
@@ -28,14 +33,14 @@ const applyRequestContext = ( req ) => {
28
33
  // future res.on('finish') refinement.
29
34
  if( req?.path ){
30
35
 
31
- scope.setTag( 'route', req.path );
36
+ Sentry.setTag( 'route', req.path );
32
37
 
33
38
  }
34
39
  const user = req?.authenticated || req?.user;
35
40
 
36
41
  if( user ){
37
42
 
38
- scope.setUser({
43
+ Sentry.setUser({
39
44
  id : user.id || user._id,
40
45
  email : user.email
41
46
  });
@@ -43,7 +48,7 @@ const applyRequestContext = ( req ) => {
43
48
  }
44
49
  if( req?.organization ){
45
50
 
46
- scope.setTag( 'organization', req.organization.id || req.organization._id );
51
+ Sentry.setTag( 'organization', req.organization.id || req.organization._id );
47
52
 
48
53
  }
49
54
  };
package/dist/express.js CHANGED
@@ -1,29 +1,28 @@
1
1
  // express.js
2
- import * as Sentry from "@sentry/core";
2
+ import * as Sentry from "@sentry/node";
3
3
  var applyRequestContext = (req) => {
4
- const scope = Sentry.getCurrentScope();
5
4
  if (req == null ? void 0 : req.id) {
6
- scope.setTag("traceId", req.id);
5
+ Sentry.setTag("traceId", req.id);
7
6
  }
8
7
  ;
9
8
  if (req == null ? void 0 : req.method) {
10
- scope.setTag("method", req.method);
9
+ Sentry.setTag("method", req.method);
11
10
  }
12
11
  ;
13
12
  if (req == null ? void 0 : req.path) {
14
- scope.setTag("route", req.path);
13
+ Sentry.setTag("route", req.path);
15
14
  }
16
15
  ;
17
16
  const user = (req == null ? void 0 : req.authenticated) || (req == null ? void 0 : req.user);
18
17
  if (user) {
19
- scope.setUser({
18
+ Sentry.setUser({
20
19
  id: user.id || user._id,
21
20
  email: user.email
22
21
  });
23
22
  }
24
23
  ;
25
24
  if (req == null ? void 0 : req.organization) {
26
- scope.setTag("organization", req.organization.id || req.organization._id);
25
+ Sentry.setTag("organization", req.organization.id || req.organization._id);
27
26
  }
28
27
  ;
29
28
  };
package/dist/index.cjs CHANGED
@@ -29,12 +29,28 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // index.js
30
30
  var index_exports = {};
31
31
  __export(index_exports, {
32
+ Sentry: () => Sentry,
32
33
  attachProcessHandlers: () => attachProcessHandlers,
34
+ captureException: () => captureException2,
35
+ captureMessage: () => captureMessage2,
33
36
  currentTraceId: () => currentTraceId,
37
+ init: () => init2,
38
+ logger: () => logger2,
34
39
  withTraceScope: () => withTraceScope
35
40
  });
36
41
  module.exports = __toCommonJS(index_exports);
37
- var Sentry = __toESM(require("@sentry/core"), 1);
42
+ var Sentry = __toESM(require("@sentry/node"), 1);
43
+ var init2 = (config = {}) => Sentry.init({
44
+ dsn: process.env.SENTRY_DSN,
45
+ enableLogs: true,
46
+ environment: process.env.SENTRY_ENVIRONMENT || "localhost",
47
+ tracesSampleRate: 0.1,
48
+ profilesSampleRate: 0.05,
49
+ ...config
50
+ });
51
+ var captureException2 = (error, options) => Sentry.captureException(error, options);
52
+ var captureMessage2 = (message, options) => Sentry.captureMessage(message, options);
53
+ var logger2 = Sentry.logger;
38
54
  var attached = false;
39
55
  var attachProcessHandlers = () => {
40
56
  if (attached) return;
@@ -79,7 +95,12 @@ var currentTraceId = () => {
79
95
  };
80
96
  // Annotate the CommonJS export names for ESM import in node:
81
97
  0 && (module.exports = {
98
+ Sentry,
82
99
  attachProcessHandlers,
100
+ captureException,
101
+ captureMessage,
83
102
  currentTraceId,
103
+ init,
104
+ logger,
84
105
  withTraceScope
85
106
  });
package/dist/index.d.cts CHANGED
@@ -1,4 +1,33 @@
1
- import * as Sentry from '@sentry/core';
1
+ import * as Sentry from '@sentry/node';
2
+ export { Sentry };
3
+
4
+ // Project-standard Sentry.init wrapper. Sets the conventions used across
5
+ // drawbridge-api / -sync / -webhooks (enableLogs, tracesSampleRate,
6
+ // profilesSampleRate, environment) so each service's init call collapses
7
+ // to dsn + any overrides.
8
+ //
9
+ // Defaults are conservative. Override per service as needed.
10
+
11
+ const init = ( config = {} ) => Sentry.init({
12
+ dsn : process.env.SENTRY_DSN,
13
+ enableLogs : true,
14
+ environment : process.env.SENTRY_ENVIRONMENT || 'localhost',
15
+ tracesSampleRate : 0.1,
16
+ profilesSampleRate : 0.05,
17
+ ...config
18
+ });
19
+
20
+ // Named re-exports of the Sentry surface services actually use. Keep this
21
+ // list narrow — every export here is a service-API contract.
22
+
23
+ const captureException = ( error, options ) => Sentry.captureException( error, options );
24
+
25
+ const captureMessage = ( message, options ) => Sentry.captureMessage( message, options );
26
+
27
+ // Sentry.logger is the structured-logs surface (ships to Sentry Logs).
28
+ // Exposed as `logger` so callers do `logger.info(...)` / `logger.error(...)`.
29
+
30
+ const logger = Sentry.logger;
2
31
 
3
32
  // Diagnostic process-level handlers. Surfaces unhandled async errors to
4
33
  // Sentry (without these, modern Node defaults silently exit) and logs
@@ -90,4 +119,4 @@ const currentTraceId = () => {
90
119
 
91
120
  };
92
121
 
93
- export { attachProcessHandlers, currentTraceId, withTraceScope };
122
+ export { attachProcessHandlers, captureException, captureMessage, currentTraceId, init, logger, withTraceScope };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,33 @@
1
- import * as Sentry from '@sentry/core';
1
+ import * as Sentry from '@sentry/node';
2
+ export { Sentry };
3
+
4
+ // Project-standard Sentry.init wrapper. Sets the conventions used across
5
+ // drawbridge-api / -sync / -webhooks (enableLogs, tracesSampleRate,
6
+ // profilesSampleRate, environment) so each service's init call collapses
7
+ // to dsn + any overrides.
8
+ //
9
+ // Defaults are conservative. Override per service as needed.
10
+
11
+ const init = ( config = {} ) => Sentry.init({
12
+ dsn : process.env.SENTRY_DSN,
13
+ enableLogs : true,
14
+ environment : process.env.SENTRY_ENVIRONMENT || 'localhost',
15
+ tracesSampleRate : 0.1,
16
+ profilesSampleRate : 0.05,
17
+ ...config
18
+ });
19
+
20
+ // Named re-exports of the Sentry surface services actually use. Keep this
21
+ // list narrow — every export here is a service-API contract.
22
+
23
+ const captureException = ( error, options ) => Sentry.captureException( error, options );
24
+
25
+ const captureMessage = ( message, options ) => Sentry.captureMessage( message, options );
26
+
27
+ // Sentry.logger is the structured-logs surface (ships to Sentry Logs).
28
+ // Exposed as `logger` so callers do `logger.info(...)` / `logger.error(...)`.
29
+
30
+ const logger = Sentry.logger;
2
31
 
3
32
  // Diagnostic process-level handlers. Surfaces unhandled async errors to
4
33
  // Sentry (without these, modern Node defaults silently exit) and logs
@@ -90,4 +119,4 @@ const currentTraceId = () => {
90
119
 
91
120
  };
92
121
 
93
- export { attachProcessHandlers, currentTraceId, withTraceScope };
122
+ export { attachProcessHandlers, captureException, captureMessage, currentTraceId, init, logger, withTraceScope };
package/dist/index.js CHANGED
@@ -1,10 +1,20 @@
1
1
  import {
2
+ Sentry,
2
3
  attachProcessHandlers,
4
+ captureException,
5
+ captureMessage,
3
6
  currentTraceId,
7
+ init,
8
+ logger,
4
9
  withTraceScope
5
- } from "./chunk-SRV5HFQT.js";
10
+ } from "./chunk-O6EHU4U7.js";
6
11
  export {
12
+ Sentry,
7
13
  attachProcessHandlers,
14
+ captureException,
15
+ captureMessage,
8
16
  currentTraceId,
17
+ init,
18
+ logger,
9
19
  withTraceScope
10
20
  };
@@ -0,0 +1,63 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // nextjs.js
30
+ var nextjs_exports = {};
31
+ __export(nextjs_exports, {
32
+ Sentry: () => Sentry,
33
+ captureException: () => captureException2,
34
+ captureMessage: () => captureMessage2,
35
+ captureRequestError: () => captureRequestError2,
36
+ init: () => init2,
37
+ logger: () => logger2,
38
+ withSentryConfig: () => import_nextjs.withSentryConfig
39
+ });
40
+ module.exports = __toCommonJS(nextjs_exports);
41
+ var Sentry = __toESM(require("@sentry/nextjs"), 1);
42
+ var import_nextjs = require("@sentry/nextjs");
43
+ var init2 = (config = {}) => Sentry.init({
44
+ dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
45
+ enableLogs: true,
46
+ environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT || "localhost",
47
+ tracesSampleRate: 0.1,
48
+ ...config
49
+ });
50
+ var captureException2 = (error, options) => Sentry.captureException(error, options);
51
+ var captureMessage2 = (message, options) => Sentry.captureMessage(message, options);
52
+ var captureRequestError2 = Sentry.captureRequestError;
53
+ var logger2 = Sentry.logger;
54
+ // Annotate the CommonJS export names for ESM import in node:
55
+ 0 && (module.exports = {
56
+ Sentry,
57
+ captureException,
58
+ captureMessage,
59
+ captureRequestError,
60
+ init,
61
+ logger,
62
+ withSentryConfig
63
+ });
@@ -0,0 +1,41 @@
1
+ import * as Sentry from '@sentry/nextjs';
2
+ export { Sentry };
3
+ export { withSentryConfig } from '@sentry/nextjs';
4
+
5
+ // @sentry/nextjs surface routed through drawbridge-telemetry so consumer
6
+ // apps (drawbridge-app-web, drawbridge-share) never import @sentry/nextjs
7
+ // directly. Same architectural reason as the /node default: one owner of
8
+ // the Sentry SDK, zero risk of duplicated module instances with separate
9
+ // scope state.
10
+ //
11
+ // @sentry/nextjs is an optional peer dep — only Next.js consumers need it
12
+ // installed. Node services that import the default export aren't forced
13
+ // to carry the Next.js SDK's weight.
14
+
15
+
16
+ // Project-standard Sentry.init wrapper for Next.js apps. Server, edge,
17
+ // and client configs each call init() with their own overrides; the
18
+ // shared defaults (environment from NEXT_PUBLIC_SENTRY_ENVIRONMENT,
19
+ // enableLogs, tracesSampleRate) live here.
20
+
21
+ const init = ( config = {} ) => Sentry.init({
22
+ dsn : process.env.NEXT_PUBLIC_SENTRY_DSN,
23
+ enableLogs : true,
24
+ environment : process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT || 'localhost',
25
+ tracesSampleRate : 0.1,
26
+ ...config
27
+ });
28
+
29
+ const captureException = ( error, options ) => Sentry.captureException( error, options );
30
+
31
+ const captureMessage = ( message, options ) => Sentry.captureMessage( message, options );
32
+
33
+ // Next.js instrumentation.js export — re-exposed so consumer
34
+ // instrumentation.js can wire `export const onRequestError =
35
+ // captureRequestError;` without touching @sentry/nextjs directly.
36
+
37
+ const captureRequestError = Sentry.captureRequestError;
38
+
39
+ const logger = Sentry.logger;
40
+
41
+ export { captureException, captureMessage, captureRequestError, init, logger };
@@ -0,0 +1,41 @@
1
+ import * as Sentry from '@sentry/nextjs';
2
+ export { Sentry };
3
+ export { withSentryConfig } from '@sentry/nextjs';
4
+
5
+ // @sentry/nextjs surface routed through drawbridge-telemetry so consumer
6
+ // apps (drawbridge-app-web, drawbridge-share) never import @sentry/nextjs
7
+ // directly. Same architectural reason as the /node default: one owner of
8
+ // the Sentry SDK, zero risk of duplicated module instances with separate
9
+ // scope state.
10
+ //
11
+ // @sentry/nextjs is an optional peer dep — only Next.js consumers need it
12
+ // installed. Node services that import the default export aren't forced
13
+ // to carry the Next.js SDK's weight.
14
+
15
+
16
+ // Project-standard Sentry.init wrapper for Next.js apps. Server, edge,
17
+ // and client configs each call init() with their own overrides; the
18
+ // shared defaults (environment from NEXT_PUBLIC_SENTRY_ENVIRONMENT,
19
+ // enableLogs, tracesSampleRate) live here.
20
+
21
+ const init = ( config = {} ) => Sentry.init({
22
+ dsn : process.env.NEXT_PUBLIC_SENTRY_DSN,
23
+ enableLogs : true,
24
+ environment : process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT || 'localhost',
25
+ tracesSampleRate : 0.1,
26
+ ...config
27
+ });
28
+
29
+ const captureException = ( error, options ) => Sentry.captureException( error, options );
30
+
31
+ const captureMessage = ( message, options ) => Sentry.captureMessage( message, options );
32
+
33
+ // Next.js instrumentation.js export — re-exposed so consumer
34
+ // instrumentation.js can wire `export const onRequestError =
35
+ // captureRequestError;` without touching @sentry/nextjs directly.
36
+
37
+ const captureRequestError = Sentry.captureRequestError;
38
+
39
+ const logger = Sentry.logger;
40
+
41
+ export { captureException, captureMessage, captureRequestError, init, logger };
package/dist/nextjs.js ADDED
@@ -0,0 +1,23 @@
1
+ // nextjs.js
2
+ import * as Sentry from "@sentry/nextjs";
3
+ import { withSentryConfig } from "@sentry/nextjs";
4
+ var init2 = (config = {}) => Sentry.init({
5
+ dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
6
+ enableLogs: true,
7
+ environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT || "localhost",
8
+ tracesSampleRate: 0.1,
9
+ ...config
10
+ });
11
+ var captureException2 = (error, options) => Sentry.captureException(error, options);
12
+ var captureMessage2 = (message, options) => Sentry.captureMessage(message, options);
13
+ var captureRequestError2 = Sentry.captureRequestError;
14
+ var logger2 = Sentry.logger;
15
+ export {
16
+ Sentry,
17
+ captureException2 as captureException,
18
+ captureMessage2 as captureMessage,
19
+ captureRequestError2 as captureRequestError,
20
+ init2 as init,
21
+ logger2 as logger,
22
+ withSentryConfig
23
+ };
package/package.json CHANGED
@@ -1,15 +1,18 @@
1
1
  {
2
2
  "type": "module",
3
+ "dependencies": {
4
+ "@drawbridge/drawbridge-agents": "0.0.4",
5
+ "@sentry/node": "10.27.0"
6
+ },
3
7
  "peerDependencies": {
4
- "@sentry/core": ">=10"
8
+ "@sentry/nextjs": ">=10"
5
9
  },
6
10
  "peerDependenciesMeta": {
7
- "@sentry/core": {
8
- "optional": false
11
+ "@sentry/nextjs": {
12
+ "optional": true
9
13
  }
10
14
  },
11
15
  "devDependencies": {
12
- "@sentry/core": "10.27.0",
13
16
  "tsup": "8.5.1",
14
17
  "typescript": "5.9.3"
15
18
  },
@@ -33,6 +36,11 @@
33
36
  "types": "./dist/stream.d.ts",
34
37
  "import": "./dist/stream.js",
35
38
  "require": "./dist/stream.cjs"
39
+ },
40
+ "./nextjs": {
41
+ "types": "./dist/nextjs.d.ts",
42
+ "import": "./dist/nextjs.js",
43
+ "require": "./dist/nextjs.cjs"
36
44
  }
37
45
  },
38
46
  "files": [
@@ -46,9 +54,9 @@
46
54
  "access": "public"
47
55
  },
48
56
  "scripts": {
49
- "sync": ". \"$HOME/.nvm/nvm.sh\" && nvm use && npm prune && npm install",
57
+ "sync": ". \"$HOME/.nvm/nvm.sh\" && nvm use && npm prune && npm install && npx drawbridge-agents-sync",
50
58
  "build": "tsup && npm publish"
51
59
  },
52
60
  "types": "dist/index.d.ts",
53
- "version": "0.0.3"
61
+ "version": "0.0.5"
54
62
  }