Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hocuspocus/server

Package Overview
Dependencies
Maintainers
3
Versions
116
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 1.0.0-alpha.75 to 1.0.0-alpha.76

dist/demos/backend/src/load-document.d.ts

22

dist/hocuspocus-server.esm.js

@@ -1581,3 +1581,3 @@ import { WebSocketServer } from 'ws';

var description = "plug & play collaboration backend";
var version = "1.0.0-alpha.74";
var version = "1.0.0-alpha.75";
var homepage = "https://hocuspocus.dev";

@@ -1635,2 +1635,3 @@ var keywords = [

};
const defaultOnCreateDocument = () => new Promise(r => r(null));
/**

@@ -1647,3 +1648,4 @@ * Hocuspocus server

onConnect: () => new Promise(r => r(null)),
onCreateDocument: () => new Promise(r => r(null)),
onCreateDocument: defaultOnCreateDocument,
onLoadDocument: () => new Promise(r => r(null)),
onDestroy: () => new Promise(r => r(null)),

@@ -1666,2 +1668,14 @@ onDisconnect: () => new Promise(r => r(null)),

};
/**
* The `onCreateDocument` hook has been renamed to `onLoadDocument`.
* We’ll keep this workaround to support the deprecated hook for a while, but output a warning.
*/
let onLoadDocument;
if (this.configuration.onCreateDocument !== defaultOnCreateDocument) {
console.warn('[hocuspocus warn]: The onCreateDocument hook has been renamed. Use the onLoadDocument hook instead.');
onLoadDocument = this.configuration.onCreateDocument;
}
else {
onLoadDocument = this.configuration.onLoadDocument;
}
this.configuration.extensions.push({

@@ -1672,3 +1686,3 @@ onAuthenticate: this.configuration.onAuthenticate,

onConnect: this.configuration.onConnect,
onCreateDocument: this.configuration.onCreateDocument,
onLoadDocument,
onDestroy: this.configuration.onDestroy,

@@ -1938,3 +1952,3 @@ onDisconnect: this.configuration.onDisconnect,

};
await this.hooks('onCreateDocument', hookPayload, (loadedDocument) => {
await this.hooks('onLoadDocument', hookPayload, (loadedDocument) => {
// if a hook returns a Y-Doc, encode the document state as update

@@ -1941,0 +1955,0 @@ // and apply it to the newly created document

2

dist/packages/provider/src/HocuspocusProvider.d.ts

@@ -111,3 +111,3 @@ import * as Y from 'yjs';

subscribedToBroadcastChannel: boolean;
webSocket: any;
webSocket: WebSocket | null;
shouldConnect: boolean;

@@ -114,0 +114,0 @@ status: WebSocketStatus;

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

onConfigure?(data: onConfigurePayload): Promise<any>;
onCreateDocument?(data: onCreateDocumentPayload): Promise<any>;
/**
* @deprecated onCreateDocument is deprecated, use onLoadDocument instead
*/
onCreateDocument?(data: onLoadDocumentPayload): Promise<any>;
onLoadDocument?(data: onLoadDocumentPayload): Promise<any>;
onDestroy?(data: onDestroyPayload): Promise<any>;

@@ -77,3 +81,3 @@ onDisconnect?(data: onDisconnectPayload): Promise<any>;

}
export interface onCreateDocumentPayload {
export interface onLoadDocumentPayload {
context: any;

@@ -80,0 +84,0 @@ document: Document;

{
"name": "@hocuspocus/server",
"description": "plug & play collaboration backend",
"version": "1.0.0-alpha.75",
"version": "1.0.0-alpha.76",
"homepage": "https://hocuspocus.dev",

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

},
"gitHead": "49a520f1b6be37139f5c7243a484dc413640869c"
"gitHead": "fa031748b345c53bd71eaeca2bccfcf29cbb36e8"
}

@@ -22,2 +22,4 @@ import * as decoding from 'lib0/decoding'

const defaultOnCreateDocument = () => new Promise(r => r(null))
/**

@@ -33,3 +35,4 @@ * Hocuspocus server

onConnect: () => new Promise(r => r(null)),
onCreateDocument: () => new Promise(r => r(null)),
onCreateDocument: defaultOnCreateDocument,
onLoadDocument: () => new Promise(r => r(null)),
onDestroy: () => new Promise(r => r(null)),

@@ -59,2 +62,14 @@ onDisconnect: () => new Promise(r => r(null)),

/**
* The `onCreateDocument` hook has been renamed to `onLoadDocument`.
* We’ll keep this workaround to support the deprecated hook for a while, but output a warning.
*/
let onLoadDocument
if (this.configuration.onCreateDocument !== defaultOnCreateDocument) {
console.warn('[hocuspocus warn]: The onCreateDocument hook has been renamed. Use the onLoadDocument hook instead.')
onLoadDocument = this.configuration.onCreateDocument
} else {
onLoadDocument = this.configuration.onLoadDocument
}
this.configuration.extensions.push({

@@ -65,3 +80,3 @@ onAuthenticate: this.configuration.onAuthenticate,

onConnect: this.configuration.onConnect,
onCreateDocument: this.configuration.onCreateDocument,
onLoadDocument,
onDestroy: this.configuration.onDestroy,

@@ -367,3 +382,3 @@ onDisconnect: this.configuration.onDisconnect,

await this.hooks('onCreateDocument', hookPayload, (loadedDocument: Doc | undefined) => {
await this.hooks('onLoadDocument', hookPayload, (loadedDocument: Doc | undefined) => {
// if a hook returns a Y-Doc, encode the document state as update

@@ -370,0 +385,0 @@ // and apply it to the newly created document

@@ -43,3 +43,7 @@ import {

onConfigure?(data: onConfigurePayload): Promise<any>,
onCreateDocument?(data: onCreateDocumentPayload): Promise<any>,
/**
* @deprecated onCreateDocument is deprecated, use onLoadDocument instead
*/
onCreateDocument?(data: onLoadDocumentPayload): Promise<any>,
onLoadDocument?(data: onLoadDocumentPayload): Promise<any>,
onDestroy?(data: onDestroyPayload): Promise<any>,

@@ -87,3 +91,3 @@ onDisconnect?(data: onDisconnectPayload): Promise<any>

export interface onCreateDocumentPayload {
export interface onLoadDocumentPayload {
context: any,

@@ -90,0 +94,0 @@ document: Document,

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 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