@browserless.io/browserless 2.24.3 → 2.25.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 (160) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/README.md +1 -1
  3. package/build/browserless.js +3 -1
  4. package/build/browsers/browsers.cdp.d.ts +3 -0
  5. package/build/browsers/browsers.cdp.js +4 -1
  6. package/build/browsers/browsers.playwright.d.ts +4 -0
  7. package/build/browsers/browsers.playwright.js +5 -1
  8. package/build/browsers/index.js +3 -2
  9. package/build/http.d.ts +9 -0
  10. package/build/http.js +9 -0
  11. package/build/routes/chrome/http/content.post.body.json +8 -8
  12. package/build/routes/chrome/http/pdf.post.body.json +8 -8
  13. package/build/routes/chrome/http/scrape.post.body.json +8 -8
  14. package/build/routes/chrome/http/screenshot.post.body.json +8 -8
  15. package/build/routes/chrome/tests/kill-sessions.spec.js +1 -1
  16. package/build/routes/chromium/http/content.post.body.json +8 -8
  17. package/build/routes/chromium/http/pdf.post.body.json +8 -8
  18. package/build/routes/chromium/http/scrape.post.body.json +8 -8
  19. package/build/routes/chromium/http/screenshot.post.body.json +8 -8
  20. package/build/routes/chromium/tests/kill-sessions.spec.js +1 -1
  21. package/build/routes/edge/http/content.post.body.json +579 -0
  22. package/build/routes/edge/http/content.post.d.ts +8 -0
  23. package/build/routes/edge/http/content.post.js +7 -0
  24. package/build/routes/edge/http/content.post.query.json +183 -0
  25. package/build/routes/edge/http/content.post.response.json +5 -0
  26. package/build/routes/edge/http/download.post.body.json +32 -0
  27. package/build/routes/edge/http/download.post.d.ts +8 -0
  28. package/build/routes/edge/http/download.post.js +7 -0
  29. package/build/routes/edge/http/download.post.query.json +120 -0
  30. package/build/routes/edge/http/download.post.response.json +4 -0
  31. package/build/routes/edge/http/function.post.body.json +32 -0
  32. package/build/routes/edge/http/function.post.d.ts +8 -0
  33. package/build/routes/edge/http/function.post.js +7 -0
  34. package/build/routes/edge/http/function.post.query.json +120 -0
  35. package/build/routes/edge/http/function.post.response.json +4 -0
  36. package/build/routes/edge/http/json-list.get.d.ts +5 -0
  37. package/build/routes/edge/http/json-list.get.js +5 -0
  38. package/build/routes/edge/http/json-list.get.response.json +52 -0
  39. package/build/routes/edge/http/json-new.put.d.ts +5 -0
  40. package/build/routes/edge/http/json-new.put.js +5 -0
  41. package/build/routes/edge/http/json-new.put.response.json +44 -0
  42. package/build/routes/edge/http/json-protocol.get.d.ts +5 -0
  43. package/build/routes/edge/http/json-protocol.get.js +5 -0
  44. package/build/routes/edge/http/json-protocol.get.response.json +6 -0
  45. package/build/routes/edge/http/json-version.get.d.ts +5 -0
  46. package/build/routes/edge/http/json-version.get.js +5 -0
  47. package/build/routes/edge/http/json-version.get.response.json +44 -0
  48. package/build/routes/edge/http/pdf.post.body.json +724 -0
  49. package/build/routes/edge/http/pdf.post.d.ts +8 -0
  50. package/build/routes/edge/http/pdf.post.js +7 -0
  51. package/build/routes/edge/http/pdf.post.query.json +120 -0
  52. package/build/routes/edge/http/pdf.post.response.json +5 -0
  53. package/build/routes/edge/http/performance.post.body.json +26 -0
  54. package/build/routes/edge/http/performance.post.d.ts +8 -0
  55. package/build/routes/edge/http/performance.post.js +7 -0
  56. package/build/routes/edge/http/performance.post.query.json +120 -0
  57. package/build/routes/edge/http/performance.post.response.json +7 -0
  58. package/build/routes/edge/http/scrape.post.body.json +626 -0
  59. package/build/routes/edge/http/scrape.post.d.ts +8 -0
  60. package/build/routes/edge/http/scrape.post.js +7 -0
  61. package/build/routes/edge/http/scrape.post.query.json +183 -0
  62. package/build/routes/edge/http/scrape.post.response.json +334 -0
  63. package/build/routes/edge/http/screenshot.post.body.json +669 -0
  64. package/build/routes/edge/http/screenshot.post.d.ts +8 -0
  65. package/build/routes/edge/http/screenshot.post.js +7 -0
  66. package/build/routes/edge/http/screenshot.post.query.json +120 -0
  67. package/build/routes/edge/http/screenshot.post.response.json +5 -0
  68. package/build/routes/edge/tests/content.spec.d.ts +1 -0
  69. package/build/routes/edge/tests/content.spec.js +312 -0
  70. package/build/routes/edge/tests/download.spec.d.ts +1 -0
  71. package/build/routes/edge/tests/download.spec.js +67 -0
  72. package/build/routes/edge/tests/function.spec.d.ts +1 -0
  73. package/build/routes/edge/tests/function.spec.js +277 -0
  74. package/build/routes/edge/tests/json-version.spec.d.ts +1 -0
  75. package/build/routes/edge/tests/json-version.spec.js +37 -0
  76. package/build/routes/edge/tests/kill-sessions.spec.d.ts +1 -0
  77. package/build/routes/edge/tests/kill-sessions.spec.js +80 -0
  78. package/build/routes/edge/tests/page-websocket.spec.d.ts +1 -0
  79. package/build/routes/edge/tests/page-websocket.spec.js +97 -0
  80. package/build/routes/edge/tests/pdf.spec.d.ts +1 -0
  81. package/build/routes/edge/tests/pdf.spec.js +345 -0
  82. package/build/routes/edge/tests/performance.spec.d.ts +1 -0
  83. package/build/routes/edge/tests/performance.spec.js +124 -0
  84. package/build/routes/edge/tests/scrape.spec.d.ts +1 -0
  85. package/build/routes/edge/tests/scrape.spec.js +354 -0
  86. package/build/routes/edge/tests/screenshot.spec.d.ts +1 -0
  87. package/build/routes/edge/tests/screenshot.spec.js +339 -0
  88. package/build/routes/edge/tests/websocket.spec.d.ts +1 -0
  89. package/build/routes/edge/tests/websocket.spec.js +384 -0
  90. package/build/routes/edge/ws/browser.d.ts +7 -0
  91. package/build/routes/edge/ws/browser.js +6 -0
  92. package/build/routes/edge/ws/browser.query.json +120 -0
  93. package/build/routes/edge/ws/cdp.d.ts +8 -0
  94. package/build/routes/edge/ws/cdp.js +7 -0
  95. package/build/routes/edge/ws/cdp.query.json +120 -0
  96. package/build/routes/edge/ws/page.d.ts +8 -0
  97. package/build/routes/edge/ws/page.js +7 -0
  98. package/build/routes/edge/ws/page.query.json +120 -0
  99. package/build/routes/edge/ws/playwright.d.ts +8 -0
  100. package/build/routes/edge/ws/playwright.js +7 -0
  101. package/build/routes/edge/ws/playwright.query.json +100 -0
  102. package/build/routes/firefox/tests/kill-sessions.spec.js +1 -1
  103. package/build/routes/webkit/tests/kill-sessions.spec.js +1 -1
  104. package/build/sdk-utils.js +1 -1
  105. package/build/shared/scrape.http.js +2 -2
  106. package/build/types.d.ts +32 -0
  107. package/build/types.js +18 -0
  108. package/build/utils.d.ts +1 -0
  109. package/build/utils.js +16 -2
  110. package/docker/chrome/Dockerfile +14 -14
  111. package/docker/chromium/Dockerfile +14 -14
  112. package/docker/edge/.dockerignore +16 -0
  113. package/docker/edge/Dockerfile +43 -0
  114. package/docker/firefox/Dockerfile +14 -14
  115. package/docker/multi/Dockerfile +18 -18
  116. package/docker/sdk/Dockerfile +10 -0
  117. package/package.json +18 -18
  118. package/src/browserless.ts +4 -0
  119. package/src/browsers/browsers.cdp.ts +5 -0
  120. package/src/browsers/browsers.playwright.ts +6 -0
  121. package/src/browsers/index.ts +4 -1
  122. package/src/http.ts +9 -0
  123. package/src/routes/chrome/tests/kill-sessions.spec.ts +1 -1
  124. package/src/routes/chromium/tests/kill-sessions.spec.ts +1 -1
  125. package/src/routes/edge/http/content.post.ts +20 -0
  126. package/src/routes/edge/http/download.post.ts +20 -0
  127. package/src/routes/edge/http/function.post.ts +20 -0
  128. package/src/routes/edge/http/json-list.get.ts +7 -0
  129. package/src/routes/edge/http/json-new.put.ts +7 -0
  130. package/src/routes/edge/http/json-protocol.get.ts +7 -0
  131. package/src/routes/edge/http/json-version.get.ts +7 -0
  132. package/src/routes/edge/http/pdf.post.ts +20 -0
  133. package/src/routes/edge/http/performance.post.ts +20 -0
  134. package/src/routes/edge/http/scrape.post.ts +20 -0
  135. package/src/routes/edge/http/screenshot.post.ts +20 -0
  136. package/src/routes/edge/tests/content.spec.ts +376 -0
  137. package/src/routes/edge/tests/download.spec.ts +77 -0
  138. package/src/routes/edge/tests/function.spec.ts +317 -0
  139. package/src/routes/edge/tests/json-version.spec.ts +52 -0
  140. package/src/routes/edge/tests/kill-sessions.spec.ts +99 -0
  141. package/src/routes/edge/tests/page-websocket.spec.ts +129 -0
  142. package/src/routes/edge/tests/pdf.spec.ts +389 -0
  143. package/src/routes/edge/tests/performance.spec.ts +155 -0
  144. package/src/routes/edge/tests/scrape.spec.ts +417 -0
  145. package/src/routes/edge/tests/screenshot.spec.ts +387 -0
  146. package/src/routes/edge/tests/websocket.spec.ts +510 -0
  147. package/src/routes/edge/ws/browser.ts +10 -0
  148. package/src/routes/edge/ws/cdp.ts +17 -0
  149. package/src/routes/edge/ws/page.ts +10 -0
  150. package/src/routes/edge/ws/playwright.ts +17 -0
  151. package/src/routes/firefox/tests/kill-sessions.spec.ts +1 -1
  152. package/src/routes/webkit/tests/kill-sessions.spec.ts +1 -1
  153. package/src/sdk-utils.ts +1 -1
  154. package/src/shared/scrape.http.ts +2 -2
  155. package/src/types.ts +19 -0
  156. package/src/utils.ts +38 -16
  157. package/static/docs/swagger.json +2097 -10
  158. package/static/docs/swagger.min.json +2096 -9
  159. package/static/function/client.js +76 -68
  160. package/static/function/index.html +76 -68
