// Builds src/data/sdn-lite.js (shipped in the npm package) from src/data/sdn.js (Worker only).
// The lite snapshot keeps only lookup keys and per-address match counts: enough for the free-preview verdict
// (sanctioned true/false, match count, chain guess) offline, without SDN entity names, uids, programs or dates.
import { writeFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { SDN } from '../src/data/sdn.js';
const out = fileURLToPath(new URL('../src/data/sdn-lite.js', import.meta.url));
const addresses = Object.fromEntries(Object.keys(SDN.addresses).sort().map((k) => [k, SDN.addresses[k].length]));
const lite = {
source: SDN.source, source_url: SDN.source_url, publish_date: SDN.publish_date, generated_at: SDN.generated_at,
address_count: SDN.address_count, by_currency: SDN.by_currency, tier: 'preview', addresses,
};
writeFileSync(out, `// GENERATED by scripts/build-lite.mjs from src/data/sdn.js. Do not edit by hand.\n// Preview tier: lookup keys and match counts only (no entity, program or date details; those are the paid API).\nexport const SDN_LITE = ${JSON.stringify(lite)};\n`);
console.log(`sdn-lite.js: ${Object.keys(addresses).length} keys, list ${SDN.publish_date}`);
agentgate-source: code mirror on Cloudflare Pages. All repos