TypeScript API#

Classes#

FileIdError#

Defined in: ids.ts:156

Thrown for a text that is not an ID in the file form; path says where it stands.

Extends#

  • RangeError

Constructors#

Constructor#
new FileIdError(message, path?): FileIdError;

Defined in: ids.ts:159

Parameters#

Parameter

Type

Default value

message

string

undefined

path?

Path

[]

Returns#

FileIdError

Overrides#

RangeError.constructor

Properties#

Property

Modifier

Type

Defined in

path

readonly

Path

ids.ts:157


JsonFloat#

Defined in: json/value.ts:18

A float whose value is an integer, such as 2.0, 1e+16 or -0.0.

A JavaScript number cannot tell 2.0 from 2. loads returns these floats wrapped, so that dumps writes them back as floats; every other float is a plain number, which is never an integer.

Constructors#

Constructor#
new JsonFloat(value): JsonFloat;

Defined in: json/value.ts:21

Parameters#

Parameter

Type

value

number

Returns#

JsonFloat

Properties#

Property

Modifier

Type

Defined in

value

readonly

number

json/value.ts:19


JsonSyntaxError#

Defined in: serialization/errors.ts:46

A text read as JSON that the reading rules refuse.

Extends#

  • TextSyntaxError

Constructors#

Constructor#
new JsonSyntaxError(
   reason, 
   text, 
   offset
): JsonSyntaxError;

Defined in: serialization/errors.ts:47

Parameters#

Parameter

Type

reason

string

text

string

offset

number

Returns#

JsonSyntaxError

Overrides#

TextSyntaxError.constructor

Properties#

Property

Modifier

Type

Inherited from

Defined in

column

readonly

number

TextSyntaxError.column

serialization/errors.ts:34

line

readonly

number

TextSyntaxError.line

serialization/errors.ts:33

offset

readonly

number

TextSyntaxError.offset

serialization/errors.ts:32


SchemaValidationError#

Defined in: validate/diagnostics.ts:82

Thrown when a value violates the schema or a semantic rule.

Extends#

  • Error

Constructors#

Constructor#
new SchemaValidationError(
   code, 
   path, 
   detail
): SchemaValidationError;

Defined in: validate/diagnostics.ts:87

Parameters#

Parameter

Type

code

ValidationCode

path

readonly PathSegment[]

detail

string

Returns#

SchemaValidationError

Overrides#

Error.constructor

Properties#

Property

Modifier

Type

Defined in

code

readonly

ValidationCode

validate/diagnostics.ts:83

detail

readonly

string

validate/diagnostics.ts:85

path

readonly

readonly PathSegment[]

validate/diagnostics.ts:84


UnsupportedVersionError#

Defined in: validate.ts:58

Thrown when a manifest’s version marker names a version other than SCHEMA_VERSION.

Extends#

  • Error

Constructors#

Constructor#
new UnsupportedVersionError(version): UnsupportedVersionError;

Defined in: validate.ts:61

Parameters#

Parameter

Type

version

unknown

Returns#

UnsupportedVersionError

Overrides#

Error.constructor

Properties#

Property

Modifier

Type

Defined in

version

readonly

unknown

validate.ts:59


YamlSyntaxError#

Defined in: serialization/errors.ts:54

A text read as YAML that the reading rules refuse.

Extends#

  • TextSyntaxError

Constructors#

Constructor#
new YamlSyntaxError(
   reason, 
   text, 
   offset
): YamlSyntaxError;

Defined in: serialization/errors.ts:55

Parameters#

Parameter

Type

reason

string

text

string

offset

number

Returns#

YamlSyntaxError

Overrides#

TextSyntaxError.constructor

Properties#

Property

Modifier

Type

Inherited from

Defined in

column

readonly

number

TextSyntaxError.column

serialization/errors.ts:34

line

readonly

number

TextSyntaxError.line

serialization/errors.ts:33

offset

readonly

number

TextSyntaxError.offset

serialization/errors.ts:32

Interfaces#

Alternative#

Defined in: statements/catalogue.ts:47

One alternative of a verb’s or a type’s pattern in a system.

Properties#

Property

Modifier

Type

Description

Defined in

inverse?

readonly

boolean

Whether the pattern is the verb’s inverse reading.

statements/catalogue.ts:53

note?

readonly

string

-

statements/catalogue.ts:54

pattern

readonly

JsonObject

A statements fragment: keys type or IRIs, every value a one-item list, slots for the value.

statements/catalogue.ts:49

when?

readonly

object

Where the alternative applies: subjects of these types, values of these things.

statements/catalogue.ts:51

when.subject?

readonly

readonly string[]

-

statements/catalogue.ts:51

when.value?

readonly

readonly string[]

-

statements/catalogue.ts:51


BeliefOptions#

Defined in: statements/statements.ts:1005

What withBelief takes besides the pair.

Properties#

Property

Modifier

Type

Defined in

actor

readonly

string

statements/statements.ts:1006

belief

readonly

"true" | "false" | "unlikely"

statements/statements.ts:1007

date

readonly

string

statements/statements.ts:1008

note?

readonly

string

statements/statements.ts:1009


CandidateOptions#

Defined in: statements/statements.ts:994

What withCandidate takes besides the pair.

Properties#

Property

Modifier

Type

Defined in

basis?

readonly

readonly string[]

statements/statements.ts:999

date

readonly

string

statements/statements.ts:996

match?

readonly

"exact" | "close" | "broad" | "narrow" | "related"

statements/statements.ts:1000

method

readonly

string

statements/statements.ts:997

note?

readonly

string

statements/statements.ts:1001

service?

readonly

string

statements/statements.ts:998

stated_by

readonly

readonly string[]

statements/statements.ts:995


Catalogue#

Defined in: statements/catalogue.ts:110

The catalogue as read.

Properties#

Property

Modifier

Type

Defined in

aliases

readonly

Readonly<Record<string, string>>

statements/catalogue.ts:112

prefixes

readonly

Readonly<Record<string, string>>

statements/catalogue.ts:111

systems

readonly

readonly CatalogueSystem[]

statements/catalogue.ts:113

types

readonly

readonly CatalogueType[]

statements/catalogue.ts:115

verbs

readonly

readonly CatalogueVerb[]

statements/catalogue.ts:114


CatalogueSystem#

Defined in: statements/catalogue.ts:83

An identifier system: its things, the prefixes of its vocabulary and its lookup.

Properties#

Property

Modifier

Type

Defined in

id

readonly

string

statements/catalogue.ts:84

lookup

readonly

Lookup

statements/catalogue.ts:88

name

readonly

string

statements/catalogue.ts:85

note?

readonly

string

statements/catalogue.ts:89

prefixes

readonly

readonly string[]

statements/catalogue.ts:86

things

readonly

readonly CatalogueThing[]

statements/catalogue.ts:87


CatalogueThing#

Defined in: statements/catalogue.ts:58

A kind of thing an identifier system names, and the URLs that address one.

Properties#

Property

Modifier

Type

Description

Defined in

id

readonly

string

-

statements/catalogue.ts:59

iri

readonly

string | null

The template of the thing’s IRIs, holding {value}, or null where it mints none.

statements/catalogue.ts:63

kind

readonly

string

-

statements/catalogue.ts:60

lowercase

readonly

boolean

Whether values are written in lower case: the letters A to Z are lowered.

statements/catalogue.ts:70

lrmoo_class

readonly

string | null

The LRMoo class of every such thing, or null where the address does not tell.

statements/catalogue.ts:68

name

readonly

string

-

statements/catalogue.ts:61

note?

readonly

string

-

statements/catalogue.ts:73

patterns

readonly

readonly string[]

Regular expressions, each matching a whole URL and capturing the value in its one group.

statements/catalogue.ts:72

prefix?

readonly

string

The prefix the thing’s IRIs are written with.

