@fgv/ts-utils 1.9.3 → 2.0.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 (211) hide show
  1. package/CHANGELOG.json +26 -0
  2. package/CHANGELOG.md +14 -0
  3. package/dist/ts-utils.d.ts +3007 -0
  4. package/dist/tsdoc-metadata.json +11 -0
  5. package/lib/index.d.ts +12 -0
  6. package/lib/index.d.ts.map +1 -0
  7. package/lib/index.js +68 -0
  8. package/lib/index.js.map +1 -0
  9. package/lib/packlets/base/brand.d.ts.map +1 -0
  10. package/lib/packlets/base/brand.js +24 -0
  11. package/lib/packlets/base/brand.js.map +1 -0
  12. package/lib/packlets/base/index.d.ts +7 -0
  13. package/lib/packlets/base/index.d.ts.map +1 -0
  14. package/lib/packlets/base/index.js +58 -0
  15. package/lib/packlets/base/index.js.map +1 -0
  16. package/{logger.d.ts → lib/packlets/base/logger.d.ts} +16 -1
  17. package/lib/packlets/base/logger.d.ts.map +1 -0
  18. package/lib/packlets/base/logger.js +128 -0
  19. package/lib/packlets/base/logger.js.map +1 -0
  20. package/{normalize.d.ts → lib/packlets/base/normalize.d.ts} +6 -0
  21. package/lib/packlets/base/normalize.d.ts.map +1 -0
  22. package/lib/packlets/base/normalize.js +139 -0
  23. package/lib/packlets/base/normalize.js.map +1 -0
  24. package/{result.d.ts → lib/packlets/base/result.d.ts} +16 -15
  25. package/lib/packlets/base/result.d.ts.map +1 -0
  26. package/lib/packlets/base/result.js +571 -0
  27. package/lib/packlets/base/result.js.map +1 -0
  28. package/lib/packlets/base/utils.d.ts.map +1 -0
  29. package/lib/packlets/base/utils.js +200 -0
  30. package/lib/packlets/base/utils.js.map +1 -0
  31. package/{converter.d.ts → lib/packlets/conversion/converter.d.ts} +11 -12
  32. package/lib/packlets/conversion/converter.d.ts.map +1 -0
  33. package/lib/packlets/conversion/converter.js +218 -0
  34. package/lib/packlets/conversion/converter.js.map +1 -0
  35. package/{converters.d.ts → lib/packlets/conversion/converters.d.ts} +52 -216
  36. package/lib/packlets/conversion/converters.d.ts.map +1 -0
  37. package/lib/packlets/conversion/converters.js +739 -0
  38. package/lib/packlets/conversion/converters.js.map +1 -0
  39. package/lib/packlets/conversion/index.d.ts +6 -0
  40. package/lib/packlets/conversion/index.d.ts.map +1 -0
  41. package/lib/packlets/conversion/index.js +56 -0
  42. package/lib/packlets/conversion/index.js.map +1 -0
  43. package/lib/packlets/conversion/objectConverter.d.ts +94 -0
  44. package/lib/packlets/conversion/objectConverter.d.ts.map +1 -0
  45. package/lib/packlets/conversion/objectConverter.js +110 -0
  46. package/lib/packlets/conversion/objectConverter.js.map +1 -0
  47. package/lib/packlets/conversion/stringConverter.d.ts +78 -0
  48. package/lib/packlets/conversion/stringConverter.d.ts.map +1 -0
  49. package/lib/packlets/conversion/stringConverter.js +97 -0
  50. package/lib/packlets/conversion/stringConverter.js.map +1 -0
  51. package/{csvHelpers.d.ts → lib/packlets/csv/csvHelpers.d.ts} +1 -1
  52. package/lib/packlets/csv/csvHelpers.d.ts.map +1 -0
  53. package/lib/packlets/csv/csvHelpers.js +69 -0
  54. package/lib/packlets/csv/csvHelpers.js.map +1 -0
  55. package/lib/packlets/csv/index.d.ts +2 -0
  56. package/lib/packlets/csv/index.d.ts.map +1 -0
  57. package/lib/packlets/csv/index.js +39 -0
  58. package/lib/packlets/csv/index.js.map +1 -0
  59. package/{extendedArray.d.ts → lib/packlets/experimental/extendedArray.d.ts} +7 -7
  60. package/lib/packlets/experimental/extendedArray.d.ts.map +1 -0
  61. package/lib/packlets/experimental/extendedArray.js +106 -0
  62. package/lib/packlets/experimental/extendedArray.js.map +1 -0
  63. package/{formatter.d.ts → lib/packlets/experimental/formatter.d.ts} +6 -6
  64. package/lib/packlets/experimental/formatter.d.ts.map +1 -0
  65. package/lib/packlets/experimental/formatter.js +75 -0
  66. package/lib/packlets/experimental/formatter.js.map +1 -0
  67. package/lib/packlets/experimental/index.d.ts +4 -0
  68. package/lib/packlets/experimental/index.d.ts.map +1 -0
  69. package/lib/packlets/experimental/index.js +41 -0
  70. package/lib/packlets/experimental/index.js.map +1 -0
  71. package/{rangeOf.d.ts → lib/packlets/experimental/rangeOf.d.ts} +21 -24
  72. package/lib/packlets/experimental/rangeOf.d.ts.map +1 -0
  73. package/lib/packlets/experimental/rangeOf.js +185 -0
  74. package/lib/packlets/experimental/rangeOf.js.map +1 -0
  75. package/{hash.d.ts → lib/packlets/hash/hash.d.ts} +1 -1
  76. package/lib/packlets/hash/hash.d.ts.map +1 -0
  77. package/lib/packlets/hash/hash.js +168 -0
  78. package/lib/packlets/hash/hash.js.map +1 -0
  79. package/lib/packlets/hash/index.d.ts +2 -0
  80. package/lib/packlets/hash/index.d.ts.map +1 -0
  81. package/lib/packlets/hash/index.js +39 -0
  82. package/lib/packlets/hash/index.js.map +1 -0
  83. package/lib/packlets/record-jar/index.d.ts +2 -0
  84. package/lib/packlets/record-jar/index.d.ts.map +1 -0
  85. package/lib/packlets/record-jar/index.js +39 -0
  86. package/lib/packlets/record-jar/index.js.map +1 -0
  87. package/{recordJarHelpers.d.ts → lib/packlets/record-jar/recordJarHelpers.d.ts} +1 -1
  88. package/lib/packlets/record-jar/recordJarHelpers.d.ts.map +1 -0
  89. package/lib/packlets/record-jar/recordJarHelpers.js +263 -0
  90. package/lib/packlets/record-jar/recordJarHelpers.js.map +1 -0
  91. package/{validation → lib/packlets/validation}/array.d.ts +2 -2
  92. package/lib/packlets/validation/array.d.ts.map +1 -0
  93. package/lib/packlets/validation/array.js +67 -0
  94. package/lib/packlets/validation/array.js.map +1 -0
  95. package/{validation → lib/packlets/validation}/boolean.d.ts +1 -1
  96. package/lib/packlets/validation/boolean.d.ts.map +1 -0
  97. package/lib/packlets/validation/boolean.js +56 -0
  98. package/lib/packlets/validation/boolean.js.map +1 -0
  99. package/lib/packlets/validation/classes.d.ts.map +1 -0
  100. package/lib/packlets/validation/classes.js +38 -0
  101. package/lib/packlets/validation/classes.js.map +1 -0
  102. package/lib/packlets/validation/common.d.ts.map +1 -0
  103. package/lib/packlets/validation/common.js +24 -0
  104. package/lib/packlets/validation/common.js.map +1 -0
  105. package/{validation → lib/packlets/validation}/field.d.ts +1 -1
  106. package/lib/packlets/validation/field.d.ts.map +1 -0
  107. package/lib/packlets/validation/field.js +71 -0
  108. package/lib/packlets/validation/field.js.map +1 -0
  109. package/{validation → lib/packlets/validation}/genericValidator.d.ts +2 -3
  110. package/lib/packlets/validation/genericValidator.d.ts.map +1 -0
  111. package/lib/packlets/validation/genericValidator.js +137 -0
  112. package/lib/packlets/validation/genericValidator.js.map +1 -0
  113. package/lib/packlets/validation/index.d.ts.map +1 -0
  114. package/{validation → lib/packlets/validation}/index.js +1 -1
  115. package/lib/packlets/validation/index.js.map +1 -0
  116. package/{validation → lib/packlets/validation}/number.d.ts +1 -1
  117. package/lib/packlets/validation/number.d.ts.map +1 -0
  118. package/lib/packlets/validation/number.js +54 -0
  119. package/lib/packlets/validation/number.js.map +1 -0
  120. package/{validation → lib/packlets/validation}/object.d.ts +1 -1
  121. package/lib/packlets/validation/object.d.ts.map +1 -0
  122. package/lib/packlets/validation/object.js +139 -0
  123. package/lib/packlets/validation/object.js.map +1 -0
  124. package/{validation → lib/packlets/validation}/string.d.ts +1 -1
  125. package/lib/packlets/validation/string.d.ts.map +1 -0
  126. package/lib/packlets/validation/string.js +54 -0
  127. package/lib/packlets/validation/string.js.map +1 -0
  128. package/lib/packlets/validation/traits.d.ts.map +1 -0
  129. package/lib/packlets/validation/traits.js +58 -0
  130. package/lib/packlets/validation/traits.js.map +1 -0
  131. package/{validation → lib/packlets/validation}/typeGuard.d.ts +1 -1
  132. package/lib/packlets/validation/typeGuard.d.ts.map +1 -0
  133. package/lib/packlets/validation/typeGuard.js +62 -0
  134. package/lib/packlets/validation/typeGuard.js.map +1 -0
  135. package/{validation → lib/packlets/validation}/validator.d.ts +15 -16
  136. package/lib/packlets/validation/validator.d.ts.map +1 -0
  137. package/lib/packlets/validation/validator.js +24 -0
  138. package/lib/packlets/validation/validator.js.map +1 -0
  139. package/{validation → lib/packlets/validation}/validatorBase.d.ts +1 -1
  140. package/lib/packlets/validation/validatorBase.d.ts.map +1 -0
  141. package/lib/packlets/validation/validatorBase.js +41 -0
  142. package/lib/packlets/validation/validatorBase.js.map +1 -0
  143. package/{validation → lib/packlets/validation}/validators.d.ts +3 -6
  144. package/lib/packlets/validation/validators.d.ts.map +1 -0
  145. package/lib/packlets/validation/validators.js +121 -0
  146. package/lib/packlets/validation/validators.js.map +1 -0
  147. package/package.json +34 -33
  148. package/brand.d.ts.map +0 -1
  149. package/brand.js +0 -24
  150. package/converter.d.ts.map +0 -1
  151. package/converter.js +0 -222
  152. package/converters.d.ts.map +0 -1
  153. package/converters.js +0 -896
  154. package/csvHelpers.d.ts.map +0 -1
  155. package/csvHelpers.js +0 -69
  156. package/extendedArray.d.ts.map +0 -1
  157. package/extendedArray.js +0 -106
  158. package/formatter.d.ts.map +0 -1
  159. package/formatter.js +0 -75
  160. package/hash.d.ts.map +0 -1
  161. package/hash.js +0 -168
  162. package/index.d.ts +0 -15
  163. package/index.d.ts.map +0 -1
  164. package/index.js +0 -70
  165. package/logger.d.ts.map +0 -1
  166. package/logger.js +0 -115
  167. package/normalize.d.ts.map +0 -1
  168. package/normalize.js +0 -139
  169. package/rangeOf.d.ts.map +0 -1
  170. package/rangeOf.js +0 -185
  171. package/recordJarHelpers.d.ts.map +0 -1
  172. package/recordJarHelpers.js +0 -262
  173. package/result.d.ts.map +0 -1
  174. package/result.js +0 -569
  175. package/utils.d.ts.map +0 -1
  176. package/utils.js +0 -200
  177. package/validation/array.d.ts.map +0 -1
  178. package/validation/array.js +0 -67
  179. package/validation/boolean.d.ts.map +0 -1
  180. package/validation/boolean.js +0 -59
  181. package/validation/classes.d.ts.map +0 -1
  182. package/validation/classes.js +0 -38
  183. package/validation/common.d.ts.map +0 -1
  184. package/validation/common.js +0 -24
  185. package/validation/field.d.ts.map +0 -1
  186. package/validation/field.js +0 -72
  187. package/validation/genericValidator.d.ts.map +0 -1
  188. package/validation/genericValidator.js +0 -138
  189. package/validation/index.d.ts.map +0 -1
  190. package/validation/number.d.ts.map +0 -1
  191. package/validation/number.js +0 -57
  192. package/validation/object.d.ts.map +0 -1
  193. package/validation/object.js +0 -143
  194. package/validation/string.d.ts.map +0 -1
  195. package/validation/string.js +0 -57
  196. package/validation/traits.d.ts.map +0 -1
  197. package/validation/traits.js +0 -58
  198. package/validation/typeGuard.d.ts.map +0 -1
  199. package/validation/typeGuard.js +0 -62
  200. package/validation/validator.d.ts.map +0 -1
  201. package/validation/validator.js +0 -24
  202. package/validation/validatorBase.d.ts.map +0 -1
  203. package/validation/validatorBase.js +0 -44
  204. package/validation/validators.d.ts.map +0 -1
  205. package/validation/validators.js +0 -119
  206. /package/{brand.d.ts → lib/packlets/base/brand.d.ts} +0 -0
  207. /package/{utils.d.ts → lib/packlets/base/utils.d.ts} +0 -0
  208. /package/{validation → lib/packlets/validation}/classes.d.ts +0 -0
  209. /package/{validation → lib/packlets/validation}/common.d.ts +0 -0
  210. /package/{validation → lib/packlets/validation}/index.d.ts +0 -0
  211. /package/{validation → lib/packlets/validation}/traits.d.ts +0 -0
