@webblackbox/recorder
Advanced tools
+10
-13
| // src/action-span.ts | ||
| import { createActionId } from "@webblackbox/protocol"; | ||
| import { | ||
| createActionId, | ||
| extractRequestId | ||
| } from "@webblackbox/protocol"; | ||
| var ACTION_START_EVENTS = /* @__PURE__ */ new Set([ | ||
@@ -42,2 +45,3 @@ "user.click", | ||
| const reqId = this.readReqId(event); | ||
| const eventWithReqRef = reqId && event.ref?.req !== reqId ? this.withRef(event, { req: reqId }) : event; | ||
| if (!actionId && event.type.startsWith("network.")) { | ||
@@ -53,5 +57,5 @@ actionId = reqId ? this.reqToAction.get(reqId) : void 0; | ||
| if (actionId) { | ||
| return this.withRef(event, { act: actionId }); | ||
| return this.withRef(eventWithReqRef, { act: actionId }); | ||
| } | ||
| return event; | ||
| return eventWithReqRef; | ||
| } | ||
@@ -79,11 +83,3 @@ isActionStartEvent(event) { | ||
| readReqId(event) { | ||
| const payload = this.asRecord(event.data); | ||
| const reqId = payload?.reqId; | ||
| if (typeof reqId === "string" && reqId.length > 0) { | ||
| return reqId; | ||
| } | ||
| if (typeof event.ref?.req === "string" && event.ref.req.length > 0) { | ||
| return event.ref.req; | ||
| } | ||
| return void 0; | ||
| return extractRequestId(event) ?? void 0; | ||
| } | ||
@@ -148,2 +144,3 @@ asRecord(value) { | ||
| // src/normalizer.ts | ||
| import { extractRequestIdFromPayload } from "@webblackbox/protocol"; | ||
| var CDP_EVENT_MAP = { | ||
@@ -372,3 +369,3 @@ "Network.requestWillBeSent": "network.request", | ||
| function readRequestId(payload) { | ||
| return asString(payload?.reqId) ?? asString(payload?.requestId) ?? asString(asRecord(payload?.request)?.requestId) ?? null; | ||
| return extractRequestIdFromPayload(payload); | ||
| } | ||
@@ -375,0 +372,0 @@ function buildFallbackReqId(method, url) { |
+2
-2
| { | ||
| "name": "@webblackbox/recorder", | ||
| "description": "Browser event recorder and normalization engine for WebBlackbox capture pipelines.", | ||
| "version": "0.2.0", | ||
| "version": "0.4.0", | ||
| "type": "module", | ||
@@ -41,3 +41,3 @@ "main": "./dist/index.js", | ||
| "dependencies": { | ||
| "@webblackbox/protocol": "0.2.0" | ||
| "@webblackbox/protocol": "0.4.0" | ||
| }, | ||
@@ -44,0 +44,0 @@ "scripts": { |
55235
-0.19%1330
-0.23%+ Added
- Removed
Updated