Socket
Socket
Sign inDemoInstall

@hocuspocus/server

Package Overview
Dependencies
Maintainers
4
Versions
115
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 2.0.1 to 2.0.2

dist/playground/backend/src/tiptapcollab.d.ts

2

dist/packages/server/src/Connection.d.ts

@@ -42,3 +42,3 @@ /// <reference types="node" />

*/
beforeHandleMessage(callback: (payload: Document, update: Uint8Array) => Promise<any>): Connection;
beforeHandleMessage(callback: (connection: Connection, update: Uint8Array) => Promise<any>): Connection;
/**

@@ -45,0 +45,0 @@ * Send the given message

@@ -179,2 +179,3 @@ /// <reference types="node" />

socketId: string;
connection: Connection;
}

@@ -181,0 +182,0 @@ export interface beforeBroadcastStatelessPayload {

{
"name": "@hocuspocus/server",
"description": "plug & play collaboration backend",
"version": "2.0.1",
"version": "2.0.2",
"homepage": "https://hocuspocus.dev",

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

"dependencies": {
"@hocuspocus/common": "^2.0.1",
"@hocuspocus/common": "^2.0.2",
"@types/async-lock": "^1.1.3",

@@ -34,0 +34,0 @@ "@types/uuid": "^9.0.0",

@@ -32,3 +32,3 @@ import { IncomingMessage as HTTPIncomingMessage } from 'http'

onClose: [(document: Document, event?: CloseEvent) => null],
beforeHandleMessage: (document: Document, update: Uint8Array) => Promise,
beforeHandleMessage: (connection: Connection, update: Uint8Array) => Promise,
statelessCallback: () => Promise,

@@ -112,3 +112,3 @@ }

*/
beforeHandleMessage(callback: (payload: Document, update: Uint8Array) => Promise<any>): Connection {
beforeHandleMessage(callback: (connection: Connection, update: Uint8Array) => Promise<any>): Connection {
this.callbacks.beforeHandleMessage = callback

@@ -234,3 +234,3 @@

this.callbacks.beforeHandleMessage(this.document, data)
this.callbacks.beforeHandleMessage(this, data)
.then(() => {

@@ -237,0 +237,0 @@ new MessageReceiver(

@@ -578,3 +578,3 @@ import { createServer, IncomingMessage, Server as HTTPServer } from 'http'

*/
private handleDocumentUpdate(document: Document, connection: Connection, update: Uint8Array, request: IncomingMessage, socketId: string): void {
private handleDocumentUpdate(document: Document, connection: Connection | undefined, update: Uint8Array, request?: IncomingMessage): void {
const hookPayload = {

@@ -586,5 +586,5 @@ instance: this,

documentName: document.name,
requestHeaders: request.headers,
requestHeaders: request?.headers,
requestParameters: Hocuspocus.getParameters(request),
socketId,
socketId: connection?.socketId,
update,

@@ -700,3 +700,3 @@ }

document.onUpdate((document: Document, connection: Connection, update: Uint8Array) => {
this.handleDocumentUpdate(document, connection, update, request, connection?.socketId)
this.handleDocumentUpdate(document, connection, update, connection?.request)
})

@@ -797,3 +797,3 @@

instance.beforeHandleMessage((document, update) => {
instance.beforeHandleMessage((connection, update) => {
const hookPayload: beforeHandleMessagePayload = {

@@ -805,2 +805,3 @@ instance: this,

socketId,
connection,
documentName: document.name,

@@ -865,3 +866,3 @@ requestHeaders: request.headers,

*/
private static getParameters(request: IncomingMessage): URLSearchParams {
private static getParameters(request?: IncomingMessage): URLSearchParams {
const query = request?.url?.split('?') || []

@@ -868,0 +869,0 @@ return new URLSearchParams(query[1] ? query[1] : '')

@@ -231,2 +231,3 @@ import {

socketId: string,
connection: Connection
}

@@ -233,0 +234,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc