@interfere/types 10.2.2 → 10.4.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 (55) hide show
  1. package/dist/data/session.cjs +1 -1
  2. package/dist/data/session.d.cts +2 -1
  3. package/dist/data/session.d.mts +2 -1
  4. package/dist/data/session.mjs +1 -1
  5. package/dist/data/source-map-batch.cjs +1 -1
  6. package/dist/data/source-map-batch.mjs +1 -1
  7. package/dist/integrations/index.cjs +1 -1
  8. package/dist/integrations/index.d.cts +4 -0
  9. package/dist/integrations/index.d.mts +4 -0
  10. package/dist/integrations/index.mjs +1 -1
  11. package/dist/integrations/platforms/cloudflare.cjs +1 -1
  12. package/dist/integrations/platforms/cloudflare.d.cts +6 -2
  13. package/dist/integrations/platforms/cloudflare.d.mts +6 -2
  14. package/dist/integrations/platforms/cloudflare.mjs +1 -1
  15. package/dist/internal/runtime-inference.cjs +1 -0
  16. package/dist/internal/runtime-inference.d.cts +11 -0
  17. package/dist/internal/runtime-inference.d.mts +11 -0
  18. package/dist/internal/runtime-inference.mjs +1 -0
  19. package/dist/releases/build-telemetry.cjs +1 -1
  20. package/dist/releases/build-telemetry.d.cts +1 -0
  21. package/dist/releases/build-telemetry.d.mts +1 -0
  22. package/dist/releases/build-telemetry.mjs +1 -1
  23. package/dist/releases/definition.d.cts +2 -0
  24. package/dist/releases/definition.d.mts +2 -0
  25. package/dist/sdk/build-diagnostics.cjs +1 -1
  26. package/dist/sdk/build-diagnostics.d.cts +37 -14
  27. package/dist/sdk/build-diagnostics.d.mts +37 -14
  28. package/dist/sdk/build-diagnostics.mjs +1 -1
  29. package/dist/sdk/deploy-environment.cjs +1 -2
  30. package/dist/sdk/deploy-environment.d.cts +3 -1
  31. package/dist/sdk/deploy-environment.d.mts +3 -1
  32. package/dist/sdk/deploy-environment.mjs +1 -2
  33. package/dist/sdk/envelope.d.cts +12 -12
  34. package/dist/sdk/envelope.d.mts +12 -12
  35. package/dist/sdk/errors.d.cts +3 -34
  36. package/dist/sdk/errors.d.mts +3 -34
  37. package/dist/sdk/injected-globals.cjs +1 -1
  38. package/dist/sdk/injected-globals.d.cts +1 -0
  39. package/dist/sdk/injected-globals.d.mts +1 -0
  40. package/dist/sdk/injected-globals.mjs +1 -1
  41. package/dist/sdk/runtime.cjs +1 -1
  42. package/dist/sdk/runtime.mjs +1 -1
  43. package/dist/sdk/service-name.cjs +1 -0
  44. package/dist/sdk/service-name.d.cts +8 -0
  45. package/dist/sdk/service-name.d.mts +8 -0
  46. package/dist/sdk/service-name.mjs +1 -0
  47. package/dist/sdk/throw-site.cjs +2 -0
  48. package/dist/sdk/throw-site.d.cts +14 -0
  49. package/dist/sdk/throw-site.d.mts +14 -0
  50. package/dist/sdk/throw-site.mjs +2 -0
  51. package/dist/sdk/url-redaction.cjs +1 -0
  52. package/dist/sdk/url-redaction.d.cts +58 -0
  53. package/dist/sdk/url-redaction.d.mts +58 -0
  54. package/dist/sdk/url-redaction.mjs +1 -0
  55. package/package.json +11 -12
@@ -188,7 +188,7 @@ export declare const errorEnvelopeSchema: z.ZodObject<{
188
188
  node: "node";
189
189
  }>>;
