@debugbundle/shared-types 2.0.0 → 2.1.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 (42) hide show
  1. package/README.md +1 -0
  2. package/dist/alert-notification-policy.d.ts +71 -0
  3. package/dist/alert-notification-policy.d.ts.map +1 -0
  4. package/dist/alert-notification-policy.js +54 -0
  5. package/dist/alert-notification-policy.js.map +1 -0
  6. package/dist/analytics-product.d.ts +16 -16
  7. package/dist/analytics.d.ts +46 -46
  8. package/dist/browser-recovery.d.ts +13 -0
  9. package/dist/browser-recovery.d.ts.map +1 -0
  10. package/dist/browser-recovery.js +42 -0
  11. package/dist/browser-recovery.js.map +1 -0
  12. package/dist/browser-resource-context.d.ts +66 -0
  13. package/dist/browser-resource-context.d.ts.map +1 -1
  14. package/dist/browser-resource-context.js +20 -1
  15. package/dist/browser-resource-context.js.map +1 -1
  16. package/dist/browser-resource-suggestions.d.ts.map +1 -1
  17. package/dist/browser-resource-suggestions.js +51 -1
  18. package/dist/browser-resource-suggestions.js.map +1 -1
  19. package/dist/browser-resource.d.ts +8 -0
  20. package/dist/browser-resource.d.ts.map +1 -1
  21. package/dist/browser-resource.js +24 -0
  22. package/dist/browser-resource.js.map +1 -1
  23. package/dist/capture-policy.d.ts +16 -16
  24. package/dist/capture-rule-evaluation.d.ts +71 -12
  25. package/dist/capture-rule-evaluation.d.ts.map +1 -1
  26. package/dist/capture-rule-evaluation.js +98 -3
  27. package/dist/capture-rule-evaluation.js.map +1 -1
  28. package/dist/capture-rule-schemas.d.ts +1080 -210
  29. package/dist/capture-rule-schemas.d.ts.map +1 -1
  30. package/dist/capture-rule-schemas.js +56 -0
  31. package/dist/capture-rule-schemas.js.map +1 -1
  32. package/dist/capture-rule-suggestions.d.ts +398 -97
  33. package/dist/capture-rule-suggestions.d.ts.map +1 -1
  34. package/dist/event-envelope.d.ts +276 -276
  35. package/dist/frontend-severity.d.ts.map +1 -1
  36. package/dist/frontend-severity.js +3 -0
  37. package/dist/frontend-severity.js.map +1 -1
  38. package/dist/index.d.ts +293 -171
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +1 -1
  41. package/dist/index.js.map +1 -1
  42. package/package.json +1 -1
package/README.md CHANGED
@@ -36,5 +36,6 @@ EventEnvelopeSchema.parse(event);
36
36
 
37
37
  ## Notes
38
38
 
39
+ - Version 2.1 adds browser page lifecycle and bounded target-attribute capture matchers, alert noise policies, and optional correlated recovery evidence. Bundle schemas remain version 1 and existing SDK event envelopes stay compatible.
39
40
  - Published from the core-owned shared-package release workflow in `debugbundle/debugbundle`.
40
41
  - Source remains core-owned in the DebugBundle workspace and is published through the shared-package release workflow.
