effx
API reference@effx/runtime

Annotation

API reference for @effx/runtime/Annotation

Annotation.ts overview


Exports Grouped by Category


utils

AccessCapabilities (type alias)

Signature

type AccessCapabilities =
  | { readonly _tag: "None" }
  | { readonly _tag: "One"; readonly capability: string }
  | { readonly _tag: "Any" | "All"; readonly capabilities: NonEmptyStrings }

AccessConcealment (type alias)

Signature

type AccessConcealment = { readonly _tag: "Reveal" } | { readonly _tag: "NotFound"; readonly stages: NonEmptyStrings }

AccessJson (type alias)

JSON-only values in application-defined requirement parameters.

Signature

type AccessJson = null | string | number | boolean | ReadonlyArray<AccessJson> | { readonly [key: string]: AccessJson }

Annotation (interface)

The runtime form of a spec 0001 annotation: same name, same argument structure, live values instead of symbol references. Decorators and builders both produce these (spec 0002).

Signature

export interface Annotation {
  readonly name: string
  readonly args: ReadonlyArray<AnnotationValue>
}

AnnotationValue (type alias)

A value usable as an annotation argument: literal, Schema, service class, capability, focus, record, array, function.

Signature

type AnnotationValue = string | number | boolean | object

Capability (interface)

Signature

export interface Capability {
  readonly _tag: "Capability"
  readonly name: string
  readonly resource: Schema.Top
  readonly focus?: Focus
}

CommandIdentityValue (interface)

The app owns key issuance and keeps the original HTTP request and precondition for retries.

Signature

export interface CommandIdentityValue {
  readonly key: string
  readonly input: object
  readonly precondition: string | null
}

ExportedFunctionSymbol (type alias)

An application-exported function referenced by source, never invoked by the compiler.

Signature

type ExportedFunctionSymbol = (request: never) => CommandIdentityValue

Focus (interface)

Signature

export interface Focus {
  readonly _tag: "Focus"
  readonly root: Schema.Top
  readonly path: ReadonlyArray<string>
}

FoldkitCommandOptions (type alias)

App-owned Message schemas; the generated Command only maps into their declared types.

Signature

type FoldkitCommandOptions = Parameters<typeof Builtins.FoldkitCommand>[0]

HttpAccessAnnotationSpec (interface)

Values passed unchanged to the application annotator in generated endpoint code.

Signature

export interface HttpAccessAnnotationSpec {
  readonly exposure: "External" | "Internal"
  readonly acceptedCredentials: NonEmptyStrings
  readonly principalKinds: NonEmptyStrings
  readonly capabilities: AccessCapabilities
  readonly requirements: ReadonlyArray<{
    readonly id: string
    readonly parameters?: Readonly<Record<string, AccessJson>>
  }>
  /** Application-exported value, resolved to a SymbolRef by the frontend. */
  readonly canonicalScopeResolver: object
  readonly concealment: AccessConcealment
  readonly decisionTime: "SnapshotRead" | "Transaction"
}

HttpAccessOptions (type alias)

Source-only declaration; the application owns evaluation and transaction timing.

Signature

type HttpAccessOptions = Parameters<typeof Builtins.HttpAccess>[0]

HttpContractOptions (type alias)

Live HTTP contract values are lowered to references by the source frontend.

Signature

type HttpContractOptions = Parameters<typeof Builtins.HttpContract>[0]

HttpGroupOptions (type alias)

A named HTTP group is source metadata, independent of its operation declarations.

Signature

type HttpGroupOptions = Parameters<typeof Builtins.HttpGroup>[0]

HttpOperationAnnotator (type alias)

An exported callable returning annotations merged onto the generated endpoint.

Signature

type HttpOperationAnnotator = (metadata: HttpOperationMetadata) => Context.Context<never>

HttpOperationMetadata (interface)

Metadata available to an application-owned HTTP operation annotator.

Signature

export interface HttpOperationMetadata {
  readonly operationId?: string
  readonly summary?: string
  readonly description?: string
  readonly tags?: ReadonlyArray<string>
}

HttpProblemsOptions (type alias)

Http.Problems options. The definition is not generic, so only the two Code-dependent fields are written here; every other field is derived.

Signature

type HttpProblemsOptions<Code extends string = string> = Omit<
  Parameters<typeof Builtins.HttpProblems>[0],
  "registry" | "codes"
> & {
  readonly registry?: ProblemRegistry<Code>
  readonly codes: readonly [Code, ...Code[]]
}

NonEmptyStrings (type alias)

Signature

type NonEmptyStrings = readonly [string, ...string[]]

OperationOptions (type alias)

Query/Command options.

Signature

type OperationOptions = Parameters<typeof Builtins.Query>[0]

PersistentModelOptions (type alias)

PersistentModel options; the collector (or the decorator) supplies schema.

Signature

type PersistentModelOptions = Parameters<typeof Builtins.PersistentModel>[0]

ProblemRegistry (type alias)

Exported derivation function imported by the generated endpoint.

Signature

type ProblemRegistry<Code extends string = string> = (
  identifier: string,
  codes: readonly [Code, ...Code[]]
) => ReadonlyArray<Schema.Top>

ServiceLike (interface)

A Context.Service class (its static side carries key).

Signature

export interface ServiceLike {
  readonly key: string
}

annotationsOf

Signature

declare const annotationsOf: <Target extends object>(target: Target) => ReadonlyArray<Annotation>

record

Decorators are applied bottom-up although they are written top-down; prepending keeps the recorded order equal to source order, which is what builder chains produce.

Signature

declare const record: <Target extends object>(target: Target, annotation: Annotation) => void

On this page