- restructure from src/ + server/ to src/client/ + src/server/ + src/shared/ - switch backend runtime from Node (tsx) to Bun - merge server/package.json into root, remove @hono/node-server + tsx - convert server @/ imports to relative paths - standardize biome config (lineWidth 80, quoteStyle double) - add CLAUDE.md, .env.example at root - update vite.config, tsconfig, deploy.sh for new structure Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
29 lines
696 B
TypeScript
29 lines
696 B
TypeScript
import type { PGlite } from "@electric-sql/pglite"
|
|
|
|
export async function getPushState(
|
|
db: PGlite,
|
|
key: string,
|
|
): Promise<string | null> {
|
|
const res = await db.query<{ value: string }>(
|
|
"SELECT value FROM push_state WHERE key = $1",
|
|
[key],
|
|
)
|
|
return res.rows.length > 0 ? res.rows[0].value : null
|
|
}
|
|
|
|
export async function setPushState(
|
|
db: PGlite,
|
|
key: string,
|
|
value: string,
|
|
): Promise<void> {
|
|
await db.query(
|
|
`INSERT INTO push_state (key, value) VALUES ($1, $2)
|
|
ON CONFLICT (key) DO UPDATE SET value = $2`,
|
|
[key, value],
|
|
)
|
|
}
|
|
|
|
export async function removePushState(db: PGlite, key: string): Promise<void> {
|
|
await db.query("DELETE FROM push_state WHERE key = $1", [key])
|
|
}
|