@cocreate/api 1.2.23 → 1.2.27

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,31 @@
1
+ ## [1.2.27](https://github.com/CoCreate-app/CoCreate-api/compare/v1.2.26...v1.2.27) (2022-02-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * define host will be used when creating socket ([e7c4a88](https://github.com/CoCreate-app/CoCreate-api/commit/e7c4a8846b1131c98150f923e76ab42ec8bfe821))
7
+
8
+ ## [1.2.26](https://github.com/CoCreate-app/CoCreate-api/compare/v1.2.25...v1.2.26) (2022-02-10)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * bump dependencies ([19c4eb9](https://github.com/CoCreate-app/CoCreate-api/commit/19c4eb979a2605716a2ba7d4702a23242e06a9d5))
14
+
15
+ ## [1.2.25](https://github.com/CoCreate-app/CoCreate-api/compare/v1.2.24...v1.2.25) (2022-02-07)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * bump dependency versions ([cf5bf5e](https://github.com/CoCreate-app/CoCreate-api/commit/cf5bf5e85ffe08bd9413f5dc38923e4b6001199a))
21
+
22
+ ## [1.2.24](https://github.com/CoCreate-app/CoCreate-api/compare/v1.2.23...v1.2.24) (2022-02-03)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * replaced show and hide class hidden with attribute hidden ([aeda09c](https://github.com/CoCreate-app/CoCreate-api/commit/aeda09c1024963a4cdf6d362c4d67a0c724f9c82))
28
+
1
29
  ## [1.2.23](https://github.com/CoCreate-app/CoCreate-api/compare/v1.2.22...v1.2.23) (2022-02-01)
2
30
 
3
31
 
package/docs/form.html CHANGED
@@ -181,7 +181,7 @@
181
181
  <div class="container svColumn overflow:hidden card position:relative border-radius:2px width:auto height:100%" id="sandbox">
182
182
  <div class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
183
183
  <a class="margin-right:10px" id="code" show="#preview" hide="#code, #view"><i class="far fa-eye"></i></a>
184
- <a class="margin-right:10px hidden" id="preview" show="#code, #view" hide="#preview"><i class="fas fa-code"></i></a>
184
+ <a class="margin-right:10px" id="preview" show="#code, #view" hide="#preview" hidden><i class="fas fa-code"></i></a>
185
185
  <a class="margin-right:5px" fullscreen target="#playground"><i class="fas fa-expand"></i></a>
186
186
  </div>
187
187
  <div class="svRow">
package/docs/index.html CHANGED
@@ -207,7 +207,7 @@
207
207
  <div class="container svColumn overflow:hidden card position:relative border-radius:2px width:auto height:100%" id="sandbox">
208
208
  <div class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
209
209
  <a class="margin-right:10px" id="code" show="#preview" hide="#code, #view"><i class="far fa-eye"></i></a>
210
- <a class="margin-right:10px hidden" id="preview" show="#code, #view" hide="#preview"><i class="fas fa-code"></i></a>
210
+ <a class="margin-right:10px" id="preview" show="#code, #view" hide="#preview" hidden><i class="fas fa-code"></i></a>
211
211
  <a class="margin-right:5px" fullscreen target="#playground"><i class="fas fa-expand"></i></a>
212
212
  </div>
213
213
  <div class="svRow">
package/docs/module.html CHANGED
@@ -171,7 +171,7 @@
171
171
  <div class="container svColumn overflow:hidden card position:relative border-radius:2px width:auto height:100%" id="sandbox">
172
172
  <div class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
173
173
  <a class="margin-right:10px" id="code" show="#preview" hide="#code, #view"><i class="far fa-eye"></i></a>
174
- <a class="margin-right:10px hidden" id="preview" show="#code, #view" hide="#preview"><i class="fas fa-code"></i></a>
174
+ <a class="margin-right:10px" id="preview" show="#code, #view" hide="#preview" hidden><i class="fas fa-code"></i></a>
175
175
  <a class="margin-right:5px" fullscreen target="#playground"><i class="fas fa-expand"></i></a>
176
176
  </div>
