@trafficwar/node 2.2.4 → 2.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -67,7 +67,8 @@ interface TrafficWarOptions extends TrafficWarQueueOptions {
67
67
  debug?: boolean;
68
68
  /**
69
69
  * At startup, statically scan application source for `capture()` calls and
70
- * print each `event` and `label`. Defaults to `false`.
70
+ * print each pair whose `event` and `label` are both fixed string literals.
71
+ * Calls with a dynamic or missing value are omitted. Defaults to `false`.
71
72
  */
72
73
  verbose?: boolean;
73
74
  /**
package/dist/index.d.ts CHANGED
@@ -67,7 +67,8 @@ interface TrafficWarOptions extends TrafficWarQueueOptions {
67
67
  debug?: boolean;
68
68
  /**
69
69
  * At startup, statically scan application source for `capture()` calls and
70
- * print each `event` and `label`. Defaults to `false`.
70
+ * print each pair whose `event` and `label` are both fixed string literals.
71
+ * Calls with a dynamic or missing value are omitted. Defaults to `false`.
71
72
  */
72
73
  verbose?: boolean;
73
74
  /**
package/dist/index.js CHANGED
@@ -570,7 +570,7 @@ function isSourceFile(name) {
570
570
  return SOURCE_EXTENSIONS.has(path.extname(name));
571
571
  }
572
572
  function clip(value) {
573
- if (value === "<dynamic>" || value === "<missing>" || value.length <= MAX_LITERAL_CHARS) {
573
+ if (value.length <= MAX_LITERAL_CHARS) {
574
574
  return value;
575
575
  }
576
576
  return `${value.slice(0, MAX_LITERAL_CHARS - 3)}...`;
@@ -661,7 +661,6 @@ function parseObject(source, open, limit) {
661
661
  const line = lineAt(source, open);
662
662
  let event;
663
663
  let label;
664
- let saw = false;
665
664
  let index = open + 1;
666
665
  while (index < limit) {
667
666
  index = skipTrivia(source, index, limit);
@@ -670,7 +669,7 @@ function parseObject(source, open, limit) {
670
669
  }
671
670
  if (source[index] === "}") {
672
671
  return {
673
- row: saw ? finishRow(event, label, line) : void 0,
672
+ row: fixedCapture(event, label, line),
674
673
  next: index + 1
675
674
  };
676
675
  }
@@ -689,39 +688,32 @@ function parseObject(source, open, limit) {
689
688
  }
690
689
  index = skipTrivia(source, key.next, limit);
691
690
  if (source[index] !== ":") {
692
- if (key.name === "event" || key.name === "label") {
693
- saw = true;
694
- if (key.name === "event") {
695
- event = "<dynamic>";
696
- } else {
697
- label = "<dynamic>";
698
- }
691
+ if (key.name === "event") {
692
+ event = void 0;
693
+ } else if (key.name === "label") {
694
+ label = void 0;
699
695
  }
696
+ index = key.next;
700
697
  continue;
701
698
  }
702
699
  const value = readValue(source, index + 1, limit);
703
- if (key.name === "event" || key.name === "label") {
704
- saw = true;
705
- const text = value.literal ?? "<dynamic>";
706
- if (key.name === "event") {
707
- event = text;
708
- } else {
709
- label = text;
710
- }
700
+ if (key.name === "event") {
701
+ event = value.literal ?? void 0;
702
+ } else if (key.name === "label") {
703
+ label = value.literal ?? void 0;
711
704
  }
712
705
  index = value.next;
713
706
  }
714
707
  return {
715
- row: saw ? finishRow(event, label, line) : void 0,
708
+ row: fixedCapture(event, label, line),
716
709
  next: index
717
710
  };
718
711
  }
719
- function finishRow(event, label, line) {
720
- return {
721
- event: event ?? "<missing>",
722
- label: label ?? "<missing>",
723
- line
724
- };
712
+ function fixedCapture(event, label, line) {
713
+ if (event === void 0 || label === void 0) {
714
+ return void 0;
715
+ }
716
+ return { event, label, line };
725
717
  }
726
718
  function readKey(source, start, limit) {
727
719
  const index = skipTrivia(source, start, limit);
@@ -1118,7 +1110,7 @@ function uuidv7() {
1118
1110
 
1119
1111
  // package.json
1120
1112
  var package_default = {
1121
- version: "2.2.4"};
1113
+ version: "2.2.5"};
1122
1114
 
1123
1115
  // src/client.ts
1124
1116
  var TRAFFICWAR_DEFAULT_BASE_URL = "https://ingest.trafficwar.tech";