Line

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

ui/server/src/storyBridgeApi

(part of ): the server side of the Picker's "propose selectors as a diff to story.md" (design docs/design/ia-five-screens.md section 9.7).

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

Classes#

StoryBridgeError#

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

Extends#

  • Error

Constructors#

Constructor

new StoryBridgeError(status, message): StoryBridgeError

Defined in: ui/server/src/storyBridgeApi.mjs:24

Parameters
status

any

message

any

Returns

StoryBridgeError

Overrides

Error.constructor

Properties#

status

status: any

Defined in: ui/server/src/storyBridgeApi.mjs:26

Variables#

MAX_PAYLOAD_BYTES#

const MAX_PAYLOAD_BYTES: number

Defined in: ui/server/src/storyBridgeApi.mjs:20

Functions#

createStoryBridgeRouter()#

createStoryBridgeRouter(deps): any

Defined in: ui/server/src/storyBridgeApi.mjs:135

Parameters#

deps
afterSave?

(root, rel, isNew?) => unknown

clientOrigin?

string

getRoot

() => { ok: true; root: string; } | { error: string; ok: false; }

Returns#

any


validateSelector()#

validateSelector(value): { error: string; ok: boolean; } | { error?: undefined; ok: boolean; }

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

Same rule as the userscript's validateSelector (design 9.6b): length cap, CSS or {css}/{xpath}, no javascript:/script forms, no XPath function that reaches outside the tree. Kept independent (not a shared import from ui/client/public/construct-clipper.user.js) because the two run in different runtimes and this is a small, deterministic, easily-duplicated check -- exactly the kind that is cheap to keep in sync by eye and expensive to couple across a client/server boundary.

Parameters#

value

any

Returns#

{ error: string; ok: boolean; } | { error?: undefined; ok: boolean; }