mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-07 02:07:43 +02:00
introduce TxResult
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { Tx, Storage, Ref, Doc, Class, DocumentQuery, FindResult, FindOptions, TxHander, ServerStorage } from '@anticrm/core'
|
||||
import type { Tx, Storage, Ref, Doc, Class, DocumentQuery, FindResult, FindOptions, TxHander, ServerStorage, TxResult } from '@anticrm/core'
|
||||
import { DOMAIN_TX } from '@anticrm/core'
|
||||
import { createInMemoryAdapter, createInMemoryTxAdapter } from '@anticrm/dev-storage'
|
||||
import { createServerStorage, FullTextAdapter, IndexedDoc } from '@anticrm/server-core'
|
||||
@@ -28,19 +28,22 @@ class ServerStorageWrapper implements Storage {
|
||||
return this.storage.findAll(c, q, o)
|
||||
}
|
||||
|
||||
async tx (tx: Tx): Promise<void> {
|
||||
async tx (tx: Tx): Promise<TxResult> {
|
||||
const _tx = protoDeserialize(protoSerialize(tx))
|
||||
const derived = await this.storage.tx(_tx)
|
||||
for (const tx of derived) { this.handler(tx) }
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
class NullFullTextAdapter implements FullTextAdapter {
|
||||
async index (doc: IndexedDoc): Promise<void> {
|
||||
async index (doc: IndexedDoc): Promise<TxResult> {
|
||||
console.log('noop full text indexer: ', doc)
|
||||
return {}
|
||||
}
|
||||
|
||||
async update (id: Ref<Doc>, update: Record<string, any>): Promise<void> {
|
||||
async update (id: Ref<Doc>, update: Record<string, any>): Promise<TxResult> {
|
||||
return {}
|
||||
}
|
||||
|
||||
async search (query: any): Promise<IndexedDoc[]> {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
//
|
||||
|
||||
import { DOMAIN_TX } from '@anticrm/core'
|
||||
import type { Ref, Doc } from '@anticrm/core'
|
||||
import type { Ref, Doc, TxResult } from '@anticrm/core'
|
||||
import { start as startJsonRpc } from '@anticrm/server-ws'
|
||||
import { createInMemoryAdapter, createInMemoryTxAdapter } from '@anticrm/dev-storage'
|
||||
import { createServerStorage, FullTextAdapter, IndexedDoc } from '@anticrm/server-core'
|
||||
@@ -25,11 +25,13 @@ import { addLocation } from '@anticrm/platform'
|
||||
import { serverChunterId } from '@anticrm/server-chunter'
|
||||
|
||||
class NullFullTextAdapter implements FullTextAdapter {
|
||||
async index (doc: IndexedDoc): Promise<void> {
|
||||
async index (doc: IndexedDoc): Promise<TxResult> {
|
||||
console.log('noop full text indexer: ', doc)
|
||||
return {}
|
||||
}
|
||||
|
||||
async update (id: Ref<Doc>, update: Record<string, any>): Promise<void> {
|
||||
async update (id: Ref<Doc>, update: Record<string, any>): Promise<TxResult> {
|
||||
return {}
|
||||
}
|
||||
|
||||
async search (query: any): Promise<IndexedDoc[]> {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { Tx, Ref, Doc, Class, DocumentQuery, FindResult, FindOptions } from '@anticrm/core'
|
||||
import type { Tx, Ref, Doc, Class, DocumentQuery, FindResult, FindOptions, TxResult } from '@anticrm/core'
|
||||
import { ModelDb, TxDb, Hierarchy } from '@anticrm/core'
|
||||
import type { DbAdapter, TxAdapter } from '@anticrm/server-core'
|
||||
|
||||
@@ -30,7 +30,7 @@ class InMemoryTxAdapter implements TxAdapter {
|
||||
return await this.txdb.findAll(_class, query, options)
|
||||
}
|
||||
|
||||
tx (tx: Tx): Promise<void> {
|
||||
tx (tx: Tx): Promise<TxResult> {
|
||||
return this.txdb.tx(tx)
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class InMemoryAdapter implements DbAdapter {
|
||||
return await this.modeldb.findAll(_class, query, options)
|
||||
}
|
||||
|
||||
async tx (tx: Tx): Promise<void> {
|
||||
async tx (tx: Tx): Promise<TxResult> {
|
||||
return await this.modeldb.tx(tx)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user