@sentry/node 7.99.0 → 7.100.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.
Files changed (121) hide show
  1. package/cjs/index.js +31 -8
  2. package/cjs/index.js.map +1 -1
  3. package/cjs/integrations/anr/index.js +8 -1
  4. package/cjs/integrations/anr/index.js.map +1 -1
  5. package/cjs/integrations/anr/legacy.js +1 -0
  6. package/cjs/integrations/anr/legacy.js.map +1 -1
  7. package/cjs/integrations/anr/worker-script.js +1 -1
  8. package/cjs/integrations/console.js +10 -2
  9. package/cjs/integrations/console.js.map +1 -1
  10. package/cjs/integrations/context.js +10 -2
  11. package/cjs/integrations/context.js.map +1 -1
  12. package/cjs/integrations/contextlines.js +10 -2
  13. package/cjs/integrations/contextlines.js.map +1 -1
  14. package/cjs/integrations/hapi/index.js +8 -2
  15. package/cjs/integrations/hapi/index.js.map +1 -1
  16. package/cjs/integrations/http.js +71 -9
  17. package/cjs/integrations/http.js.map +1 -1
  18. package/cjs/integrations/index.js +1 -1
  19. package/cjs/integrations/index.js.map +1 -1
  20. package/cjs/integrations/local-variables/index.js +8 -1
  21. package/cjs/integrations/local-variables/index.js.map +1 -1
  22. package/cjs/integrations/local-variables/local-variables-sync.js +8 -2
  23. package/cjs/integrations/local-variables/local-variables-sync.js.map +1 -1
  24. package/cjs/integrations/modules.js +10 -2
  25. package/cjs/integrations/modules.js.map +1 -1
  26. package/cjs/integrations/onuncaughtexception.js +10 -2
  27. package/cjs/integrations/onuncaughtexception.js.map +1 -1
  28. package/cjs/integrations/onunhandledrejection.js +10 -2
  29. package/cjs/integrations/onunhandledrejection.js.map +1 -1
  30. package/cjs/integrations/spotlight.js +9 -2
  31. package/cjs/integrations/spotlight.js.map +1 -1
  32. package/cjs/integrations/undici/index.js +17 -1
  33. package/cjs/integrations/undici/index.js.map +1 -1
  34. package/cjs/sdk.js +20 -26
  35. package/cjs/sdk.js.map +1 -1
  36. package/esm/index.js +18 -8
  37. package/esm/index.js.map +1 -1
  38. package/esm/integrations/anr/index.js +9 -3
  39. package/esm/integrations/anr/index.js.map +1 -1
  40. package/esm/integrations/anr/legacy.js +1 -0
  41. package/esm/integrations/anr/legacy.js.map +1 -1
  42. package/esm/integrations/anr/worker-script.js +1 -1
  43. package/esm/integrations/console.js +11 -4
  44. package/esm/integrations/console.js.map +1 -1
  45. package/esm/integrations/context.js +11 -4
  46. package/esm/integrations/context.js.map +1 -1
  47. package/esm/integrations/contextlines.js +11 -4
  48. package/esm/integrations/contextlines.js.map +1 -1
  49. package/esm/integrations/hapi/index.js +9 -4
  50. package/esm/integrations/hapi/index.js.map +1 -1
  51. package/esm/integrations/http.js +71 -12
  52. package/esm/integrations/http.js.map +1 -1
  53. package/esm/integrations/index.js +2 -0
  54. package/esm/integrations/index.js.map +1 -1
  55. package/esm/integrations/local-variables/index.js +9 -3
  56. package/esm/integrations/local-variables/index.js.map +1 -1
  57. package/esm/integrations/local-variables/local-variables-sync.js +9 -4
  58. package/esm/integrations/local-variables/local-variables-sync.js.map +1 -1
  59. package/esm/integrations/modules.js +11 -4
  60. package/esm/integrations/modules.js.map +1 -1
  61. package/esm/integrations/onuncaughtexception.js +11 -4
  62. package/esm/integrations/onuncaughtexception.js.map +1 -1
  63. package/esm/integrations/onunhandledrejection.js +11 -4
  64. package/esm/integrations/onunhandledrejection.js.map +1 -1
  65. package/esm/integrations/spotlight.js +10 -4
  66. package/esm/integrations/spotlight.js.map +1 -1
  67. package/esm/integrations/undici/index.js +19 -4
  68. package/esm/integrations/undici/index.js.map +1 -1
  69. package/esm/sdk.js +27 -33
  70. package/esm/sdk.js.map +1 -1
  71. package/package.json +5 -5
  72. package/types/index.d.ts +15 -5
  73. package/types/index.d.ts.map +1 -1
  74. package/types/integrations/anr/index.d.ts +4 -0
  75. package/types/integrations/anr/index.d.ts.map +1 -1
  76. package/types/integrations/anr/legacy.d.ts.map +1 -1
  77. package/types/integrations/console.d.ts +6 -1
  78. package/types/integrations/console.d.ts.map +1 -1
  79. package/types/integrations/context.d.ts +13 -1
  80. package/types/integrations/context.d.ts.map +1 -1
  81. package/types/integrations/contextlines.d.ts +16 -1
  82. package/types/integrations/contextlines.d.ts.map +1 -1
  83. package/types/integrations/hapi/index.d.ts +4 -1
  84. package/types/integrations/hapi/index.d.ts.map +1 -1
  85. package/types/integrations/http.d.ts +37 -1
  86. package/types/integrations/http.d.ts.map +1 -1
  87. package/types/integrations/index.d.ts.map +1 -1
  88. package/types/integrations/local-variables/index.d.ts +6 -1
  89. package/types/integrations/local-variables/index.d.ts.map +1 -1
  90. package/types/integrations/local-variables/local-variables-async.d.ts +5 -1
  91. package/types/integrations/local-variables/local-variables-async.d.ts.map +1 -1
  92. package/types/integrations/local-variables/local-variables-sync.d.ts +4 -1
  93. package/types/integrations/local-variables/local-variables-sync.d.ts.map +1 -1
  94. package/types/integrations/modules.d.ts +6 -1
  95. package/types/integrations/modules.d.ts.map +1 -1
  96. package/types/integrations/onuncaughtexception.d.ts +6 -1
  97. package/types/integrations/onuncaughtexception.d.ts.map +1 -1
  98. package/types/integrations/onunhandledrejection.d.ts +6 -1
  99. package/types/integrations/onunhandledrejection.d.ts.map +1 -1
  100. package/types/integrations/spotlight.d.ts +12 -1
  101. package/types/integrations/spotlight.d.ts.map +1 -1
  102. package/types/integrations/undici/index.d.ts +9 -1
  103. package/types/integrations/undici/index.d.ts.map +1 -1
  104. package/types/sdk.d.ts +1 -12
  105. package/types/sdk.d.ts.map +1 -1
  106. package/types-ts3.8/index.d.ts +15 -5
  107. package/types-ts3.8/integrations/anr/index.d.ts +4 -0
  108. package/types-ts3.8/integrations/console.d.ts +6 -1
  109. package/types-ts3.8/integrations/context.d.ts +13 -1
  110. package/types-ts3.8/integrations/contextlines.d.ts +16 -1
  111. package/types-ts3.8/integrations/hapi/index.d.ts +4 -1
  112. package/types-ts3.8/integrations/http.d.ts +37 -1
  113. package/types-ts3.8/integrations/local-variables/index.d.ts +6 -1
  114. package/types-ts3.8/integrations/local-variables/local-variables-async.d.ts +5 -1
  115. package/types-ts3.8/integrations/local-variables/local-variables-sync.d.ts +4 -1
  116. package/types-ts3.8/integrations/modules.d.ts +6 -1
  117. package/types-ts3.8/integrations/onuncaughtexception.d.ts +6 -1
  118. package/types-ts3.8/integrations/onunhandledrejection.d.ts +6 -1
  119. package/types-ts3.8/integrations/spotlight.d.ts +12 -1
  120. package/types-ts3.8/integrations/undici/index.d.ts +9 -1
  121. package/types-ts3.8/sdk.d.ts +1 -12
