@ogcio/o11y-sdk-react 0.4.0 → 0.6.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 (106) hide show
  1. package/dist/sdk-core/index.d.ts +2 -0
  2. package/dist/sdk-core/index.d.ts.map +1 -0
  3. package/dist/sdk-core/index.js +2 -0
  4. package/dist/sdk-core/index.js.map +1 -0
  5. package/dist/sdk-core/lib/index.d.ts +3 -0
  6. package/dist/sdk-core/lib/index.d.ts.map +1 -0
  7. package/dist/sdk-core/lib/index.js +3 -0
  8. package/dist/sdk-core/lib/index.js.map +1 -0
  9. package/dist/sdk-core/lib/redaction/basic-redactor.d.ts +8 -0
  10. package/dist/sdk-core/lib/redaction/basic-redactor.d.ts.map +1 -0
  11. package/dist/sdk-core/lib/redaction/basic-redactor.js +19 -0
  12. package/dist/sdk-core/lib/redaction/basic-redactor.js.map +1 -0
  13. package/dist/sdk-core/lib/redaction/email-redactor.d.ts +9 -0
  14. package/dist/sdk-core/lib/redaction/email-redactor.d.ts.map +1 -0
  15. package/dist/sdk-core/lib/redaction/email-redactor.js +18 -0
  16. package/dist/sdk-core/lib/redaction/email-redactor.js.map +1 -0
  17. package/dist/sdk-core/lib/redaction/index.d.ts +10 -0
  18. package/dist/sdk-core/lib/redaction/index.d.ts.map +1 -0
  19. package/dist/sdk-core/lib/redaction/index.js +5 -0
  20. package/dist/sdk-core/lib/redaction/index.js.map +1 -0
  21. package/dist/sdk-core/lib/redaction/ip-redactor.d.ts +10 -0
  22. package/dist/sdk-core/lib/redaction/ip-redactor.d.ts.map +1 -0
  23. package/dist/sdk-core/lib/redaction/ip-redactor.js +24 -0
  24. package/dist/sdk-core/lib/redaction/ip-redactor.js.map +1 -0
  25. package/dist/sdk-core/lib/redaction/ppsn-redactor.d.ts +9 -0
  26. package/dist/sdk-core/lib/redaction/ppsn-redactor.d.ts.map +1 -0
  27. package/dist/sdk-core/lib/redaction/ppsn-redactor.js +18 -0
  28. package/dist/sdk-core/lib/redaction/ppsn-redactor.js.map +1 -0
  29. package/dist/sdk-core/lib/utils/data-structures.d.ts +16 -0
  30. package/dist/sdk-core/lib/utils/data-structures.d.ts.map +1 -0
  31. package/dist/sdk-core/lib/utils/data-structures.js +58 -0
  32. package/dist/sdk-core/lib/utils/data-structures.js.map +1 -0
  33. package/dist/sdk-core/lib/utils/index.d.ts +3 -0
  34. package/dist/sdk-core/lib/utils/index.d.ts.map +1 -0
  35. package/dist/sdk-core/lib/utils/index.js +3 -0
  36. package/dist/sdk-core/lib/utils/index.js.map +1 -0
  37. package/dist/sdk-core/lib/utils/string-decoding.d.ts +8 -0
  38. package/dist/sdk-core/lib/utils/string-decoding.d.ts.map +1 -0
  39. package/dist/sdk-core/lib/utils/string-decoding.js +23 -0
  40. package/dist/sdk-core/lib/utils/string-decoding.js.map +1 -0
  41. package/dist/sdk-react/index.d.ts +7 -0
  42. package/dist/sdk-react/index.d.ts.map +1 -0
  43. package/dist/{index.js → sdk-react/index.js} +1 -0
  44. package/dist/sdk-react/index.js.map +1 -0
  45. package/dist/{lib → sdk-react/lib}/index.d.ts +12 -0
  46. package/dist/sdk-react/lib/index.d.ts.map +1 -0
  47. package/dist/sdk-react/lib/index.js +2 -0
  48. package/dist/sdk-react/lib/index.js.map +1 -0
  49. package/dist/{lib → sdk-react/lib}/instrumentation.faro.d.ts +1 -0
  50. package/dist/sdk-react/lib/instrumentation.faro.d.ts.map +1 -0
  51. package/dist/{lib → sdk-react/lib}/instrumentation.faro.js +7 -1
  52. package/dist/sdk-react/lib/instrumentation.faro.js.map +1 -0
  53. package/dist/sdk-react/lib/internals/hooks.d.ts +4 -0
  54. package/dist/sdk-react/lib/internals/hooks.d.ts.map +1 -0
  55. package/dist/sdk-react/lib/internals/hooks.js +8 -0
  56. package/dist/sdk-react/lib/internals/hooks.js.map +1 -0
  57. package/dist/sdk-react/lib/internals/redaction/redactors/email.d.ts +6 -0
  58. package/dist/sdk-react/lib/internals/redaction/redactors/email.d.ts.map +1 -0
  59. package/dist/sdk-react/lib/internals/redaction/redactors/email.js +22 -0
  60. package/dist/sdk-react/lib/internals/redaction/redactors/email.js.map +1 -0
  61. package/dist/sdk-react/lib/internals/redaction/redactors/index.d.ts +5 -0
  62. package/dist/sdk-react/lib/internals/redaction/redactors/index.d.ts.map +1 -0
  63. package/dist/sdk-react/lib/internals/redaction/redactors/index.js +9 -0
  64. package/dist/sdk-react/lib/internals/redaction/redactors/index.js.map +1 -0
  65. package/dist/sdk-react/lib/internals/redaction/redactors/ip.d.ts +6 -0
  66. package/dist/sdk-react/lib/internals/redaction/redactors/ip.d.ts.map +1 -0
  67. package/dist/sdk-react/lib/internals/redaction/redactors/ip.js +23 -0
  68. package/dist/sdk-react/lib/internals/redaction/redactors/ip.js.map +1 -0
  69. package/dist/sdk-react/lib/internals/redaction/redactors/ppsn.d.ts +8 -0
  70. package/dist/sdk-react/lib/internals/redaction/redactors/ppsn.d.ts.map +1 -0
  71. package/dist/sdk-react/lib/internals/redaction/redactors/ppsn.js +21 -0
  72. package/dist/sdk-react/lib/internals/redaction/redactors/ppsn.js.map +1 -0
  73. package/dist/{vitest.config.d.ts → sdk-react/vitest.config.d.ts} +1 -0
  74. package/dist/sdk-react/vitest.config.d.ts.map +1 -0
  75. package/dist/{vitest.config.js → sdk-react/vitest.config.js} +3 -2
  76. package/dist/sdk-react/vitest.config.js.map +1 -0
  77. package/package.json +13 -9
  78. package/CHANGELOG.md +0 -77
  79. package/dist/index.d.ts +0 -5
  80. package/dist/lib/index.js +0 -1
  81. package/dist/lib/internals/hooks.d.ts +0 -3
  82. package/dist/lib/internals/hooks.js +0 -34
  83. package/dist/lib/internals/redaction/pii-detection.d.ts +0 -19
  84. package/dist/lib/internals/redaction/pii-detection.js +0 -39
  85. package/dist/lib/internals/redaction/redactors/email.d.ts +0 -8
  86. package/dist/lib/internals/redaction/redactors/email.js +0 -55
  87. package/dist/lib/internals/redaction/redactors/index.d.ts +0 -4
  88. package/dist/lib/internals/redaction/redactors/index.js +0 -6
  89. package/dist/lib/internals/redaction/redactors/ip.d.ts +0 -10
  90. package/dist/lib/internals/redaction/redactors/ip.js +0 -61
  91. package/index.ts +0 -10
  92. package/lib/index.ts +0 -63
  93. package/lib/instrumentation.faro.ts +0 -102
  94. package/lib/internals/hooks.ts +0 -55
  95. package/lib/internals/redaction/pii-detection.ts +0 -52
  96. package/lib/internals/redaction/redactors/email.ts +0 -68
  97. package/lib/internals/redaction/redactors/index.ts +0 -12
  98. package/lib/internals/redaction/redactors/ip.ts +0 -78
  99. package/test/config.test.ts +0 -215
  100. package/test/lib/hooks.test.ts +0 -150
  101. package/test/lib/internals/redactors/email.test.ts +0 -81
  102. package/test/lib/internals/redactors/ip.test.ts +0 -86
  103. package/test/lib/pii-detection.test.ts +0 -79
  104. package/test/validation.test.ts +0 -65
  105. package/tsconfig.json +0 -14
  106. package/vitest.config.ts +0 -26
