@browserless.io/browserless 2.3.0-beta-1 → 2.3.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 (208) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/README.md +2 -2
  3. package/bin/browserless.js +47 -18
  4. package/bin/scaffold/README.md +50 -0
  5. package/bin/scaffold/src/hello-world.http.ts +2 -1
  6. package/build/browserless.d.ts +3 -5
  7. package/build/browserless.js +17 -11
  8. package/build/browsers/chrome.cdp.js +1 -1
  9. package/build/browsers/chrome.playwright.js +1 -1
  10. package/build/browsers/index.d.ts +1 -0
  11. package/build/browsers/index.js +4 -1
  12. package/build/data/classes.json +1 -1
  13. package/build/data/selectors.json +1 -1
  14. package/build/exports.d.ts +24 -38
  15. package/build/exports.js +25 -44
  16. package/build/limiter.d.ts +2 -1
  17. package/build/limiter.js +6 -3
  18. package/build/routes/chrome/http/content.post.body.json +8 -8
  19. package/build/routes/chrome/http/content.post.d.ts +2 -1
  20. package/build/routes/chrome/http/content.post.js +3 -2
  21. package/build/routes/chrome/http/download.post.body.json +11 -489
  22. package/build/routes/chrome/http/download.post.d.ts +2 -1
  23. package/build/routes/chrome/http/download.post.js +3 -2
  24. package/build/routes/chrome/http/download.post.query.json +6 -69
  25. package/build/routes/chrome/http/download.post.response.json +0 -1
  26. package/build/routes/chrome/http/function.post.body.json +11 -489
  27. package/build/routes/chrome/http/function.post.d.ts +2 -1
  28. package/build/routes/chrome/http/function.post.js +3 -2
  29. package/build/routes/chrome/http/function.post.query.json +6 -69
  30. package/build/routes/chrome/http/function.post.response.json +0 -1
  31. package/build/routes/chrome/http/json-list.get.d.ts +5 -1
  32. package/build/routes/chrome/http/json-list.get.js +5 -1
  33. package/build/routes/chrome/http/json-list.get.response.json +49 -1
  34. package/build/routes/chrome/http/json-new.put.d.ts +5 -1
  35. package/build/routes/chrome/http/json-new.put.js +5 -1
  36. package/build/routes/chrome/http/json-new.put.response.json +41 -1
  37. package/build/routes/chrome/http/json-protocol.get.d.ts +5 -1
  38. package/build/routes/chrome/http/json-protocol.get.js +5 -1
  39. package/build/routes/chrome/http/json-protocol.get.response.json +3 -1
  40. package/build/routes/chrome/http/json-version.get.d.ts +5 -1
  41. package/build/routes/chrome/http/json-version.get.js +5 -1
  42. package/build/routes/chrome/http/json-version.get.response.json +41 -1
  43. package/build/routes/chrome/http/pdf.post.body.json +153 -9
  44. package/build/routes/chrome/http/pdf.post.d.ts +2 -1
  45. package/build/routes/chrome/http/pdf.post.js +3 -2
  46. package/build/routes/chrome/http/pdf.post.query.json +6 -69
  47. package/build/routes/chrome/http/performance.post.body.json +10 -494
  48. package/build/routes/chrome/http/performance.post.d.ts +2 -1
  49. package/build/routes/chrome/http/performance.post.js +3 -2
  50. package/build/routes/chrome/http/performance.post.query.json +6 -69
  51. package/build/routes/chrome/http/performance.post.response.json +3 -1
  52. package/build/routes/chrome/http/scrape.post.body.json +56 -9
  53. package/build/routes/chrome/http/scrape.post.d.ts +2 -1
  54. package/build/routes/chrome/http/scrape.post.js +3 -2
  55. package/build/routes/chrome/http/scrape.post.response.json +305 -1
  56. package/build/routes/chrome/http/screenshot.post.body.json +99 -9
  57. package/build/routes/chrome/http/screenshot.post.d.ts +2 -1
  58. package/build/routes/chrome/http/screenshot.post.js +3 -2
  59. package/build/routes/chrome/http/screenshot.post.query.json +6 -69
  60. package/build/routes/chrome/ws/browser.d.ts +2 -1
  61. package/build/routes/chrome/ws/browser.js +3 -2
  62. package/build/routes/chrome/ws/browser.query.json +6 -69
  63. package/build/routes/chrome/ws/cdp.d.ts +2 -1
  64. package/build/routes/chrome/ws/cdp.js +3 -2
  65. package/build/routes/chrome/ws/cdp.query.json +6 -69
  66. package/build/routes/chrome/ws/page.d.ts +3 -2
  67. package/build/routes/chrome/ws/page.js +3 -2
  68. package/build/routes/chrome/ws/page.query.json +6 -69
  69. package/build/routes/chrome/ws/playwright.d.ts +1 -0
  70. package/build/routes/chrome/ws/playwright.js +2 -1
  71. package/build/routes/chrome/ws/playwright.query.json +7 -90
  72. package/build/routes/chromium/http/content.post.body.json +8 -8
  73. package/build/routes/chromium/http/download.post.body.json +11 -489
  74. package/build/routes/chromium/http/download.post.query.json +6 -69
  75. package/build/routes/chromium/http/download.post.response.json +0 -1
  76. package/build/routes/chromium/http/function.post.body.json +11 -489
  77. package/build/routes/chromium/http/function.post.query.json +6 -69
  78. package/build/routes/chromium/http/function.post.response.json +0 -1
  79. package/build/routes/chromium/http/json-list.get.response.json +49 -1
  80. package/build/routes/chromium/http/json-new.put.response.json +41 -1
  81. package/build/routes/chromium/http/json-protocol.get.response.json +3 -1
  82. package/build/routes/chromium/http/json-version.get.response.json +41 -1
  83. package/build/routes/chromium/http/pdf.post.body.json +153 -9
  84. package/build/routes/chromium/http/pdf.post.query.json +6 -69
  85. package/build/routes/chromium/http/performance.post.body.json +10 -494
  86. package/build/routes/chromium/http/performance.post.query.json +6 -69
  87. package/build/routes/chromium/http/performance.post.response.json +3 -1
  88. package/build/routes/chromium/http/scrape.post.body.json +56 -9
  89. package/build/routes/chromium/http/scrape.post.response.json +305 -1
  90. package/build/routes/chromium/http/screenshot.post.body.json +99 -9
  91. package/build/routes/chromium/http/screenshot.post.query.json +6 -69
  92. package/build/routes/chromium/ws/browser.query.json +6 -69
  93. package/build/routes/chromium/ws/cdp.query.json +6 -69
  94. package/build/routes/chromium/ws/page.query.json +6 -69
  95. package/build/routes/chromium/ws/playwright.query.json +7 -90
  96. package/build/routes/firefox/ws/playwright.d.ts +2 -1
  97. package/build/routes/firefox/ws/playwright.js +3 -2
  98. package/build/routes/firefox/ws/playwright.query.json +30 -115
  99. package/build/routes/management/http/config.get.d.ts +1 -0
  100. package/build/routes/management/http/config.get.js +2 -1
  101. package/build/routes/management/http/config.get.response.json +104 -1
  102. package/build/routes/management/http/metrics-total.get.d.ts +1 -0
  103. package/build/routes/management/http/metrics-total.get.js +2 -1
  104. package/build/routes/management/http/metrics-total.get.response.json +69 -1
  105. package/build/routes/management/http/metrics.get.d.ts +1 -0
  106. package/build/routes/management/http/metrics.get.js +2 -1
  107. package/build/routes/management/http/metrics.get.response.json +91 -1
  108. package/build/routes/management/http/sessions.get.d.ts +1 -0
  109. package/build/routes/management/http/sessions.get.js +2 -1
  110. package/build/routes/management/http/sessions.get.response.json +232 -1
  111. package/build/routes/management/http/static.get.d.ts +1 -0
  112. package/build/routes/management/http/static.get.js +2 -1
  113. package/build/routes/webkit/ws/playwright.d.ts +2 -1
  114. package/build/routes/webkit/ws/playwright.js +3 -2
  115. package/build/routes/webkit/ws/playwright.query.json +7 -90
  116. package/build/shared/browser.ws.d.ts +2 -1
  117. package/build/shared/browser.ws.js +3 -2
  118. package/build/shared/chromium.playwright.ws.d.ts +2 -1
  119. package/build/shared/chromium.playwright.ws.js +3 -2
  120. package/build/shared/chromium.ws.d.ts +2 -1
  121. package/build/shared/chromium.ws.js +3 -2
  122. package/build/shared/content.http.d.ts +2 -1
  123. package/build/shared/content.http.js +3 -2
  124. package/build/shared/download.http.d.ts +2 -1
  125. package/build/shared/download.http.js +3 -2
  126. package/build/shared/function.http.d.ts +2 -1
  127. package/build/shared/function.http.js +3 -2
  128. package/build/shared/json-list.http.d.ts +2 -1
  129. package/build/shared/json-list.http.js +3 -2
  130. package/build/shared/json-new.http.d.ts +2 -1
  131. package/build/shared/json-new.http.js +3 -2
  132. package/build/shared/json-protocol.http.d.ts +2 -1
  133. package/build/shared/json-protocol.http.js +3 -2
  134. package/build/shared/json-version.http.d.ts +2 -1
  135. package/build/shared/json-version.http.js +3 -2
  136. package/build/shared/page.ws.d.ts +2 -1
  137. package/build/shared/page.ws.js +3 -2
  138. package/build/shared/pdf.http.d.ts +2 -1
  139. package/build/shared/pdf.http.js +3 -2
  140. package/build/shared/performance.http.d.ts +1 -0
  141. package/build/shared/performance.http.js +2 -1
  142. package/build/shared/scrape.http.d.ts +2 -1
  143. package/build/shared/scrape.http.js +3 -2
  144. package/build/shared/screenshot.http.d.ts +1 -0
  145. package/build/shared/screenshot.http.js +2 -1
  146. package/build/types.d.ts +91 -0
  147. package/build/types.js +54 -0
  148. package/build/utils.d.ts +1 -1
  149. package/build/utils.js +11 -6
  150. package/docker/chrome/Dockerfile +0 -2
  151. package/docker/chromium/Dockerfile +1 -4
  152. package/docker/firefox/Dockerfile +1 -4
  153. package/docker/multi/Dockerfile +2 -6
  154. package/docker/webkit/Dockerfile +1 -4
  155. package/package.json +11 -10
  156. package/scripts/build-open-api.js +150 -141
  157. package/scripts/build-schemas.js +3 -2
  158. package/src/browserless.ts +43 -30
  159. package/src/browsers/chrome.cdp.ts +1 -1
  160. package/src/browsers/chrome.playwright.ts +1 -1
  161. package/src/browsers/index.ts +5 -1
  162. package/src/exports.ts +25 -49
  163. package/src/limiter.ts +7 -3
  164. package/src/routes/chrome/http/content.post.ts +7 -2
  165. package/src/routes/chrome/http/download.post.ts +7 -2
  166. package/src/routes/chrome/http/function.post.ts +7 -2
  167. package/src/routes/chrome/http/json-list.get.ts +7 -1
  168. package/src/routes/chrome/http/json-new.put.ts +7 -1
  169. package/src/routes/chrome/http/json-protocol.get.ts +7 -1
  170. package/src/routes/chrome/http/json-version.get.ts +7 -1
  171. package/src/routes/chrome/http/pdf.post.ts +7 -2
  172. package/src/routes/chrome/http/performance.post.ts +7 -2
  173. package/src/routes/chrome/http/scrape.post.ts +7 -2
  174. package/src/routes/chrome/http/screenshot.post.ts +7 -2
  175. package/src/routes/chrome/ws/browser.ts +3 -2
  176. package/src/routes/chrome/ws/cdp.ts +7 -2
  177. package/src/routes/chrome/ws/page.ts +3 -2
  178. package/src/routes/chrome/ws/playwright.ts +6 -1
  179. package/src/routes/firefox/ws/playwright.ts +3 -1
  180. package/src/routes/management/http/config.get.ts +2 -0
  181. package/src/routes/management/http/metrics-total.get.ts +2 -0
  182. package/src/routes/management/http/metrics.get.ts +2 -0
  183. package/src/routes/management/http/sessions.get.ts +2 -0
  184. package/src/routes/management/http/static.get.ts +2 -0
  185. package/src/routes/webkit/ws/playwright.ts +3 -1
  186. package/src/shared/browser.ws.ts +3 -1
  187. package/src/shared/chromium.playwright.ws.ts +3 -1
  188. package/src/shared/chromium.ws.ts +3 -1
  189. package/src/shared/content.http.ts +3 -1
  190. package/src/shared/download.http.ts +3 -1
  191. package/src/shared/function.http.ts +3 -1
  192. package/src/shared/json-list.http.ts +3 -1
  193. package/src/shared/json-new.http.ts +3 -1
  194. package/src/shared/json-protocol.http.ts +3 -1
  195. package/src/shared/json-version.http.ts +3 -1
  196. package/src/shared/page.ws.ts +3 -1
  197. package/src/shared/pdf.http.ts +3 -1
  198. package/src/shared/performance.http.ts +2 -0
  199. package/src/shared/scrape.http.ts +3 -1
  200. package/src/shared/screenshot.http.ts +2 -0
  201. package/src/types.ts +66 -0
  202. package/src/utils.ts +13 -7
  203. package/static/docs/swagger.json +2511 -1520
  204. package/static/docs/swagger.min.json +6697 -0
  205. package/static/function/client.js +323 -323
  206. package/build/exports.core.d.ts +0 -24
  207. package/build/exports.core.js +0 -26
  208. package/src/exports.core.ts +0 -26
@@ -1,120 +1,9 @@
1
1
  {
2
- "additionalProperties": false,
3
2
  "type": "object",
4
3
  "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
4
  "launch": {
10
- "anyOf": [
11
- {
12
- "$ref": "#/definitions/CDPLaunchOptions"
13
- },
14
- {
15
- "type": "string"
16
- }
17
- ]
18
- },
19
- "record": {
20
- "description": "Whether or nor to record the session. The browser will run\nin \"head-full\" mode, and recording is started and closed\nvia the embedded browserless API. Please refer to the \"Recording\"\nsection in the live documentation site for more details.",
21
- "type": "boolean"
22
- },
23
- "timeout": {
24
- "description": "Override the system-level timeout for this request.\nAccepts a value in milliseconds.",
25
- "type": "number"
26
- },
27
- "token": {
28
- "description": "The authorization token",
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": {
5
+ "description": "Launch options, which can be either an object\nof puppeteer.launch options or playwright.launchServer\noptions, depending on the API. Must be either JSON\nobject, or a base64-encoded JSON object.",
6
+ "additionalProperties": false,
118
7
  "type": "object",
119
8
  "properties": {
120
9
  "args": {
@@ -174,10 +63,36 @@
174
63
  },
175
64
  "tracesDir": {
176
65
  "type": "string"
66
+ },
67
+ "firefoxUserPrefs": {
68
+ "type": "object",
69
+ "additionalProperties": {
70
+ "type": [
71
+ "string",
72
+ "number",
73
+ "boolean"
74
+ ]
75
+ }
177
76
  }
178
- },
179
- "additionalProperties": false
77
+ }
78
+ },
79
+ "blockAds": {
80
+ "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.",
81
+ "type": "boolean"
82
+ },
83
+ "record": {
84
+ "description": "Whether or nor to record the session. The browser will run\nin \"head-full\" mode, and recording is started and closed\nvia the embedded browserless API. Please refer to the \"Recording\"\nsection in the live documentation site for more details.",
85
+ "type": "boolean"
86
+ },
87
+ "timeout": {
88
+ "description": "Override the system-level timeout for this request.\nAccepts a value in milliseconds.",
89
+ "type": "number"
90
+ },
91
+ "token": {
92
+ "description": "The authorization token",
93
+ "type": "string"
180
94
  }
