@lunora/replica 1.0.0-alpha.39 → 1.0.0-alpha.40
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/dist/adapters/sqlite-wasm.d.mts +2 -2
- package/dist/adapters/sqlite-wasm.d.ts +2 -2
- package/dist/index.d.mts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/packem_shared/{local-mirror.d-CyGOpUES.d.ts → local-mirror.d-ByrYTq4z.d.ts} +2 -2
- package/dist/packem_shared/{local-mirror.d-DTavX_y0.d.mts → local-mirror.d-Cip3QuMf.d.mts} +2 -2
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ import { S as SqliteAdapter } from "../packem_shared/types.d-CkMkSwLJ.mjs";
|
|
|
10
10
|
* IMPORTANT (REPLICA-01): the real `oo1.DB.exec()` does NOT return sql.js's
|
|
11
11
|
* `{ columns, values }[]` result shape — with `rowMode: "object"` and
|
|
12
12
|
* `returnValue: "resultRows"` it returns the rows directly, as
|
|
13
|
-
* `Record
|
|
13
|
+
* `Record<string, unknown>[]`. This adapter is written against that real
|
|
14
14
|
* shape; `lastInsertRowId` uses the driver's `selectValue()` convenience
|
|
15
15
|
* method (a single-scalar query helper) rather than parsing a result-row
|
|
16
16
|
* array.
|
|
@@ -18,7 +18,7 @@ import { S as SqliteAdapter } from "../packem_shared/types.d-CkMkSwLJ.mjs";
|
|
|
18
18
|
* @param database.close Tear down the database connection.
|
|
19
19
|
* @param database.exec Execute SQL with optional bind params. With
|
|
20
20
|
* `{ returnValue: "resultRows", rowMode: "object" }` it returns the matched
|
|
21
|
-
* rows directly (`Record
|
|
21
|
+
* rows directly (`Record<string, unknown>[]`); otherwise (DDL/DML/BEGIN/
|
|
22
22
|
* COMMIT/ROLLBACK) its return value is unused here.
|
|
23
23
|
* @param database.selectValue Run a query and return the first column of the
|
|
24
24
|
* first row as a single scalar — used for `SELECT last_insert_rowid()`.
|
|
@@ -10,7 +10,7 @@ import { S as SqliteAdapter } from "../packem_shared/types.d-CkMkSwLJ.js";
|
|
|
10
10
|
* IMPORTANT (REPLICA-01): the real `oo1.DB.exec()` does NOT return sql.js's
|
|
11
11
|
* `{ columns, values }[]` result shape — with `rowMode: "object"` and
|
|
12
12
|
* `returnValue: "resultRows"` it returns the rows directly, as
|
|
13
|
-
* `Record
|
|
13
|
+
* `Record<string, unknown>[]`. This adapter is written against that real
|
|
14
14
|
* shape; `lastInsertRowId` uses the driver's `selectValue()` convenience
|
|
15
15
|
* method (a single-scalar query helper) rather than parsing a result-row
|
|
16
16
|
* array.
|
|
@@ -18,7 +18,7 @@ import { S as SqliteAdapter } from "../packem_shared/types.d-CkMkSwLJ.js";
|
|
|
18
18
|
* @param database.close Tear down the database connection.
|
|
19
19
|
* @param database.exec Execute SQL with optional bind params. With
|
|
20
20
|
* `{ returnValue: "resultRows", rowMode: "object" }` it returns the matched
|
|
21
|
-
* rows directly (`Record
|
|
21
|
+
* rows directly (`Record<string, unknown>[]`); otherwise (DDL/DML/BEGIN/
|
|
22
22
|
* COMMIT/ROLLBACK) its return value is unused here.
|
|
23
23
|
* @param database.selectValue Run a query and return the first column of the
|
|
24
24
|
* first row as a single scalar — used for `SELECT last_insert_rowid()`.
|
package/dist/index.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ export { createBetterSqlite3Adapter } from "./adapters/better-sqlite3.mjs";
|
|
|
2
2
|
export { createSqliteWasmAdapter } from "./adapters/sqlite-wasm.mjs";
|
|
3
3
|
export { createSqlJsAdapter } from "./adapters/sqljs.mjs";
|
|
4
4
|
import { S as SqliteAdapter } from "./packem_shared/types.d-CkMkSwLJ.mjs";
|
|
5
|
-
import { T as TableDiff, I as InputEvent, S as Seq, E as EventLogEntry, a as EventLog, A as AppendOptions, L as LocalMirror } from "./packem_shared/local-mirror.d-
|
|
6
|
-
export { type C as ClientSeq, type b as EventLogOptions, type c as EventLogSnapshot, type G as GlobalSeq, type d as LocalMirrorOptions, type M as MirrorTableDef, type R as RowChange, e as classifyChanges, f as createTableDiff, g as diffSize, i as isClientSeq, h as isDiffEmpty, j as isGlobalSeq, k as isInputEvent, m as mergeDiffs } from "./packem_shared/local-mirror.d-
|
|
5
|
+
import { T as TableDiff, I as InputEvent, S as Seq, E as EventLogEntry, a as EventLog, A as AppendOptions, L as LocalMirror } from "./packem_shared/local-mirror.d-Cip3QuMf.mjs";
|
|
6
|
+
export { type C as ClientSeq, type b as EventLogOptions, type c as EventLogSnapshot, type G as GlobalSeq, type d as LocalMirrorOptions, type M as MirrorTableDef, type R as RowChange, e as classifyChanges, f as createTableDiff, g as diffSize, i as isClientSeq, h as isDiffEmpty, j as isGlobalSeq, k as isInputEvent, m as mergeDiffs } from "./packem_shared/local-mirror.d-Cip3QuMf.mjs";
|
|
7
7
|
/**
|
|
8
8
|
* Apply a single {@link TableDiff} to an in-memory row map and return
|
|
9
9
|
* the updated map.
|
|
@@ -39,7 +39,7 @@ declare const applyDiffs: (current: ReadonlyMap<string, Record<string, unknown>>
|
|
|
39
39
|
/**
|
|
40
40
|
* Merge the row-level effect of a {@link TableDiff} into plain JSON
|
|
41
41
|
* state keyed by table name, returning a new snapshot.
|
|
42
|
-
* @param snapshot Current snapshot, e.g. `{ users: Map
|
|
42
|
+
* @param snapshot Current snapshot, e.g. `{ users: Map<id, row>, posts: Map<id, row> }`.
|
|
43
43
|
* @param diff Contains the target table name and the row-level changes to merge.
|
|
44
44
|
* @returns A shallow copy of `snapshot` with `diff.table`'s map updated.
|
|
45
45
|
* @experimental
|
|
@@ -106,7 +106,7 @@ interface DefineEventsOptions {
|
|
|
106
106
|
/**
|
|
107
107
|
* Optional version prefix for all event types.
|
|
108
108
|
*
|
|
109
|
-
* When set, every qualified event type is prefixed with `"v
|
|
109
|
+
* When set, every qualified event type is prefixed with `"v<N>."`, enabling
|
|
110
110
|
* versioned event naming like `"v1.chat.messageSent"` or `"v2.chat.messageSent"`.
|
|
111
111
|
* This allows materializers to evolve their handling logic based on the event
|
|
112
112
|
* version without breaking backward compatibility.
|
|
@@ -272,8 +272,8 @@ type UnknownEventHandling = "warn" | "ignore" | "fail" | ((entry: EventLogEntry)
|
|
|
272
272
|
* Events emitted by the {@link EventSource} runtime.
|
|
273
273
|
*
|
|
274
274
|
* A `type` (not `interface`) so it satisfies `EventEmitter`'s
|
|
275
|
-
* `Record
|
|
276
|
-
* signature and aren't assignable to `Record
|
|
275
|
+
* `Record<string, unknown>` constraint — interfaces have no implicit index
|
|
276
|
+
* signature and aren't assignable to `Record<string, unknown>`.
|
|
277
277
|
* @experimental
|
|
278
278
|
*/
|
|
279
279
|
type EventSourceEvents = {
|
|
@@ -509,9 +509,9 @@ declare const defineMaterializer: <S>(definition: MaterializerDef<S>) => Materia
|
|
|
509
509
|
* A materializer of any state shape. The {@link MaterializerRuntime} holds a
|
|
510
510
|
* heterogeneous collection and only ever calls `apply(entry)` / `setState(...)`
|
|
511
511
|
* (with cast values) / reads `def.name` — it never needs the concrete state
|
|
512
|
-
* type. `Materializer
|
|
513
|
-
* `Materializer
|
|
514
|
-
* to `Materializer
|
|
512
|
+
* type. `Materializer<unknown>` won't do: `setState(state: S)` makes
|
|
513
|
+
* `Materializer<S>` invariant in `S`, so `Materializer<number>` isn't assignable
|
|
514
|
+
* to `Materializer<unknown>`. Erasing the type param is the idiomatic fix.
|
|
515
515
|
*/
|
|
516
516
|
type AnyMaterializer = Materializer<any>;
|
|
517
517
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ export { createBetterSqlite3Adapter } from "./adapters/better-sqlite3.js";
|
|
|
2
2
|
export { createSqliteWasmAdapter } from "./adapters/sqlite-wasm.js";
|
|
3
3
|
export { createSqlJsAdapter } from "./adapters/sqljs.js";
|
|
4
4
|
import { S as SqliteAdapter } from "./packem_shared/types.d-CkMkSwLJ.js";
|
|
5
|
-
import { T as TableDiff, I as InputEvent, S as Seq, E as EventLogEntry, a as EventLog, A as AppendOptions, L as LocalMirror } from "./packem_shared/local-mirror.d-
|
|
6
|
-
export { type C as ClientSeq, type b as EventLogOptions, type c as EventLogSnapshot, type G as GlobalSeq, type d as LocalMirrorOptions, type M as MirrorTableDef, type R as RowChange, e as classifyChanges, f as createTableDiff, g as diffSize, i as isClientSeq, h as isDiffEmpty, j as isGlobalSeq, k as isInputEvent, m as mergeDiffs } from "./packem_shared/local-mirror.d-
|
|
5
|
+
import { T as TableDiff, I as InputEvent, S as Seq, E as EventLogEntry, a as EventLog, A as AppendOptions, L as LocalMirror } from "./packem_shared/local-mirror.d-ByrYTq4z.js";
|
|
6
|
+
export { type C as ClientSeq, type b as EventLogOptions, type c as EventLogSnapshot, type G as GlobalSeq, type d as LocalMirrorOptions, type M as MirrorTableDef, type R as RowChange, e as classifyChanges, f as createTableDiff, g as diffSize, i as isClientSeq, h as isDiffEmpty, j as isGlobalSeq, k as isInputEvent, m as mergeDiffs } from "./packem_shared/local-mirror.d-ByrYTq4z.js";
|
|
7
7
|
/**
|
|
8
8
|
* Apply a single {@link TableDiff} to an in-memory row map and return
|
|
9
9
|
* the updated map.
|
|
@@ -39,7 +39,7 @@ declare const applyDiffs: (current: ReadonlyMap<string, Record<string, unknown>>
|
|
|
39
39
|
/**
|
|
40
40
|
* Merge the row-level effect of a {@link TableDiff} into plain JSON
|
|
41
41
|
* state keyed by table name, returning a new snapshot.
|
|
42
|
-
* @param snapshot Current snapshot, e.g. `{ users: Map
|
|
42
|
+
* @param snapshot Current snapshot, e.g. `{ users: Map<id, row>, posts: Map<id, row> }`.
|
|
43
43
|
* @param diff Contains the target table name and the row-level changes to merge.
|
|
44
44
|
* @returns A shallow copy of `snapshot` with `diff.table`'s map updated.
|
|
45
45
|
* @experimental
|
|
@@ -106,7 +106,7 @@ interface DefineEventsOptions {
|
|
|
106
106
|
/**
|
|
107
107
|
* Optional version prefix for all event types.
|
|
108
108
|
*
|
|
109
|
-
* When set, every qualified event type is prefixed with `"v
|
|
109
|
+
* When set, every qualified event type is prefixed with `"v<N>."`, enabling
|
|
110
110
|
* versioned event naming like `"v1.chat.messageSent"` or `"v2.chat.messageSent"`.
|
|
111
111
|
* This allows materializers to evolve their handling logic based on the event
|
|
112
112
|
* version without breaking backward compatibility.
|
|
@@ -272,8 +272,8 @@ type UnknownEventHandling = "warn" | "ignore" | "fail" | ((entry: EventLogEntry)
|
|
|
272
272
|
* Events emitted by the {@link EventSource} runtime.
|
|
273
273
|
*
|
|
274
274
|
* A `type` (not `interface`) so it satisfies `EventEmitter`'s
|
|
275
|
-
* `Record
|
|
276
|
-
* signature and aren't assignable to `Record
|
|
275
|
+
* `Record<string, unknown>` constraint — interfaces have no implicit index
|
|
276
|
+
* signature and aren't assignable to `Record<string, unknown>`.
|
|
277
277
|
* @experimental
|
|
278
278
|
*/
|
|
279
279
|
type EventSourceEvents = {
|
|
@@ -509,9 +509,9 @@ declare const defineMaterializer: <S>(definition: MaterializerDef<S>) => Materia
|
|
|
509
509
|
* A materializer of any state shape. The {@link MaterializerRuntime} holds a
|
|
510
510
|
* heterogeneous collection and only ever calls `apply(entry)` / `setState(...)`
|
|
511
511
|
* (with cast values) / reads `def.name` — it never needs the concrete state
|
|
512
|
-
* type. `Materializer
|
|
513
|
-
* `Materializer
|
|
514
|
-
* to `Materializer
|
|
512
|
+
* type. `Materializer<unknown>` won't do: `setState(state: S)` makes
|
|
513
|
+
* `Materializer<S>` invariant in `S`, so `Materializer<number>` isn't assignable
|
|
514
|
+
* to `Materializer<unknown>`. Erasing the type param is the idiomatic fix.
|
|
515
515
|
*/
|
|
516
516
|
type AnyMaterializer = Materializer<any>;
|
|
517
517
|
/**
|
|
@@ -140,7 +140,7 @@ declare const isClientSeq: (seq: Seq) => seq is ClientSeq;
|
|
|
140
140
|
*
|
|
141
141
|
* ```ts
|
|
142
142
|
* const event = events.chat.messageSent({ channelId: "c1", text: "hello" });
|
|
143
|
-
* // event: InputEvent
|
|
143
|
+
* // event: InputEvent<"chat.messageSent", { channelId: string; text: string }>
|
|
144
144
|
* ```
|
|
145
145
|
* @experimental
|
|
146
146
|
*/
|
|
@@ -420,7 +420,7 @@ interface LocalMirrorOptions {
|
|
|
420
420
|
* mirror.applyDiff(someDiff);
|
|
421
421
|
*
|
|
422
422
|
* // Query locally:
|
|
423
|
-
* const rows = mirror.query
|
|
423
|
+
* const rows = mirror.query<{ id: string; name: string }>(
|
|
424
424
|
* "SELECT id, name FROM users WHERE name LIKE ?",
|
|
425
425
|
* ["alice%"],
|
|
426
426
|
* );
|
|
@@ -140,7 +140,7 @@ declare const isClientSeq: (seq: Seq) => seq is ClientSeq;
|
|
|
140
140
|
*
|
|
141
141
|
* ```ts
|
|
142
142
|
* const event = events.chat.messageSent({ channelId: "c1", text: "hello" });
|
|
143
|
-
* // event: InputEvent
|
|
143
|
+
* // event: InputEvent<"chat.messageSent", { channelId: string; text: string }>
|
|
144
144
|
* ```
|
|
145
145
|
* @experimental
|
|
146
146
|
*/
|
|
@@ -420,7 +420,7 @@ interface LocalMirrorOptions {
|
|
|
420
420
|
* mirror.applyDiff(someDiff);
|
|
421
421
|
*
|
|
422
422
|
* // Query locally:
|
|
423
|
-
* const rows = mirror.query
|
|
423
|
+
* const rows = mirror.query<{ id: string; name: string }>(
|
|
424
424
|
* "SELECT id, name FROM users WHERE name LIKE ?",
|
|
425
425
|
* ["alice%"],
|
|
426
426
|
* );
|
package/dist/react.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as LocalMirror } from "./packem_shared/local-mirror.d-
|
|
1
|
+
import { L as LocalMirror } from "./packem_shared/local-mirror.d-Cip3QuMf.mjs";
|
|
2
2
|
import "./packem_shared/types.d-CkMkSwLJ.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Result of {@link useLocalQuery} — a discriminated union so callers get a
|
package/dist/react.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as LocalMirror } from "./packem_shared/local-mirror.d-
|
|
1
|
+
import { L as LocalMirror } from "./packem_shared/local-mirror.d-ByrYTq4z.js";
|
|
2
2
|
import "./packem_shared/types.d-CkMkSwLJ.js";
|
|
3
3
|
/**
|
|
4
4
|
* Result of {@link useLocalQuery} — a discriminated union so callers get a
|