Skip to content

@graphty/graphty-element / session / CostGateDecision

Type Alias: CostGateDecision ​

CostGateDecision = { estimate: CostEstimate; kind: "exact"; } | { estimate: CostEstimate; exactEstimate: CostEstimate; kind: "approximate"; method: string; notes: readonly string[]; plainName: string; sampleSize: number; seeded: boolean; } | { error: GraphtyError; kind: "refused"; }

Defined in: graphty-element/src/session/cost/estimate.ts:1034

What the gate decided, as three cases a caller switches on.

Union Members ​

Type Literal ​

{ estimate: CostEstimate; kind: "exact"; }

estimate ​

readonly estimate: CostEstimate

What it is expected to cost.

kind ​

readonly kind: "exact"

Run it exactly.


Type Literal ​

{ estimate: CostEstimate; exactEstimate: CostEstimate; kind: "approximate"; method: string; notes: readonly string[]; plainName: string; sampleSize: number; seeded: boolean; }

estimate ​

readonly estimate: CostEstimate

What the approximate method is expected to cost.

exactEstimate ​

readonly exactEstimate: CostEstimate

What the exact method would have cost, which is why the switch happened.

kind ​

readonly kind: "approximate"

Run the approximate method instead, and say so in the caveats.

method ​

readonly method: string

The method name, for caveats.method.

notes ​

readonly notes: readonly string[]

Sentences for caveats.notes, stating plainly what the numbers are.

plainName ​

readonly plainName: string

What the method is called in words.

sampleSize ​

readonly sampleSize: number

The sample size, for caveats.sampleSize.

seeded ​

readonly seeded: boolean

Whether the method takes a seed, so caveats.seed can be filled or left null.


Type Literal ​

{ error: GraphtyError; kind: "refused"; }

error ​

readonly error: GraphtyError

The error to reject the run with, carrying the facts a consumer switches on.

kind ​

readonly kind: "refused"

Refuse it.