Skip to main content

Interfaces

References

defineProcess

Re-exports defineProcess

processBinding

Re-exports processBinding

processSnapshot

Re-exports processSnapshot

ProcessDefinition

Re-exports ProcessDefinition

ProcessEvidence

Re-exports ProcessEvidence

ProcessSnapshot

Re-exports ProcessSnapshot

Type Aliases

Context

Ƭ Context: BijectionQueryCtx<any, any> Not exported: an exported type refers to it.

ApplicationProcess

Ƭ ApplicationProcess: ProcessDefinition & { observe?: (ctx: Context, row: AppObject, cursor: string | null) => Promise<Omit<ProcessEvidencePage, "projection">> } Optional adapters run as the current reader and must preserve source identity. They report observations, never manufacture native acceptance or delivery.

ApplicationProcesses

Ƭ ApplicationProcesses: Record<string, ApplicationProcess>

TransitionOptions

Ƭ TransitionOptions<State>: Object The state graph of a .transitions() declaration. Without initial, edges and terminal every present-state change is recorded and none is refused; ordinary deletion still requires a removable stage.

Type parameters

Type declaration


TransitionFields

Ƭ TransitionFields<DocumentType>: DocumentType extends { fields: infer Fields } ? { [Field in keyof Fields]: Fields[Field] extends Object ? [Type] extends [string] ? Field : never : never }[keyof Fields] & string : string The required string fields of a table’s object validator, the fields .transitions() accepts.

Type parameters


TransitionActor

Ƭ TransitionActor: { kind: "user" ; subject: string ; issuer: string } | { kind: "acting_user" ; subject: string | null } | { kind: "program" ; installation: string | null ; callback: string } | { kind: "admin" } | { kind: "system" } | { kind: "anonymous" } Who made the commit that recorded a transition.

TransitionRequest

Ƭ TransitionRequest: Object The accepted operation request whose retained invocation made a change: the installation holding it, its operation and its reference, the request’s identity within that installation.

Type declaration


Transition

Ƭ Transition: Object One entry of a row’s stage history. basis: "commit" is a change the commit recorded; its at is the commit timestamp in nanoseconds. basis: "observed" is the state the row was in before its recorded history begins (the row predates the declaration, or its earliest records expired); its at is the recorded time it entered that state, or null when that time is unknown. Unknown time is never zero.

Type declaration

Variables

processSnapshotValidator

• Const processSnapshotValidator: VObject<{ attention_stages: undefined | Record<string, string> ; key: string ; revision: string ; label: string ; steps: { key: string; label: string; operations: string[]; depends_on: string[]; }[] ; active_stages: string[] }, { key: VString<string, "required"> ; label: VString<string, "required"> ; revision: VString<string, "required"> ; active_stages: VArray<string[], VString<string, "required">, "required"> ; attention_stages: VRecord<undefined | Record<string, string>, VString<string, "required">, VString<string, "required">, "optional", string> ; steps: VArray<{ key: string ; label: string ; operations: string[] ; depends_on: string[] }[], VObject<{ key: string ; label: string ; operations: string[] ; depends_on: string[] }, { key: VString<string, "required"> ; label: VString<string, "required"> ; operations: VArray<string[], VString<string, "required">, "required"> ; depends_on: VArray<string[], VString<string, "required">, "required"> }, "required", "key" | "label" | "operations" | "depends_on">, "required"> }, "required", "key" | "revision" | "label" | "steps" | "active_stages" | "attention_stages" | `attention_stages.${string}`> Schema for the immutable definition captured by an application’s case owner.

PROCESS_HISTORY_TOTALS

• Const PROCESS_HISTORY_TOTALS: Object The totals defineProcessHistory declares by default, and the measure each one answers.

Type declaration


DEFAULT_PROCESS_HISTORY_BINS

• Const DEFAULT_PROCESS_HISTORY_BINS: string[] Bins a process history uses when its declaration names none.

PROCESS_POSITIONS

• Const PROCESS_POSITIONS: ["open", "closed", "past"] Where a history row stands in its case: open and closed mark the case’s newest row, past every earlier one.

PROCESS_CONFORMANCE

