@cocreate/api 1.20.4 → 1.20.5

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,11 @@
1
+ ## [1.20.5](https://github.com/CoCreate-app/CoCreate-api/compare/v1.20.4...v1.20.5) (2024-04-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * bug in param handeling ([083b77e](https://github.com/CoCreate-app/CoCreate-api/commit/083b77eebec53f5523fd228ccfb1a88911e6132b))
7
+ * handeling of params ([9685e08](https://github.com/CoCreate-app/CoCreate-api/commit/9685e080d0bd0f3940aab9a7f277324c00526750))
8
+
1
9
  ## [1.20.4](https://github.com/CoCreate-app/CoCreate-api/compare/v1.20.3...v1.20.4) (2024-02-18)
2
10
 
3
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/api",
3
- "version": "1.20.4",
3
+ "version": "1.20.5",
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/index.js CHANGED
@@ -126,7 +126,7 @@ const CoCreateApi = {
126
126
 
127
127
  // TODO: handle $param operator
128
128
  getData: async function ({ name, method, element, form }) {
129
- const data = {}
129
+ let data = {}
130
130
 
131
131
  if (!form && element)
132
132
  form = element.closest('form');
@@ -146,7 +146,21 @@ const CoCreateApi = {
146
146
  }
147
147
  }
148
148
 
149
- return dotNotationToObject(data);
149
+ let params = {}, hasParams = false
150
+ for (let i = 0; true; i++) {
151
+ if (`$param[${i}]` in data) {
152
+ params[`$param[${i}]`] = data[`$param[${i}]`]
153
+ delete data[`$param[${i}]`]
154
+ hasParams = true
155
+ } else {
156
+ break;
157
+ }
158
+ }
159
+ data = dotNotationToObject(data);
160
+ if (hasParams)
161
+ data = { ...params, ...data }
162
+
163
+ return data
150
164
  },
151
165
 
152
166
  // TODO: handle $param operator