@types/sharedb 3.3.13 → 5.1.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: Tue, 15 Oct 2024 16:40:27 GMT
11
+ * Last updated: Fri, 17 Apr 2026 12:48:05 GMT
12
12
  * Dependencies: none
13
13
 
14
14
  # Credits
sharedb/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  import { EventEmitter } from "events";
4
4
  import { Duplex } from "stream";
5
5
  import Agent = require("./lib/agent");
6
- import { Connection } from "./lib/client";
6
+ import { Connection, Snapshot } from "./lib/client";
7
7
  import * as ShareDB from "./lib/sharedb";
8
8
 
9
9
  interface PubSubOptions {
@@ -56,6 +56,27 @@ declare class sharedb extends EventEmitter {
56
56
  * or session info.
57
57
  */
58
58
  listen(stream: Duplex, request?: any): Agent;
59
+ fetch<T = unknown>(
60
+ agent: Agent,
61
+ index: string,
62
+ id: string,
63
+ callback: (error: Error | null, snapshot?: Snapshot<T>) => void,
64
+ ): void;
65
+ fetch<T = unknown>(
66
+ agent: Agent,
67
+ index: string,
68
+ id: string,
69
+ options: ShareDB.BackendFetchOptions | null,
70
+ callback: (error: Error | null, snapshot?: Snapshot<T>) => void,
71
+ ): void;
72
+ submit(
73
+ agent: Agent,
74
+ index: string,
75
+ id: string,
76
+ op: SubmitRequest["op"],
77
+ options: ShareDB.BackendSubmitOptions | null,
78
+ callback: (error: Error | null, ops: any[], request?: SubmitRequest) => void,
79
+ ): void;
59
80
  close(callback?: BasicCallback): void;
60
81
  /**
61
82
  * Registers a server middleware function.
@@ -109,6 +130,7 @@ declare namespace sharedb {
109
130
  suppressPublish?: boolean;
110
131
  maxSubmitRetries?: number;
111
132
  doNotForwardSendPresenceErrorsToClient?: boolean;
133
+ doNotCommitNoOps?: boolean;
112
134
  errorHandler?: ErrorHandler;
113
135
 
114
136
  presence?: boolean;
sharedb/lib/agent.d.ts CHANGED
@@ -35,6 +35,10 @@ declare class Agent<TCustom = any> {
35
35
  clientId: string;
36
36
  src: string;
37
37
  connectTime: number;
38
+ protocol: {
39
+ major: number;
40
+ minor: number;
41
+ };
38
42
 
39
43
  /**
40
44
  * Sends a JSON-compatible message to the client for this agent.
sharedb/lib/sharedb.d.ts CHANGED
@@ -104,9 +104,9 @@ export interface RawOp {
104
104
  d: DocumentID;
105
105
  }
106
106
 
107
- export type CreateOp = RawOp & { create: { type: string; data: any }; del: undefined; op: undefined };
108
- export type DeleteOp = RawOp & { del: boolean; create: undefined; op: undefined };
109
- export type EditOp = RawOp & { op: any[]; create: undefined; del: undefined };
107
+ export type CreateOp = Partial<RawOp> & { create: { type: string; data: any } };
108
+ export type DeleteOp = Partial<RawOp> & { del: boolean };
109
+ export type EditOp = Partial<RawOp> & { op: any[] };
110
110
 
111
111
  export type OTType = "ot-text" | "ot-json0" | "ot-json1" | "ot-text-tp2" | "rich-text";
112
112
 
@@ -154,6 +154,12 @@ export interface ShareDBSourceOptions {
154
154
  // interface ShareDBCreateOptions extends ShareDBSourceOptions {}
155
155
  // interface ShareDBDelOptions extends ShareDBSourceOptions {}
156
156
  // interface ShareDBSubmitOpOptions extends ShareDBSourceOptions {}
157
+ export interface BackendFetchOptions {
158
+ snapshotOptions?: Record<string, unknown>;
159
+ }
160
+ export interface BackendSubmitOptions {
161
+ [key: string]: unknown;
162
+ }
157
163
 
158
164
  export type Callback = (err: Error) => any;
159
165
 
sharedb/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/sharedb",
3
- "version": "3.3.13",
3
+ "version": "5.1.1",
4
4
  "description": "TypeScript definitions for sharedb",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sharedb",
6
6
  "license": "MIT",
@@ -45,6 +45,7 @@
45
45
  },
46
46
  "scripts": {},
47
47
  "dependencies": {},
48
- "typesPublisherContentHash": "0a678cfa232f8d549ecf76cebed8c0a39464b47e2b1c48517f8eccb361d7c17c",
49
- "typeScriptVersion": "4.8"
48
+ "peerDependencies": {},
49
+ "typesPublisherContentHash": "443d4b1ff851f8daa543926a236c92f63fe218fc978e04c78f88adfa6e89ee47",
50
+ "typeScriptVersion": "5.3"
50
51
  }