@cocreate/socket-server 1.12.1 → 1.13.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.
@@ -42,18 +42,42 @@ jobs:
42
42
  new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
43
43
  new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
44
44
 
45
- docs:
46
- runs-on: ubuntu-latest
47
- steps:
48
- - name: Checkout
49
- uses: actions/checkout@v3
50
- - name: setup nodejs
51
- uses: actions/setup-node@v3
52
- with:
53
- node-version: 16
54
- - name: update documentation
55
- uses: CoCreate-app/CoCreate-docs@master
56
- env:
57
- organization_id: ${{ secrets.COCREATE_ORGANIZATION_ID }}
58
- key: ${{ secrets.COCREATE_KEY }}
59
- host: ${{ secrets.COCREATE_HOST }}
45
+ upload:
46
+ runs-on: ubuntu-latest
47
+
48
+ steps:
49
+ - name: Checkout
50
+ uses: actions/checkout@v3
51
+
52
+ - name: Setup Node.js
53
+ uses: actions/setup-node@v3
54
+ with:
55
+ node-version: 16
56
+
57
+ - name: Get Environment Variables
58
+ run: |
59
+ echo "organization_id=${{ secrets.COCREATE_ORGANIZATION_ID }}" >> $GITHUB_ENV
60
+ echo "key=${{ secrets.COCREATE_KEY }}" >> $GITHUB_ENV
61
+ echo "host=${{ secrets.COCREATE_HOST }}" >> $GITHUB_ENV
62
+
63
+ - name: Install @cocreate/cli
64
+ run: npm install -g @cocreate/cli
65
+
66
+ - name: CoCreate CLI Upload
67
+ run: coc upload
68
+
69
+ # docs:
70
+ # runs-on: ubuntu-latest
71
+ # steps:
72
+ # - name: Checkout
73
+ # uses: actions/checkout@v3
74
+ # - name: setup nodejs
75
+ # uses: actions/setup-node@v3
76
+ # with:
77
+ # node-version: 16
78
+ # - name: update documentation
79
+ # uses: CoCreate-app/CoCreate-docs@master
80
+ # env:
81
+ # organization_id: ${{ secrets.COCREATE_ORGANIZATION_ID }}
82
+ # key: ${{ secrets.COCREATE_KEY }}
83
+ # host: ${{ secrets.COCREATE_HOST }}
package/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## [1.13.1](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.13.0...v1.13.1) (2023-06-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Refactor authentication method to use token decoding 🚀 ([249cf69](https://github.com/CoCreate-app/CoCreate-socket-server/commit/249cf69c3ce918a2d5bee324456008e1923d8226))
7
+ * Update dependencies versions for [@cocreate](https://github.com/cocreate) libraries ([b7d21f3](https://github.com/CoCreate-app/CoCreate-socket-server/commit/b7d21f334dd160fbad19b4f3539b6adfbfed9861))
8
+
9
+ # [1.13.0](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.12.1...v1.13.0) (2023-06-10)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * Update dependencies versions for [@cocreate](https://github.com/cocreate) libraries ([c5ea592](https://github.com/CoCreate-app/CoCreate-socket-server/commit/c5ea592a82ee5ed079bb51e876e52eadfda8df31))
15
+
16
+
17
+ ### Features
18
+
19
+ * Add CLI prompts for "organization_id" and "db" string ([5e2b5ba](https://github.com/CoCreate-app/CoCreate-socket-server/commit/5e2b5babee1a28d084bd60c417d7e3c2b7ecdad0))
20
+
1
21
  ## [1.12.1](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.12.0...v1.12.1) (2023-06-08)
2
22
 
3
23
 
@@ -1,9 +1,7 @@
1
1
  module.exports = {
2
- "config": {
3
- "organization_id": "",
4
- "key": "",
5
- "host": ""
6
- },
2
+ "organization_id": "",
3
+ "key": "",
4
+ "host": "",
7
5
  "sources": [
8
6
  {
9
7
  "collection": "files",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/socket-server",
3
- "version": "1.12.1",
3
+ "version": "1.13.1",
4
4
  "description": "CoCreate-socket-server",
5
5
  "keywords": [
6
6
  "cocreate-socket",
@@ -27,7 +27,6 @@
27
27
  "scripts": {
28
28
  "demo": "PORT=5000 node demo/server.js",
29
29
  "test": "echo \"Error: no test specified\" && exit 1",
30
- "docs": "node ./node_modules/@cocreate/docs/src/index.js",
31
30
  "postinstall": "node ./node_modules/@cocreate/cli/check-coc.js"
32
31
  },
33
32
  "repository": {
@@ -44,8 +43,7 @@
44
43
  "@cocreate/cli": "^1.29.3"
45
44
  },
46
45
  "dependencies": {
47
- "@cocreate/docs": "^1.8.2",
48
- "@cocreate/uuid": "^1.4.15",
46
+ "@cocreate/uuid": "^1.4.16",
49
47
  "ws": "7.5.9"
50
48
  }
51
49
  }
package/src/index.js CHANGED
@@ -2,12 +2,14 @@ const WebSocket = require('ws');
2
2
  const url = require("url");
3
3
  const EventEmitter = require("events").EventEmitter;
4
4
  const uid = require('@cocreate/uuid')
5
+ const { config } = require('@cocreate/cli')
5
6
 
6
7
  class SocketServer extends EventEmitter {
7
8
  constructor(server, prefix) {
8
9
  super();
9
10
  this.clients = new Map();
10
11
  this.prefix = prefix || "crud";
12
+ config({ key: 'organization_id', prompt: 'Enter your organization_id: ' })
11
13
 
12
14
  this.wss = new WebSocket.Server({ noServer: true });
13
15
  this.wss.on('headers', (headers, request) => {
@@ -127,7 +129,7 @@ class SocketServer extends EventEmitter {
127
129
  });
128
130
  let user_id = null;
129
131
  if (this.authenticate)
130
- user_id = await this.authenticate.getUserId(req);
132
+ user_id = await this.authenticate.decodeToken(req);
131
133
 
132
134
  if (this.authorize) {
133
135
  data.host = this.getHost(req)