Skip to content

bolt/page

bolt/page

Import from @norbital-ai/bolt/page

Page types and standalone helpers. The shell hands each component its own context.

page

IntegrationSetup component

component IntegrationSetup(props: $$ComponentProps)

One integration instance's setup and health over its client: the provider choice, pairing (a form, a QR or code, an OAuth sign-in), the connected summary, a test, reconnecting and disconnecting. Unboxed: the page that embeds it owns the surface.

Props

NameTypeDescription
clientPick<IntegrationClient, 'instance' | 'status' | 'pair' | 'import_start' | 'unpair' | 'test' | 'watch'>

The instance's client (bolt.integrations for one connection): its status feed and pairing calls.

  • instance: string
  • status: () => Effect.Effect<{ readonly instance: string; readonly state: "error" | "pairing" | "unpaired" | "connecting" | "connected" | "reconnecting"; readonly integration: string; readonly driver: string; readonly stored: boolean; readonly code?: string; readonly conversation?: boolean; readonly error?: string; readonly providers?: readonly { readonly id: string; readonly label: string | { readonly en…
  • import_start: (input: ImportStartInput) => Effect.Effect<{ readonly instance: string; readonly state: "error" | "pairing" | "unpaired" | "connecting" | "connected" | "reconnecting"; readonly integration: string; readonly driver: string; readonly stored: boolean; readonly code?: string; readonly conversation?: boolean; readonly error?: string; readonly providers?: readonly { readonly id: string; readonly label:…
  • test: (input?: Json) => Effect.Effect<{ readonly instance: string; readonly state: "error" | "pairing" | "unpaired" | "connecting" | "connected" | "reconnecting"; readonly integration: string; readonly driver: string; readonly stored: boolean; readonly code?: string; readonly conversation?: boolean; readonly error?: string; readonly providers?: readonly { readonly id: string; readonly label: string | {…
  • pair: (input?: Json) => Effect.Effect<{ readonly instance: string; readonly state: "error" | "pairing" | "unpaired" | "connecting" | "connected" | "reconnecting"; readonly integration: string; readonly driver: string; readonly stored: boolean; readonly code?: string; readonly conversation?: boolean; readonly error?: string; readonly providers?: readonly { readonly id: string; readonly label: string | {…
  • unpair: () => Effect.Effect<{ readonly instance: string; readonly state: "error" | "pairing" | "unpaired" | "connecting" | "connected" | "reconnecting"; readonly integration: string; readonly driver: string; readonly stored: boolean; readonly code?: string; readonly conversation?: boolean; readonly error?: string; readonly providers?: readonly { readonly id: string; readonly label: string | { readonly en…
  • watch: () => Stream.Stream<InstanceStatus, ProtocolFailed>
setup?IntegrationSetupEntry | undefined

The definition's own +integration.svelte, drawn in place of the generic views.

  • load: IntegrationSetupLoader
controls?boolean | undefined

The containing connection row owns reconnecting and disconnecting.

on_state_change?((state: InstanceState | undefined, previous: InstanceState | undefined, status: InstanceStatus | null) => void) | undefined

Lifecycle events for a containing connection row, from the same status resource it renders.

children?Snippet<[IntegrationSetupProps]> | undefined

A containing connection row can render the shared status and setup controls in its own layout.

t?(key: string) => string

Translates the setup's English strings (keys are the English text). Default: identity.

locale?string

The locale dates and numbers are formatted in. Default 'en'.

Source: packages/bolt/src/page/IntegrationSetup.svelte:1

shell

IntegrationSetupEntry type

type IntegrationSetupEntry = {
    load: IntegrationSetupLoader;
};

The compiled registry's entry for a definition's +integration.svelte.

Members

NameTypeDescription
loadIntegrationSetupLoader

Source: packages/bolt/src/shell/integration/setup.ts:68

page

PageBolt interface

interface PageBolt {
    /** Re-reads mounted queries, surfaces read failures, and waits for their subscribers to receive the answers. */
    refresh(): Effect.Effect<void, ReadFailed | TransportFailed>;
    /**
     * A read request, as server code's `ctx.query`: roots (models with `outputs`) and their declared layers in one read, the
     * answer typed from the named layers; live by every row it read, layers included.
     * Read `.current`, `.loading` and `.error` reactively to render all states. Awaiting in an event handler reads once.
     * @param request Declared roots and layers with caller-scoped filters and pagination; it never bypasses policies.
     * @returns A Query whose current value is initially undefined; each root contains its own page or aggregate.
     * @see Query
     * @example
     * const orders = ctx.query({
     * 	orders: { where: { status: { eq: 'issued' } }, fields: ['number', 'total'], order_by: 'due_on', limit: 100,
     * 		party: { fields: ['name'] }, lines: { fields: ['quantity', 'net'] } }
     * });
     */
    query<const R extends ReadRequestBase>(request: ReadRequest<R>): Query<ReadAnswer<R>>;
    /** A record's revisions, oldest first, up to an instant, a revision or just before an approval request. */
    history<C extends string>(model: Is<C, ReadableName>, id: NoInfer<Id<C>>, options?: HistoryOptions<C>): Query<readonly Revision[]>;
    /**
     * The page's clock. With a unit, reactive: `today` and `now` change at each minute, hour or day boundary in the
     * workspace zone, ticking only while the page is visible. Without one, a fixed snapshot taken when the page opened.
     */
    clock(unit?: 'minute' | 'hour' | 'day'): PageClock;
    /** The record's field and operation permissions for its current revision; `null` when it is absent or not readable. */
    record_capabilities<C extends string>(model: Is<C, ReadableName>, id: NoInfer<Id<C>>, parent?: RecordParentContext): PageCall<RecordCapabilities | null, TransportFailed | ProtocolFailed>;
    /** Whether deleting these records would commit (`allow`), be held for approval (`approve`) or be refused (`refuse`), in one read. */
    delete_verdict<C extends string>(model: Is<C, ReadableName>, ids: readonly NoInfer<Id<C>>[]): PageCall<'allow' | 'approve' | 'refuse', TransportFailed | ProtocolFailed>;
    /** Plans every named generated write together and commits them as one statement. */
    act<const A extends ActMap>(acts: ActMapInput<A>, options?: ActOptions): PageAct<ActMapOutput<A>>;
    act<const A extends Readonly<Record<string, Json>>>(acts: string extends keyof A ? A : never, options?: ActOptions): PageAct<Readonly<Record<string, Json>>>;
    /**
     * Starts an automation as the viewer (their policy's `capabilities.automations`). A `call` is the page RPC, the one
     * request/response path to server code: it runs in this request and answers its declared output. A job queues one
     * run per input, with `id`/`ids` available before admission settles so native controls can follow them; yielding it
     * confirms queue admission, not completed execution. A job batch needs at least one input. Every failure is typed:
     * recover a refusal with `Effect.catchTag('ActRefused', …)`.
     */
    run<const A extends string>(automation: Is<A, AutomationName>, input: NoInfer<AutomationSpecOf<A> extends {
        mode: 'call';
    } ? StartInput<A> : StartInput<A> | readonly StartInput<A>[]>): AutomationSpecOf<A> extends {
        mode: 'call';
    } ? PageCall<StartOutput<A>, ActRefused | ActConflict | ActUnknown | ProtocolFailed> & {
        readonly mode: 'call';
        readonly automation: A;
    } : PageRun<A>;
    /**
     * Native sync controls, separate from automation calls and schedules; execution stays visible in the run ledger as
     * `<model>.sync.<name>`, and the handle's run id follows progress and the exported file. Grants as `SyncControlInput`.
     * @example
     * ctx.sync_control('work_logs', 'work_sh…

The typed members of a page context; a page reads and acts as its viewer, so rows are caller rows.

Members

NameTypeDescription
refresh() => Effect.Effect<void, ReadFailed | TransportFailed>

Re-reads mounted queries, surfaces read failures, and waits for their subscribers to receive the answers.

query<const R extends ReadRequestBase>(request: ReadRequest<R>) => Query<ReadAnswer<R>>

A read request, as server code's ctx.query: roots (models with outputs) and their declared layers in one read, the answer typed from the named layers; live by every row it read, layers included. Read .current, .loading and .error reactively to render all states. Awaiting in an event handler reads once.

@returns A Query whose current value is initially undefined; each root contains its own page or aggregate.

@see Query *

const orders = ctx.query({
	orders: { where: { status: { eq: 'issued' } }, fields: ['number', 'total'], order_by: 'due_on', limit: 100,
		party: { fields: ['name'] }, lines: { fields: ['quantity', 'net'] } }
});
history<C extends string>(model: Is<C, ReadableName>, id: NoInfer<Id<C>>, options?: HistoryOptions<C>) => Query<readonly Revision[]>

A record's revisions, oldest first, up to an instant, a revision or just before an approval request.

clock(unit?: "minute" | "hour" | "day") => PageClock

The page's clock. With a unit, reactive: today and now change at each minute, hour or day boundary in the workspace zone, ticking only while the page is visible. Without one, a fixed snapshot taken when the page opened.

record_capabilities<C extends string>(model: Is<C, ReadableName>, id: NoInfer<Id<C>>, parent?: RecordParentContext) => PageCall<RecordCapabilities | null, TransportFailed | ProtocolFailed>

The record's field and operation permissions for its current revision; null when it is absent or not readable.

delete_verdict<C extends string>(model: Is<C, ReadableName>, ids: readonly NoInfer<Id<C>>[]) => PageCall<"allow" | "approve" | "refuse", TransportFailed | ProtocolFailed>

Whether deleting these records would commit (allow), be held for approval (approve) or be refused (refuse), in one read.

act{ <const A extends ActMap>(acts: ActMapInput<A>, options?: ActOptions): PageAct<ActMapOutput<A>>; <const A extends Readonly<Record<string, Json>>>(acts: string extends keyof A ? A : never, options?: ActOptions): PageAct<Readonly<Record<string, Json>>>; }

Plans every named generated write together and commits them as one statement.

run<const A extends string>(automation: Is<A, AutomationName>, input: NoInfer<AutomationSpecOf<A> extends { mode: "call"; } ? StartInput<A> : StartInput<A> | readonly StartInput<A>[]>) => AutomationSpecOf<A> extends { mode: "call"; } ? PageCall<StartOutput<A>, ActRefused | ActConflict | ActUnknown | ProtocolFailed> & { readonly mode: "call"; readonly automation: A; } : PageRun<A>

Starts an automation as the viewer (their policy's capabilities.automations). A call is the page RPC, the one request/response path to server code: it runs in this request and answers its declared output. A job queues one run per input, with id/ids available before admission settles so native controls can follow them; yielding it confirms queue admission, not completed execution. A job batch needs at least one input. Every failure is typed: recover a refusal with Effect.catchTag('ActRefused', …).

sync_control<const M extends string, const S extends string>(model: Is<M, ModelName>, sync: Is<S, FileSyncName<M> | ReadSyncName<M>>, input: NoInfer<SyncControlInput<M, S>>) => PageRun<`${M}.sync.${S}`>

Native sync controls, separate from automation calls and schedules; execution stays visible in the run ledger as <model>.sync.<name>, and the handle's run id follows progress and the exported file. Grants as SyncControlInput.

ctx.sync_control('work_logs', 'work_sheet', { mode: 'import', file, context: { company } });
upload(file: Blob & { name?: string; }, field: UploadField | InputUploadField) => PageCall<FileRef, ActRefused | TransportFailed>

Stores a file for a model's file field, a file sync's import (<model>.$import.<sync>) or an automation's file input (<automation>.$input.<input>, then pass the answered FileRef in the start); accept and max are checked before bytes are stored; a refusal is ActRefused. Identical content, name and media type uploaded by the same actor to the same destination reuse one FileRef; changed content remains a distinct file.

preview_pdf(source: ConvertSource, options?: PreviewPdfOptions) => PageCall<Uint8Array, ActRefused | TransportFailed | Unavailable>

Renders a PDF for this page and returns its bytes without storing a file or a conversion job, for content the viewer already has; limited by the policy's convert rate (default 30/min). A stored document comes from an automation's ctx.convert.document.

file_url(ref: Pick<FileRef, "id">, options?: FileUrlOptions) => string

The URL a page shows or downloads a stored file from: the original, or with { preview: 64 | 512 | 1024 } an image preview of that maximum edge. Reading it still needs the file's record or conversation authority; a public page's URL keeps its app or kiosk scope.

approvals{ /** * Decides the request's current step as the viewer: `approve` (a superseder's approve supersedes, reason * required), `reject` (rolls the held change back), or `request_changes` (the requester edits and saves to * resubmit); `reason` is required for the last two. `withdraw` is the requester's own: it takes their open * request back, restoring the record as a rejection does. Offer what the v…

Approval requests: decide the current step, read one request's view, or list the requests the viewer may see.

t(key: MessageKey, vars?: { readonly [name: string]: string | number; }) => string

A message of +messages.ts in the page's locale, {name} placeholders filled from vars.

session{ send_code(address: string): PageCall<void, Refusal>; verify(address: string, code: string): PageCall<void, Refusal>; }

On-page sign-in: send_code texts or emails a six-digit code, verify proves it, signs the viewer in — a newcomer joins where the workspace declares signup — and reloads the page as them. A refusal is a Refusal. ui's <PhoneVerify {ctx} session={ctx.session} /> is the whole control.

actorActor | null

Who the page runs as; null before a visitor page has one.

policiesreadonly PolicyName[]

The policies the actor holds: what a page checks to show or hide what a policy grants.

Source: packages/bolt/src/page/page-bolt.ts:106

PageContext interface

interface PageContext extends PageBolt, UiContext, Pick<ShellBolt, 'locale' | 'tz' | 'catalog' | 'device' | 'href' | 'org' | 'agent' | 'integration' | 'runs'> {
}

A page's ctx: the typed page operations (PageBolt), the page's locale and zone, the viewer's catalog (the models and outputs it may read and write), the device it runs on, href to app pages, the workspace org, the agent panel, integration instance controls and the run ledger (runs). Its ui is what every @norbital-ai/ui view takes, so a page passes ctx whole (<Table {ctx} of="projects">). Nothing else of the shell client is the page's.

Members

NameTypeDescription
refresh() => Effect<void, ReadFailed | TransportFailed>

Re-reads mounted queries, surfaces read failures, and waits for their subscribers to receive the answers.

query<const R extends ReadRequestBase>(request: ReadRequest<R>) => Query<ReadAnswer<R>>

A read request, as server code's ctx.query: roots (models with outputs) and their declared layers in one read, the answer typed from the named layers; live by every row it read, layers included. Read .current, .loading and .error reactively to render all states. Awaiting in an event handler reads once.

@returns A Query whose current value is initially undefined; each root contains its own page or aggregate.

@see Query *

const orders = ctx.query({
	orders: { where: { status: { eq: 'issued' } }, fields: ['number', 'total'], order_by: 'due_on', limit: 100,
		party: { fields: ['name'] }, lines: { fields: ['quantity', 'net'] } }
});
history<C extends string>(model: Is<C, ReadableName>, id: NoInfer<Id<C>>, options?: HistoryOptions<C>) => Query<readonly Revision[]>

A record's revisions, oldest first, up to an instant, a revision or just before an approval request.

clock(unit?: "minute" | "hour" | "day") => PageClock

The page's clock. With a unit, reactive: today and now change at each minute, hour or day boundary in the workspace zone, ticking only while the page is visible. Without one, a fixed snapshot taken when the page opened.

record_capabilities<C extends string>(model: Is<C, ReadableName>, id: NoInfer<Id<C>>, parent?: RecordParentContext) => PageCall<RecordCapabilities | null, ProtocolFailed | TransportFailed>

The record's field and operation permissions for its current revision; null when it is absent or not readable.

delete_verdict<C extends string>(model: Is<C, ReadableName>, ids: readonly NoInfer<Id<C>>[]) => PageCall<"allow" | "refuse" | "approve", ProtocolFailed | TransportFailed>

Whether deleting these records would commit (allow), be held for approval (approve) or be refused (refuse), in one read.

act{ <const A extends ActMap>(acts: ActMapInput<A>, options?: ActOptions): PageAct<ActMapOutput<A>>; <const A extends Readonly<Record<string, Json>>>(acts: string extends keyof A ? A : never, options?: ActOptions): PageAct<Readonly<Record<string, Json>>>; }

Plans every named generated write together and commits them as one statement.

run<const A extends string>(automation: Is<A, AutomationName>, input: NoInfer<AutomationSpecOf<A> extends { mode: "call"; } ? StartInput<A> : StartInput<A> | readonly StartInput<A>[]>) => AutomationSpecOf<A> extends { mode: "call"; } ? PageCall<StartOutput<A>, ActRefused | ActConflict | ActUnknown | ProtocolFailed> & { readonly mode: "call"; readonly automation: A; } : PageRun<A>

Starts an automation as the viewer (their policy's capabilities.automations). A call is the page RPC, the one request/response path to server code: it runs in this request and answers its declared output. A job queues one run per input, with id/ids available before admission settles so native controls can follow them; yielding it confirms queue admission, not completed execution. A job batch needs at least one input. Every failure is typed: recover a refusal with Effect.catchTag('ActRefused', …).

sync_control<const M extends string, const S extends string>(model: Is<M, ModelName>, sync: Is<S, FileSyncName<M> | ReadSyncName<M>>, input: NoInfer<SyncControlInput<M, S>>) => PageRun<`${M}.sync.${S}`>

Native sync controls, separate from automation calls and schedules; execution stays visible in the run ledger as <model>.sync.<name>, and the handle's run id follows progress and the exported file. Grants as SyncControlInput.

ctx.sync_control('work_logs', 'work_sheet', { mode: 'import', file, context: { company } });
upload(file: Blob & { name?: string; }, field: never | never) => PageCall<FileRef, ActRefused | TransportFailed>

Stores a file for a model's file field, a file sync's import (<model>.$import.<sync>) or an automation's file input (<automation>.$input.<input>, then pass the answered FileRef in the start); accept and max are checked before bytes are stored; a refusal is ActRefused. Identical content, name and media type uploaded by the same actor to the same destination reuse one FileRef; changed content remains a distinct file.

preview_pdf(source: ConvertSource, options?: PreviewPdfOptions) => PageCall<Uint8Array<ArrayBufferLike>, ActRefused | Unavailable | TransportFailed>

Renders a PDF for this page and returns its bytes without storing a file or a conversion job, for content the viewer already has; limited by the policy's convert rate (default 30/min). A stored document comes from an automation's ctx.convert.document.

file_url(ref: Pick<FileRef, "id">, options?: FileUrlOptions) => string

The URL a page shows or downloads a stored file from: the original, or with { preview: 64 | 512 | 1024 } an image preview of that maximum edge. Reading it still needs the file's record or conversation authority; a public page's URL keeps its app or kiosk scope.

approvals{ /** * Decides the request's current step as the viewer: `approve` (a superseder's approve supersedes, reason * required), `reject` (rolls the held change back), or `request_changes` (the requester edits and saves to * resubmit); `reason` is required for the last two. `withdraw` is the requester's own: it takes their open * request back, restoring the record as a rejection does. Offer what the v…

Approval requests: decide the current step, read one request's view, or list the requests the viewer may see.

t(key: MessageKey, vars?: { readonly [name: string]: string | number; }) => string

A message of +messages.ts in the page's locale, {name} placeholders filled from vars.

session{ send_code(address: string): PageCall<void, Refusal>; verify(address: string, code: string): PageCall<void, Refusal>; }

On-page sign-in: send_code texts or emails a six-digit code, verify proves it, signs the viewer in — a newcomer joins where the workspace declares signup — and reloads the page as them. A refusal is a Refusal. ui's <PhoneVerify {ctx} session={ctx.session} /> is the whole control.

actorActor | null

Who the page runs as; null before a visitor page has one.

policiesreadonly PolicyName[]

The policies the actor holds: what a page checks to show or hide what a policy grants.

ui{ readonly bolt?: ViewBolt | undefined; readonly kinds: KindsHost; }
tzstring
agent{ open: (request?: AgentRequest) => void; models: () => readonly string[]; }

The agent panel: open it (optionally with a request), and the model classes the host offers.

integration(instance: string) => import("../page/integrations.ts").IntegrationClient

An integration instance's host verbs: its status, pairing, test and status stream (IntegrationSetup draws them).

localestring
catalog{ readonly [model: string]: import("@norbital-ai/ui").ModelExposure; }
deviceDeviceApi

The device this page runs on (DeviceApi): the shell's installed one, else the browser's. Pages only; declare an app's requires to hold its pages until the member grants a permission.

href(app: string, page?: string | undefined, record?: { model: string; id: string; } | undefined) => string

The path of an app page, optionally opening a record: bolt.href(app, page?, record?).

org{ name: string; logo: string | null; }

The page's organization: the workspace name and its brand logo (the host's first icon), or null.

runs((automation: string, options: { where?: Json; limit: number; }) => Stream.Stream<{ rows: import("../engine/runs/rows.ts").RunView[]; next: null; }, import("../decl/errors.ts").ReadFailed | TransportFailed | ShellError, never>) & { stop: (id: string) => Effect.Effect<import("../engine/runs/rows.ts").RunView, ShellError, never>; }

Source: packages/bolt/src/page/index.ts:19

PageSnapshotHost interface

interface PageSnapshotHost {
    /** Set before the page boots; absent or `stream` keeps normal browser streaming. */
    bolt_live_mode?: 'stream' | 'snapshot';
    /** Installed read-only while snapshot clients are mounted; removed when the last client's scope closes.
     * Resolves after their current queries consume refreshed answers and Svelte renders; read failures reject. */
    readonly bolt_refresh?: () => Promise<void>;
}

The optional document bridge a fleet host uses to inspect mounted snapshot clients without a live stream.

Set window.bolt_live_mode = 'snapshot' before the page boots; once a client mounts, check that bolt_refresh exists and await it before inspecting the page (its absence means no snapshot client is mounted). There is no polling interval. Page code can yield ctx.refresh() for the same re-read; a normal tab re-registers its views over its stream instead. Queries keep a failure until a later good answer, so a refresh can recover them.

Members

NameTypeDescription
bolt_live_mode?'stream' | 'snapshot'

Set before the page boots; absent or stream keeps normal browser streaming.

bolt_refresh?() => Promise<void>

Installed read-only while snapshot clients are mounted; removed when the last client's scope closes. Resolves after their current queries consume refreshed answers and Svelte renders; read failures reject.

Example

await window.bolt_refresh?.();

Source: packages/bolt/src/page/bolt.ts:97

PublicPageContext interface

interface PublicPageContext extends PageBolt, UiContext, Pick<PublicClient, 'locale' | 'tz' | 'device' | 'href' | 'org' | 'location'> {
}

A public page's ctx: PageContext's counterpart for apps whose audience is not members, over the public client.

The page renders on the server: Svelte renders synchronously, the engine resolves the reads that render used (as the caller, metered by the guest's CPU, heap, crossing and read-byte limits) and renders again with their answers, then the browser hydrates from those answers and the same queries go live. Read initial data with ctx.query, filter by ctx.location (workspace-relative pathname and search), and start writes and device work on mount. Each route loads only its own browser graph; navigation is a document request.

Members

NameTypeDescription
refresh() => Effect<void, ReadFailed | TransportFailed>

Re-reads mounted queries, surfaces read failures, and waits for their subscribers to receive the answers.

query<const R extends ReadRequestBase>(request: ReadRequest<R>) => Query<ReadAnswer<R>>

A read request, as server code's ctx.query: roots (models with outputs) and their declared layers in one read, the answer typed from the named layers; live by every row it read, layers included. Read .current, .loading and .error reactively to render all states. Awaiting in an event handler reads once.

@returns A Query whose current value is initially undefined; each root contains its own page or aggregate.

@see Query *

const orders = ctx.query({
	orders: { where: { status: { eq: 'issued' } }, fields: ['number', 'total'], order_by: 'due_on', limit: 100,
		party: { fields: ['name'] }, lines: { fields: ['quantity', 'net'] } }
});
history<C extends string>(model: Is<C, ReadableName>, id: NoInfer<Id<C>>, options?: HistoryOptions<C>) => Query<readonly Revision[]>

A record's revisions, oldest first, up to an instant, a revision or just before an approval request.

clock(unit?: "minute" | "hour" | "day") => PageClock

The page's clock. With a unit, reactive: today and now change at each minute, hour or day boundary in the workspace zone, ticking only while the page is visible. Without one, a fixed snapshot taken when the page opened.

record_capabilities<C extends string>(model: Is<C, ReadableName>, id: NoInfer<Id<C>>, parent?: RecordParentContext) => PageCall<RecordCapabilities | null, ProtocolFailed | TransportFailed>

The record's field and operation permissions for its current revision; null when it is absent or not readable.

delete_verdict<C extends string>(model: Is<C, ReadableName>, ids: readonly NoInfer<Id<C>>[]) => PageCall<"allow" | "refuse" | "approve", ProtocolFailed | TransportFailed>

Whether deleting these records would commit (allow), be held for approval (approve) or be refused (refuse), in one read.

act{ <const A extends ActMap>(acts: ActMapInput<A>, options?: ActOptions): PageAct<ActMapOutput<A>>; <const A extends Readonly<Record<string, Json>>>(acts: string extends keyof A ? A : never, options?: ActOptions): PageAct<Readonly<Record<string, Json>>>; }

Plans every named generated write together and commits them as one statement.

run<const A extends string>(automation: Is<A, AutomationName>, input: NoInfer<AutomationSpecOf<A> extends { mode: "call"; } ? StartInput<A> : StartInput<A> | readonly StartInput<A>[]>) => AutomationSpecOf<A> extends { mode: "call"; } ? PageCall<StartOutput<A>, ActRefused | ActConflict | ActUnknown | ProtocolFailed> & { readonly mode: "call"; readonly automation: A; } : PageRun<A>

Starts an automation as the viewer (their policy's capabilities.automations). A call is the page RPC, the one request/response path to server code: it runs in this request and answers its declared output. A job queues one run per input, with id/ids available before admission settles so native controls can follow them; yielding it confirms queue admission, not completed execution. A job batch needs at least one input. Every failure is typed: recover a refusal with Effect.catchTag('ActRefused', …).

sync_control<const M extends string, const S extends string>(model: Is<M, ModelName>, sync: Is<S, FileSyncName<M> | ReadSyncName<M>>, input: NoInfer<SyncControlInput<M, S>>) => PageRun<`${M}.sync.${S}`>

Native sync controls, separate from automation calls and schedules; execution stays visible in the run ledger as <model>.sync.<name>, and the handle's run id follows progress and the exported file. Grants as SyncControlInput.

ctx.sync_control('work_logs', 'work_sheet', { mode: 'import', file, context: { company } });
upload(file: Blob & { name?: string; }, field: never | never) => PageCall<FileRef, ActRefused | TransportFailed>

Stores a file for a model's file field, a file sync's import (<model>.$import.<sync>) or an automation's file input (<automation>.$input.<input>, then pass the answered FileRef in the start); accept and max are checked before bytes are stored; a refusal is ActRefused. Identical content, name and media type uploaded by the same actor to the same destination reuse one FileRef; changed content remains a distinct file.

preview_pdf(source: ConvertSource, options?: PreviewPdfOptions) => PageCall<Uint8Array<ArrayBufferLike>, ActRefused | Unavailable | TransportFailed>

Renders a PDF for this page and returns its bytes without storing a file or a conversion job, for content the viewer already has; limited by the policy's convert rate (default 30/min). A stored document comes from an automation's ctx.convert.document.

file_url(ref: Pick<FileRef, "id">, options?: FileUrlOptions) => string

The URL a page shows or downloads a stored file from: the original, or with { preview: 64 | 512 | 1024 } an image preview of that maximum edge. Reading it still needs the file's record or conversation authority; a public page's URL keeps its app or kiosk scope.

approvals{ /** * Decides the request's current step as the viewer: `approve` (a superseder's approve supersedes, reason * required), `reject` (rolls the held change back), or `request_changes` (the requester edits and saves to * resubmit); `reason` is required for the last two. `withdraw` is the requester's own: it takes their open * request back, restoring the record as a rejection does. Offer what the v…

Approval requests: decide the current step, read one request's view, or list the requests the viewer may see.

t(key: MessageKey, vars?: { readonly [name: string]: string | number; }) => string

A message of +messages.ts in the page's locale, {name} placeholders filled from vars.

session{ send_code(address: string): PageCall<void, Refusal>; verify(address: string, code: string): PageCall<void, Refusal>; }

On-page sign-in: send_code texts or emails a six-digit code, verify proves it, signs the viewer in — a newcomer joins where the workspace declares signup — and reloads the page as them. A refusal is a Refusal. ui's <PhoneVerify {ctx} session={ctx.session} /> is the whole control.

actorActor | null

Who the page runs as; null before a visitor page has one.

policiesreadonly PolicyName[]

The policies the actor holds: what a page checks to show or hide what a policy grants.

ui{ readonly bolt?: ViewBolt | undefined; readonly kinds: KindsHost; }
location{ readonly pathname: string; readonly search: string; }
tzstring
localestring
deviceimport("../../page/device.ts").DeviceApi
href(app: string, page?: string | undefined, record?: { model: string; id: string; } | undefined) => string
org{ name: string; logo: string | null; }

Source: packages/bolt/src/page/index.ts:32

file_ref function

function file_ref(file: { readonly id: string; readonly name: string; readonly mime: string; readonly size?: number; }): FileRef

A stored-file handle from upload or a row read, as bolt's branded FileRef for writes and acts.

Parameters

NameTypeDescription
file{ readonly id: string; readonly name: string; readonly mime: string; readonly size?: number; }
  • id: string
  • name: string
  • mime: string
  • size?: number

Source: packages/bolt/src/page/file-ref.ts:38