All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Fix main entry point for the NPM package.
- Move initialization logic of view classes out of
View
and into their respective classes to simplify creating view based protocols. - Make
View
instantiable to allow maintaining multiple protocols at once e.g. for versioning.
StringView.encode
correctly encodes strings of 3-byte characters.
- Support arrays as values in DictView
- Add DictView to support dictionaries (lookup tables) in View
- Add
ArrayView#indexOf
&VectorView#indexOf
methods to support searching items in container views.
- Add BinaryView to simplify working with binary data of variable size in View
- Fix typings for AdjacencyStructures to correctly extend TypedArrays.
- BitField and BigBitField classes are refactored and simplified with common
typings.
Big/BitField.initialize
methods are removed as redundant when mixins are used.
StringView#includes
method.ArrayView#at
&VectorView#at
methods.
StringView#search
renamed intoStringView#indexOf
.
- Support typing View schemas through ViewSchema interface.
View.create
accepts object constructor as optional second parameter.
(breaking changes)
- The library is rewritten in TypeScript and distributed as ECMAScript modules targeting ES2020.
- Structures extending built-in interfaces (e.g. TypedArrays, Array) no longer
overload their parent constructor instead using static factory method
create
, e.g. instead ofnew Pool(30)
usePool.create(30)
. - Adjacency structures are reworked: they no longer extend grid structures, directed and undirected matrices are split into different classes, unweighted list is removed, the names are changed accordingly.
- Binary structures are reworked and centralized with the addition of the
View
class that serves as the entry point for all views. Mixins related to binary structures are removed, useView.create
to initialize view classes for all supported types, including objects, maps, arrays, etc. BitFieldMixin
no longer automatically createsBigBitField
, useBigBitFieldMixin
explicitly if bigints are needed.
- SortedCollection is removed in favor of SortedArray.
- BinaryProtocol is removed, part of its functionality is implemented in View.
- UnweightedList is removed.
- Add VectorView
- Support required fields and default values in MapView.
- Support nested MapViews.
- Optimize StringView encoding and decoding.
- Support setting maximum size for strings and arrays in MapView.
- Use custom UTF8 encoding for StringView as a workaround to solve performance issues in V8.
- TypeViewMixin caching custom TypeView classes.
- Export TypedArrayView.
- Rename *View.Array into *View.ArrayClass.
- Export TypeView class.
- Add *View.Array field to allow using custom ArrayView classes.
- MapView can be used within a larger buffer.
- MapView can use custom ObjectView classes to initialize nested objects.
MapView.from
treats undefined and null fields as missing.
(breaking changes)
- ObjectView and all related *View classes use JSON Schema for schema definition.
- All *View classes use little endian encoding by default.
ObjectView#get
,ArrayView#get
,MapView#get
return JavaScript values, use*View.getView
methods to get views.- CollectionView is replaced by MapView
- TypedArrayView extends ArrayView, and TypedArrayViewMixin is replaced with ArrayViewMixin
- Add static
toJSON
methods to View classes
- 2x speed up View encoding/decoding by avoiding extra DataView instantiations.
- (potentially breaking)
TypeView.get
&TypeView.set
are renames intoTypeView.toJSON
andTypeView.from
respectively.
- Support boolean type in ObjectView.
- Support type aliases in ObjectView.
- Cache ArrayView & TypedArrayView classes to avoid duplications.
- TypeView class to simplify creation of custom types for ObjectView.
- (potentially breaking) Adding custom types to ObjectView is reworked. Custom types are now expected to be extensions of existing *View classes. A special TypeView class is added for types that extend number types.
- BinaryProtocol class to simplify operating on tagged ObjectView.
- TypeScript type declarations for ObjectView.
Deprecated classes and methods:
- Remove RecordArray (consider using ObjectView instead).
- Remove StringArrayView (use ArrayView instead).
- Remove
toObject
methods of *View classes (usetoJSON
methods instead).
- Rename
BitField.fields
toBitField.schema
, simplify the schema definition. - BitField no longer implicitly switches to using BigInts.
- Add BigBitField that uses BigInts for bitfields longer than 31 bits.
- BitFieldMixin automatically switches to BigBitField if the size of the bitfield exceeds 31 bits.
- BitField no longer auto-initializes upon first call, use
BitField.initialize()
or BitFieldMixin to initialize the class after creation.
- Support default field values in ObjectView.
- (potentially breaking)
ObjectView.from
no longer initializes ObjectView upon the first call. CallObjectView.initialize()
upon setting the schema (ObjectView.schema
) for the extending class, or use ObjectViewMixin
- Add BitFieldMixin.
- Avoid BigInts in RecordArray if not supported.
- Add ObjectViewMixin and expose ArrayView.
- Add ObjectView#getView.
- Handle non-string values in StringView.from
- Add StringView.from that uses TextEncoder#encodeInto
- Support strings in ArrayView replacing StringArrayView
- Support custom types in nested ObjectViews
- Support custom types in ObjectView
- Add getValue methods to View classes
- Add toJSON methods and deprecate toObject in View classes
- Add iterators in TypeScript definitions
- Add CollectionView
- Add StringArrayView class to support arrays of strings in ObjectView
- Support setting endiannes for TypedArrayViews
- Make TypedArrayViews public
- ArrayView.of & TypedArrayView.of methods
- Reworked ObjectView and ArrayView for better performance
- ObjectView, ArrayView, and TypedArrayView classes
- Correct byte offsets for strings in RecordArray
- Support TypedArray fields in RecordArray
- RecordArray#fromObject
- BitArray
- RankedBitArray
- Pool extends BitArray
- Set correct size for Pool.