@types/sharedb 1.0.23 → 2.2.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: Fri, 12 Nov 2021 19:31:24 GMT
11
+ * Last updated: Tue, 03 May 2022 16:31:36 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.0
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
  /**
@@ -222,7 +225,9 @@ declare namespace sharedb {
222
225
  query: QueryContext;
223
226
  readSnapshots: ReadSnapshotsContext;
224
227
  receive: ReceiveContext;
228
+ receivePresence: PresenceContext;
225
229
  reply: ReplyContext;
230
+ sendPresence: PresenceContext;
226
231
  submit: SubmitContext;
227
232
  }
228
233
 
@@ -255,6 +260,11 @@ declare namespace sharedb {
255
260
  op: any;
256
261
  }
257
262
 
263
+ interface PresenceContext extends BaseContext {
264
+ presence: PresenceMessage;
265
+ collection?: string;
266
+ }
267
+
258
268
  interface QueryContext extends BaseContext {
259
269
  index: string;
260
270
  collection: string;
@@ -326,4 +336,22 @@ interface GetOpsOptions {
326
336
  };
327
337
  }
328
338
 
339
+ interface PresenceMessage {
340
+ a: 'p';
341
+ ch: string; // channel
342
+ src: string; // client ID
343
+ id: string; // presence ID
344
+ p: any; // presence payload
345
+ pv: number; // presence version
346
+ c?: string; // document collection
347
+ d?: string; // document ID
348
+ v?: number; // document version
349
+ t?: string; // document OT type
350
+ }
351
+
329
352
  type BasicCallback = (err?: Error) => void;
353
+
354
+ type ErrorHandler = (error: Error, context: ErrorHandlerContext) => void;
355
+ interface ErrorHandlerContext {
356
+ agent?: Agent;
357
+ }
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": "1.0.23",
3
+ "version": "2.2.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": "0fede5791642ef4d06d6a137afd9968129407dfe2827787900440ef8cb6555a8",
44
- "typeScriptVersion": "3.7"
43
+ "typesPublisherContentHash": "a7c66f7d4ca41d1a4423bd30c1789c77b975c80f599d4811fd699acbff6139ec",
44
+ "typeScriptVersion": "3.9"
45
45
  }