@cocreate/api 1.20.5 → 1.21.0

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,17 @@
1
+ # [1.21.0](https://github.com/CoCreate-app/CoCreate-api/compare/v1.20.6...v1.21.0) (2024-05-19)
2
+
3
+
4
+ ### Features
5
+
6
+ * attributes to handle endpoint and query ([f6aa450](https://github.com/CoCreate-app/CoCreate-api/commit/f6aa4502147e5ef9e6f6d24daf326de14829b710))
7
+
8
+ ## [1.20.6](https://github.com/CoCreate-app/CoCreate-api/compare/v1.20.5...v1.20.6) (2024-04-29)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * bump cocreate dependencies ([28dabef](https://github.com/CoCreate-app/CoCreate-api/commit/28dabefd52299a59fc7cbe1fe6fbe1d15c074479))
14
+
1
15
  ## [1.20.5](https://github.com/CoCreate-app/CoCreate-api/compare/v1.20.4...v1.20.5) (2024-04-27)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/api",
3
- "version": "1.20.5",
3
+ "version": "1.21.0",
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",
@@ -59,11 +59,11 @@
59
59
  "webpack-log": "^3.0.1"
60
60
  },
61
61
  "dependencies": {
62
- "@cocreate/actions": "^1.15.1",
63
- "@cocreate/crud-client": "^1.32.2",
64
- "@cocreate/element-prototype": "^1.15.0",
65
- "@cocreate/render": "^1.37.1",
66
- "@cocreate/socket-client": "^1.36.1",
67
- "@cocreate/utils": "^1.30.0"
62
+ "@cocreate/actions": "^1.18.1",
63
+ "@cocreate/crud-client": "^1.33.8",
64
+ "@cocreate/element-prototype": "^1.22.2",
65
+ "@cocreate/render": "^1.40.3",
66
+ "@cocreate/socket-client": "^1.39.0",
67
+ "@cocreate/utils": "^1.33.6"
68
68
  }
69
69
  }
package/src/index.js CHANGED
@@ -124,7 +124,6 @@ const CoCreateApi = {
124
124
  Socket.send({ method: name + '.' + method, [name]: data, broadcast: false, broadcastBrowser: false, status: 'await' });
125
125
  },
126
126
 
127
- // TODO: handle $param operator
128
127
  getData: async function ({ name, method, element, form }) {
129
128
  let data = {}
130
129
 
@@ -144,6 +143,15 @@ const CoCreateApi = {
144
143
  if (key) {
145
144
  data[key] = await elements[i].getValue()
146
145
  }
146
+
147
+ let endpoint = elements[i].getAttribute('endpoint')
148
+ if (endpoint) {
149
+ data.endpoint = endpoint
150
+ }
151
+
152
+ if (elements[i].getAttribute('query') && elements[i].getAttribute('query') !== 'false') {
153
+ data.query = true
154
+ }
147
155
  }
148
156
 
149
157
  let params = {}, hasParams = false
@@ -163,7 +171,6 @@ const CoCreateApi = {
163
171
  return data
164
172
  },
165
173
 
166
- // TODO: handle $param operator
167
174
  setData: function ({ name, method, data, form }) {
168
175
  if (!form)
169
176
  form = document;
@@ -187,8 +194,12 @@ const CoCreateApi = {
187
194
  });
188
195
  } else {
189
196
  let key = elements[i].getAttribute(`${name}-key`)
190
- let value = getValueFromObject(data[name], key);
191
- elements[i].setValue(value);
197
+ if (key === '{}')
198
+ elements[i].setValue(data[name])
199
+ else {
200
+ let value = getValueFromObject(data[name], key);
201
+ elements[i].setValue(value);
202
+ }
192
203
  }
193
204
  }
194
205
  }