ng-talkback 21.0.17 → 21.0.18

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 (38) hide show
  1. package/browser/package.json +1 -1
  2. package/browser-prod/package.json +1 -1
  3. package/lib/build-info._auto-generated_.d.ts +1 -1
  4. package/lib/build-info._auto-generated_.js +1 -1
  5. package/lib/package.json +1 -1
  6. package/lib-prod/build-info._auto-generated_.js +26 -14
  7. package/lib-prod/env/env.angular-node-app.js +66 -130
  8. package/lib-prod/env/env.docs-webapp.js +66 -130
  9. package/lib-prod/env/env.electron-app.js +66 -130
  10. package/lib-prod/env/env.mobile-app.js +66 -130
  11. package/lib-prod/env/env.npm-lib-and-cli-tool.js +66 -130
  12. package/lib-prod/env/env.vscode-plugin.js +66 -130
  13. package/lib-prod/env/index.js +6 -6
  14. package/lib-prod/es6.backend.js +2 -5
  15. package/lib-prod/features/error-rate.backend.js +20 -24
  16. package/lib-prod/features/latency.backend.js +25 -27
  17. package/lib-prod/index._auto-generated_.js +5 -0
  18. package/lib-prod/index.js +12 -14
  19. package/lib-prod/logger.backend.js +17 -21
  20. package/lib-prod/migrations/index.js +2 -1
  21. package/lib-prod/migrations/migrations_index._auto-generated_.js +3 -0
  22. package/lib-prod/options.backend.js +75 -85
  23. package/lib-prod/package.json +1 -1
  24. package/lib-prod/request-handler.backend.js +131 -125
  25. package/lib-prod/server.backend.js +76 -79
  26. package/lib-prod/summary.backend.js +16 -21
  27. package/lib-prod/talkback-factory.backend.js +15 -18
  28. package/lib-prod/tape-matcher.backend.js +84 -88
  29. package/lib-prod/tape-renderer.backend.js +90 -89
  30. package/lib-prod/tape-store.backend.js +85 -87
  31. package/lib-prod/tape.backend.js +64 -70
  32. package/lib-prod/types.backend.js +1 -0
  33. package/lib-prod/utils/content-encoding.backend.js +31 -35
  34. package/lib-prod/utils/headers.backend.js +12 -14
  35. package/lib-prod/utils/media-type.backend.js +41 -46
  36. package/package.json +1 -1
  37. package/websql/package.json +1 -1
  38. package/websql-prod/package.json +1 -1
