@bolttech/form-engine-core 1.0.10 → 1.1.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 (64) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/credit-card.d.ts +743 -0
  3. package/credit-card.esm.js +1 -0
  4. package/currency.d.ts +131 -0
  5. package/currency.esm.js +1 -0
  6. package/date.d.ts +582 -0
  7. package/date.esm.js +1 -0
  8. package/document.d.ts +527 -0
  9. package/document.esm.js +1 -0
  10. package/index.d.ts +52 -5
  11. package/index.esm.js +1 -4570
  12. package/lite.d.ts +2393 -0
  13. package/lite.esm.js +1 -0
  14. package/package.json +34 -2
  15. package/src/constants/constants.d.ts +11 -0
  16. package/src/formatters/creditCard.d.ts +23 -0
  17. package/src/formatters/custom.d.ts +29 -0
  18. package/src/formatters/handler.d.ts +2 -0
  19. package/src/formatters/regex.d.ts +47 -0
  20. package/src/formatters/splitter.d.ts +17 -0
  21. package/src/formatters/string.d.ts +88 -0
  22. package/src/helpers/SafeSubject.d.ts +21 -0
  23. package/src/helpers/creditCard.d.ts +95 -0
  24. package/src/helpers/helpers.d.ts +66 -0
  25. package/src/helpers/lodash-replacements.d.ts +41 -0
  26. package/src/helpers/validation.d.ts +28 -0
  27. package/src/index.d.ts +15 -0
  28. package/src/interfaces/schema.d.ts +161 -0
  29. package/src/interfaces/state.d.ts +22 -0
  30. package/src/lite.d.ts +30 -0
  31. package/src/managers/field.d.ts +339 -0
  32. package/src/managers/form.d.ts +357 -0
  33. package/src/managers/formGroup.d.ts +110 -0
  34. package/src/managers/index.d.ts +3 -0
  35. package/src/masks/creditCard.d.ts +60 -0
  36. package/src/masks/currency.d.ts +29 -0
  37. package/src/masks/generic.d.ts +39 -0
  38. package/src/masks/handler.d.ts +2 -0
  39. package/src/masks/string.d.ts +37 -0
  40. package/src/plugins/credit-card.d.ts +4 -0
  41. package/src/plugins/currency.d.ts +2 -0
  42. package/src/plugins/date.d.ts +2 -0
  43. package/src/plugins/document.d.ts +2 -0
  44. package/src/registry.d.ts +20 -0
  45. package/src/types/event.d.ts +175 -0
  46. package/src/types/form.d.ts +55 -0
  47. package/src/types/mapper.d.ts +87 -0
  48. package/src/types/schema.d.ts +1001 -0
  49. package/src/types/template.d.ts +65 -0
  50. package/src/types/utility.d.ts +12 -0
  51. package/src/validations/creditCard.d.ts +52 -0
  52. package/src/validations/custom.d.ts +27 -0
  53. package/src/validations/date.d.ts +79 -0
  54. package/src/validations/document.d.ts +25 -0
  55. package/src/validations/handler.d.ts +2 -0
  56. package/src/validations/length.d.ts +39 -0
  57. package/src/validations/list.d.ts +32 -0
  58. package/src/validations/logical.d.ts +75 -0
  59. package/src/validations/multiple.d.ts +31 -0
  60. package/src/validations/namedRule.d.ts +22 -0
  61. package/src/validations/number.d.ts +145 -0
  62. package/src/validations/object.d.ts +44 -0
  63. package/src/validations/regex.d.ts +217 -0
  64. package/src/validations/string.d.ts +53 -0