@@ -4,10 +4,25 @@ import { Event, Integration, IntegrationClass } from '@sentry/types';
4
4
  * @hidden
5
5
  */
6
6
  export declare function resetFileContentCache(): void;
7
- /** Add node modules / packages to the event */
7
+ interface ContextLinesOptions {
8
+ /**
9
+ * Sets the number of context lines for each frame when loading a file.
10
+ * Defaults to 7.
11
+ *
12
+ * Set to 0 to disable loading and inclusion of source files.
13
+ **/
14
+ frameContextLines?: number;
15
+ }
16
+ export declare const contextLinesIntegration: (options?: ContextLinesOptions | undefined) => import("@sentry/types").IntegrationFnResult;
17
+ /**
18
+ * Add node modules / packages to the event.
19
+ * @deprecated Use `contextLinesIntegration()` instead.
20
+ */
8
21
  export declare const ContextLines: IntegrationClass<Integration & {
9
22
  processEvent: (event: Event) => Promise<Event>;
10
23
  }> & (new (options?: {
11
24
  frameContextLines?: number;
12
25
  }) => Integration);
26
+ export type ContextLines = typeof ContextLines;
27
+ export {};
13
28
  //# sourceMappingURL=contextlines.d.ts.map
@@ -12,8 +12,11 @@ export type HapiOptions = {
12
12
  /** Hapi server instance */
13
13
  server?: Record<any, any>;
14
14
  };