@@ -0,0 +1,2 @@
1
+ export * from "./lib/index.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../sdk-core/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./lib/index.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../sdk-core/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./redaction/index.js";
2
+ export * from "./utils/index.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../sdk-core/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./redaction/index.js";
2
+ export * from "./utils/index.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../sdk-core/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { StringKind, RedactionResult } from "./index.js";
2
+ export declare abstract class BasicRedactor {
3
+ constructor();
4
+ process(value: string, source: string, kind: StringKind): string;
5
+ protected redact(_value: string, _source: string, _kind: StringKind): RedactionResult<Record<string, unknown>>;
6
+ protected exportMetrics(_context: RedactionResult<Record<string, unknown>>["context"], _source: string, _kind: StringKind): void;
7
+ }
8
+ //# sourceMappingURL=basic-redactor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basic-redactor.d.ts","sourceRoot":"","sources":["../../../../../sdk-core/lib/redaction/basic-redactor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE9D,8BAAsB,aAAa;;IAG1B,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM;IAMvE,SAAS,CAAC,MAAM,CACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,UAAU,GAChB,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAQ3C,SAAS,CAAC,aAAa,CACrB,QAAQ,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,EAC7D,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,UAAU,GAChB,IAAI;CAGR"}
@@ -0,0 +1,19 @@
1
+ export class BasicRedactor {
2
+ constructor() { }
3
+ process(value, source, kind) {
4
+ const { redactedValue, context } = this.redact(value, source, kind);
5
+ this.exportMetrics(context, source, kind);
6
+ return redactedValue;
7
+ }
8
+ redact(_value, _source, _kind) {
9
+ // no-op by default
10
+ return {
11
+ redactedValue: _value,
12
+ context: {},
13
+ };
14
+ }
15
+ exportMetrics(_context, _source, _kind) {
16
+ // no-op by default
17
+ }
18
+ }
19
+ //# sourceMappingURL=basic-redactor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basic-redactor.js","sourceRoot":"","sources":["../../../../../sdk-core/lib/redaction/basic-redactor.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,aAAa;IACjC,gBAAsB,CAAC;IAEhB,OAAO,CAAC,KAAa,EAAE,MAAc,EAAE,IAAgB;QAC5D,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QACpE,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC1C,OAAO,aAAa,CAAC;IACvB,CAAC;IAES,MAAM,CACd,MAAc,EACd,OAAe,EACf,KAAiB;QAEjB,mBAAmB;QACnB,OAAO;YACL,aAAa,EAAE,MAAM;YACrB,OAAO,EAAE,EAAE;SACZ,CAAC;IACJ,CAAC;IAES,aAAa,CACrB,QAA6D,EAC7D,OAAe,EACf,KAAiB;QAEjB,mBAAmB;IACrB,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import { BasicRedactor } from "./basic-redactor.js";
2
+ import type { RedactionResult } from "./index.js";
3
+ export declare class EmailRedactor extends BasicRedactor {
4
+ private static readonly EMAIL_REGEX;
5
+ protected redact(value: string): RedactionResult<{
6
+ domains: Record<string, number>;
7
+ }>;
8
+ }
9
+ //# sourceMappingURL=email-redactor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-redactor.d.ts","sourceRoot":"","sources":["../../../../../sdk-core/lib/redaction/email-redactor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,qBAAa,aAAc,SAAQ,aAAa;IAC9C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAC0B;IAE7D,SAAS,CAAC,MAAM,CACd,KAAK,EAAE,MAAM,GACZ,eAAe,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;CAkBxD"}
@@ -0,0 +1,18 @@
1
+ import { BasicRedactor } from "./basic-redactor.js";
2
+ export class EmailRedactor extends BasicRedactor {
3
+ static EMAIL_REGEX = /[\p{L}\p{N}._%+-]+@((?:[\p{L}\p{N}-]+\.)+[\p{L}]{2,})/giu;
4
+ redact(value) {
5
+ const domains = {};
6
+ const redactedValue = value.replace(EmailRedactor.EMAIL_REGEX, (_, domain) => {
7
+ domains[domain] = (domains[domain] || 0) + 1;
8
+ return "[REDACTED EMAIL]";
9
+ });
10
+ return {
11
+ redactedValue: redactedValue,
12
+ context: {
13
+ domains,
14
+ },
15
+ };
16
+ }
17
+ }
18
+ //# sourceMappingURL=email-redactor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-redactor.js","sourceRoot":"","sources":["../../../../../sdk-core/lib/redaction/email-redactor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,MAAM,OAAO,aAAc,SAAQ,aAAa;IACtC,MAAM,CAAU,WAAW,GACjC,0DAA0D,CAAC;IAEnD,MAAM,CACd,KAAa;QAEb,MAAM,OAAO,GAA2B,EAAE,CAAC;QAE3C,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CACjC,aAAa,CAAC,WAAW,EACzB,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;YACZ,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YAC7C,OAAO,kBAAkB,CAAC;QAC5B,CAAC,CACF,CAAC;QAEF,OAAO;YACL,aAAa,EAAE,aAAa;YAC5B,OAAO,EAAE;gBACP,OAAO;aACR;SACF,CAAC;IACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ export interface RedactionResult<T extends Record<string, unknown>> {
2
+ redactedValue: string;
3
+ context: T;
4
+ }
5
+ export type StringKind = "string" | "url";
6
+ export { BasicRedactor } from "./basic-redactor.js";
7
+ export { EmailRedactor } from "./email-redactor.js";
8
+ export { IpRedactor } from "./ip-redactor.js";
9
+ export { PpsnRedactor } from "./ppsn-redactor.js";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../sdk-core/lib/redaction/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAChE,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,CAAC,CAAC;CACZ;AAED,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { BasicRedactor } from "./basic-redactor.js";
2
+ export { EmailRedactor } from "./email-redactor.js";
3
+ export { IpRedactor } from "./ip-redactor.js";
4
+ export { PpsnRedactor } from "./ppsn-redactor.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../sdk-core/lib/redaction/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { BasicRedactor } from "./basic-redactor.js";
2
+ import type { RedactionResult } from "./index.js";
3
+ export declare class IpRedactor extends BasicRedactor {
4
+ private static readonly IPV4_REGEX;
5
+ private static readonly IPV6_REGEX;
6
+ protected redact(value: string): RedactionResult<{
7
+ counters: Record<string, number>;
8
+ }>;
9
+ }
10
+ //# sourceMappingURL=ip-redactor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ip-redactor.d.ts","sourceRoot":"","sources":["../../../../../sdk-core/lib/redaction/ip-redactor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,qBAAa,UAAW,SAAQ,aAAa;IAC3C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAC6G;IAC/I,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAC6jB;IAE/lB,SAAS,CAAC,MAAM,CACd,KAAK,EAAE,MAAM,GACZ,eAAe,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;CAoBzD"}
@@ -0,0 +1,24 @@
1
+ import { BasicRedactor } from "./basic-redactor.js";
2
+ export class IpRedactor extends BasicRedactor {
3
+ static IPV4_REGEX = /(?<!\d)(?:%[0-9A-Fa-f]{2})?(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}(?:%[0-9A-Fa-f]{2})?(?!\d)/gi;
4
+ static IPV6_REGEX = /(?<![0-9a-f:])(?:%[0-9A-Fa-f]{2})?((?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|:(?::[0-9A-Fa-f]{1,4}){1,7}|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,5}(?::[0-9A-Fa-f]{1,4}){1,2}|(?:[0-9A-Fa-f]{1,4}:){1,4}(?::[0-9A-Fa-f]{1,4}){1,3}|(?:[0-9A-Fa-f]{1,4}:){1,3}(?::[0-9A-Fa-f]{1,4}){1,4}|(?:[0-9A-Fa-f]{1,4}:){1,2}(?::[0-9A-Fa-f]{1,4}){1,5}|[0-9A-Fa-f]{1,4}:(?::[0-9A-Fa-f]{1,4}){1,6}|:(?::[0-9A-Fa-f]{1,4}){1,7}:?|(?:[0-9A-Fa-f]{1,4}:){1,4}:(?:25[0-5]|2[0-4]\d|1\d\d|\d{1,2})(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|\d{1,2})){3})(?:%[0-9A-Fa-f]{2})?(?![0-9a-f:])/gi;
5
+ redact(value) {
6
+ const counters = {};
7
+ const redactedValue = value
8
+ .replace(IpRedactor.IPV4_REGEX, () => {
9
+ counters["IPv4"] = (counters["IPv4"] || 0) + 1;
10
+ return "[REDACTED IPV4]";
11
+ })
12
+ .replace(IpRedactor.IPV6_REGEX, () => {
13
+ counters["IPv6"] = (counters["IPv6"] || 0) + 1;
14
+ return "[REDACTED IPV6]";
15
+ });
16
+ return {
17
+ redactedValue: redactedValue,
18
+ context: {
19
+ counters,
20
+ },
21
+ };
22
+ }
23
+ }
24
+ //# sourceMappingURL=ip-redactor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ip-redactor.js","sourceRoot":"","sources":["../../../../../sdk-core/lib/redaction/ip-redactor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,MAAM,OAAO,UAAW,SAAQ,aAAa;IACnC,MAAM,CAAU,UAAU,GAChC,4IAA4I,CAAC;IACvI,MAAM,CAAU,UAAU,GAChC,4lBAA4lB,CAAC;IAErlB,MAAM,CACd,KAAa;QAEb,MAAM,QAAQ,GAA2B,EAAE,CAAC;QAE5C,MAAM,aAAa,GAAG,KAAK;aACxB,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,EAAE;YACnC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YAC/C,OAAO,iBAAiB,CAAC;QAC3B,CAAC,CAAC;aACD,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,EAAE;YACnC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YAC/C,OAAO,iBAAiB,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEL,OAAO;YACL,aAAa,EAAE,aAAa;YAC5B,OAAO,EAAE;gBACP,QAAQ;aACT;SACF,CAAC;IACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { BasicRedactor } from "./basic-redactor.js";
2
+ import type { RedactionResult } from "./index.js";
3
+ export declare class PpsnRedactor extends BasicRedactor {
4
+ private static readonly PPSN_REGEX;
5
+ protected redact(value: string): RedactionResult<{
6
+ redactedCounter: number;
7
+ }>;
8
+ }
9
+ //# sourceMappingURL=ppsn-redactor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ppsn-redactor.d.ts","sourceRoot":"","sources":["../../../../../sdk-core/lib/redaction/ppsn-redactor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,qBAAa,YAAa,SAAQ,aAAa;IAC7C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAC0B;IAE5D,SAAS,CAAC,MAAM,CACd,KAAK,EAAE,MAAM,GACZ,eAAe,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC;CAehD"}
@@ -0,0 +1,18 @@
1
+ import { BasicRedactor } from "./basic-redactor.js";
2
+ export class PpsnRedactor extends BasicRedactor {
3
+ static PPSN_REGEX = /(?<!([0-9]|[a-z]))[0-9]{7}[a-z]{1,2}(?!([0-9]|[a-z]))/gi;
4
+ redact(value) {
5
+ let redactedCounter = 0;
6
+ const redactedValue = value.replace(PpsnRedactor.PPSN_REGEX, (_) => {
7
+ redactedCounter++;
8
+ return "[REDACTED PPSN]";
9
+ });
10
+ return {
11
+ redactedValue: redactedValue,
12
+ context: {
13
+ redactedCounter,
14
+ },
15
+ };
16
+ }
17
+ }
18
+ //# sourceMappingURL=ppsn-redactor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ppsn-redactor.js","sourceRoot":"","sources":["../../../../../sdk-core/lib/redaction/ppsn-redactor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,MAAM,OAAO,YAAa,SAAQ,aAAa;IACrC,MAAM,CAAU,UAAU,GAChC,yDAAyD,CAAC;IAElD,MAAM,CACd,KAAa;QAEb,IAAI,eAAe,GAAG,CAAC,CAAC;QAExB,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE;YACjE,eAAe,EAAE,CAAC;YAClB,OAAO,iBAAiB,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,aAAa,EAAE,aAAa;YAC5B,OAAO,EAAE;gBACP,eAAe;aAChB;SACF,CAAC;IACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { AnyValue } from "@opentelemetry/api-logs";
2
+ import { BasicRedactor } from "../redaction/index.js";
3
+ /**
4
+ * Cleans a string by redacting configured PIIs and emitting metrics for redacted values.
5
+ *
6
+ * If the string is URL-encoded, it will be decoded before redaction.
7
+ *
8
+ * @param {string} value - The input value to sanitize.
9
+ * @param {string} source - The source context of the input, used in metrics.
10
+ * @param {BasicRedactor[]} redactors - The string redactors containing the redaction logic.
11
+ *
12
+ * @returns {string} The cleaned string with any configured PII replaced by `[REDACTED PII_TYPE]`.
13
+ */
14
+ export declare function _cleanStringPII<T extends string>(value: string, source: T, redactors: BasicRedactor[]): string;
15
+ export declare function _recursiveObjectClean<T extends AnyValue, R extends string>(value: T, source: R, redactors: BasicRedactor[]): T;
16
+ //# sourceMappingURL=data-structures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-structures.d.ts","sourceRoot":"","sources":["../../../../../sdk-core/lib/utils/data-structures.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAe,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAKtD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAC9C,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,CAAC,EACT,SAAS,EAAE,aAAa,EAAE,GACzB,MAAM,CAkBR;AAED,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,MAAM,EACxE,KAAK,EAAE,CAAC,EACR,MAAM,EAAE,CAAC,EACT,SAAS,EAAE,aAAa,EAAE,GACzB,CAAC,CAsCH"}
@@ -0,0 +1,58 @@
1
+ import { _containsEncodedComponents } from "./string-decoding.js";
2
+ const decoder = new TextDecoder();
3
+ const encoder = new TextEncoder();
4
+ /**
5
+ * Cleans a string by redacting configured PIIs and emitting metrics for redacted values.
6
+ *
7
+ * If the string is URL-encoded, it will be decoded before redaction.
8
+ *
9
+ * @param {string} value - The input value to sanitize.
10
+ * @param {string} source - The source context of the input, used in metrics.
11
+ * @param {BasicRedactor[]} redactors - The string redactors containing the redaction logic.
12
+ *
13
+ * @returns {string} The cleaned string with any configured PII replaced by `[REDACTED PII_TYPE]`.
14
+ */
15
+ export function _cleanStringPII(value, source, redactors) {
16
+ if (typeof value !== "string") {
17
+ return value;
18
+ }
19
+ let kind = "string";
20
+ let decodedValue = value;
21
+ if (_containsEncodedComponents(value)) {
22
+ decodedValue = decodeURIComponent(value);
23
+ kind = "url";
24
+ }
25
+ return redactors.reduce((redactedValue, currentRedactor) => currentRedactor.process(redactedValue, source, kind), decodedValue);
26
+ }
27
+ export function _recursiveObjectClean(value, source, redactors) {
28
+ if (typeof value === "string") {
29
+ return _cleanStringPII(value, source, redactors);
30
+ }
31
+ if (typeof value === "number" ||
32
+ typeof value === "boolean" ||
33
+ value == null) {
34
+ return value;
35
+ }
36
+ if (value instanceof Uint8Array) {
37
+ try {
38
+ const decoded = decoder.decode(value);
39
+ const sanitized = _cleanStringPII(decoded, source, redactors);
40
+ return encoder.encode(sanitized);
41
+ }
42
+ catch {
43
+ return value;
44
+ }
45
+ }
46
+ if (Array.isArray(value)) {
47
+ return value.map((value) => _recursiveObjectClean(value, source, redactors));
48
+ }
49
+ if (typeof value === "object") {
50
+ const sanitized = {};
51
+ for (const [key, val] of Object.entries(value)) {
52
+ sanitized[key] = _recursiveObjectClean(val, source, redactors);
53
+ }
54
+ return sanitized;
55
+ }
56
+ return value;
57
+ }
58
+ //# sourceMappingURL=data-structures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-structures.js","sourceRoot":"","sources":["../../../../../sdk-core/lib/utils/data-structures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAIlE,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAClC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAC7B,KAAa,EACb,MAAS,EACT,SAA0B;IAE1B,IAAI,OAAO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AE,CACzB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAC3C,CAAC;IACT,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,SAAS,GAAgB,EAAE,CAAC;QAClC,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/C,SAAS,CAAC,GAAG,CAAC,GAAG,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,SAAc,CAAC;IACxB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { _cleanStringPII, _recursiveObjectClean } from "./data-structures.js";
2
+ export { _containsEncodedComponents } from "./string-decoding.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../sdk-core/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { _cleanStringPII, _recursiveObjectClean } from "./data-structures.js";
2
+ export { _containsEncodedComponents } from "./string-decoding.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../sdk-core/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Checks whether a string contains URI-encoded components.
3
+ *
4
+ * @param {string} value - The string to inspect.
5
+ * @returns {boolean} `true` if the string is encoded, `false` otherwise.
6
+ */
7
+ export declare function _containsEncodedComponents(value: string): boolean;
8
+ //# sourceMappingURL=string-decoding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-decoding.d.ts","sourceRoot":"","sources":["../../../../../sdk-core/lib/utils/string-decoding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAkBjE"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Checks whether a string contains URI-encoded components.
3
+ *
4
+ * @param {string} value - The string to inspect.
5
+ * @returns {boolean} `true` if the string is encoded, `false` otherwise.
6
+ */
7
+ export function _containsEncodedComponents(value) {
8
+ try {
9
+ const decodedURIComponent = decodeURIComponent(value);
10
+ if (decodeURI(value) !== decodedURIComponent) {
11
+ return true;
12
+ }
13
+ if (value !== decodedURIComponent) {
14
+ return (encodeURIComponent(decodedURIComponent) === value ||
15
+ encodeURI(decodedURIComponent) === value);
16
+ }
17
+ }
18
+ catch {
19
+ return false;
20
+ }
21
+ return false;
22
+ }
23
+ //# sourceMappingURL=string-decoding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-decoding.js","sourceRoot":"","sources":["../../../../../sdk-core/lib/utils/string-decoding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,KAAa;IACtD,IAAI,CAAC;QACH,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACtD,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,mBAAmB,EAAE,CAAC;YAC7C,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,KAAK,KAAK,mBAAmB,EAAE,CAAC;YAClC,OAAO,CACL,kBAAkB,CAAC,mBAAmB,CAAC,KAAK,KAAK;gBACjD,SAAS,CAAC,mBAAmB,CAAC,KAAK,KAAK,CACzC,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type Faro, withFaroErrorBoundary, withFaroProfiler } from "@grafana/faro-react";
2
+ import buildFaroInstrumentation from "./lib/instrumentation.faro.js";
3
+ export * from "./lib/index.js";
4
+ export { withFaroErrorBoundary, withFaroProfiler };
5
+ export type { Faro };
6
+ export { buildFaroInstrumentation as instrumentFaro };
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EACT,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AAErE,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,CAAC;AACnD,YAAY,EAAE,IAAI,EAAE,CAAC;AACrB,OAAO,EAAE,wBAAwB,IAAI,cAAc,EAAE,CAAC"}
@@ -3,3 +3,4 @@ import buildFaroInstrumentation from "./lib/instrumentation.faro.js";
3
3
  export * from "./lib/index.js";
