@archbase/core 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/README.md +42 -0
  2. package/dist/archbase-core-3.0.0.tgz +0 -0
  3. package/dist/context/ArchbaseAppContext.d.ts +43 -0
  4. package/dist/context/ArchbaseGlobalProvider.d.ts +33 -0
  5. package/dist/context/ArchbaseSimpleAppContext.d.ts +34 -0
  6. package/dist/context/index.d.ts +5 -0
  7. package/dist/error/ArchbaseError.d.ts +14 -0
  8. package/dist/error/index.d.ts +11 -0
  9. package/dist/errorboundary/ArchbaseErrorBoundary.d.ts +21 -0
  10. package/dist/errorboundary/ArchbaseErrorBoundaryContext.d.ts +6 -0
  11. package/dist/errorboundary/ArchbaseErrorFallback.d.ts +7 -0
  12. package/dist/errorboundary/assertArchbaseErrorBoundaryContext.d.ts +2 -0
  13. package/dist/errorboundary/index.d.ts +6 -0
  14. package/dist/errorboundary/types.d.ts +39 -0
  15. package/dist/errorboundary/useArchbaseErrorBoundary.d.ts +5 -0
  16. package/dist/errorboundary/withArchbaseErrorBoundary.d.ts +3 -0
  17. package/dist/exceptions/ApiError.d.ts +27 -0
  18. package/dist/exceptions/ArchbaseErrorHelper.d.ts +2 -0
  19. package/dist/exceptions/ArchbaseException.d.ts +9 -0
  20. package/dist/exceptions/index.d.ts +3 -0
  21. package/dist/fallback/ArchbaseSafeMigrationWrapper.d.ts +57 -0
  22. package/dist/helper/ArchbaseClickOutside.d.ts +9 -0
  23. package/dist/helper/ArchbaseObjectHelper.d.ts +9 -0
  24. package/dist/helper/index.d.ts +2 -0
  25. package/dist/hooks/ArchbaseDepencyManager.d.ts +70 -0
  26. package/dist/hooks/index.d.ts +15 -0
  27. package/dist/hooks/lifecycle/index.d.ts +54 -0
  28. package/dist/hooks/useArchbaseAsyncFunction.d.ts +1 -0
  29. package/dist/hooks/useArchbaseBool.d.ts +6 -0
  30. package/dist/hooks/useArchbaseForceRenderer.d.ts +1 -0
  31. package/dist/hooks/useArchbaseLatest.d.ts +3 -0
  32. package/dist/hooks/useArchbasePassiveLayoutEffect.d.ts +3 -0
  33. package/dist/hooks/useArchbasePasswordRemember.d.ts +11 -0
  34. package/dist/hooks/useArchbaseReducer.d.ts +21 -0
  35. package/dist/hooks/useArchbaseResizeObserver.d.ts +11 -0
  36. package/dist/hooks/useArchbaseSize.d.ts +12 -0
  37. package/dist/hooks/useArchbaseStateWithCallback.d.ts +2 -0
  38. package/dist/hooks/useArchbaseTextSelection.d.ts +14 -0
  39. package/dist/hooks/useArchbaseTheme.d.ts +6 -0
  40. package/dist/hooks/useArchbaseValidator.d.ts +2 -0
  41. package/dist/index.css +108 -0
  42. package/dist/index.d.ts +25 -0
  43. package/dist/index.js +9728 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/ioc/ArchbaseIOCHelper.d.ts +56 -0
  46. package/dist/ioc/ArchbaseIOCTypes.d.ts +11 -0
  47. package/dist/ioc/index.d.ts +2 -0
  48. package/dist/json/ArchbaseJacksonParser.d.ts +15 -0
  49. package/dist/json/index.d.ts +1 -0
  50. package/dist/locales/config.d.ts +1781 -0
  51. package/dist/locales/index.d.ts +1 -0
  52. package/dist/rsql/ast/ComparisonOperator.d.ts +24 -0
  53. package/dist/rsql/ast/LogicOperator.d.ts +13 -0
  54. package/dist/rsql/ast/Node.d.ts +41 -0
  55. package/dist/rsql/ast/ReservedChars.d.ts +4 -0
  56. package/dist/rsql/ast/index.d.ts +4 -0
  57. package/dist/rsql/builder/index.d.ts +20 -0
  58. package/dist/rsql/emitter/index.d.ts +19 -0
  59. package/dist/rsql/index.d.ts +7 -0
  60. package/dist/rsql/parser/Error.d.ts +7 -0
  61. package/dist/rsql/parser/ParserContext.d.ts +15 -0
  62. package/dist/rsql/parser/ParserOperation.d.ts +43 -0
  63. package/dist/rsql/parser/ParserProduction.d.ts +14 -0
  64. package/dist/rsql/parser/index.d.ts +3 -0
  65. package/dist/rsql/parser/lexer/LexerContext.d.ts +8 -0
  66. package/dist/rsql/parser/lexer/LexerProcessor.d.ts +8 -0
  67. package/dist/rsql/parser/lexer/Token.d.ts +38 -0
  68. package/dist/rsql/parser/lexer/lex.d.ts +3 -0
  69. package/dist/rsql/parser/lexer/processors/scanNonReservedSymbol.d.ts +3 -0
  70. package/dist/rsql/parser/lexer/processors/scanSymbol.d.ts +3 -0
  71. package/dist/rsql/parser/lexer/processors/seekAnyToken.d.ts +4 -0
  72. package/dist/rsql/parser/lexer/processors/seekComparisonCustomOperatorToken.d.ts +4 -0
  73. package/dist/rsql/parser/lexer/processors/seekComparisonOperatorToken.d.ts +4 -0
  74. package/dist/rsql/parser/lexer/processors/seekLogicCanonicalOperatorToken.d.ts +4 -0
  75. package/dist/rsql/parser/lexer/processors/seekLogicVerboseOperatorToken.d.ts +4 -0
  76. package/dist/rsql/parser/lexer/processors/seekParenthesisToken.d.ts +4 -0
  77. package/dist/rsql/parser/lexer/processors/seekQuotedToken.d.ts +4 -0
  78. package/dist/rsql/parser/lexer/processors/seekUnquotedToken.d.ts +4 -0
  79. package/dist/rsql/parser/lexer/processors/skipWhitespace.d.ts +3 -0
  80. package/dist/types/OptionsResult.d.ts +8 -0
  81. package/dist/types/filter.d.ts +56 -0
  82. package/dist/types/index.d.ts +5 -0
  83. package/dist/types/querybuilder.d.ts +85 -0
  84. package/dist/types/token.d.ts +50 -0
  85. package/dist/types/types.d.ts +5 -0
  86. package/dist/utils/archbaseLogo.d.ts +3 -0
  87. package/dist/utils/array.d.ts +1 -0
  88. package/dist/utils/convertImageToBase64.d.ts +1 -0
  89. package/dist/utils/deepFilter.d.ts +2 -0
  90. package/dist/utils/deepFind.d.ts +2 -0
  91. package/dist/utils/deepForEach.d.ts +2 -0
  92. package/dist/utils/deepMap.d.ts +2 -0
  93. package/dist/utils/dom.d.ts +2 -0
  94. package/dist/utils/enum-utils.d.ts +1 -0
  95. package/dist/utils/filter.d.ts +2 -0
  96. package/dist/utils/getElementName.d.ts +2 -0
  97. package/dist/utils/groupByType.d.ts +2 -0
  98. package/dist/utils/hasChildren.d.ts +4 -0
  99. package/dist/utils/hasComplexChildren.d.ts +4 -0
  100. package/dist/utils/index.d.ts +24 -0
  101. package/dist/utils/isBase64.d.ts +1 -0
  102. package/dist/utils/isEmail.d.ts +1 -0
  103. package/dist/utils/masker.d.ts +27 -0
  104. package/dist/utils/nestedObject.d.ts +7 -0
  105. package/dist/utils/object.d.ts +10 -0
  106. package/dist/utils/objectPrototype.d.ts +2 -0
  107. package/dist/utils/onlyText.d.ts +3 -0
  108. package/dist/utils/onlyValid.d.ts +2 -0
  109. package/dist/utils/propertyUtils.d.ts +1 -0
  110. package/dist/utils/string-utils.d.ts +138 -0
  111. package/dist/utils/string.d.ts +11 -0
  112. package/dist/validation/ValidationErrorsContext.d.ts +25 -0
  113. package/dist/validator/ArchbaseValidator.d.ts +21 -0
  114. package/dist/validator/container.d.ts +25 -0
  115. package/dist/validator/decorator/ValidationOptions.d.ts +25 -0
  116. package/dist/validator/decorator/array/ArrayContains.d.ts +12 -0
  117. package/dist/validator/decorator/array/ArrayMaxSize.d.ts +12 -0
  118. package/dist/validator/decorator/array/ArrayMinSize.d.ts +12 -0
  119. package/dist/validator/decorator/array/ArrayNotContains.d.ts +12 -0
  120. package/dist/validator/decorator/array/ArrayNotEmpty.d.ts +12 -0
  121. package/dist/validator/decorator/array/ArrayUnique.d.ts +13 -0
  122. package/dist/validator/decorator/common/Allow.d.ts +5 -0
  123. package/dist/validator/decorator/common/Equals.d.ts +10 -0
  124. package/dist/validator/decorator/common/IsDefined.d.ts +10 -0
  125. package/dist/validator/decorator/common/IsEmpty.d.ts +10 -0
  126. package/dist/validator/decorator/common/IsIn.d.ts +10 -0
  127. package/dist/validator/decorator/common/IsLatLong.d.ts +10 -0
  128. package/dist/validator/decorator/common/IsLatitude.d.ts +10 -0
  129. package/dist/validator/decorator/common/IsLongitude.d.ts +10 -0
  130. package/dist/validator/decorator/common/IsNotEmpty.d.ts +10 -0
  131. package/dist/validator/decorator/common/IsNotIn.d.ts +10 -0
  132. package/dist/validator/decorator/common/IsOptional.d.ts +5 -0
  133. package/dist/validator/decorator/common/NotEquals.d.ts +10 -0
  134. package/dist/validator/decorator/common/Validate.d.ts +14 -0
  135. package/dist/validator/decorator/common/ValidateBy.d.ts +11 -0
  136. package/dist/validator/decorator/common/ValidateIf.d.ts +5 -0
  137. package/dist/validator/decorator/common/ValidateNested.d.ts +5 -0
  138. package/dist/validator/decorator/common/ValidatePromise.d.ts +5 -0
  139. package/dist/validator/decorator/date/MaxDate.d.ts +10 -0
  140. package/dist/validator/decorator/date/MinDate.d.ts +10 -0
  141. package/dist/validator/decorator/decorators.d.ts +111 -0
  142. package/dist/validator/decorator/number/IsDivisibleBy.d.ts +10 -0
  143. package/dist/validator/decorator/number/IsNegative.d.ts +10 -0
  144. package/dist/validator/decorator/number/IsPositive.d.ts +10 -0
  145. package/dist/validator/decorator/number/Max.d.ts +10 -0
  146. package/dist/validator/decorator/number/Min.d.ts +10 -0
  147. package/dist/validator/decorator/object/IsInstance.d.ts +10 -0
  148. package/dist/validator/decorator/object/IsNotEmptyObject.d.ts +16 -0
  149. package/dist/validator/decorator/string/Contains.d.ts +12 -0
  150. package/dist/validator/decorator/string/IsAlpha.d.ts +12 -0
  151. package/dist/validator/decorator/string/IsAlphanumeric.d.ts +12 -0
  152. package/dist/validator/decorator/string/IsAscii.d.ts +12 -0
  153. package/dist/validator/decorator/string/IsBIC.d.ts +12 -0
  154. package/dist/validator/decorator/string/IsBase32.d.ts +12 -0
  155. package/dist/validator/decorator/string/IsBase58.d.ts +12 -0
  156. package/dist/validator/decorator/string/IsBase64.d.ts +12 -0
  157. package/dist/validator/decorator/string/IsBooleanString.d.ts +12 -0
  158. package/dist/validator/decorator/string/IsBtcAddress.d.ts +12 -0
  159. package/dist/validator/decorator/string/IsByteLength.d.ts +12 -0
  160. package/dist/validator/decorator/string/IsCreditCard.d.ts +12 -0
  161. package/dist/validator/decorator/string/IsCurrency.d.ts +12 -0
  162. package/dist/validator/decorator/string/IsDataURI.d.ts +12 -0
  163. package/dist/validator/decorator/string/IsDateString.d.ts +10 -0
  164. package/dist/validator/decorator/string/IsDecimal.d.ts +12 -0
  165. package/dist/validator/decorator/string/IsEAN.d.ts +12 -0
  166. package/dist/validator/decorator/string/IsEmail.d.ts +12 -0
  167. package/dist/validator/decorator/string/IsEthereumAddress.d.ts +12 -0
  168. package/dist/validator/decorator/string/IsFQDN.d.ts +12 -0
  169. package/dist/validator/decorator/string/IsFirebasePushId.d.ts +12 -0
  170. package/dist/validator/decorator/string/IsFullWidth.d.ts +12 -0
  171. package/dist/validator/decorator/string/IsHSL.d.ts +14 -0
  172. package/dist/validator/decorator/string/IsHalfWidth.d.ts +12 -0
  173. package/dist/validator/decorator/string/IsHash.d.ts +14 -0
  174. package/dist/validator/decorator/string/IsHexColor.d.ts +12 -0
  175. package/dist/validator/decorator/string/IsHexadecimal.d.ts +12 -0
  176. package/dist/validator/decorator/string/IsIBAN.d.ts +12 -0
  177. package/dist/validator/decorator/string/IsIP.d.ts +13 -0
  178. package/dist/validator/decorator/string/IsISBN.d.ts +13 -0
  179. package/dist/validator/decorator/string/IsISIN.d.ts +12 -0
  180. package/dist/validator/decorator/string/IsISO31661Alpha2.d.ts +10 -0
  181. package/dist/validator/decorator/string/IsISO31661Alpha3.d.ts +10 -0
  182. package/dist/validator/decorator/string/IsISO8601.d.ts +14 -0
  183. package/dist/validator/decorator/string/IsISRC.d.ts +12 -0
  184. package/dist/validator/decorator/string/IsISSN.d.ts +12 -0
  185. package/dist/validator/decorator/string/IsIdentityCard.d.ts +16 -0
  186. package/dist/validator/decorator/string/IsJSON.d.ts +12 -0
  187. package/dist/validator/decorator/string/IsJWT.d.ts +12 -0
  188. package/dist/validator/decorator/string/IsLocale.d.ts +12 -0
  189. package/dist/validator/decorator/string/IsLowercase.d.ts +12 -0
  190. package/dist/validator/decorator/string/IsMacAddress.d.ts +13 -0
  191. package/dist/validator/decorator/string/IsMagnetURI.d.ts +12 -0
  192. package/dist/validator/decorator/string/IsMilitaryTime.d.ts +12 -0
  193. package/dist/validator/decorator/string/IsMimeType.d.ts +12 -0
  194. package/dist/validator/decorator/string/IsMobilePhone.d.ts +28 -0
  195. package/dist/validator/decorator/string/IsMongoId.d.ts +12 -0
  196. package/dist/validator/decorator/string/IsMultibyte.d.ts +12 -0
  197. package/dist/validator/decorator/string/IsNumberString.d.ts +12 -0
  198. package/dist/validator/decorator/string/IsOctal.d.ts +12 -0
  199. package/dist/validator/decorator/string/IsPassportNumber.d.ts +12 -0
  200. package/dist/validator/decorator/string/IsPhoneNumber.d.ts +19 -0
  201. package/dist/validator/decorator/string/IsPort.d.ts +10 -0
  202. package/dist/validator/decorator/string/IsPostalCode.d.ts +12 -0
  203. package/dist/validator/decorator/string/IsRFC3339.d.ts +12 -0
  204. package/dist/validator/decorator/string/IsRgbColor.d.ts +14 -0
  205. package/dist/validator/decorator/string/IsSemVer.d.ts +12 -0
  206. package/dist/validator/decorator/string/IsStrongPassword.d.ts +16 -0
  207. package/dist/validator/decorator/string/IsSurrogatePair.d.ts +12 -0
  208. package/dist/validator/decorator/string/IsTimeZone.d.ts +12 -0
  209. package/dist/validator/decorator/string/IsUUID.d.ts +12 -0
  210. package/dist/validator/decorator/string/IsUppercase.d.ts +12 -0
  211. package/dist/validator/decorator/string/IsUrl.d.ts +12 -0
  212. package/dist/validator/decorator/string/IsVariableWidth.d.ts +12 -0
  213. package/dist/validator/decorator/string/Length.d.ts +12 -0
  214. package/dist/validator/decorator/string/Matches.d.ts +14 -0
  215. package/dist/validator/decorator/string/MaxLength.d.ts +12 -0
  216. package/dist/validator/decorator/string/MinLength.d.ts +12 -0
  217. package/dist/validator/decorator/string/NotContains.d.ts +12 -0
  218. package/dist/validator/decorator/string/is-iso4217-currency-code.d.ts +10 -0
  219. package/dist/validator/decorator/string/is-tax-id.d.ts +20 -0
  220. package/dist/validator/decorator/typechecker/IsArray.d.ts +10 -0
  221. package/dist/validator/decorator/typechecker/IsBoolean.d.ts +10 -0
  222. package/dist/validator/decorator/typechecker/IsDate.d.ts +10 -0
  223. package/dist/validator/decorator/typechecker/IsEnum.d.ts +10 -0
  224. package/dist/validator/decorator/typechecker/IsInt.d.ts +10 -0
  225. package/dist/validator/decorator/typechecker/IsNumber.d.ts +18 -0
  226. package/dist/validator/decorator/typechecker/IsObject.d.ts +12 -0
  227. package/dist/validator/decorator/typechecker/IsString.d.ts +10 -0
  228. package/dist/validator/index.d.ts +49 -0
  229. package/dist/validator/metadata/ConstraintMetadata.d.ts +23 -0
  230. package/dist/validator/metadata/MetadataStorage.d.ts +42 -0
  231. package/dist/validator/metadata/ValidationMetadata.d.ts +53 -0
  232. package/dist/validator/metadata/ValidationMetadataArgs.d.ts +38 -0
  233. package/dist/validator/register-decorator.d.ts +36 -0
  234. package/dist/validator/utils/convert-to-array.util.d.ts +4 -0
  235. package/dist/validator/utils/get-global.util.d.ts +7 -0
  236. package/dist/validator/utils/index.d.ts +3 -0
  237. package/dist/validator/utils/is-promise.util.d.ts +1 -0
  238. package/dist/validator/validation/ValidationArguments.d.ts +26 -0
  239. package/dist/validator/validation/ValidationError.d.ts +42 -0
  240. package/dist/validator/validation/ValidationExecutor.d.ts +28 -0
  241. package/dist/validator/validation/ValidationTypes.d.ts +15 -0
  242. package/dist/validator/validation/ValidationUtils.d.ts +8 -0
  243. package/dist/validator/validation/Validator.d.ts +37 -0
  244. package/dist/validator/validation/ValidatorConstraintInterface.d.ts +14 -0
  245. package/dist/validator/validation/ValidatorOptions.d.ts +75 -0
  246. package/dist/validator/validation-schema/ValidationSchema.d.ts +57 -0
  247. package/dist/validator/validation-schema/ValidationSchemaToMetadataTransformer.d.ts +8 -0
  248. package/package.json +88 -0