statements/catalogue.ts:65

scheme_uri

readonly

string | null

-

statements/catalogue.ts:66


CatalogueType#

Defined in: statements/catalogue.ts:101

A type of thing: its “is a” alternatives per system, its usual verbs, its lookup systems.

Properties#

Property

Modifier

Type

Defined in

id

readonly

string

statements/catalogue.ts:102

is_a

readonly

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

statements/catalogue.ts:104

label

readonly

string

statements/catalogue.ts:103

lookup

readonly

readonly string[]

statements/catalogue.ts:106

verbs

readonly

readonly string[]

statements/catalogue.ts:105


CatalogueVerb#

Defined in: statements/catalogue.ts:93

A verb: its label, and its pattern alternatives per system.

Properties#

Property

Modifier

Type

Defined in

id

readonly

string

statements/catalogue.ts:94

inverse_label?

readonly

string

statements/catalogue.ts:96

label

readonly

string

statements/catalogue.ts:95

patterns

readonly

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

statements/catalogue.ts:97


DumpsOptions#

Defined in: serialization/write.ts:178

Options of dumps.

Properties#

Property

Modifier

Type

Description

Defined in

serialization?

readonly

Serialization

The serialization to write: "yaml" (the default), "json" or "jcs".

serialization/write.ts:180


FileForm#

Defined in: files.ts:18

How a manifest file writes its manifest.

Properties#

Property

Modifier

Type

Description

Defined in

minimal

readonly

boolean

Whether the manifest is in the minimal form rather than the complete form.

files.ts:20

serialization

readonly

Serialization

"yaml" (canonical YAML), "json" (pretty JSON) or "jcs" (RFC 8785 JSON).

files.ts:24

styling

readonly

boolean

Whether the manifest’s graphical object is written.

files.ts:22


FontMetrics#

Defined in: font.ts:30

The advance-width metrics that measure a drawing’s text, in DejaVu Sans’s font units.

Properties#

Property

Modifier

Type

Description

Defined in

advances

readonly

Readonly<Record<string, number>>

The advance of every measured code point, keyed by the code point in decimal: every code point DejaVu Sans maps, and every code point Noto Music maps and DejaVu Sans does not, scaled to DejaVu Sans’s units per em and rounded to the nearest integer, ties to even.

font.ts:43

ascender

readonly

number

-

font.ts:32

descender

readonly

number

The descender as a positive depth.

font.ts:34

fallback

readonly

number

The advance of glyph 0, counted for a code point the table does not hold.

font.ts:36

units_per_em

readonly

number

-

font.ts:31


InstantiateOptions#

Defined in: statements/catalogue.ts:385

What instantiate takes besides the verb, the system and the value.

Properties#

Property

Modifier

Type

Description

Defined in

alternative?

readonly

number

The index of the alternative in the system, 0 by default.

statements/catalogue.ts:387

label?

readonly

string

The label every thing slot is given.

statements/catalogue.ts:389

slots?

readonly

Readonly<Record<string, unknown>>

The values of the named slots, by name without ?.

statements/catalogue.ts:391


Lookup#

Defined in: statements/catalogue.ts:77

How a system’s things are looked up.

Indexable#

[key: string]: unknown

Properties#

Property

Modifier

Type

Defined in

route

readonly

"none" | "browser" | "server" | "cross_reference" | "database"

statements/catalogue.ts:78


ManifestWarning#

Defined in: validate/statements.ts:352

One warning of a valid manifest.

Properties#

Property

Modifier

Type

Defined in

code

readonly

WarningCode

validate/statements.ts:353

message

readonly

string

validate/statements.ts:355

path

readonly

readonly PathSegment[]

validate/statements.ts:354


PairOptions#

Defined in: statements/statements.ts:986

What withPair takes besides the pair.

Properties#

Property

Modifier

Type

Description

Defined in

actor?

readonly

string

The person stating the pair, recorded as believing it true on date.

statements/statements.ts:989

date?

readonly

string

-

statements/statements.ts:990

provenance?

readonly

PairProvenance

-

statements/statements.ts:987


PairProvenance#

Defined in: statements/statements.ts:975

What withPair sets on the pair’s entry: an entry’s keys but its pair and its beliefs.

Properties#

Property

Modifier

Type

Defined in

basis?

readonly

readonly string[]

statements/statements.ts:980

date?

readonly

string

statements/statements.ts:977

match?

readonly

"exact" | "close" | "broad" | "narrow" | "related"

statements/statements.ts:981

method?

readonly

string

statements/statements.ts:978

note?

readonly

string

statements/statements.ts:982

service?

readonly

string

statements/statements.ts:979

stated_by?

readonly

readonly string[]

statements/statements.ts:976


Rational#

Defined in: numbers/exact.ts:14

An exact rational number in lowest terms with a positive denominator.

Properties#

Property

Modifier

Type

Defined in

denominator

readonly

bigint

numbers/exact.ts:16

numerator

readonly

bigint

numbers/exact.ts:15


Recognition#

Defined in: statements/catalogue.ts:119

What a URL addresses: the system, the thing, the value and the thing’s IRI or null.

Properties#

Property

Modifier

Type

Defined in

iri

readonly

string | null

statements/catalogue.ts:123

system

readonly

string

statements/catalogue.ts:120

thing

readonly

string

statements/catalogue.ts:121

value

readonly

string

statements/catalogue.ts:122


Rectangle#

Defined in: statements/catalogue.ts:132

One verb about one thing: the pairs of a subject that state it, in file order, in as many vocabularies as they use; the expanded IRIs of the things they name, in first-seen order; and the first label among them. A pair no verb reads stands alone with verb null.

Properties#

Property

Modifier

Type

Defined in

inverse

readonly

boolean

statements/catalogue.ts:134

label

readonly

string | null

statements/catalogue.ts:137

pairs

readonly

readonly Pair[]

statements/catalogue.ts:135

things

readonly

readonly string[]

statements/catalogue.ts:136

verb

readonly

string | null

statements/catalogue.ts:133


SubjectElement#

Defined in: statements/statements.ts:264

An element that may carry statements, with its path and what it is.

Properties#

Property

Modifier

Type

Defined in

element

readonly

JsonObject

statements/statements.ts:265

kind

readonly

"timeline" | "region" | "manifest"

statements/statements.ts:267

path

readonly

readonly PathSegment[]

statements/statements.ts:266


UnitEntry#

Defined in: manifest/units.ts:11

One row of the unit table.

Properties#

Property

Modifier

Type

Description

Defined in

domain

readonly

"graphical" | "logical" | "physical"

logical (musical time), physical (real time) or graphical (space).

manifest/units.ts:13

modality

readonly

"continuous" | "discrete"

-

manifest/units.ts:14

numberType

readonly

NumberType

The default number type of an axis declaring none.

manifest/units.ts:16

numberTypes

readonly

readonly NumberType[]

The number types the unit admits, in the order int, float, fraction.

manifest/units.ts:18


UnknownKey#

Defined in: validate.ts:71

A key the schema does not declare on the object at path.

Properties#

Property

Modifier

Type

Defined in

key

readonly

string

validate.ts:73

path

readonly

readonly PathSegment[]

validate.ts:72

Type Aliases#

Belief#

type Belief = typeof BELIEFS[number];

Defined in: statements/statements.ts:165

An actor’s belief in an item.


BeliefState#

type BeliefState = "true" | "undecided" | "unlikely" | "false";

Defined in: statements/statements.ts:98

An item’s state for one actor: the actor’s belief in it, or "undecided" where the actor holds none.


Json#

type Json = 
  | null
  | boolean
  | number
  | string
  | Json[]
  | {
[key: string]: Json;
};

Defined in: json/value.ts:36

Any JSON value, as JSON.parse returns it.


JsonNumber#

type JsonNumber = number | bigint | JsonFloat;

