@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,37 @@
1
+ import { ValidationError } from './ValidationError';
2
+ import { ValidatorOptions } from './ValidatorOptions';
3
+ /**
4
+ * Validator performs validation of the given object based on its metadata.
5
+ */
6
+ export declare class Validator {
7
+ /**
8
+ * Performs validation of the given object based on decorators used in given object class.
9
+ */
10
+ validate(object: object, options?: ValidatorOptions): Promise<ValidationError[]>;
11
+ /**
12
+ * Performs validation of the given object based on validation schema.
13
+ */
14
+ validate(schemaName: string, object: object, options?: ValidatorOptions): Promise<ValidationError[]>;
15
+ /**
16
+ * Performs validation of the given object based on decorators used in given object class and reject on error.
17
+ */
18
+ validateOrReject(object: object, options?: ValidatorOptions): Promise<void>;
19
+ /**
20
+ * Performs validation of the given object based on validation schema and reject on error.
21
+ */
22
+ validateOrReject(schemaName: string, object: object, options?: ValidatorOptions): Promise<void>;
23
+ /**
24
+ * Performs validation of the given object based on decorators used in given object class.
25
+ * NOTE: This method completely ignores all async validations.
26
+ */
27
+ validateSync(object: object, options?: ValidatorOptions): ValidationError[];
28
+ /**
29
+ * Performs validation of the given object based on validation schema.
30
+ */
31
+ validateSync(schemaName: string, object: object, options?: ValidatorOptions): ValidationError[];
32
+ /**
33
+ * Performs validation of the given object based on decorators or validation schema.
34
+ * Common method for `validateOrReject` and `validate` methods.
35
+ */
36
+ private coreValidate;
37
+ }
@@ -0,0 +1,14 @@
1
+ import { ValidationArguments } from './ValidationArguments';
2
+ /**
3
+ * Custom validators must implement this interface to provide custom validation logic.
4
+ */
5
+ export interface ValidatorConstraintInterface {
6
+ /**
7
+ * Method to be called to perform custom validation over given value.
8
+ */
9
+ validate(value: any, validationArguments?: ValidationArguments): Promise<boolean> | boolean;
10
+ /**
11
+ * Gets default message when validation for this constraint fail.
12
+ */
13
+ defaultMessage?(validationArguments?: ValidationArguments): string;
14
+ }
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Options passed to validator during validation.
3
+ */
4
+ export interface ValidatorOptions {
5
+ /**
6
+ * If set to true then class-validator will print extra warning messages to the console when something is not right.
7
+ */
8
+ enableDebugMessages?: boolean;
9
+ /**
10
+ * If set to true then validator will skip validation of all properties that are undefined in the validating object.
11
+ */
12
+ skipUndefinedProperties?: boolean;
13
+ /**
14
+ * If set to true then validator will skip validation of all properties that are null in the validating object.
15
+ */
16
+ skipNullProperties?: boolean;
17
+ /**
18
+ * If set to true then validator will skip validation of all properties that are null or undefined in the validating object.
19
+ */
20
+ skipMissingProperties?: boolean;
21
+ /**
22
+ * If set to true validator will strip validated object of any properties that do not have any decorators.
23
+ *
24
+ * Tip: if no other decorator is suitable for your property use @Allow decorator.
25
+ */
26
+ whitelist?: boolean;
27
+ /**
28
+ * If set to true, instead of stripping non-whitelisted properties validator will throw an error
29
+ */
30
+ forbidNonWhitelisted?: boolean;
31
+ /**
32
+ * Groups to be used during validation of the object.
33
+ */
34
+ groups?: string[];
35
+ /**
36
+ * Set default for `always` option of decorators. Default can be overridden in decorator options.
37
+ */
38
+ always?: boolean;
39
+ /**
40
+ * If [groups]{@link ValidatorOptions#groups} is not given or is empty,
41
+ * ignore decorators with at least one group.
42
+ */
43
+ strictGroups?: boolean;
44
+ /**
45
+ * If set to true, the validation will not use default messages.
46
+ * Error message always will be undefined if its not explicitly set.
47
+ */
48
+ dismissDefaultMessages?: boolean;
49
+ /**
50
+ * ValidationError special options.
51
+ */
52
+ validationError?: {
53
+ /**
54
+ * Indicates if target should be exposed in ValidationError.
55
+ */
56
+ target?: boolean;
57
+ /**
58
+ * Indicates if validated value should be exposed in ValidationError.
59
+ */
60
+ value?: boolean;
61
+ };
62
+ /**
63
+ * Fails validation for objects unknown to class-validator. Defaults to false.
64
+ *
65
+ * For instance, since a plain empty object has no annotations used for validation:
66
+ * - `validate({})` // passes
67
+ * - `validate({}, { forbidUnknownValues: true })` // fails.
68
+ * - `validate(new SomeAnnotatedEmptyClass(), { forbidUnknownValues: true })` // passes.
69
+ */
70
+ forbidUnknownValues?: boolean;
71
+ /**
72
+ * When set to true, validation of the given property will stop after encountering the first error. Defaults to false.
73
+ */
74
+ stopAtFirstError?: boolean;
75
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Validation schema is a decorator-free way of validation of your objects.
3
+ * Also using validation schemas makes this library to be easily used with es6/es5.
4
+ */
5
+ export interface ValidationSchema {
6
+ /**
7
+ * Schema name. This is required, because we tell validator to validate by this schema using its name.
8
+ */
9
+ name: string;
10
+ /**
11
+ * Validated properties.
12
+ */
13
+ properties: {
14
+ /**
15
+ * Name of the object's property to be validated which holds an array of validation constraints.
16
+ */
17
+ [propertyName: string]: {
18
+ /**
19
+ * Validation type. Should be one of the ValidationTypes value.
20
+ */
21
+ type: string;
22
+ /**
23
+ * Validator name.
24
+ */
25
+ name?: string;
26
+ /**
27
+ * Constraints set by validation type.
28
+ */
29
+ constraints?: any[];
30
+ /**
31
+ * Error message used to be used on validation fail.
32
+ * You can use "$value" to use value that was failed by validation.
33
+ * You can use "$constraint1" and "$constraint2" keys in the message string,
34
+ * and they will be replaced with constraint values if they exist.
35
+ * Message can be either string, either a function that returns a string.
36
+ * Second option allows to use values and custom messages depend of them.
37
+ */
38
+ message?: string | ((value?: any, constraint1?: any, constraint2?: any) => string);
39
+ /**
40
+ * Specifies if validated value is an array and each of its item must be validated.
41
+ */
42
+ each?: boolean;
43
+ /**
44
+ * Indicates if validation must be performed always, no matter of validation groups used.
45
+ */
46
+ always?: boolean;
47
+ /**
48
+ * Validation groups used for this validation.
49
+ */
50
+ groups?: string[];
51
+ /**
52
+ * Specific validation type options.
53
+ */
54
+ options?: any;
55
+ }[];
56
+ };
57
+ }
@@ -0,0 +1,8 @@
1
+ import { ValidationSchema } from './ValidationSchema';
2
+ import { ValidationMetadata } from '../metadata/ValidationMetadata';
3
+ /**
4
+ * Used to transform validation schemas to validation metadatas.
5
+ */
6
+ export declare class ValidationSchemaToMetadataTransformer {
7
+ transform(schema: ValidationSchema): ValidationMetadata[];
8
+ }
package/package.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "@archbase/core",
3
+ "version": "3.0.0",
4
+ "description": "Core utilities and foundation for Archbase React v3",
5
+ "author": "Edson Martins <edsonmartins2005@gmail.com>",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "./dist/index.js",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "source": "./src/index.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js",
16
+ "require": "./dist/index.js"
17
+ },
18
+ "./utils": {
19
+ "types": "./dist/utils/index.d.ts",
20
+ "import": "./dist/utils/index.js",
21
+ "require": "./dist/utils/index.js"
22
+ },
23
+ "./styles": {
24
+ "import": "./dist/styles.css"
25
+ },
26
+ "./dist/index.css": "./dist/index.css"
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "README.md"
31
+ ],
32
+ "peerDependencies": {
33
+ "@mantine/core": "8.3.12",
34
+ "@mantine/dates": "8.3.12",
35
+ "@mantine/hooks": "8.3.12",
36
+ "@mantine/modals": "8.3.12",
37
+ "@mantine/notifications": "8.3.12",
38
+ "@mantine/spotlight": "8.3.12",
39
+ "react": "^18.3.0 || ^19.0.0",
40
+ "react-dom": "^18.3.0 || ^19.0.0"
41
+ },
42
+ "dependencies": {
43
+ "@juggle/resize-observer": "^3.4.0",
44
+ "@tanstack/react-query": "^5.25.0",
45
+ "class-transformer": "^0.5.1",
46
+ "class-validator": "^0.14.0",
47
+ "date-fns": "^2.30.0",
48
+ "dayjs": "^1.11.10",
49
+ "dot-prop": "^8.0.2",
50
+ "i18next": "^23.10.0",
51
+ "i18next-browser-languagedetector": "^7.2.0",
52
+ "inversify": "^6.2.0",
53
+ "inversify-react": "^1.2.0",
54
+ "lodash": "^4.17.21",
55
+ "lz-string": "^1.5.0",
56
+ "query-string": "^8.2.0",
57
+ "react-i18next": "^13.5.0",
58
+ "react-pro-sidebar": "^1.1.0",
59
+ "react-router-dom": "^6.22.0",
60
+ "react-use": "^17.5.0",
61
+ "reflect-metadata": "^0.2.2",
62
+ "use-query-params": "^2.2.1",
63
+ "usehooks-ts": "^2.16.0",
64
+ "uuid": "^9.0.1",
65
+ "validator": "^13.11.0"
66
+ },
67
+ "devDependencies": {
68
+ "@types/react": "^19.0.4",
69
+ "@types/react-dom": "^19.0.2",
70
+ "@types/validator": "^13.15.10",
71
+ "@vitejs/plugin-react": "^4.3.4",
72
+ "react": "^19.0.0",
73
+ "react-dom": "^19.0.0",
74
+ "typescript": "~5.7.2",
75
+ "vite": "^6.0.3",
76
+ "vite-plugin-external": "^6.2.2",
77
+ "vitest": "^2.1.8"
78
+ },
79
+ "scripts": {
80
+ "dev": "NODE_OPTIONS=\"--max-old-space-size=16384\" vite build --watch",
81
+ "build": "NODE_OPTIONS=\"--max-old-space-size=16384\" vite build && tsc --emitDeclarationOnly || true",
82
+ "test": "vitest run",
83
+ "test:watch": "vitest",
84
+ "test:coverage": "vitest run --coverage",
85
+ "lint": "eslint . --max-warnings 0",
86
+ "clean": "rm -rf dist .turbo node_modules"
87
+ }
88
+ }