@types/sharedb 1.0.22 → 1.0.23

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, 07 Oct 2021 13:31:20 GMT
11
+ * Last updated: Fri, 12 Nov 2021 19:31:24 GMT
12
12
  * Dependencies: none
13
13
  * Global values: none
14
14
 
sharedb/index.d.ts CHANGED
@@ -31,6 +31,10 @@ declare class sharedb extends EventEmitter {
31
31
  extraDbs: {[extraDbName: string]: sharedb.ExtraDB};
32
32
  milestoneDb?: sharedb.MilestoneDB;
33
33
 
34
+ readonly projections: {
35
+ readonly [name: string]: ReadonlyProjection;
36
+ };
37
+
34
38
  constructor(options?: {
35
39
  db?: any,
36
40
  pubsub?: sharedb.PubSub,
@@ -254,13 +258,13 @@ declare namespace sharedb {
254
258
  interface QueryContext extends BaseContext {
255
259
  index: string;
256
260
  collection: string;
257
- projection: Projection;
261
+ projection: ReadonlyProjection;
258
262
  fields: ProjectionFields;
259
263
  channel: string;
260
264
  query: any;
261
265
  options?: {[key: string]: any};
262
266
  db: DB | null;
263
- snapshotProjection: Projection | null;
267
+ snapshotProjection: ReadonlyProjection | null;
264
268
  }
265
269
 
266
270
  interface ReadSnapshotsContext extends BaseContext {
@@ -285,9 +289,9 @@ declare namespace sharedb {
285
289
  }
286
290
  }
287
291
 
288
- interface Projection {
289
- target: string;
290
- fields: ProjectionFields;
292
+ interface ReadonlyProjection {
293
+ readonly target: Readonly<string>;
294
+ readonly fields: Readonly<ProjectionFields>;
291
295
  }
292
296
 
293
297
  interface ProjectionFields {
@@ -296,7 +300,7 @@ interface ProjectionFields {
296
300
 
297
301
  interface SubmitRequest {
298
302
  index: string;
299
- projection: Projection;
303
+ projection: ReadonlyProjection;
300
304
  collection: string;
301
305
  id: string;
302
306
  op: sharedb.CreateOp | sharedb.DeleteOp | sharedb.EditOp;
sharedb/lib/client.d.ts CHANGED
@@ -29,6 +29,30 @@ export class Connection {
29
29
  fetchSnapshotByTimestamp(collection: string, id: string, timestamp: number, callback: (error: Error, snapshot: ShareDB.Snapshot) => void): void;
30
30
  getPresence(channel: string): Presence;
31
31
  getDocPresence(collection: string, id: string): Presence;
32
+
33
+ /**
34
+ * Returns whether anything in this client is either:
35
+ * - In-flight, waiting on a response from the server
36
+ * - Pending (locally queued)
37
+ */
38
+ hasPending(): boolean;
39
+
40
+ /**
41
+ * Invokes the callback once nothing on this client is in-flight or pending.
42
+ *
43
+ * @see hasPending
44
+ */
45
+ whenNothingPending(callback: () => void): void;
46
+
47
+ /**
48
+ * Manually send a JSON-serializable message to the server.
49
+ *
50
+ * WARNING - This is mostly for internal use within sharedb.
51
+ *
52
+ * Prefer to use methods like `Doc#submitOp`, `Doc#subscribe`, `Connection#createFetchQuery`,
53
+ * etc., which will manage the necessary message exchanges.
54
+ */
55
+ send(message: Record<string, unknown>): void;
32
56
  }
33
57
  export type Doc<T = any> = ShareDB.Doc<T>;
34
58
  export type Snapshot<T = any> = ShareDB.Snapshot<T>;
sharedb/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/sharedb",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
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": "255cd0fdfdcbaed88c729a2071841aac7a11bb5ed47272c972d303615f351959",
43
+ "typesPublisherContentHash": "0fede5791642ef4d06d6a137afd9968129407dfe2827787900440ef8cb6555a8",
44
44
  "typeScriptVersion": "3.7"
45
45
  }