workspace/ids#
Classes#
MissingIdError#
Defined in: workspace/ids.ts:154
Thrown by an IdSource asked for more IDs than its command carries when
it has no minter; the reducer refuses the command for it.
Extends#
Error
Constructors#
Constructor#
new MissingIdError(
given):MissingIdError
Defined in: workspace/ids.ts:156
Parameters#
given#
number
Returns#
Overrides#
Error.constructor
Properties#
given#
readonlygiven:number
Defined in: workspace/ids.ts:155
Interfaces#
IdMinter#
Defined in: workspace/ids.ts:91
A minter: its seed (modulo 2^64), its length, and the next ID it mints for a prefix.
Properties#
length#
readonlylength:number
Defined in: workspace/ids.ts:93
seed#
readonlyseed:bigint
Defined in: workspace/ids.ts:92
Methods#
copy()#
copy():
IdMinter
Defined in: workspace/ids.ts:100
A minter of this one’s seed and length at its count: it mints what this one mints next, and minting from either leaves the other where it was.
Returns#
mint()#
mint(
prefix):string
Defined in: workspace/ids.ts:95
The next ID: prefix, _ and the next suffix of the minter.
Parameters#
prefix#
string
Returns#
string
IdMinterOptions#
Defined in: workspace/ids.ts:104
The options of createIdMinter.
Properties#
length?#
readonlyoptionallength?:number
Defined in: workspace/ids.ts:108
The number of base-36 characters of a suffix, 1 to 13; 13 by default.
seed?#
readonlyoptionalseed?:bigint
Defined in: workspace/ids.ts:106
The seed, taken modulo 2^64; 64 random bits when left out.
IdSource#
Defined in: workspace/ids.ts:168
Where the reducer takes the IDs of what a command creates, in the order it creates them: the IDs the command carries first, then, with a minter, those the minter mints.
Properties#
left#
readonlyleft:number
Defined in: workspace/ids.ts:174
How many given IDs no call took.
take#
readonlytake:Mint
Defined in: workspace/ids.ts:170
The next ID; throws MissingIdError past the given IDs without a minter.
taken#
readonlytaken: readonlystring[]
Defined in: workspace/ids.ts:172
Every ID taken so far, in order.
Type Aliases#
Mint#
Mint = (
prefix) =>string
Defined in: workspace/ids.ts:148
What gives an ID to an element a command creates: one for each call, for an element of prefix.
Parameters#
prefix#
string
Returns#
string
Variables#
ANCHOR_PREFIX#
constANCHOR_PREFIX:"anchor"="anchor"
Defined in: workspace/ids.ts:60
The prefix of an alignment anchor’s ID.
CONVERSION_MAP_PREFIX#
constCONVERSION_MAP_PREFIX:"cmap"="cmap"
Defined in: workspace/ids.ts:72
The prefix of a conversion map’s ID.
ELISION_PREFIX#
constELISION_PREFIX:"elision"="elision"
Defined in: workspace/ids.ts:54
The prefix of an elision’s ID.
FLOW_MAP_PREFIX#
constFLOW_MAP_PREFIX:"flow"="flow"
Defined in: workspace/ids.ts:66
The prefix of a FlowMap’s ID.
GROUP_PREFIX#
constGROUP_PREFIX:"group"="group"
Defined in: workspace/ids.ts:63
The prefix of a group’s ID.
ID_LENGTH#
constID_LENGTH:13=13
Defined in: workspace/ids.ts:75
The number of base-36 characters of a minted ID’s suffix by default.
MATCHSTAMP_PREFIX#
constMATCHSTAMP_PREFIX:"matchstamp"="matchstamp"
Defined in: workspace/ids.ts:57
The prefix of a named MatchStamp’s ID.
REGION_PREFIX#
constREGION_PREFIX:"region"="region"
Defined in: workspace/ids.ts:69
The prefix of a region’s ID.
TIMELINE_PREFIX#
constTIMELINE_PREFIX:object
Defined in: workspace/ids.ts:41
The prefix of a minted timeline ID (clt_…, dpt_…, …) by its timeline class.
Type Declaration#
ContinuousGraphicalTimeline#
readonlyContinuousGraphicalTimeline:"cgt"="cgt"
ContinuousLogicalTimeline#
readonlyContinuousLogicalTimeline:"clt"="clt"
ContinuousPhysicalTimeline#
readonlyContinuousPhysicalTimeline:"cpt"="cpt"
DiscreteGraphicalTimeline#
readonlyDiscreteGraphicalTimeline:"dgt"="dgt"
DiscreteLogicalTimeline#
readonlyDiscreteLogicalTimeline:"dlt"="dlt"
DiscretePhysicalTimeline#
readonlyDiscretePhysicalTimeline:"dpt"="dpt"
TIMESTAMP_PREFIX#
constTIMESTAMP_PREFIX:"timestamp"="timestamp"
Defined in: workspace/ids.ts:51
The prefix of a named timestamp’s ID.
Functions#
createIdMinter()#
createIdMinter(
options?):IdMinter
Defined in: workspace/ids.ts:122
A minter of seed (64 random bits when left out) and length (13 by
default); a length that is not an integer from 1 to 13 throws a
RangeError.
Parameters#
options?#
IdMinterOptions = {}
Returns#
idSource()#
idSource(
given,minter?):IdSource
Defined in: workspace/ids.ts:178
A source taking given in order, then minting with minter, where there is one.
Parameters#
given#
readonly string[]
minter?#
IdMinter | null = null
Returns#
mintBlockId()#
mintBlockId(
fill?):string
Defined in: workspace/ids.ts:27
A fresh block id: ten random base-36 characters, so concurrent peers never collide.
Parameters#
fill?#
(bytes) => void
Returns#
string
mix64()#
mix64(
x):bigint
Defined in: workspace/ids.ts:80
SplitMix64’s finalizer over 64-bit integers, a bijection: x is taken modulo 2^64.
Parameters#
x#
bigint
Returns#
bigint