latinfo 0.7.0 → 0.8.1
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/dist/index.js +73 -9
- package/dist/sdk.d.ts +88 -11
- package/package.json +8 -3
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
10
10
|
const os_1 = __importDefault(require("os"));
|
|
11
11
|
const child_process_1 = require("child_process");
|
|
12
12
|
const demo_data_1 = require("./demo-data");
|
|
13
|
-
const VERSION = '0.
|
|
13
|
+
const VERSION = '0.8.1';
|
|
14
14
|
const API_URL = process.env.LATINFO_API_URL || 'https://api.latinfo.dev';
|
|
15
15
|
const GITHUB_CLIENT_ID = process.env.GITHUB_CLIENT_ID || 'Ov23li5fcQaiCsVtaMKK';
|
|
16
16
|
const CONFIG_DIR = path_1.default.join(os_1.default.homedir(), '.latinfo');
|
|
@@ -495,16 +495,31 @@ DATA
|
|
|
495
495
|
return;
|
|
496
496
|
}
|
|
497
497
|
for (const r of results) {
|
|
498
|
-
const
|
|
498
|
+
const tender = r.tender || {};
|
|
499
|
+
const monto = tender.value?.amount ?? 0;
|
|
499
500
|
const montoFmt = monto > 0 ? `S/ ${monto.toLocaleString('es-PE', { minimumFractionDigits: 2 })}` : 'N/A';
|
|
500
|
-
const fecha = r.
|
|
501
|
-
const
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
501
|
+
const fecha = (tender.datePublished || r.date || '').split('T')[0];
|
|
502
|
+
const cierre = tender.tenderPeriod?.endDate?.split('T')[0] || '';
|
|
503
|
+
const desc = (tender.description || '');
|
|
504
|
+
const descFmt = desc.length > 100 ? desc.substring(0, 100) + '...' : desc;
|
|
505
|
+
const cat = tender.mainProcurementCategory || '';
|
|
506
|
+
const status = tender.items?.[0]?.statusDetails || '';
|
|
507
|
+
const method = tender.procurementMethodDetails || '';
|
|
508
|
+
console.log(` ${fecha} ${montoFmt} [${cat}] [${status}]`);
|
|
509
|
+
if (cierre)
|
|
510
|
+
console.log(` Cierre: ${cierre}`);
|
|
511
|
+
console.log(` ${descFmt}`);
|
|
512
|
+
console.log(` Buyer: ${r.buyer?.name || 'N/A'}`);
|
|
513
|
+
// Show documents (bases)
|
|
514
|
+
const docs = tender.documents || [];
|
|
515
|
+
if (docs.length > 0) {
|
|
516
|
+
const bases = docs.find((d) => d.title?.toLowerCase().includes('bases'));
|
|
517
|
+
if (bases)
|
|
518
|
+
console.log(` Bases: ${bases.url}`);
|
|
519
|
+
}
|
|
505
520
|
if (r.url)
|
|
506
521
|
console.log(` ${r.url}`);
|
|
507
|
-
console.log(` ${
|
|
522
|
+
console.log(` ${method} — ${r.ocid}`);
|
|
508
523
|
console.log();
|
|
509
524
|
}
|
|
510
525
|
console.log(`${results.length} result(s)`);
|
|
@@ -607,6 +622,53 @@ EXIT CODES
|
|
|
607
622
|
0 Success
|
|
608
623
|
1 Error`);
|
|
609
624
|
}
|
|
625
|
+
function printLogo() {
|
|
626
|
+
if (!process.stdout.isTTY)
|
|
627
|
+
return;
|
|
628
|
+
const O = '\x1b[38;5;208m';
|
|
629
|
+
const o = '\x1b[38;5;216m';
|
|
630
|
+
const W = '\x1b[37m';
|
|
631
|
+
const G = '\x1b[90m';
|
|
632
|
+
const R = '\x1b[0m';
|
|
633
|
+
const lines = [
|
|
634
|
+
' aaaaa xx \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 ',
|
|
635
|
+
'bbaaa yy \u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2591 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 ',
|
|
636
|
+
' baaa \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2591\u2591 \u2588\u2588\u2588\u2588\u2588\u2588 ',
|
|
637
|
+
' baaa \u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2591\u2588\u2588\u2588\u2591 \u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588',
|
|
638
|
+
' baaa \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2591\u2591\u2588\u2588\u2588\u2591 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588',
|
|
639
|
+
' baaa a \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588',
|
|
640
|
+
' aaaaaaaaaaa\u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588 ',
|
|
641
|
+
'bbbbbbbbbbb \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591 ',
|
|
642
|
+
];
|
|
643
|
+
for (const line of lines) {
|
|
644
|
+
let out = '';
|
|
645
|
+
for (const ch of line) {
|
|
646
|
+
switch (ch) {
|
|
647
|
+
case 'a':
|
|
648
|
+
out += O + '\u2588';
|
|
649
|
+
break;
|
|
650
|
+
case 'x':
|
|
651
|
+
out += o + '\u2588';
|
|
652
|
+
break;
|
|
653
|
+
case 'b':
|
|
654
|
+
out += o + '\u2591';
|
|
655
|
+
break;
|
|
656
|
+
case 'y':
|
|
657
|
+
out += o + '\u2591';
|
|
658
|
+
break;
|
|
659
|
+
case '\u2588':
|
|
660
|
+
out += W + '\u2588';
|
|
661
|
+
break;
|
|
662
|
+
case '\u2591':
|
|
663
|
+
out += G + '\u2591';
|
|
664
|
+
break;
|
|
665
|
+
default: out += R + ch;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
console.log(out + R);
|
|
669
|
+
}
|
|
670
|
+
console.log();
|
|
671
|
+
}
|
|
610
672
|
function version() {
|
|
611
673
|
console.log(`latinfo/${VERSION}`);
|
|
612
674
|
}
|
|
@@ -686,6 +748,8 @@ else {
|
|
|
686
748
|
case 'help':
|
|
687
749
|
help();
|
|
688
750
|
break;
|
|
689
|
-
default:
|
|
751
|
+
default:
|
|
752
|
+
printLogo();
|
|
753
|
+
help();
|
|
690
754
|
}
|
|
691
755
|
}
|
package/dist/sdk.d.ts
CHANGED
|
@@ -15,20 +15,97 @@ export interface PeRecord {
|
|
|
15
15
|
manzana: string;
|
|
16
16
|
kilometro: string;
|
|
17
17
|
}
|
|
18
|
+
/** Full OCDS 1.1 compiledRelease + url field added by Latinfo. */
|
|
18
19
|
export interface PeLicitacion {
|
|
19
20
|
ocid: string;
|
|
20
|
-
titulo: string;
|
|
21
|
-
descripcion: string;
|
|
22
|
-
monto: string;
|
|
23
|
-
moneda: string;
|
|
24
|
-
categoria: string;
|
|
25
|
-
metodo: string;
|
|
26
|
-
buyer_nombre: string;
|
|
27
|
-
buyer_id: string;
|
|
28
|
-
fecha: string;
|
|
29
|
-
estado: string;
|
|
30
|
-
unspsc: string;
|
|
31
21
|
url: string;
|
|
22
|
+
date?: string;
|
|
23
|
+
tender: {
|
|
24
|
+
title?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
datePublished?: string;
|
|
27
|
+
value?: {
|
|
28
|
+
amount?: number;
|
|
29
|
+
currency?: string;
|
|
30
|
+
};
|
|
31
|
+
mainProcurementCategory?: string;
|
|
32
|
+
procurementMethodDetails?: string;
|
|
33
|
+
tenderPeriod?: {
|
|
34
|
+
startDate?: string;
|
|
35
|
+
endDate?: string;
|
|
36
|
+
};
|
|
37
|
+
enquiryPeriod?: {
|
|
38
|
+
startDate?: string;
|
|
39
|
+
endDate?: string;
|
|
40
|
+
durationInDays?: number;
|
|
41
|
+
};
|
|
42
|
+
items?: Array<{
|
|
43
|
+
description?: string;
|
|
44
|
+
quantity?: number;
|
|
45
|
+
unit?: {
|
|
46
|
+
name?: string;
|
|
47
|
+
};
|
|
48
|
+
statusDetails?: string;
|
|
49
|
+
additionalClassifications?: Array<{
|
|
50
|
+
scheme?: string;
|
|
51
|
+
id?: string;
|
|
52
|
+
}>;
|
|
53
|
+
}>;
|
|
54
|
+
documents?: Array<{
|
|
55
|
+
title?: string;
|
|
56
|
+
url?: string;
|
|
57
|
+
format?: string;
|
|
58
|
+
}>;
|
|
59
|
+
tenderers?: Array<{
|
|
60
|
+
name?: string;
|
|
61
|
+
id?: string;
|
|
62
|
+
}>;
|
|
63
|
+
numberOfTenderers?: number;
|
|
64
|
+
};
|
|
65
|
+
buyer?: {
|
|
66
|
+
name?: string;
|
|
67
|
+
id?: string;
|
|
68
|
+
};
|
|
69
|
+
parties?: Array<{
|
|
70
|
+
name?: string;
|
|
71
|
+
roles?: string[];
|
|
72
|
+
address?: {
|
|
73
|
+
region?: string;
|
|
74
|
+
locality?: string;
|
|
75
|
+
};
|
|
76
|
+
}>;
|
|
77
|
+
awards?: Array<{
|
|
78
|
+
status?: string;
|
|
79
|
+
value?: {
|
|
80
|
+
amount?: number;
|
|
81
|
+
currency?: string;
|
|
82
|
+
};
|
|
83
|
+
suppliers?: Array<{
|
|
84
|
+
name?: string;
|
|
85
|
+
id?: string;
|
|
86
|
+
}>;
|
|
87
|
+
date?: string;
|
|
88
|
+
}>;
|
|
89
|
+
contracts?: Array<{
|
|
90
|
+
status?: string;
|
|
91
|
+
value?: {
|
|
92
|
+
amount?: number;
|
|
93
|
+
};
|
|
94
|
+
period?: {
|
|
95
|
+
startDate?: string;
|
|
96
|
+
endDate?: string;
|
|
97
|
+
durationInDays?: number;
|
|
98
|
+
};
|
|
99
|
+
}>;
|
|
100
|
+
planning?: {
|
|
101
|
+
budget?: {
|
|
102
|
+
amount?: {
|
|
103
|
+
amount?: number;
|
|
104
|
+
currency?: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
[key: string]: any;
|
|
32
109
|
}
|
|
33
110
|
export interface LicitacionesQuery {
|
|
34
111
|
q?: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "latinfo",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Tax registry API for Latin America. Query RUC, DNI,
|
|
3
|
+
"version": "0.8.1",
|
|
4
|
+
"description": "Tax registry & procurement API for Latin America. Query RUC, DNI, licitaciones (OECE/SEACE) from Peru. Full OCDS data, updated daily.",
|
|
5
5
|
"homepage": "https://latinfo.dev",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,7 +21,12 @@
|
|
|
21
21
|
"api",
|
|
22
22
|
"latin-america",
|
|
23
23
|
"latam",
|
|
24
|
-
"json"
|
|
24
|
+
"json",
|
|
25
|
+
"licitaciones",
|
|
26
|
+
"oece",
|
|
27
|
+
"seace",
|
|
28
|
+
"ocds",
|
|
29
|
+
"procurement"
|
|
25
30
|
],
|
|
26
31
|
"main": "dist/sdk.js",
|
|
27
32
|
"types": "dist/sdk.d.ts",
|