@replayio-app-building/netlify-recorder 0.54.0 → 0.55.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 +32 -1
  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.54.0"
987
+ packageVersion: "0.55.0"
988
988
  };
989
989
  const blobData = redactBlobData(rawBlobData);
990
990
  const blobContent = JSON.stringify(blobData);
@@ -1143,6 +1143,35 @@ async function createRequestRecording(blobUrlOrData, handlerPath, requestInfo, p
1143
1143
  t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
1144
1144
  return ((t ^ t >>> 14) >>> 0) / 4294967296;
1145
1145
  };
1146
+ const cryptoMod = __require("crypto");
1147
+ const origRandomBytes = cryptoMod.randomBytes;
1148
+ const origRandomUUID = cryptoMod.randomUUID;
1149
+ let cryptoSeed = 3735928559;
1150
+ const nextByte = () => {
1151
+ cryptoSeed = cryptoSeed + 1831565813 | 0;
1152
+ let t = Math.imul(cryptoSeed ^ cryptoSeed >>> 15, 1 | cryptoSeed);
1153
+ t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
1154
+ return (t ^ t >>> 14) >>> 0 & 255;
1155
+ };
1156
+ cryptoMod.randomBytes = (size, cb) => {
1157
+ const buf = Buffer.alloc(size);
1158
+ for (let i = 0; i < size; i++) buf[i] = nextByte();
1159
+ if (cb) {
1160
+ cb(null, buf);
1161
+ return void 0;
1162
+ }
1163
+ return buf;
1164
+ };
1165
+ if (origRandomUUID) {
1166
+ cryptoMod.randomUUID = () => {
1167
+ const bytes = new Uint8Array(16);
1168
+ for (let i = 0; i < 16; i++) bytes[i] = nextByte();
1169
+ bytes[6] = bytes[6] & 15 | 64;
1170
+ bytes[8] = bytes[8] & 63 | 128;
1171
+ const h = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
1172
+ return `${h.slice(0, 8)}-${h.slice(8, 12)}-${h.slice(12, 16)}-${h.slice(16, 20)}-${h.slice(20)}`;
1173
+ };
1174
+ }
1146
1175
  const g = globalThis;
1147
1176
  if (typeof g.Blob === "undefined") {
1148
1177
  try {
@@ -1507,6 +1536,8 @@ async function createRequestRecording(blobUrlOrData, handlerPath, requestInfo, p
1507
1536
  delete g.__REPLAY_REQUEST_COOKIES__;
1508
1537
  delete g.__REPLAY_REQUEST_HEADERS__;
1509
1538
  Math.random = origMathRandom;
1539
+ cryptoMod.randomBytes = origRandomBytes;
1540
+ if (origRandomUUID) cryptoMod.randomUUID = origRandomUUID;
1510
1541
  networkHandle.restore();
1511
1542
  envHandle.restore();
1512
1543
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@replayio-app-building/netlify-recorder",
3
- "version": "0.54.0",
3
+ "version": "0.55.0",
4
4
  "description": "Capture and replay Netlify function executions as Replay recordings",
5
5
  "type": "module",
6
6
  "exports": {