Skip to content

Commit b7a5475

Browse files
authored
Merge pull request #246 from tursodatabase/lucio/add-replicated
release 0.9 & update libsql to 0.4
2 parents 7803649 + 73ec295 commit b7a5475

10 files changed

Lines changed: 232 additions & 89 deletions

File tree

package-lock.json

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

packages/libsql-client-wasm/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@libsql/client-wasm",
3-
"version": "0.8.1",
3+
"version": "0.9.0",
44
"keywords": [
55
"libsql",
66
"database",
@@ -56,7 +56,7 @@
5656
"typedoc": "rm -rf ./docs && typedoc"
5757
},
5858
"dependencies": {
59-
"@libsql/core": "0.8.1",
59+
"@libsql/core": "^0.9.0",
6060
"@libsql/libsql-wasm-experimental": "^0.0.2",
6161
"js-base64": "^3.7.5"
6262
},

packages/libsql-client-wasm/src/wasm.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import type {
1717
Value,
1818
InValue,
1919
InStatement,
20-
InArgs
20+
InArgs,
21+
Replicated,
2122
} from "@libsql/core/api";
2223
import { LibsqlError } from "@libsql/core/api";
2324
import type { ExpandedConfig } from "@libsql/core/config";
@@ -125,17 +126,20 @@ export class Sqlite3Client implements Client {
125126
async execute(stmt: InStatement): Promise<ResultSet>;
126127
async execute(sql: string, args?: InArgs): Promise<ResultSet>;
127128

128-
async execute(stmtOrSql: InStatement | string, args?: InArgs): Promise<ResultSet> {
129-
let stmt: InStatement;
130-
131-
if (typeof stmtOrSql === 'string') {
132-
stmt = {
133-
sql: stmtOrSql,
134-
args: args || []
135-
};
136-
} else {
137-
stmt = stmtOrSql;
138-
}
129+
async execute(
130+
stmtOrSql: InStatement | string,
131+
args?: InArgs,
132+
): Promise<ResultSet> {
133+
let stmt: InStatement;
134+
135+
if (typeof stmtOrSql === "string") {
136+
stmt = {
137+
sql: stmtOrSql,
138+
args: args || [],
139+
};
140+
} else {
141+
stmt = stmtOrSql;
142+
}
139143

140144
this.#checkNotClosed();
141145
return executeStmt(this.#getDb(), stmt, this.#intMode);
@@ -186,7 +190,7 @@ export class Sqlite3Client implements Client {
186190
}
187191
}
188192

189-
async sync(): Promise<void> {
193+
async sync(): Promise<Replicated> {
190194
throw new LibsqlError(
191195
"sync not supported in wasm mode",
192196
"SYNC_NOT_SUPPORTED",

packages/libsql-client/examples/sync.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@ async function example() {
1212
await db.execute(
1313
"CREATE TABLE IF NOT EXISTS guest_book_entries (comment TEXT)",
1414
);
15-
await db.sync();
15+
const rep = await db.sync();
16+
17+
console.log("frames_synced: " + rep.frames_synced);
1618

1719
const comment = reader.question("Enter your comment: ");
1820

1921
await db.execute({
2022
sql: "INSERT INTO guest_book_entries (comment) VALUES (?)",
2123
args: [comment],
2224
});
23-
await db.sync();
25+
26+
const rep2 = await db.sync();
27+
28+
console.log("frames_synced: " + rep2.frames_synced);
2429

2530
console.log("Guest book entries:");
2631
const rs = await db.execute("SELECT * FROM guest_book_entries");

packages/libsql-client/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@libsql/client",
3-
"version": "0.8.1",
3+
"version": "0.9.0",
44
"keywords": [
55
"libsql",
66
"database",
@@ -102,10 +102,10 @@
102102
"lint-staged": "lint-staged"
103103
},
104104
"dependencies": {
105-
"@libsql/core": "^0.8.1",
105+
"@libsql/core": "^0.9.0",
106106
"@libsql/hrana-client": "^0.6.2",
107107
"js-base64": "^3.7.5",
108-
"libsql": "^0.3.10",
108+
"libsql": "^0.4.1",
109109
"promise-limit": "^2.7.0"
110110
},
111111
"devDependencies": {

0 commit comments

Comments
 (0)