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
Viewand into their respective classes to simplify creating view based protocols. - Make
Viewinstantiable to allow maintaining multiple protocols at once e.g. for versioning.
StringView.encodecorrectly 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#indexOfmethods 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.initializemethods are removed as redundant when mixins are used.
StringView#includesmethod.ArrayView#at&VectorView#atmethods.
StringView#searchrenamed intoStringView#indexOf.
- Support typing View schemas through ViewSchema interface.
View.createaccepts 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
Viewclass that serves as the entry point for all views. Mixins related to binary structures are removed, useView.createto initialize view classes for all supported types, including objects, maps, arrays, etc. BitFieldMixinno longer automatically createsBigBitField, useBigBitFieldMixinexplicitly 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.fromtreats 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#getreturn JavaScript values, use*View.getViewmethods to get views.- CollectionView is replaced by MapView
- TypedArrayView extends ArrayView, and TypedArrayViewMixin is replaced with ArrayViewMixin
- Add static
toJSONmethods to View classes
- 2x speed up View encoding/decoding by avoiding extra DataView instantiations.
- (potentially breaking)
TypeView.get&TypeView.setare renames intoTypeView.toJSONandTypeView.fromrespectively.
- 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
toObjectmethods of *View classes (usetoJSONmethods instead).
- Rename
BitField.fieldstoBitField.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.fromno 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.