@types/sharedb 2.2.2 → 3.0.1

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.
sharedb/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for sharedb (https://github.com/share/sha
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sharedb.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 02 Jun 2022 18:01:29 GMT
11
+ * Last updated: Tue, 20 Sep 2022 16:02:48 GMT
12
12
  * Dependencies: none
13
13
  * Global values: none
14
14
 
sharedb/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for sharedb 2.2
1
+ // Type definitions for sharedb 3.0
2
2
  // Project: https://github.com/share/sharedb
3
3
  // Definitions by: Steve Oney <https://github.com/soney>
4
4
  // Eric Hwang <https://github.com/ericyhwang>
sharedb/lib/client.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import * as ShareDB from './sharedb';
3
3
  import Agent = require('./agent');
4
4
 
5
- export class Connection {
5
+ export class Connection extends ShareDB.TypedEmitter<ShareDB.ConnectionEventMap> {
6
6
  constructor(ws: ShareDB.Socket);
7
7
 
8
8
  // This direct reference from connection to agent is not used internal to
sharedb/lib/sharedb.d.ts CHANGED
@@ -138,6 +138,22 @@ export class Doc<T = any> extends TypedEmitter<DocEventMap<T>> {
138
138
  flush(): void;
139
139
  }
140
140
 
141
+ export type ConnectionState = 'connecting' | 'connected' | 'disconnected' | 'stopped' | 'closed';
142
+ export type ConnectionStateEventMap = {
143
+ [state in ConnectionState]: (reason: string) => void;
144
+ };
145
+ export interface ConnectionReceiveRequest {
146
+ data: any;
147
+ }
148
+ export type ConnectionEventMap = ConnectionStateEventMap & {
149
+ 'connection error': (error: Error) => void;
150
+ 'doc': (doc: Doc) => void;
151
+ 'error': (error: Error) => void;
152
+ 'receive': (request: ConnectionReceiveRequest) => void;
153
+ 'send': (message: any) => void;
154
+ 'state': (newState: ConnectionState, reason: string) => void;
155
+ };
156
+
141
157
  export interface DocEventMap<T> {
142
158
  'load': () => void;
143
159
  'no write pending': () => void;
sharedb/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/sharedb",
3
- "version": "2.2.2",
3
+ "version": "3.0.1",
4
4
  "description": "TypeScript definitions for sharedb",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sharedb",
6
6
  "license": "MIT",
@@ -40,6 +40,6 @@
40
40
  },
41
41
  "scripts": {},
42
42
  "dependencies": {},
43
- "typesPublisherContentHash": "37f57c8f390e581233bacd93aafe070e7c8f911eb66d6d5d4cffc59385d19136",
44
- "typeScriptVersion": "3.9"
43
+ "typesPublisherContentHash": "887fe69a5bcff16dcd51e689bd93d4d56fd0cf71a5ac779e77cbbcb7e43b06c7",
44
+ "typeScriptVersion": "4.1"
45
45
  }