@types/sharedb 2.2.0 → 3.0.0

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: Wed, 01 Dec 2021 08:01:02 GMT
11
+ * Last updated: Wed, 13 Jul 2022 07:02:21 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>
@@ -97,14 +97,11 @@ declare class sharedb extends EventEmitter {
97
97
  fn: (context: sharedb.middleware.ActionContextMap[A], callback: (err?: any) => void) => void,
98
98
  ): void;
99
99
 
100
- on(event: 'timing', callback: (type: string, time: number, request: any) => void): this;
101
- on(event: 'submitRequestEnd', callback: (error: Error, request: SubmitRequest) => void): this;
102
- on(event: 'error', callback: (err: Error) => void): this;
103
- on(event: 'send', callback: (agent: Agent, response: ShareDB.ServerResponseSuccess | ShareDB.ServerResponseError) => void): this;
100
+ on<E extends keyof sharedb.BackendEventListenerMap>(event: E, callback: sharedb.BackendEventListenerMap[E]): this;
101
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
104
102
 
105
- addListener(event: 'timing', callback: (type: string, time: number, request: any) => void): this;
106
- addListener(event: 'submitRequestEnd', callback: (error: Error, request: SubmitRequest) => void): this;
107
- addListener(event: 'error', callback: (err: Error) => void): this;
103
+ addListener<E extends keyof sharedb.BackendEventListenerMap>(event: E, callback: sharedb.BackendEventListenerMap[E]): this;
104
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
108
105
 
109
106
  getOps(agent: Agent, index: string, id: string, from: number, to: number, options: GetOpsOptions, callback: (error: Error, ops: any[]) => any): void;
110
107
  getOpsBulk(agent: Agent, index: string, id: string, fromMap: Record<string, number>, toMap: Record<string, number>, options: GetOpsOptions, callback: (error: Error, ops: any[]) => any): void;
@@ -143,6 +140,13 @@ declare namespace sharedb {
143
140
  type DBQueryMethod = (collection: string, query: any, fields: ProjectionFields, options: any, callback: DBQueryCallback) => void;
144
141
  type DBQueryCallback = (err: Error | null, snapshots: Snapshot[], extra?: any) => void;
145
142
 
143
+ interface BackendEventListenerMap {
144
+ error: (err: Error) => void;
145
+ send: (agent: Agent, response: ShareDB.ServerResponseSuccess | ShareDB.ServerResponseError) => void;
146
+ submitRequestEnd: (error: Error, request: SubmitRequest) => void;
147
+ timing: (type: string, time: number, request: any) => void;
148
+ }
149
+
146
150
  abstract class PubSub {
147
151
  private static shallowCopy(obj: any): any;
148
152
  protected prefix?: string;
sharedb/lib/sharedb.d.ts CHANGED
@@ -126,8 +126,8 @@ export class Doc<T = any> extends TypedEmitter<DocEventMap<T>> {
126
126
  ingestSnapshot(snapshot: Pick<Snapshot<T>, 'v' | 'type' | 'data'>, callback?: Callback): void;
127
127
  destroy(callback?: Callback): void;
128
128
  create(data: any, callback?: Callback): void;
129
- create(data: any, type?: OTType, callback?: Callback): void;
130
- create(data: any, type?: OTType, options?: ShareDBSourceOptions, callback?: Callback): void;
129
+ create(data: any, type?: string, callback?: Callback): void;
130
+ create(data: any, type?: string, options?: ShareDBSourceOptions, callback?: Callback): void;
131
131
  submitOp(data: any, options?: ShareDBSourceOptions, callback?: Callback): void;
132
132
  del(options: ShareDBSourceOptions, callback?: (err: Error) => void): void;
133
133
  whenNothingPending(callback: () => void): void;
sharedb/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/sharedb",
3
- "version": "2.2.0",
3
+ "version": "3.0.0",
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": "dad7e36fc031d7a9c0b324db1a345d7056c756cc410f1e22257f26b18d53aa63",
44
- "typeScriptVersion": "3.8"
43
+ "typesPublisherContentHash": "b8fe18fbe3f494d46b24c69a981d7bfd92b84374cc5365046e9722fdf131a2b6",
44
+ "typeScriptVersion": "4.0"
45
45
  }