mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-30 20:25:38 +00:00
Merge branch 'develop' into staging-new
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
commit
cd1161c585
@ -15,6 +15,7 @@
|
||||
<script lang="ts">
|
||||
import { getMetadata } from '@hcengineering/platform'
|
||||
import uiPlugin, { closePopup, closeTooltip, navigate, parseLocation } from '@hcengineering/ui'
|
||||
import presentation from '../plugin'
|
||||
|
||||
export let href: string | undefined
|
||||
export let disabled = false
|
||||
@ -44,7 +45,8 @@
|
||||
closeTooltip()
|
||||
try {
|
||||
const url = new URL(href)
|
||||
if (url.origin === window.location.origin) {
|
||||
const frontUrl = getMetadata(presentation.metadata.FrontUrl) ?? window.location.origin
|
||||
if (url.origin === frontUrl) {
|
||||
const loc = parseLocation(url)
|
||||
const routes = getMetadata(uiPlugin.metadata.Routes)
|
||||
const app = routes?.get(loc.path[0])
|
||||
|
@ -219,7 +219,7 @@ async function setDefaultRoomAccess (info: ParticipantInfo, control: TriggerCont
|
||||
const roomInfos = await control.queryFind(control.ctx, love.class.RoomInfo, {})
|
||||
const oldRoomInfo = roomInfos.find((ri) => ri.persons.includes(info.person))
|
||||
if (oldRoomInfo !== undefined) {
|
||||
if (oldRoomInfo.persons.length === 0) {
|
||||
if (oldRoomInfo.persons.length === 1 && oldRoomInfo.persons[0] === info.person) {
|
||||
res.push(control.txFactory.createTxRemoveDoc(oldRoomInfo._class, oldRoomInfo.space, oldRoomInfo._id))
|
||||
|
||||
const resetAccessTx = control.txFactory.createTxUpdateDoc(
|
||||
|
@ -578,6 +578,8 @@ export interface Session {
|
||||
loadDocs: (ctx: ClientSessionCtx, domain: Domain, docs: Ref<Doc>[]) => Promise<void>
|
||||
upload: (ctx: ClientSessionCtx, domain: Domain, docs: Doc[]) => Promise<void>
|
||||
clean: (ctx: ClientSessionCtx, domain: Domain, docs: Ref<Doc>[]) => Promise<void>
|
||||
|
||||
includeSessionContext: (ctx: ClientSessionCtx) => void
|
||||
}
|
||||
|
||||
/**
|
||||
@ -700,6 +702,15 @@ export interface SessionManager {
|
||||
request: Request<any>,
|
||||
workspace: WorkspaceUuid
|
||||
) => Promise<void>
|
||||
|
||||
createOpContext: (
|
||||
ctx: MeasureContext,
|
||||
pipeline: Pipeline,
|
||||
request: Request<any>,
|
||||
service: Session,
|
||||
ws: ConnectionSocket,
|
||||
workspace: WorkspaceUuid
|
||||
) => ClientSessionCtx
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,6 +24,7 @@ import serverCore, {
|
||||
Session,
|
||||
Workspace,
|
||||
type ConnectionSocket,
|
||||
type Pipeline,
|
||||
type PipelineFactory,
|
||||
type SessionManager
|
||||
} from '@hcengineering/server-core'
|
||||
@ -471,6 +472,22 @@ export class Transactor extends DurableObject<Env> {
|
||||
return session.session
|
||||
}
|
||||
|
||||
private async getRpcPipeline (rawToken: string, cs: ConnectionSocket): Promise<Pipeline> {
|
||||
const session = await this.makeRpcSession(rawToken, cs)
|
||||
const pipeline =
|
||||
session.workspace.pipeline instanceof Promise ? await session.workspace.pipeline : session.workspace.pipeline
|
||||
const opContext = this.sessionManager.createOpContext(
|
||||
this.measureCtx,
|
||||
pipeline,
|
||||
{ method: '', params: '' },
|
||||
session,
|
||||
cs,
|
||||
this.workspace
|
||||
)
|
||||
session.includeSessionContext(opContext)
|
||||
return pipeline
|
||||
}
|
||||
|
||||
async findAll (
|
||||
rawToken: string,
|
||||
workspaceId: string,
|
||||
@ -481,12 +498,10 @@ export class Transactor extends DurableObject<Env> {
|
||||
let result
|
||||
const cs = this.createDummyClientSocket()
|
||||
try {
|
||||
const session = await this.makeRpcSession(rawToken, cs)
|
||||
const pipeline =
|
||||
session.workspace.pipeline instanceof Promise ? await session.workspace.pipeline : session.workspace.pipeline
|
||||
;(session as any).includeSessionContext(this.measureCtx, pipeline)
|
||||
const pipeline = await this.getRpcPipeline(rawToken, cs)
|
||||
result = await pipeline.findAll(this.measureCtx, _class, query ?? {}, options ?? {})
|
||||
} catch (error: any) {
|
||||
console.error(error)
|
||||
result = { error: `${error}` }
|
||||
} finally {
|
||||
await this.sessionManager.close(this.measureCtx, cs, this.workspace)
|
||||
@ -498,12 +513,10 @@ export class Transactor extends DurableObject<Env> {
|
||||
let result
|
||||
const cs = this.createDummyClientSocket()
|
||||
try {
|
||||
const session = await this.makeRpcSession(rawToken, cs)
|
||||
const pipeline =
|
||||
session.workspace.pipeline instanceof Promise ? await session.workspace.pipeline : session.workspace.pipeline
|
||||
;(session as any).includeSessionContext(this.measureCtx, pipeline)
|
||||
const pipeline = await this.getRpcPipeline(rawToken, cs)
|
||||
result = await pipeline.tx(this.measureCtx, [tx])
|
||||
} catch (error: any) {
|
||||
console.error(error)
|
||||
result = { error: `${error}` }
|
||||
} finally {
|
||||
await this.sessionManager.close(this.measureCtx, cs, this.workspace)
|
||||
@ -515,10 +528,7 @@ export class Transactor extends DurableObject<Env> {
|
||||
let result: Tx[] = []
|
||||
const cs = this.createDummyClientSocket()
|
||||
try {
|
||||
const session = await this.makeRpcSession(rawToken, cs)
|
||||
const pipeline =
|
||||
session.workspace.pipeline instanceof Promise ? await session.workspace.pipeline : session.workspace.pipeline
|
||||
;(session as any).includeSessionContext(this.measureCtx, pipeline)
|
||||
const pipeline = await this.getRpcPipeline(rawToken, cs)
|
||||
const ret = await pipeline.loadModel(this.measureCtx, 0)
|
||||
if (Array.isArray(ret)) {
|
||||
result = ret
|
||||
@ -526,6 +536,7 @@ export class Transactor extends DurableObject<Env> {
|
||||
result = ret.transactions
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error(error)
|
||||
return { error: `${error}` }
|
||||
} finally {
|
||||
await this.sessionManager.close(this.measureCtx, cs, this.workspace)
|
||||
@ -542,8 +553,6 @@ export class Transactor extends DurableObject<Env> {
|
||||
const cs = this.createDummyClientSocket()
|
||||
try {
|
||||
const session = await this.makeRpcSession(rawToken, cs)
|
||||
// const pipeline =
|
||||
// session.workspace.pipeline instanceof Promise ? await session.workspace.pipeline : session.workspace.pipeline
|
||||
return session.getRawAccount()
|
||||
} catch (error: any) {
|
||||
return { error: `${error}` }
|
||||
|
Loading…
Reference in New Issue
Block a user