@cocreate/socket-server 1.1.10 → 1.1.13

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,26 @@
1
+ ## [1.1.13](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.1.12...v1.1.13) (2022-03-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * removed emit changeDB ([cde4d9f](https://github.com/CoCreate-app/CoCreate-socket-server/commit/cde4d9f6f74d7cbf536eddb4a87436cc315e07fe))
7
+ * update pakage.json main to src/index ([4188d9c](https://github.com/CoCreate-app/CoCreate-socket-server/commit/4188d9c65ef461c26cc7ea3e12d8216f20183ea5))
8
+
9
+ ## [1.1.12](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.1.11...v1.1.12) (2022-02-28)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * update param requestData.action to requestData.module ([8a1a7e0](https://github.com/CoCreate-app/CoCreate-socket-server/commit/8a1a7e0b7eb14c948973c42e97911781e91b9e53))
15
+ * wildcard permission for docs domain ([7a0d5cd](https://github.com/CoCreate-app/CoCreate-socket-server/commit/7a0d5cd1ca0cc275e28362333addd8c3a35b15b3))
16
+
17
+ ## [1.1.11](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.1.10...v1.1.11) (2022-02-16)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * update dependencies ([b8d3cb3](https://github.com/CoCreate-app/CoCreate-socket-server/commit/b8d3cb38658d58b85d127bb68a3beab5781e0128))
23
+
1
24
  ## [1.1.10](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.1.9...v1.1.10) (2022-02-09)
2
25
 
3
26
 
@@ -14,7 +14,7 @@ module.exports = {
14
14
  "name": "index.html",
15
15
  "path": "/docs/socket-server/index.html",
16
16
  "domains": [
17
- "cocreate.app",
17
+ "*",
18
18
  "general.cocreate.app"
19
19
  ],
20
20
  "directory": "/docs/socket-server",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/socket-server",
3
- "version": "1.1.10",
3
+ "version": "1.1.13",
4
4
  "description": "CoCreate-socket-server",
5
5
  "keywords": [
6
6
  "cocreate-socket",
@@ -23,7 +23,7 @@
23
23
  "publishConfig": {
24
24
  "access": "public"
25
25
  },
26
- "main": "index.js",
26
+ "main": "./src/index",
27
27
  "scripts": {
28
28
  "demo": "PORT=5000 node demo/server.js",
29
29
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -40,8 +40,8 @@
40
40
  },
41
41
  "homepage": "https://cocreate.app/docs/CoCreate-socket-server",
42
42
  "dependencies": {
43
- "@cocreate/docs": "^1.2.68",
44
- "@cocreate/uuid": "^1.0.5",
43
+ "@cocreate/docs": "^1.2.70",
44
+ "@cocreate/uuid": "^1.1.60",
45
45
  "querystring": "^0.2.0",
46
46
  "ws": "^7.3.0"
47
47
  },
package/src/index.js CHANGED
@@ -145,20 +145,21 @@ class SocketServer extends EventEmitter{
145
145
  const requestData = JSON.parse(message)
146
146
  let cloneRoomInfo = {...roomInfo};
147
147
 
148
- if (requestData.action) {
148
+ if (requestData.module) {
149
149
  let user_id = null;
150
150
  if (this.authInstance) {
151
151
  user_id = await this.authInstance.getUserId(req);
152
152
  }
153
+
153
154
  //. check permission
154
155
  if (this.permissionInstance) {
155
- let passStatus = await this.permissionInstance.check(requestData.action, requestData.data, req, user_id)
156
+ let passStatus = await this.permissionInstance.check(requestData.module, requestData.data, req, user_id)
156
157
  if (!passStatus) {
157
158
  this.send(ws, 'permissionError', requestData.data, cloneRoomInfo.orgId, cloneRoomInfo)
158
159
  return;
159
160
  }
160
161
  }
161
-
162
+
162
163
  //. checking async status....
163
164
  if (requestData.data.async == true) {
164
165
  const uuid = CoCreateUUID.generate(), asyncMessage = this.asyncMessages.get(cloneRoomInfo.key);
@@ -167,12 +168,7 @@ class SocketServer extends EventEmitter{
167
168
  asyncMessage.defineMessage(uuid);
168
169
  }
169
170
  }
170
- //. End
171
-
172
- if (cloneRoomInfo.orgId != null) {
173
- this.emit('changeDB', ws, { db: cloneRoomInfo.orgId }, cloneRoomInfo);
174
- }
175
- this.emit(requestData.action, ws, requestData.data, cloneRoomInfo);
171
+ this.emit(requestData.module, ws, requestData.data, cloneRoomInfo);
176
172
  }
177
173
 
178
174
  } catch(e) {
@@ -188,7 +184,7 @@ class SocketServer extends EventEmitter{
188
184
  room_key += `/${room}`;
189
185
  }
190
186
  const responseData =JSON.stringify({
191
- action: messageType,
187
+ module: messageType,
192
188
  data: data
193
189
  });
194
190
 
@@ -217,7 +213,6 @@ class SocketServer extends EventEmitter{
217
213
  }
218
214
 
219
215
  } else {
220
-
221
216
  this.clients.forEach((value, key) => {
222
217
  console.log(value.length, key)
223
218
  if (key.includes(room_key)) {
@@ -245,7 +240,7 @@ class SocketServer extends EventEmitter{
245
240
  send(ws, messageType, data, orgId, roomInfo){
246
241
  const asyncId = this.getAsyncId(roomInfo)
247
242
  let responseData = JSON.stringify({
248
- action: messageType,
243
+ module: messageType,
249
244
  data: data
250
245
  });
251
246
 
package/index.js DELETED
@@ -1,4 +0,0 @@
1
- 'use strict';
2
-
3
- const SocketServer = require('./src/index');
4
- module.exports = SocketServer;