mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-01 04:35:46 +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">
|
<script lang="ts">
|
||||||
import { getMetadata } from '@hcengineering/platform'
|
import { getMetadata } from '@hcengineering/platform'
|
||||||
import uiPlugin, { closePopup, closeTooltip, navigate, parseLocation } from '@hcengineering/ui'
|
import uiPlugin, { closePopup, closeTooltip, navigate, parseLocation } from '@hcengineering/ui'
|
||||||
|
import presentation from '../plugin'
|
||||||
|
|
||||||
export let href: string | undefined
|
export let href: string | undefined
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
@ -44,7 +45,8 @@
|
|||||||
closeTooltip()
|
closeTooltip()
|
||||||
try {
|
try {
|
||||||
const url = new URL(href)
|
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 loc = parseLocation(url)
|
||||||
const routes = getMetadata(uiPlugin.metadata.Routes)
|
const routes = getMetadata(uiPlugin.metadata.Routes)
|
||||||
const app = routes?.get(loc.path[0])
|
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 roomInfos = await control.queryFind(control.ctx, love.class.RoomInfo, {})
|
||||||
const oldRoomInfo = roomInfos.find((ri) => ri.persons.includes(info.person))
|
const oldRoomInfo = roomInfos.find((ri) => ri.persons.includes(info.person))
|
||||||
if (oldRoomInfo !== undefined) {
|
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))
|
res.push(control.txFactory.createTxRemoveDoc(oldRoomInfo._class, oldRoomInfo.space, oldRoomInfo._id))
|
||||||
|
|
||||||
const resetAccessTx = control.txFactory.createTxUpdateDoc(
|
const resetAccessTx = control.txFactory.createTxUpdateDoc(
|
||||||
|
@ -578,6 +578,8 @@ export interface Session {
|
|||||||
loadDocs: (ctx: ClientSessionCtx, domain: Domain, docs: Ref<Doc>[]) => Promise<void>
|
loadDocs: (ctx: ClientSessionCtx, domain: Domain, docs: Ref<Doc>[]) => Promise<void>
|
||||||
upload: (ctx: ClientSessionCtx, domain: Domain, docs: Doc[]) => Promise<void>
|
upload: (ctx: ClientSessionCtx, domain: Domain, docs: Doc[]) => Promise<void>
|
||||||
clean: (ctx: ClientSessionCtx, domain: Domain, docs: Ref<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>,
|
request: Request<any>,
|
||||||
workspace: WorkspaceUuid
|
workspace: WorkspaceUuid
|
||||||
) => Promise<void>
|
) => Promise<void>
|
||||||
|
|
||||||
|
createOpContext: (
|
||||||
|
ctx: MeasureContext,
|
||||||
|
pipeline: Pipeline,
|
||||||
|
request: Request<any>,
|
||||||
|
service: Session,
|
||||||
|
ws: ConnectionSocket,
|
||||||
|
workspace: WorkspaceUuid
|
||||||
|
) => ClientSessionCtx
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,6 +24,7 @@ import serverCore, {
|
|||||||
Session,
|
Session,
|
||||||
Workspace,
|
Workspace,
|
||||||
type ConnectionSocket,
|
type ConnectionSocket,
|
||||||
|
type Pipeline,
|
||||||
type PipelineFactory,
|
type PipelineFactory,
|
||||||
type SessionManager
|
type SessionManager
|
||||||
} from '@hcengineering/server-core'
|
} from '@hcengineering/server-core'
|
||||||
@ -471,6 +472,22 @@ export class Transactor extends DurableObject<Env> {
|
|||||||
return session.session
|
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 (
|
async findAll (
|
||||||
rawToken: string,
|
rawToken: string,
|
||||||
workspaceId: string,
|
workspaceId: string,
|
||||||
@ -481,12 +498,10 @@ export class Transactor extends DurableObject<Env> {
|
|||||||
let result
|
let result
|
||||||
const cs = this.createDummyClientSocket()
|
const cs = this.createDummyClientSocket()
|
||||||
try {
|
try {
|
||||||
const session = await this.makeRpcSession(rawToken, cs)
|
const pipeline = await this.getRpcPipeline(rawToken, cs)
|
||||||
const pipeline =
|
|
||||||
session.workspace.pipeline instanceof Promise ? await session.workspace.pipeline : session.workspace.pipeline
|
|
||||||
;(session as any).includeSessionContext(this.measureCtx, pipeline)
|
|
||||||
result = await pipeline.findAll(this.measureCtx, _class, query ?? {}, options ?? {})
|
result = await pipeline.findAll(this.measureCtx, _class, query ?? {}, options ?? {})
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
console.error(error)
|
||||||
result = { error: `${error}` }
|
result = { error: `${error}` }
|
||||||
} finally {
|
} finally {
|
||||||
await this.sessionManager.close(this.measureCtx, cs, this.workspace)
|
await this.sessionManager.close(this.measureCtx, cs, this.workspace)
|
||||||
@ -498,12 +513,10 @@ export class Transactor extends DurableObject<Env> {
|
|||||||
let result
|
let result
|
||||||
const cs = this.createDummyClientSocket()
|
const cs = this.createDummyClientSocket()
|
||||||
try {
|
try {
|
||||||
const session = await this.makeRpcSession(rawToken, cs)
|
const pipeline = await this.getRpcPipeline(rawToken, cs)
|
||||||
const pipeline =
|
|
||||||
session.workspace.pipeline instanceof Promise ? await session.workspace.pipeline : session.workspace.pipeline
|
|
||||||
;(session as any).includeSessionContext(this.measureCtx, pipeline)
|
|
||||||
result = await pipeline.tx(this.measureCtx, [tx])
|
result = await pipeline.tx(this.measureCtx, [tx])
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
console.error(error)
|
||||||
result = { error: `${error}` }
|
result = { error: `${error}` }
|
||||||
} finally {
|
} finally {
|
||||||
await this.sessionManager.close(this.measureCtx, cs, this.workspace)
|
await this.sessionManager.close(this.measureCtx, cs, this.workspace)
|
||||||
@ -515,10 +528,7 @@ export class Transactor extends DurableObject<Env> {
|
|||||||
let result: Tx[] = []
|
let result: Tx[] = []
|
||||||
const cs = this.createDummyClientSocket()
|
const cs = this.createDummyClientSocket()
|
||||||
try {
|
try {
|
||||||
const session = await this.makeRpcSession(rawToken, cs)
|
const pipeline = await this.getRpcPipeline(rawToken, cs)
|
||||||
const pipeline =
|
|
||||||
session.workspace.pipeline instanceof Promise ? await session.workspace.pipeline : session.workspace.pipeline
|
|
||||||
;(session as any).includeSessionContext(this.measureCtx, pipeline)
|
|
||||||
const ret = await pipeline.loadModel(this.measureCtx, 0)
|
const ret = await pipeline.loadModel(this.measureCtx, 0)
|
||||||
if (Array.isArray(ret)) {
|
if (Array.isArray(ret)) {
|
||||||
result = ret
|
result = ret
|
||||||
@ -526,6 +536,7 @@ export class Transactor extends DurableObject<Env> {
|
|||||||
result = ret.transactions
|
result = ret.transactions
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
console.error(error)
|
||||||
return { error: `${error}` }
|
return { error: `${error}` }
|
||||||
} finally {
|
} finally {
|
||||||
await this.sessionManager.close(this.measureCtx, cs, this.workspace)
|
await this.sessionManager.close(this.measureCtx, cs, this.workspace)
|
||||||
@ -542,8 +553,6 @@ export class Transactor extends DurableObject<Env> {
|
|||||||
const cs = this.createDummyClientSocket()
|
const cs = this.createDummyClientSocket()
|
||||||
try {
|
try {
|
||||||
const session = await this.makeRpcSession(rawToken, cs)
|
const session = await this.makeRpcSession(rawToken, cs)
|
||||||
// const pipeline =
|
|
||||||
// session.workspace.pipeline instanceof Promise ? await session.workspace.pipeline : session.workspace.pipeline
|
|
||||||
return session.getRawAccount()
|
return session.getRawAccount()
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
return { error: `${error}` }
|
return { error: `${error}` }
|
||||||
|
Loading…
Reference in New Issue
Block a user