monastery 2.2.2 → 2.2.3

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,8 @@
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
+ ### [2.2.3](https://github.com/boycce/monastery/compare/2.2.2...2.2.3) (2024-04-28)
6
+
5
7
  ### [2.2.2](https://github.com/boycce/monastery/compare/2.2.1...2.2.2) (2024-04-07)
6
8
 
7
9
  ### [2.2.1](https://github.com/boycce/monastery/compare/2.2.0...2.2.1) (2024-04-07)
File without changes
package/docs/readme.md CHANGED
@@ -65,6 +65,12 @@ db.user.insert({
65
65
  // }]
66
66
  })
67
67
  ```
68
+ ## Versions
69
+
70
+ - Monk: `v7.3.4`
71
+ - MongoDB NodeJS driver: `v3.7.4` ([MongoDB compatibility](https://www.mongodb.com/docs/drivers/node/current/compatibility/#compatibility))
72
+ - MongoDB: [`v5.0.0`](https://www.mongodb.com/docs/v5.0/reference/) [(`v6.0.0` partial support)](https://www.mongodb.com/docs/v6.0/reference/)
73
+
68
74
  ## Debugging
69
75
 
70
76
  This package uses [debug](https://github.com/visionmedia/debug) which allows you to set different levels of output via the `DEBUG` environment variable. Due to known limations `monastery:warning` and `monastery:error` are forced on, you can however disable these via [manager settings](./manager).
@@ -101,7 +107,7 @@ Coming soon...
101
107
  - Global after/before hooks
102
108
  - before hooks can receive a data array, remove this
103
109
  - docs: Make the implicit ID query conversion more apparent
104
- - Split away from Monk (unless updated)
110
+ - Split away from Monk so we can update the MongoDB NodeJS Driver version
105
111
  - Add a warning if an invalid model is referenced in jthe schema
106
112
  - Remove leading forward slashes from custom image paths (AWS adds this as a seperate folder)
107
113
  - double check await db.model.remove({ query: idfromparam }) doesnt cause issues for null, undefined or '', but continue to allow {}
@@ -111,12 +117,6 @@ Coming soon...
111
117
  - test importing of models
112
118
  - Docs: model.methods
113
119
 
114
- ## Versions
115
-
116
- - Monk: `v7.3.4`
117
- - MongoDB NodeJS driver: `v3.2.3` ([compatibility](https://www.mongodb.com/docs/drivers/node/current/compatibility/#compatibility))
118
- - MongoDB: [`v4.0.0`](https://www.mongodb.com/docs/v4.2/reference/)
119
-
120
120
  ## Special Thanks
121
121
 
122
122
  [Jerome Gravel-Niquet](https://github.com/jeromegn)
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": "2.2.2",
5
+ "version": "2.2.3",
6
6
  "license": "MIT",
7
7
  "repository": "github:boycce/monastery",
8
8
  "homepage": "https://boycce.github.io/monastery/",
@@ -30,11 +30,12 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@aws-sdk/client-s3": "3.549.0",
33
+ "@aws-sdk/lib-storage": "3.549.0",
33
34
  "@aws-sdk/s3-request-presigner": "3.549.0",
34
35
  "debug": "4.3.4",
35
36
  "file-type": "^16.5.4",
36
- "monk": "7.3.4",
37
37
  "mongodb": "^3.2.3",
38
+ "monk": "7.3.4",
38
39
  "nanoid": "3.2.0",
39
40
  "validator": "13.7.0"
40
41
  },
@@ -174,11 +174,22 @@ let plugin = module.exports = {
174
174
  plugin._addImageObjectsToData(filesArr.inputPath, data, image)
175
175
  resolve(s3Options)
176
176
  } else {
177
- plugin.getS3Client().upload(s3Options, (err, response) => {
178
- if (err) return reject(err)
179
- plugin._addImageObjectsToData(filesArr.inputPath, data, image)
180
- resolve(s3Options)
177
+ const { Upload } = require('@aws-sdk/lib-storage')
178
+ const upload = new Upload({
179
+ client: plugin.getS3Client(),
180
+ params: s3Options,
181
181
  })
182
+ // upload.on('httpUploadProgress', (progress) => {
183
+ // console.log(progress)
184
+ // })
185
+ upload.done()
186
+ .then((res) => {
187
+ plugin._addImageObjectsToData(filesArr.inputPath, data, image)
188
+ resolve(s3Options)
189
+ })
190
+ .catch((err) => {
191
+ reject(err)
192
+ })
182
193
  }
183
194
  })
184
195
  }))
package/test/monk.js CHANGED
@@ -37,4 +37,17 @@ module.exports = function(monastery, opendb) {
37
37
  })
38
38
  })
39
39
 
40
+ test('Monk basic operations', async () => {
41
+ let db = monastery('localhost/monastery', { serverSelectionTimeoutMS: 2000 })
42
+ let userCol = db.get('user')
43
+
44
+ // Insert (returns whole document)
45
+ let res1 = await userCol.insert({ woot: 'b' })
46
+ expect(res1).toEqual(expect.objectContaining({ woot: 'b', _id: expect.any(Object) }))
47
+
48
+ // Update (returns whole document)
49
+ let res2 = await userCol.update({ woot: 'b' }, { $set: { woot: 'c' }})
50
+ expect(res2).toEqual(expect.objectContaining({ n: 1, nModified: 1, ok: 1 }))
51
+ })
52
+
40
53
  }