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.
- Improve inferred types for _raw property (#820)
- Change output of
Connection
date/time methods to use theISOCalendarDate
,ISOCalendarDateTime
, andISOTime
templated string literal types as return values to ensure consistency with inferred schema types (#805)
- Switch the type definition of array schema properties to readonly tuples (#794)
- Add
_id
and__v
to types for schemaless models (#790)
- New
RecordNotFoundError
error was created to be thrown when a record cannot be found in the database. #740 - New Increment operation is now supported on numeric fields. The operation will increment the value at the path specified by the amount specified and will return both the original and updated documents. #750, #757, #758
- New internal unibasic subroutine
writeRecord
was created to be shared bysave
andincrement
operations for writes to the database. #756
- Properly handle a failure in basic digest function when saving (#753)
- Fix regression in
_raw
property ofDocument
that was no longer conditionally assigning property (#754)
- Improve the type of schema type property
path
to be a union of numeric tuples instead of a numeric array (#751)
- Adjust
SchemaFilterKeys
type to exclude non-string keys and useSchemaFilterKeys
in construction ofSortCriteria
type (#747)
- Create new
SchemaFilter
andSchemaFilterKeys
types and export additional query types from main entry point (#745)
- Create a
Model
type alias and export additional types from main entry point (#743)
- Minimum Node version is now 18.0.0 (#620)
- Fix handling of projection to ensure the correct data attributes are projected (#653)
- Upgraded to Docusaurus v3.2.1 because V2 does not support Node 18 (#620)
- Infer output object types based upon Schema definition (#697, #720, and #732)
- Add type inference for query conditions (#719)
- Add node 20 to the CI matrix (#620)
- Improve error messaging for validation errors (#642)
- Make validators synchronous to improve performance (#701)
- Allow bypassing deployment validation and expose basic subroutine name on connection instance (#709)
- Include cause in MvisError, TimeoutError, and UnknownError (#724)
2.0.0-rc.1 - 2023-05-05
- Logger interface has been adjusted, adding
fatal
andtrace
while removingverbose
andsilly
(#463)
- Fix handling of foreign key validation when multiple files are specified (#467)
2.0.0-rc.0 - 2023-03-16
- Minimum Node version is now 16.0.0 (#413)
- Check catalog existence as part of server validation (#196)
- Deploy UniBasic via MVIS Admin (#186)
- Prevent multiples of same connection operations from running in parallel (#308)
- Add filename and record ID to error output (#318)
- Return write error status codes (#322)
- Allow specification of a maximum return payload size from the database (#357)
- Pass requestId to MVIS as HTTP header (#390)
- Add requestId to common variable (#397)
2.0.0-alpha.7 - 2022-06-13
- Fix an issue with
findById
where the UniBasic source code did not include the UDO constants which produced an uninitialized variable abort (#157) - Handle construction of full MVIS URL more gracefully to avoid issues with trailing slashes (#128 and #166)
- Fix an issue with
$contains
,$startsWith
, and$endsWith
queries where an unintended pattern match could be introduced into the query constant causing the query to return unexpected results (#166)
- Add node 18 to the CI matrix (#111)
- Remove
@types/jest
from dependencies and update timers syntax to no longer specifymodern
(#152)
- Add documentation site and automate deployment of it to GitHub pages (#151)
- Update readme and create contributing guide and code of conduct (#155)
2.0.0-alpha.6 - 2022-05-05
- Previously, specifying an empty projection array for Model database methods (e.g.
find
,findById
) would behave the same as specifying no projection at all. This change adjusts that behavior so that specifying an empty projection array will instead return no data. (#86)
- Corrected an issue with saving subdocument arrays defined with multipart paths where the resulting saved data would be formatted incorrectly in the database (#85)
- Added missing
@babel/runtime
dependency (#105) - If a database value cannot be transformed, log the original value and not the value after a transformation attempt (#106)
2.0.0-alpha.5 - 2022-04-19
- Allow user defined properties in Model methods. These will be stored in the
S$MVOM
named common area. (#76) - Validate database server query limits prior to execution of query (#79)
2.0.0-alpha.4 - 2022-04-12
- Change database I/O for records to use delimited strings instead of arrays (#60)
- A new non-enumerable
_originalRecordString
property now exists on the Model instance - Model instances can no longer be constructed from arrays. Delimited strings can be used instead.
- The
Document
constructor is now protected and should not be instantiated directly. Use of the staticcreateDocumentFromRecordString
should be used instead.
- A new non-enumerable
- Allow http/s agent to be passed to Connection (#45)
- Allow type information to be specified for dictionaries that are not part of the data definitions (#53)
2.0.0-alpha.3 - 2022-03-22
- Fixed an issue where the time transformations were returning the incorrect value on the date a daylight saving time transition occurred (#42)
- Fixed an issue where property descriptors were being added unnecessarily to properties on the
Document
class which had been migrated to JS private syntax (#41) - Fixed an issue where the default
dbFormat
of'ms'
forISOCalendarDateTime
schema types was not properly passing the defaulted format to theISOTime
constructor. This led to incorrect transformations of the time component of theISOCalendarDateTime
. (#50)
moment
was replaced withdate-fns
for use in date and time conversions sincemoment
is in maintenance mode. (#42)- Logging behaviors were changed to have a different severity level for many log events. Additionally, all logs now include the account name in the emitted log message. (#44)
- When an MVIS connection times out, a new
TimeoutError
will be emitted instead ofMvisError
. Additionally, a newUnknownError
could possibly be emitted if the caught error is not of typeAxiosError
(fromaxios
library). (#43)
2.0.0-alpha.2 - 2022-03-17
- The
findById
andfindByIds
database features were returning empty string when a record was not found. However, the types for the responses were anticipatingnull
to be returned in this scenario. The handling code was anticipatingnull
and was returning an emptyModel
instance instead of returningnull
as expected. Use ofnull
is a better pattern and the database code was adjusted to returnnull
instead of empty string. (#37) - The
unibasic
path for db server feature deployments was resolving to the incorrect file system location (#37) - The
Document
andModel
constructors were incorrectly only allowing an option of eitherrecord
ordata
to be supplied. It is valid syntax to supply both so the restrictions on the constructor options were relaxed. (#37)
2.0.0-alpha.1 - 2022-03-14
- The
encrypt
anddecrypt
functions are no longer overloaded to accept or return arrays and no longer accept or returnnull
. All handling of arrays andnull
values has been internalized. (#29)
- The
_id
property ofModel
instances was inadvertently not enumerable. This fix ensures that the_id
property will be enumerable. (#31)
2.0.0-alpha.0 - 2022-03-11
- Minimum Node version is now 14.19.0
- The Schema constructor definitions no longer accept constructors for the
type
property in schema property definitions. Instead, thetype
will be string literals indicating the property's type (e.g.'string'
). - Several exported types have been improved or renamed
- There is no longer a default export from the library. The main export now includes named exports
Connection
,Document
,Schema
, and the variousError
classes. createConnection
has been changed from a standalone exported function to a static method on theConnection
class. This is now the only supported mechanism for instiantiating aConnection
.ConnectionManagerError
has been renamed asMvisError
and its properties similarly renamed since the official Rocket product is "MVIS"
- Migrated library from BitBucket to GitHub
- Update repository URL in
package.json
(#3) - Update all dependencies to latest version
- Library has been completely converted to TypeScript (#14, #18, #20, #22, and #23)
- Uses STORIS published eslint, prettier, and typescript configurations
- Convert changelog to the Keep-a-Changelog standard
1.0.0 - 2022-02-22
No changes; only publish 1.0.0 stable release
1.0.0-rc.1 - 2021-10-19
- Fix projection error on schemaless models
1.0.0-rc.0 - 2021-10-18
- Node 12 is now minimum version
- Allow explicit
$and
operator for queries - Improve Query unit tests
- Allow schematically defined foreign key validations
- Allow projection operators to be passed to queries to limit returned data from data server and transformations
- Allow reading binary files as Base64 encoded
- Update dependencies to remove security warnings
0.9.4 - 2021-06-30
- Update all dependencies
- Format the ISOCalendarDateTime type to have the time component left padded with zeroes
0.9.3 - 2021-05-07
- Update production dependencies to remedy high vulnerability security issues
0.9.2 - 2020-11-19
- Several properties on the
Document
instance were intended to not be enumerable and were not getting configured properly to ensure that. This change ensures that thetransformDocumentToRecord
,_transformRecordToDocument
, andvalidate
properties are not configurable, not enumerable, and not writable. SinceModel
inherits fromDocument
, this will affect instances of that class as well.
0.9.1 - 2020-05-22
- When a document's property is a schema type of Array or NestedArray,
required
validation will fail when the property is not defined. This is because during validation theundefined
property gets cast tonull
and then the array gets cast to[null]
during validation which fails. The issue is thatundefined
andnull
values are not cast to arrays prior to validation in the same way thatDocumentArray
s are. This change castsnull
andundefined
properties to[]
and scalars to an array of that scalar during property validation.
0.9.0 - 2020-05-18
- Eliminate implicit
required
validation of primitive arrays that was occurring if the primitive's schema definition indicated it wasrequired
. This effectively made it so that arrays must have a length greater than 0 if the contents of the array were required. This caused therequired
flag to effectively serve double-duty -- preventingnull
/undefined
contents of arrays and enforcing that arrays contained contents.
0.8.0 - 2020-04-21
- Add support to encrypt and decrypt strings and ISO calendar dates. String and ISOCalendarDate type fields can be marked as
encrypted
. The Schema constructor now accepts optionalencrypt
anddecrypt
functions. If a field is marked asencrypted
these provided functions will be run.
0.7.0 - 2020-04-03
- Update to fix dependency vulnerabilities
- Expose the
Document
constructor and allow a record to be passed in the constructor without having fetched it from the DB
0.6.2 - 2020-03-24
- Fix a deployment issue introduced in 0.6.0. Make sure that all features needed for the
deploy
feature are deployed as part of a bootstrap step - Add temporary workarounds for several issues identified in UniQuery
- Using the
returning
clause on a query where a query limit is exceeded causes an abort (proposed to be fixed in UniData 8.2.2) - Exceeding the sentence length limit does to set an error condition in
@system.return.code
therefore returning incorrect results instead of an error.
- Using the
0.6.1 - 2020-03-13
- Allow for regular expression pattern matching for strings and ids. Strings will accept a property named
match
in the schema definition for any string type. Document ids can be matched by providing anidMatch
property to the Schema constructor options.
- Update some vulnerable dependencies
0.6.0 - 2020-03-03
- Add new setup and teardown features which will run before and after a subroutine feature to setup and teardown the environment. While configurable, the initial implementation creates and clears a named common block called
S$MVOM
, which includes one variable calledS$MVOM.PROCESS
set totrue
. UniBasic programs can check for this variable to determine if they were initiated byMVIS
. This may be necessary when code not shipped through MVOM is run like in a database trigger or virtual dictionary.
UniBasic programs should include the below to use this new variable:
COM /S$MVOM/ S$MVOM.PROCESS
- Enhance the save action to support clearing all attributes before writing out the record. This fixes an issue with schemaless documents where the record being written has less attributes than what is already on disk. This is automatically set when working with schemaless files.
0.5.2 - 2020-02-25
- Allow for null schemas passed to the model constructor. When schemas are null, no mapping of the record to a document (and vice versa) will occur. Instead, a property named
_raw
will be added to the document which contains an array of the record contents. When saving, this array will overwrite the entire record.
0.5.1 - 2019-11-21
- Rollback fs-extra version to avoid memory leak
0.5.0 - 2019-11-11
- Fix simple and document array handling so they can be cleared using an empty array syntax and also update correctly when changing the length
- Change exported error names so they contain an
Error
suffix for clarity
- Update dependencies and begin conversion to TypeScript
0.4.0 - 2019-07-18
- String types with an enumeration of empty string will return empty string instead of null from the database
- Improve the Model class in the typescript declaration
0.3.5 - 2019-06-03
- Correct static members on Model class in TS declaration file
0.3.4 - 2019-05-30
- Add TypeScript declaration file
0.3.3 - 2019-05-16
- Ensure that the
count
property returned fromfindAndCount
is numeric
0.3.2 - 2019-05-13
- Add new
findByIds
static model method which finds a list of documents by id. - Add new
findAndCount
static model method which returns both the documents matching the query as well as the count of all documents matching the query irrespective of skip and limit
0.3.1 - 2018-12-21
- Fix an issue where enum validation returns a data validation error on null values on non-required fields
0.3.0 - 2018-12-17
- Correctly format an attribute that only contains subvalued data. Previously this returned a string with embedded subvalue delimiters. This now returns a nested array.
- Improve the performance of the server-side formatDocument routine on large records by switching to REMOVE and udoAppendArrayItem
- Fix an abort from the U2 digest function when reading or overwriting a previously empty record
0.2.1 - 2018-10-22
- The constant values for queries will now be converted from the external schema format to the internal u2 format. This affects the date/time types as well as Booleans.
- Add support for specifying allowed enum values in the schema for string types
0.2.0 - 2018-09-18
- Connections now accept a timeout parameter which will override the default of no timeout. The default remains to be no timeout.
- The
request
andresponse
properties of theConnectionManager
error object have now been renamed so they do not appear to be errors that directly came from axios. They are nowconnectionManagerRequest
andconnectionManagerResponse
respectively. - The
Connection
class is no longer exported. Connections should be established via thecreateConnection
method which now accepts all parameters that theConnection
class accepts - mvom will no longer create a default winston logger if one is not passed to the connection constructor. All consumers who wish to have mvom provide logging should pass in their own logger (such as winston) which provides methods conforming to the npm log levels.
- Nearly all dependencies and devDependencies have been updated to the latest versions
- Db server tier errors can now be cast to error class instances. Errors due to record locking will now be cast to
RecordLockedError
and errors due to record version mismatches will be cast toRecordVersionError
- Db server errors occurring during save will now enrich the error object with the filename and record id in the error object's
other
property - All errors thrown from mvom will now contain a source property with a value of
mvom
0.1.0 - 2018-08-10
We've graduated from Alpha to Beta! Semver has been updated so breaking vs. non-breaking changes can be more easily identified go forward.
- A bug was discovered where a subdocument array could not reference a multi-part path. That is, the subdocument array had a path in the format of
x.y
indicating the data was located at a particular attribute and value and the array should iterate across the subvalue. In this structure, the properties in the subdocument arrays would end up empty. This has been corrected.
0.0.10 - 2018-06-12
- An object in the Schema is now only considered to be a "data definition" if it contains both a
type
and apath
property. If an object doesn't contain both of these properties, it will be treated as a subdocument object instead of a data definition. The upshot of this is thattype
can now be used as a data-describing property in a Schema definition, provided that it does not appear alongside apath
property in that same definition.
0.0.9 - 2018-06-07
- Connection instances now expose
getDbDate
,getDbDateTime
, andgetDbTime
functions. These can be used to calculate the date and time values as represented at the database layer since it is likely to differ from the layer running mvom. This will allow consumers to get these values so they can be provided in the data. Note: This information is cached with a tunable time period (default 1 hour) in order to provide low latency feedback but also reasonably handle shifts in the database time (e.g. daylight saving time, server migrations, etc.)
0.0.8 - 2018-05-30
- Document constructor no longer accepts "record" -- instead it accepts an object of data
- Plain objects can now be used with subdocuments, enabling far easier use of these structures
0.0.7 - 2018-05-07
- Use array of arrays for sort criteria to preserve sequencing; can no longer be specified as object
0.0.6 - 2018-04-19
- Provide default dictionary of @ID for
_id
property
0.0.5 - 2018-04-17
- Do not treat missing records as an error condition - instead return null from findById
0.0.4 - 2018-04-16
- Partially revert changes to default export -- continue to export as named exports as well
0.0.3 - 2018-04-16
- When a query property is equal to an array, automatically convert to $in query
- Change default export from library to include Connection, Errors, and Schema
0.0.2 - 2018-04-09
- Connection is now exported from main module
__v
is now an accessible property in model instances- Connection instances now have a status
- Models cannot be created from connection instances that have not been opened
0.0.1 - 2018-03-19
Initial alpha release of this library! Thanks for using it!