@77sol-lab/form-schemas 2.0.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.
Files changed (162) hide show
  1. package/{chunk-6U3W3WGJ.mjs → chunk-4T4DDJJZ.mjs} +6 -6
  2. package/{chunk-QGHAWR7N.mjs → chunk-65WB3CQB.mjs} +8 -8
  3. package/{chunk-AFF2ESHC.mjs → chunk-6AISIJ3O.mjs} +6 -6
  4. package/{chunk-P5QT636Q.mjs → chunk-7ULQG7YJ.mjs} +8 -8
  5. package/{chunk-QFCBUDTN.mjs → chunk-7VU2KIBV.mjs} +6 -6
  6. package/chunk-BXLQYGEB.mjs +105 -0
  7. package/{chunk-Z6PA77SA.mjs → chunk-CGBX6OCD.mjs} +6 -6
  8. package/{chunk-DKIUSETH.mjs → chunk-CJSJ3VDW.mjs} +109 -41
  9. package/{chunk-MKN3T4EC.mjs → chunk-EG5RVHCZ.mjs} +8 -8
  10. package/{chunk-2JHLFEU7.mjs → chunk-F4RMWUXJ.mjs} +9 -9
  11. package/{chunk-LXNKU6Q5.mjs → chunk-GBKY6QE3.mjs} +6 -6
  12. package/{chunk-KIN5ASCQ.mjs → chunk-HF7G6PTH.mjs} +8 -8
  13. package/{chunk-VGBIJ7LQ.mjs → chunk-HX5UJCA2.mjs} +6 -6
  14. package/{chunk-DRLPCEVY.mjs → chunk-HXHJSQ2X.mjs} +8 -8
  15. package/{chunk-ECQBM5TA.mjs → chunk-IVY6IQXZ.mjs} +8 -8
  16. package/{chunk-TGDPLYN3.mjs → chunk-K3QXEL6M.mjs} +19 -20
  17. package/{chunk-64RQV46Z.mjs → chunk-LDL7QLPB.mjs} +6 -6
  18. package/{chunk-DWOFPI2A.mjs → chunk-LRIO6V7H.mjs} +6 -6
  19. package/{chunk-FGNV6RT5.mjs → chunk-OIGZEDM3.mjs} +6 -6
  20. package/{chunk-FBL2YW6F.mjs → chunk-OJUTNXHL.mjs} +135 -38
  21. package/{chunk-E5SPEAZO.mjs → chunk-OKAMQBUN.mjs} +6 -6
  22. package/{chunk-KOB7CHDM.mjs → chunk-PCTF5JYB.mjs} +8 -8
  23. package/{chunk-26RFB4ZS.mjs → chunk-PCXYLWDD.mjs} +8 -8
  24. package/chunk-QEPJ2RLU.mjs +18 -0
  25. package/{chunk-LCD7MY35.mjs → chunk-QQCSQ3L4.mjs} +9 -9
  26. package/{chunk-IVT2ZFVR.mjs → chunk-R5TJYTTO.mjs} +8 -8
  27. package/{chunk-WVQ2LFIN.mjs → chunk-T2FBV7WO.mjs} +9 -9
  28. package/{chunk-LNPPAYB6.mjs → chunk-TNZ33455.mjs} +6 -6
  29. package/{chunk-J4BYCQDX.mjs → chunk-TWOBBIQC.mjs} +8 -8
  30. package/{chunk-NQIIQVGK.mjs → chunk-TZEPVIC4.mjs} +8 -8
  31. package/{chunk-QSMMXRNI.mjs → chunk-UK62IINL.mjs} +6 -6
  32. package/{chunk-6EBUH4MK.mjs → chunk-VTTNXB64.mjs} +6 -6
  33. package/{chunk-DQ6ZS36G.mjs → chunk-VWKF4I2L.mjs} +8 -8
  34. package/financing/formalization/index.d.cts +710 -708
  35. package/financing/formalization/index.d.ts +710 -708
  36. package/financing/formalization/index.js +454 -226
  37. package/financing/formalization/index.mjs +33 -33
  38. package/financing/formalization/schemas/AlfaPFSchema.d.cts +16 -16
  39. package/financing/formalization/schemas/AlfaPFSchema.d.ts +16 -16
  40. package/financing/formalization/schemas/AlfaPFSchema.js +94 -27
  41. package/financing/formalization/schemas/AlfaPFSchema.mjs +3 -3
  42. package/financing/formalization/schemas/AlfaPJSchema.d.cts +16 -16
  43. package/financing/formalization/schemas/AlfaPJSchema.d.ts +16 -16
  44. package/financing/formalization/schemas/AlfaPJSchema.js +97 -29
  45. package/financing/formalization/schemas/AlfaPJSchema.mjs +2 -2
  46. package/financing/formalization/schemas/BancoDoBrasilPFSchema.d.cts +16 -16
  47. package/financing/formalization/schemas/BancoDoBrasilPFSchema.d.ts +16 -16
  48. package/financing/formalization/schemas/BancoDoBrasilPFSchema.js +94 -27
  49. package/financing/formalization/schemas/BancoDoBrasilPFSchema.mjs +3 -3
  50. package/financing/formalization/schemas/BancoDoBrasilPJSchema.d.cts +16 -16
  51. package/financing/formalization/schemas/BancoDoBrasilPJSchema.d.ts +16 -16
  52. package/financing/formalization/schemas/BancoDoBrasilPJSchema.js +97 -29
  53. package/financing/formalization/schemas/BancoDoBrasilPJSchema.mjs +2 -2
  54. package/financing/formalization/schemas/BtgPFSchema.d.cts +16 -16
  55. package/financing/formalization/schemas/BtgPFSchema.d.ts +16 -16
  56. package/financing/formalization/schemas/BtgPFSchema.js +94 -27
  57. package/financing/formalization/schemas/BtgPFSchema.mjs +3 -3
  58. package/financing/formalization/schemas/BtgPJSchema.d.cts +16 -16
  59. package/financing/formalization/schemas/BtgPJSchema.d.ts +16 -16
  60. package/financing/formalization/schemas/BtgPJSchema.js +102 -30
  61. package/financing/formalization/schemas/BtgPJSchema.mjs +3 -3
  62. package/financing/formalization/schemas/BvPFSchema.d.cts +20 -20
  63. package/financing/formalization/schemas/BvPFSchema.d.ts +20 -20
  64. package/financing/formalization/schemas/BvPFSchema.js +96 -29
  65. package/financing/formalization/schemas/BvPFSchema.mjs +3 -3
  66. package/financing/formalization/schemas/BvPJSchema.d.cts +16 -16
  67. package/financing/formalization/schemas/BvPJSchema.d.ts +16 -16
  68. package/financing/formalization/schemas/BvPJSchema.js +102 -30
  69. package/financing/formalization/schemas/BvPJSchema.mjs +3 -3
  70. package/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.d.cts +16 -16
  71. package/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.d.ts +16 -16
  72. package/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.js +94 -27
  73. package/financing/formalization/schemas/CaixaEconomicaFederalPFSchema.mjs +3 -3
  74. package/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.d.cts +16 -16
  75. package/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.d.ts +16 -16
  76. package/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.js +97 -29
  77. package/financing/formalization/schemas/CaixaEconomicaFederalPJSchema.mjs +2 -2
  78. package/financing/formalization/schemas/CashMePFSchema.d.cts +16 -16
  79. package/financing/formalization/schemas/CashMePFSchema.d.ts +16 -16
  80. package/financing/formalization/schemas/CashMePFSchema.js +94 -27
  81. package/financing/formalization/schemas/CashMePFSchema.mjs +3 -3
  82. package/financing/formalization/schemas/CashMePJSchema.d.cts +16 -16
  83. package/financing/formalization/schemas/CashMePJSchema.d.ts +16 -16
  84. package/financing/formalization/schemas/CashMePJSchema.js +97 -29
  85. package/financing/formalization/schemas/CashMePJSchema.mjs +2 -2
  86. package/financing/formalization/schemas/Credito77PFSchema.d.cts +16 -16
  87. package/financing/formalization/schemas/Credito77PFSchema.d.ts +16 -16
  88. package/financing/formalization/schemas/Credito77PFSchema.js +94 -27
  89. package/financing/formalization/schemas/Credito77PFSchema.mjs +3 -3
  90. package/financing/formalization/schemas/Credito77PJSchema.d.cts +16 -16
  91. package/financing/formalization/schemas/Credito77PJSchema.d.ts +16 -16
  92. package/financing/formalization/schemas/Credito77PJSchema.js +97 -29
  93. package/financing/formalization/schemas/Credito77PJSchema.mjs +2 -2
  94. package/financing/formalization/schemas/EosPFSchema.d.cts +16 -16
  95. package/financing/formalization/schemas/EosPFSchema.d.ts +16 -16
  96. package/financing/formalization/schemas/EosPFSchema.js +94 -27
  97. package/financing/formalization/schemas/EosPFSchema.mjs +3 -3
  98. package/financing/formalization/schemas/EosPJSchema.d.cts +16 -16
  99. package/financing/formalization/schemas/EosPJSchema.d.ts +16 -16
  100. package/financing/formalization/schemas/EosPJSchema.js +97 -29
  101. package/financing/formalization/schemas/EosPJSchema.mjs +2 -2
  102. package/financing/formalization/schemas/HdtEnergyPFSchema.d.cts +16 -16
  103. package/financing/formalization/schemas/HdtEnergyPFSchema.d.ts +16 -16
  104. package/financing/formalization/schemas/HdtEnergyPFSchema.js +94 -27
  105. package/financing/formalization/schemas/HdtEnergyPFSchema.mjs +3 -3
  106. package/financing/formalization/schemas/HdtEnergyPJSchema.d.cts +16 -16
  107. package/financing/formalization/schemas/HdtEnergyPJSchema.d.ts +16 -16
  108. package/financing/formalization/schemas/HdtEnergyPJSchema.js +97 -29
  109. package/financing/formalization/schemas/HdtEnergyPJSchema.mjs +2 -2
  110. package/financing/formalization/schemas/LosangoPFSchema.d.cts +16 -16
  111. package/financing/formalization/schemas/LosangoPFSchema.d.ts +16 -16
  112. package/financing/formalization/schemas/LosangoPFSchema.js +94 -27
  113. package/financing/formalization/schemas/LosangoPFSchema.mjs +3 -3
  114. package/financing/formalization/schemas/LosangoPJSchema.d.cts +16 -16
  115. package/financing/formalization/schemas/LosangoPJSchema.d.ts +16 -16
  116. package/financing/formalization/schemas/LosangoPJSchema.js +97 -29
  117. package/financing/formalization/schemas/LosangoPJSchema.mjs +2 -2
  118. package/financing/formalization/schemas/SafraPFSchema.d.cts +16 -16
  119. package/financing/formalization/schemas/SafraPFSchema.d.ts +16 -16
  120. package/financing/formalization/schemas/SafraPFSchema.js +94 -27
  121. package/financing/formalization/schemas/SafraPFSchema.mjs +3 -3
  122. package/financing/formalization/schemas/SafraPJSchema.d.cts +16 -16
  123. package/financing/formalization/schemas/SafraPJSchema.d.ts +16 -16
  124. package/financing/formalization/schemas/SafraPJSchema.js +97 -29
  125. package/financing/formalization/schemas/SafraPJSchema.mjs +2 -2
  126. package/financing/formalization/schemas/SantanderPFSchema.d.cts +16 -16
  127. package/financing/formalization/schemas/SantanderPFSchema.d.ts +16 -16
  128. package/financing/formalization/schemas/SantanderPFSchema.js +94 -27
  129. package/financing/formalization/schemas/SantanderPFSchema.mjs +3 -3
  130. package/financing/formalization/schemas/SantanderPJSchema.d.cts +16 -16
  131. package/financing/formalization/schemas/SantanderPJSchema.d.ts +16 -16
  132. package/financing/formalization/schemas/SantanderPJSchema.js +97 -29
  133. package/financing/formalization/schemas/SantanderPJSchema.mjs +2 -2
  134. package/financing/formalization/schemas/SolAgoraPFSchema.d.cts +16 -16
  135. package/financing/formalization/schemas/SolAgoraPFSchema.d.ts +16 -16
  136. package/financing/formalization/schemas/SolAgoraPFSchema.js +94 -27
  137. package/financing/formalization/schemas/SolAgoraPFSchema.mjs +3 -3
  138. package/financing/formalization/schemas/SolAgoraPJSchema.d.cts +16 -16
  139. package/financing/formalization/schemas/SolAgoraPJSchema.d.ts +16 -16
  140. package/financing/formalization/schemas/SolAgoraPJSchema.js +102 -30
  141. package/financing/formalization/schemas/SolAgoraPJSchema.mjs +3 -3
  142. package/financing/formalization/schemas/SolfacilPFSchema.d.cts +16 -16
  143. package/financing/formalization/schemas/SolfacilPFSchema.d.ts +16 -16
  144. package/financing/formalization/schemas/SolfacilPFSchema.js +94 -27
  145. package/financing/formalization/schemas/SolfacilPFSchema.mjs +3 -3
  146. package/financing/formalization/schemas/SolfacilPJSchema.d.cts +16 -16
  147. package/financing/formalization/schemas/SolfacilPJSchema.d.ts +16 -16
  148. package/financing/formalization/schemas/SolfacilPJSchema.js +97 -29
  149. package/financing/formalization/schemas/SolfacilPJSchema.mjs +2 -2
  150. package/financing/formalization/schemas/UnifiedPFSchema.d.cts +48 -48
  151. package/financing/formalization/schemas/UnifiedPFSchema.d.ts +48 -48
  152. package/financing/formalization/schemas/UnifiedPFSchema.js +108 -41
  153. package/financing/formalization/schemas/UnifiedPFSchema.mjs +3 -3
  154. package/financing/formalization/schemas/UnifiedPJSchema.d.cts +118 -118
  155. package/financing/formalization/schemas/UnifiedPJSchema.d.ts +118 -118
  156. package/financing/formalization/schemas/UnifiedPJSchema.js +147 -75
  157. package/financing/formalization/schemas/UnifiedPJSchema.mjs +3 -3
  158. package/index.js +454 -226
  159. package/index.mjs +33 -33
  160. package/package.json +1 -1
  161. package/chunk-ARSY3NB7.mjs +0 -13
  162. package/chunk-QZ2BTLCH.mjs +0 -105