Defined in: json/value.ts:33

A number as loads reads it: a number (a safe integer, or a float with a fractional part), a bigint (an integer beyond Number.MAX_SAFE_INTEGER), or a JsonFloat (an integral float).


Lossless#

type Lossless<T> = T extends number ? JsonNumber : T extends readonly unknown[] ? number extends T["length"] ? T extends unknown[] ? Lossless<T[number]>[] : readonly Lossless<T[number]>[] : { [Index in keyof T]: Lossless<T[Index]> } : T extends object ? { [Key in keyof T]: Lossless<T[Key]> } : T;

Defined in: json/value.ts:43

The type T with every number as loads reads it. Arrays map element by element and tuples stay tuples, so a [numerator, denominator] Fraction is a pair of JsonNumbers.

Type Parameters#

Type Parameter

T


Pair#

type Pair = readonly [property: string, value: unknown];

Defined in: statements/statements.ts:186

One pair of a subject: its property as written and one value.


PathSegment#

type PathSegment = string | number;

Defined in: validate/diagnostics.ts:16

One step of a path into a value: an object key or an array index.


Serialization#

type Serialization = "yaml" | "json" | "jcs";

Defined in: serialization/write.ts:28

The name of a serialization: canonical YAML, pretty JSON or RFC 8785 JSON.


Subject#

type Subject = readonly PathSegment[];

Defined in: statements/statements.ts:183

A subject’s path in the manifest: [] the manifest, else an element or a value node.


ValidationCode#

type ValidationCode = 
  | "not_a_manifest"
  | "schema"
  | "representation"
  | "duplicate_id"
  | "dangling_target"
  | "flow_control_form"
  | "flow_coordinate"
  | "jump_repeated"
  | "jump_destination"
  | "flow_map_timeline"
  | "flow_map_chunk"
  | "flow_map_canonical"
  | "virtual_timeline"
  | "flow_rule"
  | "conversion_map"
  | "child_unit"
  | "child_offset"
  | "child_end"
  | "segment_line"
  | "group_member"
  | "manifest_id"
  | "order_key"
  | "display_order"
  | "band_order"
  | "timestamp_timeline"
  | "timestamp_coordinate"
  | "groupstamp"
  | "elision_timeline"
  | "elision_stretch"
  | "match_timestamp"
  | "alignment_anchor"
  | "matchstamp"
  | "resource_timeline"
  | "resource_type"
  | "calendar_date"
  | "finite_number"
  | "context"
  | "reserved_key"
  | "iri"
  | "element_value"
  | "provenance_duplicate"
  | "belief_actor";

Defined in: validate/diagnostics.ts:19

A stable machine-readable schema or semantic rule identifier.


WarningCode#

type WarningCode = 
  | "context_absent"
  | "bundle_blank"
  | "manifestation_unknown"
  | "convention_unknown"
  | "flow_conflict";

Defined in: validate/statements.ts:344

What a manifest is warned of, never refused for.

Variables#

ANCHOR_DISPLAY#

const ANCHOR_DISPLAY: readonly ["line", "name"];

Defined in: manifest/order.ts:39

The words of an alignment anchor’s display, in canonical order.


ATOMIC_SECTION#

const ATOMIC_SECTION: "https://timetoalign.github.io/timetoshare/ns#AtomicSection";

Defined in: statements/statements.ts:38

The class of an atomic section of a timeline’s flow: the type a region states that is one, written as a compact IRI under a prefix the manifest’s context declares for NAMESPACE (tts:AtomicSection).


BELIEF_STATES#

const BELIEF_STATES: readonly BeliefState[];

Defined in: statements/statements.ts:101

The four states of the belief filter, in that order.


BELIEFS#

const BELIEFS: readonly ["true", "false", "unlikely"];

Defined in: statements/statements.ts:92

The beliefs an actor may hold in an item, strings in the schema’s order.


BLANK#

const BLANK: "[\\u0000-\\u0020\\u007f-\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]" = "[\\u0000-\\u0020\\u007f-\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]";

Defined in: statements/statements.ts:172

White space and control characters, which no IRI holds: the class the schema’s Iri, IriReference and PrefixIri refuse, written out because Python’s \s and JavaScript’s \s differ.


CHUNK_SENTINEL#

const CHUNK_SENTINEL: "CHUNK_SENTINEL" = "CHUNK_SENTINEL";

Defined in: ids.ts:52

The event ID of a CHUNK side in a MatchClaim table: a synchronous MatchClaim states a coordinate on this timeline, which holds no event for it; the coordinate is the anchor’s on this side. It is no event, and no element has it as its ID. Python’s timetoshare.tables.CHUNK_SENTINEL is the same string.


DEFAULT_BELIEFS#

const DEFAULT_BELIEFS: readonly BeliefState[];

Defined in: statements/statements.ts:109

The states the belief filter keeps by default: every state but "false".


DEFAULTS#

const DEFAULTS: object;

Defined in: defaults.ts:41

The default of every key that has one, by the kind of object holding it. A timeline’s number_type defaults to its unit’s default number type, which the unit table UNITS states. Every conversion map has the keys of conversion_map; a LinearMap adds those of linear_map and a TableMap those of table_map. Every flow-control element has the keys of flow_control_element and every destination of a jump those of jump_destination; a destination’s repeat_count has no default, its absence meaning no limit. Every FlowMap has the keys of flow_map and every virtual timeline those of virtual_timeline; the manifest’s flow_maps and virtual_timelines have no default and are never added. Every named timestamp of graphical.timestamps has the keys of timestamp, a match timestamp (matchstamp: true) those of match_timestamp instead, and every alignment anchor of a named MatchStamp those of alignment_anchor, and every elision of graphical.elisions those of elision (its width has none). A resource has no defaults. @context, statements and provenance have no default and are never added or removed. Python’s timetoshare.defaults holds the same table, and the schema declares each value as the key’s default.

Type Declaration#

Name

Type

Default value

Defined in

alignment_anchor

object

-

defaults.ts:73

alignment_anchor.display

readonly ["line"]

-

defaults.ts:73

conversion_map

object

-

defaults.ts:58

conversion_map.name

null

null

defaults.ts:58

elision

object

-

defaults.ts:74

elision.display

readonly ["ellipsis", "name"]

-

defaults.ts:74

flow_control_element

object

-

defaults.ts:54

flow_control_element.label

null

null

defaults.ts:54

flow_control_element.meta

object

{}

defaults.ts:54

flow_control_element.name

null

null

defaults.ts:54

flow_map

object

-

defaults.ts:56

flow_map.canonical

false

false

defaults.ts:56

flow_map.name

null

null

defaults.ts:56

graphical

object

-

defaults.ts:63

graphical.elisions

readonly []

[]

defaults.ts:69

graphical.matchstamps

readonly []

[]

defaults.ts:68

graphical.order

object

{}

defaults.ts:66

graphical.rules

readonly []

[]

defaults.ts:65

graphical.styles

object

{}

defaults.ts:64

graphical.timestamps

readonly []

[]

defaults.ts:67

group

object

-

defaults.ts:62

group.meta

object

{}

defaults.ts:62

group.name

null

null

defaults.ts:62

jump_destination

object

-

defaults.ts:55

jump_destination.determined

true

true

defaults.ts:55

jump_destination.label

null

null

defaults.ts:55

jump_destination.reset

true

true

defaults.ts:55

linear_map

object

-

defaults.ts:59

linear_map.offset

0

0

defaults.ts:59

linear_map.scalar

1

1

defaults.ts:59

manifest

object

-

defaults.ts:42

manifest.groups

readonly []

[]

defaults.ts:42

manifest.measure_maps

readonly []

[]

defaults.ts:42

manifest.meta

object

{}

defaults.ts:42

manifest.name

null

null

defaults.ts:42

manifest.resources

readonly []

[]

defaults.ts:42

