Skip to content

Commit

Permalink
chore: merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicGBauer committed Feb 27, 2024
2 parents 87299d2 + 749dc80 commit 7a3f8a7
Show file tree
Hide file tree
Showing 11 changed files with 1,111 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
*
* For the most part, behavior is the same whether querying on the underlying database, or on {@link AbstractPowerSyncDatabase}.
*/
protected get database() {
get database() {
return this.options.database;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface ChecksumCache {
export interface SyncLocalDatabaseResult {
ready: boolean;
checkpointValid: boolean;
failures?: string[];
checkpointFailures?: string[];
}

export interface BucketChecksum {
Expand All @@ -34,7 +34,7 @@ export interface BucketChecksum {
/**
* Count of operations - informational only.
*/
count: number;
count?: number;
}

export enum PSInternalTable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { OpId } from './CrudEntry';
import { OpType, OpTypeJSON } from './OpType';

export interface OplogEntryJSON {
checksum: number;
data?: string;
object_id?: string;
object_type?: string;
op_id: string;
op: OpTypeJSON;
object_type: string;
object_id: string;
checksum: number;
data: string;
subkey: string | object;
subkey?: string | object;
}

export class OplogEntry {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ export class SqliteBucketStorage implements BucketStorageAdapter {
async syncLocalDatabase(checkpoint: Checkpoint): Promise<SyncLocalDatabaseResult> {
const r = await this.validateChecksums(checkpoint);
if (!r.checkpointValid) {
this.logger.error('Checksums failed for', r.failures);
for (const b of r.failures ?? []) {
this.logger.error('Checksums failed for', r.checkpointFailures);
for (const b of r.checkpointFailures ?? []) {
await this.deleteBucket(b);
}
return { ready: false, checkpointValid: false, failures: r.failures };
return { ready: false, checkpointValid: false, checkpointFailures: r.checkpointFailures };
}

const bucketNames = checkpoint.buckets.map((b) => b.bucket);
Expand Down Expand Up @@ -178,7 +178,7 @@ export class SqliteBucketStorage implements BucketStorageAdapter {
return {
checkpointValid: false,
ready: false,
failures: []
checkpointFailures: []
};
}

Expand All @@ -190,7 +190,7 @@ export class SqliteBucketStorage implements BucketStorageAdapter {
return {
checkpointValid: false,
ready: false,
failures: result['failed_buckets']
checkpointFailures: result['failed_buckets']
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ export class SyncDataBucket {
/**
* The `after` specified in the request.
*/
public after: OpId,
public after?: OpId,
/**
* Use this for the next request.
*/
public next_after: OpId
public next_after?: OpId
) {}

toJSON(): SyncDataBucketJSON {
Expand Down
1 change: 1 addition & 0 deletions packages/powersync-sdk-common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export * from './client/sync/bucket/CrudTransaction';
export * from './client/sync/bucket/SyncDataBatch';
export * from './client/sync/bucket/SyncDataBucket';
export * from './client/sync/bucket/OpType';
export * from './client/sync/bucket/OplogEntry';
export * from './client/sync/stream/AbstractRemote';
export * from './client/sync/stream/AbstractStreamingSyncImplementation';
export * from './client/sync/stream/streaming-sync-types';
Expand Down
Loading

0 comments on commit 7a3f8a7

Please sign in to comment.