177
177
  <div class="svRow">
package/docs/server.html CHANGED
@@ -182,7 +182,7 @@
182
182
  <div class="container svColumn overflow:hidden card position:relative border-radius:2px width:auto height:100%" id="sandbox">
183
183
  <div class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
184
184
  <a class="margin-right:10px" id="code" show="#preview" hide="#code, #view"><i class="far fa-eye"></i></a>
185
- <a class="margin-right:10px hidden" id="preview" show="#code, #view" hide="#preview"><i class="fas fa-code"></i></a>
185
+ <a class="margin-right:10px" id="preview" show="#code, #view" hide="#preview" hidden><i class="fas fa-code"></i></a>
186
186
  <a class="margin-right:5px" fullscreen target="#playground"><i class="fas fa-expand"></i></a>
187
187
  </div>
188
188
  <div class="svRow">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/api",
3
- "version": "1.2.23",
3
+ "version": "1.2.27",
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,12 +62,12 @@
62
62
  "webpack-log": "^3.0.1"
63
63
  },
64
64
  "dependencies": {
65
- "@cocreate/actions": "^1.3.28",
66
- "@cocreate/crud-client": "^1.4.43",
67
- "@cocreate/docs": "^1.2.65",
68
- "@cocreate/elements": "^1.6.5",
69
- "@cocreate/hosting": "^1.2.60",
70
- "@cocreate/render": "^1.5.1",
71
- "@cocreate/socket-client": "^1.4.18"
65
+ "@cocreate/actions": "^1.3.31",
66
+ "@cocreate/crud-client": "^1.4.46",
67
+ "@cocreate/docs": "^1.2.68",
68
+ "@cocreate/elements": "^1.6.9",
69
+ "@cocreate/hosting": "^1.2.63",
70
+ "@cocreate/render": "^1.5.5",
71
+ "@cocreate/socket-client": "^1.4.21"
72
72
  }
73
73
  }
package/src/client.js CHANGED
@@ -165,6 +165,7 @@ const CoCreateApi = {
165
165
  return {
166
166
  "apiKey": info.apiKey || config.apiKey,
167
167
  "organization_id": info.organization_id || config.organization_Id,
168
+ "host": info.host || config.host
168
169
  };
169
170
  }
170
171
  };
package/src/server.js CHANGED
@@ -1,54 +1,49 @@
1
1
  const crud = require('@cocreate/crud-client')
2
- const CoCreateSocketClient = require('@cocreate/socket-client')
3
- let socket = new CoCreateSocketClient("ws");
2
+ const socketClient = require('@cocreate/socket-client')
3
+ let socket = new socketClient("ws");
4
4
 
5
5
  crud.setSocket(socket);
6
6
 
