monastery 1.32.5 → 1.35.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/.eslintrc.json +1 -1
- package/changelog.md +21 -0
- package/docs/readme.md +17 -0
- package/docs/schema/index.md +3 -3
- package/lib/index.js +3 -0
- package/lib/model-crud.js +194 -252
- package/lib/model-validate.js +16 -47
- package/lib/model.js +8 -53
- package/package.json +1 -1
- package/plugins/images/index.js +2 -2
- package/test/blacklisting.js +256 -78
- package/test/crud.js +5 -1
- package/test/model.js +0 -165
- package/test/util.js +7 -0
package/.eslintrc.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"plugins": [],
|
|
22
22
|
"rules": {
|
|
23
23
|
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
|
|
24
|
-
"max-len": ["error", { "code":
|
|
24
|
+
"max-len": ["error", { "code": 125, "ignorePattern": "^\\s*<(rect|path|line)\\s" }],
|
|
25
25
|
"no-prototype-builtins": "off",
|
|
26
26
|
"no-unused-vars": ["error", { "args": "none" }],
|
|
27
27
|
"object-shorthand": ["error", "consistent"],
|
package/changelog.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.35.0](https://github.com/boycce/monastery/compare/1.34.0...1.35.0) (2022-04-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* `false` removes blacklist, added tests for blacklisting/project stirng ([5999859](https://github.com/boycce/monastery/commit/599985972cc14b980148db26c03108feabf23756))
|
|
11
|
+
|
|
12
|
+
## [1.34.0](https://github.com/boycce/monastery/compare/1.33.0...1.34.0) (2022-04-05)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* added db.arraySchema / db.arrayWithSchema ([4210dc3](https://github.com/boycce/monastery/commit/4210dc33486de757a22d0973e661522e19230158))
|
|
18
|
+
|
|
19
|
+
## [1.33.0](https://github.com/boycce/monastery/compare/1.32.5...1.33.0) (2022-04-05)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* whitelisting a parent will remove any previously blacklisted children ([d335c2e](https://github.com/boycce/monastery/commit/d335c2e2e9e691b2c0b406f06cb9c2ed14f8bb25))
|
|
25
|
+
|
|
5
26
|
### [1.32.5](https://github.com/boycce/monastery/compare/1.32.4...1.32.5) (2022-03-21)
|
|
6
27
|
|
|
7
28
|
|
package/docs/readme.md
CHANGED
|
@@ -81,6 +81,23 @@ npm run dev -- -t 'Model indexes'
|
|
|
81
81
|
|
|
82
82
|
Coming soon...
|
|
83
83
|
|
|
84
|
+
## Roadmap
|
|
85
|
+
|
|
86
|
+
- Add FindOneAndUpdate
|
|
87
|
+
- Add before/afterInsertUpdate
|
|
88
|
+
- Bug: Setting an object literal on an ID field ('model') saves successfully
|
|
89
|
+
- Population within array items
|
|
90
|
+
- ~~Blacklist `false` removes all blacklisting~~
|
|
91
|
+
- ~~Add project to insert/update/validate~~
|
|
92
|
+
- ~~Whitelisting a parent will remove any previously blacklisted children~~
|
|
93
|
+
- ~~Blacklist/project works the same across find/insert/update/validate~~
|
|
94
|
+
- Automatic subdocument ids
|
|
95
|
+
- Remove ACL default 'public read'
|
|
96
|
+
- ~~Public db.arrayWithSchema method~~
|
|
97
|
+
- Global after/before hooks
|
|
98
|
+
- Split away from Monk (unless updated)
|
|
99
|
+
- docs: Make the implicit ID query conversion more apparent
|
|
100
|
+
|
|
84
101
|
## Special Thanks
|
|
85
102
|
|
|
86
103
|
[Jerome Gravel-Niquet](https://github.com/jeromegn)
|
package/docs/schema/index.md
CHANGED
|
@@ -248,9 +248,9 @@ schema.messages = {
|
|
|
248
248
|
}
|
|
249
249
|
// You can also target any rules set on the array or sub arrays
|
|
250
250
|
// e.g.
|
|
251
|
-
// let arrayWithSchema = (array, schema) => { array.schema = schema; return array }
|
|
252
|
-
// petGroups = arrayWithSchema(
|
|
253
|
-
// [arrayWithSchema(
|
|
251
|
+
// // let arrayWithSchema = (array, schema) => { array.schema = schema; return array }, OR you can use db.arrayWithSchema
|
|
252
|
+
// petGroups = db.arrayWithSchema(
|
|
253
|
+
// [db.arrayWithSchema(
|
|
254
254
|
// [{ name: { type: 'string' }}],
|
|
255
255
|
// { minLength: 1 }
|
|
256
256
|
// )],
|
package/lib/index.js
CHANGED
|
@@ -53,6 +53,9 @@ module.exports = function(uri, opts, fn) {
|
|
|
53
53
|
manager.timestamps = timestamps
|
|
54
54
|
manager.useMilliseconds = useMilliseconds
|
|
55
55
|
manager.beforeModel = []
|
|
56
|
+
manager.arrayWithSchema = manager.arraySchema = (array, schema) => {
|
|
57
|
+
array.schema = schema; return array
|
|
58
|
+
}
|
|
56
59
|
|
|
57
60
|
// Depreciation warnings
|
|
58
61
|
if (depreciationWarningDefaultField) {
|