@hocuspocus/server
Advanced tools
Comparing version 2.15.0 to 2.15.1-rc.0
@@ -98,3 +98,3 @@ /// <reference types="node" /> | ||
hooks<T extends HookName>(name: T, payload: HookPayloadByName[T], callback?: Function | null): Promise<any>; | ||
unloadDocument(document: Document): void; | ||
unloadDocument(document: Document): Promise<any>; | ||
enableDebugging(): void; | ||
@@ -101,0 +101,0 @@ enableMessageLogging(): void; |
@@ -1,3 +0,3 @@ | ||
import { HocuspocusProvider, HocuspocusProviderConfiguration, HocuspocusProviderWebsocketConfiguration } from '@hocuspocus/provider'; | ||
import { HocuspocusProvider, HocuspocusProviderConfiguration, HocuspocusProviderWebsocket, HocuspocusProviderWebsocketConfiguration } from '@hocuspocus/provider'; | ||
import { Hocuspocus } from '@hocuspocus/server'; | ||
export declare const newHocuspocusProvider: (server: Hocuspocus, options?: Partial<HocuspocusProviderConfiguration>, websocketOptions?: Partial<HocuspocusProviderWebsocketConfiguration>) => HocuspocusProvider; | ||
export declare const newHocuspocusProvider: (server: Hocuspocus, options?: Partial<HocuspocusProviderConfiguration>, websocketOptions?: Partial<HocuspocusProviderWebsocketConfiguration>, websocketProvider?: HocuspocusProviderWebsocket) => HocuspocusProvider; |
{ | ||
"name": "@hocuspocus/server", | ||
"description": "plug & play collaboration backend", | ||
"version": "2.15.0", | ||
"version": "2.15.1-rc.0", | ||
"homepage": "https://hocuspocus.dev", | ||
@@ -32,3 +32,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@hocuspocus/common": "^2.15.0", | ||
"@hocuspocus/common": "^2.15.1-rc.0", | ||
"async-lock": "^1.3.1", | ||
@@ -35,0 +35,0 @@ "kleur": "^4.1.4", |
@@ -277,6 +277,13 @@ import { IncomingMessage } from 'http' | ||
getConnectionsCount(): number { | ||
return Array.from(this.documents.values()).reduce((acc, document) => { | ||
acc += document.getConnectionsCount() | ||
return acc | ||
const uniqueSocketIds = new Set<string>() | ||
const totalDirectConnections = Array.from(this.documents.values()).reduce((acc, document) => { | ||
// Accumulate unique socket IDs | ||
document.getConnections().forEach(({ socketId }) => { | ||
uniqueSocketIds.add(socketId) | ||
}) | ||
// Accumulate direct connections | ||
return acc + document.directConnectionsCount | ||
}, 0) | ||
// Return the sum of unique socket IDs and direct connections | ||
return uniqueSocketIds.size + totalDirectConnections | ||
} | ||
@@ -527,3 +534,3 @@ | ||
.then(() => { | ||
this.hooks('afterStoreDocument', hookPayload).then(() => { | ||
this.hooks('afterStoreDocument', hookPayload).then(async () => { | ||
// Remove document from memory. | ||
@@ -535,3 +542,3 @@ | ||
this.unloadDocument(document) | ||
await this.unloadDocument(document) | ||
}) | ||
@@ -588,3 +595,3 @@ }) | ||
unloadDocument(document: Document) { | ||
async unloadDocument(document: Document): Promise<any> { | ||
const documentName = document.name | ||
@@ -595,3 +602,3 @@ if (!this.documents.has(documentName)) return | ||
document.destroy() | ||
this.hooks('afterUnloadDocument', { instance: this, documentName }) | ||
await this.hooks('afterUnloadDocument', { instance: this, documentName }) | ||
} | ||
@@ -598,0 +605,0 @@ |
@@ -68,3 +68,3 @@ import * as decoding from 'lib0/decoding' | ||
applyAwarenessUpdate(document.awareness, message.readVarUint8Array(), connection) | ||
applyAwarenessUpdate(document.awareness, message.readVarUint8Array(), connection?.webSocket) | ||
@@ -71,0 +71,0 @@ break |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
832129
9882
1
3