@sentry/types 8.0.0-alpha.1 → 8.0.0-alpha.3

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 (47) hide show
  1. package/esm/package.json +1 -0
  2. package/package.json +15 -2
  3. package/types/attachment.d.ts +2 -1
  4. package/types/attachment.d.ts.map +1 -1
  5. package/types/client.d.ts +29 -34
  6. package/types/client.d.ts.map +1 -1
  7. package/types/envelope.d.ts +3 -3
  8. package/types/envelope.d.ts.map +1 -1
  9. package/types/event.d.ts +2 -12
  10. package/types/event.d.ts.map +1 -1
  11. package/types/feedback.d.ts +12 -1
  12. package/types/feedback.d.ts.map +1 -1
  13. package/types/hub.d.ts +0 -21
  14. package/types/hub.d.ts.map +1 -1
  15. package/types/index.d.ts +4 -3
  16. package/types/index.d.ts.map +1 -1
  17. package/types/scope.d.ts +14 -3
  18. package/types/scope.d.ts.map +1 -1
  19. package/types/span.d.ts +43 -20
  20. package/types/span.d.ts.map +1 -1
  21. package/types/spanStatus.d.ts +59 -0
  22. package/types/spanStatus.d.ts.map +1 -0
  23. package/types/stacktrace.d.ts +1 -1
  24. package/types/stacktrace.d.ts.map +1 -1
  25. package/types/startSpanOptions.d.ts +2 -66
  26. package/types/startSpanOptions.d.ts.map +1 -1
  27. package/types/transaction.d.ts +1 -8
  28. package/types/transaction.d.ts.map +1 -1
  29. package/types/transport.d.ts +1 -1
  30. package/types/transport.d.ts.map +1 -1
  31. package/types/user.d.ts +0 -6
  32. package/types/user.d.ts.map +1 -1
  33. package/types-ts3.8/attachment.d.ts +2 -1
  34. package/types-ts3.8/client.d.ts +29 -34
  35. package/types-ts3.8/envelope.d.ts +3 -3
  36. package/types-ts3.8/event.d.ts +2 -12
  37. package/types-ts3.8/feedback.d.ts +12 -1
  38. package/types-ts3.8/hub.d.ts +0 -21
  39. package/types-ts3.8/index.d.ts +4 -3
  40. package/types-ts3.8/scope.d.ts +14 -3
  41. package/types-ts3.8/span.d.ts +43 -20
  42. package/types-ts3.8/spanStatus.d.ts +59 -0
  43. package/types-ts3.8/stacktrace.d.ts +1 -1
  44. package/types-ts3.8/startSpanOptions.d.ts +2 -66
  45. package/types-ts3.8/transaction.d.ts +1 -8
  46. package/types-ts3.8/transport.d.ts +1 -1
  47. package/types-ts3.8/user.d.ts +0 -6
@@ -8,7 +8,7 @@ export { DsnComponents, DsnLike, DsnProtocol } from './dsn';
8
8
  export { DebugImage, DebugMeta } from './debugMeta';
9
9
  export { AttachmentItem, BaseEnvelopeHeaders, BaseEnvelopeItemHeaders, ClientReportEnvelope, ClientReportItem, DynamicSamplingContext, Envelope, EnvelopeItemType, EnvelopeItem, EventEnvelope, EventEnvelopeHeaders, EventItem, ReplayEnvelope, FeedbackItem, SessionEnvelope, SessionItem, UserFeedbackItem, CheckInItem, CheckInEnvelope, StatsdItem, StatsdEnvelope, ProfileItem, } from './envelope';
10
10
  export { ExtendedError } from './error';
11
- export { Event, EventHint, EventType, ErrorEvent, TransactionEvent, SerializedEvent } from './event';
11
+ export { Event, EventHint, EventType, ErrorEvent, TransactionEvent } from './event';
12
12
  export { EventProcessor } from './eventprocessor';
13
13
  export { Exception } from './exception';
14
14
  export { Extra, Extras } from './extra';
@@ -21,7 +21,7 @@ export { Package } from './package';
21
21
  export { PolymorphicEvent, PolymorphicRequest } from './polymorphics';
22
22
  export { ThreadId, FrameId, StackId, ThreadCpuSample, ThreadCpuStack, ThreadCpuFrame, ThreadCpuProfile, Profile, } from './profiling';
