mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-18 14:56:59 +08:00
feat(storage): binding jwst storage to node (#2808)
This commit is contained in:
52
packages/storage/index.d.ts
vendored
Normal file
52
packages/storage/index.d.ts
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/* auto-generated by NAPI-RS */
|
||||
/* eslint-disable */
|
||||
|
||||
export class Doc {
|
||||
get guid(): string;
|
||||
}
|
||||
|
||||
export class Storage {
|
||||
/** Create a storage instance and establish connection to persist store. */
|
||||
static connect(
|
||||
database: string,
|
||||
debugOnlyAutoMigrate?: boolean | undefined | null
|
||||
): Promise<Storage>;
|
||||
/** Get a workspace by id */
|
||||
getWorkspace(workspaceId: string): Promise<Workspace | null>;
|
||||
/** Create a new workspace with a init update. */
|
||||
createWorkspace(workspaceId: string, init: Buffer): Promise<Workspace>;
|
||||
/** Delete a workspace. */
|
||||
deleteWorkspace(workspaceId: string): Promise<void>;
|
||||
/** Sync doc updates. */
|
||||
sync(workspaceId: string, guid: string, update: Buffer): Promise<void>;
|
||||
/** Sync doc update with doc guid encoded. */
|
||||
syncWithGuid(workspaceId: string, update: Buffer): Promise<void>;
|
||||
/** Load doc as update buffer. */
|
||||
load(guid: string): Promise<Buffer | null>;
|
||||
/** Fetch a workspace blob. */
|
||||
blob(workspaceId: string, name: string): Promise<Blob | null>;
|
||||
/** Upload a blob into workspace storage. */
|
||||
uploadBlob(workspaceId: string, blob: Buffer): Promise<string>;
|
||||
/** Workspace size taken by blobs. */
|
||||
blobsSize(workspaceId: string): Promise<number>;
|
||||
}
|
||||
|
||||
export class Workspace {
|
||||
get doc(): Doc;
|
||||
isEmpty(): boolean;
|
||||
get id(): string;
|
||||
get clientId(): string;
|
||||
search(query: string): Array<SearchResult>;
|
||||
}
|
||||
|
||||
export interface Blob {
|
||||
contentType: string;
|
||||
lastModified: string;
|
||||
size: number;
|
||||
data: Buffer;
|
||||
}
|
||||
|
||||
export interface SearchResult {
|
||||
blockId: string;
|
||||
score: number;
|
||||
}
|
||||
Reference in New Issue
Block a user