Skip to content

Commit 37016be

Browse files
Copilothotlong
andcommitted
fix(apps/demo): add @libsql/client transitive deps to vercel.json includeFiles and package.json; fix TURSO_SYNC_INTERVAL parsing, remove as any casts, fix README diagram
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Agent-Logs-Url: https://github.com/objectstack-ai/objectql/sessions/b2684b8f-f82b-4586-af12-a917a8f44471
1 parent d2c37c5 commit 37016be

File tree

6 files changed

+53
-11
lines changed

6 files changed

+53
-11
lines changed

apps/demo/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,5 @@ apps/demo/
115115
116116
ObjectStack Kernel
117117
(ObjectQL + Auth +
118-
TursoDriver)
118+
TursoDriver / InMemoryDriver)
119119
```

apps/demo/api/[[...route]].ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,20 +288,26 @@ async function bootstrap(): Promise<Hono> {
288288
if (tursoUrl) {
289289
log(`Registering TursoDriver (${tursoUrl})…`);
290290
const syncUrl = process.env.TURSO_SYNC_URL;
291+
const rawSyncInterval = process.env.TURSO_SYNC_INTERVAL;
292+
const parsedSyncInterval =
293+
rawSyncInterval !== undefined ? Number(rawSyncInterval) : NaN;
294+
const syncIntervalSeconds = Number.isFinite(parsedSyncInterval)
295+
? parsedSyncInterval
296+
: 60;
291297
tursoDriver = createTursoDriver({
292298
url: tursoUrl,
293299
authToken: process.env.TURSO_AUTH_TOKEN,
294300
syncUrl,
295301
sync: syncUrl
296302
? {
297-
intervalSeconds: Number(process.env.TURSO_SYNC_INTERVAL) || 60,
303+
intervalSeconds: syncIntervalSeconds,
298304
onConnect: true,
299305
}
300306
: undefined,
301307
});
302-
// DriverPlugin from @objectstack/runtime expects the upstream Driver interface;
303-
// TursoDriver implements @objectql/types Driver which is structurally compatible.
304-
await withTimeout(kernel.use(new DriverPlugin(tursoDriver as any, 'turso')), PLUGIN_TIMEOUT_MS, 'DriverPlugin-turso');
308+
// DriverPlugin from @objectstack/runtime accepts any driver; TursoDriver
309+
// implements @objectql/types Driver which is structurally compatible.
310+
await withTimeout(kernel.use(new DriverPlugin(tursoDriver, 'turso')), PLUGIN_TIMEOUT_MS, 'DriverPlugin-turso');
305311
log('TursoDriver registered.');
306312
} else {
307313
log('Registering DriverPlugin (InMemoryDriver)…');

apps/demo/objectstack.config.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,19 @@ function createDefaultDriver() {
4040
if (tursoUrl) {
4141
console.log(`🗄️ Driver: Turso (${tursoUrl})`);
4242
const syncUrl = process.env.TURSO_SYNC_URL;
43+
const rawSyncInterval = process.env.TURSO_SYNC_INTERVAL;
44+
const parsedSyncInterval =
45+
rawSyncInterval !== undefined ? Number(rawSyncInterval) : NaN;
46+
const syncIntervalSeconds = Number.isFinite(parsedSyncInterval)
47+
? parsedSyncInterval
48+
: 60;
4349
return createTursoDriver({
4450
url: tursoUrl,
4551
authToken: process.env.TURSO_AUTH_TOKEN,
4652
syncUrl,
4753
sync: syncUrl
4854
? {
49-
intervalSeconds: Number(process.env.TURSO_SYNC_INTERVAL) || 60,
55+
intervalSeconds: syncIntervalSeconds,
5056
onConnect: true,
5157
}
5258
: undefined,
@@ -83,10 +89,8 @@ export default {
8389
ctx.registerService('driver.default', defaultDriver);
8490
},
8591
start: async () => {
86-
// Connect Turso driver if applicable (MemoryDriver.connect() is a no-op)
87-
if (typeof (defaultDriver as any).connect === 'function') {
88-
await (defaultDriver as { connect: () => Promise<void> }).connect();
89-
}
92+
// Both MemoryDriver and TursoDriver implement connect()
93+
await defaultDriver.connect?.();
9094
},
9195
},
9296
projectTrackerPlugin,

apps/demo/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
"devDependencies": {
1414
"@hono/node-server": "^1.19.11",
1515
"@libsql/client": "^0.17.2",
16+
"@libsql/core": "^0.17.2",
17+
"@libsql/hrana-client": "^0.9.0",
18+
"@libsql/isomorphic-ws": "^0.1.5",
19+
"@neon-rs/load": "^0.0.4",
1620
"@object-ui/console": "^3.1.3",
1721
"@objectql/core": "workspace:*",
1822
"@objectql/driver-memory": "workspace:*",
@@ -37,8 +41,12 @@
3741
"@objectstack/runtime": "^3.2.8",
3842
"@objectstack/studio": "^3.2.8",
3943
"@types/node": "^20.19.37",
44+
"detect-libc": "^2.0.2",
4045
"hono": "^4.12.8",
46+
"js-base64": "^3.7.8",
47+
"libsql": "^0.5.28",
4148
"nanoid": "^3.3.11",
49+
"promise-limit": "^2.7.0",
4250
"typescript": "^5.9.3",
4351
"zod": "^4.3.6"
4452
},

apps/demo/vercel.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"api/**/*.ts": {
88
"memory": 1024,
99
"maxDuration": 60,
10-
"includeFiles": "{node_modules/@object-ui/console/dist,node_modules/@objectstack/plugin-auth/dist,node_modules/@objectstack/studio/dist,node_modules/@objectql/example-project-tracker/dist}/**"
10+
"includeFiles": "{node_modules/@object-ui/console/dist,node_modules/@objectstack/plugin-auth/dist,node_modules/@objectstack/studio/dist,node_modules/@objectql/example-project-tracker/dist,node_modules/@objectql/driver-turso/dist,node_modules/@libsql,node_modules/libsql,node_modules/@neon-rs,node_modules/detect-libc,node_modules/js-base64,node_modules/promise-limit,node_modules/nanoid}/**"
1111
}
1212
},
1313
"rewrites": [

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)