@mushi-mushi/core 1.8.0 → 1.9.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/dist/index.d.cts CHANGED
@@ -263,6 +263,39 @@ interface MushiCaptureConfig {
263
263
  * Nothing else. No DOM beyond the summary, no query values, no PII.
264
264
  */
265
265
  discoverInventory?: boolean | MushiDiscoverInventoryConfig;
266
+ /**
267
+ * W3C trace-context propagation for OTel-style frontend→backend correlation.
268
+ *
269
+ * When enabled, the SDK injects a W3C `traceparent` header and an
270
+ * `x-mushi-session` header into every fetch/XHR request whose URL matches
271
+ * the `corsUrls` allowlist. The generated trace_id is recorded on each
272
+ * captured network entry so a bug report can be correlated with the
273
+ * backend span that handled the failing request.
274
+ *
275
+ * Default: disabled. Enable only for origins you control to avoid CORS issues.
276
+ * The backend (node SDK or Supabase edge function) must include
277
+ * `traceparent` and `x-mushi-session` in `Access-Control-Allow-Headers`.
278
+ *
279
+ * @example
280
+ * capture: {
281
+ * tracePropagation: {
282
+ * enabled: true,
283
+ * corsUrls: [/api\.myapp\.com/, /localhost:3000/],
284
+ * }
285
+ * }
286
+ */
287
+ tracePropagation?: MushiTracePropagationConfig;
288
+ }
289
+ interface MushiTracePropagationConfig {
290
+ /** Enable W3C traceparent injection. Defaults to false. */
291
+ enabled?: boolean;
292
+ /**
293
+ * URL patterns for which the SDK injects `traceparent` + `x-mushi-session`
294
+ * headers. Only requests matching at least one pattern are instrumented.
295
+ * Strings are substring-matched; RegExp values are tested against the full URL.
296
+ * Required when `enabled` is true — an empty allowlist silently disables propagation.
297
+ */
298
+ corsUrls?: Array<string | RegExp>;
266
299
  }
267
300
  /**
268
301
  * Fine-grained controls for `discoverInventory`. Defaults are tuned
@@ -816,6 +849,13 @@ interface MushiNetworkEntry {
816
849
  requestHeaders?: Record<string, string>;
817
850
  responseHeaders?: Record<string, string>;
818
851
  error?: string;
852
+ /**
853
+ * W3C trace ID (32-char lowercase hex) injected by the SDK's trace propagation
854
+ * feature. Present only when `capture.tracePropagation.enabled` is true AND
855
+ * the request URL matched the `corsUrls` allowlist.
856
+ * Used to correlate this network entry with a backend span in the admin console.
857
+ */
858
+ traceId?: string;
819
859
  }
