ng-talkback 21.0.14 → 21.0.17

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 (99) hide show
  1. package/browser/package.json +1 -1
  2. package/browser-prod/package.json +1 -1
  3. package/browser-prod.re-export.json +1 -0
  4. package/lib/build-info._auto-generated_.d.ts +1 -1
  5. package/lib/build-info._auto-generated_.js +1 -1
  6. package/lib/package.json +1 -1
  7. package/lib-prod/build-info._auto-generated_.js +14 -30
  8. package/lib-prod/env/env.angular-node-app.js +130 -71
  9. package/lib-prod/env/env.docs-webapp.js +130 -71
  10. package/lib-prod/env/env.electron-app.js +130 -71
  11. package/lib-prod/env/env.mobile-app.js +130 -71
  12. package/lib-prod/env/env.npm-lib-and-cli-tool.js +130 -71
  13. package/lib-prod/env/env.vscode-plugin.js +130 -71
  14. package/lib-prod/env/index.js +6 -23
  15. package/lib-prod/es6.backend.js +5 -5
  16. package/lib-prod/features/error-rate.backend.js +23 -24
  17. package/lib-prod/features/latency.backend.js +26 -29
  18. package/lib-prod/index._auto-generated_.js +0 -6
  19. package/lib-prod/index.js +15 -31
  20. package/lib-prod/logger.backend.js +20 -21
  21. package/lib-prod/migrations/index.js +1 -19
  22. package/lib-prod/migrations/migrations_index._auto-generated_.js +0 -4
  23. package/lib-prod/options.backend.js +86 -82
  24. package/lib-prod/package.json +1 -1
  25. package/lib-prod/request-handler.backend.js +124 -138
  26. package/lib-prod/server.backend.js +78 -84
  27. package/lib-prod/summary.backend.js +20 -21
  28. package/lib-prod/talkback-factory.backend.js +17 -18
  29. package/lib-prod/tape-matcher.backend.js +87 -89
  30. package/lib-prod/tape-renderer.backend.js +88 -94
  31. package/lib-prod/tape-store.backend.js +86 -91
  32. package/lib-prod/tape.backend.js +69 -74
  33. package/lib-prod/types.backend.js +0 -3
  34. package/lib-prod/utils/content-encoding.backend.js +34 -35
  35. package/lib-prod/utils/headers.backend.js +13 -15
  36. package/lib-prod/utils/media-type.backend.js +45 -46
  37. package/lib-prod.re-export.json +1 -0
  38. package/package.json +3 -2
  39. package/websql/package.json +1 -1
  40. package/websql-prod/package.json +1 -1
  41. package/websql-prod.re-export.json +1 -0
  42. package/lib-prod/build-info._auto-generated_.d.ts +0 -24
  43. package/lib-prod/build-info._auto-generated_.js.map +0 -1
  44. package/lib-prod/env/env.angular-node-app.d.ts +0 -64
  45. package/lib-prod/env/env.angular-node-app.js.map +0 -1
  46. package/lib-prod/env/env.docs-webapp.d.ts +0 -64
  47. package/lib-prod/env/env.docs-webapp.js.map +0 -1
  48. package/lib-prod/env/env.electron-app.d.ts +0 -64
  49. package/lib-prod/env/env.electron-app.js.map +0 -1
  50. package/lib-prod/env/env.mobile-app.d.ts +0 -64
  51. package/lib-prod/env/env.mobile-app.js.map +0 -1
  52. package/lib-prod/env/env.npm-lib-and-cli-tool.d.ts +0 -64
  53. package/lib-prod/env/env.npm-lib-and-cli-tool.js.map +0 -1
  54. package/lib-prod/env/env.vscode-plugin.d.ts +0 -64
  55. package/lib-prod/env/env.vscode-plugin.js.map +0 -1
  56. package/lib-prod/env/index.d.ts +0 -6
  57. package/lib-prod/env/index.js.map +0 -1
  58. package/lib-prod/es6.backend.d.ts +0 -2
  59. package/lib-prod/es6.backend.js.map +0 -1
  60. package/lib-prod/features/error-rate.backend.d.ts +0 -9
  61. package/lib-prod/features/error-rate.backend.js.map +0 -1
  62. package/lib-prod/features/latency.backend.d.ts +0 -8
  63. package/lib-prod/features/latency.backend.js.map +0 -1
  64. package/lib-prod/index._auto-generated_.d.ts +0 -0
  65. package/lib-prod/index._auto-generated_.js.map +0 -1
  66. package/lib-prod/index.d.ts +0 -41
  67. package/lib-prod/index.js.map +0 -1
  68. package/lib-prod/logger.backend.d.ts +0 -7
  69. package/lib-prod/logger.backend.js.map +0 -1
  70. package/lib-prod/migrations/index.d.ts +0 -1
  71. package/lib-prod/migrations/index.js.map +0 -1
  72. package/lib-prod/migrations/migrations_index._auto-generated_.d.ts +0 -0
  73. package/lib-prod/migrations/migrations_index._auto-generated_.js.map +0 -1
  74. package/lib-prod/options.backend.d.ts +0 -52
  75. package/lib-prod/options.backend.js.map +0 -1
  76. package/lib-prod/request-handler.backend.d.ts +0 -13
  77. package/lib-prod/request-handler.backend.js.map +0 -1
  78. package/lib-prod/server.backend.d.ts +0 -17
  79. package/lib-prod/server.backend.js.map +0 -1
  80. package/lib-prod/summary.backend.d.ts +0 -8
  81. package/lib-prod/summary.backend.js.map +0 -1
  82. package/lib-prod/talkback-factory.backend.d.ts +0 -7
  83. package/lib-prod/talkback-factory.backend.js.map +0 -1
  84. package/lib-prod/tape-matcher.backend.d.ts +0 -12
  85. package/lib-prod/tape-matcher.backend.js.map +0 -1
  86. package/lib-prod/tape-renderer.backend.d.ts +0 -24
  87. package/lib-prod/tape-renderer.backend.js.map +0 -1
  88. package/lib-prod/tape-store.backend.d.ts +0 -16
  89. package/lib-prod/tape-store.backend.js.map +0 -1
  90. package/lib-prod/tape.backend.d.ts +0 -19
  91. package/lib-prod/tape.backend.js.map +0 -1
  92. package/lib-prod/types.backend.d.ts +0 -43
  93. package/lib-prod/types.backend.js.map +0 -1
  94. package/lib-prod/utils/content-encoding.backend.d.ts +0 -10
  95. package/lib-prod/utils/content-encoding.backend.js.map +0 -1
  96. package/lib-prod/utils/headers.backend.d.ts +0 -4
  97. package/lib-prod/utils/headers.backend.js.map +0 -1
  98. package/lib-prod/utils/media-type.backend.d.ts +0 -10
  99. package/lib-prod/utils/media-type.backend.js.map +0 -1
