@powersync/op-sqlite 0.0.0-dev-20250121082529 → 0.0.0-dev-20250121122709
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/lib/commonjs/db/OPSqliteAdapter.js +7 -6
- package/lib/commonjs/db/OPSqliteAdapter.js.map +1 -1
- package/lib/module/db/OPSqliteAdapter.js +7 -6
- package/lib/module/db/OPSqliteAdapter.js.map +1 -1
- package/lib/typescript/commonjs/src/db/OPSqliteAdapter.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/db/SqliteOptions.d.ts +1 -1
- package/lib/typescript/commonjs/src/db/SqliteOptions.d.ts.map +1 -1
- package/lib/typescript/commonjs/tsconfig.build.tsbuildinfo +1 -1
- package/lib/typescript/module/src/db/OPSqliteAdapter.d.ts.map +1 -1
- package/lib/typescript/module/src/db/SqliteOptions.d.ts +1 -1
- package/lib/typescript/module/src/db/SqliteOptions.d.ts.map +1 -1
- package/lib/typescript/module/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/db/OPSqliteAdapter.ts +7 -5
- package/src/db/SqliteOptions.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powersync/op-sqlite",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20250121122709",
|
|
4
4
|
"description": "PowerSync - sync Postgres or MongoDB with SQLite in your React Native app for offline-first and real-time data",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
|
@@ -57,7 +57,7 @@ export class OPSQLiteDBAdapter extends BaseObserver<DBAdapterListener> implement
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
protected async init() {
|
|
60
|
-
const { lockTimeoutMs, journalMode, journalSizeLimit, synchronous
|
|
60
|
+
const { lockTimeoutMs, journalMode, journalSizeLimit, synchronous } = this.options.sqliteOptions!;
|
|
61
61
|
const dbFilename = this.options.name;
|
|
62
62
|
|
|
63
63
|
this.writeConnection = await this.openConnection(dbFilename);
|
|
@@ -99,7 +99,7 @@ export class OPSQLiteDBAdapter extends BaseObserver<DBAdapterListener> implement
|
|
|
99
99
|
|
|
100
100
|
protected async openConnection(filenameOverride?: string): Promise<OPSQLiteConnection> {
|
|
101
101
|
const dbFilename = filenameOverride ?? this.options.name;
|
|
102
|
-
const DB: DB = this.openDatabase(dbFilename, this.options.sqliteOptions
|
|
102
|
+
const DB: DB = this.openDatabase(dbFilename, this.options.sqliteOptions?.encryptionKey ?? undefined);
|
|
103
103
|
|
|
104
104
|
//Load extensions for all connections
|
|
105
105
|
this.loadAdditionalExtensions(DB);
|
|
@@ -139,7 +139,7 @@ export class OPSQLiteDBAdapter extends BaseObserver<DBAdapterListener> implement
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
private loadAdditionalExtensions(DB: DB) {
|
|
142
|
-
if (this.options.sqliteOptions.extensions.length > 0) {
|
|
142
|
+
if (this.options.sqliteOptions?.extensions && this.options.sqliteOptions.extensions.length > 0) {
|
|
143
143
|
for (const extension of this.options.sqliteOptions.extensions) {
|
|
144
144
|
DB.loadExtension(extension.path, extension.entryPoint);
|
|
145
145
|
}
|
|
@@ -292,8 +292,10 @@ export class OPSQLiteDBAdapter extends BaseObserver<DBAdapterListener> implement
|
|
|
292
292
|
await this.initialized;
|
|
293
293
|
await this.writeConnection!.refreshSchema();
|
|
294
294
|
|
|
295
|
-
|
|
296
|
-
|
|
295
|
+
if(this.readConnections) {
|
|
296
|
+
for (let readConnection of this.readConnections) {
|
|
297
|
+
await readConnection.connection.refreshSchema();
|
|
298
|
+
}
|
|
297
299
|
}
|
|
298
300
|
}
|
|
299
301
|
}
|
package/src/db/SqliteOptions.ts
CHANGED
|
@@ -28,7 +28,7 @@ export interface SqliteOptions {
|
|
|
28
28
|
* Encryption key for the database.
|
|
29
29
|
* If set, the database will be encrypted using SQLCipher.
|
|
30
30
|
*/
|
|
31
|
-
encryptionKey?: string;
|
|
31
|
+
encryptionKey?: string | null;
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Load extensions using the path and entryPoint.
|