latinfo 0.13.1 → 0.13.5

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 (2) hide show
  1. package/dist/index.js +27 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -47,7 +47,7 @@ const local_search_1 = require("./local-search");
47
47
  const client_search_1 = require("./client-search");
48
48
  const odis_search_1 = require("./odis-search");
49
49
  const mphf_search_1 = require("./mphf-search");
50
- const VERSION = '0.13.1';
50
+ const VERSION = '0.13.5';
51
51
  const API_URL = process.env.LATINFO_API_URL || 'https://api.latinfo.dev';
52
52
  const GITHUB_CLIENT_ID = process.env.GITHUB_CLIENT_ID || 'Ov23li5fcQaiCsVtaMKK';
53
53
  const CONFIG_DIR = path_1.default.join(os_1.default.homedir(), '.latinfo');
@@ -1899,7 +1899,7 @@ async function pipeStage(args) {
1899
1899
  const remoteRepo = '~/actions-runner/_work/latinfo-api/latinfo-api';
1900
1900
  console.log('[pipe] Syncing files to Linux Mint...');
1901
1901
  try {
1902
- run(`ssh ${RUNNER} "echo OK"`, { stdio: 'pipe', timeout: 10_000 });
1902
+ run(`ssh -o ConnectTimeout=10 ${RUNNER} "echo OK"`, { stdio: 'pipe' });
1903
1903
  // Copy import script and YAML
1904
1904
  const scriptFile = path_1.default.join(repo, 'src', 'imports', `${sourceName}.ts`);
1905
1905
  const yamlFile = path_1.default.join(repo, 'sources', `${sourceName}.yaml`);
@@ -1923,11 +1923,33 @@ async function pipeStage(args) {
1923
1923
  run(`scp ${devVarsLocal} ${RUNNER}:${remoteRepo}/.dev.vars`, { stdio: 'pipe' });
1924
1924
  }
1925
1925
  catch { }
1926
- // 3. Run import on Linux Mint
1926
+ // 3. Install deps on Linux Mint from YAML
1927
+ const yamlPath = path_1.default.join(repo, 'sources', `${sourceName}.yaml`);
1928
+ const yamlContent = fs_1.default.existsSync(yamlPath) ? fs_1.default.readFileSync(yamlPath, 'utf-8') : '';
1929
+ const depsMatch = yamlContent.match(/dependencies:\n([\s\S]*?)(?=\n\w|\n$|$)/);
1930
+ if (depsMatch) {
1931
+ const deps = depsMatch[1].split('\n').map(l => l.replace(/^\s*-\s*/, '').trim()).filter(Boolean);
1932
+ if (deps.length > 0) {
1933
+ console.log(`[pipe] Installing deps on Linux Mint: ${deps.join(', ')}...`);
1934
+ try {
1935
+ run(`ssh ${RUNNER} "cd ${remoteRepo} && npm install ${deps.join(' ')}"`, { stdio: 'inherit' });
1936
+ // Install playwright browsers if needed
1937
+ if (deps.some(d => d.includes('playwright'))) {
1938
+ console.log(`[pipe] Installing Playwright browser (this may take a few minutes)...`);
1939
+ run(`ssh ${RUNNER} "cd ${remoteRepo} && npx playwright install chromium --with-deps"`, { stdio: 'inherit' });
1940
+ }
1941
+ }
1942
+ catch {
1943
+ console.error('[pipe] Failed to install deps on Linux Mint');
1944
+ process.exit(1);
1945
+ }
1946
+ }
1947
+ }
1948
+ // 4. Run import on Linux Mint
1927
1949
  console.log(`[pipe] Running import on Linux Mint...`);
1928
1950
  try {
1929
1951
  run(`ssh ${RUNNER} "cd ${remoteRepo} && set -a && source .env 2>/dev/null; source .dev.vars 2>/dev/null; set +a && R2_BUCKET_NAME=latinfo-data npx tsx src/imports/${sourceName}.ts"`, {
1930
- stdio: 'inherit', timeout: 600_000,
1952
+ stdio: 'inherit',
1931
1953
  });
1932
1954
  }
1933
1955
  catch {
@@ -1955,7 +1977,7 @@ Promise.all(Array.from({length:CONC},()=>go())).then(()=>{
1955
1977
  lats.sort((a,b)=>a-b);
1956
1978
  console.log(JSON.stringify({total_ms:Date.now()-t0,success,fails,qps:Math.round(TOTAL/((Date.now()-t0)/1000)),
1957
1979
  p50:lats[Math.floor(lats.length*0.5)],p95:lats[Math.floor(lats.length*0.95)],p99:lats[Math.floor(lats.length*0.99)]}));
1958
- });\\"" `, { encoding: 'utf-8', stdio: 'pipe', timeout: 60_000 });
1980
+ });\\"" `, { encoding: 'utf-8', stdio: 'pipe' });
1959
1981
  const bench = JSON.parse(benchOutput.trim());
1960
1982
  const successRate = ((bench.success) / 500 * 100);
1961
1983
  console.log(`\n 500 concurrent: ${bench.qps} q/s, ${successRate.toFixed(1)}% success`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "latinfo",
3
- "version": "0.13.1",
3
+ "version": "0.13.5",
4
4
  "description": "Tax registry & procurement API for Latin America. Query RUC, DNI, NIT, licitaciones from Peru & Colombia. Offline MPHF search, full OCDS data, updated daily.",
5
5
  "homepage": "https://latinfo.dev",
6
6
  "repository": {