@cocreate/elements 1.28.0 → 1.29.1

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,22 @@
1
+ ## [1.29.1](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.29.0...v1.29.1) (2023-12-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * handle arrays ([7ea1e12](https://github.com/CoCreate-app/CoCreate-elements/commit/7ea1e12d89d95aae1dca23b38d80b899fa4cddd6))
7
+
8
+ # [1.29.0](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.28.0...v1.29.0) (2023-11-25)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * update licensing details ([9f9b839](https://github.com/CoCreate-app/CoCreate-elements/commit/9f9b8390e751604de9f7e361e15e47e2a72093a6))
14
+
15
+
16
+ ### Features
17
+
18
+ * upgrade dependencies for latest features and fixes ([83cbf98](https://github.com/CoCreate-app/CoCreate-elements/commit/83cbf9831f526b9c4c436d9502d432836b44d922))
19
+
1
20
  # [1.28.0](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.27.1...v1.28.0) (2023-11-25)
2
21
 
3
22
 
package/README.md CHANGED
@@ -39,12 +39,12 @@ $ yarn install @cocreate/elements
39
39
 
40
40
  # Table of Contents
41
41
 
42
- - [Table of Contents](#table-of-contents)
43
- - [Announcements](#announcements)
44
- - [Roadmap](#roadmap)
45
- - [How to Contribute](#how-to-contribute)
46
- - [About](#about)
47
- - [License](#license)
42
+ - [Table of Contents](#table-of-contents)
43
+ - [Announcements](#announcements)
44
+ - [Roadmap](#roadmap)
45
+ - [How to Contribute](#how-to-contribute)
46
+ - [About](#about)
47
+ - [License](#license)
48
48
 
49
49
  <a name="announcements"></a>
50
50
 
@@ -78,8 +78,14 @@ We want this library to be community-driven, and CoCreate led. We need your help
78
78
 
79
79
  We appreciate your continued support, thank you!
80
80
 
81
-
82
81
  <a name="license"></a>
82
+
83
83
  # License
84
84
 
85
- [The MIT License (MIT)](https://github.com/CoCreate-app/CoCreate-elements/blob/master/LICENSE)
85
+ This software is dual-licensed under the GNU Affero General Public License version 3 (AGPLv3) and a commercial license.
86
+
87
+ - **Open Source Use**: For open-source projects and non-commercial use, this software is available under the AGPLv3. The AGPLv3 allows you to freely use, modify, and distribute this software, provided that all modifications and derivative works are also licensed under the AGPLv3. For the full license text, see the [LICENSE file](https://github.com/CoCreate-app/CoCreate-element/blob/master/LICENSE).
88
+
89
+ - **Commercial Use**: For-profit companies and individuals intending to use this software for commercial purposes must obtain a commercial license. The commercial license is available when you sign up for an API key on our [website](https://cocreate.app). This license permits proprietary use and modification of the software without the copyleft requirements of the AGPLv3. It is ideal for integrating this software into proprietary commercial products and applications.
90
+
91
+ If you have not purchased a commercial license and intend to use this software for commercial purposes, you are required to sign up for an API key on our website.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/elements",
3
- "version": "1.28.0",
3
+ "version": "1.29.1",
4
4
  "description": "Fetch content into any html element by using html5 attributes to query data stored in CoCreate headless CMS. If data is changed it will instantly reflect in html tags as changes are broadcasted in realtime",
5
5
  "keywords": [
6
6
  "elements",
@@ -58,12 +58,12 @@
58
58
  "webpack-log": "^3.0.1"
59
59
  },
60
60
  "dependencies": {
61
- "@cocreate/actions": "^1.13.0",
62
- "@cocreate/crud-client": "^1.30.0",
63
- "@cocreate/element-prototype": "^1.14.1",
64
- "@cocreate/filter": "^1.26.0",
65
- "@cocreate/observer": "^1.13.0",
66
- "@cocreate/render": "^1.34.0",
67
- "@cocreate/utils": "^1.28.0"
61
+ "@cocreate/actions": "^1.14.0",
62
+ "@cocreate/crud-client": "^1.31.0",
63
+ "@cocreate/element-prototype": "^1.15.0",
64
+ "@cocreate/filter": "^1.27.0",
65
+ "@cocreate/observer": "^1.14.0",
66
+ "@cocreate/render": "^1.35.0",
67
+ "@cocreate/utils": "^1.29.0"
68
68
  }
69
69
  }
package/src/index.js CHANGED
@@ -333,6 +333,12 @@ async function filterData(element, data, type, key) {
333
333
  if (Array.isArray(data[type])) {
334
334
  let Data = []
335
335
  for (let doc of data[type]) {
336
+ // TODO: should have been handled by getDataElements()
337
+ if (type === 'object') {
338
+ let _id = element.getAttribute('object')
339
+ if (_id && doc._id !== _id)
340
+ return
341
+ }
336
342
  if (doc[key]) {
337
343
  if (Array.isArray(doc[key]))
338
344
  Data.push(...doc[key])
@@ -602,13 +608,20 @@ async function getData(form) {
602
608
  }
603
609
  }
604
610
 
605
-
606
611
  if (Data.type = 'object') {
607
612
  if (typeof Data[Data.type] === 'string')
608
613
  if (Data.key == '{}')
609
614
  Data[Data.type] = { _id: Data[Data.type], ...value }
610
615
  else
611
616
  Data[Data.type] = { _id: Data[Data.type], [Data.key]: value }
617
+ else if (Array.isArray(Data[Data.type]))
618
+ if (Data.key == '{}')
619
+ Data[Data.type][0] = { ...Data[Data.type][0], ...value }
620
+ else {
621
+ Data[Data.type][0][Data.key] = value
622
+ if (!Data[Data.type][0]._id)
623
+ Data.method = Data.type + '.create'
624
+ }
612
625
  else if (typeof Data[Data.type] === 'object')
613
626
  if (Data.key == '{}')
614
627
  Data[Data.type] = { ...Data[Data.type], ...value }