Skip to content

ESI Metadata ​

No token needed Runs nightly against live ESI

Reads ESI's own metadata: the API name, the compatibility dates it accepts, the latest changelog entries, and the health of each route.

No authentication required.

Calls: meta.getName · meta.getCompatibilityDates · meta.getOpenApiYaml · meta.getChangelog · meta.getStatus

Run it ​

bash
git clone https://github.com/lgriffin/ESI.ts.git && cd ESI.ts
npm ci
npm run example:meta

examples/meta.ts on GitHub. The imports below are written as a consumer of the package writes them; the file in the repository imports from ../src.

Source ​

ts
import { EsiClient } from '@lgriffin/esi.ts';
import { createConsoleLogger } from '@lgriffin/esi.ts';

// The program's own output. The client logs through the same console sink
// at ESI_LOG_LEVEL (default warn), so its diagnostics stay out of the way.
const log = createConsoleLogger('info');
const esiLog = createConsoleLogger();

async function main() {
  const client = new EsiClient({ logger: esiLog });

  try {
    const { current, history } = await client.meta.getName();
    log.info(`API: ${current} (${history.length} earlier names)`);

    const { compatibility_dates: dates } =
      await client.meta.getCompatibilityDates();
    log.info(
      `Compatibility dates: ${dates.length}, newest ${[...dates].sort().at(-1) ?? 'none'}`,
    );

    const yaml = await client.meta.getOpenApiYaml();
    const [, yamlVersion] = /^openapi: *['"]?([^'"\s]+)/m.exec(yaml) ?? [];
    log.info(
      `OpenAPI YAML: ${yaml.length} characters, openapi ${yamlVersion ?? 'unknown'}`,
    );

    const { changelog } = await client.meta.getChangelog();
    const [latestDate] = Object.keys(changelog).sort().reverse();
    const latest = latestDate ? (changelog[latestDate] ?? []) : [];
    log.info(`\nChangelog for ${latestDate ?? 'no date'}:`);
    for (const entry of latest.slice(0, 5)) {
      log.info(
        `  ${entry.method} ${entry.path} (${entry.type}): ${entry.description}`,
      );
    }

    const { routes } = await client.meta.getStatus();
    const unhealthy = routes.filter((route) => route.status !== 'OK');
    log.info(
      `\nRoute health: ${routes.length - unhealthy.length} of ${routes.length} OK`,
    );
    for (const route of unhealthy.slice(0, 10)) {
      log.info(`  ${route.status}: ${route.method} ${route.path}`);
    }
  } catch (err) {
    log.error('Request failed', { error: err });
    process.exit(1);
  } finally {
    await client.shutdown();
  }
}

main();

Released under the GPL-3.0-or-later license.