pivotick - v2.0.1
    Preparing search index...

    Interface PivotManager

    The pivot runtime: the registry, the two provider calls with their cancellation and cache, the narrowing gate, the candidate sets awaiting triage, and ingest with its provenance. Taking a run back is graph.history's job, alongside every other thing the analyst can reverse.

    It holds no UI. Everything here is drivable from the console — a pivot with autoIngest: true is end to end without a single pane — and the triage pane and the Pivot rail mode are readers of this state, not owners of it.

    Reached as Graph.pivots.

    interface PivotManager {
        candidateCeiling: number;
        markUnsaved: boolean;
        quickIngestLimit: number;
        get rimBadge(): PivotRimBadge;
        set rimBadge(mode: PivotRimBadge): void;
        get size(): number;
        all(): PivotDefinition[];
        applicableCount(node: Node): number;
        cachedSummary(
            id: string,
            nodes?: Node[],
            narrowing?: PivotNarrowing,
        ): PivotSummary | undefined;
        cancel(pivotId?: string, kind?: "summarize" | "fetch"): void;
        cancelFetch(pivotId: string): void;
        candidates(pivotId: string): PivotCandidateSet | undefined;
        canonicalId(element: Node | Edge): string | undefined;
        discard(pivotId: string): void;
        dismissPending(pivotId: string): void;
        for(nodes: Node[]): PivotDefinition[];
        get(id: string): PivotDefinition | undefined;
        ingest(
            pivotId: string,
            trigger?: "auto" | "triage",
        ): Promise<PivotRunOutcome>;
        invalidate(pivotId?: string, nodes?: Node[]): void;
        isSavable(element: Node | Edge): boolean;
        isSaved(element: Node | Edge): boolean;
        mark(pivotId: string, id: string, marked?: boolean): void;
        markAll(pivotId: string, marked?: boolean): void;
        on(listener: (change: PivotChange) => void): () => void;
        originFor(id: string, nodes: Node[]): Node[];
        register(definition: PivotDefinition): () => void;
        reject(pivotId: string, ids: string[]): void;
        rejectedCount(pivotId: string): number;
        rejectedIds(pivotId: string): string[];
        rejectedRows(pivotId: string): PivotRejection[];
        rejectRemaining(pivotId: string): void;
        run(
            id: string,
            nodes?: Node[],
            narrowing?: PivotNarrowing,
            options?: PivotRunOptions,
        ): Promise<PivotRunOutcome>;
        save(target?: string): Promise<PivotSaveReport>;
        showPending(pivotId: string): void;
        staged(): PivotCandidateSet[];
        summarize(
            id: string,
            nodes?: Node[],
            narrowing?: PivotNarrowing,
        ): Promise<PivotSummary | undefined>;
        unregister(id: string): void;
        unreject(pivotId: string, id: string): void;
        unrejectAll(pivotId: string): void;
        unsaved(): PivotRun[];
        unsavedCount(pivotId?: string): { edges: number; nodes: number };
    }

    Implements

    Index

    Accessors

    • get rimBadge(): PivotRimBadge

      What the library draws on a node's rim for its pivots: one badge per pivot that declared a potential, one badge for all of them, or nothing. Set it through pivotRimBadge in the graph options, or here to change it later.

      Assigning marks every node dirty, the way setPotential does for one — the rim redraws on the next render, so call graph.renderer.update() if nothing else is about to.

      Returns PivotRimBadge

    • set rimBadge(mode: PivotRimBadge): void

      What the library draws on a node's rim for its pivots.

      Parameters

      Returns void

    • get size(): number

      How many pivots are registered — what the Pivot rail mode's gating reads.

      Returns number

    Methods

    • How many pivots apply to one node — what the 'summary' rim badge counts when nothing was declared for it.

      Memoised, because the rim asks this for every node on every render and the answer is one appliesTo call per registered pivot: at a hundred providers and a thousand nodes, asking each time is a hundred thousand calls a frame. The memo is dropped whenever the registry or the graph's nodes change, so a predicate reading anything else can go stale — acceptable for a hint on the rim, and the panel is always the exact answer.

      Parameters

      Returns number

    • Abort in-flight provider calls: one pivot's or every pivot's, and optionally only one kind.

      The kind is what lets leaving a surface stop the questions it was asking without cancelling the work it commissioned — a fetch already has a candidate set of its own and a pane showing it, so abandoning that silently would throw away results nobody asked to lose.

      Parameters

      • OptionalpivotId: string
      • Optionalkind: "summarize" | "fetch"

      Returns void

    • Cancel a fetch in flight. The candidate set goes with it; nothing is staged.

      Parameters

      • pivotId: string

      Returns void

    • The id the source system assigned this element, when it assigned one.

      Parameters

      Returns string | undefined

    • Drop a staged set without rejecting anything. Closing a pane is not a verdict: whatever was never rejected is offered again on the next run.

      Parameters

      • pivotId: string

      Returns void

    • Drop a waiting re-run and carry on with what is on show. Nothing is rejected: the next run offers those candidates again.

      Parameters

      • pivotId: string

      Returns void

    • What applies to this origin. An empty origin yields the origin-less pivots — search, import, staging — and nothing else, because a selection-driven pivot with no selection has nothing to run on.

      A pivot that applies to only part of the origin is in: a selection mixing a domain and an IP offers the domain-only providers too, and each is run against the nodes it kept.

      Parameters

      Returns PivotDefinition[]

    • Commit the marked candidates of one staged set.

      Purely additive: an id already on canvas is skipped, never overwritten, and removal only ever happens through graph.history or graph.removeBySource. The whole batch goes through onBeforeIngest once, and lands as one dataBatchChanged.

      Parameters

      • pivotId: string
      • trigger: "auto" | "triage" = 'triage'

      Returns Promise<PivotRunOutcome>

    • Drop cached summaries: all of them, one pivot's, or only those asked about particular nodes. The library caches because a multi-selection summary is an aggregate nothing can decompose, but only the consumer knows when their backend changed.

      Parameters

      • OptionalpivotId: string
      • Optionalnodes: Node[]

      Returns void

    • Whether this element came from a run whose pivot declares a save.

      Parameters

      Returns boolean

    • Written to the source system. false both for an element still waiting and for one whose pivot can never write it anywhere — isSavable is the question that tells those two apart.

      Parameters

      Returns boolean

    • Mark or unmark a candidate for ingest. Deliberately silent: with hundreds of rows, re-rendering the pane on every tick loses the analyst's place, so the caller updates the row it just changed.

      Parameters

      • pivotId: string
      • id: string
      • marked: boolean = true

      Returns void

    • Mark every landable candidate — what "select all" resolves to.

      Parameters

      • pivotId: string
      • marked: boolean = true

      Returns void

    • Subscribe to pivot state changes — the registry, a summary, the staged candidates, the run stack. Returns a disposer.

      Parameters

      • listener: (change: PivotChange) => void

      Returns () => void

    • How much of nodes one pivot applies to. Empty when it does not apply, and empty for an origin-less pivot, which is asked about nothing by definition.

      Parameters

      • id: string
      • nodes: Node[]

      Returns Node[]

    • Register a pivot. Returns a disposer; calling it twice is a no-op. A duplicate id is skipped with a warning, as everywhere else in the library.

      Parameters

      Returns () => void

    • Reject candidates explicitly. Remembered for the session, keyed per pivot: a candidate rejected under one pivot is still offered by another, which asks about it in a different analytic context.

      Parameters

      • pivotId: string
      • ids: string[]

      Returns void

    • How many candidates have been rejected for this pivot this session.

      Parameters

      • pivotId: string

      Returns number

    • The rejected candidate ids for this pivot — what the pane reveals on demand.

      Parameters

      • pivotId: string

      Returns string[]

    • The rejections themselves, rows and all, newest last. What a surface listing them shows: an id names nothing once the run that carried it is gone.

      Parameters

      • pivotId: string

      Returns PivotRejection[]

    • Reject everything still untriaged in this set — how triaging 1,800 down to 12 and dismissing the rest stays one gesture.

      Parameters

      • pivotId: string

      Returns void

    • Run a pivot: gate the advertised count against its cap, fetch, then either land the results (autoIngest) or stage them for triage.

      Resolves at the hand-off — a staged run does not wait on the analyst. The outcome's runId is the id the resulting ingest is recorded under, so it is the handle for graph.history.undo.

      Parameters

      Returns Promise<PivotRunOutcome>

    • Write ingested runs back out to the systems their pivots speak to: one run, or every savable run with something still unsaved.

      The library contributes the bookkeeping, not the transport — which elements a run created, which of them have been written, and what a retry should carry. The write itself is PivotDefinition.save's, and a pivot that declares none is skipped entirely rather than counted as failing.

      Runs go one at a time: a backend being written to is not helped by six parallel batches, and a sequential pass makes the report exact.

      Parameters

      • Optionaltarget: string

        A run id for one run, a pivot id for every unsaved run of that pivot, or nothing for all of them.

      Returns Promise<PivotSaveReport>

    • Promote a waiting re-run: its candidates become the set on show, and the marks on the one it replaces go with it. A no-op while the re-run is still fetching — swapping in a set with nothing in it yet would be the silent discard this whole mechanism exists to avoid.

      Parameters

      • pivotId: string

      Returns void

    • Ask a pivot what is out there. Serves a cached answer without touching the provider, and supersedes any summarize already in flight for the same pivot.

      Resolves undefined when the call was superseded or cancelled — nothing to render, and never an error. A provider that throws rejects, so a surface can show the failure and offer a retry.

      Parameters

      Returns Promise<PivotSummary | undefined>

    • Unregister a pivot, dropping its cached summaries and its staged candidates.

      Parameters

      • id: string

      Returns void

    • Take a rejection back. Reaches the session memory whether or not the candidate is still staged — a rejection from an earlier run suppresses the row rather than showing it, and taking it back is the only way that row is ever offered again.

      Parameters

      • pivotId: string
      • id: string

      Returns void

    • Take every rejection this pivot holds back. The way out of a Reject all remaining that went too far, which one-by-one restoring is not.

      Parameters

      • pivotId: string

      Returns void

    • What a Save would send — across every savable run, or one pivot's.

      Parameters

      • OptionalpivotId: string

      Returns { edges: number; nodes: number }

    Properties

    candidateCeiling: number = 10_000

    Absolute ceiling on what one fetch may stage. A provider that returns more is refused — nothing is staged, nothing is truncated, and the analyst is told the number. It is about memory for candidate objects, not the table, which virtualises. Override it through pivotCandidateCeiling in the graph options.

    markUnsaved: boolean = false

    Whether a node a run created and has not written back carries a pvt-node-unsaved class. Set it through pivotMarkUnsaved in the graph options, or here to change it later.

    quickIngestLimit: number = 50

    How many new candidates a one-click pivot lands without triage. The number is about the canvas rather than the clicking: undo takes an ingest back but not the layout the simulation made around it, so the limit is roughly what a graph can absorb and still be the graph the analyst was reading. Override it through pivotQuickIngestLimit in the graph options.