@cocreate/api 1.2.29 → 1.2.30
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 +9 -0
- package/CoCreate.config.js +1 -1
- package/package.json +1 -1
- package/src/client.js +5 -6
- package/src/server.js +5 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [1.2.30](https://github.com/CoCreate-app/CoCreate-api/compare/v1.2.29...v1.2.30) (2022-02-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* CoCreate.config replace CoCreate.app with * ([62ecf98](https://github.com/CoCreate-app/CoCreate-api/commit/62ecf980e1e0efdc237d0015fd041ebaceb954eb))
|
|
7
|
+
* removed name param from getOrg crud function ([4d868b5](https://github.com/CoCreate-app/CoCreate-api/commit/4d868b58982d4fb635f6d040073fad23dc225533))
|
|
8
|
+
* update param type to action ([3ee6cd7](https://github.com/CoCreate-app/CoCreate-api/commit/3ee6cd7c6f2f67b0d26c49c0b202554e828633b4))
|
|
9
|
+
|
|
1
10
|
## [1.2.29](https://github.com/CoCreate-app/CoCreate-api/compare/v1.2.28...v1.2.29) (2022-02-16)
|
|
2
11
|
|
|
3
12
|
|
package/CoCreate.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/api",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.30",
|
|
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",
|
package/src/client.js
CHANGED
|
@@ -46,16 +46,16 @@ const CoCreateApi = {
|
|
|
46
46
|
},
|
|
47
47
|
|
|
48
48
|
__response: function(id, data) {
|
|
49
|
-
const {
|
|
49
|
+
const {action, response} = data;
|
|
50
50
|
const m_instance = this.modules[id];
|
|
51
|
-
const functions = m_instance.actions[
|
|
51
|
+
const functions = m_instance.actions[action]
|
|
52
52
|
if (typeof functions.response === 'function') {
|
|
53
53
|
functions.response(response);
|
|
54
54
|
}
|
|
55
55
|
else
|
|
56
|
-
this.render(
|
|
56
|
+
this.render(action, response);
|
|
57
57
|
|
|
58
|
-
document.dispatchEvent(new CustomEvent(
|
|
58
|
+
document.dispatchEvent(new CustomEvent(action, {
|
|
59
59
|
detail: {
|
|
60
60
|
data: response
|
|
61
61
|
}
|
|
@@ -140,9 +140,8 @@ const CoCreateApi = {
|
|
|
140
140
|
|
|
141
141
|
send : function(module, action, data){
|
|
142
142
|
let request_data = this.getCommonParams(data || {});
|
|
143
|
-
data = {...request_data,
|
|
143
|
+
data = {...request_data, action, data};
|
|
144
144
|
socketApi.send(module, data);
|
|
145
|
-
console.log('data', data)
|
|
146
145
|
},
|
|
147
146
|
|
|
148
147
|
render: function(action, data) {
|
package/src/server.js
CHANGED
|
@@ -7,19 +7,18 @@ crud.setSocket(socket);
|
|
|
7
7
|
var api = ( ()=> {
|
|
8
8
|
return {
|
|
9
9
|
send_response: (wsManager, socket, obj, send_response) => {
|
|
10
|
-
console.log(send_response, " Response Sent")
|
|
11
10
|
wsManager.send(socket, send_response, obj)
|
|
12
11
|
},
|
|
13
12
|
|
|
14
|
-
handleError: (wsManager, socket,
|
|
13
|
+
handleError: (wsManager, socket, action, error, module_id) => {
|
|
15
14
|
const response = {
|
|
16
15
|
'object': 'error',
|
|
17
16
|
'data':error || error.response || error.response.data || error.response.body || error.message || error,
|
|
18
17
|
};
|
|
19
|
-
wsManager.send(socket, module_id, {
|
|
18
|
+
wsManager.send(socket, module_id, { action, response })
|
|
20
19
|
},
|
|
21
20
|
|
|
22
|
-
getOrg: async (config, module) =>{
|
|
21
|
+
getOrg: async (config, module) => {
|
|
23
22
|
|
|
24
23
|
socket.create({
|
|
25
24
|
namespace: config["organization_id"],
|
|
@@ -29,7 +28,6 @@ var api = ( ()=> {
|
|
|
29
28
|
|
|
30
29
|
let org = await crud.readDocument({
|
|
31
30
|
collection: "organizations",
|
|
32
|
-
name:"name",
|
|
33
31
|
document_id: config["organization_id"],
|
|
34
32
|
apiKey: config["apiKey"],
|
|
35
33
|
organization_id: config["organization_id"]
|
|
@@ -44,7 +42,7 @@ var api = ( ()=> {
|
|
|
44
42
|
return org;
|
|
45
43
|
},
|
|
46
44
|
|
|
47
|
-
getOrgInRoutesbyHostname : async (config, hostname) =>{
|
|
45
|
+
getOrgInRoutesbyHostname : async (config, hostname) => {
|
|
48
46
|
var socket_config = {
|
|
49
47
|
"config": {
|
|
50
48
|
"apiKey": config["config"]["apiKey"],
|
|
@@ -75,7 +73,7 @@ var api = ( ()=> {
|
|
|
75
73
|
});
|
|
76
74
|
|
|
77
75
|
//let data2 = await crud.listenAsync(eventGetOrg);
|
|
78
|
-
console.log("data2 ===",data2)
|
|
76
|
+
// console.log("data2 ===", data2)
|
|
79
77
|
|
|
80
78
|
var org = data2["data"][0]
|
|
81
79
|
|