Line

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

ui/client/features/story/services/StoryApi

the one client call story.md sources go through: StoryApi.fetch(url), backed by POST /api/story/fetch (ui/server/src/storyFetchApi.mjs).

Cockpit client (features), next. Source: ui/client/features/story/services/StoryApi.ts.

Interfaces#

StoryConsentApproval#

Defined in: ui/client/features/story/services/StoryApi.ts:29

Properties#

createdAt

createdAt: string

Defined in: ui/client/features/story/services/StoryApi.ts:36

decision

decision: "deny" | "allow"

Defined in: ui/client/features/story/services/StoryApi.ts:34

host

host: string

Defined in: ui/client/features/story/services/StoryApi.ts:31

id

id: string

Defined in: ui/client/features/story/services/StoryApi.ts:30

scope

scope: "url" | "host"

Defined in: ui/client/features/story/services/StoryApi.ts:33

sourceOrigin

sourceOrigin: "local" | "foreign"

Defined in: ui/client/features/story/services/StoryApi.ts:35

url

url: string | null

Defined in: ui/client/features/story/services/StoryApi.ts:32


StoryFetchRequest#

Defined in: ui/client/features/story/services/StoryApi.ts:11

Properties#

consent?

optional consent?: "always" | "once" | "deny"

Defined in: ui/client/features/story/services/StoryApi.ts:16

The consent choice for this call, when the Cockpit already asked (ia-story-consent). Omit on the first try.

parse?

optional parse?: Record<string, StorySelector>

Defined in: ui/client/features/story/services/StoryApi.ts:14

field name -> selector, e.g. { title: 'h1', acceptance: 'ul.acceptance > li' }.

source?

optional source?: "local" | "foreign"

Defined in: ui/client/features/story/services/StoryApi.ts:19

Whether the story.md this url came from was authored in this repository ('local') or arrived from a clone ('foreign') -- drives the extra warning on first use (design 9.6). Defaults to 'local' on the server.

url

url: string

Defined in: ui/client/features/story/services/StoryApi.ts:12

Type Aliases#

StoryFetchResult#

StoryFetchResult = { ok: true; redirects: number; selectors: Record<string, { kind: "css" | "xpath"; value: string; }>; status: number; text: string; url: string; via: "server"; } | { code: "NEEDS_BRIDGE"; error: string; host: string; ok: false; via: "bridge"; } | { code: "CONSENT_REQUIRED"; error: string; host: string; ok: false; url: string; warning: boolean; } | { code: "CONSENT_DENIED"; error: string; host: string; ok: false; url: string; } | { code: string; error: string; ok: false; }

Defined in: ui/client/features/story/services/StoryApi.ts:22


StorySelector#

StorySelector = string | { css: string; } | { xpath: string; }

Defined in: ui/client/features/story/services/StoryApi.ts:9

A parse entry: a plain string is CSS; {css} / {xpath} are explicit (design 9.6b).

Variables#

StoryApi#

const StoryApi: object

Defined in: ui/client/features/story/services/StoryApi.ts:41

Type Declaration#

fetch()

fetch(request): Promise<StoryFetchResult>

One guarded fetch, strategy chosen per link (design 9.3). Never throws.

Parameters
request

StoryFetchRequest

Returns

Promise<StoryFetchResult>

listConsent()

listConsent(): Promise<{ approvals: StoryConsentApproval[]; ok: true; } | { error: string; ok: false; }>

The standing (host, url) approvals and denials, for the revoke list (design 9.6).

Returns

Promise<{ approvals: StoryConsentApproval[]; ok: true; } | { error: string; ok: false; }>

revokeConsent()

revokeConsent(id): Promise<{ ok: true; } | { error: string; ok: false; }>

Revoke one standing approval or denial.

Parameters
id

string

Returns

Promise<{ ok: true; } | { error: string; ok: false; }>