@cobre-npm/library-onboarding-core 0.7.4 → 0.7.6
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.
|
@@ -14,6 +14,7 @@ export type FieldValidationRule = {
|
|
|
14
14
|
};
|
|
15
15
|
export interface FieldValidation {
|
|
16
16
|
readonly maxLength?: number;
|
|
17
|
+
readonly minLength?: number;
|
|
17
18
|
readonly rule?: FieldValidationRule;
|
|
18
19
|
readonly noSpaces?: boolean;
|
|
19
20
|
}
|
|
@@ -21,5 +22,6 @@ export declare const FIELD_VALIDATIONS: Record<string, FieldValidation>;
|
|
|
21
22
|
export declare const getFieldValidation: (fieldName: string) => FieldValidation | undefined;
|
|
22
23
|
export declare const getFieldRule: (fieldName: string) => FieldValidationRule | undefined;
|
|
23
24
|
export declare const getFieldMaxLength: (fieldName: string, fallback?: number) => number;
|
|
25
|
+
export declare const getFieldMinLength: (fieldName: string) => number | undefined;
|
|
24
26
|
export declare const disallowsSpaces: (fieldName: string) => boolean;
|
|
25
27
|
export declare const hasFieldValidation: (fieldName: string) => boolean;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* (input validation, date bounds); this module holds data + pure lookups only.
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.hasFieldValidation = exports.disallowsSpaces = exports.getFieldMaxLength = exports.getFieldRule = exports.getFieldValidation = exports.FIELD_VALIDATIONS = exports.DEFAULT_NAME_MIN_LENGTH = exports.DEFAULT_PHONE_MAX_LENGTH = exports.DEFAULT_MAX_LENGTH = void 0;
|
|
12
|
+
exports.hasFieldValidation = exports.disallowsSpaces = exports.getFieldMinLength = exports.getFieldMaxLength = exports.getFieldRule = exports.getFieldValidation = exports.FIELD_VALIDATIONS = exports.DEFAULT_NAME_MIN_LENGTH = exports.DEFAULT_PHONE_MAX_LENGTH = exports.DEFAULT_MAX_LENGTH = void 0;
|
|
13
13
|
// Fallback max length when a field declares none.
|
|
14
14
|
exports.DEFAULT_MAX_LENGTH = 500;
|
|
15
15
|
// Fallback max length for phone fields specifically.
|
|
@@ -26,9 +26,9 @@ exports.FIELD_VALIDATIONS = {
|
|
|
26
26
|
incorporation_date: { rule: { kind: "pastDate" } },
|
|
27
27
|
operations_start_date: { rule: { kind: "pastDate" } },
|
|
28
28
|
birth_date: { rule: { kind: "pastDate", minAgeYears: 18 } },
|
|
29
|
-
// Percentage KYC data points.
|
|
30
|
-
percentage_ownership: { rule: { kind: "numericRange", min: 1, max: 100 } },
|
|
31
|
-
cash_transaction_percentage: { rule: { kind: "numericRange", min: 0, max: 100 } },
|
|
29
|
+
// Percentage KYC data points — a space is never part of a number.
|
|
30
|
+
percentage_ownership: { rule: { kind: "numericRange", min: 1, max: 100 }, noSpaces: true },
|
|
31
|
+
cash_transaction_percentage: { rule: { kind: "numericRange", min: 0, max: 100 }, noSpaces: true },
|
|
32
32
|
// Identifiers/codes — length + no-spaces (whitespace is never part of the value).
|
|
33
33
|
tax_id_number: { maxLength: 50, noSpaces: true },
|
|
34
34
|
e_sign_number: { maxLength: 50, noSpaces: true },
|
|
@@ -38,14 +38,19 @@ exports.FIELD_VALIDATIONS = {
|
|
|
38
38
|
number: { maxLength: 50, noSpaces: true },
|
|
39
39
|
third_party_id: { maxLength: 100, noSpaces: true },
|
|
40
40
|
email: { noSpaces: true },
|
|
41
|
+
/*
|
|
42
|
+
* Not identifiers, but whitespace is never part of the value either — a phone,
|
|
43
|
+
* a URL and a count are each broken by a stray space.
|
|
44
|
+
*/
|
|
45
|
+
phone: { minLength: 2, maxLength: exports.DEFAULT_PHONE_MAX_LENGTH, noSpaces: true },
|
|
46
|
+
website: { maxLength: 500, noSpaces: true },
|
|
47
|
+
monthly_counterparties_count: { maxLength: 100, noSpaces: true },
|
|
41
48
|
// Length-only fields.
|
|
42
|
-
phone: { maxLength: exports.DEFAULT_PHONE_MAX_LENGTH },
|
|
43
49
|
legal_name: { maxLength: 300 },
|
|
44
50
|
dba_name: { maxLength: 300 },
|
|
45
51
|
incorporation_state: { maxLength: 100 },
|
|
46
52
|
incorporation_city: { maxLength: 100 },
|
|
47
53
|
business_description: { maxLength: 2000 },
|
|
48
|
-
website: { maxLength: 500 },
|
|
49
54
|
line_1: { maxLength: 200 },
|
|
50
55
|
line_2: { maxLength: 200 },
|
|
51
56
|
city: { maxLength: 100 },
|
|
@@ -62,7 +67,6 @@ exports.FIELD_VALIDATIONS = {
|
|
|
62
67
|
public_office_position: { maxLength: 500 },
|
|
63
68
|
legal_proceedings_description: { maxLength: 5000 },
|
|
64
69
|
funds_source_other_description: { maxLength: 1000 },
|
|
65
|
-
monthly_counterparties_count: { maxLength: 100 },
|
|
66
70
|
};
|
|
67
71
|
const getFieldValidation = (fieldName) => exports.FIELD_VALIDATIONS[fieldName];
|
|
68
72
|
exports.getFieldValidation = getFieldValidation;
|
|
@@ -70,6 +74,9 @@ const getFieldRule = (fieldName) => exports.FIELD_VALIDATIONS[fieldName]?.rule;
|
|
|
70
74
|
exports.getFieldRule = getFieldRule;
|
|
71
75
|
const getFieldMaxLength = (fieldName, fallback = exports.DEFAULT_MAX_LENGTH) => exports.FIELD_VALIDATIONS[fieldName]?.maxLength ?? fallback;
|
|
72
76
|
exports.getFieldMaxLength = getFieldMaxLength;
|
|
77
|
+
// Undefined when the field declares no floor — consumers skip the check entirely.
|
|
78
|
+
const getFieldMinLength = (fieldName) => exports.FIELD_VALIDATIONS[fieldName]?.minLength;
|
|
79
|
+
exports.getFieldMinLength = getFieldMinLength;
|
|
73
80
|
const disallowsSpaces = (fieldName) => exports.FIELD_VALIDATIONS[fieldName]?.noSpaces === true;
|
|
74
81
|
exports.disallowsSpaces = disallowsSpaces;
|
|
75
82
|
const hasFieldValidation = (fieldName) => (0, exports.getFieldValidation)(fieldName) !== undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -2419,8 +2419,15 @@ export declare const locales: {
|
|
|
2419
2419
|
invalid: string;
|
|
2420
2420
|
nameFormat: string;
|
|
2421
2421
|
nameMinLength: string;
|
|
2422
|
+
numericOnly: string;
|
|
2423
|
+
integerOnly: string;
|
|
2422
2424
|
numericRange: string;
|
|
2425
|
+
alphanumericOnly: string;
|
|
2426
|
+
minLength: string;
|
|
2427
|
+
maxLength: string;
|
|
2423
2428
|
emailFormat: string;
|
|
2429
|
+
urlFormat: string;
|
|
2430
|
+
phoneFormat: string;
|
|
2424
2431
|
};
|
|
2425
2432
|
};
|
|
2426
2433
|
es: {
|
|
@@ -2493,8 +2500,15 @@ export declare const locales: {
|
|
|
2493
2500
|
invalid: string;
|
|
2494
2501
|
nameFormat: string;
|
|
2495
2502
|
nameMinLength: string;
|
|
2503
|
+
numericOnly: string;
|
|
2504
|
+
integerOnly: string;
|
|
2496
2505
|
numericRange: string;
|
|
2506
|
+
alphanumericOnly: string;
|
|
2507
|
+
minLength: string;
|
|
2508
|
+
maxLength: string;
|
|
2497
2509
|
emailFormat: string;
|
|
2510
|
+
urlFormat: string;
|
|
2511
|
+
phoneFormat: string;
|
|
2498
2512
|
};
|
|
2499
2513
|
};
|
|
2500
2514
|
};
|
|
@@ -66,9 +66,16 @@
|
|
|
66
66
|
"validation": {
|
|
67
67
|
"required": "This field is required",
|
|
68
68
|
"invalid": "This field is invalid",
|
|
69
|
-
"nameFormat": "
|
|
69
|
+
"nameFormat": "Use only letters, spaces, apostrophes and hyphens",
|
|
70
70
|
"nameMinLength": "Name must be at least {min} characters",
|
|
71
|
+
"numericOnly": "Use digits only, no letters or symbols",
|
|
72
|
+
"integerOnly": "Enter a whole number, no decimals",
|
|
71
73
|
"numericRange": "Enter a value between {min} and {max}",
|
|
72
|
-
"
|
|
74
|
+
"alphanumericOnly": "Use letters and numbers only",
|
|
75
|
+
"minLength": "Must be at least {min} characters",
|
|
76
|
+
"maxLength": "Cannot exceed {max} characters",
|
|
77
|
+
"emailFormat": "Enter a valid email (e.g. name@company.com)",
|
|
78
|
+
"urlFormat": "Enter a valid website (e.g. company.com)",
|
|
79
|
+
"phoneFormat": "Use digits only for the phone number"
|
|
73
80
|
}
|
|
74
81
|
}
|
|
@@ -66,9 +66,16 @@
|
|
|
66
66
|
"validation": {
|
|
67
67
|
"required": "Este campo es requerido",
|
|
68
68
|
"invalid": "Este campo es inválido",
|
|
69
|
-
"nameFormat": "
|
|
69
|
+
"nameFormat": "Usa solo letras, espacios, apóstrofes y guiones",
|
|
70
70
|
"nameMinLength": "El nombre debe tener al menos {min} caracteres",
|
|
71
|
+
"numericOnly": "Usa solo números, sin letras ni símbolos",
|
|
72
|
+
"integerOnly": "Ingresa un número entero, sin decimales",
|
|
71
73
|
"numericRange": "Ingresa un valor entre {min} y {max}",
|
|
72
|
-
"
|
|
74
|
+
"alphanumericOnly": "Usa solo letras y números",
|
|
75
|
+
"minLength": "Debe tener al menos {min} caracteres",
|
|
76
|
+
"maxLength": "No puede tener más de {max} caracteres",
|
|
77
|
+
"emailFormat": "Ingresa un correo válido (ej. nombre@empresa.com)",
|
|
78
|
+
"urlFormat": "Ingresa un sitio web válido (ej. empresa.com)",
|
|
79
|
+
"phoneFormat": "Usa solo números en el teléfono"
|
|
73
80
|
}
|
|
74
81
|
}
|