monastery 1.33.0 → 1.34.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/changelog.md CHANGED
@@ -2,6 +2,13 @@
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.34.0](https://github.com/boycce/monastery/compare/1.33.0...1.34.0) (2022-04-05)
6
+
7
+
8
+ ### Features
9
+
10
+ * added db.arraySchema / db.arrayWithSchema ([4210dc3](https://github.com/boycce/monastery/commit/4210dc33486de757a22d0973e661522e19230158))
11
+
5
12
  ## [1.33.0](https://github.com/boycce/monastery/compare/1.32.5...1.33.0) (2022-04-05)
6
13
 
7
14
 
package/docs/readme.md CHANGED
@@ -87,7 +87,8 @@ Coming soon...
87
87
  - Add before/afterInsertUpdate
88
88
  - Bug: Setting an object literal on an ID field ('model') saves successfully
89
89
  - Population within array items
90
- - Deep blackislisitng which aggregates from the order of appearance
90
+ - ~~Blackislisitng which aggregates from the order of appearance~~
91
+ - ~~Whitelisting a parent will remove any previously blacklisted children~~
91
92
  - Automatic subdocument ids
92
93
  - Remove ACL default 'public read'
93
94
  - Public db.arrayWithSchema method
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) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "monastery",
3
3
  "description": "⛪ A straight forward MongoDB ODM built around Monk",
4
4
  "author": "Ricky Boyce",
5
- "version": "1.33.0",
5
+ "version": "1.34.0",
6
6
  "license": "MIT",
7
7
  "repository": "github:boycce/monastery",
8
8
  "homepage": "https://boycce.github.io/monastery/",
package/test/util.js CHANGED
@@ -39,4 +39,11 @@ module.exports = function(monastery, opendb) {
39
39
  expect(db.isId('5ff50fe955da2c00170de734')).toEqual(true)
40
40
  })
41
41
 
42
+ test('utilities arrayWithSchema', async () => {
43
+ let db = (await opendb(false)).db
44
+ let res = db.arrayWithSchema([{ name: { type: 'string' }}], { minLength: 1 })
45
+ expect(res).toContainEqual({ name: { type: 'string' }})
46
+ expect(res.schema).toEqual({ minLength: 1 })
47
+ })
48
+
42
49
  }