@@ -1,75 +1,69 @@
1
- import MediaType from "./utils/media-type.backend";
2
- import TapeRenderer from "./tape-renderer.backend";
3
- import ContentEncoding from "./utils/content-encoding.backend";
4
- import * as URL from "url";
5
- import * as querystring from "querystring";
6
- class Tape {
7
- req;
8
- res;
9
- options;
10
- queryParamsToIgnore;
11
- meta;
12
- path;
13
- new = false;
14
- used = false;
15
- constructor(req, options) {
16
- this.req = { ...req };
17
- this.options = options;
18
- this.normalizeBody();
19
- this.cleanupHeaders();
20
- this.queryParamsToIgnore = this.options.ignoreQueryParams;
21
- this.cleanupQueryParams();
22
- this.meta = {
23
- createdAt: /* @__PURE__ */ new Date(),
24
- host: this.options.host
25
- };
26
- }
27
- static async fromStore(raw, options) {
28
- return TapeRenderer.fromStore(raw, options);
29
- }
30
- cleanupHeaders() {
31
- const newHeaders = { ...this.req.headers };
32
- this.options.ignoreHeaders.forEach((h) => delete newHeaders[h]);
33
- this.req = {
34
- ...this.req,
35
- headers: newHeaders
36
- };
37
- }
38
- cleanupQueryParams() {
39
- if (this.queryParamsToIgnore.length === 0) {
40
- return;
1
+ import MediaType from './utils/media-type.backend';
2
+ import TapeRenderer from './tape-renderer.backend';
3
+ import ContentEncoding from './utils/content-encoding.backend';
4
+ import * as URL from 'url';
5
+ import * as querystring from 'querystring';
6
+ // const URL = require('url')
7
+ // const querystring = require('querystring')
8
+ export class Tape {
9
+ constructor(req, options) {
10
+ this.new = false;
11
+ this.used = false;
12
+ this.req = { ...req };
13
+ this.options = options;
14
+ // This needs to happen before we erase headers since we could lose information
15
+ this.normalizeBody();
16
+ this.cleanupHeaders();
17
+ this.queryParamsToIgnore = this.options.ignoreQueryParams;
18
+ this.cleanupQueryParams();
19
+ this.meta = {
20
+ createdAt: new Date(),
21
+ host: this.options.host
22
+ };
41
23
  }
42
- const url = URL.parse(this.req.url, true);
43
- if (!url.search) {
44
- return;
24
+ static async fromStore(raw, options) {
25
+ return TapeRenderer.fromStore(raw, options);
45
26
  }
46
- const query = { ...url.query };
47
- this.queryParamsToIgnore.forEach((q) => delete query[q]);
48
- const newQuery = querystring.stringify(query);
49
- if (newQuery) {
50
- url.query = query;
51
- url.search = "?" + newQuery;
52
- } else {
53
- url.query = null;
54
- url.search = null;
27
+ cleanupHeaders() {
28
+ const newHeaders = { ...this.req.headers };
29
+ this.options.ignoreHeaders.forEach(h => delete newHeaders[h]);
30
+ this.req = {
31
+ ...this.req,
32
+ headers: newHeaders
33
+ };
55
34
  }
56
- this.req.url = URL.format(url);
57
- }
58
- normalizeBody() {
59
- const mediaType = new MediaType(this.req);
60
- const contentEncoding = new ContentEncoding(this.req);
61
- if (contentEncoding.isUncompressed() && mediaType.isJSON() && this.req.body.length > 0) {
62
- this.req.body = Buffer.from(JSON.stringify(JSON.parse(this.req.body.toString()), null, 2));
35
+ cleanupQueryParams() {
36
+ if (this.queryParamsToIgnore.length === 0) {
37
+ return;
38
+ }
39
+ const url = URL.parse(this.req.url, true);
40
+ if (!url.search) {
41
+ return;
42
+ }
43
+ const query = { ...url.query };
44
+ this.queryParamsToIgnore.forEach(q => delete query[q]);
45
+ const newQuery = querystring.stringify(query);
46
+ if (newQuery) {
47
+ url.query = query;
48
+ url.search = "?" + newQuery;
49
+ }
50
+ else {
51
+ url.query = null;
52
+ url.search = null;
53
+ }
54
+ this.req.url = URL.format(url);
55
+ }
56
+ normalizeBody() {
57
+ const mediaType = new MediaType(this.req);
58
+ const contentEncoding = new ContentEncoding(this.req);
59
+ if (contentEncoding.isUncompressed() && mediaType.isJSON() && this.req.body.length > 0) {
60
+ this.req.body = Buffer.from(JSON.stringify(JSON.parse(this.req.body.toString()), null, 2));
61
+ }
62
+ }
63
+ async clone() {
64
+ const tapeRenderer = new TapeRenderer(this);
65
+ const raw = await tapeRenderer.render();
66
+ return Tape.fromStore(raw, this.options);
63
67
  }
64
- }
65
- async clone() {
66
- const tapeRenderer = new TapeRenderer(this);
67
- const raw = await tapeRenderer.render();
68
- return Tape.fromStore(raw, this.options);
69
- }
70
68
  }
71
- var tape_backend_default = Tape;
72
- export {
73
- Tape,
74
- tape_backend_default as default
75
- };
69
+ export default Tape;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,40 +1,36 @@
1
- const zlib = require("zlib");
2
- import Headers from "./headers.backend";
1
+ const zlib = require('zlib');
2
+ import Headers from './headers.backend';
3
3
  const ALGORITHMS = {
4
- gzip: { compress: zlib.gzipSync, uncompress: zlib.gunzipSync },
5
- deflate: { compress: zlib.deflateSync, uncompress: zlib.inflateSync }
4
+ gzip: { compress: zlib.gzipSync, uncompress: zlib.gunzipSync },
5
+ deflate: { compress: zlib.deflateSync, uncompress: zlib.inflateSync }
6
6
  };
7
- class ContentEncoding {
8
- reqRes;
9
- constructor(reqRes) {
10
- this.reqRes = reqRes;
11
- }
12
- isUncompressed() {
13
- const contentEncoding = this.contentEncoding();
14
- return !contentEncoding || contentEncoding === "identity";
15
- }
16
- supportedAlgorithm() {
17
- const contentEncoding = this.contentEncoding();
18
- return Object.keys(ALGORITHMS).includes(contentEncoding);
19
- }
20
- contentEncoding() {
21
- return Headers.read(this.reqRes.headers, "content-encoding");
22
- }
23
- async uncompressedBody(body) {
24
- const contentEncoding = this.contentEncoding();
25
- if (!this.supportedAlgorithm()) {
26
- throw new Error(`Unsupported content-encoding ${contentEncoding}`);
7
+ export default class ContentEncoding {
8
+ constructor(reqRes) {
9
+ this.reqRes = reqRes;
27
10
  }
28
- return ALGORITHMS[contentEncoding].uncompress(body);
29
- }
30
- async compressedBody(body) {
31
- const contentEncoding = this.contentEncoding();
32
- if (!this.supportedAlgorithm()) {
33
- throw new Error(`Unsupported content-encoding ${contentEncoding}`);
11
+ isUncompressed() {
12
+ const contentEncoding = this.contentEncoding();
13
+ return !contentEncoding || contentEncoding === "identity";
14
+ }
15
+ supportedAlgorithm() {
16
+ const contentEncoding = this.contentEncoding();
17
+ return Object.keys(ALGORITHMS).includes(contentEncoding);
18
+ }
19
+ contentEncoding() {
20
+ return Headers.read(this.reqRes.headers, "content-encoding");
21
+ }
22
+ async uncompressedBody(body) {
23
+ const contentEncoding = this.contentEncoding();
24
+ if (!this.supportedAlgorithm()) {
25
+ throw new Error(`Unsupported content-encoding ${contentEncoding}`);
26
+ }
27
+ return ALGORITHMS[contentEncoding].uncompress(body);
28
+ }
29
+ async compressedBody(body) {
30
+ const contentEncoding = this.contentEncoding();
31
+ if (!this.supportedAlgorithm()) {
32
+ throw new Error(`Unsupported content-encoding ${contentEncoding}`);
33
+ }
34
+ return ALGORITHMS[contentEncoding].compress(body);
34
35
  }
35
- return ALGORITHMS[contentEncoding].compress(body);
36
- }
37
36
  }
38
- export {
39
- ContentEncoding as default
40
- };
@@ -1,16 +1,14 @@
1
- class Headers {
2
- static read(headers, headerName) {
3
- const value = headers[headerName];
4
- if (Array.isArray(value)) {
5
- return value[0];
6
- } else {
7
- return value;
1
+ export default class Headers {
2
+ static read(headers, headerName) {
3
+ const value = headers[headerName];
4
+ if (Array.isArray(value)) {
5
+ return value[0];
6
+ }
7
+ else {
8
+ return value;
9
+ }
10
+ }
11
+ static write(headers, headerName, value, type) {
12
+ headers[headerName] = type === "req" ? value : [value];
8
13
  }
9
- }
10
- static write(headers, headerName, value, type) {
11
- headers[headerName] = type === "req" ? value : [value];
12
- }
13
14
  }
14
- export {
15
- Headers as default
16
- };
@@ -1,54 +1,49 @@
1
- import { ___NS__merge } from "tnp-core/lib-prod";
2
- import Headers from "./headers.backend";
3
- const contentTypeParser = require("content-type");
1
+ import { ___NS__merge } from 'tnp-core/lib-prod';
2
+ import Headers from './headers.backend';
3
+ const contentTypeParser = require('content-type');
4
4
  const equals = (to) => (contentType) => to == contentType;
5
- const jsonTypes = [
6
- equals("application/json"),
7
- (contentType) => contentType.startsWith("application/") && contentType.endsWith("+json")
5
+ export const jsonTypes = [
6
+ equals("application/json"),
7
+ (contentType) => contentType.startsWith("application/") && contentType.endsWith("+json")
8
8
  ];
9
9
  const humanReadableContentTypes = [
10
- equals("application/javascript"),
11
- equals("text/css"),
12
- equals("text/html"),
13
- equals("text/javascript"),
14
- equals("text/plain"),
15
- ...jsonTypes
10
+ equals("application/javascript"),
11
+ equals("text/css"),
12
+ equals("text/html"),
13
+ equals("text/javascript"),
14
+ equals("text/plain"),
15
+ ...jsonTypes
16
16
  ];
17
- class MediaType {
18
- htmlReqRes;
19
- constructor(htmlReqRes) {
20
- this.htmlReqRes = htmlReqRes;
21
- }
22
- isHumanReadable() {
23
- const contentType = this.contentType();
24
- if (!contentType) {
25
- return false;
17
+ export default class MediaType {
18
+ constructor(htmlReqRes) {
19
+ this.htmlReqRes = htmlReqRes;
26
20
  }
27
- return humanReadableContentTypes.some((comparator) => comparator(contentType));
28
- }
29
- isJSON() {
30
- const contentType = this.contentType();
31
- if (!contentType) {
32
- return false;
21
+ isHumanReadable() {
22
+ const contentType = this.contentType();
23
+ if (!contentType) {
24
+ return false;
25
+ }
26
+ return humanReadableContentTypes.some(comparator => comparator(contentType));
33
27
  }
34
- const result = jsonTypes.some((comparator) => comparator("application/json"));
35
- return result;
36
- }
37
- contentType() {
38
- const contentTypeHeader = Headers.read(this.headers(), "content-type");
39
- if (!contentTypeHeader) {
40
- return null;
28
+ isJSON() {
29
+ const contentType = this.contentType();
30
+ if (!contentType) {
31
+ return false;
32
+ }
33
+ const result = jsonTypes.some(comparator => comparator('application/json'));
34
+ return result;
35
+ }
36
+ contentType() {
37
+ const contentTypeHeader = Headers.read(this.headers(), "content-type");
38
+ if (!contentTypeHeader) {
39
+ return null;
40
+ }
41
+ const parsedContentType = contentTypeParser.parse(contentTypeHeader);
42
+ return parsedContentType.type;
43
+ }
44
+ headers() {
45
+ return ___NS__merge(this.htmlReqRes.headers, {
46
+ 'content-type': 'application/json'
47
+ });
41
48
  }
42
- const parsedContentType = contentTypeParser.parse(contentTypeHeader);
43
- return parsedContentType.type;
44
- }
45
- headers() {
46
- return ___NS__merge(this.htmlReqRes.headers, {
47
- "content-type": "application/json"
48
- });
49
- }
50
49
  }
51
- export {
52
- MediaType as default,
53
- jsonTypes
54
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-talkback",
3
- "version": "21.0.17",
3
+ "version": "21.0.18",
4
4
  "scripts": {
5
5
  "build": "node tools/build.js",
6
6
  "ci": "yarn ts-check && yarn test && yarn build && USE_DIST=1 yarn test",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-talkback/websql",
3
- "version": "21.0.17",
3
+ "version": "21.0.18",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.0.0",
6
6
  "@angular/core": "^21.0.0"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-talkback/websql-prod",
3
- "version": "21.0.17",
3
+ "version": "21.0.18",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.0.0",
6
6
  "@angular/core": "^21.0.0"