Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#70913 [sharedb] add new doNotCommitNoOps…
Browse files Browse the repository at this point in the history
… backend option and `agent.protocol` by @alecgibson
  • Loading branch information
alecgibson authored Oct 23, 2024
1 parent ab6216c commit 0620f0c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions types/sharedb/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ declare namespace sharedb {
suppressPublish?: boolean;
maxSubmitRetries?: number;
doNotForwardSendPresenceErrorsToClient?: boolean;
doNotCommitNoOps?: boolean;
errorHandler?: ErrorHandler;

presence?: boolean;
Expand Down
4 changes: 4 additions & 0 deletions types/sharedb/lib/agent.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ declare class Agent<TCustom = any> {
clientId: string;
src: string;
connectTime: number;
protocol: {
major: number;
minor: number;
};

/**
* Sends a JSON-compatible message to the client for this agent.
Expand Down
2 changes: 1 addition & 1 deletion types/sharedb/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/sharedb",
"version": "3.3.9999",
"version": "5.1.9999",
"projects": [
"https://github.com/share/sharedb"
],
Expand Down
3 changes: 3 additions & 0 deletions types/sharedb/sharedb-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const options: ShareDB.ShareDBOptions = {
milestoneDb: new MyMilestoneDB(),
suppressPublish: false,
maxSubmitRetries: 3,
doNotCommitNoOps: true,
errorHandler: (error, context) => {
console.log(error, context.agent.custom);
},
Expand Down Expand Up @@ -156,6 +157,8 @@ backend.use("connect", (context, callback) => {
context.backend,
context.stream,
context.req,
context.agent.protocol.major,
context.agent.protocol.minor,
);
callback();
});
Expand Down

0 comments on commit 0620f0c

Please sign in to comment.