Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ─── Auth ──────────────────────────────────────────────────────────────────
AUTH_SECRET=objectql-dev-secret-change-me-in-production

# ─── Turso / libSQL Driver ────────────────────────────────────────────────
# Uncomment and set these to use Turso driver instead of MemoryDriver.
#
# Connection modes:
# Remote (Cloud): TURSO_DATABASE_URL=libsql://my-db-orgname.turso.io
# Local (Embedded file): TURSO_DATABASE_URL=file:./data/local.db
# In-memory: TURSO_DATABASE_URL=:memory:
#
# TURSO_DATABASE_URL=file:./data/local.db
# TURSO_AUTH_TOKEN=
#
# Embedded Replica (Hybrid) — sync a local file with a remote primary:
# TURSO_SYNC_URL=libsql://my-db-orgname.turso.io
# TURSO_SYNC_INTERVAL=60
1 change: 1 addition & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ ObjectQL is the **Standard Protocol for AI Software Generation** — a universal
- ✅ `@objectql/driver-turso` — Phase B: Multi-Tenant Router, Schema Diff Engine, Platform API Client, Driver Plugin (52 new tests, 177 total)
- ✅ Fix test quality: replaced all `expect(true).toBe(true)` placeholder assertions with meaningful state checks across `plugin-optimizations`, `protocol-odata-v4`, `protocol-json-rpc`, and `protocol-graphql` (7 files, 10 assertions fixed)
- ✅ Plugin-based metadata auto-loading: `createAppPlugin()` factory in `@objectql/platform-node` replaces manual `loadObjects()`. Metadata registered as `app.*` services for upstream ObjectQLPlugin auto-discovery. Added `MetadataRegistry.listEntries()` and 8 new tests.
- ✅ `pnpm dev` supports Turso/libSQL driver via `TURSO_DATABASE_URL` env var (local embedded, remote cloud, or embedded replica modes)

---

Expand Down
37 changes: 33 additions & 4 deletions objectstack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,35 @@ import { ValidatorPlugin } from '@objectql/plugin-validator';
import { FormulaPlugin } from '@objectql/plugin-formula';
import { createApiRegistryPlugin } from '@objectstack/core';
import { MemoryDriver } from '@objectql/driver-memory';
import { createTursoDriver } from '@objectql/driver-turso';
import { createAppPlugin } from '@objectql/platform-node';

// Choose driver based on environment — Turso when TURSO_DATABASE_URL is set,
// MemoryDriver otherwise (zero-config fallback for quick starts).
function createDefaultDriver() {
const tursoUrl = process.env.TURSO_DATABASE_URL;
if (tursoUrl) {
console.log(`🗄️ Driver: Turso (${tursoUrl})`);
const syncUrl = process.env.TURSO_SYNC_URL;
return createTursoDriver({
url: tursoUrl,
authToken: process.env.TURSO_AUTH_TOKEN,
syncUrl,
sync: syncUrl
? {
intervalSeconds: Number(process.env.TURSO_SYNC_INTERVAL) || 60,
onConnect: true,
}
: undefined,
});
}
console.log('🗄️ Driver: Memory (in-memory, non-persistent)');
return new MemoryDriver();
}

// Shared driver instance — registered as 'driver.default' service for
// upstream ObjectQLPlugin discovery and passed to QueryPlugin for query execution.
const defaultDriver = new MemoryDriver();
const defaultDriver = createDefaultDriver();

// App plugins: each business module is loaded via createAppPlugin.
// ObjectLoader recursively scans for *.object.yml, *.view.yml, *.permission.yml, etc.
Expand All @@ -59,14 +83,19 @@ export default {
createApiRegistryPlugin(),
new HonoServerPlugin({}),
new ConsolePlugin(),
// Register MemoryDriver as 'driver.default' service so upstream
// Register the active driver as 'driver.default' service so upstream
// ObjectQLPlugin can discover it during start() phase.
{
name: 'driver-memory',
name: 'driver-default',
init: async (ctx: any) => {
ctx.registerService('driver.default', defaultDriver);
},
start: async () => {},
start: async () => {
// Connect Turso driver if applicable (MemoryDriver has no connect method)
if ('connect' in defaultDriver && typeof (defaultDriver as { connect: () => Promise<void> }).connect === 'function') {
await (defaultDriver as { connect: () => Promise<void> }).connect();
}
},
},
// App plugins: register app metadata as `app.*` services.
// Must be before ObjectQLPlugin so services are available during start().
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@objectql/cli": "workspace:*",
"@objectql/core": "workspace:*",
"@objectql/driver-memory": "^4.2.2",
"@objectql/driver-turso": "workspace:*",
"@objectql/example-enterprise-erp": "workspace:*",
"@objectql/example-project-tracker": "workspace:*",
"@objectql/plugin-security": "workspace:*",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading