@fgv/ts-utils 5.1.0-19 → 5.1.0-20

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 (218) hide show
  1. package/dist/index.js.map +1 -0
  2. package/dist/packlets/base/brand.js.map +1 -0
  3. package/dist/packlets/base/index.js.map +1 -0
  4. package/dist/packlets/base/mapResults.js.map +1 -0
  5. package/dist/packlets/base/messageAggregator.js.map +1 -0
  6. package/dist/packlets/base/normalize.js.map +1 -0
  7. package/dist/packlets/base/result.js.map +1 -0
  8. package/dist/packlets/base/utils.js.map +1 -0
  9. package/dist/packlets/collections/aggregatedResultMap.js.map +1 -0
  10. package/dist/packlets/collections/collectible.js.map +1 -0
  11. package/dist/packlets/collections/collector.js.map +1 -0
  12. package/dist/packlets/collections/collectorValidator.js.map +1 -0
  13. package/dist/packlets/collections/common.js.map +1 -0
  14. package/dist/packlets/collections/converters.js.map +1 -0
  15. package/dist/packlets/collections/convertingCollector.js.map +1 -0
  16. package/dist/packlets/collections/convertingCollectorValidator.js.map +1 -0
  17. package/dist/packlets/collections/convertingResultMap.js.map +1 -0
  18. package/dist/packlets/collections/index.js.map +1 -0
  19. package/dist/packlets/collections/keyValueConverters.js.map +1 -0
  20. package/dist/packlets/collections/readOnlyConvertingResultMap.js.map +1 -0
  21. package/dist/packlets/collections/readonlyResultMap.js.map +1 -0
  22. package/dist/packlets/collections/resultMap.js.map +1 -0
  23. package/dist/packlets/collections/resultMapValidator.js.map +1 -0
  24. package/dist/packlets/collections/utils.js.map +1 -0
  25. package/dist/packlets/collections/validatingCollector.js.map +1 -0
  26. package/dist/packlets/collections/validatingConvertingCollector.js.map +1 -0
  27. package/dist/packlets/collections/validatingConvertingResultMap.js.map +1 -0
  28. package/dist/packlets/collections/validatingResultMap.js.map +1 -0
  29. package/dist/packlets/conversion/advancedConverters.js.map +1 -0
  30. package/dist/packlets/conversion/baseConverter.js.map +1 -0
  31. package/dist/packlets/conversion/basicConverters.js.map +1 -0
  32. package/dist/packlets/conversion/converter.js.map +1 -0
  33. package/dist/packlets/conversion/converters.js.map +1 -0
  34. package/dist/packlets/conversion/defaultingConverter.js.map +1 -0
  35. package/dist/packlets/conversion/index.js.map +1 -0
  36. package/dist/packlets/conversion/objectConverter.js.map +1 -0
  37. package/dist/packlets/conversion/stringConverter.js.map +1 -0
  38. package/dist/packlets/hash/crcNormalizer.js.map +1 -0
  39. package/dist/packlets/hash/hashingNormalizer.js.map +1 -0
  40. package/dist/packlets/hash/index.js.map +1 -0
  41. package/dist/packlets/logging/bootLogger.js.map +1 -0
  42. package/dist/packlets/logging/index.js.map +1 -0
  43. package/dist/packlets/logging/logReporter.js.map +1 -0
  44. package/dist/packlets/logging/logger.js.map +1 -0
  45. package/dist/packlets/validation/array.js.map +1 -0
  46. package/dist/packlets/validation/boolean.js.map +1 -0
  47. package/dist/packlets/validation/classes.js.map +1 -0
  48. package/dist/packlets/validation/common.js.map +1 -0
  49. package/dist/packlets/validation/compositeId.js.map +1 -0
  50. package/dist/packlets/validation/field.js.map +1 -0
  51. package/dist/packlets/validation/genericValidator.js.map +1 -0
  52. package/dist/packlets/validation/index.js.map +1 -0
  53. package/dist/packlets/validation/number.js.map +1 -0
  54. package/dist/packlets/validation/object.js.map +1 -0
  55. package/dist/packlets/validation/oneOf.js.map +1 -0
  56. package/dist/packlets/validation/string.js.map +1 -0
  57. package/dist/packlets/validation/traits.js.map +1 -0
  58. package/dist/packlets/validation/typeGuard.js.map +1 -0
  59. package/dist/packlets/validation/validator.js.map +1 -0
  60. package/dist/packlets/validation/validatorBase.js.map +1 -0
  61. package/dist/packlets/validation/validators.js.map +1 -0
  62. package/lib/index.d.ts.map +1 -0
  63. package/lib/index.js.map +1 -0
  64. package/lib/packlets/base/brand.d.ts.map +1 -0
  65. package/lib/packlets/base/brand.js.map +1 -0
  66. package/lib/packlets/base/index.d.ts.map +1 -0
  67. package/lib/packlets/base/index.js.map +1 -0
  68. package/lib/packlets/base/mapResults.d.ts.map +1 -0
  69. package/lib/packlets/base/mapResults.js.map +1 -0
  70. package/lib/packlets/base/messageAggregator.d.ts.map +1 -0
  71. package/lib/packlets/base/messageAggregator.js.map +1 -0
  72. package/lib/packlets/base/normalize.d.ts.map +1 -0
  73. package/lib/packlets/base/normalize.js.map +1 -0
  74. package/lib/packlets/base/result.d.ts.map +1 -0
  75. package/lib/packlets/base/result.js.map +1 -0
  76. package/lib/packlets/base/utils.d.ts.map +1 -0
  77. package/lib/packlets/base/utils.js.map +1 -0
  78. package/lib/packlets/collections/aggregatedResultMap.d.ts.map +1 -0
  79. package/lib/packlets/collections/aggregatedResultMap.js.map +1 -0
  80. package/lib/packlets/collections/collectible.d.ts.map +1 -0
  81. package/lib/packlets/collections/collectible.js.map +1 -0
  82. package/lib/packlets/collections/collector.d.ts.map +1 -0
  83. package/lib/packlets/collections/collector.js.map +1 -0
  84. package/lib/packlets/collections/collectorValidator.d.ts.map +1 -0
  85. package/lib/packlets/collections/collectorValidator.js.map +1 -0
  86. package/lib/packlets/collections/common.d.ts.map +1 -0
  87. package/lib/packlets/collections/common.js.map +1 -0
  88. package/lib/packlets/collections/converters.d.ts.map +1 -0
  89. package/lib/packlets/collections/converters.js.map +1 -0
  90. package/lib/packlets/collections/convertingCollector.d.ts.map +1 -0
  91. package/lib/packlets/collections/convertingCollector.js.map +1 -0
  92. package/lib/packlets/collections/convertingCollectorValidator.d.ts.map +1 -0
  93. package/lib/packlets/collections/convertingCollectorValidator.js.map +1 -0
  94. package/lib/packlets/collections/convertingResultMap.d.ts.map +1 -0
  95. package/lib/packlets/collections/convertingResultMap.js.map +1 -0
  96. package/lib/packlets/collections/index.d.ts.map +1 -0
  97. package/lib/packlets/collections/index.js.map +1 -0
  98. package/lib/packlets/collections/keyValueConverters.d.ts.map +1 -0
  99. package/lib/packlets/collections/keyValueConverters.js.map +1 -0
  100. package/lib/packlets/collections/readOnlyConvertingResultMap.d.ts.map +1 -0
  101. package/lib/packlets/collections/readOnlyConvertingResultMap.js.map +1 -0
  102. package/lib/packlets/collections/readonlyResultMap.d.ts.map +1 -0
  103. package/lib/packlets/collections/readonlyResultMap.js.map +1 -0
  104. package/lib/packlets/collections/resultMap.d.ts.map +1 -0
  105. package/lib/packlets/collections/resultMap.js.map +1 -0
  106. package/lib/packlets/collections/resultMapValidator.d.ts.map +1 -0
  107. package/lib/packlets/collections/resultMapValidator.js.map +1 -0
  108. package/lib/packlets/collections/utils.d.ts.map +1 -0
  109. package/lib/packlets/collections/utils.js.map +1 -0
  110. package/lib/packlets/collections/validatingCollector.d.ts.map +1 -0
  111. package/lib/packlets/collections/validatingCollector.js.map +1 -0
  112. package/lib/packlets/collections/validatingConvertingCollector.d.ts.map +1 -0
  113. package/lib/packlets/collections/validatingConvertingCollector.js.map +1 -0
  114. package/lib/packlets/collections/validatingConvertingResultMap.d.ts.map +1 -0
  115. package/lib/packlets/collections/validatingConvertingResultMap.js.map +1 -0
  116. package/lib/packlets/collections/validatingResultMap.d.ts.map +1 -0
  117. package/lib/packlets/collections/validatingResultMap.js.map +1 -0
  118. package/lib/packlets/conversion/advancedConverters.d.ts.map +1 -0
  119. package/lib/packlets/conversion/advancedConverters.js.map +1 -0
  120. package/lib/packlets/conversion/baseConverter.d.ts.map +1 -0
  121. package/lib/packlets/conversion/baseConverter.js.map +1 -0
  122. package/lib/packlets/conversion/basicConverters.d.ts.map +1 -0
  123. package/lib/packlets/conversion/basicConverters.js.map +1 -0
  124. package/lib/packlets/conversion/converter.d.ts.map +1 -0
  125. package/lib/packlets/conversion/converter.js.map +1 -0
  126. package/lib/packlets/conversion/converters.d.ts.map +1 -0
  127. package/lib/packlets/conversion/converters.js.map +1 -0
  128. package/lib/packlets/conversion/defaultingConverter.d.ts.map +1 -0
  129. package/lib/packlets/conversion/defaultingConverter.js.map +1 -0
  130. package/lib/packlets/conversion/index.d.ts.map +1 -0
  131. package/lib/packlets/conversion/index.js.map +1 -0
  132. package/lib/packlets/conversion/objectConverter.d.ts.map +1 -0
  133. package/lib/packlets/conversion/objectConverter.js.map +1 -0
  134. package/lib/packlets/conversion/stringConverter.d.ts.map +1 -0
  135. package/lib/packlets/conversion/stringConverter.js.map +1 -0
  136. package/lib/packlets/hash/crcNormalizer.d.ts.map +1 -0
  137. package/lib/packlets/hash/crcNormalizer.js.map +1 -0
  138. package/lib/packlets/hash/hashingNormalizer.d.ts.map +1 -0
  139. package/lib/packlets/hash/hashingNormalizer.js.map +1 -0
  140. package/lib/packlets/hash/index.d.ts.map +1 -0
  141. package/lib/packlets/hash/index.js.map +1 -0
  142. package/lib/packlets/logging/bootLogger.d.ts.map +1 -0
  143. package/lib/packlets/logging/bootLogger.js.map +1 -0
  144. package/lib/packlets/logging/index.d.ts.map +1 -0
  145. package/lib/packlets/logging/index.js.map +1 -0
  146. package/lib/packlets/logging/logReporter.d.ts.map +1 -0
  147. package/lib/packlets/logging/logReporter.js.map +1 -0
  148. package/lib/packlets/logging/logger.d.ts.map +1 -0
  149. package/lib/packlets/logging/logger.js.map +1 -0
  150. package/lib/packlets/validation/array.d.ts.map +1 -0
  151. package/lib/packlets/validation/array.js.map +1 -0
  152. package/lib/packlets/validation/boolean.d.ts.map +1 -0
  153. package/lib/packlets/validation/boolean.js.map +1 -0
  154. package/lib/packlets/validation/classes.d.ts.map +1 -0
  155. package/lib/packlets/validation/classes.js.map +1 -0
  156. package/lib/packlets/validation/common.d.ts.map +1 -0
  157. package/lib/packlets/validation/common.js.map +1 -0
  158. package/lib/packlets/validation/compositeId.d.ts.map +1 -0
  159. package/lib/packlets/validation/compositeId.js.map +1 -0
  160. package/lib/packlets/validation/field.d.ts.map +1 -0
  161. package/lib/packlets/validation/field.js.map +1 -0
  162. package/lib/packlets/validation/genericValidator.d.ts.map +1 -0
  163. package/lib/packlets/validation/genericValidator.js.map +1 -0
  164. package/lib/packlets/validation/index.d.ts.map +1 -0
  165. package/lib/packlets/validation/index.js.map +1 -0
  166. package/lib/packlets/validation/number.d.ts.map +1 -0
  167. package/lib/packlets/validation/number.js.map +1 -0
  168. package/lib/packlets/validation/object.d.ts.map +1 -0
  169. package/lib/packlets/validation/object.js.map +1 -0
  170. package/lib/packlets/validation/oneOf.d.ts.map +1 -0
  171. package/lib/packlets/validation/oneOf.js.map +1 -0
  172. package/lib/packlets/validation/string.d.ts.map +1 -0
  173. package/lib/packlets/validation/string.js.map +1 -0
  174. package/lib/packlets/validation/traits.d.ts.map +1 -0
  175. package/lib/packlets/validation/traits.js.map +1 -0
  176. package/lib/packlets/validation/typeGuard.d.ts.map +1 -0
  177. package/lib/packlets/validation/typeGuard.js.map +1 -0
  178. package/lib/packlets/validation/validator.d.ts.map +1 -0
  179. package/lib/packlets/validation/validator.js.map +1 -0
  180. package/lib/packlets/validation/validatorBase.d.ts.map +1 -0
  181. package/lib/packlets/validation/validatorBase.js.map +1 -0
  182. package/lib/packlets/validation/validators.d.ts.map +1 -0
  183. package/lib/packlets/validation/validators.js.map +1 -0
  184. package/package.json +3 -3
  185. package/dist/test/helpers/jest/helpers/fsHelpers.js +0 -139
  186. package/dist/test/helpers/jest/helpers/index.js +0 -2
  187. package/dist/test/helpers/jest/index.js +0 -17
  188. package/dist/test/helpers/jest/matchers/index.js +0 -14
  189. package/dist/test/helpers/jest/matchers/toFail/index.js +0 -23
  190. package/dist/test/helpers/jest/matchers/toFail/predicate.js +0 -5
  191. package/dist/test/helpers/jest/matchers/toFailTest/index.js +0 -28
  192. package/dist/test/helpers/jest/matchers/toFailTest/predicate.js +0 -8
  193. package/dist/test/helpers/jest/matchers/toFailTestAndMatchSnapshot/index.js +0 -24
  194. package/dist/test/helpers/jest/matchers/toFailTestAndMatchSnapshot/predicate.js +0 -11
  195. package/dist/test/helpers/jest/matchers/toFailTestWith/index.js +0 -29
  196. package/dist/test/helpers/jest/matchers/toFailTestWith/predicate.js +0 -26
  197. package/dist/test/helpers/jest/matchers/toFailWith/index.js +0 -27
  198. package/dist/test/helpers/jest/matchers/toFailWith/predicate.js +0 -16
  199. package/dist/test/helpers/jest/matchers/toFailWithDetail/index.js +0 -27
  200. package/dist/test/helpers/jest/matchers/toFailWithDetail/predicate.js +0 -22
  201. package/dist/test/helpers/jest/matchers/toSucceed/index.js +0 -23
  202. package/dist/test/helpers/jest/matchers/toSucceed/predicate.js +0 -5
  203. package/dist/test/helpers/jest/matchers/toSucceedAndMatchInlineSnapshot/index.js +0 -24
  204. package/dist/test/helpers/jest/matchers/toSucceedAndMatchSnapshot/index.js +0 -24
  205. package/dist/test/helpers/jest/matchers/toSucceedAndSatisfy/index.js +0 -53
  206. package/dist/test/helpers/jest/matchers/toSucceedAndSatisfy/predicate.js +0 -17
  207. package/dist/test/helpers/jest/matchers/toSucceedWith/index.js +0 -27
  208. package/dist/test/helpers/jest/matchers/toSucceedWith/predicate.js +0 -12
  209. package/dist/test/helpers/jest/matchers/toSucceedWithDetail/index.js +0 -27
  210. package/dist/test/helpers/jest/matchers/toSucceedWithDetail/predicate.js +0 -17
  211. package/dist/test/helpers/jest/resolvers/cli.js +0 -10
  212. package/dist/test/helpers/jest/resolvers/ide.js +0 -10
  213. package/dist/test/helpers/jest/ts-utils.js +0 -2
  214. package/dist/test/helpers/jest/types/index.js +0 -3
  215. package/dist/test/helpers/jest/utils/matcherHelpers.js +0 -47
  216. package/dist/test/helpers/jest/utils/snapshotResolver.js +0 -11
  217. package/dist/test/unit/collections/helpers.js +0 -106
  218. package/dist/test/unit/hashTextEncodeCompat.js +0 -23
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oneOf.js","sourceRoot":"","sources":["../../../src/packlets/validation/oneOf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAW,IAAI,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,aAAa,EAAkC,MAAM,iBAAiB,CAAC;AAYhF;;;;GAIG;AACH,MAAM,OAAO,cAAgC,SAAQ,aAAoB;IASvE;;;;OAIG;IACH,YAAmB,MAA8C;;QAC/D,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,EAAE,CAAC;IACtC,CAAC;IAED;;;;;;;;OAQG;IACO,SAAS,CAAI,IAAa,EAAE,OAAY,EAAE,IAAuB;QACzE,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC;QACrE,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,IAAI,iCAAiC,CAAC,CAAC;IAC/D,CAAC;CACF","sourcesContent":["/*\n * Copyright (c) 2024 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 { Failure, fail } from '../base';\nimport { Validator, ValidatorOptions } from './validator';\nimport { ValidatorBase, ValidatorBaseConstructorParams } from './validatorBase';\n\n/**\n * Parameters used to construct a {@link Validation.Classes.OneOfValidator | OneOfValidator}.\n * @public\n */\n\nexport interface OneOfValidatorConstructorParams<T, TC = unknown>\n extends ValidatorBaseConstructorParams<T, TC> {\n validators: Validator<T, TC>[];\n}\n\n/**\n * An in-place {@link Validator | Validator} which validates that a supplied\n * value matches one of several other validators.\n * @public\n */\nexport class OneOfValidator<T, TC = unknown> extends ValidatorBase<T, TC> {\n /**\n * {@link Validation.ValidatorOptions | Options} which apply to this\n * validator.\n */\n public readonly options: ValidatorOptions<TC>;\n\n protected readonly _validators: Validator<T, TC>[];\n\n /**\n * Constructs a new {@link Validation.Classes.OneOfValidator | OneOfValidator}.\n * @param params - Optional {@link Validation.Classes.OneOfValidatorConstructorParams | init params} for the\n * new {@link Validation.Classes.OneOfValidator | OneOfValidator}.\n */\n public constructor(params: OneOfValidatorConstructorParams<T, TC>) {\n super(params);\n this._validators = params.validators;\n this.options = params.options ?? {};\n }\n\n /**\n * Static method which validates that a supplied `unknown` value matches at least one\n * of the configured validators.\n * @param from - The `unknown` value to be tested.\n * @param context - Optional validation context will be propagated to element validator.\n * @param self - Optional self-reference for recursive validation.\n * @returns Returns `true` if `from` is an `array` of valid elements, or\n * {@link Failure} with an error message if not.\n */\n protected _validate<T>(from: unknown, context?: TC, self?: Validator<T, TC>): boolean | Failure<T> {\n const found = this._validators.some((v) => v.validate(from).success);\n if (found) {\n return true;\n }\n return fail(`value \"${from}\" does not match any validator.`);\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/packlets/validation/string.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAW,IAAI,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAqC,MAAM,oBAAoB,CAAC;AAWzF;;;GAGG;AACH,MAAM,OAAO,eAAyD,SAAQ,gBAAuB;IACnG;;;;OAIG;IACH,YAAmB,MAAgD;QACjE,oBAAoB;QACpB,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC;QACtB,KAAK,iBACH,SAAS,EAAE,eAAe,CAAC,cAAc,IACtC,MAAM,EACT,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,cAAc,CAAmB,IAAa;QAC1D,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAI,IAAI,IAAI,iBAAiB,CAAC,CAAC;IAC5C,CAAC;CACF","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 { Failure, fail } from '../base';\nimport { GenericValidator, GenericValidatorConstructorParams } from './genericValidator';\n\n/**\n * Parameters used to construct a {@link Validation.Classes.StringValidator | StringValidator}.\n * @public\n */\nexport type StringValidatorConstructorParams<\n T extends string = string,\n TC = unknown\n> = GenericValidatorConstructorParams<T, TC>;\n\n/**\n * An in-place {@link Validation.Validator | Validator} for `string` values.\n * @public\n */\nexport class StringValidator<T extends string = string, TC = unknown> extends GenericValidator<T, TC> {\n /**\n * Constructs a new {@link Validation.Classes.StringValidator | StringValidator}.\n * @param params - Optional {@link Validation.Classes.StringValidatorConstructorParams | init params}\n * for the new {@link Validation.Classes.StringValidator | StringValidator}.\n */\n public constructor(params?: StringValidatorConstructorParams<T, TC>) {\n /* c8 ignore next */\n params = params ?? {};\n super({\n validator: StringValidator.validateString,\n ...params\n });\n }\n\n /**\n * Static method which validates that a supplied `unknown` value is a `string`.\n * @param from - The `unknown` value to be tested.\n * @returns Returns `true` if `from` is a `string`, or {@link Failure} with an error\n * message if not.\n */\n public static validateString<T extends string>(from: unknown): boolean | Failure<T> {\n if (typeof from === 'string') {\n return true;\n }\n return fail<T>(`\"${from}\": not a string`);\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traits.js","sourceRoot":"","sources":["../../../src/packlets/validation/traits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA4CH;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAyB;IAC1D,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,EAAE;CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,eAAe;IAgB1B;;;;;;;OAOG;IACH,YAAmB,IAAoC,EAAE,IAA2B;;QAClF,sBAAsB;QACtB,IAAI,CAAC,UAAU,GAAG,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,mCAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,mCAAI,sBAAsB,CAAC,UAAU,CAAC;QAC5F,IAAI,CAAC,KAAK,GAAG,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,mCAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,mCAAI,sBAAsB,CAAC,KAAK,CAAC;QACxE,IAAI,CAAC,WAAW,GAAG;YACjB,GAAG,sBAAsB,CAAC,WAAW;YACrC,sBAAsB;YACtB,GAAG,CAAC,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,mCAAI,EAAE,CAAC;YAC5B,GAAG,CAAC,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,mCAAI,EAAE,CAAC;SAC7B,CAAC;IACJ,CAAC;CACF","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\n/**\n * A {@link Validation.ConstraintTrait | ConstraintTrait} indicating that\n * a {@link Validation.Constraint | Constraint<T>} function provides an\n * additional constraint implementation.\n * @public\n */\n\nexport interface FunctionConstraintTrait {\n type: 'function';\n}\n\n/**\n * Union of all supported constraint traits.\n * @public\n */\nexport type ConstraintTrait = FunctionConstraintTrait;\n\n/**\n * Interface describing the supported validator traits.\n * @public\n */\n\nexport interface ValidatorTraitValues {\n /**\n * Indicates whether the validator accepts `undefined` as\n * a valid value.\n */\n readonly isOptional: boolean;\n\n /**\n * If present, indicates that the result will be branded\n * with the corresponding brand.\n */\n readonly brand?: string;\n\n /**\n * Zero or more additional {@link Validation.ConstraintTrait | ConstraintTrait}s\n * describing additional constraints applied by this {@link Validation.Validator | Validator}.\n */\n readonly constraints: ConstraintTrait[];\n}\n\n/**\n * Default {@link Validation.ValidatorTraitValues | validation traits}.\n * @public\n */\nexport const defaultValidatorTraits: ValidatorTraitValues = {\n isOptional: false,\n constraints: []\n};\n\n/**\n * Generic implementation of {@link Validation.ValidatorTraitValues | ValidatorTraitValues}.\n * @public\n */\nexport class ValidatorTraits implements ValidatorTraitValues {\n /**\n * {@inheritDoc Validation.ValidatorTraitValues.isOptional}\n */\n public readonly isOptional: boolean;\n\n /**\n * {@inheritDoc Validation.ValidatorTraitValues.brand}\n */\n public readonly brand?: string;\n\n /**\n * {@inheritDoc Validation.ValidatorTraitValues.constraints}\n */\n public readonly constraints: ConstraintTrait[];\n\n /**\n * Constructs a new {@link Validation.ValidatorTraits | ValidatorTraits} optionally\n * initialized with the supplied base and initial values.\n * @remarks\n * Initial values take priority over base values, which fall back to the global default values.\n * @param init - Partial initial values to be set in the resulting {@link Validation.Validator | Validator}.\n * @param base - Base values to be used when no initial values are present.\n */\n public constructor(init?: Partial<ValidatorTraitValues>, base?: ValidatorTraitValues) {\n /* c8 ignore next 2 */\n this.isOptional = init?.isOptional ?? base?.isOptional ?? defaultValidatorTraits.isOptional;\n this.brand = init?.brand ?? base?.brand ?? defaultValidatorTraits.brand;\n this.constraints = [\n ...defaultValidatorTraits.constraints,\n /* c8 ignore next 1 */\n ...(base?.constraints ?? []),\n ...(init?.constraints ?? [])\n ];\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typeGuard.js","sourceRoot":"","sources":["../../../src/packlets/validation/typeGuard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAW,IAAI,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,aAAa,EAAkC,MAAM,iBAAiB,CAAC;AAgBhF;;;;GAIG;AACH,MAAM,OAAO,kBAAoC,SAAQ,aAAoB;IAU3E;;;;OAIG;IACH,YAAmB,MAAkD;;QACnE,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,EAAE,CAAC;IACtC,CAAC;IAED;;;;;;;;;OASG;IACO,SAAS,CAAC,IAAa,EAAE,OAAY,EAAE,IAAuB;QACtE,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvE,CAAC;CACF","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 { Failure, fail } from '../base';\nimport { ValidatorBase, ValidatorBaseConstructorParams } from './validatorBase';\n\nimport { TypeGuardWithContext } from './common';\nimport { Validator, ValidatorOptions } from './validator';\n\n/**\n * Parameters used to construct a {@link Validation.Classes.TypeGuardValidator}.\n * @public\n */\n\nexport interface TypeGuardValidatorConstructorParams<T, TC = unknown>\n extends ValidatorBaseConstructorParams<T, TC> {\n guard: TypeGuardWithContext<T, TC>;\n description: string;\n}\n\n/**\n * An in-place {@link Validation.Validator | Validator} that can be instantiated using a type guard\n * function.\n * @public\n */\nexport class TypeGuardValidator<T, TC = unknown> extends ValidatorBase<T, TC> {\n /**\n * {@link Validation.ValidatorOptions | Options} which apply to this\n * validator.\n */\n public readonly options: ValidatorOptions<TC>;\n public readonly description: string;\n\n protected readonly _guard: TypeGuardWithContext<T, TC>;\n\n /**\n * Constructs a new {@link Validation.Classes.TypeGuardValidator | TypeGuardValidator}.\n * @param params - Optional {@link Validation.Classes.TypeGuardValidatorConstructorParams | init params} for the\n * new {@link Validation.Classes.TypeGuardValidator | TypeGuardValidator}.\n */\n public constructor(params: TypeGuardValidatorConstructorParams<T, TC>) {\n super(params);\n this.description = params.description;\n this._guard = params.guard;\n this.options = params.options ?? {};\n }\n\n /**\n * Static method which validates that a supplied `unknown` value matches the supplied\n * type guard, returning a `Failure<T>` containing more information about a failure.\n * @param from - Value to be converted.\n * @param context - Optional validation context.\n * @param self - Optional self-reference for recursive validation.\n * @returns `true` if `from` is valid, {@link Failure | Failure<T>}\n * with an error message if `from` is invalid.\n * @internal\n */\n protected _validate(from: unknown, context?: TC, self?: Validator<T, TC>): boolean | Failure<T> {\n if (this._guard(from, context)) {\n return true;\n }\n return fail(`invalid ${this.description} (${JSON.stringify(from)})`);\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.js","sourceRoot":"","sources":["../../../src/packlets/validation/validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG","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 { Brand, Failure, Result } from '../base';\nimport { ConstraintTrait, ValidatorTraits } from './traits';\n\n/**\n * Type for a validation function, which validates that a supplied `unknown`\n * value is a valid value of type `<T>`, possibly as influenced by\n * an optionally-supplied validation context of type `<TC>`.\n * @public\n */\nexport type ValidatorFunc<T, TC> = (\n from: unknown,\n context?: TC,\n self?: Validator<T, TC>\n) => boolean | Failure<T>;\n\n/**\n * Options that apply to any {@link Validation.Validator | Validator}.\n * @public\n */\n\nexport interface ValidatorOptions<TC> {\n defaultContext?: TC;\n}\n\n/**\n * A {@link Validation.Constraint | Constraint<T>} function returns\n * `true` if the supplied value meets the constraint. Can return\n * {@link Failure} with an error message or simply return `false`\n * for a default message.\n * @public\n */\nexport type Constraint<T> = (val: T) => boolean | Failure<T>;\n\n/**\n * Formats an incoming error message and value that failed validation.\n * @param val - The value that failed validation.\n * @param message - The default error message, if any.\n * @param context - Optional validation context.\n * @returns The formatted error message.\n * @public\n */\nexport type ValidationErrorFormatter<TC = unknown> = (val: unknown, message?: string, context?: TC) => string;\n\n/**\n * In-place validation that a supplied unknown matches some\n * required characteristics (type, values, etc).\n * @public\n */\n\nexport interface Validator<T, TC = unknown> {\n /**\n * {@link Validation.ValidatorTraits | Traits} describing this validation.\n */\n readonly traits: ValidatorTraits;\n\n /**\n * Indicates whether this element is explicitly optional.\n */\n readonly isOptional: boolean;\n\n /**\n * The brand for a branded type.\n */\n readonly brand: string | undefined;\n\n /**\n * Tests to see if a supplied `unknown` value matches this validation. All\n * validate calls are guaranteed to return the entity passed in on Success.\n * @param from - The `unknown` value to be tested.\n * @param context - Optional validation context.\n * @returns {@link Success} with the typed, validated value,\n * or {@link Failure} with an error message if validation fails.\n */\n validate(from: unknown, context?: TC): Result<T>;\n\n /**\n * Tests to see if a supplied 'unknown' value matches this validation. In\n * contrast to {@link Validator.validate | validate}, makes no guarantees\n * about the identity of the returned value.\n * @param from - The `unknown` value to be tested.\n * @param context - Optional validation context.\n * @returns {@link Success} with the typed, conversion value,\n * or {@link Failure} with an error message if conversion fails.\n */\n convert(from: unknown, context?: TC): Result<T>;\n\n /**\n * Tests to see if a supplied `unknown` value matches this\n * validation. Accepts `undefined`.\n * @param from - The `unknown` value to be tested.\n * @param context - Optional validation context.\n * @returns {@link Success} with the typed, validated value,\n * or {@link Failure} with an error message if validation fails.\n */\n validateOptional(from: unknown, context?: TC): Result<T | undefined>;\n\n /**\n * Non-throwing type guard\n * @param from - The value to be tested.\n * @param context - Optional validation context.\n */\n guard(from: unknown, context?: TC): from is T;\n\n /**\n * Creates an {@link Validation.Validator | in-place validator}\n * which is derived from this one but which also matches `undefined`.\n */\n optional(): Validator<T | undefined, TC>;\n\n /**\n * Creates an {@link Validation.Validator | in-place validator}\n * which is derived from this one but which applies additional constraints.\n * @param constraint - the constraint to be applied\n * @param trait - As optional {@link Validation.ConstraintTrait | ConstraintTrait}\n * to be applied to the resulting {@link Validation.Validator | Validator}.\n * @returns A new {@link Validation.Validator | Validator}.\n */\n withConstraint(constraint: Constraint<T>, trait?: ConstraintTrait): Validator<T, TC>;\n\n /**\n * Creates a new {@link Validation.Validator | in-place validator} which\n * is derived from this one but which matches a branded result.\n * @param brand - The brand to be applied.\n */\n withBrand<B extends string>(brand: B): Validator<Brand<T, B>, TC>;\n\n /**\n * Creates a new {@link Validation.Validator | in-place validator} which\n * is derived from this one but which returns an error message supplied\n * by the provided formatter if an error occurs.\n * @param formatter - The error message formatter to be applied.\n * @returns A new {@link Validation.Validator | Validator}.\n */\n withFormattedError(formatter: ValidationErrorFormatter<TC>): Validator<T, TC>;\n\n /**\n * Chains this validator with another of the same type, to be attempted if this\n * validator fails.\n * @param other - The other {@link Validation.Validator | Validator} to be attempted\n * if this one fails.\n */\n or(other: Validator<T, TC>): Validator<T, TC>;\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validatorBase.js","sourceRoot":"","sources":["../../../src/packlets/validation/validatorBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,gBAAgB,EAAqC,MAAM,oBAAoB,CAAC;AAazF;;;GAGG;AACH,MAAM,OAAgB,aAA+B,SAAQ,gBAAuB;IAClF;;;;OAIG;IACH,YAAsB,MAAsD;QAC1E,KAAK,iBACH,SAAS,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,IACpE,MAAM,EACT,CAAC;IACL,CAAC;CAYF","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 { GenericValidator, GenericValidatorConstructorParams } from './genericValidator';\nimport { Validator } from './validator';\n\nimport { Failure } from '../base';\n\n/**\n * @internal\n */\nexport type ValidatorBaseConstructorParams<T, TC> = Omit<\n GenericValidatorConstructorParams<T, TC>,\n 'validator'\n>;\n\n/**\n * Abstract base helper class for specific validator implementations\n * @internal\n */\nexport abstract class ValidatorBase<T, TC = unknown> extends GenericValidator<T, TC> {\n /**\n * Inner constructor\n * @param params - Initialization params.\n * @internal\n */\n protected constructor(params: Partial<ValidatorBaseConstructorParams<T, TC>>) {\n super({\n validator: (from, context, self) => this._validate(from, context, self),\n ...params\n });\n }\n\n /**\n * Abstract validation method to me implemented by derived classes.\n * @param from - Value to be converted.\n * @param context - Optional validation context.\n * @param self - Optional self-reference for recursive validation.\n * @returns `true` if `from` is valid, {@link Failure | Failure<T>}\n * with an error message if `from` is invalid.\n * @internal\n */\n protected abstract _validate(from: unknown, context?: TC, self?: Validator<T, TC>): boolean | Failure<T>;\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../src/packlets/validation/validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAW,IAAI,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,cAAc,EAAmC,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAyC,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAmB,eAAe,EAAoC,MAAM,UAAU,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAuC,MAAM,aAAa,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAmC,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAsB,IAAI,eAAe,EAAE,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAsB,IAAI,eAAe,EAAE,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAuB,IAAI,gBAAgB,EAAE,CAAC;AAElE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,MAAM,CACpB,MAA8B,EAC9B,MAAgE;IAEhE,OAAO,IAAI,eAAe,iBAAG,MAAM,IAAK,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,EAAG,CAAC;AAC5D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CACrB,eAAiC,EACjC,MAAwE;IAExE,OA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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 { Failure, fail, isKeyOf, MessageAggregator } from '../base';\nimport { ArrayValidator, ArrayValidatorConstructorParams } from './array';\nimport { CompositeIdValidator, CompositeIdValidatorConstructorParams } from './compositeId';\nimport { FieldValidators, ObjectValidator, ObjectValidatorConstructorParams } from './object';\nimport { TypeGuardValidator, TypeGuardValidatorConstructorParams } from './typeGuard';\n\nimport { BooleanValidator } from './boolean';\nimport { TypeGuardWithContext } from './common';\nimport { GenericValidator } from './genericValidator';\nimport { NumberValidator } from './number';\nimport { OneOfValidator, OneOfValidatorConstructorParams } from './oneOf';\nimport { StringValidator } from './string';\nimport { Validator, ValidatorFunc } from './validator';\n\n/**\n * A {@link Validation.Classes.StringValidator | StringValidator} which validates a string in place.\n * @public\n */\nexport const string: Validator<string> = new StringValidator();\n\n/**\n * A {@link Validation.Classes.NumberValidator | NumberValidator} which validates a number in place.\n * @public\n */\nexport const number: Validator<number> = new NumberValidator();\n\n/**\n * A {@link Validation.Classes.BooleanValidator | BooleanValidator} which validates a boolean in place.\n * @public\n */\nexport const boolean: Validator<boolean> = new BooleanValidator();\n\n/**\n * Helper function to create a {@link Validation.Classes.ObjectValidator | ObjectValidator} which validates\n * an object in place.\n * @param fields - A {@link Validation.Classes.FieldValidators | field validator definition}\n * describing the validations to be applied.\n * @param params - Optional {@link Validation.Classes.ObjectValidatorConstructorParams | parameters}\n * to refine the behavior of the resulting {@link Validation.Validator | validator}.\n * @returns A new {@link Validation.Validator | Validator} which validates the desired\n * object in place.\n * @public\n */\nexport function object<T, TC = unknown>(\n fields: FieldValidators<T, TC>,\n params?: Omit<ObjectValidatorConstructorParams<T, TC>, 'fields'>\n): ObjectValidator<T, TC> {\n return new ObjectValidator({ fields, ...(params ?? {}) });\n}\n\n/**\n * Helper function to create a {@link Validation.Classes.ArrayValidator | ArrayValidator} which\n * validates an array in place.\n * @param validateElement - A {@link Validation.Validator | validator} which validates each element.\n * @returns A new {@link Validation.Classes.ArrayValidator | ArrayValidator } which validates the desired\n * array in place.\n * @public\n */\nexport function arrayOf<T, TC>(\n validateElement: Validator<T, TC>,\n params?: Omit<ArrayValidatorConstructorParams<T, TC>, 'validateElement'>\n): ArrayValidator<T, TC> {\n return new ArrayValidator({ validateElement, ...(params ?? {}) });\n}\n\n/**\n * Options for {@link Validators.recordOf} helper function.\n * @public\n */\nexport interface IRecordOfValidatorOptions<TK extends string = string, TC = unknown> {\n /**\n * If `onError` is `'fail'` (default), then the entire validation fails if any key or element\n * cannot be validated. If `onError` is `'ignore'`, failing elements are silently ignored.\n */\n onError?: 'fail' | 'ignore';\n /**\n * If present, `keyValidator` is used to validate the source object property names.\n * @remarks\n * Can be used to validate key names to supported values and/or strong types.\n */\n keyValidator?: Validator<TK, TC>;\n}\n\n/**\n * A helper function to create a {@link Validation.Validator | Validator} which validates the `string`-keyed properties\n * using a supplied {@link Validation.Validator | Validator<T, TC>} to produce a `Record<TK, T>`.\n * @remarks\n * If present, the supplied {@link Validators.IRecordOfValidatorOptions | options} can provide a strongly-typed\n * validator for keys and/or control the handling of elements that fail validation.\n * @param validator - {@link Validation.Validator | Validator} used for each item in the source object.\n * @param options - Optional {@link Validators.IRecordOfValidatorOptions | IRecordOfValidatorOptions<TK, TC>} which\n * supplies a key validator and/or error-handling options.\n * @returns A {@link Validation.Validator | Validator} which validates `Record<TK, T>`.\n * @public\n */\nexport function recordOf<T, TC = unknown, TK extends string = string>(\n validator: Validator<T, TC>,\n options?: IRecordOfValidatorOptions<TK, TC>\n): Validator<Record<TK, T>, TC> {\n const opts: IRecordOfValidatorOptions<TK, TC> = { onError: 'fail', ...options };\n\n return new GenericValidator({\n validator: (\n from: unknown,\n context?: TC,\n self?: Validator<Record<TK, T>, TC>\n ): boolean | Failure<Record<TK, T>> => {\n if (typeof from !== 'object' || from === null || Array.isArray(from)) {\n return fail(`Not a string-keyed object: ${JSON.stringify(from)}`);\n }\n\n const errors = new MessageAggregator();\n\n for (const key in from) {\n if (isKeyOf(key, from)) {\n // Validate key if keyValidator is provided\n if (opts.keyValidator) {\n const keyResult = opts.keyValidator.validate(key, context);\n if (!keyResult.isSuccess()) {\n if (opts.onError === 'ignore') {\n continue;\n }\n errors.addMessage(`Key \"${key}\": ${keyResult.message}`);\n if (opts.onError === 'fail') {\n return fail(keyResult.message);\n }\n }\n }\n\n // Validate value\n const valueResult = validator.validate(from[key] as unknown, context);\n if (!valueResult.isSuccess()) {\n if (opts.onError === 'ignore') {\n continue;\n }\n errors.addMessage(`Property \"${key}\": ${valueResult.message}`);\n if (opts.onError === 'fail') {\n return fail(valueResult.message);\n }\n }\n }\n }\n\n /* c8 ignore next 1 - defense in depth */\n return errors.hasMessages ? fail(errors.toString()) : true;\n }\n });\n}\n\n/**\n * Helper function to create a {@link Validation.Validator} which validates an enumerated\n * value in place.\n * @public\n */\nexport function enumeratedValue<T extends string>(values: ReadonlyArray<T>): Validator<T, ReadonlyArray<T>> {\n return new GenericValidator({\n validator: (\n from: unknown,\n context?: ReadonlyArray<T>,\n self?: Validator<T, ReadonlyArray<T>>\n ): boolean | Failure<T> => {\n if (typeof from === 'string') {\n const v = context ?? values;\n const index = v.indexOf(from as T);\n return index >= 0 ? true : fail(`Invalid enumerated value \"${from}\" - expected: (${v.join(', ')})`);\n }\n return fail(`Not a string: \"${JSON.stringify(from, undefined, 2)}`);\n }\n });\n}\n\n/**\n * Helper function to create a {@link Validation.Validator} which validates a literal value.\n * @param value - the literal value to be validated\n * @public\n */\nexport function literal<T extends string | number | boolean | symbol | null | undefined>(\n value: T\n): Validator<T> {\n return new GenericValidator({\n validator: (from: unknown, context?: unknown, self?: Validator<T>): boolean | Failure<T> => {\n return from === value\n ? true\n : fail(`Expected literal ${String(value)}, found \"${JSON.stringify(from, undefined, 2)}`);\n }\n });\n}\n\n/** Helper function to create a {@link Validation.Validator | Validator} which validates a\n * strongly-typed composite ID.\n * @param params - {@link Validation.Classes.CompositeIdValidatorConstructorParams | params}\n * used to construct the validator.\n * @returns A new {@link Validation.Validator | Validator} which validates the desired\n * composite ID in place.\n * @public\n */\nexport function compositeId<\n T extends string = string,\n TCOLLECTIONID extends string = string,\n TITEMID extends string = string,\n TC = unknown\n>(\n params: CompositeIdValidatorConstructorParams<T, TCOLLECTIONID, TITEMID, TC>\n): CompositeIdValidator<T, TCOLLECTIONID, TITEMID, TC> {\n return new CompositeIdValidator<T, TCOLLECTIONID, TITEMID, TC>(params);\n}\n\n/**\n * Helper function to create a {@link Validation.Validator | Validator} which validates one\n * of several possible validated values.\n * @param validators - the {@link Validation.Validator | validators} to be considered.\n * @param params - Optional {@link Validation.Classes.OneOfValidatorConstructorParams | params} used to construct the validator.\n * @returns A new {@link Validator | Validator} which validates values that match any of\n * the supplied validators.\n * @public\n */\nexport function oneOf<T, TC = unknown>(\n validators: Array<Validator<T, TC>>,\n params?: Omit<OneOfValidatorConstructorParams<T, TC>, 'validators'>\n): OneOfValidator<T, TC> {\n return new OneOfValidator<T, TC>({ ...(params ?? {}), validators });\n}\n\n/**\n * Helper function to create a {@link Validation.Classes.TypeGuardValidator | TypeGuardValidator} which\n * validates a value or object in place.\n * @param description - a description of the thing to be validated for use in error messages\n * @param guard - a {@link Validation.TypeGuardWithContext} which performs the validation.\n * @returns A new {@link Validation.Classes.TypeGuardValidator | TypeGuardValidator } which validates\n * the values using the supplied type guard.\n * @public\n */\nexport function isA<T, TC = unknown>(\n description: string,\n guard: TypeGuardWithContext<T, TC>,\n params?: Omit<TypeGuardValidatorConstructorParams<T, TC>, 'description' | 'guard'>\n): TypeGuardValidator<T, TC> {\n return new TypeGuardValidator({ description, guard, ...(params ?? {}) });\n}\n\n/**\n * Helper function to create a {@link Validation.Validator | Validator} using a\n * supplied {@link Validation.ValidatorFunc | validator function}.\n * @param validator - A {@link Validation.ValidatorFunc | validator function} that a\n * supplied unknown value matches some condition.\n * @returns A new {@link Validation.Validator | Validator} which validates the desired\n * value using the supplied function.\n * @public\n */\nexport function generic<T, TC = unknown>(validator: ValidatorFunc<T, TC>): Validator<T, TC> {\n return new GenericValidator({ validator });\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,WAAW,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,SAAS,EACT,mBAAmB,EACnB,6BAA6B,EAC7B,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAE9D,cAAc,iBAAiB,CAAC;AAChC,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,kBAAkB,EAClB,OAAO,EACP,eAAe,EACf,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,6BAA6B,EAC7B,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,UAAU,EACX,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oEAAsD;AAuBpD,kCAAW;AAtBb,kEAAoD;AAyBlD,gCAAU;AAxBZ,sDAAwC;AA2BtC,oBAAI;AA1BN,4DAA8C;AA6B5C,0BAAO;AA5BT,kEAAoD;AAmClD,gCAAU;AAjCZ,wDAUgC;AAM9B,oGAfA,iCAAmB,OAeA;AAEnB,0FAhBA,uBAAS,OAgBA;AACT,oGAfA,iCAAmB,OAeA;AASnB,0FAtBA,uBAAS,OAsBA;AAET,oGAvBA,iCAAmB,OAuBA;AACnB,8GAvBA,2CAA6B,OAuBA;AAC7B,oGAvBA,iCAAmB,OAuBA;AArBrB,sDAAgG;AAW9F,2FAXkB,uBAAU,OAWlB;AAKV,gGAhB8B,4BAAe,OAgB9B;AAEf,gGAlB+C,4BAAe,OAkB/C;AAjBjB,sDAA8D;AAuB5D,2FAvBkB,uBAAU,OAuBlB;AArBZ,kDAAgC","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 * as Collections from './packlets/collections';\nimport * as Conversion from './packlets/conversion';\nimport * as Hash from './packlets/hash';\nimport * as Logging from './packlets/logging';\nimport * as Validation from './packlets/validation';\n\nimport {\n AggregatedResultMap,\n Collector,\n ICollectible,\n ConvertingCollector,\n IReadOnlyResultMap,\n ResultMap,\n ValidatingCollector,\n ValidatingConvertingCollector,\n ValidatingResultMap\n} from './packlets/collections';\nimport { Converter, Converters, ObjectConverter, StringConverter } from './packlets/conversion';\nimport { Validator, Validators } from './packlets/validation';\n\nexport * from './packlets/base';\nexport {\n AggregatedResultMap,\n Collections,\n Collector,\n ConvertingCollector,\n Conversion,\n Converter,\n Converters,\n Hash,\n ICollectible,\n IReadOnlyResultMap,\n Logging,\n ObjectConverter,\n ResultMap,\n StringConverter,\n ValidatingCollector,\n ValidatingConvertingCollector,\n ValidatingResultMap,\n Validation,\n Validator,\n Validators\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand.d.ts","sourceRoot":"","sources":["../../../src/packlets/base/brand.ts"],"names":[],"mappings":"AAsBA;;;GAGG;AAEH,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand.js","sourceRoot":"","sources":["../../../src/packlets/base/brand.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG","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\n/**\n * Helper type to brand a simple type to prevent inappropriate use\n * @public\n */\n\nexport type Brand<T, B> = T & { __brand: B };\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/base/index.ts"],"names":[],"mappings":"AAsBA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/base/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;AAEH,0CAAwB;AACxB,+CAA6B;AAC7B,sDAAoC;AACpC,yCAAyC;AAAhC,uGAAA,UAAU,OAAA;AACnB,2CAAyB;AACzB,0CAAwB","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 './brand';\nexport * from './mapResults';\nexport * from './messageAggregator';\nexport { Normalizer } from './normalize';\nexport * from './result';\nexport * from './utils';\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapResults.d.ts","sourceRoot":"","sources":["../../../src/packlets/base/mapResults.ts"],"names":[],"mappings":"AAuBA,OAAO,EACL,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,MAAM,EAIP,MAAM,UAAU,CAAC;AAElB;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,OAAO,EAA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AK,CAAC;YAC5B,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,uBAAuB,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;QACtF,CAAC;IACH,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QACtC,OAAO,IAAA,aAAI,EAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,IAAA,gBAAO,EAAC,KAAU,CAAC,CAAC;AAC7B,CAAC","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 { MessageAggregator } from './messageAggregator';\nimport {\n DeferredResult,\n DetailedResult,\n IMessageAggregator,\n Result,\n fail,\n isDeferredResult,\n succeed\n} from './result';\n\n/**\n * Aggregates successful result values from a collection of {@link Result | Result<T>}.\n * @param results - The collection of {@link Result | Result<T>} to be mapped.\n * @param aggregatedErrors - Optional string array to which any error messages will be\n * appended. Each error is appended as an individual string.\n * @returns If all {@link Result | results} are successful, returns {@link Success} with an\n * array containing all returned values. If any {@link Result | results} failed, returns\n * {@link Failure} with a concatenated summary of all error messages.\n * @public\n */\nexport function mapResults<T>(\n results: Iterable<Result<T>>,\n aggregatedErrors?: IMessageAggregator\n): Result<T[]> {\n const errors: string[] = [];\n const elements: T[] = [];\n\n for (const result of results) {\n if (result.isSuccess()) {\n elements.push(result.value);\n } else {\n errors.push(result.message);\n }\n }\n\n if (errors.length > 0) {\n aggregatedErrors?.addMessages(errors);\n return fail(errors.join('\\n'));\n }\n return succeed(elements);\n}\n\n/**\n * Aggregates successful results from a collection of {@link DetailedResult | DetailedResult<T, TD>},\n * optionally ignoring certain error details.\n * @param results - The collection of {@link DetailedResult | DetailedResult<T, TD>} to be mapped.\n * @param ignore - An array of error detail values (of type `<TD>`) that should be ignored.\n * @param aggregatedErrors - Optional string array to which any non-ignorable error messages will be\n * appended. Each error is appended as an individual string.\n * @returns {@link Success} with an array containing all successful results if all results either\n * succeeded or returned error details listed in `ignore`. If any results failed with details\n * that cannot be ignored, returns {@link Failure} with an concatenated summary of all non-ignorable\n * error messages.\n * @public\n */\nexport function mapDetailedResults<T, TD>(\n results: Iterable<DetailedResult<T, TD>>,\n ignore: TD[],\n aggregatedErrors?: IMessageAggregator\n): Result<T[]> {\n const errors: string[] = [];\n const elements: T[] = [];\n\n for (const result of results) {\n if (result.isSuccess()) {\n elements.push(result.value);\n } else if (result.detail && !ignore.includes(result.detail)) {\n errors.push(result.message);\n }\n }\n\n if (errors.length > 0) {\n aggregatedErrors?.addMessages(errors);\n return fail(errors.join('\\n'));\n }\n return succeed(elements);\n}\n\n/**\n * Aggregates successful results from a a collection of {@link Result | Result<T>}.\n * @param results - An `Iterable` of {@link Result | Result<T>} from which success\n * results are to be aggregated.\n * @param aggregatedErrors - Optional string array to which any returned error messages will be\n * appended. Each error is appended as an individual string.\n * @returns {@link Success} with an array of `<T>` if any results were successful. If\n * all {@link Result | results} failed, returns {@link Failure} with a concatenated\n * summary of all error messages.\n * @public\n */\nexport function mapSuccess<T>(\n results: Iterable<Result<T>>,\n aggregatedErrors?: IMessageAggregator\n): Result<T[]> {\n const errors: string[] = [];\n const elements: T[] = [];\n\n for (const result of results) {\n if (result.isSuccess()) {\n elements.push(result.value);\n } else {\n errors.push(result.message);\n }\n }\n\n if (elements.length === 0 && errors.length > 0) {\n aggregatedErrors?.addMessages(errors);\n return fail(errors.join('\\n'));\n }\n return succeed(elements);\n}\n\n/**\n * Aggregates error messages from a collection of {@link Result | Result<T>}.\n * @param results - An iterable collection of {@link Result | Result<T>} for which\n * error messages are aggregated.\n * @param aggregatedErrors - Optional string array to which any returned error messages will be\n * appended. Each error is appended as an individual string.\n * @returns An array of strings consisting of all error messages returned by\n * {@link Result | results} in the source collection. Ignores {@link Success}\n * results and returns an empty array if there were no errors.\n * @public\n */\nexport function mapFailures<T>(\n results: Iterable<Result<T>>,\n aggregatedErrors?: IMessageAggregator\n): string[] {\n const errors: string[] = [];\n for (const result of results) {\n if (result.isFailure()) {\n errors.push(result.message);\n aggregatedErrors?.addMessage(result.message);\n }\n }\n return errors;\n}\n\n/**\n * Determines if an iterable collection of {@link Result | Result<T>} were all successful.\n * @param results - The collection of {@link Result | Result<T>} to be tested.\n * @param successValue - The value to be returned if results are successful.\n * @param aggregatedErrors - Optional string array to which any returned error messages will be\n * appended. Each error is appended as an individual string.\n * @returns Returns {@link Success} with `successValue` if all {@link Result | results} are successful.\n * If any are unsuccessful, returns {@link Failure} with a concatenated summary of the error\n * messages from all failed elements.\n * @public\n */\nexport function allSucceed<T>(\n results: Iterable<Result<unknown>>,\n successValue: T,\n aggregatedErrors?: IMessageAggregator\n): Result<T> {\n const errors: string[] = [];\n\n if (results !== undefined) {\n for (const result of results) {\n if (result.isFailure()) {\n errors.push(result.message);\n }\n }\n }\n\n if (errors.length > 0) {\n aggregatedErrors?.addMessages(errors);\n return fail(errors.join('\\n'));\n }\n return succeed(successValue);\n}\n\n/**\n * Returns the first successful result from a collection of {@link Result | Result<T>} or {@link DeferredResult | DeferredResult<T>}.\n * @param results - The collection of {@link Result | Result<T>} or {@link DeferredResult | DeferredResult<T>} to be tested.\n * @returns The first successful result, or {@link Failure} with a concatenated summary of all error messages.\n * @public\n */\nexport function firstSuccess<T>(results: Iterable<Result<T> | DeferredResult<T>>): Result<T> {\n const errors: MessageAggregator = new MessageAggregator();\n for (const r of results) {\n const result = isDeferredResult(r) ? r() : r;\n if (result.isSuccess()) {\n return result;\n }\n errors.addMessage(result.message);\n }\n return errors.returnOrReport(fail('no results found'));\n}\n\n/**\n * String-keyed record of initialization functions to be passed to {@link populateObject}\n * or {@link populateObject}.\n * @public\n */\nexport type FieldInitializers<T> = { [key in keyof T]: (state: Partial<T>) => Result<T[key]> };\n\n/**\n * Options for the {@link populateObject} function.\n * @public\n */\n\nexport interface PopulateObjectOptions<T> {\n /**\n * If present, specifies the order in which property values should\n * be evaluated. Any keys not listed are evaluated after all listed\n * keys in indeterminate order. If 'order' is not present, keys\n * are evaluated in indeterminate order.\n */\n order?: (keyof T)[];\n\n /**\n * Specify handling of `undefined` values. By default, successful\n * `undefined` results are written to the result object. If this value\n * is `true` then `undefined` results are suppressed for all properties.\n * If this value is an array of property keys then `undefined` results\n * are suppressed for those properties only.\n */\n suppressUndefined?: boolean | (keyof T)[];\n}\n\n/**\n * Populates an an object based on a prototype full of field initializers that return {@link Result | Result<T[key]>}.\n * Returns {@link Success} with the populated object if all initializers succeed, or {@link Failure} with a\n * concatenated list of all error messages.\n * @param initializers - An object with the shape of the target but with initializer functions for\n * each property.\n * @param options - An optional {@link PopulateObjectOptions | set of options} which\n * modify the behavior of this call.\n * @param aggregatedErrors - Optional string array to which any returned error messages will be\n * appended. Each error is appended as an individual string.\n * {@label WITH_OPTIONS}\n * @public\n */\nexport function populateObject<T>(\n initializers: FieldInitializers<T>,\n options?: PopulateObjectOptions<T>,\n aggregatedErrors?: IMessageAggregator\n): Result<T>;\n\n/**\n * Populates an an object based on a prototype full of field initializers that return {@link Result | Result<T[key]>}.\n * Returns {@link Success} with the populated object if all initializers succeed, or {@link Failure} with a\n * concatenated list of all error messages.\n * @param initializers - An object with the shape of the target but with initializer functions for\n * each property.\n * @param order - Optional order in which keys should be written.\n * @param aggregatedErrors - Optional string array to which any returned error messages will be\n * appended. Each error is appended as an individual string.\n * @public\n * {@label WITH_ORDER}\n * @deprecated Pass {@link PopulateObjectOptions} instead.\n */\nexport function populateObject<T>(\n initializers: FieldInitializers<T>,\n order: (keyof T)[] | undefined,\n aggregatedErrors?: IMessageAggregator\n): Result<T>;\n\nexport function populateObject<T>(\n initializers: FieldInitializers<T>,\n optionsOrOrder?: PopulateObjectOptions<T> | (keyof T)[],\n aggregatedErrors?: IMessageAggregator\n): Result<T> {\n const options: PopulateObjectOptions<T> = optionsOrOrder\n ? Array.isArray(optionsOrOrder)\n ? { order: optionsOrOrder }\n : optionsOrOrder\n : {};\n const state = {} as { [key in keyof T]: T[key] };\n const errors: string[] = [];\n const keys: (keyof T)[] = Array.from(options.order ?? []);\n const foundKeys = new Set<keyof T>(options.order);\n\n // start with the supplied order then append anything else we find\n for (const key in initializers) {\n if (!foundKeys.has(key)) {\n keys.push(key);\n foundKeys.add(key);\n }\n }\n\n for (const key of keys) {\n if (initializers[key]) {\n const result = initializers[key](state);\n if (result.isSuccess()) {\n if (result.value === undefined) {\n if (\n options.suppressUndefined === true ||\n (Array.isArray(options.suppressUndefined) && options.suppressUndefined.includes(key))\n ) {\n continue;\n }\n }\n state[key] = result.value;\n } else {\n errors.push(result.message);\n }\n } else {\n errors.push(`populateObject: Key ${String(key)} is present but has no initializer`);\n }\n }\n\n if (errors.length > 0) {\n aggregatedErrors?.addMessages(errors);\n return fail(errors.join('\\n'));\n }\n return succeed(state as T);\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messageAggregator.d.ts","sourceRoot":"","sources":["../../../src/packlets/base/messageAggregator.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAQ,MAAM,UAAU,CAAC;AAE5D;;;;GAIG;AACH,qBAAa,iBAAkB,YAAW,kBAAkB;IAC1D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAW;IAErC;;;;;OAKG;gBACgB,MAAM,CAAC,EAAE,MAAM,EAAE;IAIpC;;OAEG;IACH,IAAW,WAAW,IAAI,OAAO,CAEhC;IAED;;OAEG;IACH,IAAW,WAAW,IAAI,MAAM,CAE/B;IAED;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,EAAE,CAE9B;IAED;;OAEG;IACI,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAOpD;;OAEG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,IAAI;IAOxD;;OAEG;IACI,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM;IAI3C;;;;;;;;;;;;;;;;;OAiBG;IACI,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;CAW3E"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messageAggregator.js","sourceRoot":"","sources":["../../../src/packlets/base/messageAggregator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,qCAA4D;AAE5D;;;;GAIG;AACH,MAAa,iBAAiB;IAG5B;;;;;OAKG;IACH,YAAmB,MAAiB;QAClC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI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I,EAAC,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,IAAI,CAAC,CAAC,CAAC;YAC3E,CAAC;QACH,CAAC;QACD,OAAO,IAAA,aAAI,EAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;IACxC,CAAC;CACF;AA1FD,8CA0FC","sourcesContent":["/*\n * Copyright (c) 2024 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 { IMessageAggregator, Result, fail } from './result';\n\n/**\n * A simple error aggregator to simplify collecting and reporting all errors in\n * a flow.\n * @public\n */\nexport class MessageAggregator implements IMessageAggregator {\n private readonly _messages: string[];\n\n /**\n * Constructs a new {@link MessageAggregator | ErrorAggregator} with an\n * optionally specified initial set of error messages.\n * @param errors - optional array of errors to be included\n * in the aggregation.\n */\n public constructor(errors?: string[]) {\n this._messages = errors ? Array.from(errors) : [];\n }\n\n /**\n * {@inheritDoc IMessageAggregator.hasMessages}\n */\n public get hasMessages(): boolean {\n return this._messages.length > 0;\n }\n\n /**\n * {@inheritDoc IMessageAggregator.numMessages}\n */\n public get numMessages(): number {\n return this._messages.length;\n }\n\n /**\n * {@inheritDoc IMessageAggregator.messages}\n */\n public get messages(): string[] {\n return this._messages;\n }\n\n /**\n * {@inheritDoc IMessageAggregator.addMessage}\n */\n public addMessage(message: string | undefined): this {\n if (message) {\n this._messages.push(message);\n }\n return this;\n }\n\n /**\n * {@inheritDoc IMessageAggregator.addMessages}\n */\n public addMessages(messages: string[] | undefined): this {\n if (messages && messages.length > 0) {\n this._messages.push(...messages);\n }\n return this;\n }\n\n /**\n * {@inheritDoc IMessageAggregator.toString}\n */\n public toString(separator?: string): string {\n return this._messages.join(separator ?? '\\n');\n }\n\n /**\n * If any error messages have been aggregated, returns\n * {@link Failure | Failure<T>} with the aggregated\n * messages concatenated using the optionally-supplied\n * separator, or newline. If the supplied {@link Result | Result<T>}\n * contains an error message that has not already been aggregated,\n * it will be included in the aggregated messages.\n *\n * If no error messages have been aggregated, returns\n * the supplied {@link Result | Result<T>}.\n * @param result - The {@link Result | Result<T>} to be returned\n * if no messages have been aggregated.\n * @param separator - Optional string separator used to construct\n * the error message.\n * @returns {@link Failure | Failure<T>} with an aggregated message\n * if any error messages were collected, the supplied\n * {@link Result | Result<T>} otherwise.\n */\n public returnOrReport<T>(result: Result<T>, separator?: string): Result<T> {\n if (!this.hasMessages) {\n return result;\n }\n if (!result.success) {\n if (!this._messages.find((s) => s === result.message)) {\n return fail([...this._messages, result.message].join(separator ?? '\\n'));\n }\n }\n return fail(this.toString(separator));\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/packlets/base/normalize.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,MAAM,EAAiB,MAAM,UAAU,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,KAAK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,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS,CAAC;YACf,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC;YACd,KAAK,WAAW;gBACd,OAAO,IAAA,gBAAO,EAAC,IAAI,CAAC,CAAC;QACzB,CAAC;QACD,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,OAAO,IAAA,gBAAO,EAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,IAAI,YAAY,IAAI,EAAE,CAAC;YACzB,OAAO,IAAA,gBAAO,EAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,IAAI,YAAY,MAAM,EAAE,CAAC;YAC3B,OAAO,IAAA,gBAAO,EAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,sBAAsB;QACtB,OAAO,IAAA,aAAI,EAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;CACF;AAxGD,gCAwGC","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 { mapResults } from './mapResults';\nimport { Result, fail, succeed } from './result';\n\n/**\n * @internal\n */\nexport type Entry<T> = [string | number | symbol, T];\n\n/**\n * @internal\n */\nexport type ResultEntry<T> = [string | number | symbol, Result<T>];\n\n/**\n * Normalizes an arbitrary JSON object\n * @public\n */\nexport class Normalizer {\n /**\n * Normalizes the supplied value\n *\n * @param from - The value to be normalized\n * @returns A normalized version of the value\n */\n public normalize<T>(from: T): Result<T> {\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);\n case 'object':\n if (from === null || from instanceof Date || from instanceof RegExp) {\n return this.normalizeLiteral(from);\n } else if (Array.isArray(from)) {\n return this._normalizeArray(from) as unknown as Result<T>;\n } else if (from instanceof Map) {\n return succeed(new Map(this.normalizeEntries(from.entries())) as unknown as T);\n } else if (from instanceof Set) {\n return succeed(new Set(this.normalizeEntries(from.entries())) as unknown as T);\n }\n const obj: { [key in number | string | symbol]: unknown } = {};\n for (const e of this.normalizeEntries(Object.entries(from as unknown as object))) {\n obj[e[0]] = e[1];\n }\n return succeed(obj as T);\n }\n return fail(`normalize: Unexpected type - cannot normalize '${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 */\n public normalizeEntries<T = unknown>(entries: Iterable<Entry<T>>): Entry<T>[] {\n return Array.from(entries)\n .sort((e1, e2) => this._compareKeys(e1[0], e2[0]))\n .map((e) => [e[0], this.normalize(e[1])] as ResultEntry<T>)\n .filter((e) => e[1].isSuccess())\n .map((e) => [e[0], e[1].orThrow()]);\n }\n\n protected _normalizeArray(from: unknown[]): Result<unknown[]> {\n return mapResults(from.map((v) => this.normalize(v)));\n }\n\n /**\n * Normalizes the supplied literal value\n * @param from - The literal value to be normalized.\n * @returns A normalized value for the literal.\n */\n public normalizeLiteral<T>(from: T): Result<T> {\n // TODO: Apply configurable normalization rules\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(from);\n }\n if (from === null) {\n return succeed(from);\n }\n if (from instanceof Date) {\n return succeed(from);\n }\n if (from instanceof RegExp) {\n return succeed(from);\n }\n /* c8 ignore next 2 */\n return fail(`cannot normalize ${JSON.stringify(from)}`);\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../../src/packlets/base/result.ts"],"names":[],"mappings":"AAsBA;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC;AAEhD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC,CAEtG;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC,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MG;IACI,MAAM,CAAC,QAA6B,EAAE,OAAuC;QAClF,OAAO,IAAI,WAAW,CACpB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;YACvB,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC5B,OAAO,CAAC,CAAC;QACX,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,2CAA2C;IACpC,IAAI,CACT,WAA6E,EAC7E,UAA2E;QAE3E,0CAA0C;QAC1C,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,IAAI,CAAI,MAAiB;QACrC,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAClD,CAAC;CACF;AA5JD,kCA4JC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,kBAAkB,CAAI,IAAsB;IAChE,IAAI,CAAC;QACH,OAAO,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IAC/B,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;IAClC,CAAC;AACH,CAAC","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\n/**\n * Represents the {@link IResult | result} of some operation or sequence of operations.\n * @remarks\n * {@link Success | Success<T>} and {@link Failure | Failure<T>} share the common\n * contract {@link IResult}, enabling commingled discriminated usage.\n * @public\n */\nexport type Result<T> = Success<T> | Failure<T>;\n\n/**\n * Represents a deferred result that will be evaluated if needed.\n * @public\n */\nexport type DeferredResult<T> = () => Result<T>;\n\n/**\n * Checks if a result is a deferred result.\n * @param result - The result to check.\n * @returns `true` if the result is a deferred result, `false` otherwise.\n * @public\n */\nexport function isDeferredResult<T>(result: Result<T> | DeferredResult<T>): result is DeferredResult<T> {\n return typeof result === 'function';\n}\n\n/**\n * Continuation callback to be called in the event that an\n * {@link Result} is successful.\n * @public\n */\nexport type SuccessContinuation<T, TN> = (value: T) => Result<TN>;\n\n/**\n * Continuation callback to be called in the event that an\n * {@link Result} fails.\n * @public\n */\nexport type FailureContinuation<T> = (message: string) => Result<T>;\n\n/**\n * Type inference to determine the result type of an {@link Result}.\n * @beta\n */\nexport type ResultValueType<T> = T extends Result<infer TV> ? TV : never;\n\n/**\n * Type inference to determine the result type of an {@link IResult}.\n * @beta\n */\nexport type IResultValueType<T> = T extends IResult<infer TV> ? TV : never;\n\n/**\n * Type inference to determine the value type returned from a result-map style\n * `get` method.\n * @remarks\n * Useful for extracting collection entry types from maps whose `get` method\n * returns an {@link IResult}.\n * @beta\n */\nexport type ResultMapValueType<TCollection extends { get: (...args: readonly unknown[]) => unknown }> =\n Exclude<IResultValueType<ReturnType<TCollection['get']>>, undefined>;\n\n/**\n * Formats an error message.\n * @param message - The error message to be formatted.\n * @param detail - An optional detail to be included in the formatted message.\n * @public\n */\nexport type ErrorFormatter<TD = unknown> = (message: string, detail?: TD) => string;\n\n/**\n * Simple logger interface used by {@link IResult.orThrow | orThrow(logger)} and {@link IResult.orThrow | orThrow(formatter)}.\n * @public\n */\nexport interface IResultLogger<TD = unknown> {\n /**\n * Log an error message.\n * @param message - The message to be logged.\n */\n error(message: string, detail?: TD): void;\n}\n\n/**\n * The severity level at which a message should be logged.\n * @public\n */\nexport type MessageLogLevel = 'quiet' | 'detail' | 'info' | 'warning' | 'error';\n\n/**\n * Details for reporting a message.\n * @public\n */\nexport interface IMessageReportDetail<TD = unknown> {\n level?: MessageLogLevel;\n message?: ErrorFormatter<TD>;\n detail?: TD;\n}\n\n/**\n * Options for reporting a result.\n * @public\n */\nexport interface IResultReportOptions<TD = unknown> {\n /**\n * The level of reporting to be used for failure results. Default is 'error'.\n */\n failure?: MessageLogLevel | IMessageReportDetail<TD>;\n\n /**\n * The level of reporting to be used for success results. Default is 'quiet'.\n */\n success?: MessageLogLevel | IMessageReportDetail<TD>;\n}\n\n/**\n * Interface for reporting a result.\n * @public\n */\nexport interface IResultReporter<T, TD = unknown> {\n /** Reports a successful result at the specified log level. */\n reportSuccess(level: MessageLogLevel, value: T, detail?: TD, message?: ErrorFormatter<TD>): void;\n /** Reports a failed result at the specified log level. */\n reportFailure(level: MessageLogLevel, message: string, detail?: TD): void;\n}\n\n/**\n * Simple error aggregator to simplify collecting all errors in\n * a flow.\n * @public\n */\nexport interface IMessageAggregator {\n /**\n * Indicates whether any messages have been aggregated.\n */\n readonly hasMessages: boolean;\n\n /**\n * The number of messages aggregated.\n */\n readonly numMessages: number;\n\n /**\n * The aggregated messages.\n */\n readonly messages: ReadonlyArray<string>;\n\n /**\n * Adds a message to the aggregator, if defined.\n * @param message - The message to add - pass `undefined`\n * or the empty string to continue without adding a message.\n */\n addMessage(message: string | undefined): this;\n\n /**\n * Adds multiple messages to the aggregator.\n * @param messages - the messages to add.\n */\n addMessages(messages: string[] | undefined): this;\n\n /**\n * Returns all messages as a single string joined\n * using the optionally-supplied `separator`, or\n * newline if no separator is specified.\n * @param separator - The optional separator used\n * to join strings.\n */\n toString(separator?: string): string;\n}\n\n/**\n * Represents the result of some operation of sequence of operations.\n * @remarks\n * This common contract enables commingled discriminated usage of {@link Success | Success<T>}\n * and {@link Failure | Failure<T>}.\n * @public\n */\nexport interface IResult<T> {\n /**\n * Indicates whether the operation was successful.\n */\n readonly success: boolean;\n\n /**\n * Value returned by a successful operation, undefined\n * for a failed operation.\n */\n readonly value: T | undefined;\n\n /**\n * Error message returned by a failed operation, undefined\n * for a successful operation.\n */\n readonly message: string | undefined;\n\n /**\n * Indicates whether this operation was successful. Functions\n * as a type guard for {@link Success | Success<T>}.\n */\n isSuccess(): this is Success<T>;\n\n /**\n * Indicates whether this operation failed. Functions\n * as a type guard for {@link Failure | Failure<T>}.\n */\n isFailure(): this is Failure<T>;\n\n /**\n * Gets the value associated with a successful {@link IResult | result},\n * or throws the error message if the corresponding operation failed.\n *\n * Note that `getValueOrThrow` is being superseded by `orThrow` and\n * will eventually be deprecated. Please use orDefault instead.\n *\n * @param logger - An optional {@link IResultLogger | logger} to which the\n * error will also be reported.\n * @returns The return value, if the operation was successful.\n * @throws The error message if the operation failed.\n * @deprecated Use {@link IResult.orThrow | orThrow(logger)} or {@link IResult.orThrow | orThrow(formatter)} instead.\n */\n getValueOrThrow(logger?: IResultLogger): T;\n\n /**\n * Gets the value associated with a successful {@link IResult | result},\n * or a default value if the corresponding operation failed.\n * @param dflt - The value to be returned if the operation failed (default is\n * `undefined`).\n *\n * Note that `getValueOrDefault` is being superseded by `orDefault` and\n * will eventually be deprecated. Please use orDefault instead.\n *\n * @returns The return value, if the operation was successful. Returns\n * the supplied default value or `undefined` if no default is supplied.\n * @deprecated Use {@link IResult.orDefault | orDefault(T)} or {@link IResult.orDefault | orDefault()} instead.\n */\n getValueOrDefault(dflt?: T): T | undefined;\n\n /**\n * Gets the value associated with a successful {@link IResult | result},\n * or throws the error message if the corresponding operation failed.\n * @param logger - An optional {@link IResultLogger | logger} to which the\n * error will also be reported.\n * @returns The return value, if the operation was successful.\n * @throws The error message if the operation failed.\n * {@label logger}\n */\n orThrow(logger?: IResultLogger): T;\n\n /**\n * Gets the value associated with a successful {@link IResult | result},\n * or throws the error message if the corresponding operation failed.\n * @param cb - The {@link ErrorFormatter | error formatter} to be called in the event of failure.\n * @returns The return value, if the operation was successful.\n * @throws The error message if the operation failed.\n * {@label formatter}\n */\n orThrow(cb: ErrorFormatter): T;\n\n /**\n * Gets the value associated with a successful {@link IResult | result},\n * or a default value if the corresponding operation failed.\n * @param dflt - The value to be returned if the operation failed.\n * @returns The return value, if the operation was successful. Returns\n * the supplied default if an error occurred.\n * {@label SUPPLIED}\n */\n orDefault(dflt: T): T;\n\n /**\n * Gets the value associated with a successful {@link IResult | result},\n * or a default value if the corresponding operation failed.\n * @returns The return value, if the operation was successful, or\n * `undefined` if an error occurs.\n * {@label MISSING}\n */\n orDefault(): T | undefined;\n\n /**\n * Calls a supplied {@link SuccessContinuation | success continuation} if\n * the operation was a success.\n * @remarks\n * The {@link SuccessContinuation | success continuation} might return a\n * different result type than {@link IResult} on which it is invoked. This\n * enables chaining of operations with heterogenous return types.\n *\n * @param cb - The {@link SuccessContinuation | success continuation} to\n * be called in the event of success.\n * @returns If this operation was successful, returns the value returned\n * by the {@link SuccessContinuation | success continuation}. If this result\n * failed, propagates the error message from this failure.\n */\n onSuccess<TN>(cb: SuccessContinuation<T, TN>): Result<TN>;\n\n /**\n * Calls a supplied {@link FailureContinuation | failed continuation} if\n * the operation failed.\n * @param cb - The {@link FailureContinuation | failure continuation} to\n * be called in the event of failure.\n * @returns If this operation failed, returns the value returned by the\n * {@link FailureContinuation | failure continuation}. If this result\n * was successful, propagates the result value from the successful event.\n */\n onFailure(cb: FailureContinuation<T>): Result<T>;\n\n /**\n * Calls a supplied {@link AsyncSuccessContinuation | async success continuation} if\n * the operation was a success, bridging into an {@link AsyncResult} chain.\n * @remarks\n * If the async callback rejects, the rejection is caught and converted\n * to a {@link Failure}.\n * @param cb - The {@link AsyncSuccessContinuation | async success continuation} to\n * be called in the event of success.\n * @returns An {@link AsyncResult} wrapping the async continuation result, or\n * propagating the error message from this failure.\n */\n thenOnSuccess<TN>(cb: AsyncSuccessContinuation<T, TN>): AsyncResult<TN>;\n\n /**\n * Calls a supplied {@link AsyncFailureContinuation | async failure continuation} if\n * the operation failed, bridging into an {@link AsyncResult} chain.\n * @remarks\n * If the async callback rejects, the rejection is caught and converted\n * to a {@link Failure}.\n * @param cb - The {@link AsyncFailureContinuation | async failure continuation} to\n * be called in the event of failure.\n * @returns An {@link AsyncResult} wrapping the async continuation result, or\n * propagating the success value from this result.\n */\n thenOnFailure(cb: AsyncFailureContinuation<T>): AsyncResult<T>;\n\n /**\n * Calls a supplied {@link ErrorFormatter | error formatter} if\n * the operation failed.\n * @param cb - The {@link ErrorFormatter | error formatter} to\n * be called in the event of failure.\n * @returns If this operation failed, returns the returns {@link Failure | Failure}\n * with the message returned by the formatter. If this result\n * was successful, propagates the result value from the successful event.\n */\n withErrorFormat(cb: ErrorFormatter): Result<T>;\n\n /**\n * Converts a {@link IResult | IResult<T>} to a {@link DetailedResult | DetailedResult<T, TD>},\n * adding a supplied detail if the operation failed.\n * @param detail - The detail to be added if this operation failed.\n * @returns A new {@link DetailedResult | DetailedResult<T, TD>} with either\n * the success result or the error message from this {@link IResult}, with\n * the supplied detail (if this event failed) or detail `undefined` (if\n * this result succeeded).\n */\n withFailureDetail<TD>(detail: TD): DetailedResult<T, TD>;\n\n /**\n * Converts a {@link IResult | IResult<T>} to a {@link DetailedResult | DetailedResult<T, TD>},\n * adding supplied details.\n * @param detail - The default detail to be added to the new {@link DetailedResult}.\n * @param successDetail - An optional detail to be added if this result was successful.\n * @returns A new {@link DetailedResult | DetailedResult<T, TD>} with either\n * the success result or the error message from this {@link IResult} and the\n * appropriate added detail.\n */\n withDetail<TD>(detail: TD, successDetail?: TD): DetailedResult<T, TD>;\n\n /**\n * Propagates interior result, appending any error message to the\n * supplied errors array.\n * @param errors - {@link IMessageAggregator | Error aggregator} in which\n * errors will be aggregated.\n * @param formatter - An optional {@link ErrorFormatter | error formatter} to be used to format the error message.\n */\n aggregateError(errors: IMessageAggregator, formatter?: ErrorFormatter): this;\n\n /**\n * Reports the result to the supplied reporter\n * @param reporter - The {@link IResultReporter | reporter} to which the result will be reported.\n * @param options - The {@link IResultReportOptions | options} for reporting the result.\n */\n report(reporter?: IResultReporter<T>, options?: IResultReportOptions<unknown>): Result<T>;\n}\n\n/**\n * Reports a successful {@link IResult | result} from some operation and the\n * corresponding value.\n * @public\n */\nexport class Success<out T> implements IResult<T> {\n /**\n * {@inheritDoc IResult.success}\n */\n public readonly success: true = true;\n\n /**\n * For a successful operation, the error message is always `undefined`.\n */\n public readonly message: undefined = undefined;\n\n /**\n * @internal\n */\n protected readonly _value: T;\n\n /**\n * Constructs a {@link Success} with the supplied value.\n * @param value - The value to be returned.\n */\n public constructor(value: T) {\n this._value = value;\n }\n\n /**\n * The result value returned by the successful operation.\n */\n public get value(): T {\n return this._value;\n }\n\n /**\n * {@inheritDoc IResult.isSuccess}\n */\n public isSuccess(): this is Success<T> {\n return true;\n }\n\n /**\n * {@inheritDoc IResult.isFailure}\n */\n public isFailure(): this is Failure<T> {\n return false;\n }\n\n /**\n * {@inheritDoc IResult.orThrow}\n */\n public orThrow(logger?: IResultLogger): T;\n\n /**\n * {@inheritDoc IResult.orThrow}\n */\n public orThrow(cb: ErrorFormatter): T;\n public orThrow(__logger?: IResultLogger | ErrorFormatter): T {\n return this._value;\n }\n\n /**\n * {@inheritDoc IResult.orDefault}\n */\n public orDefault(dflt: T): T;\n /**\n * {@inheritDoc IResult.orDefault}\n */\n public orDefault(): T | undefined;\n public orDefault(dflt?: T): T | undefined {\n return this._value ?? dflt;\n }\n\n /**\n * {@inheritDoc IResult.getValueOrThrow}\n * @deprecated Use {@link Success.orThrow | orThrow(logger)} or {@link Success.orThrow | orThrow(formatter)} instead.\n */\n public getValueOrThrow(__logger?: IResultLogger): T {\n return this._value;\n }\n\n /**\n * {@inheritDoc IResult.getValueOrDefault}\n * @deprecated Use {@link Success.orDefault | orDefault(T)} or {@link Success.orDefault | orDefault()} instead.\n */\n public getValueOrDefault(dflt?: T): T | undefined {\n return this._value ?? dflt;\n }\n\n /**\n * {@inheritDoc IResult.onSuccess}\n */\n public onSuccess<TN>(cb: SuccessContinuation<T, TN>): Result<TN> {\n return cb(this._value);\n }\n\n /**\n * {@inheritDoc IResult.onFailure}\n */\n public onFailure(__: FailureContinuation<T>): Result<T> {\n return this;\n }\n\n /**\n * {@inheritDoc IResult.thenOnSuccess}\n */\n public thenOnSuccess<TN>(cb: AsyncSuccessContinuation<T, TN>): AsyncResult<TN> {\n try {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return new AsyncResult(cb(this._value));\n } catch (err: unknown) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return AsyncResult.from(fail<TN>(_errorMessage(err)));\n }\n }\n\n /**\n * {@inheritDoc IResult.thenOnFailure}\n */\n public thenOnFailure(__: AsyncFailureContinuation<T>): AsyncResult<T> {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return AsyncResult.from(this);\n }\n\n /**\n * {@inheritDoc IResult.withErrorFormat}\n */\n public withErrorFormat(__cb: ErrorFormatter): Result<T> {\n return this;\n }\n\n /**\n * {@inheritDoc IResult.withFailureDetail}\n */\n public withFailureDetail<TD>(__detail: TD): DetailedResult<T, TD> {\n return succeedWithDetail(this._value);\n }\n\n /**\n * {@inheritDoc IResult.withDetail}\n */\n public withDetail<TD>(detail: TD, successDetail?: TD): DetailedResult<T, TD> {\n return succeedWithDetail(this._value, successDetail ?? detail);\n }\n\n /**\n * {@inheritDoc IResult.aggregateError}\n */\n public aggregateError(__errors: IMessageAggregator, __formatter?: ErrorFormatter): this {\n return this;\n }\n\n /**\n * {@inheritDoc IResult.report}\n */\n public report(reporter?: IResultReporter<T>, options?: IResultReportOptions<unknown>): Success<T> {\n const successOptions =\n typeof options?.success === 'object' ? options.success : { level: options?.success };\n const level = successOptions.level ?? 'quiet';\n reporter?.reportSuccess(level, this._value, undefined, successOptions.message);\n return this;\n }\n\n /**\n * Creates a {@link Success | Success<T>} with the supplied value.\n * @param value - The value to be returned.\n * @returns The resulting {@link Success | Success<T>} with the supplied value.\n * @public\n */\n public static with<T>(value: T): Success<T> {\n return new Success<T>(value);\n }\n}\n\n/**\n * Reports a failed {@link IResult | result} from some operation, with an error message.\n * @public\n */\nexport class Failure<out T> implements IResult<T> {\n /**\n * {@inheritDoc IResult.success}\n */\n public readonly success: false = false;\n /**\n * Failed operation always returns undefined for value.\n */\n public readonly value: undefined = undefined;\n\n /**\n * @internal\n */\n protected readonly _message: string;\n\n /**\n * Constructs a {@link Failure} with the supplied message.\n * @param message - Error message to be reported.\n */\n public constructor(message: string) {\n this._message = message;\n }\n\n /**\n * Gets the error message associated with this error.\n */\n public get message(): string {\n return this._message;\n }\n\n /**\n * {@inheritDoc IResult.isSuccess}\n */\n public isSuccess(): this is Success<T> {\n return false;\n }\n\n /**\n * {@inheritDoc IResult.isFailure}\n */\n public isFailure(): this is Failure<T> {\n return true;\n }\n\n /**\n * {@inheritDoc IResult.orThrow}\n */\n public orThrow(logger?: IResultLogger): never;\n\n /**\n * {@inheritDoc IResult.orThrow}\n */\n public orThrow(cb: ErrorFormatter): never;\n public orThrow(logOrFormat?: IResultLogger | ErrorFormatter): never {\n if (logOrFormat !== undefined) {\n if (typeof logOrFormat === 'function') {\n throw new Error(logOrFormat(this._message));\n } else {\n logOrFormat.error(this._message);\n }\n }\n throw new Error(this._message);\n }\n\n /**\n * {@inheritDoc IResult.orDefault}\n */\n public orDefault(dflt: T): T;\n /**\n * {@inheritDoc IResult.orDefault}\n */\n public orDefault(): T | undefined;\n public orDefault(dflt?: T): T | undefined {\n return dflt;\n }\n\n /**\n * {@inheritDoc IResult.getValueOrThrow}\n * @deprecated Use {@link Failure.orThrow | orThrow(logger)} or {@link Failure.orThrow | orThrow(formatter)} instead.\n */\n public getValueOrThrow(logger?: IResultLogger): never {\n if (logger !== undefined) {\n logger.error(this._message);\n }\n throw new Error(this._message);\n }\n\n /**\n * {@inheritDoc IResult.getValueOrDefault}\n * @deprecated Use {@link Failure.orDefault | orDefault(T)} or {@link Failure.orDefault | orDefault()} instead.\n */\n public getValueOrDefault(dflt?: T): T | undefined {\n return dflt;\n }\n\n /**\n * {@inheritDoc IResult.onSuccess}\n */\n public onSuccess<TN>(__: SuccessContinuation<T, TN>): Result<TN> {\n return new Failure(this._message);\n }\n\n /**\n * {@inheritDoc IResult.onFailure}\n */\n public onFailure(cb: FailureContinuation<T>): Result<T> {\n return cb(this._message);\n }\n\n /**\n * {@inheritDoc IResult.thenOnSuccess}\n */\n public thenOnSuccess<TN>(__: AsyncSuccessContinuation<T, TN>): AsyncResult<TN> {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return AsyncResult.from(fail<TN>(this._message));\n }\n\n /**\n * {@inheritDoc IResult.thenOnFailure}\n */\n public thenOnFailure(cb: AsyncFailureContinuation<T>): AsyncResult<T> {\n try {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return new AsyncResult(cb(this._message));\n } catch (err: unknown) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return AsyncResult.from(fail<T>(_errorMessage(err)));\n }\n }\n\n /**\n * {@inheritDoc IResult.withErrorFormat}\n */\n public withErrorFormat(cb: ErrorFormatter): Result<T> {\n return fail(cb(this._message));\n }\n\n /**\n * {@inheritDoc IResult.withFailureDetail}\n */\n public withFailureDetail<TD>(detail: TD): DetailedResult<T, TD> {\n return failWithDetail(this._message, detail);\n }\n\n /**\n * {@inheritDoc IResult.withDetail}\n */\n public withDetail<TD>(detail: TD, __successDetail?: TD): DetailedResult<T, TD> {\n return failWithDetail(this._message, detail);\n }\n\n /**\n * {@inheritDoc IResult.aggregateError}\n */\n public aggregateError(errors: IMessageAggregator, formatter?: ErrorFormatter): this {\n const message = formatter ? formatter(this._message) : this._message;\n errors.addMessage(message);\n return this;\n }\n\n /**\n * {@inheritDoc IResult.report}\n */\n public report(reporter?: IResultReporter<T>, options?: IResultReportOptions<unknown>): Failure<T> {\n const failureOptions =\n typeof options?.failure === 'object' ? options.failure : { level: options?.failure };\n const level = failureOptions.level ?? 'error';\n const message = failureOptions.message?.(this._message) ?? this._message;\n reporter?.reportFailure(level, message);\n return this;\n }\n\n /**\n * Get a 'friendly' string representation of this object.\n * @remarks\n * The string representation of a {@link Failure} value is the error message.\n * @returns A string representing this object.\n */\n public toString(): string {\n return this._message;\n }\n\n /**\n * Creates a {@link Failure | Failure<T>} with the supplied error message.\n * @param message - The error message to be returned.\n * @returns The resulting {@link Failure | Failure<T>} with the supplied error message.\n */\n public static with<T>(message: string): Failure<T> {\n return new Failure<T>(message);\n }\n}\n\n/**\n * Returns {@link Success | Success<T>} with the supplied result value.\n * @param value - The successful result value to be returned\n * @remarks\n * A `succeeds` alias was added in release 5.0 for\n * naming consistency with {@link fails | fails}, which was added\n * to avoid conflicts with test frameworks and libraries.\n * @public\n */\nexport function succeed<T>(value: T): Success<T> {\n return new Success<T>(value);\n}\n\n/**\n * {@inheritDoc succeed}\n * @public\n */\nexport function succeeds<T>(value: T): Success<T> {\n return new Success<T>(value);\n}\n\n/**\n * Returns {@link Failure | Failure<T>} with the supplied error message.\n * @param message - Error message to be returned.\n * @remarks\n * A `fails` alias was added in release 5.0 due to\n * issues with the name `fail` being used test frameworks and libraries.\n * @public\n */\nexport function fail<T>(message: string): Failure<T> {\n return new Failure<T>(message);\n}\n\n/**\n * {@inheritDoc fail}\n * @public\n */\nexport function fails<T>(message: string): Failure<T> {\n return new Failure<T>(message);\n}\n\n/**\n * Uses a value or calls a supplied initializer if the supplied value is undefined.\n * @param value - the value\n * @param initializer - a function that initializes the value if it is undefined\n * @returns `Success` with the value if it is defined, or the result of calling the initializer function.\n * @public\n */\nexport function useOrInitialize<T>(value: T | undefined, initializer: () => Result<T>): Result<T> {\n return value !== undefined ? succeed(value) : initializer();\n}\n\n/**\n * Callback to be called when a {@link DetailedResult | DetailedResult} encounters success.\n * @remarks\n * A success callback can return a different result type than it receives, allowing\n * success results to chain through intermediate result types.\n * @public\n */\nexport type DetailedSuccessContinuation<T, TD, TN> = (value: T, detail?: TD) => DetailedResult<TN, TD>;\n\n/**\n * Callback to be called when a {@link DetailedResult | DetailedResult} encounters a failure.\n * @remarks\n * A failure callback can change {@link DetailedFailure | DetailedFailure<T, TD>} to\n * {@link DetailedSuccess | DetailedSuccess<T, TD>} (e.g. by returning a default value)\n * or it can change or embellish the error message, but it cannot change the success return type.\n * @public\n */\nexport type DetailedFailureContinuation<T, TD> = (message: string, detail?: TD) => DetailedResult<T, TD>;\n\n/**\n * A {@link DetailedSuccess | DetailedSuccess} extends {@link Success | Success} to report optional success\n * details in addition to the error message.\n * @public\n */\nexport class DetailedSuccess<out T, out TD> extends Success<T> {\n /**\n * @internal\n */\n protected _detail?: TD;\n\n /**\n * Constructs a new {@link DetailedSuccess | DetailedSuccess<T, TD>} with the supplied\n * value and detail.\n * @param value - The value to be returned.\n * @param detail - An optional successful detail to be returned. If omitted, detail\n * will be `undefined`.\n */\n public constructor(value: T, detail?: TD) {\n super(value);\n this._detail = detail;\n }\n\n /**\n * The success detail associated with this {@link DetailedSuccess}, or `undefined` if\n * no detail was supplied.\n */\n public get detail(): TD | undefined {\n return this._detail;\n }\n\n /**\n * Reports that this {@link DetailedSuccess} is a success.\n * @remarks\n * Always true for {@link DetailedSuccess} but can be used as type guard\n * to discriminate {@link DetailedSuccess} from {@link DetailedFailure} in\n * a {@link DetailedResult}.\n * @returns `true`\n */\n public isSuccess(): this is DetailedSuccess<T, TD> {\n return true;\n }\n\n /**\n * Invokes the supplied {@link DetailedSuccessContinuation | success callback} and propagates\n * its returned {@link DetailedResult | DetailedResult<TN, TD>}.\n * @remarks\n * The success callback mutates the return type from `<T>` to `<TN>`.\n * @param cb - The {@link DetailedSuccessContinuation | success callback} to be invoked.\n * @returns The {@link DetailedResult | DetailedResult<T, TD>} returned by the success callback.\n */\n public onSuccess<TN>(cb: DetailedSuccessContinuation<T, TD, TN>): DetailedResult<TN, TD> {\n return cb(this._value, this._detail);\n }\n\n /**\n * Propagates this {@link DetailedSuccess}.\n * @remarks\n * Failure does not mutate return type so we can return this event directly.\n * @param __cb - {@link DetailedFailureContinuation | Failure callback} to be called\n * on a {@link DetailedResult} in case of failure (ignored).\n * @returns `this`\n */\n public onFailure(__cb: DetailedFailureContinuation<T, TD>): DetailedResult<T, TD> {\n return this;\n }\n\n /**\n * {@inheritDoc Success.withErrorFormat}\n */\n public withErrorFormat(cb: ErrorFormatter): DetailedResult<T, TD> {\n return this;\n }\n\n /**\n * {@inheritDoc IResult.report}\n */\n public report(\n reporter?: IResultReporter<T, unknown>,\n options?: IResultReportOptions<unknown>\n ): DetailedSuccess<T, TD> {\n const successOptions =\n typeof options?.success === 'object' ? options.success : { level: options?.success };\n const level = successOptions.level ?? 'quiet';\n // Cast reporter to preserve detail type when calling reportSuccess\n const detailedReporter = reporter as IResultReporter<T, TD> | undefined;\n detailedReporter?.reportSuccess(level, this._value, this._detail, successOptions.message);\n return this;\n }\n\n /**\n * Creates a {@link DetailedSuccess | DetailedSuccess<T, TD>} with the supplied value and\n * optional detail.\n */\n public static with<T, TD>(value: T, detail?: TD): DetailedSuccess<T, TD> {\n return new DetailedSuccess<T, TD>(value, detail);\n }\n\n /**\n * Returns this {@link DetailedSuccess} as a {@link Result}.\n */\n public get asResult(): Result<T> {\n return this;\n }\n}\n\n/**\n * A {@link DetailedFailure | DetailedFailure<T, TD>} extends {@link Failure | Failure<T>} to report optional\n * failure details in addition to the error message.\n * @public\n */\nexport class DetailedFailure<out T, out TD> extends Failure<T> {\n /**\n * @internal\n */\n protected _detail?: TD;\n\n /**\n * Constructs a new {@link DetailedFailure | DetailedFailure<T, TD>} with the supplied\n * message and detail.\n * @param message - The message to be returned.\n * @param detail - The error detail to be returned.\n */\n public constructor(message: string, detail?: TD) {\n super(message);\n this._detail = detail;\n }\n\n /**\n * The error detail associated with this {@link DetailedFailure}.\n */\n public get detail(): TD | undefined {\n return this._detail;\n }\n\n /**\n * Reports that this {@link DetailedFailure} is a failure.\n * @remarks\n * Always true for {@link DetailedFailure} but can be used as type guard\n * to discriminate {@link DetailedSuccess} from {@link DetailedFailure} in\n * a {@link DetailedResult}.\n * @returns `true`\n */\n public isFailure(): this is DetailedFailure<T, TD> {\n return true;\n }\n\n /**\n * Propagates the error message and detail from this result.\n * @remarks\n * Mutates the success type as the success callback would have, but does not\n * call the success callback.\n * @param __cb - {@link DetailedSuccessContinuation | Success callback} to be called\n * on a {@link DetailedResult} in case of success (ignored).\n * @returns A new {@link DetailedFailure | DetailedFailure<TN, TD>} which contains\n * the error message and detail from this one.\n */\n public onSuccess<TN>(__cb: DetailedSuccessContinuation<T, TD, TN>): DetailedResult<TN, TD> {\n return new DetailedFailure<TN, TD>(this._message, this._detail);\n }\n\n /**\n * Invokes the supplied {@link DetailedFailureContinuation | failure callback} and propagates\n * its returned {@link DetailedResult | DetailedResult<T, TD>}.\n * @param cb - The {@link DetailedFailureContinuation | failure callback} to be invoked.\n * @returns The {@link DetailedResult | DetailedResult<T, TD>} returned by the failure callback.\n */\n public onFailure(cb: DetailedFailureContinuation<T, TD>): DetailedResult<T, TD> {\n return cb(this._message, this._detail);\n }\n\n /**\n * {@inheritDoc IResult.withErrorFormat}\n */\n public withErrorFormat(cb: ErrorFormatter<TD>): DetailedResult<T, TD> {\n return failWithDetail(cb(this._message, this._detail), this._detail);\n }\n\n /**\n * {@inheritDoc IResult.aggregateError}\n */\n public aggregateError(errors: IMessageAggregator, formatter?: ErrorFormatter<TD>): this {\n const message = formatter ? formatter(this._message, this._detail) : this._message;\n errors.addMessage(message);\n return this;\n }\n\n /**\n * {@inheritDoc IResult.report}\n */\n public report(\n reporter?: IResultReporter<T, unknown>,\n options?: IResultReportOptions<unknown>\n ): DetailedFailure<T, TD> {\n const failureOptions =\n typeof options?.failure === 'object' ? options.failure : { level: options?.failure };\n const level = failureOptions.level ?? 'error';\n // Cast formatter to handle detail type properly\n const formatter = failureOptions.message as ErrorFormatter<TD> | undefined;\n const message = formatter?.(this._message, this._detail) ?? this._message;\n // Cast reporter to preserve detail type when calling reportFailure\n const detailedReporter = reporter as IResultReporter<T, TD> | undefined;\n detailedReporter?.reportFailure(level, message, this._detail);\n return this;\n }\n\n public orThrow(logOrFormat?: IResultLogger<TD> | ErrorFormatter<TD>): never;\n public orThrow(cb: ErrorFormatter): never;\n public orThrow(logOrFormat?: IResultLogger<TD> | ErrorFormatter<TD>): never {\n if (logOrFormat !== undefined) {\n if (typeof logOrFormat === 'function') {\n throw new Error(logOrFormat(this._message, this._detail));\n } else {\n logOrFormat.error(this._message, this._detail);\n }\n }\n throw new Error(this._message);\n }\n\n /**\n * Returns this {@link DetailedFailure} as a {@link Result}.\n */\n public get asResult(): Result<T> {\n return this;\n }\n\n /**\n * Creates a {@link DetailedFailure | DetailedFailure<T, TD>} with the supplied error message\n * and optional detail.\n * @param message - The error message to be returned.\n * @param detail - The error detail to be returned.\n * @returns The resulting {@link DetailedFailure | DetailedFailure<T, TD>} with the supplied\n * error message and detail.\n * @public\n */\n public static with<T, TD>(message: string, detail?: TD): DetailedFailure<T, TD> {\n return new DetailedFailure<T, TD>(message, detail);\n }\n}\n\n/**\n * Represents a result with additional detail.\n * @beta\n */\nexport type DetailedResult<T, TD> = DetailedSuccess<T, TD> | DetailedFailure<T, TD>;\n\n/**\n * Type inference to determine the result type `T` of a {@link DetailedResult | DetailedResult<T, TD>}.\n * @beta\n */\nexport type DetailedResultValueType<T> = T extends DetailedResult<infer TV, unknown> ? TV : never;\n\n/**\n * Type inference to determine the detail type `TD` of a {@link DetailedResult | DetailedResult<T, TD>}.\n * @beta\n */\nexport type ResultDetailType<T> = T extends DetailedResult<unknown, infer TD> ? TD : never;\n\n/**\n * Returns {@link DetailedSuccess | DetailedSuccess<T, TD>} with a supplied value and optional\n * detail.\n * @param value - The value of type `<T>` to be returned.\n * @param detail - An optional detail of type `<TD>` to be returned.\n * @returns A {@link DetailedSuccess | DetailedSuccess<T, TD>} with the supplied value\n * and detail, if supplied.\n * @remarks\n * The `succeedsWithDetail` alias was added in release 5.0 for\n * naming consistency with {@link fails | fails}, which was added to avoid conflicts\n * with test frameworks and libraries.\n * @public\n */\nexport function succeedWithDetail<T, TD>(value: T, detail?: TD): DetailedSuccess<T, TD> {\n return new DetailedSuccess<T, TD>(value, detail);\n}\n\n/**\n * {@inheritDoc succeedWithDetail}\n * @public\n */\nexport function succeedsWithDetail<T, TD>(value: T, detail?: TD): DetailedSuccess<T, TD> {\n return new DetailedSuccess<T, TD>(value, detail);\n}\n\n/**\n * Returns {@link DetailedFailure | DetailedFailure<T, TD>} with a supplied error message and detail.\n * @param message - The error message to be returned.\n * @param detail - The event detail to be returned.\n * @returns An {@link DetailedFailure | DetailedFailure<T, TD>} with the supplied error\n * message and detail.\n * @remarks\n * The `failsWithDetail` alias was added in release 5.0 for naming consistency\n * with {@link fails | fails}, which was added to avoid conflicts with test frameworks and libraries.\n * @public\n */\nexport function failWithDetail<T, TD>(message: string, detail?: TD): DetailedFailure<T, TD> {\n return new DetailedFailure<T, TD>(message, detail);\n}\n\n/**\n * {@inheritDoc failWithDetail}\n * @public\n */\nexport function failsWithDetail<T, TD>(message: string, detail?: TD): DetailedFailure<T, TD> {\n return new DetailedFailure<T, TD>(message, detail);\n}\n\n/**\n * Propagates a {@link Success} or {@link Failure} {@link Result}, adding supplied\n * event details as appropriate.\n * @param result - The {@link Result} to be propagated.\n * @param detail - The event detail (type `<TD>`) to be added to the {@link Result | result}.\n * @param successDetail - An optional distinct event detail to be added to {@link Success} results. If `successDetail`\n * is omitted or `undefined`, then `detail` will be applied to {@link Success} results.\n * @returns A new {@link DetailedResult | DetailedResult<T, TD>} with the success value or error\n * message from the original `result` but with the specified detail added.\n * @public\n */\nexport function propagateWithDetail<T, TD>(\n result: Result<T>,\n detail: TD,\n successDetail?: TD\n): DetailedResult<T, TD> {\n return result.isSuccess()\n ? succeedWithDetail(result.value, successDetail ?? detail)\n : failWithDetail(result.message, detail);\n}\n\n/**\n * Extracts a message string from an unknown thrown/rejected value.\n * @param err - The caught error value.\n * @returns The error message string.\n * @internal\n */\nexport function _errorMessage(err: unknown): string {\n if (err instanceof Error) {\n return err.message;\n }\n return String(err);\n}\n\n/**\n * Wraps a function which might throw to convert exception results\n * to {@link Failure}.\n * @param func - The function to be captured.\n * @returns Returns {@link Success} with a value of type `<T>` on\n * success , or {@link Failure} with the thrown error message if\n * `func` throws an `Error` or string.\n * @public\n */\nexport function captureResult<T>(func: () => T): Result<T> {\n try {\n return succeed(func());\n } catch (err) {\n return fail(_errorMessage(err));\n }\n}\n\n/**\n * Async continuation callback to be called in the event that a\n * {@link Result} is successful, returning a `Promise` of a new {@link Result}.\n * @public\n */\nexport type AsyncSuccessContinuation<T, TN> = (value: T) => Promise<Result<TN>>;\n\n/**\n * Async continuation callback to be called in the event that a\n * {@link Result} fails, returning a `Promise` of a new {@link Result}.\n * @public\n */\nexport type AsyncFailureContinuation<T> = (message: string) => Promise<Result<T>>;\n\n/**\n * Wraps a `Promise` of a {@link Result} to enable fluent chaining of both\n * synchronous and asynchronous operations.\n *\n * @remarks\n * `AsyncResult<T>` implements `PromiseLike` so it can be directly `await`ed.\n * Use the `thenOnSuccess` and `thenOnFailure` methods on {@link Result} to bridge\n * from synchronous to asynchronous result chains.\n *\n * @example\n * ```typescript\n * const result: Result<Final> = await parseInput(input)\n * .thenOnSuccess(async (parsed) => fetchData(parsed))\n * .onSuccess((data) => transform(data))\n * .thenOnSuccess(async (transformed) => saveData(transformed))\n * .withErrorFormat((msg) => `pipeline failed: ${msg}`);\n * ```\n *\n * @public\n */\nexport class AsyncResult<T> implements PromiseLike<Result<T>> {\n private readonly _promise: Promise<Result<T>>;\n\n /**\n * Constructs an {@link AsyncResult} wrapping the supplied promise.\n * @remarks\n * If the supplied promise rejects, the rejection is caught and converted\n * to a {@link Failure}, ensuring that awaiting an {@link AsyncResult} always\n * yields a {@link Result}.\n * @param promise - A `Promise` that resolves to a {@link Result}.\n */\n public constructor(promise: Promise<Result<T>>) {\n this._promise = promise.catch((err: unknown) => fail<T>(_errorMessage(err)));\n }\n\n /**\n * Calls a supplied {@link SuccessContinuation | success continuation} if\n * the wrapped result is successful.\n * @param cb - The synchronous {@link SuccessContinuation | success continuation}\n * to be called in the event of success.\n * @returns A new {@link AsyncResult} wrapping the continuation result.\n */\n public onSuccess<TN>(cb: SuccessContinuation<T, TN>): AsyncResult<TN> {\n return new AsyncResult(this._promise.then((r) => r.onSuccess(cb)));\n }\n\n /**\n * Calls a supplied {@link AsyncSuccessContinuation | async success continuation} if\n * the wrapped result is successful.\n * @remarks\n * Both synchronous throws and async rejections from the callback are caught\n * and converted to a {@link Failure}.\n * @param cb - The {@link AsyncSuccessContinuation | async success continuation}\n * to be called in the event of success.\n * @returns A new {@link AsyncResult} wrapping the async continuation result.\n */\n public thenOnSuccess<TN>(cb: AsyncSuccessContinuation<T, TN>): AsyncResult<TN> {\n return new AsyncResult(\n this._promise.then(async (r) => {\n if (r.isFailure()) {\n return fail<TN>(r.message);\n }\n try {\n return await cb(r.value);\n } catch (err: unknown) {\n return fail<TN>(_errorMessage(err));\n }\n })\n );\n }\n\n /**\n * Calls a supplied {@link FailureContinuation | failure continuation} if\n * the wrapped result is a failure.\n * @param cb - The synchronous {@link FailureContinuation | failure continuation}\n * to be called in the event of failure.\n * @returns A new {@link AsyncResult} wrapping the continuation result.\n */\n public onFailure(cb: FailureContinuation<T>): AsyncResult<T> {\n return new AsyncResult(this._promise.then((r) => r.onFailure(cb)));\n }\n\n /**\n * Calls a supplied {@link AsyncFailureContinuation | async failure continuation} if\n * the wrapped result is a failure.\n * @remarks\n * Both synchronous throws and async rejections from the callback are caught\n * and converted to a {@link Failure}.\n * @param cb - The {@link AsyncFailureContinuation | async failure continuation}\n * to be called in the event of failure.\n * @returns A new {@link AsyncResult} wrapping the async continuation result.\n */\n public thenOnFailure(cb: AsyncFailureContinuation<T>): AsyncResult<T> {\n return new AsyncResult(\n this._promise.then(async (r) => {\n if (r.isSuccess()) {\n return r;\n }\n try {\n return await cb(r.message);\n } catch (err: unknown) {\n return fail<T>(_errorMessage(err));\n }\n })\n );\n }\n\n /**\n * Calls a supplied {@link ErrorFormatter | error formatter} if\n * the wrapped result is a failure.\n * @param cb - The {@link ErrorFormatter | error formatter} to\n * be called in the event of failure.\n * @returns A new {@link AsyncResult} with the formatted error message,\n * or the original success result.\n */\n public withErrorFormat(cb: ErrorFormatter): AsyncResult<T> {\n return new AsyncResult(this._promise.then((r) => r.withErrorFormat(cb)));\n }\n\n /**\n * Propagates the wrapped result, appending any error message to the\n * supplied errors aggregator.\n * @param errors - {@link IMessageAggregator | Error aggregator} in which\n * errors will be aggregated.\n * @param formatter - An optional {@link ErrorFormatter | error formatter}\n * to be used to format the error message.\n * @returns A new {@link AsyncResult} wrapping the result after aggregation.\n */\n public aggregateError(errors: IMessageAggregator, formatter?: ErrorFormatter): AsyncResult<T> {\n return new AsyncResult(\n this._promise.then((r) => {\n r.aggregateError(errors, formatter);\n return r;\n })\n );\n }\n\n /**\n * Reports the wrapped result to the supplied reporter.\n * @param reporter - The {@link IResultReporter | reporter} to which the result\n * will be reported.\n * @param options - The {@link IResultReportOptions | options} for reporting the result.\n * @returns A new {@link AsyncResult} wrapping the result after reporting.\n */\n public report(reporter?: IResultReporter<T>, options?: IResultReportOptions<unknown>): AsyncResult<T> {\n return new AsyncResult(\n this._promise.then((r) => {\n r.report(reporter, options);\n return r;\n })\n );\n }\n\n /**\n * Implementation of `PromiseLike.then` enabling `await` on {@link AsyncResult}.\n * @param onfulfilled - Callback invoked when the promise resolves.\n * @param onrejected - Callback invoked when the promise rejects.\n * @returns A `Promise` resolving to the callback result.\n */\n /* eslint-disable @rushstack/no-new-null */\n public then<TResult1 = Result<T>, TResult2 = never>(\n onfulfilled?: ((value: Result<T>) => TResult1 | PromiseLike<TResult1>) | null,\n onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null\n ): Promise<TResult1 | TResult2> {\n /* eslint-enable @rushstack/no-new-null */\n return this._promise.then(onfulfilled, onrejected);\n }\n\n /**\n * Creates an {@link AsyncResult} from a {@link Result}.\n * @param result - The {@link Result} to wrap.\n * @returns A new {@link AsyncResult} wrapping the supplied result.\n */\n public static from<T>(result: Result<T>): AsyncResult<T> {\n return new AsyncResult(Promise.resolve(result));\n }\n}\n\n/**\n * Wraps an async function which might throw to convert exception results\n * to {@link Failure}.\n * @param func - The async function to be captured.\n * @returns Returns a `Promise` of {@link Success} with a value of type `<T>` on\n * success, or {@link Failure} with the thrown error message if `func` throws or rejects.\n * @public\n */\nexport async function captureAsyncResult<T>(func: () => Promise<T>): Promise<Result<T>> {\n try {\n return succeed(await func());\n } catch (err: unknown) {\n return fail(_errorMessage(err));\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/packlets/base/utils.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,MAAM,EAAiB,MAAM,UAAU,CAAC;AAEjD;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,GAAG,IAAI,MAAM,CAAC,CAEhG;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAQ3F;AAED;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,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AO,IAAA,aAAI,EAAC,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAA,gBAAO,EAAC,MAAM,CAAC,CAAC;AACzB,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CACjC,GAAoC,EACpC,OAAsC;IAEtC,OAAO,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,IAAA,gBAAO,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC5E,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,gCAAgC,CAC9C,GAAoC,EACpC,OAAsC;IAEtC,OAAO,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,IAAA,gBAAO,EAAC,EAAoB,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACvF,CAAC","sourcesContent":["/*\r\n * Copyright (c) 2020 Erik Fortune\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in all\r\n * copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\r\n\r\nimport { Result, fail, succeed } from './result';\r\n\r\n/**\r\n * Helper type-guard function to report whether a specified key is present in\r\n * a supplied object.\r\n * @param key - The key to be tested.\r\n * @param item - The object to be tested.\r\n * @returns Returns `true` if the key is present, `false` otherwise.\r\n * @public\r\n */\r\nexport function isKeyOf<T extends object>(key: string | number | symbol, item: T): key is keyof T {\r\n return item.hasOwnProperty(key);\r\n}\r\n\r\n/**\r\n * Simple implicit pick function, which picks a set of properties from a supplied\r\n * object. Ignores picked properties that do not exist regardless of type signature.\r\n * @param from - The object from which keys are to be picked.\r\n * @param include - The keys of the properties to be picked from `from`.\r\n * @returns A new object containing the requested properties from `from`, where present.\r\n * @public\r\n */\r\nexport function pick<T extends object, K extends keyof T>(from: T, include: K[]): Pick<T, K> {\r\n const rtrn: Partial<Pick<T, K>> = {};\r\n for (const key of include) {\r\n if (key in from) {\r\n rtrn[key] = from[key];\r\n }\r\n }\r\n return rtrn as Pick<T, K>;\r\n}\r\n\r\n/**\r\n * Simple implicit omit function, which picks all of the properties from a supplied\r\n * object except those specified for exclusion.\r\n * @param from - The object from which keys are to be picked.\r\n * @param exclude - The keys of the properties to be excluded from the returned object.\r\n * @returns A new object containing all of the properties from `from` that were not\r\n * explicitly excluded.\r\n * @public\r\n */\r\nexport function omit<T extends object, K extends keyof T>(from: T, exclude: K[]): Omit<T, K> {\r\n const rtrn: Partial<Omit<T, K>> = {};\r\n for (const entry of Object.entries(from).filter((e) => !exclude.includes(e[0] as keyof T as K))) {\r\n rtrn[entry[0] as unknown as keyof Omit<T, K>] = entry[1];\r\n }\r\n\r\n return rtrn as Omit<T, K>;\r\n}\r\n\r\n/**\r\n * Type-safe(ish) key extractor for typed records.\r\n * @param obj - The record from which keys are to be extracted.\r\n * @returns The keys of the record as an array.\r\n * @public\r\n */\r\nexport function keysForRecord<TK extends string>(obj: Record<TK, unknown>): TK[] {\r\n return Object.keys(obj) as TK[];\r\n}\r\n\r\n/**\r\n * Type-safe(ish) value extractor for typed records.\r\n * @param obj - The record from which values are to be extracted.\r\n * @returns The values of the record as an array.\r\n * @public\r\n */\r\nexport function valuesForRecord<TK extends string, TV>(obj: Record<TK, TV>): TV[] {\r\n return Object.values(obj) as TV[];\r\n}\r\n\r\n/**\r\n * Type-safe(ish) entries extractor for typed records.\r\n * @param obj - The record from which entries are to be extracted.\r\n * @returns The entries of the record as an array of `[key, value]` tuples.\r\n * @public\r\n */\r\nexport function entriesForRecord<TK extends string, TV>(obj: Record<TK, TV>): Array<[TK, TV]> {\r\n return Object.entries(obj) as Array<[TK, TV]>;\r\n}\r\n\r\n/**\r\n * Type-safe(ish) record constructor from an iterable of `[key, value]` tuples.\r\n * @param entries - The iterable of `[key, value]` tuples from which to construct the record.\r\n * @returns A record constructed from the supplied entries.\r\n * @public\r\n */\r\nexport function recordFromEntries<TK extends string, TV>(entries: Iterable<[TK, TV]>): Record<TK, TV> {\r\n return Object.fromEntries(entries) as Record<TK, TV>;\r\n}\r\n\r\n/**\r\n * Helper type to extract the element type and preserve readonly status.\r\n * @public\r\n */\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nexport type EnsureArrayResult<T> = T extends readonly (infer _U)[] ? T : T[];\r\n\r\n/**\r\n * Ensures the input is an array. If already an array, returns it as-is.\r\n * If a single item, wraps it in an array.\r\n * Preserves readonly status of input arrays.\r\n * @param items - A single item or an array of items.\r\n * @returns The input array unchanged, or a new array containing the single item.\r\n * @public\r\n */\r\nexport function ensureArray<T>(items: T): EnsureArrayResult<T> {\r\n return (Array.isArray(items) ? items : [items]) as EnsureArrayResult<T>;\r\n}\r\n\r\n/**\r\n * Gets the value of a property specified by key from an arbitrary object,\r\n * or a default value if the property does not exist.\r\n * @param key - The key specifying the property to be retrieved.\r\n * @param item - The object from which the property is to be retrieved.\r\n * @param defaultValue - An optional default value to be returned if the property\r\n * is not present (default `undefined`).\r\n * @returns The value of the requested property, or the default value if the\r\n * requested property does not exist.\r\n * @public\r\n */\r\nexport function getValueOfPropertyOrDefault<T extends object>(\r\n key: string | number | symbol,\r\n item: T,\r\n defaultValue?: unknown\r\n): unknown | undefined {\r\n return isKeyOf(key, item) ? item[key] : defaultValue;\r\n}\r\n\r\n/**\r\n * Gets the type of a property specified by key from an arbitrary object.\r\n * @param key - The key specifying the property to be tested.\r\n * @param item - The object from which the property is to be tested.\r\n * @returns The type of the requested property, or `undefined` if the\r\n * property does not exist.\r\n * @example\r\n * Returns `'undefined'` (a string) if the property exists but has the value\r\n * undefined but `undefined` (the literal) if the property does not exist.\r\n * @public\r\n */\r\nexport function getTypeOfProperty<T extends object>(\r\n key: string | number | symbol,\r\n item: T\r\n):\r\n | 'string'\r\n | 'number'\r\n | 'bigint'\r\n | 'boolean'\r\n | 'symbol'\r\n | 'undefined'\r\n | 'undefined'\r\n | 'object'\r\n | 'function'\r\n | undefined {\r\n return isKeyOf(key, item) ? typeof item[key] : undefined;\r\n}\r\n\r\n/**\r\n * Type for factory methods which convert a key-value pair to a new unique value.\r\n * @public\r\n */\r\ntype KeyedThingFactory<TS, TD, TK extends string = string> = (key: TK, thing: TS) => Result<TD>;\r\n\r\n/**\r\n * Applies a factory method to convert a `Record<TK, TS>` into a `Map<TK, TD>`.\r\n * @param src - The `Record` to be converted.\r\n * @param factory - The factory method used to convert elements.\r\n * @returns {@link Success} with the resulting map on success, or {@link Failure} with a\r\n * message if an error occurs.\r\n * @public\r\n */\r\nexport function recordToMap<TS, TD, TK extends string = string>(\r\n src: Record<TK, TS>,\r\n factory: KeyedThingFactory<TS, TD, TK>\r\n): Result<Map<TK, TD>> {\r\n const map = new Map<TK, TD>();\r\n for (const key in src) {\r\n if (src[key] !== undefined) {\r\n const itemResult = factory(key, src[key]);\r\n if (itemResult.isSuccess()) {\r\n map.set(key, itemResult.value);\r\n } else {\r\n return fail(`${key}: ${itemResult.message}`);\r\n }\r\n }\r\n }\r\n return succeed(map);\r\n}\r\n\r\n/**\r\n * Applies a factory method to convert an optional `Record<TK, TS>` into a `Map<TK, TD>`, or `undefined`.\r\n * @param src - The `Record` to be converted, or undefined.\r\n * @param factory - The factory method used to convert elements.\r\n * @returns {@link Success} with the resulting map if conversion succeeds, or {@link Success} with `undefined`\r\n * if `src` is `undefined`. Returns {@link Failure} with a message if an error occurs.\r\n * @public\r\n */\r\nexport function optionalRecordToMap<TS, TD, TK extends string = string>(\r\n src: Record<TK, TS> | undefined,\r\n factory: KeyedThingFactory<TS, TD, TK>\r\n): Result<Map<TK, TD> | undefined> {\r\n return src === undefined ? succeed(undefined) : recordToMap(src, factory);\r\n}\r\n\r\n/**\r\n * Applies a factory method to convert an optional `Record<TK, TS>` into a `Map<TK, TD>`\r\n * @param src - The `Record` to be converted, or `undefined`.\r\n * @param factory - The factory method used to convert elements.\r\n * @returns {@link Success} with the resulting map (empty if `src` is `undefined`) if conversion succeeds.\r\n * Returns {@link Failure} with a message if an error occurs.\r\n * @public\r\n */\r\nexport function optionalRecordToPossiblyEmptyMap<TS, TD, TK extends string = string>(\r\n src: Record<TK, TS> | undefined,\r\n factory: KeyedThingFactory<TS, TD, TK>\r\n): Result<Map<TK, TD>> {\r\n return src === undefined ? succeed(new Map<TK, TD>()) : recordToMap(src, factory);\r\n}\r\n\r\n/**\r\n * Applies a factory method to convert a `ReadonlyMap<TK, TS>` into a `Record<TK, TD>`.\r\n * @param src - The `Map` object to be converted.\r\n * @param factory - The factory method used to convert elements.\r\n * @returns {@link Success} with the resulting `Record<TK, TD>` if conversion succeeds, or\r\n * {@link Failure} with an error message if an error occurs.\r\n * @public\r\n */\r\nexport function mapToRecord<TS, TD, TK extends string = string>(\r\n src: ReadonlyMap<TK, TS>,\r\n factory: KeyedThingFactory<TS, TD, TK>\r\n): Result<Record<TK, TD>> {\r\n const record: Record<TK, TD> = {} as Record<TK, TD>;\r\n for (const kvp of src) {\r\n if (kvp[1] !== undefined) {\r\n const itemResult = factory(kvp[0], kvp[1]);\r\n if (itemResult.isSuccess()) {\r\n record[kvp[0]] = itemResult.value;\r\n } else {\r\n return fail(`${kvp[0]}: ${itemResult.message}`);\r\n }\r\n }\r\n }\r\n return succeed(record);\r\n}\r\n\r\n/**\r\n * Applies a factory method to convert an optional `ReadonlyMap<string, TS>` into a `Record<string, TD>` or `undefined`.\r\n * @param src - The `Map` object to be converted, or `undefined`.\r\n * @param factory - The factory method used to convert elements.\r\n * @returns {@link Success} with the resulting record if conversion succeeds, or {@link Success} with `undefined` if\r\n * `src` is `undefined`. Returns {@link Failure} with a message if an error occurs.\r\n * @public\r\n */\r\nexport function optionalMapToRecord<TS, TD, TK extends string = string>(\r\n src: ReadonlyMap<TK, TS> | undefined,\r\n factory: KeyedThingFactory<TS, TD, TK>\r\n): Result<Record<TK, TD> | undefined> {\r\n return src === undefined ? succeed(undefined) : mapToRecord(src, factory);\r\n}\r\n\r\n/**\r\n * Applies a factory method to convert an optional `ReadonlyMap<string, TS>` into a `Record<string, TD>`\r\n * @param src - The `ReadonlyMap` object to be converted, or `undefined`.\r\n * @param factory - The factory method used to convert elements.\r\n * @returns {@link Success} with the resulting record (empty if `src` is `undefined`) if conversion succeeds.\r\n * Returns {@link Failure} with a message if an error occurs.\r\n * @public\r\n */\r\nexport function optionalMapToPossiblyEmptyRecord<TS, TD, TK extends string = string>(\r\n src: ReadonlyMap<TK, TS> | undefined,\r\n factory: KeyedThingFactory<TS, TD, TK>\r\n): Result<Record<TK, TD>> {\r\n return src === undefined ? succeed({} as Record<TK, TD>) : mapToRecord(src, factory);\r\n}\r\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregatedResultMap.d.ts","sourceRoot":"","sources":["../../../src/packlets/collections/aggregatedResultMap.ts"],"names":[],"mappings":"AAsBA,OAAO,EAEL,cAAc,EACd,MAAM,EAMP,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAc,MAAM,eAAe,CAA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