4
4
  export { withFaroErrorBoundary, withFaroProfiler };
5
5
  export { buildFaroInstrumentation as instrumentFaro };
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AAErE,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,CAAC;AAEnD,OAAO,EAAE,wBAAwB,IAAI,cAAc,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { BasicRedactor } from "../../sdk-core/lib/redaction/basic-redactor.js";
1
2
  interface SDKConfig {
2
3
  /**
3
4
  * The opentelemetry collector entrypoint GRPC url.
@@ -47,8 +48,19 @@ export interface FaroSDKConfig extends SDKConfig {
47
48
  * @default true
48
49
  */
49
50
  ip?: boolean;
51
+ /**
52
+ * Redact ppsn (personal public service number)
53
+ * @default true
54
+ */
55
+ ppsn?: boolean;
56
+ /**
57
+ * Custom redactors to be added together with the default ones
58
+ * @default []
59
+ */
60
+ custom?: BasicRedactor[];
50
61
  };
51
62
  }
52
63
  export type SDKCollectorMode = "single" | "batch";
53
64
  export type SDKLogLevel = "NONE" | "ERROR" | "WARN" | "INFO" | "DEBUG" | "VERBOSE" | "ALL";
54
65
  export {};
66
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAE/E,UAAU,SAAS;IACjB;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,gBAAgB,CAAC;CAClC;AAED,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE;QACV;;;WAGG;QACH,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB;;;WAGG;QACH,EAAE,CAAC,EAAE,OAAO,CAAC;QACb;;;WAGG;QACH,IAAI,CAAC,EAAE,OAAO,CAAC;QACf;;;WAGG;QACH,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;KAC1B,CAAC;CACH;AAED,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElD,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GACN,OAAO,GACP,SAAS,GACT,KAAK,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/index.ts"],"names":[],"mappings":""}
@@ -1,3 +1,4 @@
1
1
  import { type Faro } from "@grafana/faro-react";
