@cuboapp/api-backend 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuboapp/api-backend",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "Backend Api for CuboApp",
5
5
  "main": "src/index.ts",
6
6
  "repository": "git@github.com:cuboapp/api-backend.git",
@@ -9,7 +9,7 @@
9
9
  "type": "module",
10
10
  "dependencies": {
11
11
  "@cuboapp/constants": "^2.0.5",
12
- "@cuboapp/database": "^1.0.1",
12
+ "@cuboapp/database": "^1.0.2",
13
13
  "@cuboapp/types": "^2.0.6",
14
14
  "@cuboapp/utils": "1.0.4",
15
15
  "@hocuspocus/extension-database": "^3.2.3",
package/src/crdt/index.ts CHANGED
@@ -1,23 +1,17 @@
1
1
  import { QueryTypes } from '@cuboapp/database'
2
2
  import { CuboApiEntitiesMap, CuboEntity } from '@cuboapp/types'
3
3
  import { Database } from '@hocuspocus/extension-database'
4
- import {
5
- beforeSyncPayload,
6
- Document,
7
- Hocuspocus,
8
- onChangePayload,
9
- onLoadDocumentPayload,
10
- onStoreDocumentPayload,
11
- Server
12
- } from '@hocuspocus/server'
4
+ import { Server } from '@hocuspocus/server'
13
5
  import { IncomingHttpHeaders } from 'http'
14
6
  import * as Y from 'yjs'
15
7
 
16
8
  import { CuboBackendApi } from '..'
17
- import { DirectConnection } from './types'
9
+ import { CuboDirectConnection } from './types'
18
10
 
19
11
  export * from './types'
20
12
 
13
+ export * from '@hocuspocus/server'
14
+
21
15
  export class CuboCrdt<T extends CuboApiEntitiesMap<T>> {
22
16
  public server: Server
23
17
  private documentPrefix = 'cubo'
@@ -308,7 +302,7 @@ export class CuboCrdt<T extends CuboApiEntitiesMap<T>> {
308
302
  return this.server.hocuspocus.openDirectConnection(documentName, context)
309
303
  }
310
304
 
311
- public async connectionDisconnect(connection: DirectConnection) {
305
+ public async connectionDisconnect(connection: CuboDirectConnection) {
312
306
  const { document, instance, context } = connection
313
307
 
314
308
  if (document) {
@@ -414,5 +408,3 @@ export class CuboCrdt<T extends CuboApiEntitiesMap<T>> {
414
408
  return Buffer.from(Y.encodeStateAsUpdate(document))
415
409
  }
416
410
  }
417
-
418
- export { beforeSyncPayload, DirectConnection, Document, Hocuspocus, onChangePayload, onLoadDocumentPayload, onStoreDocumentPayload }
package/src/crdt/types.ts CHANGED
@@ -27,7 +27,7 @@ export type CuboCrdtConfiguration<T extends CuboApiEntitiesMap<T>> = Omit<
27
27
  fieldAlias?: string
28
28
  }
29
29
 
30
- export type DirectConnection = {
30
+ export type CuboDirectConnection = {
31
31
  document: Document | null
32
32
  instance: Hocuspocus
33
33
  context: any