23
23
  export { ReplayEvent, ReplayRecordingData, ReplayRecordingMode } from './replay';
24
- export { FeedbackEvent } from './feedback';
24
+ export { FeedbackEvent, UserFeedback } from './feedback';
25
25
  export { QueryParams, Request, SanitizedRequestData } from './request';
26
26
  export { Runtime } from './runtime';
27
27
  export { CaptureContext, Scope, ScopeContext, ScopeData } from './scope';
@@ -30,6 +30,7 @@ export { SdkMetadata } from './sdkmetadata';
30
30
  export { SessionAggregates, AggregationCounts, Session, SessionContext, SessionStatus, RequestSession, RequestSessionStatus, SessionFlusherLike, SerializedSession, } from './session';
31
31
  export { SeverityLevel } from './severity';
32
32
  export { Span, SpanContext, SpanOrigin, SpanAttributeValue, SpanAttributes, SpanTimeInput, SpanJSON, SpanContextData, TraceFlag, MetricSummary, } from './span';
33
+ export { SpanStatus } from './spanStatus';
33
34
  export { StackFrame } from './stackframe';
34
35
  export { Stacktrace, StackParser, StackLineParser, StackLineParserFn } from './stacktrace';
35
36
  export { PropagationContext, TracePropagationTargets } from './tracing';
@@ -38,7 +39,7 @@ export { CustomSamplingContext, SamplingContext, TraceparentData, Transaction, T
38
39
  export { DurationUnit, InformationUnit, FractionUnit, MeasurementUnit, NoneUnit, Measurements, } from './measurement';
39
40
  export { Thread } from './thread';
40
41
  export { Transport, TransportRequest, TransportMakeRequestResponse, InternalBaseTransportOptions, BaseTransportOptions, TransportRequestExecutor, } from './transport';
41
- export { User, UserFeedback } from './user';
42
+ export { User } from './user';
42
43
  export { WebFetchHeaders, WebFetchRequest } from './webfetchapi';
43
44
  export { WrappedFunction } from './wrappedfunction';
44
45
  export { HandlerDataFetch, HandlerDataXhr, HandlerDataDom, HandlerDataConsole, HandlerDataHistory, HandlerDataError, HandlerDataUnhandledRejection, ConsoleLevel, SentryXhrData, SentryWrappedXMLHttpRequest, } from './instrument';
@@ -43,7 +43,6 @@ export interface ScopeData {
43
43
  };
44
44
  fingerprint: string[];
45
45
  level?: SeverityLevel;
46
- /** @deprecated This will be removed in v8. */
47
46
  transactionName?: string;
48
47
  span?: Span;
49
48
  }
