New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@hocuspocus/server

Package Overview
Dependencies
Maintainers
6
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hocuspocus/server - npm Package Compare versions

Comparing version
4.0.0-rc.0
to
4.0.0-rc.1
+3
-3
package.json
{
"name": "@hocuspocus/server",
"description": "plug & play collaboration backend",
"version": "4.0.0-rc.0",
"version": "4.0.0-rc.1",
"homepage": "https://hocuspocus.dev",

@@ -32,3 +32,3 @@ "keywords": [

"dependencies": {
"@hocuspocus/common": "^4.0.0-rc.0",
"@hocuspocus/common": "^4.0.0-rc.1",
"async-lock": "^1.3.1",

@@ -47,3 +47,3 @@ "async-mutex": "^0.5.0",

},
"gitHead": "3fe6c023877badd74d3ea3e50019b73660e028a4",
"gitHead": "730ac02724fcc44bbbfcc5849df4b0cafb996450",
"repository": {

@@ -50,0 +50,0 @@ "url": "https://github.com/ueberdosis/hocuspocus"

import crypto from "node:crypto";
import { ResetConnection, awarenessStatesToArray } from "@hocuspocus/common";
import { Doc } from "yjs";
import { applyUpdate, encodeStateAsUpdate } from "yjs";
import meta from "../package.json" assert { type: "json" };
import { awarenessStatesToArray, ResetConnection, SkipFurtherHooksError } from "@hocuspocus/common";
import { applyUpdate, Doc, encodeStateAsUpdate } from "yjs";
import meta from "../package.json" with { type: "json" };
import { ClientConnection } from "./ClientConnection.ts";

@@ -12,2 +12,3 @@ import { DirectConnection } from "./DirectConnection.ts";

AwarenessUpdate,
beforeBroadcastStatelessPayload,
Configuration,

@@ -17,7 +18,6 @@ ConnectionConfiguration,

HookPayloadByName,
WebSocketLike,
beforeBroadcastStatelessPayload,
onChangePayload,
onDisconnectPayload,
onStoreDocumentPayload,
WebSocketLike,
} from "./types.ts";

@@ -175,6 +175,3 @@ import { isTransactionOrigin, shouldSkipStoreHooks } from "./types.ts";

const debounceId = `onStoreDocument-${document.name}`;
if (
!document.isLoading &&
this.debouncer.isDebounced(debounceId)
) {
if (!document.isLoading && this.debouncer.isDebounced(debounceId)) {
this.debouncer.executeNow(debounceId);

@@ -329,2 +326,6 @@ }

): Promise<Document> {
if (!documentName.trim()) {
throw new Error("Document name must not be empty");
}
const existingLoadingDoc = this.loadingDocuments.get(documentName);

@@ -479,13 +480,24 @@

} catch (error: any) {
console.error("Caught error during storeDocumentHooks", error);
if (error?.message) {
throw error;
if (error instanceof SkipFurtherHooksError) {
// Another extension handled this — proceed to unload
setTimeout(() => {
if (this.shouldUnloadDocument(document)) {
this.unloadDocument(document);
}
}, 0);
return;
}
} finally {
setTimeout(() => {
if (this.shouldUnloadDocument(document)) {
this.unloadDocument(document);
}
}, 0);
console.error(
"Caught error during storeDocumentHooks. Document stays in memory to avoid data loss",
error,
);
return;
}
setTimeout(() => {
if (this.shouldUnloadDocument(document)) {
this.unloadDocument(document);
}
}, 0);
},

@@ -492,0 +504,0 @@ immediately ? 0 : this.configuration.debounce,

@@ -58,8 +58,2 @@ import { AuthMessageType } from "@hocuspocus/common";

} else if (connection) {
// TODO: We should log this, shouldn't we?
// this.logger.log({
// direction: 'out',
// type: MessageType.Awareness,
// category: 'Update',
// })
connection.send(message.toUint8Array());

@@ -179,5 +173,5 @@ }

// no new changes in update
const ackMessage = new OutgoingMessage(messageAddress).writeSyncStatus(
true,
);
const ackMessage = new OutgoingMessage(
messageAddress,
).writeSyncStatus(true);

@@ -187,5 +181,5 @@ connection.send(ackMessage.toUint8Array());

// new changes in update that we can't apply, because readOnly
const ackMessage = new OutgoingMessage(messageAddress).writeSyncStatus(
false,
);
const ackMessage = new OutgoingMessage(
messageAddress,
).writeSyncStatus(false);

@@ -192,0 +186,0 @@ connection.send(ackMessage.toUint8Array());

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display