Skip to content

Commit 4d42566

Browse files
committed
chore: revert
1 parent 4737b27 commit 4d42566

File tree

4 files changed

+653
-1692
lines changed

4 files changed

+653
-1692
lines changed

packages/powersync-op-sqlite/src/db/OPSqliteAdapter.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class OPSQLiteDBAdapter extends BaseObserver<DBAdapterListener> implement
5757
}
5858

5959
protected async init() {
60-
const { lockTimeoutMs, journalMode, journalSizeLimit, synchronous, encryptionKey } = this.options.sqliteOptions;
60+
const { lockTimeoutMs, journalMode, journalSizeLimit, synchronous } = this.options.sqliteOptions!;
6161
const dbFilename = this.options.name;
6262

6363
this.writeConnection = await this.openConnection(dbFilename);
@@ -99,7 +99,7 @@ export class OPSQLiteDBAdapter extends BaseObserver<DBAdapterListener> implement
9999

100100
protected async openConnection(filenameOverride?: string): Promise<OPSQLiteConnection> {
101101
const dbFilename = filenameOverride ?? this.options.name;
102-
const DB: DB = this.openDatabase(dbFilename, this.options.sqliteOptions.encryptionKey);
102+
const DB: DB = this.openDatabase(dbFilename, this.options.sqliteOptions?.encryptionKey ?? undefined);
103103

104104
//Load extensions for all connections
105105
this.loadAdditionalExtensions(DB);
@@ -139,7 +139,7 @@ export class OPSQLiteDBAdapter extends BaseObserver<DBAdapterListener> implement
139139
}
140140

141141
private loadAdditionalExtensions(DB: DB) {
142-
if (this.options.sqliteOptions.extensions.length > 0) {
142+
if (this.options.sqliteOptions?.extensions && this.options.sqliteOptions.extensions.length > 0) {
143143
for (const extension of this.options.sqliteOptions.extensions) {
144144
DB.loadExtension(extension.path, extension.entryPoint);
145145
}
@@ -292,8 +292,10 @@ export class OPSQLiteDBAdapter extends BaseObserver<DBAdapterListener> implement
292292
await this.initialized;
293293
await this.writeConnection!.refreshSchema();
294294

295-
for (let readConnection of this.readConnections) {
296-
await readConnection.connection.refreshSchema();
295+
if(this.readConnections) {
296+
for (let readConnection of this.readConnections) {
297+
await readConnection.connection.refreshSchema();
298+
}
297299
}
298300
}
299301
}

packages/powersync-op-sqlite/src/db/SqliteOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface SqliteOptions {
2828
* Encryption key for the database.
2929
* If set, the database will be encrypted using SQLCipher.
3030
*/
31-
encryptionKey?: string;
31+
encryptionKey?: string | null;
3232

3333
/**
3434
* Load extensions using the path and entryPoint.

packages/powersync-op-sqlite/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"noEmit": true,
1111
"noFallthroughCasesInSwitch": true,
1212
"skipLibCheck": true,
13+
"strict": true,
1314
"esModuleInterop": true
1415
},
1516
"references": [

0 commit comments

Comments
 (0)