- Fixed bug related to synchronization between disk and memory.
- Fixed the logo link in the Portuguese documentation.
- Released the version with the fix on npm.
- Added a category for Portuguese documentation to the GitHub page.
- A link to this documentation has been added to the README.
- Fixed a bug in the generics system that ensures intellisense in collections.
- Modified the file structure of changes.
- Updated the README for add a reference to the new Storage Strategy (TypedJson).
- Added new Storage model: TypedJson.
- Characteristics:
Now, when a schema exists, all inserted/updated data is checked.
If the type of a data or a key that does not exist in the schema is provided in the Document, an error will be raised.
Complex cases were tested, such as: { value: [ { key: String(), xxx: [ Number() ] } ], required: Boolean() }.
- Given this example, at run time, each document will be tested, looking for the following requirements:
- required: if it exists in the past Document, it must be a boolean.
- value: if it exists in the document, it must be an array.
Each value within this array must be an object:
- key: if it exists in the object, it must be a string.
- xxx: if it exists in the object, it must be an array of Numbers.
Several cases were tested, and 'apparently' the validation function '(utils/validateSchema.js)' is working correctly.
- Fixed the npmignore file.
- The Storage API has been enhanced with the option to override the functions available in the Collection API.
- This primarily aims to enable more complex methods in more intricate Storages.
- Fixed the npmignore file.
- Rework of the entire API.
- The library has been divided into several modules.
- Core
- MycroDatabase: The main class of the library, used to build the database access wrapper.
- Collection: A class that represents a collection and provides access to its manipulation methods.
- Storage:
- Memory: A class that represents an in-memory database.
- JSON: A class that represents a disk-based database in JSON format.
- Added a 'static site' using the Github Pages.
- Removed the old build script.
- 'insert' now accepts multiple documents, making it simpler to insert multiple documents at once.
- Example: `db.collection('users', {id: 0, name: "", age: 0}).insert([{name: "John Doe", age: 20}, {name: "Jane Doe, age: 30}])`
- 'insert', 'update', and 'remove' now return the list of IDs related to the affected documents (created, modified, and removed).
- General improvements in argument validations for functions.
- Updated tests to reflect the changes.
- README documentation updated.
- Re-added the 'project overview' label in the README.
- Added a Logo in the README.
- Added Remove and Update methods to the Collections API.
- Complete rewrite of the library's tests.
- Each function is in its own file.
- README has been updated to reflect the new changes.
- Removed all Rollup build tooling.
- The library is 'self-contained' and does not require a separate build process (for now).
- Updated the package.json to reflect the changes.
- Fixed a minor 'import' example error in the README.
- Old: import MycroDatabase from 'mycro-db'
- New: import { MycroDatabase } from 'mycro-db
- The collections system is now stable.
- When you create a collection, it has its own in-memory space to save its objects.
- Objects are still indexed using auto-generated IDs.
- All collection-related information is also saved to disk.
- No changes were made to the APIs, which still include Insert and Query for each collection, and Sync for the database.
- Tests have been updated to reflect the changes.
- Modified the type of the 'filter' parameter in db.collection.query.
- Now, the IDE can provide 'intellisense' for the 'doc' that exists inside the collection.
- Example: db.collection('users', {id: 0, name: "", age: 0}).query((doc) => doc.name === "John Doe")
- The IDE knows that 'doc' is of type {id: number, name: string, age: number}.
- When defining a collection, it now checks if the required arguments are being passed for collection creation.
- There is no type checking on these arguments.
- The implementation of 'saving collection schemas' to the on-disk database has begun.
- Update README to reflect API changes.
- Implemented the initial version of the Collections API.
- Removed direct access to Insert and Query.
- When defining a Collection, you should now pass (with a plain JavaScript object) what you want to be the Schema for that collection.
- Example: db.collection('users', {id: 0, name: "", age: 0})
- This will ensure that when users access the Insert and Query methods using the collection, the IDE will know that the 'Document' in this collection has the type: {id: number, name: string, age: number}, and provide auto-completion (intellisense) for the user.
- To use Insert and Query, you should first create a collection.
- Example: const User = db.collection('users', {id: 0, name: "", age: 0})
- User.insert({name: "John Doe", age: 20})
- User.query((doc) => doc.name === "John Doe")
- Sync remains at the database level.
- Example: db.sync()
- Tests have been modified in accordance with the above changes.
- Added the Rollup package with some plugins for the project compilation process.
- Modified the package.json to fix the library import issue in other projects.
- Revamped the project README to include the current MycroDB API information.
- Added the LICENSE file.
- Added the .npmignore file to prevent unnecessary files from being included with the library during packaging.
- Added the 'ava' package as a development dependency for testing.
- Implemented the initial approach for the Database.
- The library exports the 'MycroDatabase' class.
- When constructing this class, it takes a path to the JSON file.
- An object with 'Insert,' 'Query,' and 'Sync' functions is returned:
- Insert: Receives a document (object) and inserts it (in memory) into the database.
- Query: Receives an expression to be used as a filter (in a filter) on the database values.
- Sync: Synchronizes the in-memory data with the on-disk file.
- There are other private functions and properties that are not part of the MycroDatabase object's API:
- __load
-__save
- __nextId
-__filePath
- __memory
-__id
- GitHub repository created with some configuration files and initial project structure.
- Package published on npm.