match_timestamp

object

-

defaults.ts:72

match_timestamp.display

readonly ["cross_section"]

-

defaults.ts:72

match_timestamp.groupstamp

false

false

defaults.ts:72

measure_map

object

-

defaults.ts:61

measure_map.meta

object

{}

defaults.ts:61

measure_map.name

null

null

defaults.ts:61

region

object

-

defaults.ts:53

region.meta

object

{}

defaults.ts:53

region.name

null

null

defaults.ts:53

table_map

object

-

defaults.ts:60

table_map.extrapolate

"none"

"none"

defaults.ts:60

table_map.kind

"linear"

"linear"

defaults.ts:60

timeline

object

-

defaults.ts:43

timeline.children

readonly []

[]

defaults.ts:48

timeline.conversion_maps

readonly []

[]

defaults.ts:49

timeline.flow_control

readonly []

[]

defaults.ts:51

timeline.is_segment_line

false

false

defaults.ts:46

timeline.locked

false

false

defaults.ts:45

timeline.meta

object

{}

defaults.ts:47

timeline.name

null

null

defaults.ts:44

timeline.regions

readonly []

[]

defaults.ts:50

timestamp

object

-

defaults.ts:71

timestamp.display

readonly ["wedge", "name", "cross_section"]

-

defaults.ts:71

timestamp.groupstamp

false

false

defaults.ts:71

timestamp.matchstamp

false

false

defaults.ts:71

virtual_timeline

object

-

defaults.ts:57

virtual_timeline.name

null

null

defaults.ts:57


ELISION_DISPLAY#

const ELISION_DISPLAY: readonly ["ellipsis", "name", "id", "coordinate", "continuation"];

Defined in: manifest/order.ts:42

The words of an elision’s display, in canonical order.


FONT_FILES#

const FONT_FILES: readonly ["DejaVuSans.ttf", "NotoMusic-Regular.ttf"];

Defined in: font.ts:24

The bundled TrueType files in fallback order: the text font, DejaVu Sans 2.37, then the music font, Noto Music 2.004, which draws what DejaVu Sans does not map.


FORMAT_CONTEXT#

const FORMAT_CONTEXT: Readonly<{
  "@version": 1.1;
  actor: Readonly<{
     "@id": "https://timetoalign.github.io/timetoshare/ns#actor";
     "@type": "@id";
  }>;
  basis: Readonly<{
     "@id": "http://www.w3.org/ns/prov#hadPrimarySource";
     "@type": "@id";
  }>;
  belief: Readonly<{
     "@id": "https://timetoalign.github.io/timetoshare/ns#belief";
     "@type": "@vocab";
  }>;
  beliefs: "https://timetoalign.github.io/timetoshare/ns#beliefs";
  broad: "http://www.w3.org/2004/02/skos/core#broadMatch";
  children: "@included";
  close: "http://www.w3.org/2004/02/skos/core#closeMatch";
  date: Readonly<{
     "@id": "http://purl.org/dc/terms/date";
     "@type": "http://www.w3.org/2001/XMLSchema#date";
  }>;
  exact: "http://www.w3.org/2004/02/skos/core#exactMatch";
  false: "https://timetoalign.github.io/timetoshare/ns#False";
  groups: "@included";
  id: "@id";
  imported: "https://timetoalign.github.io/timetoshare/ns#Imported";
  inferred: "https://timetoalign.github.io/timetoshare/ns#Inferred";
  label: "http://www.w3.org/2000/01/rdf-schema#label";
  list: "@list";
  manual: "https://timetoalign.github.io/timetoshare/ns#Manual";
  match: Readonly<{
     "@id": "https://timetoalign.github.io/timetoshare/ns#match";
     "@type": "@vocab";
  }>;
  method: Readonly<{
     "@id": "https://timetoalign.github.io/timetoshare/ns#method";
     "@type": "@vocab";
  }>;
  narrow: "http://www.w3.org/2004/02/skos/core#narrowMatch";
  note: "http://www.w3.org/2000/01/rdf-schema#comment";
  property: Readonly<{
     "@id": "http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate";
     "@type": "@vocab";
  }>;
  provenance: Readonly<{
     "@reverse": "http://www.w3.org/1999/02/22-rdf-syntax-ns#subject";
  }>;
  reconciled: "https://timetoalign.github.io/timetoshare/ns#Reconciled";
  regions: "@included";
  related: "http://www.w3.org/2004/02/skos/core#relatedMatch";
  service: Readonly<{
     "@id": "https://timetoalign.github.io/timetoshare/ns#service";
     "@type": "@id";
  }>;
  stated_by: Readonly<{
     "@id": "http://www.w3.org/ns/prov#wasAttributedTo";
     "@type": "@id";
  }>;
  statements: "@nest";
  timelines: "@included";
  true: "https://timetoalign.github.io/timetoshare/ns#True";
  type: "@type";
  unlikely: "https://timetoalign.github.io/timetoshare/ns#Unlikely";
  value: "http://www.w3.org/1999/02/22-rdf-syntax-ns#object";
}>;

Defined in: statements/statements.ts:50

The format’s terms of the inline JSON-LD context, each as the schema’s Context fixes it. A manifest’s @context holds exactly these and the prefixes its statements and provenance use.


MATCHES#

const MATCHES: readonly ["exact", "close", "broad", "narrow", "related"];

Defined in: statements/statements.ts:162

The words of a provenance entry’s match, in the schema’s order.


METHODS#

const METHODS: readonly ["manual", "reconciled", "imported", "inferred"];

Defined in: statements/statements.ts:159

The words of a provenance entry’s method, in the schema’s order; any other method is an IRI.


NAMESPACE#

const NAMESPACE: "https://timetoalign.github.io/timetoshare/ns#" = "https://timetoalign.github.io/timetoshare/ns#";

Defined in: statements/statements.ts:31

The namespace of the format’s own terms: method, service, match, the beliefs and their words.


NOMATCH_SENTINEL#

const NOMATCH_SENTINEL: "NOMATCH_SENTINEL" = "NOMATCH_SENTINEL";

Defined in: ids.ts:43

The event ID of a NOMATCH side in a MatchClaim table: a MatchClaim that is not synchronous states that the event of its other side has no counterpart on this timeline. It is no event, holds no anchor, and no element has it as its ID. Python’s timetoshare.tables.NOMATCH_SENTINEL is the same string.


SCHEMA_VERSION#

const SCHEMA_VERSION: "0.2.0" = "0.2.0";

Defined in: validate.ts:55

The schema version this package reads and writes, the only one it supports.


SERIALIZATIONS#

const SERIALIZATIONS: readonly Serialization[];

Defined in: serialization/write.ts:31

Every serialization’s name: canonical YAML, pretty JSON and RFC 8785 JSON.


TIMESTAMP_DISPLAY#

const TIMESTAMP_DISPLAY: readonly ["wedge", "name", "id", "coordinate", "cross_section"];

Defined in: manifest/order.ts:36

The words of a named timestamp’s display, in canonical order.


UNITS#

const UNITS: Readonly<Record<TimeUnit, UnitEntry>>;

Defined in: manifest/units.ts:34

The unit table, keyed by unit in the schema’s order of TimeUnit.

Functions#

candidates()#

function candidates(
   manifest, 
   subject, 
   actor?
): JsonObject[];

Defined in: statements/statements.ts:962

The candidates of a subject: the entries of pairs the subject does not state. Given actor, a candidate the actor believes false is left out: it is not offered to that actor again. Actors compare as their IRIs.

Parameters#

Parameter

Type

manifest

unknown

subject

Subject

actor?

string

Returns#

JsonObject[]

Throws#

if the path addresses no element and no value node.


canonicalManifest()#

function canonicalManifest<T>(value): T;

Defined in: forms.ts:26

A manifest with every array whose order carries no meaning in canonical order.