@@ -0,0 +1,183 @@
1
+ {
2
+ "additionalProperties": false,
3
+ "type": "object",
4
+ "properties": {
5
+ "blockAds": {
6
+ "description": "Whether or nor to load ad-blocking extensions for the session.\nThis currently uses uBlock Origin and may cause certain sites\nto not load properly.",
7
+ "type": "boolean"
8
+ },
9
+ "launch": {
10
+ "anyOf": [
11
+ {
12
+ "$ref": "#/definitions/CDPLaunchOptions"
13
+ },
14
+ {
15
+ "type": "string"
16
+ }
17
+ ]
18
+ },
19
+ "timeout": {
20
+ "description": "Override the system-level timeout for this request.\nAccepts a value in milliseconds.",
21
+ "type": "number"
22
+ },
23
+ "token": {
24
+ "description": "The authorization token",
25
+ "type": "string"
26
+ },
27
+ "trackingId": {
28
+ "description": "Custom session identifier",
29
+ "type": "string"
30
+ }
31
+ },
32
+ "definitions": {
33
+ "CDPLaunchOptions": {
34
+ "type": "object",
35
+ "properties": {
36
+ "args": {
37
+ "type": "array",
38
+ "items": {
39
+ "type": "string"
40
+ }
41
+ },
42
+ "defaultViewport": {
43
+ "type": "object",
44
+ "properties": {
45
+ "deviceScaleFactor": {
46
+ "type": "number"
47
+ },
48
+ "hasTouch": {
49
+ "type": "boolean"
50
+ },
51
+ "height": {
52
+ "type": "number"
53
+ },
54
+ "isLandscape": {
55
+ "type": "boolean"
56
+ },
57
+ "isMobile": {
58
+ "type": "boolean"
59
+ },
60
+ "width": {
61
+ "type": "number"
62
+ }
63
+ },
64
+ "additionalProperties": false,
65
+ "required": [
66
+ "height",
67
+ "width"
68
+ ]
69
+ },
70
+ "devtools": {
71
+ "type": "boolean"
72
+ },
73
+ "dumpio": {
74
+ "type": "boolean"
75
+ },
76
+ "headless": {
77
+ "enum": [
78
+ false,
79
+ "shell",
80
+ true
81
+ ]
82
+ },
83
+ "ignoreDefaultArgs": {
84
+ "anyOf": [
85
+ {
86
+ "type": "array",
87
+ "items": {
88
+ "type": "string"
89
+ }
90
+ },
91
+ {
92
+ "type": "boolean"
93
+ }
94
+ ]
95
+ },
96
+ "ignoreHTTPSErrors": {
97
+ "type": "boolean"
98
+ },
99
+ "slowMo": {
100
+ "type": "number"
101
+ },
102
+ "stealth": {
103
+ "type": "boolean"
104
+ },
105
+ "timeout": {
106
+ "type": "number"
107
+ },
108
+ "userDataDir": {
109
+ "type": "string"
110
+ },
111
+ "waitForInitialPage": {
112
+ "type": "boolean"
113
+ }
114
+ },
115
+ "additionalProperties": false
116
+ },
117
+ "BrowserServerOptions": {
118
+ "type": "object",
119
+ "properties": {
120
+ "args": {
121
+ "type": "array",
122
+ "items": {
123
+ "type": "string"
124
+ }
125
+ },
126
+ "chromiumSandbox": {
127
+ "type": "boolean"
128
+ },
129
+ "devtools": {
130
+ "type": "boolean"
131
+ },
132
+ "downloadsPath": {
133
+ "type": "string"
134
+ },
135
+ "headless": {
136
+ "type": "boolean"
137
+ },
138
+ "ignoreDefaultArgs": {
139
+ "anyOf": [
140
+ {
141
+ "type": "array",
142
+ "items": {
143
+ "type": "string"
144
+ }
145
+ },
146
+ {
147
+ "type": "boolean"
148
+ }
149
+ ]
150
+ },
151
+ "proxy": {
152
+ "type": "object",
153
+ "properties": {
154
+ "bypass": {
155
+ "type": "string"
156
+ },
157
+ "password": {
158
+ "type": "string"
159
+ },
160
+ "server": {
161
+ "type": "string"
162
+ },
163
+ "username": {
164
+ "type": "string"
165
+ }
166
+ },
167
+ "additionalProperties": false,
168
+ "required": [
169
+ "server"
170
+ ]
171
+ },
172
+ "timeout": {
173
+ "type": "number"
174
+ },
175
+ "tracesDir": {
176
+ "type": "string"
177
+ }
178
+ },
179
+ "additionalProperties": false
180
+ }
181
+ },
182
+ "$schema": "http://json-schema.org/draft-07/schema#"
183
+ }
@@ -0,0 +1,334 @@
1
+ {
2
+ "description": "The JSON response body",
3
+ "type": "object",
4
+ "properties": {
5
+ "data": {
6
+ "anyOf": [
7
+ {
8
+ "type": "array",
9
+ "items": {
10
+ "type": "object",
11
+ "properties": {
12
+ "results": {
13
+ "type": "array",
14
+ "items": {
15
+ "type": "object",
16
+ "properties": {
17
+ "attributes": {
18
+ "description": "A list of HTML attributes of the element",
19
+ "type": "array",
20
+ "items": {
21
+ "type": "object",
22
+ "properties": {
23
+ "name": {
24
+ "description": "The name of the HTML attribute for the element",
25
+ "type": "string"
26
+ },
27
+ "value": {
28
+ "description": "The value of the HTML attribute for the element",
29
+ "type": "string"
30
+ }
31
+ },
32
+ "additionalProperties": false,
33
+ "required": [
34
+ "name",
35
+ "value"
36
+ ]
37
+ }
38
+ },
39
+ "height": {
40
+ "description": "The height the element",
41
+ "type": "number"
42
+ },
43
+ "html": {
44
+ "description": "The HTML the element",
45
+ "type": "string"
46
+ },
47
+ "left": {
48
+ "description": "The amount of pixels from the left of the page",
49
+ "type": "number"
50
+ },
51
+ "text": {
52
+ "description": "The text the element",
53
+ "type": "string"
54
+ },
55
+ "top": {
56
+ "description": "The amount of pixels from the top of the page",
57
+ "type": "number"
58
+ },
59
+ "width": {
60
+ "description": "The width the element",
61
+ "type": "number"
62
+ }
63
+ },
64
+ "additionalProperties": false,
65
+ "required": [
66
+ "attributes",
67
+ "height",
68
+ "html",
69
+ "left",
70
+ "text",
71
+ "top",
72
+ "width"
73
+ ]
74
+ }
75
+ },
76
+ "selector": {
77
+ "description": "The DOM selector of the element",
78
+ "type": "string"
79
+ }
80
+ },
81
+ "additionalProperties": false,
82
+ "required": [
83
+ "results",
84
+ "selector"
85
+ ]
86
+ }
87
+ },
88
+ {
89
+ "type": "null"
90
+ }
91
+ ]
92
+ },
93
+ "debug": {
94
+ "description": "When debugOpts options are present, results are here",
95
+ "anyOf": [
96
+ {
97
+ "type": "object",
98
+ "properties": {
99
+ "console": {
100
+ "description": "A list of console messages from the browser",
101
+ "type": "array",
102
+ "items": {
103
+ "type": "string"
104
+ }
105
+ },
106
+ "cookies": {
107
+ "description": "List of cookies for the site or null",
108
+ "anyOf": [
109
+ {
110
+ "type": "array",
111
+ "items": {
112
+ "$ref": "#/definitions/Cookie"
113
+ }
114
+ },
115
+ {
116
+ "type": "null"
117
+ }
118
+ ]
119
+ },
120
+ "html": {
121
+ "description": "The HTML string of the website or null",
122
+ "type": [
123
+ "null",
124
+ "string"
125
+ ]
126
+ },
127
+ "network": {
128
+ "type": "object",
129
+ "properties": {
130
+ "inbound": {
131
+ "type": "array",
132
+ "items": {
133
+ "$ref": "#/definitions/InBoundRequest"
134
+ }
135
+ },
136
+ "outbound": {
137
+ "type": "array",
138
+ "items": {
139
+ "$ref": "#/definitions/OutBoundRequest"
140
+ }
141
+ }
142
+ },
143
+ "additionalProperties": false,
144
+ "required": [
145
+ "inbound",
146
+ "outbound"
147
+ ]
148
+ },
149
+ "screenshot": {
150
+ "description": "A base64-encoded string of the site or null",
151
+ "type": [
152
+ "null",
153
+ "string"
154
+ ]
155
+ }
156
+ },
157
+ "additionalProperties": false,
158
+ "required": [
159
+ "console",
160
+ "cookies",
161
+ "html",
162
+ "network",
163
+ "screenshot"
164
+ ]
165
+ },
166
+ {
167
+ "type": "null"
168
+ }
169
+ ]
170
+ }
171
+ },
172
+ "additionalProperties": false,
173
+ "required": [
174
+ "data",
175
+ "debug"
176
+ ],
177
+ "definitions": {
178
+ "Cookie": {
179
+ "description": "Represents a cookie object.",
180
+ "type": "object",
181
+ "properties": {
182
+ "name": {
183
+ "description": "Cookie name.",
184
+ "type": "string"
185
+ },
186
+ "value": {
187
+ "description": "Cookie value.",
188
+ "type": "string"
189
+ },
190
+ "domain": {
191
+ "description": "Cookie domain.",
192
+ "type": "string"
193
+ },
194
+ "path": {
195
+ "description": "Cookie path.",
196
+ "type": "string"
197
+ },
198
+ "expires": {
199
+ "description": "Cookie expiration date as the number of seconds since the UNIX epoch. Set to `-1` for\nsession cookies",
200
+ "type": "number"
201
+ },
202
+ "size": {
203
+ "description": "Cookie size.",
204
+ "type": "number"
205
+ },
206
+ "httpOnly": {
207
+ "description": "True if cookie is http-only.",
208
+ "type": "boolean"
209
+ },
210
+ "secure": {
211
+ "description": "True if cookie is secure.",
212
+ "type": "boolean"
213
+ },
214
+ "session": {
215
+ "description": "True in case of session cookie.",
216
+ "type": "boolean"
217
+ },
218
+ "sameSite": {
219
+ "description": "Cookie SameSite type.",
220
+ "enum": [
221
+ "Lax",
222
+ "None",
223
+ "Strict"
224
+ ],
225
+ "type": "string"
226
+ },
227
+ "priority": {
228
+ "description": "Cookie Priority. Supported only in Chrome.",
229
+ "enum": [
230
+ "High",
231
+ "Low",
232
+ "Medium"
233
+ ],
234
+ "type": "string"
235
+ },
236
+ "sameParty": {
237
+ "description": "True if cookie is SameParty. Supported only in Chrome.",
238
+ "type": "boolean"
239
+ },
240
+ "sourceScheme": {
241
+ "description": "Cookie source scheme type. Supported only in Chrome.",
242
+ "enum": [
243
+ "NonSecure",
244
+ "Secure",
245
+ "Unset"
246
+ ],
247
+ "type": "string"
248
+ },
249
+ "partitionKey": {
250
+ "description": "Cookie partition key. In Chrome, it is the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n(https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey).",
251
+ "anyOf": [
252
+ {
253
+ "$ref": "#/definitions/CookiePartitionKey"
254
+ },
255
+ {
256
+ "type": "string"
257
+ }
258
+ ]
259
+ },
260
+ "partitionKeyOpaque": {
261
+ "description": "True if cookie partition key is opaque. Supported only in Chrome.",
262
+ "type": "boolean"
263
+ }
264
+ },
265
+ "additionalProperties": false,
266
+ "required": [
267
+ "domain",
268
+ "expires",
269
+ "httpOnly",
270
+ "name",
271
+ "path",
272
+ "secure",
273
+ "session",
274
+ "size",
275
+ "value"
276
+ ]
277
+ },
278
+ "CookiePartitionKey": {
279
+ "description": "Represents a cookie partition key in Chrome.",
280
+ "type": "object",
281
+ "properties": {
282
+ "sourceOrigin": {
283
+ "description": "The site of the top-level URL the browser was visiting at the start of the request\nto the endpoint that set the cookie.\n\nIn Chrome, maps to the CDP's `topLevelSite` partition key.",
284
+ "type": "string"
285
+ },
286
+ "hasCrossSiteAncestor": {
287
+ "description": "Indicates if the cookie has any ancestors that are cross-site to\nthe topLevelSite.\n\nSupported only in Chrome.",
288
+ "type": "boolean"
289
+ }
290
+ },
291
+ "additionalProperties": false,
292
+ "required": [
293
+ "sourceOrigin"
294
+ ]
295
+ },
296
+ "InBoundRequest": {
297
+ "type": "object",
298
+ "properties": {
299
+ "headers": {},
300
+ "status": {
301
+ "type": "number"
302
+ },
303
+ "url": {
304
+ "type": "string"
305
+ }
306
+ },
307
+ "additionalProperties": false,
308
+ "required": [
309
+ "headers",
310
+ "status",
311
+ "url"
312
+ ]
313
+ },
314
+ "OutBoundRequest": {
315
+ "type": "object",
316
+ "properties": {
317
+ "headers": {},
318
+ "method": {
319
+ "type": "string"
320
+ },
321
+ "url": {
322
+ "type": "string"
323
+ }
324
+ },
325
+ "additionalProperties": false,
326
+ "required": [
327
+ "headers",
328
+ "method",
329
+ "url"
330
+ ]
331
+ }
332
+ },
333
+ "$schema": "http://json-schema.org/draft-07/schema#"
334
+ }