Skip to content

Commit 238391b

Browse files
ci: apply automated fixes
1 parent 0c4910f commit 238391b

2 files changed

Lines changed: 27 additions & 24 deletions

File tree

packages/db-sqlite-persisted-collection-core/src/persisted.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,10 @@ export interface PersistenceAdapter<
187187
options: LoadSubsetOptions,
188188
ctx?: { requiredIndexSignatures?: ReadonlyArray<string> },
189189
) => Promise<Array<{ key: TKey; value: T }>>
190-
applyCommittedTx: (collectionId: string, tx: PersistedTx<T, TKey>) => Promise<void>
190+
applyCommittedTx: (
191+
collectionId: string,
192+
tx: PersistedTx<T, TKey>,
193+
) => Promise<void>
191194
ensureIndex: (
192195
collectionId: string,
193196
signature: string,
@@ -391,10 +394,7 @@ function validatePersistenceAdapter<
391394
}
392395
}
393396

394-
function resolvePersistence<
395-
T extends object,
396-
TKey extends string | number,
397-
>(
397+
function resolvePersistence<T extends object, TKey extends string | number>(
398398
persistence: PersistedCollectionPersistence<T, TKey>,
399399
): PersistedResolvedPersistence<T, TKey> {
400400
validatePersistenceAdapter(persistence.adapter)
@@ -437,7 +437,11 @@ function createLoopbackSync<T extends object, TKey extends string | number>() {
437437
syncControls.begin = params.begin
438438
syncControls.write = params.write as SyncControlFns<T, TKey>[`write`]
439439
syncControls.commit = params.commit
440-
collection = params.collection as Collection<T, TKey, PersistedCollectionUtils>
440+
collection = params.collection as Collection<
441+
T,
442+
TKey,
443+
PersistedCollectionUtils
444+
>
441445
params.markReady()
442446
return () => {}
443447
},
@@ -529,8 +533,7 @@ export function persistedCollectionOptions<
529533
}
530534
}
531535

532-
const localOnlyOptions =
533-
options
536+
const localOnlyOptions = options
534537
const loopbackSync = createLoopbackSync<T, TKey>()
535538
const collectionId =
536539
localOnlyOptions.id ?? `persisted-collection:${crypto.randomUUID()}`

packages/db-sqlite-persisted-collection-core/tests/persisted.test-d.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { describe, expectTypeOf, it } from 'vitest'
22
import { createCollection } from '@tanstack/db'
33
import { persistedCollectionOptions } from '../src'
4-
import type {
5-
PersistedCollectionUtils,
6-
PersistenceAdapter,
7-
} from '../src'
4+
import type { PersistedCollectionUtils, PersistenceAdapter } from '../src'
85
import type { SyncConfig, UtilsRecord } from '@tanstack/db'
96

107
type Todo = {
@@ -63,19 +60,22 @@ describe(`persisted collection types`, () => {
6360
},
6461
}
6562

66-
const options = persistedCollectionOptions<Todo, string, never, SyncExtraUtils>(
67-
{
68-
id: `persisted-sync-present`,
69-
getKey: (item) => item.id,
70-
sync,
71-
utils: {
72-
refetch: async () => {},
73-
},
74-
persistence: {
75-
adapter,
76-
},
63+
const options = persistedCollectionOptions<
64+
Todo,
65+
string,
66+
never,
67+
SyncExtraUtils
68+
>({
69+
id: `persisted-sync-present`,
70+
getKey: (item) => item.id,
71+
sync,
72+
utils: {
73+
refetch: async () => {},
74+
},
75+
persistence: {
76+
adapter,
7777
},
78-
)
78+
})
7979

8080
expectTypeOf(options.sync).toEqualTypeOf<SyncConfig<Todo, string>>()
8181
expectTypeOf(options.utils).toEqualTypeOf<SyncExtraUtils | undefined>()

0 commit comments

Comments
 (0)