@replayio-app-building/netlify-recorder 0.58.0 → 0.59.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 (2) hide show
  1. package/dist/index.js +10 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -984,7 +984,7 @@ async function finishRequest(requestContext, callbacks, response, options) {
984
984
  body: typeof response.body === "string" ? response.body : void 0
985
985
  },
986
986
  originalRequestId: options?.originalRequestId,
987
- packageVersion: "0.58.0"
987
+ packageVersion: "0.59.0"
988
988
  };
989
989
  const blobData = redactBlobData(rawBlobData);
990
990
  const blobContent = JSON.stringify(blobData);
@@ -1146,6 +1146,9 @@ async function createRequestRecording(blobUrlOrData, handlerPath, requestInfo, p
1146
1146
  t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
1147
1147
  return ((t ^ t >>> 14) >>> 0) / 4294967296;
1148
1148
  };
1149
+ const origDateNow = Date.now;
1150
+ let dateNowCounter = 17e11;
1151
+ Date.now = () => dateNowCounter++;
1149
1152
  const cryptoMod = __require("crypto");
1150
1153
  const origRandomBytes = cryptoMod.randomBytes;
1151
1154
  const origRandomUUID = cryptoMod.randomUUID;
@@ -1275,6 +1278,10 @@ async function createRequestRecording(blobUrlOrData, handlerPath, requestInfo, p
1275
1278
  async json() {
1276
1279
  return JSON.parse(this._body ?? "null");
1277
1280
  }
1281
+ async arrayBuffer() {
1282
+ const buf = Buffer.from(this._body ?? "");
1283
+ return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
1284
+ }
1278
1285
  clone() {
1279
1286
  return new RequestShim(this.url, {
1280
1287
  method: this.method,
@@ -1487,7 +1494,7 @@ async function createRequestRecording(blobUrlOrData, handlerPath, requestInfo, p
1487
1494
  result.replayResponse = replayResponse;
1488
1495
  result.capturedResponse = blobData.handlerResponse;
1489
1496
  const statusMismatch = replayResponse.statusCode !== blobData.handlerResponse.statusCode;
1490
- const bodyMismatch = replayResponse.body !== blobData.handlerResponse.body;
1497
+ const bodyMismatch = (replayResponse.body || "") !== (blobData.handlerResponse.body || "");
1491
1498
  if (statusMismatch || bodyMismatch) {
1492
1499
  result.responseMismatch = true;
1493
1500
  const details = [];
@@ -1539,6 +1546,7 @@ async function createRequestRecording(blobUrlOrData, handlerPath, requestInfo, p
1539
1546
  delete g2.__REPLAY_REQUEST_COOKIES__;
1540
1547
  delete g2.__REPLAY_REQUEST_HEADERS__;
1541
1548
  Math.random = origMathRandom;
1549
+ Date.now = origDateNow;
1542
1550
  cryptoMod.randomBytes = origRandomBytes;
1543
1551
  if (origRandomUUID) cryptoMod.randomUUID = origRandomUUID;
1544
1552
  networkHandle.restore();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@replayio-app-building/netlify-recorder",
3
- "version": "0.58.0",
3
+ "version": "0.59.0",
4
4
  "description": "Capture and replay Netlify function executions as Replay recordings",
5
5
  "type": "module",
6
6
  "exports": {