@ttt-productions/monitoring-core 0.13.5 → 0.13.6

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/adapter.d.ts CHANGED
@@ -2,7 +2,11 @@ import type { MonitoringInitOptions, MonitoringUser, ScopeLike } from "./types.j
2
2
  export interface MonitoringAdapter {
3
3
  init(options: MonitoringInitOptions): void | Promise<void>;
4
4
  captureException(error: unknown, context?: Record<string, unknown>): void;
5
- captureMessage(message: string, level?: "fatal" | "error" | "warning" | "info" | "debug"): void;
5
+ /** `context` follows the same contract as `captureException`: keys become extras,
6
+ * with `tags` (flat string map) and `level` special-cased onto the real Sentry
7
+ * fields — see `capture-context.ts`. The explicit `level` argument remains the
8
+ * message's severity; a `level` inside `context` is applied to the scope. */
9
+ captureMessage(message: string, level?: "fatal" | "error" | "warning" | "info" | "debug", context?: Record<string, unknown>): void;
6
10
  setUser(user: MonitoringUser | null): void;
7
11
  setTag(key: string, value: string): void;
8
12
  withScope?<T>(fn: (scope: ScopeLike) => T): T;
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEnF,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3D,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC1E,cAAc,CACZ,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GACvD,IAAI,CAAC;IAER,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,IAA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;IAEzC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,CAAC;IAE9C,aAAa,CAAC,CAAC,UAAU,EAAE;QACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;QACzD,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC,GAAG,IAAI,CAAC;CACV"}
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"","sourcesContent":["import type { MonitoringInitOptions, MonitoringUser, ScopeLike } from \"./types.js\";\n\nexport interface MonitoringAdapter {\n init(options: MonitoringInitOptions): void | Promise<void>;\n\n captureException(error: unknown, context?: Record<string, unknown>): void;\n captureMessage(\n message: string,\n level?: \"fatal\" | \"error\" | \"warning\" | \"info\" | \"debug\"\n ): void;\n\n setUser(user: MonitoringUser | null): void;\n setTag(key: string, value: string): void;\n\n withScope?<T>(fn: (scope: ScopeLike) => T): T;\n \n addBreadcrumb?(breadcrumb: {\n category?: string;\n message?: string;\n level?: \"fatal\" | \"error\" | \"warning\" | \"info\" | \"debug\";\n data?: Record<string, unknown>;\n }): void;\n}"]}
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"","sourcesContent":["import type { MonitoringInitOptions, MonitoringUser, ScopeLike } from \"./types.js\";\n\nexport interface MonitoringAdapter {\n init(options: MonitoringInitOptions): void | Promise<void>;\n\n captureException(error: unknown, context?: Record<string, unknown>): void;\n /** `context` follows the same contract as `captureException`: keys become extras,\n * with `tags` (flat string map) and `level` special-cased onto the real Sentry\n * fields — see `capture-context.ts`. The explicit `level` argument remains the\n * message's severity; a `level` inside `context` is applied to the scope. */\n captureMessage(\n message: string,\n level?: \"fatal\" | \"error\" | \"warning\" | \"info\" | \"debug\",\n context?: Record<string, unknown>\n ): void;\n\n setUser(user: MonitoringUser | null): void;\n setTag(key: string, value: string): void;\n\n withScope?<T>(fn: (scope: ScopeLike) => T): T;\n \n addBreadcrumb?(breadcrumb: {\n category?: string;\n message?: string;\n level?: \"fatal\" | \"error\" | \"warning\" | \"info\" | \"debug\";\n data?: Record<string, unknown>;\n }): void;\n}"]}
@@ -7,7 +7,7 @@ const noopScope = {
7
7
  export const NoopAdapter = {
8
8
  init: (_options) => { },
9
9
  captureException: (_error, _context) => { },
10
- captureMessage: (_message, _level) => { },
10
+ captureMessage: (_message, _level, _context) => { },
11
11
  setUser: (_user) => { },
12
12
  setTag: (_key, _value) => { },
13
13
  withScope: (fn) => fn(noopScope),
@@ -1 +1 @@
1
- {"version":3,"file":"noop.js","sourceRoot":"","sources":["../../src/adapters/noop.ts"],"names":[],"mappings":"AAGA,MAAM,SAAS,GAAc;IAC3B,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;IAChB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;IACjB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAsB;IAC5C,IAAI,EAAE,CAAC,QAA+B,EAAE,EAAE,GAAE,CAAC;IAE7C,gBAAgB,EAAE,CAAC,MAAe,EAAE,QAAkC,EAAE,EAAE,GAAE,CAAC;IAC7E,cAAc,EAAE,CAAC,QAAgB,EAAE,MAAY,EAAE,EAAE,GAAE,CAAC;IAEtD,OAAO,EAAE,CAAC,KAA4B,EAAE,EAAE,GAAE,CAAC;IAC7C,MAAM,EAAE,CAAC,IAAY,EAAE,MAAc,EAAE,EAAE,GAAE,CAAC;IAE5C,SAAS,EAAE,CAAI,EAA2B,EAAE,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;IAE5D,aAAa,EAAE,CAAC,WAKf,EAAE,EAAE,GAAE,CAAC;CACT,CAAC","sourcesContent":["import type { MonitoringAdapter } from \"../adapter.js\";\nimport type { MonitoringInitOptions, MonitoringUser, ScopeLike } from \"../types.js\";\n\nconst noopScope: ScopeLike = {\n setTag: () => {},\n setUser: () => {},\n setExtra: () => {},\n setContext: () => {},\n};\n\nexport const NoopAdapter: MonitoringAdapter = {\n init: (_options: MonitoringInitOptions) => {},\n\n captureException: (_error: unknown, _context?: Record<string, unknown>) => {},\n captureMessage: (_message: string, _level?: any) => {},\n\n setUser: (_user: MonitoringUser | null) => {},\n setTag: (_key: string, _value: string) => {},\n\n withScope: <T>(fn: (scope: ScopeLike) => T) => fn(noopScope),\n \n addBreadcrumb: (_breadcrumb: {\n category?: string;\n message?: string;\n level?: \"fatal\" | \"error\" | \"warning\" | \"info\" | \"debug\";\n data?: Record<string, unknown>;\n }) => {},\n};"]}
1
+ {"version":3,"file":"noop.js","sourceRoot":"","sources":["../../src/adapters/noop.ts"],"names":[],"mappings":"AAGA,MAAM,SAAS,GAAc;IAC3B,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;IAChB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;IACjB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAsB;IAC5C,IAAI,EAAE,CAAC,QAA+B,EAAE,EAAE,GAAE,CAAC;IAE7C,gBAAgB,EAAE,CAAC,MAAe,EAAE,QAAkC,EAAE,EAAE,GAAE,CAAC;IAC7E,cAAc,EAAE,CAAC,QAAgB,EAAE,MAAY,EAAE,QAAkC,EAAE,EAAE,GAAE,CAAC;IAE1F,OAAO,EAAE,CAAC,KAA4B,EAAE,EAAE,GAAE,CAAC;IAC7C,MAAM,EAAE,CAAC,IAAY,EAAE,MAAc,EAAE,EAAE,GAAE,CAAC;IAE5C,SAAS,EAAE,CAAI,EAA2B,EAAE,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;IAE5D,aAAa,EAAE,CAAC,WAKf,EAAE,EAAE,GAAE,CAAC;CACT,CAAC","sourcesContent":["import type { MonitoringAdapter } from \"../adapter.js\";\nimport type { MonitoringInitOptions, MonitoringUser, ScopeLike } from \"../types.js\";\n\nconst noopScope: ScopeLike = {\n setTag: () => {},\n setUser: () => {},\n setExtra: () => {},\n setContext: () => {},\n};\n\nexport const NoopAdapter: MonitoringAdapter = {\n init: (_options: MonitoringInitOptions) => {},\n\n captureException: (_error: unknown, _context?: Record<string, unknown>) => {},\n captureMessage: (_message: string, _level?: any, _context?: Record<string, unknown>) => {},\n\n setUser: (_user: MonitoringUser | null) => {},\n setTag: (_key: string, _value: string) => {},\n\n withScope: <T>(fn: (scope: ScopeLike) => T) => fn(noopScope),\n \n addBreadcrumb: (_breadcrumb: {\n category?: string;\n message?: string;\n level?: \"fatal\" | \"error\" | \"warning\" | \"info\" | \"debug\";\n data?: Record<string, unknown>;\n }) => {},\n};"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sentry-node.d.ts","sourceRoot":"","sources":["../../src/adapters/sentry-node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AA2BvD,eAAO,MAAM,iBAAiB,EAAE,iBA4H/B,CAAC"}
1
+ {"version":3,"file":"sentry-node.d.ts","sourceRoot":"","sources":["../../src/adapters/sentry-node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AA2BvD,eAAO,MAAM,iBAAiB,EAAE,iBA6I/B,CAAC"}
@@ -49,13 +49,27 @@ export const SentryNodeAdapter = {
49
49
  S.captureException(error);
50
50
  })();
51
51
  },
52
- captureMessage(message, level) {
52
+ captureMessage(message, level, context) {
53
53
  if (sentryNodeInstance) {
54
+ if (context) {
55
+ sentryNodeInstance.withScope((scope) => {
56
+ applyCaptureContext(scope, context);
57
+ sentryNodeInstance.captureMessage(message, level);
58
+ });
59
+ return;
60
+ }
54
61
  sentryNodeInstance.captureMessage(message, level);
55
62
  return;
56
63
  }
57
64
  void (async () => {
58
65
  const S = await getSentryNode();
66
+ if (context) {
67
+ S.withScope((scope) => {
68
+ applyCaptureContext(scope, context);
69
+ S.captureMessage(message, level);
70
+ });
71
+ return;
72
+ }
59
73
  S.captureMessage(message, level);
60
74
  })();
61
75
  },
@@ -1 +1 @@
1
- {"version":3,"file":"sentry-node.js","sourceRoot":"","sources":["../../src/adapters/sentry-node.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAY5D,IAAI,iBAAiB,GAAmC,IAAI,CAAC;AAC7D,IAAI,kBAAkB,GAA0B,IAAI,CAAC;AAErD,SAAS,aAAa;IACpB,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,iBAAiB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;YACpD,kBAAkB,GAAG,CAAQ,CAAC;YAC9B,OAAO,kBAAmB,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAsB;IAClD,KAAK,CAAC,IAAI,CAAC,OAA8B;QACvC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC;QACxC,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG;YAAE,OAAO;QAErC,MAAM,CAAC,GAAG,MAAM,aAAa,EAAE,CAAC;QAChC,CAAC,CAAC,IAAI,CAAC;YACL,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,GAA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;YAC9B,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;YAChB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;YACjB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;YAClB,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;SACrB,CAAC;QAEF,KAAK,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,CAAC,GAAG,MAAM,aAAa,EAAE,CAAC;YAChC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,KAAY,CAAC,CAAC,CAAC;QAC3C,CAAC,CAAC,EAAE,CAAC;QAEL,OAAO,EAAE,CAAC,YAAY,CAAC,CAAC;IAC1B,CAAC;IAED,aAAa,CAAC,UAKb;QACC,IAAI,kBAAkB,EAAE,CAAC;YACvB,kBAAkB,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAC7C,OAAO;QACT,CAAC;QACD,KAAK,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,CAAC,GAAG,MAAM,aAAa,EAAE,CAAC;YAChC,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAC9B,CAAC,CAAC,EAAE,CAAC;IACP,CAAC;CACF,CAAC","sourcesContent":["import type { MonitoringAdapter } from \"../adapter.js\";\nimport type { MonitoringInitOptions, MonitoringUser, ScopeLike } from \"../types.js\";\nimport { applyCaptureContext } from \"../capture-context.js\";\n\ntype SentryNodeLike = {\n init: (opts: any) => void;\n captureException: (e: unknown, hint?: any) => void;\n captureMessage: (m: string, level?: any) => void;\n setUser: (u: any) => void;\n setTag: (k: string, v: string) => void;\n withScope: (fn: (scope: any) => void) => void;\n addBreadcrumb: (breadcrumb: any) => void;\n};\n\nlet sentryNodePromise: Promise<SentryNodeLike> | null = null;\nlet sentryNodeInstance: SentryNodeLike | null = null;\n\nfunction getSentryNode(): Promise<SentryNodeLike> {\n if (!sentryNodePromise) {\n sentryNodePromise = import(\"@sentry/node\").then((m) => {\n sentryNodeInstance = m as any;\n return sentryNodeInstance!;\n });\n }\n return sentryNodePromise;\n}\n\nexport const SentryNodeAdapter: MonitoringAdapter = {\n async init(options: MonitoringInitOptions) {\n const enabled = options.enabled ?? true;\n if (!enabled || !options.dsn) return;\n\n const S = await getSentryNode();\n S.init({\n dsn: options.dsn,\n environment: options.environment,\n enabled: true,\n release: options.release,\n ...(options.tracesSampleRate !== undefined ? { tracesSampleRate: options.tracesSampleRate } : {}),\n ...(options.integrations !== undefined ? { integrations: options.integrations } : {}),\n });\n },\n\n captureException(error: unknown, context?: Record<string, unknown>) {\n if (sentryNodeInstance) {\n if (context) {\n sentryNodeInstance.withScope((scope) => {\n applyCaptureContext(scope, context);\n sentryNodeInstance!.captureException(error);\n });\n return;\n }\n sentryNodeInstance.captureException(error);\n return;\n }\n\n void (async () => {\n const S = await getSentryNode();\n\n if (context) {\n S.withScope((scope) => {\n applyCaptureContext(scope, context);\n S.captureException(error);\n });\n return;\n }\n\n S.captureException(error);\n })();\n },\n\n captureMessage(message: string, level?: any) {\n if (sentryNodeInstance) {\n sentryNodeInstance.captureMessage(message, level);\n return;\n }\n void (async () => {\n const S = await getSentryNode();\n S.captureMessage(message, level);\n })();\n },\n\n setUser(user: MonitoringUser | null) {\n if (sentryNodeInstance) {\n sentryNodeInstance.setUser(user as any);\n return;\n }\n void (async () => {\n const S = await getSentryNode();\n S.setUser(user as any);\n })();\n },\n\n setTag(key: string, value: string) {\n if (sentryNodeInstance) {\n sentryNodeInstance.setTag(key, value);\n return;\n }\n void (async () => {\n const S = await getSentryNode();\n S.setTag(key, value);\n })();\n },\n\n // NOTE: withScope calls `fn` exactly once. When Sentry is already loaded\n // (the expected steady state — `init()` awaits the dynamic import, and\n // callers must await `initMonitoring()` before serving traffic), it runs\n // synchronously through the real Sentry scope. Only during the narrow\n // pre-load race window (a call that races the very first `getSentryNode()`\n // resolution) does it fall back to a synchronous no-op-scope call plus an\n // async replay against the real scope — mirroring the browser adapter's\n // same accepted tradeoff for that same race window.\n withScope<T>(fn: (scope: ScopeLike) => T): T {\n if (sentryNodeInstance) {\n let result: T;\n sentryNodeInstance.withScope((scope) => {\n result = fn(scope as any);\n });\n return result!;\n }\n\n const minimalScope: ScopeLike = {\n setTag: () => {},\n setUser: () => {},\n setExtra: () => {},\n setContext: () => {},\n };\n\n void (async () => {\n const S = await getSentryNode();\n S.withScope((scope) => fn(scope as any));\n })();\n\n return fn(minimalScope);\n },\n\n addBreadcrumb(breadcrumb: {\n category?: string;\n message?: string;\n level?: \"fatal\" | \"error\" | \"warning\" | \"info\" | \"debug\";\n data?: Record<string, unknown>;\n }) {\n if (sentryNodeInstance) {\n sentryNodeInstance.addBreadcrumb(breadcrumb);\n return;\n }\n void (async () => {\n const S = await getSentryNode();\n S.addBreadcrumb(breadcrumb);\n })();\n },\n};"]}
1
+ {"version":3,"file":"sentry-node.js","sourceRoot":"","sources":["../../src/adapters/sentry-node.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAY5D,IAAI,iBAAiB,GAAmC,IAAI,CAAC;AAC7D,IAAI,kBAAkB,GAA0B,IAAI,CAAC;AAErD,SAAS,aAAa;IACpB,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,iBAAiB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;YACpD,kBAAkB,GAAG,CAAQ,CAAC;YAC9B,OAAO,kBAAmB,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAsB;IAClD,KAAK,CAAC,IAAI,CAAC,OAA8B;QACvC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC;QACxC,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG;YAAE,OAAO;QAErC,MAAM,CAAC,GAAG,MAAM,a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C,UAAU,CAAC,CAAC;YAC7C,OAAO;QACT,CAAC;QACD,KAAK,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,CAAC,GAAG,MAAM,aAAa,EAAE,CAAC;YAChC,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAC9B,CAAC,CAAC,EAAE,CAAC;IACP,CAAC;CACF,CAAC","sourcesContent":["import type { MonitoringAdapter } from \"../adapter.js\";\nimport type { MonitoringInitOptions, MonitoringUser, ScopeLike } from \"../types.js\";\nimport { applyCaptureContext } from \"../capture-context.js\";\n\ntype SentryNodeLike = {\n init: (opts: any) => void;\n captureException: (e: unknown, hint?: any) => void;\n captureMessage: (m: string, level?: any) => void;\n setUser: (u: any) => void;\n setTag: (k: string, v: string) => void;\n withScope: (fn: (scope: any) => void) => void;\n addBreadcrumb: (breadcrumb: any) => void;\n};\n\nlet sentryNodePromise: Promise<SentryNodeLike> | null = null;\nlet sentryNodeInstance: SentryNodeLike | null = null;\n\nfunction getSentryNode(): Promise<SentryNodeLike> {\n if (!sentryNodePromise) {\n sentryNodePromise = import(\"@sentry/node\").then((m) => {\n sentryNodeInstance = m as any;\n return sentryNodeInstance!;\n });\n }\n return sentryNodePromise;\n}\n\nexport const SentryNodeAdapter: MonitoringAdapter = {\n async init(options: MonitoringInitOptions) {\n const enabled = options.enabled ?? true;\n if (!enabled || !options.dsn) return;\n\n const S = await getSentryNode();\n S.init({\n dsn: options.dsn,\n environment: options.environment,\n enabled: true,\n release: options.release,\n ...(options.tracesSampleRate !== undefined ? { tracesSampleRate: options.tracesSampleRate } : {}),\n ...(options.integrations !== undefined ? { integrations: options.integrations } : {}),\n });\n },\n\n captureException(error: unknown, context?: Record<string, unknown>) {\n if (sentryNodeInstance) {\n if (context) {\n sentryNodeInstance.withScope((scope) => {\n applyCaptureContext(scope, context);\n sentryNodeInstance!.captureException(error);\n });\n return;\n }\n sentryNodeInstance.captureException(error);\n return;\n }\n\n void (async () => {\n const S = await getSentryNode();\n\n if (context) {\n S.withScope((scope) => {\n applyCaptureContext(scope, context);\n S.captureException(error);\n });\n return;\n }\n\n S.captureException(error);\n })();\n },\n\n captureMessage(message: string, level?: any, context?: Record<string, unknown>) {\n if (sentryNodeInstance) {\n if (context) {\n sentryNodeInstance.withScope((scope) => {\n applyCaptureContext(scope, context);\n sentryNodeInstance!.captureMessage(message, level);\n });\n return;\n }\n sentryNodeInstance.captureMessage(message, level);\n return;\n }\n\n void (async () => {\n const S = await getSentryNode();\n\n if (context) {\n S.withScope((scope) => {\n applyCaptureContext(scope, context);\n S.captureMessage(message, level);\n });\n return;\n }\n\n S.captureMessage(message, level);\n })();\n },\n\n setUser(user: MonitoringUser | null) {\n if (sentryNodeInstance) {\n sentryNodeInstance.setUser(user as any);\n return;\n }\n void (async () => {\n const S = await getSentryNode();\n S.setUser(user as any);\n })();\n },\n\n setTag(key: string, value: string) {\n if (sentryNodeInstance) {\n sentryNodeInstance.setTag(key, value);\n return;\n }\n void (async () => {\n const S = await getSentryNode();\n S.setTag(key, value);\n })();\n },\n\n // NOTE: withScope calls `fn` exactly once. When Sentry is already loaded\n // (the expected steady state — `init()` awaits the dynamic import, and\n // callers must await `initMonitoring()` before serving traffic), it runs\n // synchronously through the real Sentry scope. Only during the narrow\n // pre-load race window (a call that races the very first `getSentryNode()`\n // resolution) does it fall back to a synchronous no-op-scope call plus an\n // async replay against the real scope — mirroring the browser adapter's\n // same accepted tradeoff for that same race window.\n withScope<T>(fn: (scope: ScopeLike) => T): T {\n if (sentryNodeInstance) {\n let result: T;\n sentryNodeInstance.withScope((scope) => {\n result = fn(scope as any);\n });\n return result!;\n }\n\n const minimalScope: ScopeLike = {\n setTag: () => {},\n setUser: () => {},\n setExtra: () => {},\n setContext: () => {},\n };\n\n void (async () => {\n const S = await getSentryNode();\n S.withScope((scope) => fn(scope as any));\n })();\n\n return fn(minimalScope);\n },\n\n addBreadcrumb(breadcrumb: {\n category?: string;\n message?: string;\n level?: \"fatal\" | \"error\" | \"warning\" | \"info\" | \"debug\";\n data?: Record<string, unknown>;\n }) {\n if (sentryNodeInstance) {\n sentryNodeInstance.addBreadcrumb(breadcrumb);\n return;\n }\n void (async () => {\n const S = await getSentryNode();\n S.addBreadcrumb(breadcrumb);\n })();\n },\n};"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sentry.d.ts","sourceRoot":"","sources":["../../src/adapters/sentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AA2BvD,eAAO,MAAM,aAAa,EAAE,iBA0H3B,CAAC"}
1
+ {"version":3,"file":"sentry.d.ts","sourceRoot":"","sources":["../../src/adapters/sentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AA2BvD,eAAO,MAAM,aAAa,EAAE,iBA2I3B,CAAC"}
@@ -49,13 +49,27 @@ export const SentryAdapter = {
49
49
  S.captureException(error);
50
50
  })();
51
51
  },
52
- captureMessage(message, level) {
52
+ captureMessage(message, level, context) {
53
53
  if (sentryInstance) {
54
+ if (context && sentryInstance.withScope) {
55
+ sentryInstance.withScope((scope) => {
56
+ applyCaptureContext(scope, context);
57
+ sentryInstance.captureMessage(message, level);
58
+ });
59
+ return;
60
+ }
54
61
  sentryInstance.captureMessage(message, level);
55
62
  return;
56
63
  }
57
64
  void (async () => {
58
65
  const S = await getSentry();
66
+ if (context && S.withScope) {
67
+ S.withScope((scope) => {
68
+ applyCaptureContext(scope, context);
69
+ S.captureMessage(message, level);
70
+ });
71
+ return;
72
+ }
59
73
  S.captureMessage(message, level);
60
74
  })();
61
75
  },
@@ -1 +1 @@
1
- {"version":3,"file":"sentry.js","sourceRoot":"","sources":["../../src/adapters/sentry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAY5D,IAAI,aAAa,GAA+B,IAAI,CAAC;AACrD,IAAI,cAAc,GAAsB,IAAI,CAAC;AAE7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AAc,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAC3C,CAAC;YACD,OAAO;QACT,CAAC;QACD,KAAK,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,CAAC,GAAG,MAAM,SAAS,EAAE,CAAC;YAC5B,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;gBACpB,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;IACP,CAAC;CACF,CAAC","sourcesContent":["import type { MonitoringAdapter } from \"../adapter.js\";\nimport type { MonitoringInitOptions, MonitoringUser, ScopeLike } from \"../types.js\";\nimport { applyCaptureContext } from \"../capture-context.js\";\n\ntype SentryLike = {\n init: (opts: any) => void;\n captureException: (e: unknown) => void;\n captureMessage: (m: string, level?: any) => void;\n setUser: (u: any) => void;\n setTag: (k: string, v: string) => void;\n withScope?: (fn: (scope: any) => void) => void;\n addBreadcrumb?: (breadcrumb: any) => void;\n};\n\nlet sentryPromise: Promise<SentryLike> | null = null;\nlet sentryInstance: SentryLike | null = null;\n\nfunction getSentry(): Promise<SentryLike> {\n if (!sentryPromise) {\n sentryPromise = import(\"@sentry/nextjs\").then((m) => {\n sentryInstance = m as any;\n return sentryInstance!;\n });\n }\n return sentryPromise;\n}\n\nexport const SentryAdapter: MonitoringAdapter = {\n async init(options: MonitoringInitOptions) {\n const enabled = options.enabled ?? true;\n if (!enabled || !options.dsn) return;\n\n const S = await getSentry();\n S.init({\n dsn: options.dsn,\n environment: options.environment,\n enabled: true,\n release: options.release,\n ...(options.tracesSampleRate !== undefined ? { tracesSampleRate: options.tracesSampleRate } : {}),\n ...(options.integrations !== undefined ? { integrations: options.integrations } : {}),\n });\n },\n\n captureException(error: unknown, context?: Record<string, unknown>) {\n if (sentryInstance) {\n if (context && sentryInstance.withScope) {\n sentryInstance.withScope((scope) => {\n applyCaptureContext(scope, context);\n sentryInstance!.captureException(error);\n });\n return;\n }\n sentryInstance.captureException(error);\n return;\n }\n\n void (async () => {\n const S = await getSentry();\n\n if (context && S.withScope) {\n S.withScope((scope) => {\n applyCaptureContext(scope, context);\n S.captureException(error);\n });\n return;\n }\n\n S.captureException(error);\n })();\n },\n\n captureMessage(message: string, level?: any) {\n if (sentryInstance) {\n sentryInstance.captureMessage(message, level);\n return;\n }\n void (async () => {\n const S = await getSentry();\n S.captureMessage(message, level);\n })();\n },\n\n setUser(user: MonitoringUser | null) {\n if (sentryInstance) {\n sentryInstance.setUser(user as any);\n return;\n }\n void (async () => {\n const S = await getSentry();\n S.setUser(user as any);\n })();\n },\n\n setTag(key: string, value: string) {\n if (sentryInstance) {\n sentryInstance.setTag(key, value);\n return;\n }\n void (async () => {\n const S = await getSentry();\n S.setTag(key, value);\n })();\n },\n\n withScope<T>(fn: (scope: ScopeLike) => T): T {\n if (sentryInstance && sentryInstance.withScope) {\n let result: T;\n sentryInstance.withScope((scope) => {\n result = fn(scope as any);\n });\n return result!;\n }\n\n // Sentry not loaded yet — run with no-op scope, then replay async\n const minimalScope: ScopeLike = {\n setTag: () => {},\n setUser: () => {},\n setExtra: () => {},\n setContext: () => {},\n };\n\n void (async () => {\n const S = await getSentry();\n if (!S.withScope) return;\n S.withScope((scope) => fn(scope as any));\n })();\n\n return fn(minimalScope);\n },\n\n addBreadcrumb(breadcrumb: {\n category?: string;\n message?: string;\n level?: \"fatal\" | \"error\" | \"warning\" | \"info\" | \"debug\";\n data?: Record<string, unknown>;\n }) {\n if (sentryInstance) {\n if (sentryInstance.addBreadcrumb) {\n sentryInstance.addBreadcrumb(breadcrumb);\n }\n return;\n }\n void (async () => {\n const S = await getSentry();\n if (S.addBreadcrumb) {\n S.addBreadcrumb(breadcrumb);\n }\n })();\n },\n};"]}
1
+ {"version":3,"file":"sentry.js","sourceRoot":"","sources":["../../src/adapters/sentry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAY5D,IAAI,aAAa,GAA+B,IAAI,CAA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C9B,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;YAChB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;YACjB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;YAClB,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;SACrB,CAAC;QAEF,KAAK,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,CAAC,GAAG,MAAM,SAAS,EAAE,CAAC;YAC5B,IAAI,CAAC,CAAC,CAAC,SAAS;gBAAE,OAAO;YACzB,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,KAAY,CAAC,CAAC,CAAC;QAC3C,CAAC,CAAC,EAAE,CAAC;QAEL,OAAO,EAAE,CAAC,YAAY,CAAC,CAAC;IAC1B,CAAC;IAED,aAAa,CAAC,UAKb;QACC,IAAI,cAAc,EAAE,CAAC;YACnB,IAAI,cAAc,CAAC,aAAa,EAAE,CAAC;gBACjC,cAAc,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAC3C,CAAC;YACD,OAAO;QACT,CAAC;QACD,KAAK,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,CAAC,GAAG,MAAM,SAAS,EAAE,CAAC;YAC5B,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;gBACpB,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;IACP,CAAC;CACF,CAAC","sourcesContent":["import type { MonitoringAdapter } from \"../adapter.js\";\nimport type { MonitoringInitOptions, MonitoringUser, ScopeLike } from \"../types.js\";\nimport { applyCaptureContext } from \"../capture-context.js\";\n\ntype SentryLike = {\n init: (opts: any) => void;\n captureException: (e: unknown) => void;\n captureMessage: (m: string, level?: any) => void;\n setUser: (u: any) => void;\n setTag: (k: string, v: string) => void;\n withScope?: (fn: (scope: any) => void) => void;\n addBreadcrumb?: (breadcrumb: any) => void;\n};\n\nlet sentryPromise: Promise<SentryLike> | null = null;\nlet sentryInstance: SentryLike | null = null;\n\nfunction getSentry(): Promise<SentryLike> {\n if (!sentryPromise) {\n sentryPromise = import(\"@sentry/nextjs\").then((m) => {\n sentryInstance = m as any;\n return sentryInstance!;\n });\n }\n return sentryPromise;\n}\n\nexport const SentryAdapter: MonitoringAdapter = {\n async init(options: MonitoringInitOptions) {\n const enabled = options.enabled ?? true;\n if (!enabled || !options.dsn) return;\n\n const S = await getSentry();\n S.init({\n dsn: options.dsn,\n environment: options.environment,\n enabled: true,\n release: options.release,\n ...(options.tracesSampleRate !== undefined ? { tracesSampleRate: options.tracesSampleRate } : {}),\n ...(options.integrations !== undefined ? { integrations: options.integrations } : {}),\n });\n },\n\n captureException(error: unknown, context?: Record<string, unknown>) {\n if (sentryInstance) {\n if (context && sentryInstance.withScope) {\n sentryInstance.withScope((scope) => {\n applyCaptureContext(scope, context);\n sentryInstance!.captureException(error);\n });\n return;\n }\n sentryInstance.captureException(error);\n return;\n }\n\n void (async () => {\n const S = await getSentry();\n\n if (context && S.withScope) {\n S.withScope((scope) => {\n applyCaptureContext(scope, context);\n S.captureException(error);\n });\n return;\n }\n\n S.captureException(error);\n })();\n },\n\n captureMessage(message: string, level?: any, context?: Record<string, unknown>) {\n if (sentryInstance) {\n if (context && sentryInstance.withScope) {\n sentryInstance.withScope((scope) => {\n applyCaptureContext(scope, context);\n sentryInstance!.captureMessage(message, level);\n });\n return;\n }\n sentryInstance.captureMessage(message, level);\n return;\n }\n\n void (async () => {\n const S = await getSentry();\n\n if (context && S.withScope) {\n S.withScope((scope) => {\n applyCaptureContext(scope, context);\n S.captureMessage(message, level);\n });\n return;\n }\n\n S.captureMessage(message, level);\n })();\n },\n\n setUser(user: MonitoringUser | null) {\n if (sentryInstance) {\n sentryInstance.setUser(user as any);\n return;\n }\n void (async () => {\n const S = await getSentry();\n S.setUser(user as any);\n })();\n },\n\n setTag(key: string, value: string) {\n if (sentryInstance) {\n sentryInstance.setTag(key, value);\n return;\n }\n void (async () => {\n const S = await getSentry();\n S.setTag(key, value);\n })();\n },\n\n withScope<T>(fn: (scope: ScopeLike) => T): T {\n if (sentryInstance && sentryInstance.withScope) {\n let result: T;\n sentryInstance.withScope((scope) => {\n result = fn(scope as any);\n });\n return result!;\n }\n\n // Sentry not loaded yet — run with no-op scope, then replay async\n const minimalScope: ScopeLike = {\n setTag: () => {},\n setUser: () => {},\n setExtra: () => {},\n setContext: () => {},\n };\n\n void (async () => {\n const S = await getSentry();\n if (!S.withScope) return;\n S.withScope((scope) => fn(scope as any));\n })();\n\n return fn(minimalScope);\n },\n\n addBreadcrumb(breadcrumb: {\n category?: string;\n message?: string;\n level?: \"fatal\" | \"error\" | \"warning\" | \"info\" | \"debug\";\n data?: Record<string, unknown>;\n }) {\n if (sentryInstance) {\n if (sentryInstance.addBreadcrumb) {\n sentryInstance.addBreadcrumb(breadcrumb);\n }\n return;\n }\n void (async () => {\n const S = await getSentry();\n if (S.addBreadcrumb) {\n S.addBreadcrumb(breadcrumb);\n }\n })();\n },\n};"]}
package/dist/api.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { MonitoringUser } from "./types.js";
2
2
  export declare function captureException(error: unknown, context?: Record<string, unknown>): void;
3
- export declare function captureMessage(message: string, level?: "fatal" | "error" | "warning" | "info" | "debug"): void;
3
+ export declare function captureMessage(message: string, level?: "fatal" | "error" | "warning" | "info" | "debug", context?: Record<string, unknown>): void;
4
4
  export declare function setUser(user: MonitoringUser | null): void;
5
5
  export declare function setTag(key: string, value: string): void;
6
6
  export declare function withScope(fn: (scope: any) => any): any;
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,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AAC,KAAK,EAAE,GAAG,KAAK,GAAG,OAQhD;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,QAKA"}
package/dist/api.js CHANGED
@@ -2,8 +2,8 @@ import { getMonitoringAdapter } from "./init.js";
2
2
  export function captureException(error, context) {
3
3
  return getMonitoringAdapter().captureException(error, context);
4
4
  }
5
- export function captureMessage(message, level) {
6
- return getMonitoringAdapter().captureMessage(message, level);
5
+ export function captureMessage(message, level, context) {
6
+ return getMonitoringAdapter().captureMessage(message, level, context);
7
7
  }
8
8
  export function setUser(user) {
9
9
  return getMonitoringAdapter().setUser(user);
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,UAAU,gBAAgB,CAAC,KAAc,EAAE,OAAiC;IAChF,OAAO,oBAAoB,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,OAAe,EACf,KAAwD;IAExD,OAAO,oBAAoB,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,IAA2B;IACjD,OAAO,oBAAoB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAW,EAAE,KAAa;IAC/C,OAAO,oBAAoB,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,EAAuB;IAC/C,MAAM,CAAC,GAAG,oBAAoB,EAAE,CAAC;IACjC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/C,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;QAChB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;QACjB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;QAClB,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;KACrB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,UAK7B;IACC,MAAM,CAAC,GAAG,oBAAoB,EAAE,CAAC;IACjC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;QACpB,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC","sourcesContent":["import type { MonitoringUser } from \"./types.js\";\nimport { getMonitoringAdapter } from \"./init.js\";\n\nexport function captureException(error: unknown, context?: Record<string, unknown>) {\n return getMonitoringAdapter().captureException(error, context);\n}\n\nexport function captureMessage(\n message: string,\n level?: \"fatal\" | \"error\" | \"warning\" | \"info\" | \"debug\"\n) {\n return getMonitoringAdapter().captureMessage(message, level);\n}\n\nexport function setUser(user: MonitoringUser | null) {\n return getMonitoringAdapter().setUser(user);\n}\n\nexport function setTag(key: string, value: string) {\n return getMonitoringAdapter().setTag(key, value);\n}\n\nexport function withScope(fn: (scope: any) => any) {\n const a = getMonitoringAdapter();\n return a.withScope ? a.withScope(fn as any) : fn({\n setTag: () => {},\n setUser: () => {},\n setExtra: () => {},\n setContext: () => {},\n });\n}\n\nexport function addBreadcrumb(breadcrumb: {\n category?: string;\n message?: string;\n level?: \"fatal\" | \"error\" | \"warning\" | \"info\" | \"debug\";\n data?: Record<string, unknown>;\n}) {\n const a = getMonitoringAdapter();\n if (a.addBreadcrumb) {\n a.addBreadcrumb(breadcrumb);\n }\n}"]}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,UAAU,gBAAgB,CAAC,KAAc,EAAE,OAAiC;IAChF,OAAO,oBAAoB,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,OAAe,EACf,KAAwD,EACxD,OAAiC;IAEjC,OAAO,oBAAoB,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,IAA2B;IACjD,OAAO,oBAAoB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAW,EAAE,KAAa;IAC/C,OAAO,oBAAoB,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,EAAuB;IAC/C,MAAM,CAAC,GAAG,oBAAoB,EAAE,CAAC;IACjC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/C,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;QAChB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;QACjB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;QAClB,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;KACrB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,UAK7B;IACC,MAAM,CAAC,GAAG,oBAAoB,EAAE,CAAC;IACjC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;QACpB,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC","sourcesContent":["import type { MonitoringUser } from \"./types.js\";\nimport { getMonitoringAdapter } from \"./init.js\";\n\nexport function captureException(error: unknown, context?: Record<string, unknown>) {\n return getMonitoringAdapter().captureException(error, context);\n}\n\nexport function captureMessage(\n message: string,\n level?: \"fatal\" | \"error\" | \"warning\" | \"info\" | \"debug\",\n context?: Record<string, unknown>\n) {\n return getMonitoringAdapter().captureMessage(message, level, context);\n}\n\nexport function setUser(user: MonitoringUser | null) {\n return getMonitoringAdapter().setUser(user);\n}\n\nexport function setTag(key: string, value: string) {\n return getMonitoringAdapter().setTag(key, value);\n}\n\nexport function withScope(fn: (scope: any) => any) {\n const a = getMonitoringAdapter();\n return a.withScope ? a.withScope(fn as any) : fn({\n setTag: () => {},\n setUser: () => {},\n setExtra: () => {},\n setContext: () => {},\n });\n}\n\nexport function addBreadcrumb(breadcrumb: {\n category?: string;\n message?: string;\n level?: \"fatal\" | \"error\" | \"warning\" | \"info\" | \"debug\";\n data?: Record<string, unknown>;\n}) {\n const a = getMonitoringAdapter();\n if (a.addBreadcrumb) {\n a.addBreadcrumb(breadcrumb);\n }\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttt-productions/monitoring-core",
3
- "version": "0.13.5",
3
+ "version": "0.13.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ttt-productions/ttt-packages.git",