15
+ export declare const hapiIntegration: (options?: HapiOptions | undefined) => import("@sentry/types").IntegrationFnResult;
15
16
  /**
16
- * Hapi Framework Integration
17
+ * Hapi Framework Integration.
18
+ * @deprecated Use `hapiIntegration()` instead.
17
19
  */
18
20
  export declare const Hapi: import("@sentry/types").IntegrationClass<import("@sentry/types").Integration>;
21
+ export type Hapi = typeof Hapi;
19
22
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { Hub } from '@sentry/core';
2
- import { EventProcessor, Integration, TracePropagationTargets } from '@sentry/types';
2
+ import { ClientOptions, EventProcessor, Integration, IntegrationFnResult, TracePropagationTargets } from '@sentry/types';
3
+ import { NodeClientOptions } from '../types';
3
4
  interface TracingOptions {
4
5
  /**
5
6
  * List of strings/regex controlling to which outgoing requests
@@ -24,6 +25,11 @@ interface TracingOptions {
24
25
  * By default, spans will be created for all outgoing requests.
25
26
  */
26
27
  shouldCreateSpanForRequest?: (url: string) => boolean;
28
+ /**
29
+ * This option is just for compatibility with v7.
30
+ * In v8, this will be the default behavior.
31
+ */
32
+ enableIfHasTracingEnabled?: boolean;
27
33
  }
28
34
  interface HttpOptions {
29
35
  /**
@@ -37,9 +43,35 @@ interface HttpOptions {
37
43
  */
38
44
  tracing?: TracingOptions | boolean;
39
45
  }
46
+ interface HttpIntegrationOptions {
47
+ /**
48
+ * Whether breadcrumbs should be recorded for requests
49
+ * Defaults to true.
50
+ */
51
+ breadcrumbs?: boolean;
52
+ /**
53
+ * Whether tracing spans should be created for requests
54
+ * If not set, this will be enabled/disabled based on if tracing is enabled.
55
+ */
56
+ tracing?: boolean;
57
+ /**
58
+ * Function determining whether or not to create spans to track outgoing requests to the given URL.
59
+ * By default, spans will be created for all outgoing requests.
60
+ */
61
+ shouldCreateSpanForRequest?: (url: string) => boolean;
62
+ }
63
+ /**
64
+ * The http module integration instruments Node's internal http module. It creates breadcrumbs, spans for outgoing
65
+ * http requests, and attaches trace data when tracing is enabled via its `tracing` option.
66
+ *
67
+ * By default, this will always create breadcrumbs, and will create spans if tracing is enabled.
68
+ */
69
+ export declare const httpIntegration: (options?: HttpIntegrationOptions | undefined) => IntegrationFnResult;
40
70
  /**
41
71
  * The http module integration instruments Node's internal http module. It creates breadcrumbs, transactions for outgoing
42
72
  * http requests and attaches trace data when tracing is enabled via its `tracing` option.
73
+ *
74
+ * @deprecated Use `httpIntegration()` instead.
43
75
  */
