hocuspocus lol
This commit is contained in:
parent
d3c930cac6
commit
3b387e7e4a
21
services/hocuspocus/node_modules/.bin/node-gyp
generated
vendored
Executable file
21
services/hocuspocus/node_modules/.bin/node-gyp
generated
vendored
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$NODE_PATH" ]; then
|
||||
export NODE_PATH="/Users/red/workdev/ulti-backend/services/hocuspocus/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/bin/node_modules:/Users/red/workdev/ulti-backend/services/hocuspocus/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/node_modules:/Users/red/workdev/ulti-backend/services/hocuspocus/node_modules/.pnpm/node-gyp@8.4.1/node_modules:/Users/red/workdev/ulti-backend/services/hocuspocus/node_modules/.pnpm/node_modules"
|
||||
else
|
||||
export NODE_PATH="/Users/red/workdev/ulti-backend/services/hocuspocus/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/bin/node_modules:/Users/red/workdev/ulti-backend/services/hocuspocus/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/node_modules:/Users/red/workdev/ulti-backend/services/hocuspocus/node_modules/.pnpm/node-gyp@8.4.1/node_modules:/Users/red/workdev/ulti-backend/services/hocuspocus/node_modules/.pnpm/node_modules:$NODE_PATH"
|
||||
fi
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../.pnpm/node-gyp@8.4.1/node_modules/node-gyp/bin/node-gyp.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../.pnpm/node-gyp@8.4.1/node_modules/node-gyp/bin/node-gyp.js" "$@"
|
||||
fi
|
||||
121
services/hocuspocus/node_modules/.modules.yaml
generated
vendored
Normal file
121
services/hocuspocus/node_modules/.modules.yaml
generated
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
hoistPattern:
|
||||
- '*'
|
||||
hoistedDependencies:
|
||||
'@hocuspocus/common@4.1.0':
|
||||
'@hocuspocus/common': private
|
||||
'@tiptap/core@3.26.0(@tiptap/pm@3.26.0)':
|
||||
'@tiptap/core': private
|
||||
'@tiptap/extension-blockquote@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-blockquote': private
|
||||
'@tiptap/extension-bold@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-bold': private
|
||||
'@tiptap/extension-bullet-list@3.26.0(@tiptap/extension-list@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-bullet-list': private
|
||||
'@tiptap/extension-code-block@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))(@tiptap/pm@3.26.0)':
|
||||
'@tiptap/extension-code-block': private
|
||||
'@tiptap/extension-code@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-code': private
|
||||
'@tiptap/extension-document@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-document': private
|
||||
'@tiptap/extension-dropcursor@3.26.0(@tiptap/extensions@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-dropcursor': private
|
||||
'@tiptap/extension-gapcursor@3.26.0(@tiptap/extensions@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-gapcursor': private
|
||||
'@tiptap/extension-hard-break@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-hard-break': private
|
||||
'@tiptap/extension-heading@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-heading': private
|
||||
'@tiptap/extension-horizontal-rule@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))(@tiptap/pm@3.26.0)':
|
||||
'@tiptap/extension-horizontal-rule': private
|
||||
'@tiptap/extension-italic@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-italic': private
|
||||
'@tiptap/extension-link@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))(@tiptap/pm@3.26.0)':
|
||||
'@tiptap/extension-link': private
|
||||
'@tiptap/extension-list-item@3.26.0(@tiptap/extension-list@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-list-item': private
|
||||
'@tiptap/extension-list-keymap@3.26.0(@tiptap/extension-list@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-list-keymap': private
|
||||
'@tiptap/extension-list@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))(@tiptap/pm@3.26.0)':
|
||||
'@tiptap/extension-list': private
|
||||
'@tiptap/extension-ordered-list@3.26.0(@tiptap/extension-list@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-ordered-list': private
|
||||
'@tiptap/extension-paragraph@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-paragraph': private
|
||||
'@tiptap/extension-strike@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-strike': private
|
||||
'@tiptap/extension-text@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-text': private
|
||||
'@tiptap/extension-underline@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))':
|
||||
'@tiptap/extension-underline': private
|
||||
'@tiptap/extensions@3.26.0(@tiptap/core@3.26.0(@tiptap/pm@3.26.0))(@tiptap/pm@3.26.0)':
|
||||
'@tiptap/extensions': private
|
||||
'@tiptap/pm@3.26.0':
|
||||
'@tiptap/pm': private
|
||||
async-mutex@0.5.0:
|
||||
async-mutex: private
|
||||
crossws@0.4.5:
|
||||
crossws: private
|
||||
isomorphic.js@0.2.5:
|
||||
isomorphic.js: private
|
||||
kleur@4.1.5:
|
||||
kleur: private
|
||||
lib0@0.2.117:
|
||||
lib0: private
|
||||
linkifyjs@4.3.3:
|
||||
linkifyjs: private
|
||||
orderedmap@2.1.1:
|
||||
orderedmap: private
|
||||
prosemirror-changeset@2.4.1:
|
||||
prosemirror-changeset: private
|
||||
prosemirror-commands@1.7.1:
|
||||
prosemirror-commands: private
|
||||
prosemirror-dropcursor@1.8.2:
|
||||
prosemirror-dropcursor: private
|
||||
prosemirror-gapcursor@1.4.1:
|
||||
prosemirror-gapcursor: private
|
||||
prosemirror-history@1.5.0:
|
||||
prosemirror-history: private
|
||||
prosemirror-inputrules@1.5.1:
|
||||
prosemirror-inputrules: private
|
||||
prosemirror-keymap@1.2.3:
|
||||
prosemirror-keymap: private
|
||||
prosemirror-model@1.25.7:
|
||||
prosemirror-model: private
|
||||
prosemirror-schema-list@1.5.1:
|
||||
prosemirror-schema-list: private
|
||||
prosemirror-state@1.4.4:
|
||||
prosemirror-state: private
|
||||
prosemirror-tables@1.8.5:
|
||||
prosemirror-tables: private
|
||||
prosemirror-transform@1.12.0:
|
||||
prosemirror-transform: private
|
||||
prosemirror-view@1.41.8:
|
||||
prosemirror-view: private
|
||||
rope-sequence@1.3.4:
|
||||
rope-sequence: private
|
||||
tslib@2.8.1:
|
||||
tslib: private
|
||||
w3c-keyname@2.2.8:
|
||||
w3c-keyname: private
|
||||
y-prosemirror@1.3.7(prosemirror-model@1.25.7)(prosemirror-state@1.4.4)(prosemirror-view@1.41.8)(y-protocols@1.0.7(yjs@13.6.31))(yjs@13.6.31):
|
||||
y-prosemirror: private
|
||||
y-protocols@1.0.7(yjs@13.6.31):
|
||||
y-protocols: private
|
||||
included:
|
||||
dependencies: true
|
||||
devDependencies: true
|
||||
optionalDependencies: true
|
||||
injectedDeps: {}
|
||||
layoutVersion: 5
|
||||
nodeLinker: isolated
|
||||
packageManager: pnpm@10.22.0
|
||||
pendingBuilds: []
|
||||
prunedAt: Tue, 09 Jun 2026 08:22:21 GMT
|
||||
publicHoistPattern: []
|
||||
registries:
|
||||
'@jsr': https://npm.jsr.io/
|
||||
default: https://registry.npmjs.org/
|
||||
skipped: []
|
||||
storeDir: /Users/red/.local/share/pnpm/store/v10
|
||||
virtualStoreDir: .pnpm
|
||||
virtualStoreDirMaxLength: 120
|
||||
25
services/hocuspocus/node_modules/.pnpm-workspace-state-v1.json
generated
vendored
Normal file
25
services/hocuspocus/node_modules/.pnpm-workspace-state-v1.json
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"lastValidatedTimestamp": 1780995133107,
|
||||
"projects": {},
|
||||
"pnpmfiles": [],
|
||||
"settings": {
|
||||
"autoInstallPeers": true,
|
||||
"dedupeDirectDeps": false,
|
||||
"dedupeInjectedDeps": true,
|
||||
"dedupePeerDependents": true,
|
||||
"dev": true,
|
||||
"excludeLinksFromLockfile": false,
|
||||
"hoistPattern": [
|
||||
"*"
|
||||
],
|
||||
"hoistWorkspacePackages": true,
|
||||
"injectWorkspacePackages": false,
|
||||
"linkWorkspacePackages": false,
|
||||
"nodeLinker": "isolated",
|
||||
"optional": true,
|
||||
"preferWorkspacePackages": false,
|
||||
"production": true,
|
||||
"publicHoistPattern": []
|
||||
},
|
||||
"filteredInstall": false
|
||||
}
|
||||
10
services/hocuspocus/node_modules/.pnpm/@gar+promisify@1.1.3/node_modules/@gar/promisify/LICENSE.md
generated
vendored
Normal file
10
services/hocuspocus/node_modules/.pnpm/@gar+promisify@1.1.3/node_modules/@gar/promisify/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright © 2020-2022 Michael Garvin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
65
services/hocuspocus/node_modules/.pnpm/@gar+promisify@1.1.3/node_modules/@gar/promisify/README.md
generated
vendored
Normal file
65
services/hocuspocus/node_modules/.pnpm/@gar+promisify@1.1.3/node_modules/@gar/promisify/README.md
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
# @gar/promisify
|
||||
|
||||
### Promisify an entire object or class instance
|
||||
|
||||
This module leverages es6 Proxy and Reflect to promisify every function in an
|
||||
object or class instance.
|
||||
|
||||
It assumes the callback that the function is expecting is the last
|
||||
parameter, and that it is an error-first callback with only one value,
|
||||
i.e. `(err, value) => ...`. This mirrors node's `util.promisify` method.
|
||||
|
||||
In order that you can use it as a one-stop-shop for all your promisify
|
||||
needs, you can also pass it a function. That function will be
|
||||
promisified as normal using node's built-in `util.promisify` method.
|
||||
|
||||
[node's custom promisified
|
||||
functions](https://nodejs.org/api/util.html#util_custom_promisified_functions)
|
||||
will also be mirrored, further allowing this to be a drop-in replacement
|
||||
for the built-in `util.promisify`.
|
||||
|
||||
### Examples
|
||||
|
||||
Promisify an entire object
|
||||
|
||||
```javascript
|
||||
|
||||
const promisify = require('@gar/promisify')
|
||||
|
||||
class Foo {
|
||||
constructor (attr) {
|
||||
this.attr = attr
|
||||
}
|
||||
|
||||
double (input, cb) {
|
||||
cb(null, input * 2)
|
||||
}
|
||||
|
||||
const foo = new Foo('baz')
|
||||
const promisified = promisify(foo)
|
||||
|
||||
console.log(promisified.attr)
|
||||
console.log(await promisified.double(1024))
|
||||
```
|
||||
|
||||
Promisify a function
|
||||
|
||||
```javascript
|
||||
|
||||
const promisify = require('@gar/promisify')
|
||||
|
||||
function foo (a, cb) {
|
||||
if (a !== 'bad') {
|
||||
return cb(null, 'ok')
|
||||
}
|
||||
return cb('not ok')
|
||||
}
|
||||
|
||||
const promisified = promisify(foo)
|
||||
|
||||
// This will resolve to 'ok'
|
||||
promisified('good')
|
||||
|
||||
// this will reject
|
||||
promisified('bad')
|
||||
```
|
||||
36
services/hocuspocus/node_modules/.pnpm/@gar+promisify@1.1.3/node_modules/@gar/promisify/index.js
generated
vendored
Normal file
36
services/hocuspocus/node_modules/.pnpm/@gar+promisify@1.1.3/node_modules/@gar/promisify/index.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
'use strict'
|
||||
|
||||
const { promisify } = require('util')
|
||||
|
||||
const handler = {
|
||||
get: function (target, prop, receiver) {
|
||||
if (typeof target[prop] !== 'function') {
|
||||
return target[prop]
|
||||
}
|
||||
if (target[prop][promisify.custom]) {
|
||||
return function () {
|
||||
return Reflect.get(target, prop, receiver)[promisify.custom].apply(target, arguments)
|
||||
}
|
||||
}
|
||||
return function () {
|
||||
return new Promise((resolve, reject) => {
|
||||
Reflect.get(target, prop, receiver).apply(target, [...arguments, function (err, result) {
|
||||
if (err) {
|
||||
return reject(err)
|
||||
}
|
||||
resolve(result)
|
||||
}])
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function (thingToPromisify) {
|
||||
if (typeof thingToPromisify === 'function') {
|
||||
return promisify(thingToPromisify)
|
||||
}
|
||||
if (typeof thingToPromisify === 'object') {
|
||||
return new Proxy(thingToPromisify, handler)
|
||||
}
|
||||
throw new TypeError('Can only promisify functions or objects')
|
||||
}
|
||||
32
services/hocuspocus/node_modules/.pnpm/@gar+promisify@1.1.3/node_modules/@gar/promisify/package.json
generated
vendored
Normal file
32
services/hocuspocus/node_modules/.pnpm/@gar+promisify@1.1.3/node_modules/@gar/promisify/package.json
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "@gar/promisify",
|
||||
"version": "1.1.3",
|
||||
"description": "Promisify an entire class or object",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/wraithgar/gar-promisify.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "standard",
|
||||
"lint:fix": "standard --fix",
|
||||
"test": "lab -a @hapi/code -t 100",
|
||||
"posttest": "npm run lint"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"promisify",
|
||||
"all",
|
||||
"class",
|
||||
"object"
|
||||
],
|
||||
"author": "Gar <gar+npm@danger.computer>",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@hapi/code": "^8.0.1",
|
||||
"@hapi/lab": "^24.1.0",
|
||||
"standard": "^16.0.3"
|
||||
}
|
||||
}
|
||||
14
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/README.md
generated
vendored
Normal file
14
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/README.md
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
# @hocuspocus/common
|
||||
[](https://www.npmjs.com/package/@hocuspocus/common)
|
||||
[](https://npmcharts.com/compare/tiptap?minimal=true)
|
||||
[](https://www.npmjs.com/package/@hocuspocus/common)
|
||||
[](https://github.com/sponsors/ueberdosis)
|
||||
|
||||
## Introduction
|
||||
Hocuspocus is an opinionated collaborative editing backend for [Tiptap](https://github.com/ueberdosis/tiptap) – based on [Y.js](https://github.com/yjs/yjs), a CRDT framework with a powerful abstraction of shared data.
|
||||
|
||||
## Official Documentation
|
||||
Documentation can be found in the [GitHub repository](https://github.com/ueberdosis/hocuspocus).
|
||||
|
||||
## License
|
||||
Hocuspocus is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/hocuspocus/blob/main/LICENSE.md).
|
||||
521
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/hocuspocus-common.cjs
generated
vendored
Normal file
521
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/hocuspocus-common.cjs
generated
vendored
Normal file
@ -0,0 +1,521 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Common Math expressions.
|
||||
*
|
||||
* @module math
|
||||
*/
|
||||
|
||||
const floor = Math.floor;
|
||||
|
||||
/**
|
||||
* @function
|
||||
* @param {number} a
|
||||
* @param {number} b
|
||||
* @return {number} The smaller element of a and b
|
||||
*/
|
||||
const min = (a, b) => a < b ? a : b;
|
||||
|
||||
/**
|
||||
* @function
|
||||
* @param {number} a
|
||||
* @param {number} b
|
||||
* @return {number} The bigger element of a and b
|
||||
*/
|
||||
const max = (a, b) => a > b ? a : b;
|
||||
|
||||
/* eslint-env browser */
|
||||
|
||||
const BIT8 = 128;
|
||||
const BITS7 = 127;
|
||||
|
||||
/**
|
||||
* Utility helpers for working with numbers.
|
||||
*
|
||||
* @module number
|
||||
*/
|
||||
|
||||
|
||||
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @return {Uint8Array}
|
||||
*/
|
||||
const _encodeUtf8Polyfill = str => {
|
||||
const encodedString = unescape(encodeURIComponent(str));
|
||||
const len = encodedString.length;
|
||||
const buf = new Uint8Array(len);
|
||||
for (let i = 0; i < len; i++) {
|
||||
buf[i] = /** @type {number} */ (encodedString.codePointAt(i));
|
||||
}
|
||||
return buf
|
||||
};
|
||||
|
||||
/* c8 ignore next */
|
||||
const utf8TextEncoder = /** @type {TextEncoder} */ (typeof TextEncoder !== 'undefined' ? new TextEncoder() : null);
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @return {Uint8Array}
|
||||
*/
|
||||
const _encodeUtf8Native = str => utf8TextEncoder.encode(str);
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @return {Uint8Array}
|
||||
*/
|
||||
/* c8 ignore next */
|
||||
const encodeUtf8 = utf8TextEncoder ? _encodeUtf8Native : _encodeUtf8Polyfill;
|
||||
|
||||
/* c8 ignore next */
|
||||
let utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf-8', { fatal: true, ignoreBOM: true });
|
||||
|
||||
/* c8 ignore start */
|
||||
if (utf8TextDecoder && utf8TextDecoder.decode(new Uint8Array()).length === 1) {
|
||||
// Safari doesn't handle BOM correctly.
|
||||
// This fixes a bug in Safari 13.0.5 where it produces a BOM the first time it is called.
|
||||
// utf8TextDecoder.decode(new Uint8Array()).length === 1 on the first call and
|
||||
// utf8TextDecoder.decode(new Uint8Array()).length === 1 on the second call
|
||||
// Another issue is that from then on no BOM chars are recognized anymore
|
||||
/* c8 ignore next */
|
||||
utf8TextDecoder = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Efficient schema-less binary encoding with support for variable length encoding.
|
||||
*
|
||||
* Use [lib0/encoding] with [lib0/decoding]. Every encoding function has a corresponding decoding function.
|
||||
*
|
||||
* Encodes numbers in little-endian order (least to most significant byte order)
|
||||
* and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/)
|
||||
* which is also used in Protocol Buffers.
|
||||
*
|
||||
* ```js
|
||||
* // encoding step
|
||||
* const encoder = encoding.createEncoder()
|
||||
* encoding.writeVarUint(encoder, 256)
|
||||
* encoding.writeVarString(encoder, 'Hello world!')
|
||||
* const buf = encoding.toUint8Array(encoder)
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* // decoding step
|
||||
* const decoder = decoding.createDecoder(buf)
|
||||
* decoding.readVarUint(decoder) // => 256
|
||||
* decoding.readVarString(decoder) // => 'Hello world!'
|
||||
* decoding.hasContent(decoder) // => false - all data is read
|
||||
* ```
|
||||
*
|
||||
* @module encoding
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Write one byte to the encoder.
|
||||
*
|
||||
* @function
|
||||
* @param {Encoder} encoder
|
||||
* @param {number} num The byte that is to be encoded.
|
||||
*/
|
||||
const write = (encoder, num) => {
|
||||
const bufferLen = encoder.cbuf.length;
|
||||
if (encoder.cpos === bufferLen) {
|
||||
encoder.bufs.push(encoder.cbuf);
|
||||
encoder.cbuf = new Uint8Array(bufferLen * 2);
|
||||
encoder.cpos = 0;
|
||||
}
|
||||
encoder.cbuf[encoder.cpos++] = num;
|
||||
};
|
||||
|
||||
/**
|
||||
* Write a variable length unsigned integer. Max encodable integer is 2^53.
|
||||
*
|
||||
* @function
|
||||
* @param {Encoder} encoder
|
||||
* @param {number} num The number that is to be encoded.
|
||||
*/
|
||||
const writeVarUint = (encoder, num) => {
|
||||
while (num > BITS7) {
|
||||
write(encoder, BIT8 | (BITS7 & num));
|
||||
num = floor(num / 128); // shift >>> 7
|
||||
}
|
||||
write(encoder, BITS7 & num);
|
||||
};
|
||||
|
||||
/**
|
||||
* A cache to store strings temporarily
|
||||
*/
|
||||
const _strBuffer = new Uint8Array(30000);
|
||||
const _maxStrBSize = _strBuffer.length / 3;
|
||||
|
||||
/**
|
||||
* Write a variable length string.
|
||||
*
|
||||
* @function
|
||||
* @param {Encoder} encoder
|
||||
* @param {String} str The string that is to be encoded.
|
||||
*/
|
||||
const _writeVarStringNative = (encoder, str) => {
|
||||
if (str.length < _maxStrBSize) {
|
||||
// We can encode the string into the existing buffer
|
||||
/* c8 ignore next */
|
||||
const written = utf8TextEncoder.encodeInto(str, _strBuffer).written || 0;
|
||||
writeVarUint(encoder, written);
|
||||
for (let i = 0; i < written; i++) {
|
||||
write(encoder, _strBuffer[i]);
|
||||
}
|
||||
} else {
|
||||
writeVarUint8Array(encoder, encodeUtf8(str));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Write a variable length string.
|
||||
*
|
||||
* @function
|
||||
* @param {Encoder} encoder
|
||||
* @param {String} str The string that is to be encoded.
|
||||
*/
|
||||
const _writeVarStringPolyfill = (encoder, str) => {
|
||||
const encodedString = unescape(encodeURIComponent(str));
|
||||
const len = encodedString.length;
|
||||
writeVarUint(encoder, len);
|
||||
for (let i = 0; i < len; i++) {
|
||||
write(encoder, /** @type {number} */ (encodedString.codePointAt(i)));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Write a variable length string.
|
||||
*
|
||||
* @function
|
||||
* @param {Encoder} encoder
|
||||
* @param {String} str The string that is to be encoded.
|
||||
*/
|
||||
/* c8 ignore next */
|
||||
const writeVarString = (utf8TextEncoder && /** @type {any} */ (utf8TextEncoder).encodeInto) ? _writeVarStringNative : _writeVarStringPolyfill;
|
||||
|
||||
/**
|
||||
* Append fixed-length Uint8Array to the encoder.
|
||||
*
|
||||
* @function
|
||||
* @param {Encoder} encoder
|
||||
* @param {Uint8Array} uint8Array
|
||||
*/
|
||||
const writeUint8Array = (encoder, uint8Array) => {
|
||||
const bufferLen = encoder.cbuf.length;
|
||||
const cpos = encoder.cpos;
|
||||
const leftCopyLen = min(bufferLen - cpos, uint8Array.length);
|
||||
const rightCopyLen = uint8Array.length - leftCopyLen;
|
||||
encoder.cbuf.set(uint8Array.subarray(0, leftCopyLen), cpos);
|
||||
encoder.cpos += leftCopyLen;
|
||||
if (rightCopyLen > 0) {
|
||||
// Still something to write, write right half..
|
||||
// Append new buffer
|
||||
encoder.bufs.push(encoder.cbuf);
|
||||
// must have at least size of remaining buffer
|
||||
encoder.cbuf = new Uint8Array(max(bufferLen * 2, rightCopyLen));
|
||||
// copy array
|
||||
encoder.cbuf.set(uint8Array.subarray(leftCopyLen));
|
||||
encoder.cpos = rightCopyLen;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Append an Uint8Array to Encoder.
|
||||
*
|
||||
* @function
|
||||
* @param {Encoder} encoder
|
||||
* @param {Uint8Array} uint8Array
|
||||
*/
|
||||
const writeVarUint8Array = (encoder, uint8Array) => {
|
||||
writeVarUint(encoder, uint8Array.byteLength);
|
||||
writeUint8Array(encoder, uint8Array);
|
||||
};
|
||||
|
||||
/**
|
||||
* Error helpers.
|
||||
*
|
||||
* @module error
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {string} s
|
||||
* @return {Error}
|
||||
*/
|
||||
/* c8 ignore next */
|
||||
const create = s => new Error(s);
|
||||
|
||||
/**
|
||||
* Efficient schema-less binary decoding with support for variable length encoding.
|
||||
*
|
||||
* Use [lib0/decoding] with [lib0/encoding]. Every encoding function has a corresponding decoding function.
|
||||
*
|
||||
* Encodes numbers in little-endian order (least to most significant byte order)
|
||||
* and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/)
|
||||
* which is also used in Protocol Buffers.
|
||||
*
|
||||
* ```js
|
||||
* // encoding step
|
||||
* const encoder = encoding.createEncoder()
|
||||
* encoding.writeVarUint(encoder, 256)
|
||||
* encoding.writeVarString(encoder, 'Hello world!')
|
||||
* const buf = encoding.toUint8Array(encoder)
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* // decoding step
|
||||
* const decoder = decoding.createDecoder(buf)
|
||||
* decoding.readVarUint(decoder) // => 256
|
||||
* decoding.readVarString(decoder) // => 'Hello world!'
|
||||
* decoding.hasContent(decoder) // => false - all data is read
|
||||
* ```
|
||||
*
|
||||
* @module decoding
|
||||
*/
|
||||
|
||||
|
||||
const errorUnexpectedEndOfArray = create('Unexpected end of array');
|
||||
const errorIntegerOutOfRange = create('Integer out of Range');
|
||||
|
||||
/**
|
||||
* Create an Uint8Array view of the next `len` bytes and advance the position by `len`.
|
||||
*
|
||||
* Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks.
|
||||
* Use `buffer.copyUint8Array` to copy the result into a new Uint8Array.
|
||||
*
|
||||
* @function
|
||||
* @param {Decoder} decoder The decoder instance
|
||||
* @param {number} len The length of bytes to read
|
||||
* @return {Uint8Array}
|
||||
*/
|
||||
const readUint8Array = (decoder, len) => {
|
||||
const view = new Uint8Array(decoder.arr.buffer, decoder.pos + decoder.arr.byteOffset, len);
|
||||
decoder.pos += len;
|
||||
return view
|
||||
};
|
||||
|
||||
/**
|
||||
* Read variable length Uint8Array.
|
||||
*
|
||||
* Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks.
|
||||
* Use `buffer.copyUint8Array` to copy the result into a new Uint8Array.
|
||||
*
|
||||
* @function
|
||||
* @param {Decoder} decoder
|
||||
* @return {Uint8Array}
|
||||
*/
|
||||
const readVarUint8Array = decoder => readUint8Array(decoder, readVarUint(decoder));
|
||||
|
||||
/**
|
||||
* Read one byte as unsigned integer.
|
||||
* @function
|
||||
* @param {Decoder} decoder The decoder instance
|
||||
* @return {number} Unsigned 8-bit integer
|
||||
*/
|
||||
const readUint8 = decoder => decoder.arr[decoder.pos++];
|
||||
|
||||
/**
|
||||
* Read unsigned integer (32bit) with variable length.
|
||||
* 1/8th of the storage is used as encoding overhead.
|
||||
* * numbers < 2^7 is stored in one bytlength
|
||||
* * numbers < 2^14 is stored in two bylength
|
||||
*
|
||||
* @function
|
||||
* @param {Decoder} decoder
|
||||
* @return {number} An unsigned integer.length
|
||||
*/
|
||||
const readVarUint = decoder => {
|
||||
let num = 0;
|
||||
let mult = 1;
|
||||
const len = decoder.arr.length;
|
||||
while (decoder.pos < len) {
|
||||
const r = decoder.arr[decoder.pos++];
|
||||
// num = num | ((r & binary.BITS7) << len)
|
||||
num = num + (r & BITS7) * mult; // shift $r << (7*#iterations) and add it to num
|
||||
mult *= 128; // next iteration, shift 7 "more" to the left
|
||||
if (r < BIT8) {
|
||||
return num
|
||||
}
|
||||
/* c8 ignore start */
|
||||
if (num > MAX_SAFE_INTEGER) {
|
||||
throw errorIntegerOutOfRange
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
}
|
||||
throw errorUnexpectedEndOfArray
|
||||
};
|
||||
|
||||
/**
|
||||
* We don't test this function anymore as we use native decoding/encoding by default now.
|
||||
* Better not modify this anymore..
|
||||
*
|
||||
* Transforming utf8 to a string is pretty expensive. The code performs 10x better
|
||||
* when String.fromCodePoint is fed with all characters as arguments.
|
||||
* But most environments have a maximum number of arguments per functions.
|
||||
* For effiency reasons we apply a maximum of 10000 characters at once.
|
||||
*
|
||||
* @function
|
||||
* @param {Decoder} decoder
|
||||
* @return {String} The read String.
|
||||
*/
|
||||
/* c8 ignore start */
|
||||
const _readVarStringPolyfill = decoder => {
|
||||
let remainingLen = readVarUint(decoder);
|
||||
if (remainingLen === 0) {
|
||||
return ''
|
||||
} else {
|
||||
let encodedString = String.fromCodePoint(readUint8(decoder)); // remember to decrease remainingLen
|
||||
if (--remainingLen < 100) { // do not create a Uint8Array for small strings
|
||||
while (remainingLen--) {
|
||||
encodedString += String.fromCodePoint(readUint8(decoder));
|
||||
}
|
||||
} else {
|
||||
while (remainingLen > 0) {
|
||||
const nextLen = remainingLen < 10000 ? remainingLen : 10000;
|
||||
// this is dangerous, we create a fresh array view from the existing buffer
|
||||
const bytes = decoder.arr.subarray(decoder.pos, decoder.pos + nextLen);
|
||||
decoder.pos += nextLen;
|
||||
// Starting with ES5.1 we can supply a generic array-like object as arguments
|
||||
encodedString += String.fromCodePoint.apply(null, /** @type {any} */ (bytes));
|
||||
remainingLen -= nextLen;
|
||||
}
|
||||
}
|
||||
return decodeURIComponent(escape(encodedString))
|
||||
}
|
||||
};
|
||||
/* c8 ignore stop */
|
||||
|
||||
/**
|
||||
* @function
|
||||
* @param {Decoder} decoder
|
||||
* @return {String} The read String
|
||||
*/
|
||||
const _readVarStringNative = decoder =>
|
||||
/** @type any */ (utf8TextDecoder).decode(readVarUint8Array(decoder));
|
||||
|
||||
/**
|
||||
* Read string of variable length
|
||||
* * varUint is used to store the length of the string
|
||||
*
|
||||
* @function
|
||||
* @param {Decoder} decoder
|
||||
* @return {String} The read String
|
||||
*
|
||||
*/
|
||||
/* c8 ignore next */
|
||||
const readVarString = utf8TextDecoder ? _readVarStringNative : _readVarStringPolyfill;
|
||||
|
||||
exports.AuthMessageType = void 0;
|
||||
(function (AuthMessageType) {
|
||||
AuthMessageType[AuthMessageType["Token"] = 0] = "Token";
|
||||
AuthMessageType[AuthMessageType["PermissionDenied"] = 1] = "PermissionDenied";
|
||||
AuthMessageType[AuthMessageType["Authenticated"] = 2] = "Authenticated";
|
||||
})(exports.AuthMessageType || (exports.AuthMessageType = {}));
|
||||
const writeAuthentication = (encoder, auth) => {
|
||||
writeVarUint(encoder, exports.AuthMessageType.Token);
|
||||
writeVarString(encoder, auth);
|
||||
};
|
||||
const writePermissionDenied = (encoder, reason) => {
|
||||
writeVarUint(encoder, exports.AuthMessageType.PermissionDenied);
|
||||
writeVarString(encoder, reason);
|
||||
};
|
||||
const writeAuthenticated = (encoder, scope) => {
|
||||
writeVarUint(encoder, exports.AuthMessageType.Authenticated);
|
||||
writeVarString(encoder, scope);
|
||||
};
|
||||
const writeTokenSyncRequest = (encoder) => {
|
||||
writeVarUint(encoder, exports.AuthMessageType.Token);
|
||||
};
|
||||
const readAuthMessage = (decoder, sendToken, permissionDeniedHandler, authenticatedHandler) => {
|
||||
switch (readVarUint(decoder)) {
|
||||
case exports.AuthMessageType.Token: {
|
||||
sendToken();
|
||||
break;
|
||||
}
|
||||
case exports.AuthMessageType.PermissionDenied: {
|
||||
permissionDeniedHandler(readVarString(decoder));
|
||||
break;
|
||||
}
|
||||
case exports.AuthMessageType.Authenticated: {
|
||||
authenticatedHandler(readVarString(decoder));
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The server is terminating the connection because a data frame was received
|
||||
* that is too large.
|
||||
* See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code
|
||||
*/
|
||||
const MessageTooBig = {
|
||||
code: 1009,
|
||||
reason: "Message Too Big",
|
||||
};
|
||||
/**
|
||||
* The server successfully processed the request, asks that the requester reset
|
||||
* its document view, and is not returning any content.
|
||||
*/
|
||||
const ResetConnection = {
|
||||
code: 4205,
|
||||
reason: "Reset Connection",
|
||||
};
|
||||
/**
|
||||
* Similar to Forbidden, but specifically for use when authentication is required and has
|
||||
* failed or has not yet been provided.
|
||||
*/
|
||||
const Unauthorized = {
|
||||
code: 4401,
|
||||
reason: "Unauthorized",
|
||||
};
|
||||
/**
|
||||
* The request contained valid data and was understood by the server, but the server
|
||||
* is refusing action.
|
||||
*/
|
||||
const Forbidden = {
|
||||
code: 4403,
|
||||
reason: "Forbidden",
|
||||
};
|
||||
/**
|
||||
* The server timed out waiting for the request.
|
||||
*/
|
||||
const ConnectionTimeout = {
|
||||
code: 4408,
|
||||
reason: "Connection Timeout",
|
||||
};
|
||||
|
||||
const awarenessStatesToArray = (states) => {
|
||||
return Array.from(states.entries()).map(([key, value]) => {
|
||||
return {
|
||||
clientId: key,
|
||||
...value,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* State of the WebSocket connection.
|
||||
* https://developer.mozilla.org/de/docs/Web/API/WebSocket/readyState
|
||||
*/
|
||||
exports.WsReadyStates = void 0;
|
||||
(function (WsReadyStates) {
|
||||
WsReadyStates[WsReadyStates["Connecting"] = 0] = "Connecting";
|
||||
WsReadyStates[WsReadyStates["Open"] = 1] = "Open";
|
||||
WsReadyStates[WsReadyStates["Closing"] = 2] = "Closing";
|
||||
WsReadyStates[WsReadyStates["Closed"] = 3] = "Closed";
|
||||
})(exports.WsReadyStates || (exports.WsReadyStates = {}));
|
||||
|
||||
exports.ConnectionTimeout = ConnectionTimeout;
|
||||
exports.Forbidden = Forbidden;
|
||||
exports.MessageTooBig = MessageTooBig;
|
||||
exports.ResetConnection = ResetConnection;
|
||||
exports.Unauthorized = Unauthorized;
|
||||
exports.awarenessStatesToArray = awarenessStatesToArray;
|
||||
exports.readAuthMessage = readAuthMessage;
|
||||
exports.writeAuthenticated = writeAuthenticated;
|
||||
exports.writeAuthentication = writeAuthentication;
|
||||
exports.writePermissionDenied = writePermissionDenied;
|
||||
exports.writeTokenSyncRequest = writeTokenSyncRequest;
|
||||
//# sourceMappingURL=hocuspocus-common.cjs.map
|
||||
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/hocuspocus-common.cjs.map
generated
vendored
Normal file
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/hocuspocus-common.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
509
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/hocuspocus-common.esm.js
generated
vendored
Normal file
509
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/hocuspocus-common.esm.js
generated
vendored
Normal file
@ -0,0 +1,509 @@
|
||||
/**
|
||||
* Common Math expressions.
|
||||
*
|
||||
* @module math
|
||||
*/
|
||||
|
||||
const floor = Math.floor;
|
||||
|
||||
/**
|
||||
* @function
|
||||
* @param {number} a
|
||||
* @param {number} b
|
||||
* @return {number} The smaller element of a and b
|
||||
*/
|
||||
const min = (a, b) => a < b ? a : b;
|
||||
|
||||
/**
|
||||
* @function
|
||||
* @param {number} a
|
||||
* @param {number} b
|
||||
* @return {number} The bigger element of a and b
|
||||
*/
|
||||
const max = (a, b) => a > b ? a : b;
|
||||
|
||||
/* eslint-env browser */
|
||||
|
||||
const BIT8 = 128;
|
||||
const BITS7 = 127;
|
||||
|
||||
/**
|
||||
* Utility helpers for working with numbers.
|
||||
*
|
||||
* @module number
|
||||
*/
|
||||
|
||||
|
||||
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @return {Uint8Array}
|
||||
*/
|
||||
const _encodeUtf8Polyfill = str => {
|
||||
const encodedString = unescape(encodeURIComponent(str));
|
||||
const len = encodedString.length;
|
||||
const buf = new Uint8Array(len);
|
||||
for (let i = 0; i < len; i++) {
|
||||
buf[i] = /** @type {number} */ (encodedString.codePointAt(i));
|
||||
}
|
||||
return buf
|
||||
};
|
||||
|
||||
/* c8 ignore next */
|
||||
const utf8TextEncoder = /** @type {TextEncoder} */ (typeof TextEncoder !== 'undefined' ? new TextEncoder() : null);
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @return {Uint8Array}
|
||||
*/
|
||||
const _encodeUtf8Native = str => utf8TextEncoder.encode(str);
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @return {Uint8Array}
|
||||
*/
|
||||
/* c8 ignore next */
|
||||
const encodeUtf8 = utf8TextEncoder ? _encodeUtf8Native : _encodeUtf8Polyfill;
|
||||
|
||||
/* c8 ignore next */
|
||||
let utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf-8', { fatal: true, ignoreBOM: true });
|
||||
|
||||
/* c8 ignore start */
|
||||
if (utf8TextDecoder && utf8TextDecoder.decode(new Uint8Array()).length === 1) {
|
||||
// Safari doesn't handle BOM correctly.
|
||||
// This fixes a bug in Safari 13.0.5 where it produces a BOM the first time it is called.
|
||||
// utf8TextDecoder.decode(new Uint8Array()).length === 1 on the first call and
|
||||
// utf8TextDecoder.decode(new Uint8Array()).length === 1 on the second call
|
||||
// Another issue is that from then on no BOM chars are recognized anymore
|
||||
/* c8 ignore next */
|
||||
utf8TextDecoder = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Efficient schema-less binary encoding with support for variable length encoding.
|
||||
*
|
||||
* Use [lib0/encoding] with [lib0/decoding]. Every encoding function has a corresponding decoding function.
|
||||
*
|
||||
* Encodes numbers in little-endian order (least to most significant byte order)
|
||||
* and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/)
|
||||
* which is also used in Protocol Buffers.
|
||||
*
|
||||
* ```js
|
||||
* // encoding step
|
||||
* const encoder = encoding.createEncoder()
|
||||
* encoding.writeVarUint(encoder, 256)
|
||||
* encoding.writeVarString(encoder, 'Hello world!')
|
||||
* const buf = encoding.toUint8Array(encoder)
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* // decoding step
|
||||
* const decoder = decoding.createDecoder(buf)
|
||||
* decoding.readVarUint(decoder) // => 256
|
||||
* decoding.readVarString(decoder) // => 'Hello world!'
|
||||
* decoding.hasContent(decoder) // => false - all data is read
|
||||
* ```
|
||||
*
|
||||
* @module encoding
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Write one byte to the encoder.
|
||||
*
|
||||
* @function
|
||||
* @param {Encoder} encoder
|
||||
* @param {number} num The byte that is to be encoded.
|
||||
*/
|
||||
const write = (encoder, num) => {
|
||||
const bufferLen = encoder.cbuf.length;
|
||||
if (encoder.cpos === bufferLen) {
|
||||
encoder.bufs.push(encoder.cbuf);
|
||||
encoder.cbuf = new Uint8Array(bufferLen * 2);
|
||||
encoder.cpos = 0;
|
||||
}
|
||||
encoder.cbuf[encoder.cpos++] = num;
|
||||
};
|
||||
|
||||
/**
|
||||
* Write a variable length unsigned integer. Max encodable integer is 2^53.
|
||||
*
|
||||
* @function
|
||||
* @param {Encoder} encoder
|
||||
* @param {number} num The number that is to be encoded.
|
||||
*/
|
||||
const writeVarUint = (encoder, num) => {
|
||||
while (num > BITS7) {
|
||||
write(encoder, BIT8 | (BITS7 & num));
|
||||
num = floor(num / 128); // shift >>> 7
|
||||
}
|
||||
write(encoder, BITS7 & num);
|
||||
};
|
||||
|
||||
/**
|
||||
* A cache to store strings temporarily
|
||||
*/
|
||||
const _strBuffer = new Uint8Array(30000);
|
||||
const _maxStrBSize = _strBuffer.length / 3;
|
||||
|
||||
/**
|
||||
* Write a variable length string.
|
||||
*
|
||||
* @function
|
||||
* @param {Encoder} encoder
|
||||
* @param {String} str The string that is to be encoded.
|
||||
*/
|
||||
const _writeVarStringNative = (encoder, str) => {
|
||||
if (str.length < _maxStrBSize) {
|
||||
// We can encode the string into the existing buffer
|
||||
/* c8 ignore next */
|
||||
const written = utf8TextEncoder.encodeInto(str, _strBuffer).written || 0;
|
||||
writeVarUint(encoder, written);
|
||||
for (let i = 0; i < written; i++) {
|
||||
write(encoder, _strBuffer[i]);
|
||||
}
|
||||
} else {
|
||||
writeVarUint8Array(encoder, encodeUtf8(str));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Write a variable length string.
|
||||
*
|
||||
* @function
|
||||
* @param {Encoder} encoder
|
||||
* @param {String} str The string that is to be encoded.
|
||||
*/
|
||||
const _writeVarStringPolyfill = (encoder, str) => {
|
||||
const encodedString = unescape(encodeURIComponent(str));
|
||||
const len = encodedString.length;
|
||||
writeVarUint(encoder, len);
|
||||
for (let i = 0; i < len; i++) {
|
||||
write(encoder, /** @type {number} */ (encodedString.codePointAt(i)));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Write a variable length string.
|
||||
*
|
||||
* @function
|
||||
* @param {Encoder} encoder
|
||||
* @param {String} str The string that is to be encoded.
|
||||
*/
|
||||
/* c8 ignore next */
|
||||
const writeVarString = (utf8TextEncoder && /** @type {any} */ (utf8TextEncoder).encodeInto) ? _writeVarStringNative : _writeVarStringPolyfill;
|
||||
|
||||
/**
|
||||
* Append fixed-length Uint8Array to the encoder.
|
||||
*
|
||||
* @function
|
||||
* @param {Encoder} encoder
|
||||
* @param {Uint8Array} uint8Array
|
||||
*/
|
||||
const writeUint8Array = (encoder, uint8Array) => {
|
||||
const bufferLen = encoder.cbuf.length;
|
||||
const cpos = encoder.cpos;
|
||||
const leftCopyLen = min(bufferLen - cpos, uint8Array.length);
|
||||
const rightCopyLen = uint8Array.length - leftCopyLen;
|
||||
encoder.cbuf.set(uint8Array.subarray(0, leftCopyLen), cpos);
|
||||
encoder.cpos += leftCopyLen;
|
||||
if (rightCopyLen > 0) {
|
||||
// Still something to write, write right half..
|
||||
// Append new buffer
|
||||
encoder.bufs.push(encoder.cbuf);
|
||||
// must have at least size of remaining buffer
|
||||
encoder.cbuf = new Uint8Array(max(bufferLen * 2, rightCopyLen));
|
||||
// copy array
|
||||
encoder.cbuf.set(uint8Array.subarray(leftCopyLen));
|
||||
encoder.cpos = rightCopyLen;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Append an Uint8Array to Encoder.
|
||||
*
|
||||
* @function
|
||||
* @param {Encoder} encoder
|
||||
* @param {Uint8Array} uint8Array
|
||||
*/
|
||||
const writeVarUint8Array = (encoder, uint8Array) => {
|
||||
writeVarUint(encoder, uint8Array.byteLength);
|
||||
writeUint8Array(encoder, uint8Array);
|
||||
};
|
||||
|
||||
/**
|
||||
* Error helpers.
|
||||
*
|
||||
* @module error
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {string} s
|
||||
* @return {Error}
|
||||
*/
|
||||
/* c8 ignore next */
|
||||
const create = s => new Error(s);
|
||||
|
||||
/**
|
||||
* Efficient schema-less binary decoding with support for variable length encoding.
|
||||
*
|
||||
* Use [lib0/decoding] with [lib0/encoding]. Every encoding function has a corresponding decoding function.
|
||||
*
|
||||
* Encodes numbers in little-endian order (least to most significant byte order)
|
||||
* and is compatible with Golang's binary encoding (https://golang.org/pkg/encoding/binary/)
|
||||
* which is also used in Protocol Buffers.
|
||||
*
|
||||
* ```js
|
||||
* // encoding step
|
||||
* const encoder = encoding.createEncoder()
|
||||
* encoding.writeVarUint(encoder, 256)
|
||||
* encoding.writeVarString(encoder, 'Hello world!')
|
||||
* const buf = encoding.toUint8Array(encoder)
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* // decoding step
|
||||
* const decoder = decoding.createDecoder(buf)
|
||||
* decoding.readVarUint(decoder) // => 256
|
||||
* decoding.readVarString(decoder) // => 'Hello world!'
|
||||
* decoding.hasContent(decoder) // => false - all data is read
|
||||
* ```
|
||||
*
|
||||
* @module decoding
|
||||
*/
|
||||
|
||||
|
||||
const errorUnexpectedEndOfArray = create('Unexpected end of array');
|
||||
const errorIntegerOutOfRange = create('Integer out of Range');
|
||||
|
||||
/**
|
||||
* Create an Uint8Array view of the next `len` bytes and advance the position by `len`.
|
||||
*
|
||||
* Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks.
|
||||
* Use `buffer.copyUint8Array` to copy the result into a new Uint8Array.
|
||||
*
|
||||
* @function
|
||||
* @param {Decoder} decoder The decoder instance
|
||||
* @param {number} len The length of bytes to read
|
||||
* @return {Uint8Array}
|
||||
*/
|
||||
const readUint8Array = (decoder, len) => {
|
||||
const view = new Uint8Array(decoder.arr.buffer, decoder.pos + decoder.arr.byteOffset, len);
|
||||
decoder.pos += len;
|
||||
return view
|
||||
};
|
||||
|
||||
/**
|
||||
* Read variable length Uint8Array.
|
||||
*
|
||||
* Important: The Uint8Array still points to the underlying ArrayBuffer. Make sure to discard the result as soon as possible to prevent any memory leaks.
|
||||
* Use `buffer.copyUint8Array` to copy the result into a new Uint8Array.
|
||||
*
|
||||
* @function
|
||||
* @param {Decoder} decoder
|
||||
* @return {Uint8Array}
|
||||
*/
|
||||
const readVarUint8Array = decoder => readUint8Array(decoder, readVarUint(decoder));
|
||||
|
||||
/**
|
||||
* Read one byte as unsigned integer.
|
||||
* @function
|
||||
* @param {Decoder} decoder The decoder instance
|
||||
* @return {number} Unsigned 8-bit integer
|
||||
*/
|
||||
const readUint8 = decoder => decoder.arr[decoder.pos++];
|
||||
|
||||
/**
|
||||
* Read unsigned integer (32bit) with variable length.
|
||||
* 1/8th of the storage is used as encoding overhead.
|
||||
* * numbers < 2^7 is stored in one bytlength
|
||||
* * numbers < 2^14 is stored in two bylength
|
||||
*
|
||||
* @function
|
||||
* @param {Decoder} decoder
|
||||
* @return {number} An unsigned integer.length
|
||||
*/
|
||||
const readVarUint = decoder => {
|
||||
let num = 0;
|
||||
let mult = 1;
|
||||
const len = decoder.arr.length;
|
||||
while (decoder.pos < len) {
|
||||
const r = decoder.arr[decoder.pos++];
|
||||
// num = num | ((r & binary.BITS7) << len)
|
||||
num = num + (r & BITS7) * mult; // shift $r << (7*#iterations) and add it to num
|
||||
mult *= 128; // next iteration, shift 7 "more" to the left
|
||||
if (r < BIT8) {
|
||||
return num
|
||||
}
|
||||
/* c8 ignore start */
|
||||
if (num > MAX_SAFE_INTEGER) {
|
||||
throw errorIntegerOutOfRange
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
}
|
||||
throw errorUnexpectedEndOfArray
|
||||
};
|
||||
|
||||
/**
|
||||
* We don't test this function anymore as we use native decoding/encoding by default now.
|
||||
* Better not modify this anymore..
|
||||
*
|
||||
* Transforming utf8 to a string is pretty expensive. The code performs 10x better
|
||||
* when String.fromCodePoint is fed with all characters as arguments.
|
||||
* But most environments have a maximum number of arguments per functions.
|
||||
* For effiency reasons we apply a maximum of 10000 characters at once.
|
||||
*
|
||||
* @function
|
||||
* @param {Decoder} decoder
|
||||
* @return {String} The read String.
|
||||
*/
|
||||
/* c8 ignore start */
|
||||
const _readVarStringPolyfill = decoder => {
|
||||
let remainingLen = readVarUint(decoder);
|
||||
if (remainingLen === 0) {
|
||||
return ''
|
||||
} else {
|
||||
let encodedString = String.fromCodePoint(readUint8(decoder)); // remember to decrease remainingLen
|
||||
if (--remainingLen < 100) { // do not create a Uint8Array for small strings
|
||||
while (remainingLen--) {
|
||||
encodedString += String.fromCodePoint(readUint8(decoder));
|
||||
}
|
||||
} else {
|
||||
while (remainingLen > 0) {
|
||||
const nextLen = remainingLen < 10000 ? remainingLen : 10000;
|
||||
// this is dangerous, we create a fresh array view from the existing buffer
|
||||
const bytes = decoder.arr.subarray(decoder.pos, decoder.pos + nextLen);
|
||||
decoder.pos += nextLen;
|
||||
// Starting with ES5.1 we can supply a generic array-like object as arguments
|
||||
encodedString += String.fromCodePoint.apply(null, /** @type {any} */ (bytes));
|
||||
remainingLen -= nextLen;
|
||||
}
|
||||
}
|
||||
return decodeURIComponent(escape(encodedString))
|
||||
}
|
||||
};
|
||||
/* c8 ignore stop */
|
||||
|
||||
/**
|
||||
* @function
|
||||
* @param {Decoder} decoder
|
||||
* @return {String} The read String
|
||||
*/
|
||||
const _readVarStringNative = decoder =>
|
||||
/** @type any */ (utf8TextDecoder).decode(readVarUint8Array(decoder));
|
||||
|
||||
/**
|
||||
* Read string of variable length
|
||||
* * varUint is used to store the length of the string
|
||||
*
|
||||
* @function
|
||||
* @param {Decoder} decoder
|
||||
* @return {String} The read String
|
||||
*
|
||||
*/
|
||||
/* c8 ignore next */
|
||||
const readVarString = utf8TextDecoder ? _readVarStringNative : _readVarStringPolyfill;
|
||||
|
||||
var AuthMessageType;
|
||||
(function (AuthMessageType) {
|
||||
AuthMessageType[AuthMessageType["Token"] = 0] = "Token";
|
||||
AuthMessageType[AuthMessageType["PermissionDenied"] = 1] = "PermissionDenied";
|
||||
AuthMessageType[AuthMessageType["Authenticated"] = 2] = "Authenticated";
|
||||
})(AuthMessageType || (AuthMessageType = {}));
|
||||
const writeAuthentication = (encoder, auth) => {
|
||||
writeVarUint(encoder, AuthMessageType.Token);
|
||||
writeVarString(encoder, auth);
|
||||
};
|
||||
const writePermissionDenied = (encoder, reason) => {
|
||||
writeVarUint(encoder, AuthMessageType.PermissionDenied);
|
||||
writeVarString(encoder, reason);
|
||||
};
|
||||
const writeAuthenticated = (encoder, scope) => {
|
||||
writeVarUint(encoder, AuthMessageType.Authenticated);
|
||||
writeVarString(encoder, scope);
|
||||
};
|
||||
const writeTokenSyncRequest = (encoder) => {
|
||||
writeVarUint(encoder, AuthMessageType.Token);
|
||||
};
|
||||
const readAuthMessage = (decoder, sendToken, permissionDeniedHandler, authenticatedHandler) => {
|
||||
switch (readVarUint(decoder)) {
|
||||
case AuthMessageType.Token: {
|
||||
sendToken();
|
||||
break;
|
||||
}
|
||||
case AuthMessageType.PermissionDenied: {
|
||||
permissionDeniedHandler(readVarString(decoder));
|
||||
break;
|
||||
}
|
||||
case AuthMessageType.Authenticated: {
|
||||
authenticatedHandler(readVarString(decoder));
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The server is terminating the connection because a data frame was received
|
||||
* that is too large.
|
||||
* See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code
|
||||
*/
|
||||
const MessageTooBig = {
|
||||
code: 1009,
|
||||
reason: "Message Too Big",
|
||||
};
|
||||
/**
|
||||
* The server successfully processed the request, asks that the requester reset
|
||||
* its document view, and is not returning any content.
|
||||
*/
|
||||
const ResetConnection = {
|
||||
code: 4205,
|
||||
reason: "Reset Connection",
|
||||
};
|
||||
/**
|
||||
* Similar to Forbidden, but specifically for use when authentication is required and has
|
||||
* failed or has not yet been provided.
|
||||
*/
|
||||
const Unauthorized = {
|
||||
code: 4401,
|
||||
reason: "Unauthorized",
|
||||
};
|
||||
/**
|
||||
* The request contained valid data and was understood by the server, but the server
|
||||
* is refusing action.
|
||||
*/
|
||||
const Forbidden = {
|
||||
code: 4403,
|
||||
reason: "Forbidden",
|
||||
};
|
||||
/**
|
||||
* The server timed out waiting for the request.
|
||||
*/
|
||||
const ConnectionTimeout = {
|
||||
code: 4408,
|
||||
reason: "Connection Timeout",
|
||||
};
|
||||
|
||||
const awarenessStatesToArray = (states) => {
|
||||
return Array.from(states.entries()).map(([key, value]) => {
|
||||
return {
|
||||
clientId: key,
|
||||
...value,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* State of the WebSocket connection.
|
||||
* https://developer.mozilla.org/de/docs/Web/API/WebSocket/readyState
|
||||
*/
|
||||
var WsReadyStates;
|
||||
(function (WsReadyStates) {
|
||||
WsReadyStates[WsReadyStates["Connecting"] = 0] = "Connecting";
|
||||
WsReadyStates[WsReadyStates["Open"] = 1] = "Open";
|
||||
WsReadyStates[WsReadyStates["Closing"] = 2] = "Closing";
|
||||
WsReadyStates[WsReadyStates["Closed"] = 3] = "Closed";
|
||||
})(WsReadyStates || (WsReadyStates = {}));
|
||||
|
||||
export { AuthMessageType, ConnectionTimeout, Forbidden, MessageTooBig, ResetConnection, Unauthorized, WsReadyStates, awarenessStatesToArray, readAuthMessage, writeAuthenticated, writeAuthentication, writePermissionDenied, writeTokenSyncRequest };
|
||||
//# sourceMappingURL=hocuspocus-common.esm.js.map
|
||||
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/hocuspocus-common.esm.js.map
generated
vendored
Normal file
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/hocuspocus-common.esm.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
||||
export * from 'prosemirror-model';
|
||||
@ -0,0 +1 @@
|
||||
export * from 'prosemirror-state';
|
||||
@ -0,0 +1 @@
|
||||
export * from 'prosemirror-transform';
|
||||
@ -0,0 +1 @@
|
||||
export * from 'prosemirror-view';
|
||||
@ -0,0 +1,29 @@
|
||||
export interface CloseEvent {
|
||||
code: number;
|
||||
reason: string;
|
||||
}
|
||||
/**
|
||||
* The server is terminating the connection because a data frame was received
|
||||
* that is too large.
|
||||
* See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code
|
||||
*/
|
||||
export declare const MessageTooBig: CloseEvent;
|
||||
/**
|
||||
* The server successfully processed the request, asks that the requester reset
|
||||
* its document view, and is not returning any content.
|
||||
*/
|
||||
export declare const ResetConnection: CloseEvent;
|
||||
/**
|
||||
* Similar to Forbidden, but specifically for use when authentication is required and has
|
||||
* failed or has not yet been provided.
|
||||
*/
|
||||
export declare const Unauthorized: CloseEvent;
|
||||
/**
|
||||
* The request contained valid data and was understood by the server, but the server
|
||||
* is refusing action.
|
||||
*/
|
||||
export declare const Forbidden: CloseEvent;
|
||||
/**
|
||||
* The server timed out waiting for the request.
|
||||
*/
|
||||
export declare const ConnectionTimeout: CloseEvent;
|
||||
13
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/common/src/auth.d.ts
generated
vendored
Normal file
13
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/common/src/auth.d.ts
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
import * as encoding from "lib0/encoding";
|
||||
import * as decoding from "lib0/decoding";
|
||||
import type { AuthorizedScope } from "../../provider/src";
|
||||
export declare enum AuthMessageType {
|
||||
Token = 0,
|
||||
PermissionDenied = 1,
|
||||
Authenticated = 2
|
||||
}
|
||||
export declare const writeAuthentication: (encoder: encoding.Encoder, auth: string) => void;
|
||||
export declare const writePermissionDenied: (encoder: encoding.Encoder, reason: string) => void;
|
||||
export declare const writeAuthenticated: (encoder: encoding.Encoder, scope: AuthorizedScope) => void;
|
||||
export declare const writeTokenSyncRequest: (encoder: encoding.Encoder) => void;
|
||||
export declare const readAuthMessage: (decoder: decoding.Decoder, sendToken: () => void, permissionDeniedHandler: (reason: string) => void, authenticatedHandler: (scope: string) => void) => void;
|
||||
@ -0,0 +1,3 @@
|
||||
export declare const awarenessStatesToArray: (states: Map<number, Record<string, any>>) => {
|
||||
clientId: number;
|
||||
}[];
|
||||
4
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/common/src/index.d.ts
generated
vendored
Normal file
4
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/common/src/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
export * from "./auth.ts";
|
||||
export * from "./CloseEvents.ts";
|
||||
export * from "./awarenessStatesToArray.ts";
|
||||
export * from "./types.ts";
|
||||
10
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/common/src/types.d.ts
generated
vendored
Normal file
10
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/common/src/types.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* State of the WebSocket connection.
|
||||
* https://developer.mozilla.org/de/docs/Web/API/WebSocket/readyState
|
||||
*/
|
||||
export declare enum WsReadyStates {
|
||||
Connecting = 0,
|
||||
Open = 1,
|
||||
Closing = 2,
|
||||
Closed = 3
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
import type { Extension, onChangePayload, onLoadDocumentPayload, storePayload, fetchPayload } from "@hocuspocus/server";
|
||||
export interface DatabaseConfiguration {
|
||||
/**
|
||||
* Pass a Promise to retrieve updates from your database. The Promise should resolve to
|
||||
* an array of items with Y.js-compatible binary data.
|
||||
*/
|
||||
fetch: (data: fetchPayload) => Promise<Uint8Array | null>;
|
||||
/**
|
||||
* Pass a function to store updates in your database.
|
||||
*/
|
||||
store: (data: storePayload) => Promise<void>;
|
||||
}
|
||||
export declare class Database implements Extension {
|
||||
/**
|
||||
* Default configuration
|
||||
*/
|
||||
configuration: DatabaseConfiguration;
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(configuration: Partial<DatabaseConfiguration>);
|
||||
/**
|
||||
* Get stored data from the database.
|
||||
*/
|
||||
onLoadDocument(data: onLoadDocumentPayload): Promise<any>;
|
||||
/**
|
||||
* Store new updates in the database.
|
||||
*/
|
||||
onStoreDocument(data: onChangePayload): Promise<void>;
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
export * from "./Database.ts";
|
||||
@ -0,0 +1,67 @@
|
||||
import type { Extension, onChangePayload, onConfigurePayload, onConnectPayload, onLoadDocumentPayload, onDestroyPayload, onDisconnectPayload, onRequestPayload, onUpgradePayload } from "@hocuspocus/server";
|
||||
export interface LoggerConfiguration {
|
||||
/**
|
||||
* Prepend all logging message with a string.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
prefix: null | string;
|
||||
/**
|
||||
* Whether to log something for the `onLoadDocument` hook.
|
||||
*/
|
||||
onLoadDocument: boolean;
|
||||
/**
|
||||
* Whether to log something for the `onChange` hook.
|
||||
*/
|
||||
onChange: boolean;
|
||||
/**
|
||||
* Whether to log something for the `onStoreDocument` hook.
|
||||
*/
|
||||
onStoreDocument: boolean;
|
||||
/**
|
||||
* Whether to log something for the `onConnect` hook.
|
||||
*/
|
||||
onConnect: boolean;
|
||||
/**
|
||||
* Whether to log something for the `onDisconnect` hook.
|
||||
*/
|
||||
onDisconnect: boolean;
|
||||
/**
|
||||
* Whether to log something for the `onUpgrade` hook.
|
||||
*/
|
||||
onUpgrade: boolean;
|
||||
/**
|
||||
* Whether to log something for the `onRequest` hook.
|
||||
*/
|
||||
onRequest: boolean;
|
||||
/**
|
||||
* Whether to log something for the `onDestroy` hook.
|
||||
*/
|
||||
onDestroy: boolean;
|
||||
/**
|
||||
* Whether to log something for the `onConfigure` hook.
|
||||
*/
|
||||
onConfigure: boolean;
|
||||
/**
|
||||
* A log function, if none is provided output will go to console
|
||||
*/
|
||||
log: (...args: any[]) => void;
|
||||
}
|
||||
export declare class Logger implements Extension {
|
||||
name: string | null;
|
||||
configuration: LoggerConfiguration;
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(configuration?: Partial<LoggerConfiguration>);
|
||||
onConfigure(data: onConfigurePayload): Promise<void>;
|
||||
onLoadDocument(data: onLoadDocumentPayload): Promise<void>;
|
||||
onChange(data: onChangePayload): Promise<void>;
|
||||
onStoreDocument(data: onDisconnectPayload): Promise<void>;
|
||||
onConnect(data: onConnectPayload): Promise<void>;
|
||||
onDisconnect(data: onDisconnectPayload): Promise<void>;
|
||||
onUpgrade(data: onUpgradePayload): Promise<void>;
|
||||
onRequest(data: onRequestPayload): Promise<void>;
|
||||
onDestroy(data: onDestroyPayload): Promise<void>;
|
||||
private log;
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
export * from "./Logger.ts";
|
||||
124
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/extension-redis/src/Redis.d.ts
generated
vendored
Normal file
124
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/extension-redis/src/Redis.d.ts
generated
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
import type { Extension, Hocuspocus, afterLoadDocumentPayload, afterStoreDocumentPayload, afterUnloadDocumentPayload, beforeBroadcastStatelessPayload, beforeUnloadDocumentPayload, onAwarenessUpdatePayload, onChangePayload, onConfigurePayload, onStoreDocumentPayload } from "@hocuspocus/server";
|
||||
import { type ExecutionResult, type Lock, Redlock } from "@sesamecare-oss/redlock";
|
||||
import type { Cluster, ClusterNode, ClusterOptions, RedisOptions } from "ioredis";
|
||||
import RedisClient from "ioredis";
|
||||
export type RedisInstance = RedisClient | Cluster;
|
||||
export interface Configuration {
|
||||
/**
|
||||
* Redis port
|
||||
*/
|
||||
port: number;
|
||||
/**
|
||||
* Redis host
|
||||
*/
|
||||
host: string;
|
||||
/**
|
||||
* Redis Cluster
|
||||
*/
|
||||
nodes?: ClusterNode[];
|
||||
/**
|
||||
* Duplicate from an existed Redis instance
|
||||
*/
|
||||
redis?: RedisInstance;
|
||||
/**
|
||||
* Redis instance creator
|
||||
*/
|
||||
createClient?: () => RedisInstance;
|
||||
/**
|
||||
* Options passed directly to Redis constructor
|
||||
*
|
||||
* https://github.com/luin/ioredis/blob/master/API.md#new-redisport-host-options
|
||||
*/
|
||||
options?: ClusterOptions | 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;
|
||||
/**
|
||||
* A delay before onDisconnect is executed. This allows last minute updates'
|
||||
* sync messages to be received by the subscription before it's closed.
|
||||
*/
|
||||
disconnectDelay: 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;
|
||||
redisTransactionOrigin: string;
|
||||
pub: RedisInstance;
|
||||
sub: RedisInstance;
|
||||
instance: Hocuspocus;
|
||||
redlock: Redlock;
|
||||
locks: Map<string, {
|
||||
lock: Lock;
|
||||
release?: Promise<ExecutionResult>;
|
||||
}>;
|
||||
messagePrefix: Buffer;
|
||||
private pendingAfterStoreDocumentResolves;
|
||||
constructor(configuration: Partial<Configuration>);
|
||||
onConfigure({ instance }: onConfigurePayload): Promise<void>;
|
||||
private getKey;
|
||||
private pubKey;
|
||||
private subKey;
|
||||
private lockKey;
|
||||
private encodeMessage;
|
||||
private decodeMessage;
|
||||
/**
|
||||
* Once a document is loaded, subscribe to the channel in Redis.
|
||||
*/
|
||||
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<void>;
|
||||
/**
|
||||
* Release the Redis lock, so other instances can store documents.
|
||||
*/
|
||||
afterStoreDocument({ documentName, socketId, }: afterStoreDocumentPayload): Promise<void>;
|
||||
/**
|
||||
* Handle awareness update messages received directly by this Hocuspocus instance.
|
||||
*/
|
||||
onAwarenessUpdate({ documentName, awareness, added, updated, removed, document, }: onAwarenessUpdatePayload): Promise<number | undefined>;
|
||||
/**
|
||||
* Handle incoming messages published on subscribed document channels.
|
||||
* Note that this will also include messages from ourselves as it is not possible
|
||||
* in Redis to filter these.
|
||||
*/
|
||||
private handleIncomingMessage;
|
||||
/**
|
||||
* if the ydoc changed, we'll need to inform other Hocuspocus servers about it.
|
||||
*/
|
||||
onChange(data: onChangePayload): Promise<any>;
|
||||
/**
|
||||
* Delay unloading to allow syncs to finish
|
||||
*/
|
||||
beforeUnloadDocument(data: beforeUnloadDocumentPayload): Promise<void>;
|
||||
afterUnloadDocument(data: afterUnloadDocumentPayload): Promise<void>;
|
||||
beforeBroadcastStateless(data: beforeBroadcastStatelessPayload): Promise<number>;
|
||||
/**
|
||||
* Kill the Redlock connection immediately.
|
||||
*/
|
||||
onDestroy(): Promise<void>;
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
export * from "./Redis.ts";
|
||||
44
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/extension-s3/src/S3.d.ts
generated
vendored
Normal file
44
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/extension-s3/src/S3.d.ts
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
import type { DatabaseConfiguration } from "@hocuspocus/extension-database";
|
||||
import { Database } from "@hocuspocus/extension-database";
|
||||
import { S3Client } from "@aws-sdk/client-s3";
|
||||
export interface S3Configuration extends DatabaseConfiguration {
|
||||
/**
|
||||
* AWS S3 region
|
||||
*/
|
||||
region?: string;
|
||||
/**
|
||||
* S3 bucket name
|
||||
*/
|
||||
bucket: string;
|
||||
/**
|
||||
* S3 key prefix for documents (optional)
|
||||
*/
|
||||
prefix?: string;
|
||||
/**
|
||||
* AWS credentials
|
||||
*/
|
||||
credentials?: {
|
||||
accessKeyId: string;
|
||||
secretAccessKey: string;
|
||||
};
|
||||
/**
|
||||
* S3 endpoint URL (for S3-compatible services like MinIO)
|
||||
*/
|
||||
endpoint?: string;
|
||||
/**
|
||||
* Force path style URLs (required for MinIO)
|
||||
*/
|
||||
forcePathStyle?: boolean;
|
||||
/**
|
||||
* Custom S3 client
|
||||
*/
|
||||
s3Client?: S3Client;
|
||||
}
|
||||
export declare class S3 extends Database {
|
||||
private s3Client?;
|
||||
configuration: S3Configuration;
|
||||
constructor(configuration: Partial<S3Configuration>);
|
||||
private getObjectKey;
|
||||
onConfigure(): Promise<void>;
|
||||
onListen(): Promise<void>;
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
export * from "./S3.ts";
|
||||
@ -0,0 +1,27 @@
|
||||
import type { DatabaseConfiguration } from "@hocuspocus/extension-database";
|
||||
import { Database } from "@hocuspocus/extension-database";
|
||||
import sqlite3 from "sqlite3";
|
||||
export declare const schema = "CREATE TABLE IF NOT EXISTS \"documents\" (\n \"name\" varchar(255) NOT NULL,\n \"data\" blob NOT NULL,\n UNIQUE(name)\n)";
|
||||
export declare const selectQuery = "\n SELECT data FROM \"documents\" WHERE name = $name ORDER BY rowid DESC\n";
|
||||
export declare const upsertQuery = "\n INSERT INTO \"documents\" (\"name\", \"data\") VALUES ($name, $data)\n ON CONFLICT(name) DO UPDATE SET data = $data\n";
|
||||
export interface SQLiteConfiguration extends DatabaseConfiguration {
|
||||
/**
|
||||
* Valid values are filenames, ":memory:" for an anonymous in-memory database and an empty
|
||||
* string for an anonymous disk-based database. Anonymous databases are not persisted and
|
||||
* when closing the database handle, their contents are lost.
|
||||
*
|
||||
* https://github.com/mapbox/node-sqlite3/wiki/API#new-sqlite3databasefilename-mode-callback
|
||||
*/
|
||||
database: string;
|
||||
/**
|
||||
* The database schema to create.
|
||||
*/
|
||||
schema: string;
|
||||
}
|
||||
export declare class SQLite extends Database {
|
||||
db?: sqlite3.Database;
|
||||
configuration: SQLiteConfiguration;
|
||||
constructor(configuration?: Partial<SQLiteConfiguration>);
|
||||
onConfigure(): Promise<void>;
|
||||
onListen(): Promise<void>;
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
export * from "./SQLite.ts";
|
||||
@ -0,0 +1,30 @@
|
||||
import type { Extension, onConnectPayload } from "@hocuspocus/server";
|
||||
export interface ThrottleConfiguration {
|
||||
throttle: number | null | false;
|
||||
consideredSeconds: number;
|
||||
banTime: number;
|
||||
cleanupInterval: number;
|
||||
}
|
||||
export declare class Throttle implements Extension {
|
||||
configuration: ThrottleConfiguration;
|
||||
connectionsByIp: Map<string, Array<number>>;
|
||||
bannedIps: Map<string, number>;
|
||||
cleanupInterval?: NodeJS.Timeout;
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(configuration?: Partial<ThrottleConfiguration>);
|
||||
onDestroy(): Promise<void>;
|
||||
clearMaps(): void;
|
||||
isBanned(ip: string): boolean;
|
||||
/**
|
||||
* Throttle requests
|
||||
* @private
|
||||
*/
|
||||
private throttle;
|
||||
/**
|
||||
* onConnect hook
|
||||
* @param data
|
||||
*/
|
||||
onConnect(data: onConnectPayload): Promise<any>;
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
import type { Extension, onChangePayload, onConnectPayload, onDisconnectPayload, onLoadDocumentPayload } from "@hocuspocus/server";
|
||||
import type { Transformer } from "@hocuspocus/transformer";
|
||||
import type { Doc } from "yjs";
|
||||
export declare enum Events {
|
||||
onChange = "change",
|
||||
onConnect = "connect",
|
||||
onCreate = "create",
|
||||
onDisconnect = "disconnect"
|
||||
}
|
||||
export interface Configuration {
|
||||
debounce: number | false | null;
|
||||
debounceMaxWait: number;
|
||||
secret: string;
|
||||
transformer: Transformer | {
|
||||
toYdoc: (document: any) => Doc;
|
||||
fromYdoc: (document: Doc) => any;
|
||||
};
|
||||
url: string;
|
||||
events: Array<Events>;
|
||||
}
|
||||
export declare class Webhook implements Extension {
|
||||
configuration: Configuration;
|
||||
debounced: Map<string, {
|
||||
timeout: NodeJS.Timeout;
|
||||
start: number;
|
||||
}>;
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
constructor(configuration?: Partial<Configuration>);
|
||||
/**
|
||||
* Create a signature for the response body
|
||||
*/
|
||||
createSignature(body: string): string;
|
||||
/**
|
||||
* debounce the given function, using the given identifier
|
||||
*/
|
||||
debounce(id: string, func: Function): void;
|
||||
/**
|
||||
* Send a request to the given url containing the given data
|
||||
*/
|
||||
sendRequest(event: Events, payload: any): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
||||
/**
|
||||
* onChange hook
|
||||
*/
|
||||
onChange(data: onChangePayload): Promise<void>;
|
||||
/**
|
||||
* onLoadDocument hook
|
||||
*/
|
||||
onLoadDocument(data: onLoadDocumentPayload): Promise<void>;
|
||||
/**
|
||||
* onConnect hook
|
||||
*/
|
||||
onConnect(data: onConnectPayload): Promise<any>;
|
||||
onDisconnect(data: onDisconnectPayload): Promise<void>;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
export default class EventEmitter {
|
||||
callbacks: {
|
||||
[key: string]: Function[];
|
||||
};
|
||||
on(event: string, fn: Function): this;
|
||||
protected emit(event: string, ...args: any): this;
|
||||
off(event: string, fn?: Function): this;
|
||||
removeAllListeners(): void;
|
||||
}
|
||||
@ -0,0 +1,116 @@
|
||||
import type { Event, MessageEvent } from "ws";
|
||||
import { Awareness } from "y-protocols/awareness";
|
||||
import * as Y from "yjs";
|
||||
import EventEmitter from "./EventEmitter.ts";
|
||||
import type { CompleteHocuspocusProviderWebsocketConfiguration } from "./HocuspocusProviderWebsocket.ts";
|
||||
import { HocuspocusProviderWebsocket } from "./HocuspocusProviderWebsocket.ts";
|
||||
import type { AuthorizedScope, ConstructableOutgoingMessage, onAuthenticatedParameters, onAuthenticationFailedParameters, onAwarenessChangeParameters, onAwarenessUpdateParameters, onCloseParameters, onDisconnectParameters, onMessageParameters, onOpenParameters, onOutgoingMessageParameters, onStatelessParameters, onStatusParameters, onSyncedParameters, onUnsyncedChangesParameters } from "./types.ts";
|
||||
export type HocuspocusProviderConfiguration = Required<Pick<CompleteHocuspocusProviderConfiguration, "name">> & Partial<CompleteHocuspocusProviderConfiguration> & ((Required<Pick<CompleteHocuspocusProviderWebsocketConfiguration, "url">> & Partial<Pick<CompleteHocuspocusProviderWebsocketConfiguration, "preserveTrailingSlash">>) | Required<Pick<CompleteHocuspocusProviderConfiguration, "websocketProvider">>);
|
||||
export interface CompleteHocuspocusProviderConfiguration {
|
||||
/**
|
||||
* The identifier/name of your document
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The actual Y.js document
|
||||
*/
|
||||
document: Y.Doc;
|
||||
/**
|
||||
* An Awareness instance to keep the presence state of all clients.
|
||||
*
|
||||
* You can disable sharing awareness information by passing `null`.
|
||||
* Note that having no awareness information shared across all connections will break our ping checks
|
||||
* and thus trigger reconnects. You should always have at least one Provider with enabled awareness per
|
||||
* socket connection, or ensure that the Provider receives messages before running into `HocuspocusProviderWebsocket.messageReconnectTimeout`.
|
||||
*/
|
||||
awareness: Awareness | null;
|
||||
/**
|
||||
* A token that’s sent to the backend for authentication purposes.
|
||||
*/
|
||||
token: string | (() => string) | (() => Promise<string>) | null;
|
||||
/**
|
||||
* Hocuspocus websocket provider
|
||||
*/
|
||||
websocketProvider: HocuspocusProviderWebsocket;
|
||||
/**
|
||||
* Force syncing the document in the defined interval.
|
||||
*/
|
||||
forceSyncInterval: false | number;
|
||||
onAuthenticated: (data: onAuthenticatedParameters) => void;
|
||||
onAuthenticationFailed: (data: onAuthenticationFailedParameters) => void;
|
||||
onOpen: (data: onOpenParameters) => void;
|
||||
onConnect: () => void;
|
||||
onStatus: (data: onStatusParameters) => void;
|
||||
onMessage: (data: onMessageParameters) => void;
|
||||
onOutgoingMessage: (data: onOutgoingMessageParameters) => void;
|
||||
onSynced: (data: onSyncedParameters) => void;
|
||||
onDisconnect: (data: onDisconnectParameters) => void;
|
||||
onClose: (data: onCloseParameters) => void;
|
||||
onDestroy: () => void;
|
||||
onAwarenessUpdate: (data: onAwarenessUpdateParameters) => void;
|
||||
onAwarenessChange: (data: onAwarenessChangeParameters) => void;
|
||||
onStateless: (data: onStatelessParameters) => void;
|
||||
onUnsyncedChanges: (data: onUnsyncedChangesParameters) => void;
|
||||
}
|
||||
export declare class AwarenessError extends Error {
|
||||
code: number;
|
||||
}
|
||||
export declare class HocuspocusProvider extends EventEmitter {
|
||||
configuration: CompleteHocuspocusProviderConfiguration;
|
||||
isSynced: boolean;
|
||||
unsyncedChanges: number;
|
||||
isAuthenticated: boolean;
|
||||
authorizedScope: AuthorizedScope | undefined;
|
||||
manageSocket: boolean;
|
||||
private _isAttached;
|
||||
intervals: any;
|
||||
constructor(configuration: HocuspocusProviderConfiguration);
|
||||
boundDocumentUpdateHandler: (update: Uint8Array, origin: any) => void;
|
||||
boundAwarenessUpdateHandler: ({ added, updated, removed }: any, origin: any) => void;
|
||||
boundPageHide: () => void;
|
||||
boundOnOpen: (event: Event) => Promise<void>;
|
||||
boundOnClose: () => void;
|
||||
forwardConnect: () => this;
|
||||
forwardStatus: (e: onStatusParameters) => this;
|
||||
forwardClose: (e: onCloseParameters) => this;
|
||||
forwardDisconnect: (e: onDisconnectParameters) => this;
|
||||
forwardDestroy: () => this;
|
||||
setConfiguration(configuration?: Partial<HocuspocusProviderConfiguration>): void;
|
||||
get document(): Y.Doc;
|
||||
get isAttached(): boolean;
|
||||
get awareness(): Awareness | null;
|
||||
get hasUnsyncedChanges(): boolean;
|
||||
private resetUnsyncedChanges;
|
||||
incrementUnsyncedChanges(): void;
|
||||
decrementUnsyncedChanges(): void;
|
||||
forceSync(): void;
|
||||
pageHide(): void;
|
||||
registerEventListeners(): void;
|
||||
sendStateless(payload: string): void;
|
||||
sendToken(): Promise<void>;
|
||||
documentUpdateHandler(update: Uint8Array, origin: any): void;
|
||||
awarenessUpdateHandler({ added, updated, removed }: any, origin: any): void;
|
||||
/**
|
||||
* Indicates whether a first handshake with the server has been established
|
||||
*
|
||||
* Note: this does not mean all updates from the client have been persisted to the backend. For this,
|
||||
* use `hasUnsyncedChanges`.
|
||||
*/
|
||||
get synced(): boolean;
|
||||
set synced(state: boolean);
|
||||
receiveStateless(payload: string): void;
|
||||
connect(): Promise<unknown>;
|
||||
disconnect(): void;
|
||||
onOpen(event: Event): Promise<void>;
|
||||
getToken(): Promise<string | null>;
|
||||
startSync(): void;
|
||||
send(message: ConstructableOutgoingMessage, args: any): void;
|
||||
onMessage(event: MessageEvent): void;
|
||||
onClose(): void;
|
||||
destroy(): void;
|
||||
detach(): void;
|
||||
attach(): void;
|
||||
permissionDeniedHandler(reason: string): void;
|
||||
authenticatedHandler(scope: string): void;
|
||||
setAwarenessField(key: string, value: any): void;
|
||||
}
|
||||
@ -0,0 +1,119 @@
|
||||
import type { Event, MessageEvent } from "ws";
|
||||
import EventEmitter from "./EventEmitter.ts";
|
||||
import type { HocuspocusProvider } from "./HocuspocusProvider.ts";
|
||||
import { WebSocketStatus, type onAwarenessChangeParameters, type onAwarenessUpdateParameters, type onCloseParameters, type onDisconnectParameters, type onMessageParameters, type onOpenParameters, type onOutgoingMessageParameters, type onStatusParameters } from "./types.ts";
|
||||
export type HocuspocusWebSocket = WebSocket & {
|
||||
identifier: string;
|
||||
};
|
||||
export type HocusPocusWebSocket = HocuspocusWebSocket;
|
||||
export type HocuspocusProviderWebsocketConfiguration = Required<Pick<CompleteHocuspocusProviderWebsocketConfiguration, "url">> & Partial<CompleteHocuspocusProviderWebsocketConfiguration>;
|
||||
export interface CompleteHocuspocusProviderWebsocketConfiguration {
|
||||
/**
|
||||
* Whether to connect automatically when creating the provider instance. Default=true
|
||||
*/
|
||||
autoConnect: boolean;
|
||||
/**
|
||||
* URL of your @hocuspocus/server instance
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* By default, trailing slashes are removed from the URL. Set this to true
|
||||
* to preserve trailing slashes if your server configuration requires them.
|
||||
*/
|
||||
preserveTrailingSlash: boolean;
|
||||
/**
|
||||
* An optional WebSocket polyfill, for example for Node.js
|
||||
*/
|
||||
WebSocketPolyfill: any;
|
||||
/**
|
||||
* 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 initialDelay 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;
|
||||
handleTimeout: (() => Promise<unknown>) | null;
|
||||
onOpen: (data: onOpenParameters) => void;
|
||||
onConnect: () => void;
|
||||
onMessage: (data: onMessageParameters) => void;
|
||||
onOutgoingMessage: (data: onOutgoingMessageParameters) => void;
|
||||
onStatus: (data: onStatusParameters) => void;
|
||||
onDisconnect: (data: onDisconnectParameters) => void;
|
||||
onClose: (data: onCloseParameters) => void;
|
||||
onDestroy: () => void;
|
||||
onAwarenessUpdate: (data: onAwarenessUpdateParameters) => void;
|
||||
onAwarenessChange: (data: onAwarenessChangeParameters) => void;
|
||||
/**
|
||||
* Map of attached providers keyed by documentName.
|
||||
*/
|
||||
providerMap: Map<string, HocuspocusProvider>;
|
||||
}
|
||||
export declare class HocuspocusProviderWebsocket extends EventEmitter {
|
||||
private messageQueue;
|
||||
configuration: CompleteHocuspocusProviderWebsocketConfiguration;
|
||||
webSocket: HocusPocusWebSocket | null;
|
||||
webSocketHandlers: {
|
||||
[key: string]: any;
|
||||
};
|
||||
shouldConnect: boolean;
|
||||
status: WebSocketStatus;
|
||||
lastMessageReceived: number;
|
||||
identifier: number;
|
||||
intervals: any;
|
||||
connectionAttempt: {
|
||||
resolve: (value?: any) => void;
|
||||
reject: (reason?: any) => void;
|
||||
} | null;
|
||||
constructor(configuration: HocuspocusProviderWebsocketConfiguration);
|
||||
receivedOnOpenPayload?: Event | undefined;
|
||||
onOpen(event: Event): Promise<void>;
|
||||
attach(provider: HocuspocusProvider): void;
|
||||
detach(provider: HocuspocusProvider): void;
|
||||
setConfiguration(configuration?: Partial<HocuspocusProviderWebsocketConfiguration>): void;
|
||||
cancelWebsocketRetry?: () => void;
|
||||
connect(): Promise<unknown>;
|
||||
attachWebSocketListeners(ws: HocusPocusWebSocket, reject: Function): void;
|
||||
cleanupWebSocket(): void;
|
||||
createWebSocketConnection(): Promise<unknown>;
|
||||
onMessage(event: MessageEvent): void;
|
||||
resolveConnectionAttempt(): void;
|
||||
stopConnectionAttempt(): void;
|
||||
rejectConnectionAttempt(): void;
|
||||
closeTries: number;
|
||||
checkConnection(): void;
|
||||
get serverUrl(): string;
|
||||
get url(): string;
|
||||
disconnect(): void;
|
||||
send(message: any): void;
|
||||
onClose({ event }: onCloseParameters): void;
|
||||
destroy(): void;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
import type { Decoder } from "lib0/decoding";
|
||||
import type { Encoder } from "lib0/encoding";
|
||||
import type { MessageType } from "./types.ts";
|
||||
export declare class IncomingMessage {
|
||||
data: any;
|
||||
encoder: Encoder;
|
||||
decoder: Decoder;
|
||||
constructor(data: any);
|
||||
peekVarString(): string;
|
||||
readVarUint(): MessageType;
|
||||
readVarString(): string;
|
||||
readVarUint8Array(): Uint8Array<ArrayBufferLike>;
|
||||
writeVarUint(type: MessageType): void;
|
||||
writeVarString(string: string): void;
|
||||
writeVarUint8Array(data: Uint8Array): void;
|
||||
length(): number;
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
import type { HocuspocusProvider } from "./HocuspocusProvider.ts";
|
||||
import type { IncomingMessage } from "./IncomingMessage.ts";
|
||||
export declare class MessageReceiver {
|
||||
message: IncomingMessage;
|
||||
constructor(message: IncomingMessage);
|
||||
apply(provider: HocuspocusProvider, emitSynced: boolean): void;
|
||||
private applySyncMessage;
|
||||
applySyncStatusMessage(provider: HocuspocusProvider, applied: boolean): void;
|
||||
private applyAwarenessMessage;
|
||||
private applyAuthMessage;
|
||||
private applyQueryAwarenessMessage;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
import type { Encoder } from "lib0/encoding";
|
||||
import type { ConstructableOutgoingMessage } from "./types.ts";
|
||||
export declare class MessageSender {
|
||||
encoder: Encoder;
|
||||
message: any;
|
||||
constructor(Message: ConstructableOutgoingMessage, args?: any);
|
||||
create(): Uint8Array<ArrayBufferLike>;
|
||||
send(webSocket: any): void;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
import type { Encoder } from "lib0/encoding";
|
||||
import type { MessageType, OutgoingMessageArguments, OutgoingMessageInterface } from "./types.ts";
|
||||
export declare class OutgoingMessage implements OutgoingMessageInterface {
|
||||
encoder: Encoder;
|
||||
type?: MessageType;
|
||||
constructor();
|
||||
get(args: Partial<OutgoingMessageArguments>): Encoder | undefined;
|
||||
toUint8Array(): Uint8Array<ArrayBufferLike>;
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
import type { OutgoingMessageArguments } from "../types.ts";
|
||||
import { MessageType } from "../types.ts";
|
||||
import { OutgoingMessage } from "../OutgoingMessage.ts";
|
||||
export declare class AuthenticationMessage extends OutgoingMessage {
|
||||
type: MessageType;
|
||||
description: string;
|
||||
get(args: Partial<OutgoingMessageArguments>): import("lib0/encoding").Encoder;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
import * as encoding from "lib0/encoding";
|
||||
import type { OutgoingMessageArguments } from "../types.ts";
|
||||
import { MessageType } from "../types.ts";
|
||||
import { OutgoingMessage } from "../OutgoingMessage.ts";
|
||||
export declare class AwarenessMessage extends OutgoingMessage {
|
||||
type: MessageType;
|
||||
description: string;
|
||||
get(args: Partial<OutgoingMessageArguments>): encoding.Encoder;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
import * as encoding from "lib0/encoding";
|
||||
import type { OutgoingMessageArguments } from "../types.ts";
|
||||
import { MessageType } from "../types.ts";
|
||||
import { OutgoingMessage } from "../OutgoingMessage.ts";
|
||||
export declare class CloseMessage extends OutgoingMessage {
|
||||
type: MessageType;
|
||||
description: string;
|
||||
get(args: Partial<OutgoingMessageArguments>): encoding.Encoder;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
import * as encoding from "lib0/encoding";
|
||||
import type { OutgoingMessageArguments } from "../types.ts";
|
||||
import { MessageType } from "../types.ts";
|
||||
import { OutgoingMessage } from "../OutgoingMessage.ts";
|
||||
export declare class QueryAwarenessMessage extends OutgoingMessage {
|
||||
type: MessageType;
|
||||
description: string;
|
||||
get(args: Partial<OutgoingMessageArguments>): encoding.Encoder;
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
import type { OutgoingMessageArguments } from "../types.ts";
|
||||
import { MessageType } from "../types.ts";
|
||||
import { OutgoingMessage } from "../OutgoingMessage.ts";
|
||||
export declare class StatelessMessage extends OutgoingMessage {
|
||||
type: MessageType;
|
||||
description: string;
|
||||
get(args: Partial<OutgoingMessageArguments>): import("lib0/encoding").Encoder;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
import * as encoding from "lib0/encoding";
|
||||
import type { OutgoingMessageArguments } from "../types.ts";
|
||||
import { MessageType } from "../types.ts";
|
||||
import { OutgoingMessage } from "../OutgoingMessage.ts";
|
||||
export declare class SyncStepOneMessage extends OutgoingMessage {
|
||||
type: MessageType;
|
||||
description: string;
|
||||
get(args: Partial<OutgoingMessageArguments>): encoding.Encoder;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
import * as encoding from "lib0/encoding";
|
||||
import type { OutgoingMessageArguments } from "../types.ts";
|
||||
import { MessageType } from "../types.ts";
|
||||
import { OutgoingMessage } from "../OutgoingMessage.ts";
|
||||
export declare class SyncStepTwoMessage extends OutgoingMessage {
|
||||
type: MessageType;
|
||||
description: string;
|
||||
get(args: Partial<OutgoingMessageArguments>): encoding.Encoder;
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
import type { OutgoingMessageArguments } from "../types.ts";
|
||||
import { MessageType } from "../types.ts";
|
||||
import { OutgoingMessage } from "../OutgoingMessage.ts";
|
||||
export declare class UpdateMessage extends OutgoingMessage {
|
||||
type: MessageType;
|
||||
description: string;
|
||||
get(args: Partial<OutgoingMessageArguments>): import("lib0/encoding").Encoder;
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
export * from "./HocuspocusProvider.ts";
|
||||
export * from "./HocuspocusProviderWebsocket.ts";
|
||||
export * from "./types.ts";
|
||||
93
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/provider/src/types.d.ts
generated
vendored
Normal file
93
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/provider/src/types.d.ts
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
import type { Encoder } from "lib0/encoding";
|
||||
import type { Event, MessageEvent } from "ws";
|
||||
import type { Awareness } from "y-protocols/awareness";
|
||||
import type * as Y from "yjs";
|
||||
import type { CloseEvent } from "@hocuspocus/common";
|
||||
import type { IncomingMessage } from "./IncomingMessage.ts";
|
||||
import type { OutgoingMessage } from "./OutgoingMessage.ts";
|
||||
import type { AuthenticationMessage } from "./OutgoingMessages/AuthenticationMessage.ts";
|
||||
import type { AwarenessMessage } from "./OutgoingMessages/AwarenessMessage.ts";
|
||||
import type { QueryAwarenessMessage } from "./OutgoingMessages/QueryAwarenessMessage.ts";
|
||||
import type { SyncStepOneMessage } from "./OutgoingMessages/SyncStepOneMessage.ts";
|
||||
import type { SyncStepTwoMessage } from "./OutgoingMessages/SyncStepTwoMessage.ts";
|
||||
import type { UpdateMessage } from "./OutgoingMessages/UpdateMessage.ts";
|
||||
export declare enum MessageType {
|
||||
Sync = 0,
|
||||
Awareness = 1,
|
||||
Auth = 2,
|
||||
QueryAwareness = 3,
|
||||
Stateless = 5,
|
||||
CLOSE = 7,
|
||||
SyncStatus = 8
|
||||
}
|
||||
export declare enum WebSocketStatus {
|
||||
Connecting = "connecting",
|
||||
Connected = "connected",
|
||||
Disconnected = "disconnected"
|
||||
}
|
||||
export type AuthorizedScope = "read-write" | "readonly";
|
||||
export interface OutgoingMessageInterface {
|
||||
encoder: Encoder;
|
||||
type?: MessageType;
|
||||
}
|
||||
export interface OutgoingMessageArguments {
|
||||
documentName: string;
|
||||
token: string;
|
||||
document: Y.Doc;
|
||||
awareness: Awareness;
|
||||
clients: number[];
|
||||
states: Map<number, {
|
||||
[key: string]: any;
|
||||
}>;
|
||||
update: any;
|
||||
payload: string;
|
||||
encoder: Encoder;
|
||||
}
|
||||
export interface Constructable<T> {
|
||||
new (...args: any): T;
|
||||
}
|
||||
export type ConstructableOutgoingMessage = Constructable<AuthenticationMessage> | Constructable<AwarenessMessage> | Constructable<QueryAwarenessMessage> | Constructable<SyncStepOneMessage> | Constructable<SyncStepTwoMessage> | Constructable<UpdateMessage>;
|
||||
export type onAuthenticationFailedParameters = {
|
||||
reason: string;
|
||||
};
|
||||
export type onAuthenticatedParameters = {
|
||||
scope: AuthorizedScope;
|
||||
};
|
||||
export type onOpenParameters = {
|
||||
event: Event;
|
||||
};
|
||||
export type onMessageParameters = {
|
||||
event: MessageEvent;
|
||||
message: IncomingMessage;
|
||||
};
|
||||
export type onOutgoingMessageParameters = {
|
||||
message: OutgoingMessage;
|
||||
};
|
||||
export type onStatusParameters = {
|
||||
status: WebSocketStatus;
|
||||
};
|
||||
export type onSyncedParameters = {
|
||||
state: boolean;
|
||||
};
|
||||
export type onUnsyncedChangesParameters = {
|
||||
number: number;
|
||||
};
|
||||
export type onDisconnectParameters = {
|
||||
event: CloseEvent;
|
||||
};
|
||||
export type onCloseParameters = {
|
||||
event: CloseEvent;
|
||||
};
|
||||
export type onAwarenessUpdateParameters = {
|
||||
states: StatesArray;
|
||||
};
|
||||
export type onAwarenessChangeParameters = {
|
||||
states: StatesArray;
|
||||
};
|
||||
export type onStatelessParameters = {
|
||||
payload: string;
|
||||
};
|
||||
export type StatesArray = {
|
||||
clientId: number;
|
||||
[key: string | number]: any;
|
||||
}[];
|
||||
@ -0,0 +1,63 @@
|
||||
import type { IncomingMessage } from "node:http";
|
||||
import { type CloseEvent } from "@hocuspocus/common";
|
||||
import type WebSocket from "ws";
|
||||
import type Document from "./Document.ts";
|
||||
import type { Hocuspocus } from "./Hocuspocus.ts";
|
||||
import type { onDisconnectPayload } from "./types.ts";
|
||||
/**
|
||||
* The `ClientConnection` class is responsible for handling an incoming WebSocket
|
||||
*
|
||||
* TODO-refactor:
|
||||
* - use event handlers instead of calling hooks directly, hooks should probably be called from Hocuspocus.ts
|
||||
*/
|
||||
export declare class ClientConnection {
|
||||
private readonly websocket;
|
||||
private readonly request;
|
||||
private readonly documentProvider;
|
||||
private readonly hooks;
|
||||
private readonly opts;
|
||||
private readonly defaultContext;
|
||||
private readonly documentConnections;
|
||||
private readonly incomingMessageQueue;
|
||||
private readonly documentConnectionsEstablished;
|
||||
private readonly hookPayloads;
|
||||
private readonly callbacks;
|
||||
private readonly socketId;
|
||||
timeout: number;
|
||||
pingInterval: NodeJS.Timeout;
|
||||
pongReceived: boolean;
|
||||
/**
|
||||
* The `ClientConnection` class receives incoming WebSocket connections,
|
||||
* runs all hooks:
|
||||
*
|
||||
* - onConnect for all connections
|
||||
* - onAuthenticate only if required
|
||||
*
|
||||
* … and if nothings fails it’ll fully establish the connection and
|
||||
* load the Document then.
|
||||
*/
|
||||
constructor(websocket: WebSocket, request: IncomingMessage, documentProvider: {
|
||||
createDocument: Hocuspocus["createDocument"];
|
||||
}, hooks: Hocuspocus["hooks"], opts: {
|
||||
timeout: number;
|
||||
}, defaultContext?: any);
|
||||
private handleWebsocketClose;
|
||||
close(event?: CloseEvent): void;
|
||||
handlePong: () => void;
|
||||
/**
|
||||
* Check if pong was received and close the connection otherwise
|
||||
* @private
|
||||
*/
|
||||
private check;
|
||||
/**
|
||||
* Set a callback that will be triggered when the connection is closed
|
||||
*/
|
||||
onClose(callback: (document: Document, payload: onDisconnectPayload) => void): ClientConnection;
|
||||
/**
|
||||
* Create a new connection by the given request and document
|
||||
*/
|
||||
private createConnection;
|
||||
private setUpNewConnection;
|
||||
private handleQueueingMessage;
|
||||
private messageHandler;
|
||||
}
|
||||
75
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/server/src/Connection.d.ts
generated
vendored
Normal file
75
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/server/src/Connection.d.ts
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
import type { IncomingMessage as HTTPIncomingMessage } from "node:http";
|
||||
import { type CloseEvent } from "@hocuspocus/common";
|
||||
import type WebSocket from "ws";
|
||||
import type Document from "./Document.ts";
|
||||
import type { beforeSyncPayload, onStatelessPayload } from "./types.ts";
|
||||
export declare class Connection {
|
||||
webSocket: WebSocket;
|
||||
context: any;
|
||||
document: Document;
|
||||
request: HTTPIncomingMessage;
|
||||
callbacks: {
|
||||
onClose: ((document: Document, event?: CloseEvent) => void)[];
|
||||
beforeHandleMessage: (connection: Connection, update: Uint8Array) => Promise<void>;
|
||||
beforeSync: (connection: Connection, payload: Pick<beforeSyncPayload, "type" | "payload">) => Promise<void>;
|
||||
statelessCallback: (payload: onStatelessPayload) => Promise<void>;
|
||||
onTokenSyncCallback: (payload: {
|
||||
token: string;
|
||||
}) => Promise<void>;
|
||||
};
|
||||
socketId: string;
|
||||
readOnly: boolean;
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
constructor(connection: WebSocket, request: HTTPIncomingMessage, document: Document, socketId: string, context: any, readOnly?: boolean);
|
||||
/**
|
||||
* Set a callback that will be triggered when the connection is closed
|
||||
*/
|
||||
onClose(callback: (document: Document, event?: CloseEvent) => void): Connection;
|
||||
/**
|
||||
* Set a callback that will be triggered when an stateless message is received
|
||||
*/
|
||||
onStatelessCallback(callback: (payload: onStatelessPayload) => Promise<void>): Connection;
|
||||
/**
|
||||
* Set a callback that will be triggered before an message is handled
|
||||
*/
|
||||
beforeHandleMessage(callback: (connection: Connection, update: Uint8Array) => Promise<any>): Connection;
|
||||
/**
|
||||
* Set a callback that will be triggered before a sync message is handled
|
||||
*/
|
||||
beforeSync(callback: (connection: Connection, payload: Pick<beforeSyncPayload, "type" | "payload">) => Promise<any>): Connection;
|
||||
/**
|
||||
* Set a callback that will be triggered when on token sync message is received
|
||||
*/
|
||||
onTokenSyncCallback(callback: (payload: {
|
||||
token: string;
|
||||
}) => Promise<void>): Connection;
|
||||
/**
|
||||
* Send the given message
|
||||
*/
|
||||
send(message: any): void;
|
||||
/**
|
||||
* Send a stateless message with payload
|
||||
*/
|
||||
sendStateless(payload: string): void;
|
||||
/**
|
||||
* Request current token from the client
|
||||
*/
|
||||
requestToken(): void;
|
||||
/**
|
||||
* Graceful wrapper around the WebSocket close method.
|
||||
*/
|
||||
close(event?: CloseEvent): void;
|
||||
/**
|
||||
* Send the current document awareness to the client, if any
|
||||
* @private
|
||||
*/
|
||||
private sendCurrentAwareness;
|
||||
/**
|
||||
* Handle an incoming message
|
||||
* @public
|
||||
*/
|
||||
handleMessage(data: Uint8Array): void;
|
||||
}
|
||||
export default Connection;
|
||||
@ -0,0 +1,14 @@
|
||||
import type Document from "./Document.ts";
|
||||
import type { Hocuspocus } from "./Hocuspocus.ts";
|
||||
import type { DirectConnection as DirectConnectionInterface } from "./types.ts";
|
||||
export declare class DirectConnection implements DirectConnectionInterface {
|
||||
document: Document | null;
|
||||
instance: Hocuspocus;
|
||||
context: any;
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
constructor(document: Document, instance: Hocuspocus, context?: any);
|
||||
transact(transaction: (document: Document) => void): Promise<void>;
|
||||
disconnect(): Promise<void>;
|
||||
}
|
||||
92
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/server/src/Document.d.ts
generated
vendored
Normal file
92
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/server/src/Document.d.ts
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
import { Mutex } from "async-mutex";
|
||||
import type WebSocket from "ws";
|
||||
import { Awareness } from "y-protocols/awareness";
|
||||
import { Doc } from "yjs";
|
||||
import type Connection from "./Connection.ts";
|
||||
export declare class Document extends Doc {
|
||||
awareness: Awareness;
|
||||
callbacks: {
|
||||
onUpdate: (document: Document, connection: Connection, update: Uint8Array) => void;
|
||||
beforeBroadcastStateless: (document: Document, stateless: string) => void;
|
||||
};
|
||||
connections: Map<WebSocket, {
|
||||
clients: Set<any>;
|
||||
connection: Connection;
|
||||
}>;
|
||||
directConnectionsCount: number;
|
||||
name: string;
|
||||
isLoading: boolean;
|
||||
isDestroyed: boolean;
|
||||
saveMutex: Mutex;
|
||||
lastChangeTime: number;
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
constructor(name: string, yDocOptions?: object);
|
||||
/**
|
||||
* Check if the Document (XMLFragment or Map) is empty
|
||||
*/
|
||||
isEmpty(fieldName: string): boolean;
|
||||
/**
|
||||
* Merge the given document(s) into this one
|
||||
*/
|
||||
merge(documents: Doc | Array<Doc>): Document;
|
||||
/**
|
||||
* Set a callback that will be triggered when the document is updated
|
||||
*/
|
||||
onUpdate(callback: (document: Document, connection: Connection, update: Uint8Array) => void): Document;
|
||||
/**
|
||||
* Set a callback that will be triggered before a stateless message is broadcasted
|
||||
*/
|
||||
beforeBroadcastStateless(callback: (document: Document, stateless: string) => void): Document;
|
||||
/**
|
||||
* Register a connection and a set of clients on this document keyed by the
|
||||
* underlying websocket connection
|
||||
*/
|
||||
addConnection(connection: Connection): Document;
|
||||
/**
|
||||
* Is the given connection registered on this document
|
||||
*/
|
||||
hasConnection(connection: Connection): boolean;
|
||||
/**
|
||||
* Remove the given connection from this document
|
||||
*/
|
||||
removeConnection(connection: Connection): Document;
|
||||
addDirectConnection(): Document;
|
||||
removeDirectConnection(): Document;
|
||||
/**
|
||||
* Get the number of active connections for this document
|
||||
*/
|
||||
getConnectionsCount(): number;
|
||||
/**
|
||||
* Get an array of registered connections
|
||||
*/
|
||||
getConnections(): Array<Connection>;
|
||||
/**
|
||||
* Get the client ids for the given connection instance
|
||||
*/
|
||||
getClients(connectionInstance: WebSocket): Set<any>;
|
||||
/**
|
||||
* Has the document awareness states
|
||||
*/
|
||||
hasAwarenessStates(): boolean;
|
||||
/**
|
||||
* Apply the given awareness update
|
||||
*/
|
||||
applyAwarenessUpdate(connection: Connection, update: Uint8Array): Document;
|
||||
/**
|
||||
* Handle an awareness update and sync changes to clients
|
||||
* @private
|
||||
*/
|
||||
private handleAwarenessUpdate;
|
||||
/**
|
||||
* Handle an updated document and sync changes to clients
|
||||
*/
|
||||
private handleUpdate;
|
||||
/**
|
||||
* Broadcast stateless message to all connections
|
||||
*/
|
||||
broadcastStateless(payload: string, filter?: (conn: Connection) => boolean): void;
|
||||
destroy(): void;
|
||||
}
|
||||
export default Document;
|
||||
80
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/server/src/Hocuspocus.d.ts
generated
vendored
Normal file
80
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/server/src/Hocuspocus.d.ts
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
import type { IncomingMessage } from "node:http";
|
||||
import type WebSocket from "ws";
|
||||
import { DirectConnection } from "./DirectConnection.ts";
|
||||
import Document from "./Document.ts";
|
||||
import type { Server } from "./Server.ts";
|
||||
import type { Configuration, ConnectionConfiguration, HookName, HookPayloadByName, onStoreDocumentPayload } from "./types.ts";
|
||||
export declare const defaultConfiguration: {
|
||||
name: null;
|
||||
timeout: number;
|
||||
debounce: number;
|
||||
maxDebounce: number;
|
||||
quiet: boolean;
|
||||
yDocOptions: {
|
||||
gc: boolean;
|
||||
gcFilter: () => boolean;
|
||||
};
|
||||
unloadImmediately: boolean;
|
||||
};
|
||||
export declare class Hocuspocus {
|
||||
configuration: Configuration;
|
||||
loadingDocuments: Map<string, Promise<Document>>;
|
||||
unloadingDocuments: Map<string, Promise<void>>;
|
||||
documents: Map<string, Document>;
|
||||
server?: Server;
|
||||
debouncer: {
|
||||
debounce: (id: string, func: () => any | Promise<() => any>, debounce: number, maxDebounce: number) => Promise<any>;
|
||||
isDebounced: (id: string) => boolean;
|
||||
isCurrentlyExecuting: (id: string) => boolean;
|
||||
executeNow: (id: string) => any;
|
||||
};
|
||||
constructor(configuration?: Partial<Configuration>);
|
||||
/**
|
||||
* Configure Hocuspocus
|
||||
*/
|
||||
configure(configuration: Partial<Configuration>): Hocuspocus;
|
||||
/**
|
||||
* Get the total number of active documents
|
||||
*/
|
||||
getDocumentsCount(): number;
|
||||
/**
|
||||
* Get the total number of active connections
|
||||
*/
|
||||
getConnectionsCount(): number;
|
||||
/**
|
||||
* Force close one or more connections
|
||||
*/
|
||||
closeConnections(documentName?: string): void;
|
||||
/**
|
||||
* The `handleConnection` method receives incoming WebSocket connections,
|
||||
* runs all hooks:
|
||||
*
|
||||
* - onConnect for all connections
|
||||
* - onAuthenticate only if required
|
||||
*
|
||||
* … and if nothing fails it’ll fully establish the connection and
|
||||
* load the Document then.
|
||||
*/
|
||||
handleConnection(incoming: WebSocket, request: IncomingMessage, defaultContext?: any): void;
|
||||
/**
|
||||
* Handle update of the given document
|
||||
*
|
||||
* "connection" is not necessarily type "Connection", it's the Yjs "origin" (which is "Connection" if
|
||||
* the update is incoming from the provider, but can be anything if the updates is originated from an extension.
|
||||
*/
|
||||
private handleDocumentUpdate;
|
||||
/**
|
||||
* Create a new document by the given request
|
||||
*/
|
||||
createDocument(documentName: string, request: Partial<Pick<IncomingMessage, "headers" | "url">>, socketId: string, connection: ConnectionConfiguration, context?: any): Promise<Document>;
|
||||
loadDocument(documentName: string, request: Partial<Pick<IncomingMessage, "headers" | "url">>, socketId: string, connectionConfig: ConnectionConfiguration, context?: any): Promise<Document>;
|
||||
storeDocumentHooks(document: Document, hookPayload: onStoreDocumentPayload, immediately?: boolean): Promise<any>;
|
||||
/**
|
||||
* Run the given hook on all configured extensions.
|
||||
* Runs the given callback after each hook.
|
||||
*/
|
||||
hooks<T extends HookName>(name: T, payload: HookPayloadByName[T], callback?: Function | null): Promise<any>;
|
||||
shouldUnloadDocument(document: Document): boolean;
|
||||
unloadDocument(document: Document): Promise<any>;
|
||||
openDirectConnection(documentName: string, context?: any): Promise<DirectConnection>;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import type { Decoder } from "lib0/decoding";
|
||||
import type { Encoder } from "lib0/encoding";
|
||||
import type { MessageType } from "./types.ts";
|
||||
export declare class IncomingMessage {
|
||||
/**
|
||||
* Access to the received message.
|
||||
*/
|
||||
decoder: Decoder;
|
||||
/**
|
||||
* Private encoder; can be undefined.
|
||||
*
|
||||
* Lazy creation of the encoder speeds up IncomingMessages that need only a decoder.
|
||||
*/
|
||||
private encoderInternal?;
|
||||
constructor(input: any);
|
||||
get encoder(): Encoder;
|
||||
readVarUint8Array(): Uint8Array<ArrayBufferLike>;
|
||||
peekVarUint8Array(): Uint8Array<ArrayBufferLike>;
|
||||
readVarUint(): number;
|
||||
readVarString(): string;
|
||||
toUint8Array(): Uint8Array<ArrayBufferLike>;
|
||||
writeVarUint(type: MessageType): void;
|
||||
writeVarString(string: string): void;
|
||||
get length(): number;
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
import type Connection from "./Connection.ts";
|
||||
import type Document from "./Document.ts";
|
||||
import type { IncomingMessage } from "./IncomingMessage.ts";
|
||||
export declare class MessageReceiver {
|
||||
message: IncomingMessage;
|
||||
defaultTransactionOrigin?: string;
|
||||
constructor(message: IncomingMessage, defaultTransactionOrigin?: string);
|
||||
apply(document: Document, connection?: Connection, reply?: (message: Uint8Array) => void): void;
|
||||
readSyncMessage(message: IncomingMessage, document: Document, connection?: Connection, reply?: (message: Uint8Array) => void, requestFirstSync?: boolean): 0 | 2 | 1;
|
||||
applyQueryAwarenessMessage(document: Document, reply?: (message: Uint8Array) => void): void;
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
import type { Encoder } from "lib0/encoding";
|
||||
import type { Awareness } from "y-protocols/awareness";
|
||||
import type Document from "./Document.ts";
|
||||
export declare class OutgoingMessage {
|
||||
encoder: Encoder;
|
||||
type?: number;
|
||||
category?: string;
|
||||
constructor(documentName: string);
|
||||
createSyncMessage(): OutgoingMessage;
|
||||
createSyncReplyMessage(): OutgoingMessage;
|
||||
createAwarenessUpdateMessage(awareness: Awareness, changedClients?: Array<any>): OutgoingMessage;
|
||||
writeQueryAwareness(): OutgoingMessage;
|
||||
writeTokenSyncRequest(): OutgoingMessage;
|
||||
writeAuthenticated(readonly: boolean): OutgoingMessage;
|
||||
writePermissionDenied(reason: string): OutgoingMessage;
|
||||
writeFirstSyncStepFor(document: Document): OutgoingMessage;
|
||||
writeUpdate(update: Uint8Array): OutgoingMessage;
|
||||
writeStateless(payload: string): OutgoingMessage;
|
||||
writeBroadcastStateless(payload: string): OutgoingMessage;
|
||||
writeSyncStatus(updateSaved: boolean): OutgoingMessage;
|
||||
writeCloseMessage(reason: string): OutgoingMessage;
|
||||
toUint8Array(): Uint8Array;
|
||||
}
|
||||
32
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/server/src/Server.d.ts
generated
vendored
Normal file
32
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/server/src/Server.d.ts
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
import type { Server as HTTPServer, IncomingMessage, ServerResponse } from "node:http";
|
||||
import { WebSocketServer } from "ws";
|
||||
import type { AddressInfo, ServerOptions } from "ws";
|
||||
import { Hocuspocus } from "./Hocuspocus.ts";
|
||||
import type { Configuration } from "./types.ts";
|
||||
export interface ServerConfiguration extends Configuration {
|
||||
port?: number;
|
||||
address?: string;
|
||||
stopOnSignals?: boolean;
|
||||
}
|
||||
export declare const defaultServerConfiguration: {
|
||||
port: number;
|
||||
address: string;
|
||||
stopOnSignals: boolean;
|
||||
};
|
||||
export declare class Server {
|
||||
httpServer: HTTPServer;
|
||||
webSocketServer: WebSocketServer;
|
||||
hocuspocus: Hocuspocus;
|
||||
configuration: ServerConfiguration;
|
||||
constructor(configuration?: Partial<ServerConfiguration>, websocketOptions?: ServerOptions);
|
||||
setupWebsocketConnection: () => void;
|
||||
setupHttpUpgrade: () => void;
|
||||
requestHandler: (request: IncomingMessage, response: ServerResponse) => Promise<void>;
|
||||
listen(port?: number, callback?: any): Promise<Hocuspocus>;
|
||||
get address(): AddressInfo;
|
||||
destroy(): Promise<any>;
|
||||
get URL(): string;
|
||||
get webSocketURL(): string;
|
||||
get httpURL(): string;
|
||||
private showStartScreen;
|
||||
}
|
||||
9
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/server/src/index.d.ts
generated
vendored
Normal file
9
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/server/src/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
export * from "./Connection.ts";
|
||||
export * from "./Document.ts";
|
||||
export * from "./Hocuspocus.ts";
|
||||
export * from "./IncomingMessage.ts";
|
||||
export * from "./MessageReceiver.ts";
|
||||
export * from "./OutgoingMessage.ts";
|
||||
export * from "./Server.ts";
|
||||
export * from "./types.ts";
|
||||
export * from "./util/debounce.ts";
|
||||
342
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/server/src/types.d.ts
generated
vendored
Normal file
342
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/packages/server/src/types.d.ts
generated
vendored
Normal file
@ -0,0 +1,342 @@
|
||||
import type { IncomingHttpHeaders, IncomingMessage, ServerResponse } from "node:http";
|
||||
import type { URLSearchParams } from "node:url";
|
||||
import type { Awareness } from "y-protocols/awareness";
|
||||
import type Connection from "./Connection.ts";
|
||||
import type Document from "./Document.ts";
|
||||
import type { Hocuspocus } from "./Hocuspocus.ts";
|
||||
export declare enum MessageType {
|
||||
Unknown = -1,
|
||||
Sync = 0,
|
||||
Awareness = 1,
|
||||
Auth = 2,
|
||||
QueryAwareness = 3,
|
||||
SyncReply = 4,// same as Sync, but won't trigger another 'SyncStep1'
|
||||
Stateless = 5,
|
||||
BroadcastStateless = 6,
|
||||
CLOSE = 7,
|
||||
SyncStatus = 8
|
||||
}
|
||||
export interface AwarenessUpdate {
|
||||
added: Array<any>;
|
||||
updated: Array<any>;
|
||||
removed: Array<any>;
|
||||
}
|
||||
export interface ConnectionConfiguration {
|
||||
readOnly: boolean;
|
||||
isAuthenticated: boolean;
|
||||
}
|
||||
export interface Extension {
|
||||
priority?: number;
|
||||
extensionName?: string;
|
||||
onConfigure?(data: onConfigurePayload): Promise<any>;
|
||||
onListen?(data: onListenPayload): Promise<any>;
|
||||
onUpgrade?(data: onUpgradePayload): Promise<any>;
|
||||
onConnect?(data: onConnectPayload): Promise<any>;
|
||||
connected?(data: connectedPayload): Promise<any>;
|
||||
onAuthenticate?(data: onAuthenticatePayload): Promise<any>;
|
||||
onTokenSync?(data: onTokenSyncPayload): Promise<any>;
|
||||
onCreateDocument?(data: onCreateDocumentPayload): Promise<any>;
|
||||
onLoadDocument?(data: onLoadDocumentPayload): Promise<any>;
|
||||
afterLoadDocument?(data: afterLoadDocumentPayload): Promise<any>;
|
||||
beforeHandleMessage?(data: beforeHandleMessagePayload): Promise<any>;
|
||||
beforeSync?(data: beforeSyncPayload): Promise<any>;
|
||||
beforeBroadcastStateless?(data: beforeBroadcastStatelessPayload): Promise<any>;
|
||||
onStateless?(payload: onStatelessPayload): Promise<any>;
|
||||
onChange?(data: onChangePayload): Promise<any>;
|
||||
onStoreDocument?(data: onStoreDocumentPayload): Promise<any>;
|
||||
afterStoreDocument?(data: afterStoreDocumentPayload): Promise<any>;
|
||||
onAwarenessUpdate?(data: onAwarenessUpdatePayload): Promise<any>;
|
||||
onRequest?(data: onRequestPayload): Promise<any>;
|
||||
onDisconnect?(data: onDisconnectPayload): Promise<any>;
|
||||
beforeUnloadDocument?(data: beforeUnloadDocumentPayload): Promise<any>;
|
||||
afterUnloadDocument?(data: afterUnloadDocumentPayload): Promise<any>;
|
||||
onDestroy?(data: onDestroyPayload): Promise<any>;
|
||||
}
|
||||
export type HookName = "onConfigure" | "onListen" | "onUpgrade" | "onConnect" | "connected" | "onAuthenticate" | "onTokenSync" | "onCreateDocument" | "onLoadDocument" | "afterLoadDocument" | "beforeHandleMessage" | "beforeBroadcastStateless" | "beforeSync" | "onStateless" | "onChange" | "onStoreDocument" | "afterStoreDocument" | "onAwarenessUpdate" | "onRequest" | "onDisconnect" | "beforeUnloadDocument" | "afterUnloadDocument" | "onDestroy";
|
||||
export type HookPayloadByName = {
|
||||
onConfigure: onConfigurePayload;
|
||||
onListen: onListenPayload;
|
||||
onUpgrade: onUpgradePayload;
|
||||
onConnect: onConnectPayload;
|
||||
connected: connectedPayload;
|
||||
onAuthenticate: onAuthenticatePayload;
|
||||
onTokenSync: onTokenSyncPayload;
|
||||
onCreateDocument: onCreateDocumentPayload;
|
||||
onLoadDocument: onLoadDocumentPayload;
|
||||
afterLoadDocument: afterLoadDocumentPayload;
|
||||
beforeHandleMessage: beforeHandleMessagePayload;
|
||||
beforeBroadcastStateless: beforeBroadcastStatelessPayload;
|
||||
beforeSync: beforeSyncPayload;
|
||||
onStateless: onStatelessPayload;
|
||||
onChange: onChangePayload;
|
||||
onStoreDocument: onStoreDocumentPayload;
|
||||
afterStoreDocument: afterStoreDocumentPayload;
|
||||
onAwarenessUpdate: onAwarenessUpdatePayload;
|
||||
onRequest: onRequestPayload;
|
||||
onDisconnect: onDisconnectPayload;
|
||||
afterUnloadDocument: afterUnloadDocumentPayload;
|
||||
beforeUnloadDocument: beforeUnloadDocumentPayload;
|
||||
onDestroy: onDestroyPayload;
|
||||
};
|
||||
export interface Configuration extends Extension {
|
||||
/**
|
||||
* A name for the instance, used for logging.
|
||||
*/
|
||||
name: string | null;
|
||||
/**
|
||||
* A list of hocuspocus extensions.
|
||||
*/
|
||||
extensions: Array<Extension>;
|
||||
/**
|
||||
* Defines in which interval the server sends a ping, and closes the connection when no pong is sent back.
|
||||
*/
|
||||
timeout: number;
|
||||
/**
|
||||
* Debounces the call of the `onStoreDocument` hook for the given amount of time in ms.
|
||||
* Otherwise every single update would be persisted.
|
||||
*/
|
||||
debounce: number;
|
||||
/**
|
||||
* Makes sure to call `onStoreDocument` at least in the given amount of time (ms).
|
||||
*/
|
||||
maxDebounce: number;
|
||||
/**
|
||||
* By default, the servers show a start screen. If passed false, the server will start quietly.
|
||||
*/
|
||||
quiet: boolean;
|
||||
/**
|
||||
* If set to false, respects the debounce time of `onStoreDocument` before unloading a document.
|
||||
* Otherwise, the document will be unloaded immediately.
|
||||
*
|
||||
* This prevents a client from DOSing the server by repeatedly connecting and disconnecting when
|
||||
* your onStoreDocument is rate-limited.
|
||||
*/
|
||||
unloadImmediately: boolean;
|
||||
/**
|
||||
* options to pass to the ydoc document
|
||||
*/
|
||||
yDocOptions: {
|
||||
gc: boolean;
|
||||
gcFilter: () => boolean;
|
||||
};
|
||||
}
|
||||
export interface onStatelessPayload {
|
||||
connection: Connection;
|
||||
documentName: string;
|
||||
document: Document;
|
||||
payload: string;
|
||||
}
|
||||
export interface onAuthenticatePayload {
|
||||
context: any;
|
||||
documentName: string;
|
||||
instance: Hocuspocus;
|
||||
requestHeaders: IncomingHttpHeaders;
|
||||
requestParameters: URLSearchParams;
|
||||
request: IncomingMessage;
|
||||
socketId: string;
|
||||
token: string;
|
||||
connectionConfig: ConnectionConfiguration;
|
||||
}
|
||||
export interface onTokenSyncPayload {
|
||||
context: any;
|
||||
document: Document;
|
||||
documentName: string;
|
||||
instance: Hocuspocus;
|
||||
requestHeaders: IncomingHttpHeaders;
|
||||
requestParameters: URLSearchParams;
|
||||
socketId: string;
|
||||
token: string;
|
||||
connectionConfig: ConnectionConfiguration;
|
||||
connection: Connection;
|
||||
}
|
||||
export interface onCreateDocumentPayload {
|
||||
context: any;
|
||||
documentName: string;
|
||||
instance: Hocuspocus;
|
||||
requestHeaders: IncomingHttpHeaders;
|
||||
requestParameters: URLSearchParams;
|
||||
socketId: string;
|
||||
connectionConfig: ConnectionConfiguration;
|
||||
}
|
||||
export interface onConnectPayload {
|
||||
context: any;
|
||||
documentName: string;
|
||||
instance: Hocuspocus;
|
||||
request: IncomingMessage;
|
||||
requestHeaders: IncomingHttpHeaders;
|
||||
requestParameters: URLSearchParams;
|
||||
socketId: string;
|
||||
connectionConfig: ConnectionConfiguration;
|
||||
}
|
||||
export interface connectedPayload {
|
||||
context: any;
|
||||
documentName: string;
|
||||
instance: Hocuspocus;
|
||||
request: IncomingMessage;
|
||||
requestHeaders: IncomingHttpHeaders;
|
||||
requestParameters: URLSearchParams;
|
||||
socketId: string;
|
||||
connectionConfig: ConnectionConfiguration;
|
||||
connection: Connection;
|
||||
}
|
||||
export interface onLoadDocumentPayload {
|
||||
context: any;
|
||||
document: Document;
|
||||
documentName: string;
|
||||
instance: Hocuspocus;
|
||||
requestHeaders: IncomingHttpHeaders;
|
||||
requestParameters: URLSearchParams;
|
||||
socketId: string;
|
||||
connectionConfig: ConnectionConfiguration;
|
||||
}
|
||||
export interface afterLoadDocumentPayload {
|
||||
context: any;
|
||||
document: Document;
|
||||
documentName: string;
|
||||
instance: Hocuspocus;
|
||||
requestHeaders: IncomingHttpHeaders;
|
||||
requestParameters: URLSearchParams;
|
||||
socketId: string;
|
||||
connectionConfig: ConnectionConfiguration;
|
||||
}
|
||||
export interface onChangePayload {
|
||||
clientsCount: number;
|
||||
context: any;
|
||||
document: Document;
|
||||
documentName: string;
|
||||
instance: Hocuspocus;
|
||||
requestHeaders: IncomingHttpHeaders;
|
||||
requestParameters: URLSearchParams;
|
||||
update: Uint8Array;
|
||||
socketId: string;
|
||||
transactionOrigin: any;
|
||||
}
|
||||
export interface beforeHandleMessagePayload {
|
||||
clientsCount: number;
|
||||
context: any;
|
||||
document: Document;
|
||||
documentName: string;
|
||||
instance: Hocuspocus;
|
||||
requestHeaders: IncomingHttpHeaders;
|
||||
requestParameters: URLSearchParams;
|
||||
update: Uint8Array;
|
||||
socketId: string;
|
||||
connection: Connection;
|
||||
}
|
||||
export interface beforeSyncPayload {
|
||||
clientsCount: number;
|
||||
context: any;
|
||||
document: Document;
|
||||
documentName: string;
|
||||
connection: Connection;
|
||||
/**
|
||||
* The y-protocols/sync message type
|
||||
* @example
|
||||
* 0: SyncStep1
|
||||
* 1: SyncStep2
|
||||
* 2: YjsUpdate
|
||||
*
|
||||
* @see https://github.com/yjs/y-protocols/blob/master/sync.js#L13-L40
|
||||
*/
|
||||
type: number;
|
||||
/**
|
||||
* The payload of the y-sync message.
|
||||
*/
|
||||
payload: Uint8Array;
|
||||
}
|
||||
export interface beforeBroadcastStatelessPayload {
|
||||
document: Document;
|
||||
documentName: string;
|
||||
payload: string;
|
||||
}
|
||||
export interface onStoreDocumentPayload {
|
||||
clientsCount: number;
|
||||
context: any;
|
||||
document: Document;
|
||||
documentName: string;
|
||||
instance: Hocuspocus;
|
||||
requestHeaders: IncomingHttpHeaders;
|
||||
requestParameters: URLSearchParams;
|
||||
socketId: string;
|
||||
transactionOrigin?: any;
|
||||
}
|
||||
export interface afterStoreDocumentPayload extends onStoreDocumentPayload {
|
||||
}
|
||||
export interface onAwarenessUpdatePayload {
|
||||
context: any;
|
||||
document: Document;
|
||||
documentName: string;
|
||||
instance: Hocuspocus;
|
||||
requestHeaders: IncomingHttpHeaders;
|
||||
requestParameters: URLSearchParams;
|
||||
socketId: string;
|
||||
added: number[];
|
||||
updated: number[];
|
||||
removed: number[];
|
||||
awareness: Awareness;
|
||||
states: StatesArray;
|
||||
}
|
||||
export type StatesArray = {
|
||||
clientId: number;
|
||||
[key: string | number]: any;
|
||||
}[];
|
||||
export interface fetchPayload {
|
||||
context: any;
|
||||
document: Document;
|
||||
documentName: string;
|
||||
instance: Hocuspocus;
|
||||
requestHeaders: IncomingHttpHeaders;
|
||||
requestParameters: URLSearchParams;
|
||||
socketId: string;
|
||||
connectionConfig: ConnectionConfiguration;
|
||||
}
|
||||
export interface storePayload extends onStoreDocumentPayload {
|
||||
state: Buffer;
|
||||
}
|
||||
export interface onDisconnectPayload {
|
||||
clientsCount: number;
|
||||
context: any;
|
||||
document: Document;
|
||||
documentName: string;
|
||||
instance: Hocuspocus;
|
||||
requestHeaders: IncomingHttpHeaders;
|
||||
requestParameters: URLSearchParams;
|
||||
socketId: string;
|
||||
}
|
||||
export interface onRequestPayload {
|
||||
request: IncomingMessage;
|
||||
response: ServerResponse;
|
||||
instance: Hocuspocus;
|
||||
}
|
||||
export interface onUpgradePayload {
|
||||
request: IncomingMessage;
|
||||
socket: any;
|
||||
head: any;
|
||||
instance: Hocuspocus;
|
||||
}
|
||||
export interface onListenPayload {
|
||||
instance: Hocuspocus;
|
||||
configuration: Configuration;
|
||||
port: number;
|
||||
}
|
||||
export interface onDestroyPayload {
|
||||
instance: Hocuspocus;
|
||||
}
|
||||
export interface onConfigurePayload {
|
||||
instance: Hocuspocus;
|
||||
configuration: Configuration;
|
||||
version: string;
|
||||
}
|
||||
export interface afterUnloadDocumentPayload {
|
||||
instance: Hocuspocus;
|
||||
documentName: string;
|
||||
}
|
||||
export interface beforeUnloadDocumentPayload {
|
||||
instance: Hocuspocus;
|
||||
documentName: string;
|
||||
document: Document;
|
||||
}
|
||||
export interface DirectConnection {
|
||||
transact(transaction: (document: Document) => void): Promise<void>;
|
||||
disconnect(): void;
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
export declare const useDebounce: () => {
|
||||
debounce: (id: string, func: () => any | Promise<() => any>, debounce: number, maxDebounce: number) => Promise<any>;
|
||||
isDebounced: (id: string) => boolean;
|
||||
isCurrentlyExecuting: (id: string) => boolean;
|
||||
executeNow: (id: string) => any;
|
||||
};
|
||||
@ -0,0 +1,6 @@
|
||||
import type { IncomingMessage } from "node:http";
|
||||
import { URLSearchParams } from "node:url";
|
||||
/**
|
||||
* Get parameters by the given request
|
||||
*/
|
||||
export declare function getParameters(request?: Pick<IncomingMessage, "url">): URLSearchParams;
|
||||
@ -0,0 +1,11 @@
|
||||
import { Doc } from "yjs";
|
||||
import { Schema } from "@tiptap/pm/model";
|
||||
import type { Transformer } from "./types.ts";
|
||||
declare class Prosemirror implements Transformer {
|
||||
defaultSchema: Schema;
|
||||
schema(schema: Schema): Prosemirror;
|
||||
fromYdoc(document: Doc, fieldName?: string | Array<string>): any;
|
||||
toYdoc(document: any, fieldName?: string | Array<string>, schema?: Schema): Doc;
|
||||
}
|
||||
export declare const ProsemirrorTransformer: Prosemirror;
|
||||
export {};
|
||||
@ -0,0 +1,10 @@
|
||||
import type { Doc } from "yjs";
|
||||
import type { Extensions } from "@tiptap/core";
|
||||
import type { Transformer } from "./types.ts";
|
||||
export declare class Tiptap implements Transformer {
|
||||
defaultExtensions: Extensions;
|
||||
extensions(extensions: Extensions): Tiptap;
|
||||
fromYdoc(document: Doc, fieldName?: string | Array<string>): any;
|
||||
toYdoc(document: any, fieldName?: string | Array<string>, extensions?: Extensions): Doc;
|
||||
}
|
||||
export declare const TiptapTransformer: Tiptap;
|
||||
@ -0,0 +1,3 @@
|
||||
export * from "./Prosemirror.ts";
|
||||
export * from "./Tiptap.ts";
|
||||
export * from "./types.ts";
|
||||
@ -0,0 +1,5 @@
|
||||
import type { Doc } from "yjs";
|
||||
export interface Transformer {
|
||||
fromYdoc: (document: Doc, fieldName?: string | Array<string>) => any;
|
||||
toYdoc: (document: any, fieldName: string) => Doc;
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/playground/backend/src/koa.d.ts
generated
vendored
Normal file
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/playground/backend/src/koa.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/playground/backend/src/s3.d.ts
generated
vendored
Normal file
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/playground/backend/src/s3.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1,2 @@
|
||||
import type { HocuspocusProviderWebsocket } from "@hocuspocus/provider";
|
||||
export declare const SocketContext1: import("react").Context<HocuspocusProviderWebsocket | null>;
|
||||
@ -0,0 +1,2 @@
|
||||
import type { HocuspocusProviderWebsocket } from "@hocuspocus/provider";
|
||||
export declare const SocketContext2: import("react").Context<HocuspocusProviderWebsocket | null>;
|
||||
@ -0,0 +1,3 @@
|
||||
import type { NextConfig } from "next";
|
||||
declare const nextConfig: NextConfig;
|
||||
export default nextConfig;
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/tests/extension-s3/fetch.d.ts
generated
vendored
Normal file
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/tests/extension-s3/fetch.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/tests/provider/observe.d.ts
generated
vendored
Normal file
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/tests/provider/observe.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
||||
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/tests/provider/observeDeep.d.ts
generated
vendored
Normal file
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/tests/provider/observeDeep.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
@ -0,0 +1 @@
|
||||
export {};
|
||||
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/tests/provider/onClose.d.ts
generated
vendored
Normal file
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/tests/provider/onClose.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
||||
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/tests/provider/onConnect.d.ts
generated
vendored
Normal file
1
services/hocuspocus/node_modules/.pnpm/@hocuspocus+common@3.4.4/node_modules/@hocuspocus/common/dist/tests/provider/onConnect.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user