@@ -1,99 +1,94 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const lib_prod_1 = require("tnp-core/lib-prod");
4
- const tape_backend_1 = require("./tape.backend");
5
- const tape_matcher_backend_1 = require("./tape-matcher.backend");
6
- const tape_renderer_backend_1 = require("./tape-renderer.backend");
1
+ import { fse, path, json5, mkdirp } from "tnp-core/lib-prod";
2
+ import Tape from "./tape.backend";
3
+ import TapeMatcher from "./tape-matcher.backend";
4
+ import TapeRenderer from "./tape-renderer.backend";
7
5
  class TapeStore {
8
- path;
9
- options;
10
- tapes;
11
- constructor(options) {
12
- this.path = lib_prod_1.path.normalize(options.path + "/");
13
- this.options = options;
14
- this.tapes = [];
15
- }
16
- async load() {
17
- lib_prod_1.mkdirp.sync(this.path);
18
- await this.loadTapesAtDir(this.path);
19
- console.log(`Loaded ${this.tapes.length} tapes`);
20
- }
21
- async loadTapesAtDir(directory) {
22
- const items = lib_prod_1.fse.readdirSync(directory);
23
- for (let i = 0; i < items.length; i++) {
24
- const filename = items[i];
25
- const fullPath = `${directory}${filename}`;
26
- const stat = lib_prod_1.fse.statSync(fullPath);
27
- if (!stat.isDirectory()) {
28
- try {
29
- const data = lib_prod_1.fse.readFileSync(fullPath, "utf8");
30
- const raw = lib_prod_1.json5.parse(data);
31
- const tape = await tape_backend_1.default.fromStore(raw, this.options);
32
- tape.path = filename;
33
- this.tapes.push(tape);
34
- }
35
- catch (e) {
36
- console.log(`Error reading tape ${fullPath}`, e.message);
37
- }
38
- }
39
- else {
40
- this.loadTapesAtDir(fullPath + "/");
41
- }
6
+ path;
7
+ options;
8
+ tapes;
9
+ constructor(options) {
10
+ this.path = path.normalize(options.path + "/");
11
+ this.options = options;
12
+ this.tapes = [];
13
+ }
14
+ async load() {
15
+ mkdirp.sync(this.path);
16
+ await this.loadTapesAtDir(this.path);
17
+ console.log(`Loaded ${this.tapes.length} tapes`);
18
+ }
19
+ async loadTapesAtDir(directory) {
20
+ const items = fse.readdirSync(directory);
21
+ for (let i = 0; i < items.length; i++) {
22
+ const filename = items[i];
23
+ const fullPath = `${directory}${filename}`;
24
+ const stat = fse.statSync(fullPath);
25
+ if (!stat.isDirectory()) {
26
+ try {
27
+ const data = fse.readFileSync(fullPath, "utf8");
28
+ const raw = json5.parse(data);
29
+ const tape = await Tape.fromStore(raw, this.options);
30
+ tape.path = filename;
31
+ this.tapes.push(tape);
32
+ } catch (e) {
33
+ console.log(`Error reading tape ${fullPath}`, e.message);
42
34
  }
35
+ } else {
36
+ this.loadTapesAtDir(fullPath + "/");
37
+ }
43
38
  }
44
- find(newTape) {
45
- const foundTape = this.tapes.find(t => {
46
- this.options.logger.debug(`Comparing against tape ${t.path}`);
47
- return new tape_matcher_backend_1.default(t, this.options).sameAs(newTape);
48
- });
49
- if (foundTape) {
50
- foundTape.used = true;
51
- this.options.logger.log(`Found matching tape for ${newTape.req.url} at ${foundTape.path}`);
52
- return foundTape;
53
- }
39
+ }
40
+ find(newTape) {
41
+ const foundTape = this.tapes.find((t) => {
42
+ this.options.logger.debug(`Comparing against tape ${t.path}`);
43
+ return new TapeMatcher(t, this.options).sameAs(newTape);
44
+ });
45
+ if (foundTape) {
46
+ foundTape.used = true;
47
+ this.options.logger.log(`Found matching tape for ${newTape.req.url} at ${foundTape.path}`);
48
+ return foundTape;
54
49
  }
55
- async save(tape) {
56
- tape.new = true;
57
- tape.used = true;
58
- const tapePath = tape.path;
59
- let fullFilename;
60
- if (tapePath) {
61
- fullFilename = lib_prod_1.path.join(this.path, tapePath);
62
- }
63
- else {
64
- // If the tape doesn't have a path then it's new
65
- this.tapes.push(tape);
66
- fullFilename = this.createTapePath(tape);
67
- tape.path = lib_prod_1.path.relative(this.path, fullFilename);
68
- }
69
- this.options.logger.log(`Saving request ${tape.req.url} at ${tape.path}`);
70
- const tapeRenderer = new tape_renderer_backend_1.default(tape);
71
- const toSave = await tapeRenderer.render();
72
- lib_prod_1.fse.writeFileSync(fullFilename, lib_prod_1.json5.stringify(toSave, null, 4));
50
+ }
51
+ async save(tape) {
52
+ tape.new = true;
53
+ tape.used = true;
54
+ const tapePath = tape.path;
55
+ let fullFilename;
56
+ if (tapePath) {
57
+ fullFilename = path.join(this.path, tapePath);
58
+ } else {
59
+ this.tapes.push(tape);
60
+ fullFilename = this.createTapePath(tape);
61
+ tape.path = path.relative(this.path, fullFilename);
73
62
  }
74
- currentTapeId() {
75
- return this.tapes.length;
63
+ this.options.logger.log(`Saving request ${tape.req.url} at ${tape.path}`);
64
+ const tapeRenderer = new TapeRenderer(tape);
65
+ const toSave = await tapeRenderer.render();
66
+ fse.writeFileSync(fullFilename, json5.stringify(toSave, null, 4));
67
+ }
68
+ currentTapeId() {
69
+ return this.tapes.length;
70
+ }
71
+ hasTapeBeenUsed(tapeName) {
72
+ return this.tapes.some((t) => t.used && t.path === tapeName);
73
+ }
74
+ resetTapeUsage() {
75
+ return this.tapes.forEach((t) => t.used = false);
76
+ }
77
+ createTapePath(tape) {
78
+ const currentTapeId = this.currentTapeId();
79
+ let tapePath = `unnamed-${currentTapeId}.json5`;
80
+ if (this.options.tapeNameGenerator) {
81
+ tapePath = this.options.tapeNameGenerator(currentTapeId, tape);
76
82
  }
77
- hasTapeBeenUsed(tapeName) {
78
- return this.tapes.some(t => t.used && t.path === tapeName);
79
- }
80
- resetTapeUsage() {
81
- return this.tapes.forEach(t => t.used = false);
82
- }
83
- createTapePath(tape) {
84
- const currentTapeId = this.currentTapeId();
85
- let tapePath = `unnamed-${currentTapeId}.json5`;
86
- if (this.options.tapeNameGenerator) {
87
- tapePath = this.options.tapeNameGenerator(currentTapeId, tape);
88
- }
89
- let result = lib_prod_1.path.normalize(lib_prod_1.path.join(this.options.path, tapePath));
90
- if (!result.endsWith(".json5")) {
91
- result = `${result}.json5`;
92
- }
93
- const dir = lib_prod_1.path.dirname(result);
94
- lib_prod_1.mkdirp.sync(dir);
95
- return result;
83
+ let result = path.normalize(path.join(this.options.path, tapePath));
84
+ if (!result.endsWith(".json5")) {
85
+ result = `${result}.json5`;
96
86
  }
87
+ const dir = path.dirname(result);
88
+ mkdirp.sync(dir);
89
+ return result;
90
+ }
97
91
  }
98
- exports.default = TapeStore;
99
- //# sourceMappingURL=tape-store.backend.js.map
92
+ export {
93
+ TapeStore as default
94
+ };
@@ -1,80 +1,75 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Tape = void 0;
4
- const media_type_backend_1 = require("./utils/media-type.backend");
5
- const tape_renderer_backend_1 = require("./tape-renderer.backend");
6
- const content_encoding_backend_1 = require("./utils/content-encoding.backend");
7
- const URL = require("url");
8
- const querystring = require("querystring");
9
- // const URL = require('url')
10
- // const querystring = require('querystring')
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";
11
6
  class Tape {
12
- req;
13
- res;
14
- options;
15
- queryParamsToIgnore;
16
- meta;
17
- path;
18
- new = false;
19
- used = false;
20
- constructor(req, options) {
21
- this.req = { ...req };
22
- this.options = options;
23
- // This needs to happen before we erase headers since we could lose information
24
- this.normalizeBody();
25
- this.cleanupHeaders();
26
- this.queryParamsToIgnore = this.options.ignoreQueryParams;
27
- this.cleanupQueryParams();
28
- this.meta = {
29
- createdAt: new Date(),
30
- host: this.options.host
31
- };
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;
32
41
  }
33
- static async fromStore(raw, options) {
34
- return tape_renderer_backend_1.default.fromStore(raw, options);
42
+ const url = URL.parse(this.req.url, true);
43
+ if (!url.search) {
44
+ return;
35
45
  }
36
- cleanupHeaders() {
37
- const newHeaders = { ...this.req.headers };
38
- this.options.ignoreHeaders.forEach(h => delete newHeaders[h]);
39
- this.req = {
40
- ...this.req,
41
- headers: newHeaders
42
- };
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;
43
55
  }
44
- cleanupQueryParams() {
45
- if (this.queryParamsToIgnore.length === 0) {
46
- return;
47
- }
48
- const url = URL.parse(this.req.url, true);
49
- if (!url.search) {
50
- return;
51
- }
52
- const query = { ...url.query };
53
- this.queryParamsToIgnore.forEach(q => delete query[q]);
54
- const newQuery = querystring.stringify(query);
55
- if (newQuery) {
56
- url.query = query;
57
- url.search = "?" + newQuery;
58
- }
59
- else {
60
- url.query = null;
61
- url.search = null;
62
- }
63
- this.req.url = URL.format(url);
64
- }
65
- normalizeBody() {
66
- const mediaType = new media_type_backend_1.default(this.req);
67
- const contentEncoding = new content_encoding_backend_1.default(this.req);
68
- if (contentEncoding.isUncompressed() && mediaType.isJSON() && this.req.body.length > 0) {
69
- this.req.body = Buffer.from(JSON.stringify(JSON.parse(this.req.body.toString()), null, 2));
70
- }
71
- }
72
- async clone() {
73
- const tapeRenderer = new tape_renderer_backend_1.default(this);
74
- const raw = await tapeRenderer.render();
75
- return Tape.fromStore(raw, this.options);
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));
76
63
  }
64
+ }
65
+ async clone() {
66
+ const tapeRenderer = new TapeRenderer(this);
67
+ const raw = await tapeRenderer.render();
68
+ return Tape.fromStore(raw, this.options);
69
+ }
77
70
  }
78
- exports.Tape = Tape;
79
- exports.default = Tape;
80
- //# sourceMappingURL=tape.backend.js.map
71
+ var tape_backend_default = Tape;
72
+ export {
73
+ Tape,
74
+ tape_backend_default as default
75
+ };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.backend.js.map
@@ -1,41 +1,40 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const zlib = require('zlib');
4
- const headers_backend_1 = require("./headers.backend");
1
+ const zlib = require("zlib");
2
+ import Headers from "./headers.backend";
5
3
  const ALGORITHMS = {
6
- gzip: { compress: zlib.gzipSync, uncompress: zlib.gunzipSync },
7
- deflate: { compress: zlib.deflateSync, uncompress: zlib.inflateSync }
4
+ gzip: { compress: zlib.gzipSync, uncompress: zlib.gunzipSync },
5
+ deflate: { compress: zlib.deflateSync, uncompress: zlib.inflateSync }
8
6
  };
9
7
  class ContentEncoding {
10
- reqRes;
11
- constructor(reqRes) {
12
- this.reqRes = reqRes;
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}`);
13
27
  }
14
- isUncompressed() {
15
- const contentEncoding = this.contentEncoding();
16
- return !contentEncoding || contentEncoding === "identity";
17
- }
18
- supportedAlgorithm() {
19
- const contentEncoding = this.contentEncoding();
20
- return Object.keys(ALGORITHMS).includes(contentEncoding);
21
- }
22
- contentEncoding() {
23
- return headers_backend_1.default.read(this.reqRes.headers, "content-encoding");
24
- }
25
- async uncompressedBody(body) {
26
- const contentEncoding = this.contentEncoding();
27
- if (!this.supportedAlgorithm()) {
28
- throw new Error(`Unsupported content-encoding ${contentEncoding}`);
29
- }
30
- return ALGORITHMS[contentEncoding].uncompress(body);
31
- }
32
- async compressedBody(body) {
33
- const contentEncoding = this.contentEncoding();
34
- if (!this.supportedAlgorithm()) {
35
- throw new Error(`Unsupported content-encoding ${contentEncoding}`);
36
- }
37
- return ALGORITHMS[contentEncoding].compress(body);
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}`);
38
34
  }
35
+ return ALGORITHMS[contentEncoding].compress(body);
36
+ }
39
37
  }
40
- exports.default = ContentEncoding;
41
- //# sourceMappingURL=content-encoding.backend.js.map
38
+ export {
39
+ ContentEncoding as default
40
+ };
@@ -1,18 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  class Headers {
4
- static read(headers, headerName) {
5
- const value = headers[headerName];
6
- if (Array.isArray(value)) {
7
- return value[0];
8
- }
9
- else {
10
- return value;
11
- }
12
- }
13
- static write(headers, headerName, value, type) {
14
- headers[headerName] = type === "req" ? value : [value];
2
+ static read(headers, headerName) {
3
+ const value = headers[headerName];
4
+ if (Array.isArray(value)) {
5
+ return value[0];
6
+ } else {
7
+ return value;
15
8
  }
9
+ }
10
+ static write(headers, headerName, value, type) {
11
+ headers[headerName] = type === "req" ? value : [value];
12
+ }
16
13
  }
17
- exports.default = Headers;
18
- //# sourceMappingURL=headers.backend.js.map
14
+ export {
15
+ Headers as default
16
+ };
@@ -1,55 +1,54 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jsonTypes = void 0;
4
- const lib_prod_1 = require("tnp-core/lib-prod");
5
- const headers_backend_1 = require("./headers.backend");
6
- 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");
7
4
  const equals = (to) => (contentType) => to == contentType;
8
- exports.jsonTypes = [
9
- equals("application/json"),
10
- (contentType) => contentType.startsWith("application/") && contentType.endsWith("+json")
5
+ const jsonTypes = [
6
+ equals("application/json"),
7
+ (contentType) => contentType.startsWith("application/") && contentType.endsWith("+json")
11
8
  ];
12
9
  const humanReadableContentTypes = [
13
- equals("application/javascript"),
14
- equals("text/css"),
15
- equals("text/html"),
16
- equals("text/javascript"),
17
- equals("text/plain"),
18
- ...exports.jsonTypes
10
+ equals("application/javascript"),
11
+ equals("text/css"),
12
+ equals("text/html"),
13
+ equals("text/javascript"),
14
+ equals("text/plain"),
15
+ ...jsonTypes
19
16
  ];
20
17
  class MediaType {
21
- htmlReqRes;
22
- constructor(htmlReqRes) {
23
- this.htmlReqRes = htmlReqRes;
18
+ htmlReqRes;
19
+ constructor(htmlReqRes) {
20
+ this.htmlReqRes = htmlReqRes;
21
+ }
22
+ isHumanReadable() {
23
+ const contentType = this.contentType();
24
+ if (!contentType) {
25
+ return false;
24
26
  }
25
- isHumanReadable() {
26
- const contentType = this.contentType();
27
- if (!contentType) {
28
- return false;
29
- }
30
- return humanReadableContentTypes.some(comparator => comparator(contentType));
27
+ return humanReadableContentTypes.some((comparator) => comparator(contentType));
28
+ }
29
+ isJSON() {
30
+ const contentType = this.contentType();
31
+ if (!contentType) {
32
+ return false;
31
33
  }
32
- isJSON() {
33
- const contentType = this.contentType();
34
- if (!contentType) {
35
- return false;
36
- }
37
- const result = exports.jsonTypes.some(comparator => comparator('application/json'));
38
- return result;
39
- }
40
- contentType() {
41
- const contentTypeHeader = headers_backend_1.default.read(this.headers(), "content-type");
42
- if (!contentTypeHeader) {
43
- return null;
44
- }
45
- const parsedContentType = contentTypeParser.parse(contentTypeHeader);
46
- return parsedContentType.type;
47
- }
48
- headers() {
49
- return lib_prod_1._.merge(this.htmlReqRes.headers, {
50
- 'content-type': 'application/json'
51
- });
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;
52
41
  }
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
+ }
53
50
  }
54
- exports.default = MediaType;
55
- //# sourceMappingURL=media-type.backend.js.map
51
+ export {
52
+ MediaType as default,
53
+ jsonTypes
54
+ };
@@ -0,0 +1 @@
1
+ {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-talkback",
3
- "version": "21.0.14",
3
+ "version": "21.0.17",
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",
@@ -49,5 +49,6 @@
49
49
  "url": "https://github.com/darekf77/ng-talkback"
50
50
  },
51
51
  "bin": {},
52
- "peerDependencies": {}
52
+ "peerDependencies": {},
53
+ "devDependencies": {}
53
54
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-talkback/websql",
3
- "version": "21.0.14",
3
+ "version": "21.0.17",
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.14",
3
+ "version": "21.0.17",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.0.0",
6
6
  "@angular/core": "^21.0.0"
@@ -0,0 +1 @@
1
+ {}
@@ -1,24 +0,0 @@
1
- /**
2
- * Autogenerated by current cli tool
3
- */
4
- export declare const BUILD_FRAMEWORK_CLI_NAME = "tnp";
5
- /**
6
- * This value can be change in taon.jsonc (appId)
7
- */
8
- export declare const APP_ID = "com.domain.example.ng-talkback";
9
- /**
10
- * Autogenerated by current cli tool
11
- */
12
- export declare const BUILD_BASE_HREF = "";
13
- /**
14
- * This value can be change in taon.jsonc (overrideNpmName)
15
- */
16
- export declare const PROJECT_NPM_NAME = "ng-talkback";
17
- /**
18
- * Taon version from you project taon.json
19
- */
20
- export declare const CURRENT_PACKAGE_TAON_VERSION = "v21";
21
- /**
22
- * Autogenerated by current cli tool. Use *tnp release* to bump version.
23
- */
24
- export declare const CURRENT_PACKAGE_VERSION = "21.0.14";
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-info._auto-generated_.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;;AAAA,yCAAyC;AACzC;;GAEG;AACU,QAAA,wBAAwB,GAAG,KAAK,CAAC;AAC9C;;GAEG;AACU,QAAA,MAAM,GAAG,gCAAgC,CAAC;AACvD;;GAEG;AACU,QAAA,eAAe,GAAG,EAAE,CAAC;AAClC;;GAEG;AACU,QAAA,gBAAgB,GAAG,aAAa,CAAC;AAC9C;;GAEG;AACU,QAAA,4BAA4B,GAAG,KAAK,CAAC;AAClD;;GAEG;AACU,QAAA,uBAAuB,GAAG,SAAS,CAAC;AACjD,yCAAyC"}