mevn-orm 2.5.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -28
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,33 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
while I have a vision to create an intuitive ORM, I am not able to contitnue with this project at this time.
|
|
3
|
-
I have to go back to the drawing board and come up with a better tool using the learnings from this.
|
|
1
|
+
# Mevn ORM
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
 [](https://github.com/StanleyMasinde/mevn-orm/blob/master/LICENSE) 
|
|
4
|
+
|
|
5
|
+
**Mevn ORM** is a lightweight ORM for Express.js and MySQL that provides a clean, fluent interface for building queries and managing models.
|
|
6
|
+
It is under maintenance mode and receives security updates. Development is paused, but the core ORM functionality is complete and usable.
|
|
7
|
+
|
|
8
|
+
## Getting Started
|
|
9
9
|
|
|
10
10
|
```javascript
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
11
|
+
const { Model } = require('mevn-orm')
|
|
12
|
+
|
|
13
|
+
class User extends Model {}
|
|
14
|
+
|
|
15
|
+
const user = await User.create({
|
|
16
|
+
name: 'John Doe',
|
|
17
|
+
email: 'john@example.com',
|
|
18
|
+
password: 'secret' // hash before storing
|
|
19
|
+
})
|
|
20
|
+
````
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
* Model-based abstraction
|
|
25
|
+
* Create, Read, Update, Delete support
|
|
26
|
+
* Chainable query builder (`where`, `first`, `all`)
|
|
27
|
+
* Timestamps
|
|
28
|
+
* Soft deletes
|
|
29
|
+
* SQLite support for testing
|
|
30
|
+
* Knex-based migration support
|
|
31
|
+
|
|
32
|
+
## ORM Basics Checklist
|
|
33
|
+
|
|
34
|
+
* [x] `Model` base class
|
|
35
|
+
* [x] `.create`, `.find`, `.update`, `.delete`
|
|
36
|
+
* [x] `.where()`, `.first()`, `.all()` chaining
|
|
37
|
+
* [x] Table name inference
|
|
38
|
+
* [x] Timestamps
|
|
39
|
+
* [x] Soft deletes
|
|
40
|
+
* [x] Basic relationship hooks (`hasOne`, `hasMany`, `belongsTo`)
|
|
41
|
+
* [x] Raw queries
|
|
42
|
+
* [x] Knex passthrough
|
|
43
|
+
* [x] SQLite3 test DB
|
|
44
|
+
* [x] Uses `mysql2` for production
|
|
45
|
+
* [x] `dotenv` support
|
|
46
|
+
|
|
47
|
+
## Testing
|
|
48
|
+
|
|
49
|
+
This project uses [Vitest](https://vitest.dev/) for testing.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm install
|
|
53
|
+
npm run migrate
|
|
54
|
+
npm run test
|
|
31
55
|
```
|
|
32
56
|
|
|
33
|
-
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
[MIT](./LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mevn-orm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "simple ORM for express js",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"scripts": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"lint": "eslint --ext .js ./"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"dotenv": "^
|
|
14
|
+
"dotenv": "^17.0.1",
|
|
15
15
|
"knex": "^3.0.0",
|
|
16
16
|
"mysql2": "^3.9.3"
|
|
17
17
|
},
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"@babel/core": "^7.24.5",
|
|
47
47
|
"@babel/eslint-parser": "^7.24.3",
|
|
48
48
|
"@babel/eslint-plugin": "^7.24.0",
|
|
49
|
-
"@faker-js/faker": "^8.
|
|
49
|
+
"@faker-js/faker": "^9.8.0",
|
|
50
50
|
"chai": "^4.4.1",
|
|
51
|
-
"dotenv": "^
|
|
51
|
+
"dotenv": "^17.0.1",
|
|
52
52
|
"knex": "^3.0.0",
|
|
53
53
|
"mocha": "^10.4.0",
|
|
54
54
|
"mysql": "^2.18.1",
|