/**
 * DB factory for zync-public-api — maps HYPERDRIVE binding to the @zync/db pattern.
 * tenant-public-api (wave-11 leaf-D)
 *
 * @zync/db's createDb expects env.DB (a Hyperdrive binding).
 * This worker uses env.HYPERDRIVE. We cast so the types align.
 */
import { createDb as _createDb } from '@zync/db'
import type { Env } from './env'

export function createDb(env: Env) {
  // HYPERDRIVE satisfies the same Hyperdrive interface as DB
  return _createDb({ DB: env.HYPERDRIVE } as Parameters<typeof _createDb>[0])
}

export type { Db } from '@zync/db'
