create-syncular-app 0.15.45 → 0.15.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/minimal/README.md +1 -1
- package/template/minimal/src/make-client.ts +2 -2
- package/template/minimal/src/server.ts +1 -1
- package/template/tauri/src/server.ts +1 -1
- package/template/tauri/src/syncular.queries.ts +8 -0
- package/template/tauri/src-tauri/Cargo.toml +1 -1
- package/template/web/src/server.ts +1 -1
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ bun run clients # terminal 2 — prints "✓ converged"
|
|
|
23
23
|
| `syncular.migrations.lock.json` | Immutable checksums/layout evidence for deployed migrations (committed) |
|
|
24
24
|
| `src/syncular.generated.ts` | Generated by `syncular generate` (committed; regenerate on schema change) |
|
|
25
25
|
| `src/server.ts` | The whole sync backend in one Bun process |
|
|
26
|
-
| `src/make-client.ts` | Constructs one `SyncClient`
|
|
26
|
+
| `src/make-client.ts` | Constructs one `SyncClient` with the runtime-selected SQLite adapter + fetch |
|
|
27
27
|
| `src/clients.ts` | Two clients, one server, terminal-visible convergence |
|
|
28
28
|
| `src/smoke.test.ts` | The end-to-end smoke test (`bun test`) |
|
|
29
29
|
|
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
httpSyncTransport,
|
|
13
13
|
SyncClient,
|
|
14
14
|
} from '@syncular/client';
|
|
15
|
-
import {
|
|
15
|
+
import { openSqliteDatabase } from '@syncular/client/sqlite';
|
|
16
16
|
import { schema } from './syncular.generated';
|
|
17
17
|
|
|
18
18
|
export function makeClient(baseUrl: string, clientId: string): SyncClient {
|
|
19
19
|
return new SyncClient({
|
|
20
|
-
database:
|
|
20
|
+
database: openSqliteDatabase(), // in-memory; pass a path to persist
|
|
21
21
|
schema,
|
|
22
22
|
clientId,
|
|
23
23
|
transport: httpSyncTransport(`${baseUrl}/sync`),
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
import {
|
|
17
17
|
ensureSyncServerReady,
|
|
18
18
|
MemorySegmentStore,
|
|
19
|
-
SqliteServerStorage,
|
|
20
19
|
type SyncServerConfig,
|
|
21
20
|
} from '@syncular/server';
|
|
22
21
|
import { createSyncularHono } from '@syncular/server-hono';
|
|
22
|
+
import { SqliteServerStorage } from '@syncular/server/sqlite';
|
|
23
23
|
import { schema } from './syncular.generated';
|
|
24
24
|
|
|
25
25
|
const config: SyncServerConfig = {
|
|
@@ -23,10 +23,10 @@ import {
|
|
|
23
23
|
ensureSyncServerReady,
|
|
24
24
|
MemorySegmentStore,
|
|
25
25
|
type RealtimeSession,
|
|
26
|
-
SqliteServerStorage,
|
|
27
26
|
type SyncServerConfig,
|
|
28
27
|
} from '@syncular/server';
|
|
29
28
|
import { createSyncularHono } from '@syncular/server-hono';
|
|
29
|
+
import { SqliteServerStorage } from '@syncular/server/sqlite';
|
|
30
30
|
import { schema } from './syncular.generated';
|
|
31
31
|
|
|
32
32
|
const PORT = Number(process.env.PORT ?? 8787);
|
|
@@ -71,6 +71,7 @@ export interface NamedQuery<Row, Params = undefined> {
|
|
|
71
71
|
readonly sql: string;
|
|
72
72
|
readonly mapRow: (row: Readonly<Record<string, unknown>>) => Row;
|
|
73
73
|
readonly tables: readonly string[];
|
|
74
|
+
readonly resultColumns: readonly QueryResultColumn[];
|
|
74
75
|
readonly bind: (params: Params) => readonly QueryValue[];
|
|
75
76
|
readonly sqlFor?: (params: Params) => string;
|
|
76
77
|
readonly dependencies: (params: Params) => readonly QueryDependency[];
|
|
@@ -85,6 +86,12 @@ export interface QueryDependency {
|
|
|
85
86
|
readonly scopeKeys?: readonly string[];
|
|
86
87
|
}
|
|
87
88
|
|
|
89
|
+
export interface QueryResultColumn {
|
|
90
|
+
readonly name: string;
|
|
91
|
+
readonly type: 'string' | 'integer' | 'float' | 'boolean' | 'json' | 'bytes' | 'blob_ref' | 'crdt';
|
|
92
|
+
readonly nullable: boolean;
|
|
93
|
+
}
|
|
94
|
+
|
|
88
95
|
export interface WindowCoverage {
|
|
89
96
|
readonly base: {
|
|
90
97
|
readonly table: string;
|
|
@@ -158,6 +165,7 @@ export const listTodosQuery: NamedQuery<ListTodosRow, ListTodosParams> = {
|
|
|
158
165
|
mapRow: listTodosMapRow,
|
|
159
166
|
sqlFor: (params: ListTodosParams) => listTodosSelect(params).sql,
|
|
160
167
|
tables: listTodosTables,
|
|
168
|
+
resultColumns: [{ name: 'id', type: 'string', nullable: false }, { name: 'listId', type: 'string', nullable: false }, { name: 'title', type: 'string', nullable: false }, { name: 'done', type: 'boolean', nullable: false }, { name: 'position', type: 'integer', nullable: false }, { name: 'updatedAtMs', type: 'integer', nullable: false }],
|
|
161
169
|
dependencies: (params) => [
|
|
162
170
|
{ table: 'todos', scopeKeys: ['list:' + String(params.listId) + ''] },
|
|
163
171
|
],
|
|
@@ -21,7 +21,7 @@ tauri = { version = "2", features = [] }
|
|
|
21
21
|
# The syncular plugin from crates.io. `native-transport` gives the core its
|
|
22
22
|
# real HTTP + WebSocket transport (ureq + tungstenite) inside the host
|
|
23
23
|
# process — the webview never talks to the sync server directly.
|
|
24
|
-
tauri-plugin-syncular = { version = "0.15.
|
|
24
|
+
tauri-plugin-syncular = { version = "0.15.47", features = ["native-transport"] }
|
|
25
25
|
|
|
26
26
|
[features]
|
|
27
27
|
default = []
|
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
ensureSyncServerReady,
|
|
20
20
|
MemorySegmentStore,
|
|
21
21
|
type RealtimeSession,
|
|
22
|
-
SqliteServerStorage,
|
|
23
22
|
type SyncServerConfig,
|
|
24
23
|
} from '@syncular/server';
|
|
25
24
|
import { createSyncularHono } from '@syncular/server-hono';
|
|
25
|
+
import { SqliteServerStorage } from '@syncular/server/sqlite';
|
|
26
26
|
import { schema } from './syncular.generated';
|
|
27
27
|
|
|
28
28
|
const PORT = Number(process.env.PORT ?? 8787);
|