@govtechsg/oobee 0.10.42 → 0.10.45

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/REPORTS.md CHANGED
@@ -242,7 +242,9 @@ This file contains a summary of pages affected by accessibility issues.
242
242
  {
243
243
  "url": "<string>",
244
244
  "pageTitle": "<string>",
245
- "actualUrl": "about:blank"
245
+ "actualUrl": "<string>",
246
+ "metadata": "<string>",
247
+ "httpStatusCode": number
246
248
  },
247
249
  ],
248
250
  "pagesNotScannedCount": <number>
@@ -340,7 +342,9 @@ This file contains a summary of accessibility issues found in a scan, categorize
340
342
  {
341
343
  "url": "<string>",
342
344
  "pageTitle": "<string>",
343
- "actualUrl": "about:blank"
345
+ "actualUrl": "<string>",
346
+ "metadata": "<string>",
347
+ "httpStatusCode": number
344
348
  },
345
349
  ],
346
350
  "pagesNotScannedCount": <number>
@@ -360,3 +364,68 @@ To deflate the .json.gz.b64, use the following with `pako` library installed:
360
364
  // Parse and return the JSON object
361
365
  return JSON.parse(jsonString);
362
366
  ```
367
+
368
+ ## HTTP Status Codes Returned for Skipped Pages
369
+ In scanPagesSummary.json and scanPagesDetail,json, within each `pagesNotScanned`, the following HTTP and Metadata is stored to provide a reason why the apge could not be scanned.
370
+
371
+ | httpStatusCode | metadata |
372
+ |------|------------------------------------------------|
373
+ | 0 | Page Excluded |
374
+ | 1 | Not A Supported Document |
375
+ | 2 | Web Crawler Errored |
376
+ | 100 | 100 – Continue |
377
+ | 101 | 101 – Switching Protocols |
378
+ | 102 | 102 – Processing |
379
+ | 103 | 103 – Early Hints |
380
+ | 200 | 200 – However Page Could Not Be Scanned |
381
+ | 204 | 204 – No Content |
382
+ | 205 | 205 – Reset Content |
383
+ | 300 | 300 – Multiple Choices |
384
+ | 301 | 301 – Moved Permanently |
385
+ | 302 | 302 – Found |
386
+ | 303 | 303 – See Other |
387
+ | 304 | 304 – Not Modified |
388
+ | 305 | 305 – Use Proxy |
389
+ | 307 | 307 – Temporary Redirect |
390
+ | 308 | 308 – Permanent Redirect |
391
+ | 400 | 400 – Bad Request |
392
+ | 401 | 401 – Unauthorized |
393
+ | 402 | 402 – Payment Required |
394
+ | 403 | 403 – Forbidden |
395
+ | 404 | 404 – Not Found |
396
+ | 405 | 405 – Method Not Allowed |
397
+ | 406 | 406 – Not Acceptable |
398
+ | 407 | 407 – Proxy Authentication Required |
399
+ | 408 | 408 – Request Timeout |
400
+ | 409 | 409 – Conflict |
401
+ | 410 | 410 – Gone |
402
+ | 411 | 411 – Length Required |
403
+ | 412 | 412 – Precondition Failed |
404
+ | 413 | 413 – Payload Too Large |
405
+ | 414 | 414 – URI Too Long |
406
+ | 415 | 415 – Unsupported Media Type |
407
+ | 416 | 416 – Range Not Satisfiable |
408
+ | 417 | 417 – Expectation Failed |
409
+ | 418 | 418 – I’m a teapot |
410
+ | 421 | 421 – Misdirected Request |
411
+ | 422 | 422 – Unprocessable Content |
412
+ | 423 | 423 – Locked |
413
+ | 424 | 424 – Failed Dependency |
414
+ | 425 | 425 – Too Early |
415
+ | 426 | 426 – Upgrade Required |
416
+ | 428 | 428 – Precondition Required |
417
+ | 429 | 429 – Too Many Requests |
418
+ | 431 | 431 – Request Header Fields Too Large |
419
+ | 451 | 451 – Unavailable For Legal Reasons |
420
+ | 500 | 500 – Internal Server Error |
421
+ | 501 | 501 – Not Implemented |
422
+ | 502 | 502 – Bad Gateway |
423
+ | 503 | 503 – Service Unavailable |
424
+ | 504 | 504 – Gateway Timeout |
425
+ | 505 | 505 – HTTP Version Not Supported |
426
+ | 506 | 506 – Variant Also Negotiates |
427
+ | 507 | 507 – Insufficient Storage |
428
+ | 508 | 508 – Loop Detected |
429
+ | 510 | 510 – Not Extended |
430
+ | 511 | 511 – Network Authentication Required |
431
+ | 599 | Uncommon Response Code Received |
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@govtechsg/oobee",
3
3
  "main": "dist/npmIndex.js",
4
- "version": "0.10.42",
4
+ "version": "0.10.45",
5
5
  "type": "module",
6
6
  "author": "Government Technology Agency <info@tech.gov.sg>",
7
7
  "dependencies": {
8
8
  "@json2csv/node": "^7.0.3",
9
9
  "@napi-rs/canvas": "^0.1.53",
10
+ "@sentry/node": "^9.13.0",
10
11
  "axe-core": "^4.10.2",
11
12
  "axios": "^1.8.2",
12
13
  "base64-stream": "^1.0.0",
@@ -46,6 +47,7 @@
46
47
  "@types/fs-extra": "^11.0.4",
47
48
  "@types/inquirer": "^9.0.7",
48
49
  "@types/lodash": "^4.17.7",
50
+ "@types/mime-types": "^2.1.4",
49
51
  "@types/safe-regex": "^1.1.6",
50
52
  "@types/validator": "^13.11.10",
51
53
  "@types/which": "^3.0.4",
@@ -97,4 +99,4 @@
97
99
  "url": "https://github.com/GovTechSG/oobee/issues"
98
100
  },
99
101
  "homepage": "https://github.com/GovTechSG/oobee#readme"
100
- }
102
+ }
package/src/cli.ts CHANGED
@@ -137,9 +137,6 @@ Usage: npm run cli -- -c <crawler> -d <device> -w <viewport> -u <url> OPTIONS`,
137
137
  printMessage([`Invalid blacklistedPatternsFilename file path. ${err}`], messageOptions);
