Skip to content

@graphty/graphty-element / session / ScopeApi

Interface: ScopeApi ​

Defined in: graphty-element/src/session/scope/ScopeApi.ts:245

Resolving a scope, counting one, and keeping one under a name.

Methods ​

count() ​

count(spec, options?): Promise<ScopeCount>

Defined in: graphty-element/src/session/scope/ScopeApi.ts:258

How many elements a specification covers, without materialising them.

Parameters ​

spec ​

ScopeInput

What to count.

options? ​

ScopeCountOptions

Whether an estimate is acceptable, and how big a sample to take.

Returns ​

Promise<ScopeCount>

The counts, saying whether the edge count was exact.


list() ​

list(): readonly SavedScope[]

Defined in: graphty-element/src/session/scope/ScopeApi.ts:276

Every kept set, as the specification it holds and whether it still refers to anything.

Returns ​

readonly SavedScope[]

The kept sets, in the order they were created.

Deprecated ​

Use session.sets.list, which returns the definitions.


remove() ​

remove(id): void

Defined in: graphty-element/src/session/scope/ScopeApi.ts:282

Remove a kept set. Anything that named it becomes unbound rather than silently empty.

Parameters ​

id ​

string

The id to remove.

Returns ​

void

Deprecated ​

Use session.sets.remove.


resolve() ​

resolve(spec): Promise<ResolvedScope>

Defined in: graphty-element/src/session/scope/ScopeApi.ts:251

The elements a specification covers.

Parameters ​

spec ​

ScopeInput

What to resolve.

Returns ​

Promise<ResolvedScope>

The resolved scope.


save() ​

save(name, spec): string

Defined in: graphty-element/src/session/scope/ScopeApi.ts:270

Keep a specification under a name, so { set: id } can name it later.

It is kept as a set, created from user: { where } as a rule, { nodes } as a fixed set, { define } as its definition, "graph", "largest-component" and { set } as a rule naming them. "selection" and "visible" are kept as their current members.

Parameters ​

name ​

string

The name, unique among kept sets.

spec ​

Scope

The specification to keep.

Returns ​

string

The minted id, never one issued before.

Deprecated ​

Use session.sets.create, which takes a definition.