Compresses data into a binary format. At present, this will always be a .zip file. This requires your execution environment to support workers, which is most modern browser / Node.js environments.
A synchronous variant of compress. This may be preferred in environments where workers are not supported or you do not want to change existing code to be asynchronous.
Note: There is a performance penalty that scales relative to the size of the data to be compressed.
An unsafe variant of compress that does not validate the contents of the compressed data. This is useful for cases where you know the data is valid, or you do not care about the validity of the data, and you want to avoid the overhead of validation.
This should generally be avoided -- in most circumstances where compression is used, the performance hit of validation is negligible, and should be required especially if decompressUnsafe is used on the consumption end.
A synchronous variant of compressUnsafe. This may be preferred in environments where workers are not supported or you do not want to change existing code to be asynchronous.
Note: There is a performance penalty that scales relative to the size of the data to be compressed.
Transforms a given value into the decoded form of the schema. This is automatically done in the decompress method, so this should only be required in cases where you need to transform the value outside of the decompression process.
The value to transform.
Decompresses data from a binary format into native objects. This is only expected to consume .zip files at present, and will fail if given data in an unknown format. This requires your execution environment to support workers, which is most modern browser / Node.js environments.
The data to decompress.
A synchronous variant of decompress. This may be preferred in environments where workers are not supported or you do not want to change existing code to be asynchronous.
Note: There is a performance penalty that scales relative to the size of the data to be decompressed.
An unsafe variant of decompress that does not validate the contents of the decompressed data. This is useful for cases where you know the data is valid, or you do not care about the validity of the data, and you want to avoid the overhead of validation. Note that data must still be decoded, so this can produce unexpected results if the data does not match the shape of the schema.
The data to decompress.
A synchronous variant of decompressUnsafe. This may be preferred in environments where workers are not supported or you do not want to change existing code to be asynchronous.
Note: There is a performance penalty that scales relative to the size of the data to be decompressed.
Encodes a given value into the encoded form of the schema. This is automatically done in the compress method, so this should only be required in cases where you need to transform the value outside of the compression process.
Checks if a given value is valid against the schema. This should not be used for data that has already been decoded.
The value to check.
Returns a JSON schema representation of the parser's schema. This is useful for cases where you need a standard format to validate data where the parser isn't functional (i.e. other libraries or languages). This can also be useful for AOT complication of the validation functions via AJV or a similar tool.
Parses a given value against the schema. Similar utility to is, but returns a ParseResult to be able to inspect errors if that is desired. This should not be used for data that has already been decoded.
The value to parse.
Verifies the integrity of a given value against the rules of each extension used by the parser. This is intended for use on data that already matches the shape of the schema, but may have invalid references between extensions / other checks that aren't possible to embed in the schema.
The value to verify.
StaticcreateInstantiates a new MVF parser class. It's not recommended to use this
directly -- you most likely want to use an MVFParserBuilder,
generally via createParser, and use the build method to produce
a parser.
An MVFParserBuilder instance
The $id to use for the schema. Defaults to CoreMVF.
Whether to construct a parser compatible with
unsafe-eval CSP rules. This will reduce the performance of checks, and
is not recommended.
A class that represents an MVF parser. This is not intended to be used directly -- you most likely want to use an MVFParserBuilder, and use the
buildmethod to produce a parser.