Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

739 B
Raw Blame
/**
 * Fixture for `db-call-graph.mjs --sync --tx --root scripts/__fixtures__`: one class that
 * still touches the database synchronously and opens a raw transaction, so the two gates
 * CI runs (`--sync`, `--tx`) each have a known-bad case to report. `unawaited-sample.ts`
 * beside it is clean under both flags.
 */

interface RawDb {
  get(sql: string, ...args: unknown[]): unknown;
  transaction<T>(fn: () => T): T;
}

export class SyncSample {
  private db: RawDb = { get: () => undefined, transaction: (fn) => fn() };

  readSync(id: number): unknown {
    return this.db.get('SELECT 1 WHERE id = ?', id); // sync DB-touching method
  }

  writeInTx(): void {
    this.db.transaction(() => undefined); // raw transaction site
  }
}