@sailfish-ai/recorder 1.8.9 → 1.8.10

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.
@@ -106,6 +106,7 @@ async function captureError(error, isPromiseRejection = false) {
106
106
  const mappedStack = await resolveStackTrace(stack);
107
107
  const filteredStack = mappedStack.filter((line) => !line.includes("chunk-") && !line.includes("react-dom"));
108
108
  const trace = filteredStack.length > 0 ? filteredStack : mappedStack;
109
+ const timestamp = Date.now();
109
110
  const errorDetails = {
110
111
  message: errorMessage,
111
112
  stack,
@@ -113,7 +114,7 @@ async function captureError(error, isPromiseRejection = false) {
113
114
  filteredStack,
114
115
  userAgent: navigator.userAgent,
115
116
  url: window.location.href,
116
- timestamp: Date.now(),
117
+ timestamp,
117
118
  level: "error",
118
119
  };
119
120
  // Sends the mapped error details to the backend.
@@ -121,6 +122,7 @@ async function captureError(error, isPromiseRejection = false) {
121
122
  type: "event",
122
123
  event: {
123
124
  type: 6,
125
+ timestamp, // Add timestamp at event root level for consistency with other events
124
126
  data: {
125
127
  payload: errorDetails,
126
128
  },
package/dist/recorder.cjs CHANGED
@@ -446,7 +446,7 @@ function initializeWebSocket(e, a, u) {
446
446
  const a2 = document.createElement("a");
447
447
  return a2.href = e2, `${a2.hostname}${a2.port ? `:${a2.port}` : ""}`;
448
448
  })(e), w2 = new URL(e).protocol;
449
- return ne = new $(`${"https:" === w2 ? "wss" : "ws"}://${m2}/ws/notify/?apiKey=${a}&sessionId=${u}&sender=JS%2FTS&version=1.8.9`, [], { connectionTimeout: 3e4 }), ne.addEventListener("open", () => {
449
+ return ne = new $(`${"https:" === w2 ? "wss" : "ws"}://${m2}/ws/notify/?apiKey=${a}&sessionId=${u}&sender=JS%2FTS&version=1.8.10`, [], { connectionTimeout: 3e4 }), ne.addEventListener("open", () => {
450
450
  Q && (console.log("[Sailfish] WebSocket connection opened"), console.log("[Sailfish] Function span tracking state: " + (ie ? "ENABLED" : "DISABLED"))), (async () => {
451
451
  try {
452
452
  re = true, await flushNotifyQueue(), await flushBufferedEvents();
@@ -1211,8 +1211,8 @@ async function captureError(e, a = false) {
1211
1211
  u2.push(e3);
1212
1212
  continue;
1213
1213
  }
1214
- const [, m3, w3, b3, C2] = a3, x2 = parseInt(b3, 10), I2 = Math.max(0, parseInt(C2, 10) - 1);
1215
- if (!Number.isFinite(x2) || !Number.isFinite(I2)) {
1214
+ const [, m3, w3, b3, C3] = a3, x3 = parseInt(b3, 10), I2 = Math.max(0, parseInt(C3, 10) - 1);
1215
+ if (!Number.isFinite(x3) || !Number.isFinite(I2)) {
1216
1216
  u2.push(e3 + " [Invalid line/column]");
1217
1217
  continue;
1218
1218
  }
@@ -1221,16 +1221,16 @@ async function captureError(e, a = false) {
1221
1221
  u2.push(`${e3} [No source map found for ${w3}]`);
1222
1222
  continue;
1223
1223
  }
1224
- let O2 = _2.originalPositionFor({ line: x2, column: I2, bias: He.SourceMapConsumer.GREATEST_LOWER_BOUND });
1225
- if (!O2.source || null == O2.line) for (let e4 = 1; e4 <= 20 && (O2 = _2.originalPositionFor({ line: x2, column: Math.max(0, I2 - e4), bias: He.SourceMapConsumer.GREATEST_LOWER_BOUND }), !O2.source || null == O2.line); e4++) ;
1224
+ let O2 = _2.originalPositionFor({ line: x3, column: I2, bias: He.SourceMapConsumer.GREATEST_LOWER_BOUND });
1225
+ if (!O2.source || null == O2.line) for (let e4 = 1; e4 <= 20 && (O2 = _2.originalPositionFor({ line: x3, column: Math.max(0, I2 - e4), bias: He.SourceMapConsumer.GREATEST_LOWER_BOUND }), !O2.source || null == O2.line); e4++) ;
1226
1226
  if (O2.source && null != O2.line) {
1227
1227
  const e4 = O2.name || "anonymous";
1228
1228
  u2.push(`${O2.source}:${O2.line}:${O2.column ?? 0} (${e4})`);
1229
1229
  } else u2.push(`${e3} [No mapping found in ${w3}]`);
1230
1230
  }
1231
1231
  return u2;
1232
- })(m2), b2 = w2.filter((e2) => !e2.includes("chunk-") && !e2.includes("react-dom"));
1233
- sendMessage({ type: "event", event: { type: 6, data: { payload: { message: u, stack: m2, trace: b2.length > 0 ? b2 : w2, filteredStack: b2, userAgent: navigator.userAgent, url: window.location.href, timestamp: Date.now(), level: "error" } } } });
1232
+ })(m2), b2 = w2.filter((e2) => !e2.includes("chunk-") && !e2.includes("react-dom")), C2 = b2.length > 0 ? b2 : w2, x2 = Date.now();
1233
+ sendMessage({ type: "event", event: { type: 6, timestamp: x2, data: { payload: { message: u, stack: m2, trace: C2, filteredStack: b2, userAgent: navigator.userAgent, url: window.location.href, timestamp: x2, level: "error" } } } });
1234
1234
  }
1235
1235
  const Xe = readDebugFlag();
1236
1236
  const Qe = readDebugFlag();
package/dist/recorder.js CHANGED
@@ -445,7 +445,7 @@ function initializeWebSocket(e, a, u) {
445
445
  const a2 = document.createElement("a");
446
446
  return a2.href = e2, `${a2.hostname}${a2.port ? `:${a2.port}` : ""}`;
447
447
  })(e), w2 = new URL(e).protocol;
448
- return re = new $(`${"https:" === w2 ? "wss" : "ws"}://${m2}/ws/notify/?apiKey=${a}&sessionId=${u}&sender=JS%2FTS&version=1.8.9`, [], { connectionTimeout: 3e4 }), re.addEventListener("open", () => {
448
+ return re = new $(`${"https:" === w2 ? "wss" : "ws"}://${m2}/ws/notify/?apiKey=${a}&sessionId=${u}&sender=JS%2FTS&version=1.8.10`, [], { connectionTimeout: 3e4 }), re.addEventListener("open", () => {
449
449
  ee && (console.log("[Sailfish] WebSocket connection opened"), console.log("[Sailfish] Function span tracking state: " + (le ? "ENABLED" : "DISABLED"))), (async () => {
450
450
  try {
451
451
  oe = true, await flushNotifyQueue(), await flushBufferedEvents();
@@ -1210,8 +1210,8 @@ async function captureError(e, a = false) {
1210
1210
  u2.push(e3);
1211
1211
  continue;
1212
1212
  }
1213
- const [, m3, w3, b3, C2] = a3, x2 = parseInt(b3, 10), I2 = Math.max(0, parseInt(C2, 10) - 1);
1214
- if (!Number.isFinite(x2) || !Number.isFinite(I2)) {
1213
+ const [, m3, w3, b3, C3] = a3, x3 = parseInt(b3, 10), I2 = Math.max(0, parseInt(C3, 10) - 1);
1214
+ if (!Number.isFinite(x3) || !Number.isFinite(I2)) {
1215
1215
  u2.push(e3 + " [Invalid line/column]");
1216
1216
  continue;
1217
1217
  }
@@ -1220,16 +1220,16 @@ async function captureError(e, a = false) {
1220
1220
  u2.push(`${e3} [No source map found for ${w3}]`);
1221
1221
  continue;
1222
1222
  }
1223
- let O2 = _2.originalPositionFor({ line: x2, column: I2, bias: Je.SourceMapConsumer.GREATEST_LOWER_BOUND });
1224
- if (!O2.source || null == O2.line) for (let e4 = 1; e4 <= 20 && (O2 = _2.originalPositionFor({ line: x2, column: Math.max(0, I2 - e4), bias: Je.SourceMapConsumer.GREATEST_LOWER_BOUND }), !O2.source || null == O2.line); e4++) ;
1223
+ let O2 = _2.originalPositionFor({ line: x3, column: I2, bias: Je.SourceMapConsumer.GREATEST_LOWER_BOUND });
1224
+ if (!O2.source || null == O2.line) for (let e4 = 1; e4 <= 20 && (O2 = _2.originalPositionFor({ line: x3, column: Math.max(0, I2 - e4), bias: Je.SourceMapConsumer.GREATEST_LOWER_BOUND }), !O2.source || null == O2.line); e4++) ;
1225
1225
  if (O2.source && null != O2.line) {
1226
1226
  const e4 = O2.name || "anonymous";
1227
1227
  u2.push(`${O2.source}:${O2.line}:${O2.column ?? 0} (${e4})`);
1228
1228
  } else u2.push(`${e3} [No mapping found in ${w3}]`);
1229
1229
  }
1230
1230
  return u2;
1231
- })(m2), b2 = w2.filter((e2) => !e2.includes("chunk-") && !e2.includes("react-dom"));
1232
- sendMessage({ type: "event", event: { type: 6, data: { payload: { message: u, stack: m2, trace: b2.length > 0 ? b2 : w2, filteredStack: b2, userAgent: navigator.userAgent, url: window.location.href, timestamp: Date.now(), level: "error" } } } });
1231
+ })(m2), b2 = w2.filter((e2) => !e2.includes("chunk-") && !e2.includes("react-dom")), C2 = b2.length > 0 ? b2 : w2, x2 = Date.now();
1232
+ sendMessage({ type: "event", event: { type: 6, timestamp: x2, data: { payload: { message: u, stack: m2, trace: C2, filteredStack: b2, userAgent: navigator.userAgent, url: window.location.href, timestamp: x2, level: "error" } } } });
1233
1233
  }
1234
1234
  const Qe = readDebugFlag();
1235
1235
  const et = readDebugFlag();
Binary file
Binary file
@@ -448,7 +448,7 @@
448
448
  const a3 = document.createElement("a");
449
449
  return a3.href = e3, `${a3.hostname}${a3.port ? `:${a3.port}` : ""}`;
450
450
  })(e2), w2 = new URL(e2).protocol;
451
- return re = new z(`${"https:" === w2 ? "wss" : "ws"}://${m2}/ws/notify/?apiKey=${a2}&sessionId=${u2}&sender=JS%2FTS&version=1.8.9`, [], { connectionTimeout: 3e4 }), re.addEventListener("open", () => {
451
+ return re = new z(`${"https:" === w2 ? "wss" : "ws"}://${m2}/ws/notify/?apiKey=${a2}&sessionId=${u2}&sender=JS%2FTS&version=1.8.10`, [], { connectionTimeout: 3e4 }), re.addEventListener("open", () => {
452
452
  ee && (console.log("[Sailfish] WebSocket connection opened"), console.log("[Sailfish] Function span tracking state: " + (le ? "ENABLED" : "DISABLED"))), (async () => {
453
453
  try {
454
454
  oe = true, await flushNotifyQueue(), await flushBufferedEvents();
@@ -1213,8 +1213,8 @@
1213
1213
  u3.push(e4);
1214
1214
  continue;
1215
1215
  }
1216
- const [, m3, w3, b3, C2] = a4, x2 = parseInt(b3, 10), I2 = Math.max(0, parseInt(C2, 10) - 1);
1217
- if (!Number.isFinite(x2) || !Number.isFinite(I2)) {
1216
+ const [, m3, w3, b3, C3] = a4, x3 = parseInt(b3, 10), I2 = Math.max(0, parseInt(C3, 10) - 1);
1217
+ if (!Number.isFinite(x3) || !Number.isFinite(I2)) {
1218
1218
  u3.push(e4 + " [Invalid line/column]");
1219
1219
  continue;
1220
1220
  }
@@ -1223,16 +1223,16 @@
1223
1223
  u3.push(`${e4} [No source map found for ${w3}]`);
1224
1224
  continue;
1225
1225
  }
1226
- let O2 = _2.originalPositionFor({ line: x2, column: I2, bias: Je.SourceMapConsumer.GREATEST_LOWER_BOUND });
1227
- if (!O2.source || null == O2.line) for (let e5 = 1; e5 <= 20 && (O2 = _2.originalPositionFor({ line: x2, column: Math.max(0, I2 - e5), bias: Je.SourceMapConsumer.GREATEST_LOWER_BOUND }), !O2.source || null == O2.line); e5++) ;
1226
+ let O2 = _2.originalPositionFor({ line: x3, column: I2, bias: Je.SourceMapConsumer.GREATEST_LOWER_BOUND });
1227
+ if (!O2.source || null == O2.line) for (let e5 = 1; e5 <= 20 && (O2 = _2.originalPositionFor({ line: x3, column: Math.max(0, I2 - e5), bias: Je.SourceMapConsumer.GREATEST_LOWER_BOUND }), !O2.source || null == O2.line); e5++) ;
1228
1228
  if (O2.source && null != O2.line) {
1229
1229
  const e5 = O2.name || "anonymous";
1230
1230
  u3.push(`${O2.source}:${O2.line}:${O2.column ?? 0} (${e5})`);
1231
1231
  } else u3.push(`${e4} [No mapping found in ${w3}]`);
1232
1232
  }
1233
1233
  return u3;
1234
- })(m2), b2 = w2.filter((e3) => !e3.includes("chunk-") && !e3.includes("react-dom"));
1235
- sendMessage({ type: "event", event: { type: 6, data: { payload: { message: u2, stack: m2, trace: b2.length > 0 ? b2 : w2, filteredStack: b2, userAgent: navigator.userAgent, url: window.location.href, timestamp: Date.now(), level: "error" } } } });
1234
+ })(m2), b2 = w2.filter((e3) => !e3.includes("chunk-") && !e3.includes("react-dom")), C2 = b2.length > 0 ? b2 : w2, x2 = Date.now();
1235
+ sendMessage({ type: "event", event: { type: 6, timestamp: x2, data: { payload: { message: u2, stack: m2, trace: C2, filteredStack: b2, userAgent: navigator.userAgent, url: window.location.href, timestamp: x2, level: "error" } } } });
1236
1236
  }
1237
1237
  const Qe = readDebugFlag();
1238
1238
  const et = readDebugFlag();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sailfish-ai/recorder",
3
- "version": "1.8.9",
3
+ "version": "1.8.10",
4
4
  "publishPublicly": true,
5
5
  "type": "module",
6
6
  "main": "dist/recorder.cjs",