@@ -0,0 +1,71 @@
1
+ import { z } from "zod";
2
+ export declare const AlertEmailConfigSchema: z.ZodObject<{
3
+ to: z.ZodString;
4
+ aggregation_window_seconds: z.ZodOptional<z.ZodNumber>;
5
+ }, "strict", z.ZodTypeAny, {
6
+ to: string;
7
+ aggregation_window_seconds?: number | undefined;
8
+ }, {
9
+ to: string;
10
+ aggregation_window_seconds?: number | undefined;
11
+ }>;
12
+ export declare const AlertSlackConfigSchema: z.ZodUnion<[z.ZodObject<{
13
+ webhook_url: z.ZodString;
14
+ cooldown_scope: z.ZodOptional<z.ZodEnum<["incident", "project"]>>;
15
+ }, "strict", z.ZodTypeAny, {
16
+ webhook_url: string;
17
+ cooldown_scope?: "incident" | "project" | undefined;
18
+ }, {
19
+ webhook_url: string;
20
+ cooldown_scope?: "incident" | "project" | undefined;
21
+ }>, z.ZodObject<{
22
+ slack_destination_id: z.ZodString;
23
+ cooldown_scope: z.ZodOptional<z.ZodEnum<["incident", "project"]>>;
24
+ }, "strict", z.ZodTypeAny, {
25
+ slack_destination_id: string;
26
+ cooldown_scope?: "incident" | "project" | undefined;
27
+ }, {
28
+ slack_destination_id: string;
29
+ cooldown_scope?: "incident" | "project" | undefined;
30
+ }>]>;
31
+ export declare const AlertDiscordConfigSchema: z.ZodObject<{
32
+ webhook_url: z.ZodString;
33
+ cooldown_scope: z.ZodOptional<z.ZodEnum<["incident", "project"]>>;
34
+ }, "strict", z.ZodTypeAny, {
35
+ webhook_url: string;
36
+ cooldown_scope?: "incident" | "project" | undefined;
37
+ }, {
38
+ webhook_url: string;
39
+ cooldown_scope?: "incident" | "project" | undefined;
40
+ }>;
41
+ export declare const AlertWebhookConfigSchema: z.ZodObject<{
42
+ target_url: z.ZodString;
43
+ cooldown_scope: z.ZodOptional<z.ZodEnum<["incident", "project"]>>;
44
+ }, "strict", z.ZodTypeAny, {
45
+ target_url: string;
46
+ cooldown_scope?: "incident" | "project" | undefined;
47
+ }, {
48
+ target_url: string;
49
+ cooldown_scope?: "incident" | "project" | undefined;
50
+ }>;
51
+ /** A digest retains distinct incidents. Immediate-channel project cooldowns are opt-in,
52
+ * scoped to the selected rule, environment and severity so an escalation still alerts. */
53
+ export declare function resolveAlertNoisePolicy(input: {
54
+ channel: string;
55
+ config: Record<string, unknown>;
56
+ projectId: string;
57
+ incidentId: string;
58
+ environment: string;
59
+ severity: string;
60
+ notificationKey: string;
61
+ cooldownSeconds: number;
62
+ coalescingWindowSeconds?: number;
63
+ coalescingKey?: string;
64
+ }): {
65
+ notification_key: string;
66
+ cooldown_seconds: number;
67
+ aggregation_window_seconds: number;
68
+ };
69
+ /** Destination-only edits retain API-configured noise options on the same channel. */
70
+ export declare function preserveAlertNoiseSettings(channel: string, previous: Record<string, unknown> | undefined, next: Record<string, unknown>): Record<string, unknown>;
71
+ //# sourceMappingURL=alert-notification-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-notification-policy.d.ts","sourceRoot":"","sources":["../src/alert-notification-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB;;;;;;;;;EAKxB,CAAC;AAEZ,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;IAGjC,CAAC;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;EAE1B,CAAC;AACZ,eAAO,MAAM,wBAAwB;;;;;;;;;EAE1B,CAAC;AAEZ;0FAC0F;AAC1F,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAC;IAAC,0BAA0B,EAAE,MAAM,CAAA;CAAE,CAoB7F;AAED,sFAAsF;AACtF,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC7C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUzB"}
@@ -0,0 +1,54 @@
1
+ import { z } from "zod";
2
+ export const AlertEmailConfigSchema = z
3
+ .object({
4
+ to: z.string().email(),
5
+ aggregation_window_seconds: z.number().int().min(1).max(300).optional()
6
+ })
7
+ .strict();
8
+ const cooldownScope = z.enum(["incident", "project"]).optional();
9
+ export const AlertSlackConfigSchema = z.union([
10
+ z.object({ webhook_url: z.string().url().max(2000), cooldown_scope: cooldownScope }).strict(),
11
+ z.object({ slack_destination_id: z.string().uuid(), cooldown_scope: cooldownScope }).strict()
12
+ ]);
13
+ export const AlertDiscordConfigSchema = z
14
+ .object({ webhook_url: z.string().url().max(2000), cooldown_scope: cooldownScope })
15
+ .strict();
16
+ export const AlertWebhookConfigSchema = z
17
+ .object({ target_url: z.string().url().max(2000), cooldown_scope: cooldownScope })
18
+ .strict();
19
+ /** A digest retains distinct incidents. Immediate-channel project cooldowns are opt-in,
20
+ * scoped to the selected rule, environment and severity so an escalation still alerts. */
21
+ export function resolveAlertNoisePolicy(input) {
22
+ const email = input.channel === "email";
23
+ const configuredWindow = AlertEmailConfigSchema.safeParse(input.config);
24
+ return {
25
+ notification_key: email
26
+ ? input.coalescingWindowSeconds === undefined
27
+ ? input.notificationKey
28
+ : input.incidentId
29
+ : input.config["cooldown_scope"] === "project"
30
+ ? JSON.stringify(["project_alert", input.projectId, input.environment, input.severity])
31
+ : input.notificationKey,
32
+ // Legacy queued jobs used one key for both checks; retain their bounded behavior.
33
+ cooldown_seconds: email || input.coalescingKey !== undefined
34
+ ? input.cooldownSeconds
35
+ : Math.max(input.cooldownSeconds, input.coalescingWindowSeconds ?? 0),
36
+ aggregation_window_seconds: configuredWindow.success
37
+ ? (configuredWindow.data.aggregation_window_seconds ?? 10)
38
+ : 10
39
+ };
40
+ }
41
+ /** Destination-only edits retain API-configured noise options on the same channel. */
42
+ export function preserveAlertNoiseSettings(channel, previous, next) {
43
+ if (previous === undefined)
44
+ return next;
45
+ if (channel === "email") {
46
+ const parsed = AlertEmailConfigSchema.safeParse(previous);
47
+ return parsed.success && parsed.data.aggregation_window_seconds !== undefined
48
+ ? { aggregation_window_seconds: parsed.data.aggregation_window_seconds, ...next }
49
+ : next;
50
+ }
51
+ const scope = cooldownScope.safeParse(previous["cooldown_scope"]);
52
+ return scope.success && scope.data !== undefined ? { cooldown_scope: scope.data, ...next } : next;
53
+ }
54
+ //# sourceMappingURL=alert-notification-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-notification-policy.js","sourceRoot":"","sources":["../src/alert-notification-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAA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AQ,CAAC,CAAC;QAC1D,OAAO,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,0BAA0B,KAAK,SAAS;YAC3E,CAAC,CAAC,EAAE,0BAA0B,EAAE,MAAM,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,IAAI,EAAE;YACjF,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;IACD,MAAM,KAAK,GAAG,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAClE,OAAO,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACpG,CAAC"}
@@ -525,20 +525,20 @@ export declare const AnalyticsBundleV1Schema: z.ZodObject<{
525
525
  to: z.ZodString;
526
526
  granularity: z.ZodEnum<["hour", "day", "week", "month"]>;
527
527
  }, "strict", z.ZodTypeAny, {
528
- from: string;
529
528
  to: string;
529
+ from: string;
530
530
  granularity: "hour" | "day" | "week" | "month";
531
531
  }, {
532
- from: string;
533
532
  to: string;
533
+ from: string;
534
534
  granularity: "hour" | "day" | "week" | "month";
535
535
  }>, {
536
- from: string;
537
536
  to: string;
537
+ from: string;
538
538
  granularity: "hour" | "day" | "week" | "month";
539
539
  }, {
540
- from: string;
541
540
  to: string;
541
+ from: string;
542
542
  granularity: "hour" | "day" | "week" | "month";
543
543
  }>;
