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

@hocuspocus/transformer

Package Overview
Dependencies
Maintainers
3
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hocuspocus/transformer - npm Package Compare versions

Comparing version 1.0.0-alpha.22 to 1.0.0-alpha.23

dist/tests/extension-redis/closeConnections.d.ts

3

dist/packages/extension-monitor/src/Collector.d.ts

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

configuration: Partial<Configuration>;
ipAddress: string;
ipAddress: string | null;
nodeVersion: string;

@@ -60,3 +60,4 @@ platform: NodeJS.Platform;

}>;
private getIpAddress;
private static readableYDoc;
}
export * from './Redis';
export * from './RedisCluster';

@@ -1,16 +0,94 @@

import { RedisPersistence } from 'y-redis';
import { Extension, onConnectPayload, onLoadDocumentPayload, onDisconnectPayload } from '@hocuspocus/server';
import RedisClient from 'ioredis';
import Redlock from 'redlock';
import { Document, Extension, afterLoadDocumentPayload, afterStoreDocumentPayload, onDisconnectPayload, onStoreDocumentPayload, onAwarenessUpdatePayload, Debugger, onConfigurePayload, onListenPayload } from '@hocuspocus/server';
export interface Configuration {
/**
* Redis port
*/
port: number;
/**
* Redis host
*/
host: string;
/**
* Options passed directly to Redis constructor
*
* https://github.com/luin/ioredis/blob/master/API.md#new-redisport-host-options
*/
options?: RedisClient.RedisOptions;
/**
* An unique instance name, required to filter messages in Redis.
* If none is provided an unique id is generated.
*/
identifier: string;
/**
* Namespace for Redis keys, if none is provided 'hocuspocus' is used
*/
prefix: string;
/**
* The maximum time for the Redis lock in ms (in case it can’t be released).
*/
lockTimeout: number;
}
export declare class Redis implements Extension {
/**
* Make sure to give that extension a higher priority, so
* the `onStoreDocument` hook is able to intercept the chain,
* before documents are stored to the database.
*/
priority: number;
configuration: Configuration;
cluster: boolean;
persistence: RedisPersistence | undefined;
pub: RedisClient.Redis;
sub: RedisClient.Redis;
documents: Map<string, Document>;
redlock: Redlock;
locks: Map<string, Redlock.Lock>;
logger: Debugger;
constructor(configuration: Partial<Configuration>);
onConfigure({ instance }: onConfigurePayload): Promise<void>;
onListen({ configuration }: onListenPayload): Promise<void>;
private getKey;
private pubKey;
private subKey;
private lockKey;
/**
* Constructor
* Once a document is laoded, subscribe to the channel in Redis.
*/
constructor(configuration?: Partial<Configuration>);
onLoadDocument(data: onLoadDocumentPayload): Promise<import("yjs").Doc | undefined>;
onConnect(data: onConnectPayload): Promise<void>;
onDisconnect(data: onDisconnectPayload): Promise<void>;
afterLoadDocument({ documentName, document }: afterLoadDocumentPayload): Promise<unknown>;
/**
* Publish the first sync step through Redis.
*/
private publishFirstSyncStep;
/**
* Let’s ask Redis who is connected already.
*/
private requestAwarenessFromOtherInstances;
/**
* Before the document is stored, make sure to set a lock in Redis.
* That’s meant to avoid conflicts with other instances trying to store the document.
*/
onStoreDocument({ documentName }: onStoreDocumentPayload): Promise<unknown>;
/**
* Release the Redis lock, so other instances can store documents.
*/
afterStoreDocument({ documentName }: afterStoreDocumentPayload): Promise<void>;
/**
* Handle awareness update messages received directly by this Hocuspocus instance.
*/
onAwarenessUpdate({ documentName, awareness }: onAwarenessUpdatePayload): Promise<number>;
/**
* Handle incoming messages published on all subscribed document channels.
* Note that this will also include messages from ourselves as it is not possible
* in Redis to filter these.
*/
private handleIncomingMessage;
/**
* Make sure to *not* listen for further changes, when there’s
* noone connected anymore.
*/
onDisconnect: ({ documentName, clientsCount }: onDisconnectPayload) => Promise<void>;
/**
* Kill the Redlock connection immediately.
*/
onDestroy(): Promise<void>;
}
/// <reference types="node" />
import WebSocket, { AddressInfo, WebSocketServer } from 'ws';
import { IncomingMessage, Server as HTTPServer } from 'http';
import { Configuration, Hook } from './types';
import { Configuration, HookName, HookPayload } from './types';
import Document from './Document';

@@ -91,3 +91,3 @@ import { Debugger } from './Debugger';

*/
hooks(name: Hook, payload: any, callback?: Function | null): Promise<any>;
hooks(name: HookName, payload: HookPayload, callback?: Function | null): Promise<any>;
/**

@@ -94,0 +94,0 @@ * Get parameters by the given request

@@ -1,9 +0,8 @@

export * from './Hocuspocus';
export * from './Connection';
export * from './Debugger';
export * from './Document';
export * from './Hocuspocus';
export * from './IncomingMessage';
export * from './MessageReceiver';
export * from './OutgoingMessage';
export * from './types';
export * from './MessageReceiver';
export * from './Document';
export * from './Connection';
/// <reference types="node" />
import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'http';
import { URLSearchParams } from 'url';
import { Socket } from 'net';
import { Awareness } from 'y-protocols/awareness';

@@ -47,3 +46,3 @@ import Document from './Document';

}
export declare type Hook = 'onConfigure' | 'onListen' | 'onUpgrade' | 'onConnect' | 'connected' | 'onAuthenticate' |
export declare type HookName = 'onConfigure' | 'onListen' | 'onUpgrade' | 'onConnect' | 'connected' | 'onAuthenticate' |
/**

@@ -53,2 +52,3 @@ * @deprecated onCreateDocument is deprecated, use onLoadDocument instead

'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 interface Configuration extends Extension {

@@ -203,8 +203,10 @@ /**

export interface onUpgradePayload {
request: IncomingMessage;
socket: any;
head: any;
request: IncomingMessage;
socket: Socket;
instance: Hocuspocus;
}
export interface onListenPayload {
instance: Hocuspocus;
configuration: Configuration;
port: number;

@@ -216,5 +218,5 @@ }

export interface onConfigurePayload {
instance: Hocuspocus;
configuration: Configuration;
version: string;
instance: Hocuspocus;
}

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

export * from './newHocuspocusProvider';
export * from './randomInteger';
export * from './redisConnectionSettings';
export * from './removeDirectory';
export * from './sleep';
{
"name": "@hocuspocus/transformer",
"version": "1.0.0-alpha.22",
"version": "1.0.0-alpha.23",
"description": "hocuspocus transformation utilities",

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

"type": "module",
"main": "dist/hocuspocus-transformer.esm.js",
"main": "dist/hocuspocus-transformer.cjs",
"module": "dist/hocuspocus-transformer.esm.js",

@@ -37,3 +37,3 @@ "types": "dist/packages/transformer/src/index.d.ts",

},
"gitHead": "1fc2a6cff1b5fd626b8dd7c486755111965da20d"
"gitHead": "b0a04ffe8d56cfa6b269a2c8ad7f64c92b108de0"
}
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