Skip to content

Releases: Josuto/monguito

6.1.3

07 Dec 20:05
82afe69
Compare
Choose a tag to compare

What's Changed

Improved exception handling in the following MongooseRepository functions:

  • insert
  • update
  • instantiateFrom

Also, updated all dependencies.

Pull Requests:

Full Changelog: 6.1.2...6.1.3

6.1.2

22 Nov 17:54
Compare
Choose a tag to compare

What's Changed

Have you ever wanted to know all the invalid fields of an entity instance(*) before it is stored in the database at once? Now you can! 💃🎁🕺

You can simply capture the ValidationException error on a try-catch block surrounding the entity save operation and invoke any of the following three new functions:

  • getInvalidFields retrieves the names of all the entity fields specifying an invalid value
  • getInvalidRequiredFields retrieves the names of all the mandatory entity fields with no defined value
  • getInvalidUniqueFields retrieves the names of all the entity fields which values are meant to be unique in your collection

Code example: 🧑‍💻

const book = new Book({
    title: undefined, // say this field is specified as mandatory in your book Mongoose Schema
    isbn: "978-0-123456-47-2" // say this field is specified as unique but there is another stored book with this value
});
try {
    bookRepository.save(book);
} catch (error) {
    if (error instanceof ValidationError) {
        console.error(error.getInvalidFields()) // 'title', 'isbn'
        console.error(error.getInvalidRequiredFields()) // 'title'
        console.error(error.getInvalidUniqueFields()) // 'isbn'
    } else {
        throw error;
    }
}

Hope you find this new feature useful! 😙👋

(*) By invalid entity instance fields we refer to those fields of the instance which values break any constraint you have imposed on them in your entity schema.

Pull Requests

  • feat: add validation errors to validation exception cause by @Josuto in #325
  • fix: rename validation exception functions by @Josuto in #326

Full Changelog: 6.0.2...6.1.2

6.0.2

20 Oct 09:11
ad009af
Compare
Choose a tag to compare

What's Changed

Full Changelog: 6.0.1...6.0.2

6.0.1

19 Oct 14:40
Compare
Choose a tag to compare

What's Changed

Wooow! That was a long time without updating any dependency, sorry about that! 🙏

Now Monguito is up-to-date, specially regarding patches against known security breaches! 🕺

Pull Requests

  • chore: update dependencies by @Josuto in #303
  • chore(deps): bump rollup from 2.79.1 to 2.79.2 by @dependabot in #301
  • chore(deps): bump micromatch from 4.0.5 to 4.0.8 by @dependabot in #291
  • chore(deps): bump micromatch from 4.0.5 to 4.0.8 in /examples/nestjs-mongoose-book-manager by @dependabot in #290

Full Changelog: 6.0.0...6.0.1

6.0.0

06 Jul 10:37
15b94d8
Compare
Choose a tag to compare

What's Changed

Hello monguitoers! 🖖

Good news to newcomers but also veterans! Specifying your custom repository domain model is now a 🍰 with the new DomainModel type 🎁! Additionally, this new type enables recursive subtype definitions. We added further type constraints into DomainModel to help you realise misconfigurations faster via TypeScript compiling errors. All to improve your development experience 🧑‍💻

We also re-designed the core of Monguito's exception handling to provide more information in case of erratic behaviour and thus help you better debug your code 🎁. Furthermore, we have simplified the definitions of CRUD operations' optional properties and introduced some semantic changes at the findOne operation for Mongoose/MongoDB compatibility purposes: it now returns an arbitrary entity when no filters is provided.

These are the most important changes that Monguito v6 brings to you. However, you may find a full list of breaking changes a this changelog.

Hope you keep on enjoying Monguito!

Happy summer! 🏖️

Pull Requests

  • feat!: improve input domain model definition by @Josuto in #240
  • fix!: update findOne and deleteAll semantics by @Josuto in #244
  • fix!: constraint operations optional attribute types by @Josuto in #245
  • docs: update API and docs by @Josuto in #246
  • chore!: merge canary to main by @Josuto in #247
  • chore(deps): bump braces from 3.0.2 to 3.0.3 by @dependabot in #258
  • chore(deps): bump braces from 3.0.2 to 3.0.3 in /examples/nestjs-mongoose-book-manager by @dependabot in #257

Full Changelog: 5.1.2...6.0.0

5.1.2

06 Jun 17:25
Compare
Choose a tag to compare

What's Changed

Not much really, we just updated several dependencies this time 📦

Something new is coming, so stay tuned! 📺

Pull Requests

  • chore(deps-dev): bump mongoose from 8.3.4 to 8.4.1 by @dependabot in #249
  • chore(deps-dev): bump eslint from 9.2.0 to 9.4.0 by @dependabot in #250
  • chore(deps-dev): bump @typescript-eslint/parser from 7.8.0 to 7.11.0 by @dependabot in #252
  • chore(deps-dev): bump @types/node from 20.12.11 to 20.14.0 by @dependabot in #248
  • chore(deps-dev): bump @typescript-eslint/eslint-plugin from 7.8.0 to 7.11.0 by @dependabot in #251
  • Update dependencies by @Josuto in #253