@@ -0,0 +1,12 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const IS_UPPERCASE = "isUppercase";
3
+ /**
4
+ * Checks if the string is uppercase.
5
+ * If given value is not a string, then it returns false.
6
+ */
7
+ export declare function isUppercase(value: unknown): boolean;
8
+ /**
9
+ * Checks if the string is uppercase.
10
+ * If given value is not a string, then it returns false.
11
+ */
12
+ export declare function IsUppercase(validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,12 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const IS_URL = "isUrl";
3
+ /**
4
+ * Checks if the string is a url.
5
+ * If given value is not a string, then it returns false.
6
+ */
7
+ export declare function isURL(value: string, options?: validator.IsURLOptions): boolean;
8
+ /**
9
+ * Checks if the string is a url.
10
+ * If given value is not a string, then it returns false.
11
+ */
12
+ export declare function IsUrl(options?: validator.IsURLOptions, validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,12 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const IS_VARIABLE_WIDTH = "isVariableWidth";
3
+ /**
4
+ * Checks if the string contains variable-width chars.
5
+ * If given value is not a string, then it returns false.
6
+ */
7
+ export declare function isVariableWidth(value: unknown): boolean;
8
+ /**
9
+ * Checks if the string contains variable-width chars.
10
+ * If given value is not a string, then it returns false.
11
+ */
12
+ export declare function IsVariableWidth(validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,12 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const IS_LENGTH = "isLength";
3
+ /**
4
+ * Checks if the string's length falls in a range. Note: this function takes into account surrogate pairs.
5
+ * If given value is not a string, then it returns false.
6
+ */
7
+ export declare function length(value: unknown, min: number, max?: number): boolean;
8
+ /**
9
+ * Checks if the string's length falls in a range. Note: this function takes into account surrogate pairs.
10
+ * If given value is not a string, then it returns false.
11
+ */
12
+ export declare function Length(min: number, max?: number, validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,14 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const MATCHES = "matches";
3
+ /**
4
+ * Checks if string matches the pattern. Either matches('foo', /foo/i).
5
+ * If given value is not a string, then it returns false.
6
+ */
7
+ export declare function matches(value: string, pattern: RegExp): boolean;
8
+ export declare function matches(value: string, pattern: string, modifiers: string): boolean;
9
+ /**
10
+ * Checks if string matches the pattern. Either matches('foo', /foo/i)
11
+ * If given value is not a string, then it returns false.
12
+ */
13
+ export declare function Matches(pattern: RegExp, validationOptions?: ValidationOptions): PropertyDecorator;
14
+ export declare function Matches(pattern: string, modifiers?: string, validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,12 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const MAX_LENGTH = "maxLength";
3
+ /**
4
+ * Checks if the string's length is not more than given number. Note: this function takes into account surrogate pairs.
5
+ * If given value is not a string, then it returns false.
6
+ */
7
+ export declare function maxLength(value: unknown, max: number): boolean;
8
+ /**
9
+ * Checks if the string's length is not more than given number. Note: this function takes into account surrogate pairs.
10
+ * If given value is not a string, then it returns false.
11
+ */
12
+ export declare function MaxLength(max: number, validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,12 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const MIN_LENGTH = "minLength";
3
+ /**
4
+ * Checks if the string's length is not less than given number. Note: this function takes into account surrogate pairs.
5
+ * If given value is not a string, then it returns false.
6
+ */
7
+ export declare function minLength(value: unknown, min: number): boolean;
8
+ /**
9
+ * Checks if the string's length is not less than given number. Note: this function takes into account surrogate pairs.
10
+ * If given value is not a string, then it returns false.
11
+ */
12
+ export declare function MinLength(min: number, validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,12 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const NOT_CONTAINS = "notContains";
3
+ /**
4
+ * Checks if the string does not contain the seed.
5
+ * If given value is not a string, then it returns false.
6
+ */
7
+ export declare function notContains(value: unknown, seed: string): boolean;
8
+ /**
9
+ * Checks if the string does not contain the seed.
10
+ * If given value is not a string, then it returns false.
11
+ */
12
+ export declare function NotContains(seed: string, validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,10 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const IS_ISO4217_CURRENCY_CODE = "isISO4217CurrencyCode";
3
+ /**
4
+ * Check if the string is a valid [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) officially assigned currency code.
5
+ */
6
+ export declare function isISO4217CurrencyCode(value: unknown): boolean;
7
+ /**
8
+ * Check if the string is a valid [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) officially assigned currency code.
9
+ */
10
+ export declare function IsISO4217CurrencyCode(validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,20 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const IS_TAX_ID = "isTaxId";
3
+ /**
4
+ * Checks if the string is a valid tax ID. Default locale is `en-US`.
5
+ * If given value is not a string, then it returns false.
6
+ *
7
+ * Supported locales: bg-BG, cs-CZ, de-AT, de-DE, dk-DK, el-CY, el-GR, en-CA,
8
+ * en-IE, en-US, es-ES, et-EE, fi-FI, fr-BE, fr-FR, fr-LU, hr-HR, hu-HU, it-IT,
9
+ * lv-LV, mt-MT, nl-NL, pl-PL, pt-BR, pt-PT, ro-RO, sk-SK, sl-SI, sv-SE.
10
+ */
11
+ export declare function isTaxId(value: unknown, locale?: string): boolean;
12
+ /**
13
+ * Checks if the string is a valid tax ID. Default locale is `en-US`.
14
+ * If given value is not a string, then it returns false.
15
+ *
16
+ * Supported locales: bg-BG, cs-CZ, de-AT, de-DE, dk-DK, el-CY, el-GR, en-CA,
17
+ * en-IE, en-US, es-ES, et-EE, fi-FI, fr-BE, fr-FR, fr-LU, hr-HR, hu-HU, it-IT,
18
+ * lv-LV, mt-MT, nl-NL, pl-PL, pt-BR, pt-PT, ro-RO, sk-SK, sl-SI, sv-SE.
19
+ */
20
+ export declare function IsTaxId(locale?: string, validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,10 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const IS_ARRAY = "isArray";
3
+ /**
4
+ * Checks if a given value is an array
5
+ */
6
+ export declare function isArray<T = any>(value: unknown): value is Array<T>;
7
+ /**
8
+ * Checks if a given value is an array
9
+ */
10
+ export declare function IsArray(validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,10 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const IS_BOOLEAN = "isBoolean";
3
+ /**
4
+ * Checks if a given value is a boolean.
5
+ */
6
+ export declare function isBoolean(value: unknown): value is boolean;
7
+ /**
8
+ * Checks if a value is a boolean.
9
+ */
10
+ export declare function IsBoolean(validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,10 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const IS_DATE = "isDate";
3
+ /**
4
+ * Checks if a given value is a date.
5
+ */
6
+ export declare function isDate(value: unknown): value is Date;
7
+ /**
8
+ * Checks if a value is a date.
9
+ */
10
+ export declare function IsDate(validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,10 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const IS_ENUM = "isEnum";
3
+ /**
4
+ * Checks if a given value is the member of the provided enum.
5
+ */
6
+ export declare function isEnum(value: unknown, entity: any): boolean;
7
+ /**
8
+ * Checks if a given value is the member of the provided enum.
9
+ */
10
+ export declare function IsEnum(entity: object, validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,10 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const IS_INT = "isInt";
3
+ /**
4
+ * Checks if value is an integer.
5
+ */
6
+ export declare function isInt(val: unknown): val is Number;
7
+ /**
8
+ * Checks if value is an integer.
9
+ */
10
+ export declare function IsInt(validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,18 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const IS_NUMBER = "isNumber";
3
+ /**
4
+ * Options to be passed to IsNumber decorator.
5
+ */
6
+ export interface IsNumberOptions {
7
+ allowNaN?: boolean;
8
+ allowInfinity?: boolean;
9
+ maxDecimalPlaces?: number;
10
+ }
11
+ /**
12
+ * Checks if a given value is a number.
13
+ */
14
+ export declare function isNumber(value: unknown, options?: IsNumberOptions): value is number;
15
+ /**
16
+ * Checks if a value is a number.
17
+ */
18
+ export declare function IsNumber(options?: IsNumberOptions, validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,12 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const IS_OBJECT = "isObject";
3
+ /**
4
+ * Checks if the value is valid Object.
5
+ * Returns false if the value is not an object.
6
+ */
7
+ export declare function isObject<T = object>(value: unknown): value is T;
8
+ /**
9
+ * Checks if the value is valid Object.
10
+ * Returns false if the value is not an object.
11
+ */
12
+ export declare function IsObject(validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,10 @@
1
+ import { ValidationOptions } from '../ValidationOptions';
2
+ export declare const IS_STRING = "isString";
3
+ /**
4
+ * Checks if a given value is a real string.
5
+ */
6
+ export declare function isString(value: unknown): value is string;
7
+ /**
8
+ * Checks if a given value is a real string.
9
+ */
10
+ export declare function IsString(validationOptions?: ValidationOptions): PropertyDecorator;
@@ -0,0 +1,49 @@
1
+ import { ValidationError } from './validation/ValidationError';
2
+ import { ValidatorOptions } from './validation/ValidatorOptions';
3
+ import { ValidationSchema } from './validation-schema/ValidationSchema';
4
+ export * from './container';
5
+ export * from './decorator/decorators';
6
+ export * from './decorator/ValidationOptions';
7
+ export * from './validation/ValidatorConstraintInterface';
8
+ export * from './validation/ValidationError';
9
+ export * from './validation/ValidatorOptions';
10
+ export * from './validation/ValidationArguments';
11
+ export * from './validation/ValidationTypes';
12
+ export * from './validation/Validator';
13
+ export * from './validation-schema/ValidationSchema';
14
+ export * from './register-decorator';
15
+ export * from './metadata/MetadataStorage';
16
+ export { ArchbaseValidator } from './ArchbaseValidator';
17
+ export type { DataSourceValidationError, IDataSourceValidator } from './ArchbaseValidator';
18
+ /**
19
+ * Valida determinado objeto.
20
+ */
21
+ export declare function validate(object: object, validatorOptions?: ValidatorOptions): Promise<ValidationError[]>;
22
+ /**
23
+ * Valida determinado objeto por um determinado esquema de validação.
24
+ */
25
+ export declare function validate(schemaName: string, object: object, validatorOptions?: ValidatorOptions): Promise<ValidationError[]>;
26
+ /**
27
+ * Valida determinado objeto e rejeita em caso de erro.
28
+ */
29
+ export declare function validateOrReject(object: object, validatorOptions?: ValidatorOptions): Promise<void>;
30
+ /**
31
+ * Valida determinado objeto por um determinado esquema de validação e rejeita em caso de erro.
32
+ */
33
+ export declare function validateOrReject(schemaName: string, object: object, validatorOptions?: ValidatorOptions): Promise<void>;
34
+ /**
35
+ * Executa a validação de sincronização do objeto fornecido.
36
+ * Observe que este método ignora completamente as validações assíncronas.
37
+ * Se você deseja realizar a validação corretamente, você precisa chamar o método activate.
38
+ */
39
+ export declare function validateSync(object: object, validatorOptions?: ValidatorOptions): ValidationError[];
40
+ /**
41
+ * Valida determinado objeto por um determinado esquema de validação.
42
+ * Observe que este método ignora completamente as validações assíncronas.
43
+ * Se você deseja realizar a validação corretamente, você precisa chamar o método activate.
44
+ */
45
+ export declare function validateSync(schemaName: string, object: object, validatorOptions?: ValidatorOptions): ValidationError[];
46
+ /**
47
+ * Registra um novo esquema de validação.
48
+ */
49
+ export declare function registerSchema(schema: ValidationSchema): void;
@@ -0,0 +1,23 @@
1
+ import { ValidatorConstraintInterface } from '../validation/ValidatorConstraintInterface';
2
+ /**
3
+ * This metadata interface contains information for custom validators.
4
+ */
5
+ export declare class ConstraintMetadata {
6
+ /**
7
+ * Target class which performs validation.
8
+ */
9
+ target: Function;
10
+ /**
11
+ * Custom validation's name, that will be used as validation error type.
12
+ */
13
+ name?: string;
14
+ /**
15
+ * Indicates if this validation is asynchronous or not.
16
+ */
17
+ async: boolean;
18
+ constructor(target: Function, name?: string, async?: boolean);
19
+ /**
20
+ * Instance of the target custom validation class which performs validation.
21
+ */
22
+ get instance(): ValidatorConstraintInterface;
23
+ }
@@ -0,0 +1,42 @@
1
+ import { ValidationMetadata } from './ValidationMetadata';
2
+ import { ConstraintMetadata } from './ConstraintMetadata';
3
+ import { ValidationSchema } from '../validation-schema/ValidationSchema';
4
+ /**
5
+ * Storage all metadatas.
6
+ */
7
+ export declare class MetadataStorage {
8
+ private validationMetadatas;
9
+ private constraintMetadatas;
10
+ get hasValidationMetaData(): boolean;
11
+ /**
12
+ * Adds a new validation metadata.
13
+ */
14
+ addValidationSchema(schema: ValidationSchema): void;
15
+ /**
16
+ * Adds a new validation metadata.
17
+ */
18
+ addValidationMetadata(metadata: ValidationMetadata): void;
19
+ /**
20
+ * Adds a new constraint metadata.
21
+ */
22
+ addConstraintMetadata(metadata: ConstraintMetadata): void;
23
+ /**
24
+ * Groups metadata by their property names.
25
+ */
26
+ groupByPropertyName(metadata: ValidationMetadata[]): {
27
+ [propertyName: string]: ValidationMetadata[];
28
+ };
29
+ /**
30
+ * Gets all validation metadatas for the given object with the given groups.
31
+ */
32
+ getTargetValidationMetadatas(targetConstructor: Function, targetSchema: string, always: boolean, strictGroups: boolean, groups?: string[]): ValidationMetadata[];
33
+ /**
34
+ * Gets all validator constraints for the given object.
35
+ */
36
+ getTargetValidatorConstraints(target: Function): ConstraintMetadata[];
37
+ }
38
+ /**
39
+ * Gets metadata storage.
40
+ * Metadata storage follows the best practices and stores metadata in a global variable.
41
+ */
42
+ export declare function getMetadataStorage(): MetadataStorage;
@@ -0,0 +1,53 @@
1
+ import { ValidationMetadataArgs } from './ValidationMetadataArgs';
2
+ import { ValidationArguments } from '../validation/ValidationArguments';
3
+ /**
4
+ * This metadata contains validation rules.
5
+ */
6
+ export declare class ValidationMetadata {
7
+ /**
8
+ * Validation type.
9
+ */
10
+ type: string;
11
+ /**
12
+ * Validator name.
13
+ */
14
+ name?: string;
15
+ /**
16
+ * Target class to which this validation is applied.
17
+ */
18
+ target: Function | string;
19
+ /**
20
+ * Property of the object to be validated.
21
+ */
22
+ propertyName: string;
23
+ /**
24
+ * Constraint class that performs validation. Used only for custom validations.
25
+ */
26
+ constraintCls?: Function;
27
+ /**
28
+ * Array of constraints of this validation.
29
+ */
30
+ constraints?: any[];
31
+ /**
32
+ * Validation message to be shown in the case of error.
33
+ */
34
+ message?: string | ((args: ValidationArguments) => string);
35
+ /**
36
+ * Validation groups used for this validation.
37
+ */
38
+ groups?: string[];
39
+ /**
40
+ * Indicates if validation must be performed always, no matter of validation groups used.
41
+ */
42
+ always?: boolean;
43
+ /**
44
+ * Specifies if validated value is an array and each of its item must be validated.
45
+ */
46
+ each?: boolean;
47
+ context?: any;
48
+ /**
49
+ * Extra options specific to validation type.
50
+ */
51
+ validationTypeOptions: any;
52
+ constructor(args: ValidationMetadataArgs);
53
+ }
@@ -0,0 +1,38 @@
1
+ import { ValidationOptions } from '../decorator/ValidationOptions';
2
+ /**
3
+ * Constructor arguments for ValidationMetadata class.
4
+ */
5
+ export interface ValidationMetadataArgs {
6
+ /**
7
+ * Validation type.
8
+ */
9
+ type: string;
10
+ /**
11
+ * Validator name.
12
+ */
13
+ name?: string;
14
+ /**
15
+ * Object that is used to be validated.
16
+ */
17
+ target: Function | string;
18
+ /**
19
+ * Property of the object to be validated.
20
+ */
21
+ propertyName: string;
22
+ /**
23
+ * Constraint class that performs validation. Used only for custom validations.
24
+ */
25
+ constraintCls?: Function;
26
+ /**
27
+ * Array of constraints of this validation.
28
+ */
29
+ constraints?: any[];
30
+ /**
31
+ * Validation options.
32
+ */
33
+ validationOptions?: ValidationOptions;
34
+ /**
35
+ * Extra options specific to validation type.
36
+ */
37
+ validationTypeOptions?: any;
38
+ }
@@ -0,0 +1,36 @@
1
+ import { ValidatorConstraintInterface } from './validation/ValidatorConstraintInterface';
2
+ import { ValidationOptions } from './decorator/ValidationOptions';
3
+ export interface ValidationDecoratorOptions {
4
+ /**
5
+ * Target object to be validated.
6
+ */
7
+ target: Function;
8
+ /**
9
+ * Target object's property name to be validated.
10
+ */
11
+ propertyName: string;
12
+ /**
13
+ * Name of the validation that is being registered.
14
+ */
15
+ name?: string;
16
+ /**
17
+ * Indicates if this decorator will perform async validation.
18
+ */
19
+ async?: boolean;
20
+ /**
21
+ * Validator options.
22
+ */
23
+ options?: ValidationOptions;
24
+ /**
25
+ * Array of validation constraints.
26
+ */
27
+ constraints?: any[];
28
+ /**
29
+ * Validator that performs validation.
30
+ */
31
+ validator: ValidatorConstraintInterface | Function;
32
+ }
33
+ /**
34
+ * Registers a custom validation decorator.
35
+ */
36
+ export declare function registerDecorator(options: ValidationDecoratorOptions): void;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Convert Map, Set to Array
3
+ */
4
+ export declare function convertToArray<T>(val: Array<T> | Set<T> | Map<any, T>): Array<T>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This function returns the global object across Node and browsers.
3
+ *
4
+ * Note: `globalThis` is the standardized approach however it has been added to
5
+ * Node.js in version 12. We need to include this snippet until Node 12 EOL.
6
+ */
7
+ export declare function getGlobal(): typeof globalThis;
@@ -0,0 +1,3 @@
1
+ export * from './convert-to-array.util';
2
+ export * from './get-global.util';
3
+ export * from './is-promise.util';
@@ -0,0 +1 @@
1
+ export declare function isPromise<T = any>(p: any): p is Promise<T>;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Arguments being sent to message builders - user can create message either by simply returning a string,
3
+ * either by returning a function that accepts MessageArguments and returns a message string built based on these arguments.
4
+ */
5
+ export interface ValidationArguments {
6
+ /**
7
+ * Validating value.
8
+ */
9
+ value: any;
10
+ /**
11
+ * Constraints set by this validation type.
12
+ */
13
+ constraints: any[];
14
+ /**
15
+ * Name of the target that is being validated.
16
+ */
17
+ targetName: string;
18
+ /**
19
+ * Object that is being validated.
20
+ */
21
+ object: object;
22
+ /**
23
+ * Name of the object's property being validated.
24
+ */
25
+ property: string;
26
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Validation error description.
3
+ */
4
+ export declare class ValidationError {
5
+ /**
6
+ * Object that was validated.
7
+ *
8
+ * OPTIONAL - configurable via the ValidatorOptions.validationError.target option
9
+ */
10
+ target?: object;
11
+ /**
12
+ * Object's property that haven't pass validation.
13
+ */
14
+ property: string;
15
+ /**
16
+ * Value that haven't pass a validation.
17
+ *
18
+ * OPTIONAL - configurable via the ValidatorOptions.validationError.value option
19
+ */
20
+ value?: any;
21
+ /**
22
+ * Constraints that failed validation with error messages.
23
+ */
24
+ constraints?: {
25
+ [type: string]: string;
26
+ };
27
+ /**
28
+ * Contains all nested validation errors of the property.
29
+ */
30
+ children?: ValidationError[];
31
+ contexts?: {
32
+ [type: string]: any;
33
+ };
34
+ /**
35
+ *
36
+ * @param shouldDecorate decorate the message with ANSI formatter escape codes for better readability
37
+ * @param hasParent true when the error is a child of an another one
38
+ * @param parentPath path as string to the parent of this property
39
+ * @param showConstraintMessages show constraint messages instead of constraint names
40
+ */
41
+ toString(shouldDecorate?: boolean, hasParent?: boolean, parentPath?: string, showConstraintMessages?: boolean): string;
42
+ }
@@ -0,0 +1,28 @@
1
+ import { Validator } from './Validator';
2
+ import { ValidationError } from './ValidationError';
3
+ import { ValidationMetadata } from '../metadata/ValidationMetadata';
4
+ import { ValidatorOptions } from './ValidatorOptions';
5
+ /**
6
+ * Executes validation over given object.
7
+ */
8
+ export declare class ValidationExecutor {
9
+ private validator;
10
+ private validatorOptions?;
11
+ awaitingPromises: Promise<any>[];
12
+ ignoreAsyncValidations: boolean;
13
+ private metadataStorage;
14
+ constructor(validator: Validator, validatorOptions?: ValidatorOptions);
15
+ execute(object: object, targetSchema: string, validationErrors: ValidationError[]): void;
16
+ whitelist(object: any, groupedMetadatas: {
17
+ [propertyName: string]: ValidationMetadata[];
18
+ }, validationErrors: ValidationError[]): void;
19
+ stripEmptyErrors(errors: ValidationError[]): ValidationError[];
20
+ private performValidations;
21
+ private generateValidationError;
22
+ private conditionalValidations;
23
+ private customValidations;
24
+ private nestedValidations;
25
+ private mapContexts;
26
+ private createValidationError;
27
+ private getConstraintType;
28
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Validation types.
3
+ */
4
+ export declare class ValidationTypes {
5
+ static CUSTOM_VALIDATION: string;
6
+ static NESTED_VALIDATION: string;
7
+ static PROMISE_VALIDATION: string;
8
+ static CONDITIONAL_VALIDATION: string;
9
+ static WHITELIST: string;
10
+ static IS_DEFINED: string;
11
+ /**
12
+ * Checks if validation type is valid.
13
+ */
14
+ static isValid(type: string): boolean;
15
+ }
@@ -0,0 +1,8 @@
1
+ import { ValidationArguments } from './ValidationArguments';
2
+ /**
3
+ * Convert the constraint to a string to be shown in an error
4
+ */
5
+ export declare function constraintToString(constraint: unknown): string;
6
+ export declare class ValidationUtils {
7
+ static replaceMessageSpecialTokens(message: string | ((args: ValidationArguments) => string), validationArguments: ValidationArguments): string;
8
+ }