820
860
  interface MushiPerformanceMetrics {
821
861
  fcp?: number;
@@ -1497,4 +1537,4 @@ declare function createLogger(options: LoggerOptions): Logger;
1497
1537
  */
1498
1538
  declare const noopLogger: Logger;
1499
1539
 
1500
- export { type ApiClientOptions, type BreadcrumbBuffer, type BreadcrumbBufferOptions, DEFAULT_API_ENDPOINT, type LogEntry, type LogFormat, type LogLevel, type Logger, type LoggerOptions, MUSHI_INTERNAL_HEADER, MUSHI_INTERNAL_INIT_MARKER, type MushiActivityEvent, type MushiApiCascadeConfig, type MushiApiClient, type MushiApiResponse, type MushiBannerConfig, type MushiBannerLink, type MushiBetaChangelogEntry, type MushiBetaModeConfig, type MushiBreadcrumb, type MushiCaptureConfig, type MushiCaptureEventInput, type MushiCaptureExceptionOptions, type MushiConfig, type MushiConsoleEntry, type MushiCooldownConfig, type MushiDiagnosticsResult, type MushiDiscoverInventoryConfig, type MushiDiscoveryEventPayload, type MushiEnvironment, type MushiEventHandler, type MushiEventType, type MushiIntegrationsConfig, type MushiInternalRequestKind, type MushiNetworkEntry, type MushiOfflineConfig, type MushiOnDeviceClassifier, type MushiOnDeviceClassifierInput, type MushiOnDeviceClassifierResult, type MushiPerformanceMetrics, type MushiPreFilterConfig, type MushiPreset, type MushiPrivacyConfig, type MushiProactiveConfig, type MushiRegion, type MushiReport, type MushiReportBuilder, type MushiReportCategory, type MushiReportStatus, type MushiReporterComment, type MushiReporterReport, type MushiReputationResult, type MushiRewardsConfig, type MushiRuntimeSdkConfig, type MushiSDKInstance, type MushiSdkVersionInfo, type MushiSelectedElement, type MushiSentryConfig, type MushiSentryContext, type MushiTierResult, type MushiTimelineEntry, type MushiTimelineKind, type MushiUrlMatcher, type MushiWidgetAnchor, type MushiWidgetConfig, type NormalisedException, type OfflineQueue, type PiiScrubberConfig, type PreFilterResult, REGION_ENDPOINTS, type RateLimiter, type RateLimiterConfig, captureEnvironment, createApiClient, createBreadcrumbBuffer, createLogger, createOfflineQueue, createPiiScrubber, createPreFilter, createRateLimiter, getDeviceFingerprintHash, getReporterToken, getSessionId, newUuid, noopLogger, normaliseThrown, resolveRegionEndpoint, scrubPii };
1540
+ export { type ApiClientOptions, type BreadcrumbBuffer, type BreadcrumbBufferOptions, DEFAULT_API_ENDPOINT, type LogEntry, type LogFormat, type LogLevel, type Logger, type LoggerOptions, MUSHI_INTERNAL_HEADER, MUSHI_INTERNAL_INIT_MARKER, type MushiActivityEvent, type MushiApiCascadeConfig, type MushiApiClient, type MushiApiResponse, type MushiBannerConfig, type MushiBannerLink, type MushiBetaChangelogEntry, type MushiBetaModeConfig, type MushiBreadcrumb, type MushiCaptureConfig, type MushiCaptureEventInput, type MushiCaptureExceptionOptions, type MushiConfig, type MushiConsoleEntry, type MushiCooldownConfig, type MushiDiagnosticsResult, type MushiDiscoverInventoryConfig, type MushiDiscoveryEventPayload, type MushiEnvironment, type MushiEventHandler, type MushiEventType, type MushiIntegrationsConfig, type MushiInternalRequestKind, type MushiNetworkEntry, type MushiOfflineConfig, type MushiOnDeviceClassifier, type MushiOnDeviceClassifierInput, type MushiOnDeviceClassifierResult, type MushiPerformanceMetrics, type MushiPreFilterConfig, type MushiPreset, type MushiPrivacyConfig, type MushiProactiveConfig, type MushiRegion, type MushiReport, type MushiReportBuilder, type MushiReportCategory, type MushiReportStatus, type MushiReporterComment, type MushiReporterReport, type MushiReputationResult, type MushiRewardsConfig, type MushiRuntimeSdkConfig, type MushiSDKInstance, type MushiSdkVersionInfo, type MushiSelectedElement, type MushiSentryConfig, type MushiSentryContext, type MushiTierResult, type MushiTimelineEntry, type MushiTimelineKind, type MushiTracePropagationConfig, type MushiUrlMatcher, type MushiWidgetAnchor, type MushiWidgetConfig, type NormalisedException, type OfflineQueue, type PiiScrubberConfig, type PreFilterResult, REGION_ENDPOINTS, type RateLimiter, type RateLimiterConfig, captureEnvironment, createApiClient, createBreadcrumbBuffer, createLogger, createOfflineQueue, createPiiScrubber, createPreFilter, createRateLimiter, getDeviceFingerprintHash, getReporterToken, getSessionId, newUuid, noopLogger, normaliseThrown, resolveRegionEndpoint, scrubPii };
package/dist/index.d.ts CHANGED
@@ -263,6 +263,39 @@ interface MushiCaptureConfig {
263
263
  * Nothing else. No DOM beyond the summary, no query values, no PII.
264
264
  */
265
265
  discoverInventory?: boolean | MushiDiscoverInventoryConfig;
266
+ /**
267
+ * W3C trace-context propagation for OTel-style frontend→backend correlation.
268
+ *
269
+ * When enabled, the SDK injects a W3C `traceparent` header and an
270
+ * `x-mushi-session` header into every fetch/XHR request whose URL matches
271
+ * the `corsUrls` allowlist. The generated trace_id is recorded on each
272
+ * captured network entry so a bug report can be correlated with the
273
+ * backend span that handled the failing request.
274
+ *
275
+ * Default: disabled. Enable only for origins you control to avoid CORS issues.
276
+ * The backend (node SDK or Supabase edge function) must include
277
+ * `traceparent` and `x-mushi-session` in `Access-Control-Allow-Headers`.
278
+ *
279
+ * @example
280
+ * capture: {
281
+ * tracePropagation: {
282
+ * enabled: true,
283
+ * corsUrls: [/api\.myapp\.com/, /localhost:3000/],
284
+ * }
285
+ * }
286
+ */
287
+ tracePropagation?: MushiTracePropagationConfig;
288
+ }
289
+ interface MushiTracePropagationConfig {
290
+ /** Enable W3C traceparent injection. Defaults to false. */
291
+ enabled?: boolean;
292
+ /**
293
+ * URL patterns for which the SDK injects `traceparent` + `x-mushi-session`
294
+ * headers. Only requests matching at least one pattern are instrumented.
295
+ * Strings are substring-matched; RegExp values are tested against the full URL.
296
+ * Required when `enabled` is true — an empty allowlist silently disables propagation.
297
+ */
298
+ corsUrls?: Array<string | RegExp>;
266
299
  }
267
300
  /**
268
301
  * Fine-grained controls for `discoverInventory`. Defaults are tuned
@@ -816,6 +849,13 @@ interface MushiNetworkEntry {
816
849
  requestHeaders?: Record<string, string>;
817
850
  responseHeaders?: Record<string, string>;
818
851
  error?: string;
852
+ /**
853
+ * W3C trace ID (32-char lowercase hex) injected by the SDK's trace propagation
854
+ * feature. Present only when `capture.tracePropagation.enabled` is true AND
855
+ * the request URL matched the `corsUrls` allowlist.
856
+ * Used to correlate this network entry with a backend span in the admin console.
857
+ */
858
+ traceId?: string;
819
859
  }
