Class: SchemaStore<Entries>
Type Parameters
Type Parameter | Default type |
---|---|
Entries extends object | object |
Constructors
new SchemaStore()
new SchemaStore<
Entries
>(defaultMaximumArrayLength
:number
):SchemaStore
<Entries
>
Creates a new schema store
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
defaultMaximumArrayLength | number | 100 | The default maximum array length for schemas |
Returns
SchemaStore
<Entries
>
Defined in
Properties
#schemas
Defined in
defaultMaximumArrayLength
defaultMaximumArrayLength:
number
The default maximum array length for schemas
Defined in
Methods
[iterator]()
[iterator]():
IterableIterator
<{ [K in string | number | symbol]: readonly [K & number, Entries[K]] }[keyofEntries
]>
Iterates over the stores's schema entries.
Returns
IterableIterator
<{ [K in string | number | symbol]: readonly [K & number, Entries[K]] }[keyof Entries
]>
An iterator for the stores's schema entries
Defined in
add()
add<
Id
,SchemaType
>(schema
:Schema
<Id
,SchemaType
>):Merge
<Entries
,Id
,Schema
<Id
,SchemaType
>>
Adds a schema to the store
Type Parameters
Type Parameter |
---|
Id extends number |
SchemaType extends object |
Parameters
Parameter | Type | Description |
---|---|---|
schema | Schema <Id , SchemaType > | The schema to add to the store |
Returns
Merge
<Entries
, Id
, Schema
<Id
, SchemaType
>>
The modified store
Remarks
An error will be thrown if a schema with the same id already exists in the store.
Defined in
deserialize()
deserialize(
buffer
:string
|UnalignedUint16Array
):DeserializationResult
<Entries
>
Deserializes a buffer
Parameters
Parameter | Type | Description |
---|---|---|
buffer | string | UnalignedUint16Array | The buffer to deserialize |
Returns
DeserializationResult
<Entries
>
The resolved value, including the id of the schema used for deserialization
Defined in
entries()
entries():
IterableIterator
<{ [K in string | number | symbol]: readonly [K & number, Entries[K]] }[keyofEntries
]>
Iterates over the stores's schema entries.
Returns
IterableIterator
<{ [K in string | number | symbol]: readonly [K & number, Entries[K]] }[keyof Entries
]>
An iterator for the stores's schema entries
Defined in
get()
get<
Id
>(id
:Id
):Entries
[Id
]
Gets a schema from the store
Type Parameters
Type Parameter |
---|
Id extends number |
Parameters
Parameter | Type | Description |
---|---|---|
id | Id | The id of the schema to get |
Returns
Entries
[Id
]
The schema with the given id
Remarks
An error will be thrown if a schema with the given id does not exist in the store.
Defined in
keys()
keys():
IterableIterator
<keyofEntries
&number
>
Iterates over the stores's schema identifiers.
Returns
IterableIterator
<keyof Entries
& number
>
An iterator for the stores's schema identifiers
Defined in
serialize()
serialize<
Id
>(id
:Id
,value
:Readonly
<UnwrapSchema
<Entries
[Id
] &object
>>):UnalignedUint16Array
Serializes a value using the schema with the given id
Type Parameters
Type Parameter |
---|
Id extends number |
Parameters
Parameter | Type | Description |
---|---|---|
id | Id | The id of the schema to use for serialization |
value | Readonly <UnwrapSchema <Entries [Id ] & object >> | The value to serialize |
Returns
The serialized buffer
Defined in
values()
values():
IterableIterator
<Entries
[keyofEntries
&number
]>
Iterates over the stores's schemas.
Returns
IterableIterator
<Entries
[keyof Entries
& number
]>
An iterator for the stores's schemas