190
190
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
191
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
191
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
192
192
  sessionSource: z.ZodOptional<z.ZodEnum<{
193
193
  async_context: "async_context";
194
194
  client: "client";
@@ -315,7 +315,7 @@ export declare const pageviewEnvelopeSchema: z.ZodObject<{
315
315
  node: "node";
316
316
  }>>;
317
317
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
318
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
318
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
319
319
  sessionSource: z.ZodOptional<z.ZodEnum<{
320
320
  async_context: "async_context";
321
321
  client: "client";
@@ -422,7 +422,7 @@ export declare const pageleaveEnvelopeSchema: z.ZodObject<{
422
422
  node: "node";
423
423
  }>>;
424
424
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
425
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
425
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
426
426
  sessionSource: z.ZodOptional<z.ZodEnum<{
427
427
  async_context: "async_context";
428
428
  client: "client";
@@ -529,7 +529,7 @@ export declare const uiEventEnvelopeSchema: z.ZodObject<{
529
529
  node: "node";
530
530
  }>>;
531
531
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
532
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
532
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
533
533
  sessionSource: z.ZodOptional<z.ZodEnum<{
534
534
  async_context: "async_context";
535
535
  client: "client";
@@ -635,7 +635,7 @@ export declare const replayChunkEnvelopeSchema: z.ZodObject<{
635
635
  node: "node";
636
636
  }>>;
637
637
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
638
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
638
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
639
639
  sessionSource: z.ZodOptional<z.ZodEnum<{
640
640
  async_context: "async_context";
641
641
  client: "client";
@@ -745,7 +745,7 @@ export declare const rageClickEnvelopeSchema: z.ZodObject<{
745
745
  node: "node";
746
746
  }>>;
747
747
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
748
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
748
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
749
749
  sessionSource: z.ZodOptional<z.ZodEnum<{
750
750
  async_context: "async_context";
751
751
  client: "client";
@@ -857,7 +857,7 @@ export declare const envelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
857
857
  node: "node";
858
858
  }>>;
859
859
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
860
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
860
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
861
861
  sessionSource: z.ZodOptional<z.ZodEnum<{
862
862
  async_context: "async_context";
863
863
  client: "client";
@@ -983,7 +983,7 @@ export declare const envelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
983
983
  node: "node";
984
984
  }>>;
985
985
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
986
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
986
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
987
987
  sessionSource: z.ZodOptional<z.ZodEnum<{
988
988
  async_context: "async_context";
989
989
  client: "client";
@@ -1089,7 +1089,7 @@ export declare const envelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1089
1089
  node: "node";
1090
1090
  }>>;
1091
1091
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
1092
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
1092
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
1093
1093
  sessionSource: z.ZodOptional<z.ZodEnum<{
1094
1094
  async_context: "async_context";
1095
1095
  client: "client";
@@ -1195,7 +1195,7 @@ export declare const envelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1195
1195
  node: "node";
1196
1196
  }>>;
1197
1197
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
1198
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
1198
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
1199
1199
  sessionSource: z.ZodOptional<z.ZodEnum<{
1200
1200
  async_context: "async_context";
1201
1201
  client: "client";
@@ -1300,7 +1300,7 @@ export declare const envelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1300
1300
  node: "node";
1301
1301
  }>>;
1302
1302
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
1303
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
1303
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
1304
1304
  sessionSource: z.ZodOptional<z.ZodEnum<{
1305
1305
  async_context: "async_context";
1306
1306
  client: "client";
@@ -1409,7 +1409,7 @@ export declare const envelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1409
1409
  node: "node";
1410
1410
  }>>;
1411
1411
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
1412
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
1412
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
1413
1413
  sessionSource: z.ZodOptional<z.ZodEnum<{
1414
1414
  async_context: "async_context";
1415
1415
  client: "client";
@@ -188,7 +188,7 @@ export declare const errorEnvelopeSchema: z.ZodObject<{
188
188
  node: "node";
189
189
  }>>;
190
190
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
191
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
191
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
192
192
  sessionSource: z.ZodOptional<z.ZodEnum<{
193
193
  async_context: "async_context";
194
194
  client: "client";
@@ -315,7 +315,7 @@ export declare const pageviewEnvelopeSchema: z.ZodObject<{
315
315
  node: "node";
316
316
  }>>;
317
317
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
318
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
318
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
319
319
  sessionSource: z.ZodOptional<z.ZodEnum<{
320
320
  async_context: "async_context";
321
321
  client: "client";
@@ -422,7 +422,7 @@ export declare const pageleaveEnvelopeSchema: z.ZodObject<{
422
422
  node: "node";
423
423
  }>>;
424
424
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
425
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
425
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
426
426
  sessionSource: z.ZodOptional<z.ZodEnum<{
427
427
  async_context: "async_context";
428
428
  client: "client";
@@ -529,7 +529,7 @@ export declare const uiEventEnvelopeSchema: z.ZodObject<{
529
529
  node: "node";
530
530
  }>>;
531
531
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
532
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
532
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
533
533
  sessionSource: z.ZodOptional<z.ZodEnum<{
534
534
  async_context: "async_context";
535
535
  client: "client";
@@ -635,7 +635,7 @@ export declare const replayChunkEnvelopeSchema: z.ZodObject<{
635
635
  node: "node";
636
636
  }>>;
637
637
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
638
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
638
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
639
639
  sessionSource: z.ZodOptional<z.ZodEnum<{
640
640
  async_context: "async_context";
641
641
  client: "client";
@@ -745,7 +745,7 @@ export declare const rageClickEnvelopeSchema: z.ZodObject<{
745
745
  node: "node";
746
746
  }>>;
747
747
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
748
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
748
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
749
749
  sessionSource: z.ZodOptional<z.ZodEnum<{
750
750
  async_context: "async_context";
751
751
  client: "client";
@@ -857,7 +857,7 @@ export declare const envelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
857
857
  node: "node";
858
858
  }>>;
859
859
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
860
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
860
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
861
861
  sessionSource: z.ZodOptional<z.ZodEnum<{
862
862
  async_context: "async_context";
863
863
  client: "client";
@@ -983,7 +983,7 @@ export declare const envelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
983
983
  node: "node";
984
984
  }>>;
985
985
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
986
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
986
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
987
987
  sessionSource: z.ZodOptional<z.ZodEnum<{
988
988
  async_context: "async_context";
989
989
  client: "client";
@@ -1089,7 +1089,7 @@ export declare const envelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1089
1089
  node: "node";
1090
1090
  }>>;
1091
1091
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
1092
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
1092
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
1093
1093
  sessionSource: z.ZodOptional<z.ZodEnum<{
1094
1094
  async_context: "async_context";
1095
1095
  client: "client";
@@ -1195,7 +1195,7 @@ export declare const envelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1195
1195
  node: "node";
1196
1196
  }>>;
1197
1197
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
1198
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
1198
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
1199
1199
  sessionSource: z.ZodOptional<z.ZodEnum<{
1200
1200
  async_context: "async_context";
1201
1201
  client: "client";
@@ -1300,7 +1300,7 @@ export declare const envelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1300
1300
  node: "node";
1301
1301
  }>>;
1302
1302
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
1303
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
1303
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
1304
1304
  sessionSource: z.ZodOptional<z.ZodEnum<{
1305
1305
  async_context: "async_context";
1306
1306
  client: "client";
@@ -1409,7 +1409,7 @@ export declare const envelopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1409
1409
  node: "node";
1410
1410
  }>>;
1411
1411
  sdkStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
1412
- sessionId: z.ZodNullable<z.core.$ZodBranded<z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>, "SessionId", "out">>;
1412
+ sessionId: z.ZodNullable<z.ZodIntersection<z.core.$ZodBranded<z.ZodString, "SessionId", "out">, z.ZodUnion<readonly [z.ZodUUID, z.ZodTemplateLiteral<`server_${string}`>]>>>;
1413
1413
  sessionSource: z.ZodOptional<z.ZodEnum<{
1414
1414
  async_context: "async_context";
1415
1415
  client: "client";
@@ -92,19 +92,7 @@ export declare function parseReactComponentStack(componentStack: string): {
92
92
  line?: number | undefined;
93
93
  source?: string | undefined;
94
94
  }[];
95
- /**
96
- * Coerces any thrown value into an `Error` instance, preferring a nested
97
- * `Error` inside a plain-object rejection over a stringified fallback.
98
- *
99
- * Motivated by the common `Promise.reject({ error: realErr })` pattern
100
- * (tRPC, GraphQL clients, some fetch wrappers). Without this, the captured
101
- * exception would be `new Error("[object Object]")` and the nested Error's
102
- * stack/message would be lost entirely.
103
- *
104
- * When multiple candidate Error values exist on the object, the first one
105
- * found (in declaration order) wins. `cause` is preferred if present, since
106
- * it's the documented ES2022 convention.
107
- */
95
+ /** Returns an Error, preferring an existing or nested Error over a stringified fallback. */
108
96
  export declare function toError(error: unknown): Error;
109
97
  /**
110
98
  * Capture-side variant for thrown values that aren't Errors and don't
@@ -139,29 +127,10 @@ export interface NonErrorException {
139
127
  */
140
128
  readonly value: string;
141
129
  }
142
- /**
143
- * Depth-bounded, circular-safe clone. Primitives + null/undefined pass
144
- * through as-is. Objects and arrays recurse up to `MAX_NON_ERROR_DEPTH`
145
- * before collapsing to `DEPTH_LIMIT_SENTINEL`; back-edges become
146
- * `CIRCULAR_SENTINEL`. Functions, symbols, and other non-serialisable
147
- * values are coerced via `String(...)` so the dashboard can render
148
- * something rather than dropping the field.
149
- */
150
130
  type SerializedException = null | undefined | string | number | boolean | SerializedException[] | {
151
131
  [key: string]: SerializedException;
152
132
  };
153
- /**
154
- * Coerces any thrown value into either an `Error` (when one is
155
- * recoverable — direct Error, or nested Error inside an object via
156
- * `cause` / first-Error-valued property — or a string, which maps
157
- * cleanly to `new Error(str)`) or a structured `NonErrorException`
158
- * carrying the original payload.
159
- *
160
- * Replaces `toError` for capture sites that handle both branches
161
- * (today: `unhandledrejection`). `toError` is kept for callers that
162
- * specifically need an `Error` (`<ErrorBoundary>` interop, browser
163
- * APIs that take Error-typed args).
164
- */
133
+ /** Preserves recoverable Errors and serializes other thrown values as structured exceptions. */
165
134
  export declare function toException(value: unknown): Error | {
166
135
  kind: "non-error";
167
136
  serialized: SerializedException;
@@ -175,7 +144,7 @@ export declare function isNonErrorException(value: unknown): value is NonErrorEx
175
144
  * plus the raw `stack` string — the SDK ships **no parsed frames**.
176
145
  * Server-side ingest parses `stack` into structured `IngestedFrame[]`
177
146
  * via the collector's stack parser (see
178
- * `src/packages/private/otlp-ingest/src/stack-parser.ts`).
147
+ * `src/packages/private/otlp-ingest/src/mapping/traces/stack-parser.ts`).
179
148
  *
180
149
  * Non-Error rejections short-circuit to a single `kind: "non-error"`
181
150
  * entry with the structured payload on `serialized`.
@@ -92,19 +92,7 @@ export declare function parseReactComponentStack(componentStack: string): {
92
92
  line?: number | undefined;
93
93
  source?: string | undefined;
94
94
  }[];
95
- /**
96
- * Coerces any thrown value into an `Error` instance, preferring a nested
97
- * `Error` inside a plain-object rejection over a stringified fallback.
98
- *
99
- * Motivated by the common `Promise.reject({ error: realErr })` pattern
100
- * (tRPC, GraphQL clients, some fetch wrappers). Without this, the captured
101
- * exception would be `new Error("[object Object]")` and the nested Error's
102
- * stack/message would be lost entirely.
103
- *
104
- * When multiple candidate Error values exist on the object, the first one
105
- * found (in declaration order) wins. `cause` is preferred if present, since
106
- * it's the documented ES2022 convention.
107
- */
95
+ /** Returns an Error, preferring an existing or nested Error over a stringified fallback. */
108
96
  export declare function toError(error: unknown): Error;
109
97
  /**
110
98
  * Capture-side variant for thrown values that aren't Errors and don't
@@ -139,29 +127,10 @@ export interface NonErrorException {
139
127
  */
140
128
  readonly value: string;
141
129
  }
142
- /**
143
- * Depth-bounded, circular-safe clone. Primitives + null/undefined pass
144
- * through as-is. Objects and arrays recurse up to `MAX_NON_ERROR_DEPTH`
145
- * before collapsing to `DEPTH_LIMIT_SENTINEL`; back-edges become
146
- * `CIRCULAR_SENTINEL`. Functions, symbols, and other non-serialisable
147
- * values are coerced via `String(...)` so the dashboard can render
148
- * something rather than dropping the field.
149
- */
150
130
  type SerializedException = null | undefined | string | number | boolean | SerializedException[] | {
151
131
  [key: string]: SerializedException;
152
132
  };
153
- /**
154
- * Coerces any thrown value into either an `Error` (when one is
155
- * recoverable — direct Error, or nested Error inside an object via
156
- * `cause` / first-Error-valued property — or a string, which maps
157
- * cleanly to `new Error(str)`) or a structured `NonErrorException`
158
- * carrying the original payload.
159
- *
160
- * Replaces `toError` for capture sites that handle both branches
161
- * (today: `unhandledrejection`). `toError` is kept for callers that
162
- * specifically need an `Error` (`<ErrorBoundary>` interop, browser
163
- * APIs that take Error-typed args).
164
- */
133
+ /** Preserves recoverable Errors and serializes other thrown values as structured exceptions. */
165
134
  export declare function toException(value: unknown): Error | {
166
135
  kind: "non-error";
167
136
  serialized: SerializedException;
@@ -175,7 +144,7 @@ export declare function isNonErrorException(value: unknown): value is NonErrorEx
175
144
  * plus the raw `stack` string — the SDK ships **no parsed frames**.
176
145
  * Server-side ingest parses `stack` into structured `IngestedFrame[]`
177
146
  * via the collector's stack parser (see
178
- * `src/packages/private/otlp-ingest/src/stack-parser.ts`).
147
+ * `src/packages/private/otlp-ingest/src/mapping/traces/stack-parser.ts`).
179
148
  *
180
149
  * Non-Error rejections short-circuit to a single `kind: "non-error"`
181
150
  * entry with the structured payload on `serialized`.
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),exports.API_URL_GLOBAL=`__INTERFERE_API_URL__`,exports.BUILD_MARKER_GLOBAL=`__INTERFERE_BUILD__`,exports.ENVIRONMENT_GLOBAL=`__INTERFERE_ENVIRONMENT__`,exports.FORCE_ENABLE_GLOBAL=`__INTERFERE_FORCE_ENABLE__`,exports.INGEST_URL_GLOBAL=`__INTERFERE_INGEST_URL__`,exports.PUBLIC_KEY_GLOBAL=`__INTERFERE_PUBLIC_KEY__`,exports.RELEASE_SLUG_GLOBAL=`__INTERFERE_RELEASE_SLUG__`,exports.SDK_STACK_GLOBAL=`__INTERFERE_SDK_STACK__`;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),exports.API_URL_GLOBAL=`__INTERFERE_API_URL__`,exports.BUILD_MARKER_GLOBAL=`__INTERFERE_BUILD__`,exports.DISABLED_GLOBAL=`__INTERFERE_DISABLED__`,exports.ENVIRONMENT_GLOBAL=`__INTERFERE_ENVIRONMENT__`,exports.FORCE_ENABLE_GLOBAL=`__INTERFERE_FORCE_ENABLE__`,exports.INGEST_URL_GLOBAL=`__INTERFERE_INGEST_URL__`,exports.PUBLIC_KEY_GLOBAL=`__INTERFERE_PUBLIC_KEY__`,exports.RELEASE_SLUG_GLOBAL=`__INTERFERE_RELEASE_SLUG__`,exports.SDK_STACK_GLOBAL=`__INTERFERE_SDK_STACK__`;
@@ -1,6 +1,7 @@
1
1
  //#region src/sdk/injected-globals.d.ts
2
2
  export declare const API_URL_GLOBAL = "__INTERFERE_API_URL__";
3
3
  export declare const BUILD_MARKER_GLOBAL = "__INTERFERE_BUILD__";
4
+ export declare const DISABLED_GLOBAL = "__INTERFERE_DISABLED__";
4
5
  export declare const ENVIRONMENT_GLOBAL = "__INTERFERE_ENVIRONMENT__";
5
6
  export declare const FORCE_ENABLE_GLOBAL = "__INTERFERE_FORCE_ENABLE__";
6
7
  export declare const INGEST_URL_GLOBAL = "__INTERFERE_INGEST_URL__";
@@ -1,6 +1,7 @@
1
1
  //#region src/sdk/injected-globals.d.ts
2
2
  export declare const API_URL_GLOBAL = "__INTERFERE_API_URL__";
3
3
  export declare const BUILD_MARKER_GLOBAL = "__INTERFERE_BUILD__";
4
+ export declare const DISABLED_GLOBAL = "__INTERFERE_DISABLED__";
4
5
  export declare const ENVIRONMENT_GLOBAL = "__INTERFERE_ENVIRONMENT__";
5
6
  export declare const FORCE_ENABLE_GLOBAL = "__INTERFERE_FORCE_ENABLE__";
6
7
  export declare const INGEST_URL_GLOBAL = "__INTERFERE_INGEST_URL__";
@@ -1 +1 @@
1
- const API_URL_GLOBAL=`__INTERFERE_API_URL__`,BUILD_MARKER_GLOBAL=`__INTERFERE_BUILD__`,ENVIRONMENT_GLOBAL=`__INTERFERE_ENVIRONMENT__`,FORCE_ENABLE_GLOBAL=`__INTERFERE_FORCE_ENABLE__`,INGEST_URL_GLOBAL=`__INTERFERE_INGEST_URL__`,PUBLIC_KEY_GLOBAL=`__INTERFERE_PUBLIC_KEY__`,RELEASE_SLUG_GLOBAL=`__INTERFERE_RELEASE_SLUG__`,SDK_STACK_GLOBAL=`__INTERFERE_SDK_STACK__`;export{API_URL_GLOBAL,BUILD_MARKER_GLOBAL,ENVIRONMENT_GLOBAL,FORCE_ENABLE_GLOBAL,INGEST_URL_GLOBAL,PUBLIC_KEY_GLOBAL,RELEASE_SLUG_GLOBAL,SDK_STACK_GLOBAL};
1
+ const API_URL_GLOBAL=`__INTERFERE_API_URL__`,BUILD_MARKER_GLOBAL=`__INTERFERE_BUILD__`,DISABLED_GLOBAL=`__INTERFERE_DISABLED__`,ENVIRONMENT_GLOBAL=`__INTERFERE_ENVIRONMENT__`,FORCE_ENABLE_GLOBAL=`__INTERFERE_FORCE_ENABLE__`,INGEST_URL_GLOBAL=`__INTERFERE_INGEST_URL__`,PUBLIC_KEY_GLOBAL=`__INTERFERE_PUBLIC_KEY__`,RELEASE_SLUG_GLOBAL=`__INTERFERE_RELEASE_SLUG__`,SDK_STACK_GLOBAL=`__INTERFERE_SDK_STACK__`;export{API_URL_GLOBAL,BUILD_MARKER_GLOBAL,DISABLED_GLOBAL,ENVIRONMENT_GLOBAL,FORCE_ENABLE_GLOBAL,INGEST_URL_GLOBAL,PUBLIC_KEY_GLOBAL,RELEASE_SLUG_GLOBAL,SDK_STACK_GLOBAL};
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let zod=require("zod");const envSchema=zod.z.string().min(1).nullable().meta({description:"Deployment environment the SDK is running in. Free-form label (e.g. `production`, `preview`, `staging`, `development`).",id:`Environment`,title:`Environment`}),DEFAULT_ENVIRONMENT=`development`,ENVIRONMENT_ENV_VARS=[`INTERFERE_ENVIRONMENT`,`VERCEL_ENV`,`NODE_ENV`];function resolveEnvironment(opts){let env=opts?.env??{},explicit=normalizeEnv(opts?.explicit);if(explicit)return explicit;for(let key of ENVIRONMENT_ENV_VARS){let value=normalizeEnv(env[key]);if(value)return value}return DEFAULT_ENVIRONMENT}const runtimeSchema=zod.z.enum([`browser`,`node`,`edge`]).nullable().meta({description:`JavaScript runtime the SDK is running in.`,id:`Runtime`,title:`Runtime`}),globalScope=globalThis;function readProcessEnv(){return globalScope.process?.env}function inferRuntime(options){return globalScope.window!==void 0&&globalScope.document!==void 0&&globalScope.navigator!==void 0?`browser`:typeof globalScope.EdgeRuntime==`string`||options?.nextRuntime===`edge`?`edge`:typeof globalScope.process?.versions?.node==`string`?`node`:null}function normalizeEnv(value){if(typeof value!=`string`)return null;let env=value.trim().toLowerCase();return env.length>0?env:null}exports.DEFAULT_ENVIRONMENT=DEFAULT_ENVIRONMENT,exports.envSchema=envSchema,exports.inferRuntime=inferRuntime,exports.normalizeEnv=normalizeEnv,exports.readProcessEnv=readProcessEnv,exports.resolveEnvironment=resolveEnvironment,exports.runtimeSchema=runtimeSchema;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const require_internal_runtime_inference=require("../internal/runtime-inference.cjs");let zod=require("zod");const envSchema=zod.z.string().min(1).nullable().meta({description:"Deployment environment the SDK is running in. Free-form label (e.g. `production`, `preview`, `staging`, `development`).",id:`Environment`,title:`Environment`}),DEFAULT_ENVIRONMENT=`development`,ENVIRONMENT_ENV_VARS=[`INTERFERE_ENVIRONMENT`,`VERCEL_ENV`,`NODE_ENV`];function resolveEnvironment(opts){let env=opts?.env??{},explicit=normalizeEnv(opts?.explicit);if(explicit)return explicit;for(let key of ENVIRONMENT_ENV_VARS){let value=normalizeEnv(env[key]);if(value)return value}return DEFAULT_ENVIRONMENT}const runtimeSchema=zod.z.enum([`browser`,`node`,`edge`]).nullable().meta({description:`JavaScript runtime the SDK is running in.`,id:`Runtime`,title:`Runtime`}),globalScope=globalThis;function readProcessEnv(){return globalScope.process?.env}function inferRuntime(options){return require_internal_runtime_inference.inferRuntimeFromEvidence({hasWindow:globalScope.window!==void 0,hasDocument:globalScope.document!==void 0,hasNavigator:globalScope.navigator!==void 0,edgeRuntime:globalScope.EdgeRuntime,nodeVersion:globalScope.process?.versions?.node,nextRuntime:options?.nextRuntime})}function normalizeEnv(value){if(typeof value!=`string`)return null;let env=value.trim().toLowerCase();return env.length>0?env:null}exports.DEFAULT_ENVIRONMENT=DEFAULT_ENVIRONMENT,exports.envSchema=envSchema,exports.inferRuntime=inferRuntime,exports.normalizeEnv=normalizeEnv,exports.readProcessEnv=readProcessEnv,exports.resolveEnvironment=resolveEnvironment,exports.runtimeSchema=runtimeSchema;
@@ -1 +1 @@
1
- import{z}from"zod";const envSchema=z.string().min(1).nullable().meta({description:"Deployment environment the SDK is running in. Free-form label (e.g. `production`, `preview`, `staging`, `development`).",id:`Environment`,title:`Environment`}),DEFAULT_ENVIRONMENT=`development`,ENVIRONMENT_ENV_VARS=[`INTERFERE_ENVIRONMENT`,`VERCEL_ENV`,`NODE_ENV`];function resolveEnvironment(opts){let env=opts?.env??{},explicit=normalizeEnv(opts?.explicit);if(explicit)return explicit;for(let key of ENVIRONMENT_ENV_VARS){let value=normalizeEnv(env[key]);if(value)return value}return DEFAULT_ENVIRONMENT}const runtimeSchema=z.enum([`browser`,`node`,`edge`]).nullable().meta({description:`JavaScript runtime the SDK is running in.`,id:`Runtime`,title:`Runtime`}),globalScope=globalThis;function readProcessEnv(){return globalScope.process?.env}function inferRuntime(options){return globalScope.window!==void 0&&globalScope.document!==void 0&&globalScope.navigator!==void 0?`browser`:typeof globalScope.EdgeRuntime==`string`||options?.nextRuntime===`edge`?`edge`:typeof globalScope.process?.versions?.node==`string`?`node`:null}function normalizeEnv(value){if(typeof value!=`string`)return null;let env=value.trim().toLowerCase();return env.length>0?env:null}export{DEFAULT_ENVIRONMENT,envSchema,inferRuntime,normalizeEnv,readProcessEnv,resolveEnvironment,runtimeSchema};
1
+ import{inferRuntimeFromEvidence}from"../internal/runtime-inference.mjs";import{z}from"zod";const envSchema=z.string().min(1).nullable().meta({description:"Deployment environment the SDK is running in. Free-form label (e.g. `production`, `preview`, `staging`, `development`).",id:`Environment`,title:`Environment`}),DEFAULT_ENVIRONMENT=`development`,ENVIRONMENT_ENV_VARS=[`INTERFERE_ENVIRONMENT`,`VERCEL_ENV`,`NODE_ENV`];function resolveEnvironment(opts){let env=opts?.env??{},explicit=normalizeEnv(opts?.explicit);if(explicit)return explicit;for(let key of ENVIRONMENT_ENV_VARS){let value=normalizeEnv(env[key]);if(value)return value}return DEFAULT_ENVIRONMENT}const runtimeSchema=z.enum([`browser`,`node`,`edge`]).nullable().meta({description:`JavaScript runtime the SDK is running in.`,id:`Runtime`,title:`Runtime`}),globalScope=globalThis;function readProcessEnv(){return globalScope.process?.env}function inferRuntime(options){return inferRuntimeFromEvidence({hasWindow:globalScope.window!==void 0,hasDocument:globalScope.document!==void 0,hasNavigator:globalScope.navigator!==void 0,edgeRuntime:globalScope.EdgeRuntime,nodeVersion:globalScope.process?.versions?.node,nextRuntime:options?.nextRuntime})}function normalizeEnv(value){if(typeof value!=`string`)return null;let env=value.trim().toLowerCase();return env.length>0?env:null}export{DEFAULT_ENVIRONMENT,envSchema,inferRuntime,normalizeEnv,readProcessEnv,resolveEnvironment,runtimeSchema};
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),exports.SERVICE_NAME_GLOBAL=`__INTERFERE_SERVICE_NAME__`;
@@ -0,0 +1,8 @@
1
+ //#region src/sdk/service-name.d.ts
2
+ /**
3
+ * Global a build stamps into the page with the default OTel `service.name`
4
+ * (the Vite plugin derives it from the package name). The kernel reads it
5
+ * when `init()` is called without `serviceName`; an explicit value wins.
6
+ */
7
+ export declare const SERVICE_NAME_GLOBAL = "__INTERFERE_SERVICE_NAME__";
8
+ //#endregion
@@ -0,0 +1,8 @@
1
+ //#region src/sdk/service-name.d.ts
2
+ /**
3
+ * Global a build stamps into the page with the default OTel `service.name`
4
+ * (the Vite plugin derives it from the package name). The kernel reads it
5
+ * when `init()` is called without `serviceName`; an explicit value wins.
6
+ */
7
+ export declare const SERVICE_NAME_GLOBAL = "__INTERFERE_SERVICE_NAME__";
8
+ //#endregion
@@ -0,0 +1 @@
1
+ const SERVICE_NAME_GLOBAL=`__INTERFERE_SERVICE_NAME__`;export{SERVICE_NAME_GLOBAL};
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let _sdk_errors=require("#sdk/errors");const V8_FRAME_RE=/^\s*at\s+(?:(?<fn>.+?)\s+\()?(?<location>.+?):(?<line>\d+)(?::\d+)?\)?\s*$/u,GECKO_FRAME_RE=/^(?<fn>[^@]*)@(?<location>.+?):(?<line>\d+)(?::\d+)?\s*$/u,FOREIGN_LOCATION_RE=/(?:^|\/)node_modules\/|^(?:native|<anonymous>|\[native code\])$|\beval at\s|^(?:chrome|moz|safari-web|safari|ms-browser|webkit-masked)-(?:extension|url):/u,ANONYMOUS_FN_RE=/^(?:<anonymous>|Object\.<anonymous>|global code)?$/u;function basename(location){let trimmed=location.replace(/[?#].*$/u,``),last=trimmed.lastIndexOf(`/`);return(last===-1?trimmed:trimmed.slice(last+1))||trimmed}function throwSiteLabel(stack){for(let rawLine of stack.split(`
2
+ `,30)){let line=rawLine.slice(0,1024),groups=(V8_FRAME_RE.exec(line)??GECKO_FRAME_RE.exec(line))?.groups;if(!groups?.location||!groups.line)continue;let location=groups.location.trim();if(FOREIGN_LOCATION_RE.test(location))continue;let fn=(groups.fn??``).replace(/^(?:async|new)\s+/u,``).trim(),site=`${basename(location)}:${groups.line}`;return ANONYMOUS_FN_RE.test(fn)?site:`${fn} (${site})`}return null}function exceptionSpanName(value){if((0,_sdk_errors.isNonErrorException)(value))return value.type;let stack=value.stack;return(typeof stack==`string`?throwSiteLabel(stack):null)??(value.name||`Error`)}exports.exceptionSpanName=exceptionSpanName;
@@ -0,0 +1,14 @@
1
+ import { NonErrorException } from "#sdk/errors";
2
+ //#region src/sdk/throw-site.d.ts
3
+ /**
4
+ * Name for the span the SDK opens to carry a captured exception when no
5
+ * span is active: the top in-app frame of the raw stack as `fn (file:line)`
6
+ * (`file:line` for anonymous frames; `node_modules`, native and
7
+ * browser-extension frames are skipped), or the error's type when the
8
+ * stack has no usable frame or host code replaced it with a non-string.
9
+ * Non-Error rejections carry no stack and use their structural type. The
10
+ * label mirrors the raw text the SDK ships; symbolication of minified
11
+ * names stays server-side.
12
+ */
13
+ export declare function exceptionSpanName(value: Error | NonErrorException): string;
14
+ //#endregion
@@ -0,0 +1,14 @@
1
+ import { NonErrorException } from "#sdk/errors";
2
+ //#region src/sdk/throw-site.d.ts
3
+ /**
4
+ * Name for the span the SDK opens to carry a captured exception when no
5
+ * span is active: the top in-app frame of the raw stack as `fn (file:line)`
6
+ * (`file:line` for anonymous frames; `node_modules`, native and
7
+ * browser-extension frames are skipped), or the error's type when the
8
+ * stack has no usable frame or host code replaced it with a non-string.
9
+ * Non-Error rejections carry no stack and use their structural type. The
10
+ * label mirrors the raw text the SDK ships; symbolication of minified
11
+ * names stays server-side.
12
+ */
13
+ export declare function exceptionSpanName(value: Error | NonErrorException): string;
14
+ //#endregion
@@ -0,0 +1,2 @@
1
+ import{isNonErrorException}from"#sdk/errors";const V8_FRAME_RE=/^\s*at\s+(?:(?<fn>.+?)\s+\()?(?<location>.+?):(?<line>\d+)(?::\d+)?\)?\s*$/u,GECKO_FRAME_RE=/^(?<fn>[^@]*)@(?<location>.+?):(?<line>\d+)(?::\d+)?\s*$/u,FOREIGN_LOCATION_RE=/(?:^|\/)node_modules\/|^(?:native|<anonymous>|\[native code\])$|\beval at\s|^(?:chrome|moz|safari-web|safari|ms-browser|webkit-masked)-(?:extension|url):/u,ANONYMOUS_FN_RE=/^(?:<anonymous>|Object\.<anonymous>|global code)?$/u;function basename(location){let trimmed=location.replace(/[?#].*$/u,``),last=trimmed.lastIndexOf(`/`);return(last===-1?trimmed:trimmed.slice(last+1))||trimmed}function throwSiteLabel(stack){for(let rawLine of stack.split(`
2
+ `,30)){let line=rawLine.slice(0,1024),groups=(V8_FRAME_RE.exec(line)??GECKO_FRAME_RE.exec(line))?.groups;if(!groups?.location||!groups.line)continue;let location=groups.location.trim();if(FOREIGN_LOCATION_RE.test(location))continue;let fn=(groups.fn??``).replace(/^(?:async|new)\s+/u,``).trim(),site=`${basename(location)}:${groups.line}`;return ANONYMOUS_FN_RE.test(fn)?site:`${fn} (${site})`}return null}function exceptionSpanName(value){if(isNonErrorException(value))return value.type;let stack=value.stack;return(typeof stack==`string`?throwSiteLabel(stack):null)??(value.name||`Error`)}export{exceptionSpanName};
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let zod=require("zod");const URL_ATTRIBUTE_KEYS=[`http.referrer`,`http.request.header.referer`,`http.target`,`http.url`,`url.full`,`url.original`,`url.path`],URL_PARTS_RE=/^(?<base>[^?#]*)(?:\?(?<query>[^#]*))?(?<fragment>#.*)?$/su,ABSOLUTE_URL_RE=/https?:\/\/[^\s"'<>]+/giu,REDACTED=`REDACTED`,SENSITIVE_NAMES=new Set([`awsaccesskeyid`,`code`,`key`,`sig`]),SENSITIVE_TERMS=[`api_key`,`apikey`,`auth`,`credential`,`passwd`,`password`,`secret`,`session`,`signature`,`token`];function isSensitiveName(name){return SENSITIVE_NAMES.has(name)||SENSITIVE_TERMS.some(term=>name.includes(term))}function resolveUrlRedaction(option={}){if(option===!0||option===!1)return{fragment:option,redactsValue:()=>option};let allow=option.allow&&new Set(option.allow.map(name=>name.toLowerCase())),deny=new Set(option.deny?.map(name=>name.toLowerCase()));return{fragment:option.fragment??!1,redactsValue:name=>deny.has(name)||(allow?!allow.has(name):isSensitiveName(name))}}function decodeName(name){try{return decodeURIComponent(name).toLowerCase()}catch{return name.toLowerCase()}}function redactQuery(query,policy){return query.split(`&`).map(parameter=>{let separator=parameter.indexOf(`=`),name=separator===-1?parameter:parameter.slice(0,separator);return parameter&&policy.redactsValue(decodeName(name))?separator===-1?REDACTED:`${name}=${REDACTED}`:parameter}).join(`&`)}function redactCredentials(base){return base.replace(/^(?<scheme>[a-z][\d+.a-z-]*:\/\/)[^/@:]*:[^/@]*@/iu,`$<scheme>${REDACTED}:${REDACTED}@`).replace(/^(?<scheme>[a-z][\d+.a-z-]*:\/\/)[^/@:]*@/iu,`$<scheme>${REDACTED}@`)}function redactUrl(url,policy){let{base=``,fragment=``,query}=URL_PARTS_RE.exec(url)?.groups??{};return[redactCredentials(base),query===void 0?``:`?${redactQuery(query,policy)}`,policy.fragment?``:fragment].join(``)}function redactMessage(message,policy){return message.replaceAll(ABSOLUTE_URL_RE,url=>redactUrl(url,policy))}function redactSpanName(name,policy){return name.split(` `).map(token=>token.startsWith(`/`)||token.includes(`://`)?redactUrl(token,policy):token).join(` `)}const exceptionChainSchema=zod.z.array(zod.z.looseObject({stack:zod.z.string().optional(),value:zod.z.string().optional()}));function redactExceptionChain(chain,policy){try{let entries=exceptionChainSchema.parse(JSON.parse(chain));for(let entry of entries)if(entry.value!==void 0){let value=redactMessage(entry.value,policy);entry.stack=entry.stack?.replace(entry.value,value),entry.value=value}return JSON.stringify(entries)}catch{return chain}}function rewrite(attributes,key,redact){let value=attributes[key];typeof value==`string`?attributes[key]=redact(value):typeof value==`object`&&(attributes[key]=value.map(item=>typeof item==`string`?redact(item):item))}function redactAttributes(attributes,policy){for(let key of URL_ATTRIBUTE_KEYS)rewrite(attributes,key,url=>redactUrl(url,policy));rewrite(attributes,`url.query`,query=>redactQuery(query,policy)),policy.fragment&&delete attributes[`url.fragment`],rewrite(attributes,`exception.message`,message=>{let redacted=redactMessage(message,policy);return rewrite(attributes,`exception.stacktrace`,stack=>stack.replace(message,redacted)),redacted}),rewrite(attributes,`interfere.exception.chain`,chain=>redactExceptionChain(chain,policy)),rewrite(attributes,`interfere.exception.serialized`,serialized=>redactMessage(serialized,policy))}function redactSpan(span,policy){redactAttributes(span.attributes,policy);for(let event of span.events)event.attributes&&redactAttributes(event.attributes,policy)}function createUrlRedactionSpanProcessor(policy){return{async forceFlush(){await Promise.resolve()},onEnd(span){redactSpan(span,policy)},onEnding(span){span.updateName(redactSpanName(span.name,policy)),span.status.message!==void 0&&span.setStatus({...span.status,message:redactMessage(span.status.message,policy)}),redactSpan(span,policy)},onStart:()=>void 0,async shutdown(){await Promise.resolve()}}}exports.createUrlRedactionSpanProcessor=createUrlRedactionSpanProcessor,exports.redactUrl=redactUrl,exports.resolveUrlRedaction=resolveUrlRedaction;
@@ -0,0 +1,58 @@
1
+ //#region src/sdk/url-redaction.d.ts
2
+ /** Query parameters and fragments to redact in SDK telemetry. Parameter names match case-insensitively. */
3
+ export interface UrlRedactionOptions {
4
+ /**
5
+ * Parameters whose values are kept. Every other value becomes `REDACTED`,
6
+ * including the built-in sensitive names unless they are listed here.
7
+ */
8
+ allow?: string[];
9
+ /** Parameters whose values become `REDACTED` in addition to the built-in sensitive names. */
10
+ deny?: string[];
11
+ /** Remove fragments, including hash-router paths. Defaults to `false`. */
12
+ fragment?: boolean;
13
+ }
14
+ /**
15
+ * Omit to redact the values of built-in sensitive query parameters such as
16
+ * `token`, `password` and `sig`. `true` redacts every value and removes
17
+ * fragments. `false` keeps query values. URL credentials are always redacted.
18
+ */
19
+ export type UrlRedactionOption = boolean | UrlRedactionOptions;
20
+ export interface UrlRedactionPolicy {
21
+ readonly fragment: boolean;
22
+ readonly redactsValue: (name: string) => boolean;
23
+ }
24
+ type AttributeScalar = boolean | number | string;
25
+ type SpanAttributes = Record<string, AttributeScalar | readonly (AttributeScalar | null | undefined)[] | undefined>;
26
+ interface RedactableSpan {
27
+ attributes: SpanAttributes;
28
+ events: readonly {
29
+ attributes?: SpanAttributes | undefined;
30
+ name: string;
31
+ }[];
32
+ }
33
+ interface EndingSpan extends RedactableSpan {
34
+ name: string;
35
+ setStatus: (status: {
36
+ code: number;
37
+ message: string;
38
+ }) => void;
39
+ status: {
40
+ code: number;
41
+ message?: string;
42
+ };
43
+ updateName: (name: string) => void;
44
+ }
45
+ export declare function resolveUrlRedaction(option?: UrlRedactionOption): {
46
+ fragment: boolean;
47
+ redactsValue: (name: string) => boolean;
48
+ };
49
+ export declare function redactUrl(url: string, policy: UrlRedactionPolicy): string;
50
+ /** Redacts URL attributes, URL-bearing span names and absolute URLs in exception messages in `onEnding`, before any processor exports the span. */
51
+ export declare function createUrlRedactionSpanProcessor(policy: UrlRedactionPolicy): {
52
+ forceFlush(): Promise<void>;
53
+ onEnd(span: RedactableSpan): void;
54
+ onEnding(span: EndingSpan): void;
55
+ onStart: () => undefined;
56
+ shutdown(): Promise<void>;
57
+ };
58
+ //#endregion
@@ -0,0 +1,58 @@
1
+ //#region src/sdk/url-redaction.d.ts
2
+ /** Query parameters and fragments to redact in SDK telemetry. Parameter names match case-insensitively. */
3
+ export interface UrlRedactionOptions {
4
+ /**
5
+ * Parameters whose values are kept. Every other value becomes `REDACTED`,
6
+ * including the built-in sensitive names unless they are listed here.
7
+ */
8
+ allow?: string[];
9
+ /** Parameters whose values become `REDACTED` in addition to the built-in sensitive names. */
10
+ deny?: string[];
11
+ /** Remove fragments, including hash-router paths. Defaults to `false`. */
12
+ fragment?: boolean;
13
+ }
14
+ /**
15
+ * Omit to redact the values of built-in sensitive query parameters such as
16
+ * `token`, `password` and `sig`. `true` redacts every value and removes
17
+ * fragments. `false` keeps query values. URL credentials are always redacted.
18
+ */
19
+ export type UrlRedactionOption = boolean | UrlRedactionOptions;
20
+ export interface UrlRedactionPolicy {
21
+ readonly fragment: boolean;
22
+ readonly redactsValue: (name: string) => boolean;
23
+ }
24
+ type AttributeScalar = boolean | number | string;
25
+ type SpanAttributes = Record<string, AttributeScalar | readonly (AttributeScalar | null | undefined)[] | undefined>;
26
+ interface RedactableSpan {
27
+ attributes: SpanAttributes;
28
+ events: readonly {
29
+ attributes?: SpanAttributes | undefined;
30
+ name: string;
31
+ }[];
32
+ }
33
+ interface EndingSpan extends RedactableSpan {
34
+ name: string;
35
+ setStatus: (status: {
36
+ code: number;
37
+ message: string;
38
+ }) => void;
39
+ status: {
40
+ code: number;
41
+ message?: string;
42
+ };
43
+ updateName: (name: string) => void;
44
+ }
45
+ export declare function resolveUrlRedaction(option?: UrlRedactionOption): {
46
+ fragment: boolean;
47
+ redactsValue: (name: string) => boolean;
48
+ };
49
+ export declare function redactUrl(url: string, policy: UrlRedactionPolicy): string;
50
+ /** Redacts URL attributes, URL-bearing span names and absolute URLs in exception messages in `onEnding`, before any processor exports the span. */
51
+ export declare function createUrlRedactionSpanProcessor(policy: UrlRedactionPolicy): {
52
+ forceFlush(): Promise<void>;
53
+ onEnd(span: RedactableSpan): void;
54
+ onEnding(span: EndingSpan): void;
55
+ onStart: () => undefined;
56
+ shutdown(): Promise<void>;
57
+ };
58
+ //#endregion
@@ -0,0 +1 @@
1
+ import{z}from"zod";const URL_ATTRIBUTE_KEYS=[`http.referrer`,`http.request.header.referer`,`http.target`,`http.url`,`url.full`,`url.original`,`url.path`],URL_PARTS_RE=/^(?<base>[^?#]*)(?:\?(?<query>[^#]*))?(?<fragment>#.*)?$/su,ABSOLUTE_URL_RE=/https?:\/\/[^\s"'<>]+/giu,REDACTED=`REDACTED`,SENSITIVE_NAMES=new Set([`awsaccesskeyid`,`code`,`key`,`sig`]),SENSITIVE_TERMS=[`api_key`,`apikey`,`auth`,`credential`,`passwd`,`password`,`secret`,`session`,`signature`,`token`];function isSensitiveName(name){return SENSITIVE_NAMES.has(name)||SENSITIVE_TERMS.some(term=>name.includes(term))}function resolveUrlRedaction(option={}){if(option===!0||option===!1)return{fragment:option,redactsValue:()=>option};let allow=option.allow&&new Set(option.allow.map(name=>name.toLowerCase())),deny=new Set(option.deny?.map(name=>name.toLowerCase()));return{fragment:option.fragment??!1,redactsValue:name=>deny.has(name)||(allow?!allow.has(name):isSensitiveName(name))}}function decodeName(name){try{return decodeURIComponent(name).toLowerCase()}catch{return name.toLowerCase()}}function redactQuery(query,policy){return query.split(`&`).map(parameter=>{let separator=parameter.indexOf(`=`),name=separator===-1?parameter:parameter.slice(0,separator);return parameter&&policy.redactsValue(decodeName(name))?separator===-1?REDACTED:`${name}=${REDACTED}`:parameter}).join(`&`)}function redactCredentials(base){return base.replace(/^(?<scheme>[a-z][\d+.a-z-]*:\/\/)[^/@:]*:[^/@]*@/iu,`$<scheme>${REDACTED}:${REDACTED}@`).replace(/^(?<scheme>[a-z][\d+.a-z-]*:\/\/)[^/@:]*@/iu,`$<scheme>${REDACTED}@`)}function redactUrl(url,policy){let{base=``,fragment=``,query}=URL_PARTS_RE.exec(url)?.groups??{};return[redactCredentials(base),query===void 0?``:`?${redactQuery(query,policy)}`,policy.fragment?``:fragment].join(``)}function redactMessage(message,policy){return message.replaceAll(ABSOLUTE_URL_RE,url=>redactUrl(url,policy))}function redactSpanName(name,policy){return name.split(` `).map(token=>token.startsWith(`/`)||token.includes(`://`)?redactUrl(token,policy):token).join(` `)}const exceptionChainSchema=z.array(z.looseObject({stack:z.string().optional(),value:z.string().optional()}));function redactExceptionChain(chain,policy){try{let entries=exceptionChainSchema.parse(JSON.parse(chain));for(let entry of entries)if(entry.value!==void 0){let value=redactMessage(entry.value,policy);entry.stack=entry.stack?.replace(entry.value,value),entry.value=value}return JSON.stringify(entries)}catch{return chain}}function rewrite(attributes,key,redact){let value=attributes[key];typeof value==`string`?attributes[key]=redact(value):typeof value==`object`&&(attributes[key]=value.map(item=>typeof item==`string`?redact(item):item))}function redactAttributes(attributes,policy){for(let key of URL_ATTRIBUTE_KEYS)rewrite(attributes,key,url=>redactUrl(url,policy));rewrite(attributes,`url.query`,query=>redactQuery(query,policy)),policy.fragment&&delete attributes[`url.fragment`],rewrite(attributes,`exception.message`,message=>{let redacted=redactMessage(message,policy);return rewrite(attributes,`exception.stacktrace`,stack=>stack.replace(message,redacted)),redacted}),rewrite(attributes,`interfere.exception.chain`,chain=>redactExceptionChain(chain,policy)),rewrite(attributes,`interfere.exception.serialized`,serialized=>redactMessage(serialized,policy))}function redactSpan(span,policy){redactAttributes(span.attributes,policy);for(let event of span.events)event.attributes&&redactAttributes(event.attributes,policy)}function createUrlRedactionSpanProcessor(policy){return{async forceFlush(){await Promise.resolve()},onEnd(span){redactSpan(span,policy)},onEnding(span){span.updateName(redactSpanName(span.name,policy)),span.status.message!==void 0&&span.setStatus({...span.status,message:redactMessage(span.status.message,policy)}),redactSpan(span,policy)},onStart:()=>void 0,async shutdown(){await Promise.resolve()}}}export{createUrlRedactionSpanProcessor,redactUrl,resolveUrlRedaction};