@@ -1,4 +1,4 @@
1
- import { Result } from './result';
1
+ import { Result } from '../base';
2
2
  /**
3
3
  * Represents a generic range of some comparable type `<T>`.
4
4
  * @public
@@ -10,7 +10,7 @@ export interface RangeOfProperties<T> {
10
10
  /**
11
11
  * Format strings (in mustache format) to
12
12
  * use for both open-ended and complete
13
- * {@link RangeOf | RangeOf<T>}.
13
+ * {@link Experimental.RangeOf | RangeOf<T>}.
14
14
  * @public
15
15
  */
16
16
  export interface RangeOfFormats {
@@ -19,15 +19,11 @@ export interface RangeOfFormats {
19
19
  minMax: string;
20
20
  }
21
21
  /**
22
- * Default {@link RangeOfFormats | formats} to use for both
23
- * open-ended and complete {@link RangeOf | RangeOf<T>}.
22
+ * Default {@link Experimental.RangeOfFormats | formats} to use for both
23
+ * open-ended and complete {@link Experimental.RangeOf | RangeOf<T>}.
24
24
  * @public
25
25
  */
26
- export declare const DEFAULT_RANGEOF_FORMATS: {
27
- minOnly: string;
28
- maxOnly: string;
29
- minMax: string;
30
- };
26
+ export declare const DEFAULT_RANGEOF_FORMATS: RangeOfFormats;
31
27
  /**
32
28
  * Simple implementation of a possibly open-ended range of some comparable
33
29
  * type `<T>` with test and formatting.
@@ -43,23 +39,23 @@ export declare class RangeOf<T> implements RangeOfProperties<T> {
43
39
  */
44
40
  readonly max?: T;
45
41
  /**
46
- * Creates a new {@link RangeOf | RangeOf<T>}.
47
- * @param min - Optional mininum extent of the range.
42
+ * Creates a new {@link Experimental.RangeOf | RangeOf<T>}.
43
+ * @param min - Optional minimum extent of the range.
48
44
  * @param max - Optional maximum extent of the range.
49
45
  */
50
46
  constructor(min?: T, max?: T);
51
47
  /**
52
- * Static constructor for a {@link RangeOf | RangeOf<T>}.
53
- * @param init - {@link RangeOfProperties | Range initializer}.
54
- * @returns A new {@link RangeOf | RangeOf<T>}.
48
+ * Static constructor for a {@link Experimental.RangeOf | RangeOf<T>}.
49
+ * @param init - {@link Experimental.RangeOfProperties | Range initializer}.
50
+ * @returns A new {@link Experimental.RangeOf | RangeOf<T>}.
55
51
  */
56
52
  static createRange<T>(init?: RangeOfProperties<T>): Result<RangeOf<T>>;
57
53
  /**
58
- * Gets a formatted description of a {@link RangeOfProperties | RangeOfProperties<T>} given an
54
+ * Gets a formatted description of a {@link Experimental.RangeOfProperties | RangeOfProperties<T>} given an
59
55
  * optional set of formats and 'empty' value to use.
60
- * @param range - The {@link RangeOfProperties | RangeOfProperties<T>} to be formatted.
61
- * @param formats - Optionas {@link RangeOfFormats | formats} to use. Default is
62
- * {@link DEFAULT_RANGEOF_FORMATS | DEFAULT_RANGEOF_FORMATS}.
56
+ * @param range - The {@link Experimental.RangeOfProperties | RangeOfProperties<T>} to be formatted.
57
+ * @param formats - Optional {@link Experimental.RangeOfFormats | formats} to use. Default is
58
+ * {@link Experimental.DEFAULT_RANGEOF_FORMATS | DEFAULT_RANGEOF_FORMATS}.
63
59
  * @param emptyValue - Value which represents unbounded minimum or maximum for this range. Default is `undefined`.
64
60
  * @returns A string representation of the range.
65
61
  */
@@ -99,21 +95,22 @@ export declare class RangeOf<T> implements RangeOfProperties<T> {
99
95
  /**
100
96
  * Formats the minimum and maximum values of this range.
101
97
  * @param format - A format function used to format the values.
102
- * @returns A {@link RangeOfProperties | RangeOfProperties<string>} contaning the
103
- * formatted representation of the {@link RangeOf.min | minimum} and {@link RangeOf.max | maximum}
98
+ * @returns A {@link Experimental.RangeOfProperties | RangeOfProperties<string>} containing the
99
+ * formatted representation of the {@link Experimental.RangeOf.min | minimum} and
100
+ * {@link Experimental.RangeOf.max | maximum}
104
101
  * extent of the range, or `undefined` for an extent that is not present.
105
102
  */
106
103
  toFormattedProperties(format: (value: T) => string | undefined): RangeOfProperties<string>;
107
104
  /**
108
105
  * Formats this range using the supplied format function.
109
- * @param format - Format function used to format minimum and maxiumum extent values.
110
- * @param formats - The {@link RangeOfFormats | format strings} used to format the range
111
- * (default {@link DEFAULT_RANGEOF_FORMATS}).
106
+ * @param format - Format function used to format minimum and maximum extent values.
107
+ * @param formats - The {@link Experimental.RangeOfFormats | format strings} used to format the range
108
+ * (default {@link Experimental.DEFAULT_RANGEOF_FORMATS}).
112
109
  * @returns Returns a formatted representation of this range.
113
110
  */
114
111
  format(format: (value: T) => string | undefined, formats?: RangeOfFormats): string | undefined;
115
112
  /**
116
- * Inner compare method can be overriden by a derived class.
113
+ * Inner compare method can be overridden by a derived class.
117
114
  * @param t1 - First value to compare.
118
115
  * @param t2 - Second value to compare.
119
116
  * @returns `'less'` if `t1` is less than `t2`, `'greater'` if `t1` is larger
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rangeOf.d.ts","sourceRoot":"","sources":["../../../src/packlets/experimental/rangeOf.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,MAAM,EAAiB,MAAM,SAAS,CAAC;AAEhD;;;GAGG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;IAI9B;;;;;;;OAOG;IACI,cAAc,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS;IAU1C;;;;;;;OAOG;IACI,qBAAqB,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,GAAG,iBAAiB,CAAC,MAAM,CAAC;IAOjG;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS;IAIrG;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS;CAG/D"}
@@ -0,0 +1,185 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
24
+ return (mod && mod.__esModule) ? mod : { "default": mod };
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.RangeOf = exports.DEFAULT_RANGEOF_FORMATS = void 0;
28
+ const mustache_1 = __importDefault(require("mustache"));
29
+ const base_1 = require("../base");
30
+ /**
31
+ * Default {@link Experimental.RangeOfFormats | formats} to use for both
32
+ * open-ended and complete {@link Experimental.RangeOf | RangeOf<T>}.
33
+ * @public
34
+ */
35
+ exports.DEFAULT_RANGEOF_FORMATS = {
36
+ minOnly: '{{min}}-',
37
+ maxOnly: '-{{max}}',
38
+ minMax: '{{min}}-{{max}}'
39
+ };
40
+ /**
41
+ * Simple implementation of a possibly open-ended range of some comparable
42
+ * type `<T>` with test and formatting.
43
+ * @public
44
+ */
45
+ class RangeOf {
46
+ /**
47
+ * Creates a new {@link Experimental.RangeOf | RangeOf<T>}.
48
+ * @param min - Optional minimum extent of the range.
49
+ * @param max - Optional maximum extent of the range.
50
+ */
51
+ constructor(min, max) {
52
+ if (min !== undefined && max !== undefined && this._compare(min, max) === 'greater') {
53
+ throw new Error(`Inverted range - ${JSON.stringify(min)} must be <= ${JSON.stringify(max)}.`);
54
+ }
55
+ this.min = min;
56
+ this.max = max;
57
+ }
58
+ /**
59
+ * Static constructor for a {@link Experimental.RangeOf | RangeOf<T>}.
60
+ * @param init - {@link Experimental.RangeOfProperties | Range initializer}.
61
+ * @returns A new {@link Experimental.RangeOf | RangeOf<T>}.
62
+ */
63
+ static createRange(init) {
64
+ return (0, base_1.captureResult)(() => new RangeOf(init === null || init === void 0 ? void 0 : init.min, init === null || init === void 0 ? void 0 : init.max));
65
+ }
66
+ /**
67
+ * Gets a formatted description of a {@link Experimental.RangeOfProperties | RangeOfProperties<T>} given an
68
+ * optional set of formats and 'empty' value to use.
69
+ * @param range - The {@link Experimental.RangeOfProperties | RangeOfProperties<T>} to be formatted.
70
+ * @param formats - Optional {@link Experimental.RangeOfFormats | formats} to use. Default is
71
+ * {@link Experimental.DEFAULT_RANGEOF_FORMATS | DEFAULT_RANGEOF_FORMATS}.
72
+ * @param emptyValue - Value which represents unbounded minimum or maximum for this range. Default is `undefined`.
73
+ * @returns A string representation of the range.
74
+ */
75
+ static propertiesToString(range, formats, emptyValue) {
76
+ formats = formats !== null && formats !== void 0 ? formats : exports.DEFAULT_RANGEOF_FORMATS;
77
+ if (range.min !== undefined && range.min !== emptyValue) {
78
+ if (range.max !== undefined && range.max !== emptyValue) {
79
+ return mustache_1.default.render(formats.minMax, range);
80
+ }
81
+ else {
82
+ return mustache_1.default.render(formats.minOnly, range);
83
+ }
84
+ }
85
+ else if (range.max !== undefined && range.max !== emptyValue) {
86
+ return mustache_1.default.render(formats.maxOnly, range);
87
+ }
88
+ return undefined;
89
+ }
90
+ /**
91
+ * Default comparison uses javascript built-in comparison.
92
+ * @param t1 - First value to be compared.
93
+ * @param t2 - Second value to be compared.
94
+ * @returns `'less'` if `t1` is less than `t2`, `'greater'` if `t1` is larger
95
+ * and `'equal'` if `t1` and `t2` are equal.
96
+ * @internal
97
+ */
98
+ static _defaultCompare(t1, t2) {
99
+ if (t1 < t2) {
100
+ return 'less';
101
+ }
102
+ else if (t1 > t2) {
103
+ return 'greater';
104
+ }
105
+ return 'equal';
106
+ }
107
+ /**
108
+ * Checks if a supplied value is within this range.
109
+ * @param t - The value to be tested.
110
+ * @returns `'included'` if `t` falls within the range, `'less'` if `t` falls
111
+ * below the minimum extent of the range and `'greater'` if `t` is above the
112
+ * maximum extent.
113
+ */
114
+ check(t) {
115
+ if (this.min !== undefined && this._compare(t, this.min) === 'less') {
116
+ return 'less';
117
+ }
118
+ if (this.max !== undefined && this._compare(t, this.max) !== 'less') {
119
+ return 'greater';
120
+ }
121
+ return 'included';
122
+ }
123
+ /**
124
+ * Determines if a supplied value is within this range.
125
+ * @param t - The value to be tested.
126
+ * @returns Returns `true` if `t` falls within the range, `false` otherwise.
127
+ */
128
+ includes(t) {
129
+ return this.check(t) === 'included';
130
+ }
131
+ /**
132
+ * Finds the transition value that would bring a supplied value `t` into
133
+ * range.
134
+ * @param t - The value to be tested.
135
+ * @returns The minimum extent of the range if `t` is below the range or
136
+ * the maximum extent of the range if `t` is above the range. Returns
137
+ * `undefined` if `t` already falls within the range.
138
+ */
139
+ findTransition(t) {
140
+ switch (this.check(t)) {
141
+ case 'less':
142
+ return this.min;
143
+ case 'included':
144
+ return this.max;
145
+ }
146
+ return undefined;
147
+ }
148
+ /**
149
+ * Formats the minimum and maximum values of this range.
150
+ * @param format - A format function used to format the values.
151
+ * @returns A {@link Experimental.RangeOfProperties | RangeOfProperties<string>} containing the
152
+ * formatted representation of the {@link Experimental.RangeOf.min | minimum} and
153
+ * {@link Experimental.RangeOf.max | maximum}
154
+ * extent of the range, or `undefined` for an extent that is not present.
155
+ */
156
+ toFormattedProperties(format) {
157
+ return {
158
+ min: this.min !== undefined ? format(this.min) : undefined,
159
+ max: this.max !== undefined ? format(this.max) : undefined
160
+ };
161
+ }
162
+ /**
163
+ * Formats this range using the supplied format function.
164
+ * @param format - Format function used to format minimum and maximum extent values.
165
+ * @param formats - The {@link Experimental.RangeOfFormats | format strings} used to format the range
166
+ * (default {@link Experimental.DEFAULT_RANGEOF_FORMATS}).
167
+ * @returns Returns a formatted representation of this range.
168
+ */
169
+ format(format, formats) {
170
+ return RangeOf.propertiesToString(this.toFormattedProperties(format), formats);
171
+ }
172
+ /**
173
+ * Inner compare method can be overridden by a derived class.
174
+ * @param t1 - First value to compare.
175
+ * @param t2 - Second value to compare.
176
+ * @returns `'less'` if `t1` is less than `t2`, `'greater'` if `t1` is larger
177
+ * and `'equal'` if `t1` and `t2` are equal.
178
+ * @internal
179
+ */
180
+ _compare(t1, t2) {
181
+ return RangeOf._defaultCompare(t1, t2);
182
+ }
183
+ }
184
+ exports.RangeOf = RangeOf;
185
+ //# sourceMappingURL=rangeOf.js.map
@@ -0,0 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AAC,CAAI;QACxB,QAAQ,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YACrB,KAAK,MAAM;gBACT,OAAO,IAAI,CAAC,GAAG,CAAC;YAClB,KAAK,UAAU;gBACb,OAAO,IAAI,CAAC,GAAG,CAAC;SACnB;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;;;OAOG;IACI,qBAAqB,CAAC,MAAwC;QACnE,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;YAC1D,GAAG,EAAE,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;SAC3D,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAwC,EAAE,OAAwB;QAC9E,OAAO,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;IACjF,CAAC;IAED;;;;;;;OAOG;IACO,QAAQ,CAAC,EAAK,EAAE,EAAK;QAC7B,OAAO,OAAO,CAAC,eAAe,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACzC,CAAC;CACF;AA7JD,0BA6JC","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\nimport Mustache from 'mustache';\nimport { Result, captureResult } from '../base';\n\n/**\n * Represents a generic range of some comparable type `<T>`.\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface RangeOfProperties<T> {\n readonly min?: T;\n readonly max?: T;\n}\n\n/**\n * Format strings (in mustache format) to\n * use for both open-ended and complete\n * {@link Experimental.RangeOf | RangeOf<T>}.\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface RangeOfFormats {\n minOnly: string;\n maxOnly: string;\n minMax: string;\n}\n\n/**\n * Default {@link Experimental.RangeOfFormats | formats} to use for both\n * open-ended and complete {@link Experimental.RangeOf | RangeOf<T>}.\n * @public\n */\nexport const DEFAULT_RANGEOF_FORMATS: RangeOfFormats = {\n minOnly: '{{min}}-',\n maxOnly: '-{{max}}',\n minMax: '{{min}}-{{max}}'\n};\n\n/**\n * Simple implementation of a possibly open-ended range of some comparable\n * type `<T>` with test and formatting.\n * @public\n */\nexport class RangeOf<T> implements RangeOfProperties<T> {\n /**\n * Minimum extent of the range.\n */\n public readonly min?: T;\n /**\n * Maximum extent of the range.\n */\n public readonly max?: T;\n\n /**\n * Creates a new {@link Experimental.RangeOf | RangeOf<T>}.\n * @param min - Optional minimum extent of the range.\n * @param max - Optional maximum extent of the range.\n */\n public constructor(min?: T, max?: T) {\n if (min !== undefined && max !== undefined && this._compare(min, max) === 'greater') {\n throw new Error(`Inverted range - ${JSON.stringify(min)} must be <= ${JSON.stringify(max)}.`);\n }\n this.min = min;\n this.max = max;\n }\n\n /**\n * Static constructor for a {@link Experimental.RangeOf | RangeOf<T>}.\n * @param init - {@link Experimental.RangeOfProperties | Range initializer}.\n * @returns A new {@link Experimental.RangeOf | RangeOf<T>}.\n */\n public static createRange<T>(init?: RangeOfProperties<T>): Result<RangeOf<T>> {\n return captureResult(() => new RangeOf<T>(init?.min, init?.max));\n }\n\n /**\n * Gets a formatted description of a {@link Experimental.RangeOfProperties | RangeOfProperties<T>} given an\n * optional set of formats and 'empty' value to use.\n * @param range - The {@link Experimental.RangeOfProperties | RangeOfProperties<T>} to be formatted.\n * @param formats - Optional {@link Experimental.RangeOfFormats | formats} to use. Default is\n * {@link Experimental.DEFAULT_RANGEOF_FORMATS | DEFAULT_RANGEOF_FORMATS}.\n * @param emptyValue - Value which represents unbounded minimum or maximum for this range. Default is `undefined`.\n * @returns A string representation of the range.\n */\n public static propertiesToString<T>(\n range: RangeOfProperties<T>,\n formats?: RangeOfFormats,\n emptyValue?: T\n ): string | undefined {\n formats = formats ?? DEFAULT_RANGEOF_FORMATS;\n if (range.min !== undefined && range.min !== emptyValue) {\n if (range.max !== undefined && range.max !== emptyValue) {\n return Mustache.render(formats.minMax, range);\n } else {\n return Mustache.render(formats.minOnly, range);\n }\n } else if (range.max !== undefined && range.max !== emptyValue) {\n return Mustache.render(formats.maxOnly, range);\n }\n return undefined;\n }\n\n /**\n * Default comparison uses javascript built-in comparison.\n * @param t1 - First value to be compared.\n * @param t2 - Second value to be compared.\n * @returns `'less'` if `t1` is less than `t2`, `'greater'` if `t1` is larger\n * and `'equal'` if `t1` and `t2` are equal.\n * @internal\n */\n protected static _defaultCompare<T>(t1: T, t2: T): 'less' | 'equal' | 'greater' {\n if (t1 < t2) {\n return 'less';\n } else if (t1 > t2) {\n return 'greater';\n }\n return 'equal';\n }\n\n /**\n * Checks if a supplied value is within this range.\n * @param t - The value to be tested.\n * @returns `'included'` if `t` falls within the range, `'less'` if `t` falls\n * below the minimum extent of the range and `'greater'` if `t` is above the\n * maximum extent.\n */\n public check(t: T): 'less' | 'included' | 'greater' {\n if (this.min !== undefined && this._compare(t, this.min) === 'less') {\n return 'less';\n }\n if (this.max !== undefined && this._compare(t, this.max) !== 'less') {\n return 'greater';\n }\n return 'included';\n }\n\n /**\n * Determines if a supplied value is within this range.\n * @param t - The value to be tested.\n * @returns Returns `true` if `t` falls within the range, `false` otherwise.\n */\n public includes(t: T): boolean {\n return this.check(t) === 'included';\n }\n\n /**\n * Finds the transition value that would bring a supplied value `t` into\n * range.\n * @param t - The value to be tested.\n * @returns The minimum extent of the range if `t` is below the range or\n * the maximum extent of the range if `t` is above the range. Returns\n * `undefined` if `t` already falls within the range.\n */\n public findTransition(t: T): T | undefined {\n switch (this.check(t)) {\n case 'less':\n return this.min;\n case 'included':\n return this.max;\n }\n return undefined;\n }\n\n /**\n * Formats the minimum and maximum values of this range.\n * @param format - A format function used to format the values.\n * @returns A {@link Experimental.RangeOfProperties | RangeOfProperties<string>} containing the\n * formatted representation of the {@link Experimental.RangeOf.min | minimum} and\n * {@link Experimental.RangeOf.max | maximum}\n * extent of the range, or `undefined` for an extent that is not present.\n */\n public toFormattedProperties(format: (value: T) => string | undefined): RangeOfProperties<string> {\n return {\n min: this.min !== undefined ? format(this.min) : undefined,\n max: this.max !== undefined ? format(this.max) : undefined\n };\n }\n\n /**\n * Formats this range using the supplied format function.\n * @param format - Format function used to format minimum and maximum extent values.\n * @param formats - The {@link Experimental.RangeOfFormats | format strings} used to format the range\n * (default {@link Experimental.DEFAULT_RANGEOF_FORMATS}).\n * @returns Returns a formatted representation of this range.\n */\n public format(format: (value: T) => string | undefined, formats?: RangeOfFormats): string | undefined {\n return RangeOf.propertiesToString(this.toFormattedProperties(format), formats);\n }\n\n /**\n * Inner compare method can be overridden by a derived class.\n * @param t1 - First value to compare.\n * @param t2 - Second value to compare.\n * @returns `'less'` if `t1` is less than `t2`, `'greater'` if `t1` is larger\n * and `'equal'` if `t1` and `t2` are equal.\n * @internal\n */\n protected _compare(t1: T, t2: T): 'less' | 'equal' | 'greater' {\n return RangeOf._defaultCompare(t1, t2);\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { Result } from './result';
1
+ import { Result } from '../base';
2
2
  /**
3
3
  * Computes an md5 hash from an array of strings. Not secure and not intended to be secure.
4
4
  * @param parts - The strings to be hashed
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../src/packlets/hash/hash.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,MAAM,EAA4C,MAAM,SAAS,CAAC;AAE3E;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAEnD;AAED;;;GAGG;AACH,qBAAa,UAAU;IACrB;;;;;;;;;OASG;IACI,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IA4BjD;;;;;;;OAOG;IACH,SAAS,CAAC,YAAY,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,GAAG,MAAM;IAexD;;;;;;;OAOG;IACH,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE;IAIxF;;;;;OAKG;IACH,SAAS,CAAC,iBAAiB,CACzB,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,GACnF,MAAM,CAAC,MAAM,CAAC;CAwBlB"}
@@ -0,0 +1,168 @@
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
+ // istanbul ignore else
119
+ if (cs2 > cs1) {
120
+ return -1;
121
+ }
122
+ // istanbul ignore next
123
+ return 0;
124
+ }
125
+ /**
126
+ * Normalizes an array of object property entries (e.g. as returned by `Object.entries()`).
127
+ * @remarks
128
+ * Converts property names (entry key) to string and then sorts as string.
129
+ * @param entries - The entries to be normalized.
130
+ * @returns A normalized sorted array of entries.
131
+ * @internal
132
+ */
133
+ _normalizeEntries(entries) {
134
+ return Array.from(entries).sort((e1, e2) => this._compareKeys(e1[0], e2[0]));
135
+ }
136
+ /**
137
+ * Constructs a normalized string representation of some literal value.
138
+ * @param from - The literal value to be normalized.
139
+ * @returns A normalized string representation of the literal.
140
+ * @internal
141
+ */
142
+ _normalizeLiteral(from) {
143
+ switch (typeof from) {
144
+ case 'string':
145
+ return (0, base_1.succeed)(from);
146
+ case 'bigint':
147
+ case 'boolean':
148
+ case 'number':
149
+ case 'symbol':
150
+ case 'undefined':
151
+ return (0, base_1.succeed)(`${typeof from}:[[[${String(from)}]]]`);
152
+ }
153
+ if (from === null) {
154
+ return (0, base_1.succeed)('object:[[[null]]');
155
+ }
156
+ if (from instanceof Date) {
157
+ return (0, base_1.succeed)(`Date:[[[${String(from.valueOf())}]]]`);
158
+ }
159
+ // istanbul ignore else
160
+ if (from instanceof RegExp) {
161
+ return (0, base_1.succeed)(`RegExp:[[[${from.toString()}]]]`);
162
+ }
163
+ // istanbul ignore next
164
+ return (0, base_1.fail)(`cannot normalize ${JSON.stringify(from)}`);
165
+ }
166
+ }
167
+ exports.Normalizer = Normalizer;
168
+ //# sourceMappingURL=hash.js.map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AY,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,uBAAuB;QACvB,IAAI,IAAI,YAAY,MAAM,EAAE;YAC1B,OAAO,IAAA,cAAO,EAAC,aAAa,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;SACnD;QACD,uBAAuB;QACvB,OAAO,IAAA,WAAI,EAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;CACF;AA1GD,gCA0GC","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 // istanbul ignore else\n if (cs2 > cs1) {\n return -1;\n }\n\n // istanbul ignore next\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 // istanbul ignore else\n if (from instanceof RegExp) {\n return succeed(`RegExp:[[[${from.toString()}]]]`);\n }\n // istanbul ignore next\n return fail(`cannot normalize ${JSON.stringify(from)}`);\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './hash';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/hash/index.ts"],"names":[],"mappings":"AAsBA,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,39 @@
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
@@ -0,0 +1 @@
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"]}
@@ -0,0 +1,2 @@
1
+ export * from './recordJarHelpers';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/record-jar/index.ts"],"names":[],"mappings":"AAsBA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,39 @@
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
@@ -0,0 +1 @@
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,4 +1,4 @@
1
- import { Result } from './result';
1
+ import { Result } from '../base';
2
2
  /**
3
3
  * Represents a single record in a JAR file
4
4
  * @public
@@ -0,0 +1 @@
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"}