@alpaca-headless/alpaca-headless-nextjs 1.0.4428 → 1.0.4429

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.
@@ -1,21 +1,29 @@
1
1
  import axios from "axios";
2
+ // import { HttpsProxyAgent } from "https-proxy-agent";
2
3
  import { NextResponse } from "next/server";
3
- async function GET(req, target) {
4
+ async function GET(req, target
5
+ //{ proxy }: { proxy?: string }
6
+ ) {
4
7
  const reqUrl = new URL(req.url);
5
8
  const url = target + reqUrl.pathname + "?" + reqUrl.searchParams.toString();
6
9
  const headers = {
7
10
  Authorization: req.headers.get("Authorization") || "",
8
11
  Cookie: req.headers.get("Cookie") || "",
9
12
  };
13
+ // const agent = proxy ? new HttpsProxyAgent(proxy) : undefined;
10
14
  const externalResponse = await axios.get(url, {
11
15
  headers: headers,
16
+ // httpAgent: agent,
17
+ // httpsAgent: agent,
12
18
  responseType: "stream",
13
19
  });
14
20
  return new NextResponse(nodeReadableToReadableStream(externalResponse.data), {
15
21
  status: externalResponse.status,
16
22
  });
17
23
  }
18
- async function POST(req) {
24
+ async function POST(req
25
+ //{ proxy }: { proxy?: string }
26
+ ) {
19
27
  const reqUrl = new URL(req.url);
20
28
  const body = await req.text();
21
29
  const url = process.env.EDITOR_SERVICE_URL +
@@ -27,8 +35,11 @@ async function POST(req) {
27
35
  Authorization: req.headers.get("Authorization") || "",
28
36
  Cookie: req.headers.get("Cookie") || "",
29
37
  };
38
+ // const agent = proxy ? new HttpsProxyAgent(proxy) : undefined;
30
39
  const externalResponse = await axios.post(url, body, {
31
40
  headers: headers,
41
+ // httpAgent: agent,
42
+ // httpsAgent: agent,
32
43
  responseType: "stream",
33
44
  });
34
45
  const responseHeaders = getResponseHeaders(externalResponse);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alpaca-headless/alpaca-headless-nextjs",
3
- "version": "1.0.4428",
3
+ "version": "1.0.4429",
4
4
  "type": "module",
5
5
  "description": "Alpaca Headless",
6
6
  "main": "dist/index.js",
@@ -44,18 +44,20 @@
44
44
  },
45
45
  "homepage": "https://github.com/yourusername/your-module-name#readme",
46
46
  "devDependencies": {
47
- "@types/node": "^25.5.0",
48
- "@types/react": "19.2.14",
49
- "eslint": "^9.39.4",
50
- "eslint-config-next": "16.2.1",
51
- "typescript": "5.9.3"
47
+ "@types/node": "^20.14.2",
48
+ "@types/react": "19.2.2",
49
+ "@types/react-dom": "19.2.2",
50
+ "eslint": "^9.22.0",
51
+ "eslint-config-next": "16.0.10",
52
+ "typescript": "^5"
52
53
  },
53
54
  "dependencies": {
54
- "@alpaca-headless/alpaca-headless": "^1.0.4428",
55
- "axios": "^1.13.6",
56
- "next": "16.2.1",
57
- "react": "19.2.4",
58
- "react-dom": "19.2.4",
55
+ "@alpaca-headless/alpaca-headless": "^1.0.4429",
56
+ "axios": "^1.8.1",
57
+ "https-proxy-agent": "^7.0.4",
58
+ "next": "16.0.10",
59
+ "react": "19.2.3",
60
+ "react-dom": "19.2.3",
59
61
  "react-uuid": "^2.0.0"
60
62
  }
61
63
  }
@@ -1,9 +1,11 @@
1
1
  import axios from "axios";
2
+ // import { HttpsProxyAgent } from "https-proxy-agent";
2
3
  import { NextResponse } from "next/server";
3
4
 
4
5
  async function GET(
5
6
  req: Request,
6
7
  target: string
8
+ //{ proxy }: { proxy?: string }
7
9
  ) {
8
10
  const reqUrl = new URL(req.url);
9
11
 
@@ -15,8 +17,12 @@ async function GET(
15
17
  Cookie: req.headers.get("Cookie") || "",
16
18
  };
17
19
 
20
+ // const agent = proxy ? new HttpsProxyAgent(proxy) : undefined;
21
+
18
22
  const externalResponse = await axios.get(url, {
19
23
  headers: headers,
24
+ // httpAgent: agent,
25
+ // httpsAgent: agent,
20
26
  responseType: "stream",
21
27
  });
22
28
 
@@ -25,7 +31,10 @@ async function GET(
25
31
  });
26
32
  }
27
33
 
28
- async function POST(req: Request) {
34
+ async function POST(
35
+ req: Request
36
+ //{ proxy }: { proxy?: string }
37
+ ) {
29
38
  const reqUrl = new URL(req.url);
30
39
  const body = await req.text();
31
40
 
@@ -41,8 +50,12 @@ async function POST(req: Request) {
41
50
  Cookie: req.headers.get("Cookie") || "",
42
51
  };
43
52
 
53
+ // const agent = proxy ? new HttpsProxyAgent(proxy) : undefined;
54
+
44
55
  const externalResponse = await axios.post(url, body, {
45
56
  headers: headers,
57
+ // httpAgent: agent,
58
+ // httpsAgent: agent,
46
59
  responseType: "stream",
47
60
  });
48
61
 
package/tsconfig.json CHANGED
@@ -5,7 +5,6 @@
5
5
  "moduleResolution": "bundler",
6
6
  "jsx": "react-jsx",
7
7
  "declaration": true,
8
- "rootDir": "./src",
9
8
  "outDir": "./dist",
10
9
  "strict": true,
11
10
  "lib": ["dom", "dom.iterable", "es2021"],
@@ -1 +0,0 @@
1
- {"root":["./src/editorintegration.tsx","./src/editorintegrationclient.tsx","./src/handlebasicauthroute.ts","./src/index.ts","./src/useexposerefreshfunction.ts","./src/client-components/multicomponenteditor.tsx","./src/client-components/index.ts","./src/middleware/handlerequest.ts","./src/middleware/index.ts","./src/proxy/index.ts"],"version":"5.9.3"}