• Const PROCESS_CONFORMANCE: ["conformant", "deviant", "unknown"] A case’s conformance so far: deviant once an undeclared change, a re-entered state or a left terminal state is recorded; unknown while the history does not begin at the case’s insertion or its path is longer than 64 states; otherwise conformant.

UNKNOWN_PROCESS_BIN

• Const UNKNOWN_PROCESS_BIN: "unknown" The bin of a dwell or elapsed time that is not known; dwell_ms and elapsed_ms are 0 exactly when their bin is this one.

MAX_PROCESS_PATH

• Const MAX_PROCESS_PATH: 64 States a history row’s path keeps.

Functions

defineProcessHistory

▸ defineProcessHistory<Case>(caseTable, options?): TableDefinition<VObject<{ at: bigint ; path: string[] ; revision: string ; position: "open" | "closed" | "past" ; case: GenericId<Case> ; request: null | { reference: string; operation: string; owner: string; } ; actor: "program" | "system" | "user" | "acting_user" | "admin" | "anonymous" ; started_at: null | bigint ; expires_at: null | bigint ; declared: boolean ; from: null | string ; to: null | string ; overdue: boolean ; variant: string ; seq: bigint ; from_since: null | bigint ; dwell_ms: bigint ; dwell_bin: string ; elapsed_ms: bigint ; elapsed_bin: string ; conformance: "unknown" | "conformant" | "deviant" ; actor_identity: { kind: “user”; subject: string; issuer: string; } | { kind: “acting_user”; subject: string | null; } | { kind: “program”; installation: string | null; callback: string; } | { kind: “admin”; } | { kind: “system”; } | { kind: “anonymous”; } ; deadline_revision: string ; due_at: null | bigint }, { case: VId<GenericId<Case>, "required"> ; seq: VInt64<bigint, "required"> ; from: VUnion<null | string, [VString<string, "required">, VNull<null, "required">], "required", never> ; to: VUnion<null | string, [VString<string, "required">, VNull<null, "required">], "required", never> ; at: VInt64<bigint, "required"> ; from_since: VUnion<null | bigint, [VInt64<bigint, "required">, VNull<null, "required">], "required", never> ; dwell_ms: VInt64<bigint, "required"> ; dwell_bin: VString<string, "required"> ; started_at: VUnion<null | bigint, [VInt64<bigint, "required">, VNull<null, "required">], "required", never> ; elapsed_ms: VInt64<bigint, "required"> ; elapsed_bin: VString<string, "required"> ; position: VUnion<"open" | "closed" | "past", [VLiteral<"open", "required">, VLiteral<"closed", "required">, VLiteral<"past", "required">], "required", never> ; declared: VBoolean<boolean, "required"> ; conformance: VUnion<"unknown" | "conformant" | "deviant", [VLiteral<"conformant", "required">, VLiteral<"deviant", "required">, VLiteral<"unknown", "required">], "required", never> ; variant: VString<string, "required"> ; path: VArray<string[], VString<string, "required">, "required"> ; revision: VString<string, "required"> ; actor: VUnion<"program" | "system" | "user" | "acting_user" | "admin" | "anonymous", [VLiteral<"user", "required">, VLiteral<"acting_user", "required">, VLiteral<"program", "required">, VLiteral<"admin", "required">, VLiteral<"system", "required">, VLiteral<"anonymous", "required">], "required", never> ; actor_identity: VUnion<{ kind: "user" ; subject: string ; issuer: string } | { kind: "acting_user" ; subject: null | string } | { kind: "program" ; installation: null | string ; callback: string } | { kind: "admin" } | { kind: "system" } | { kind: "anonymous" }, [VObject<{ kind: "user" ; subject: string ; issuer: string }, { kind: VLiteral<"user", "required"> ; subject: VString<string, "required"> ; issuer: VString<string, "required"> }, "required", "kind" | "subject" | "issuer">, VObject<{ kind: "acting_user" ; subject: null | string }, { kind: VLiteral<"acting_user", "required"> ; subject: VUnion<null | string, [VString<string, "required">, VNull<null, "required">], "required", never> }, "required", "kind" | "subject">, VObject<{ kind: "program" ; installation: null | string ; callback: string }, { kind: VLiteral<"program", "required"> ; installation: VUnion<null | string, [VString<string, "required">, VNull<null, "required">], "required", never> ; callback: VString<string, "required"> }, "required", "kind" | "installation" | "callback">], "required", "kind" | "subject" | "installation" | "issuer" | "callback"> ; request: VUnion<null | { reference: string ; operation: string ; owner: string }, [VObject<{ reference: string ; operation: string ; owner: string }, { owner: VString<string, "required"> ; operation: VString<string, "required"> ; reference: VString<string, "required"> }, "required", "reference" | "operation" | "owner">, VNull<null, "required">], "required", "reference" | "operation" | "owner"> ; expires_at: VUnion<null | bigint, [VInt64<bigint, "required">, VNull<null, "required">], "required", never> ; deadline_revision: VString<string, "required"> ; due_at: VUnion<null | bigint, [VInt64<bigint, "required">, VNull<null, "required">], "required", never> ; overdue: VBoolean<boolean, "required"> }, "required", "at" | "path" | "revision" | "position" | "case" | "request" | "actor" | "started_at" | "expires_at" | "declared" | "from" | "to" | "overdue" | "variant" | "seq" | "from_since" | "dwell_ms" | "dwell_bin" | "elapsed_ms" | "elapsed_bin" | "conformance" | "actor_identity" | "deadline_revision" | "due_at" | "request.reference" | "request.operation" | "request.owner" | "actor_identity.kind" | "actor_identity.subject" | "actor_identity.installation" | "actor_identity.issuer" | "actor_identity.callback">, { by_case: ["case", "seq", "_creationTime"] ; by_expiry: ["expires_at", "_creationTime"] ; by_target: ["position", "deadline_revision", "_creationTime"] ; by_deadline: ["position", "deadline_revision", "overdue", "due_at", "_creationTime"] ; by_variant: ["position", "variant", "_creationTime"] }, {}, {}, false, {}> Declare the process history of the stage field whose .transitions() names this table in history. The table has the fixed processHistoryFields shape, the by_case and by_expiry indexes the commit reads, by_target and by_deadline for current-policy deadline maintenance, a by_variant index for reading a variant’s path, and, unless totals: false, the maintained totals of PROCESS_HISTORY_TOTALS. Add an access declaration whose parent is the case table by case and by_case when the case table is protected, and visibility: "collectionReaders" so its readers are served totals.

