@cocreate/api 1.1.35 → 1.1.39
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 +29 -0
- package/package.json +7 -7
- package/src/client.js +5 -25
- package/src/server.js +19 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
## [1.1.39](https://github.com/CoCreate-app/CoCreate-api/compare/v1.1.38...v1.1.39) (2021-10-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update dependencies ([6786fd8](https://github.com/CoCreate-app/CoCreate-api/commit/6786fd820f20450de3752baf1209a36bedab335e))
|
|
7
|
+
|
|
8
|
+
## [1.1.38](https://github.com/CoCreate-app/CoCreate-api/compare/v1.1.37...v1.1.38) (2021-10-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* fixed bug event name cant be found when socket-client used on server side ([c5d8246](https://github.com/CoCreate-app/CoCreate-api/commit/c5d8246a77cb77d92446139c92737819dec06967))
|
|
14
|
+
|
|
15
|
+
## [1.1.37](https://github.com/CoCreate-app/CoCreate-api/compare/v1.1.36...v1.1.37) (2021-10-16)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* updated create socket ([623c743](https://github.com/CoCreate-app/CoCreate-api/commit/623c7438ee9a3434bb72021c04e6a16358183284))
|
|
21
|
+
* updated dependency ([d5b6740](https://github.com/CoCreate-app/CoCreate-api/commit/d5b674081a59e56d4b359a62d00e321b93fad5c2))
|
|
22
|
+
|
|
23
|
+
## [1.1.36](https://github.com/CoCreate-app/CoCreate-api/compare/v1.1.35...v1.1.36) (2021-10-16)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* update socket package to fix bug in docs ([ad4cf54](https://github.com/CoCreate-app/CoCreate-api/commit/ad4cf54d06aa691e46014236940f6414d73a7761))
|
|
29
|
+
|
|
1
30
|
## [1.1.35](https://github.com/CoCreate-app/CoCreate-api/compare/v1.1.34...v1.1.35) (2021-10-16)
|
|
2
31
|
|
|
3
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/api",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.39",
|
|
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",
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"webpack-log": "^3.0.1"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@cocreate/action": "^1.3.
|
|
66
|
-
"@cocreate/crud-client": "^1.4.
|
|
67
|
-
"@cocreate/docs": "^1.2.
|
|
68
|
-
"@cocreate/hosting": "^1.2.
|
|
69
|
-
"@cocreate/render": "^1.3.
|
|
70
|
-
"@cocreate/socket-client": "^1.3.
|
|
65
|
+
"@cocreate/action": "^1.3.4",
|
|
66
|
+
"@cocreate/crud-client": "^1.4.16",
|
|
67
|
+
"@cocreate/docs": "^1.2.43",
|
|
68
|
+
"@cocreate/hosting": "^1.2.37",
|
|
69
|
+
"@cocreate/render": "^1.3.5",
|
|
70
|
+
"@cocreate/socket-client": "^1.3.7"
|
|
71
71
|
}
|
|
72
72
|
}
|
package/src/client.js
CHANGED
|
@@ -10,6 +10,8 @@ const CoCreateApi = {
|
|
|
10
10
|
|
|
11
11
|
init: function({name, module}) {
|
|
12
12
|
this.register(name, module);
|
|
13
|
+
if (!socketApi.sockets.size)
|
|
14
|
+
socketApi.create(window.config);
|
|
13
15
|
},
|
|
14
16
|
|
|
15
17
|
register: function(name, m_instance) {
|
|
@@ -164,7 +166,7 @@ const CoCreateApi = {
|
|
|
164
166
|
},
|
|
165
167
|
|
|
166
168
|
send : function(module, action, data){
|
|
167
|
-
let request_data = this.
|
|
169
|
+
let request_data = this.getCommonParams(data || {});
|
|
168
170
|
request_data = {...request_data, data};
|
|
169
171
|
socketApi.send(module, {type: action, data: request_data});
|
|
170
172
|
},
|
|
@@ -176,24 +178,7 @@ const CoCreateApi = {
|
|
|
176
178
|
});
|
|
177
179
|
},
|
|
178
180
|
|
|
179
|
-
|
|
180
|
-
if (namespace) {
|
|
181
|
-
socketApi.create({
|
|
182
|
-
namespace: namespace,
|
|
183
|
-
room: null,
|
|
184
|
-
host: host
|
|
185
|
-
});
|
|
186
|
-
socketApi.setGlobalScope(namespace);
|
|
187
|
-
} else {
|
|
188
|
-
socketApi.create({
|
|
189
|
-
namespace: null,
|
|
190
|
-
room: null,
|
|
191
|
-
host: host
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
getCommonParamsExtend: function(info)
|
|
181
|
+
getCommonParams: function(info)
|
|
197
182
|
{
|
|
198
183
|
return {
|
|
199
184
|
"apiKey": info.apiKey || config.apiKey,
|
|
@@ -201,10 +186,5 @@ const CoCreateApi = {
|
|
|
201
186
|
}
|
|
202
187
|
}
|
|
203
188
|
}
|
|
204
|
-
|
|
205
|
-
CoCreateApi.createApiSocket(
|
|
206
|
-
window.config.host ? window.config.host : 'server.cocreate.app',
|
|
207
|
-
window.config.organization_Id
|
|
208
|
-
);
|
|
209
|
-
|
|
189
|
+
|
|
210
190
|
export default CoCreateApi;
|
package/src/server.js
CHANGED
|
@@ -32,7 +32,7 @@ var api = ( ()=> {
|
|
|
32
32
|
|
|
33
33
|
console.log("Org_id => ",config["organization_id"])
|
|
34
34
|
|
|
35
|
-
crud.readDocument({
|
|
35
|
+
let org_row = await crud.readDocument({
|
|
36
36
|
collection: "organizations",
|
|
37
37
|
name:"name",
|
|
38
38
|
document_id: config["organization_id"],
|
|
@@ -40,9 +40,9 @@ var api = ( ()=> {
|
|
|
40
40
|
apiKey: config["apiKey"],
|
|
41
41
|
organization_id: '5de0387b12e200ea63204d6c'
|
|
42
42
|
});
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
try{
|
|
45
|
-
org_row =org_row["data"];
|
|
45
|
+
org_row = org_row["data"];
|
|
46
46
|
}catch(e){
|
|
47
47
|
console.log(module," Error GET ORG in : ",e);
|
|
48
48
|
return false;
|
|
@@ -53,7 +53,6 @@ var api = ( ()=> {
|
|
|
53
53
|
var socket_config = {
|
|
54
54
|
"config": {
|
|
55
55
|
"apiKey": config["config"]["apiKey"],
|
|
56
|
-
// "securityKey": config["config"]["securityKey"],
|
|
57
56
|
"organization_Id": config["config"]["organization_id"],
|
|
58
57
|
},
|
|
59
58
|
"prefix": "ws",
|
|
@@ -66,9 +65,8 @@ var api = ( ()=> {
|
|
|
66
65
|
host: socket_config.host
|
|
67
66
|
})
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
crud.readDocumentList({
|
|
68
|
+
|
|
69
|
+
let data2 = await crud.readDocumentList({
|
|
72
70
|
collection: "organizations",
|
|
73
71
|
operator: {
|
|
74
72
|
filters: [{
|
|
@@ -80,14 +78,12 @@ var api = ( ()=> {
|
|
|
80
78
|
// startIndex: 0,
|
|
81
79
|
// search: { type: 'or', value: []}
|
|
82
80
|
},
|
|
83
|
-
event: eventGetOrg,
|
|
84
81
|
is_collection: false,
|
|
85
82
|
apiKey: config["config"]["apiKey"],
|
|
86
|
-
// securityKey: config["config"]["securityKey"],
|
|
87
83
|
organization_id: config["config"]["organization_id"]
|
|
88
84
|
});
|
|
89
85
|
|
|
90
|
-
let data2 = await crud.listenAsync(eventGetOrg);
|
|
86
|
+
//let data2 = await crud.listenAsync(eventGetOrg);
|
|
91
87
|
console.log("data2 ===",data2)
|
|
92
88
|
|
|
93
89
|
var org = data2["data"][0]
|
|
@@ -108,25 +104,22 @@ var api = ( ()=> {
|
|
|
108
104
|
host: socket_config.host
|
|
109
105
|
})
|
|
110
106
|
// socket.setGlobalScope(socket_config.config.organization_id)
|
|
111
|
-
crud.readDocumentList({
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
"event": "getDataOrg",
|
|
107
|
+
let myOrg = await crud.readDocumentList({
|
|
108
|
+
collection: "organizations",
|
|
109
|
+
operator: {
|
|
110
|
+
filters: [{
|
|
111
|
+
name: '_id',
|
|
112
|
+
operator: "$eq",
|
|
113
|
+
value: [org["_id"].toString()]
|
|
114
|
+
}],
|
|
115
|
+
orders: [],
|
|
116
|
+
startIndex: 0,
|
|
117
|
+
search: { type: 'or', value: []}
|
|
118
|
+
},
|
|
124
119
|
is_collection: false,
|
|
125
120
|
apiKey: org["apiKey"],
|
|
126
|
-
|
|
127
|
-
organization_id: org["_id"]
|
|
121
|
+
organization_id: org["_id"]
|
|
128
122
|
});
|
|
129
|
-
let myOrg = await crud.listenAsync("getDataOrg");
|
|
130
123
|
let result = {'row':myOrg,'socket_config':socket_config};
|
|
131
124
|
return result;
|
|
132
125
|
}
|