@twin.org/core 0.0.2-next.9 → 0.0.2

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 (225) hide show
  1. package/README.md +1 -9
  2. package/dist/es/encoding/base32.js +75 -0
  3. package/dist/es/encoding/base32.js.map +1 -0
  4. package/dist/es/encoding/base58.js +124 -0
  5. package/dist/es/encoding/base58.js.map +1 -0
  6. package/dist/es/encoding/base64.js +231 -0
  7. package/dist/es/encoding/base64.js.map +1 -0
  8. package/dist/es/encoding/base64Url.js +42 -0
  9. package/dist/es/encoding/base64Url.js.map +1 -0
  10. package/dist/es/errors/alreadyExistsError.js +22 -0
  11. package/dist/es/errors/alreadyExistsError.js.map +1 -0
  12. package/dist/es/errors/baseError.js +257 -0
  13. package/dist/es/errors/baseError.js.map +1 -0
  14. package/dist/es/errors/conflictError.js +23 -0
  15. package/dist/es/errors/conflictError.js.map +1 -0
  16. package/dist/es/errors/generalError.js +21 -0
  17. package/dist/es/errors/generalError.js.map +1 -0
  18. package/dist/es/errors/guardError.js +27 -0
  19. package/dist/es/errors/guardError.js.map +1 -0
  20. package/dist/es/errors/notFoundError.js +22 -0
  21. package/dist/es/errors/notFoundError.js.map +1 -0
  22. package/dist/es/errors/notImplementedError.js +24 -0
  23. package/dist/es/errors/notImplementedError.js.map +1 -0
  24. package/dist/es/errors/notSupportedError.js +21 -0
  25. package/dist/es/errors/notSupportedError.js.map +1 -0
  26. package/dist/es/errors/unauthorizedError.js +21 -0
  27. package/dist/es/errors/unauthorizedError.js.map +1 -0
  28. package/dist/es/errors/unprocessableError.js +21 -0
  29. package/dist/es/errors/unprocessableError.js.map +1 -0
  30. package/dist/es/errors/validationError.js +23 -0
  31. package/dist/es/errors/validationError.js.map +1 -0
  32. package/dist/es/factories/componentFactory.js +9 -0
  33. package/dist/es/factories/componentFactory.js.map +1 -0
  34. package/dist/es/factories/factory.js +297 -0
  35. package/dist/es/factories/factory.js.map +1 -0
  36. package/dist/es/helpers/arrayHelper.js +46 -0
  37. package/dist/es/helpers/arrayHelper.js.map +1 -0
  38. package/dist/es/helpers/envHelper.js +39 -0
  39. package/dist/es/helpers/envHelper.js.map +1 -0
  40. package/dist/es/helpers/errorHelper.js +100 -0
  41. package/dist/es/helpers/errorHelper.js.map +1 -0
  42. package/dist/es/helpers/filenameHelper.js +32 -0
  43. package/dist/es/helpers/filenameHelper.js.map +1 -0
  44. package/dist/es/helpers/hexHelper.js +45 -0
  45. package/dist/es/helpers/hexHelper.js.map +1 -0
  46. package/dist/es/helpers/jsonHelper.js +163 -0
  47. package/dist/es/helpers/jsonHelper.js.map +1 -0
  48. package/dist/es/helpers/numberHelper.js +30 -0
  49. package/dist/es/helpers/numberHelper.js.map +1 -0
  50. package/dist/es/helpers/objectHelper.js +309 -0
  51. package/dist/es/helpers/objectHelper.js.map +1 -0
  52. package/dist/es/helpers/randomHelper.js +66 -0
  53. package/dist/es/helpers/randomHelper.js.map +1 -0
  54. package/dist/es/helpers/stringHelper.js +252 -0
  55. package/dist/es/helpers/stringHelper.js.map +1 -0
  56. package/dist/es/helpers/uint8ArrayHelper.js +26 -0
  57. package/dist/es/helpers/uint8ArrayHelper.js.map +1 -0
  58. package/dist/es/index.js +60 -0
  59. package/dist/es/index.js.map +1 -0
  60. package/dist/es/models/IComponent.js +2 -0
  61. package/dist/es/models/IComponent.js.map +1 -0
  62. package/dist/es/models/IError.js +4 -0
  63. package/dist/es/models/IError.js.map +1 -0
  64. package/dist/es/models/IHealth.js +2 -0
  65. package/dist/es/models/IHealth.js.map +1 -0
  66. package/dist/es/models/II18nShared.js +2 -0
  67. package/dist/es/models/II18nShared.js.map +1 -0
  68. package/dist/es/models/IKeyValue.js +2 -0
  69. package/dist/es/models/IKeyValue.js.map +1 -0
  70. package/dist/es/models/ILabelledValue.js +2 -0
  71. package/dist/es/models/ILabelledValue.js.map +1 -0
  72. package/dist/es/models/ILocale.js +2 -0
  73. package/dist/es/models/ILocale.js.map +1 -0
  74. package/dist/es/models/ILocaleDictionary.js +4 -0
  75. package/dist/es/models/ILocaleDictionary.js.map +1 -0
  76. package/dist/es/models/ILocalesIndex.js +2 -0
  77. package/dist/es/models/ILocalesIndex.js.map +1 -0
  78. package/dist/es/models/IPatchOperation.js +4 -0
  79. package/dist/es/models/IPatchOperation.js.map +1 -0
  80. package/dist/es/models/IUrlParts.js +4 -0
  81. package/dist/es/models/IUrlParts.js.map +1 -0
  82. package/dist/es/models/IValidationFailure.js +2 -0
  83. package/dist/es/models/IValidationFailure.js.map +1 -0
  84. package/dist/es/models/coerceType.js +49 -0
  85. package/dist/es/models/coerceType.js.map +1 -0
  86. package/dist/es/models/compressionType.js +17 -0
  87. package/dist/es/models/compressionType.js.map +1 -0
  88. package/dist/es/models/healthStatus.js +21 -0
  89. package/dist/es/models/healthStatus.js.map +1 -0
  90. package/dist/es/types/bitString.js +98 -0
  91. package/dist/es/types/bitString.js.map +1 -0
  92. package/dist/es/types/objectOrArray.js +2 -0
  93. package/dist/es/types/objectOrArray.js.map +1 -0
  94. package/dist/es/types/singleOccurrenceArray.js +2 -0
  95. package/dist/es/types/singleOccurrenceArray.js.map +1 -0
  96. package/dist/es/types/url.js +144 -0
  97. package/dist/es/types/url.js.map +1 -0
  98. package/dist/es/types/urn.js +211 -0
  99. package/dist/es/types/urn.js.map +1 -0
  100. package/dist/es/utils/asyncCache.js +206 -0
  101. package/dist/es/utils/asyncCache.js.map +1 -0
  102. package/dist/es/utils/coerce.js +269 -0
  103. package/dist/es/utils/coerce.js.map +1 -0
  104. package/dist/es/utils/compression.js +49 -0
  105. package/dist/es/utils/compression.js.map +1 -0
  106. package/dist/es/utils/converter.js +256 -0
  107. package/dist/es/utils/converter.js.map +1 -0
  108. package/dist/es/utils/guards.js +385 -0
  109. package/dist/es/utils/guards.js.map +1 -0
  110. package/dist/es/utils/i18n.js +243 -0
  111. package/dist/es/utils/i18n.js.map +1 -0
  112. package/dist/es/utils/is.js +367 -0
  113. package/dist/es/utils/is.js.map +1 -0
  114. package/dist/es/utils/sharedStore.js +48 -0
  115. package/dist/es/utils/sharedStore.js.map +1 -0
  116. package/dist/es/utils/validation.js +774 -0
  117. package/dist/es/utils/validation.js.map +1 -0
  118. package/dist/types/encoding/base32.d.ts +5 -1
  119. package/dist/types/encoding/base58.d.ts +4 -0
  120. package/dist/types/encoding/base64.d.ts +4 -0
  121. package/dist/types/encoding/base64Url.d.ts +4 -0
  122. package/dist/types/errors/alreadyExistsError.d.ts +6 -3
  123. package/dist/types/errors/baseError.d.ts +2 -2
  124. package/dist/types/errors/conflictError.d.ts +6 -3
  125. package/dist/types/errors/generalError.d.ts +2 -2
  126. package/dist/types/errors/guardError.d.ts +2 -2
  127. package/dist/types/errors/notFoundError.d.ts +6 -3
  128. package/dist/types/errors/notImplementedError.d.ts +6 -2
  129. package/dist/types/errors/notSupportedError.d.ts +6 -3
  130. package/dist/types/errors/unauthorizedError.d.ts +7 -4
  131. package/dist/types/errors/unprocessableError.d.ts +2 -2
  132. package/dist/types/errors/validationError.d.ts +2 -2
  133. package/dist/types/factories/componentFactory.d.ts +2 -2
  134. package/dist/types/factories/factory.d.ts +27 -1
  135. package/dist/types/helpers/arrayHelper.d.ts +1 -8
  136. package/dist/types/helpers/errorHelper.d.ts +1 -1
  137. package/dist/types/helpers/jsonHelper.d.ts +5 -1
  138. package/dist/types/helpers/numberHelper.d.ts +17 -0
  139. package/dist/types/helpers/objectHelper.d.ts +24 -6
  140. package/dist/types/helpers/randomHelper.d.ts +16 -0
  141. package/dist/types/helpers/stringHelper.d.ts +12 -6
  142. package/dist/types/index.d.ts +57 -53
  143. package/dist/types/models/IComponent.d.ts +18 -7
  144. package/dist/types/models/IError.d.ts +1 -1
  145. package/dist/types/models/IHealth.d.ts +32 -0
  146. package/dist/types/models/ILocalesIndex.d.ts +1 -1
  147. package/dist/types/models/IValidationFailure.d.ts +0 -4
  148. package/dist/types/models/healthStatus.d.ts +21 -0
  149. package/dist/types/types/bitString.d.ts +4 -0
  150. package/dist/types/types/singleOccurrenceArray.d.ts +9 -0
  151. package/dist/types/types/url.d.ts +8 -3
  152. package/dist/types/types/urn.d.ts +7 -2
  153. package/dist/types/utils/asyncCache.d.ts +7 -0
  154. package/dist/types/utils/coerce.d.ts +1 -1
  155. package/dist/types/utils/compression.d.ts +5 -1
  156. package/dist/types/utils/guards.d.ts +11 -3
  157. package/dist/types/utils/i18n.d.ts +16 -1
  158. package/dist/types/utils/is.d.ts +8 -1
  159. package/dist/types/utils/validation.d.ts +1 -1
  160. package/docs/changelog.md +1224 -131
  161. package/docs/examples.md +308 -1
  162. package/docs/reference/classes/AlreadyExistsError.md +43 -39
  163. package/docs/reference/classes/ArrayHelper.md +10 -44
  164. package/docs/reference/classes/AsyncCache.md +12 -12
  165. package/docs/reference/classes/Base32.md +11 -3
  166. package/docs/reference/classes/Base58.md +10 -2
  167. package/docs/reference/classes/Base64.md +11 -3
  168. package/docs/reference/classes/Base64Url.md +10 -2
  169. package/docs/reference/classes/BaseError.md +37 -37
  170. package/docs/reference/classes/BitString.md +13 -5
  171. package/docs/reference/classes/Coerce.md +31 -31
  172. package/docs/reference/classes/Compression.md +10 -2
  173. package/docs/reference/classes/ConflictError.md +43 -39
  174. package/docs/reference/classes/Converter.md +18 -18
  175. package/docs/reference/classes/EnvHelper.md +1 -1
  176. package/docs/reference/classes/ErrorHelper.md +5 -5
  177. package/docs/reference/classes/Factory.md +122 -20
  178. package/docs/reference/classes/FilenameHelper.md +1 -1
  179. package/docs/reference/classes/GeneralError.md +38 -38
  180. package/docs/reference/classes/GuardError.md +38 -38
  181. package/docs/reference/classes/Guards.md +80 -34
  182. package/docs/reference/classes/HexHelper.md +6 -6
  183. package/docs/reference/classes/I18n.md +66 -14
  184. package/docs/reference/classes/Is.md +77 -43
  185. package/docs/reference/classes/JsonHelper.md +17 -9
  186. package/docs/reference/classes/NotFoundError.md +43 -39
  187. package/docs/reference/classes/NotImplementedError.md +48 -38
  188. package/docs/reference/classes/NotSupportedError.md +43 -39
  189. package/docs/reference/classes/NumberHelper.md +55 -0
  190. package/docs/reference/classes/ObjectHelper.md +163 -51
  191. package/docs/reference/classes/RandomHelper.md +53 -1
  192. package/docs/reference/classes/SharedStore.md +5 -5
  193. package/docs/reference/classes/StringHelper.md +52 -30
  194. package/docs/reference/classes/Uint8ArrayHelper.md +1 -1
  195. package/docs/reference/classes/UnauthorizedError.md +44 -40
  196. package/docs/reference/classes/UnprocessableError.md +38 -38
  197. package/docs/reference/classes/Url.md +24 -10
  198. package/docs/reference/classes/Urn.md +42 -28
  199. package/docs/reference/classes/Validation.md +27 -27
  200. package/docs/reference/classes/ValidationError.md +37 -37
  201. package/docs/reference/index.md +6 -0
  202. package/docs/reference/interfaces/IComponent.md +57 -27
  203. package/docs/reference/interfaces/IError.md +11 -11
  204. package/docs/reference/interfaces/IHealth.md +55 -0
  205. package/docs/reference/interfaces/II18nShared.md +4 -4
  206. package/docs/reference/interfaces/IKeyValue.md +2 -2
  207. package/docs/reference/interfaces/ILabelledValue.md +2 -2
  208. package/docs/reference/interfaces/ILocale.md +2 -2
  209. package/docs/reference/interfaces/ILocaleDictionary.md +1 -1
  210. package/docs/reference/interfaces/ILocalesIndex.md +1 -1
  211. package/docs/reference/interfaces/IPatchOperation.md +6 -6
  212. package/docs/reference/interfaces/IUrlParts.md +9 -9
  213. package/docs/reference/interfaces/IValidationFailure.md +4 -12
  214. package/docs/reference/type-aliases/HealthStatus.md +5 -0
  215. package/docs/reference/type-aliases/SingleOccurrenceArray.md +15 -0
  216. package/docs/reference/type-aliases/SingleOccurrenceArrayDepthHelper.md +19 -0
  217. package/docs/reference/variables/CoerceType.md +10 -10
  218. package/docs/reference/variables/CompressionType.md +2 -2
  219. package/docs/reference/variables/HealthStatus.md +25 -0
  220. package/locales/.validate-ignore +1 -0
  221. package/locales/en.json +9 -7
  222. package/package.json +24 -12
  223. package/dist/cjs/index.cjs +0 -5175
  224. package/dist/esm/index.mjs +0 -5133
  225. /package/dist/types/{models → types}/objectOrAr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I,WAAW,EAAE,CAAC;gBAChC,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;YAC1B,CAAC;QACF,CAAC;QAED,KAAK,MAAM,iBAAiB,IAAI,QAAQ,EAAE,CAAC;YAC1C,IAAI,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;gBACvD,WAAW,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YACjE,CAAC;iBAAM,CAAC;gBACP,WAAW,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;YAC/D,CAAC;QACF,CAAC;IACF,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Is } from \"./is.js\";\nimport { ValidationError } from \"../errors/validationError.js\";\nimport type { IValidationFailure } from \"../models/IValidationFailure.js\";\n\n/**\n * Class to handle validation operations.\n */\nexport class Validation {\n\t/**\n\t * Is the property null or undefined.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @returns True if the value is a empty.\n\t */\n\tpublic static empty(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string\n\t): value is undefined | null {\n\t\tconst is = Is.empty(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beEmpty\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t}\n\t\treturn is;\n\t}\n\n\t/**\n\t * Is the property is not null or undefined.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @returns True if the value is a not empty.\n\t */\n\tpublic static notEmpty(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string\n\t): boolean {\n\t\tconst is = Is.notEmpty(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beNotEmpty\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t}\n\t\treturn is;\n\t}\n\n\t/**\n\t * Is the property a string.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @param options Additional options for the validation.\n\t * @param options.minLength The minimum length of the string.\n\t * @param options.maxLength The maximum length of the string.\n\t * @param options.format Specific format to check.\n\t * @returns True if the value is a valid string.\n\t */\n\tpublic static string(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string,\n\t\toptions?: {\n\t\t\tformat?: \"base64\" | \"base58\" | \"hex\" | RegExp;\n\t\t\tminLength?: number;\n\t\t\tmaxLength?: number;\n\t\t}\n\t): value is string {\n\t\tconst is = Is.string(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beText\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t} else {\n\t\t\tconst minLength = options?.minLength;\n\t\t\tconst maxLength = options?.maxLength;\n\t\t\tconst minLimitDefined = Is.integer(minLength);\n\t\t\tconst maxLimitDefined = Is.integer(maxLength);\n\t\t\tconst belowMin = minLimitDefined && value.length < minLength;\n\t\t\tconst aboveMax = maxLimitDefined && value.length > maxLength;\n\n\t\t\tif (options?.format === \"base58\" && !Is.stringBase58(value)) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beTextBase58\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (options?.format === \"base64\" && !Is.stringBase64(value)) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beTextBase64\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (options?.format === \"hex\" && !Is.stringHex(value)) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beTextHex\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (Is.regexp(options?.format) && !options.format.test(value)) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beTextRegExp\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tformat: options?.format\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (minLimitDefined && maxLimitDefined && (belowMin || aboveMax)) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beTextMinMax\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tminLength,\n\t\t\t\t\t\tmaxLength\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (minLimitDefined && belowMin) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beTextMin\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tminLength\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (maxLimitDefined && aboveMax) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beTextMax\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tmaxLength\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn failures.length === 0;\n\t}\n\n\t/**\n\t * Is the property a string with a value.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @param options Additional options for the validation.\n\t * @param options.minLength The minimum length of the string.\n\t * @param options.maxLength The maximum length of the string.\n\t * @returns True if the value is a valid string.\n\t */\n\tpublic static stringValue(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string,\n\t\toptions?: {\n\t\t\tminLength?: number;\n\t\t\tmaxLength?: number;\n\t\t}\n\t): value is string {\n\t\tconst is = Is.stringValue(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beTextValue\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t} else {\n\t\t\tconst minLength = options?.minLength;\n\t\t\tconst maxLength = options?.maxLength;\n\t\t\tconst minLimitDefined = Is.integer(minLength);\n\t\t\tconst maxLimitDefined = Is.integer(maxLength);\n\t\t\tconst belowMin = minLimitDefined && value.length < minLength;\n\t\t\tconst aboveMax = maxLimitDefined && value.length > maxLength;\n\n\t\t\tif (minLimitDefined && maxLimitDefined && (belowMin || aboveMax)) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beTextMinMax\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tminLength,\n\t\t\t\t\t\tmaxLength\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (minLimitDefined && belowMin) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beTextMin\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tminLength\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (maxLimitDefined && aboveMax) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beTextMax\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tmaxLength\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn failures.length === 0;\n\t}\n\n\t/**\n\t * Is the property a number.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @param options Additional options for the validation.\n\t * @param options.minValue The minimum value of the number.\n\t * @param options.maxValue The maximum value of the number.\n\t * @returns True if the value is a valid number.\n\t */\n\tpublic static number(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string,\n\t\toptions?: {\n\t\t\tminValue?: number;\n\t\t\tmaxValue?: number;\n\t\t}\n\t): value is number {\n\t\tconst is = Is.number(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beNumber\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t} else {\n\t\t\tconst minValue = options?.minValue;\n\t\t\tconst maxValue = options?.maxValue;\n\t\t\tconst minLimitDefined = Is.number(minValue);\n\t\t\tconst maxLimitDefined = Is.number(maxValue);\n\t\t\tconst belowMin = minLimitDefined && value < minValue;\n\t\t\tconst aboveMax = maxLimitDefined && value > maxValue;\n\n\t\t\tif (minLimitDefined && maxLimitDefined && (belowMin || aboveMax)) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beNumberMinMax\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tminValue,\n\t\t\t\t\t\tmaxValue\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (minLimitDefined && belowMin) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beNumberMin\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tminValue\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (maxLimitDefined && aboveMax) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beNumberMax\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tmaxValue\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn failures.length === 0;\n\t}\n\n\t/**\n\t * Is the property an integer.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @param options Additional options for the validation.\n\t * @param options.minValue The minimum value of the integer.\n\t * @param options.maxValue The maximum value of the integer.\n\t * @returns True if the value is a valid integer.\n\t */\n\tpublic static integer(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string,\n\t\toptions?: {\n\t\t\tminValue?: number;\n\t\t\tmaxValue?: number;\n\t\t}\n\t): value is number {\n\t\tconst is = Is.integer(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beWholeNumber\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t} else {\n\t\t\tconst minValue = options?.minValue;\n\t\t\tconst maxValue = options?.maxValue;\n\t\t\tconst minLimitDefined = Is.integer(minValue);\n\t\t\tconst maxLimitDefined = Is.integer(maxValue);\n\t\t\tconst belowMin = minLimitDefined && value < minValue;\n\t\t\tconst aboveMax = maxLimitDefined && value > maxValue;\n\n\t\t\tif (minLimitDefined && maxLimitDefined && (belowMin || aboveMax)) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beWholeNumberMinMax\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tminValue,\n\t\t\t\t\t\tmaxValue\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (minLimitDefined && belowMin) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beWholeNumberMin\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tminValue\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (maxLimitDefined && aboveMax) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beWholeNumberMax\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tmaxValue\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn failures.length === 0;\n\t}\n\n\t/**\n\t * Is the property a bigint.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @param options Additional options for the validation.\n\t * @param options.minValue The minimum value of the bigint.\n\t * @param options.maxValue The maximum value of the bigint.\n\t * @returns True if the value is a valid bigint.\n\t */\n\tpublic static bigint(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string,\n\t\toptions?: {\n\t\t\tminValue?: bigint;\n\t\t\tmaxValue?: bigint;\n\t\t}\n\t): value is bigint {\n\t\tconst is = Is.bigint(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beBigInteger\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t} else {\n\t\t\tconst minValue = options?.minValue;\n\t\t\tconst maxValue = options?.maxValue;\n\t\t\tconst minLimitDefined = Is.bigint(minValue);\n\t\t\tconst maxLimitDefined = Is.bigint(maxValue);\n\t\t\tconst belowMin = minLimitDefined && value < minValue;\n\t\t\tconst aboveMax = maxLimitDefined && value > maxValue;\n\n\t\t\tif (minLimitDefined && maxLimitDefined && (belowMin || aboveMax)) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beBigIntegerMinMax\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tminValue,\n\t\t\t\t\t\tmaxValue\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (minLimitDefined && belowMin) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beBigIntegerMin\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tminValue\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (maxLimitDefined && aboveMax) {\n\t\t\t\tfailures.push({\n\t\t\t\t\tproperty,\n\t\t\t\t\treason: \"validation.beBigIntegerMax\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tmaxValue\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn failures.length === 0;\n\t}\n\n\t/**\n\t * Is the property a boolean.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @returns True if the value is a boolean.\n\t */\n\tpublic static boolean(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string\n\t): value is boolean {\n\t\tconst is = Is.boolean(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beBoolean\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t}\n\t\treturn is;\n\t}\n\n\t/**\n\t * Is the property a date.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @returns True if the value is a date.\n\t */\n\tpublic static date(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string\n\t): value is Date {\n\t\tif (Is.dateEmpty(value)) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beDate\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\n\t\tconst is = Is.date(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beDate\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t}\n\t\treturn is;\n\t}\n\n\t/**\n\t * Is the property a date in ISO 8601 format.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @returns True if the value is a date.\n\t */\n\tpublic static dateString(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string\n\t): value is string {\n\t\tif (!Is.stringValue(value)) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beDate\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\n\t\tconst is = Is.dateString(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beDate\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t}\n\t\treturn is;\n\t}\n\n\t/**\n\t * Is the property a date/time in ISO 8601 format.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @returns True if the value is a date/time.\n\t */\n\tpublic static dateTimeString(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string\n\t): value is string {\n\t\tif (!Is.stringValue(value)) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beDateTime\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\n\t\tconst is = Is.dateTimeString(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beDateTime\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t}\n\t\treturn is;\n\t}\n\n\t/**\n\t * Is the property a time in ISO 8601 format.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @returns True if the value is a time.\n\t */\n\tpublic static timeString(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string\n\t): value is string {\n\t\tif (!Is.stringValue(value)) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beTime\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\n\t\tconst is = Is.timeString(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beTime\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t}\n\t\treturn is;\n\t}\n\n\t/**\n\t * Is the property a timestamp in milliseconds.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @returns True if the value is a timestamp in milliseconds.\n\t */\n\tpublic static timestampMilliseconds(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string\n\t): value is number {\n\t\tif (!Is.integer(value)) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beTimestampMilliseconds\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\n\t\tconst is = Is.timestampMilliseconds(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beTimestampMilliseconds\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t}\n\t\treturn is;\n\t}\n\n\t/**\n\t * Is the property a timestamp in seconds.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @returns True if the value is a timestamp in seconds.\n\t */\n\tpublic static timestampSeconds(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string\n\t): value is number {\n\t\tif (!Is.integer(value)) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beTimestampSeconds\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\n\t\tconst is = Is.timestampSeconds(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beTimestampSeconds\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t}\n\t\treturn is;\n\t}\n\n\t/**\n\t * Is the property an object.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @returns True if the value is a object.\n\t */\n\tpublic static object<T = { [id: string]: unknown }>(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string\n\t): value is T {\n\t\tconst is = Is.object<T>(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beObject\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t}\n\t\treturn is;\n\t}\n\n\t/**\n\t * Is the property an array.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @returns True if the value is an array.\n\t */\n\tpublic static array<T>(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string\n\t): value is T[] {\n\t\tconst is = Is.array<T>(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beArray\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t}\n\t\treturn is;\n\t}\n\n\t/**\n\t * Is the property an array with at least one item.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @returns True if the value is an array with at least one element.\n\t */\n\tpublic static arrayValue<T>(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string\n\t): value is T[] {\n\t\tconst is = Is.array(value) && value.length > 0;\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beArrayValue\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t}\n\t\treturn is;\n\t}\n\n\t/**\n\t * Is the property one of a list of items.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param options The options the value must be one of.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @returns True if the value is one of the items in the options.\n\t */\n\tpublic static arrayOneOf<T>(\n\t\tproperty: string,\n\t\tvalue: T,\n\t\toptions: T[],\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string\n\t): value is T {\n\t\tif (Is.empty(value)) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beIncluded\",\n\t\t\t\tproperties: {\n\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\tvalue,\n\t\t\t\t\toptions\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\n\t\tconst is = Is.arrayOneOf(value, options);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beIncluded\",\n\t\t\t\tproperties: {\n\t\t\t\t\tfieldName: fieldNameResource ?? \"validation.defaultFieldName\",\n\t\t\t\t\tvalue,\n\t\t\t\t\toptions\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn is;\n\t}\n\n\t/**\n\t * Is the property a Uint8Array.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @returns True if the value is a Uint8Array.\n\t */\n\tpublic static uint8Array(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string\n\t): value is Uint8Array {\n\t\tconst is = Is.uint8Array(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beByteArray\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t}\n\t\treturn is;\n\t}\n\n\t/**\n\t * Is the property valid JSON.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @returns True if the value is valid JSON.\n\t */\n\tpublic static json(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string\n\t): value is string {\n\t\tconst is = Is.json(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beJSON\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t}\n\t\treturn is;\n\t}\n\n\t/**\n\t * Is the property a string in e-mail format.\n\t * @param property The name of the property.\n\t * @param value The value to test.\n\t * @param failures The list of failures to add to.\n\t * @param fieldNameResource Optional i18n resource of the field name to display in the message.\n\t * @returns True if the value is a valid looking e-mail.\n\t */\n\tpublic static email(\n\t\tproperty: string,\n\t\tvalue: unknown,\n\t\tfailures: IValidationFailure[],\n\t\tfieldNameResource?: string\n\t): value is string {\n\t\tconst is = Is.email(value);\n\t\tif (!is) {\n\t\t\tfailures.push({\n\t\t\t\tproperty,\n\t\t\t\treason: \"validation.beEmail\",\n\t\t\t\tproperties: { fieldName: fieldNameResource ?? \"validation.defaultFieldName\", value }\n\t\t\t});\n\t\t}\n\t\treturn is;\n\t}\n\n\t/**\n\t * Throw the validation failures as a ValidationError.\n\t * @param source The source of the error.\n\t * @param objectName The object that was being validated.\n\t * @param failures The validation failures.\n\t * @throws ValidationError From the converted failures.\n\t */\n\tpublic static asValidationError(\n\t\tsource: string,\n\t\tobjectName: string,\n\t\tfailures: IValidationFailure[]\n\t): void {\n\t\tif (Is.arrayValue<IValidationFailure>(failures)) {\n\t\t\tthrow new ValidationError(source, objectName, failures);\n\t\t}\n\t}\n\n\t/**\n\t * Map a list of failures to their properties in a map.\n\t * @param failures The validation failures to combine into the map for the properties.\n\t * @param propertyMap The map to add the failures to.\n\t * @param clearMap Should the map be cleared before adding the failures.\n\t */\n\tpublic static toPropertyMap(\n\t\tfailures: IValidationFailure[],\n\t\tpropertyMap: { [property: string]: IValidationFailure[] },\n\t\tclearMap: boolean = true\n\t): void {\n\t\tif (clearMap) {\n\t\t\tfor (const prop in propertyMap) {\n\t\t\t\tdelete propertyMap[prop];\n\t\t\t}\n\t\t}\n\n\t\tfor (const validationFailure of failures) {\n\t\t\tif (Is.array(propertyMap[validationFailure.property])) {\n\t\t\t\tpropertyMap[validationFailure.property].push(validationFailure);\n\t\t\t} else {\n\t\t\t\tpropertyMap[validationFailure.property] = [validationFailure];\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