@@ -61,6 +60,11 @@ export interface Scope {
61
60
  * It is generally recommended to use the global function `Sentry.getClient()` instead, unless you know what you are doing.
62
61
  */
63
62
  getClient<C extends Client>(): C | undefined;
63
+ /**
64
+ * Add internal on change listener. Used for sub SDKs that need to store the scope.
65
+ * @hidden
66
+ */
67
+ addScopeListener(callback: (scope: Scope) => void): void;
64
68
  /** Add new event processor that will be called during event processing. */
65
69
  addEventProcessor(callback: EventProcessor): this;
66
70
  /** Get the data of this scope, which is applied to an event during processing. */
@@ -113,8 +117,15 @@ export interface Scope {
113
117
  */
114
118
  setLevel(level: SeverityLevel): this;
115
119
  /**
116
- * Sets the transaction name on the scope for future events.
117
- * @deprecated Use extra or tags instead.
120
+ * Sets the transaction name on the scope so that the name of the transaction
121
+ * (e.g. taken server route or page location) is attached to future events.
122
+ *
123
+ * IMPORTANT: Calling this function does NOT change the name of the currently active
124
+ * span. If you want to change the name of the active span, use `span.updateName()`
125
+ * instead.
126
+ *
127
+ * By default, the SDK updates the scope's transaction name automatically on sensible
128
+ * occasions, such as a page navigation or when handling a new request on the server.
118
129
  */
119
130
  setTransactionName(name?: string): this;
120
131
  /**
@@ -1,5 +1,6 @@
1
1
  import { Primitive } from './misc';
2
2
  import { HrTime } from './opentelemetry';
3
+ import { SpanStatus } from './spanStatus';
3
4
  import { TransactionSource } from './transaction';
4
5
  type SpanOriginType = 'manual' | 'auto';
5
6
  type SpanOriginCategory = string;
@@ -33,9 +34,6 @@ export interface SpanJSON {
33
34
  span_id: string;
34
35
  start_timestamp: number;
35
36
  status?: string;
36
- tags?: {
37
- [key: string]: Primitive;
38
- };
39
37
  timestamp?: number;
40
38
  trace_id: string;
41
39
  origin?: SpanOrigin;
@@ -44,6 +42,43 @@ export interface SpanJSON {
44
42
  type TraceFlagNone = 0;
45
43
  type TraceFlagSampled = 1;
46
44
  export type TraceFlag = TraceFlagNone | TraceFlagSampled;
45
+ export interface TraceState {
46
+ /**
47
+ * Create a new TraceState which inherits from this TraceState and has the
48
+ * given key set.
49
+ * The new entry will always be added in the front of the list of states.
50
+ *
51
+ * @param key key of the TraceState entry.
52
+ * @param value value of the TraceState entry.
53
+ */
54
+ set(key: string, value: string): TraceState;
55
+ /**
56
+ * Return a new TraceState which inherits from this TraceState but does not
57
+ * contain the given key.
58
+ *
59
+ * @param key the key for the TraceState entry to be removed.
60
+ */
61
+ unset(key: string): TraceState;
62
+ /**
63
+ * Returns the value to which the specified key is mapped, or `undefined` if
64
+ * this map contains no mapping for the key.
65
+ *
66
+ * @param key with which the specified value is to be associated.
67
+ * @returns the value to which the specified key is mapped, or `undefined` if
68
+ * this map contains no mapping for the key.
69
+ */
70
+ get(key: string): string | undefined;
71
+ /**
72
+ * Serializes the TraceState to a `list` as defined below. The `list` is a
73
+ * series of `list-members` separated by commas `,`, and a list-member is a
74
+ * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs
75
+ * surrounding `list-members` are ignored. There can be a maximum of 32
76
+ * `list-members` in a `list`.
77
+ *
78
+ * @returns the serialized string.
79
+ */
80
+ serialize(): string;
81
+ }
47
82
  export interface SpanContextData {
48
83
  /**
49
84
  * The ID of the trace that this span belongs to. It is worldwide unique
@@ -61,7 +96,7 @@ export interface SpanContextData {
61
96
  /**
62
97
  * Only true if the SpanContext was propagated from a remote parent.
63
98
  */
64
- isRemote?: boolean;
99
+ isRemote?: boolean | undefined;
65
100
  /**
66
101
  * Trace flags to propagate.
67
102
  *
@@ -69,9 +104,10 @@ export interface SpanContextData {
69
104
  * sampled or not. When set, the least significant bit documents that the
70
105
  * caller may have recorded trace data. A caller who does not record trace
71
106
  * data out-of-band leaves this flag unset.
72
- * We allow number here because otel also does, so we can't be stricter than them.
73
107
  */
74
108
  traceFlags: TraceFlag | number;
109
+ /** In OpenTelemetry, this can be used to store trace state, which are basically key-value pairs. */
110
+ traceState?: TraceState | undefined;
75
111
  }
76
112
  /**
77
113
  * Interface holding all properties that can be set on a Span on creation.
@@ -102,13 +138,6 @@ export interface SpanContext {
102
138
  * Trace ID
103
139
  */
104
140
  traceId?: string | undefined;
105
- /**
106
- * Tags of the Span.
107
- * @deprecated Pass `attributes` instead.
108
- */
109
- tags?: {
110
- [key: string]: Primitive;
111
- };
112
141
  /**
113
142
  * Data of the Span.
114
143
  * @deprecated Pass `attributes` instead.
@@ -128,10 +157,6 @@ export interface SpanContext {
128
157
  * Timestamp in seconds (epoch time) indicating when the span ended.
129
158
  */
130
159
  endTimestamp?: number | undefined;
131
- /**
132
- * The origin of the span, giving context about what created the span.
133
- */
134
- origin?: SpanOrigin | undefined;
135
160
  }
