orange-orm 4.2.0-beta.5 → 4.2.0-beta.6
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/package.json +1 -1
- package/src/client/index.js +22 -9
package/package.json
CHANGED
package/src/client/index.js
CHANGED
|
@@ -488,7 +488,6 @@ function rdbClient(options = {}) {
|
|
|
488
488
|
rootMap.set(array, { json: cloneFromDb(array, fast), strategy, originalArray: [...array] });
|
|
489
489
|
});
|
|
490
490
|
let innerProxy = new Proxy(watcher, handler);
|
|
491
|
-
//todo
|
|
492
491
|
if (strategy !== undefined) {
|
|
493
492
|
const { limit, ...cleanStrategy } = { ...strategy };
|
|
494
493
|
fetchingStrategyMap.set(array, cleanStrategy);
|
|
@@ -593,7 +592,9 @@ function rdbClient(options = {}) {
|
|
|
593
592
|
|
|
594
593
|
async function saveArray(array, concurrencyOptions, strategy) {
|
|
595
594
|
let deduceStrategy = false;
|
|
596
|
-
let
|
|
595
|
+
let json = rootMap.get(array)?.json;
|
|
596
|
+
if (!json)
|
|
597
|
+
return;
|
|
597
598
|
strategy = extractStrategy({ strategy }, array);
|
|
598
599
|
strategy = extractFetchingStrategy(array, strategy);
|
|
599
600
|
|
|
@@ -673,7 +674,7 @@ function rdbClient(options = {}) {
|
|
|
673
674
|
return options.strategy;
|
|
674
675
|
if (obj) {
|
|
675
676
|
let context = rootMap.get(obj);
|
|
676
|
-
if (context
|
|
677
|
+
if (context?.strategy !== undefined) {
|
|
677
678
|
// @ts-ignore
|
|
678
679
|
let { limit, ...strategy } = { ...context.strategy };
|
|
679
680
|
return strategy;
|
|
@@ -692,13 +693,17 @@ function rdbClient(options = {}) {
|
|
|
692
693
|
}
|
|
693
694
|
|
|
694
695
|
function clearChangesArray(array) {
|
|
695
|
-
let
|
|
696
|
+
let json = rootMap.get(array)?.json;
|
|
697
|
+
if (!json)
|
|
698
|
+
return;
|
|
696
699
|
let old = cloneFromDb(json);
|
|
697
700
|
array.splice(0, old.length, ...old);
|
|
698
701
|
}
|
|
699
702
|
|
|
700
703
|
function acceptChangesArray(array) {
|
|
701
704
|
const map = rootMap.get(array);
|
|
705
|
+
if (!map)
|
|
706
|
+
return;
|
|
702
707
|
map.json = cloneFromDb(array);
|
|
703
708
|
map.originalArray = [...array];
|
|
704
709
|
}
|
|
@@ -796,7 +801,7 @@ function rdbClient(options = {}) {
|
|
|
796
801
|
strategy = extractStrategy({ strategy }, row);
|
|
797
802
|
strategy = extractFetchingStrategy(row, strategy);
|
|
798
803
|
|
|
799
|
-
let
|
|
804
|
+
let json = rootMap.get(row)?.json;
|
|
800
805
|
if (!json)
|
|
801
806
|
return;
|
|
802
807
|
let meta = await getMeta();
|
|
@@ -839,12 +844,15 @@ function rdbClient(options = {}) {
|
|
|
839
844
|
}
|
|
840
845
|
|
|
841
846
|
function acceptChangesRow(row) {
|
|
842
|
-
const
|
|
847
|
+
const data = rootMap.get(row);
|
|
848
|
+
if (!data)
|
|
849
|
+
return;
|
|
850
|
+
const { strategy } = data;
|
|
843
851
|
rootMap.set(row, { json: cloneFromDb(row), strategy });
|
|
844
852
|
}
|
|
845
853
|
|
|
846
854
|
function clearChangesRow(row) {
|
|
847
|
-
let
|
|
855
|
+
let json = rootMap.get(row)?.json;
|
|
848
856
|
if (!json)
|
|
849
857
|
return;
|
|
850
858
|
let old = cloneFromDb(json);
|
|
@@ -1027,9 +1035,14 @@ function onChange(target, onChange) {
|
|
|
1027
1035
|
}
|
|
1028
1036
|
return Reflect.set(target, prop, value, receiver);
|
|
1029
1037
|
|
|
1038
|
+
},
|
|
1039
|
+
deleteProperty(target, prop) {
|
|
1040
|
+
if (!notified) {
|
|
1041
|
+
notified = true;
|
|
1042
|
+
onChange(JSON.stringify(target));
|
|
1043
|
+
}
|
|
1044
|
+
return Reflect.deleteProperty(target, prop);
|
|
1030
1045
|
}
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
1046
|
};
|
|
1034
1047
|
|
|
1035
1048
|
return new Proxy(target, handler);
|