@@ -1,7 +1,11 @@
1
1
  /**
2
- * Class to help with base63 Encoding/Decoding.
2
+ * Class to help with base32 Encoding/Decoding.
3
3
  */
4
4
  export declare class Base32 {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
5
9
  /**
6
10
  * Convert the base 32 string to a byte array.
7
11
  * @param base32 The base32 string to convert.
@@ -2,6 +2,10 @@
2
2
  * Class to help with base58 Encoding/Decoding.
3
3
  */
4
4
  export declare class Base58 {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
5
9
  /**
6
10
  * Convert the base 58 string to a byte array.
7
11
  * @param base58 The base58 string to convert.
@@ -3,6 +3,10 @@
3
3
  * Sourced from https://github.com/beatgammit/base64-js.
4
4
  */
5
5
  export declare class Base64 {
6
+ /**
7
+ * Runtime name for the class.
8
+ */
9
+ static readonly CLASS_NAME: string;
6
10
  /**
7
11
  * Get the byte length of the data.
8
12
  * @param base64 The base64 string.
@@ -3,6 +3,10 @@
3
3
  * https://www.rfc-editor.org/rfc/rfc4648#section-5.
4
4
  */
5
5
  export declare class Base64Url {
6
+ /**
7
+ * Runtime name for the class.
8
+ */
9
+ static readonly CLASS_NAME: string;
6
10
  /**
7
11
  * Convert the base 64 string to a byte array.
8
12
  * @param base64Url The base64 url string to convert.
@@ -1,4 +1,4 @@
1
- import { BaseError } from "./baseError";
1
+ import { BaseError } from "./baseError.js";
2
2
  /**
3
3
  * Class to handle errors which are triggered by data already existing.
4
4
  */
@@ -10,9 +10,12 @@ export declare class AlreadyExistsError extends BaseError {
10
10
  /**
11
11
  * Create a new instance of AlreadyExistsError.
12
12
  * @param source The source of the error.
13
- * @param message The message as a code.
13
+ * @param message The message as an i18n key.
14
14
  * @param existingId The id for the item.
15
+ * @param properties Any additional information for the error.
15
16
  * @param cause The cause of the error if we have wrapped another error.
16
17
  */
17
- constructor(source: string, message: string, existingId?: string, cause?: unknown);
18
+ constructor(source: string, message: string, existingId?: string, properties?: {
19
+ [id: string]: unknown;
20
+ }, cause?: unknown);
18
21
  }
@@ -1,4 +1,4 @@
1
- import type { IError } from "../models/IError";
1
+ import type { IError } from "../models/IError.js";
2
2
  /**
3
3
  * Class to handle errors.
4
4
  */
@@ -21,7 +21,7 @@ export declare class BaseError extends Error implements IError {
21
21
  * Create a new instance of BaseError.
22
22
  * @param name The name of the error.
23
23
  * @param source The source of the error.
24
- * @param message The message as a code.
24
+ * @param message The message as an i18n key.
25
25
  * @param properties Any additional information for the error.
26
26
  * @param cause The cause of error if we have wrapped another error.
27
27
  */
@@ -1,4 +1,4 @@
1
- import { BaseError } from "./baseError";
1
+ import { BaseError } from "./baseError.js";
2
2
  /**
3
3
  * Class to handle errors which are triggered by conflicting data.
4
4
  */
@@ -10,10 +10,13 @@ export declare class ConflictError extends BaseError {
10
10
  /**
11
11
  * Create a new instance of ConflictError.
12
12
  * @param source The source of the error.
13
- * @param message The message as a code.
13
+ * @param message The message as an i18n key.
14
14
  * @param conflictId The id that has conflicts.
15
15
  * @param conflicts The conflicts that occurred.
16
+ * @param properties Any additional information for the error.
16
17
  * @param cause The cause or the error if we have wrapped another error.
17
18
  */
18
- constructor(source: string, message: string, conflictId?: string, conflicts?: string[], cause?: unknown);
19
+ constructor(source: string, message: string, conflictId?: string, conflicts?: string[], properties?: {
20
+ [id: string]: unknown;
21
+ }, cause?: unknown);
19
22
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from "./baseError";
1
+ import { BaseError } from "./baseError.js";
2
2
  /**
3
3
  * Class to handle errors.
4
4
  */
@@ -10,7 +10,7 @@ export declare class GeneralError extends BaseError {
10
10
  /**
11
11
  * Create a new instance of GeneralError.
12
12
  * @param source The source of the error.
13
- * @param message The message as a code.
13
+ * @param message The message as an i18n key.
14
14
  * @param properties Any additional information for the error.
15
15
  * @param cause The cause of the error if we have wrapped another error.
16
16
  */
@@ -1,4 +1,4 @@
1
- import { BaseError } from "./baseError";
1
+ import { BaseError } from "./baseError.js";
2
2
  /**
3
3
  * Class to handle errors which are triggered by data guards.
4
4
  */
@@ -10,7 +10,7 @@ export declare class GuardError extends BaseError {
10
10
  /**
11
11
  * Create a new instance of GuardError.
12
12
  * @param source The source of the error.
13
- * @param message The message as a code.
13
+ * @param message The message as an i18n key.
14
14
  * @param propertyName The property which triggered the guard error for the item.
15
15
  * @param propertyValue The property value which triggered the guard error for the item.
16
16
  * @param propertyOptions The property options which might be allowed.
@@ -1,4 +1,4 @@
1
- import { BaseError } from "./baseError";
1
+ import { BaseError } from "./baseError.js";
2
2
  /**
3
3
  * Class to handle errors which are triggered by data not being found.
4
4
  */
@@ -10,9 +10,12 @@ export declare class NotFoundError extends BaseError {
10
10
  /**
11
11
  * Create a new instance of NotFoundError.
12
12
  * @param source The source of the error.
13
- * @param message The message as a code.
13
+ * @param message The message as an i18n key.
14
14
  * @param notFoundId The id for the item.
15
+ * @param properties Any additional information for the error.
15
16
  * @param cause The cause of the error if we have wrapped another error.
16
17
  */
17
- constructor(source: string, message: string, notFoundId?: string, cause?: unknown);
18
+ constructor(source: string, message: string, notFoundId?: string, properties?: {
19
+ [id: string]: unknown;
20
+ }, cause?: unknown);
18
21
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from "./baseError";
1
+ import { BaseError } from "./baseError.js";
2
2
  /**
3
3
  * Class to handle errors.
4
4
  */
@@ -11,6 +11,10 @@ export declare class NotImplementedError extends BaseError {
11
11
  * Create a new instance of NotImplementedError.
12
12
  * @param source The source of the error.
13
13
  * @param method The method for the error.
14
+ * @param properties Any additional information for the error.
15
+ * @param cause The cause of the error if we have wrapped another error.
14
16
  */
15
- constructor(source: string, method: string);
17
+ constructor(source: string, method: string, properties?: {
18
+ [id: string]: unknown;
19
+ }, cause?: unknown);
16
20
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from "./baseError";
1
+ import { BaseError } from "./baseError.js";
2
2
  /**
3
3
  * Class to handle errors when a feature is unsupported.
4
4
  */
@@ -10,8 +10,11 @@ export declare class NotSupportedError extends BaseError {
10
10
  /**
11
11
  * Create a new instance of NotSupportedError.
12
12
  * @param source The source of the error.
13
- * @param message The message as a code.
13
+ * @param message The message as an i18n key.
14
+ * @param properties Any additional information for the error.
14
15
  * @param cause The cause of the error if we have wrapped another error.
15
16
  */
16
- constructor(source: string, message: string, cause?: unknown);
17
+ constructor(source: string, message: string, properties?: {
18
+ [id: string]: unknown;
19
+ }, cause?: unknown);
17
20
  }
@@ -1,6 +1,6 @@
1
- import { BaseError } from "./baseError";
1
+ import { BaseError } from "./baseError.js";
2
2
  /**
3
- * Class to handle errors which are triggered by access not being unauthorized.
3
+ * Class to handle errors which are triggered by access not being authorized.
4
4
  */
5
5
  export declare class UnauthorizedError extends BaseError {
6
6
  /**
@@ -10,8 +10,11 @@ export declare class UnauthorizedError extends BaseError {
10
10
  /**
11
11
  * Create a new instance of UnauthorizedError.
12
12
  * @param source The source of the error.
13
- * @param message The message as a code.
13
+ * @param message The message as an i18n key.
14
+ * @param properties Any additional information for the error.
14
15
  * @param cause The cause of the error if we have wrapped another error.
15
16
  */
16
- constructor(source: string, message: string, cause?: unknown);
17
+ constructor(source: string, message: string, properties?: {
18
+ [id: string]: unknown;
19
+ }, cause?: unknown);
17
20
  }
@@ -1,4 +1,4 @@
1
- import { BaseError } from "./baseError";
1
+ import { BaseError } from "./baseError.js";
2
2
  /**
3
3
  * Class to handle errors when some data can not be processed.
4
4
  */
@@ -10,7 +10,7 @@ export declare class UnprocessableError extends BaseError {
10
10
  /**
11
11
  * Create a new instance of UnprocessableError.
12
12
  * @param source The source of the error.
13
- * @param message The message as a code.
13
+ * @param message The message as an i18n key.
14
14
  * @param properties Any additional information for the error.
15
15
  * @param cause The cause of the error if we have wrapped another error.
16
16
  */
@@ -1,5 +1,5 @@
1
- import { BaseError } from "./baseError";
2
- import type { IValidationFailure } from "../models/IValidationFailure";
1
+ import { BaseError } from "./baseError.js";
2
+ import type { IValidationFailure } from "../models/IValidationFailure.js";
3
3
  /**
4
4
  * Class to handle errors which are triggered by entity validation.
5
5
  */
@@ -1,5 +1,5 @@
1
- import { Factory } from "./factory";
2
- import type { IComponent } from "../models/IComponent";
1
+ import { Factory } from "./factory.js";
2
+ import type { IComponent } from "../models/IComponent.js";
3
3
  /**
4
4
  * Factory for creating implementation of component types.
5
5
  */
@@ -2,6 +2,10 @@
2
2
  * Factory for creating implementation of generic types.
3
3
  */
4
4
  export declare class Factory<T> {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
5
9
  /**
6
10
  * Create a new factory, which is shared throughout all library instances.
7
11
  * @param typeName The type name for the instances.
@@ -25,12 +29,17 @@ export declare class Factory<T> {
25
29
  * Clear all the factories, which removes anything registered with the factories.
26
30
  */
27
31
  static clearFactories(): void;
32
+ /**
33
+ * Get the type name of the factory.
34
+ * @returns The type name of the factory.
35
+ */
36
+ typeName(): string;
28
37
  /**
29
38
  * Register a new generator.
30
39
  * @param name The name of the generator.
31
40
  * @param generator The function to create an instance.
32
41
  */
33
- register<U extends T>(name: string, generator: () => U): void;
42
+ register<U extends T>(name: string, generator: (args?: unknown) => U): void;
34
43
  /**
35
44
  * Unregister a generator.
36
45
  * @param name The name of the generator to unregister.
@@ -52,6 +61,23 @@ export declare class Factory<T> {
52
61
  * @returns An instance of the item or undefined if it does not exist.
53
62
  */
54
63
  getIfExists<U extends T>(name?: string): U | undefined;
64
+ /**
65
+ * Create a new instance without caching it.
66
+ * @param name The name of the instance to generate.
67
+ * @param args The arguments to pass to the generator.
68
+ * @returns A new instance of the item.
69
+ * @throws GuardError if the parameters are invalid.
70
+ * @throws GeneralError if no item exists to create.
71
+ */
72
+ create<U extends T>(name: string, args?: unknown): U;
73
+ /**
74
+ * Create a new instance without caching it if it exists.
75
+ * @param name The name of the instance to generate.
76
+ * @param args The arguments to pass to the generator.
77
+ * @returns A new instance of the item if it exists.
78
+ * @throws GuardError if the parameters are invalid.
79
+ */
80
+ createIfExists<U extends T>(name: string, args?: unknown): U | undefined;
55
81
  /**
56
82
  * Remove all the instances and leave the generators intact.
57
83
  */
@@ -1,4 +1,3 @@
1
- import type { ObjectOrArray } from "../models/objectOrArray";
2
1
  /**
3
2
  * Class to help with arrays.
4
3
  */
@@ -15,11 +14,5 @@ export declare class ArrayHelper {
15
14
  * @param value The object or array to convert.
16
15
  * @returns The array.
17
16
  */
18
- static fromObjectOrArray<T = unknown>(value: undefined): undefined;
19
- /**
20
- * Convert an object or array to an array.
21
- * @param value The object or array to convert.
22
- * @returns The array.
23
- */
24
- static fromObjectOrArray<T = unknown>(value: ObjectOrArray<T>): T[];
17
+ static fromObjectOrArray<T = unknown>(value: T | T[] | undefined): T extends undefined ? undefined : T[];
25
18
  }
@@ -1,4 +1,4 @@
1
- import type { IError } from "../models/IError";
1
+ import type { IError } from "../models/IError.js";
2
2
  /**
3
3
  * Error helper functions.
4
4
  */
@@ -1,8 +1,12 @@
1
- import type { IPatchOperation } from "../models/IPatchOperation";
1
+ import type { IPatchOperation } from "../models/IPatchOperation.js";
2
2
  /**
3
3
  * Helpers methods for JSON objects.
4
4
  */
5
5
  export declare class JsonHelper {
6
+ /**
7
+ * Runtime name for the class.
8
+ */
9
+ static readonly CLASS_NAME: string;
6
10
  /**
7
11
  * Serializes in canonical format.
8
12
  * Based on https://www.rfc-editor.org/rfc/rfc8785.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Class to help with numbers.
3
+ */
4
+ export declare class NumberHelper {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
9
+ /**
10
+ * Clamps a number between a minimum and maximum value.
11
+ * @param value The value to clamp.
12
+ * @param minValue The minimum value.
13
+ * @param maxValue The maximum value.
14
+ * @returns The clamped value.
15
+ */
16
+ static clamp(value: number, minValue?: number, maxValue?: number): number;
17
+ }
@@ -2,6 +2,10 @@
2
2
  * Class to help with objects.
3
3
  */
4
4
  export declare class ObjectHelper {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
5
9
  /**
6
10
  * Convert an object to bytes.
7
11
  * @param obj The object to convert.
@@ -54,8 +58,8 @@ export declare class ObjectHelper {
54
58
  static propertySet(obj: unknown, property: string, value: unknown): void;
55
59
  /**
56
60
  * Delete the property of an unknown object.
57
- * @param obj The object to set the property from.
58
- * @param property The property to set
61
+ * @param obj The object to delete the property from.
62
+ * @param property The property to delete.
59
63
  */
60
64
  static propertyDelete(obj: unknown, property: string): void;
61
65
  /**
@@ -70,16 +74,30 @@ export declare class ObjectHelper {
70
74
  * Pick a subset of properties from an object.
71
75
  * @param obj The object to pick the properties from.
72
76
  * @param keys The property keys to pick.
73
- * @returns The partial object.
77
+ * @returns The picked object.
78
+ */
79
+ static pick<T, K extends keyof T>(obj: T, keys?: K[]): Pick<T, K>;
80
+ /**
81
+ * Pick a subset of properties from an object.
82
+ * @param obj The object to pick the properties from.
83
+ * @param keys The property keys to pick.
84
+ * @returns The picked object, or undefined if the input was undefined.
85
+ */
86
+ static pick<T, K extends keyof T>(obj: T | undefined, keys?: K[]): Pick<T, K> | undefined;
87
+ /**
88
+ * Omit a subset of properties from an object.
89
+ * @param obj The object to omit the properties from.
90
+ * @param keys The property keys to omit.
91
+ * @returns The object without the omitted keys.
74
92
  */
75
- static pick<T>(obj: T | undefined, keys?: (keyof T)[]): Partial<T>;
93
+ static omit<T, K extends keyof T>(obj: T, keys?: K[]): Omit<T, K>;
76
94
  /**
77
95
  * Omit a subset of properties from an object.
78
96
  * @param obj The object to omit the properties from.
79
97
  * @param keys The property keys to omit.
80
- * @returns The partial object.
98
+ * @returns The object without the omitted keys, or undefined if the input was undefined.
81
99
  */
82
- static omit<T>(obj: T | undefined, keys?: (keyof T)[]): Partial<T>;
100
+ static omit<T, K extends keyof T>(obj: T | undefined, keys?: K[]): Omit<T, K> | undefined;
83
101
  /**
84
102
  * Converter the non JSON primitives to extended types.
85
103
  * @param obj The object to convert.
@@ -2,10 +2,26 @@
2
2
  * Class to help with random generation.
3
3
  */
4
4
  export declare class RandomHelper {
5
+ /**
6
+ * Runtime name for the class.
7
+ */
8
+ static readonly CLASS_NAME: string;
5
9
  /**
6
10
  * Generate a new random array.
7
11
  * @param length The length of buffer to create.
8
12
  * @returns The random array.
9
13
  */
10
14
  static generate(length: number): Uint8Array;
15
+ /**
16
+ * Generate a new UUIDv7.
17
+ * @param format The format of the UUIDv7 string.
18
+ * @returns The UUIDv7 string.
19
+ */
20
+ static generateUuidV7(format?: "standard" | "compact"): string;
21
+ /**
22
+ * Extract the unix timestamp (ms) from a UUIDv7.
23
+ * @param uuid The UUIDv7 string.
24
+ * @returns The unix timestamp in milliseconds.
25
+ */
26
+ static uuidV7ExtractTimestamp(uuid: string): number;
11
27
  }
@@ -3,17 +3,23 @@
3
3
  */
4
4
  export declare class StringHelper {
5
5
  /**
6
- * Trim trailing slashes from a string.
6
+ * Implementation signature for trimTrailingSlashes.
7
7
  * @param value The value to trim.
8
- * @returns The trimmed value.
8
+ * @returns The trimmed string or the original.
9
9
  */
10
- static trimTrailingSlashes(value: string | undefined): string;
10
+ static trimTrailingSlashes(value: string): string;
11
11
  /**
12
- * Trim leading slashes from a string.
12
+ * Implementation signature for trimLeadingSlashes.
13
13
  * @param value The value to trim.
14
- * @returns The trimmed value.
14
+ * @returns The trimmed string or the original.
15
15
  */
16
- static trimLeadingSlashes(value: string | undefined): string;
16
+ static trimLeadingSlashes(value: string): string;
17
+ /**
18
+ * Trim both leading and trailing slashes from a string.
19
+ * @param value The value to trim.
20
+ * @returns The trimmed string or the original.
21
+ */
22
+ static trimLeadingAndTrailingSlashes(value: string): string;
17
23
  /**
18
24
  * Convert the input string to kebab case.
19
25
  * @param input The input to convert.