Full Changelog: 5.1.1...5.1.2

5.1.1

12 May 10:13
9e18014
Compare
Choose a tag to compare

What's Changed

Hello monguitoers!

This new release includes some refactoring at MongooseRepository to improve code readability as well as an Architecture Decision Record (ADR) to explain why we chose to disallow secondary key-based domain object storage (TL;DR: we decided to support partial domain object updates while guaranteeing loose coupling between persistence and application/domain logic).

Keep on rocking! 🤘

Pull Requests

  • refactor: improve code readability by @Josuto in #224
  • docs: add ADR on secondary key-based storage by @Josuto in #225
  • chore(deps): bump ejs from 3.1.9 to 3.1.10 by @dependabot in #229
  • chore(deps-dev): bump @typescript-eslint/parser from 7.6.0 to 7.8.0 by @dependabot in #232
  • chore(deps-dev): bump supertest from 6.3.4 to 7.0.0 in /examples/nestjs-mongoose-book-manager by @dependabot in #226
  • chore(deps-dev): bump mongodb-memory-server from 9.1.8 to 9.2.0 by @dependabot in #228
  • chore(deps-dev): bump @typescript-eslint/eslint-plugin from 7.7.0 to 7.8.0 by @dependabot in #231
  • chore(deps-dev): update rest of dependencies by @Josuto in #234

Full Changelog: 5.1.0...5.1.1

5.1.0

20 Apr 18:15
aeccfdc
Compare
Choose a tag to compare

What's Changed

Hey monguitoers!

This new release enables you to register any standalone Mongoose plugin of your liking during the creation of your schemas 🎁. All you need to do is to invoke the extendSchema function passing an array of plugins as value for options.plugins, as illustrated in this example. Hope you find it useful!

Happy Saturday to y'all! 👋

Pull Requests

  • fix: enable Mongoose plugin registration in schemas by @Josuto in #221
  • chore(deps-dev): bump @typescript-eslint/eslint-plugin from 7.5.0 to 7.7.0 by @dependabot in #222

Full Changelog: 5.0.1...5.1.0

5.0.1

18 Apr 18:24
Compare
Choose a tag to compare

What's Changed

Hello monguitoers! 👋

This release is the result of sweeping the house a bit 🧹. Here is what we did:

  • 📦 added some new options parameter to the findOne operation in case you want to include it in your own transactional operations
  • ⚠️ deprecated findOne filters parameter for operation syntax consistency; now you can define filters as part of options instead
  • ⚠️ deprecated the connection property from all monguito operations' options parameter, as it is no longer required
  • 📚 improved the documentation on monguito operations to better explain each options parameter, among other things

As always, enjoy monguito and happy coding! 👩‍💻

Pull Requests

  • feat: add extra options to findOne operation by @Josuto in #217

Full Changelog: 5.0.0...5.0.1

5.0.0

13 Apr 15:29
b235e44
Compare
Choose a tag to compare

What's Changed

Good Saturday, monguitoers!

📣 We are happy to announce the publication of runInTransaction, the transactional helper function used by the saveAll and deleteAll to ensure operation atomicity. Now it is available to you (dear developer) can now use to easily implement your own custom atomic operations! 🎁. You can check it action at this soft deleteAll version.

Furthermore, all the basic and transactional CRUD operations included in this new version specify an options optional parameter to enable extra configuration 👯. You may find the definition of each operation options parameter here. Related to this topic, we decided to finally remove the userId parameter specified at the save operation. If you need to track the userId value for entity operation auditing purposes, please include it as part of the the save operation options parameter.

Last but not least, we also decided to make Mongoose a peer dependency for monguito. This way you are now in control of the Mongoose version, giving you higher capability of choice, under one condition: it must be higher or equals to v8.0.0.

We hope you keep on enjoying monguito, and as always, if you have any comment, doubt or concern, do not hesitate to create an issue 🙏.

Happy weekend and happy coding! 🖖

Breaking Changes ⚠️

Bringing new features to you does not come without a cost, unfortunately. That being said, we believe and hope they won't impact your code much.

This is the list of breaking changes introduced in this release:

  • The userId optional parameter has been removed from the save operation
  • The SearchOptions type has been renamed to FindAllOptions for naming convention purposes
  • The TypeData type has been renamed to SybtypeData
  • Mongoose must now be included in your package.json as a dependency

Pull Requests

  • feat: publish transactional helper by @Josuto in #184
  • Code cleanup by @Josuto in #215
  • chore(deps-dev): bump @typescript-eslint/eslint-plugin from 7.4.0 to 7.5.0 by @dependabot in #214
  • chore(deps-dev): bump @typescript-eslint/parser from 7.4.0 to 7.6.0 by @dependabot in #213

Full Changelog: 4.8.0...5.0.0