@hocuspocus/extension-redis 1.0.0-alpha.49 → 1.0.0-alpha.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/packages/extension-database/src/Database.d.ts +36 -0
- package/dist/packages/extension-database/src/index.d.ts +1 -0
- package/dist/packages/extension-sqlite/src/SQLite.d.ts +26 -0
- package/dist/packages/extension-sqlite/src/index.d.ts +1 -0
- package/dist/packages/extension-webhook/src/index.d.ts +1 -1
- package/dist/packages/provider/src/HocuspocusCloudProvider.d.ts +10 -0
- package/dist/packages/provider/src/HocuspocusProvider.d.ts +1 -1
- package/dist/packages/provider/src/index.d.ts +1 -0
- package/dist/{demos/backend/src/express.d.ts → playground/backend/src/default.d.ts} +0 -0
- package/dist/{demos/backend/src/koa.d.ts → playground/backend/src/express.d.ts} +0 -0
- package/dist/{demos/backend/src/load-document.d.ts → playground/backend/src/koa.d.ts} +0 -0
- package/dist/{demos/backend/src/minimal.d.ts → playground/backend/src/load-document.d.ts} +0 -0
- package/dist/{demos → playground}/backend/src/monitor.d.ts +0 -0
- package/dist/{demos → playground}/backend/src/redis.d.ts +0 -0
- package/dist/{demos → playground}/backend/src/slow.d.ts +0 -0
- package/dist/{demos → playground}/backend/src/webhook.d.ts +0 -0
- package/package.json +5 -5
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Extension, onChangePayload, onLoadDocumentPayload } from '@hocuspocus/server';
|
|
3
|
+
export interface DatabaseConfiguration {
|
|
4
|
+
/**
|
|
5
|
+
* Pass a Promise to retrieve updates from your database. The Promise should resolve to
|
|
6
|
+
* an array of items with Y.js-compatible binary data.
|
|
7
|
+
*/
|
|
8
|
+
fetchUpdates: ({ documentName }: {
|
|
9
|
+
documentName: string;
|
|
10
|
+
}) => Promise<Uint8Array[]>;
|
|
11
|
+
/**
|
|
12
|
+
* Pass a function to store updates in your database.
|
|
13
|
+
*/
|
|
14
|
+
storeUpdate: ({ update, documentName }: {
|
|
15
|
+
update: Buffer;
|
|
16
|
+
documentName: string;
|
|
17
|
+
}) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare class Database implements Extension {
|
|
20
|
+
/**
|
|
21
|
+
* Default configuration
|
|
22
|
+
*/
|
|
23
|
+
configuration: DatabaseConfiguration;
|
|
24
|
+
/**
|
|
25
|
+
* Constructor
|
|
26
|
+
*/
|
|
27
|
+
constructor(configuration: Partial<DatabaseConfiguration>);
|
|
28
|
+
/**
|
|
29
|
+
* Get stored data from the database.
|
|
30
|
+
*/
|
|
31
|
+
onLoadDocument({ document, documentName }: onLoadDocumentPayload): Promise<any>;
|
|
32
|
+
/**
|
|
33
|
+
* Store new updates in the database.
|
|
34
|
+
*/
|
|
35
|
+
onChange({ document, documentName }: onChangePayload): Promise<void>;
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Database';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Database, DatabaseConfiguration } from '@hocuspocus/extension-database';
|
|
2
|
+
import sqlite3 from 'sqlite3';
|
|
3
|
+
export interface SQLiteConfiguration extends DatabaseConfiguration {
|
|
4
|
+
/**
|
|
5
|
+
* Valid values are filenames, ":memory:" for an anonymous in-memory database and an empty
|
|
6
|
+
* string for an anonymous disk-based database. Anonymous databases are not persisted and
|
|
7
|
+
* when closing the database handle, their contents are lost.
|
|
8
|
+
*
|
|
9
|
+
* https://github.com/mapbox/node-sqlite3/wiki/API#new-sqlite3databasefilename-mode-callback
|
|
10
|
+
*/
|
|
11
|
+
database: string;
|
|
12
|
+
/**
|
|
13
|
+
* The database schema to create.
|
|
14
|
+
*/
|
|
15
|
+
schema: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class SQLite extends Database {
|
|
18
|
+
db?: sqlite3.Database;
|
|
19
|
+
configuration: SQLiteConfiguration;
|
|
20
|
+
/**
|
|
21
|
+
* Constructor
|
|
22
|
+
*/
|
|
23
|
+
constructor(configuration?: Partial<SQLiteConfiguration>);
|
|
24
|
+
onListen(): Promise<void>;
|
|
25
|
+
onConfigure(): Promise<void>;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SQLite';
|
|
@@ -42,7 +42,7 @@ export declare class Webhook implements Extension {
|
|
|
42
42
|
/**
|
|
43
43
|
* Send a request to the given url containing the given data
|
|
44
44
|
*/
|
|
45
|
-
sendRequest(event: Events, payload: any): Promise<AxiosResponse<
|
|
45
|
+
sendRequest(event: Events, payload: any): Promise<AxiosResponse<any, any>>;
|
|
46
46
|
/**
|
|
47
47
|
* onChange hook
|
|
48
48
|
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HocuspocusProvider, HocuspocusProviderOptions } from './HocuspocusProvider';
|
|
2
|
+
export interface HocuspocusCloudProviderOptions extends HocuspocusProviderOptions {
|
|
3
|
+
/**
|
|
4
|
+
* A Hocuspocus Cloud key, get one here: https://hocuspocus.cloud/
|
|
5
|
+
*/
|
|
6
|
+
key: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class HocuspocusCloudProvider extends HocuspocusProvider {
|
|
9
|
+
constructor(options: HocuspocusCloudProviderOptions);
|
|
10
|
+
}
|
|
@@ -130,7 +130,7 @@ export declare class HocuspocusProvider extends EventEmitter {
|
|
|
130
130
|
get awareness(): Awareness;
|
|
131
131
|
checkConnection(): void;
|
|
132
132
|
forceSync(): void;
|
|
133
|
-
|
|
133
|
+
registerEventListeners(): void;
|
|
134
134
|
documentUpdateHandler(update: Uint8Array, origin: any): void;
|
|
135
135
|
awarenessUpdateHandler({ added, updated, removed }: any, origin: any): void;
|
|
136
136
|
permissionDeniedHandler(reason: string): void;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hocuspocus/extension-redis",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.50",
|
|
4
4
|
"description": "hocuspocus persistence driver for Redis",
|
|
5
5
|
"homepage": "https://hocuspocus.dev",
|
|
6
6
|
"keywords": [
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@hocuspocus/server": "^1.0.0-alpha.
|
|
31
|
-
"y-redis": "^1.0.
|
|
32
|
-
"yjs": "^13.5.
|
|
30
|
+
"@hocuspocus/server": "^1.0.0-alpha.87",
|
|
31
|
+
"y-redis": "^1.0.3",
|
|
32
|
+
"yjs": "^13.5.22"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "8ffe8d8f4d10ba33f4f203806bd1d4415bef5dc3"
|
|
35
35
|
}
|