44
76
  export declare class Http implements Integration {
45
77
  /**
@@ -61,5 +93,9 @@ export declare class Http implements Integration {
61
93
  */
62
94
  setupOnce(_addGlobalEventProcessor: (callback: EventProcessor) => void, setupOnceGetCurrentHub: () => Hub): void;
63
95
  }
96
+ /** Exported for tests only. */
97
+ export declare function _shouldCreateSpans(tracingOptions: TracingOptions | undefined, clientOptions: Partial<ClientOptions> | undefined): boolean;
98
+ /** Exported for tests only. */
99
+ export declare function _getShouldCreateSpanForRequest(shouldCreateSpans: boolean, tracingOptions: TracingOptions | undefined, clientOptions: Partial<NodeClientOptions> | undefined): undefined | ((url: string) => boolean);
64
100
  export {};
65
101
  //# sourceMappingURL=http.d.ts.map
@@ -1,8 +1,13 @@
1
+ import { LocalVariablesSync } from './local-variables-sync';
1
2
  /**
2
- * Adds local variables to exception frames
3
+ * Adds local variables to exception frames.
4
+ *
5
+ * @deprecated Use `localVariablesIntegration()` instead.
3
6
  */
4
7
  export declare const LocalVariables: import("@sentry/types").IntegrationClass<import("@sentry/types").Integration & {
5
8
  processEvent: (event: import("@sentry/types").Event) => import("@sentry/types").Event;
6
9
  setup: (client: import("../..").NodeClient) => void;
7
10
  }> & (new (options?: import("./common").LocalVariablesIntegrationOptions | undefined, session?: import("./local-variables-sync").DebugSession | undefined) => import("@sentry/types").Integration);
11
+ export type LocalVariables = LocalVariablesSync;
12
+ export declare const localVariablesIntegration: (options?: import("./common").LocalVariablesIntegrationOptions | undefined, session?: import("./local-variables-sync").DebugSession | undefined) => import("@sentry/types").IntegrationFnResult;
8
13
  //# sourceMappingURL=index.d.ts.map
@@ -1,10 +1,14 @@
1
1
  import { Event, Integration, IntegrationClass } from '@sentry/types';
2
2
  import { NodeClient } from '../../client';
3
+ import { LocalVariablesIntegrationOptions } from './common';
4
+ export declare const localVariablesAsyncIntegration: (options?: LocalVariablesIntegrationOptions | undefined) => import("@sentry/types").IntegrationFnResult;
3
5
  /**
4
- * Adds local variables to exception frames
6
+ * Adds local variables to exception frames.
7
+ * @deprecated Use `localVariablesAsyncIntegration()` instead.
5
8
  */
6
9
  export declare const LocalVariablesAsync: IntegrationClass<Integration & {
7
10
  processEvent: (event: Event) => Event;
8
11
  setup: (client: NodeClient) => void;
9
12
  }>;
13
+ export type LocalVariablesAsync = typeof LocalVariablesAsync;
10
14
  //# sourceMappingURL=local-variables-async.d.ts.map
@@ -19,12 +19,15 @@ type CallbackWrapper<T> = {
19
19
  };
20
20
  /** Creates a container for callbacks to be called sequentially */
21
21
  export declare function createCallbackList<T>(complete: Next<T>): CallbackWrapper<T>;
22
+ export declare const localVariablesSyncIntegration: (options?: LocalVariablesIntegrationOptions | undefined, session?: DebugSession | undefined) => import("@sentry/types").IntegrationFnResult;
22
23
  /**
23
- * Adds local variables to exception frames
24
+ * Adds local variables to exception frames.
25
+ * @deprecated Use `localVariablesSyncIntegration()` instead.
24
26
  */
