mango-cms 0.2.30 → 0.2.31

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.
@@ -1,24 +1,32 @@
1
1
  {
2
- "port": 6646,
3
- "frontPort": 6645,
4
- "siteName": "Example",
5
- "siteDomain": "example.com",
6
- "mangoDomain": "api.example.com",
2
+ "port": 6646,
3
+ "frontPort": 6645,
4
+ "siteName": "Example",
5
+ "siteDomain": "example.com",
6
+ "mangoDomain": "api.example.com",
7
7
 
8
- "useDevAPI": true,
8
+ "mangoThreads": 2,
9
+ "maxPoolSize": 10,
10
+ "minPoolSize": 0,
11
+ "maxIdleTimeMS": 60000,
12
+ "waitQueueTimeoutMS": 5000,
9
13
 
10
- "mongoURI":"mongodb://127.0.0.1:27017",
11
- "database":"exampleMongoDB",
14
+ "useDevAPI": true,
12
15
 
13
- "s3AccessKeyId": null,
14
- "s3AccessKeySecret": null,
15
- "s3Region": null,
16
- "s3Bucket":"exampleBucket",
16
+ "mongoURI": "mongodb://127.0.0.1:27017",
17
+ "database": "exampleMongoDB",
17
18
 
18
- "mailgunKey": null,
19
- "mailgunDomain": null,
19
+ "s3AccessKeyId": null,
20
+ "s3AccessKeySecret": null,
21
+ "s3Region": null,
22
+ "s3Bucket": "exampleBucket",
20
23
 
21
- "algoliaAppId": null,
22
- "algoliaSearchKey": null,
23
- "algoliaIndex": null
24
+ "emailProvider": "",
25
+ "resendKey": null,
26
+ "mailgunKey": null,
27
+ "mailgunDomain": null,
28
+
29
+ "algoliaAppId": null,
30
+ "algoliaSearchKey": null,
31
+ "algoliaIndex": null
24
32
  }
@@ -1,10 +1,24 @@
1
- const subscribe = ({ io, collection, document, request, individual }) => {
1
+ const subscribe = ({ io, collection, document, request, individual, originalDocument }) => {
2
2
  let method = request.method
3
3
  if (collection.subscribe && method != 'read' && individual) {
4
- let roomId = request.member?.id
5
- console.log('attempting to emit to', collection.name, roomId, `${collection.name}:${method}d`)
4
+
6
5
  const subscription = io.of(collection.name);
7
- subscription.to(roomId).emit(`${collection.name}:${method}d`, document);
6
+
7
+ // Send to the id and the author id
8
+ let payload = method == 'delete' ? originalDocument : document
9
+ subscription.to(request.member?.id).emit(`${collection.name}:${method}d`, payload);
10
+ subscription.to((document?.id||originalDocument?.id)).emit(`${collection.name}:${method}d`, payload);
11
+
12
+ // Send to each custom room
13
+ for (let room of (collection.subscribe?.rooms||[])) {
14
+ let keys = room.split('.')
15
+ let target = document
16
+ for (let key of keys) target = target[key]
17
+ console.log(document, keys)
18
+ let roomId = target
19
+ console.log('attempting to emit to', collection.name, roomId, `${collection.name}:${method}d`)
20
+ subscription.to(roomId).emit(`${collection.name}:${method}d`, payload);
21
+ }
8
22
  }
9
23
  }
10
24
 
@@ -25,7 +25,7 @@
25
25
  "dayjs": "^1.10.7",
26
26
  "express": "^4.18.1",
27
27
  "google-maps": "^4.3.3",
28
- "mango-cms": "^0.2.30",
28
+ "mango-cms": "^0.2.31",
29
29
  "mapbox-gl": "^2.7.0",
30
30
  "sweetalert2": "^11.4.0",
31
31
  "vite": "^6.2.2",
@@ -78,8 +78,7 @@ const store = reactive({
78
78
 
79
79
  })
80
80
 
81
- let Authorization = window.localStorage.getItem('email') + ';' + window.localStorage.getItem('user')
82
- axios.defaults.headers.common['Authorization'] = Authorization
81
+ axios.defaults.headers.common['Authorization'] = window.localStorage.getItem('token')
83
82
 
84
83
  app.provide('store', store)
85
84
  app.provide('axios', axios)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mango-cms",
3
- "version": "0.2.30",
3
+ "version": "0.2.31",
4
4
  "main": "./index.js",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -85,6 +85,7 @@
85
85
  "parse-html-text-content": "^1.1.1",
86
86
  "redis": "^4.7.0",
87
87
  "require-all": "^3.0.0",
88
+ "resend": "^6.3.0",
88
89
  "sharp": "^0.32.1",
89
90
  "socket.io": "^4.8.0",
90
91
  "socket.io-redis": "^6.1.1",