Skip to content

Commit 3cc428f

Browse files
committed
Run prettier
1 parent 053a299 commit 3cc428f

File tree

13 files changed

+161
-149
lines changed

13 files changed

+161
-149
lines changed

packages/common/src/client/AbstractPowerSyncDatabase.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,14 +364,13 @@ export abstract class AbstractPowerSyncDatabase extends BaseObserver<PowerSyncDB
364364
priorityStatuses.push({ priority, hasSynced: true, lastSyncedAt: parsedDate });
365365
}
366366
}
367-
368367

369368
const hasSynced = lastCompleteSync != null;
370369
const updatedStatus = new SyncStatus({
371370
...this.currentStatus.toJSON(),
372371
hasSynced,
373372
priorityStatuses,
374-
lastSyncedAt: lastCompleteSync,
373+
lastSyncedAt: lastCompleteSync
375374
});
376375

377376
if (!updatedStatus.isEqual(this.currentStatus)) {

packages/common/src/client/sync/bucket/SqliteBucketStorage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export class SqliteBucketStorage extends BaseObserver<BucketStorageListener> imp
207207
if (priority !== undefined) {
208208
// Only validate the buckets within the priority we care about
209209
const newBuckets = checkpoint.buckets.filter((cs) => hasMatchingPriority(priority, cs));
210-
checkpoint = {...checkpoint, buckets: newBuckets};
210+
checkpoint = { ...checkpoint, buckets: newBuckets };
211211
}
212212

213213
const rs = await this.db.execute('SELECT powersync_validate_checkpoint(?) as result', [

packages/common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,10 @@ The next upload iteration will be delayed.`);
557557
const bucketsToDelete = new Set<string>(bucketMap.keys());
558558
const newBuckets = new Map<string, BucketDescription>();
559559
for (const checksum of line.checkpoint.buckets) {
560-
newBuckets.set(checksum.bucket, { name: checksum.bucket, priority: checksum.priority ?? FALLBACK_PRIORITY });
560+
newBuckets.set(checksum.bucket, {
561+
name: checksum.bucket,
562+
priority: checksum.priority ?? FALLBACK_PRIORITY
563+
});
561564
bucketsToDelete.delete(checksum.bucket);
562565
}
563566
if (bucketsToDelete.size > 0) {

packages/web/bin/powersync.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,27 @@ const program = new Command();
55
const path = require('path');
66
const fsPromise = require('fs/promises');
77
const { version } = require('../package.json');
8-
9-
program
10-
.name('powersync-web')
11-
.description('CLI for PowerSync Web SDK utilities')
12-
.version(version);
8+
9+
program.name('powersync-web').description('CLI for PowerSync Web SDK utilities').version(version);
1310

1411
program
1512
.command('copy-assets')
1613
.description('Copy assets to the specified output directory')
1714
.option('-o, --output <directory>', 'output directory for assets', 'public')
18-
.action(async(options) => {
15+
.action(async (options) => {
1916
const outputDir = options.output;
20-
17+
2118
console.log(`Target directory: ${outputDir}`);
22-
19+
2320
const cwd = process.cwd();
2421
const source = path.join(cwd, 'node_modules', '@powersync', 'web', 'dist');
2522
const destination = path.join(cwd, outputDir, '@powersync');
26-
23+
2724
await fsPromise.rm(destination, { recursive: true, force: true }); // Clear old assets
2825

29-
await copyDirectory(source, destination)
26+
await copyDirectory(source, destination);
3027
});
3128

32-
3329
program.parse(process.argv);
3430

3531
async function copyDirectory(source, destination) {
@@ -40,4 +36,4 @@ async function copyDirectory(source, destination) {
4036
console.error(`Error copying assets: ${err.message}`);
4137
process.exit(1);
4238
}
43-
}
39+
}

packages/web/src/db/PowerSyncDatabase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
PowerSyncDatabaseOptionsWithOpenFactory,
1515
PowerSyncDatabaseOptionsWithSettings,
1616
SqliteBucketStorage,
17-
StreamingSyncImplementation,
17+
StreamingSyncImplementation
1818
} from '@powersync/common';
1919
import { Mutex } from 'async-mutex';
2020
import { getNavigatorLocks } from '../shared/navigator';

packages/web/src/shared/navigator.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ export const getNavigatorLocks = (): LockManager => {
33
return navigator.locks;
44
}
55

6-
throw new Error('Navigator locks are not available in an insecure context. Use a secure context such as HTTPS or http://localhost.');
7-
}
6+
throw new Error(
7+
'Navigator locks are not available in an insecure context. Use a secure context such as HTTPS or http://localhost.'
8+
);
9+
};

packages/web/tests/crud.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ describe('CRUD Tests', () => {
7979
expect(await powersync.get('SELECT count(*) AS count FROM assets')).deep.equals({ count: 1 });
8080

8181
// Make sure uniqueness is enforced
82-
await expect(powersync.execute('INSERT INTO assets(id, description) VALUES(?, ?)', [testId, 'test3'])).rejects.toThrow(
83-
/UNIQUE constraint failed/
84-
);
82+
await expect(
83+
powersync.execute('INSERT INTO assets(id, description) VALUES(?, ?)', [testId, 'test3'])
84+
).rejects.toThrow(/UNIQUE constraint failed/);
8585
});
8686

8787
it('UPDATE', async () => {

packages/web/tests/shared/navigator.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('getNavigationLocks', () => {
99
it('should return native navigator.locks if available', () => {
1010
const mockLocks = {
1111
request: vi.fn(),
12-
query: vi.fn(),
12+
query: vi.fn()
1313
};
1414

1515
vi.spyOn(navigator, 'locks', 'get').mockReturnValue(mockLocks);
@@ -19,9 +19,10 @@ describe('getNavigationLocks', () => {
1919
});
2020

2121
it('should throw an error if navigator.locks is unavailable', () => {
22-
2322
vi.spyOn(navigator, 'locks', 'get').mockReturnValue(undefined!);
2423

25-
expect(() => getNavigatorLocks()).toThrowError('Navigator locks are not available in an insecure context. Use a secure context such as HTTPS or http://localhost.');;
24+
expect(() => getNavigatorLocks()).toThrowError(
25+
'Navigator locks are not available in an insecure context. Use a secure context such as HTTPS or http://localhost.'
26+
);
2627
});
2728
});

packages/web/tests/src/db/AbstractPowerSyncDatabase.test.ts

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,42 @@
11
import { describe, it, expect, vi } from 'vitest';
2-
import { AbstractPowerSyncDatabase, DEFAULT_RETRY_DELAY_MS, DEFAULT_CRUD_UPLOAD_THROTTLE_MS, BucketStorageAdapter, DBAdapter, PowerSyncBackendConnector, PowerSyncDatabaseOptionsWithSettings, RequiredAdditionalConnectionOptions, StreamingSyncImplementation } from '@powersync/common';
2+
import {
3+
AbstractPowerSyncDatabase,
4+
DEFAULT_RETRY_DELAY_MS,
5+
DEFAULT_CRUD_UPLOAD_THROTTLE_MS,
6+
BucketStorageAdapter,
7+
DBAdapter,
8+
PowerSyncBackendConnector,
9+
PowerSyncDatabaseOptionsWithSettings,
10+
RequiredAdditionalConnectionOptions,
11+
StreamingSyncImplementation
12+
} from '@powersync/common';
313
import { testSchema } from '../../utils/testDb';
414

515
class TestPowerSyncDatabase extends AbstractPowerSyncDatabase {
616
protected openDBAdapter(options: PowerSyncDatabaseOptionsWithSettings): DBAdapter {
7-
return {} as any
17+
return {} as any;
818
}
9-
protected generateSyncStreamImplementation(connector: PowerSyncBackendConnector, options: RequiredAdditionalConnectionOptions): StreamingSyncImplementation {
19+
protected generateSyncStreamImplementation(
20+
connector: PowerSyncBackendConnector,
21+
options: RequiredAdditionalConnectionOptions
22+
): StreamingSyncImplementation {
1023
return undefined as any;
1124
}
1225
protected generateBucketStorageAdapter(): BucketStorageAdapter {
1326
return {
1427
init: vi.fn()
15-
} as any
28+
} as any;
1629
}
1730
_initialize(): Promise<void> {
1831
return Promise.resolve();
1932
}
2033

2134
get database() {
2235
return {
23-
get: vi.fn().mockResolvedValue({ version: '0.3.0'}),
36+
get: vi.fn().mockResolvedValue({ version: '0.3.0' }),
2437
execute: vi.fn(),
25-
refreshSchema: vi.fn(),
26-
} as any
38+
refreshSchema: vi.fn()
39+
} as any;
2740
}
2841
// Expose protected method for testing
2942
public testResolvedConnectionOptions(options?: any) {

packages/web/tests/src/db/PowersyncDatabase.test.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('PowerSyncDatabase', () => {
1010

1111
beforeEach(() => {
1212
mockLogger = {
13-
debug: vi.fn(),
13+
debug: vi.fn()
1414
};
1515

1616
// Initialize with minimal required options
@@ -24,8 +24,7 @@ describe('PowerSyncDatabase', () => {
2424

2525
vi.spyOn(db as any, 'runExclusive').mockImplementation((cb: any) => cb());
2626

27-
vi.spyOn(AbstractPowerSyncDatabase.prototype, 'connect')
28-
.mockResolvedValue(undefined);
27+
vi.spyOn(AbstractPowerSyncDatabase.prototype, 'connect').mockResolvedValue(undefined);
2928
});
3029

3130
afterEach(() => {
@@ -49,17 +48,14 @@ describe('PowerSyncDatabase', () => {
4948
connectionMethod: SyncStreamConnectionMethod.HTTP
5049
});
5150

52-
expect(AbstractPowerSyncDatabase.prototype.connect).toHaveBeenCalledWith(
53-
mockConnector,
54-
{
55-
retryDelayMs: 1000,
56-
crudUploadThrottleMs: 2000,
57-
connectionMethod: "http",
58-
params: {
59-
param1: 1,
60-
},
51+
expect(AbstractPowerSyncDatabase.prototype.connect).toHaveBeenCalledWith(mockConnector, {
52+
retryDelayMs: 1000,
53+
crudUploadThrottleMs: 2000,
54+
connectionMethod: 'http',
55+
params: {
56+
param1: 1
6157
}
62-
);
58+
});
6359
});
6460
});
6561
});

0 commit comments

Comments
 (0)