paolodina / pinia-orm

The Pinia plugin to enable Object-Relational Mapping access to the Pinia Store.

Home Page:https://pinia-orm.codedredd.de/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pinia ORM logo

Artwork from Pinia

pinia-orm

npm version npm downloads Github Actions CI Coverage License

Intuitive, type safe and flexible ORM for Pinia based on Vuex ORM Next

Migration from vuex-orm

You want to migrate from vuex to pinia and with it vuex-orm to pinia-orm but you don't know yet? Well maybe this table will help you to decide. This comparison is just about facts and current state.

Features pinia-orm@v1.0.0 @vuex-orm/core@0.36.4 @vuex-orm/core@1.0.0-draft.16
Bundle Size (Min + GZIP) 9.1 KB 16.7 KB 12.6 KB
Relations (hasMany, belongsTo, morphOne, hasManyBy, hasOne) βœ… βœ… βœ…
Relations (morphTo, morphMany, belongsToMany) βœ… βœ… ❌
Relations (morphToMany, morphedByMany, hasManyThrough) ❌ βœ… ❌
Mutators βœ… βœ… ❌
Casts βœ… ❌ ❌
Decorators βœ… ❌ βœ…
Single Table Inheritance βœ… βœ… ❌
Lifecycle Hooks βœ… βœ… ❌
Aggregates βœ… βœ… ❌
Query (orHas, doesntHave, orDoesntHave, whereHas, orWhereHas, groupBy) βœ… ❌ ❌
Collection Helpers βœ… (βœ…) can use pinia-orm helpers too (βœ…) can use pinia-orm helpers too
Hidden Fields βœ… ❌ ❌
Metadata field βœ… ❌ ❌
Caching of queries with gc βœ… (βœ…) with plugin ❌

If you decide to migrate then there are some breaking changes. A guide how to migrate will be written. Small overview:

  • Fields are by default null
  • Renamed some functions aligning more with laravel naming
  • Code is based on vuex-orm-next and not on vuex-orm !

Help me keep working on this project πŸ’š

Platinum Sponsors

Gold Sponsors

Silver Sponsors

Bronze Sponsors

tintin10q salcedo

Backers

Sven Hue Paolo Dina


FAQ

A few notes about the project and possible questions:

Q: Does it work with the same models as vuex-orm?

A: Yes, this code is based on their work

πŸ’» Development

  • Clone this repository
  • Enable Corepack using corepack enable (use npm i -g corepack for Node.js < 16.10)
  • Install dependencies using pnpm install
  • Build normalizr package: pnpm build
  • Run interactive tests using cd packages/pinia-orm && pnpm test:ui

Credits

Related projects

License

Made with ❀️

Published under MIT License.

About

The Pinia plugin to enable Object-Relational Mapping access to the Pinia Store.

https://pinia-orm.codedredd.de/

License:MIT License


Languages

Language:TypeScript 85.6%Language:Vue 8.6%Language:JavaScript 3.8%Language:HTML 1.7%Language:CSS 0.3%