136
161
  /**
137
162
  * A generic Span which holds trace data.
@@ -157,11 +182,9 @@ export interface Span {
157
182
  */
158
183
  setAttributes(attributes: SpanAttributes): void;
159
184
  /**
160
- * Sets the status attribute on the current span
161
- * See: {@sentry/core SpanStatusType} for possible values
162
- * @param status http code used to set the status
185
+ * Sets the status attribute on the current span.
163
186
  */
164
- setStatus(status: string): this;
187
+ setStatus(status: SpanStatus): this;
165
188
  /**
166
189
  * Update the name of the span.
167
190
  */
@@ -0,0 +1,59 @@
1
+ type SpanStatusType =
2
+ /** The operation completed successfully. */
3
+ 'ok'
4
+ /** Deadline expired before operation could complete. */
5
+ | 'deadline_exceeded'
6
+ /** 401 Unauthorized (actually does mean unauthenticated according to RFC 7235) */
7
+ | 'unauthenticated'
8
+ /** 403 Forbidden */
9
+ | 'permission_denied'
10
+ /** 404 Not Found. Some requested entity (file or directory) was not found. */
11
+ | 'not_found'
12
+ /** 429 Too Many Requests */
13
+ | 'resource_exhausted'
14
+ /** Client specified an invalid argument. 4xx. */
15
+ | 'invalid_argument'
16
+ /** 501 Not Implemented */
17
+ | 'unimplemented'
18
+ /** 503 Service Unavailable */
19
+ | 'unavailable'
20
+ /** Other/generic 5xx. */
21
+ | 'internal_error'
22
+ /** Unknown. Any non-standard HTTP status code. */
23
+ | 'unknown_error'
24
+ /** The operation was cancelled (typically by the user). */
25
+ | 'cancelled'
26
+ /** Already exists (409) */
27
+ | 'already_exists'
28
+ /** Operation was rejected because the system is not in a state required for the operation's */
29
+ | 'failed_precondition'
30
+ /** The operation was aborted, typically due to a concurrency issue. */
31
+ | 'aborted'
32
+ /** Operation was attempted past the valid range. */
33
+ | 'out_of_range'
34
+ /** Unrecoverable data loss or corruption */
35
+ | 'data_loss';
36
+ declare const SPAN_STATUS_UNSET = 0;
37
+ declare const SPAN_STATUS_OK = 1;
38
+ declare const SPAN_STATUS_ERROR = 2;
39
+ /** The status code of a span. */
40
+ export type SpanStatusCode = typeof SPAN_STATUS_UNSET | typeof SPAN_STATUS_OK | typeof SPAN_STATUS_ERROR;
41
+ /**
42
+ * The status of a span.
43
+ * This can optionally contain a human-readable message.
44
+ */
45
+ export interface SpanStatus {
46
+ /**
47
+ * The status code of this message.
48
+ * 0 = UNSET
49
+ * 1 = OK
50
+ * 2 = ERROR
51
+ */
52
+ code: SpanStatusCode;
53
+ /**
54
+ * A developer-facing error message.
55
+ */
56
+ message?: SpanStatusType | string;
57
+ }
58
+ export {};
59
+ //# sourceMappingURL=spanStatus.d.ts.map
@@ -7,7 +7,7 @@ export interface Stacktrace {
7
7
  number
8
8
  ];
9
9
  }
10
- export type StackParser = (stack: string, skipFirst?: number) => StackFrame[];
10
+ export type StackParser = (stack: string, skipFirstLines?: number, framesToPop?: number) => StackFrame[];
11
11
  export type StackLineParserFn = (line: string) => StackFrame | undefined;
