monastery 1.40.4 → 1.40.5
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 +2 -0
- package/docs/image-plugin.md +8 -2
- package/docs/readme.md +1 -0
- package/package.json +1 -1
- package/plugins/images/index.js +2 -1
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
|
+
### [1.40.5](https://github.com/boycce/monastery/compare/1.40.4...1.40.5) (2023-02-22)
|
|
6
|
+
|
|
5
7
|
### [1.40.4](https://github.com/boycce/monastery/compare/1.40.3...1.40.4) (2022-12-21)
|
|
6
8
|
|
|
7
9
|
### [1.40.3](https://github.com/boycce/monastery/compare/1.40.2...1.40.3) (2022-12-21)
|
package/docs/image-plugin.md
CHANGED
|
@@ -43,7 +43,7 @@ let user = db.model('user', {
|
|
|
43
43
|
})
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
Then when inserting or updating a document you need to set `files` to an
|
|
46
|
+
Then when inserting or updating a document you need to set `options.files` to an object containing your parsed files, [express-fileupload](https://github.com/richardgirges/express-fileupload) works great with an express setup, e.g.
|
|
47
47
|
|
|
48
48
|
```js
|
|
49
49
|
user.update({
|
|
@@ -53,7 +53,13 @@ user.update({
|
|
|
53
53
|
})
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
### Updating documents
|
|
57
|
+
|
|
58
|
+
When updating a document with `options.files`, you need to make sure to **always** include previously uploaded file objects in `options.data` otherwise these will be removed automatically from your S3 bucket (via a comparsion check against your previous document).
|
|
59
|
+
|
|
60
|
+
You can reuse the image objects (e.g. `{ bucket, data, uid, ... }`) for other file field values on the same document. You can't however copy image objects across documents and collections.
|
|
61
|
+
|
|
62
|
+
You can skip all file processing by not defining `options.files`. A nice way to sepearte file and non-file updates is by appending ?files=true to your API route calls, e.g.
|
|
57
63
|
|
|
58
64
|
```js
|
|
59
65
|
user.update({
|
package/docs/readme.md
CHANGED
|
@@ -100,6 +100,7 @@ Coming soon...
|
|
|
100
100
|
- docs: Make the implicit ID query conversion more apparent
|
|
101
101
|
- Split away from Monk (unless updated)
|
|
102
102
|
- Add a warning if an invalid model is referenced in jthe schema
|
|
103
|
+
- Remove leading forward slashes from custom image paths (AWS adds this as a seperate folder)
|
|
103
104
|
|
|
104
105
|
## Versions
|
|
105
106
|
|
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.40.
|
|
5
|
+
"version": "1.40.5",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "github:boycce/monastery",
|
|
8
8
|
"homepage": "https://boycce.github.io/monastery/",
|
package/plugins/images/index.js
CHANGED
|
@@ -322,7 +322,8 @@ let plugin = module.exports = {
|
|
|
322
322
|
// valid image-object?
|
|
323
323
|
if (typeof useCount[image.image.uid] == 'undefined') {
|
|
324
324
|
throw `The passed image object for '${image.dataPath}' does not match any pre-existing
|
|
325
|
-
images saved on this document
|
|
325
|
+
images saved on this document. Make sure that this image dosen't come from another document or
|
|
326
|
+
collection, and is indeed saved on this document.`
|
|
326
327
|
// Different image from prexisting image
|
|
327
328
|
} else if (preExistingImage && preExistingImage.image.uid != image.image.uid) {
|
|
328
329
|
useCount[preExistingImage.image.uid]--
|