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

@hocuspocus/provider

Package Overview
Dependencies
Maintainers
3
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hocuspocus/provider - npm Package Compare versions

Comparing version 1.0.0-alpha.36 to 1.0.0-alpha.37

dist/tests/extension-database/fetch.d.ts

8

dist/packages/extension-database/src/Database.d.ts

@@ -1,2 +0,2 @@

import { Extension, onChangePayload, onLoadDocumentPayload, storePayload } from '@hocuspocus/server';
import { Extension, onChangePayload, onLoadDocumentPayload, storePayload, fetchPayload } from '@hocuspocus/server';
export interface DatabaseConfiguration {

@@ -7,5 +7,3 @@ /**

*/
fetch: ({ documentName }: {
documentName: string;
}) => Promise<Uint8Array | null>;
fetch: (data: fetchPayload) => Promise<Uint8Array | null>;
/**

@@ -28,3 +26,3 @@ * Pass a function to store updates in your database.

*/
onLoadDocument({ document, documentName }: onLoadDocumentPayload): Promise<any>;
onLoadDocument(data: onLoadDocumentPayload): Promise<any>;
/**

@@ -31,0 +29,0 @@ * Store new updates in the database.

import RedisClient from 'ioredis';
import Redlock from 'redlock';
import { Document, Extension, afterLoadDocumentPayload, afterStoreDocumentPayload, onDisconnectPayload, onStoreDocumentPayload, onAwarenessUpdatePayload, Debugger, onConfigurePayload, onListenPayload } from '@hocuspocus/server';
import { Document, Extension, afterLoadDocumentPayload, afterStoreDocumentPayload, onDisconnectPayload, onStoreDocumentPayload, onAwarenessUpdatePayload, onChangePayload, Debugger, onConfigurePayload, onListenPayload } from '@hocuspocus/server';
export interface Configuration {

@@ -86,2 +86,6 @@ /**

/**
* if the ydoc changed, we'll need to inform other Hocuspocus servers about it.
*/
onChange(data: onChangePayload): Promise<any>;
/**
* Make sure to *not* listen for further changes, when there’s

@@ -88,0 +92,0 @@ * noone connected anymore.

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

setConfiguration(configuration?: Partial<HocuspocusProviderConfiguration>): void;
boundConnect: () => Promise<void>;
connect(): Promise<void>;

@@ -133,2 +134,4 @@ createWebSocketConnection(): Promise<unknown>;

forceSync(): void;
boundBeforeUnload: () => void;
beforeUnload(): void;
registerEventListeners(): void;

@@ -153,2 +156,3 @@ documentUpdateHandler(update: Uint8Array, origin: any): void;

get broadcastChannel(): string;
boundBroadcastChannelSubscriber: (data: ArrayBuffer) => void;
broadcastChannelSubscriber(data: ArrayBuffer): void;

@@ -155,0 +159,0 @@ subscribeToBroadcastChannel(): void;

@@ -22,3 +22,3 @@ import WebSocket from 'ws';

*/
constructor(name: string, logger: Debugger);
constructor(name: string, logger: Debugger, yDocOptions: {});
/**

@@ -25,0 +25,0 @@ * Check if the Document is empty

@@ -15,2 +15,6 @@ /// <reference types="node" />

quiet: boolean;
yDocOptions: {
gc: boolean;
gcFilter: () => boolean;
};
};

@@ -17,0 +21,0 @@ /**

@@ -11,4 +11,4 @@ import { Awareness } from 'y-protocols/awareness';

apply(document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): void;
readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): 0 | 2 | 1;
readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void, requestFirstSync?: boolean): 0 | 2 | 1;
applyQueryAwarenessMessage(awareness: Awareness, reply?: (message: Uint8Array) => void): void;
}

@@ -10,2 +10,3 @@ import { Encoder } from 'lib0/encoding';

createSyncMessage(): OutgoingMessage;
createSyncReplyMessage(): OutgoingMessage;
createAwarenessUpdateMessage(awareness: Awareness, changedClients?: Array<any>): OutgoingMessage;

@@ -12,0 +13,0 @@ writeQueryAwareness(): OutgoingMessage;

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

Auth = 2,
QueryAwareness = 3
QueryAwareness = 3,
SyncReply = 4
}

@@ -52,3 +53,3 @@ export interface AwarenessUpdate {

'onCreateDocument' | 'onLoadDocument' | 'afterLoadDocument' | 'onChange' | 'onStoreDocument' | 'afterStoreDocument' | 'onAwarenessUpdate' | 'onRequest' | 'onDisconnect' | 'onDestroy';
export declare type HookPayload = onConfigurePayload | onListenPayload | onUpgradePayload | onConnectPayload | connectedPayload | onAuthenticatePayload | onLoadDocumentPayload | onLoadDocumentPayload | onLoadDocumentPayload | onChangePayload | onStoreDocumentPayload | afterStoreDocumentPayload | onAwarenessUpdatePayload | onRequestPayload | onDisconnectPayload | onDestroyPayload;
export declare type HookPayload = onConfigurePayload | onListenPayload | onUpgradePayload | onConnectPayload | connectedPayload | onAuthenticatePayload | onLoadDocumentPayload | onChangePayload | onStoreDocumentPayload | afterStoreDocumentPayload | onAwarenessUpdatePayload | onRequestPayload | onDisconnectPayload | onDestroyPayload;
export interface Configuration extends Extension {

@@ -85,2 +86,9 @@ /**

/**
* options to pass to the ydoc document
*/
yDocOptions: {
gc: boolean;
gcFilter: () => boolean;
};
/**
* Function which returns the (customized) document name based on the request

@@ -185,2 +193,12 @@ */

}[];
export interface fetchPayload {
context: any;
document: Document;
documentName: string;
instance: Hocuspocus;
requestHeaders: IncomingHttpHeaders;
requestParameters: URLSearchParams;
socketId: string;
connection: ConnectionConfiguration;
}
export interface storePayload extends onStoreDocumentPayload {

@@ -187,0 +205,0 @@ state: Buffer;

{
"name": "@hocuspocus/provider",
"version": "1.0.0-alpha.36",
"version": "1.0.0-alpha.37",
"description": "hocuspocus provider",

@@ -37,3 +37,3 @@ "homepage": "https://hocuspocus.dev",

},
"gitHead": "b0a04ffe8d56cfa6b269a2c8ad7f64c92b108de0"
"gitHead": "af278e7c5d91c74afefd9234379c8179c8b91e6d"
}