138
138
  process.exit(1);
139
139
  }
140
-
141
- // eslint-disable-next-line no-unreachable
142
- return null;
143
140
  })
144
141
  .coerce('i', option => {
145
142
  const { choices } = cliOptions.i;
@@ -241,7 +238,7 @@ const scanInit = async (argvs: Answers): Promise<string> => {
241
238
  clonedDataDir,
242
239
  updatedArgvs.playwrightDeviceDetailsObject,
243
240
  isCustomFlow,
244
- updatedArgvs.header,
241
+ parseHeaders(updatedArgvs.header),
245
242
  );
246
243
  switch (res.status) {
247
244
  case statuses.success.code: {
@@ -255,17 +252,14 @@ const scanInit = async (argvs: Answers): Promise<string> => {
255
252
  case statuses.unauthorised.code: {
256
253
  printMessage([statuses.unauthorised.message], messageOptions);
257
254
  process.exit(res.status);
258
- break;
259
255
  }
260
256
  case statuses.cannotBeResolved.code: {
261
257
  printMessage([statuses.cannotBeResolved.message], messageOptions);
262
258
  process.exit(res.status);
263
- break;
264
259
  }
265
260
  case statuses.systemError.code: {
266
261
  printMessage([statuses.systemError.message], messageOptions);
267
262
  process.exit(res.status);
268
- break;
269
263
  }
270
264
  case statuses.invalidUrl.code: {
271
265
  if (
@@ -296,17 +290,14 @@ const scanInit = async (argvs: Answers): Promise<string> => {
296
290
  case statuses.notASitemap.code: {
297
291
  printMessage([statuses.notASitemap.message], messageOptions);
298
292
  process.exit(res.status);
299
- break;
300
293
  }
301
294
  case statuses.notALocalFile.code: {
302
295
  printMessage([statuses.notALocalFile.message], messageOptions);
303
296
  process.exit(res.status);
304
- break;
305
297
  }
306
298
  case statuses.browserError.code: {
307
299
  printMessage([statuses.browserError.message], messageOptions);
308
300
  process.exit(res.status);
309
- break;
310
301
  }
311
302
  default:
312
303
  break;
@@ -362,7 +353,7 @@ const scanInit = async (argvs: Answers): Promise<string> => {
362
353
  }
363
354
 
364
355
  // Delete dataset and request queues
365
- await cleanUp(data.randomToken);
356
+ cleanUp(data.randomToken);
366
357
 
367
358
  return getStoragePath(data.randomToken);
368
359
  };