25
27
  export declare const LocalVariablesSync: IntegrationClass<Integration & {
26
28
  processEvent: (event: Event) => Event;
27
29
  setup: (client: NodeClient) => void;
28
30
  }> & (new (options?: LocalVariablesIntegrationOptions, session?: DebugSession) => Integration);
31
+ export type LocalVariablesSync = typeof LocalVariablesSync;
29
32
  export {};
30
33
  //# sourceMappingURL=local-variables-sync.d.ts.map
@@ -1,6 +1,11 @@
1
1
  import { Event, Integration, IntegrationClass } from '@sentry/types';
2
- /** Add node modules / packages to the event */
2
+ export declare const modulesIntegration: () => import("@sentry/types").IntegrationFnResult;
3
+ /**
4
+ * Add node modules / packages to the event.
5
+ * @deprecated Use `modulesIntegration()` instead.
6
+ */
3
7
  export declare const Modules: IntegrationClass<Integration & {
4
8
  processEvent: (event: Event) => Event;
5
9
  }>;
10
+ export type Modules = typeof Modules;
6
11
  //# sourceMappingURL=modules.d.ts.map
@@ -19,13 +19,18 @@ interface OnUncaughtExceptionOptions {
19
19
  */
20
20
  onFatalError?(this: void, firstError: Error, secondError?: Error): void;
21
21
  }
22
- /** Global Exception handler */
22
+ export declare const onUncaughtExceptionIntegration: (options?: Partial<OnUncaughtExceptionOptions> | undefined) => import("@sentry/types").IntegrationFnResult;
23
+ /**
24
+ * Global Exception handler.
25
+ * @deprecated Use `onUncaughtExceptionIntegration()` instead.
26
+ */
23
27
  export declare const OnUncaughtException: IntegrationClass<Integration & {
24
28
  setup: (client: NodeClient) => void;
25
29
  }> & (new (options?: Partial<{
26
30
  exitEvenIfOtherHandlersAreRegistered: boolean;
27
31
  onFatalError?(this: void, firstError: Error, secondError?: Error): void;
28
32
  }> | undefined) => Integration);
33
+ export type OnUncaughtException = typeof OnUncaughtException;
29
34
  type ErrorHandler = {
30
35
  _errorHandler: boolean;
31
36
  } & ((error: Error) => void);
@@ -7,12 +7,17 @@ interface OnUnhandledRejectionOptions {
7
7
  */
8
8
  mode: UnhandledRejectionMode;
9
9
  }
10
- /** Global Promise Rejection handler */
10
+ export declare const onUnhandledRejectionIntegration: (options?: Partial<OnUnhandledRejectionOptions> | undefined) => import("@sentry/types").IntegrationFnResult;
11
+ /**
12
+ * Global Promise Rejection handler.
13
+ * @deprecated Use `onUnhandledRejectionIntegration()` instead.
14
+ */
11
15
  export declare const OnUnhandledRejection: IntegrationClass<Integration & {
12
16
  setup: (client: Client) => void;
13
17
  }> & (new (options?: Partial<{
14
18
  mode: UnhandledRejectionMode;
15
19
  }>) => Integration);
20
+ export type OnUnhandledRejection = typeof OnUnhandledRejection;
16
21
  /**
17
22
  * Send an exception with reason
18
23
  * @param reason string
@@ -1,17 +1,28 @@
1
1
  import * as http from 'http';
2
2
  import { Client, Integration, IntegrationClass } from '@sentry/types';
3
+ type SpotlightConnectionOptions = {
4
+ /**
5
+ * Set this if the Spotlight Sidecar is not running on localhost:8969
6
+ * By default, the Url is set to http://localhost:8969/stream
7
+ */
8
+ sidecarUrl?: string;
9
+ };
10
+ export declare const spotlightIntegration: (options?: Partial<SpotlightConnectionOptions> | undefined) => import("@sentry/types").IntegrationFnResult;
3
11
  /**
4
12
  * Use this integration to send errors and transactions to Spotlight.
5
13
  *
6
14
  * Learn more about spotlight at https://spotlightjs.com
7
15
  *
8
- * Important: This integration only works with Node 18 or newer
16
+ * Important: This integration only works with Node 18 or newer.
17
+ *
18
+ * @deprecated Use `spotlightIntegration()` instead.
9
19
  */