@@ -262,2 +262,4 @@ import * as Y from 'yjs'

boundConnect = this.connect.bind(this)
async connect() {

@@ -377,2 +379,8 @@ if (this.status === WebSocketStatus.Connected) {

boundBeforeUnload = this.beforeUnload.bind(this)
beforeUnload() {
removeAwarenessStates(this.awareness, [this.document.clientID], 'window unload')
}
registerEventListeners() {

@@ -383,6 +391,4 @@ if (typeof window === 'undefined') {

window.addEventListener('online', this.connect.bind(this))
window.addEventListener('beforeunload', () => {
removeAwarenessStates(this.awareness, [this.document.clientID], 'window unload')
})
window.addEventListener('online', this.boundConnect)
window.addEventListener('beforeunload', this.boundBeforeUnload)
}

@@ -611,3 +617,4 @@

window.removeEventListener('online', this.connect.bind(this))
window.removeEventListener('online', this.boundConnect)
window.removeEventListener('beforeunload', this.boundBeforeUnload)
}

@@ -619,2 +626,4 @@

boundBroadcastChannelSubscriber = this.broadcastChannelSubscriber.bind(this)
broadcastChannelSubscriber(data: ArrayBuffer) {

@@ -631,3 +640,3 @@ this.mux(() => {

if (!this.subscribedToBroadcastChannel) {
bc.subscribe(this.broadcastChannel, this.broadcastChannelSubscriber.bind(this))
bc.subscribe(this.broadcastChannel, this.boundBroadcastChannelSubscriber)
this.subscribedToBroadcastChannel = true

@@ -653,3 +662,3 @@ }

if (this.subscribedToBroadcastChannel) {
bc.unsubscribe(this.broadcastChannel, this.broadcastChannelSubscriber.bind(this))
bc.unsubscribe(this.broadcastChannel, this.boundBroadcastChannelSubscriber)
this.subscribedToBroadcastChannel = false

@@ -656,0 +665,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