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

@hocuspocus/extension-database

Package Overview
Dependencies
Maintainers
3
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hocuspocus/extension-database - npm Package Compare versions

Comparing version 1.0.0-alpha.15 to 1.0.0-alpha.16

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

8

dist/hocuspocus-database.esm.js

@@ -23,8 +23,8 @@ import * as Y from 'yjs';

*/
async onLoadDocument({ document, documentName }) {
const update = await this.configuration.fetch({ documentName });
async onLoadDocument(data) {
const update = await this.configuration.fetch(data);
if (update) {
Y.applyUpdate(document, update);
Y.applyUpdate(data.document, update);
}
return document;
return data.document;
}

@@ -31,0 +31,0 @@ /**

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

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

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

@@ -183,2 +183,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 {

@@ -185,0 +195,0 @@ state: Buffer;

{
"name": "@hocuspocus/extension-database",
"description": "a generic Hocuspocus persistence driver for the database",
"version": "1.0.0-alpha.15",
"version": "1.0.0-alpha.16",
"homepage": "https://hocuspocus.dev",

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

"dependencies": {
"@hocuspocus/server": "^1.0.0-alpha.101",
"@hocuspocus/server": "^1.0.0-alpha.102",
"yjs": "^13.5.29"

@@ -36,3 +36,3 @@ },

},
"gitHead": "b0a04ffe8d56cfa6b269a2c8ad7f64c92b108de0"
"gitHead": "450e12c89b027bc62683f151330a98074cd8e8fb"
}
import {
Extension, onChangePayload, onLoadDocumentPayload, storePayload,
Extension,
onChangePayload,
onLoadDocumentPayload,
storePayload,
fetchPayload,
} from '@hocuspocus/server'

@@ -11,3 +15,3 @@ import * as Y from 'yjs'

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

@@ -41,10 +45,10 @@ * Pass a function to store updates in your database.

*/
async onLoadDocument({ document, documentName }: onLoadDocumentPayload): Promise<any> {
const update = await this.configuration.fetch({ documentName })
async onLoadDocument(data: onLoadDocumentPayload): Promise<any> {
const update = await this.configuration.fetch(data)
if (update) {
Y.applyUpdate(document, update)
Y.applyUpdate(data.document, update)
}
return document
return data.document
}

@@ -51,0 +55,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 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