@cobre-npm/library-onboarding-core 0.5.0 → 0.6.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.
|
@@ -15,9 +15,11 @@ export type FieldValidationRule = {
|
|
|
15
15
|
export interface FieldValidation {
|
|
16
16
|
readonly maxLength?: number;
|
|
17
17
|
readonly rule?: FieldValidationRule;
|
|
18
|
+
readonly noSpaces?: boolean;
|
|
18
19
|
}
|
|
19
20
|
export declare const FIELD_VALIDATIONS: Record<string, FieldValidation>;
|
|
20
21
|
export declare const getFieldValidation: (fieldName: string) => FieldValidation | undefined;
|
|
21
22
|
export declare const getFieldRule: (fieldName: string) => FieldValidationRule | undefined;
|
|
22
23
|
export declare const getFieldMaxLength: (fieldName: string, fallback?: number) => number;
|
|
24
|
+
export declare const disallowsSpaces: (fieldName: string) => boolean;
|
|
23
25
|
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.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.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.
|
|
@@ -29,12 +29,19 @@ exports.FIELD_VALIDATIONS = {
|
|
|
29
29
|
// Percentage KYC data points.
|
|
30
30
|
percentage_ownership: { rule: { kind: "numericRange", min: 1, max: 100 } },
|
|
31
31
|
cash_transaction_percentage: { rule: { kind: "numericRange", min: 0, max: 100 } },
|
|
32
|
+
// Identifiers/codes — length + no-spaces (whitespace is never part of the value).
|
|
33
|
+
tax_id_number: { maxLength: 50, noSpaces: true },
|
|
34
|
+
e_sign_number: { maxLength: 50, noSpaces: true },
|
|
35
|
+
postal_code: { maxLength: 20, noSpaces: true },
|
|
36
|
+
curp: { maxLength: 18, noSpaces: true },
|
|
37
|
+
migration_form_number: { maxLength: 50, noSpaces: true },
|
|
38
|
+
number: { maxLength: 50, noSpaces: true },
|
|
39
|
+
third_party_id: { maxLength: 100, noSpaces: true },
|
|
40
|
+
email: { noSpaces: true },
|
|
32
41
|
// Length-only fields.
|
|
33
42
|
phone: { maxLength: exports.DEFAULT_PHONE_MAX_LENGTH },
|
|
34
43
|
legal_name: { maxLength: 300 },
|
|
35
44
|
dba_name: { maxLength: 300 },
|
|
36
|
-
tax_id_number: { maxLength: 50 },
|
|
37
|
-
e_sign_number: { maxLength: 50 },
|
|
38
45
|
incorporation_state: { maxLength: 100 },
|
|
39
46
|
incorporation_city: { maxLength: 100 },
|
|
40
47
|
business_description: { maxLength: 2000 },
|
|
@@ -43,24 +50,19 @@ exports.FIELD_VALIDATIONS = {
|
|
|
43
50
|
line_2: { maxLength: 200 },
|
|
44
51
|
city: { maxLength: 100 },
|
|
45
52
|
state: { maxLength: 100 },
|
|
46
|
-
postal_code: { maxLength: 20 },
|
|
47
53
|
tax_id_type: { maxLength: 50 },
|
|
48
|
-
curp: { maxLength: 18 },
|
|
49
54
|
migration_status: { maxLength: 100 },
|
|
50
|
-
migration_form_number: { maxLength: 50 },
|
|
51
55
|
nationality: { maxLength: 100 },
|
|
52
56
|
birth_country: { maxLength: 100 },
|
|
53
57
|
country_of_birth: { maxLength: 100 },
|
|
54
58
|
country_of_residence: { maxLength: 100 },
|
|
55
59
|
state_of_birth: { maxLength: 100 },
|
|
56
60
|
occupation: { maxLength: 200 },
|
|
57
|
-
number: { maxLength: 50 },
|
|
58
61
|
company_relationship: { maxLength: 200 },
|
|
59
62
|
public_office_position: { maxLength: 500 },
|
|
60
63
|
legal_proceedings_description: { maxLength: 5000 },
|
|
61
64
|
funds_source_other_description: { maxLength: 1000 },
|
|
62
65
|
monthly_counterparties_count: { maxLength: 100 },
|
|
63
|
-
third_party_id: { maxLength: 100 },
|
|
64
66
|
};
|
|
65
67
|
const getFieldValidation = (fieldName) => exports.FIELD_VALIDATIONS[fieldName];
|
|
66
68
|
exports.getFieldValidation = getFieldValidation;
|
|
@@ -68,5 +70,7 @@ const getFieldRule = (fieldName) => exports.FIELD_VALIDATIONS[fieldName]?.rule;
|
|
|
68
70
|
exports.getFieldRule = getFieldRule;
|
|
69
71
|
const getFieldMaxLength = (fieldName, fallback = exports.DEFAULT_MAX_LENGTH) => exports.FIELD_VALIDATIONS[fieldName]?.maxLength ?? fallback;
|
|
70
72
|
exports.getFieldMaxLength = getFieldMaxLength;
|
|
73
|
+
const disallowsSpaces = (fieldName) => exports.FIELD_VALIDATIONS[fieldName]?.noSpaces === true;
|
|
74
|
+
exports.disallowsSpaces = disallowsSpaces;
|
|
71
75
|
const hasFieldValidation = (fieldName) => (0, exports.getFieldValidation)(fieldName) !== undefined;
|
|
72
76
|
exports.hasFieldValidation = hasFieldValidation;
|