@77sol-lab/form-schemas 1.2.0 → 1.3.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.
- package/chunk-52KJIJBF.mjs +45 -0
- package/{chunk-X4DDGGAB.mjs → chunk-KKGV43J4.mjs} +18 -1
- package/chunk-XNACW46V.mjs +105 -0
- package/financing/formalization/index.d.cts +1577 -244
- package/financing/formalization/index.d.ts +1577 -244
- package/financing/formalization/index.js +158 -0
- package/financing/formalization/index.mjs +3 -1
- package/financing/formalization/schemas/UnifiedPFSchema.d.cts +535 -0
- package/financing/formalization/schemas/UnifiedPFSchema.d.ts +535 -0
- package/financing/formalization/schemas/UnifiedPFSchema.js +248 -0
- package/financing/formalization/schemas/UnifiedPFSchema.mjs +3 -0
- package/financing/formalization/schemas/UnifiedPJSchema.d.cts +1335 -0
- package/financing/formalization/schemas/UnifiedPJSchema.d.ts +1335 -0
- package/financing/formalization/schemas/UnifiedPJSchema.js +268 -0
- package/financing/formalization/schemas/UnifiedPJSchema.mjs +3 -0
- package/index.d.cts +3 -1
- package/index.d.ts +3 -1
- package/index.js +158 -0
- package/index.mjs +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { DocumentTypeEnum } from './chunk-A2TV7TRP.mjs';
|
|
2
|
+
import { issueDateSchema, currencySchema, emailSchema, phoneBRSchema, SexEnum, birthDateSchema, cpfSchema, cepSchema, formalizationExtras, textField, cnpjSchema, numberField, integerField, cpfCnpjSchema, applyPfRefinements } from './chunk-NDJRJOFE.mjs';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
var unifiedPfObject = z.object({
|
|
6
|
+
...formalizationExtras,
|
|
7
|
+
name: textField(),
|
|
8
|
+
cep: cepSchema,
|
|
9
|
+
cpf: cpfSchema,
|
|
10
|
+
address: textField(),
|
|
11
|
+
birth_date: birthDateSchema,
|
|
12
|
+
number: textField(),
|
|
13
|
+
sex: SexEnum,
|
|
14
|
+
complement: textField(15).optional(),
|
|
15
|
+
mother_name: textField(),
|
|
16
|
+
district: textField(),
|
|
17
|
+
energy_account_in_requester_name: textField(),
|
|
18
|
+
city: textField(),
|
|
19
|
+
energy_bill_owner_document: cpfCnpjSchema.optional(),
|
|
20
|
+
state: textField(2),
|
|
21
|
+
nationality: textField(),
|
|
22
|
+
cellphone: phoneBRSchema,
|
|
23
|
+
email: emailSchema,
|
|
24
|
+
monthly_income: currencySchema,
|
|
25
|
+
profession: textField(),
|
|
26
|
+
type_doc: DocumentTypeEnum,
|
|
27
|
+
doc: textField(15),
|
|
28
|
+
issuing_body: textField(6),
|
|
29
|
+
doc_issue_date: issueDateSchema,
|
|
30
|
+
residence_situation: textField().optional(),
|
|
31
|
+
months_in_residence: integerField.optional(),
|
|
32
|
+
is_installation_at_requester: textField().optional(),
|
|
33
|
+
civil_status: textField().optional(),
|
|
34
|
+
uf_naturalness: textField(2).optional(),
|
|
35
|
+
naturalness: textField().optional(),
|
|
36
|
+
nature_of_occupation: textField().optional(),
|
|
37
|
+
company_time: numberField.optional(),
|
|
38
|
+
cnpj_proprietary: cnpjSchema.optional(),
|
|
39
|
+
equity_value: currencySchema.optional(),
|
|
40
|
+
emitting_state: textField(2).optional(),
|
|
41
|
+
pep_relationship: textField().optional()
|
|
42
|
+
});
|
|
43
|
+
var unifiedPfSchema = unifiedPfObject.strict().superRefine(applyPfRefinements);
|
|
44
|
+
|
|
45
|
+
export { unifiedPfObject, unifiedPfSchema };
|
|
@@ -4,6 +4,8 @@ import { solAgoraPfObject, solAgoraPfSchema } from './chunk-RMWCQ6YU.mjs';
|
|
|
4
4
|
import { solAgoraPjObject, solAgoraPjSchema } from './chunk-B7RDVG4R.mjs';
|
|
5
5
|
import { solfacilPfObject, solfacilPfSchema } from './chunk-KXEEZLMR.mjs';
|
|
6
6
|
import { solfacilPjObject, solfacilPjSchema } from './chunk-XUMC3TQU.mjs';
|
|
7
|
+
import { unifiedPfSchema, unifiedPfObject } from './chunk-52KJIJBF.mjs';
|
|
8
|
+
import { unifiedPjSchema, unifiedPjObject } from './chunk-XNACW46V.mjs';
|
|
7
9
|
import { eosPfObject, eosPfSchema } from './chunk-ORO6OVTB.mjs';
|
|
8
10
|
import { eosPjObject, eosPjSchema } from './chunk-36GQASLI.mjs';
|
|
9
11
|
import { hdtEnergyPfObject, hdtEnergyPfSchema } from './chunk-2TGZGHS3.mjs';
|
|
@@ -48,6 +50,15 @@ var BANK_SLUGS = [
|
|
|
48
50
|
var BankEnum = z.enum(BANK_SLUGS);
|
|
49
51
|
|
|
50
52
|
// src/domains/financing/formalization/registry.ts
|
|
53
|
+
var UNIFIED_SLUG = "unified";
|
|
54
|
+
var unifiedSchemaByPerson = {
|
|
55
|
+
pf: unifiedPfSchema,
|
|
56
|
+
pj: unifiedPjSchema
|
|
57
|
+
};
|
|
58
|
+
var unifiedBaseSchemaByPerson = {
|
|
59
|
+
pf: unifiedPfObject,
|
|
60
|
+
pj: unifiedPjObject
|
|
61
|
+
};
|
|
51
62
|
var pfSchemaRegistry = {
|
|
52
63
|
credito77: credito77PfSchema,
|
|
53
64
|
losango: losangoPfSchema,
|
|
@@ -122,12 +133,18 @@ function isCredito77WithoutPrestamista(bank, person, options) {
|
|
|
122
133
|
return bank === "credito77" && person === "pf" && !options.prestamistaIncluso;
|
|
123
134
|
}
|
|
124
135
|
function getFormalizationSchema(bank, person, options = {}) {
|
|
136
|
+
if (bank === UNIFIED_SLUG) {
|
|
137
|
+
return unifiedSchemaByPerson[person];
|
|
138
|
+
}
|
|
125
139
|
if (isCredito77WithoutPrestamista(bank, person, options)) {
|
|
126
140
|
return credito77PfObject.omit(CREDITO77_PRESTAMISTA_FIELDS).strict().superRefine(applyPfRefinements);
|
|
127
141
|
}
|
|
128
142
|
return person === "pf" ? pfSchemaRegistry[bank] : pjSchemaRegistry[bank];
|
|
129
143
|
}
|
|
130
144
|
function getFormalizationBaseSchema(bank, person, options = {}) {
|
|
145
|
+
if (bank === UNIFIED_SLUG) {
|
|
146
|
+
return unifiedBaseSchemaByPerson[person];
|
|
147
|
+
}
|
|
131
148
|
if (isCredito77WithoutPrestamista(bank, person, options)) {
|
|
132
149
|
return credito77PfObject.omit(CREDITO77_PRESTAMISTA_FIELDS);
|
|
133
150
|
}
|
|
@@ -230,4 +247,4 @@ var FORMALIZATION_FIELD_META = {
|
|
|
230
247
|
}
|
|
231
248
|
};
|
|
232
249
|
|
|
233
|
-
export { BANK_SLUGS, BankEnum, FORMALIZATION_FIELD_META, getFormalizationBaseSchema, getFormalizationSchema, pfBaseSchemaRegistry, pfSchemaRegistry, pjBaseSchemaRegistry, pjSchemaRegistry };
|
|
250
|
+
export { BANK_SLUGS, BankEnum, FORMALIZATION_FIELD_META, UNIFIED_SLUG, getFormalizationBaseSchema, getFormalizationSchema, pfBaseSchemaRegistry, pfSchemaRegistry, pjBaseSchemaRegistry, pjSchemaRegistry };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { DocumentTypeEnum } from './chunk-A2TV7TRP.mjs';
|
|
2
|
+
import { formalizationExtras, SexEnum, emailSchema, phoneBRSchema, cepSchema, birthDateSchema, cpfSchema, textField, issueDateSchema, currencySchema, dateDMYSchema, integerField, cnpjSchema, applyPjRefinements } from './chunk-NDJRJOFE.mjs';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
var unifiedPjObject = z.object({
|
|
6
|
+
...formalizationExtras,
|
|
7
|
+
financing_company: z.object({
|
|
8
|
+
corporate_name: textField(),
|
|
9
|
+
cnpj: cnpjSchema,
|
|
10
|
+
foundation_date: issueDateSchema,
|
|
11
|
+
address: textField(),
|
|
12
|
+
number: textField(),
|
|
13
|
+
email: emailSchema,
|
|
14
|
+
complement: textField(15).optional(),
|
|
15
|
+
phone: phoneBRSchema,
|
|
16
|
+
district: textField(),
|
|
17
|
+
legal_nature: textField(),
|
|
18
|
+
city: textField(),
|
|
19
|
+
state: textField(2),
|
|
20
|
+
cep: cepSchema,
|
|
21
|
+
economic_activity: textField().optional(),
|
|
22
|
+
economic_activity_group: textField().optional(),
|
|
23
|
+
monthly_income: currencySchema.optional(),
|
|
24
|
+
residence_situation: textField().optional(),
|
|
25
|
+
months_in_residence: integerField.optional(),
|
|
26
|
+
capital_social: currencySchema.optional()
|
|
27
|
+
}).strict(),
|
|
28
|
+
financing_company_guarantor: z.array(
|
|
29
|
+
z.object({
|
|
30
|
+
name: textField(),
|
|
31
|
+
cpf: cpfSchema,
|
|
32
|
+
birth_date: birthDateSchema,
|
|
33
|
+
address: textField(),
|
|
34
|
+
number: textField(),
|
|
35
|
+
cep: cepSchema,
|
|
36
|
+
complement: textField(15).optional(),
|
|
37
|
+
cellphone: phoneBRSchema,
|
|
38
|
+
email: emailSchema,
|
|
39
|
+
district: textField(),
|
|
40
|
+
sex: SexEnum,
|
|
41
|
+
city: textField(),
|
|
42
|
+
state: textField(2),
|
|
43
|
+
mother_name: textField(),
|
|
44
|
+
nationality: textField(),
|
|
45
|
+
office: textField().optional(),
|
|
46
|
+
phone: phoneBRSchema.optional(),
|
|
47
|
+
civil_status: textField().optional(),
|
|
48
|
+
residence_situation: textField().optional(),
|
|
49
|
+
months_in_residence: integerField.optional(),
|
|
50
|
+
type_doc: DocumentTypeEnum.optional(),
|
|
51
|
+
doc: textField().optional(),
|
|
52
|
+
issuing_body: textField().optional(),
|
|
53
|
+
uf_issuing_body: textField(2).optional(),
|
|
54
|
+
doc_issue_date: issueDateSchema.optional(),
|
|
55
|
+
doc_expiration_date: dateDMYSchema.optional(),
|
|
56
|
+
monthly_income: currencySchema.optional(),
|
|
57
|
+
patrimony: currencySchema.optional(),
|
|
58
|
+
naturalness: textField().optional(),
|
|
59
|
+
uf_naturalness: textField(2).optional(),
|
|
60
|
+
pep_relationship: textField().optional(),
|
|
61
|
+
entry_date: issueDateSchema.optional(),
|
|
62
|
+
doc_issuance_uf: textField(2).optional()
|
|
63
|
+
}).strict()
|
|
64
|
+
).optional(),
|
|
65
|
+
financing_company_qsa: z.array(
|
|
66
|
+
z.object({
|
|
67
|
+
name: textField(),
|
|
68
|
+
cpf: cpfSchema,
|
|
69
|
+
birth_date: birthDateSchema,
|
|
70
|
+
address: textField(),
|
|
71
|
+
number: textField(),
|
|
72
|
+
cep: cepSchema,
|
|
73
|
+
complement: textField(15).optional(),
|
|
74
|
+
cellphone: phoneBRSchema,
|
|
75
|
+
email: emailSchema,
|
|
76
|
+
district: textField(),
|
|
77
|
+
sex: SexEnum,
|
|
78
|
+
city: textField(),
|
|
79
|
+
state: textField(2),
|
|
80
|
+
mother_name: textField(),
|
|
81
|
+
nationality: textField(),
|
|
82
|
+
office: textField().optional(),
|
|
83
|
+
phone: phoneBRSchema.optional(),
|
|
84
|
+
civil_status: textField().optional(),
|
|
85
|
+
residence_situation: textField().optional(),
|
|
86
|
+
months_in_residence: integerField.optional(),
|
|
87
|
+
type_doc: DocumentTypeEnum.optional(),
|
|
88
|
+
doc: textField().optional(),
|
|
89
|
+
issuing_body: textField().optional(),
|
|
90
|
+
uf_issuing_body: textField(2).optional(),
|
|
91
|
+
doc_issue_date: issueDateSchema.optional(),
|
|
92
|
+
doc_expiration_date: dateDMYSchema.optional(),
|
|
93
|
+
monthly_income: currencySchema.optional(),
|
|
94
|
+
patrimony: currencySchema.optional(),
|
|
95
|
+
naturalness: textField().optional(),
|
|
96
|
+
uf_naturalness: textField(2).optional(),
|
|
97
|
+
pep_relationship: textField().optional(),
|
|
98
|
+
entry_date: issueDateSchema.optional(),
|
|
99
|
+
doc_issuance_uf: textField(2).optional()
|
|
100
|
+
}).strict()
|
|
101
|
+
).optional()
|
|
102
|
+
});
|
|
103
|
+
var unifiedPjSchema = unifiedPjObject.strict().superRefine(applyPjRefinements);
|
|
104
|
+
|
|
105
|
+
export { unifiedPjObject, unifiedPjSchema };
|