@cocreate/api 1.20.3 → 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 +15 -0
- package/package.json +1 -1
- package/src/index.js +17 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
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
|
+
|
|
9
|
+
## [1.20.4](https://github.com/CoCreate-app/CoCreate-api/compare/v1.20.3...v1.20.4) (2024-02-18)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* -request=false ([dc43f0e](https://github.com/CoCreate-app/CoCreate-api/commit/dc43f0e81b2bcd7bef73ab959ddb2da8c173b1f4))
|
|
15
|
+
|
|
1
16
|
## [1.20.3](https://github.com/CoCreate-app/CoCreate-api/compare/v1.20.2...v1.20.3) (2024-02-18)
|
|
2
17
|
|
|
3
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/api",
|
|
3
|
-
"version": "1.20.
|
|
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,14 +126,14 @@ const CoCreateApi = {
|
|
|
126
126
|
|
|
127
127
|
// TODO: handle $param operator
|
|
128
128
|
getData: async function ({ name, method, element, form }) {
|
|
129
|
-
|
|
129
|
+
let data = {}
|
|
130
130
|
|
|
131
131
|
if (!form && element)
|
|
132
132
|
form = element.closest('form');
|
|
133
133
|
|
|
134
134
|
let elements
|
|
135
135
|
if (form)
|
|
136
|
-
elements = form.querySelectorAll(`[${name}="${method}"]`);
|
|
136
|
+
elements = form.querySelectorAll(`[${name}="${method}"]:not([${name}-request="false"])`);
|
|
137
137
|
if (!elements || elements.length == 0)
|
|
138
138
|
elements = [element]
|
|
139
139
|
|
|
@@ -146,7 +146,21 @@ const CoCreateApi = {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
|
|
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
|