Type Parameters#

Type Parameter

T extends object

Parameters#

Parameter

Type

value

T

Returns#

T


canonicalOrder()#

function canonicalOrder<T>(value): T;

Defined in: manifest/order.ts:211

Return a deep copy of value, its manifest in canonical order and spelling.

A value with a top-level timelines array is a manifest: its own-axis values are respelled as their number type selects (./spelling.ts), every timeline in it is ordered at every depth and the array itself by id, its groups by id, each with its members by code point, its measure_maps by id, its resources, flow_maps and virtual_timelines by id, its graphical.timestamps by timeline, then coordinate, then id, each with its display in canonical order, and its graphical.matchstamps by id, each with its alignment_anchors by id and every anchor’s display in canonical order, and its graphical.elisions by timeline, then start, then id, each with its display in canonical order. Entries that tie keep their given order, and a member that should hold an ordered array but holds no array is left as it is. Object keys are left as they are (the writers sort them), and any other JSON value is copied unchanged. Python’s timetoshare.canonical_order gives the same value.

Type Parameters#

Type Parameter

T

Parameters#

Parameter

Type

value

T

Returns#

T

Throws#

if an entry of an ordered array of objects is not an object, lacks a member it is ordered by or holds it in a wrong type, or an entry of a group’s members is not a string.


checkBeliefFilter()#

function checkBeliefFilter(beliefs): ReadonlySet<BeliefState>;

Defined in: statements/statements.ts:125

The states a belief filter keeps, checked: a collection of BELIEF_STATES in any order; empty keeps none.

Parameters#

Parameter

Type

beliefs

unknown

Returns#

ReadonlySet<BeliefState>

Throws#

Error when beliefs is a single string or no iterable collection (null, undefined, a plain object, a Map), or names a word that is none of BELIEF_STATES. The first unknown member by code point of its spelling is named: a string quoted, any other member spelled as messages spell values, without quotes. The messages are Python’s.


childEnds()#

function childEnds(timeline): (Rational | null)[];

Defined in: validate/containment.ts:79

Where each child ends on its parent’s axis, as an exact rational.

A child’s end is its offset plus its length. Where the timeline and the child both have number type float, the two JSON numbers are summed in IEEE double arithmetic, as a reader adds them, so the end may differ from the exact sum by a rounding. In every other case (int, fraction, mixed number types, a value with no double such as a Fraction pair or an integer beyond the range of doubles, or a double sum that overflows) the sum is exact. A child with no length, or on another unit than its parent, has end null, except a child of a segment line without a length, whose end is the offset of the next child in offset order.

Parameters#

Parameter

Type

timeline

JsonObject

Returns#

(Rational | null)[]


compactIri()#

function compactIri(
   prefixes, 
   iri, 
   aliases?
): string;

Defined in: statements/statements.ts:579

iri written name:rest with one of prefixes, or as given. Where a namespace of aliases (the first in its order) begins iri, it is first replaced by the namespace it is read as. Among the prefixes whose namespace begins the IRI so read and leaves a rest of letters, digits, _, . and - that does not begin with . or -, the longest namespace (in code points) wins, a tie going to the code-point-smaller name. Without such a prefix the IRI is returned as given, no alias applied. Python’s compact_iri gives the same texts.

Parameters#

Parameter

Type

prefixes

Readonly<Record<string, string>>

iri

string

aliases?

Readonly<Record<string, string>>

Returns#

string


compactJson()#

function compactJson(value): string;

Defined in: serialization/text.ts:259

The compact JSON text of a value: no whitespace, every object’s keys in their own order (the written order for a value read by loads), numbers spelled as canonical YAML and pretty JSON spell them, strings as JSON writes them. A utility, not a serialization of the format: loads reads it back to an equal value.

Parameters#

Parameter

Type

value

unknown

Returns#

string

Throws#

for a non-finite number or a string with a lone surrogate.

Throws#

for a value that is not JSON.


compactSortedJson()#

function compactSortedJson(value): string;

Defined in: serialization/text.ts:275

The compact JSON text of a value with every object’s keys sorted by code point at every depth: no whitespace, numbers spelled as canonical YAML and pretty JSON spell them (an integer apart from a float, 2 apart from 2.0), strings as JSON writes them. Arrays keep their order, a manifest’s included, and an integer beyond 2^53 is written, as RFC 8785 JSON would not. Two values that loads reads alike, whatever the order of their keys, give the same text.

Parameters#

Parameter

Type

value

unknown

Returns#

string

Throws#

for a non-finite number or a string with a lone surrogate.

Throws#

for a value that is not JSON.


complete()#

@timetoalign/timetoshare: the TimeToShare schema, generated types, a validator, the complete and minimal forms, reading and writing in three serializations (canonical YAML, pretty JSON and RFC 8785 JSON), and the fonts that draw a drawing’s text with the table that measures it.

A TimeToShare manifest is one JSON object holding the version marker timetoshare and an array of root timelines, each describing a musical timeline as timetoalign serializes it, optionally named, optionally attributing timelines to groups, optionally describing the manifest, its timelines and its regions by property–value statements with their provenance (the catalogue of identifier systems, verbs and types guiding tools that write them) and optionally styled for drawing. A manifest carrying statements is a YAML-LD document through its inline @context. An editor can place many manifests on a canvas, but a manifest knows nothing about where or how often it is placed.

Call Signature#

function complete(value): CompleteManifest;

Defined in: defaults.ts:202

Return a copy of a manifest in the complete form: every key with a default that is absent is added with its default, at every depth (a timeline’s number_type is its unit’s default). Keys whose default is “absent” are never added, present keys keep their values, spelled as their number type selects (as canonicalOrder spells them), the display of a named timestamp, an alignment anchor and an elision in canonical order, and unknown keys pass through. Any other value is copied, its manifest-shaped parts completed, so a graphical object alone completes as complete({ graphical }).graphical. Python’s timetoshare.complete gives the same value.

Parameters#

Parameter

Type

value

{ }

Returns#

CompleteManifest

Call Signature#

function complete<T>(value): T;

Defined in: defaults.ts:204

Return a copy of any other value, its manifest-shaped parts completed.

Type Parameters#

Type Parameter

T

Parameters#

Parameter

Type

value

T

Returns#

T


completeManifest()#

function completeManifest(value): CompleteManifest;

Defined in: forms.ts:16

The complete form of a manifest: every key with a default present, at every depth.

Parameters#

Parameter

Type

value

{ }

Returns#

CompleteManifest


completeStyles()#

function completeStyles(graphical): object;

Defined in: styles.ts:22

Return a copied graphical object with empty declarations for every missing style.

The copy keeps every number as loads read it: an integral float stays a JsonFloat.

Parameters#

Parameter

Type

graphical

Graphical

Returns#

object

Name

Type

Defined in

graphical

Graphical

styles.ts:23

missing

string[]

styles.ts:24


defaultCatalogue()#

function defaultCatalogue(): Catalogue;

Defined in: statements/catalogue.ts:294

The catalogue of the shipped file catalogue/catalogue.yaml.

Returns#

Catalogue


dumps()#

function dumps(value, options?): string;

Defined in: serialization/write.ts:204

Return the text of a manifest, or of any JSON value, in canonical YAML ("yaml", the default), pretty JSON ("json") or RFC 8785 JSON ("jcs"), as Python’s dumps writes it. A value whose timelines member is an array is a manifest: it is put in canonical order and its own-axis values respelled first. dumps writes the form it is given.

Numbers are read as loads reads them: a bigint and an integral plain number are integers (an integral plain number is the integer of its exact value, so -0 is 0), a JsonFloat and a plain number with a fractional part are floats.

Parameters#

Parameter

Type

value

unknown

options?

DumpsOptions

Returns#

string

Throws#

