@cocreate/socket-server 1.6.11 → 1.7.1

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
@@ -1,3 +1,19 @@
1
+ ## [1.7.1](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.7.0...v1.7.1) (2023-04-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * removed permission.dbs it is now handeled by crud-server ([7dfb781](https://github.com/CoCreate-app/CoCreate-socket-server/commit/7dfb7812cf4ec020d23a5b688134d33abb029d0f))
7
+ * renamed domans to hosts ([6e4c75c](https://github.com/CoCreate-app/CoCreate-socket-server/commit/6e4c75cd2fae0d79950c06b1b919e913fd8b16d9))
8
+
9
+ # [1.7.0](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.6.11...v1.7.0) (2023-03-19)
10
+
11
+
12
+ ### Features
13
+
14
+ * if permmision returns db urls store in socket instance to allow crud to connect to user defined databases ([8342334](https://github.com/CoCreate-app/CoCreate-socket-server/commit/83423348c070a8985305ebf087ac83d538a6bc80))
15
+ * updated permission to return db urls to connect to 1 or more custom databases ([291fa5f](https://github.com/CoCreate-app/CoCreate-socket-server/commit/291fa5f14c8ef3ab82686935ee232dff413ad51d))
16
+
1
17
  ## [1.6.11](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.6.10...v1.6.11) (2023-02-01)
2
18
 
3
19
 
@@ -12,7 +12,7 @@ module.exports = {
12
12
  "name": "index.html",
13
13
  "path": "/docs/socket-server/index.html",
14
14
  "src": "{{./docs/index.html}}",
15
- "domains": [
15
+ "hosts": [
16
16
  "*",
17
17
  "general.cocreate.app"
18
18
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/socket-server",
3
- "version": "1.6.11",
3
+ "version": "1.7.1",
4
4
  "description": "CoCreate-socket-server",
5
5
  "keywords": [
6
6
  "cocreate-socket",
package/src/index.js CHANGED
@@ -61,7 +61,7 @@ class SocketServer extends EventEmitter{
61
61
  this.send(socket, 'connect', socket.config.key);
62
62
 
63
63
  }
64
-
64
+
65
65
  addClient(socket) {
66
66
  let organization_id = socket.config.organization_id
67
67
  let user_id = socket.config.user_id
@@ -109,8 +109,9 @@ class SocketServer extends EventEmitter{
109
109
  if (user_id)
110
110
  this.emit('userStatus', socket, {user_id, status: 'off', organization_id});
111
111
 
112
- this.emit("removeMetrics", null, { organization_id });
113
-
112
+ this.emit("deleteMetrics", null, { organization_id });
113
+ this.emit("deletePermissions", organization_id );
114
+ this.emit('disconnect', organization_id)
114
115
  this.asyncMessages.delete(key);
115
116
  } else {
116
117
  let total_cnt = 0;
@@ -147,15 +148,15 @@ class SocketServer extends EventEmitter{
147
148
 
148
149
  //. check permission
149
150
  if (this.permissionInstance) {
150
- const passStatus = await this.permissionInstance.check(action, data, req, user_id)
151
- if (passStatus !== true) {
152
- // if (action == 'syncServer' && passStatus.database === true)
151
+ const permission = await this.permissionInstance.check(action, data, req, user_id)
152
+ if (!permission || permission.status === false) {
153
+ // if (action == 'syncServer' && permission.database === true)
153
154
  // if (action == 'syncServer')
154
155
  // this.emit('createDocument', socket, data);
155
156
  // else
156
- this.send(socket, 'Access Denied', {action, passStatus, data})
157
+ this.send(socket, 'Access Denied', {action, permission, data})
157
158
  return;
158
- }
159
+ }
159
160
  }
160
161
 
161
162
  if (user_id) {