Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat: fix private prefix

DarkSky1a43ce4d0224
diff --git a/libs/datasource/jwt/src/adapter/yjs/binary.ts b/libs/datasource/jwt/src/adapter/yjs/binary.ts
index 5c677a4f51..468710ac4a 100644
--- a/libs/datasource/jwt/src/adapter/yjs/binary.ts
+++ b/libs/datasource/jwt/src/adapter/yjs/binary.ts
@@ -3,8 +3,8 @@ import { Array as YArray, Map as YMap } from 'yjs';
import { RemoteKvService } from '@toeverything/datasource/remote-kv';
export class YjsRemoteBinaries {
- readonly _binaries: YMap<YArray<ArrayBuffer>>; // binary instance
- readonly _remoteStorage?: RemoteKvService;
+ private readonly _binaries: YMap<YArray<ArrayBuffer>>; // binary instance
+ private readonly _remoteStorage?: RemoteKvService;
constructor(binaries: YMap<YArray<ArrayBuffer>>, remote_token?: string) {
this._binaries = binaries;
diff --git a/libs/datasource/jwt/src/adapter/yjs/block.ts b/libs/datasource/jwt/src/adapter/yjs/block.ts
index ad60aa31e0..1f49ad0ed1 100644
--- a/libs/datasource/jwt/src/adapter/yjs/block.ts
+++ b/libs/datasource/jwt/src/adapter/yjs/block.ts
@@ -32,19 +32,21 @@ type YjsBlockInstanceProps = {
};
export class YjsBlockInstance implements BlockInstance<YjsContentOperation> {
- readonly _id: string;
- readonly _block: YMap<unknown>;
- readonly _binary?: YArray<ArrayBuffer>;
- readonly _children: YArray<string>;
- readonly _setBlock: (
+ private readonly _id: string;
+ private readonly _block: YMap<unknown>;
+ private readonly _binary?: YArray<ArrayBuffer>;
+ private readonly _children: YArray<string>;
+ private readonly _setBlock: (
id: string,
block: BlockItem<YjsContentOperation>
) => Promise<void>;
- readonly _getUpdated: (id: string) => number | undefined;
- readonly _getCreator: (id: string) => string | undefined;
- readonly _getBlockInstance: (id: string) => YjsBlockInstance | undefined;
- readonly _childrenListeners: Map<string, BlockListener>;
- readonly _contentListeners: Map<string, BlockListener>;
+ private readonly _getUpdated: (id: string) => number | undefined;
+ private readonly _getCreator: (id: string) => string | undefined;
+ private readonly _getBlockInstance: (
+ id: string
+ ) => YjsBlockInstance | undefined;
+ private readonly _childrenListeners: Map<string, BlockListener>;
+ private readonly _contentListeners: Map<string, BlockListener>;
// eslint-disable-next-line @typescript-eslint/naming-convention
_childrenMap: Map<string, number>;
diff --git a/libs/datasource/jwt/src/adapter/yjs/gatekeeper.ts b/libs/datasource/jwt/src/adapter/yjs/gatekeeper.ts
index 1ee3e93ca3..7e02c5a09e 100644
--- a/libs/datasource/jwt/src/adapter/yjs/gatekeeper.ts
+++ b/libs/datasource/jwt/src/adapter/yjs/gatekeeper.ts
@@ -1,10 +1,9 @@
import { Map as YMap } from 'yjs';
export class GateKeeper {
- // eslint-disable-next-line @typescript-eslint/naming-convention
- _userId: string;
- _creators: YMap<string>;
- _common: YMap<string>;
+ private readonly _userId: string;
+ private readonly _creators: YMap<string>;
+ private readonly _common: YMap<string>;
constructor(userId: string, creators: YMap<string>, common: YMap<string>) {
this._userId = userId;
diff --git a/libs/datasource/jwt/src/adapter/yjs/history.ts b/libs/datasource/jwt/src/adapter/yjs/history.ts
index 34884a1150..6739cf9a50 100644
--- a/libs/datasource/jwt/src/adapter/yjs/history.ts
+++ b/libs/datasource/jwt/src/adapter/yjs/history.ts
@@ -5,10 +5,10 @@ import { HistoryCallback, HistoryManager } from '../../adapter';
type StackItem = UndoManager['undoStack'][0];
export class YjsHistoryManager implements HistoryManager {
- readonly _blocks: YMap<any>;
- readonly _historyManager: UndoManager;
- readonly _pushListeners: Map<string, HistoryCallback<any>>;
- readonly _popListeners: Map<string, HistoryCallback<any>>;
+ private readonly _blocks: YMap<any>;
+ private readonly _historyManager: UndoManager;
+ private readonly _pushListeners: Map<string, HistoryCallback<any>>;
+ private readonly _popListeners: Map<string, HistoryCallback<any>>;
constructor(scope: YMap<any>, tracker?: any[]) {
this._blocks = scope;
diff --git a/libs/datasource/jwt/src/adapter/yjs/index.ts b/libs/datasource/jwt/src/adapter/yjs/index.ts
index 1a0a637859..eb886afae5 100644
--- a/libs/datasource/jwt/src/adapter/yjs/index.ts
+++ b/libs/datasource/jwt/src/adapter/yjs/index.ts
@@ -178,22 +178,22 @@ export type YjsInitOptions = {
};
export class YjsAdapter implements AsyncDatabaseAdapter<YjsContentOperation> {
- readonly _provider: YjsProviders;
- readonly _doc: Doc; // doc instance
- readonly _awareness: Awareness; // lightweight state synchronization
- readonly _gatekeeper: GateKeeper; // Simple access control
- readonly _history: YjsHistoryManager;
+ private readonly _provider: YjsProviders;
+ private readonly _doc: Doc; // doc instance
+ private readonly _awareness: Awareness; // lightweight state synchronization
+ private readonly _gatekeeper: GateKeeper; // Simple access control
+ private readonly _history: YjsHistoryManager;
// Block Collection
// key is a randomly generated global id
- readonly _blocks: YMap<YMap<unknown>>;
- readonly _blockUpdated: YMap<number>;
+ private readonly _blocks: YMap<YMap<unknown>>;
+ private readonly _blockUpdated: YMap<number>;
// Maximum cache Block 1024, ttl 10 minutes
- readonly _blockCaches: LRUCache<string, YjsBlockInstance>;
+ private readonly _blockCaches: LRUCache<string, YjsBlockInstance>;
- readonly _binaries: YjsRemoteBinaries;
+ private readonly _binaries: YjsRemoteBinaries;
- readonly _listener: Map<string, BlockListener<any>>;
+ private readonly _listener: Map<string, BlockListener<any>>;
static async init(
workspace: string,
diff --git a/libs/datasource/jwt/src/adapter/yjs/operation.ts b/libs/datasource/jwt/src/adapter/yjs/operation.ts
index e4b2da50dd..a8dfdaffa4 100644
--- a/libs/datasource/jwt/src/adapter/yjs/operation.ts
+++ b/libs/datasource/jwt/src/adapter/yjs/operation.ts
@@ -52,7 +52,7 @@ function auto_set(root: ContentOperation, key: string, data: BaseTypes): void {
}
export class YjsContentOperation implements ContentOperation {
- readonly _content: YAbstractType<unknown>;
+ private readonly _content: YAbstractType<unknown>;
constructor(content: YAbstractType<any>) {
this._content = content;
@@ -197,7 +197,7 @@ export class YjsContentOperation implements ContentOperation {
}
class YjsTextOperation extends YjsContentOperation implements TextOperation {
- readonly _textContent: YText;
+ private readonly _textContent: YText;
constructor(content: YText) {
super(content);
@@ -241,8 +241,8 @@ class YjsArrayOperation<T extends ContentTypes>
extends YjsContentOperation
implements ArrayOperation<T>
{
- readonly _arrayContent: YArray<T>;
- readonly _listeners: Map<string, BlockListener>;
+ private readonly _arrayContent: YArray<T>;
+ private readonly _listeners: Map<string, BlockListener>;
constructor(content: YArray<T>) {
super(content);
@@ -344,8 +344,8 @@ class YjsMapOperation<T extends ContentTypes>
extends YjsContentOperation
implements MapOperation<T>
{
- readonly _mapContent: YMap<T>;
- readonly _listeners: Map<string, BlockListener>;
+ private readonly _mapContent: YMap<T>;
+ private readonly _listeners: Map<string, BlockListener>;
constructor(content: YMap<T>) {
super(content);
diff --git a/libs/datasource/jwt/src/block/abstract.ts b/libs/datasource/jwt/src/block/abstract.ts
index 9d675ee803..29ee655dc2 100644
--- a/libs/datasource/jwt/src/block/abstract.ts
+++ b/libs/datasource/jwt/src/block/abstract.ts
@@ -26,11 +26,11 @@ export class AbstractBlock<
B extends BlockInstance<C>,
C extends ContentOperation
> {
- readonly _id: string;
+ private readonly _id: string;
readonly #block: BlockInstance<C>;
- readonly _history: HistoryManager;
- readonly _root?: AbstractBlock<B, C>;
- readonly _parentListener: Map<string, BlockListener>;
+ private readonly _history: HistoryManager;
+ private readonly _root?: AbstractBlock<B, C>;
+ private readonly _parentListener: Map<string, BlockListener>;
_parent?: AbstractBlock<B, C>;
diff --git a/libs/datasource/jwt/src/block/base.ts b/libs/datasource/jwt/src/block/base.ts
index cf79c08ea7..72183187b1 100644
--- a/libs/datasource/jwt/src/block/base.ts
+++ b/libs/datasource/jwt/src/block/base.ts
@@ -51,19 +51,19 @@ export class BaseBlock<
B extends BlockInstance<C>,
C extends ContentOperation
> extends AbstractBlock<B, C> {
- readonly _exporters?: Exporters;
- readonly _contentExportersGetter: () => Map<
+ private readonly _exporters?: Exporters;
+ private readonly _contentExportersGetter: () => Map<
string,
ReadableContentExporter<string, any>
>;
- readonly _metadataExportersGetter: () => Map<
+ private readonly _metadataExportersGetter: () => Map<
string,
ReadableContentExporter<
Array<[string, number | string | string[]]>,
any
>
>;
- readonly _tagExportersGetter: () => Map<
+ private readonly _tagExportersGetter: () => Map<
string,
ReadableContentExporter<string[], any>
>;
diff --git a/libs/datasource/jwt/src/block/indexer.ts b/libs/datasource/jwt/src/block/indexer.ts
index 39dd52c4e0..d9ecde1658 100644
--- a/libs/datasource/jwt/src/block/indexer.ts
+++ b/libs/datasource/jwt/src/block/indexer.ts
@@ -107,18 +107,18 @@ export class BlockIndexer<
B extends BlockInstance<C>,
C extends ContentOperation
> {
- readonly _adapter: A;
- readonly _idb: BlockIdbInstance;
+ private readonly _adapter: A;
+ private readonly _idb: BlockIdbInstance;
- readonly _blockIndexer: DocumentIndexer<IndexMetadata>;
- readonly _blockMetadata: LRUCache<string, QueryMetadata>;
- readonly _eventBus: BlockEventBus;
+ private readonly _blockIndexer: DocumentIndexer<IndexMetadata>;
+ private readonly _blockMetadata: LRUCache<string, QueryMetadata>;
+ private readonly _eventBus: BlockEventBus;
- readonly _blockBuilder: (
+ private readonly _blockBuilder: (
block: BlockInstance<C>
) => Promise<BaseBlock<B, C>>;
- readonly _delayIndex: { documents: Map<string, BaseBlock<B, C>> };
+ private readonly _delayIndex: { documents: Map<string, BaseBlock<B, C>> };
constructor(
adapter: A,
diff --git a/libs/datasource/jwt/src/index.ts b/libs/datasource/jwt/src/index.ts
index 343f1f79ad..6ced321c2c 100644
--- a/libs/datasource/jwt/src/index.ts
+++ b/libs/datasource/jwt/src/index.ts
@@ -69,14 +69,14 @@ export class BlockClient<
B extends BlockInstance<C>,
C extends ContentOperation
> {
- readonly _adapter: A;
- readonly _workspace: string;
+ private readonly _adapter: A;
+ private readonly _workspace: string;
// Maximum cache Block 8192, ttl 30 minutes
- readonly _blockCaches: LRUCache<string, BaseBlock<B, C>>;
- readonly _blockIndexer: BlockIndexer<A, B, C>;
+ private readonly _blockCaches: LRUCache<string, BaseBlock<B, C>>;
+ private readonly _blockIndexer: BlockIndexer<A, B, C>;
- readonly _exporters: {
+ private readonly _exporters: {
readonly content: BlockExporters<string>;
readonly metadata: BlockExporters<
Array<[string, number | string | string[]]>
@@ -84,12 +84,12 @@ export class BlockClient<
readonly tag: BlockExporters<string[]>;
};
- readonly _eventBus: BlockEventBus;
+ private readonly _eventBus: BlockEventBus;
- readonly _parentMapping: Map<string, string[]>;
- readonly _pageMapping: Map<string, string>;
+ private readonly _parentMapping: Map<string, string[]>;
+ private readonly _pageMapping: Map<string, string>;
- readonly _root: { node?: BaseBlock<B, C> };
+ private readonly _root: { node?: BaseBlock<B, C> };
private constructor(
adapter: A,
diff --git a/libs/datasource/jwt/src/utils/event-bus.ts b/libs/datasource/jwt/src/utils/event-bus.ts
index 9d128049e7..50f5363390 100644
--- a/libs/datasource/jwt/src/utils/event-bus.ts
+++ b/libs/datasource/jwt/src/utils/event-bus.ts
@@ -7,9 +7,9 @@ declare const JWT_DEV: boolean;
const logger = getLogger('BlockDB:event_bus');
export class BlockEventBus {
- readonly _eventBus: EventTarget;
- readonly _eventCallbackCache: Map<string, any>;
- readonly _scopedCache: Map<string, BlockScopedEventBus<any>>;
+ private readonly _eventBus: EventTarget;
+ private readonly _eventCallbackCache: Map<string, any>;
+ private readonly _scopedCache: Map<string, BlockScopedEventBus<any>>;
constructor(event_bus?: EventTarget) {
this._eventBus = event_bus || new EventTarget();
@@ -68,7 +68,7 @@ type ListenerOptions = {
};
class BlockScopedEventBus<T> extends BlockEventBus {
- readonly _topic: string;
+ private readonly _topic: string;
constructor(topic: string, event_bus?: EventTarget) {
super(event_bus);