for a value the serialization refuses: a value nested deeper than 256 levels (checked first), a NaN or an infinity, a string or key with a lone surrogate, a key whose canonical YAML form is longer than 1024 UTF-16 code units, and in "jcs" an integer beyond ±(2^53 − 1) or an integral float of magnitude from 2^53 up to but excluding 10^21; and for an unknown serialization.

Throws#

for a manifest that cannot be put in canonical order, and for a value that is not JSON.


dumpsFile()#

function dumpsFile(value, form): string;

Defined in: files.ts:63

The text of a manifest as a file of the given form writes it: a top-level graphical left out unless form.styling, the rest in the minimal form if form.minimal, else in the complete form, in form.serialization. value is not changed.

Parameters#

Parameter

Type

value

unknown

form

FileForm

Returns#

string

Throws#

for a value the serialization refuses, or an unknown serialization.

Throws#

for a value that is not JSON.


entries()#

function entries(manifest, subject): JsonObject[];

Defined in: statements/statements.ts:939

The provenance entries of a subject, in their order.

Parameters#

Parameter

Type

manifest

unknown

subject

Subject

Returns#

JsonObject[]

Throws#

if the path addresses no element and no value node.


exactValue()#

function exactValue(value): Rational | null;

Defined in: numbers/exact.ts:74

The exact value of a bare Number, or null if the value is none: a JSON number, or a [numerator, denominator] pair of integers whose denominator is at least 1 (an integral float in the pair counts as the integer it equals, as in Python).

Parameters#

Parameter

Type

value

unknown

Returns#

Rational | null


expandIri()#

function expandIri(context, text): string | null;

Defined in: statements/statements.ts:233

The IRI text stands for under context (a manifest’s @context, or any object of prefixes), or null. type is rdf:type; another format term is the IRI it maps to; p:rest is itself where rest begins with //, the prefix’s namespace followed by rest where context declares p, and itself where p is info, mailto, tag or urn; anything else is null.

Parameters#

Parameter

Type

context

unknown

text

string

Returns#

string | null


fileForm()#

function fileForm(text): FileForm;

Defined in: files.ts:45

Read the form of a manifest file off its text. The manifest is minimal when its minimal form writes the same canonical YAML as the value the text holds: a key stated at its default makes a text not minimal, and the order canonical order sorts does not count. Defaults are recognized by exact value (a LinearMap’s scalar: 1.0 is the default 1) and own-axis values respelled by the declared number type on both sides, so an RFC 8785 JSON text, which writes an integral float as an integer, reads as the form it was written in. It holds its styling when it has a top-level graphical key; the serialization is the one serializationOf names. A text whose value states some defaults and leaves out others is not minimal. The value is not validated.

Parameters#

Parameter

Type

text

string

Returns#

FileForm

Throws#

for a text read as JSON that loads refuses.

Throws#

for a text read as YAML that loads refuses.

Throws#

for a value canonical YAML refuses, as dumps throws it.

Throws#

for a manifest that cannot be put in canonical order.


fromFileId()#

function fromFileId(text): string;

Defined in: ids.ts:190

The bare ID that a file’s #id text writes. Exactly one leading # is stripped: #x is x and ##x is #x.

Parameters#

Parameter

Type

text

string

Returns#

string

Throws#

a RangeError, if the text does not start with # or nothing follows it.


identityProblems()#

function identityProblems(value): SchemaValidationError[];

Defined in: validate.ts:488

Return every semantic violation in the long-established identity order. value is in the file form; the rules read its IDs bare.

Parameters#

Parameter

Type

value

| JsonObject | { }

Returns#

SchemaValidationError[]

Throws#

if an ID is not written in the file form.


instantiate()#

function instantiate(
   catalogue, 
   verb, 
   system, 
   value, 
   options?
): Pair[];

Defined in: statements/catalogue.ts:403

The pairs that state verb in system with value: the alternative’s pattern with {id: "?"} as {id: value} (and label after it where given), "?" as value and "?name" as slots[name]; its keys in code-point order, each type item a pair ["type", iri].

Parameters#

Parameter

Type

catalogue

Catalogue

verb

string

system

string

value

unknown

options?

InstantiateOptions

Returns#

Pair[]

Throws#

if the catalogue has no such verb, no or not that many alternatives in the system, or a named slot has no value.


isJsonFloat()#

function isJsonFloat(value): value is JsonFloat;

Defined in: json/value.ts:75

Whether a value is a JsonFloat, an integral float read by loads.

Parameters#

Parameter

Type

value

unknown

Returns#

value is JsonFloat


isJsonObject()#

function isJsonObject(value): value is JsonObject;

Defined in: json/value.ts:80

Whether a value is a JSON object (not an array, not a JsonFloat).

Parameters#

Parameter

Type

value

unknown

Returns#

value is JsonObject


isSerialization()#

function isSerialization(value): value is Serialization;

Defined in: serialization/write.ts:34

Whether a value names a serialization, one of SERIALIZATIONS.

Parameters#

Parameter

Type

value

unknown

Returns#

value is Serialization


jsonInteger()#

function jsonInteger(value): bigint | null;

Defined in: numbers/exact.ts:54

The integer a JSON number states, or null if it is none.

An integral float counts as the integer it equals, as in Python.

Parameters#

Parameter

Type

value

unknown

Returns#

bigint | null


jsonPointer()#

function jsonPointer(path): string;

Defined in: validate/diagnostics.ts:76

