Skip to content

@graphty/graphty-element / session / LoadDraft

Interface: LoadDraft ​

Defined in: graphty-element/src/session/types.ts:993

A source read by data.prepare, held until load() or dispose(). After either, every method rejects with E_DISPOSED.

Properties ​

mapping ​

readonly mapping: LoadMappingRead

Defined in: graphty-element/src/session/types.ts:999

The element's own reading: every table, with every role it found written out.


tables ​

readonly tables: readonly DraftTable[]

Defined in: graphty-element/src/session/types.ts:997

Its tables.


type ​

readonly type: string

Defined in: graphty-element/src/session/types.ts:995

The data source that read it: the value DataSourceInput.type takes.

Methods ​

dispose() ​

dispose(): void

Defined in: graphty-element/src/session/types.ts:1040

Let go of the held rows.

Returns ​

void


load() ​

load(choices?): Promise<void>

Defined in: graphty-element/src/session/types.ts:1038

Load the held rows as one undoable step, without reading the source again.

Parameters ​

choices? ​

LoadChoices

The column roles, how to treat the graph already there, and the rest.

Returns ​

Promise<void>

Settles once the rows are in the graph.


missing() ​

missing(choices?): Readonly<Record<string, readonly ColumnRole[]>>

Defined in: graphty-element/src/session/types.ts:1018

The roles each table needs and does not have under a set of choices, for a per-table "ready" check: LOAD_ROLES[rowsAre].requires less the roles the choices and the element's own reading set. An edge table needs source and target; a node table needs nothing. report and load refuse a table the reader maps that is not ready with E_EDGE_ENDPOINTS_UNRESOLVED, whose details.table and details.missing say the same.

Parameters ​

choices? ​

LoadChoices

The same choices load takes.

Returns ​

Readonly<Record<string, readonly ColumnRole[]>>

By table id, the required roles left unset; an empty list means the table is ready.


report() ​

report(choices?): Promise<LoadReport>

Defined in: graphty-element/src/session/types.ts:1025

What load(choices) would do to the graph as it is now, computed from the held rows with no I/O. A load past the element's limit is reported in tooLarge rather than thrown.

Parameters ​

choices? ​

LoadChoices

The same choices load takes.

Returns ​

Promise<LoadReport>

The report.


resolve() ​

resolve(choices?): LoadMappingRead

Defined in: graphty-element/src/session/types.ts:1008

Every table's roles as a load with these choices reads them: the reader's mapping over the element's own reading, in the full form mapping has. After a table's rowsAre changes, this is where the key, the endpoints and the rest the element now reads are found.

Parameters ​

choices? ​

LoadChoices

The same choices load takes.

Returns ​

LoadMappingRead

The roles.

Throws ​

E_BAD_COMMAND or E_UNKNOWN_ATTRIBUTE for a mapping the draft cannot carry out.


rows() ​

rows(table, options?): Promise<RecordPage<DraftRow>>

Defined in: graphty-element/src/session/types.ts:1032

The table's rows as the file holds them, a page at a time.

Parameters ​

table ​

string

A DraftTable.id.

options? ​

DraftRowOptions

The page, and only to read the unmatched or rejected rows.

Returns ​

Promise<RecordPage<DraftRow>>

The page.