7
7
  var api = ( ()=> {
8
8
  return {
9
- send_response : (wsManager,socket,obj,send_response) => {
10
- console.log("Response TO-> "+send_response)
9
+ send_response: (wsManager, socket, obj, send_response) => {
10
+ console.log(send_response, " Response Sent")
11
11
  wsManager.send(socket, send_response, obj)
12
12
  },
13
13
 
14
- handleError : (wsManager,socket, type, error,module_id)=>{
15
- const response = {
16
- 'object': 'error',
17
- 'data':error || error.response || error.response.data || error.response.body || error.message || error,
18
- };
19
- wsManager.send(socket, module_id, { type, response })
20
- //send_response(wsManager, socket, { type, response }, module_id);
14
+ handleError: (wsManager,socket, type, error,module_id)=>{
15
+ const response = {
16
+ 'object': 'error',
17
+ 'data':error || error.response || error.response.data || error.response.body || error.message || error,
18
+ };
19
+ wsManager.send(socket, module_id, { type, response })
21
20
  },
22
- getOrg : async (config, module) =>{
23
- console.log("config WS utils==== ",config)
21
+
22
+ getOrg: async (config, module) =>{
24
23
 
25
24
  socket.create({
26
25
  namespace: config["organization_id"],
27
26
  room: null,
28
- host: "server.cocreate.app:8088"
27
+ host: config["host"]
29
28
  })
30
- const event = "getOrg";
31
-
32
-
33
- console.log("Org_id => ",config["organization_id"])
34
-
35
- let org_row = await crud.readDocument({
29
+
30
+ let org = await crud.readDocument({
36
31
  collection: "organizations",
37
32
  name:"name",
38
33
  document_id: config["organization_id"],
39
- event,
40
34
  apiKey: config["apiKey"],
41
- organization_id: '5de0387b12e200ea63204d6c'
35
+ organization_id: config["organization_id"]
42
36
  });
43
37
 
44
38
  try{
45
- org_row = org_row["data"];
46
- }catch(e){
47
- console.log(module," Error GET ORG in : ",e);
39
+ org = org["data"];
40
+ }catch(e){
41
+ console.log(module," Error GET ORG in : ",e);
48
42
  return false;
49
- }
50
- return org_row;
43
+ }
44
+ return org;
51
45
  },
46
+
52
47
  getOrgInRoutesbyHostname : async (config, hostname) =>{
53
48
  var socket_config = {
54
49
  "config": {
@@ -59,29 +54,25 @@ var api = ( ()=> {
59
54
  "host": "server.cocreate.app:8088"
60
55
  };
61
56
 
62
- socket.create({
63
- namespace: socket_config.config.organization_Id,
64
- room: null,
65
- host: socket_config.host
66
- })
57
+ socket.create({
58
+ namespace: socket_config.config.organization_Id,
59
+ room: null,
60
+ host: socket_config.host
61
+ })
67
62
 
68
-
69
- let data2 = await crud.readDocumentList({
70
- collection: "organizations",
71
- operator: {
72
- filters: [{
73
- name: 'domains',
74
- operator: "$in",
75
- value: [hostname]
76
- }],
77
- // orders: [],
78
- // startIndex: 0,
79
- // search: { type: 'or', value: []}
80
- },
81
- is_collection: false,
82
- apiKey: config["config"]["apiKey"],
83
- organization_id: config["config"]["organization_id"]
84
- });
63
+ let data2 = await crud.readDocumentList({
64
+ collection: "organizations",
65
+ operator: {
66
+ filters: [{
67
+ name: 'domains',
68
+ operator: "$in",
69
+ value: [hostname]
70
+ }],
71
+ },
72
+ is_collection: false,
73
+ apiKey: config["config"]["apiKey"],
74
+ organization_id: config["config"]["organization_id"]
75
+ });
85
76
 
86
77
  //let data2 = await crud.listenAsync(eventGetOrg);
87
78
  console.log("data2 ===",data2)
@@ -91,7 +82,6 @@ var api = ( ()=> {
91
82
  var socket_config = {
92
83
  "config": {
93
84
  "apiKey": org["apiKey"],
94
- // "securityKey": org["securityKey"],
95
85
  "organization_Id": org["_id"].toString(),
96
86
  },
97
87
  "prefix": "ws",
@@ -99,23 +89,24 @@ var api = ( ()=> {
99
89
  }
100
90
  //other connection
101
91
  socket.create({
102
- namespace: socket_config.config.organization_Id,
92
+ namespace: socket_config.config.organization_Id,
103
93
  room: null,
104
94
  host: socket_config.host
105
95
  })
96
+
106
97
  // socket.setGlobalScope(socket_config.config.organization_id)
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
- },
98
+ let myOrg = await crud.readDocumentList({
99
+ collection: "organizations",
100
+ operator: {
101
+ filters: [{
102
+ name: '_id',
103
+ operator: "$eq",
104
+ value: [org["_id"].toString()]
105
+ }],
106
+ orders: [],
107
+ startIndex: 0,
108
+ search: { type: 'or', value: []}
109
+ },
119
110
  is_collection: false,
120
111
  apiKey: org["apiKey"],
121
112
  organization_id: org["_id"]
@@ -124,7 +115,7 @@ var api = ( ()=> {
124
115
  return result;
125
116
  }
126
117
 
127
- } //
118
+ }
128
119
  })();
129
120
 
130
121
  module.exports = api;