@libsql/client
Advanced tools
Comparing version 0.3.5-pre.3 to 0.3.5-pre.4
@@ -36,2 +36,3 @@ "use strict"; | ||
} | ||
let syncUrl = config.syncUrl; | ||
const uriScheme = uri.scheme.toLowerCase(); | ||
@@ -76,2 +77,3 @@ let scheme; | ||
authToken, | ||
syncUrl, | ||
intMode, | ||
@@ -78,0 +80,0 @@ fetch: config.fetch, |
@@ -143,2 +143,5 @@ "use strict"; | ||
} | ||
sync() { | ||
return Promise.resolve(); | ||
} | ||
close() { | ||
@@ -145,0 +148,0 @@ this.#client.close(); |
@@ -54,3 +54,6 @@ "use strict"; | ||
const path = config.path; | ||
const options = {}; | ||
const options = { | ||
authToken: config.authToken, | ||
syncUrl: config.syncUrl, | ||
}; | ||
const db = new libsql_1.default(path, options); | ||
@@ -130,2 +133,12 @@ try { | ||
} | ||
async sync() { | ||
this.#checkNotClosed(); | ||
const db = new libsql_1.default(this.#path, this.#options); | ||
try { | ||
await db.sync(); | ||
} | ||
finally { | ||
db.close(); | ||
} | ||
} | ||
close() { | ||
@@ -132,0 +145,0 @@ this.closed = true; |
@@ -161,2 +161,5 @@ "use strict"; | ||
} | ||
sync() { | ||
return Promise.resolve(); | ||
} | ||
async #openStream() { | ||
@@ -163,0 +166,0 @@ if (this.closed) { |
@@ -13,2 +13,4 @@ /** Configuration object for {@link createClient}. */ | ||
authToken?: string; | ||
/** URL of a remote server to synchronize database with. */ | ||
syncUrl?: string; | ||
/** Enables or disables TLS for `libsql:` URLs. | ||
@@ -167,2 +169,3 @@ * | ||
executeMultiple(sql: string): Promise<void>; | ||
sync(): Promise<void>; | ||
/** Close the client and release resources. | ||
@@ -169,0 +172,0 @@ * |
@@ -9,2 +9,3 @@ import type { Config, IntMode } from "./api.js"; | ||
authToken: string | undefined; | ||
syncUrl: string | undefined; | ||
intMode: IntMode; | ||
@@ -11,0 +12,0 @@ fetch: Function | undefined; |
@@ -33,2 +33,3 @@ import { LibsqlError } from "./api.js"; | ||
} | ||
let syncUrl = config.syncUrl; | ||
const uriScheme = uri.scheme.toLowerCase(); | ||
@@ -73,2 +74,3 @@ let scheme; | ||
authToken, | ||
syncUrl, | ||
intMode, | ||
@@ -75,0 +77,0 @@ fetch: config.fetch, |
@@ -22,2 +22,3 @@ /// <reference types="node" /> | ||
executeMultiple(sql: string): Promise<void>; | ||
sync(): Promise<void>; | ||
close(): void; | ||
@@ -24,0 +25,0 @@ get closed(): boolean; |
@@ -112,2 +112,5 @@ import * as hrana from "@libsql/hrana-client"; | ||
} | ||
sync() { | ||
return Promise.resolve(); | ||
} | ||
close() { | ||
@@ -114,0 +117,0 @@ this.#client.close(); |
@@ -18,2 +18,3 @@ import Database from "libsql"; | ||
executeMultiple(sql: string): Promise<void>; | ||
sync(): Promise<void>; | ||
close(): void; | ||
@@ -20,0 +21,0 @@ } |
@@ -33,3 +33,6 @@ import Database from "libsql"; | ||
const path = config.path; | ||
const options = {}; | ||
const options = { | ||
authToken: config.authToken, | ||
syncUrl: config.syncUrl, | ||
}; | ||
const db = new Database(path, options); | ||
@@ -108,2 +111,12 @@ try { | ||
} | ||
async sync() { | ||
this.#checkNotClosed(); | ||
const db = new Database(this.#path, this.#options); | ||
try { | ||
await db.sync(); | ||
} | ||
finally { | ||
db.close(); | ||
} | ||
} | ||
close() { | ||
@@ -110,0 +123,0 @@ this.closed = true; |
@@ -33,2 +33,3 @@ /// <reference types="node" /> | ||
executeMultiple(sql: string): Promise<void>; | ||
sync(): Promise<void>; | ||
_closeStream(streamState: StreamState): void; | ||
@@ -35,0 +36,0 @@ close(): void; |
@@ -130,2 +130,5 @@ import * as hrana from "@libsql/hrana-client"; | ||
} | ||
sync() { | ||
return Promise.resolve(); | ||
} | ||
async #openStream() { | ||
@@ -132,0 +135,0 @@ if (this.closed) { |
{ | ||
"name": "@libsql/client", | ||
"version": "0.3.5-pre.3", | ||
"version": "0.3.5-pre.4", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "libsql", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
147134
3585