@77sol-lab/form-schemas 1.7.0 → 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.
- package/{chunk-HMC73HBG.mjs → chunk-4T4DDJJZ.mjs} +7 -7
- package/{chunk-DIYEI2PA.mjs → chunk-65WB3CQB.mjs} +9 -9
- package/{chunk-VP4HT24O.mjs → chunk-6AISIJ3O.mjs} +7 -7
- package/{chunk-LU5ODSGQ.mjs → chunk-7ULQG7YJ.mjs} +9 -9
- package/{chunk-QMODZE4A.mjs → chunk-7VU2KIBV.mjs} +7 -7
- package/chunk-BXLQYGEB.mjs +105 -0
- package/{chunk-VDFDTLU5.mjs → chunk-CGBX6OCD.mjs} +7 -7
- package/{chunk-ENDOIQ32.mjs → chunk-CJSJ3VDW.mjs} +138 -60
- package/{chunk-6ZUOXZY3.mjs → chunk-EG5RVHCZ.mjs} +9 -9
- package/{chunk-5EHEC3RT.mjs → chunk-F4RMWUXJ.mjs} +10 -10
- package/{chunk-KJTTMDZP.mjs → chunk-GBKY6QE3.mjs} +7 -7
- package/{chunk-AM7HTUI3.mjs → chunk-HF7G6PTH.mjs} +9 -9
- package/{chunk-65EE5FW3.mjs → chunk-HX5UJCA2.mjs} +7 -7
- package/{chunk-L3OISOZA.mjs → chunk-HXHJSQ2X.mjs} +9 -9
- package/{chunk-UF45URAJ.mjs → chunk-IVY6IQXZ.mjs} +9 -9
- package/{chunk-FBDTG3WD.mjs → chunk-K3QXEL6M.mjs} +20 -21
- package/{chunk-CPDLICOP.mjs → chunk-LDL7QLPB.mjs} +7 -7
- package/{chunk-ORQ52KPA.mjs → chunk-LRIO6V7H.mjs} +7 -7
- package/{chunk-MM6LQXI6.mjs → chunk-OIGZEDM3.mjs} +7 -7
- package/{chunk-PDBPFNAN.mjs → chunk-OJUTNXHL.mjs} +136 -39
- package/{chunk-KBILM3GO.mjs → chunk-OKAMQBUN.mjs} +7 -7
- package/{chunk-TDL42FZZ.mjs → chunk-PCTF5JYB.mjs} +9 -9
- package/{chunk-2BHUMNK5.mjs → chunk-PCXYLWDD.mjs} +9 -9
- package/chunk-QEPJ2RLU.mjs +18 -0
- package/{chunk-5P6NWFTX.mjs → chunk-QQCSQ3L4.mjs} +10 -10
- package/{chunk-TKHIBI4R.mjs → chunk-R5TJYTTO.mjs} +9 -9
- package/{chunk-U4ZDMJX2.mjs → chunk-T2FBV7WO.mjs} +10 -10
- package/{chunk-RWOX5QO3.mjs → chunk-TNZ33455.mjs} +7 -7
- package/{chunk-Y67MNG2X.mjs → chunk-TWOBBIQC.mjs} +9 -9
- package/{chunk-22SYVROO.mjs → chunk-TZEPVIC4.mjs} +9 -9
- package/{chunk-FIPFWGBQ.mjs → chunk-UK62IINL.mjs} +7 -7
- package/{chunk-BYAXV4TG.mjs → chunk-VTTNXB64.mjs} +7 -7
- package/{chunk-DJDG3UYR.mjs → chunk-VWKF4I2L.mjs} +9 -9
- package/financing/formalization/index.d.cts +4848 -19624
- package/financing/formalization/index.d.ts +4848 -19624
- package/financing/formalization/index.js +516 -278
- package/financing/formalization/index.mjs +33 -33
- package/financing/formalization/schemas/AlfaPFSchema.d.cts +107 -395
- package/financing/formalization/schemas/AlfaPFSchema.d.ts +107 -395
- package/financing/formalization/schemas/AlfaPFSchema.js +127 -47
- package/financing/formalization/schemas/AlfaPFSchema.mjs +3 -3
- package/financing/formalization/schemas/AlfaPJSchema.d.cts +119 -621
- package/financing/formalization/schemas/AlfaPJSchema.d.ts +119 -621
- package/financing/formalization/schemas/AlfaPJSchema.js +188 -46
- package/financing/formalization/schemas/AlfaPJSchema.mjs +2 -2
- package/financing/formalization/schemas/BancoDoBrasilPFSchema.d.cts +107 -395
- package/financing/formalization/schemas/BancoDoBrasilPFSchema.d.ts +107 -395
- package/financing/formalization/schemas/BancoDoBrasilPFSchema.js +127 -47
- package/financing/formalization/schemas/BancoDoBrasilPFSchema.mjs +3 -3
- package/financing/formalization/schemas/BancoDoBrasilPJSchema.d.cts +119 -621
- package/financing/formalization/schemas/BancoDoBrasilPJSchema.d.ts +119 -621
- package/financing/formalization/schemas/BancoDoBrasilPJSchema.js +188 -46
- package/financing/formalization/schemas/BancoDoBrasilPJSchema.mjs +2 -2
- package/financing/formalization/schemas/BtgPFSchema.d.cts +107 -395
- package/financing/formalization/schemas/BtgPFSchema.d.ts +107 -395
- package/financing/formalization/schemas/BtgPFSchema.js +127 -47
- package/financing/formalization/schemas/BtgPFSchema.mjs +3 -3
- package/financing/formalization/schemas/BtgPJSchema.d.cts +147 -747
- package/financing/formalization/schemas/BtgPJSchema.d.ts +147 -747
- package/financing/formalization/schemas/BtgPJSchema.js +193 -47
- package/financing/formalization/schemas/BtgPJSchema.mjs +3 -3
- package/financing/formalization/schemas/BvPFSchema.d.cts +125 -477
- package/financing/formalization/schemas/BvPFSchema.d.ts +125 -477
- package/financing/formalization/schemas/BvPFSchema.js +129 -49
- package/financing/formalization/schemas/BvPFSchema.mjs +3 -3
- package/financing/formalization/schemas/BvPJSchema.d.cts +149 -819
- package/financing/formalization/schemas/BvPJSchema.d.ts +149 -819
- package/financing/formalization/schemas/BvPJSchema.js +193 -47
- package/financing/formalization/schemas/BvPJSchema.mjs +3 -3
- package/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.d.cts +107 -395
- package/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.d.ts +107 -395
- package/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.js +127 -47
- package/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.mjs +3 -3
- package/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.d.cts +119 -621
- package/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.d.ts +119 -621
- package/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.js +188 -46
- package/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.mjs +2 -2
- package/financing/formalization/schemas/CashMePFSchema.d.cts +107 -395
- package/financing/formalization/schemas/CashMePFSchema.d.ts +107 -395
- package/financing/formalization/schemas/CashMePFSchema.js +127 -47
- package/financing/formalization/schemas/CashMePFSchema.mjs +3 -3
- package/financing/formalization/schemas/CashMePJSchema.d.cts +119 -621
- package/financing/formalization/schemas/CashMePJSchema.d.ts +119 -621
- package/financing/formalization/schemas/CashMePJSchema.js +188 -46
- package/financing/formalization/schemas/CashMePJSchema.mjs +2 -2
- package/financing/formalization/schemas/Credito77PFSchema.d.cts +107 -395
- package/financing/formalization/schemas/Credito77PFSchema.d.ts +107 -395
- package/financing/formalization/schemas/Credito77PFSchema.js +127 -47
- package/financing/formalization/schemas/Credito77PFSchema.mjs +3 -3
- package/financing/formalization/schemas/Credito77PJSchema.d.cts +119 -621
- package/financing/formalization/schemas/Credito77PJSchema.d.ts +119 -621
- package/financing/formalization/schemas/Credito77PJSchema.js +188 -46
- package/financing/formalization/schemas/Credito77PJSchema.mjs +2 -2
- package/financing/formalization/schemas/EosPFSchema.d.cts +107 -395
- package/financing/formalization/schemas/EosPFSchema.d.ts +107 -395
- package/financing/formalization/schemas/EosPFSchema.js +127 -47
- package/financing/formalization/schemas/EosPFSchema.mjs +3 -3
- package/financing/formalization/schemas/EosPJSchema.d.cts +119 -621
- package/financing/formalization/schemas/EosPJSchema.d.ts +119 -621
- package/financing/formalization/schemas/EosPJSchema.js +188 -46
- package/financing/formalization/schemas/EosPJSchema.mjs +2 -2
- package/financing/formalization/schemas/HdtEnergyPFSchema.d.cts +107 -395
- package/financing/formalization/schemas/HdtEnergyPFSchema.d.ts +107 -395
- package/financing/formalization/schemas/HdtEnergyPFSchema.js +127 -47
- package/financing/formalization/schemas/HdtEnergyPFSchema.mjs +3 -3
- package/financing/formalization/schemas/HdtEnergyPJSchema.d.cts +119 -621
- package/financing/formalization/schemas/HdtEnergyPJSchema.d.ts +119 -621
- package/financing/formalization/schemas/HdtEnergyPJSchema.js +188 -46
- package/financing/formalization/schemas/HdtEnergyPJSchema.mjs +2 -2
- package/financing/formalization/schemas/LosangoPFSchema.d.cts +107 -395
- package/financing/formalization/schemas/LosangoPFSchema.d.ts +107 -395
- package/financing/formalization/schemas/LosangoPFSchema.js +127 -47
- package/financing/formalization/schemas/LosangoPFSchema.mjs +3 -3
- package/financing/formalization/schemas/LosangoPJSchema.d.cts +119 -621
- package/financing/formalization/schemas/LosangoPJSchema.d.ts +119 -621
- package/financing/formalization/schemas/LosangoPJSchema.js +188 -46
- package/financing/formalization/schemas/LosangoPJSchema.mjs +2 -2
- package/financing/formalization/schemas/SafraPFSchema.d.cts +107 -395
- package/financing/formalization/schemas/SafraPFSchema.d.ts +107 -395
- package/financing/formalization/schemas/SafraPFSchema.js +127 -47
- package/financing/formalization/schemas/SafraPFSchema.mjs +3 -3
- package/financing/formalization/schemas/SafraPJSchema.d.cts +119 -621
- package/financing/formalization/schemas/SafraPJSchema.d.ts +119 -621
- package/financing/formalization/schemas/SafraPJSchema.js +188 -46
- package/financing/formalization/schemas/SafraPJSchema.mjs +2 -2
- package/financing/formalization/schemas/SantanderPFSchema.d.cts +107 -395
- package/financing/formalization/schemas/SantanderPFSchema.d.ts +107 -395
- package/financing/formalization/schemas/SantanderPFSchema.js +127 -47
- package/financing/formalization/schemas/SantanderPFSchema.mjs +3 -3
- package/financing/formalization/schemas/SantanderPJSchema.d.cts +119 -621
- package/financing/formalization/schemas/SantanderPJSchema.d.ts +119 -621
- package/financing/formalization/schemas/SantanderPJSchema.js +188 -46
- package/financing/formalization/schemas/SantanderPJSchema.mjs +2 -2
- package/financing/formalization/schemas/SolAgoraPFSchema.d.cts +107 -395
- package/financing/formalization/schemas/SolAgoraPFSchema.d.ts +107 -395
- package/financing/formalization/schemas/SolAgoraPFSchema.js +127 -47
- package/financing/formalization/schemas/SolAgoraPFSchema.mjs +3 -3
- package/financing/formalization/schemas/SolAgoraPJSchema.d.cts +145 -725
- package/financing/formalization/schemas/SolAgoraPJSchema.d.ts +145 -725
- package/financing/formalization/schemas/SolAgoraPJSchema.js +193 -47
- package/financing/formalization/schemas/SolAgoraPJSchema.mjs +3 -3
- package/financing/formalization/schemas/SolfacilPFSchema.d.cts +107 -395
- package/financing/formalization/schemas/SolfacilPFSchema.d.ts +107 -395
- package/financing/formalization/schemas/SolfacilPFSchema.js +127 -47
- package/financing/formalization/schemas/SolfacilPFSchema.mjs +3 -3
- package/financing/formalization/schemas/SolfacilPJSchema.d.cts +131 -679
- package/financing/formalization/schemas/SolfacilPJSchema.d.ts +131 -679
- package/financing/formalization/schemas/SolfacilPJSchema.js +188 -46
- package/financing/formalization/schemas/SolfacilPJSchema.mjs +2 -2
- package/financing/formalization/schemas/UnifiedPFSchema.d.cts +185 -557
- package/financing/formalization/schemas/UnifiedPFSchema.d.ts +185 -557
- package/financing/formalization/schemas/UnifiedPFSchema.js +141 -61
- package/financing/formalization/schemas/UnifiedPFSchema.mjs +3 -3
- package/financing/formalization/schemas/UnifiedPJSchema.d.cts +265 -1269
- package/financing/formalization/schemas/UnifiedPJSchema.d.ts +265 -1269
- package/financing/formalization/schemas/UnifiedPJSchema.js +238 -92
- package/financing/formalization/schemas/UnifiedPJSchema.mjs +3 -3
- package/index.d.cts +2 -1
- package/index.d.ts +2 -1
- package/index.js +516 -278
- package/index.mjs +33 -33
- package/package.json +2 -2
- package/chunk-4PZYGTUU.mjs +0 -105
- package/chunk-JZ7DY7SU.mjs +0 -13
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DocumentTypeEnum } from './chunk-
|
|
2
|
-
import { issueDateSchema, currencySchema, emailSchema, phoneBRSchema, UfEnum, SexEnum, birthDateSchema, cpfSchema, cepSchema, formalizationExtras, textField, NationalityEnum, NATIONALITY_BRAZIL, cpfCnpjSchema,
|
|
3
|
-
import { z } from 'zod';
|
|
1
|
+
import { DocumentTypeEnum } from './chunk-QEPJ2RLU.mjs';
|
|
2
|
+
import { requiredObject, issueDateSchema, currencySchema, emailSchema, phoneBRSchema, UfEnum, SexEnum, birthDateSchema, cpfSchema, cepSchema, formalizationExtras, textField, NationalityEnum, NATIONALITY_BRAZIL, optionalField, cpfCnpjSchema, pfRefinement } from './chunk-CJSJ3VDW.mjs';
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
// src/domains/financing/formalization/schemas/BancoDoBrasilPFSchema.ts
|
|
5
|
+
var bancoDoBrasilPfObject = requiredObject({
|
|
6
6
|
...formalizationExtras,
|
|
7
7
|
name: textField(),
|
|
8
8
|
cep: cepSchema,
|
|
@@ -11,12 +11,12 @@ var bancoDoBrasilPfObject = z.object({
|
|
|
11
11
|
birth_date: birthDateSchema,
|
|
12
12
|
number: textField(),
|
|
13
13
|
sex: SexEnum,
|
|
14
|
-
complement: textField(15)
|
|
14
|
+
complement: optionalField(textField(15)),
|
|
15
15
|
mother_name: textField(),
|
|
16
16
|
district: textField(),
|
|
17
17
|
energy_account_in_requester_name: textField(),
|
|
18
18
|
city: textField(),
|
|
19
|
-
energy_bill_owner_document: cpfCnpjSchema
|
|
19
|
+
energy_bill_owner_document: optionalField(cpfCnpjSchema),
|
|
20
20
|
state: UfEnum,
|
|
21
21
|
nationality: NationalityEnum.default(NATIONALITY_BRAZIL),
|
|
22
22
|
cellphone: phoneBRSchema,
|
|
@@ -28,6 +28,6 @@ var bancoDoBrasilPfObject = z.object({
|
|
|
28
28
|
issuing_body: textField(6),
|
|
29
29
|
doc_issue_date: issueDateSchema
|
|
30
30
|
});
|
|
31
|
-
var bancoDoBrasilPfSchema = bancoDoBrasilPfObject.strict().
|
|
31
|
+
var bancoDoBrasilPfSchema = bancoDoBrasilPfObject.strict().check(pfRefinement);
|
|
32
32
|
|
|
33
33
|
export { bancoDoBrasilPfObject, bancoDoBrasilPfSchema };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { formalizationExtras, UfEnum, SexEnum, emailSchema, phoneBRSchema, birthDateSchema, cpfSchema, cepSchema, NationalityEnum, NATIONALITY_BRAZIL, textField, currencySchema, cnpjSchema, issueDateSchema,
|
|
2
|
-
import { z } from 'zod';
|
|
1
|
+
import { requiredObject, formalizationExtras, requiredArray, UfEnum, SexEnum, emailSchema, phoneBRSchema, birthDateSchema, cpfSchema, cepSchema, NationalityEnum, NATIONALITY_BRAZIL, textField, optionalField, currencySchema, cnpjSchema, issueDateSchema, pjRefinement } from './chunk-CJSJ3VDW.mjs';
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
// src/domains/financing/formalization/schemas/BancoDoBrasilPJSchema.ts
|
|
4
|
+
var bancoDoBrasilPjObject = requiredObject({
|
|
5
5
|
...formalizationExtras,
|
|
6
|
-
financing_company:
|
|
6
|
+
financing_company: requiredObject({
|
|
7
7
|
corporate_name: textField(),
|
|
8
8
|
cep: cepSchema,
|
|
9
9
|
address: textField(),
|
|
@@ -11,7 +11,7 @@ var bancoDoBrasilPjObject = z.object({
|
|
|
11
11
|
number: textField(),
|
|
12
12
|
cnpj: cnpjSchema,
|
|
13
13
|
email: emailSchema,
|
|
14
|
-
complement: textField(15)
|
|
14
|
+
complement: optionalField(textField(15)),
|
|
15
15
|
phone: phoneBRSchema,
|
|
16
16
|
district: textField(),
|
|
17
17
|
legal_nature: textField(),
|
|
@@ -21,15 +21,15 @@ var bancoDoBrasilPjObject = z.object({
|
|
|
21
21
|
economic_activity: textField(),
|
|
22
22
|
monthly_income: currencySchema
|
|
23
23
|
}).strict(),
|
|
24
|
-
financing_company_guarantor:
|
|
25
|
-
|
|
24
|
+
financing_company_guarantor: requiredArray(
|
|
25
|
+
requiredObject({
|
|
26
26
|
name: textField(),
|
|
27
27
|
cep: cepSchema,
|
|
28
28
|
cpf: cpfSchema,
|
|
29
29
|
address: textField(),
|
|
30
30
|
birth_date: birthDateSchema,
|
|
31
31
|
number: textField(),
|
|
32
|
-
complement: textField(15)
|
|
32
|
+
complement: optionalField(textField(15)),
|
|
33
33
|
cellphone: phoneBRSchema,
|
|
34
34
|
email: emailSchema,
|
|
35
35
|
district: textField(),
|
|
@@ -42,6 +42,6 @@ var bancoDoBrasilPjObject = z.object({
|
|
|
42
42
|
}).strict()
|
|
43
43
|
)
|
|
44
44
|
});
|
|
45
|
-
var bancoDoBrasilPjSchema = bancoDoBrasilPjObject.strict().
|
|
45
|
+
var bancoDoBrasilPjSchema = bancoDoBrasilPjObject.strict().check(pjRefinement);
|
|
46
46
|
|
|
47
47
|
export { bancoDoBrasilPjObject, bancoDoBrasilPjSchema };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DocumentTypeEnum } from './chunk-
|
|
2
|
-
import { issueDateSchema, currencySchema, emailSchema, phoneBRSchema, UfEnum, SexEnum, birthDateSchema, cpfSchema, cepSchema, formalizationExtras, textField, NationalityEnum, NATIONALITY_BRAZIL, cpfCnpjSchema,
|
|
3
|
-
import { z } from 'zod';
|
|
1
|
+
import { DocumentTypeEnum } from './chunk-QEPJ2RLU.mjs';
|
|
2
|
+
import { requiredObject, issueDateSchema, currencySchema, emailSchema, phoneBRSchema, UfEnum, SexEnum, birthDateSchema, cpfSchema, cepSchema, formalizationExtras, textField, NationalityEnum, NATIONALITY_BRAZIL, optionalField, cpfCnpjSchema, pfRefinement } from './chunk-CJSJ3VDW.mjs';
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
// src/domains/financing/formalization/schemas/AlfaPFSchema.ts
|
|
5
|
+
var alfaPfObject = requiredObject({
|
|
6
6
|
...formalizationExtras,
|
|
7
7
|
name: textField(),
|
|
8
8
|
cep: cepSchema,
|
|
@@ -11,12 +11,12 @@ var alfaPfObject = z.object({
|
|
|
11
11
|
birth_date: birthDateSchema,
|
|
12
12
|
number: textField(),
|
|
13
13
|
sex: SexEnum,
|
|
14
|
-
complement: textField(15)
|
|
14
|
+
complement: optionalField(textField(15)),
|
|
15
15
|
mother_name: textField(),
|
|
16
16
|
district: textField(),
|
|
17
17
|
energy_account_in_requester_name: textField(),
|
|
18
18
|
city: textField(),
|
|
19
|
-
energy_bill_owner_document: cpfCnpjSchema
|
|
19
|
+
energy_bill_owner_document: optionalField(cpfCnpjSchema),
|
|
20
20
|
state: UfEnum,
|
|
21
21
|
nationality: NationalityEnum.default(NATIONALITY_BRAZIL),
|
|
22
22
|
cellphone: phoneBRSchema,
|
|
@@ -28,6 +28,6 @@ var alfaPfObject = z.object({
|
|
|
28
28
|
issuing_body: textField(6),
|
|
29
29
|
doc_issue_date: issueDateSchema
|
|
30
30
|
});
|
|
31
|
-
var alfaPfSchema = alfaPfObject.strict().
|
|
31
|
+
var alfaPfSchema = alfaPfObject.strict().check(pfRefinement);
|
|
32
32
|
|
|
33
33
|
export { alfaPfObject, alfaPfSchema };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { formalizationExtras, UfEnum, SexEnum, emailSchema, phoneBRSchema, birthDateSchema, cpfSchema, cepSchema, NationalityEnum, NATIONALITY_BRAZIL, textField, currencySchema, cnpjSchema, issueDateSchema,
|
|
2
|
-
import { z } from 'zod';
|
|
1
|
+
import { requiredObject, formalizationExtras, requiredArray, UfEnum, SexEnum, emailSchema, phoneBRSchema, birthDateSchema, cpfSchema, cepSchema, NationalityEnum, NATIONALITY_BRAZIL, textField, optionalField, currencySchema, cnpjSchema, issueDateSchema, pjRefinement } from './chunk-CJSJ3VDW.mjs';
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
// src/domains/financing/formalization/schemas/HdtEnergyPJSchema.ts
|
|
4
|
+
var hdtEnergyPjObject = requiredObject({
|
|
5
5
|
...formalizationExtras,
|
|
6
|
-
financing_company:
|
|
6
|
+
financing_company: requiredObject({
|
|
7
7
|
corporate_name: textField(),
|
|
8
8
|
cep: cepSchema,
|
|
9
9
|
address: textField(),
|
|
@@ -11,7 +11,7 @@ var hdtEnergyPjObject = z.object({
|
|
|
11
11
|
number: textField(),
|
|
12
12
|
cnpj: cnpjSchema,
|
|
13
13
|
email: emailSchema,
|
|
14
|
-
complement: textField(15)
|
|
14
|
+
complement: optionalField(textField(15)),
|
|
15
15
|
phone: phoneBRSchema,
|
|
16
16
|
district: textField(),
|
|
17
17
|
legal_nature: textField(),
|
|
@@ -21,15 +21,15 @@ var hdtEnergyPjObject = z.object({
|
|
|
21
21
|
economic_activity: textField(),
|
|
22
22
|
monthly_income: currencySchema
|
|
23
23
|
}).strict(),
|
|
24
|
-
financing_company_guarantor:
|
|
25
|
-
|
|
24
|
+
financing_company_guarantor: requiredArray(
|
|
25
|
+
requiredObject({
|
|
26
26
|
name: textField(),
|
|
27
27
|
cep: cepSchema,
|
|
28
28
|
cpf: cpfSchema,
|
|
29
29
|
address: textField(),
|
|
30
30
|
birth_date: birthDateSchema,
|
|
31
31
|
number: textField(),
|
|
32
|
-
complement: textField(15)
|
|
32
|
+
complement: optionalField(textField(15)),
|
|
33
33
|
cellphone: phoneBRSchema,
|
|
34
34
|
email: emailSchema,
|
|
35
35
|
district: textField(),
|
|
@@ -42,6 +42,6 @@ var hdtEnergyPjObject = z.object({
|
|
|
42
42
|
}).strict()
|
|
43
43
|
)
|
|
44
44
|
});
|
|
45
|
-
var hdtEnergyPjSchema = hdtEnergyPjObject.strict().
|
|
45
|
+
var hdtEnergyPjSchema = hdtEnergyPjObject.strict().check(pjRefinement);
|
|
46
46
|
|
|
47
47
|
export { hdtEnergyPjObject, hdtEnergyPjSchema };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DocumentTypeEnum } from './chunk-
|
|
2
|
-
import { issueDateSchema, currencySchema, emailSchema, phoneBRSchema, UfEnum, SexEnum, birthDateSchema, cpfSchema, cepSchema, formalizationExtras, textField, NationalityEnum, NATIONALITY_BRAZIL, cpfCnpjSchema,
|
|
3
|
-
import { z } from 'zod';
|
|
1
|
+
import { DocumentTypeEnum } from './chunk-QEPJ2RLU.mjs';
|
|
2
|
+
import { requiredObject, issueDateSchema, currencySchema, emailSchema, phoneBRSchema, UfEnum, SexEnum, birthDateSchema, cpfSchema, cepSchema, formalizationExtras, textField, NationalityEnum, NATIONALITY_BRAZIL, optionalField, cpfCnpjSchema, pfRefinement } from './chunk-CJSJ3VDW.mjs';
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
// src/domains/financing/formalization/schemas/BtgPFSchema.ts
|
|
5
|
+
var btgPfObject = requiredObject({
|
|
6
6
|
...formalizationExtras,
|
|
7
7
|
name: textField(),
|
|
8
8
|
cep: cepSchema,
|
|
@@ -11,12 +11,12 @@ var btgPfObject = z.object({
|
|
|
11
11
|
birth_date: birthDateSchema,
|
|
12
12
|
number: textField(),
|
|
13
13
|
sex: SexEnum,
|
|
14
|
-
complement: textField(15)
|
|
14
|
+
complement: optionalField(textField(15)),
|
|
15
15
|
mother_name: textField(),
|
|
16
16
|
district: textField(),
|
|
17
17
|
energy_account_in_requester_name: textField(),
|
|
18
18
|
city: textField(),
|
|
19
|
-
energy_bill_owner_document: cpfCnpjSchema
|
|
19
|
+
energy_bill_owner_document: optionalField(cpfCnpjSchema),
|
|
20
20
|
state: UfEnum,
|
|
21
21
|
nationality: NationalityEnum.default(NATIONALITY_BRAZIL),
|
|
22
22
|
cellphone: phoneBRSchema,
|
|
@@ -28,6 +28,6 @@ var btgPfObject = z.object({
|
|
|
28
28
|
issuing_body: textField(6),
|
|
29
29
|
doc_issue_date: issueDateSchema
|
|
30
30
|
});
|
|
31
|
-
var btgPfSchema = btgPfObject.strict().
|
|
31
|
+
var btgPfSchema = btgPfObject.strict().check(pfRefinement);
|
|
32
32
|
|
|
33
33
|
export { btgPfObject, btgPfSchema };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { DocumentTypeEnum } from './chunk-QEPJ2RLU.mjs';
|
|
2
|
+
import { requiredObject, formalizationExtras, requiredArray, optionalCurrencySchema, UfEnum, SexEnum, emailSchema, phoneBRSchema, cepSchema, birthDateSchema, cpfSchema, optionalField, issueDateSchema, textField, dateDMYSchema, integerField, NationalityEnum, NATIONALITY_BRAZIL, cnpjSchema, pjRefinement } from './chunk-CJSJ3VDW.mjs';
|
|
3
|
+
|
|
4
|
+
// src/domains/financing/formalization/schemas/UnifiedPJSchema.ts
|
|
5
|
+
var unifiedPjObject = requiredObject({
|
|
6
|
+
...formalizationExtras,
|
|
7
|
+
financing_company: requiredObject({
|
|
8
|
+
corporate_name: textField(),
|
|
9
|
+
cnpj: cnpjSchema,
|
|
10
|
+
foundation_date: issueDateSchema,
|
|
11
|
+
address: textField(),
|
|
12
|
+
number: textField(),
|
|
13
|
+
email: emailSchema,
|
|
14
|
+
complement: optionalField(textField(15)),
|
|
15
|
+
phone: phoneBRSchema,
|
|
16
|
+
district: textField(),
|
|
17
|
+
legal_nature: textField(),
|
|
18
|
+
city: textField(),
|
|
19
|
+
state: UfEnum,
|
|
20
|
+
cep: cepSchema,
|
|
21
|
+
economic_activity: optionalField(textField()),
|
|
22
|
+
economic_activity_group: optionalField(textField()),
|
|
23
|
+
monthly_income: optionalCurrencySchema,
|
|
24
|
+
residence_situation: optionalField(textField()),
|
|
25
|
+
months_in_residence: optionalField(integerField),
|
|
26
|
+
capital_social: optionalCurrencySchema
|
|
27
|
+
}).strict(),
|
|
28
|
+
financing_company_guarantor: requiredArray(
|
|
29
|
+
requiredObject({
|
|
30
|
+
name: textField(),
|
|
31
|
+
cpf: cpfSchema,
|
|
32
|
+
birth_date: birthDateSchema,
|
|
33
|
+
address: textField(),
|
|
34
|
+
number: textField(),
|
|
35
|
+
cep: cepSchema,
|
|
36
|
+
complement: optionalField(textField(15)),
|
|
37
|
+
cellphone: phoneBRSchema,
|
|
38
|
+
email: emailSchema,
|
|
39
|
+
district: textField(),
|
|
40
|
+
sex: SexEnum,
|
|
41
|
+
city: textField(),
|
|
42
|
+
state: UfEnum,
|
|
43
|
+
mother_name: textField(),
|
|
44
|
+
nationality: NationalityEnum.default(NATIONALITY_BRAZIL),
|
|
45
|
+
office: optionalField(textField()),
|
|
46
|
+
phone: optionalField(phoneBRSchema),
|
|
47
|
+
civil_status: optionalField(textField()),
|
|
48
|
+
residence_situation: optionalField(textField()),
|
|
49
|
+
months_in_residence: optionalField(integerField),
|
|
50
|
+
type_doc: optionalField(DocumentTypeEnum),
|
|
51
|
+
doc: optionalField(textField()),
|
|
52
|
+
issuing_body: optionalField(textField()),
|
|
53
|
+
uf_issuing_body: optionalField(UfEnum),
|
|
54
|
+
doc_issue_date: optionalField(issueDateSchema),
|
|
55
|
+
doc_expiration_date: optionalField(dateDMYSchema),
|
|
56
|
+
monthly_income: optionalCurrencySchema,
|
|
57
|
+
patrimony: optionalCurrencySchema,
|
|
58
|
+
naturalness: optionalField(textField()),
|
|
59
|
+
uf_naturalness: optionalField(UfEnum),
|
|
60
|
+
pep_relationship: optionalField(textField()),
|
|
61
|
+
entry_date: optionalField(issueDateSchema),
|
|
62
|
+
doc_issuance_uf: optionalField(UfEnum)
|
|
63
|
+
}).strict()
|
|
64
|
+
).optional(),
|
|
65
|
+
financing_company_qsa: requiredArray(
|
|
66
|
+
requiredObject({
|
|
67
|
+
name: textField(),
|
|
68
|
+
cpf: cpfSchema,
|
|
69
|
+
birth_date: birthDateSchema,
|
|
70
|
+
address: textField(),
|
|
71
|
+
number: textField(),
|
|
72
|
+
cep: cepSchema,
|
|
73
|
+
complement: optionalField(textField(15)),
|
|
74
|
+
cellphone: phoneBRSchema,
|
|
75
|
+
email: emailSchema,
|
|
76
|
+
district: textField(),
|
|
77
|
+
sex: SexEnum,
|
|
78
|
+
city: textField(),
|
|
79
|
+
state: UfEnum,
|
|
80
|
+
mother_name: textField(),
|
|
81
|
+
nationality: NationalityEnum.default(NATIONALITY_BRAZIL),
|
|
82
|
+
office: optionalField(textField()),
|
|
83
|
+
phone: optionalField(phoneBRSchema),
|
|
84
|
+
civil_status: optionalField(textField()),
|
|
85
|
+
residence_situation: optionalField(textField()),
|
|
86
|
+
months_in_residence: optionalField(integerField),
|
|
87
|
+
type_doc: optionalField(DocumentTypeEnum),
|
|
88
|
+
doc: optionalField(textField()),
|
|
89
|
+
issuing_body: optionalField(textField()),
|
|
90
|
+
uf_issuing_body: optionalField(UfEnum),
|
|
91
|
+
doc_issue_date: optionalField(issueDateSchema),
|
|
92
|
+
doc_expiration_date: optionalField(dateDMYSchema),
|
|
93
|
+
monthly_income: optionalCurrencySchema,
|
|
94
|
+
patrimony: optionalCurrencySchema,
|
|
95
|
+
naturalness: optionalField(textField()),
|
|
96
|
+
uf_naturalness: optionalField(UfEnum),
|
|
97
|
+
pep_relationship: optionalField(textField()),
|
|
98
|
+
entry_date: optionalField(issueDateSchema),
|
|
99
|
+
doc_issuance_uf: optionalField(UfEnum)
|
|
100
|
+
}).strict()
|
|
101
|
+
).optional()
|
|
102
|
+
});
|
|
103
|
+
var unifiedPjSchema = unifiedPjObject.strict().check(pjRefinement);
|
|
104
|
+
|
|
105
|
+
export { unifiedPjObject, unifiedPjSchema };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DocumentTypeEnum } from './chunk-
|
|
2
|
-
import { issueDateSchema, currencySchema, emailSchema, phoneBRSchema, UfEnum, SexEnum, birthDateSchema, cpfSchema, cepSchema, formalizationExtras, textField, NationalityEnum, NATIONALITY_BRAZIL, cpfCnpjSchema,
|
|
3
|
-
import { z } from 'zod';
|
|
1
|
+
import { DocumentTypeEnum } from './chunk-QEPJ2RLU.mjs';
|
|
2
|
+
import { requiredObject, issueDateSchema, currencySchema, emailSchema, phoneBRSchema, UfEnum, SexEnum, birthDateSchema, cpfSchema, cepSchema, formalizationExtras, textField, NationalityEnum, NATIONALITY_BRAZIL, optionalField, cpfCnpjSchema, pfRefinement } from './chunk-CJSJ3VDW.mjs';
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
// src/domains/financing/formalization/schemas/LosangoPFSchema.ts
|
|
5
|
+
var losangoPfObject = requiredObject({
|
|
6
6
|
...formalizationExtras,
|
|
7
7
|
name: textField(),
|
|
8
8
|
cep: cepSchema,
|
|
@@ -11,12 +11,12 @@ var losangoPfObject = z.object({
|
|
|
11
11
|
birth_date: birthDateSchema,
|
|
12
12
|
number: textField(),
|
|
13
13
|
sex: SexEnum,
|
|
14
|
-
complement: textField(15)
|
|
14
|
+
complement: optionalField(textField(15)),
|
|
15
15
|
mother_name: textField(),
|
|
16
16
|
district: textField(),
|
|
17
17
|
energy_account_in_requester_name: textField(),
|
|
18
18
|
city: textField(),
|
|
19
|
-
energy_bill_owner_document: cpfCnpjSchema
|
|
19
|
+
energy_bill_owner_document: optionalField(cpfCnpjSchema),
|
|
20
20
|
state: UfEnum,
|
|
21
21
|
nationality: NationalityEnum.default(NATIONALITY_BRAZIL),
|
|
22
22
|
cellphone: phoneBRSchema,
|
|
@@ -28,6 +28,6 @@ var losangoPfObject = z.object({
|
|
|
28
28
|
issuing_body: textField(6),
|
|
29
29
|
doc_issue_date: issueDateSchema
|
|
30
30
|
});
|
|
31
|
-
var losangoPfSchema = losangoPfObject.strict().
|
|
31
|
+
var losangoPfSchema = losangoPfObject.strict().check(pfRefinement);
|
|
32
32
|
|
|
33
33
|
export { losangoPfObject, losangoPfSchema };
|
|
@@ -2,41 +2,74 @@ import { z } from 'zod';
|
|
|
2
2
|
|
|
3
3
|
// src/shared/fields/primitives.ts
|
|
4
4
|
var REQUIRED_MESSAGE = "Campo obrigat\xF3rio";
|
|
5
|
-
var REQUIRED_STRING_PARAMS = {
|
|
6
|
-
required_error: REQUIRED_MESSAGE,
|
|
7
|
-
invalid_type_error: REQUIRED_MESSAGE
|
|
8
|
-
};
|
|
9
5
|
function requiredString() {
|
|
10
|
-
return z.string(
|
|
6
|
+
return z.string({ error: REQUIRED_MESSAGE });
|
|
11
7
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return
|
|
8
|
+
var DEFAULT_TEXT_MAX_LENGTH = 255;
|
|
9
|
+
function textField(maxLength = DEFAULT_TEXT_MAX_LENGTH) {
|
|
10
|
+
return requiredString().trim().min(1, REQUIRED_MESSAGE).max(maxLength, `M\xE1ximo ${maxLength} caracteres`);
|
|
15
11
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
function requiredNumber(invalidTypeMessage) {
|
|
13
|
+
return z.number({
|
|
14
|
+
error: (issue) => issue.input === void 0 ? REQUIRED_MESSAGE : invalidTypeMessage
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
var numberField = requiredNumber("Valor num\xE9rico inv\xE1lido").nonnegative(
|
|
18
|
+
"Valor n\xE3o pode ser negativo"
|
|
19
|
+
);
|
|
20
|
+
var integerField = requiredNumber("Valor num\xE9rico inv\xE1lido").int("Deve ser um n\xFAmero inteiro").nonnegative("Valor n\xE3o pode ser negativo");
|
|
21
|
+
function optionalField(schema) {
|
|
22
|
+
return z.preprocess(
|
|
23
|
+
(value) => typeof value === "string" && value.trim() === "" ? void 0 : value,
|
|
24
|
+
schema.optional()
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
function unrecognizedKeysMessage(keys) {
|
|
28
|
+
const list = keys.map((key) => `"${key}"`).join(", ");
|
|
29
|
+
return keys.length === 1 ? `Campo n\xE3o reconhecido: ${list}` : `Campos n\xE3o reconhecidos: ${list}`;
|
|
30
|
+
}
|
|
31
|
+
function requiredObject(shape) {
|
|
32
|
+
return z.object(shape, {
|
|
33
|
+
error: (issue) => {
|
|
34
|
+
if (issue.code === "invalid_type") {
|
|
35
|
+
return REQUIRED_MESSAGE;
|
|
36
|
+
}
|
|
37
|
+
if (issue.code === "unrecognized_keys") {
|
|
38
|
+
return unrecognizedKeysMessage(issue.keys);
|
|
23
39
|
}
|
|
24
|
-
return
|
|
40
|
+
return void 0;
|
|
25
41
|
}
|
|
26
42
|
});
|
|
27
43
|
}
|
|
44
|
+
function requiredArray(element) {
|
|
45
|
+
return z.array(element, {
|
|
46
|
+
error: (issue) => issue.code === "invalid_type" ? REQUIRED_MESSAGE : void 0
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function enumField(values) {
|
|
50
|
+
return z.enum(values, {
|
|
51
|
+
// No zod 4 todo input fora da lista (inclusive undefined/null) gera um único
|
|
52
|
+
// issue `invalid_value`. Tratamos ausência, tipo inválido e string vazia
|
|
53
|
+
// (select não preenchido) como "obrigatório"; um valor de fato inválido cai
|
|
54
|
+
// na mensagem padrão do zod (retornar undefined delega ao error map default).
|
|
55
|
+
error: (issue) => typeof issue.input !== "string" || issue.input === "" ? REQUIRED_MESSAGE : void 0
|
|
56
|
+
});
|
|
57
|
+
}
|
|
28
58
|
var MAX_UPLOAD_BYTES = 5 * 1024 * 1024;
|
|
29
59
|
var ACCEPTED_UPLOAD_MIME = ["image/jpeg", "image/png", "application/pdf"];
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
)
|
|
60
|
+
var UPLOAD_URL_PROTOCOL = /^https$/;
|
|
61
|
+
var UPLOAD_URL_HOSTNAME = /^(?!localhost$)(?!(\d{1,3}\.){3}\d{1,3}$)[a-z0-9.-]+$/i;
|
|
62
|
+
var fileUploadField = requiredObject({
|
|
63
|
+
url: optionalField(
|
|
64
|
+
z.url({
|
|
65
|
+
protocol: UPLOAD_URL_PROTOCOL,
|
|
66
|
+
hostname: UPLOAD_URL_HOSTNAME,
|
|
67
|
+
error: "URL do arquivo inv\xE1lida"
|
|
68
|
+
})
|
|
69
|
+
),
|
|
70
|
+
mime: z.enum(ACCEPTED_UPLOAD_MIME, { error: "Formato deve ser JPEG, PNG ou PDF" }),
|
|
71
|
+
sizeBytes: requiredNumber("Tamanho do arquivo inv\xE1lido").int("Tamanho do arquivo deve ser um n\xFAmero inteiro").positive("Tamanho do arquivo deve ser positivo").max(MAX_UPLOAD_BYTES, "Arquivo deve ter no m\xE1ximo 5MB")
|
|
72
|
+
});
|
|
40
73
|
|
|
41
74
|
// src/shared/enums/nationality.ts
|
|
42
75
|
var NATIONALITY_BRAZIL = "brasil";
|
|
@@ -166,7 +199,10 @@ var PATTERNS = {
|
|
|
166
199
|
cep: /^\d{8}$/,
|
|
167
200
|
phoneBR: /^\d{11}$/,
|
|
168
201
|
email: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
|
169
|
-
dateDMY: /^\d{2}\/\d{2}\/\d{4}
|
|
202
|
+
dateDMY: /^\d{2}\/\d{2}\/\d{4}$/,
|
|
203
|
+
// Formato do RNE, exigido pela RN-015 para nacionalidade estrangeira.
|
|
204
|
+
rneNumber: /^[A-Za-z0-9]+$/
|
|
205
|
+
};
|
|
170
206
|
|
|
171
207
|
// src/shared/regex/validators.ts
|
|
172
208
|
function onlyDigits(value) {
|
|
@@ -283,19 +319,37 @@ function parseBRLCurrency(value) {
|
|
|
283
319
|
if (typeof value !== "string") {
|
|
284
320
|
return value;
|
|
285
321
|
}
|
|
286
|
-
const
|
|
287
|
-
if (
|
|
322
|
+
const normalized = value.replace(/R\$/gi, "").replace(/\s/g, "").replace(/\./g, "").replace(",", ".");
|
|
323
|
+
if (normalized === "") {
|
|
288
324
|
return void 0;
|
|
289
325
|
}
|
|
290
|
-
const normalized = trimmed.replace(/R\$/gi, "").replace(/\s/g, "").replace(/\./g, "").replace(",", ".");
|
|
291
326
|
const parsed = Number(normalized);
|
|
292
327
|
return Number.isNaN(parsed) ? value : parsed;
|
|
293
328
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
);
|
|
298
|
-
|
|
329
|
+
function brlAmount() {
|
|
330
|
+
return requiredNumber("Valor monet\xE1rio inv\xE1lido").positive("Valor deve ser positivo");
|
|
331
|
+
}
|
|
332
|
+
var currencySchema = z.preprocess(parseBRLCurrency, brlAmount());
|
|
333
|
+
var optionalCurrencySchema = z.preprocess(parseBRLCurrency, brlAmount().optional());
|
|
334
|
+
requiredNumber("Valor num\xE9rico inv\xE1lido").int("Deve ser um n\xFAmero inteiro").min(1, "M\xEDnimo 1").max(28, "M\xE1ximo 28");
|
|
335
|
+
|
|
336
|
+
// src/shared/enums/proof-kinship-type.ts
|
|
337
|
+
var ProofKinshipTypeEnum = enumField([
|
|
338
|
+
"certidao_casamento",
|
|
339
|
+
"documento_identificacao",
|
|
340
|
+
"contrato_social",
|
|
341
|
+
"declaracao_parentesco",
|
|
342
|
+
"outro_documento"
|
|
343
|
+
]);
|
|
344
|
+
var ProofKinshipTypeLabels = {
|
|
345
|
+
certidao_casamento: "Certid\xE3o de casamento",
|
|
346
|
+
documento_identificacao: "Documento de identifica\xE7\xE3o",
|
|
347
|
+
contrato_social: "Contrato social",
|
|
348
|
+
declaracao_parentesco: "Declara\xE7\xE3o de parentesco",
|
|
349
|
+
outro_documento: "Outro documento"
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
// src/domains/financing/formalization/refinements.ts
|
|
299
353
|
var RG_MAX_EMISSION_YEARS = 10;
|
|
300
354
|
function applyPartnerRefinement(data, ctx) {
|
|
301
355
|
const civilStatus = data.civil_status;
|
|
@@ -308,7 +362,7 @@ function applyPartnerRefinement(data, ctx) {
|
|
|
308
362
|
const isEmpty = value === void 0 || value === null || typeof value === "string" && value.trim().length === 0;
|
|
309
363
|
if (isEmpty) {
|
|
310
364
|
ctx.addIssue({
|
|
311
|
-
code:
|
|
365
|
+
code: "custom",
|
|
312
366
|
path: [field],
|
|
313
367
|
message: "Campo obrigat\xF3rio para o estado civil informado"
|
|
314
368
|
});
|
|
@@ -322,25 +376,54 @@ function applyCommonRefinements(data, ctx) {
|
|
|
322
376
|
}
|
|
323
377
|
if (!data.proof_kinship_type) {
|
|
324
378
|
ctx.addIssue({
|
|
325
|
-
code:
|
|
379
|
+
code: "custom",
|
|
326
380
|
path: ["proof_kinship_type"],
|
|
327
381
|
message: "Tipo de comprovante \xE9 obrigat\xF3rio quando a conta est\xE1 em nome de terceiro"
|
|
328
382
|
});
|
|
329
383
|
}
|
|
330
384
|
if (!data.proof_kinship) {
|
|
331
385
|
ctx.addIssue({
|
|
332
|
-
code:
|
|
386
|
+
code: "custom",
|
|
333
387
|
path: ["proof_kinship"],
|
|
334
388
|
message: "Documento de v\xEDnculo \xE9 obrigat\xF3rio quando a conta est\xE1 em nome de terceiro"
|
|
335
389
|
});
|
|
336
390
|
}
|
|
337
391
|
}
|
|
392
|
+
var FOREIGN_DOCUMENT_TYPE = "registro_de_estrangeiro";
|
|
393
|
+
function applyForeignDocumentRefinement(data, ctx) {
|
|
394
|
+
const nationality = data.nationality;
|
|
395
|
+
const isForeign = typeof nationality === "string" && nationality.toLowerCase() !== NATIONALITY_BRAZIL;
|
|
396
|
+
if (!isForeign || !("type_doc" in data)) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
if (data.type_doc !== FOREIGN_DOCUMENT_TYPE) {
|
|
400
|
+
ctx.addIssue({
|
|
401
|
+
code: "custom",
|
|
402
|
+
path: ["type_doc"],
|
|
403
|
+
message: "Para nacionalidade estrangeira, o documento deve ser Registro de Estrangeiro (RNE)"
|
|
404
|
+
});
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
if (typeof data.doc === "string" && !PATTERNS.rneNumber.test(data.doc)) {
|
|
408
|
+
ctx.addIssue({
|
|
409
|
+
code: "custom",
|
|
410
|
+
path: ["doc"],
|
|
411
|
+
message: "RNE deve conter apenas letras e n\xFAmeros"
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
function isRecord(data) {
|
|
416
|
+
return typeof data === "object" && data !== null;
|
|
417
|
+
}
|
|
338
418
|
function applyPfRefinements(data, ctx) {
|
|
419
|
+
if (!isRecord(data)) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
339
422
|
applyCommonRefinements(data, ctx);
|
|
340
423
|
applyPartnerRefinement(data, ctx);
|
|
341
424
|
if ("nature_of_occupation" in data && typeof data.nature_of_occupation === "string" && OCCUPATIONS_REQUIRING_CNPJ.includes(data.nature_of_occupation) && !data.cnpj_proprietary) {
|
|
342
425
|
ctx.addIssue({
|
|
343
|
-
code:
|
|
426
|
+
code: "custom",
|
|
344
427
|
path: ["cnpj_proprietary"],
|
|
345
428
|
message: "CNPJ do propriet\xE1rio \xE9 obrigat\xF3rio para esta ocupa\xE7\xE3o"
|
|
346
429
|
});
|
|
@@ -349,41 +432,36 @@ function applyPfRefinements(data, ctx) {
|
|
|
349
432
|
const years = yearsSinceDMY(data.doc_issue_date);
|
|
350
433
|
if (years !== null && years > RG_MAX_EMISSION_YEARS) {
|
|
351
434
|
ctx.addIssue({
|
|
352
|
-
code:
|
|
435
|
+
code: "custom",
|
|
353
436
|
path: ["doc_issue_date"],
|
|
354
437
|
message: `RG deve ter no m\xE1ximo ${RG_MAX_EMISSION_YEARS} anos de emiss\xE3o`
|
|
355
438
|
});
|
|
356
439
|
}
|
|
357
440
|
}
|
|
441
|
+
applyForeignDocumentRefinement(data, ctx);
|
|
358
442
|
}
|
|
359
443
|
function applyPjRefinements(data, ctx) {
|
|
444
|
+
if (!isRecord(data)) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
360
447
|
applyCommonRefinements(data, ctx);
|
|
361
448
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
var ProofKinshipTypeLabels = {
|
|
372
|
-
certidao_casamento: "Certid\xE3o de casamento",
|
|
373
|
-
documento_identificacao: "Documento de identifica\xE7\xE3o",
|
|
374
|
-
contrato_social: "Contrato social",
|
|
375
|
-
declaracao_parentesco: "Declara\xE7\xE3o de parentesco",
|
|
376
|
-
outro_documento: "Outro documento"
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
// src/domains/financing/formalization/extras.ts
|
|
449
|
+
function onlyUnknownKeysAborted(payload) {
|
|
450
|
+
return payload.aborted !== true && !payload.issues.some((issue) => issue.continue !== true && issue.code !== "unrecognized_keys");
|
|
451
|
+
}
|
|
452
|
+
var pfRefinement = z.superRefine(applyPfRefinements, {
|
|
453
|
+
when: onlyUnknownKeysAborted
|
|
454
|
+
});
|
|
455
|
+
var pjRefinement = z.superRefine(applyPjRefinements, {
|
|
456
|
+
when: onlyUnknownKeysAborted
|
|
457
|
+
});
|
|
380
458
|
var formalizationExtras = {
|
|
381
459
|
voucher_local_installation_address: fileUploadField,
|
|
382
|
-
proof_kinship_type: ProofKinshipTypeEnum
|
|
460
|
+
proof_kinship_type: optionalField(ProofKinshipTypeEnum),
|
|
383
461
|
proof_kinship: fileUploadField.optional(),
|
|
384
462
|
document_front_upload: fileUploadField,
|
|
385
463
|
document_back_upload: fileUploadField,
|
|
386
464
|
rd_re_insurance_toggle: z.boolean().default(true)
|
|
387
465
|
};
|
|
388
466
|
|
|
389
|
-
export { CIVIL_STATUS_REQUIRING_PARTNER, NATIONALITY_BRAZIL, NationalityEnum, NationalityLabels, OCCUPATIONS_REQUIRING_CNPJ, PARTNER_FIELDS, ProofKinshipTypeLabels, SexEnum, SexLabels, UfEnum, UfLabels,
|
|
467
|
+
export { CIVIL_STATUS_REQUIRING_PARTNER, NATIONALITY_BRAZIL, NationalityEnum, NationalityLabels, OCCUPATIONS_REQUIRING_CNPJ, PARTNER_FIELDS, ProofKinshipTypeLabels, SexEnum, SexLabels, UfEnum, UfLabels, birthDateSchema, cepSchema, cnpjSchema, cpfCnpjSchema, cpfSchema, currencySchema, dateDMYSchema, emailSchema, enumField, formalizationExtras, integerField, issueDateSchema, numberField, optionalCurrencySchema, optionalField, pfRefinement, phoneBRSchema, pjRefinement, requiredArray, requiredObject, textField };
|