mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-26 19:44:57 +02:00
UBERF-7532: Bulk operations for triggers (#6023)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -28,7 +28,6 @@ import core, {
|
||||
FindOptions,
|
||||
FindResult,
|
||||
LoadModelResponse,
|
||||
MeasureDoneOperation,
|
||||
Ref,
|
||||
SearchOptions,
|
||||
SearchQuery,
|
||||
@@ -524,26 +523,6 @@ class Connection implements ClientConnection {
|
||||
return await promise.promise
|
||||
}
|
||||
|
||||
async measure (operationName: string): Promise<MeasureDoneOperation> {
|
||||
const dateNow = Date.now()
|
||||
|
||||
// Send measure-start
|
||||
const mid = await this.sendRequest({
|
||||
method: 'measure',
|
||||
params: [operationName]
|
||||
})
|
||||
return async () => {
|
||||
const serverTime: number = await this.sendRequest({
|
||||
method: 'measure-done',
|
||||
params: [operationName, mid]
|
||||
})
|
||||
return {
|
||||
time: Date.now() - dateNow,
|
||||
serverTime
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async loadModel (last: Timestamp, hash?: string): Promise<Tx[] | LoadModelResponse> {
|
||||
return await this.sendRequest({ method: 'loadModel', params: [last, hash] })
|
||||
}
|
||||
|
||||
@@ -28,14 +28,7 @@ import core, {
|
||||
createClient,
|
||||
type ClientConnection
|
||||
} from '@hcengineering/core'
|
||||
import platform, {
|
||||
Severity,
|
||||
Status,
|
||||
getMetadata,
|
||||
getPlugins,
|
||||
getResource,
|
||||
setPlatformStatus
|
||||
} from '@hcengineering/platform'
|
||||
import platform, { Severity, Status, getMetadata, getPlugins, setPlatformStatus } from '@hcengineering/platform'
|
||||
import { connect } from './connection'
|
||||
|
||||
export { connect }
|
||||
@@ -88,7 +81,7 @@ export default async () => {
|
||||
): Promise<AccountClient> => {
|
||||
const filterModel = getMetadata(clientPlugin.metadata.FilterModel) ?? false
|
||||
|
||||
let client = createClient(
|
||||
const client = createClient(
|
||||
(handler: TxHandler) => {
|
||||
const url = concatLink(endpoint, `/${token}`)
|
||||
|
||||
@@ -144,8 +137,6 @@ export default async () => {
|
||||
createModelPersistence(getWSFromToken(token)),
|
||||
ctx
|
||||
)
|
||||
// Check if we had dev hook for client.
|
||||
client = hookClient(client)
|
||||
return await client
|
||||
}
|
||||
}
|
||||
@@ -203,24 +194,6 @@ function createModelPersistence (workspace: string): TxPersistenceStore | undefi
|
||||
}
|
||||
}
|
||||
|
||||
async function hookClient (client: Promise<AccountClient>): Promise<AccountClient> {
|
||||
const hook = getMetadata(clientPlugin.metadata.ClientHook)
|
||||
if (hook !== undefined) {
|
||||
const hookProc = await getResource(hook)
|
||||
const _client = client
|
||||
client = new Promise((resolve, reject) => {
|
||||
_client
|
||||
.then((res) => {
|
||||
resolve(hookProc(res))
|
||||
})
|
||||
.catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
return await client
|
||||
}
|
||||
|
||||
function getWSFromToken (token: string): string {
|
||||
const parts = token.split('.')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user