@wix/monitoring-types 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.mts CHANGED
@@ -62,10 +62,17 @@ interface Span {
62
62
  spanContext(): SpanContextData;
63
63
  end(): void;
64
64
  }
65
+ interface ManualSpan {
66
+ end(): void;
67
+ fail(error: unknown): void;
68
+ }
65
69
  interface SpanOptions {
66
70
  name: string;
67
71
  tags?: Tags;
68
72
  }
73
+ interface EndSpanOptions {
74
+ name: string;
75
+ }
69
76
  interface Breadcrumb {
70
77
  type?: string;
71
78
  category?: string;
@@ -83,14 +90,12 @@ interface MonitoringClient {
83
90
  * Captures an exception event and sends it to Sentry.
84
91
  * @param error The error to capture
85
92
  * @param captureContext Optional additional data to attach to the Sentry e vent.
86
- * @returns the id of the captured Sentry event.
87
93
  */
88
94
  captureException(error: unknown, captureContext?: CaptureContext): void;
89
95
  /**
90
96
  * Captures a message event and sends it to Sentry.
91
97
  * @param message The message to capture
92
98
  * @param captureContext Define the level of the message or pass in additional data to attach to the message.
93
- * @returns the id of the captured message.
94
99
  */
95
100
  captureMessage(message: string, captureContext?: CaptureContext): void;
96
101
  /**
@@ -99,7 +104,19 @@ interface MonitoringClient {
99
104
  * @param callback The function to wrap with a span
100
105
  * @returns The return value of the callback
101
106
  */
102
- startSpan<T>(spanOptions: SpanOptions, callback: (span: Span | undefined) => T): Promise<T>;
107
+ startSpan<T>(spanOptions: SpanOptions, callback: (span: Span | undefined) => T): T;
108
+ /**
109
+ * Starts a manual span. The span needs to be finished manually by either calling end() or fail() using the returned span object or by calling endSpanManual().
110
+ * @param spanOptions The options for the span
111
+ * @returns A span object that allows to end the span successfully or fail it.
112
+ */
113
+ startSpanManual(spanOptions: SpanOptions): ManualSpan;
114
+ /**
115
+ * Ends a manual span and sends it to Sentry. Spans can be ended using a MonitoringClient instance which wasn't necessarily used to start the span.
116
+ * Calling this method will end the last span with the same name that was started using startSpanManual() and will ignore the others.
117
+ * @param spanOptions The options for the span
118
+ */
119
+ endSpanManual(spanOptions: EndSpanOptions): void;
103
120
  /**
104
121
  * Records a new breadcrumb which will be attached to future events.
105
122
  * Breadcrumbs will be added to subsequent events to provide more context on user's actions prior to an error or crash.
@@ -157,6 +174,15 @@ interface AppMonitoringSentryConfig {
157
174
  dsn: string;
158
175
  };
159
176
  }
177
+ /**
178
+ * Represents the Panorama configuration for app's monitoring.
179
+ */
180
+ interface AppMonitoringPanoramaConfig {
181
+ /**
182
+ * The type of monitoring provider.
183
+ */
184
+ type: 'PANORAMA';
185
+ }
160
186
  interface AppMonitoringUnknownConfig {
161
187
  type: 'UNKNOWN_PROVIDER';
162
188
  }
@@ -165,6 +191,6 @@ interface AppMonitoringUnknownConfig {
165
191
  * The configuration includes the type of monitoring provider and its options.
166
192
  * Currently, only Sentry is supported as a monitoring provider.
167
193
  */
168
- type AppMonitoringConfig = AppMonitoringSentryConfig | AppMonitoringUnknownConfig;
194
+ type AppMonitoringConfig = AppMonitoringSentryConfig | AppMonitoringPanoramaConfig | AppMonitoringUnknownConfig;
169
195
 
170
- export type { AppMonitoringConfig, AppMonitoringSentryConfig, AppMonitoringUnknownConfig, Breadcrumb, CaptureContext, Context, Contexts, EventContexts, EventData, EventTags, HostMonitoringContext, MonitoringClient, Primitive, Span, SpanContextData, SpanOptions, Tags };
196
+ export type { AppMonitoringConfig, AppMonitoringPanoramaConfig, AppMonitoringSentryConfig, AppMonitoringUnknownConfig, Breadcrumb, CaptureContext, Context, Contexts, EndSpanOptions, EventContexts, EventData, EventTags, HostMonitoringContext, ManualSpan, MonitoringClient, Primitive, Span, SpanContextData, SpanOptions, Tags };
package/build/index.d.ts CHANGED
@@ -62,10 +62,17 @@ interface Span {
62
62
  spanContext(): SpanContextData;
63
63
  end(): void;
64
64
  }
65
+ interface ManualSpan {
66
+ end(): void;
67
+ fail(error: unknown): void;
68
+ }
65
69
  interface SpanOptions {
66
70
  name: string;
67
71
  tags?: Tags;
68
72
  }
73
+ interface EndSpanOptions {
74
+ name: string;
75
+ }
69
76
  interface Breadcrumb {
70
77
  type?: string;
71
78
  category?: string;
@@ -83,14 +90,12 @@ interface MonitoringClient {
83
90
  * Captures an exception event and sends it to Sentry.
84
91
  * @param error The error to capture
85
92
  * @param captureContext Optional additional data to attach to the Sentry e vent.
86
- * @returns the id of the captured Sentry event.
87
93
  */
88
94
  captureException(error: unknown, captureContext?: CaptureContext): void;
89
95
  /**
90
96
  * Captures a message event and sends it to Sentry.
91
97
  * @param message The message to capture
92
98
  * @param captureContext Define the level of the message or pass in additional data to attach to the message.
93
- * @returns the id of the captured message.
94
99
  */
95
100
  captureMessage(message: string, captureContext?: CaptureContext): void;
96
101
  /**
@@ -99,7 +104,19 @@ interface MonitoringClient {
99
104
  * @param callback The function to wrap with a span
100
105
  * @returns The return value of the callback
101
106
  */
102
- startSpan<T>(spanOptions: SpanOptions, callback: (span: Span | undefined) => T): Promise<T>;
107
+ startSpan<T>(spanOptions: SpanOptions, callback: (span: Span | undefined) => T): T;
108
+ /**
109
+ * Starts a manual span. The span needs to be finished manually by either calling end() or fail() using the returned span object or by calling endSpanManual().
110
+ * @param spanOptions The options for the span
111
+ * @returns A span object that allows to end the span successfully or fail it.
112
+ */
113
+ startSpanManual(spanOptions: SpanOptions): ManualSpan;
114
+ /**
115
+ * Ends a manual span and sends it to Sentry. Spans can be ended using a MonitoringClient instance which wasn't necessarily used to start the span.
116
+ * Calling this method will end the last span with the same name that was started using startSpanManual() and will ignore the others.
117
+ * @param spanOptions The options for the span
118
+ */
119
+ endSpanManual(spanOptions: EndSpanOptions): void;
103
120
  /**
104
121
  * Records a new breadcrumb which will be attached to future events.
105
122
  * Breadcrumbs will be added to subsequent events to provide more context on user's actions prior to an error or crash.
@@ -157,6 +174,15 @@ interface AppMonitoringSentryConfig {
157
174
  dsn: string;
158
175
  };
159
176
  }
177
+ /**
178
+ * Represents the Panorama configuration for app's monitoring.
179
+ */
180
+ interface AppMonitoringPanoramaConfig {
181
+ /**
182
+ * The type of monitoring provider.
183
+ */
184
+ type: 'PANORAMA';
185
+ }
160
186
  interface AppMonitoringUnknownConfig {
161
187
  type: 'UNKNOWN_PROVIDER';
162
188
  }
@@ -165,6 +191,6 @@ interface AppMonitoringUnknownConfig {
165
191
  * The configuration includes the type of monitoring provider and its options.
166
192
  * Currently, only Sentry is supported as a monitoring provider.
167
193
  */
168
- type AppMonitoringConfig = AppMonitoringSentryConfig | AppMonitoringUnknownConfig;
194
+ type AppMonitoringConfig = AppMonitoringSentryConfig | AppMonitoringPanoramaConfig | AppMonitoringUnknownConfig;
169
195
 
170
- export type { AppMonitoringConfig, AppMonitoringSentryConfig, AppMonitoringUnknownConfig, Breadcrumb, CaptureContext, Context, Contexts, EventContexts, EventData, EventTags, HostMonitoringContext, MonitoringClient, Primitive, Span, SpanContextData, SpanOptions, Tags };
196
+ export type { AppMonitoringConfig, AppMonitoringPanoramaConfig, AppMonitoringSentryConfig, AppMonitoringUnknownConfig, Breadcrumb, CaptureContext, Context, Contexts, EndSpanOptions, EventContexts, EventData, EventTags, HostMonitoringContext, ManualSpan, MonitoringClient, Primitive, Span, SpanContextData, SpanOptions, Tags };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/monitoring-types",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "license": "UNLICENSED",
5
5
  "author": {
6
6
  "name": "Gili Shohat",
@@ -29,12 +29,12 @@
29
29
  "*.{js,ts}": "yarn lint"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/node": "^20.17.19",
32
+ "@types/node": "^20.17.30",
33
33
  "eslint": "^8.57.1",
34
34
  "eslint-config-sdk": "0.0.0",
35
- "tsup": "^8.3.6",
36
- "type-fest": "^4.35.0",
37
- "typescript": "^5.7.3"
35
+ "tsup": "^8.4.0",
36
+ "type-fest": "^4.39.1",
37
+ "typescript": "^5.8.3"
38
38
  },
39
39
  "eslintConfig": {
40
40
  "extends": "sdk"
@@ -53,5 +53,5 @@
53
53
  ]
54
54
  }
55
55
  },
56
- "falconPackageHash": "20a6784fe7596565cccd81bf2cfe6c1a3a27963131b6b00c7218c19b"
56
+ "falconPackageHash": "bd7ab85ab0ea7b3081acd419ee43dfd3742c18e6bdc1f9bf7e4326bc"
57
57
  }