@graphty/graphty-element / index / NotesApi
Interface: NotesApi ​
Defined in: graphty-element/src/session/notes/types.ts:275
The session's notes: text people write about the graph, its nodes and edges, kept sets and results, stored, undone and redone with everything else. graphty-element never interprets a note's text.
Methods ​
add() ​
add(
input):string
Defined in: graphty-element/src/session/notes/types.ts:313
Write a note. One undoable step, labeled "Added note".
Parameters ​
input ​
The note.
Returns ​
string
The new note's id.
Throws ​
A GraphtyError (E_BAD_COMMAND or E_TOO_LARGE) whose details.reason says why; nothing changes then.
authors() ​
authors(): readonly
string[]
Defined in: graphty-element/src/session/notes/types.ts:296
Returns ​
readonly string[]
The distinct authors of the session's notes, in the order of their first note.
counts() ​
counts():
object
Defined in: graphty-element/src/session/notes/types.ts:298
Returns ​
How many notes, and how many distinct nodes and edges in the graph have at least one.
edges ​
readonlyedges:number
How many edges in the graph at least one note names.
nodes ​
readonlynodes:number
How many nodes in the graph at least one note names.
notes ​
readonlynotes:number
How many notes.
get() ​
get(
id):Note|undefined
Defined in: graphty-element/src/session/notes/types.ts:287
One note.
Parameters ​
id ​
string
Its id.
Returns ​
Note | undefined
The note, or undefined when no note has that id.
list() ​
list(
options?): readonlyNote[]
Defined in: graphty-element/src/session/notes/types.ts:281
Notes, newest first: by time, then by id. The same frozen objects until a note changes.
Parameters ​
options? ​
Filters; every one given must hold.
Returns ​
readonly Note[]
The notes.
mergeDocument() ​
mergeDocument(
document,options?):NotesReport
Defined in: graphty-element/src/session/notes/types.ts:350
Add a saved member's notes to the session's, in one undoable step labeled "Added notes from <name>". Never deletes a note. A note whose id is held with other content is added under a new id by default (onConflict). A note that fails the schema is skipped alone. A set, result or item target, or a cite, read from a member binds to nothing here: it reads missing, because two projects can share a set or result id.
Parameters ​
document ​
unknown
The member, parsed from JSON.
options? ​
What to do on a conflicting id, and the source's name.
Returns ​
The report.
Throws ​
A GraphtyError, and nothing changes: E_BAD_DOCUMENT for what is not a graphty-notes member, E_UNSUPPORTED_VERSION for another version, E_TOO_LARGE past 10,000 notes.
remove() ​
remove(
id):void
Defined in: graphty-element/src/session/notes/types.ts:325
Delete a note. One undoable step, labeled "Removed note"; undo brings it back with the same id.
Parameters ​
id ​
string
The note.
Returns ​
void
status() ​
status(
id):NoteStatus
Defined in: graphty-element/src/session/notes/types.ts:294
What each target and cite of a note points at now. Synchronous.
Parameters ​
id ​
string
The note.
Returns ​
The status, frozen.
Throws ​
A GraphtyError E_BAD_COMMAND with details.reason "unknown-id".
toDocument() ​
toDocument(
options?):NotesDocument
Defined in: graphty-element/src/session/notes/types.ts:336
The session's notes as a graphty-notes member, ready to save as JSON: oldest first, the same bytes for the same notes. Where a note was opened from is never written.
Parameters ​
options? ​
The member's name and description.
description? ​
string
Its description, at most 65,536 characters.
name? ​
string
Its name, at most 1,024 characters.
Returns ​
The member.
Throws ​
A GraphtyError E_BAD_COMMAND for a name over 1,024 or a description over 65,536 characters.
update() ​
update(
id,patch):void
Defined in: graphty-element/src/session/notes/types.ts:320
Change a note. One undoable step, labeled "Edited note"; stamps edited. A change that changes nothing records nothing.
Parameters ​
id ​
string
The note.
patch ​
What to change.
Returns ​
void