@browserless.io/browserless 2.30.0 → 2.30.1
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.
- package/CHANGELOG.md +9 -3
- package/build/limiter.js +3 -1
- package/build/routes/chrome/http/pdf.post.body.json +8 -8
- package/build/routes/chrome/http/scrape.post.body.json +8 -8
- package/build/routes/chrome/http/screenshot.post.body.json +8 -8
- package/build/routes/chromium/http/content.post.body.json +8 -8
- package/build/routes/chromium/http/pdf.post.body.json +8 -8
- package/build/routes/chromium/http/scrape.post.body.json +8 -8
- package/build/routes/chromium/http/screenshot.post.body.json +8 -8
- package/build/routes/edge/http/content.post.body.json +8 -8
- package/build/routes/edge/http/pdf.post.body.json +8 -8
- package/build/routes/edge/http/scrape.post.body.json +8 -8
- package/build/routes/edge/http/screenshot.post.body.json +8 -8
- package/package.json +3 -3
- package/scripts/build-open-api.js +16 -4
- package/src/limiter.ts +7 -2
- package/static/docs/swagger.json +35 -35
- package/static/docs/swagger.min.json +34 -34
- package/static/function/client.js +2 -2
- package/static/function/index.html +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@browserless.io/browserless",
|
|
3
|
-
"version": "2.30.
|
|
3
|
+
"version": "2.30.1",
|
|
4
4
|
"license": "SSPL",
|
|
5
5
|
"description": "The browserless platform",
|
|
6
6
|
"author": "browserless.io",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"tsconfig.json"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"debug": "^4.4.
|
|
51
|
+
"debug": "^4.4.1",
|
|
52
52
|
"del": "^8.0.0",
|
|
53
53
|
"enjoi": "^9.0.1",
|
|
54
54
|
"file-type": "^20.5.0",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@types/http-proxy": "^1.17.16",
|
|
77
77
|
"@types/micromatch": "^4.0.9",
|
|
78
78
|
"@types/mocha": "^10.0.10",
|
|
79
|
-
"@types/node": "^22.15.
|
|
79
|
+
"@types/node": "^22.15.18",
|
|
80
80
|
"@types/sinon": "^17.0.4",
|
|
81
81
|
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
82
82
|
"@typescript-eslint/parser": "^8.32.1",
|
|
@@ -108,9 +108,10 @@ const buildOpenAPI = async (
|
|
|
108
108
|
const query = routeModule.replace('.js', '.query.json');
|
|
109
109
|
const response = routeModule.replace('.js', '.response.json');
|
|
110
110
|
const isWebSocket = routeModule.includes('/ws/') || name.endsWith('ws');
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
const paths = (Array.isArray(route.path) ? route.path : [route.path])
|
|
112
|
+
.sort((a, b) => b.length - a.length)
|
|
113
|
+
.map((p) => p.replace(/\?\(\/\)/g, ''));
|
|
114
|
+
const [path, ...alternativePaths] = paths;
|
|
114
115
|
|
|
115
116
|
const {
|
|
116
117
|
tags,
|
|
@@ -122,12 +123,23 @@ const buildOpenAPI = async (
|
|
|
122
123
|
title,
|
|
123
124
|
} = route;
|
|
124
125
|
|
|
126
|
+
const routeDocs = [description];
|
|
127
|
+
|
|
128
|
+
if (alternativePaths.length > 0) {
|
|
129
|
+
const altPathsText = alternativePaths
|
|
130
|
+
.map((p) => `\`${p}\``)
|
|
131
|
+
.join(', ');
|
|
132
|
+
|
|
133
|
+
const compatNote = `**Note:** This endpoint is also available at: ${altPathsText} for backwards compatibility.`;
|
|
134
|
+
routeDocs.push(compatNote);
|
|
135
|
+
}
|
|
136
|
+
console.log(alternativePaths.length, routeDocs);
|
|
125
137
|
return {
|
|
126
138
|
accepts,
|
|
127
139
|
auth,
|
|
128
140
|
body: isWebSocket ? null : JSON.parse(await readFileOrNull(body)),
|
|
129
141
|
contentTypes,
|
|
130
|
-
description,
|
|
142
|
+
description: routeDocs.join('\n\n'),
|
|
131
143
|
isWebSocket,
|
|
132
144
|
method,
|
|
133
145
|
path,
|
package/src/limiter.ts
CHANGED
|
@@ -139,7 +139,10 @@ export class Limiter extends q {
|
|
|
139
139
|
req: job.args[0],
|
|
140
140
|
start: job.start,
|
|
141
141
|
status: 'error',
|
|
142
|
-
error:
|
|
142
|
+
error:
|
|
143
|
+
error instanceof Error
|
|
144
|
+
? error
|
|
145
|
+
: new Error(error?.toString() ?? 'Unknown Error'),
|
|
143
146
|
} as AfterResponse);
|
|
144
147
|
}
|
|
145
148
|
|
|
@@ -203,7 +206,9 @@ export class Limiter extends q {
|
|
|
203
206
|
const concurrencyLimit = this.concurrency;
|
|
204
207
|
const queueLimit = this.queued;
|
|
205
208
|
return rej(
|
|
206
|
-
new TooManyRequests(
|
|
209
|
+
new TooManyRequests(
|
|
210
|
+
`Concurrency limit of ${concurrencyLimit} and queue limit of ${queueLimit} reached. Possible causes: 1) Your token has reached maximum capacity, 2) Your token may not have access to this version, 3) Your requests are coming too quickly.`,
|
|
211
|
+
),
|
|
207
212
|
);
|
|
208
213
|
}
|
|
209
214
|
|