@cocreate/socket-server 1.1.9 → 1.1.12

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,25 @@
1
+ ## [1.1.12](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.1.11...v1.1.12) (2022-02-28)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update param requestData.action to requestData.module ([8a1a7e0](https://github.com/CoCreate-app/CoCreate-socket-server/commit/8a1a7e0b7eb14c948973c42e97911781e91b9e53))
7
+ * wildcard permission for docs domain ([7a0d5cd](https://github.com/CoCreate-app/CoCreate-socket-server/commit/7a0d5cd1ca0cc275e28362333addd8c3a35b15b3))
8
+
9
+ ## [1.1.11](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.1.10...v1.1.11) (2022-02-16)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * update dependencies ([b8d3cb3](https://github.com/CoCreate-app/CoCreate-socket-server/commit/b8d3cb38658d58b85d127bb68a3beab5781e0128))
15
+
16
+ ## [1.1.10](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.1.9...v1.1.10) (2022-02-09)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * add document_id to CoCreate.config ([dbe4c05](https://github.com/CoCreate-app/CoCreate-socket-server/commit/dbe4c05864aab9f2cd81d5b3754f9ec23a28d087))
22
+
1
23
  ## [1.1.9](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.1.8...v1.1.9) (2022-02-09)
2
24
 
3
25
 
@@ -8,13 +8,13 @@ module.exports = {
8
8
  {
9
9
  "entry": "./docs/index.html",
10
10
  "collection": "files",
11
- "document_id": "",
11
+ "document_id": "6204254580b409001727b744",
12
12
  "key": "src",
13
13
  "data": {
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.9",
3
+ "version": "1.1.12",
4
4
  "description": "CoCreate-socket-server",
5
5
  "keywords": [
6
6
  "cocreate-socket",
@@ -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);
@@ -172,7 +173,7 @@ class SocketServer extends EventEmitter{
172
173
  if (cloneRoomInfo.orgId != null) {
173
174
  this.emit('changeDB', ws, { db: cloneRoomInfo.orgId }, cloneRoomInfo);
174
175
  }
175
- this.emit(requestData.action, ws, requestData.data, cloneRoomInfo);
176
+ this.emit(requestData.module, ws, requestData.data, cloneRoomInfo);
176
177
  }
177
178
 
178
179
  } catch(e) {
@@ -188,7 +189,7 @@ class SocketServer extends EventEmitter{
188
189
  room_key += `/${room}`;
189
190
  }
190
191
  const responseData =JSON.stringify({
191
- action: messageType,
192
+ module: messageType,
192
193
  data: data
193
194
  });
194
195
 
@@ -245,7 +246,7 @@ class SocketServer extends EventEmitter{
245
246
  send(ws, messageType, data, orgId, roomInfo){
246
247
  const asyncId = this.getAsyncId(roomInfo)
247
248
  let responseData = JSON.stringify({
248
- action: messageType,
249
+ module: messageType,
249
250
  data: data
250
251
  });
251
252