Skip to content

Commit 93d3c8a

Browse files
committed
update license snippet
1 parent b93ca93 commit 93d3c8a

File tree

2 files changed

+28
-29
lines changed

2 files changed

+28
-29
lines changed

src/client.js

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
********************************************************************************/
1717

18-
// Commercial Licensing Information:
19-
// For commercial use of this software without the copyleft provisions of the AGPLv3,
20-
// you must obtain a commercial license from CoCreate LLC.
21-
// For details, visit <https://cocreate.app/licenses/> or contact us at sales@cocreate.app.
18+
/**
19+
* Commercial Licensing Information:
20+
* For commercial use of this software without the copyleft provisions of the AGPLv3,
21+
* you must obtain a commercial license from CoCreate LLC.
22+
* For details, visit <https://cocreate.app/licenses/> or contact us at sales@cocreate.app.
23+
*/
2224

2325
import Observer from '@cocreate/observer';
2426
import Crud from '@cocreate/crud-client';
@@ -406,18 +408,16 @@ async function upload(element, data) {
406408
}
407409
}
408410

409-
let action = 'update' + Data.type.charAt(0).toUpperCase() + Data.type.slice(1)
410-
if (Crud[action]) {
411-
let response = await Crud[action](Data)({
412-
array,
413-
object,
414-
upsert: true
415-
});
416-
417-
data.push(response)
418-
if (response && (!object || object !== response.object)) {
419-
Elements.setTypeValue(element, response);
420-
}
411+
Data.method = 'update.' + Data.type
412+
let response = await Crud.send(Data)({
413+
array,
414+
object,
415+
upsert: true
416+
});
417+
418+
data.push(response)
419+
if (response && (!object || object !== response.object)) {
420+
Elements.setTypeValue(element, response);
421421
}
422422
}
423423
}
@@ -482,10 +482,8 @@ async function Import(element, data) {
482482

483483
if (data.length) {
484484
for (let i = 0; i < data.length; i++) {
485-
let action = 'create' + data[i].type.charAt(0).toUpperCase() + data[i].type.slice(1)
486-
if (Crud[action]) {
487-
data[i] = await Crud[action](data[i])
488-
}
485+
data[i].method = 'create.' + data[i].type
486+
data[i] = await Crud.send(data[i])
489487
}
490488
}
491489

@@ -527,11 +525,10 @@ async function Export(element, data) {
527525

528526
if (Data.type === 'key')
529527
Data.type = 'object'
530-
let action = 'read' + Data.type.charAt(0).toUpperCase() + Data.type.slice(1)
531-
if (Crud[action]) {
532-
Data = await Crud[action](Data)
533-
data.push(...Data[Data.type])
534-
}
528+
Data.method = 'read.' + Data.type
529+
Data = await Crud.send(Data)
530+
data.push(...Data[Data.type])
531+
535532
}
536533

537534
let queriedElements = queryElements({ element: element[i], prefix: 'export' })

src/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
********************************************************************************/
1717

18-
// Commercial Licensing Information:
19-
// For commercial use of this software without the copyleft provisions of the AGPLv3,
20-
// you must obtain a commercial license from CoCreate LLC.
21-
// For details, visit <https://cocreate.app/licenses/> or contact us at sales@cocreate.app.
18+
/**
19+
* Commercial Licensing Information:
20+
* For commercial use of this software without the copyleft provisions of the AGPLv3,
21+
* you must obtain a commercial license from CoCreate LLC.
22+
* For details, visit <https://cocreate.app/licenses/> or contact us at sales@cocreate.app.
23+
*/
2224

2325
(function (root, factory) {
2426
if (typeof define === 'function' && define.amd) {

0 commit comments

Comments
 (0)