@br-validators/cli 0.12.0-alpha.3 → 1.1.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/README.md +2 -0
- package/dist/index.js +20 -3
- package/dist/run-captured.js +20 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -74,6 +74,8 @@ br-validators ie validate P-01100424.3/002 --uf SP # SP produtor rural (auto-d
|
|
|
74
74
|
| `sanitize <type> [value]` | ETL fixes + validate; `--uf` for `inscricao-estadual` |
|
|
75
75
|
| `generate <type>` | Synthetic test document; `--seed`, `--masked`, `--format` |
|
|
76
76
|
|
|
77
|
+
> **Library-only platform APIs:** `mask`, `compare`, `batch`, and `diff` are available via `@br-validators/core` subpaths — no dedicated CLI commands yet.
|
|
78
|
+
|
|
77
79
|
```bash
|
|
78
80
|
br-validators detect '123.456.789-09' --json
|
|
79
81
|
br-validators detect '110042490114' --uf SP --json
|
package/dist/index.js
CHANGED
|
@@ -736,6 +736,12 @@ function resolveInput13(value, fileContent) {
|
|
|
736
736
|
}
|
|
737
737
|
return input;
|
|
738
738
|
}
|
|
739
|
+
function boletoSuccessMeta(result) {
|
|
740
|
+
if (result.format === "arrecadacao") {
|
|
741
|
+
return { segment: result.segment, valueType: result.valueType };
|
|
742
|
+
}
|
|
743
|
+
return { situacao: result.situacao };
|
|
744
|
+
}
|
|
739
745
|
function printBoletoValidation(result, options, io = { stdout: [], stderr: [] }) {
|
|
740
746
|
if (options.json) {
|
|
741
747
|
io.stdout.push(
|
|
@@ -745,7 +751,7 @@ function printBoletoValidation(result, options, io = { stdout: [], stderr: [] })
|
|
|
745
751
|
value: result.value,
|
|
746
752
|
inputKind: result.inputKind,
|
|
747
753
|
format: result.format,
|
|
748
|
-
|
|
754
|
+
...boletoSuccessMeta(result),
|
|
749
755
|
...options.source ? { source: options.source } : {}
|
|
750
756
|
} : {
|
|
751
757
|
ok: false,
|
|
@@ -766,7 +772,12 @@ function printBoletoValidation(result, options, io = { stdout: [], stderr: [] })
|
|
|
766
772
|
io.stdout.push(`valid: yes (${result.inputKind})`);
|
|
767
773
|
io.stdout.push(`value: ${result.value}`);
|
|
768
774
|
io.stdout.push(`format: ${result.format}`);
|
|
769
|
-
|
|
775
|
+
if (result.format === "arrecadacao") {
|
|
776
|
+
io.stdout.push(`segment: ${result.segment}`);
|
|
777
|
+
io.stdout.push(`valueType: ${result.valueType}`);
|
|
778
|
+
} else {
|
|
779
|
+
io.stdout.push(`situacao: ${result.situacao}`);
|
|
780
|
+
}
|
|
770
781
|
if (options.source) {
|
|
771
782
|
io.stdout.push(`source: ${options.source}`);
|
|
772
783
|
}
|
|
@@ -1192,7 +1203,13 @@ var GENERATABLE_TYPES = [
|
|
|
1192
1203
|
"telefone",
|
|
1193
1204
|
"cartao-credito",
|
|
1194
1205
|
"inscricao-estadual",
|
|
1195
|
-
"titulo-eleitor"
|
|
1206
|
+
"titulo-eleitor",
|
|
1207
|
+
"pix",
|
|
1208
|
+
"nfe-chave",
|
|
1209
|
+
"brcode",
|
|
1210
|
+
"boleto",
|
|
1211
|
+
"boleto-arrecadacao",
|
|
1212
|
+
"inscricao-estadual-produtor-rural"
|
|
1196
1213
|
];
|
|
1197
1214
|
function isGeneratableType(type) {
|
|
1198
1215
|
return GENERATABLE_TYPES.includes(type);
|
package/dist/run-captured.js
CHANGED
|
@@ -730,6 +730,12 @@ function resolveInput13(value, fileContent) {
|
|
|
730
730
|
}
|
|
731
731
|
return input;
|
|
732
732
|
}
|
|
733
|
+
function boletoSuccessMeta(result) {
|
|
734
|
+
if (result.format === "arrecadacao") {
|
|
735
|
+
return { segment: result.segment, valueType: result.valueType };
|
|
736
|
+
}
|
|
737
|
+
return { situacao: result.situacao };
|
|
738
|
+
}
|
|
733
739
|
function printBoletoValidation(result, options, io = { stdout: [], stderr: [] }) {
|
|
734
740
|
if (options.json) {
|
|
735
741
|
io.stdout.push(
|
|
@@ -739,7 +745,7 @@ function printBoletoValidation(result, options, io = { stdout: [], stderr: [] })
|
|
|
739
745
|
value: result.value,
|
|
740
746
|
inputKind: result.inputKind,
|
|
741
747
|
format: result.format,
|
|
742
|
-
|
|
748
|
+
...boletoSuccessMeta(result),
|
|
743
749
|
...options.source ? { source: options.source } : {}
|
|
744
750
|
} : {
|
|
745
751
|
ok: false,
|
|
@@ -760,7 +766,12 @@ function printBoletoValidation(result, options, io = { stdout: [], stderr: [] })
|
|
|
760
766
|
io.stdout.push(`valid: yes (${result.inputKind})`);
|
|
761
767
|
io.stdout.push(`value: ${result.value}`);
|
|
762
768
|
io.stdout.push(`format: ${result.format}`);
|
|
763
|
-
|
|
769
|
+
if (result.format === "arrecadacao") {
|
|
770
|
+
io.stdout.push(`segment: ${result.segment}`);
|
|
771
|
+
io.stdout.push(`valueType: ${result.valueType}`);
|
|
772
|
+
} else {
|
|
773
|
+
io.stdout.push(`situacao: ${result.situacao}`);
|
|
774
|
+
}
|
|
764
775
|
if (options.source) {
|
|
765
776
|
io.stdout.push(`source: ${options.source}`);
|
|
766
777
|
}
|
|
@@ -1186,7 +1197,13 @@ var GENERATABLE_TYPES = [
|
|
|
1186
1197
|
"telefone",
|
|
1187
1198
|
"cartao-credito",
|
|
1188
1199
|
"inscricao-estadual",
|
|
1189
|
-
"titulo-eleitor"
|
|
1200
|
+
"titulo-eleitor",
|
|
1201
|
+
"pix",
|
|
1202
|
+
"nfe-chave",
|
|
1203
|
+
"brcode",
|
|
1204
|
+
"boleto",
|
|
1205
|
+
"boleto-arrecadacao",
|
|
1206
|
+
"inscricao-estadual-produtor-rural"
|
|
1190
1207
|
];
|
|
1191
1208
|
function isGeneratableType(type) {
|
|
1192
1209
|
return GENERATABLE_TYPES.includes(type);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@br-validators/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "CLI for @br-validators/core — CPF, CNPJ, NF-e, IE, PIX, boleto + detect/sanitize/generate",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"commander": "^13.1.0",
|
|
48
|
-
"@br-validators/core": "
|
|
48
|
+
"@br-validators/core": "1.1.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^22.15.21",
|