introduce TxResult

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov
2021-10-13 18:46:48 +02:00
parent e080f6e724
commit d75d17bfec
19 changed files with 127 additions and 92 deletions
+3 -2
View File
@@ -20,7 +20,7 @@ import { createServer, IncomingMessage } from 'http'
import WebSocket, { Server } from 'ws'
import { decode } from 'jwt-simple'
import type { Doc, Ref, Class, FindOptions, FindResult, Tx, DocumentQuery, Storage, ServerStorage } from '@anticrm/core'
import type { Doc, Ref, Class, FindOptions, FindResult, Tx, DocumentQuery, Storage, ServerStorage, TxResult } from '@anticrm/core'
let LOGGING_ENABLED = true
@@ -39,12 +39,13 @@ class Session implements Storage {
return await this.storage.findAll(_class, query, options)
}
async tx (tx: Tx): Promise<void> {
async tx (tx: Tx): Promise<TxResult> {
const derived = await this.storage.tx(tx)
this.manager.broadcast(this, this.token, { result: tx })
for (const tx of derived) {
this.manager.broadcast(null, this.token, { result: tx })
}
return {}
}
}