10
20
  export declare const Spotlight: IntegrationClass<Integration & {
11
21
  setup: (client: Client) => void;
12
22
  }> & (new (options?: Partial<{
13
23
  sidecarUrl?: string;
14
24
  }>) => Integration);
25
+ export type Spotlight = typeof Spotlight;
15
26
  type HttpRequestImpl = typeof http.request;
16
27
  /**
17
28
  * We want to get an unpatched http request implementation to avoid capturing our own calls.
@@ -1,4 +1,4 @@
1
- import { EventProcessor, Integration } from '@sentry/types';
1
+ import { EventProcessor, Integration, IntegrationFnResult } from '@sentry/types';
2
2
  export declare enum ChannelName {
3
3
  RequestCreate = "undici:request:create",
4
4
  RequestEnd = "undici:request:headers",
@@ -10,12 +10,18 @@ export interface UndiciOptions {
10
10
  * Defaults to true
11
11
  */
12
12
  breadcrumbs: boolean;
13
+ /**
14
+ * Whether tracing spans should be created for requests
15
+ * If not set, this will be enabled/disabled based on if tracing is enabled.
16
+ */
17
+ tracing?: boolean;
13
18
  /**
14
19
  * Function determining whether or not to create spans to track outgoing requests to the given URL.
15
20
  * By default, spans will be created for all outgoing requests.
16
21
  */
17
22
  shouldCreateSpanForRequest?: (url: string) => boolean;
18
23
  }
24
+ export declare const nativeNodeFetchintegration: (options?: Partial<UndiciOptions> | undefined) => IntegrationFnResult;
19
25
  /**
20
26
  * Instruments outgoing HTTP requests made with the `undici` package via
21
27
  * Node's `diagnostics_channel` API.
@@ -23,6 +29,8 @@ export interface UndiciOptions {
23
29
  * Supports Undici 4.7.0 or higher.
24
30
  *
25
31
  * Requires Node 16.17.0 or higher.
32
+ *
33
+ * @deprecated Use `nativeNodeFetchintegration()` instead.
26
34
  */
27
35
  export declare class Undici implements Integration {
28
36
  /**
@@ -1,19 +1,8 @@
1
1
  import { Integration, Options, StackParser } from '@sentry/types';
2
2
  import { NodeClient } from './client';
3
- import { Http, Undici } from './integrations';
4
3
  import { NodeOptions } from './types';
5
4
  /** @deprecated Use `getDefaultIntegrations(options)` instead. */
6
- export declare const defaultIntegrations: ((Integration & {
7
- setup: (client: import("@sentry/types").Client<import("@sentry/types").ClientOptions<import("@sentry/types").BaseTransportOptions>>) => void;
8
- }) | Http | (Integration & {
9
- processEvent: (event: import("@sentry/types").Event) => Promise<import("@sentry/types").Event>;
10
- }) | Undici | (Integration & {
11
- preprocessEvent: (event: import("@sentry/types").Event, hint: import("@sentry/types").EventHint, client: import("@sentry/types").Client<import("@sentry/types").ClientOptions<import("@sentry/types").BaseTransportOptions>>) => void;
12
- }) | (Integration & {
13
- setupOnce: () => void;
14
- }) | (Integration & {
15
- processEvent: (event: import("@sentry/types").Event, hint: import("@sentry/types").EventHint, client: import("@sentry/types").Client<import("@sentry/types").ClientOptions<import("@sentry/types").BaseTransportOptions>>) => import("@sentry/types").Event;
16
- }))[];
5
+ export declare const defaultIntegrations: import("@sentry/types").IntegrationFnResult[];
17
6
  /** Get the default integrations for the Node SDK. */
18
7
  export declare function getDefaultIntegrations(_options: Options): Integration[];
19
8
  /**