@dabble/patches 0.4.7 → 0.4.8

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.
@@ -1,16 +1,16 @@
1
1
  import { Signal } from '../event-signal.js';
2
- import { Patches } from '../client/Patches.js';
3
- import { PatchesStore } from '../client/PatchesStore.js';
4
- import { SyncingState, Change } from '../types.js';
5
2
  import { ConnectionState } from './protocol/types.js';
3
+ import { SyncingState, Change } from '../types.js';
4
+ import { JSONRPCClient } from './protocol/JSONRPCClient.js';
6
5
  import { PatchesWebSocket } from './websocket/PatchesWebSocket.js';
7
6
  import { WebSocketOptions } from './websocket/WebSocketTransport.js';
8
- import '../client/PatchesDoc.js';
7
+ import { Patches } from '../client/Patches.js';
8
+ import { PatchesStore } from '../client/PatchesStore.js';
9
9
  import '../json-patch/JSONPatch.js';
10
10
  import '@dabble/delta';
11
11
  import '../json-patch/types.js';
12
12
  import './PatchesClient.js';
13
- import './protocol/JSONRPCClient.js';
13
+ import '../client/PatchesDoc.js';
14
14
 
15
15
  interface PatchesSyncState {
16
16
  online: boolean;
@@ -48,6 +48,11 @@ declare class PatchesSync {
48
48
  * Gets the current sync state.
49
49
  */
50
50
  get state(): PatchesSyncState;
51
+ /**
52
+ * Gets the JSON-RPC client for making custom RPC calls.
53
+ * Useful for application-specific methods not part of the Patches protocol.
54
+ */
55
+ get rpc(): JSONRPCClient;
51
56
  /**
52
57
  * Updates the sync state.
53
58
  * @param update - The partial state to update.
@@ -52,6 +52,13 @@ class PatchesSync {
52
52
  get state() {
53
53
  return this._state;
54
54
  }
55
+ /**
56
+ * Gets the JSON-RPC client for making custom RPC calls.
57
+ * Useful for application-specific methods not part of the Patches protocol.
58
+ */
59
+ get rpc() {
60
+ return this.ws.rpc;
61
+ }
55
62
  /**
56
63
  * Updates the sync state.
57
64
  * @param update - The partial state to update.
@@ -4,6 +4,7 @@ export { PatchesSync, PatchesSyncOptions, PatchesSyncState } from './PatchesSync
4
4
  export { JSONRPCClient } from './protocol/JSONRPCClient.js';
5
5
  export { ConnectionSignalSubscriber, JSONRPCServer, MessageHandler } from './protocol/JSONRPCServer.js';
6
6
  export { AwarenessUpdateNotificationParams, ClientTransport, ConnectionState, JsonRpcNotification, JsonRpcRequest, JsonRpcResponse, ListOptions, Message, PatchesAPI, PatchesNotificationParams, ServerTransport, SignalNotificationParams } from './protocol/types.js';
7
+ export { rpcError, rpcNotification, rpcResponse } from './protocol/utils.js';
7
8
  export { PatchesState, SyncingState } from './types.js';
8
9
  export { Access, AuthContext, AuthorizationProvider, allowAll, denyAll } from './websocket/AuthorizationProvider.js';
9
10
  export { onlineState } from './websocket/onlineState.js';
package/dist/net/index.js CHANGED
@@ -3,6 +3,7 @@ export * from "./PatchesClient.js";
3
3
  export * from "./PatchesSync.js";
4
4
  export * from "./protocol/JSONRPCClient.js";
5
5
  export * from "./protocol/JSONRPCServer.js";
6
+ export * from "./protocol/utils.js";
6
7
  export * from "./websocket/AuthorizationProvider.js";
7
8
  export * from "./websocket/onlineState.js";
8
9
  export * from "./websocket/PatchesWebSocket.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dabble/patches",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
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": {