@autter/runtime-node 1.7.0 → 1.8.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.
@@ -2,7 +2,7 @@ import {
2
2
  noteCompatFeature,
3
3
  observeIngesterResponse,
4
4
  sharedSlot
5
- } from "./chunk-LG52CW3V.js";
5
+ } from "./chunk-B5ZMOCEM.js";
6
6
 
7
7
  // ../runtime-core/dist/index.js
8
8
  var SENSITIVE_KEY_PATTERNS = [
@@ -974,6 +974,43 @@ function splitFingerprint(attributes) {
974
974
  const { fingerprint, ...rest } = attributes;
975
975
  return { attributes: rest, fingerprint };
976
976
  }
977
+ function testPattern(pattern, type, message) {
978
+ if (typeof pattern === "string") {
979
+ return pattern !== "" && (message.includes(pattern) || type.includes(pattern));
980
+ }
981
+ if (!(pattern instanceof RegExp)) return false;
982
+ const re = pattern.global || pattern.sticky ? new RegExp(pattern.source, pattern.flags.replace(/[gy]/g, "")) : pattern;
983
+ return re.test(message) || type !== "" && (re.test(type) || re.test(`${type}: ${message}`));
984
+ }
985
+ function isIgnoredError(patterns, type, message) {
986
+ if (!patterns?.length) return false;
987
+ for (const pattern of patterns) {
988
+ try {
989
+ if (testPattern(pattern, type, message)) return true;
990
+ } catch {
991
+ }
992
+ }
993
+ return false;
994
+ }
995
+ function effectiveSampleRate(rate) {
996
+ return typeof rate === "number" && Number.isFinite(rate) && rate >= 0 && rate < 1 ? rate : null;
997
+ }
998
+ function createErrorFilter(options = {}, random = Math.random) {
999
+ const patterns = Array.isArray(options.ignoreErrors) ? options.ignoreErrors.slice() : [];
1000
+ const rate = effectiveSampleRate(options.sampleRate);
1001
+ if (!patterns.length && rate === null) return () => true;
1002
+ return (input) => {
1003
+ try {
1004
+ if (isIgnoredError(patterns, input.type ?? "", input.message ?? "")) return false;
1005
+ if (rate === null || input.crash) return true;
1006
+ const severity = input.severity ?? "error";
1007
+ if (severity !== "error") return true;
1008
+ return random() < rate;
1009
+ } catch {
1010
+ return true;
1011
+ }
1012
+ };
1013
+ }
977
1014
 
978
1015
  // src/breadcrumbs.ts
979
1016
  import { trace as trace2 } from "@opentelemetry/api";
@@ -1924,6 +1961,7 @@ export {
1924
1961
  fingerprintValues,
1925
1962
  fingerprintEventAttributes,
1926
1963
  splitFingerprint,
1964
+ createErrorFilter,
1927
1965
  addBreadcrumb,
1928
1966
  breadcrumbEventAttributes,
1929
1967
  otlpSink,
@@ -5,7 +5,7 @@ import {
5
5
  evaluateCompat,
6
6
  fetchIngesterCompat,
7
7
  versionAtLeast
8
- } from "./chunk-LG52CW3V.js";
8
+ } from "./chunk-B5ZMOCEM.js";
9
9
 
10
10
  // src/doctor.ts
11
11
  import { existsSync, readFileSync } from "fs";
package/dist/cli.cjs CHANGED
@@ -4,8 +4,8 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkHKVFURYTcjs = require('./chunk-HKVFURYT.cjs');
8
- require('./chunk-GYTQLITW.cjs');
7
+ var _chunk7H3FCV4Pcjs = require('./chunk-7H3FCV4P.cjs');
8
+ require('./chunk-MOZOUEMA.cjs');
9
9
 
10
10
  // src/cli.ts
11
11
  var _child_process = require('child_process');
@@ -31,22 +31,22 @@ async function main(argv) {
31
31
  return 64;
32
32
  }
33
33
  if (command !== "doctor") {
34
- console.log(_chunkHKVFURYTcjs.DOCTOR_USAGE);
34
+ console.log(_chunk7H3FCV4Pcjs.DOCTOR_USAGE);
35
35
  return command === void 0 || command === "--help" || command === "-h" ? 0 : 64;
36
36
  }
37
- const parsed = _chunkHKVFURYTcjs.parseDoctorArgs.call(void 0, rest);
37
+ const parsed = _chunk7H3FCV4Pcjs.parseDoctorArgs.call(void 0, rest);
38
38
  if ("help" in parsed) {
39
- console.log(_chunkHKVFURYTcjs.DOCTOR_USAGE);
39
+ console.log(_chunk7H3FCV4Pcjs.DOCTOR_USAGE);
40
40
  return 0;
41
41
  }
42
42
  if ("error" in parsed) {
43
43
  console.error(`${parsed.error}
44
44
 
45
- ${_chunkHKVFURYTcjs.DOCTOR_USAGE}`);
45
+ ${_chunk7H3FCV4Pcjs.DOCTOR_USAGE}`);
46
46
  return 64;
47
47
  }
48
- const report = await _chunkHKVFURYTcjs.runDoctor.call(void 0, parsed);
49
- console.log(parsed.json ? JSON.stringify(report, null, 2) : _chunkHKVFURYTcjs.formatDoctorReport.call(void 0, report));
48
+ const report = await _chunk7H3FCV4Pcjs.runDoctor.call(void 0, parsed);
49
+ console.log(parsed.json ? JSON.stringify(report, null, 2) : _chunk7H3FCV4Pcjs.formatDoctorReport.call(void 0, report));
50
50
  return report.exitCode;
51
51
  }
52
52
  main(process.argv.slice(2)).then(
package/dist/cli.js CHANGED
@@ -4,8 +4,8 @@ import {
4
4
  formatDoctorReport,
5
5
  parseDoctorArgs,
6
6
  runDoctor
7
- } from "./chunk-QUC6OUE7.js";
8
- import "./chunk-LG52CW3V.js";
7
+ } from "./chunk-UC3QH4PC.js";
8
+ import "./chunk-B5ZMOCEM.js";
9
9
 
10
10
  // src/cli.ts
11
11
  import { spawnSync } from "child_process";