544
544
  summary: z.ZodObject<{
@@ -597,6 +597,11 @@ export declare const AnalyticsBundleV1Schema: z.ZodObject<{
597
597
  input_fingerprint: string;
598
598
  }>;
599
599
  }, "strict", z.ZodTypeAny, {
600
+ project: {
601
+ project_id: string;
602
+ service: string | null;
603
+ environment: string | null;
604
+ };
600
605
  schema_version: "analytics_bundle.v1";
601
606
  summary: {
602
607
  title: string;
@@ -607,14 +612,9 @@ export declare const AnalyticsBundleV1Schema: z.ZodObject<{
607
612
  journey_patterns: Record<string, unknown>[];
608
613
  analysis_kind: "usage_summary" | "route_health" | "funnel_dropoff" | "journey_friction" | "feature_usage" | "incident_impact" | "deploy_comparison" | "conversion_path";
609
614
  bundle_type: "analytics";
610
- project: {
611
- project_id: string;
612
- service: string | null;
613
- environment: string | null;
614
- };
615
615
  analysis_window: {
616
- from: string;
617
616
  to: string;
617
+ from: string;
618
618
  granularity: "hour" | "day" | "week" | "month";
619
619
  };
620
620
  metrics: {
@@ -636,6 +636,11 @@ export declare const AnalyticsBundleV1Schema: z.ZodObject<{
636
636
  input_fingerprint: string;
637
637
  };
638
638
  }, {
639
+ project: {
640
+ project_id: string;
641
+ service: string | null;
642
+ environment: string | null;
643
+ };
639
644
  schema_version: "analytics_bundle.v1";
640
645
  summary: {
641
646
  title: string;
@@ -646,14 +651,9 @@ export declare const AnalyticsBundleV1Schema: z.ZodObject<{
646
651
  journey_patterns: Record<string, unknown>[];
647
652
  analysis_kind: "usage_summary" | "route_health" | "funnel_dropoff" | "journey_friction" | "feature_usage" | "incident_impact" | "deploy_comparison" | "conversion_path";
648
653
  bundle_type: "analytics";
649
- project: {
650
- project_id: string;
651
- service: string | null;
652
- environment: string | null;
653
- };
654
654
  analysis_window: {
655
- from: string;
656
655
  to: string;
656
+ from: string;
657
657
  granularity: "hour" | "day" | "week" | "month";
658
658
  };
659
659
  metrics: {