12
12
  export type StackLineParser = [
13
13
  number,
@@ -1,8 +1,6 @@
1
- import { Primitive } from './misc';
2
1
  import { Scope } from './scope';
3
- import { SpanAttributes, SpanOrigin, SpanTimeInput } from './span';
4
- import { TransactionContext, TransactionMetadata, TransactionSource } from './transaction';
5
- export interface StartSpanOptions extends TransactionContext {
2
+ import { SpanAttributes, SpanTimeInput } from './span';
3
+ export interface StartSpanOptions {
6
4
  /** A manually specified start time for the created `Span` object. */
7
5
  startTime?: SpanTimeInput;
8
6
  /** If defined, start this span off this scope instead off the current scope. */
@@ -19,69 +17,7 @@ export interface StartSpanOptions extends TransactionContext {
19
17
  * It is not guaranteed that a span started with this flag set to `true` will be sent as a transaction.
20
18
  */
21
19
  forceTransaction?: boolean;
22
- /**
23
- * The origin of the span - if it comes from auto instrumentation or manual instrumentation.
24
- *
25
- * @deprecated Set `attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]` instead.
26
- */
27
- origin?: SpanOrigin;
28
20
  /** Attributes for the span. */
29
21
  attributes?: SpanAttributes;
30
- /**
31
- * @deprecated Manually set the end timestamp instead.
32
- */
33
- trimEnd?: boolean;
34
- /**
35
- * @deprecated This cannot be set manually anymore.
36
- */
37
- parentSampled?: boolean;
38
- /**
39
- * @deprecated Use attributes or set data on scopes instead.
40
- */
41
- metadata?: Partial<TransactionMetadata>;
42
- /**
43
- * @deprecated Use `span.setStatus()` instead.
44
- */
45
- status?: string;
46
- /**
47
- * @deprecated Use `scope` instead.
48
- */
49
- parentSpanId?: string;
50
- /**
51
- * @deprecated You cannot manually set the span to sampled anymore.
52
- */
53
- sampled?: boolean;
54
- /**
55
- * @deprecated You cannot manually set the spanId anymore.
56
- */
57
- spanId?: string;
58
- /**
59
- * @deprecated You cannot manually set the traceId anymore.
60
- */
61
- traceId?: string;
62
- /**
63
- * @deprecated Use an attribute instead.
64
- */
65
- source?: TransactionSource;
66
- /**
67
- * @deprecated Use attributes or set tags on the scope instead.
68
- */
69
- tags?: {
70
- [key: string]: Primitive;
71
- };
72
- /**
73
- * @deprecated Use attributes instead.
74
- */
75
- data?: {
76
- [key: string]: any;
77
- };
78
- /**
79
- * @deprecated Use `startTime` instead.
80
- */
81
- startTimestamp?: number;
82
- /**
83
- * @deprecated Use `span.end()` instead.
84
- */
85
- endTimestamp?: number;
86
22
  }
87
23
  //# sourceMappingURL=startSpanOptions.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { Context } from './context';
2
2
  import { DynamicSamplingContext } from './envelope';
3
3
  import { MeasurementUnit } from './measurement';
4
- import { ExtractedNodeRequestData, Primitive, WorkerLocation } from './misc';
4
+ import { ExtractedNodeRequestData, WorkerLocation } from './misc';
5
5
  import { PolymorphicRequest } from './polymorphics';
6
6
  import { Span, SpanAttributes, SpanContext } from './span';
7
7
  /**
@@ -69,13 +69,6 @@ export interface Transaction extends Pick<TransactionContext, Exclude<keyof Tran
69
69
  * @inheritDoc
70
70
  */
71
71
  startTimestamp: number;
72
- /**
73
- * Tags for the transaction.
74
- * @deprecated Use `getSpanAttributes(transaction)` instead.
75
- */
76
- tags: {
77
- [key: string]: Primitive;
78
- };
79
72
  /**
80
73
  * Data for the transaction.
81
74
  * @deprecated Use `getSpanAttributes(transaction)` instead.
@@ -19,7 +19,7 @@ export interface BaseTransportOptions extends InternalBaseTransportOptions {
19
19
  url: string;
20
20
  }
21
21
  export interface Transport {
22
- send(request: Envelope): PromiseLike<void | TransportMakeRequestResponse>;
22
+ send(request: Envelope): PromiseLike<TransportMakeRequestResponse>;
23
23
  flush(timeout?: number): PromiseLike<boolean>;
24
24
  }
25
25
  export type TransportRequestExecutor = (request: TransportRequest) => PromiseLike<TransportMakeRequestResponse>;
@@ -8,10 +8,4 @@ export interface User {
8
8
  email?: string;
9
9
  username?: string;
10
10
  }
11
- export interface UserFeedback {
12
- event_id: string;
13
- email: User['email'];
14
- name: string;
15
- comments: string;
16
- }
17
11
  //# sourceMappingURL=user.d.ts.map