@dabble/patches 0.2.22 → 0.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,7 @@ export * from './webrtc/WebRTCTransport.js';
8
8
  export * from './websocket/AuthorizationProvider.js';
9
9
  export * from './websocket/onlineState.js';
10
10
  export * from './websocket/PatchesWebSocket.js';
11
+ export * from './websocket/RPCServer.js';
11
12
  export * from './websocket/SignalingService.js';
12
13
  export * from './websocket/WebSocketServer.js';
13
14
  export * from './websocket/WebSocketTransport.js';
package/dist/net/index.js CHANGED
@@ -6,6 +6,7 @@ export * from './webrtc/WebRTCTransport.js';
6
6
  export * from './websocket/AuthorizationProvider.js';
7
7
  export * from './websocket/onlineState.js';
8
8
  export * from './websocket/PatchesWebSocket.js';
9
+ export * from './websocket/RPCServer.js';
9
10
  export * from './websocket/SignalingService.js';
10
11
  export * from './websocket/WebSocketServer.js';
11
12
  export * from './websocket/WebSocketTransport.js';
@@ -3,7 +3,6 @@ import type { PatchesHistoryManager } from '../../server/PatchesHistoryManager.j
3
3
  import type { PatchesServer } from '../../server/PatchesServer.js';
4
4
  import type { Change, EditableVersionMetadata, ListChangesOptions, ListVersionsOptions } from '../../types.js';
5
5
  import { JSONRPCServer } from '../protocol/JSONRPCServer.js';
6
- import type { ServerTransport } from '../protocol/types.js';
7
6
  import type { AuthContext, AuthorizationProvider } from './AuthorizationProvider.js';
8
7
  /**
9
8
  * High-level client for the Patches real-time collaboration service.
@@ -11,7 +10,6 @@ import type { AuthContext, AuthorizationProvider } from './AuthorizationProvider
11
10
  * versioning, and other OT-specific functionality over a JSON RPC interface.
12
11
  */
13
12
  export interface RPCServerOptions {
14
- transport: ServerTransport;
15
13
  patches: PatchesServer;
16
14
  history?: PatchesHistoryManager;
17
15
  branches?: PatchesBranchManager;
@@ -113,8 +111,8 @@ export declare class RPCServer {
113
111
  branchId: string;
114
112
  }, ctx?: AuthContext): Promise<Change[]>;
115
113
  protected assertAccess(ctx: AuthContext | undefined, docId: string, kind: 'read' | 'write', method: string, params?: Record<string, any>): Promise<void>;
116
- protected assertRead(ctx: AuthContext | undefined, docId: string, method: string, params?: Record<string, any>): Promise<void>;
117
- protected assertWrite(ctx: AuthContext | undefined, docId: string, method: string, params?: Record<string, any>): Promise<void>;
114
+ assertRead(ctx: AuthContext | undefined, docId: string, method: string, params?: Record<string, any>): Promise<void>;
115
+ assertWrite(ctx: AuthContext | undefined, docId: string, method: string, params?: Record<string, any>): Promise<void>;
118
116
  protected assertHistoryEnabled(): void;
119
117
  protected assertBranchingEnabled(): void;
120
118
  }
@@ -1,4 +1,4 @@
1
- import type { Branch, Change, EditableVersionMetadata, ListChangesOptions, ListVersionsOptions, VersionMetadata } from '../types';
1
+ import type { Branch, Change, EditableVersionMetadata, ListChangesOptions, ListVersionsOptions, PatchesState, VersionMetadata } from '../types';
2
2
  /**
3
3
  * Interface for a backend storage system for patch synchronization.
4
4
  * Defines methods needed by PatchesServer, PatchesHistoryManager, etc.
@@ -8,6 +8,10 @@ export interface PatchesStoreBackend {
8
8
  saveChanges(docId: string, changes: Change[]): Promise<void>;
9
9
  /** Lists committed server changes based on revision numbers. */
10
10
  listChanges(docId: string, options: ListChangesOptions): Promise<Change[]>;
11
+ /** Loads the last version state for a document. Optional method for performance. */
12
+ loadLastVersionState?: (docId: string) => Promise<PatchesState | undefined>;
13
+ /** Saves the last version state for a document. Optional method for performance. */
14
+ saveLastVersionState?: (docId: string, rev: number, state: any) => Promise<void>;
11
15
  /**
12
16
  * Saves version metadata, its state snapshot, and the original changes that constitute it.
13
17
  * State and changes are stored separately from the core metadata.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dabble/patches",
3
- "version": "0.2.22",
3
+ "version": "0.2.23",
4
4
  "description": "Immutable JSON Patch implementation based on RFC 6902 supporting operational transformation and last-writer-wins",
5
5
  "author": "Jacob Wright <jacwright@gmail.com>",
6
6
  "bugs": {