Line

You are reading the unreleased docs (next). See latest (v0.9)

ui/server/src/projectGuard

"Is there a project, and is its root inside the workspace?".

Cockpit server, next. Source: ui/server/src/projectGuard.mjs.

Variables#

NO_PROJECT_BODY#

const NO_PROJECT_BODY: Readonly<{ code: "NO_PROJECT"; error: "No project is open. Open a project from the workspace first."; ok: false; }>

Defined in: ui/server/src/projectGuard.mjs:9


OUTSIDE_ROOT_BODY#

const OUTSIDE_ROOT_BODY: Readonly<{ code: "PROJECT_ROOT_OUTSIDE_WORKSPACE"; error: "The nearest architecture.yml above this folder is outside the workspace, so it is not used. Initialize a project inside the workspace instead."; ok: false; }>

Defined in: ui/server/src/projectGuard.mjs:15

Functions#

containedProjectRoot()#

containedProjectRoot(projectDir): string

Defined in: ui/server/src/projectGuard.mjs:23

The Construct project root for projectDir (nearest architecture.yml, searching upward), or null when there is none INSIDE the workspace. The upward search is the CLI's own; this only refuses a root it climbed out to.

Parameters#

projectDir

any

Returns#

string


requireProject()#

requireProject(__namedParameters?): (req, res, next) => any

Defined in: ui/server/src/projectGuard.mjs:41

Express middleware: 409 NO_PROJECT when nothing is open. allowEscapingRoot (used by init) skips the outside-root check, since init creates a new project at the open folder.

Parameters#

__namedParameters?
allowEscapingRoot?

boolean = false

Returns#

(req, res, next) => any


rootEscapesWorkspace()#

rootEscapesWorkspace(projectDir): boolean

Defined in: ui/server/src/projectGuard.mjs:35

True when an architecture.yml exists above projectDir but only outside the workspace.

Parameters#

projectDir

any

Returns#

boolean