Render a path as a JSON pointer in URI fragment form (# for the root).

Parameters#

Parameter

Type

path

readonly PathSegment[]

Returns#

string


loads()#

function loads(text): Lossless<Json>;

Defined in: serialization/read.ts:22

Read a text in any serialization, JSON or YAML, after removing one U+FEFF at position 0, without losing a number or key order and without validating.

Parameters#

Parameter

Type

text

string

Returns#

Lossless<Json>

Throws#

for a text read as JSON that the reading rules refuse.

Throws#

for a text read as YAML that the reading rules refuse.

Throws#

for a finite float literal that rounds to an infinity.


manifestWarnings()#

function manifestWarnings(value): ManifestWarning[];

Defined in: validate.ts:381

Return the warnings of a valid manifest, sorted by path, then code: context_absent (no @context), bundle_blank (statements or provenance on a manifest without ID, whose subject is a blank node), manifestation_unknown (a manifestation the format does not define for its flow-control element or destination) and convention_unknown (a FlowMap’s convention that is none of the format’s). Validates value as validate does. Python’s manifest_warnings returns the same list.

Parameters#

Parameter

Type

value

unknown

Returns#

ManifestWarning[]


matchstampProblems()#

function matchstampProblems(value): SchemaValidationError[];

Defined in: validate.ts:548

Return the problems of the named MatchStamps and their match timestamps alone, as Python’s matchstamp_problems does. First, each match timestamp (a named timestamp with matchstamp: true) and then graphical.matchstamps, each checked as validate checks it, its first problem at its path: a number that is not finite (finite_number), else the schema (schema), reported by the one path rule. Where none has a problem, every problem beyond the schema follows, not only the first: an ID of a MatchStamp or an alignment anchor that the manifest holds twice (duplicate_id, or manifest_id where the manifest’s ID repeats one), then the rules of the MatchStamps and their match timestamps (alignment_anchor, matchstamp, groupstamp, match_timestamp), in identityProblems’ order.

Nothing else is refused: an ordinary timestamp, the styles and rules, the timelines and the statements are not read beyond what the MatchStamps name. A library that keeps the rest of graphical unread checks its MatchStamps with this function. The messages are those of validate. value is in the file form; the rules read its IDs bare, an ID written without # as it stands.

Parameters#

Parameter

Type

value

| JsonObject | { }

Returns#

SchemaValidationError[]


minimal()#

@timetoalign/timetoshare: the TimeToShare schema, generated types, a validator, the complete and minimal forms, reading and writing in three serializations (canonical YAML, pretty JSON and RFC 8785 JSON), and the fonts that draw a drawing’s text with the table that measures it.

A TimeToShare manifest is one JSON object holding the version marker timetoshare and an array of root timelines, each describing a musical timeline as timetoalign serializes it, optionally named, optionally attributing timelines to groups, optionally describing the manifest, its timelines and its regions by property–value statements with their provenance (the catalogue of identifier systems, verbs and types guiding tools that write them) and optionally styled for drawing. A manifest carrying statements is a YAML-LD document through its inline @context. An editor can place many manifests on a canvas, but a manifest knows nothing about where or how often it is placed.

Call Signature#

function minimal(value): object;

Defined in: defaults.ts:222

Return a copy of a manifest in the minimal form: the complete form without every key whose value equals its default in value, after own-axis values are respelled and each display put in canonical order (a LinearMap’s scalar: 1.0 and scalar: [1, 1] are left out like 1). minimal(complete(x)) equals minimal(x) and complete(minimal(x)) equals complete(x). Python’s timetoshare.minimal gives the same value.

Parameters#

Parameter

Type

value

{ }

Returns#

object

Call Signature#

function minimal<T>(value): T;

Defined in: defaults.ts:224

Return a copy of any other value, its manifest-shaped parts in the minimal form.

Type Parameters#

Type Parameter

T

Parameters#

Parameter

Type

value

T

Returns#

T


minimalManifest()#

function minimalManifest(value): object;

Defined in: forms.ts:21

The minimal form of a manifest: every key whose value is its default left out.

Parameters#

Parameter

Type

value

CompleteManifest

Returns#

object


numberTypeOf()#

function numberTypeOf(timeline): NumberType;

Defined in: validate/diagnostics.ts:280

The number type of a timeline’s axis: its own, or its unit’s default.

Parameters#

Parameter

Type

timeline

{ number_type?: NumberType; unit: TimeUnit; }

timeline.number_type?

NumberType

timeline.unit

TimeUnit

Returns#

NumberType


pairs()#

function pairs(manifest, subject): Pair[];

Defined in: statements/statements.ts:929

The pairs of a subject: its container’s keys in code-point order, each key’s values in list order, each type item a pair ["type", iri]; a node’s pairs are its own IRI keys and type.

Parameters#

Parameter

Type

manifest

unknown

subject

Subject

Returns#

Pair[]

Throws#

if the path addresses no element and no value node.


parse()#

function parse(text): object;

Defined in: validate.ts:397

Read a manifest in any serialization with loads and validate it: a manifest read without losing a number or key order.

Parameters#

Parameter

Type

text

string

Returns#

object


parseJson()#

function parseJson(text): Lossless<Json>;

Defined in: serialization/json.ts:246

Read a text as JSON, whatever its first character, after removing one U+FEFF at position 0, without losing a number or the order of a key.

Integers keep their exact value (a bigint beyond the safe range), floats stay floats (an integral float is a JsonFloat), and an object’s keys keep their written order even where JavaScript would list array-index keys first. The text -0 is the integer 0.

Parameters#

Parameter

Type

text

string

Returns#

Lossless<Json>

Throws#

if the text is not one JSON value, a key repeats in its object, a string or key holds a lone surrogate, or collections nest deeper than 256 levels.

Throws#

if a float rounds to an infinity.


parseYaml()#

function parseYaml(text): Lossless<Json>;

Defined in: serialization/yaml.ts:292

Read a text as YAML, whatever its first character, after removing one U+FEFF at position 0, without losing a number or the order of a key.

Parameters#

Parameter

Type

text

string

Returns#

Lossless<Json>

Throws#

for a text the reading rules refuse.


readCatalogue()#

function readCatalogue(document): Catalogue;

Defined in: statements/catalogue.ts:209

Read a catalogue document and check its cross-references, in this order: no system, thing, verb or type twice; every prefix used declared (the prefixes of the systems’ vocabularies, a thing’s prefix and LRMoo class, every pattern key, type item and id); every system, thing, verb and type named held; every thing’s URL patterns usable. Its shape is not checked here: the shipped file is checked against its schema by the tests. Python’s read_catalogue raises the same messages.

Parameters#

Parameter

Type

document

unknown

Returns#

Catalogue

Throws#

at the first problem.


recognize()#

function recognize(catalogue, url): Recognition | null;

Defined in: statements/catalogue.ts:352

Return what url addresses, or null: the first thing, system by system in catalogue order, one of whose patterns matches the whole URL. The captured value is written as the thing writes it (lowered where lowercase); a thing with an IRI template gives the IRI with the value substituted as written, one without gives a value percent-decoded as UTF-8 with underscores for spaces and no IRI. A URL that is no absolute URI is never recognised, nor one whose value is not percent-encoded UTF-8. Python’s recognize gives the same.

Parameters#

Parameter

Type

catalogue

Catalogue

url

string

Returns#

Recognition | null


rectangles()#

function rectangles(
   catalogue, 
   manifest, 
   subject
): Rectangle[];

Defined in: statements/catalogue.ts:641

The rectangles of a subject: its pairs, each read by verbOf, joined where they state the same verb the same way and are both “is a”, share a thing, or carry equal string labels on both value nodes (transitively); a pair no verb reads stands alone. The “is a” rectangle comes first, empty where nothing is stated; then the others in the order of their first pair. A rectangle’s pairs keep file order, its things first-seen order, its label is the first node label among its pairs.

Parameters#

Parameter

Type

catalogue

Catalogue

manifest

unknown

subject

readonly PathSegment[]

Returns#

Rectangle[]

Throws#

if the path addresses no element and no value node.


samePair()#

function samePair(
   context, 
   left, 
   right
): boolean;

Defined in: statements/statements.ts:904

Whether two pairs are the same pair under context: their properties expand to the same IRI (type is rdf:type) and their values are equal. Literals are equal with the same JSON type (true is not 1); value objects after expanding @type; a node with id equals any node with the same expanded id, its other keys ignored, and a type item T counts as {id: T}; nodes without id equal as JSON once their top-level provenance is dropped; lists item by item. A relative reference compares as written.

Parameters#

Parameter

Type

context

unknown

left

Pair

right

Pair

Returns#

boolean


serializationOf()#

function serializationOf(text): Serialization;

Defined in: serialization/read.ts:34

Name a text’s serialization without validating it: "jcs" when it is read as JSON and is byte for byte the RFC 8785 JSON of its value, "json" for every other text read as JSON (one that cannot be read, one whose value the RFC 8785 writer refuses, and one after a byte order mark included), and "yaml" for every other text. Never throws.

Parameters#

Parameter

Type

text

string

Returns#

Serialization


statementProblems()#

function statementProblems(value): SchemaValidationError[];

Defined in: validate.ts:465

Return the problems of the statements of value alone, as Python’s statement_problems does. First, member by member, the manifest’s @context and every provenance and statements member (subject order: the manifest, then root by root the timeline, its regions and its children, depth first; on one element provenance first), each checked as validate checks it, its first problem at its path: a number that is not finite (finite_number), else the schema’s definition of the member (schema), reported by the one path rule. Where no member has a problem, every problem of the statement rules follows, not only the first: context, reserved_key, then the walk of every subject (iri, dangling_target, calendar_date, representation, element_value, provenance_duplicate, belief_actor).

Nothing outside the statements is refused but a reserved key, and the version marker is not read: a library that reads only part of a manifest checks its statements with this function. The messages are those of validate. value is in the file form; the rules read its IDs bare, an ID written without # as it stands.

Parameters#

Parameter

Type

value

| JsonObject | { }

Returns#

SchemaValidationError[]


subjectPath()#

function subjectPath(manifest, elementId): PathSegment[];

Defined in: statements/statements.ts:740

The path of the subject an element ID names: [] for null, the bundle; else the timeline (at any depth) or region whose id equals elementId as written in this manifest (#clt_1 in the file form, clt_1 bare).

Parameters#

Parameter

Type

manifest

unknown

elementId

string | null

Returns#

PathSegment[]

Throws#

if no timeline or region has the ID.


subjects()#

function subjects(manifest): Generator<SubjectElement>;

Defined in: statements/statements.ts:290

Every element that may carry statements, in subject order: the manifest, then root by root the timeline, its regions in array order and its children, depth first. Any value is read; what is no object is passed over.

Parameters#

Parameter

Type

manifest

unknown

Returns#

Generator<SubjectElement>


toFileId()#

function toFileId(id): string;

Defined in: ids.ts:167

The file form of a bare ID: # followed by the ID.

Parameters#

Parameter

Type

id

string

Returns#

string


unknownKeys()#

function unknownKeys(value): UnknownKey[];

Defined in: validate.ts:367

Return the sorted unknown keys of a valid manifest.

Parameters#

Parameter

Type

value

unknown

Returns#

UnknownKey[]


usedPrefixes()#

function usedPrefixes(manifest): string[];

Defined in: statements/statements.ts:522

The names of the prefixes a manifest’s statements and provenance use, sorted: the p of every p:rest at an IRI position of every subject (rest not beginning with //, p none of info, mailto, tag and urn; a relative reference and a method word use none). Python’s used_prefixes gives the same list.

Parameters#

Parameter

Type

manifest

unknown

Returns#

string[]


validate()#

function validate(value): asserts value is {};

Defined in: validate.ts:362

Check that value is a TimeToShare manifest. A checked value is typed as the lossless form loads returns: its numbers may be bigints and JsonFloats, and a Fraction is a pair of them.

Parameters#

Parameter

Type

value

unknown

Returns#

asserts value is {}


verbOf()#

function verbOf(
   catalogue, 
   context, 
   property, 
   value
): [verb: string, inverse: boolean] | null;

Defined in: statements/catalogue.ts:621

The verb a pair states and whether it is the verb’s inverse reading, or null: among the alternatives whose key expands (aliases applied) to the property’s IRI (type and an expanded rdf:type alike) and whose template matches the value, the one with most constants, ties to the first in catalogue order. context is the manifest’s @context.

Parameters#

Parameter

Type

catalogue

Catalogue

context

unknown

property

string

value

unknown

Returns#

[verb: string, inverse: boolean] | null


withBareIds()#

function withBareIds<T>(manifest): T;

Defined in: ids.ts:316

The manifest with every ID bare, read from its file form #id. A timeline’s entry in graphical.order holds band words, which stay as they are.

Type Parameters#

Type Parameter

T

Parameters#

Parameter

Type

manifest

T

Returns#

T

Throws#

a RangeError with the path of the first text that is not an ID in the file form.


withBelief()#

function withBelief<T>(
   manifest, 
   subject, 
   property, 
   value, 
   options
): T;

Defined in: statements/statements.ts:1273

Return the manifest with an actor’s belief in a pair of the subject: one of the strings "true", "false" and "unlikely" (BELIEFS). The pair’s entry, appended with the pair alone where it has none, records {actor, belief, date} (and note where given), replacing in place the actor’s earlier belief; actors compare as their IRIs. Whether the pair is stated is left as it is: one actor’s belief leaves the statement and every other actor’s belief standing. A candidate an actor believes "false" is not offered to that actor again (candidates).

Type Parameters#

Type Parameter

T

Parameters#

Parameter

Type

manifest

T

subject

Subject

property

string

value

unknown

options

BeliefOptions

Returns#

T

Throws#

if the property is none, the belief is none of the three, the date is no calendar date, or the path addresses no subject.


withCandidate()#

function withCandidate<T>(
   manifest, 
   subject, 
   property, 
   value, 
   options
): T;

Defined in: statements/statements.ts:1223

Return the manifest with a candidate for the subject: an entry of a pair it does not state, replacing in place another entry of the pair, whose beliefs it keeps, else appended; the statements are left as they are. A service or a loader proposing a pair holds no belief.

Type Parameters#

Type Parameter

T

Parameters#

Parameter

Type

manifest

T

subject

Subject

property

string

value

unknown

options

CandidateOptions

Returns#

T

Throws#

if the property is none, the subject has the pair, the date is no calendar date, or the path addresses no subject.


withContext()#

function withContext<T>(manifest, prefixes): T;

Defined in: statements/statements.ts:542

The manifest with its @context made from the format’s terms and the prefixes its statements and provenance use, each prefix’s namespace taken from the manifest’s own @context where it declares it, else from prefixes. A prefix no statement uses is dropped. The context replaces the manifest’s in place, or is added last.

Type Parameters#

Type Parameter

T

Parameters#

Parameter

Type

manifest

T

prefixes

Readonly<Record<string, string>>

Returns#

T

Throws#

if a prefix is declared in neither.


withFileIds()#

function withFileIds<T>(manifest): T;

Defined in: ids.ts:303

The manifest with every ID in the file form, # + the bare ID; a value of graphical.order gains the # where its key names a group.

Type Parameters#

Type Parameter

T

Parameters#

Parameter

Type

manifest

T

Returns#

T


withoutPair()#

function withoutPair<T>(
   manifest, 
   subject, 
   property, 
   value
): T;

Defined in: statements/statements.ts:1195

Return the manifest without the pair on the subject: the value and its entry removed; a list, a container or a provenance left empty is removed.

Type Parameters#

Type Parameter

T

Parameters#

Parameter

Type

manifest

T

subject

Subject

property

string

value

unknown

Returns#

T

Throws#

if the subject does not have the pair, or the path addresses no subject.


withPair()#

function withPair<T>(
   manifest, 
   subject, 
   property, 
   value, 
   options?
): T;

Defined in: statements/statements.ts:1159

Return the manifest with the pair stated on the subject: the value appended to the property’s list (type takes a class IRI). An entry of the pair, a candidate until now, stays as the stated pair’s entry. Given provenance (an entry’s keys but property, value and beliefs), they are set on the pair’s entry, appended where the pair has none: its property rdf:type for type, its value {id} for a node with id or a type, else the value. Given actor, the person stating the pair, the entry records that actor’s belief "true" on date, replacing the actor’s earlier belief.

Type Parameters#

Type Parameter

T

Parameters#

Parameter

Type

manifest

T

subject

Subject

property

string

value

unknown

options?

PairOptions

Returns#

T

Throws#

if the property is none, the subject has the pair, a date is no calendar date, actor is given without date, or the path addresses no subject.


withReferencesRenamed()#

function withReferencesRenamed<T>(manifest, renamed): T;

Defined in: statements/statements.ts:721

The manifest with the references to renamed elements renamed or dropped. The keys and values of renamed are bare IDs. A reference is the text "#" + old exactly (other.yaml#old names an element of another manifest and is none) where statements name things: a node’s id, a provenance entry’s basis and stated_by items, its service and a belief’s actor, in the statements and provenance of the manifest, of every timeline at any depth and of every region, and of every node within them, a node in an entry’s value included. Where renamed[old] is an ID, each reference becomes "#" + renamed[old]. Where it is null, a value that is a node naming the element leaves its list, an entry whose value names it leaves provenance, a basis or stated_by item naming it leaves its list, a belief whose actor it is leaves beliefs and a service naming it is deleted; then every list of values, container, basis, stated_by, beliefs and provenance left empty is deleted, as are a node without id and ordered values left without anything. Each reference is renamed once: with {a: "b", b: "c"}, #a becomes #b and #b becomes #c. The elements’ own IDs are never read, so either ID form is taken. Python’s with_references_renamed gives the same values.

Type Parameters#

Type Parameter

T

Parameters#

Parameter

Type

manifest

T

renamed

Readonly<Record<string, string | null>>

Returns#

T