@fgv/ts-utils 2.0.2-alpha.0 → 2.1.1-alpha.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 (73) hide show
  1. package/dist/ts-utils.d.ts +1509 -1924
  2. package/dist/tsdoc-metadata.json +1 -1
  3. package/lib/index.d.ts +1 -6
  4. package/lib/index.d.ts.map +1 -1
  5. package/lib/index.js +1 -9
  6. package/lib/index.js.map +1 -1
  7. package/lib/packlets/base/logger.js.map +1 -1
  8. package/lib/packlets/base/normalize.js.map +1 -1
  9. package/lib/packlets/base/result.d.ts +20 -6
  10. package/lib/packlets/base/result.d.ts.map +1 -1
  11. package/lib/packlets/base/result.js +4 -6
  12. package/lib/packlets/base/result.js.map +1 -1
  13. package/lib/packlets/base/utils.d.ts +7 -7
  14. package/lib/packlets/base/utils.d.ts.map +1 -1
  15. package/lib/packlets/base/utils.js +4 -4
  16. package/lib/packlets/base/utils.js.map +1 -1
  17. package/lib/packlets/conversion/converter.js.map +1 -1
  18. package/lib/packlets/conversion/converters.d.ts +5 -29
  19. package/lib/packlets/conversion/converters.d.ts.map +1 -1
  20. package/lib/packlets/conversion/converters.js +1 -47
  21. package/lib/packlets/conversion/converters.js.map +1 -1
  22. package/lib/packlets/conversion/objectConverter.js.map +1 -1
  23. package/lib/packlets/conversion/stringConverter.js.map +1 -1
  24. package/lib/packlets/validation/array.js.map +1 -1
  25. package/lib/packlets/validation/boolean.js.map +1 -1
  26. package/lib/packlets/validation/field.js.map +1 -1
  27. package/lib/packlets/validation/genericValidator.js.map +1 -1
  28. package/lib/packlets/validation/number.js.map +1 -1
  29. package/lib/packlets/validation/object.js.map +1 -1
  30. package/lib/packlets/validation/string.js.map +1 -1
  31. package/lib/packlets/validation/typeGuard.js.map +1 -1
  32. package/lib/packlets/validation/validators.js.map +1 -1
  33. package/package.json +29 -30
  34. package/lib/packlets/csv/csvHelpers.d.ts +0 -17
  35. package/lib/packlets/csv/csvHelpers.d.ts.map +0 -1
  36. package/lib/packlets/csv/csvHelpers.js +0 -69
  37. package/lib/packlets/csv/csvHelpers.js.map +0 -1
  38. package/lib/packlets/csv/index.d.ts +0 -2
  39. package/lib/packlets/csv/index.d.ts.map +0 -1
  40. package/lib/packlets/csv/index.js +0 -39
  41. package/lib/packlets/csv/index.js.map +0 -1
  42. package/lib/packlets/experimental/extendedArray.d.ts +0 -56
  43. package/lib/packlets/experimental/extendedArray.d.ts.map +0 -1
  44. package/lib/packlets/experimental/extendedArray.js +0 -106
  45. package/lib/packlets/experimental/extendedArray.js.map +0 -1
  46. package/lib/packlets/experimental/formatter.d.ts +0 -66
  47. package/lib/packlets/experimental/formatter.d.ts.map +0 -1
  48. package/lib/packlets/experimental/formatter.js +0 -75
  49. package/lib/packlets/experimental/formatter.js.map +0 -1
  50. package/lib/packlets/experimental/index.d.ts +0 -4
  51. package/lib/packlets/experimental/index.d.ts.map +0 -1
  52. package/lib/packlets/experimental/index.js +0 -41
  53. package/lib/packlets/experimental/index.js.map +0 -1
  54. package/lib/packlets/experimental/rangeOf.d.ts +0 -122
  55. package/lib/packlets/experimental/rangeOf.d.ts.map +0 -1
  56. package/lib/packlets/experimental/rangeOf.js +0 -185
  57. package/lib/packlets/experimental/rangeOf.js.map +0 -1
  58. package/lib/packlets/hash/hash.d.ts +0 -51
  59. package/lib/packlets/hash/hash.d.ts.map +0 -1
  60. package/lib/packlets/hash/hash.js +0 -166
  61. package/lib/packlets/hash/hash.js.map +0 -1
  62. package/lib/packlets/hash/index.d.ts +0 -2
  63. package/lib/packlets/hash/index.d.ts.map +0 -1
  64. package/lib/packlets/hash/index.js +0 -39
  65. package/lib/packlets/hash/index.js.map +0 -1
  66. package/lib/packlets/record-jar/index.d.ts +0 -2
  67. package/lib/packlets/record-jar/index.d.ts.map +0 -1
  68. package/lib/packlets/record-jar/index.js +0 -39
  69. package/lib/packlets/record-jar/index.js.map +0 -1
  70. package/lib/packlets/record-jar/recordJarHelpers.d.ts +0 -37
  71. package/lib/packlets/record-jar/recordJarHelpers.d.ts.map +0 -1
  72. package/lib/packlets/record-jar/recordJarHelpers.js +0 -263
  73. package/lib/packlets/record-jar/recordJarHelpers.js.map +0 -1
