mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 03:51:43 +03:00
736134e491
Fixes #11604 Most issues were caused by a problem with Project List flooding the network with its requests - this was fixed on develop. But one assertion was flaky - it assumed we will see the "real" run result on `write` node, but sometimes it is immediately overwritten by dry run. But the most important part of this PR is adding traces to Electron packages - it's should be much easier now to debug E2E test failures. Also renamed the previously misnamed "E2E tests" to "[GUI] integration tests".
64 lines
1.9 KiB
TypeScript
64 lines
1.9 KiB
TypeScript
declare const projectIdBrand: unique symbol
|
|
/** An ID of a project. */
|
|
export type ProjectId = string & { [projectIdBrand]: never }
|
|
declare const projectNameBrand: unique symbol
|
|
/** A name of a project. */
|
|
export type ProjectName = string & { [projectNameBrand]: never }
|
|
declare const utcDateTimeBrand: unique symbol
|
|
/** A UTC date and time. */
|
|
export type UTCDateTime = string & { [utcDateTimeBrand]: never }
|
|
|
|
/** A value specifying the hostname and port of a socket. */
|
|
export interface IpWithSocket {
|
|
host: string
|
|
port: number
|
|
}
|
|
|
|
export interface OpenProject {
|
|
engineVersion: string
|
|
languageServerJsonAddress: IpWithSocket
|
|
languageServerBinaryAddress: IpWithSocket
|
|
projectName: ProjectName
|
|
projectNormalizedName: string
|
|
projectNamespace: string
|
|
}
|
|
|
|
/** Details for a project. */
|
|
export interface ProjectMetadata {
|
|
name: ProjectName
|
|
namespace: string
|
|
id: ProjectId
|
|
engineVersion: string | null
|
|
created: UTCDateTime
|
|
lastOpened: UTCDateTime | null
|
|
}
|
|
|
|
export const projects = new Map<string, ProjectMetadata>()
|
|
const openProjects = new Set<string>()
|
|
|
|
export const methods = {
|
|
async 'project/open'(id) {
|
|
openProjects.add(id)
|
|
const project = projects.get(id)
|
|
if (!project) throw new Error(`Cannot find project with ID ${id}.`)
|
|
return {
|
|
projectName: project.name,
|
|
projectNormalizedName: project.name,
|
|
projectNamespace: project.namespace,
|
|
languageServerJsonAddress: { host: '127.0.0.1', port: 30000 },
|
|
languageServerBinaryAddress: { host: '127.0.0.1', port: 30001 },
|
|
engineVersion: '',
|
|
} satisfies OpenProject
|
|
},
|
|
async 'project/close'(id) {
|
|
openProjects.delete(id)
|
|
return {}
|
|
},
|
|
async 'project/list'(numberOfProjects) {
|
|
const projectsList = Array.from(projects.values())
|
|
return {
|
|
projects: numberOfProjects != null ? projectsList.slice(0, numberOfProjects) : projectsList,
|
|
}
|
|
},
|
|
} satisfies Record<string, (...params: any[]) => Promise<unknown>>
|