@cocreate/api 1.10.17 → 1.10.19
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/.github/workflows/automated.yml +38 -15
- package/CHANGELOG.md +14 -0
- package/CoCreate.config.js +3 -5
- package/package.json +9 -11
- package/src/server.js +100 -100
|
@@ -81,19 +81,42 @@ jobs:
|
|
|
81
81
|
destination: /api/latest
|
|
82
82
|
acl: public-read
|
|
83
83
|
invalidations: true
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
84
|
+
upload:
|
|
85
|
+
runs-on: ubuntu-latest
|
|
86
|
+
|
|
87
|
+
steps:
|
|
88
|
+
- name: Checkout
|
|
89
|
+
uses: actions/checkout@v3
|
|
90
|
+
|
|
91
|
+
- name: Setup Node.js
|
|
92
|
+
uses: actions/setup-node@v3
|
|
93
|
+
with:
|
|
94
|
+
node-version: 16
|
|
95
|
+
|
|
96
|
+
- name: Get Environment Variables
|
|
97
|
+
run: |
|
|
98
|
+
echo "organization_id=${{ secrets.COCREATE_ORGANIZATION_ID }}" >> $GITHUB_ENV
|
|
99
|
+
echo "key=${{ secrets.COCREATE_KEY }}" >> $GITHUB_ENV
|
|
100
|
+
echo "host=${{ secrets.COCREATE_HOST }}" >> $GITHUB_ENV
|
|
101
|
+
|
|
102
|
+
- name: Install @cocreate/cli
|
|
103
|
+
run: npm install -g @cocreate/cli
|
|
104
|
+
|
|
105
|
+
- name: CoCreate CLI Upload
|
|
106
|
+
run: coc upload
|
|
99
107
|
|
|
108
|
+
# docs:
|
|
109
|
+
# runs-on: ubuntu-latest
|
|
110
|
+
# steps:
|
|
111
|
+
# - name: Checkout
|
|
112
|
+
# uses: actions/checkout@v3
|
|
113
|
+
# - name: setup nodejs
|
|
114
|
+
# uses: actions/setup-node@v3
|
|
115
|
+
# with:
|
|
116
|
+
# node-version: 16
|
|
117
|
+
# - name: update documentation
|
|
118
|
+
# uses: CoCreate-app/CoCreate-docs@master
|
|
119
|
+
# env:
|
|
120
|
+
# organization_id: ${{ secrets.COCREATE_ORGANIZATION_ID }}
|
|
121
|
+
# key: ${{ secrets.COCREATE_KEY }}
|
|
122
|
+
# host: ${{ secrets.COCREATE_HOST }}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.10.19](https://github.com/CoCreate-app/CoCreate-api/compare/v1.10.18...v1.10.19) (2023-06-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Update dependencies versions for [@cocreate](https://github.com/cocreate) libraries ([c39f065](https://github.com/CoCreate-app/CoCreate-api/commit/c39f065275f683be63c46393b19feaa1c79af2f0))
|
|
7
|
+
|
|
8
|
+
## [1.10.18](https://github.com/CoCreate-app/CoCreate-api/compare/v1.10.17...v1.10.18) (2023-06-10)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* Update dependencies versions for [@cocreate](https://github.com/cocreate) libraries ([baf7db4](https://github.com/CoCreate-app/CoCreate-api/commit/baf7db49a7ed5a313268a2f0e8e5412f70f87db3))
|
|
14
|
+
|
|
1
15
|
## [1.10.17](https://github.com/CoCreate-app/CoCreate-api/compare/v1.10.16...v1.10.17) (2023-06-04)
|
|
2
16
|
|
|
3
17
|
|
package/CoCreate.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/api",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.19",
|
|
4
4
|
"description": "A simple api helper component in vanilla javascript used by JavaScript developers to create thirdparty api intergrations. CoCreate-api includes the client component and server side for api processing. Thirdparty apis can be accessible using HTML5 attributes and/or JavaScript API. ",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"thirdparty-api-intergration",
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
"start": "npx webpack --config webpack.config.js",
|
|
29
29
|
"build": "NODE_ENV=production npx webpack --config webpack.config.js",
|
|
30
30
|
"dev": "npx webpack --config webpack.config.js --watch",
|
|
31
|
-
"
|
|
32
|
-
"hosting": "node ./node_modules/@cocreate/hosting/src/index.js"
|
|
31
|
+
"postinstall": "node ./node_modules/@cocreate/cli/check-coc.js"
|
|
33
32
|
},
|
|
34
33
|
"repository": {
|
|
35
34
|
"type": "git",
|
|
@@ -49,6 +48,7 @@
|
|
|
49
48
|
"devDependencies": {
|
|
50
49
|
"@babel/core": "^7.9.6",
|
|
51
50
|
"@babel/preset-env": "^7.9.6",
|
|
51
|
+
"@cocreate/cli": "^1.29.3",
|
|
52
52
|
"babel-loader": "^8.1.0",
|
|
53
53
|
"clean-webpack-plugin": "^3.0.0",
|
|
54
54
|
"file-loader": "^6.2.0",
|
|
@@ -60,13 +60,11 @@
|
|
|
60
60
|
"webpack-log": "^3.0.1"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@cocreate/actions": "^1.8.
|
|
64
|
-
"@cocreate/crud-client": "^1.21.
|
|
65
|
-
"@cocreate/
|
|
66
|
-
"@cocreate/
|
|
67
|
-
"@cocreate/
|
|
68
|
-
"@cocreate/
|
|
69
|
-
"@cocreate/socket-client": "^1.23.10",
|
|
70
|
-
"@cocreate/utils": "^1.21.1"
|
|
63
|
+
"@cocreate/actions": "^1.8.19",
|
|
64
|
+
"@cocreate/crud-client": "^1.21.11",
|
|
65
|
+
"@cocreate/element-prototype": "^1.8.17",
|
|
66
|
+
"@cocreate/render": "^1.24.19",
|
|
67
|
+
"@cocreate/socket-client": "^1.23.13",
|
|
68
|
+
"@cocreate/utils": "^1.21.4"
|
|
71
69
|
}
|
|
72
70
|
}
|
package/src/server.js
CHANGED
|
@@ -4,106 +4,106 @@ let socket = new socketClient("ws");
|
|
|
4
4
|
|
|
5
5
|
crud.setSocket(socket);
|
|
6
6
|
|
|
7
|
-
var api = (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
7
|
+
var api = (() => {
|
|
8
|
+
return {
|
|
9
|
+
send_response: (wsManager, socket, obj, send_response) => {
|
|
10
|
+
wsManager.send(socket, send_response, obj)
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
handleError: (wsManager, socket, action, error, component) => {
|
|
14
|
+
const response = {
|
|
15
|
+
'object': 'error',
|
|
16
|
+
'data': error || error.response || error.response.data || error.response.body || error.message || error,
|
|
17
|
+
};
|
|
18
|
+
wsManager.send(socket, component, { action, response })
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
getOrg: async (config, component) => {
|
|
22
|
+
|
|
23
|
+
socket.create({
|
|
24
|
+
namespace: config["organization_id"],
|
|
25
|
+
room: null,
|
|
26
|
+
host: config["host"]
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
let org = await crud.readDocument({
|
|
30
|
+
collection: "organizations",
|
|
31
|
+
key: config["key"],
|
|
32
|
+
organization_id: config["organization_id"],
|
|
33
|
+
document: {
|
|
34
|
+
_id: config["organization_id"]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
if (!org || !org.document && !org.document[0]) {
|
|
40
|
+
console.log(component, " Error GET ORG in : ", e);
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return org.document[0];
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
getOrgInRoutesbyHostname: async (config, hostname) => {
|
|
48
|
+
var socket_config = {
|
|
49
|
+
"config": {
|
|
50
|
+
"key": config["config"]["key"],
|
|
51
|
+
"organization_id": config["config"]["organization_id"],
|
|
52
|
+
},
|
|
53
|
+
"prefix": "ws",
|
|
54
|
+
"host": "server.cocreate.app:8088"
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
socket.create({
|
|
58
|
+
namespace: socket_config.config.organization_id,
|
|
59
|
+
room: null,
|
|
60
|
+
host: socket_config.host
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
let data2 = await crud.readDocument({
|
|
64
|
+
collection: "organizations",
|
|
65
|
+
filter: {
|
|
66
|
+
query: [{
|
|
67
|
+
name: 'hosts',
|
|
68
|
+
operator: "$in",
|
|
69
|
+
value: [hostname]
|
|
70
|
+
}],
|
|
71
|
+
},
|
|
72
|
+
key: config["config"]["key"],
|
|
73
|
+
organization_id: config["config"]["organization_id"]
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
var org = data2.document[0]
|
|
77
|
+
|
|
78
|
+
var socket_config = {
|
|
79
|
+
"config": {
|
|
80
|
+
"key": org["key"],
|
|
81
|
+
"organization_id": org["_id"].toString(),
|
|
82
|
+
},
|
|
83
|
+
"prefix": "ws",
|
|
84
|
+
"host": "server.cocreate.app:8088"
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
//other connection
|
|
88
|
+
socket.create({
|
|
89
|
+
namespace: socket_config.config.organization_id,
|
|
90
|
+
room: null,
|
|
91
|
+
host: socket_config.host
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
let myOrg = await crud.readDocument({
|
|
95
|
+
collection: "organizations",
|
|
96
|
+
key: org["key"],
|
|
97
|
+
organization_id: org["_id"],
|
|
98
|
+
document: {
|
|
99
|
+
_id: org["_id"]
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
let result = { 'row': myOrg, 'socket_config': socket_config };
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
}
|
|
107
107
|
})();
|
|
108
108
|
|
|
109
109
|
module.exports = api;
|