Skip to content

Commit 489ab0c

Browse files
committed
chore: add collaboration-yjs TS project reference for CI-stable superdoc build
1 parent eb54f2c commit 489ab0c

20 files changed

Lines changed: 206 additions & 2 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { SuperDocCollaboration } from './collaboration/index.js';
2+
import type { AutoSaveFn, AuthenticateFn, BeforeChangeFn, ChangeFn, ConfigureFn, Extension, LoadFn } from './types.js';
3+
export declare class CollaborationBuilder {
4+
#private;
5+
withName(name: string): this;
6+
withDocumentExpiryMs(ms: number): this;
7+
withDebounce(ms: number): this;
8+
onConfigure(userFunction: ConfigureFn): this;
9+
onAuthenticate(userFunction: AuthenticateFn): this;
10+
onLoad(userFunction: LoadFn): this;
11+
onAutoSave(userFunction: AutoSaveFn): this;
12+
onBeforeChange(userFunction: BeforeChangeFn): this;
13+
onChange(userFunction: ChangeFn): this;
14+
useExtensions(exts: Extension[]): this;
15+
build(): SuperDocCollaboration;
16+
}
17+
//# sourceMappingURL=builder.d.ts.map
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { DocumentManager } from '../document-manager/manager.js';
2+
import type { CollaborationWebSocket, ServiceConfig, SocketRequest } from '../types/service-types.js';
3+
export declare class SuperDocCollaboration {
4+
#private;
5+
readonly config: ServiceConfig;
6+
readonly documentManager: DocumentManager;
7+
constructor(config: ServiceConfig);
8+
get name(): string;
9+
welcome(socket: CollaborationWebSocket, request: SocketRequest): Promise<void>;
10+
has(documentId: string): boolean;
11+
}
12+
//# sourceMappingURL=collaboration.d.ts.map
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import type { CollaborationParams, SocketRequest } from '../types/service-types.js';
2+
import type { SuperDocCollaboration } from './collaboration.js';
3+
export declare const generateParams: (request: SocketRequest, instance?: SuperDocCollaboration) => CollaborationParams;
4+
export declare function parseCookie(rawCookie?: string): Record<string, string>;
5+
//# sourceMappingURL=helpers.d.ts.map
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './collaboration.js';
2+
//# sourceMappingURL=index.d.ts.map
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import type { CollaborationParams, CollaborationWebSocket, Hooks, SocketRequest } from '../types/service-types.js';
2+
import type { DocumentManager } from '../document-manager/manager.js';
3+
interface ConnectionHandlerConfig {
4+
documentManager: DocumentManager;
5+
hooks?: Hooks;
6+
}
7+
/**
8+
* Handles WebSocket connections for collaborative document editing.
9+
* This class manages the connection lifecycle, including authentication,
10+
* setting up the document, and handling incoming messages.
11+
* It also provides methods to close the connection gracefully.
12+
*/
13+
export declare class ConnectionHandler {
14+
#private;
15+
documentManager: DocumentManager;
16+
constructor({ documentManager, hooks }: ConnectionHandlerConfig);
17+
handle(
18+
socket: CollaborationWebSocket,
19+
request: SocketRequest,
20+
params: CollaborationParams
21+
): Promise<CollaborationParams>;
22+
hangUp(socket: CollaborationWebSocket, errorMessage: string, code?: number): void;
23+
}
24+
export {};
25+
//# sourceMappingURL=handler.d.ts.map
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './handler.js';
2+
//# sourceMappingURL=index.d.ts.map
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './manager.js';
2+
//# sourceMappingURL=index.d.ts.map
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { SharedSuperDoc } from '../shared-doc/index.js';
2+
import type { CollaborationParams, CollaborationWebSocket, ServiceConfig } from '../types/service-types.js';
3+
/**
4+
* DocumentManager is responsible for managing Yjs documents.
5+
* It handles document retrieval and debouncing updates.
6+
*/
7+
export declare class DocumentManager {
8+
#private;
9+
debounceMs: number;
10+
constructor(config: ServiceConfig);
11+
get(documentId: string): SharedSuperDoc | null;
12+
getDocument(documentId: string, userParams: CollaborationParams): Promise<SharedSuperDoc>;
13+
releaseConnection(documentId: string, socket: CollaborationWebSocket): void;
14+
has(documentId: string): boolean;
15+
}
16+
//# sourceMappingURL=manager.d.ts.map
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export { CollaborationBuilder } from './builder.js';
2+
export { SuperDocCollaboration } from './collaboration/index.js';
3+
export type {
4+
CollaborationParams,
5+
CollaborationWebSocket,
6+
SocketRequest,
7+
UserContext,
8+
ServiceConfig,
9+
Hooks,
10+
ConfigureFn,
11+
AuthenticateFn,
12+
LoadFn,
13+
BeforeChangeFn,
14+
ChangeFn,
15+
AutoSaveFn,
16+
} from './types/service-types.js';
17+
//# sourceMappingURL=index.d.ts.map
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
declare const COLORS: {
2+
ConnectionHandler: string;
3+
DocumentManager: string;
4+
SuperDocCollaboration: string;
5+
reset: string;
6+
};
7+
export type Logger = (...args: unknown[]) => void;
8+
export declare function createLogger(label: keyof typeof COLORS | string): Logger;
9+
export {};
10+
//# sourceMappingURL=logger.d.ts.map

0 commit comments

Comments
 (0)