@signaltree/enterprise 11.5.1 → 11.5.3
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/dist/lib/diff-engine.js
CHANGED
package/dist/lib/path-index.js
CHANGED
|
@@ -142,10 +142,11 @@ class PathIndex {
|
|
|
142
142
|
this.set(path, tree);
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
|
-
if (typeof tree !== 'object') {
|
|
145
|
+
if (typeof tree !== 'object' && typeof tree !== 'function') {
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
for (const [key, value] of Object.entries(tree)) {
|
|
149
|
+
if (key.startsWith('_') || key === 'set' || key === 'update') continue;
|
|
149
150
|
this.buildFromTree(value, [...path, key]);
|
|
150
151
|
}
|
|
151
152
|
}
|
|
@@ -150,11 +150,26 @@ class OptimizedUpdateEngine {
|
|
|
150
150
|
for (let i = 0; i < patch.path.length - 1; i++) {
|
|
151
151
|
const key = patch.path[i];
|
|
152
152
|
current = current[key];
|
|
153
|
-
if (!current || typeof current !== 'object') {
|
|
153
|
+
if (!current || typeof current !== 'object' && typeof current !== 'function') {
|
|
154
154
|
return false;
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
const lastKey = patch.path[patch.path.length - 1];
|
|
158
|
+
const target = current[lastKey];
|
|
159
|
+
if (target && (typeof target === 'function' || typeof target === 'object')) {
|
|
160
|
+
if (isSignal(target)) {
|
|
161
|
+
const leaf = target;
|
|
162
|
+
if (this.isEqual(leaf(), patch.value)) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
leaf.set(patch.value);
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
if (patch.value && typeof patch.value === 'object') {
|
|
169
|
+
return this.applyDeepToNode(target, patch.value);
|
|
170
|
+
}
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
158
173
|
if (this.isEqual(current[lastKey], patch.value)) {
|
|
159
174
|
return false;
|
|
160
175
|
}
|
|
@@ -165,6 +180,23 @@ class OptimizedUpdateEngine {
|
|
|
165
180
|
return false;
|
|
166
181
|
}
|
|
167
182
|
}
|
|
183
|
+
applyDeepToNode(node, value) {
|
|
184
|
+
if (!node) return false;
|
|
185
|
+
if (isSignal(node)) {
|
|
186
|
+
const leaf = node;
|
|
187
|
+
if (this.isEqual(leaf(), value)) return false;
|
|
188
|
+
leaf.set(value);
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
if ((typeof node === 'object' || typeof node === 'function') && value && typeof value === 'object') {
|
|
192
|
+
let changed = false;
|
|
193
|
+
for (const [key, child] of Object.entries(value)) {
|
|
194
|
+
changed = this.applyDeepToNode(node[key], child) || changed;
|
|
195
|
+
}
|
|
196
|
+
return changed;
|
|
197
|
+
}
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
168
200
|
isEqual(a, b) {
|
|
169
201
|
if (a === b) return true;
|
|
170
202
|
if (typeof a !== typeof b) return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signaltree/enterprise",
|
|
3
|
-
"version": "11.5.
|
|
3
|
+
"version": "11.5.3",
|
|
4
4
|
"description": "Enterprise optimizations for SignalTree reactive JSON. Diff-based updates, bulk operations, and advanced change tracking for large-scale applications.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"type": "module",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@angular/core": "^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
71
|
-
"@signaltree/core": "^11.5.
|
|
71
|
+
"@signaltree/core": "^11.5.3",
|
|
72
72
|
"tslib": "^2.0.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependenciesMeta": {},
|