181
95
  },
96
+ "additionalProperties": false,
182
97
  "$schema": "http://json-schema.org/draft-07/schema#"
183
98
  }
@@ -24,6 +24,7 @@ export interface ResponseSchema {
24
24
  token: string | null;
25
25
  }
26
26
  export default class ConfigGetRoute extends HTTPRoute {
27
+ name: string;
27
28
  accepts: contentTypes[];
28
29
  auth: boolean;
29
30
  browser: null;
@@ -1,5 +1,6 @@
1
- import { APITags, HTTPManagementRoutes, HTTPRoute, Methods, contentTypes, jsonResponse, } from '@browserless.io/browserless';
1
+ import { APITags, BrowserlessRoutes, HTTPManagementRoutes, HTTPRoute, Methods, contentTypes, jsonResponse, } from '@browserless.io/browserless';
2
2
  export default class ConfigGetRoute extends HTTPRoute {
3
+ name = BrowserlessRoutes.ConfigGetRoute;
3
4
  accepts = [contentTypes.any];
4
5
  auth = true;
5
6
  browser = null;
@@ -1,4 +1,107 @@
1
1
  {
2
- "type": "string",
2
+ "type": "object",
3
+ "properties": {
4
+ "allowCORS": {
5
+ "type": "boolean"
6
+ },
7
+ "allowFileProtocol": {
8
+ "type": "boolean"
9
+ },
10
+ "allowGetCalls": {
11
+ "type": "boolean"
12
+ },
13
+ "concurrent": {
14
+ "type": "number"
15
+ },
16
+ "data": {
17
+ "type": "string"
18
+ },
19
+ "debug": {
20
+ "type": "string"
21
+ },
22
+ "errorAlertURL": {
23
+ "type": [
24
+ "null",
25
+ "string"
26
+ ]
27
+ },
28
+ "healthFailureURL": {
29
+ "type": [
30
+ "null",
31
+ "string"
32
+ ]
33
+ },
34
+ "host": {
35
+ "type": "string"
36
+ },
37
+ "maxCPU": {
38
+ "type": "number"
39
+ },
40
+ "maxMemory": {
41
+ "type": "number"
42
+ },
43
+ "metricsJSONPath": {
44
+ "type": "string"
45
+ },
46
+ "port": {
47
+ "type": "number"
48
+ },
49
+ "queued": {
50
+ "type": "number"
51
+ },
52
+ "queuedAlertURL": {
53
+ "type": [
54
+ "null",
55
+ "string"
56
+ ]
57
+ },
58
+ "rejectAlertURL": {
59
+ "type": [
60
+ "null",
61
+ "string"
62
+ ]
63
+ },
64
+ "retries": {
65
+ "type": "number"
66
+ },
67
+ "timeout": {
68
+ "type": "number"
69
+ },
70
+ "timeoutAlertURL": {
71
+ "type": [
72
+ "null",
73
+ "string"
74
+ ]
75
+ },
76
+ "token": {
77
+ "type": [
78
+ "null",
79
+ "string"
80
+ ]
81
+ }
82
+ },
83
+ "additionalProperties": false,
84
+ "required": [
85
+ "allowCORS",
86
+ "allowFileProtocol",
87
+ "allowGetCalls",
88
+ "concurrent",
89
+ "data",
90
+ "debug",
91
+ "errorAlertURL",
92
+ "healthFailureURL",
93
+ "host",
94
+ "maxCPU",
95
+ "maxMemory",
96
+ "metricsJSONPath",
97
+ "port",
98
+ "queued",
99
+ "queuedAlertURL",
100
+ "rejectAlertURL",
101
+ "retries",
102
+ "timeout",
103
+ "timeoutAlertURL",
104
+ "token"
105
+ ],
3
106
  "$schema": "http://json-schema.org/draft-07/schema#"
4
107
  }
@@ -3,6 +3,7 @@ import { APITags, HTTPManagementRoutes, HTTPRoute, IBrowserlessMetricTotals, Met
3
3
  import { ServerResponse } from 'http';
4
4
  export type ResponseSchema = IBrowserlessMetricTotals;
5
5
  export default class MetricsTotalGetRoute extends HTTPRoute {
6
+ name: string;
6
7
  accepts: contentTypes[];
7
8
  auth: boolean;
8
9
  browser: null;
@@ -1,6 +1,7 @@
1
- import { APITags, HTTPManagementRoutes, HTTPRoute, Methods, contentTypes, writeResponse, } from '@browserless.io/browserless';
1
+ import { APITags, BrowserlessRoutes, HTTPManagementRoutes, HTTPRoute, Methods, contentTypes, writeResponse, } from '@browserless.io/browserless';
2
2
  const fiveMinuteIntervalsInAMonth = 8640;
3
3
  export default class MetricsTotalGetRoute extends HTTPRoute {
4
+ name = BrowserlessRoutes.MetricsTotalGetRoute;
4
5
  accepts = [contentTypes.any];
5
6
  auth = true;
6
7
  browser = null;
@@ -1,4 +1,72 @@
1
1
  {
2
- "type": "string",
2
+ "type": "object",
3
+ "properties": {
4
+ "error": {
5
+ "type": "number"
6
+ },
7
+ "estimatedMonthlyUnits": {
8
+ "type": "number"
9
+ },
10
+ "maxConcurrent": {
11
+ "type": "number"
12
+ },
13
+ "maxTime": {
14
+ "type": "number"
15
+ },
16
+ "meanTime": {
17
+ "type": "number"
18
+ },
19
+ "minTime": {
20
+ "type": "number"
21
+ },
22
+ "minutesOfMetricsAvailable": {
23
+ "type": "number"
24
+ },
25
+ "queued": {
26
+ "type": "number"
27
+ },
28
+ "rejected": {
29
+ "type": "number"
30
+ },
31
+ "sessionTimes": {
32
+ "type": "array",
33
+ "items": {
34
+ "type": "number"
35
+ }
36
+ },
37
+ "successful": {
38
+ "type": "number"
39
+ },
40
+ "timedout": {
41
+ "type": "number"
42
+ },
43
+ "totalTime": {
44
+ "type": "number"
45
+ },
46
+ "unhealthy": {
47
+ "type": "number"
48
+ },
49
+ "units": {
50
+ "type": "number"
51
+ }
52
+ },
53
+ "additionalProperties": false,
54
+ "required": [
55
+ "error",
56
+ "estimatedMonthlyUnits",
57
+ "maxConcurrent",
58
+ "maxTime",
59
+ "meanTime",
60
+ "minTime",
61
+ "minutesOfMetricsAvailable",
62
+ "queued",
63
+ "rejected",
64
+ "sessionTimes",
65
+ "successful",
66
+ "timedout",
67
+ "totalTime",
68
+ "unhealthy",
69
+ "units"
70
+ ],
3
71
  "$schema": "http://json-schema.org/draft-07/schema#"
4
72
  }
@@ -3,6 +3,7 @@ import { APITags, HTTPManagementRoutes, HTTPRoute, IBrowserlessStats, Methods, R
3
3
  import { ServerResponse } from 'http';
4
4
  export type ResponseSchema = Array<IBrowserlessStats>;
5
5
  export default class MetricsGetRoute extends HTTPRoute {
6
+ name: string;
6
7
  accepts: contentTypes[];
7
8
  auth: boolean;
8
9
  browser: null;
@@ -1,5 +1,6 @@
1
- import { APITags, HTTPManagementRoutes, HTTPRoute, Methods, contentTypes, writeResponse, } from '@browserless.io/browserless';
1
+ import { APITags, BrowserlessRoutes, HTTPManagementRoutes, HTTPRoute, Methods, contentTypes, writeResponse, } from '@browserless.io/browserless';
2
2
  export default class MetricsGetRoute extends HTTPRoute {
3
+ name = BrowserlessRoutes.MetricsGetRoute;
3
4
  accepts = [contentTypes.any];
4
5
  auth = true;
5
6
  browser = null;
@@ -1,4 +1,94 @@
1
1
  {
2
- "type": "string",
2
+ "type": "array",
3
+ "items": {
4
+ "$ref": "#/definitions/IBrowserlessStats"
5
+ },
6
+ "definitions": {
7
+ "IBrowserlessStats": {
8
+ "type": "object",
9
+ "properties": {
10
+ "cpu": {
11
+ "type": [
12
+ "null",
13
+ "number"
14
+ ]
15
+ },
16
+ "date": {
17
+ "type": "number"
18
+ },
19
+ "error": {
20
+ "type": "number"
21
+ },
22
+ "maxConcurrent": {
23
+ "type": "number"
24
+ },
25
+ "maxTime": {
26
+ "type": "number"
27
+ },
28
+ "meanTime": {
29
+ "type": "number"
30
+ },
31
+ "memory": {
32
+ "type": [
33
+ "null",
34
+ "number"
35
+ ]
36
+ },
37
+ "minTime": {
38
+ "type": "number"
39
+ },
40
+ "queued": {
41
+ "type": "number"
42
+ },
43
+ "rejected": {
44
+ "type": "number"
45
+ },
46
+ "sessionTimes": {
47
+ "type": "array",
48
+ "items": {
49
+ "type": "number"
50
+ }
51
+ },
52
+ "successful": {
53
+ "type": "number"
54
+ },
55
+ "timedout": {
56
+ "type": "number"
57
+ },
58
+ "totalTime": {
59
+ "type": "number"
60
+ },
61
+ "unauthorized": {
62
+ "type": "number"
63
+ },
64
+ "unhealthy": {
65
+ "type": "number"
66
+ },
67
+ "units": {
68
+ "type": "number"
69
+ }
70
+ },
71
+ "additionalProperties": false,
72
+ "required": [
73
+ "cpu",
74
+ "date",
75
+ "error",
76
+ "maxConcurrent",
77
+ "maxTime",
78
+ "meanTime",
79
+ "memory",
80
+ "minTime",
81
+ "queued",
82
+ "rejected",
83
+ "sessionTimes",
84
+ "successful",
85
+ "timedout",
86
+ "totalTime",
87
+ "unauthorized",
88
+ "unhealthy",
89
+ "units"
90
+ ]
91
+ }
92
+ },
3
93
  "$schema": "http://json-schema.org/draft-07/schema#"
4
94
  }
@@ -3,6 +3,7 @@ import { APITags, BrowserlessSessionJSON, HTTPManagementRoutes, HTTPRoute, Metho
3
3
  import { ServerResponse } from 'http';
4
4
  export type ResponseSchema = BrowserlessSessionJSON[];
5
5
  export default class SessionsGetRoute extends HTTPRoute {
6
+ name: string;
6
7
  accepts: contentTypes[];
7
8
  auth: boolean;
8
9
  browser: null;
@@ -1,5 +1,6 @@
1
- import { APITags, HTTPManagementRoutes, HTTPRoute, Methods, contentTypes, jsonResponse, } from '@browserless.io/browserless';
1
+ import { APITags, BrowserlessRoutes, HTTPManagementRoutes, HTTPRoute, Methods, contentTypes, jsonResponse, } from '@browserless.io/browserless';
2
2
  export default class SessionsGetRoute extends HTTPRoute {
3
+ name = BrowserlessRoutes.SessionsGetRoute;
3
4
  accepts = [contentTypes.any];
4
5
  auth = true;
5
6
  browser = null;