820
860
  interface MushiPerformanceMetrics {
821
861
  fcp?: number;
@@ -1497,4 +1537,4 @@ declare function createLogger(options: LoggerOptions): Logger;
1497
1537
  */
1498
1538
  declare const noopLogger: Logger;
1499
1539
 
1500
- export { type ApiClientOptions, type BreadcrumbBuffer, type BreadcrumbBufferOptions, DEFAULT_API_ENDPOINT, type LogEntry, type LogFormat, type LogLevel, type Logger, type LoggerOptions, MUSHI_INTERNAL_HEADER, MUSHI_INTERNAL_INIT_MARKER, type MushiActivityEvent, type MushiApiCascadeConfig, type MushiApiClient, type MushiApiResponse, type MushiBannerConfig, type MushiBannerLink, type MushiBetaChangelogEntry, type MushiBetaModeConfig, type MushiBreadcrumb, type MushiCaptureConfig, type MushiCaptureEventInput, type MushiCaptureExceptionOptions, type MushiConfig, type MushiConsoleEntry, type MushiCooldownConfig, type MushiDiagnosticsResult, type MushiDiscoverInventoryConfig, type MushiDiscoveryEventPayload, type MushiEnvironment, type MushiEventHandler, type MushiEventType, type MushiIntegrationsConfig, type MushiInternalRequestKind, type MushiNetworkEntry, type MushiOfflineConfig, type MushiOnDeviceClassifier, type MushiOnDeviceClassifierInput, type MushiOnDeviceClassifierResult, type MushiPerformanceMetrics, type MushiPreFilterConfig, type MushiPreset, type MushiPrivacyConfig, type MushiProactiveConfig, type MushiRegion, type MushiReport, type MushiReportBuilder, type MushiReportCategory, type MushiReportStatus, type MushiReporterComment, type MushiReporterReport, type MushiReputationResult, type MushiRewardsConfig, type MushiRuntimeSdkConfig, type MushiSDKInstance, type MushiSdkVersionInfo, type MushiSelectedElement, type MushiSentryConfig, type MushiSentryContext, type MushiTierResult, type MushiTimelineEntry, type MushiTimelineKind, type MushiUrlMatcher, type MushiWidgetAnchor, type MushiWidgetConfig, type NormalisedException, type OfflineQueue, type PiiScrubberConfig, type PreFilterResult, REGION_ENDPOINTS, type RateLimiter, type RateLimiterConfig, captureEnvironment, createApiClient, createBreadcrumbBuffer, createLogger, createOfflineQueue, createPiiScrubber, createPreFilter, createRateLimiter, getDeviceFingerprintHash, getReporterToken, getSessionId, newUuid, noopLogger, normaliseThrown, resolveRegionEndpoint, scrubPii };
1540
+ export { type ApiClientOptions, type BreadcrumbBuffer, type BreadcrumbBufferOptions, DEFAULT_API_ENDPOINT, type LogEntry, type LogFormat, type LogLevel, type Logger, type LoggerOptions, MUSHI_INTERNAL_HEADER, MUSHI_INTERNAL_INIT_MARKER, type MushiActivityEvent, type MushiApiCascadeConfig, type MushiApiClient, type MushiApiResponse, type MushiBannerConfig, type MushiBannerLink, type MushiBetaChangelogEntry, type MushiBetaModeConfig, type MushiBreadcrumb, type MushiCaptureConfig, type MushiCaptureEventInput, type MushiCaptureExceptionOptions, type MushiConfig, type MushiConsoleEntry, type MushiCooldownConfig, type MushiDiagnosticsResult, type MushiDiscoverInventoryConfig, type MushiDiscoveryEventPayload, type MushiEnvironment, type MushiEventHandler, type MushiEventType, type MushiIntegrationsConfig, type MushiInternalRequestKind, type MushiNetworkEntry, type MushiOfflineConfig, type MushiOnDeviceClassifier, type MushiOnDeviceClassifierInput, type MushiOnDeviceClassifierResult, type MushiPerformanceMetrics, type MushiPreFilterConfig, type MushiPreset, type MushiPrivacyConfig, type MushiProactiveConfig, type MushiRegion, type MushiReport, type MushiReportBuilder, type MushiReportCategory, type MushiReportStatus, type MushiReporterComment, type MushiReporterReport, type MushiReputationResult, type MushiRewardsConfig, type MushiRuntimeSdkConfig, type MushiSDKInstance, type MushiSdkVersionInfo, type MushiSelectedElement, type MushiSentryConfig, type MushiSentryContext, type MushiTierResult, type MushiTimelineEntry, type MushiTimelineKind, type MushiTracePropagationConfig, type MushiUrlMatcher, type MushiWidgetAnchor, type MushiWidgetConfig, type NormalisedException, type OfflineQueue, type PiiScrubberConfig, type PreFilterResult, REGION_ENDPOINTS, type RateLimiter, type RateLimiterConfig, captureEnvironment, createApiClient, createBreadcrumbBuffer, createLogger, createOfflineQueue, createPiiScrubber, createPreFilter, createRateLimiter, getDeviceFingerprintHash, getReporterToken, getSessionId, newUuid, noopLogger, normaliseThrown, resolveRegionEndpoint, scrubPii };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mushi-mushi/core",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Core types, API client, and pre-filter for Mushi Mushi SDK",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -76,8 +76,8 @@
76
76
  "tsup": "^8.5.1",
77
77
  "typescript": "^6.0.3",
78
78
  "vitest": "^4.1.5",
79
- "@mushi-mushi/tsconfig": "0.0.0",
80
- "@mushi-mushi/eslint-config": "0.0.0"
79
+ "@mushi-mushi/eslint-config": "0.0.0",
80
+ "@mushi-mushi/tsconfig": "0.0.0"
81
81
  },
82
82
  "author": "Kenji Sakuramoto",
83
83
  "engines": {