@types/sharedb 3.3.1 → 3.3.3

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/LICENSE CHANGED
File without changes
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: Mon, 27 Mar 2023 18:25:41 GMT
11
+ * Last updated: Mon, 25 Sep 2023 13:39:06 GMT
12
12
  * Dependencies: none
13
13
  * Global values: none
14
14
 
sharedb/index.d.ts CHANGED
@@ -10,11 +10,11 @@
10
10
 
11
11
  /// <reference path="lib/sharedb.d.ts" />
12
12
 
13
- import { Duplex } from 'stream';
14
- import { EventEmitter } from 'events';
15
- import Agent = require('./lib/agent');
16
- import { Connection } from './lib/client';
17
- import * as ShareDB from './lib/sharedb';
13
+ import { EventEmitter } from "events";
14
+ import { Duplex } from "stream";
15
+ import Agent = require("./lib/agent");
16
+ import { Connection } from "./lib/client";
17
+ import * as ShareDB from "./lib/sharedb";
18
18
 
19
19
  interface PubSubOptions {
20
20
  prefix?: string;
@@ -28,7 +28,7 @@ export = sharedb;
28
28
  declare class sharedb extends EventEmitter {
29
29
  db: sharedb.DB;
30
30
  pubsub: sharedb.PubSub;
31
- extraDbs: {[extraDbName: string]: sharedb.ExtraDB};
31
+ extraDbs: { [extraDbName: string]: sharedb.ExtraDB };
32
32
  milestoneDb?: sharedb.MilestoneDB;
33
33
  errorHandler: ErrorHandler;
34
34
 
@@ -37,24 +37,24 @@ declare class sharedb extends EventEmitter {
37
37
  };
38
38
 
39
39
  constructor(options?: {
40
- db?: any,
41
- pubsub?: sharedb.PubSub,
42
- extraDbs?: {[extraDbName: string]: sharedb.ExtraDB},
43
- milestoneDb?: sharedb.MilestoneDB,
44
- suppressPublish?: boolean,
45
- maxSubmitRetries?: number,
46
- doNotForwardSendPresenceErrorsToClient?: boolean,
40
+ db?: any;
41
+ pubsub?: sharedb.PubSub;
42
+ extraDbs?: { [extraDbName: string]: sharedb.ExtraDB };
43
+ milestoneDb?: sharedb.MilestoneDB;
44
+ suppressPublish?: boolean;
45
+ maxSubmitRetries?: number;
46
+ doNotForwardSendPresenceErrorsToClient?: boolean;
47
47
  errorHandler?: ErrorHandler;
48
48
 
49
- presence?: boolean,
49
+ presence?: boolean;
50
50
  /**
51
51
  * @deprecated disableDocAction was removed in v1.0
52
52
  */
53
- disableDocAction?: boolean,
53
+ disableDocAction?: boolean;
54
54
  /**
55
55
  * @deprecated disableSpaceDelimitedActions was removed in v1.0
56
56
  */
57
- disableSpaceDelimitedActions?: boolean
57
+ disableSpaceDelimitedActions?: boolean;
58
58
  });
59
59
  /**
60
60
  * Creates a server-side connection to ShareDB.
@@ -100,11 +100,30 @@ declare class sharedb extends EventEmitter {
100
100
  on<E extends keyof sharedb.BackendEventListenerMap>(event: E, callback: sharedb.BackendEventListenerMap[E]): this;
101
101
  on(eventName: string | symbol, listener: (...args: any[]) => void): this;
102
102
 
103
- addListener<E extends keyof sharedb.BackendEventListenerMap>(event: E, callback: sharedb.BackendEventListenerMap[E]): this;
103
+ addListener<E extends keyof sharedb.BackendEventListenerMap>(
104
+ event: E,
105
+ callback: sharedb.BackendEventListenerMap[E],
106
+ ): this;
104
107
  addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
105
108
 
106
- getOps(agent: Agent, index: string, id: string, from: number, to: number, options: GetOpsOptions, callback: (error: Error, ops: any[]) => any): void;
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;
109
+ getOps(
110
+ agent: Agent,
111
+ index: string,
112
+ id: string,
113
+ from: number,
114
+ to: number,
115
+ options: GetOpsOptions,
116
+ callback: (error: Error, ops: any[]) => any,
117
+ ): void;
118
+ getOpsBulk(
119
+ agent: Agent,
120
+ index: string,
121
+ id: string,
122
+ fromMap: Record<string, number>,
123
+ toMap: Record<string, number>,
124
+ options: GetOpsOptions,
125
+ callback: (error: Error, ops: any[]) => any,
126
+ ): void;
108
127
 
109
128
  static types: ShareDB.Types;
110
129
  static logger: ShareDB.Logger;
@@ -115,13 +134,47 @@ declare namespace sharedb {
115
134
  projectsSnapshots: boolean;
116
135
  disableSubscribe: boolean;
117
136
  close(callback?: BasicCallback): void;
118
- commit(collection: string, id: string, op: any, snapshot: any, options: any, callback: (...args: any[]) => any): void;
137
+ commit(
138
+ collection: string,
139
+ id: string,
140
+ op: any,
141
+ snapshot: any,
142
+ options: any,
143
+ callback: (...args: any[]) => any,
144
+ ): void;
119
145
  getSnapshot(collection: string, id: string, fields: any, options: any, callback: (...args: any[]) => any): void;
120
- getSnapshotBulk(collection: string, ids: string[], fields: any, options: any, callback: (...args: any[]) => any): void;
121
- getOps(collection: string, id: string, from: number | null, to: number | null, options: any, callback: (...args: any[]) => any): void;
122
- getOpsToSnapshot(collection: string, id: string, from: number | null, snapshot: number, options: any, callback: (...args: any[]) => any): void;
146
+ getSnapshotBulk(
147
+ collection: string,
148
+ ids: string[],
149
+ fields: any,
150
+ options: any,
151
+ callback: (...args: any[]) => any,
152
+ ): void;
153
+ getOps(
154
+ collection: string,
155
+ id: string,
156
+ from: number | null,
157
+ to: number | null,
158
+ options: any,
159
+ callback: (...args: any[]) => any,
160
+ ): void;
161
+ getOpsToSnapshot(
162
+ collection: string,
163
+ id: string,
164
+ from: number | null,
165
+ snapshot: number,
166
+ options: any,
167
+ callback: (...args: any[]) => any,
168
+ ): void;
123
169
  getOpsBulk(collection: string, fromMap: any, toMap: any, options: any, callback: (...args: any[]) => any): void;
124
- getCommittedOpVersion(collection: string, id: string, snapshot: any, op: any, options: any, callback: (...args: any[]) => any): void;
170
+ getCommittedOpVersion(
171
+ collection: string,
172
+ id: string,
173
+ snapshot: any,
174
+ op: any,
175
+ options: any,
176
+ callback: (...args: any[]) => any,
177
+ ): void;
125
178
  query: DBQueryMethod;
126
179
  queryPoll(collection: string, query: any, options: any, callback: (...args: any[]) => any): void;
127
180
  queryPollDoc(collection: string, id: string, query: any, options: any, callback: (...args: any[]) => any): void;
@@ -129,7 +182,7 @@ declare namespace sharedb {
129
182
  skipPoll(): boolean;
130
183
  }
131
184
 
132
- class MemoryDB extends DB { }
185
+ class MemoryDB extends DB {}
133
186
 
134
187
  // The DBs in `extraDbs` are only ever used for queries, so they don't need the other DB methods.
135
188
  interface ExtraDB {
@@ -137,7 +190,13 @@ declare namespace sharedb {
137
190
  close(callback?: BasicCallback): void;
138
191
  }
139
192
 
140
- type DBQueryMethod = (collection: string, query: any, fields: ProjectionFields, options: any, callback: DBQueryCallback) => void;
193
+ type DBQueryMethod = (
194
+ collection: string,
195
+ query: any,
196
+ fields: ProjectionFields,
197
+ options: any,
198
+ callback: DBQueryCallback,
199
+ ) => void;
141
200
  type DBQueryCallback = (err: Error | null, snapshots: Snapshot[], extra?: any) => void;
142
201
 
143
202
  interface BackendEventListenerMap {
@@ -159,13 +218,13 @@ declare namespace sharedb {
159
218
  [channel: string]: boolean;
160
219
  };
161
220
  protected constructor(options?: PubSubOptions);
162
- close(callback?: (err: Error|null) => void): void;
163
- publish(channels: string[], data: {[k: string]: any}, callback: (err: Error | null) => void): void;
221
+ close(callback?: (err: Error | null) => void): void;
222
+ publish(channels: string[], data: { [k: string]: any }, callback: (err: Error | null) => void): void;
164
223
  subscribe(channel: string, callback: (err: Error | null, stream?: Stream) => void): void;
165
224
  protected abstract _subscribe(channel: string, callback: (err: Error | null) => void): void;
166
225
  protected abstract _unsubscribe(channel: string, callback: (err: Error | null) => void): void;
167
226
  protected abstract _publish(channels: string[], data: any, callback: (err: Error | null) => void): void;
168
- protected _emit(channel: string, data: {[k: string]: any}): void;
227
+ protected _emit(channel: string, data: { [k: string]: any }): void;
169
228
  private _createStream(channel): void;
170
229
  private _removeStream(channel, stream): void;
171
230
  }
@@ -174,8 +233,18 @@ declare namespace sharedb {
174
233
  close(callback?: BasicCallback): void;
175
234
  getMilestoneSnapshot(collection: string, id: string, version: number, callback?: BasicCallback): void;
176
235
  saveMilestoneSnapshot(collection: string, snapshot: Snapshot, callback?: BasicCallback): void;
177
- getMilestoneSnapshotAtOrBeforeTime(collection: string, id: string, timestamp: number, callback?: BasicCallback): void;
178
- getMilestoneSnapshotAtOrAfterTime(collection: string, id: string, timestamp: number, callback?: BasicCallback): void;
236
+ getMilestoneSnapshotAtOrBeforeTime(
237
+ collection: string,
238
+ id: string,
239
+ timestamp: number,
240
+ callback?: BasicCallback,
241
+ ): void;
242
+ getMilestoneSnapshotAtOrAfterTime(
243
+ collection: string,
244
+ id: string,
245
+ timestamp: number,
246
+ callback?: BasicCallback,
247
+ ): void;
179
248
  }
180
249
 
181
250
  /**
@@ -185,8 +254,18 @@ declare namespace sharedb {
185
254
  class Connection {
186
255
  constructor(socket: ShareDB.Socket);
187
256
  get(collectionName: string, documentID: string): ShareDB.Doc;
188
- createFetchQuery(collectionName: string, query: string, options: {results?: ShareDB.Query[]}, callback: (err: Error, results: any) => any): ShareDB.Query;
189
- createSubscribeQuery(collectionName: string, query: string, options: {results?: ShareDB.Query[]}, callback: (err: Error, results: any) => any): ShareDB.Query;
257
+ createFetchQuery(
258
+ collectionName: string,
259
+ query: string,
260
+ options: { results?: ShareDB.Query[] },
261
+ callback: (err: Error, results: any) => any,
262
+ ): ShareDB.Query;
263
+ createSubscribeQuery(
264
+ collectionName: string,
265
+ query: string,
266
+ options: { results?: ShareDB.Query[] },
267
+ callback: (err: Error, results: any) => any,
268
+ ): ShareDB.Query;
190
269
  }
191
270
  type Doc = ShareDB.Doc;
192
271
  type Snapshot = ShareDB.Snapshot;
@@ -250,7 +329,7 @@ declare namespace sharedb {
250
329
 
251
330
  interface ConnectContext extends BaseContext {
252
331
  stream: any;
253
- req: any; // Property always exists, value may be undefined
332
+ req: any; // Property always exists, value may be undefined
254
333
  }
255
334
 
256
335
  interface DocContext extends BaseContext {
@@ -281,7 +360,7 @@ declare namespace sharedb {
281
360
  channel: string;
282
361
  channels: string[];
283
362
  query: any;
284
- options?: {[key: string]: any};
363
+ options?: { [key: string]: any };
285
364
  db: DB | null;
286
365
  snapshotProjection: ReadonlyProjection | null;
287
366
  }
@@ -293,15 +372,15 @@ declare namespace sharedb {
293
372
  }
294
373
 
295
374
  interface ReceiveContext extends BaseContext {
296
- data: {[key: string]: any}; // ClientRequest, but before any validation
375
+ data: { [key: string]: any }; // ClientRequest, but before any validation
297
376
  }
298
377
 
299
378
  interface ReplyContext extends BaseContext {
300
379
  request: ShareDB.ClientRequest;
301
- reply: {[key: string]: any};
380
+ reply: { [key: string]: any };
302
381
  }
303
382
 
304
- type SnapshotType = 'current' | 'byVersion' | 'byTimestamp';
383
+ type SnapshotType = "current" | "byVersion" | "byTimestamp";
305
384
 
306
385
  interface SubmitContext extends BaseContext, SubmitRequest {
307
386
  }
@@ -346,7 +425,7 @@ interface GetOpsOptions {
346
425
  }
347
426
 
348
427
  interface PresenceMessage {
349
- a: 'p';
428
+ a: "p";
350
429
  ch: string; // channel
351
430
  src: string; // client ID
352
431
  id: string; // presence ID
sharedb/lib/agent.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Duplex } from 'stream';
2
- import { JSONObject } from './sharedb';
3
- import ShareDbBackend = require('..');
1
+ import { Duplex } from "stream";
2
+ import { JSONObject } from "./sharedb";
3
+ import ShareDbBackend = require("..");
4
4
 
5
5
  export = Agent;
6
6
 
sharedb/lib/client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference path="sharedb.d.ts" />
2
- import * as ShareDB from './sharedb';
3
- import Agent = require('./agent');
2
+ import * as ShareDB from "./sharedb";
3
+ import Agent = require("./agent");
4
4
 
5
5
  export class Connection extends ShareDB.TypedEmitter<ShareDB.ConnectionEventMap> {
6
6
  constructor(ws: ShareDB.Socket);
@@ -24,10 +24,30 @@ export class Connection extends ShareDB.TypedEmitter<ShareDB.ConnectionEventMap>
24
24
 
25
25
  close(): void;
26
26
  get(collectionName: string, documentID: string): Doc;
27
- createFetchQuery<T = any>(collectionName: string, query: any, options?: {results?: Array<Doc<T>>} | null, callback?: (err: Error, results: Array<Doc<T>>) => void): Query<T>;
28
- createSubscribeQuery<T = any>(collectionName: string, query: any, options?: {results?: Array<Doc<T>>} | null, callback?: (err: Error, results: Array<Doc<T>>) => void): Query<T>;
29
- fetchSnapshot(collection: string, id: string, version: number, callback: (error: Error, snapshot: ShareDB.Snapshot) => void): void;
30
- fetchSnapshotByTimestamp(collection: string, id: string, timestamp: number, callback: (error: Error, snapshot: ShareDB.Snapshot) => void): void;
27
+ createFetchQuery<T = any>(
28
+ collectionName: string,
29
+ query: any,
30
+ options?: { results?: Array<Doc<T>> } | null,
31
+ callback?: (err: Error, results: Array<Doc<T>>) => void,
32
+ ): Query<T>;
33
+ createSubscribeQuery<T = any>(
34
+ collectionName: string,
35
+ query: any,
36
+ options?: { results?: Array<Doc<T>> } | null,
37
+ callback?: (err: Error, results: Array<Doc<T>>) => void,
38
+ ): Query<T>;
39
+ fetchSnapshot(
40
+ collection: string,
41
+ id: string,
42
+ version: number | null,
43
+ callback: (error: Error, snapshot: ShareDB.Snapshot) => void,
44
+ ): void;
45
+ fetchSnapshotByTimestamp(
46
+ collection: string,
47
+ id: string,
48
+ timestamp: number | null,
49
+ callback: (error: Error, snapshot: ShareDB.Snapshot) => void,
50
+ ): void;
31
51
  getPresence(channel: string): Presence;
32
52
  getDocPresence(collection: string, id: string): Presence;
33
53
 
sharedb/lib/sharedb.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Connection } from './client';
1
+ import { Connection } from "./client";
2
2
 
3
3
  export type JSONValue = string | number | boolean | null | JSONObject | JSONArray;
4
4
  export interface JSONObject {
5
- [name: string]: JSONValue;
5
+ [name: string]: JSONValue;
6
6
  }
7
7
  export interface JSONArray extends Array<JSONValue> {}
8
8
 
@@ -13,7 +13,7 @@ export type DocumentID = string;
13
13
  export type RequestQuery = any;
14
14
  export type BulkRequestData = IDString[] | Record<IDString, any>;
15
15
 
16
- export type Path = ReadonlyArray<string|number>;
16
+ export type Path = ReadonlyArray<string | number>;
17
17
  export interface Snapshot<T = any> {
18
18
  id: IDString;
19
19
  v: VersionNumber;
@@ -29,23 +29,70 @@ export interface SnapshotMeta {
29
29
  [key: string]: any;
30
30
  }
31
31
 
32
- export interface AddNumOp { p: Path; na: number; }
32
+ export interface AddNumOp {
33
+ p: Path;
34
+ na: number;
35
+ }
33
36
 
34
- export interface ListInsertOp { p: Path; li: any; }
35
- export interface ListDeleteOp { p: Path; ld: any; }
36
- export interface ListReplaceOp { p: Path; li: any; ld: any; }
37
- export interface ListMoveOp { p: Path; lm: any; }
37
+ export interface ListInsertOp {
38
+ p: Path;
39
+ li: any;
40
+ }
41
+ export interface ListDeleteOp {
42
+ p: Path;
43
+ ld: any;
44
+ }
45
+ export interface ListReplaceOp {
46
+ p: Path;
47
+ li: any;
48
+ ld: any;
49
+ }
50
+ export interface ListMoveOp {
51
+ p: Path;
52
+ lm: any;
53
+ }
38
54
 
39
- export interface ObjectInsertOp { p: Path; oi: any; }
40
- export interface ObjectDeleteOp { p: Path; od: any; }
41
- export interface ObjectReplaceOp { p: Path; oi: any; od: any; }
55
+ export interface ObjectInsertOp {
56
+ p: Path;
57
+ oi: any;
58
+ }
59
+ export interface ObjectDeleteOp {
60
+ p: Path;
61
+ od: any;
62
+ }
63
+ export interface ObjectReplaceOp {
64
+ p: Path;
65
+ oi: any;
66
+ od: any;
67
+ }
42
68
 
43
- export interface StringInsertOp { p: Path; si: string; }
44
- export interface StringDeleteOp { p: Path; sd: string; }
69
+ export interface StringInsertOp {
70
+ p: Path;
71
+ si: string;
72
+ }
73
+ export interface StringDeleteOp {
74
+ p: Path;
75
+ sd: string;
76
+ }
45
77
 
46
- export interface SubtypeOp { p: Path; t: string; o: any; }
78
+ export interface SubtypeOp {
79
+ p: Path;
80
+ t: string;
81
+ o: any;
82
+ }
47
83
 
48
- export type Op = AddNumOp | ListInsertOp | ListDeleteOp | ListReplaceOp | ListMoveOp | ObjectInsertOp | ObjectDeleteOp | ObjectReplaceOp | StringInsertOp | StringDeleteOp | SubtypeOp;
84
+ export type Op =
85
+ | AddNumOp
86
+ | ListInsertOp
87
+ | ListDeleteOp
88
+ | ListReplaceOp
89
+ | ListMoveOp
90
+ | ObjectInsertOp
91
+ | ObjectDeleteOp
92
+ | ObjectReplaceOp
93
+ | StringInsertOp
94
+ | StringDeleteOp
95
+ | SubtypeOp;
49
96
 
50
97
  export interface RawOp {
51
98
  src: string;
@@ -56,18 +103,18 @@ export interface RawOp {
56
103
  d: DocumentID;
57
104
  }
58
105
 
59
- export type CreateOp = RawOp & { create: { type: string; data: any }; del: undefined; op: undefined; };
60
- export type DeleteOp = RawOp & { del: boolean; create: undefined; op: undefined; };
61
- export type EditOp = RawOp & { op: any[]; create: undefined; del: undefined; };
106
+ export type CreateOp = RawOp & { create: { type: string; data: any }; del: undefined; op: undefined };
107
+ export type DeleteOp = RawOp & { del: boolean; create: undefined; op: undefined };
108
+ export type EditOp = RawOp & { op: any[]; create: undefined; del: undefined };
62
109
 
63
- export type OTType = 'ot-text' | 'ot-json0' | 'ot-json1' | 'ot-text-tp2' | 'rich-text';
110
+ export type OTType = "ot-text" | "ot-json0" | "ot-json1" | "ot-text-tp2" | "rich-text";
64
111
 
65
112
  export interface Type {
66
113
  name?: string;
67
114
  uri?: string;
68
115
  create(initialData?: any): any;
69
116
  apply(snapshot: any, op: any): any;
70
- transform(op1: any, op2: any, side: 'left' | 'right'): any;
117
+ transform(op1: any, op2: any, side: "left" | "right"): any;
71
118
  compose(op1: any, op2: any): any;
72
119
  invert?(op: any): any;
73
120
  normalize?(op: any): any;
@@ -98,7 +145,9 @@ export interface Error {
98
145
  code: number;
99
146
  message: string;
100
147
  }
101
- export interface ShareDBSourceOptions { source?: any; }
148
+ export interface ShareDBSourceOptions {
149
+ source?: any;
150
+ }
102
151
  // interface ShareDBCreateOptions extends ShareDBSourceOptions {}
103
152
  // interface ShareDBDelOptions extends ShareDBSourceOptions {}
104
153
  // interface ShareDBSubmitOpOptions extends ShareDBSourceOptions {}
@@ -123,7 +172,7 @@ export class Doc<T = any> extends TypedEmitter<DocEventMap<T>> {
123
172
  subscribe: (callback?: (err: Error) => void) => void;
124
173
  unsubscribe: (callback?: (err: Error) => void) => void;
125
174
 
126
- ingestSnapshot(snapshot: Pick<Snapshot<T>, 'v' | 'type' | 'data'>, callback?: Callback): void;
175
+ ingestSnapshot(snapshot: Pick<Snapshot<T>, "v" | "type" | "data">, callback?: Callback): void;
127
176
  destroy(callback?: Callback): void;
128
177
  create(data: any, callback?: Callback): void;
129
178
  create(data: any, type?: string, callback?: Callback): void;
@@ -138,7 +187,7 @@ export class Doc<T = any> extends TypedEmitter<DocEventMap<T>> {
138
187
  flush(): void;
139
188
  }
140
189
 
141
- export type ConnectionState = 'connecting' | 'connected' | 'disconnected' | 'stopped' | 'closed';
190
+ export type ConnectionState = "connecting" | "connected" | "disconnected" | "stopped" | "closed";
142
191
  export type ConnectionStateEventMap = {
143
192
  [state in ConnectionState]: (reason: string) => void;
144
193
  };
@@ -146,32 +195,32 @@ export interface ConnectionReceiveRequest {
146
195
  data: any;
147
196
  }
148
197
  export type ConnectionEventMap = ConnectionStateEventMap & {
149
- 'connection error': (error: Error) => void;
150
- 'doc': (doc: Doc) => void;
151
- 'error': (error: Error) => void;
152
- 'pong': () => void;
153
- 'receive': (request: ConnectionReceiveRequest) => void;
154
- 'send': (message: any) => void;
155
- 'state': (newState: ConnectionState, reason: string) => void;
198
+ "connection error": (error: Error) => void;
199
+ "doc": (doc: Doc) => void;
200
+ "error": (error: Error) => void;
201
+ "pong": () => void;
202
+ "receive": (request: ConnectionReceiveRequest) => void;
203
+ "send": (message: any) => void;
204
+ "state": (newState: ConnectionState, reason: string) => void;
156
205
  };
157
206
 
158
207
  export interface DocEventMap<T> {
159
- 'load': () => void;
160
- 'no write pending': () => void;
161
- 'nothing pending': () => void;
162
- 'create': (source: any) => void;
163
- 'op': (ops: [any], source: any, clientId: string) => void;
164
- 'op batch': (ops: any[], source: any) => void;
165
- 'before op': (ops: [any], source: any, clientId: string) => void;
166
- 'before op batch': (ops: any[], source: any) => void;
167
- 'del': (data: T, source: any) => void;
168
- 'error': (error: Error) => void;
169
- 'destroy': () => void;
208
+ "load": () => void;
209
+ "no write pending": () => void;
210
+ "nothing pending": () => void;
211
+ "create": (source: any) => void;
212
+ "op": (ops: [any], source: any, clientId: string) => void;
213
+ "op batch": (ops: any[], source: any) => void;
214
+ "before op": (ops: [any], source: any, clientId: string) => void;
215
+ "before op batch": (ops: any[], source: any) => void;
216
+ "del": (data: T, source: any) => void;
217
+ "error": (error: Error) => void;
218
+ "destroy": () => void;
170
219
  }
171
220
 
172
221
  export type QueryEvent = keyof QueryEventMap<any>;
173
222
  export class Query<T = any> extends TypedEmitter<QueryEventMap<T>> {
174
- action: 'qf' | 'qs';
223
+ action: "qf" | "qs";
175
224
  connection: Connection;
176
225
  id: string;
177
226
  collection: string;
@@ -184,13 +233,13 @@ export class Query<T = any> extends TypedEmitter<QueryEventMap<T>> {
184
233
  }
185
234
 
186
235
  export interface QueryEventMap<T> {
187
- 'ready': () => void;
188
- 'error': (error: Error) => void;
189
- 'insert': (inserted: Array<Doc<T>>, index: number) => void;
190
- 'remove': (removed: Array<Doc<T>>, index: number) => void;
191
- 'move': (moved: Array<Doc<T>>, from: number, to: number) => void;
192
- 'changed': (docs: Array<Doc<T>>) => void;
193
- 'extra': (extra: any) => void;
236
+ "ready": () => void;
237
+ "error": (error: Error) => void;
238
+ "insert": (inserted: Array<Doc<T>>, index: number) => void;
239
+ "remove": (removed: Array<Doc<T>>, index: number) => void;
240
+ "move": (moved: Array<Doc<T>>, from: number, to: number) => void;
241
+ "changed": (docs: Array<Doc<T>>) => void;
242
+ "extra": (extra: any) => void;
194
243
  }
195
244
 
196
245
  export type ReceivePresenceListener<T> = (id: string, value: T) => void;
@@ -208,8 +257,8 @@ export class Presence<T = any> extends TypedEmitter<PresenceEventMap<T>> {
208
257
  }
209
258
 
210
259
  export interface PresenceEventMap<T> {
211
- 'receive': ReceivePresenceListener<T>;
212
- 'error': (error: Error) => void;
260
+ "receive": ReceivePresenceListener<T>;
261
+ "error": (error: Error) => void;
213
262
  }
214
263
 
215
264
  export class LocalPresence<T = any> extends TypedEmitter<LocalPresenceEventMap> {
@@ -224,10 +273,10 @@ export class LocalPresence<T = any> extends TypedEmitter<LocalPresenceEventMap>
224
273
  }
225
274
 
226
275
  export interface LocalPresenceEventMap {
227
- 'error': (error: Error) => void;
276
+ "error": (error: Error) => void;
228
277
  }
229
278
 
230
- export type RequestAction = 'qf' | 'qs' | 'qu' | 'bf' | 'bs' | 'bu' | 'f' | 's' | 'u' | 'op' | 'nf' | 'nt';
279
+ export type RequestAction = "qf" | "qs" | "qu" | "bf" | "bs" | "bu" | "f" | "s" | "u" | "op" | "nf" | "nt";
231
280
 
232
281
  export interface ClientRequest {
233
282
  /** Short name of the request's action */
sharedb/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/sharedb",
3
- "version": "3.3.1",
3
+ "version": "3.3.3",
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": "530d038cfa18315dd9ba5ee947e1ef71d8d2855440c3cab3a987b84ff9cbd647",
44
- "typeScriptVersion": "4.3"
43
+ "typesPublisherContentHash": "fbdde692ba5d7c2298eab1e8814a3ef9d18fc67251c2b9b0c9aeb678c3be4740",
44
+ "typeScriptVersion": "4.5"
45
45
  }