Socket
Socket
Sign inDemoInstall

@hocuspocus/common

Package Overview
Dependencies
Maintainers
4
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hocuspocus/common - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0-alpha.0

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

2

dist/packages/extension-monitor/src/Dashboard.d.ts
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from 'http';
import { Socket } from 'net';
import WebSocket, { WebSocketServer } from 'ws';
import { Socket } from 'net';
import { Storage } from './Storage';

@@ -6,0 +6,0 @@ export interface Configuration {

/// <reference types="node" />
import { IncomingMessage, ServerResponse } from 'http';
import { Extension, onChangePayload, onConfigurePayload, onLoadDocumentPayload, onDisconnectPayload, onRequestPayload, onUpgradePayload, connectedPayload } from '@hocuspocus/server';
import { IncomingMessage, ServerResponse } from 'http';
import WebSocket from 'ws';

@@ -5,0 +5,0 @@ import { Storage } from './Storage';

import { HocuspocusProvider, HocuspocusProviderConfiguration } from './HocuspocusProvider';
export declare type HocuspocusCloudProviderConfiguration = Required<Pick<HocuspocusProviderConfiguration, 'name'>> & Partial<HocuspocusProviderConfiguration> & AdditionalHocuspocusCloudProviderConfiguration;
import { HocuspocusProviderWebsocketConfiguration } from './HocuspocusProviderWebsocket';
export declare type HocuspocusCloudProviderConfiguration = Required<Pick<HocuspocusProviderConfiguration, 'name'>> & Partial<HocuspocusProviderConfiguration> & Partial<Pick<HocuspocusProviderWebsocketConfiguration, 'url'>> & AdditionalHocuspocusCloudProviderConfiguration;
export interface AdditionalHocuspocusCloudProviderConfiguration {

@@ -4,0 +5,0 @@ /**

import * as Y from 'yjs';
import { Awareness } from 'y-protocols/awareness';
import * as mutex from 'lib0/mutex';
import type { Event, CloseEvent, MessageEvent } from 'ws';
import type { CloseEvent, Event, MessageEvent } from 'ws';
import EventEmitter from './EventEmitter';
import { ConstructableOutgoingMessage, onAuthenticationFailedParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatelessParameters, onStatusParameters, onSyncedParameters, WebSocketStatus } from './types';
import { HocuspocusProviderWebsocket } from './HocuspocusProviderWebsocket';
import { onAwarenessChangeParameters, onAwarenessUpdateParameters } from '.';
export declare type HocuspocusProviderConfiguration = Required<Pick<CompleteHocuspocusProviderConfiguration, 'url' | 'name'>> & Partial<CompleteHocuspocusProviderConfiguration>;
export declare type HocuspocusProviderConfiguration = Required<Pick<CompleteHocuspocusProviderConfiguration, 'name' | 'websocketProvider'>> & Partial<CompleteHocuspocusProviderConfiguration>;
export interface CompleteHocuspocusProviderConfiguration {
/**
* URL of your @hocuspocus/server instance
*/
url: string;
/**
* The identifier/name of your document

@@ -23,6 +20,2 @@ */

/**
* Pass `false` to start the connection manually.
*/
connect: boolean;
/**
* Pass false to disable broadcasting between browser tabs.

@@ -46,5 +39,5 @@ */

/**
* An optional WebSocket polyfill, for example for Node.js
* Hocuspocus websocket provider
*/
WebSocketPolyfill: any;
websocketProvider: HocuspocusProviderWebsocket;
/**

@@ -54,38 +47,2 @@ * Force syncing the document in the defined interval.

forceSyncInterval: false | number;
/**
* Disconnect when no message is received for the defined amount of milliseconds.
*/
messageReconnectTimeout: number;
/**
* The delay between each attempt in milliseconds. You can provide a factor to have the delay grow exponentially.
*/
delay: number;
/**
* The intialDelay is the amount of time to wait before making the first attempt. This option should typically be 0 since you typically want the first attempt to happen immediately.
*/
initialDelay: number;
/**
* The factor option is used to grow the delay exponentially.
*/
factor: number;
/**
* The maximum number of attempts or 0 if there is no limit on number of attempts.
*/
maxAttempts: number;
/**
* minDelay is used to set a lower bound of delay when jitter is enabled. This property has no effect if jitter is disabled.
*/
minDelay: number;
/**
* The maxDelay option is used to set an upper bound for the delay when factor is enabled. A value of 0 can be provided if there should be no upper bound when calculating delay.
*/
maxDelay: number;
/**
* If jitter is true then the calculated delay will be a random integer value between minDelay and the calculated delay for the current iteration.
*/
jitter: boolean;
/**
* A timeout in milliseconds. If timeout is non-zero then a timer is set using setTimeout. If the timeout is triggered then future attempts will be aborted.
*/
timeout: number;
onAuthenticated: () => void;

@@ -113,28 +70,14 @@ onAuthenticationFailed: (data: onAuthenticationFailedParameters) => void;

subscribedToBroadcastChannel: boolean;
webSocket: WebSocket | null;
shouldConnect: boolean;
status: WebSocketStatus;
isSynced: boolean;
unsyncedChanges: number;
status: WebSocketStatus;
isAuthenticated: boolean;
lastMessageReceived: number;
mux: mutex.mutex;
intervals: any;
connectionAttempt: {
resolve: (value?: any) => void;
reject: (reason?: any) => void;
} | null;
constructor(configuration: HocuspocusProviderConfiguration);
onStatus({ status }: onStatusParameters): void;
setConfiguration(configuration?: Partial<HocuspocusProviderConfiguration>): void;
boundConnect: () => Promise<unknown>;
cancelWebsocketRetry?: () => void;
connect(): Promise<unknown>;
createWebSocketConnection(): Promise<unknown>;
resolveConnectionAttempt(): void;
stopConnectionAttempt(): void;
rejectConnectionAttempt(): void;
get document(): Y.Doc;
get awareness(): Awareness;
get hasUnsyncedChanges(): boolean;
checkConnection(): void;
forceSync(): void;

@@ -147,6 +90,2 @@ boundBeforeUnload: () => void;

awarenessUpdateHandler({ added, updated, removed }: any, origin: any): void;
permissionDeniedHandler(reason: string): void;
authenticatedHandler(): void;
get serverUrl(): string;
get url(): string;
get synced(): boolean;

@@ -160,6 +99,8 @@ set synced(state: boolean);

startSync(): void;
send(Message: ConstructableOutgoingMessage, args: any, broadcast?: boolean): void;
send(message: ConstructableOutgoingMessage, args: any, broadcast?: boolean): void;
onMessage(event: MessageEvent): void;
onClose(event: CloseEvent): void;
destroy(): void;
permissionDeniedHandler(reason: string): void;
authenticatedHandler(): void;
get broadcastChannel(): string;

@@ -166,0 +107,0 @@ boundBroadcastChannelSubscriber: (data: ArrayBuffer) => void;

@@ -10,6 +10,8 @@ import { Decoder } from 'lib0/decoding';

readVarUint(): MessageType;
readVarString(): string;
readVarUint8Array(): Uint8Array;
writeVarUint(type: MessageType): void;
writeVarString(string: string): void;
writeVarUint8Array(data: Uint8Array): void;
length(): number;
}
export * from './HocuspocusProvider';
export * from './HocuspocusCloudProvider';
export * from './HocuspocusProviderWebsocket';
export * from './types';

@@ -30,2 +30,3 @@ import { Awareness } from 'y-protocols/awareness';

export interface OutgoingMessageArguments {
documentName: string;
token: string;

@@ -32,0 +33,0 @@ document: Y.Doc;

/// <reference types="node" />
import { IncomingMessage as HTTPIncomingMessage } from 'http';
import AsyncLock from 'async-lock';
import WebSocket from 'ws';
import { IncomingMessage as HTTPIncomingMessage } from 'http';
import { CloseEvent } from '@hocuspocus/common';

@@ -65,13 +65,3 @@ import Document from './Document';

private handleMessage;
/**
* Get the underlying connection instance
* @deprecated
*/
get instance(): WebSocket;
/**
* Get the underlying connection instance
* @deprecated
*/
get connection(): WebSocket;
}
export default Connection;
/// <reference types="node" />
import { IncomingMessage, Server as HTTPServer } from 'http';
import WebSocket, { AddressInfo, WebSocketServer } from 'ws';
import { IncomingMessage, Server as HTTPServer } from 'http';
import { Configuration, HookName, HookPayload } from './types';
import { Configuration, HookName, HookPayload, onListenPayload } from './types';
import Document from './Document';
import { Debugger } from './Debugger';
import { onListenPayload } from '.';
export declare const defaultConfiguration: {

@@ -71,3 +70,3 @@ name: null;

*/
handleConnection(incoming: WebSocket, request: IncomingMessage, documentName: string, context?: any): void;
handleConnection(incoming: WebSocket, request: IncomingMessage, context?: any): void;
/**

@@ -102,6 +101,2 @@ * Handle update of the given document

private static getParameters;
/**
* Get document name by the given request
*/
private getDocumentNameFromRequest;
enableDebugging(): void;

@@ -108,0 +103,0 @@ enableMessageLogging(): void;

@@ -19,3 +19,4 @@ import { Decoder } from 'lib0/decoding';

writeVarUint(type: MessageType): void;
writeVarString(string: string): void;
get length(): number;
}

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

import { Awareness } from 'y-protocols/awareness';
import Connection from './Connection';

@@ -12,3 +11,3 @@ import { IncomingMessage } from './IncomingMessage';

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

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

category?: string;
constructor();
constructor(documentName: string);
createSyncMessage(): OutgoingMessage;

@@ -11,0 +11,0 @@ createSyncReplyMessage(): OutgoingMessage;

@@ -5,2 +5,3 @@ export * from './createDirectory';

export * from './newHocuspocusProvider';
export * from './newHocuspocusProviderWebsocket';
export * from './randomInteger';

@@ -7,0 +8,0 @@ export * from './redisConnectionSettings';

@@ -1,3 +0,3 @@

import { HocuspocusProvider, HocuspocusProviderConfiguration } from '@hocuspocus/provider';
import { HocuspocusProvider, HocuspocusProviderConfiguration, HocuspocusProviderWebsocketConfiguration } from '@hocuspocus/provider';
import { Hocuspocus } from '@hocuspocus/server';
export declare const newHocuspocusProvider: (server: Hocuspocus, options?: Partial<Omit<HocuspocusProviderConfiguration, 'url'>>) => HocuspocusProvider;
export declare const newHocuspocusProvider: (server: Hocuspocus, options?: Partial<HocuspocusProviderConfiguration>, websocketOptions?: Partial<HocuspocusProviderWebsocketConfiguration>) => HocuspocusProvider;
{
"name": "@hocuspocus/common",
"description": "shared code for multiple Hocuspocus packages",
"version": "1.1.0",
"version": "2.0.0-alpha.0",
"homepage": "https://hocuspocus.dev",

@@ -6,0 +6,0 @@ "keywords": [

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