Type parameters

Parameters

Returns

TableDefinition<VObject<{ at: bigint ; path: string[] ; revision: string ; position: "open" | "closed" | "past" ; case: GenericId<Case> ; request: null | { reference: string; operation: string; owner: string; } ; actor: "program" | "system" | "user" | "acting_user" | "admin" | "anonymous" ; started_at: null | bigint ; expires_at: null | bigint ; declared: boolean ; from: null | string ; to: null | string ; overdue: boolean ; variant: string ; seq: bigint ; from_since: null | bigint ; dwell_ms: bigint ; dwell_bin: string ; elapsed_ms: bigint ; elapsed_bin: string ; conformance: "unknown" | "conformant" | "deviant" ; actor_identity: { kind: “user”; subject: string; issuer: string; } | { kind: “acting_user”; subject: string | null; } | { kind: “program”; installation: string | null; callback: string; } | { kind: “admin”; } | { kind: “system”; } | { kind: “anonymous”; } ; deadline_revision: string ; due_at: null | bigint }, { case: VId<GenericId<Case>, "required"> ; seq: VInt64<bigint, "required"> ; from: VUnion<null | string, [VString<string, "required">, VNull<null, "required">], "required", never> ; to: VUnion<null | string, [VString<string, "required">, VNull<null, "required">], "required", never> ; at: VInt64<bigint, "required"> ; from_since: VUnion<null | bigint, [VInt64<bigint, "required">, VNull<null, "required">], "required", never> ; dwell_ms: VInt64<bigint, "required"> ; dwell_bin: VString<string, "required"> ; started_at: VUnion<null | bigint, [VInt64<bigint, "required">, VNull<null, "required">], "required", never> ; elapsed_ms: VInt64<bigint, "required"> ; elapsed_bin: VString<string, "required"> ; position: VUnion<"open" | "closed" | "past", [VLiteral<"open", "required">, VLiteral<"closed", "required">, VLiteral<"past", "required">], "required", never> ; declared: VBoolean<boolean, "required"> ; conformance: VUnion<"unknown" | "conformant" | "deviant", [VLiteral<"conformant", "required">, VLiteral<"deviant", "required">, VLiteral<"unknown", "required">], "required", never> ; variant: VString<string, "required"> ; path: VArray<string[], VString<string, "required">, "required"> ; revision: VString<string, "required"> ; actor: VUnion<"program" | "system" | "user" | "acting_user" | "admin" | "anonymous", [VLiteral<"user", "required">, VLiteral<"acting_user", "required">, VLiteral<"program", "required">, VLiteral<"admin", "required">, VLiteral<"system", "required">, VLiteral<"anonymous", "required">], "required", never> ; actor_identity: VUnion<{ kind: "user" ; subject: string ; issuer: string } | { kind: "acting_user" ; subject: null | string } | { kind: "program" ; installation: null | string ; callback: string } | { kind: "admin" } | { kind: "system" } | { kind: "anonymous" }, [VObject<{ kind: "user" ; subject: string ; issuer: string }, { kind: VLiteral<"user", "required"> ; subject: VString<string, "required"> ; issuer: VString<string, "required"> }, "required", "kind" | "subject" | "issuer">, VObject<{ kind: "acting_user" ; subject: null | string }, { kind: VLiteral<"acting_user", "required"> ; subject: VUnion<null | string, [VString<string, "required">, VNull<null, "required">], "required", never> }, "required", "kind" | "subject">, VObject<{ kind: "program" ; installation: null | string ; callback: string }, { kind: VLiteral<"program", "required"> ; installation: VUnion<null | string, [VString<string, "required">, VNull<null, "required">], "required", never> ; callback: VString<string, "required"> }, "required", "kind" | "installation" | "callback">], "required", "kind" | "subject" | "installation" | "issuer" | "callback"> ; request: VUnion<null | { reference: string ; operation: string ; owner: string }, [VObject<{ reference: string ; operation: string ; owner: string }, { owner: VString<string, "required"> ; operation: VString<string, "required"> ; reference: VString<string, "required"> }, "required", "reference" | "operation" | "owner">, VNull<null, "required">], "required", "reference" | "operation" | "owner"> ; expires_at: VUnion<null | bigint, [VInt64<bigint, "required">, VNull<null, "required">], "required", never> ; deadline_revision: VString<string, "required"> ; due_at: VUnion<null | bigint, [VInt64<bigint, "required">, VNull<null, "required">], "required", never> ; overdue: VBoolean<boolean, "required"> }, "required", "at" | "path" | "revision" | "position" | "case" | "request" | "actor" | "started_at" | "expires_at" | "declared" | "from" | "to" | "overdue" | "variant" | "seq" | "from_since" | "dwell_ms" | "dwell_bin" | "elapsed_ms" | "elapsed_bin" | "conformance" | "actor_identity" | "deadline_revision" | "due_at" | "request.reference" | "request.operation" | "request.owner" | "actor_identity.kind" | "actor_identity.subject" | "actor_identity.installation" | "actor_identity.issuer" | "actor_identity.callback">, { by_case: ["case", "seq", "_creationTime"] ; by_expiry: ["expires_at", "_creationTime"] ; by_target: ["position", "deadline_revision", "_creationTime"] ; by_deadline: ["position", "deadline_revision", "overdue", "due_at", "_creationTime"] ; by_variant: ["position", "variant", "_creationTime"] }, {}, {}, false, {}>

processHistoryFields

▸ processHistoryFields<Case>(caseTable): Object The fields of a process history row of cases in caseTable. Times are UTC milliseconds of the committing transaction’s snapshot; variant names the case’s whole path so far.

Type parameters

Parameters

Returns

Object

processBinLabel

▸ processBinLabel(bins, durationMs): string <1h for the first bin a duration is below, >=7d past the last and unknown for an unknown duration, as the commit labels them.

Parameters

Returns

string