@@ -10,12 +10,12 @@ declare const santanderPfObject: z.ZodObject<{
10
10
  sex: z.ZodEnum<{
11
11
  [x: string]: string;
12
12
  }>;
13
- complement: z.ZodOptional<z.ZodString>;
13
+ complement: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
14
14
  mother_name: z.ZodString;
15
15
  district: z.ZodString;
16
16
  energy_account_in_requester_name: z.ZodString;
17
17
  city: z.ZodString;
18
- energy_bill_owner_document: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
18
+ energy_bill_owner_document: z.ZodPreprocess<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
19
19
  state: z.ZodEnum<{
20
20
  [x: string]: string;
21
21
  }>;
@@ -33,7 +33,7 @@ declare const santanderPfObject: z.ZodObject<{
33
33
  issuing_body: z.ZodString;
34
34
  doc_issue_date: z.ZodString;
35
35
  voucher_local_installation_address: z.ZodObject<{
36
- url: z.ZodOptional<z.ZodURL>;
36
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
37
37
  mime: z.ZodEnum<{
38
38
  "image/jpeg": "image/jpeg";
39
39
  "image/png": "image/png";
@@ -41,11 +41,11 @@ declare const santanderPfObject: z.ZodObject<{
41
41
  }>;
42
42
  sizeBytes: z.ZodNumber;
43
43
  }, z.core.$strip>;
44
- proof_kinship_type: z.ZodOptional<z.ZodEnum<{
44
+ proof_kinship_type: z.ZodPreprocess<z.ZodOptional<z.ZodEnum<{
45
45
  [x: string]: string;
46
- }>>;
46
+ }>>>;
47
47
  proof_kinship: z.ZodOptional<z.ZodObject<{
48
- url: z.ZodOptional<z.ZodURL>;
48
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
49
49
  mime: z.ZodEnum<{
50
50
  "image/jpeg": "image/jpeg";
51
51
  "image/png": "image/png";
@@ -54,7 +54,7 @@ declare const santanderPfObject: z.ZodObject<{
54
54
  sizeBytes: z.ZodNumber;
55
55
  }, z.core.$strip>>;
56
56
  document_front_upload: z.ZodObject<{
57
- url: z.ZodOptional<z.ZodURL>;
57
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
58
58
  mime: z.ZodEnum<{
59
59
  "image/jpeg": "image/jpeg";
60
60
  "image/png": "image/png";
@@ -63,7 +63,7 @@ declare const santanderPfObject: z.ZodObject<{
63
63
  sizeBytes: z.ZodNumber;
64
64
  }, z.core.$strip>;
65
65
  document_back_upload: z.ZodObject<{
66
- url: z.ZodOptional<z.ZodURL>;
66
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
67
67
  mime: z.ZodEnum<{
68
68
  "image/jpeg": "image/jpeg";
69
69
  "image/png": "image/png";
@@ -83,12 +83,12 @@ declare const santanderPfSchema: z.ZodObject<{
83
83
  sex: z.ZodEnum<{
84
84
  [x: string]: string;
85
85
  }>;
86
- complement: z.ZodOptional<z.ZodString>;
86
+ complement: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
87
87
  mother_name: z.ZodString;
88
88
  district: z.ZodString;
89
89
  energy_account_in_requester_name: z.ZodString;
90
90
  city: z.ZodString;
91
- energy_bill_owner_document: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
91
+ energy_bill_owner_document: z.ZodPreprocess<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
92
92
  state: z.ZodEnum<{
93
93
  [x: string]: string;
94
94
  }>;
@@ -106,7 +106,7 @@ declare const santanderPfSchema: z.ZodObject<{
106
106
  issuing_body: z.ZodString;
107
107
  doc_issue_date: z.ZodString;
108
108
  voucher_local_installation_address: z.ZodObject<{
109
- url: z.ZodOptional<z.ZodURL>;
109
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
110
110
  mime: z.ZodEnum<{
111
111
  "image/jpeg": "image/jpeg";
112
112
  "image/png": "image/png";
@@ -114,11 +114,11 @@ declare const santanderPfSchema: z.ZodObject<{
114
114
  }>;
115
115
  sizeBytes: z.ZodNumber;
116
116
  }, z.core.$strip>;
117
- proof_kinship_type: z.ZodOptional<z.ZodEnum<{
117
+ proof_kinship_type: z.ZodPreprocess<z.ZodOptional<z.ZodEnum<{
118
118
  [x: string]: string;
119
- }>>;
119
+ }>>>;
120
120
  proof_kinship: z.ZodOptional<z.ZodObject<{
121
- url: z.ZodOptional<z.ZodURL>;
121
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
122
122
  mime: z.ZodEnum<{
123
123
  "image/jpeg": "image/jpeg";
124
124
  "image/png": "image/png";
@@ -127,7 +127,7 @@ declare const santanderPfSchema: z.ZodObject<{
127
127
  sizeBytes: z.ZodNumber;
128
128
  }, z.core.$strip>>;
129
129
  document_front_upload: z.ZodObject<{
130
- url: z.ZodOptional<z.ZodURL>;
130
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
131
131
  mime: z.ZodEnum<{
132
132
  "image/jpeg": "image/jpeg";
133
133
  "image/png": "image/png";
@@ -136,7 +136,7 @@ declare const santanderPfSchema: z.ZodObject<{
136
136
  sizeBytes: z.ZodNumber;
137
137
  }, z.core.$strip>;
138
138
  document_back_upload: z.ZodObject<{
139
- url: z.ZodOptional<z.ZodURL>;
139
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
140
140
  mime: z.ZodEnum<{
141
141
  "image/jpeg": "image/jpeg";
142
142
  "image/png": "image/png";
@@ -2,15 +2,14 @@
2
2
 
3
3
  var zod = require('zod');
4
4
 
5
- // src/domains/financing/formalization/schemas/SantanderPFSchema.ts
5
+ // src/shared/fields/primitives.ts
6
6
  var REQUIRED_MESSAGE = "Campo obrigat\xF3rio";
7
- var REQUIRED_STRING_PARAMS = { error: REQUIRED_MESSAGE };
8
7
  function requiredString() {
9
- return zod.z.string(REQUIRED_STRING_PARAMS);
8
+ return zod.z.string({ error: REQUIRED_MESSAGE });
10
9
  }
11
- function textField(maxLength) {
12
- const base = requiredString().trim().min(1, REQUIRED_MESSAGE);
13
- return maxLength === void 0 ? base : base.max(maxLength, `M\xE1ximo ${maxLength} caracteres`);
10
+ var DEFAULT_TEXT_MAX_LENGTH = 255;
11
+ function textField(maxLength = DEFAULT_TEXT_MAX_LENGTH) {
12
+ return requiredString().trim().min(1, REQUIRED_MESSAGE).max(maxLength, `M\xE1ximo ${maxLength} caracteres`);
14
13
  }
15
14
  function requiredNumber(invalidTypeMessage) {
16
15
  return zod.z.number({
@@ -21,6 +20,29 @@ requiredNumber("Valor num\xE9rico inv\xE1lido").nonnegative(
21
20
  "Valor n\xE3o pode ser negativo"
22
21
  );
23
22
  requiredNumber("Valor num\xE9rico inv\xE1lido").int("Deve ser um n\xFAmero inteiro").nonnegative("Valor n\xE3o pode ser negativo");
23
+ function optionalField(schema) {
24
+ return zod.z.preprocess(
25
+ (value) => typeof value === "string" && value.trim() === "" ? void 0 : value,
26
+ schema.optional()
27
+ );
28
+ }
29
+ function unrecognizedKeysMessage(keys) {
30
+ const list = keys.map((key) => `"${key}"`).join(", ");
31
+ return keys.length === 1 ? `Campo n\xE3o reconhecido: ${list}` : `Campos n\xE3o reconhecidos: ${list}`;
32
+ }
33
+ function requiredObject(shape) {
34
+ return zod.z.object(shape, {
35
+ error: (issue) => {
36
+ if (issue.code === "invalid_type") {
37
+ return REQUIRED_MESSAGE;
38
+ }
39
+ if (issue.code === "unrecognized_keys") {
40
+ return unrecognizedKeysMessage(issue.keys);
41
+ }
42
+ return void 0;
43
+ }
44
+ });
45
+ }
24
46
  function enumField(values) {
25
47
  return zod.z.enum(values, {
26
48
  // No zod 4 todo input fora da lista (inclusive undefined/null) gera um único
@@ -32,19 +54,28 @@ function enumField(values) {
32
54
  }
33
55
  var MAX_UPLOAD_BYTES = 5 * 1024 * 1024;
34
56
  var ACCEPTED_UPLOAD_MIME = ["image/jpeg", "image/png", "application/pdf"];
35
- var fileUploadField = zod.z.object(
36
- {
37
- url: zod.z.url().optional(),
38
- mime: zod.z.enum(ACCEPTED_UPLOAD_MIME, { error: "Formato deve ser JPEG, PNG ou PDF" }),
39
- sizeBytes: zod.z.number().max(MAX_UPLOAD_BYTES, "Arquivo deve ter no m\xE1ximo 5MB")
40
- },
41
- REQUIRED_STRING_PARAMS
42
- );
57
+ var UPLOAD_URL_PROTOCOL = /^https$/;
58
+ var UPLOAD_URL_HOSTNAME = /^(?!localhost$)(?!(\d{1,3}\.){3}\d{1,3}$)[a-z0-9.-]+$/i;
59
+ var fileUploadField = requiredObject({
60
+ url: optionalField(
61
+ zod.z.url({
62
+ protocol: UPLOAD_URL_PROTOCOL,
63
+ hostname: UPLOAD_URL_HOSTNAME,
64
+ error: "URL do arquivo inv\xE1lida"
65
+ })
66
+ ),
67
+ mime: zod.z.enum(ACCEPTED_UPLOAD_MIME, { error: "Formato deve ser JPEG, PNG ou PDF" }),
68
+ 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")
69
+ });
43
70
 
44
71
  // src/shared/enums/document-type.ts
45
72
  var DocumentTypeEnum = enumField([
46
73
  "documento_de_identidade",
47
- "carteira_nacional_de_habilita\xE7\xE3o"
74
+ "carteira_nacional_de_habilita\xE7\xE3o",
75
+ // Exigido pela RN-015 para nacionalidade estrangeira. Sem este membro a
76
+ // regra seria insatisfazível: todo schema é .strict() com type_doc
77
+ // restrito a este enum.
78
+ "registro_de_estrangeiro"
48
79
  ]);
49
80
 
50
81
  // src/shared/enums/nationality.ts
@@ -118,7 +149,10 @@ var PATTERNS = {
118
149
  cep: /^\d{8}$/,
119
150
  phoneBR: /^\d{11}$/,
120
151
  email: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
121
- dateDMY: /^\d{2}\/\d{2}\/\d{4}$/};
152
+ dateDMY: /^\d{2}\/\d{2}\/\d{4}$/,
153
+ // Formato do RNE, exigido pela RN-015 para nacionalidade estrangeira.
154
+ rneNumber: /^[A-Za-z0-9]+$/
155
+ };
122
156
 
123
157
  // src/shared/regex/validators.ts
124
158
  function onlyDigits(value) {
@@ -235,22 +269,22 @@ function parseBRLCurrency(value) {
235
269
  if (typeof value !== "string") {
236
270
  return value;
237
271
  }
238
- const trimmed = value.trim();
239
- if (trimmed === "") {
272
+ const normalized = value.replace(/R\$/gi, "").replace(/\s/g, "").replace(/\./g, "").replace(",", ".");
273
+ if (normalized === "") {
240
274
  return void 0;
241
275
  }
242
- const normalized = trimmed.replace(/R\$/gi, "").replace(/\s/g, "").replace(/\./g, "").replace(",", ".");
243
276
  const parsed = Number(normalized);
244
277
  return Number.isNaN(parsed) ? value : parsed;
245
278
  }
246
- var currencySchema = zod.z.preprocess(
247
- parseBRLCurrency,
248
- requiredNumber("Valor monet\xE1rio inv\xE1lido").positive("Valor deve ser positivo")
249
- );
279
+ function brlAmount() {
280
+ return requiredNumber("Valor monet\xE1rio inv\xE1lido").positive("Valor deve ser positivo");
281
+ }
282
+ var currencySchema = zod.z.preprocess(parseBRLCurrency, brlAmount());
283
+ zod.z.preprocess(parseBRLCurrency, brlAmount().optional());
250
284
  requiredNumber("Valor num\xE9rico inv\xE1lido").int("Deve ser um n\xFAmero inteiro").min(1, "M\xEDnimo 1").max(28, "M\xE1ximo 28");
251
285
  var formalizationExtras = {
252
286
  voucher_local_installation_address: fileUploadField,
253
- proof_kinship_type: ProofKinshipTypeEnum.optional(),
287
+ proof_kinship_type: optionalField(ProofKinshipTypeEnum),
254
288
  proof_kinship: fileUploadField.optional(),
255
289
  document_front_upload: fileUploadField,
256
290
  document_back_upload: fileUploadField,
@@ -312,7 +346,36 @@ function applyCommonRefinements(data, ctx) {
312
346
  });
313
347
  }
314
348
  }
349
+ var FOREIGN_DOCUMENT_TYPE = "registro_de_estrangeiro";
350
+ function applyForeignDocumentRefinement(data, ctx) {
351
+ const nationality = data.nationality;
352
+ const isForeign = typeof nationality === "string" && nationality.toLowerCase() !== NATIONALITY_BRAZIL;
353
+ if (!isForeign || !("type_doc" in data)) {
354
+ return;
355
+ }
356
+ if (data.type_doc !== FOREIGN_DOCUMENT_TYPE) {
357
+ ctx.addIssue({
358
+ code: "custom",
359
+ path: ["type_doc"],
360
+ message: "Para nacionalidade estrangeira, o documento deve ser Registro de Estrangeiro (RNE)"
361
+ });
362
+ return;
363
+ }
364
+ if (typeof data.doc === "string" && !PATTERNS.rneNumber.test(data.doc)) {
365
+ ctx.addIssue({
366
+ code: "custom",
367
+ path: ["doc"],
368
+ message: "RNE deve conter apenas letras e n\xFAmeros"
369
+ });
370
+ }
371
+ }
372
+ function isRecord(data) {
373
+ return typeof data === "object" && data !== null;
374
+ }
315
375
  function applyPfRefinements(data, ctx) {
376
+ if (!isRecord(data)) {
377
+ return;
378
+ }
316
379
  applyCommonRefinements(data, ctx);
317
380
  applyPartnerRefinement(data, ctx);
318
381
  if ("nature_of_occupation" in data && typeof data.nature_of_occupation === "string" && OCCUPATIONS_REQUIRING_CNPJ.includes(data.nature_of_occupation) && !data.cnpj_proprietary) {
@@ -332,8 +395,12 @@ function applyPfRefinements(data, ctx) {
332
395
  });
333
396
  }
334
397
  }
398
+ applyForeignDocumentRefinement(data, ctx);
335
399
  }
336
400
  function applyPjRefinements(data, ctx) {
401
+ if (!isRecord(data)) {
402
+ return;
403
+ }
337
404
  applyCommonRefinements(data, ctx);
338
405
  }
339
406
  function onlyUnknownKeysAborted(payload) {
@@ -347,7 +414,7 @@ zod.z.superRefine(applyPjRefinements, {
347
414
  });
348
415
 
349
416
  // src/domains/financing/formalization/schemas/SantanderPFSchema.ts
350
- var santanderPfObject = zod.z.object({
417
+ var santanderPfObject = requiredObject({
351
418
  ...formalizationExtras,
352
419
  name: textField(),
353
420
  cep: cepSchema,
@@ -356,12 +423,12 @@ var santanderPfObject = zod.z.object({
356
423
  birth_date: birthDateSchema,
357
424
  number: textField(),
358
425
  sex: SexEnum,
359
- complement: textField(15).optional(),
426
+ complement: optionalField(textField(15)),
360
427
  mother_name: textField(),
361
428
  district: textField(),
362
429
  energy_account_in_requester_name: textField(),
363
430
  city: textField(),
364
- energy_bill_owner_document: cpfCnpjSchema.optional(),
431
+ energy_bill_owner_document: optionalField(cpfCnpjSchema),
365
432
  state: UfEnum,
366
433
  nationality: NationalityEnum.default(NATIONALITY_BRAZIL),
367
434
  cellphone: phoneBRSchema,
@@ -1,3 +1,3 @@
1
- export { santanderPfObject, santanderPfSchema } from '../../../chunk-64RQV46Z.mjs';
2
- import '../../../chunk-ARSY3NB7.mjs';
3
- import '../../../chunk-DKIUSETH.mjs';
1
+ export { santanderPfObject, santanderPfSchema } from '../../../chunk-LDL7QLPB.mjs';
2
+ import '../../../chunk-QEPJ2RLU.mjs';
3
+ import '../../../chunk-CJSJ3VDW.mjs';
@@ -9,7 +9,7 @@ declare const santanderPjObject: z.ZodObject<{
9
9
  number: z.ZodString;
10
10
  cnpj: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
11
11
  email: z.ZodString;
12
- complement: z.ZodOptional<z.ZodString>;
12
+ complement: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
13
13
  phone: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
14
14
  district: z.ZodString;
15
15
  legal_nature: z.ZodString;
@@ -28,7 +28,7 @@ declare const santanderPjObject: z.ZodObject<{
28
28
  address: z.ZodString;
29
29
  birth_date: z.ZodString;
30
30
  number: z.ZodString;
31
- complement: z.ZodOptional<z.ZodString>;
31
+ complement: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
32
32
  cellphone: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
33
33
  email: z.ZodString;
34
34
  district: z.ZodString;
@@ -46,7 +46,7 @@ declare const santanderPjObject: z.ZodObject<{
46
46
  }>>;
47
47
  }, z.core.$strict>>;
48
48
  voucher_local_installation_address: z.ZodObject<{
49
- url: z.ZodOptional<z.ZodURL>;
49
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
50
50
  mime: z.ZodEnum<{
51
51
  "image/jpeg": "image/jpeg";
52
52
  "image/png": "image/png";
@@ -54,11 +54,11 @@ declare const santanderPjObject: z.ZodObject<{
54
54
  }>;
55
55
  sizeBytes: z.ZodNumber;
56
56
  }, z.core.$strip>;
57
- proof_kinship_type: z.ZodOptional<z.ZodEnum<{
57
+ proof_kinship_type: z.ZodPreprocess<z.ZodOptional<z.ZodEnum<{
58
58
  [x: string]: string;
59
- }>>;
59
+ }>>>;
60
60
  proof_kinship: z.ZodOptional<z.ZodObject<{
61
- url: z.ZodOptional<z.ZodURL>;
61
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
62
62
  mime: z.ZodEnum<{
63
63
  "image/jpeg": "image/jpeg";
64
64
  "image/png": "image/png";
@@ -67,7 +67,7 @@ declare const santanderPjObject: z.ZodObject<{
67
67
  sizeBytes: z.ZodNumber;
68
68
  }, z.core.$strip>>;
69
69
  document_front_upload: z.ZodObject<{
70
- url: z.ZodOptional<z.ZodURL>;
70
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
71
71
  mime: z.ZodEnum<{
72
72
  "image/jpeg": "image/jpeg";
73
73
  "image/png": "image/png";
@@ -76,7 +76,7 @@ declare const santanderPjObject: z.ZodObject<{
76
76
  sizeBytes: z.ZodNumber;
77
77
  }, z.core.$strip>;
78
78
  document_back_upload: z.ZodObject<{
79
- url: z.ZodOptional<z.ZodURL>;
79
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
80
80
  mime: z.ZodEnum<{
81
81
  "image/jpeg": "image/jpeg";
82
82
  "image/png": "image/png";
@@ -95,7 +95,7 @@ declare const santanderPjSchema: z.ZodObject<{
95
95
  number: z.ZodString;
96
96
  cnpj: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
97
97
  email: z.ZodString;
98
- complement: z.ZodOptional<z.ZodString>;
98
+ complement: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
99
99
  phone: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
100
100
  district: z.ZodString;
101
101
  legal_nature: z.ZodString;
@@ -114,7 +114,7 @@ declare const santanderPjSchema: z.ZodObject<{
114
114
  address: z.ZodString;
115
115
  birth_date: z.ZodString;
116
116
  number: z.ZodString;
117
- complement: z.ZodOptional<z.ZodString>;
117
+ complement: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
118
118
  cellphone: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
119
119
  email: z.ZodString;
120
120
  district: z.ZodString;
@@ -132,7 +132,7 @@ declare const santanderPjSchema: z.ZodObject<{
132
132
  }>>;
133
133
  }, z.core.$strict>>;
134
134
  voucher_local_installation_address: z.ZodObject<{
135
- url: z.ZodOptional<z.ZodURL>;
135
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
136
136
  mime: z.ZodEnum<{
137
137
  "image/jpeg": "image/jpeg";
138
138
  "image/png": "image/png";
@@ -140,11 +140,11 @@ declare const santanderPjSchema: z.ZodObject<{
140
140
  }>;
141
141
  sizeBytes: z.ZodNumber;
142
142
  }, z.core.$strip>;
143
- proof_kinship_type: z.ZodOptional<z.ZodEnum<{
143
+ proof_kinship_type: z.ZodPreprocess<z.ZodOptional<z.ZodEnum<{
144
144
  [x: string]: string;
145
- }>>;
145
+ }>>>;
146
146
  proof_kinship: z.ZodOptional<z.ZodObject<{
147
- url: z.ZodOptional<z.ZodURL>;
147
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
148
148
  mime: z.ZodEnum<{
149
149
  "image/jpeg": "image/jpeg";
150
150
  "image/png": "image/png";
@@ -153,7 +153,7 @@ declare const santanderPjSchema: z.ZodObject<{
153
153
  sizeBytes: z.ZodNumber;
154
154
  }, z.core.$strip>>;
155
155
  document_front_upload: z.ZodObject<{
156
- url: z.ZodOptional<z.ZodURL>;
156
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
157
157
  mime: z.ZodEnum<{
158
158
  "image/jpeg": "image/jpeg";
159
159
  "image/png": "image/png";
@@ -162,7 +162,7 @@ declare const santanderPjSchema: z.ZodObject<{
162
162
  sizeBytes: z.ZodNumber;
163
163
  }, z.core.$strip>;
164
164
  document_back_upload: z.ZodObject<{
165
- url: z.ZodOptional<z.ZodURL>;
165
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
166
166
  mime: z.ZodEnum<{
167
167
  "image/jpeg": "image/jpeg";
168
168
  "image/png": "image/png";
@@ -9,7 +9,7 @@ declare const santanderPjObject: z.ZodObject<{
9
9
  number: z.ZodString;
10
10
  cnpj: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
11
11
  email: z.ZodString;
12
- complement: z.ZodOptional<z.ZodString>;
12
+ complement: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
13
13
  phone: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
14
14
  district: z.ZodString;
15
15
  legal_nature: z.ZodString;
@@ -28,7 +28,7 @@ declare const santanderPjObject: z.ZodObject<{
28
28
  address: z.ZodString;
29
29
  birth_date: z.ZodString;
30
30
  number: z.ZodString;
31
- complement: z.ZodOptional<z.ZodString>;
31
+ complement: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
32
32
  cellphone: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
33
33
  email: z.ZodString;
34
34
  district: z.ZodString;
@@ -46,7 +46,7 @@ declare const santanderPjObject: z.ZodObject<{
46
46
  }>>;
47
47
  }, z.core.$strict>>;
48
48
  voucher_local_installation_address: z.ZodObject<{
49
- url: z.ZodOptional<z.ZodURL>;
49
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
50
50
  mime: z.ZodEnum<{
51
51
  "image/jpeg": "image/jpeg";
52
52
  "image/png": "image/png";
@@ -54,11 +54,11 @@ declare const santanderPjObject: z.ZodObject<{
54
54
  }>;
55
55
  sizeBytes: z.ZodNumber;
56
56
  }, z.core.$strip>;
57
- proof_kinship_type: z.ZodOptional<z.ZodEnum<{
57
+ proof_kinship_type: z.ZodPreprocess<z.ZodOptional<z.ZodEnum<{
58
58
  [x: string]: string;
59
- }>>;
59
+ }>>>;
60
60
  proof_kinship: z.ZodOptional<z.ZodObject<{
61
- url: z.ZodOptional<z.ZodURL>;
61
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
62
62
  mime: z.ZodEnum<{
63
63
  "image/jpeg": "image/jpeg";
64
64
  "image/png": "image/png";
@@ -67,7 +67,7 @@ declare const santanderPjObject: z.ZodObject<{
67
67
  sizeBytes: z.ZodNumber;
68
68
  }, z.core.$strip>>;
69
69
  document_front_upload: z.ZodObject<{
70
- url: z.ZodOptional<z.ZodURL>;
70
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
71
71
  mime: z.ZodEnum<{
72
72
  "image/jpeg": "image/jpeg";
73
73
  "image/png": "image/png";
@@ -76,7 +76,7 @@ declare const santanderPjObject: z.ZodObject<{
76
76
  sizeBytes: z.ZodNumber;
77
77
  }, z.core.$strip>;
78
78
  document_back_upload: z.ZodObject<{
79
- url: z.ZodOptional<z.ZodURL>;
79
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
80
80
  mime: z.ZodEnum<{
81
81
  "image/jpeg": "image/jpeg";
82
82
  "image/png": "image/png";
@@ -95,7 +95,7 @@ declare const santanderPjSchema: z.ZodObject<{
95
95
  number: z.ZodString;
96
96
  cnpj: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
97
97
  email: z.ZodString;
98
- complement: z.ZodOptional<z.ZodString>;
98
+ complement: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
99
99
  phone: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
100
100
  district: z.ZodString;
101
101
  legal_nature: z.ZodString;
@@ -114,7 +114,7 @@ declare const santanderPjSchema: z.ZodObject<{
114
114
  address: z.ZodString;
115
115
  birth_date: z.ZodString;
116
116
  number: z.ZodString;
117
- complement: z.ZodOptional<z.ZodString>;
117
+ complement: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
118
118
  cellphone: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
119
119
  email: z.ZodString;
120
120
  district: z.ZodString;
@@ -132,7 +132,7 @@ declare const santanderPjSchema: z.ZodObject<{
132
132
  }>>;
133
133
  }, z.core.$strict>>;
134
134
  voucher_local_installation_address: z.ZodObject<{
135
- url: z.ZodOptional<z.ZodURL>;
135
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
136
136
  mime: z.ZodEnum<{
137
137
  "image/jpeg": "image/jpeg";
138
138
  "image/png": "image/png";
@@ -140,11 +140,11 @@ declare const santanderPjSchema: z.ZodObject<{
140
140
  }>;
141
141
  sizeBytes: z.ZodNumber;
142
142
  }, z.core.$strip>;
143
- proof_kinship_type: z.ZodOptional<z.ZodEnum<{
143
+ proof_kinship_type: z.ZodPreprocess<z.ZodOptional<z.ZodEnum<{
144
144
  [x: string]: string;
145
- }>>;
145
+ }>>>;
146
146
  proof_kinship: z.ZodOptional<z.ZodObject<{
147
- url: z.ZodOptional<z.ZodURL>;
147
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
148
148
  mime: z.ZodEnum<{
149
149
  "image/jpeg": "image/jpeg";
150
150
  "image/png": "image/png";
@@ -153,7 +153,7 @@ declare const santanderPjSchema: z.ZodObject<{
153
153
  sizeBytes: z.ZodNumber;
154
154
  }, z.core.$strip>>;
155
155
  document_front_upload: z.ZodObject<{
156
- url: z.ZodOptional<z.ZodURL>;
156
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
157
157
  mime: z.ZodEnum<{
158
158
  "image/jpeg": "image/jpeg";
159
159
  "image/png": "image/png";
@@ -162,7 +162,7 @@ declare const santanderPjSchema: z.ZodObject<{
162
162
  sizeBytes: z.ZodNumber;
163
163
  }, z.core.$strip>;
164
164
  document_back_upload: z.ZodObject<{
165
- url: z.ZodOptional<z.ZodURL>;
165
+ url: z.ZodPreprocess<z.ZodOptional<z.ZodURL>>;
166
166
  mime: z.ZodEnum<{
167
167
  "image/jpeg": "image/jpeg";
168
168
  "image/png": "image/png";