@types/sharedb 3.3.4 → 3.3.6

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, 11 Oct 2023 12:07:28 GMT
11
+ * Last updated: Tue, 17 Oct 2023 16:37:24 GMT
12
12
  * Dependencies: none
13
13
  * Global values: none
14
14
 
sharedb/index.d.ts CHANGED
@@ -289,6 +289,7 @@ declare namespace sharedb {
289
289
 
290
290
  type Path = ShareDB.Path;
291
291
  type ShareDBSourceOptions = ShareDB.ShareDBSourceOptions;
292
+ const MESSAGE_ACTIONS: ShareDB.RequestActions;
292
293
 
293
294
  namespace middleware {
294
295
  interface ActionContextMap {
sharedb/lib/client.d.ts CHANGED
@@ -10,8 +10,8 @@ export class Connection extends ShareDB.TypedEmitter<ShareDB.ConnectionEventMap>
10
10
  // state on the agent and read it in middleware
11
11
  agent: Agent | null;
12
12
 
13
- collections: Record<string, Record<string, Doc>>;
14
- queries: Record<string, Query>;
13
+ collections: Record<string, Record<string, ShareDB.Doc>>;
14
+ queries: Record<string, ShareDB.Query>;
15
15
 
16
16
  seq: number;
17
17
  id: string | null; // Equals agent.src on the server
@@ -23,19 +23,19 @@ export class Connection extends ShareDB.TypedEmitter<ShareDB.ConnectionEventMap>
23
23
  debug: boolean;
24
24
 
25
25
  close(): void;
26
- get(collectionName: string, documentID: string): Doc;
26
+ get(collectionName: string, documentID: string): ShareDB.Doc;
27
27
  createFetchQuery<T = any>(
28
28
  collectionName: string,
29
29
  query: any,
30
- options?: { results?: Array<Doc<T>> } | null,
31
- callback?: (err: Error, results: Array<Doc<T>>) => void,
32
- ): Query<T>;
30
+ options?: { results?: Array<ShareDB.Doc<T>> } | null,
31
+ callback?: (err: Error, results: Array<ShareDB.Doc<T>>) => void,
32
+ ): ShareDB.Query<T>;
33
33
  createSubscribeQuery<T = any>(
34
34
  collectionName: string,
35
35
  query: any,
36
- options?: { results?: Array<Doc<T>> } | null,
37
- callback?: (err: Error, results: Array<Doc<T>>) => void,
38
- ): Query<T>;
36
+ options?: { results?: Array<ShareDB.Doc<T>> } | null,
37
+ callback?: (err: Error, results: Array<ShareDB.Doc<T>>) => void,
38
+ ): ShareDB.Query<T>;
39
39
  fetchSnapshot(
40
40
  collection: string,
41
41
  id: string,
@@ -48,8 +48,8 @@ export class Connection extends ShareDB.TypedEmitter<ShareDB.ConnectionEventMap>
48
48
  timestamp: number | null,
49
49
  callback: (error: Error, snapshot: ShareDB.Snapshot) => void,
50
50
  ): void;
51
- getPresence(channel: string): Presence;
52
- getDocPresence(collection: string, id: string): Presence;
51
+ getPresence(channel: string): ShareDB.Presence;
52
+ getDocPresence(collection: string, id: string): ShareDB.Presence;
53
53
 
54
54
  /**
55
55
  * Returns whether anything in this client is either:
@@ -77,27 +77,29 @@ export class Connection extends ShareDB.TypedEmitter<ShareDB.ConnectionEventMap>
77
77
 
78
78
  ping(): void;
79
79
  }
80
- export type Doc<T = any> = ShareDB.Doc<T>;
81
- export type Snapshot<T = any> = ShareDB.Snapshot<T>;
82
- export type Query<T = any> = ShareDB.Query<T>;
83
- export type Presence<T = any> = ShareDB.Presence<T>;
84
- export type LocalPresence<T = any> = ShareDB.LocalPresence<T>;
85
- export type Error = ShareDB.Error;
86
- export type Op = ShareDB.Op;
87
- export type AddNumOp = ShareDB.AddNumOp;
88
- export type ListMoveOp = ShareDB.ListMoveOp;
89
- export type ListInsertOp = ShareDB.ListInsertOp;
90
- export type ListDeleteOp = ShareDB.ListDeleteOp;
91
- export type ListReplaceOp = ShareDB.ListReplaceOp;
92
- export type StringInsertOp = ShareDB.StringInsertOp;
93
- export type StringDeleteOp = ShareDB.StringDeleteOp;
94
- export type ObjectInsertOp = ShareDB.ObjectInsertOp;
95
- export type ObjectDeleteOp = ShareDB.ObjectDeleteOp;
96
- export type ObjectReplaceOp = ShareDB.ObjectReplaceOp;
97
- export type SubtypeOp = ShareDB.SubtypeOp;
98
80
 
99
- export type Path = ShareDB.Path;
100
- export type ShareDBSourceOptions = ShareDB.ShareDBSourceOptions;
81
+ export {
82
+ AddNumOp,
83
+ Doc,
84
+ Error,
85
+ ListDeleteOp,
86
+ ListInsertOp,
87
+ ListMoveOp,
88
+ ListReplaceOp,
89
+ LocalPresence,
90
+ ObjectDeleteOp,
91
+ ObjectInsertOp,
92
+ ObjectReplaceOp,
93
+ Op,
94
+ Path,
95
+ Presence,
96
+ Query,
97
+ ShareDBSourceOptions,
98
+ Snapshot,
99
+ StringDeleteOp,
100
+ StringInsertOp,
101
+ SubtypeOp,
102
+ } from "./sharedb";
101
103
 
102
104
  export const types: ShareDB.Types;
103
105
  export const logger: ShareDB.Logger;
sharedb/lib/sharedb.d.ts CHANGED
@@ -174,9 +174,9 @@ export class Doc<T = any> extends TypedEmitter<DocEventMap<T>> {
174
174
 
175
175
  ingestSnapshot(snapshot: Pick<Snapshot<T>, "v" | "type" | "data">, callback?: Callback): void;
176
176
  destroy(callback?: Callback): void;
177
- create(data: any, callback?: Callback): void;
178
- create(data: any, type?: string, callback?: Callback): void;
179
- create(data: any, type?: string, options?: ShareDBSourceOptions, callback?: Callback): void;
177
+ create(data: T, callback?: Callback): void;
178
+ create(data: T, type?: string, callback?: Callback): void;
179
+ create(data: T, type?: string, options?: ShareDBSourceOptions, callback?: Callback): void;
180
180
  submitOp(data: any, options?: ShareDBSourceOptions, callback?: Callback): void;
181
181
  del(callback?: Callback): void;
182
182
  del(options?: ShareDBSourceOptions, callback?: Callback): void;
@@ -277,7 +277,31 @@ export interface LocalPresenceEventMap {
277
277
  "error": (error: Error) => void;
278
278
  }
279
279
 
280
- export type RequestAction = "qf" | "qs" | "qu" | "bf" | "bs" | "bu" | "f" | "s" | "u" | "op" | "nf" | "nt";
280
+ export interface RequestActions {
281
+ initLegacy: "init";
282
+ handshake: "hs";
283
+ queryFetch: "qf";
284
+ querySubscribe: "qs";
285
+ queryUnsubscribe: "qu";
286
+ queryUpdate: "q";
287
+ bulkFetch: "bf";
288
+ bulkSubscribe: "bs";
289
+ bulkUnsubscribe: "bu";
290
+ fetch: "f";
291
+ fixup: "fixup";
292
+ subscribe: "s";
293
+ unsubscribe: "u";
294
+ op: "op";
295
+ snapshotFetch: "nf";
296
+ snapshotFetchByTimestamp: "nt";
297
+ pingPong: "pp";
298
+ presence: "p";
299
+ presenceSubscribe: "ps";
300
+ presenceUnsubscribe: "pu";
301
+ presenceRequest: "pr";
302
+ }
303
+
304
+ export type RequestAction = RequestActions[keyof RequestActions];
281
305
 
282
306
  export interface ClientRequest {
283
307
  /** 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.4",
3
+ "version": "3.3.6",
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": "037a1e2b2d99d2113f3194531d831b12f69b151651405578a8a6cd3ad5db0c90",
43
+ "typesPublisherContentHash": "8e778aefbdb74140b0d1ad976733fb882fa3029b02c493708ca8808883ec2670",
44
44
  "typeScriptVersion": "4.5"
45
45
  }