@@ -1,166 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2021 Erik Fortune
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining a copy
6
- * of this software and associated documentation files (the "Software"), to deal
7
- * in the Software without restriction, including without limitation the rights
8
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- * copies of the Software, and to permit persons to whom the Software is
10
- * furnished to do so, subject to the following conditions:
11
- *
12
- * The above copyright notice and this permission notice shall be included in all
13
- * copies or substantial portions of the Software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- * SOFTWARE.
22
- */
23
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
- if (k2 === undefined) k2 = k;
25
- var desc = Object.getOwnPropertyDescriptor(m, k);
26
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
- desc = { enumerable: true, get: function() { return m[k]; } };
28
- }
29
- Object.defineProperty(o, k2, desc);
30
- }) : (function(o, m, k, k2) {
31
- if (k2 === undefined) k2 = k;
32
- o[k2] = m[k];
33
- }));
34
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
- Object.defineProperty(o, "default", { enumerable: true, value: v });
36
- }) : function(o, v) {
37
- o["default"] = v;
38
- });
39
- var __importStar = (this && this.__importStar) || function (mod) {
40
- if (mod && mod.__esModule) return mod;
41
- var result = {};
42
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
43
- __setModuleDefault(result, mod);
44
- return result;
45
- };
46
- Object.defineProperty(exports, "__esModule", { value: true });
47
- exports.Normalizer = exports.computeHash = void 0;
48
- const crypto = __importStar(require("crypto"));
49
- const base_1 = require("../base");
50
- /**
51
- * Computes an md5 hash from an array of strings. Not secure and not intended to be secure.
52
- * @param parts - The strings to be hashed
53
- * @returns An md5 hash of the parts
54
- * @public
55
- */
56
- function computeHash(parts) {
57
- return crypto.createHash('md5').update(parts.join('|'), 'utf8').digest('hex');
58
- }
59
- exports.computeHash = computeHash;
60
- /**
61
- * Computes a normalized hash for an arbitrary javascript value.
62
- * @public
63
- */
64
- class Normalizer {
65
- /**
66
- * Computes a normalized md5 hash from an arbitrary supplied object. Not secure and not
67
- * intended to be secure. Also not fast and not intended to be fast.
68
- *
69
- * Normalization just sorts Maps, Sets and object keys by hash so that differences in order
70
- * do not affect the hash.
71
- *
72
- * @param from - The arbitrary `unknown` to be hashed.
73
- * @returns A normalized md5 hash for the supplied value.
74
- */
75
- computeHash(from) {
76
- switch (typeof from) {
77
- case 'string':
78
- case 'bigint':
79
- case 'boolean':
80
- case 'number':
81
- case 'symbol':
82
- case 'undefined':
83
- return this._normalizeLiteral(from).onSuccess((v) => {
84
- return (0, base_1.captureResult)(() => computeHash([v]));
85
- });
86
- case 'object':
87
- if (from === null || from instanceof Date || from instanceof RegExp) {
88
- return this._normalizeLiteral(from).onSuccess((v) => {
89
- return (0, base_1.captureResult)(() => computeHash([v]));
90
- });
91
- }
92
- else if (Array.isArray(from)) {
93
- return (0, base_1.mapResults)(from.map((e) => this.computeHash(e))).onSuccess((a) => {
94
- return (0, base_1.captureResult)(() => computeHash(a));
95
- });
96
- }
97
- else if (from instanceof Map || from instanceof Set) {
98
- return this.computeHash(this._normalizeEntries(from.entries()));
99
- }
100
- return this.computeHash(this._normalizeEntries(Object.entries(from)));
101
- }
102
- return (0, base_1.fail)(`computeHash: Unexpected type - cannot hash '${typeof from}'`);
103
- }
104
- /**
105
- * Compares two property names from some object being normalized.
106
- * @param k1 - First key to be compared.
107
- * @param k2 - Second key to be compared.
108
- * @returns `1` if `k1` is greater, `-1` if `k2` is greater and
109
- * `0` if they are equal.
110
- * @internal
111
- */
112
- _compareKeys(k1, k2) {
113
- const cs1 = String(k1);
114
- const cs2 = String(k2);
115
- if (cs1 > cs2) {
116
- return 1;
117
- }
118
- if (cs2 > cs1) {
119
- return -1;
120
- }
121
- /* c8 ignore next 2 */
122
- return 0;
123
- }
124
- /**
125
- * Normalizes an array of object property entries (e.g. as returned by `Object.entries()`).
126
- * @remarks
127
- * Converts property names (entry key) to string and then sorts as string.
128
- * @param entries - The entries to be normalized.
129
- * @returns A normalized sorted array of entries.
130
- * @internal
131
- */
132
- _normalizeEntries(entries) {
133
- return Array.from(entries).sort((e1, e2) => this._compareKeys(e1[0], e2[0]));
134
- }
135
- /**
136
- * Constructs a normalized string representation of some literal value.
137
- * @param from - The literal value to be normalized.
138
- * @returns A normalized string representation of the literal.
139
- * @internal
140
- */
141
- _normalizeLiteral(from) {
142
- switch (typeof from) {
143
- case 'string':
144
- return (0, base_1.succeed)(from);
145
- case 'bigint':
146
- case 'boolean':
147
- case 'number':
148
- case 'symbol':
149
- case 'undefined':
150
- return (0, base_1.succeed)(`${typeof from}:[[[${String(from)}]]]`);
151
- }
152
- if (from === null) {
153
- return (0, base_1.succeed)('object:[[[null]]');
154
- }
155
- if (from instanceof Date) {
156
- return (0, base_1.succeed)(`Date:[[[${String(from.valueOf())}]]]`);
157
- }
158
- if (from instanceof RegExp) {
159
- return (0, base_1.succeed)(`RegExp:[[[${from.toString()}]]]`);
160
- }
161
- /* c8 ignore next 2 */
162
- return (0, base_1.fail)(`cannot normalize ${JSON.stringify(from)}`);
163
- }
164
- }
165
- exports.Normalizer = Normalizer;
166
- //# sourceMappingURL=hash.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hash.js","sourceRoot":"","sources":["../../../src/packlets/hash/hash.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+CAAiC;AACjC,kCAA2E;AAE3E;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,KAAe;IACzC,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChF,CAAC;AAFD,kCAEC;AAED;;;GAGG;AACH,MAAa,UAAU;IACrB;;;;;;;;;OASG;IACI,WAAW,CAAC,IAAa;QAC9B,QAAQ,OAAO,IAAI,EAAE;YACnB,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS,CAAC;YACf,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC;YACd,KAAK,WAAW;gBACd,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;oBAClD,OAAO,IAAA,oBAAa,EAAC,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC/C,CAAC,CAAC,CAAC;YACL,KAAK,QAAQ;gBACX,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,YAAY,IAAI,IAAI,IAAI,YAAY,MAAM,EAAE;oBACnE,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;wBAClD,OAAO,IAAA,oBAAa,EAAC,GAAG,EAAE,CAAC,WAAW,C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AAO,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;OAKG;IACO,iBAAiB,CACzB,IAAoF;QAEpF,QAAQ,OAAO,IAAI,EAAE;YACnB,KAAK,QAAQ;gBACX,OAAO,IAAA,cAAO,EAAC,IAAI,CAAC,CAAC;YACvB,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS,CAAC;YACf,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC;YACd,KAAK,WAAW;gBACd,OAAO,IAAA,cAAO,EAAC,GAAG,OAAO,IAAI,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC1D;QACD,IAAI,IAAI,KAAK,IAAI,EAAE;YACjB,OAAO,IAAA,cAAO,EAAC,kBAAkB,CAAC,CAAC;SACpC;QACD,IAAI,IAAI,YAAY,IAAI,EAAE;YACxB,OAAO,IAAA,cAAO,EAAC,WAAW,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;SACxD;QACD,IAAI,IAAI,YAAY,MAAM,EAAE;YAC1B,OAAO,IAAA,cAAO,EAAC,aAAa,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;SACnD;QACD,sBAAsB;QACtB,OAAO,IAAA,WAAI,EAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;CACF;AAvGD,gCAuGC","sourcesContent":["/*\n * Copyright (c) 2021 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as crypto from 'crypto';\nimport { Result, captureResult, fail, mapResults, succeed } from '../base';\n\n/**\n * Computes an md5 hash from an array of strings. Not secure and not intended to be secure.\n * @param parts - The strings to be hashed\n * @returns An md5 hash of the parts\n * @public\n */\nexport function computeHash(parts: string[]): string {\n return crypto.createHash('md5').update(parts.join('|'), 'utf8').digest('hex');\n}\n\n/**\n * Computes a normalized hash for an arbitrary javascript value.\n * @public\n */\nexport class Normalizer {\n /**\n * Computes a normalized md5 hash from an arbitrary supplied object. Not secure and not\n * intended to be secure. Also not fast and not intended to be fast.\n *\n * Normalization just sorts Maps, Sets and object keys by hash so that differences in order\n * do not affect the hash.\n *\n * @param from - The arbitrary `unknown` to be hashed.\n * @returns A normalized md5 hash for the supplied value.\n */\n public computeHash(from: unknown): Result<string> {\n switch (typeof from) {\n case 'string':\n case 'bigint':\n case 'boolean':\n case 'number':\n case 'symbol':\n case 'undefined':\n return this._normalizeLiteral(from).onSuccess((v) => {\n return captureResult(() => computeHash([v]));\n });\n case 'object':\n if (from === null || from instanceof Date || from instanceof RegExp) {\n return this._normalizeLiteral(from).onSuccess((v) => {\n return captureResult(() => computeHash([v]));\n });\n } else if (Array.isArray(from)) {\n return mapResults(from.map((e) => this.computeHash(e))).onSuccess((a) => {\n return captureResult(() => computeHash(a));\n });\n } else if (from instanceof Map || from instanceof Set) {\n return this.computeHash(this._normalizeEntries(from.entries()));\n }\n return this.computeHash(this._normalizeEntries(Object.entries(from)));\n }\n return fail(`computeHash: Unexpected type - cannot hash '${typeof from}'`);\n }\n\n /**\n * Compares two property names from some object being normalized.\n * @param k1 - First key to be compared.\n * @param k2 - Second key to be compared.\n * @returns `1` if `k1` is greater, `-1` if `k2` is greater and\n * `0` if they are equal.\n * @internal\n */\n protected _compareKeys(k1: unknown, k2: unknown): number {\n const cs1 = String(k1);\n const cs2 = String(k2);\n if (cs1 > cs2) {\n return 1;\n }\n if (cs2 > cs1) {\n return -1;\n }\n /* c8 ignore next 2 */\n return 0;\n }\n\n /**\n * Normalizes an array of object property entries (e.g. as returned by `Object.entries()`).\n * @remarks\n * Converts property names (entry key) to string and then sorts as string.\n * @param entries - The entries to be normalized.\n * @returns A normalized sorted array of entries.\n * @internal\n */\n protected _normalizeEntries(entries: Iterable<[unknown, unknown]>): [unknown, unknown][] {\n return Array.from(entries).sort((e1, e2) => this._compareKeys(e1[0], e2[0]));\n }\n\n /**\n * Constructs a normalized string representation of some literal value.\n * @param from - The literal value to be normalized.\n * @returns A normalized string representation of the literal.\n * @internal\n */\n protected _normalizeLiteral(\n from: string | number | bigint | boolean | symbol | undefined | Date | RegExp | null\n ): Result<string> {\n switch (typeof from) {\n case 'string':\n return succeed(from);\n case 'bigint':\n case 'boolean':\n case 'number':\n case 'symbol':\n case 'undefined':\n return succeed(`${typeof from}:[[[${String(from)}]]]`);\n }\n if (from === null) {\n return succeed('object:[[[null]]');\n }\n if (from instanceof Date) {\n return succeed(`Date:[[[${String(from.valueOf())}]]]`);\n }\n if (from instanceof RegExp) {\n return succeed(`RegExp:[[[${from.toString()}]]]`);\n }\n /* c8 ignore next 2 */\n return fail(`cannot normalize ${JSON.stringify(from)}`);\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
- export * from './hash';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/hash/index.ts"],"names":[],"mappings":"AAsBA,cAAc,QAAQ,CAAC"}
@@ -1,39 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2020 Erik Fortune
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining a copy
6
- * of this software and associated documentation files (the "Software"), to deal
7
- * in the Software without restriction, including without limitation the rights
8
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- * copies of the Software, and to permit persons to whom the Software is
10
- * furnished to do so, subject to the following conditions:
11
- *
12
- * The above copyright notice and this permission notice shall be included in all
13
- * copies or substantial portions of the Software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- * SOFTWARE.
22
- */
23
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
- if (k2 === undefined) k2 = k;
25
- var desc = Object.getOwnPropertyDescriptor(m, k);
26
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
- desc = { enumerable: true, get: function() { return m[k]; } };
28
- }
29
- Object.defineProperty(o, k2, desc);
30
- }) : (function(o, m, k, k2) {
31
- if (k2 === undefined) k2 = k;
32
- o[k2] = m[k];
33
- }));
34
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
35
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- __exportStar(require("./hash"), exports);
39
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/hash/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;AAEH,yCAAuB","sourcesContent":["/*\n * Copyright (c) 2020 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nexport * from './hash';\n"]}
@@ -1,2 +0,0 @@
1
- export * from './recordJarHelpers';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/record-jar/index.ts"],"names":[],"mappings":"AAsBA,cAAc,oBAAoB,CAAC"}
@@ -1,39 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2023 Erik Fortune
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining a copy
6
- * of this software and associated documentation files (the "Software"), to deal
7
- * in the Software without restriction, including without limitation the rights
8
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- * copies of the Software, and to permit persons to whom the Software is
10
- * furnished to do so, subject to the following conditions:
11
- *
12
- * The above copyright notice and this permission notice shall be included in all
13
- * copies or substantial portions of the Software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- * SOFTWARE.
22
- */
23
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
- if (k2 === undefined) k2 = k;
25
- var desc = Object.getOwnPropertyDescriptor(m, k);
26
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
- desc = { enumerable: true, get: function() { return m[k]; } };
28
- }
29
- Object.defineProperty(o, k2, desc);
30
- }) : (function(o, m, k, k2) {
31
- if (k2 === undefined) k2 = k;
32
- o[k2] = m[k];
33
- }));
34
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
35
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- __exportStar(require("./recordJarHelpers"), exports);
39
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/record-jar/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;AAEH,qDAAmC","sourcesContent":["/*\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nexport * from './recordJarHelpers';\n"]}
@@ -1,37 +0,0 @@
1
- import { Result } from '../base';
2
- /**
3
- * Represents a single record in a JAR file
4
- * @public
5
- */
6
- export type JarRecord = Record<string, string | string[]>;
7
- /**
8
- * @public
9
- */
10
- export type JarFieldPicker<T extends JarRecord = JarRecord> = (record: T) => (keyof T)[];
11
- /**
12
- * Options for a JAR record parser.
13
- * @public
14
- */
15
- export interface JarRecordParserOptions {
16
- readonly arrayFields?: string[] | JarFieldPicker;
17
- readonly fixedContinuationSize?: number;
18
- }
19
- /**
20
- * Reads a record-jar from an array of strings, each of which represents one
21
- * line in the source file.
22
- * @param lines - the array of strings to be parsed
23
- * @param options - Optional parser configuration
24
- * @returns a corresponding array of `Record<string, string>`
25
- * @public
26
- */
27
- export declare function parseRecordJarLines(lines: string[], options?: JarRecordParserOptions): Result<JarRecord[]>;
28
- /**
29
- * Reads a record-jar file from a supplied path.
30
- * @param srcPath - Source path from which the file is read.
31
- * @param options - Optional parser configuration
32
- * @returns The contents of the file as an array of `Record<string, string>`
33
- * @see https://datatracker.ietf.org/doc/html/draft-phillips-record-jar-01
34
- * @public
35
- */
36
- export declare function readRecordJarFileSync(srcPath: string, options?: JarRecordParserOptions): Result<JarRecord[]>;
37
- //# sourceMappingURL=recordJarHelpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"recordJarHelpers.d.ts","sourceRoot":"","sources":["../../../src/packlets/record-jar/recordJarHelpers.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,MAAM,EAAyC,MAAM,SAAS,CAAC;AAOxE;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;AAEzF;;;GAGG;AAEH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC;IACjD,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CACzC;AAoMD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC,CAE1G;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,sBAAsB,GAC/B,MAAM,CAAC,SAAS,EAAE,CAAC,CAOrB"}
@@ -1,263 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2022 Erik Fortune
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining a copy
6
- * of this software and associated documentation files (the "Software"), to deal
7
- * in the Software without restriction, including without limitation the rights
8
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- * copies of the Software, and to permit persons to whom the Software is
10
- * furnished to do so, subject to the following conditions:
11
- *
12
- * The above copyright notice and this permission notice shall be included in all
13
- * copies or substantial portions of the Software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- * SOFTWARE.
22
- */
23
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
- if (k2 === undefined) k2 = k;
25
- var desc = Object.getOwnPropertyDescriptor(m, k);
26
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
- desc = { enumerable: true, get: function() { return m[k]; } };
28
- }
29
- Object.defineProperty(o, k2, desc);
30
- }) : (function(o, m, k, k2) {
31
- if (k2 === undefined) k2 = k;
32
- o[k2] = m[k];
33
- }));
34
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
- Object.defineProperty(o, "default", { enumerable: true, value: v });
36
- }) : function(o, v) {
37
- o["default"] = v;
38
- });
39
- var __importStar = (this && this.__importStar) || function (mod) {
40
- if (mod && mod.__esModule) return mod;
41
- var result = {};
42
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
43
- __setModuleDefault(result, mod);
44
- return result;
45
- };
46
- Object.defineProperty(exports, "__esModule", { value: true });
47
- exports.readRecordJarFileSync = exports.parseRecordJarLines = void 0;
48
- const fs = __importStar(require("fs"));
49
- const path = __importStar(require("path"));
50
- const base_1 = require("../base");
51
- class RecordParser {
52
- // eslint-disable-next-line @typescript-eslint/no-empty-function
53
- constructor(options) {
54
- this.records = [];
55
- this._fields = {};
56
- this._name = undefined;
57
- this._body = undefined;
58
- this.options = options !== null && options !== void 0 ? options : {};
59
- }
60
- static parse(lines, options) {
61
- return new RecordParser(options)._parse(lines);
62
- }
63
- static _parseRecordBody(body) {
64
- const isContinuation = body.endsWith('\\');
65
- if (isContinuation) {
66
- body = body.slice(0, body.length - 1);
67
- }
68
- if (this._hasEscapes(body)) {
69
- const result = this._replaceEscapes(body);
70
- if (result.isFailure()) {
71
- return (0, base_1.fail)(result.message);
72
- }
73
- body = result.value;
74
- }
75
- return (0, base_1.succeed)({ body, isContinuation });
76
- }
77
- static _hasEscapes(from) {
78
- return from.includes('\\') || from.includes('&');
79
- }
80
- static _replaceEscapes(body) {
81
- const invalid = [];
82
- const escaped = body.replace(/(\\.)|(&#x[a-fA-F0-9]{2,6};)/g, (match) => {
83
- switch (match) {
84
- case '\\\\':
85
- return '\\';
86
- case '\\&':
87
- return '&';
88
- case '\\r':
89
- return '\r';
90
- case '\\n':
91
- return '\n';
92
- case '\\t':
93
- return '\t';
94
- }
95
- if (match.startsWith('&')) {
96
- const hexCode = `0x${match.slice(3, match.length - 1)}`;
97
- const charCode = Number.parseInt(hexCode, 16);
98
- return String.fromCharCode(charCode);
99
- }
100
- invalid.push(match);
101
- return '\\';
102
- });
103
- if (invalid.length > 0) {
104
- return (0, base_1.fail)(`unrecognized escape "${invalid.join(', ')}" in record-jar body`);
105
- }
106
- return (0, base_1.succeed)(escaped);
107
- }
108
- static _applyOptions(record, options) {
109
- if (options.arrayFields) {
110
- record = Object.assign({}, record); // don't edit incoming values
111
- const arrayFields = Array.isArray(options.arrayFields)
112
- ? options.arrayFields
113
- : options.arrayFields(record);
114
- for (const field of arrayFields) {
115
- if ((0, base_1.isKeyOf)(field, record) && typeof record[field] === 'string') {
116
- const current = record[field];
117
- record[field] = [current];
118
- }
119
- }
120
- }
121
- return record;
122
- }
123
- _parse(lines) {
124
- var _a, _b;
125
- for (let n = 0; n < lines.length; n++) {
126
- const line = lines[n];
127
- if (line.startsWith('%%') && !((_a = this._body) === null || _a === void 0 ? void 0 : _a.isContinuation)) {
128
- const result = this._writePendingRecord();
129
- if (result.isFailure()) {
130
- return (0, base_1.fail)(`${n}: ${result.message}`);
131
- }
132
- }
133
- else if (/^\s*$/.test(line)) {
134
- // ignore blank lines but cancel continuation
135
- if (this._body) {
136
- this._body.isContinuation = false;
137
- }
138
- continue;
139
- }
140
- else if (((_b = this._body) === null || _b === void 0 ? void 0 : _b.isContinuation) || /^\s+/.test(line)) {
141
- // explicit continuation on previous line or implicit starts with whitespace
142
- if (this._body === undefined) {
143
- return (0, base_1.fail)(`${n}: continuation ("${line}") without prior value.`);
144
- }
145
- const result = this._parseContinuation(line);
146
- if (result.isFailure()) {
147
- return (0, base_1.fail)(`${n}: ${result.message}`);
148
- }
149
- this._body = result.value;
150
- }
151
- else {
152
- const result = this._parseField(line);
153
- if (result.isFailure()) {
154
- return (0, base_1.fail)(`${n}: ${result.message}`);
155
- }
156
- }
157
- }
158
- const result = this._writePendingRecord();
159
- if (result.isFailure()) {
160
- return (0, base_1.fail)(`${lines.length}: ${result.message}`);
161
- }
162
- return (0, base_1.succeed)(this.records);
163
- }
164
- _parseField(line) {
165
- const separatorIndex = line.indexOf(':');
166
- if (separatorIndex < 1) {
167
- return (0, base_1.fail)(`malformed line ("${line}") in record-jar.`);
168
- }
169
- const parts = [line.slice(0, separatorIndex), line.slice(separatorIndex + 1)];
170
- return this._writePendingField().onSuccess(() => {
171
- this._name = parts[0].trimEnd();
172
- return RecordParser._parseRecordBody(parts[1].trim()).onSuccess((body) => {
173
- this._body = body;
174
- return (0, base_1.succeed)(true);
175
- });
176
- });
177
- }
178
- _parseContinuation(line) {
179
- var _a, _b;
180
- let trimmed = line.trim();
181
- if (!this._body.isContinuation) {
182
- /* c8 ignore next */
183
- const fixedSize = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.fixedContinuationSize) !== null && _b !== void 0 ? _b : 0;
184
- if (fixedSize > 0) {
185
- if (trimmed.length < line.length - fixedSize) {
186
- // oops, took too much
187
- trimmed = line.slice(fixedSize);
188
- }
189
- }
190
- }
191
- return RecordParser._parseRecordBody(trimmed).onSuccess((newBody) => {
192
- return (0, base_1.succeed)({
193
- body: `${this._body.body}${newBody.body}`,
194
- isContinuation: newBody.isContinuation
195
- });
196
- });
197
- }
198
- _havePendingRecord() {
199
- return Object.keys(this._fields).length > 0;
200
- }
201
- _writePendingRecord() {
202
- return this._writePendingField().onSuccess(() => {
203
- let record = this._havePendingRecord() ? this._fields : undefined;
204
- if (record !== undefined) {
205
- record = RecordParser._applyOptions(record, this.options);
206
- this.records.push(record);
207
- this._fields = {};
208
- }
209
- return (0, base_1.succeed)(undefined);
210
- });
211
- }
212
- _writePendingField() {
213
- if (this._name !== undefined) {
214
- if (this._body.body.length < 1) {
215
- return (0, base_1.fail)('empty body value not allowed');
216
- }
217
- if (!(0, base_1.isKeyOf)(this._name, this._fields)) {
218
- this._fields[this._name] = this._body.body;
219
- }
220
- else if (typeof this._fields[this._name] === 'string') {
221
- const current = this._fields[this._name];
222
- this._fields[this._name] = [current, this._body.body];
223
- }
224
- else {
225
- const current = this._fields[this._name];
226
- current.push(this._body.body);
227
- }
228
- this._name = undefined;
229
- this._body = undefined;
230
- }
231
- return (0, base_1.succeed)(true);
232
- }
233
- }
234
- /**
235
- * Reads a record-jar from an array of strings, each of which represents one
236
- * line in the source file.
237
- * @param lines - the array of strings to be parsed
238
- * @param options - Optional parser configuration
239
- * @returns a corresponding array of `Record<string, string>`
240
- * @public
241
- */
242
- function parseRecordJarLines(lines, options) {
243
- return RecordParser.parse(lines, options);
244
- }
245
- exports.parseRecordJarLines = parseRecordJarLines;
246
- /**
247
- * Reads a record-jar file from a supplied path.
248
- * @param srcPath - Source path from which the file is read.
249
- * @param options - Optional parser configuration
250
- * @returns The contents of the file as an array of `Record<string, string>`
251
- * @see https://datatracker.ietf.org/doc/html/draft-phillips-record-jar-01
252
- * @public
253
- */
254
- function readRecordJarFileSync(srcPath, options) {
255
- return (0, base_1.captureResult)(() => {
256
- const fullPath = path.resolve(srcPath);
257
- return fs.readFileSync(fullPath, 'utf8').toString().split(/\r?\n/);
258
- }).onSuccess((lines) => {
259
- return parseRecordJarLines(lines, options);
260
- });
261
- }
262
- exports.readRecordJarFileSync = readRecordJarFileSync;
263
- //# sourceMappingURL=recordJarHelpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"recordJarHelpers.js","sourceRoot":"","sources":["../../../src/packlets/record-jar/recordJarHelpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAE7B,kCAAwE;AA4BxE,MAAM,YAAY;IAQhB,gEAAgE;IAChE,YAAoB,OAAgC;QARpC,YAAO,GAAgB,EAAE,CAAC;QAGhC,YAAO,GAAc,EAAE,CAAC;QACxB,UAAK,GAAuB,SAAS,CAAC;QACtC,UAAK,GAA4B,SAAS,CAAC;QAInD,IAAI,CAAC,OAAO,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC;IAC/B,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,KAAe,EAAE,OAAgC;QACnE,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IAES,MAAM,CAAC,gBAA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OG;AACH,SAAgB,qBAAqB,CACnC,OAAe,EACf,OAAgC;IAEhC,OAAO,IAAA,oBAAa,EAAC,GAAG,EAAE;QACxB,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvC,OAAO,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,OAAO,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC;AAVD,sDAUC","sourcesContent":["/*\n * Copyright (c) 2022 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\n\nimport { Result, captureResult, fail, isKeyOf, succeed } from '../base';\n\ninterface IRecordBody {\n body: string;\n isContinuation: boolean;\n}\n\n/**\n * Represents a single record in a JAR file\n * @public\n */\nexport type JarRecord = Record<string, string | string[]>;\n\n/**\n * @public\n */\nexport type JarFieldPicker<T extends JarRecord = JarRecord> = (record: T) => (keyof T)[];\n\n/**\n * Options for a JAR record parser.\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface JarRecordParserOptions {\n readonly arrayFields?: string[] | JarFieldPicker;\n readonly fixedContinuationSize?: number;\n}\n\nclass RecordParser {\n public readonly records: JarRecord[] = [];\n public readonly options: JarRecordParserOptions;\n\n protected _fields: JarRecord = {};\n protected _name: string | undefined = undefined;\n protected _body: IRecordBody | undefined = undefined;\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private constructor(options?: JarRecordParserOptions) {\n this.options = options ?? {};\n }\n\n public static parse(lines: string[], options?: JarRecordParserOptions): Result<JarRecord[]> {\n return new RecordParser(options)._parse(lines);\n }\n\n protected static _parseRecordBody(body: string): Result<IRecordBody> {\n const isContinuation = body.endsWith('\\\\');\n if (isContinuation) {\n body = body.slice(0, body.length - 1);\n }\n if (this._hasEscapes(body)) {\n const result = this._replaceEscapes(body);\n if (result.isFailure()) {\n return fail(result.message);\n }\n body = result.value;\n }\n return succeed({ body, isContinuation });\n }\n\n protected static _hasEscapes(from: string): boolean {\n return from.includes('\\\\') || from.includes('&');\n }\n\n protected static _replaceEscapes(body: string): Result<string> {\n const invalid: string[] = [];\n const escaped = body.replace(/(\\\\.)|(&#x[a-fA-F0-9]{2,6};)/g, (match) => {\n switch (match) {\n case '\\\\\\\\':\n return '\\\\';\n case '\\\\&':\n return '&';\n case '\\\\r':\n return '\\r';\n case '\\\\n':\n return '\\n';\n case '\\\\t':\n return '\\t';\n }\n if (match.startsWith('&')) {\n const hexCode = `0x${match.slice(3, match.length - 1)}`;\n const charCode = Number.parseInt(hexCode, 16);\n return String.fromCharCode(charCode);\n }\n invalid.push(match);\n return '\\\\';\n });\n if (invalid.length > 0) {\n return fail(`unrecognized escape \"${invalid.join(', ')}\" in record-jar body`);\n }\n return succeed(escaped);\n }\n\n protected static _applyOptions(record: JarRecord, options: JarRecordParserOptions): JarRecord {\n if (options.arrayFields) {\n record = { ...record }; // don't edit incoming values\n const arrayFields = Array.isArray(options.arrayFields)\n ? options.arrayFields\n : options.arrayFields(record);\n\n for (const field of arrayFields) {\n if (isKeyOf(field, record) && typeof record[field] === 'string') {\n const current = record[field] as string;\n record[field] = [current];\n }\n }\n }\n return record;\n }\n\n protected _parse(lines: string[]): Result<JarRecord[]> {\n for (let n = 0; n < lines.length; n++) {\n const line = lines[n];\n if (line.startsWith('%%') && !this._body?.isContinuation) {\n const result = this._writePendingRecord();\n if (result.isFailure()) {\n return fail(`${n}: ${result.message}`);\n }\n } else if (/^\\s*$/.test(line)) {\n // ignore blank lines but cancel continuation\n if (this._body) {\n this._body.isContinuation = false;\n }\n continue;\n } else if (this._body?.isContinuation || /^\\s+/.test(line)) {\n // explicit continuation on previous line or implicit starts with whitespace\n if (this._body === undefined) {\n return fail(`${n}: continuation (\"${line}\") without prior value.`);\n }\n const result = this._parseContinuation(line);\n if (result.isFailure()) {\n return fail(`${n}: ${result.message}`);\n }\n this._body = result.value;\n } else {\n const result = this._parseField(line);\n if (result.isFailure()) {\n return fail(`${n}: ${result.message}`);\n }\n }\n }\n\n const result = this._writePendingRecord();\n if (result.isFailure()) {\n return fail(`${lines.length}: ${result.message}`);\n }\n return succeed(this.records);\n }\n\n protected _parseField(line: string): Result<boolean> {\n const separatorIndex = line.indexOf(':');\n if (separatorIndex < 1) {\n return fail(`malformed line (\"${line}\") in record-jar.`);\n }\n const parts = [line.slice(0, separatorIndex), line.slice(separatorIndex + 1)];\n\n return this._writePendingField().onSuccess(() => {\n this._name = parts[0].trimEnd();\n return RecordParser._parseRecordBody(parts[1].trim()).onSuccess((body) => {\n this._body = body;\n return succeed(true);\n });\n });\n }\n\n protected _parseContinuation(line: string): Result<IRecordBody> {\n let trimmed = line.trim();\n if (!this._body!.isContinuation) {\n /* c8 ignore next */\n const fixedSize = this.options?.fixedContinuationSize ?? 0;\n if (fixedSize > 0) {\n if (trimmed.length < line.length - fixedSize) {\n // oops, took too much\n trimmed = line.slice(fixedSize);\n }\n }\n }\n return RecordParser._parseRecordBody(trimmed).onSuccess((newBody) => {\n return succeed({\n body: `${this._body!.body}${newBody.body}`,\n isContinuation: newBody.isContinuation\n });\n });\n }\n\n protected _havePendingRecord(): boolean {\n return Object.keys(this._fields).length > 0;\n }\n\n protected _writePendingRecord(): Result<JarRecord | undefined> {\n return this._writePendingField().onSuccess(() => {\n let record = this._havePendingRecord() ? this._fields : undefined;\n if (record !== undefined) {\n record = RecordParser._applyOptions(record, this.options);\n this.records.push(record);\n this._fields = {};\n }\n return succeed(undefined);\n });\n }\n\n protected _writePendingField(): Result<boolean> {\n if (this._name !== undefined) {\n if (this._body!.body.length < 1) {\n return fail('empty body value not allowed');\n }\n if (!isKeyOf(this._name, this._fields)) {\n this._fields[this._name] = this._body!.body;\n } else if (typeof this._fields[this._name] === 'string') {\n const current = this._fields[this._name] as string;\n this._fields[this._name] = [current, this._body!.body];\n } else {\n const current = this._fields[this._name] as string[];\n current.push(this._body!.body);\n }\n this._name = undefined;\n this._body = undefined;\n }\n return succeed(true);\n }\n}\n\n/**\n * Reads a record-jar from an array of strings, each of which represents one\n * line in the source file.\n * @param lines - the array of strings to be parsed\n * @param options - Optional parser configuration\n * @returns a corresponding array of `Record<string, string>`\n * @public\n */\nexport function parseRecordJarLines(lines: string[], options?: JarRecordParserOptions): Result<JarRecord[]> {\n return RecordParser.parse(lines, options);\n}\n\n/**\n * Reads a record-jar file from a supplied path.\n * @param srcPath - Source path from which the file is read.\n * @param options - Optional parser configuration\n * @returns The contents of the file as an array of `Record<string, string>`\n * @see https://datatracker.ietf.org/doc/html/draft-phillips-record-jar-01\n * @public\n */\nexport function readRecordJarFileSync(\n srcPath: string,\n options?: JarRecordParserOptions\n): Result<JarRecord[]> {\n return captureResult(() => {\n const fullPath = path.resolve(srcPath);\n return fs.readFileSync(fullPath, 'utf8').toString().split(/\\r?\\n/);\n }).onSuccess((lines) => {\n return parseRecordJarLines(lines, options);\n });\n}\n"]}