Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
EYHN committed Jan 2, 2025
1 parent e507948 commit f606157
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 779 deletions.
2 changes: 1 addition & 1 deletion packages/common/nbstore/src/impls/sqlite/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface SqliteNativeDBOptions {
readonly id: string;
}

type NativeDBApis = {
export type NativeDBApis = {
connect: (id: string) => Promise<void>;
close: (id: string) => Promise<void>;
pushDocUpdate: (id: string, update: DocUpdate) => Promise<DocClock>;
Expand Down
2 changes: 1 addition & 1 deletion packages/common/nbstore/src/impls/sqlite/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './blob';
export * from './doc';
export * from './sync';
export { bindNativeDBApis } from './db';
export { bindNativeDBApis, type NativeDBApis } from './db';
24 changes: 23 additions & 1 deletion packages/frontend/apps/ios/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ import { PopupWindowProvider } from '@affine/core/modules/url';
import { ClientSchemeProvider } from '@affine/core/modules/url/providers/client-schema';
import { configureIndexedDBUserspaceStorageProvider } from '@affine/core/modules/userspace';
import { configureBrowserWorkbenchModule } from '@affine/core/modules/workbench';
import { WorkspacesService } from '@affine/core/modules/workspace';
import {
WorkspaceEngineWorkerProvider,
WorkspacesService,
} from '@affine/core/modules/workspace';
import {
configureBrowserWorkspaceFlavours,
configureIndexedDBWorkspaceEngineStorageProvider,
Expand Down Expand Up @@ -55,6 +58,8 @@ import { Cookie } from './plugins/cookie';
import { Hashcash } from './plugins/hashcash';
import { Intelligents } from './plugins/intelligents';
import { enableNavigationGesture$ } from './web-navigation-control';
import { WorkerClient } from '@affine/nbstore/worker/client';
import { OpClient } from '@toeverything/infra/op';

const future = {
v7_startTransition: true,
Expand All @@ -68,6 +73,23 @@ configureBrowserWorkspaceFlavours(framework);
configureIndexedDBWorkspaceEngineStorageProvider(framework);
configureIndexedDBUserspaceStorageProvider(framework);
configureMobileModules(framework);
framework.impl(WorkspaceEngineWorkerProvider, {
openWorker(options) {
const worker = new Worker(
new URL(
/* webpackChunkName: "nbstore-worker" */ './worker.ts',
import.meta.url
)
);
const client = new WorkerClient(new OpClient(worker), options);
return {
client,
dispose: () => {
worker.terminate();
},
};
},
});
framework.impl(PopupWindowProvider, {
open: (url: string) => {
Browser.open({
Expand Down
33 changes: 0 additions & 33 deletions packages/frontend/apps/ios/src/plugins/nbstore/blob.ts

This file was deleted.

60 changes: 0 additions & 60 deletions packages/frontend/apps/ios/src/plugins/nbstore/db.ts

This file was deleted.

83 changes: 0 additions & 83 deletions packages/frontend/apps/ios/src/plugins/nbstore/doc.ts

This file was deleted.

128 changes: 0 additions & 128 deletions packages/frontend/apps/ios/src/plugins/nbstore/handlers.ts

This file was deleted.

20 changes: 16 additions & 4 deletions packages/frontend/apps/ios/src/plugins/nbstore/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
import { registerPlugin } from '@capacitor/core';
import { type NativeDBApis } from '@affine/nbstore/sqlite';

import type { NbStorePlugin } from './definitions';
import type {
DocUpdate,
DocClock,
DocRecord,
DocClocks,
BlobRecord,
ListedBlobRecord,
} from '@affine/nbstore';
import { uint8ArrayToBase64 } from '@affine/core/modules/workspace-engine';

export * from './definitions';
export { nbstoreHandlers } from './handlers';
export { NbStoreDocStorage } from './plugin';
export * from './storage';
export { universalId } from '@affine/nbstore';

export const NbStore = registerPlugin<NbStorePlugin>('NbStoreDocStorage');
Loading

0 comments on commit f606157

Please sign in to comment.