@types/sharedb 1.0.24 → 2.2.2
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 +1 -1
- sharedb/index.d.ts +21 -8
- sharedb/lib/sharedb.d.ts +2 -2
- sharedb/package.json +3 -3
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:
|
|
11
|
+
* Last updated: Thu, 02 Jun 2022 18:01:29 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
|
|
1
|
+
// Type definitions for sharedb 2.2
|
|
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>
|
|
@@ -30,6 +30,7 @@ declare class sharedb extends EventEmitter {
|
|
|
30
30
|
pubsub: sharedb.PubSub;
|
|
31
31
|
extraDbs: {[extraDbName: string]: sharedb.ExtraDB};
|
|
32
32
|
milestoneDb?: sharedb.MilestoneDB;
|
|
33
|
+
errorHandler: ErrorHandler;
|
|
33
34
|
|
|
34
35
|
readonly projections: {
|
|
35
36
|
readonly [name: string]: ReadonlyProjection;
|
|
@@ -42,6 +43,8 @@ declare class sharedb extends EventEmitter {
|
|
|
42
43
|
milestoneDb?: sharedb.MilestoneDB,
|
|
43
44
|
suppressPublish?: boolean,
|
|
44
45
|
maxSubmitRetries?: number,
|
|
46
|
+
doNotForwardSendPresenceErrorsToClient?: boolean,
|
|
47
|
+
errorHandler?: ErrorHandler;
|
|
45
48
|
|
|
46
49
|
presence?: boolean,
|
|
47
50
|
/**
|
|
@@ -94,14 +97,11 @@ declare class sharedb extends EventEmitter {
|
|
|
94
97
|
fn: (context: sharedb.middleware.ActionContextMap[A], callback: (err?: any) => void) => void,
|
|
95
98
|
): void;
|
|
96
99
|
|
|
97
|
-
on
|
|
98
|
-
on(
|
|
99
|
-
on(event: 'error', callback: (err: Error) => void): this;
|
|
100
|
-
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;
|
|
101
102
|
|
|
102
|
-
addListener
|
|
103
|
-
addListener(
|
|
104
|
-
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;
|
|
105
105
|
|
|
106
106
|
getOps(agent: Agent, index: string, id: string, from: number, to: number, options: GetOpsOptions, callback: (error: Error, ops: any[]) => any): void;
|
|
107
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;
|
|
@@ -140,6 +140,13 @@ declare namespace sharedb {
|
|
|
140
140
|
type DBQueryMethod = (collection: string, query: any, fields: ProjectionFields, options: any, callback: DBQueryCallback) => void;
|
|
141
141
|
type DBQueryCallback = (err: Error | null, snapshots: Snapshot[], extra?: any) => void;
|
|
142
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
|
+
|
|
143
150
|
abstract class PubSub {
|
|
144
151
|
private static shallowCopy(obj: any): any;
|
|
145
152
|
protected prefix?: string;
|
|
@@ -222,6 +229,7 @@ declare namespace sharedb {
|
|
|
222
229
|
query: QueryContext;
|
|
223
230
|
readSnapshots: ReadSnapshotsContext;
|
|
224
231
|
receive: ReceiveContext;
|
|
232
|
+
receivePresence: PresenceContext;
|
|
225
233
|
reply: ReplyContext;
|
|
226
234
|
sendPresence: PresenceContext;
|
|
227
235
|
submit: SubmitContext;
|
|
@@ -346,3 +354,8 @@ interface PresenceMessage {
|
|
|
346
354
|
}
|
|
347
355
|
|
|
348
356
|
type BasicCallback = (err?: Error) => void;
|
|
357
|
+
|
|
358
|
+
type ErrorHandler = (error: Error, context: ErrorHandlerContext) => void;
|
|
359
|
+
interface ErrorHandlerContext {
|
|
360
|
+
agent?: Agent;
|
|
361
|
+
}
|
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?:
|
|
130
|
-
create(data: any, type?:
|
|
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": "
|
|
3
|
+
"version": "2.2.2",
|
|
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": "
|
|
44
|
-
"typeScriptVersion": "3.
|
|
43
|
+
"typesPublisherContentHash": "37f57c8f390e581233bacd93aafe070e7c8f911eb66d6d5d4cffc59385d19136",
|
|
44
|
+
"typeScriptVersion": "3.9"
|
|
45
45
|
}
|