@hocuspocus/server
Advanced tools
Comparing version 1.0.0-alpha.53 to 1.0.0-alpha.54
@@ -6,2 +6,10 @@ # Change Log | ||
# [1.0.0-alpha.54](https://github.com/ueberdosis/hocuspocus/compare/@hocuspocus/server@1.0.0-alpha.53...@hocuspocus/server@1.0.0-alpha.54) (2021-06-08) | ||
**Note:** Version bump only for package @hocuspocus/server | ||
# [1.0.0-alpha.53](https://github.com/ueberdosis/hocuspocus/compare/@hocuspocus/server@1.0.0-alpha.52...@hocuspocus/server@1.0.0-alpha.53) (2021-05-15) | ||
@@ -8,0 +16,0 @@ |
@@ -789,4 +789,6 @@ import WebSocket from 'ws'; | ||
if (state !== null) { | ||
state[field] = value; | ||
this.setLocalState(state); | ||
this.setLocalState({ | ||
...state, | ||
[field]: value | ||
}); | ||
} | ||
@@ -1401,9 +1403,13 @@ } | ||
const Forbidden = { | ||
code: 4403, | ||
reason: 'Forbidden', | ||
}; | ||
var name = "@hocuspocus/server"; | ||
var description = "plug & play collaboration backend"; | ||
var version = "1.0.0-alpha.52"; | ||
var version = "1.0.0-alpha.53"; | ||
var homepage = "https://hocuspocus.dev"; | ||
var keywords = [ | ||
"hocuspocus", | ||
"tiptap", | ||
"yjs", | ||
@@ -1413,2 +1419,3 @@ "yjs-websocket", | ||
]; | ||
var license = "MIT"; | ||
var type = "module"; | ||
@@ -1443,2 +1450,3 @@ var main = "dist/hocuspocus-server.esm.js"; | ||
keywords: keywords, | ||
license: license, | ||
type: type, | ||
@@ -1581,4 +1589,7 @@ main: main, | ||
}; | ||
const incomingMessageQueue = []; | ||
// Queue messages before the connection is established | ||
const queueIncomingMessageListener = this.queueIncomingMessage.bind(this); | ||
const queueIncomingMessageListener = (input) => { | ||
this.incomingMessageQueue.push(input); | ||
}; | ||
incoming.on('message', queueIncomingMessageListener); | ||
@@ -1596,3 +1607,3 @@ this.hooks('onConnect', hookPayload, (contextAdditions) => { | ||
// Work through queue messages | ||
this.incomingMessageQueue.forEach(input => { | ||
incomingMessageQueue.forEach(input => { | ||
incoming.emit('message', input); | ||
@@ -1603,3 +1614,3 @@ }); | ||
// if a hook interrupts, close the websocket connection | ||
incoming.close(); | ||
incoming.close(Forbidden.code, Forbidden.reason); | ||
if (e) | ||
@@ -1610,10 +1621,2 @@ throw e; | ||
/** | ||
* Queue incoming WebSocket messages before the onConnect hooks are finished | ||
* and the connection is full established | ||
* @private | ||
*/ | ||
queueIncomingMessage(input) { | ||
this.incomingMessageQueue.push(input); | ||
} | ||
/** | ||
* Handle update of the given document | ||
@@ -1620,0 +1623,0 @@ * @private |
@@ -818,4 +818,6 @@ 'use strict'; | ||
if (state !== null) { | ||
state[field] = value; | ||
this.setLocalState(state); | ||
this.setLocalState({ | ||
...state, | ||
[field]: value | ||
}); | ||
} | ||
@@ -1430,9 +1432,13 @@ } | ||
const Forbidden = { | ||
code: 4403, | ||
reason: 'Forbidden', | ||
}; | ||
var name = "@hocuspocus/server"; | ||
var description = "plug & play collaboration backend"; | ||
var version = "1.0.0-alpha.52"; | ||
var version = "1.0.0-alpha.53"; | ||
var homepage = "https://hocuspocus.dev"; | ||
var keywords = [ | ||
"hocuspocus", | ||
"tiptap", | ||
"yjs", | ||
@@ -1442,2 +1448,3 @@ "yjs-websocket", | ||
]; | ||
var license = "MIT"; | ||
var type = "module"; | ||
@@ -1472,2 +1479,3 @@ var main = "dist/hocuspocus-server.esm.js"; | ||
keywords: keywords, | ||
license: license, | ||
type: type, | ||
@@ -1610,4 +1618,7 @@ main: main, | ||
}; | ||
const incomingMessageQueue = []; | ||
// Queue messages before the connection is established | ||
const queueIncomingMessageListener = this.queueIncomingMessage.bind(this); | ||
const queueIncomingMessageListener = (input) => { | ||
this.incomingMessageQueue.push(input); | ||
}; | ||
incoming.on('message', queueIncomingMessageListener); | ||
@@ -1625,3 +1636,3 @@ this.hooks('onConnect', hookPayload, (contextAdditions) => { | ||
// Work through queue messages | ||
this.incomingMessageQueue.forEach(input => { | ||
incomingMessageQueue.forEach(input => { | ||
incoming.emit('message', input); | ||
@@ -1632,3 +1643,3 @@ }); | ||
// if a hook interrupts, close the websocket connection | ||
incoming.close(); | ||
incoming.close(Forbidden.code, Forbidden.reason); | ||
if (e) | ||
@@ -1639,10 +1650,2 @@ throw e; | ||
/** | ||
* Queue incoming WebSocket messages before the onConnect hooks are finished | ||
* and the connection is full established | ||
* @private | ||
*/ | ||
queueIncomingMessage(input) { | ||
this.incomingMessageQueue.push(input); | ||
} | ||
/** | ||
* Handle update of the given document | ||
@@ -1649,0 +1652,0 @@ * @private |
@@ -35,8 +35,2 @@ /// <reference types="node" /> | ||
/** | ||
* Queue incoming WebSocket messages before the onConnect hooks are finished | ||
* and the connection is full established | ||
* @private | ||
*/ | ||
private queueIncomingMessage; | ||
/** | ||
* Handle update of the given document | ||
@@ -43,0 +37,0 @@ * @private |
@@ -91,1 +91,5 @@ /// <reference types="node" /> | ||
} | ||
export interface CloseEvent { | ||
code: number; | ||
reason: string; | ||
} |
{ | ||
"name": "@hocuspocus/server", | ||
"description": "plug & play collaboration backend", | ||
"version": "1.0.0-alpha.53", | ||
"version": "1.0.0-alpha.54", | ||
"homepage": "https://hocuspocus.dev", | ||
"keywords": [ | ||
"hocuspocus", | ||
"tiptap", | ||
"yjs", | ||
@@ -13,2 +12,3 @@ "yjs-websocket", | ||
], | ||
"license": "MIT", | ||
"type": "module", | ||
@@ -36,3 +36,3 @@ "main": "dist/hocuspocus-server.esm.js", | ||
}, | ||
"gitHead": "bb85db1b03f680f706d3f1a7264f0de0d7c6162b" | ||
"gitHead": "a467438c7d6f3a707bd3424bf9fdd9f229ebe381" | ||
} |
@@ -10,2 +10,3 @@ import WebSocket from 'ws' | ||
import Connection from './Connection' | ||
import { Forbidden } from './CloseEvents' | ||
import packageJson from '../package.json' | ||
@@ -164,4 +165,9 @@ | ||
const incomingMessageQueue: Iterable<number>[] = [] | ||
// Queue messages before the connection is established | ||
const queueIncomingMessageListener = this.queueIncomingMessage.bind(this) | ||
const queueIncomingMessageListener = (input: Iterable<number>) => { | ||
this.incomingMessageQueue.push(input) | ||
} | ||
incoming.on('message', queueIncomingMessageListener) | ||
@@ -181,3 +187,3 @@ | ||
// Work through queue messages | ||
this.incomingMessageQueue.forEach(input => { | ||
incomingMessageQueue.forEach(input => { | ||
incoming.emit('message', input) | ||
@@ -188,3 +194,3 @@ }) | ||
// if a hook interrupts, close the websocket connection | ||
incoming.close() | ||
incoming.close(Forbidden.code, Forbidden.reason) | ||
if (e) throw e | ||
@@ -196,11 +202,2 @@ }) | ||
/** | ||
* Queue incoming WebSocket messages before the onConnect hooks are finished | ||
* and the connection is full established | ||
* @private | ||
*/ | ||
private queueIncomingMessage(input: Iterable<number>): void { | ||
this.incomingMessageQueue.push(input) | ||
} | ||
/** | ||
* Handle update of the given document | ||
@@ -207,0 +204,0 @@ * @private |
@@ -106,1 +106,6 @@ import { | ||
} | ||
export interface CloseEvent { | ||
code: number, | ||
reason: string, | ||
} |
Sorry, the diff of this file is not supported yet
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
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
446169
58
4951
2