@replayio-app-building/netlify-recorder 0.28.0 → 0.30.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 +5 -15
  2. package/package.json +5 -6
package/dist/index.js CHANGED
@@ -665,8 +665,8 @@ async function createRequestRecording(blobUrlOrData, handlerPath, requestInfo) {
665
665
  const g = globalThis;
666
666
  if (typeof g.Blob === "undefined") {
667
667
  try {
668
- const { Blob } = __require("buffer");
669
- g.Blob = Blob;
668
+ const { Blob: Blob2 } = __require("buffer");
669
+ g.Blob = Blob2;
670
670
  } catch {
671
671
  }
672
672
  }
@@ -946,6 +946,7 @@ async function createRequestRecording(blobUrlOrData, handlerPath, requestInfo) {
946
946
  }
947
947
 
948
948
  // src/backendRequests.ts
949
+ import { UTApi } from "uploadthing/server";
949
950
  async function backendRequestsEnsureTable(sql) {
950
951
  await sql`
951
952
  CREATE TABLE IF NOT EXISTS backend_requests (
@@ -1056,14 +1057,6 @@ async function backendRequestsUpdateStatus(sql, id, status, recordingId, errorMe
1056
1057
  }
1057
1058
  }
1058
1059
  async function uploadBlobData(blobData, requestId) {
1059
- let UTApi;
1060
- try {
1061
- ({ UTApi } = await Function('return import("uploadthing/server")')());
1062
- } catch {
1063
- throw new Error(
1064
- "netlify-recorder requires the 'uploadthing' package. Install it with: npm install uploadthing"
1065
- );
1066
- }
1067
1060
  const token = process.env.UPLOADTHING_TOKEN;
1068
1061
  if (!token) {
1069
1062
  throw new Error(
@@ -1071,11 +1064,8 @@ async function uploadBlobData(blobData, requestId) {
1071
1064
  );
1072
1065
  }
1073
1066
  const utapi = new UTApi({ token });
1074
- const file = new File(
1075
- [blobData],
1076
- `blob-${requestId}.json`,
1077
- { type: "application/json" }
1078
- );
1067
+ const blob = new Blob([blobData], { type: "application/json" });
1068
+ const file = Object.assign(blob, { name: `blob-${requestId}.json` });
1079
1069
  const result = await utapi.uploadFiles(file);
1080
1070
  if (result.error || !result.data?.ufsUrl) {
1081
1071
  throw new Error(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@replayio-app-building/netlify-recorder",
3
- "version": "0.28.0",
3
+ "version": "0.30.0",
4
4
  "description": "Capture and replay Netlify function executions as Replay recordings",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,16 +17,15 @@
17
17
  "check": "tsc --noEmit",
18
18
  "prepublishOnly": "tsup"
19
19
  },
20
+ "dependencies": {
21
+ "uploadthing": "^7.7.4"
22
+ },
20
23
  "peerDependencies": {
21
- "@replayio/app-building": ">=1.0.0",
22
- "uploadthing": ">=7.0.0"
24
+ "@replayio/app-building": ">=1.0.0"
23
25
  },
24
26
  "peerDependenciesMeta": {
25
27
  "@replayio/app-building": {
26
28
  "optional": true
27
- },
28
- "uploadthing": {
29
- "optional": true
30
29
  }
31
30
  },
32
31
  "devDependencies": {