File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
packages/epicenter/src/providers/persistence Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 11import { mkdirSync } from 'node:fs' ;
22import { join } from 'node:path' ;
33import * as Y from 'yjs' ;
4+ import type { Provider , ProviderContext } from '../../core/provider.node' ;
45import { defineProviderExports } from '../../core/provider.shared' ;
5- import type { Provider } from '../../core/provider.node ' ;
6+ import type { WorkspaceSchema } from '../../core/schema ' ;
67
78/** Debounce delay for filesystem writes (ms) */
89const DEBOUNCE_MS = 100 ;
@@ -64,7 +65,11 @@ const DEBOUNCE_MS = 100;
6465 * });
6566 * ```
6667 */
67- export const setupPersistence = ( async ( { id, ydoc, epicenterDir } ) => {
68+ export const setupPersistence = ( async < TSchema extends WorkspaceSchema > ( {
69+ id,
70+ ydoc,
71+ epicenterDir,
72+ } : ProviderContext < TSchema > ) => {
6873 if ( ! epicenterDir ) {
6974 throw new Error (
7075 'Persistence provider requires Bun environment with filesystem access' ,
Original file line number Diff line number Diff line change 11import { IndexeddbPersistence } from 'y-indexeddb' ;
2- import type { Provider } from '../../core/provider.browser' ;
2+ import type { Provider , ProviderContext } from '../../core/provider.browser' ;
3+ import type { WorkspaceSchema } from '../../core/schema' ;
34
45/**
56 * YJS document persistence provider using IndexedDB.
@@ -88,7 +89,9 @@ import type { Provider } from '../../core/provider.browser';
8889 *
8990 * @see {@link setupPersistence } from `@epicenter/hq/persistence/desktop` for Node.js/filesystem version
9091 */
91- export const setupPersistence = ( ( { ydoc } ) => {
92+ export const setupPersistence = ( < TSchema extends WorkspaceSchema > ( {
93+ ydoc,
94+ } : ProviderContext < TSchema > ) => {
9295 // y-indexeddb handles both loading and saving automatically
9396 // Uses the YDoc's guid as the IndexedDB database name
9497 const persistence = new IndexeddbPersistence ( ydoc . guid , ydoc ) ;
You can’t perform that action at this time.
0 commit comments