@hocuspocus/server
Advanced tools
Comparing version 2.13.1 to 2.13.2
@@ -92,3 +92,3 @@ /// <reference types="node" /> | ||
loadDocument(documentName: string, request: Partial<Pick<IncomingMessage, 'headers' | 'url'>>, socketId: string, connection: ConnectionConfiguration, context?: any): Promise<Document>; | ||
storeDocumentHooks(document: Document, hookPayload: onStoreDocumentPayload): Promise<void>; | ||
storeDocumentHooks(document: Document, hookPayload: onStoreDocumentPayload, immediately?: boolean): any; | ||
/** | ||
@@ -95,0 +95,0 @@ * Run the given hook on all configured extensions. |
{ | ||
"name": "@hocuspocus/server", | ||
"description": "plug & play collaboration backend", | ||
"version": "2.13.1", | ||
"version": "2.13.2", | ||
"homepage": "https://hocuspocus.dev", | ||
@@ -32,7 +32,7 @@ "keywords": [ | ||
"dependencies": { | ||
"@hocuspocus/common": "^2.13.1", | ||
"@hocuspocus/common": "^2.13.2", | ||
"async-lock": "^1.3.1", | ||
"kleur": "^4.1.4", | ||
"lib0": "^0.2.47", | ||
"uuid": "^9.0.0", | ||
"uuid": "^10.0.0", | ||
"ws": "^8.5.0" | ||
@@ -39,0 +39,0 @@ }, |
@@ -45,3 +45,3 @@ import { URLSearchParams } from 'url' | ||
transactionOrigin, | ||
}) | ||
}, true) | ||
} | ||
@@ -63,3 +63,3 @@ | ||
socketId: 'server', | ||
}) | ||
}, true) | ||
@@ -66,0 +66,0 @@ this.document = null |
@@ -381,3 +381,3 @@ import { IncomingMessage } from 'http' | ||
*/ | ||
private handleDocumentUpdate(document: Document, connection: Connection | undefined, update: Uint8Array, request?: IncomingMessage): void { | ||
private async handleDocumentUpdate(document: Document, connection: Connection | undefined, update: Uint8Array, request?: IncomingMessage) { | ||
const hookPayload: onChangePayload | onStoreDocumentPayload = { | ||
@@ -409,8 +409,3 @@ instance: this, | ||
this.debouncer.debounce( | ||
`onStoreDocument-${document.name}`, | ||
() => this.storeDocumentHooks(document, hookPayload), | ||
this.configuration.debounce, | ||
this.configuration.maxDebounce, | ||
) | ||
await this.storeDocumentHooks(document, hookPayload) | ||
} | ||
@@ -526,22 +521,30 @@ | ||
storeDocumentHooks(document: Document, hookPayload: onStoreDocumentPayload) { | ||
return this.hooks('onStoreDocument', hookPayload) | ||
.then(() => { | ||
this.hooks('afterStoreDocument', hookPayload).then(() => { | ||
// Remove document from memory. | ||
storeDocumentHooks(document: Document, hookPayload: onStoreDocumentPayload, immediately?: boolean) { | ||
return this.debouncer.debounce( | ||
`onStoreDocument-${document.name}`, | ||
() => { | ||
return this.hooks('onStoreDocument', hookPayload) | ||
.then(() => { | ||
this.hooks('afterStoreDocument', hookPayload).then(() => { | ||
// Remove document from memory. | ||
if (document.getConnectionsCount() > 0) { | ||
return | ||
} | ||
if (document.getConnectionsCount() > 0) { | ||
return | ||
} | ||
this.unloadDocument(document) | ||
}) | ||
}) | ||
.catch(error => { | ||
console.error('Caught error during storeDocumentHooks', error) | ||
this.unloadDocument(document) | ||
}) | ||
}) | ||
.catch(error => { | ||
console.error('Caught error during storeDocumentHooks', error) | ||
if (error?.message) { | ||
throw error | ||
} | ||
}) | ||
if (error?.message) { | ||
throw error | ||
} | ||
}) | ||
}, | ||
immediately ? 0 : this.configuration.debounce, | ||
this.configuration.maxDebounce, | ||
) | ||
} | ||
@@ -548,0 +551,0 @@ |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
822054
9706
+ Addeduuid@10.0.0(transitive)
- Removeduuid@9.0.1(transitive)
Updated@hocuspocus/common@^2.13.2
Updateduuid@^10.0.0