@@ -0,0 +1,217 @@
1
+ import { TValidationMethods } from '../types/schema';
2
+ /**
3
+ * Validates if a value matches a given regular expression.
4
+ *
5
+ * @param value - The value to be checked.
6
+ * @param validations - An object containing the regex pattern for validation.
7
+ * @returns `true` if the value does not match the regex, otherwise `false`.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import { regex } from './path/to/validationFunctions';
12
+ *
13
+ * const validations = { regex: '^[a-zA-Z0-9]*$' };
14
+ *
15
+ * const isValid = regex('abc123', validations);
16
+ * console.log(isValid); // Output: false
17
+ *
18
+ * // Using from a JSON config
19
+ * const config = {
20
+ * inputValue: 'abc123',
21
+ * validations: { regex: '^[a-zA-Z0-9]*$' }
22
+ * };
23
+ *
24
+ * const isValid = regex(config.inputValue, config.validations);
25
+ * console.log(isValid); // Output: false
26
+ * ```
27
+ */
28
+ export declare const regex: (value: unknown, validations: TValidationMethods) => boolean;
29
+ /**
30
+ * Validates if a value is a valid email address.
31
+ *
32
+ * @param value - The value to be checked.
33
+ * @param validations - An object containing the email validation flag.
34
+ * @returns `true` if the value is not a valid email, otherwise `false`.
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * import { email } from './path/to/validationFunctions';
39
+ *
40
+ * const validations = { email: true };
41
+ *
42
+ * const isValid = email('test@example.com', validations);
43
+ * console.log(isValid); // Output: false
44
+ *
45
+ * // Using from a JSON config
46
+ * const config = {
47
+ * inputValue: 'invalid-email',
48
+ * validations: { email: true }
49
+ * };
50
+ *
51
+ * const isValid = email(config.inputValue, config.validations);
52
+ * console.log(isValid); // Output: true
53
+ * ```
54
+ */
55
+ export declare const email: (value: unknown, validations: TValidationMethods) => boolean;
56
+ /**
57
+ * Validates if a value is a valid URL.
58
+ *
59
+ * @param value - The value to be checked.
60
+ * @param validations - An object containing the URL validation flag.
61
+ * @returns `true` if the value is not a valid URL, otherwise `false`.
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * import { url } from './path/to/validationFunctions';
66
+ *
67
+ * const validations = { url: true };
68
+ *
69
+ * const isValid = url('https://example.com', validations);
70
+ * console.log(isValid); // Output: false
71
+ *
72
+ * // Using from a JSON config
73
+ * const config = {
74
+ * inputValue: 'invalid-url',
75
+ * validations: { url: true }
76
+ * };
77
+ *
78
+ * const isValid = url(config.inputValue, config.validations);
79
+ * console.log(isValid); // Output: true
80
+ * ```
81
+ */
82
+ export declare const url: (value: unknown, validations: TValidationMethods) => boolean;
83
+ /**
84
+ * Validates if a value contains only letters.
85
+ *
86
+ * @param value - The value to be checked.
87
+ * @param validations - An object containing the onlyLetters validation flag.
88
+ * @returns `true` if the value contains non-letter characters, otherwise `false`.
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * import { onlyLetters } from './path/to/validationFunctions';
93
+ *
94
+ * const validations = { onlyLetters: true };
95
+ *
96
+ * const isValid = onlyLetters('abc', validations);
97
+ * console.log(isValid); // Output: false
98
+ *
99
+ * // Using from a JSON config
100
+ * const config = {
101
+ * inputValue: '123',
102
+ * validations: { onlyLetters: true }
103
+ * };
104
+ *
105
+ * const isValid = onlyLetters(config.inputValue, config.validations);
106
+ * console.log(isValid); // Output: true
107
+ * ```
108
+ */
109
+ export declare const onlyLetters: (value: unknown, validations: TValidationMethods) => boolean;
110
+ /**
111
+ * Validates if a value does not contain spaces.
112
+ *
113
+ * @param value - The value to be checked.
114
+ * @param validations - An object containing the notAllowSpaces validation flag.
115
+ * @returns `true` if the value contains spaces, otherwise `false`.
116
+ *
117
+ * @example
118
+ * ```typescript
119
+ * import { notAllowSpaces } from './path/to/validationFunctions';
120
+ *
121
+ * const validations = { notAllowSpaces: true };
122
+ *
123
+ * const isValid = notAllowSpaces('no spaces', validations);
124
+ * console.log(isValid); // Output: true
125
+ *
126
+ * // Using from a JSON config
127
+ * const config = {
128
+ * inputValue: 'nospaces',
129
+ * validations: { notAllowSpaces: true }
130
+ * };
131
+ *
132
+ * const isValid = notAllowSpaces(config.inputValue, config.validations);
133
+ * console.log(isValid); // Output: false
134
+ * ```
135
+ */
136
+ export declare const notAllowSpaces: (value: unknown, validations: TValidationMethods) => boolean;
137
+ /**
138
+ * Validates if a value is a number.
139
+ *
140
+ * @param value - The value to be checked.
141
+ * @param validations - An object containing the isNumber validation flag.
142
+ * @returns `true` if the value is not a number, otherwise `false`.
143
+ *
144
+ * @example
145
+ * ```typescript
146
+ * import { isNumber } from './path/to/validationFunctions';
147
+ *
148
+ * const validations = { isNumber: true };
149
+ *
150
+ * const isValid = isNumber('123', validations);
151
+ * console.log(isValid); // Output: false
152
+ *
153
+ * // Using from a JSON config
154
+ * const config = {
155
+ * inputValue: 'abc',
156
+ * validations: { isNumber: true }
157
+ * };
158
+ *
159
+ * const isValid = isNumber(config.inputValue, config.validations);
160
+ * console.log(isValid); // Output: true
161
+ * ```
162
+ */
163
+ export declare const isNumber: (value: unknown, validations: TValidationMethods) => boolean;
164
+ /**
165
+ * Validates if a value has no trailing or leading spaces.
166
+ *
167
+ * @param value - The value to be checked.
168
+ * @param validations - An object containing the hasNoExtraSpaces validation flag.
169
+ * @returns `true` if the value has trailing or leading spaces, otherwise `false`.
170
+ *
171
+ * @example
172
+ * ```typescript
173
+ * import { hasNoExtraSpaces } from './path/to/validationFunctions';
174
+ *
175
+ * const validations = { hasNoExtraSpaces: true };
176
+ *
177
+ * const isValid = hasNoExtraSpaces('Hello', validations);
178
+ * console.log(isValid); // Output: true
179
+ *
180
+ * // Using from a JSON config
181
+ * const config = {
182
+ * inputValue: ' Hello ',
183
+ * validations: { hasNoExtraSpaces: true }
184
+ * };
185
+ *
186
+ * const isValid = hasNoExtraSpaces(config.inputValue, config.validations);
187
+ * console.log(isValid); // Output: false
188
+ * ```
189
+ */
190
+ export declare const hasNoExtraSpaces: (value: unknown, validations: TValidationMethods) => boolean;
191
+ /**
192
+ * Validates if a value contains repeated digits.
193
+ *
194
+ * @param value - The value to be checked.
195
+ * @param validations - An object containing the repeated validation flag.
196
+ * @returns `true` if the value contains repeated digits, otherwise `false`.
197
+ *
198
+ * @example
199
+ * ```typescript
200
+ * import { repeated } from './path/to/validationFunctions';
201
+ *
202
+ * const validations = { repeated: true };
203
+ *
204
+ * const isValid = repeated('1231', validations);
205
+ * console.log(isValid); // Output: true
206
+ *
207
+ * // Using from a JSON config
208
+ * const config = {
209
+ * inputValue: '1234',
210
+ * validations: { repeated: true }
211
+ * };
212
+ *
213
+ * const isValid = repeated(config.inputValue, config.validations);
214
+ * console.log(isValid); // Output: false
215
+ * ```
216
+ */
217
+ export declare const repeated: (value: unknown, validations: TValidationMethods) => boolean;
@@ -0,0 +1,53 @@
1
+ import { TValidationMethods } from '../types/schema';
2
+ /**
3
+ * Validates that a string value is not empty.
4
+ *
5
+ * @param {string} value - The value to be validated.
6
+ * @param {TValidationMethods} validations - The validation methods object containing the notEmpty validation rule.
7
+ * @returns {boolean} - Returns `true` if the value is empty and the notEmpty validation rule is set, otherwise `false`.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * // Assume validations is an object with a notEmpty property
12
+ * const validations = { notEmpty: true };
13
+ *
14
+ * // Returns true because the string is empty
15
+ * const result1 = notEmpty('', validations);
16
+ * console.log(result1); // true
17
+ *
18
+ * // Returns false because the string is not empty
19
+ * const result2 = notEmpty('hello', validations);
20
+ * console.log(result2); // false
21
+ *
22
+ * // Returns false because the notEmpty validation rule is not set
23
+ * const result3 = notEmpty('', { notEmpty: false });
24
+ * console.log(result3); // false
25
+ * ```
26
+ */
27
+ export declare const notEmpty: (value: unknown, validations: TValidationMethods) => boolean;
28
+ /**
29
+ * Validates that a value matches a specified value.
30
+ *
31
+ * @param {unknown} value - The value to be validated.
32
+ * @param {TValidationMethods} validations - The validation methods object containing the value validation rule.
33
+ * @returns {boolean} - Returns `true` if the value does not match the specified validation value, otherwise `false`.
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * // Assume validations is an object with a value property
38
+ * const validations = { value: 42 };
39
+ *
40
+ * // Returns true because the value does not match the validation value
41
+ * const result1 = value(10, validations);
42
+ * console.log(result1); // true
43
+ *
44
+ * // Returns false because the value matches the validation value
45
+ * const result2 = value(42, validations);
46
+ * console.log(result2); // false
47
+ *
48
+ * // Returns false because the value validation rule is not set
49
+ * const result3 = value(10, { value: undefined });
50
+ * console.log(result3); // false
51
+ * ```
52
+ */
53
+ export declare const value: (value: unknown, validations?: TValidationMethods) => boolean;