2
2
  import type { FaroSDKConfig } from "./index.js";
3
3
  export default function buildFaroInstrumentation(config?: FaroSDKConfig): Faro | undefined;
4
+ //# sourceMappingURL=instrumentation.faro.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentation.faro.d.ts","sourceRoot":"","sources":["../../../lib/instrumentation.faro.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,qBAAqB,CAAC;AAO7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAQhD,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,MAAM,CAAC,EAAE,aAAa,GACrB,IAAI,GAAG,SAAS,CA8ElB"}
@@ -7,6 +7,7 @@ import { FetchInstrumentation } from "@opentelemetry/instrumentation-fetch";
7
7
  import { UserInteractionInstrumentation } from "@opentelemetry/instrumentation-user-interaction";
8
8
  import { _beforeSend } from "./internals/hooks.js";
9
9
  import { redactors, } from "./internals/redaction/redactors/index.js";
10
+ import { BasicRedactor } from "../../sdk-core/lib/redaction/basic-redactor.js";
10
11
  export default function buildFaroInstrumentation(config) {
11
12
  if (!config) {
12
13
  console.warn("observability config not set. Skipping Faro OpenTelemetry instrumentation.");
@@ -20,11 +21,15 @@ export default function buildFaroInstrumentation(config) {
20
21
  console.error("collectorUrl does not use a valid format. Skipping Faro OpenTelemetry instrumentation.");
21
22
  return;
22
23
  }
23
- const redactorsChain = Object.entries(redactors)
24
+ const defaultRedactors = Object.entries(redactors)
24
25
  .filter(([key]) => {
25
26
  return config.detection?.[key] !== false;
26
27
  })
27
28
  .map(([_, value]) => value);
29
+ const customRedactors = config.detection?.custom?.length
30
+ ? (config.detection?.custom.filter((redactor) => redactor instanceof BasicRedactor) ?? [])
31
+ : [];
32
+ const redactorsChain = [...defaultRedactors, ...customRedactors];
28
33
  try {
29
34
  diag.setLogger(new DiagConsoleLogger(), config.diagLogLevel
30
35
  ? DiagLogLevel[config.diagLogLevel]
@@ -75,3 +80,4 @@ function isUrl(url) {
75
80
  return false;
76
81
  }
77
82
  }
83
+ //# sourceMappingURL=instrumentation.faro.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentation.faro.js","sourceRoot":"","sources":["../../../lib/instrumentation.faro.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,wBAAwB,GAEzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,8BAA8B,EAAE,MAAM,iDAAiD,CAAC;AAEjG,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAEL,SAAS,GACV,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAE/E,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,MAAsB;IAEtB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,CACV,4EAA4E,CAC7E,CAAC;Q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dk";
2
+ import { BasicRedactor } from "../../../sdk-core/index.js";
3
+ export declare const _beforeSend: (redactors: BasicRedactor[]) => <T extends TransportItem<APIEvent>>(item: T) => T | null;
4
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../lib/internals/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAEL,aAAa,EACd,MAAM,4BAA4B,CAAC;AAEpC,eAAO,MAAM,WAAW,GACrB,WAAW,aAAa,EAAE,MAC1B,CAAC,SAAS,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,KAAG,CAAC,GAAG,IAKjD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { _recursiveObjectClean, } from "../../../sdk-core/index.js";
2
+ export const _beforeSend = (redactors) => (item) => {
3
+ if (redactors.length === 0) {
4
+ return item;
5
+ }
6
+ return _recursiveObjectClean(item, item.type, redactors);
7
+ };
8
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../../lib/internals/hooks.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,GAEtB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,CAAC,MAAM,WAAW,GACtB,CAAC,SAA0B,EAAE,EAAE,CAC/B,CAAoC,IAAO,EAAY,EAAE;IACvD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,qBAAqB,CAAQ,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAClE,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { EmailRedactor, type StringKind } from "../../../../../sdk-core/index.js";
2
+ import type { TransportItemType } from "@grafana/faro-core";
3
+ export declare class EmailRedactorWithMetrics extends EmailRedactor {
4
+ protected exportMetrics(context: ReturnType<typeof this.redact>["context"], source: TransportItemType, kind: StringKind): void;
5
+ }
6
+ //# sourceMappingURL=email.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/email.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,KAAK,UAAU,EAChB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,qBAAa,wBAAyB,SAAQ,aAAa;IACzD,SAAS,CAAC,aAAa,CACrB,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EAClD,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAE,UAAU,GACf,IAAI;CAoBR"}
@@ -0,0 +1,22 @@
1
+ import { faro } from "@grafana/faro-web-sdk";
2
+ import { EmailRedactor, } from "../../../../../sdk-core/index.js";
3
+ export class EmailRedactorWithMetrics extends EmailRedactor {
4
+ exportMetrics(context, source, kind) {
5
+ for (const [domain, domainCount] of Object.entries(context.domains)) {
6
+ faro.api.pushMeasurement({
7
+ type: "faro_o11y_pii_redaction",
8
+ values: {
9
+ redacted: domainCount,
10
+ },
11
+ }, {
12
+ context: {
13
+ pii_type: "email",
14
+ redaction_source: source,
15
+ pii_email_domain: domain,
16
+ pii_format: kind,
17
+ },
18
+ });
19
+ }
20
+ }
21
+ }
22
+ //# sourceMappingURL=email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.js","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/email.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EACL,aAAa,GAEd,MAAM,kCAAkC,CAAC;AAG1C,MAAM,OAAO,wBAAyB,SAAQ,aAAa;IAC/C,aAAa,CACrB,OAAkD,EAClD,MAAyB,EACzB,IAAgB;QAEhB,KAAK,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACpE,IAAI,CAAC,GAAG,CAAC,eAAe,CACtB;gBACE,IAAI,EAAE,yBAAyB;gBAC/B,MAAM,EAAE;oBACN,QAAQ,EAAE,WAAW;iBACtB;aACF,EACD;gBACE,OAAO,EAAE;oBACP,QAAQ,EAAE,OAAO;oBACjB,gBAAgB,EAAE,MAAM;oBACxB,gBAAgB,EAAE,MAAM;oBACxB,UAAU,EAAE,IAAI;iBACjB;aACF,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import { type FaroSDKConfig } from "../../../index.js";
2
+ import { BasicRedactor } from "../../../../../sdk-core/index.js";
3
+ export type RedactorKeys = keyof Omit<NonNullable<FaroSDKConfig["detection"]>, "custom">;
4
+ export declare const redactors: Record<RedactorKeys, BasicRedactor>;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAGjE,MAAM,MAAM,YAAY,GAAG,MAAM,IAAI,CACnC,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,EACvC,QAAQ,CACT,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,YAAY,EAAE,aAAa,CAIzD,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { EmailRedactorWithMetrics } from "./email.js";
2
+ import { IpRedactorWithMetrics } from "./ip.js";
3
+ import { PpsnRedactorWithMetrics } from "./ppsn.js";
4
+ export const redactors = {
5
+ email: new EmailRedactorWithMetrics(),
6
+ ip: new IpRedactorWithMetrics(),
7
+ ppsn: new PpsnRedactorWithMetrics(),
8
+ };
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAOpD,MAAM,CAAC,MAAM,SAAS,GAAwC;IAC5D,KAAK,EAAE,IAAI,wBAAwB,EAAE;IACrC,EAAE,EAAE,IAAI,qBAAqB,EAAE;IAC/B,IAAI,EAAE,IAAI,uBAAuB,EAAE;CACpC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { IpRedactor, type StringKind } from "../../../../../sdk-core/index.js";
2
+ import type { TransportItemType } from "@grafana/faro-core";
3
+ export declare class IpRedactorWithMetrics extends IpRedactor {
4
+ protected exportMetrics(context: ReturnType<typeof this.redact>["context"], source: TransportItemType, kind: StringKind): void;
5
+ }
6
+ //# sourceMappingURL=ip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ip.d.ts","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/ip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,qBAAa,qBAAsB,SAAQ,UAAU;IACnD,SAAS,CAAC,aAAa,CACrB,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EAClD,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAE,UAAU,GACf,IAAI;CAqBR"}
@@ -0,0 +1,23 @@
1
+ import { faro } from "@grafana/faro-web-sdk";
2
+ import { IpRedactor } from "../../../../../sdk-core/index.js";
3
+ export class IpRedactorWithMetrics extends IpRedactor {
4
+ exportMetrics(context, source, kind) {
5
+ Object.entries(context.counters).forEach(([type, counter]) => {
6
+ if (counter > 0) {
7
+ faro.api.pushMeasurement({
8
+ type: "faro_o11y_pii_redaction",
9
+ values: {
10
+ redacted: counter,
11
+ },
12
+ }, {
13
+ context: {
14
+ pii_type: type,
15
+ redaction_source: source,
16
+ pii_format: kind,
17
+ },
18
+ });
19
+ }
20
+ });
21
+ }
22
+ }
23
+ //# sourceMappingURL=ip.js.map