Skip to content

Commit 011e4ce

Browse files
cuibonoboclaude
andauthored
feat: Migrate from adapter-sqlite to adapter-local (#29)
Replace @haverstack/adapter-sqlite with @haverstack/adapter-local (SQLiteRecordAdapter + DiskBlobAdapter composed) and bump @haverstack/core and @haverstack/wire-types to ^0.6.0. SQLiteAdapter → LocalAdapter across src/stack.ts, src/routes/tokens.ts, and tests/setup.ts. Claude-Session: https://claude.ai/code/session_01U87aE3x7uo3CJft1NxYvUb Co-authored-by: Claude <noreply@anthropic.com>
1 parent 09dac5e commit 011e4ce

5 files changed

Lines changed: 46 additions & 30 deletions

File tree

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"format:check": "prettier --check ."
1818
},
1919
"dependencies": {
20-
"@haverstack/adapter-sqlite": "^0.5.0",
21-
"@haverstack/core": "^0.5.0",
22-
"@haverstack/wire-types": "^0.5.0",
20+
"@haverstack/adapter-local": "^0.6.0",
21+
"@haverstack/core": "^0.6.0",
22+
"@haverstack/wire-types": "^0.6.0",
2323
"@hono/node-server": "^1.13.7",
2424
"hono": "^4.6.0",
2525
"pino": "^9.5.0",

pnpm-lock.yaml

Lines changed: 35 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/routes/tokens.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { AppEnv } from '../types.js';
33
import type { StackContext } from '../stack.js';
44
import { requireOwner } from '../middleware/auth.js';
55
import { parseDate } from '@haverstack/wire-types';
6-
import type { TokenInfo } from '@haverstack/adapter-sqlite';
6+
import type { TokenInfo } from '@haverstack/adapter-local';
77

88
export function tokenRoutes(ctx: StackContext): Hono<AppEnv> {
99
const app = new Hono<AppEnv>();

src/stack.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
import { SQLiteAdapter } from '@haverstack/adapter-sqlite';
1+
import { LocalAdapter } from '@haverstack/adapter-local';
22
import { Stack } from '@haverstack/core';
33
import type { Config } from './config.js';
44

55
export type StackContext = {
6-
adapter: SQLiteAdapter;
6+
adapter: LocalAdapter;
77
stack: Stack;
88
};
99

1010
export async function initStack(config: Config): Promise<StackContext> {
11-
let adapter: SQLiteAdapter;
11+
let adapter: LocalAdapter;
1212

1313
if (config.isNewDb) {
14-
adapter = await SQLiteAdapter.initialize({
14+
adapter = await LocalAdapter.initialize({
1515
path: config.dbPath,
1616
entityId: config.entityId!,
1717
timezone: config.timezone,
1818
});
1919
} else {
20-
adapter = await SQLiteAdapter.open({ path: config.dbPath });
20+
adapter = await LocalAdapter.open({ path: config.dbPath });
2121
}
2222

2323
const stack = await Stack.create(adapter);

tests/setup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { join, dirname } from 'node:path';
33
import { randomBytes } from 'node:crypto';
44
import { rm } from 'node:fs/promises';
55
import { mkdirSync } from 'node:fs';
6-
import { SQLiteAdapter } from '@haverstack/adapter-sqlite';
6+
import { LocalAdapter } from '@haverstack/adapter-local';
77
import { Stack } from '@haverstack/core';
88
import pino from 'pino';
99
import { createApp } from '../src/app.js';
@@ -29,7 +29,7 @@ export function tempDbPath(): string {
2929
}
3030

3131
export async function createTestContext(dbPath: string): Promise<StackContext> {
32-
const adapter = await SQLiteAdapter.initialize({
32+
const adapter = await LocalAdapter.initialize({
3333
path: dbPath,
3434
entityId: TEST_ENTITY_ID,
3535
timezone: 'UTC',

0 commit comments

Comments
 (0)