@hocuspocus/extension-webhook 1.0.0-alpha.50 → 1.0.0-alpha.51

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.
@@ -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<unknown, any>>;
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
- registerBeforeUnloadEventListener(): void;
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;
@@ -1,3 +1,4 @@
1
1
  export * from './HocuspocusProvider';
2
+ export * from './HocuspocusCloudProvider';
2
3
  export * from './types';
3
4
  export * from './utils';
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hocuspocus/extension-webhook",
3
- "version": "1.0.0-alpha.50",
3
+ "version": "1.0.0-alpha.51",
4
4
  "description": "hocuspocus webhook extension",
5
5
  "homepage": "https://hocuspocus.dev",
6
6
  "keywords": [
@@ -29,9 +29,9 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "@hocuspocus/server": "^1.0.0-alpha.86",
33
- "@hocuspocus/transformer": "^1.0.0-alpha.17",
34
- "axios": "^0.23.0"
32
+ "@hocuspocus/server": "^1.0.0-alpha.87",
33
+ "@hocuspocus/transformer": "^1.0.0-alpha.18",
34
+ "axios": "^0.24.0"
35
35
  },
36
- "gitHead": "505fc82451201ef77847dc5bc9e92edb498dcb8e"
36
+ "gitHead": "8ffe8d8f4d10ba33f4f203806bd1d4415bef5dc3"
37
37
  }