fractostate 4.8.3 → 4.8.4
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/cjs/src/proxy.js +20 -57
- package/dist/cjs/src/proxy.js.map +1 -1
- package/dist/esm/src/proxy.js +20 -57
- package/dist/esm/src/proxy.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/src/proxy.js
CHANGED
|
@@ -51,15 +51,11 @@ function getCachedPath(path, prop) {
|
|
|
51
51
|
*
|
|
52
52
|
* Reduced allocations, cached operations
|
|
53
53
|
*/
|
|
54
|
-
function createDeepProxy(key, path,
|
|
55
|
-
|
|
54
|
+
function createDeepProxy(key, path, _initialVal, // Kept for signature compatibility but ignored for live state
|
|
55
|
+
options) {
|
|
56
|
+
// Pre-bind commit function
|
|
56
57
|
const commit = (val, forceful, skipEquality = false, op) => {
|
|
57
58
|
try {
|
|
58
|
-
// INTERNAL OPTIMIZATION: We fetch the RAW current state from the vault
|
|
59
|
-
// without cloning it. Since we are about to produce a new IMMUTABLE state
|
|
60
|
-
// using setInPath (which does structural cloning), this is safe and
|
|
61
|
-
// avoiding a full deepClone of the entire tree on every tiny action
|
|
62
|
-
// results in 100x performance in loops.
|
|
63
59
|
const currentState = store.store.get(key, undefined, { bypassClone: true });
|
|
64
60
|
const newState = setInPath(currentState, path, val);
|
|
65
61
|
store.store.set(key, newState, {
|
|
@@ -75,7 +71,6 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
75
71
|
throw error;
|
|
76
72
|
}
|
|
77
73
|
};
|
|
78
|
-
// Pre-create update function
|
|
79
74
|
const update = (val, op) => {
|
|
80
75
|
commit(val, false, true, op);
|
|
81
76
|
};
|
|
@@ -83,7 +78,12 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
83
78
|
get(_target, prop) {
|
|
84
79
|
if (typeof prop === "symbol")
|
|
85
80
|
return undefined;
|
|
86
|
-
// ---
|
|
81
|
+
// --- LIVE DATA FETCH ---
|
|
82
|
+
// We fetch the latest root state and drill down to the current path.
|
|
83
|
+
// This ensures Proxies are always "live" even if reused across updates.
|
|
84
|
+
const rootState = store.store.get(key, undefined, { bypassClone: true });
|
|
85
|
+
const currentVal = path.length === 0 ? rootState : getInPath(rootState, path);
|
|
86
|
+
// --- Meta-Operations ---
|
|
87
87
|
if (prop === "_val")
|
|
88
88
|
return currentVal;
|
|
89
89
|
if (prop === "_set")
|
|
@@ -106,59 +106,29 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
106
106
|
return (store.store.getRedoStack(key)?.length || 0) > 0;
|
|
107
107
|
if (prop === "_history")
|
|
108
108
|
return store.store.getHistory(key);
|
|
109
|
-
// Handle plugin-provided operations (e.g., _persist)
|
|
110
109
|
const pluginOps = store.store.getPluginOps(key, options);
|
|
111
110
|
if (prop in pluginOps)
|
|
112
111
|
return pluginOps[prop];
|
|
113
|
-
// Type check once for this level
|
|
114
112
|
const valType = typeof currentVal;
|
|
115
113
|
const isArray = Array.isArray(currentVal);
|
|
116
|
-
// --- Number Operations
|
|
114
|
+
// --- Number Operations ---
|
|
117
115
|
if (valType === "number") {
|
|
118
116
|
switch (prop) {
|
|
119
117
|
case "_increment":
|
|
120
|
-
return (amount = 1) =>
|
|
121
|
-
const liveVal = path.length === 0
|
|
122
|
-
? store.store.get(key, undefined, { bypassClone: true })
|
|
123
|
-
: getInPath(store.store.get(key, undefined, { bypassClone: true }), path);
|
|
124
|
-
update(liveVal + amount, "_increment");
|
|
125
|
-
};
|
|
118
|
+
return (amount = 1) => update(currentVal + amount, "_increment");
|
|
126
119
|
case "_decrement":
|
|
127
|
-
return (amount = 1) =>
|
|
128
|
-
const liveVal = path.length === 0
|
|
129
|
-
? store.store.get(key, undefined, { bypassClone: true })
|
|
130
|
-
: getInPath(store.store.get(key, undefined, { bypassClone: true }), path);
|
|
131
|
-
update(liveVal - amount, "_decrement");
|
|
132
|
-
};
|
|
120
|
+
return (amount = 1) => update(currentVal - amount, "_decrement");
|
|
133
121
|
case "_add":
|
|
134
|
-
return (amount) =>
|
|
135
|
-
const liveVal = path.length === 0
|
|
136
|
-
? store.store.get(key, undefined, { bypassClone: true })
|
|
137
|
-
: getInPath(store.store.get(key, undefined, { bypassClone: true }), path);
|
|
138
|
-
update(liveVal + amount, "_add");
|
|
139
|
-
};
|
|
122
|
+
return (amount) => update(currentVal + amount, "_add");
|
|
140
123
|
case "_subtract":
|
|
141
|
-
return (amount) =>
|
|
142
|
-
const liveVal = path.length === 0
|
|
143
|
-
? store.store.get(key, undefined, { bypassClone: true })
|
|
144
|
-
: getInPath(store.store.get(key, undefined, { bypassClone: true }), path);
|
|
145
|
-
update(liveVal - amount, "_subtract");
|
|
146
|
-
};
|
|
124
|
+
return (amount) => update(currentVal - amount, "_subtract");
|
|
147
125
|
case "_multiply":
|
|
148
|
-
return (amount) =>
|
|
149
|
-
const liveVal = path.length === 0
|
|
150
|
-
? store.store.get(key, undefined, { bypassClone: true })
|
|
151
|
-
: getInPath(store.store.get(key, undefined, { bypassClone: true }), path);
|
|
152
|
-
update(liveVal * amount, "_multiply");
|
|
153
|
-
};
|
|
126
|
+
return (amount) => update(currentVal * amount, "_multiply");
|
|
154
127
|
case "_divide":
|
|
155
128
|
return (amount) => {
|
|
156
129
|
if (amount === 0)
|
|
157
130
|
throw new Error("[FlowProxy] Division by zero");
|
|
158
|
-
|
|
159
|
-
? store.store.get(key, undefined, { bypassClone: true })
|
|
160
|
-
: getInPath(store.store.get(key, undefined, { bypassClone: true }), path);
|
|
161
|
-
update(liveVal / amount, "_divide");
|
|
131
|
+
update(currentVal / amount, "_divide");
|
|
162
132
|
};
|
|
163
133
|
case "_pow":
|
|
164
134
|
return (n) => update(Math.pow(currentVal, n), "_pow");
|
|
@@ -182,12 +152,11 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
182
152
|
return (p) => update(parseFloat(currentVal.toPrecision(p)), "_toPrecision");
|
|
183
153
|
}
|
|
184
154
|
}
|
|
185
|
-
// --- Array Operations
|
|
155
|
+
// --- Array Operations ---
|
|
186
156
|
if (isArray) {
|
|
187
157
|
switch (prop) {
|
|
188
158
|
case "_push":
|
|
189
159
|
return (item) => {
|
|
190
|
-
// Manual copy instead of spread for large arrays
|
|
191
160
|
const len = currentVal.length;
|
|
192
161
|
const newArr = new Array(len + 1);
|
|
193
162
|
for (let i = 0; i < len; i++)
|
|
@@ -201,7 +170,6 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
201
170
|
return () => update(currentVal.slice(1), "_shift");
|
|
202
171
|
case "_unshift":
|
|
203
172
|
return (item) => {
|
|
204
|
-
// Manual copy for better performance
|
|
205
173
|
const len = currentVal.length;
|
|
206
174
|
const newArr = new Array(len + 1);
|
|
207
175
|
newArr[0] = item;
|
|
@@ -215,7 +183,6 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
215
183
|
return (fn) => update(currentVal.map(fn), "_map");
|
|
216
184
|
case "_removeAt":
|
|
217
185
|
return (index) => {
|
|
218
|
-
// Manual filter for single index
|
|
219
186
|
const len = currentVal.length;
|
|
220
187
|
const newArr = new Array(len - 1);
|
|
221
188
|
let j = 0;
|
|
@@ -236,7 +203,6 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
236
203
|
newArr[i + 1] = currentVal[i];
|
|
237
204
|
update(newArr, "_insertAt");
|
|
238
205
|
};
|
|
239
|
-
// --- New Ops (v4.8.0) ---
|
|
240
206
|
case "_splice":
|
|
241
207
|
return (s, d, ...items) => {
|
|
242
208
|
const next = [...currentVal];
|
|
@@ -266,7 +232,6 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
266
232
|
}
|
|
267
233
|
update(next, "_shuffle");
|
|
268
234
|
};
|
|
269
|
-
// Traversers that return a proxy to an item
|
|
270
235
|
case "_at":
|
|
271
236
|
return (i) => {
|
|
272
237
|
const idx = i < 0 ? currentVal.length + i : i;
|
|
@@ -298,7 +263,6 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
298
263
|
return () => update(currentVal.toLowerCase(), "_lowercase");
|
|
299
264
|
case "_trim":
|
|
300
265
|
return () => update(currentVal.trim(), "_trim");
|
|
301
|
-
// --- New Ops (v4.8.0) ---
|
|
302
266
|
case "_replace":
|
|
303
267
|
return (p, r) => update(currentVal.replace(p, r), "_replace");
|
|
304
268
|
case "_replaceAll":
|
|
@@ -331,14 +295,12 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
331
295
|
if (currentVal !== null && valType === "object" && !isArray) {
|
|
332
296
|
if (prop === "_merge") {
|
|
333
297
|
return (obj) => {
|
|
334
|
-
// Object.assign faster than spread for merge
|
|
335
298
|
const merged = Object.assign({}, currentVal, obj);
|
|
336
299
|
update(merged, "_merge");
|
|
337
300
|
};
|
|
338
301
|
}
|
|
339
302
|
if (prop === "_delete") {
|
|
340
303
|
return (keyToDel) => {
|
|
341
|
-
// Only copy if key exists
|
|
342
304
|
if (!(keyToDel in currentVal))
|
|
343
305
|
return;
|
|
344
306
|
const keys = Object.keys(currentVal);
|
|
@@ -350,7 +312,6 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
350
312
|
update(next, "_delete");
|
|
351
313
|
};
|
|
352
314
|
}
|
|
353
|
-
// --- New Ops (v4.8.0) ---
|
|
354
315
|
if (prop === "_pick") {
|
|
355
316
|
return (keys) => {
|
|
356
317
|
const next = {};
|
|
@@ -386,7 +347,6 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
386
347
|
}
|
|
387
348
|
}
|
|
388
349
|
// Recursive step: create a new proxy for the child property
|
|
389
|
-
// Use cached path
|
|
390
350
|
const nextVal = currentVal !== null && currentVal !== undefined
|
|
391
351
|
? currentVal[prop]
|
|
392
352
|
: undefined;
|
|
@@ -394,6 +354,9 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
394
354
|
return createDeepProxy(key, newPath, nextVal, options);
|
|
395
355
|
},
|
|
396
356
|
apply(_target, _thisArg, args) {
|
|
357
|
+
// Re-fetch current value for apply trap too
|
|
358
|
+
const rootState = store.store.get(key, undefined, { bypassClone: true });
|
|
359
|
+
const currentVal = path.length === 0 ? rootState : getInPath(rootState, path);
|
|
397
360
|
if (typeof currentVal === "function") {
|
|
398
361
|
return currentVal(...args);
|
|
399
362
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sources":["../../../src/proxy.ts"],"sourcesContent":["/* *****************************************************************************\n * FractoSate\n *\n * ACCESS RESTRICTIONS:\n * - This software is exclusively for use by Authorized Personnel of NEHONIX\n * - Intended for Internal Use only within NEHONIX operations\n * - No rights granted to unauthorized individuals or entities\n * - All modifications are works made for hire assigned to NEHONIX\n *\n * PROHIBITED ACTIVITIES:\n * - Copying, distributing, or sublicensing without written permission\n * - Reverse engineering, decompiling, or disassembling\n * - Creating derivative works without explicit authorization\n * - External use or commercial distribution outside NEHONIX\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n * For questions or permissions, contact:\n * NEHONIX Legal Department\n * Email: legal@nehonix.com\n * Website: www.nehonix.com\n ***************************************************************************** */\n\nimport type { FlowOptions, TypeAwareOps } from \"./types\";\nimport { store } from \"./store\";\n\n// Path cache to avoid repeated array allocations\nconst pathCache = new WeakMap<string[], Map<string, string[]>>();\n\nfunction getCachedPath(path: string[], prop: string): string[] {\n let cache = pathCache.get(path);\n if (!cache) {\n cache = new Map();\n pathCache.set(path, cache);\n }\n\n let cached = cache.get(prop);\n if (!cached) {\n cached = [...path, prop];\n cache.set(prop, cached);\n }\n return cached;\n}\n\n/**\n * Creates a deep proxy that provides type-specific atomic operations for a flow.\n * The proxy tracks its path within the state tree and maps access to specific update logic.\n *\n * Reduced allocations, cached operations\n */\nexport function createDeepProxy<T = any, A = Record<string, any>>(\n key: string,\n path: string[],\n currentVal: any,\n options: FlowOptions<any>,\n): TypeAwareOps<T, A> {\n // Pre-bind commit function to avoid recreation\n const commit = (\n val: any,\n forceful: boolean,\n skipEquality = false,\n op?: string,\n ) => {\n try {\n // INTERNAL OPTIMIZATION: We fetch the RAW current state from the vault\n // without cloning it. Since we are about to produce a new IMMUTABLE state\n // using setInPath (which does structural cloning), this is safe and\n // avoiding a full deepClone of the entire tree on every tiny action\n // results in 100x performance in loops.\n const currentState = store.get(key, undefined, { bypassClone: true });\n const newState = setInPath(currentState, path, val);\n store.set(key, newState, {\n ...options,\n force: forceful,\n skipEquality,\n _op: op || (options as any)._op || \"set\",\n _path: path,\n } as any);\n } catch (error) {\n console.error(\n `[FlowProxy] Commit error at path ${path.join(\".\")}:`,\n error,\n );\n throw error;\n }\n };\n\n // Pre-create update function\n const update = (val: any, op?: string) => {\n commit(val, false, true, op);\n };\n\n return new Proxy(() => {}, {\n get(_target: any, prop: any) {\n if (typeof prop === \"symbol\") return undefined;\n\n // --- Meta-Operations (Fast path) ---\n if (prop === \"_val\") return currentVal;\n if (prop === \"_set\")\n return (val: any) => {\n commit(val, true, false, \"_set\");\n };\n if (prop === \"_patch\")\n return (val: any) => {\n commit(val, false, false, \"_patch\");\n };\n if (prop === \"__actions__\") return (options as any).actions;\n if (prop === \"_undo\") return () => store.undo(key);\n if (prop === \"_redo\") return () => store.redo(key);\n if (prop === \"_canUndo\") return (store.getHistory(key)?.length || 0) > 1;\n if (prop === \"_canRedo\")\n return (store.getRedoStack(key)?.length || 0) > 0;\n if (prop === \"_history\") return store.getHistory(key);\n\n // Handle plugin-provided operations (e.g., _persist)\n const pluginOps = store.getPluginOps(key, options);\n if (prop in pluginOps) return pluginOps[prop];\n\n // Type check once for this level\n const valType = typeof currentVal;\n const isArray = Array.isArray(currentVal);\n\n // --- Number Operations (Optimized with cached functions) ---\n if (valType === \"number\") {\n switch (prop) {\n case \"_increment\":\n return (amount = 1) => {\n const liveVal =\n path.length === 0\n ? store.get(key, undefined, { bypassClone: true })\n : getInPath(\n store.get(key, undefined, { bypassClone: true }),\n path,\n );\n update(liveVal + amount, \"_increment\");\n };\n case \"_decrement\":\n return (amount = 1) => {\n const liveVal =\n path.length === 0\n ? store.get(key, undefined, { bypassClone: true })\n : getInPath(\n store.get(key, undefined, { bypassClone: true }),\n path,\n );\n update(liveVal - amount, \"_decrement\");\n };\n case \"_add\":\n return (amount: number) => {\n const liveVal =\n path.length === 0\n ? store.get(key, undefined, { bypassClone: true })\n : getInPath(\n store.get(key, undefined, { bypassClone: true }),\n path,\n );\n update(liveVal + amount, \"_add\");\n };\n case \"_subtract\":\n return (amount: number) => {\n const liveVal =\n path.length === 0\n ? store.get(key, undefined, { bypassClone: true })\n : getInPath(\n store.get(key, undefined, { bypassClone: true }),\n path,\n );\n update(liveVal - amount, \"_subtract\");\n };\n case \"_multiply\":\n return (amount: number) => {\n const liveVal =\n path.length === 0\n ? store.get(key, undefined, { bypassClone: true })\n : getInPath(\n store.get(key, undefined, { bypassClone: true }),\n path,\n );\n update(liveVal * amount, \"_multiply\");\n };\n case \"_divide\":\n return (amount: number) => {\n if (amount === 0) throw new Error(\"[FlowProxy] Division by zero\");\n const liveVal =\n path.length === 0\n ? store.get(key, undefined, { bypassClone: true })\n : getInPath(\n store.get(key, undefined, { bypassClone: true }),\n path,\n );\n update(liveVal / amount, \"_divide\");\n };\n case \"_pow\":\n return (n: number) => update(Math.pow(currentVal, n), \"_pow\");\n case \"_sqrt\":\n return () => update(Math.sqrt(currentVal), \"_sqrt\");\n case \"_abs\":\n return () => update(Math.abs(currentVal), \"_abs\");\n case \"_round\":\n return () => update(Math.round(currentVal), \"_round\");\n case \"_floor\":\n return () => update(Math.floor(currentVal), \"_floor\");\n case \"_ceil\":\n return () => update(Math.ceil(currentVal), \"_ceil\");\n case \"_mod\":\n return (n: number) => update(currentVal % n, \"_mod\");\n case \"_clamp\":\n return (min: number, max: number) =>\n update(Math.min(Math.max(currentVal, min), max), \"_clamp\");\n case \"_negate\":\n return () => update(-currentVal, \"_negate\");\n case \"_toPrecision\":\n return (p: number) =>\n update(parseFloat(currentVal.toPrecision(p)), \"_toPrecision\");\n }\n }\n\n // --- Array Operations (Optimized with minimal allocations) ---\n if (isArray) {\n switch (prop) {\n case \"_push\":\n return (item: any) => {\n // Manual copy instead of spread for large arrays\n const len = currentVal.length;\n const newArr = new Array(len + 1);\n for (let i = 0; i < len; i++) newArr[i] = currentVal[i];\n newArr[len] = item;\n update(newArr, \"_push\");\n };\n case \"_pop\":\n return () => update(currentVal.slice(0, -1), \"_pop\");\n case \"_shift\":\n return () => update(currentVal.slice(1), \"_shift\");\n case \"_unshift\":\n return (item: any) => {\n // Manual copy for better performance\n const len = currentVal.length;\n const newArr = new Array(len + 1);\n newArr[0] = item;\n for (let i = 0; i < len; i++) newArr[i + 1] = currentVal[i];\n update(newArr, \"_unshift\");\n };\n case \"_filter\":\n return (fn: any) => update(currentVal.filter(fn), \"_filter\");\n case \"_map\":\n return (fn: any) => update(currentVal.map(fn), \"_map\");\n case \"_removeAt\":\n return (index: number) => {\n // Manual filter for single index\n const len = currentVal.length;\n const newArr = new Array(len - 1);\n let j = 0;\n for (let i = 0; i < len; i++) {\n if (i !== index) newArr[j++] = currentVal[i];\n }\n update(newArr, \"_removeAt\");\n };\n case \"_insertAt\":\n return (index: number, item: any) => {\n const len = currentVal.length;\n const newArr = new Array(len + 1);\n for (let i = 0; i < index; i++) newArr[i] = currentVal[i];\n newArr[index] = item;\n for (let i = index; i < len; i++) newArr[i + 1] = currentVal[i];\n update(newArr, \"_insertAt\");\n };\n // --- New Ops (v4.8.0) ---\n case \"_splice\":\n return (s: number, d: number, ...items: any[]) => {\n const next = [...currentVal];\n next.splice(s, d, ...items);\n update(next, \"_splice\");\n };\n case \"_reverse\":\n return () => update([...currentVal].reverse(), \"_reverse\");\n case \"_sort\":\n return (fn: any) => update([...currentVal].sort(fn), \"_sort\");\n case \"_fill\":\n return (v: any, s?: number, e?: number) => {\n const next = [...currentVal];\n next.fill(v, s, e);\n update(next, \"_fill\");\n };\n case \"_concat\":\n return (other: any[]) =>\n update(currentVal.concat(other), \"_concat\");\n case \"_uniq\":\n return () => update(Array.from(new Set(currentVal)), \"_uniq\");\n case \"_shuffle\":\n return () => {\n const next = [...currentVal];\n for (let i = next.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [next[i], next[j]] = [next[j], next[i]];\n }\n update(next, \"_shuffle\");\n };\n // Traversers that return a proxy to an item\n case \"_at\":\n return (i: number) => {\n const idx = i < 0 ? currentVal.length + i : i;\n return createDeepProxy(\n key,\n getCachedPath(path, idx.toString()),\n currentVal[idx],\n options,\n );\n };\n case \"_first\":\n return () =>\n createDeepProxy(\n key,\n getCachedPath(path, \"0\"),\n currentVal[0],\n options,\n );\n case \"_last\":\n return () =>\n createDeepProxy(\n key,\n getCachedPath(path, (currentVal.length - 1).toString()),\n currentVal[currentVal.length - 1],\n options,\n );\n case \"_findBy\":\n return (fn: (item: any, idx: number) => boolean) => {\n const idx = currentVal.findIndex(fn);\n if (idx === -1) return undefined;\n return createDeepProxy(\n key,\n getCachedPath(path, idx.toString()),\n currentVal[idx],\n options,\n );\n };\n }\n }\n\n // --- String Operations ---\n if (valType === \"string\") {\n switch (prop) {\n case \"_append\":\n return (str: string) => update(currentVal + str, \"_append\");\n case \"_prepend\":\n return (str: string) => update(str + currentVal, \"_prepend\");\n case \"_uppercase\":\n return () => update(currentVal.toUpperCase(), \"_uppercase\");\n case \"_lowercase\":\n return () => update(currentVal.toLowerCase(), \"_lowercase\");\n case \"_trim\":\n return () => update(currentVal.trim(), \"_trim\");\n // --- New Ops (v4.8.0) ---\n case \"_replace\":\n return (p: string | RegExp, r: string) =>\n update(currentVal.replace(p, r), \"_replace\");\n case \"_replaceAll\":\n return (p: string | RegExp, r: string) =>\n update(currentVal.replaceAll(p, r), \"_replaceAll\");\n case \"_substring\":\n return (s: number, e?: number) =>\n update(currentVal.substring(s, e), \"_substring\");\n case \"_slice\":\n return (s: number, e?: number) =>\n update(currentVal.slice(s, e), \"_slice\");\n case \"_capitalize\":\n return () =>\n update(\n currentVal.charAt(0).toUpperCase() + currentVal.slice(1),\n \"_capitalize\",\n );\n case \"_truncate\":\n return (l: number, s = \"...\") =>\n update(\n currentVal.length > l\n ? currentVal.substring(0, l) + s\n : currentVal,\n \"_truncate\",\n );\n case \"_padEnd\":\n return (l: number, f?: string) =>\n update(currentVal.padEnd(l, f), \"_padEnd\");\n case \"_padStart\":\n return (l: number, f?: string) =>\n update(currentVal.padStart(l, f), \"_padStart\");\n case \"_repeat\":\n return (c: number) => update(currentVal.repeat(c), \"_repeat\");\n }\n }\n\n // --- Boolean Operations ---\n if (valType === \"boolean\") {\n if (prop === \"_toggle\") {\n return () => update(!currentVal, \"_toggle\");\n }\n }\n\n // --- Object Operations ---\n if (currentVal !== null && valType === \"object\" && !isArray) {\n if (prop === \"_merge\") {\n return (obj: any) => {\n // Object.assign faster than spread for merge\n const merged = Object.assign({}, currentVal, obj);\n update(merged, \"_merge\");\n };\n }\n if (prop === \"_delete\") {\n return (keyToDel: string) => {\n // Only copy if key exists\n if (!(keyToDel in currentVal)) return;\n const keys = Object.keys(currentVal);\n const next: any = {};\n for (const k of keys) {\n if (k !== keyToDel) next[k] = currentVal[k];\n }\n update(next, \"_delete\");\n };\n }\n // --- New Ops (v4.8.0) ---\n if (prop === \"_pick\") {\n return (keys: string[]) => {\n const next: any = {};\n keys.forEach((k) => {\n if (k in currentVal) next[k] = currentVal[k];\n });\n update(next, \"_pick\");\n };\n }\n if (prop === \"_omit\") {\n return (keys: string[]) => {\n const next = { ...currentVal };\n keys.forEach((k) => delete next[k]);\n update(next, \"_omit\");\n };\n }\n if (prop === \"_defaults\") {\n return (d: any) => update({ ...d, ...currentVal }, \"_defaults\");\n }\n if (prop === \"_clear\") return () => update({}, \"_clear\");\n if (prop === \"_clone\") return () => update({ ...currentVal }, \"_clone\");\n if (prop === \"_assign\")\n return (s: any) => update({ ...currentVal, ...s }, \"_assign\");\n if (prop === \"_mapValues\") {\n return (fn: any) => {\n const next: any = {};\n Object.keys(currentVal).forEach(\n (k) => (next[k] = fn(currentVal[k], k)),\n );\n update(next, \"_mapValues\");\n };\n }\n }\n\n // Recursive step: create a new proxy for the child property\n // Use cached path\n const nextVal =\n currentVal !== null && currentVal !== undefined\n ? currentVal[prop]\n : undefined;\n const newPath = getCachedPath(path, prop);\n return createDeepProxy(key, newPath, nextVal, options);\n },\n apply(_target, _thisArg, args) {\n if (typeof currentVal === \"function\") {\n return currentVal(...args);\n }\n console.warn(\n `[FlowProxy] Attempted to call a non-function value at path: ${path.join(\".\")}`,\n );\n },\n }) as unknown as TypeAwareOps<T, A>;\n}\n\n/**\n * Immutable update utility that sets a value at a specific path within an object/array.\n */\nexport function setInPath(obj: any, path: string[], value: any): any {\n return setInPathRecursive(obj, path, value, 0);\n}\n\nfunction setInPathRecursive(\n obj: any,\n path: string[],\n value: any,\n index: number,\n): any {\n if (index === path.length) return value;\n\n const head = path[index];\n\n if (Array.isArray(obj)) {\n const i = parseInt(head, 10);\n if (isNaN(i) || i < 0)\n throw new Error(`[FlowProxy] Invalid array index: ${head}`);\n\n const len = obj.length;\n const newArr = new Array(Math.max(len, i + 1));\n\n // Fast copy with check for modified index\n for (let j = 0; j < newArr.length; j++) {\n if (j === i) {\n newArr[j] = setInPathRecursive(obj[j], path, value, index + 1);\n } else {\n newArr[j] = j < len ? obj[j] : undefined;\n }\n }\n return newArr;\n }\n\n // Object path\n const currentObj = obj ?? {};\n const keys = Object.keys(currentObj);\n const result: any = {};\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n result[key] =\n key === head\n ? setInPathRecursive(currentObj[key], path, value, index + 1)\n : currentObj[key];\n }\n\n if (!(head in currentObj)) {\n result[head] = setInPathRecursive(undefined, path, value, index + 1);\n }\n\n return result;\n}\n\n/**\n * Access utility to get a value at a specific path.\n */\nfunction getInPath(obj: any, path: string[]): any {\n let current = obj;\n for (let i = 0; i < path.length; i++) {\n if (current === null || current === undefined) return undefined;\n current = current[path[i]];\n }\n return current;\n}\n"],"names":["store"],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BiF;AAKjF;AACA,MAAM,SAAS,GAAG,IAAI,OAAO,EAAmC;AAEhE,SAAS,aAAa,CAAC,IAAc,EAAE,IAAY,EAAA;IACjD,IAAI,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC;IAC/B,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,KAAK,GAAG,IAAI,GAAG,EAAE;AACjB,QAAA,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC;IAC5B;IAEA,IAAI,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;IAC5B,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC;AACxB,QAAA,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC;IACzB;AACA,IAAA,OAAO,MAAM;AACf;AAEA;;;;;AAKG;AACG,SAAU,eAAe,CAC7B,GAAW,EACX,IAAc,EACd,UAAe,EACf,OAAyB,EAAA;;AAGzB,IAAA,MAAM,MAAM,GAAG,CACb,GAAQ,EACR,QAAiB,EACjB,YAAY,GAAG,KAAK,EACpB,EAAW,KACT;AACF,QAAA,IAAI;;;;;;AAMF,YAAA,MAAM,YAAY,GAAGA,WAAK,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;YACrE,MAAM,QAAQ,GAAG,SAAS,CAA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QAAA,OAAO,MAAM;IACf;;AAGA,IAAA,MAAM,UAAU,GAAG,GAAG,IAAI,EAAE;IAC5B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;IACpC,MAAM,MAAM,GAAQ,EAAE;AAEtB,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACpC,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC;QACnB,MAAM,CAAC,GAAG,CAAC;AACT,YAAA,GAAG,KAAK;AACN,kBAAE,kBAAkB,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC;AAC5D,kBAAE,UAAU,CAAC,GAAG,CAAC;IACvB;AAEA,IAAA,IAAI,EAAE,IAAI,IAAI,UAAU,CAAC,EAAE;AACzB,QAAA,MAAM,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC;IACtE;AAEA,IAAA,OAAO,MAAM;AACf;AAEA;;AAEG;AACH,SAAS,SAAS,CAAC,GAAQ,EAAE,IAAc,EAAA;IACzC,IAAI,OAAO,GAAG,GAAG;AACjB,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACpC,QAAA,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS;AAAE,YAAA,OAAO,SAAS;QAC/D,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5B;AACA,IAAA,OAAO,OAAO;AAChB;;;;;"}
|
|
1
|
+
{"version":3,"file":"proxy.js","sources":["../../../src/proxy.ts"],"sourcesContent":["/* *****************************************************************************\n * FractoSate\n *\n * ACCESS RESTRICTIONS:\n * - This software is exclusively for use by Authorized Personnel of NEHONIX\n * - Intended for Internal Use only within NEHONIX operations\n * - No rights granted to unauthorized individuals or entities\n * - All modifications are works made for hire assigned to NEHONIX\n *\n * PROHIBITED ACTIVITIES:\n * - Copying, distributing, or sublicensing without written permission\n * - Reverse engineering, decompiling, or disassembling\n * - Creating derivative works without explicit authorization\n * - External use or commercial distribution outside NEHONIX\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n * For questions or permissions, contact:\n * NEHONIX Legal Department\n * Email: legal@nehonix.com\n * Website: www.nehonix.com\n ***************************************************************************** */\n\nimport type { FlowOptions, TypeAwareOps } from \"./types\";\nimport { store } from \"./store\";\n\n// Path cache to avoid repeated array allocations\nconst pathCache = new WeakMap<string[], Map<string, string[]>>();\n\nfunction getCachedPath(path: string[], prop: string): string[] {\n let cache = pathCache.get(path);\n if (!cache) {\n cache = new Map();\n pathCache.set(path, cache);\n }\n\n let cached = cache.get(prop);\n if (!cached) {\n cached = [...path, prop];\n cache.set(prop, cached);\n }\n return cached;\n}\n\n/**\n * Creates a deep proxy that provides type-specific atomic operations for a flow.\n * The proxy tracks its path within the state tree and maps access to specific update logic.\n *\n * Reduced allocations, cached operations\n */\nexport function createDeepProxy<T = any, A = Record<string, any>>(\n key: string,\n path: string[],\n _initialVal: any, // Kept for signature compatibility but ignored for live state\n options: FlowOptions<any>,\n): TypeAwareOps<T, A> {\n // Pre-bind commit function\n const commit = (\n val: any,\n forceful: boolean,\n skipEquality = false,\n op?: string,\n ) => {\n try {\n const currentState = store.get(key, undefined, { bypassClone: true });\n const newState = setInPath(currentState, path, val);\n store.set(key, newState, {\n ...options,\n force: forceful,\n skipEquality,\n _op: op || (options as any)._op || \"set\",\n _path: path,\n } as any);\n } catch (error) {\n console.error(\n `[FlowProxy] Commit error at path ${path.join(\".\")}:`,\n error,\n );\n throw error;\n }\n };\n\n const update = (val: any, op?: string) => {\n commit(val, false, true, op);\n };\n\n return new Proxy(() => {}, {\n get(_target: any, prop: any) {\n if (typeof prop === \"symbol\") return undefined;\n\n // --- LIVE DATA FETCH ---\n // We fetch the latest root state and drill down to the current path.\n // This ensures Proxies are always \"live\" even if reused across updates.\n const rootState = store.get(key, undefined, { bypassClone: true });\n const currentVal =\n path.length === 0 ? rootState : getInPath(rootState, path);\n\n // --- Meta-Operations ---\n if (prop === \"_val\") return currentVal;\n if (prop === \"_set\")\n return (val: any) => {\n commit(val, true, false, \"_set\");\n };\n if (prop === \"_patch\")\n return (val: any) => {\n commit(val, false, false, \"_patch\");\n };\n if (prop === \"__actions__\") return (options as any).actions;\n if (prop === \"_undo\") return () => store.undo(key);\n if (prop === \"_redo\") return () => store.redo(key);\n if (prop === \"_canUndo\") return (store.getHistory(key)?.length || 0) > 1;\n if (prop === \"_canRedo\")\n return (store.getRedoStack(key)?.length || 0) > 0;\n if (prop === \"_history\") return store.getHistory(key);\n\n const pluginOps = store.getPluginOps(key, options);\n if (prop in pluginOps) return pluginOps[prop];\n\n const valType = typeof currentVal;\n const isArray = Array.isArray(currentVal);\n\n // --- Number Operations ---\n if (valType === \"number\") {\n switch (prop) {\n case \"_increment\":\n return (amount = 1) => update(currentVal + amount, \"_increment\");\n case \"_decrement\":\n return (amount = 1) => update(currentVal - amount, \"_decrement\");\n case \"_add\":\n return (amount: number) => update(currentVal + amount, \"_add\");\n case \"_subtract\":\n return (amount: number) => update(currentVal - amount, \"_subtract\");\n case \"_multiply\":\n return (amount: number) => update(currentVal * amount, \"_multiply\");\n case \"_divide\":\n return (amount: number) => {\n if (amount === 0) throw new Error(\"[FlowProxy] Division by zero\");\n update(currentVal / amount, \"_divide\");\n };\n case \"_pow\":\n return (n: number) => update(Math.pow(currentVal, n), \"_pow\");\n case \"_sqrt\":\n return () => update(Math.sqrt(currentVal), \"_sqrt\");\n case \"_abs\":\n return () => update(Math.abs(currentVal), \"_abs\");\n case \"_round\":\n return () => update(Math.round(currentVal), \"_round\");\n case \"_floor\":\n return () => update(Math.floor(currentVal), \"_floor\");\n case \"_ceil\":\n return () => update(Math.ceil(currentVal), \"_ceil\");\n case \"_mod\":\n return (n: number) => update(currentVal % n, \"_mod\");\n case \"_clamp\":\n return (min: number, max: number) =>\n update(Math.min(Math.max(currentVal, min), max), \"_clamp\");\n case \"_negate\":\n return () => update(-currentVal, \"_negate\");\n case \"_toPrecision\":\n return (p: number) =>\n update(parseFloat(currentVal.toPrecision(p)), \"_toPrecision\");\n }\n }\n\n // --- Array Operations ---\n if (isArray) {\n switch (prop) {\n case \"_push\":\n return (item: any) => {\n const len = currentVal.length;\n const newArr = new Array(len + 1);\n for (let i = 0; i < len; i++) newArr[i] = currentVal[i];\n newArr[len] = item;\n update(newArr, \"_push\");\n };\n case \"_pop\":\n return () => update(currentVal.slice(0, -1), \"_pop\");\n case \"_shift\":\n return () => update(currentVal.slice(1), \"_shift\");\n case \"_unshift\":\n return (item: any) => {\n const len = currentVal.length;\n const newArr = new Array(len + 1);\n newArr[0] = item;\n for (let i = 0; i < len; i++) newArr[i + 1] = currentVal[i];\n update(newArr, \"_unshift\");\n };\n case \"_filter\":\n return (fn: any) => update(currentVal.filter(fn), \"_filter\");\n case \"_map\":\n return (fn: any) => update(currentVal.map(fn), \"_map\");\n case \"_removeAt\":\n return (index: number) => {\n const len = currentVal.length;\n const newArr = new Array(len - 1);\n let j = 0;\n for (let i = 0; i < len; i++) {\n if (i !== index) newArr[j++] = currentVal[i];\n }\n update(newArr, \"_removeAt\");\n };\n case \"_insertAt\":\n return (index: number, item: any) => {\n const len = currentVal.length;\n const newArr = new Array(len + 1);\n for (let i = 0; i < index; i++) newArr[i] = currentVal[i];\n newArr[index] = item;\n for (let i = index; i < len; i++) newArr[i + 1] = currentVal[i];\n update(newArr, \"_insertAt\");\n };\n case \"_splice\":\n return (s: number, d: number, ...items: any[]) => {\n const next = [...currentVal];\n next.splice(s, d, ...items);\n update(next, \"_splice\");\n };\n case \"_reverse\":\n return () => update([...currentVal].reverse(), \"_reverse\");\n case \"_sort\":\n return (fn: any) => update([...currentVal].sort(fn), \"_sort\");\n case \"_fill\":\n return (v: any, s?: number, e?: number) => {\n const next = [...currentVal];\n next.fill(v, s, e);\n update(next, \"_fill\");\n };\n case \"_concat\":\n return (other: any[]) =>\n update(currentVal.concat(other), \"_concat\");\n case \"_uniq\":\n return () => update(Array.from(new Set(currentVal)), \"_uniq\");\n case \"_shuffle\":\n return () => {\n const next = [...currentVal];\n for (let i = next.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [next[i], next[j]] = [next[j], next[i]];\n }\n update(next, \"_shuffle\");\n };\n case \"_at\":\n return (i: number) => {\n const idx = i < 0 ? currentVal.length + i : i;\n return createDeepProxy(\n key,\n getCachedPath(path, idx.toString()),\n currentVal[idx],\n options,\n );\n };\n case \"_first\":\n return () =>\n createDeepProxy(\n key,\n getCachedPath(path, \"0\"),\n currentVal[0],\n options,\n );\n case \"_last\":\n return () =>\n createDeepProxy(\n key,\n getCachedPath(path, (currentVal.length - 1).toString()),\n currentVal[currentVal.length - 1],\n options,\n );\n case \"_findBy\":\n return (fn: (item: any, idx: number) => boolean) => {\n const idx = currentVal.findIndex(fn);\n if (idx === -1) return undefined;\n return createDeepProxy(\n key,\n getCachedPath(path, idx.toString()),\n currentVal[idx],\n options,\n );\n };\n }\n }\n\n // --- String Operations ---\n if (valType === \"string\") {\n switch (prop) {\n case \"_append\":\n return (str: string) => update(currentVal + str, \"_append\");\n case \"_prepend\":\n return (str: string) => update(str + currentVal, \"_prepend\");\n case \"_uppercase\":\n return () => update(currentVal.toUpperCase(), \"_uppercase\");\n case \"_lowercase\":\n return () => update(currentVal.toLowerCase(), \"_lowercase\");\n case \"_trim\":\n return () => update(currentVal.trim(), \"_trim\");\n case \"_replace\":\n return (p: string | RegExp, r: string) =>\n update(currentVal.replace(p, r), \"_replace\");\n case \"_replaceAll\":\n return (p: string | RegExp, r: string) =>\n update(currentVal.replaceAll(p, r), \"_replaceAll\");\n case \"_substring\":\n return (s: number, e?: number) =>\n update(currentVal.substring(s, e), \"_substring\");\n case \"_slice\":\n return (s: number, e?: number) =>\n update(currentVal.slice(s, e), \"_slice\");\n case \"_capitalize\":\n return () =>\n update(\n currentVal.charAt(0).toUpperCase() + currentVal.slice(1),\n \"_capitalize\",\n );\n case \"_truncate\":\n return (l: number, s = \"...\") =>\n update(\n currentVal.length > l\n ? currentVal.substring(0, l) + s\n : currentVal,\n \"_truncate\",\n );\n case \"_padEnd\":\n return (l: number, f?: string) =>\n update(currentVal.padEnd(l, f), \"_padEnd\");\n case \"_padStart\":\n return (l: number, f?: string) =>\n update(currentVal.padStart(l, f), \"_padStart\");\n case \"_repeat\":\n return (c: number) => update(currentVal.repeat(c), \"_repeat\");\n }\n }\n\n // --- Boolean Operations ---\n if (valType === \"boolean\") {\n if (prop === \"_toggle\") {\n return () => update(!currentVal, \"_toggle\");\n }\n }\n\n // --- Object Operations ---\n if (currentVal !== null && valType === \"object\" && !isArray) {\n if (prop === \"_merge\") {\n return (obj: any) => {\n const merged = Object.assign({}, currentVal, obj);\n update(merged, \"_merge\");\n };\n }\n if (prop === \"_delete\") {\n return (keyToDel: string) => {\n if (!(keyToDel in currentVal)) return;\n const keys = Object.keys(currentVal);\n const next: any = {};\n for (const k of keys) {\n if (k !== keyToDel) next[k] = currentVal[k];\n }\n update(next, \"_delete\");\n };\n }\n if (prop === \"_pick\") {\n return (keys: string[]) => {\n const next: any = {};\n keys.forEach((k) => {\n if (k in currentVal) next[k] = currentVal[k];\n });\n update(next, \"_pick\");\n };\n }\n if (prop === \"_omit\") {\n return (keys: string[]) => {\n const next = { ...currentVal };\n keys.forEach((k) => delete next[k]);\n update(next, \"_omit\");\n };\n }\n if (prop === \"_defaults\") {\n return (d: any) => update({ ...d, ...currentVal }, \"_defaults\");\n }\n if (prop === \"_clear\") return () => update({}, \"_clear\");\n if (prop === \"_clone\") return () => update({ ...currentVal }, \"_clone\");\n if (prop === \"_assign\")\n return (s: any) => update({ ...currentVal, ...s }, \"_assign\");\n if (prop === \"_mapValues\") {\n return (fn: any) => {\n const next: any = {};\n Object.keys(currentVal).forEach(\n (k) => (next[k] = fn(currentVal[k], k)),\n );\n update(next, \"_mapValues\");\n };\n }\n }\n\n // Recursive step: create a new proxy for the child property\n const nextVal =\n currentVal !== null && currentVal !== undefined\n ? currentVal[prop]\n : undefined;\n const newPath = getCachedPath(path, prop);\n return createDeepProxy(key, newPath, nextVal, options);\n },\n apply(_target, _thisArg, args) {\n // Re-fetch current value for apply trap too\n const rootState = store.get(key, undefined, { bypassClone: true });\n const currentVal =\n path.length === 0 ? rootState : getInPath(rootState, path);\n\n if (typeof currentVal === \"function\") {\n return currentVal(...args);\n }\n console.warn(\n `[FlowProxy] Attempted to call a non-function value at path: ${path.join(\".\")}`,\n );\n },\n }) as unknown as TypeAwareOps<T, A>;\n}\n\n/**\n * Immutable update utility that sets a value at a specific path within an object/array.\n */\nexport function setInPath(obj: any, path: string[], value: any): any {\n return setInPathRecursive(obj, path, value, 0);\n}\n\nfunction setInPathRecursive(\n obj: any,\n path: string[],\n value: any,\n index: number,\n): any {\n if (index === path.length) return value;\n\n const head = path[index];\n\n if (Array.isArray(obj)) {\n const i = parseInt(head, 10);\n if (isNaN(i) || i < 0)\n throw new Error(`[FlowProxy] Invalid array index: ${head}`);\n\n const len = obj.length;\n const newArr = new Array(Math.max(len, i + 1));\n\n // Fast copy with check for modified index\n for (let j = 0; j < newArr.length; j++) {\n if (j === i) {\n newArr[j] = setInPathRecursive(obj[j], path, value, index + 1);\n } else {\n newArr[j] = j < len ? obj[j] : undefined;\n }\n }\n return newArr;\n }\n\n // Object path\n const currentObj = obj ?? {};\n const keys = Object.keys(currentObj);\n const result: any = {};\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n result[key] =\n key === head\n ? setInPathRecursive(currentObj[key], path, value, index + 1)\n : currentObj[key];\n }\n\n if (!(head in currentObj)) {\n result[head] = setInPathRecursive(undefined, path, value, index + 1);\n }\n\n return result;\n}\n\n/**\n * Access utility to get a value at a specific path.\n */\nfunction getInPath(obj: any, path: string[]): any {\n let current = obj;\n for (let i = 0; i < path.length; i++) {\n if (current === null || current === undefined) return undefined;\n current = current[path[i]];\n }\n return current;\n}\n"],"names":["store"],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BiF;AAKjF;AACA,MAAM,SAAS,GAAG,IAAI,OAAO,EAAmC;AAEhE,SAAS,aAAa,CAAC,IAAc,EAAE,IAAY,EAAA;IACjD,IAAI,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC;IAC/B,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,KAAK,GAAG,IAAI,GAAG,EAAE;AACjB,QAAA,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC;IAC5B;IAEA,IAAI,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;IAC5B,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC;AACxB,QAAA,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC;IACzB;AACA,IAAA,OAAO,MAAM;AACf;AAEA;;;;;AAKG;AACG,SAAU,eAAe,CAC7B,GAAW,EACX,IAAc,EACd,WAAgB;AAChB,OAAyB,EAAA;;AAGzB,IAAA,MAAM,MAAM,GAAG,CACb,GAAQ,EACR,QAAiB,EAC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;"}
|
package/dist/esm/src/proxy.js
CHANGED
|
@@ -49,15 +49,11 @@ function getCachedPath(path, prop) {
|
|
|
49
49
|
*
|
|
50
50
|
* Reduced allocations, cached operations
|
|
51
51
|
*/
|
|
52
|
-
function createDeepProxy(key, path,
|
|
53
|
-
|
|
52
|
+
function createDeepProxy(key, path, _initialVal, // Kept for signature compatibility but ignored for live state
|
|
53
|
+
options) {
|
|
54
|
+
// Pre-bind commit function
|
|
54
55
|
const commit = (val, forceful, skipEquality = false, op) => {
|
|
55
56
|
try {
|
|
56
|
-
// INTERNAL OPTIMIZATION: We fetch the RAW current state from the vault
|
|
57
|
-
// without cloning it. Since we are about to produce a new IMMUTABLE state
|
|
58
|
-
// using setInPath (which does structural cloning), this is safe and
|
|
59
|
-
// avoiding a full deepClone of the entire tree on every tiny action
|
|
60
|
-
// results in 100x performance in loops.
|
|
61
57
|
const currentState = store.get(key, undefined, { bypassClone: true });
|
|
62
58
|
const newState = setInPath(currentState, path, val);
|
|
63
59
|
store.set(key, newState, {
|
|
@@ -73,7 +69,6 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
73
69
|
throw error;
|
|
74
70
|
}
|
|
75
71
|
};
|
|
76
|
-
// Pre-create update function
|
|
77
72
|
const update = (val, op) => {
|
|
78
73
|
commit(val, false, true, op);
|
|
79
74
|
};
|
|
@@ -81,7 +76,12 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
81
76
|
get(_target, prop) {
|
|
82
77
|
if (typeof prop === "symbol")
|
|
83
78
|
return undefined;
|
|
84
|
-
// ---
|
|
79
|
+
// --- LIVE DATA FETCH ---
|
|
80
|
+
// We fetch the latest root state and drill down to the current path.
|
|
81
|
+
// This ensures Proxies are always "live" even if reused across updates.
|
|
82
|
+
const rootState = store.get(key, undefined, { bypassClone: true });
|
|
83
|
+
const currentVal = path.length === 0 ? rootState : getInPath(rootState, path);
|
|
84
|
+
// --- Meta-Operations ---
|
|
85
85
|
if (prop === "_val")
|
|
86
86
|
return currentVal;
|
|
87
87
|
if (prop === "_set")
|
|
@@ -104,59 +104,29 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
104
104
|
return (store.getRedoStack(key)?.length || 0) > 0;
|
|
105
105
|
if (prop === "_history")
|
|
106
106
|
return store.getHistory(key);
|
|
107
|
-
// Handle plugin-provided operations (e.g., _persist)
|
|
108
107
|
const pluginOps = store.getPluginOps(key, options);
|
|
109
108
|
if (prop in pluginOps)
|
|
110
109
|
return pluginOps[prop];
|
|
111
|
-
// Type check once for this level
|
|
112
110
|
const valType = typeof currentVal;
|
|
113
111
|
const isArray = Array.isArray(currentVal);
|
|
114
|
-
// --- Number Operations
|
|
112
|
+
// --- Number Operations ---
|
|
115
113
|
if (valType === "number") {
|
|
116
114
|
switch (prop) {
|
|
117
115
|
case "_increment":
|
|
118
|
-
return (amount = 1) =>
|
|
119
|
-
const liveVal = path.length === 0
|
|
120
|
-
? store.get(key, undefined, { bypassClone: true })
|
|
121
|
-
: getInPath(store.get(key, undefined, { bypassClone: true }), path);
|
|
122
|
-
update(liveVal + amount, "_increment");
|
|
123
|
-
};
|
|
116
|
+
return (amount = 1) => update(currentVal + amount, "_increment");
|
|
124
117
|
case "_decrement":
|
|
125
|
-
return (amount = 1) =>
|
|
126
|
-
const liveVal = path.length === 0
|
|
127
|
-
? store.get(key, undefined, { bypassClone: true })
|
|
128
|
-
: getInPath(store.get(key, undefined, { bypassClone: true }), path);
|
|
129
|
-
update(liveVal - amount, "_decrement");
|
|
130
|
-
};
|
|
118
|
+
return (amount = 1) => update(currentVal - amount, "_decrement");
|
|
131
119
|
case "_add":
|
|
132
|
-
return (amount) =>
|
|
133
|
-
const liveVal = path.length === 0
|
|
134
|
-
? store.get(key, undefined, { bypassClone: true })
|
|
135
|
-
: getInPath(store.get(key, undefined, { bypassClone: true }), path);
|
|
136
|
-
update(liveVal + amount, "_add");
|
|
137
|
-
};
|
|
120
|
+
return (amount) => update(currentVal + amount, "_add");
|
|
138
121
|
case "_subtract":
|
|
139
|
-
return (amount) =>
|
|
140
|
-
const liveVal = path.length === 0
|
|
141
|
-
? store.get(key, undefined, { bypassClone: true })
|
|
142
|
-
: getInPath(store.get(key, undefined, { bypassClone: true }), path);
|
|
143
|
-
update(liveVal - amount, "_subtract");
|
|
144
|
-
};
|
|
122
|
+
return (amount) => update(currentVal - amount, "_subtract");
|
|
145
123
|
case "_multiply":
|
|
146
|
-
return (amount) =>
|
|
147
|
-
const liveVal = path.length === 0
|
|
148
|
-
? store.get(key, undefined, { bypassClone: true })
|
|
149
|
-
: getInPath(store.get(key, undefined, { bypassClone: true }), path);
|
|
150
|
-
update(liveVal * amount, "_multiply");
|
|
151
|
-
};
|
|
124
|
+
return (amount) => update(currentVal * amount, "_multiply");
|
|
152
125
|
case "_divide":
|
|
153
126
|
return (amount) => {
|
|
154
127
|
if (amount === 0)
|
|
155
128
|
throw new Error("[FlowProxy] Division by zero");
|
|
156
|
-
|
|
157
|
-
? store.get(key, undefined, { bypassClone: true })
|
|
158
|
-
: getInPath(store.get(key, undefined, { bypassClone: true }), path);
|
|
159
|
-
update(liveVal / amount, "_divide");
|
|
129
|
+
update(currentVal / amount, "_divide");
|
|
160
130
|
};
|
|
161
131
|
case "_pow":
|
|
162
132
|
return (n) => update(Math.pow(currentVal, n), "_pow");
|
|
@@ -180,12 +150,11 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
180
150
|
return (p) => update(parseFloat(currentVal.toPrecision(p)), "_toPrecision");
|
|
181
151
|
}
|
|
182
152
|
}
|
|
183
|
-
// --- Array Operations
|
|
153
|
+
// --- Array Operations ---
|
|
184
154
|
if (isArray) {
|
|
185
155
|
switch (prop) {
|
|
186
156
|
case "_push":
|
|
187
157
|
return (item) => {
|
|
188
|
-
// Manual copy instead of spread for large arrays
|
|
189
158
|
const len = currentVal.length;
|
|
190
159
|
const newArr = new Array(len + 1);
|
|
191
160
|
for (let i = 0; i < len; i++)
|
|
@@ -199,7 +168,6 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
199
168
|
return () => update(currentVal.slice(1), "_shift");
|
|
200
169
|
case "_unshift":
|
|
201
170
|
return (item) => {
|
|
202
|
-
// Manual copy for better performance
|
|
203
171
|
const len = currentVal.length;
|
|
204
172
|
const newArr = new Array(len + 1);
|
|
205
173
|
newArr[0] = item;
|
|
@@ -213,7 +181,6 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
213
181
|
return (fn) => update(currentVal.map(fn), "_map");
|
|
214
182
|
case "_removeAt":
|
|
215
183
|
return (index) => {
|
|
216
|
-
// Manual filter for single index
|
|
217
184
|
const len = currentVal.length;
|
|
218
185
|
const newArr = new Array(len - 1);
|
|
219
186
|
let j = 0;
|
|
@@ -234,7 +201,6 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
234
201
|
newArr[i + 1] = currentVal[i];
|
|
235
202
|
update(newArr, "_insertAt");
|
|
236
203
|
};
|
|
237
|
-
// --- New Ops (v4.8.0) ---
|
|
238
204
|
case "_splice":
|
|
239
205
|
return (s, d, ...items) => {
|
|
240
206
|
const next = [...currentVal];
|
|
@@ -264,7 +230,6 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
264
230
|
}
|
|
265
231
|
update(next, "_shuffle");
|
|
266
232
|
};
|
|
267
|
-
// Traversers that return a proxy to an item
|
|
268
233
|
case "_at":
|
|
269
234
|
return (i) => {
|
|
270
235
|
const idx = i < 0 ? currentVal.length + i : i;
|
|
@@ -296,7 +261,6 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
296
261
|
return () => update(currentVal.toLowerCase(), "_lowercase");
|
|
297
262
|
case "_trim":
|
|
298
263
|
return () => update(currentVal.trim(), "_trim");
|
|
299
|
-
// --- New Ops (v4.8.0) ---
|
|
300
264
|
case "_replace":
|
|
301
265
|
return (p, r) => update(currentVal.replace(p, r), "_replace");
|
|
302
266
|
case "_replaceAll":
|
|
@@ -329,14 +293,12 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
329
293
|
if (currentVal !== null && valType === "object" && !isArray) {
|
|
330
294
|
if (prop === "_merge") {
|
|
331
295
|
return (obj) => {
|
|
332
|
-
// Object.assign faster than spread for merge
|
|
333
296
|
const merged = Object.assign({}, currentVal, obj);
|
|
334
297
|
update(merged, "_merge");
|
|
335
298
|
};
|
|
336
299
|
}
|
|
337
300
|
if (prop === "_delete") {
|
|
338
301
|
return (keyToDel) => {
|
|
339
|
-
// Only copy if key exists
|
|
340
302
|
if (!(keyToDel in currentVal))
|
|
341
303
|
return;
|
|
342
304
|
const keys = Object.keys(currentVal);
|
|
@@ -348,7 +310,6 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
348
310
|
update(next, "_delete");
|
|
349
311
|
};
|
|
350
312
|
}
|
|
351
|
-
// --- New Ops (v4.8.0) ---
|
|
352
313
|
if (prop === "_pick") {
|
|
353
314
|
return (keys) => {
|
|
354
315
|
const next = {};
|
|
@@ -384,7 +345,6 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
384
345
|
}
|
|
385
346
|
}
|
|
386
347
|
// Recursive step: create a new proxy for the child property
|
|
387
|
-
// Use cached path
|
|
388
348
|
const nextVal = currentVal !== null && currentVal !== undefined
|
|
389
349
|
? currentVal[prop]
|
|
390
350
|
: undefined;
|
|
@@ -392,6 +352,9 @@ function createDeepProxy(key, path, currentVal, options) {
|
|
|
392
352
|
return createDeepProxy(key, newPath, nextVal, options);
|
|
393
353
|
},
|
|
394
354
|
apply(_target, _thisArg, args) {
|
|
355
|
+
// Re-fetch current value for apply trap too
|
|
356
|
+
const rootState = store.get(key, undefined, { bypassClone: true });
|
|
357
|
+
const currentVal = path.length === 0 ? rootState : getInPath(rootState, path);
|
|
395
358
|
if (typeof currentVal === "function") {
|
|
396
359
|
return currentVal(...args);
|
|
397
360
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sources":["../../../src/proxy.ts"],"sourcesContent":["/* *****************************************************************************\n * FractoSate\n *\n * ACCESS RESTRICTIONS:\n * - This software is exclusively for use by Authorized Personnel of NEHONIX\n * - Intended for Internal Use only within NEHONIX operations\n * - No rights granted to unauthorized individuals or entities\n * - All modifications are works made for hire assigned to NEHONIX\n *\n * PROHIBITED ACTIVITIES:\n * - Copying, distributing, or sublicensing without written permission\n * - Reverse engineering, decompiling, or disassembling\n * - Creating derivative works without explicit authorization\n * - External use or commercial distribution outside NEHONIX\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n * For questions or permissions, contact:\n * NEHONIX Legal Department\n * Email: legal@nehonix.com\n * Website: www.nehonix.com\n ***************************************************************************** */\n\nimport type { FlowOptions, TypeAwareOps } from \"./types\";\nimport { store } from \"./store\";\n\n// Path cache to avoid repeated array allocations\nconst pathCache = new WeakMap<string[], Map<string, string[]>>();\n\nfunction getCachedPath(path: string[], prop: string): string[] {\n let cache = pathCache.get(path);\n if (!cache) {\n cache = new Map();\n pathCache.set(path, cache);\n }\n\n let cached = cache.get(prop);\n if (!cached) {\n cached = [...path, prop];\n cache.set(prop, cached);\n }\n return cached;\n}\n\n/**\n * Creates a deep proxy that provides type-specific atomic operations for a flow.\n * The proxy tracks its path within the state tree and maps access to specific update logic.\n *\n * Reduced allocations, cached operations\n */\nexport function createDeepProxy<T = any, A = Record<string, any>>(\n key: string,\n path: string[],\n currentVal: any,\n options: FlowOptions<any>,\n): TypeAwareOps<T, A> {\n // Pre-bind commit function to avoid recreation\n const commit = (\n val: any,\n forceful: boolean,\n skipEquality = false,\n op?: string,\n ) => {\n try {\n // INTERNAL OPTIMIZATION: We fetch the RAW current state from the vault\n // without cloning it. Since we are about to produce a new IMMUTABLE state\n // using setInPath (which does structural cloning), this is safe and\n // avoiding a full deepClone of the entire tree on every tiny action\n // results in 100x performance in loops.\n const currentState = store.get(key, undefined, { bypassClone: true });\n const newState = setInPath(currentState, path, val);\n store.set(key, newState, {\n ...options,\n force: forceful,\n skipEquality,\n _op: op || (options as any)._op || \"set\",\n _path: path,\n } as any);\n } catch (error) {\n console.error(\n `[FlowProxy] Commit error at path ${path.join(\".\")}:`,\n error,\n );\n throw error;\n }\n };\n\n // Pre-create update function\n const update = (val: any, op?: string) => {\n commit(val, false, true, op);\n };\n\n return new Proxy(() => {}, {\n get(_target: any, prop: any) {\n if (typeof prop === \"symbol\") return undefined;\n\n // --- Meta-Operations (Fast path) ---\n if (prop === \"_val\") return currentVal;\n if (prop === \"_set\")\n return (val: any) => {\n commit(val, true, false, \"_set\");\n };\n if (prop === \"_patch\")\n return (val: any) => {\n commit(val, false, false, \"_patch\");\n };\n if (prop === \"__actions__\") return (options as any).actions;\n if (prop === \"_undo\") return () => store.undo(key);\n if (prop === \"_redo\") return () => store.redo(key);\n if (prop === \"_canUndo\") return (store.getHistory(key)?.length || 0) > 1;\n if (prop === \"_canRedo\")\n return (store.getRedoStack(key)?.length || 0) > 0;\n if (prop === \"_history\") return store.getHistory(key);\n\n // Handle plugin-provided operations (e.g., _persist)\n const pluginOps = store.getPluginOps(key, options);\n if (prop in pluginOps) return pluginOps[prop];\n\n // Type check once for this level\n const valType = typeof currentVal;\n const isArray = Array.isArray(currentVal);\n\n // --- Number Operations (Optimized with cached functions) ---\n if (valType === \"number\") {\n switch (prop) {\n case \"_increment\":\n return (amount = 1) => {\n const liveVal =\n path.length === 0\n ? store.get(key, undefined, { bypassClone: true })\n : getInPath(\n store.get(key, undefined, { bypassClone: true }),\n path,\n );\n update(liveVal + amount, \"_increment\");\n };\n case \"_decrement\":\n return (amount = 1) => {\n const liveVal =\n path.length === 0\n ? store.get(key, undefined, { bypassClone: true })\n : getInPath(\n store.get(key, undefined, { bypassClone: true }),\n path,\n );\n update(liveVal - amount, \"_decrement\");\n };\n case \"_add\":\n return (amount: number) => {\n const liveVal =\n path.length === 0\n ? store.get(key, undefined, { bypassClone: true })\n : getInPath(\n store.get(key, undefined, { bypassClone: true }),\n path,\n );\n update(liveVal + amount, \"_add\");\n };\n case \"_subtract\":\n return (amount: number) => {\n const liveVal =\n path.length === 0\n ? store.get(key, undefined, { bypassClone: true })\n : getInPath(\n store.get(key, undefined, { bypassClone: true }),\n path,\n );\n update(liveVal - amount, \"_subtract\");\n };\n case \"_multiply\":\n return (amount: number) => {\n const liveVal =\n path.length === 0\n ? store.get(key, undefined, { bypassClone: true })\n : getInPath(\n store.get(key, undefined, { bypassClone: true }),\n path,\n );\n update(liveVal * amount, \"_multiply\");\n };\n case \"_divide\":\n return (amount: number) => {\n if (amount === 0) throw new Error(\"[FlowProxy] Division by zero\");\n const liveVal =\n path.length === 0\n ? store.get(key, undefined, { bypassClone: true })\n : getInPath(\n store.get(key, undefined, { bypassClone: true }),\n path,\n );\n update(liveVal / amount, \"_divide\");\n };\n case \"_pow\":\n return (n: number) => update(Math.pow(currentVal, n), \"_pow\");\n case \"_sqrt\":\n return () => update(Math.sqrt(currentVal), \"_sqrt\");\n case \"_abs\":\n return () => update(Math.abs(currentVal), \"_abs\");\n case \"_round\":\n return () => update(Math.round(currentVal), \"_round\");\n case \"_floor\":\n return () => update(Math.floor(currentVal), \"_floor\");\n case \"_ceil\":\n return () => update(Math.ceil(currentVal), \"_ceil\");\n case \"_mod\":\n return (n: number) => update(currentVal % n, \"_mod\");\n case \"_clamp\":\n return (min: number, max: number) =>\n update(Math.min(Math.max(currentVal, min), max), \"_clamp\");\n case \"_negate\":\n return () => update(-currentVal, \"_negate\");\n case \"_toPrecision\":\n return (p: number) =>\n update(parseFloat(currentVal.toPrecision(p)), \"_toPrecision\");\n }\n }\n\n // --- Array Operations (Optimized with minimal allocations) ---\n if (isArray) {\n switch (prop) {\n case \"_push\":\n return (item: any) => {\n // Manual copy instead of spread for large arrays\n const len = currentVal.length;\n const newArr = new Array(len + 1);\n for (let i = 0; i < len; i++) newArr[i] = currentVal[i];\n newArr[len] = item;\n update(newArr, \"_push\");\n };\n case \"_pop\":\n return () => update(currentVal.slice(0, -1), \"_pop\");\n case \"_shift\":\n return () => update(currentVal.slice(1), \"_shift\");\n case \"_unshift\":\n return (item: any) => {\n // Manual copy for better performance\n const len = currentVal.length;\n const newArr = new Array(len + 1);\n newArr[0] = item;\n for (let i = 0; i < len; i++) newArr[i + 1] = currentVal[i];\n update(newArr, \"_unshift\");\n };\n case \"_filter\":\n return (fn: any) => update(currentVal.filter(fn), \"_filter\");\n case \"_map\":\n return (fn: any) => update(currentVal.map(fn), \"_map\");\n case \"_removeAt\":\n return (index: number) => {\n // Manual filter for single index\n const len = currentVal.length;\n const newArr = new Array(len - 1);\n let j = 0;\n for (let i = 0; i < len; i++) {\n if (i !== index) newArr[j++] = currentVal[i];\n }\n update(newArr, \"_removeAt\");\n };\n case \"_insertAt\":\n return (index: number, item: any) => {\n const len = currentVal.length;\n const newArr = new Array(len + 1);\n for (let i = 0; i < index; i++) newArr[i] = currentVal[i];\n newArr[index] = item;\n for (let i = index; i < len; i++) newArr[i + 1] = currentVal[i];\n update(newArr, \"_insertAt\");\n };\n // --- New Ops (v4.8.0) ---\n case \"_splice\":\n return (s: number, d: number, ...items: any[]) => {\n const next = [...currentVal];\n next.splice(s, d, ...items);\n update(next, \"_splice\");\n };\n case \"_reverse\":\n return () => update([...currentVal].reverse(), \"_reverse\");\n case \"_sort\":\n return (fn: any) => update([...currentVal].sort(fn), \"_sort\");\n case \"_fill\":\n return (v: any, s?: number, e?: number) => {\n const next = [...currentVal];\n next.fill(v, s, e);\n update(next, \"_fill\");\n };\n case \"_concat\":\n return (other: any[]) =>\n update(currentVal.concat(other), \"_concat\");\n case \"_uniq\":\n return () => update(Array.from(new Set(currentVal)), \"_uniq\");\n case \"_shuffle\":\n return () => {\n const next = [...currentVal];\n for (let i = next.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [next[i], next[j]] = [next[j], next[i]];\n }\n update(next, \"_shuffle\");\n };\n // Traversers that return a proxy to an item\n case \"_at\":\n return (i: number) => {\n const idx = i < 0 ? currentVal.length + i : i;\n return createDeepProxy(\n key,\n getCachedPath(path, idx.toString()),\n currentVal[idx],\n options,\n );\n };\n case \"_first\":\n return () =>\n createDeepProxy(\n key,\n getCachedPath(path, \"0\"),\n currentVal[0],\n options,\n );\n case \"_last\":\n return () =>\n createDeepProxy(\n key,\n getCachedPath(path, (currentVal.length - 1).toString()),\n currentVal[currentVal.length - 1],\n options,\n );\n case \"_findBy\":\n return (fn: (item: any, idx: number) => boolean) => {\n const idx = currentVal.findIndex(fn);\n if (idx === -1) return undefined;\n return createDeepProxy(\n key,\n getCachedPath(path, idx.toString()),\n currentVal[idx],\n options,\n );\n };\n }\n }\n\n // --- String Operations ---\n if (valType === \"string\") {\n switch (prop) {\n case \"_append\":\n return (str: string) => update(currentVal + str, \"_append\");\n case \"_prepend\":\n return (str: string) => update(str + currentVal, \"_prepend\");\n case \"_uppercase\":\n return () => update(currentVal.toUpperCase(), \"_uppercase\");\n case \"_lowercase\":\n return () => update(currentVal.toLowerCase(), \"_lowercase\");\n case \"_trim\":\n return () => update(currentVal.trim(), \"_trim\");\n // --- New Ops (v4.8.0) ---\n case \"_replace\":\n return (p: string | RegExp, r: string) =>\n update(currentVal.replace(p, r), \"_replace\");\n case \"_replaceAll\":\n return (p: string | RegExp, r: string) =>\n update(currentVal.replaceAll(p, r), \"_replaceAll\");\n case \"_substring\":\n return (s: number, e?: number) =>\n update(currentVal.substring(s, e), \"_substring\");\n case \"_slice\":\n return (s: number, e?: number) =>\n update(currentVal.slice(s, e), \"_slice\");\n case \"_capitalize\":\n return () =>\n update(\n currentVal.charAt(0).toUpperCase() + currentVal.slice(1),\n \"_capitalize\",\n );\n case \"_truncate\":\n return (l: number, s = \"...\") =>\n update(\n currentVal.length > l\n ? currentVal.substring(0, l) + s\n : currentVal,\n \"_truncate\",\n );\n case \"_padEnd\":\n return (l: number, f?: string) =>\n update(currentVal.padEnd(l, f), \"_padEnd\");\n case \"_padStart\":\n return (l: number, f?: string) =>\n update(currentVal.padStart(l, f), \"_padStart\");\n case \"_repeat\":\n return (c: number) => update(currentVal.repeat(c), \"_repeat\");\n }\n }\n\n // --- Boolean Operations ---\n if (valType === \"boolean\") {\n if (prop === \"_toggle\") {\n return () => update(!currentVal, \"_toggle\");\n }\n }\n\n // --- Object Operations ---\n if (currentVal !== null && valType === \"object\" && !isArray) {\n if (prop === \"_merge\") {\n return (obj: any) => {\n // Object.assign faster than spread for merge\n const merged = Object.assign({}, currentVal, obj);\n update(merged, \"_merge\");\n };\n }\n if (prop === \"_delete\") {\n return (keyToDel: string) => {\n // Only copy if key exists\n if (!(keyToDel in currentVal)) return;\n const keys = Object.keys(currentVal);\n const next: any = {};\n for (const k of keys) {\n if (k !== keyToDel) next[k] = currentVal[k];\n }\n update(next, \"_delete\");\n };\n }\n // --- New Ops (v4.8.0) ---\n if (prop === \"_pick\") {\n return (keys: string[]) => {\n const next: any = {};\n keys.forEach((k) => {\n if (k in currentVal) next[k] = currentVal[k];\n });\n update(next, \"_pick\");\n };\n }\n if (prop === \"_omit\") {\n return (keys: string[]) => {\n const next = { ...currentVal };\n keys.forEach((k) => delete next[k]);\n update(next, \"_omit\");\n };\n }\n if (prop === \"_defaults\") {\n return (d: any) => update({ ...d, ...currentVal }, \"_defaults\");\n }\n if (prop === \"_clear\") return () => update({}, \"_clear\");\n if (prop === \"_clone\") return () => update({ ...currentVal }, \"_clone\");\n if (prop === \"_assign\")\n return (s: any) => update({ ...currentVal, ...s }, \"_assign\");\n if (prop === \"_mapValues\") {\n return (fn: any) => {\n const next: any = {};\n Object.keys(currentVal).forEach(\n (k) => (next[k] = fn(currentVal[k], k)),\n );\n update(next, \"_mapValues\");\n };\n }\n }\n\n // Recursive step: create a new proxy for the child property\n // Use cached path\n const nextVal =\n currentVal !== null && currentVal !== undefined\n ? currentVal[prop]\n : undefined;\n const newPath = getCachedPath(path, prop);\n return createDeepProxy(key, newPath, nextVal, options);\n },\n apply(_target, _thisArg, args) {\n if (typeof currentVal === \"function\") {\n return currentVal(...args);\n }\n console.warn(\n `[FlowProxy] Attempted to call a non-function value at path: ${path.join(\".\")}`,\n );\n },\n }) as unknown as TypeAwareOps<T, A>;\n}\n\n/**\n * Immutable update utility that sets a value at a specific path within an object/array.\n */\nexport function setInPath(obj: any, path: string[], value: any): any {\n return setInPathRecursive(obj, path, value, 0);\n}\n\nfunction setInPathRecursive(\n obj: any,\n path: string[],\n value: any,\n index: number,\n): any {\n if (index === path.length) return value;\n\n const head = path[index];\n\n if (Array.isArray(obj)) {\n const i = parseInt(head, 10);\n if (isNaN(i) || i < 0)\n throw new Error(`[FlowProxy] Invalid array index: ${head}`);\n\n const len = obj.length;\n const newArr = new Array(Math.max(len, i + 1));\n\n // Fast copy with check for modified index\n for (let j = 0; j < newArr.length; j++) {\n if (j === i) {\n newArr[j] = setInPathRecursive(obj[j], path, value, index + 1);\n } else {\n newArr[j] = j < len ? obj[j] : undefined;\n }\n }\n return newArr;\n }\n\n // Object path\n const currentObj = obj ?? {};\n const keys = Object.keys(currentObj);\n const result: any = {};\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n result[key] =\n key === head\n ? setInPathRecursive(currentObj[key], path, value, index + 1)\n : currentObj[key];\n }\n\n if (!(head in currentObj)) {\n result[head] = setInPathRecursive(undefined, path, value, index + 1);\n }\n\n return result;\n}\n\n/**\n * Access utility to get a value at a specific path.\n */\nfunction getInPath(obj: any, path: string[]): any {\n let current = obj;\n for (let i = 0; i < path.length; i++) {\n if (current === null || current === undefined) return undefined;\n current = current[path[i]];\n }\n return current;\n}\n"],"names":[],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AAI,CAAC,CAAC,CAAC;QACnB,MAAM,CAAC,GAAG,CAAC;AACT,YAAA,GAAG,KAAK;AACN,kBAAE,kBAAkB,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC;AAC5D,kBAAE,UAAU,CAAC,GAAG,CAAC;IACvB;AAEA,IAAA,IAAI,EAAE,IAAI,IAAI,UAAU,CAAC,EAAE;AACzB,QAAA,MAAM,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC;IACtE;AAEA,IAAA,OAAO,MAAM;AACf;AAEA;;AAEG;AACH,SAAS,SAAS,CAAC,GAAQ,EAAE,IAAc,EAAA;IACzC,IAAI,OAAO,GAAG,GAAG;AACjB,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACpC,QAAA,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS;AAAE,YAAA,OAAO,SAAS;QAC/D,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5B;AACA,IAAA,OAAO,OAAO;AAChB;;;;"}
|
|
1
|
+
{"version":3,"file":"proxy.js","sources":["../../../src/proxy.ts"],"sourcesContent":["/* *****************************************************************************\n * FractoSate\n *\n * ACCESS RESTRICTIONS:\n * - This software is exclusively for use by Authorized Personnel of NEHONIX\n * - Intended for Internal Use only within NEHONIX operations\n * - No rights granted to unauthorized individuals or entities\n * - All modifications are works made for hire assigned to NEHONIX\n *\n * PROHIBITED ACTIVITIES:\n * - Copying, distributing, or sublicensing without written permission\n * - Reverse engineering, decompiling, or disassembling\n * - Creating derivative works without explicit authorization\n * - External use or commercial distribution outside NEHONIX\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n * For questions or permissions, contact:\n * NEHONIX Legal Department\n * Email: legal@nehonix.com\n * Website: www.nehonix.com\n ***************************************************************************** */\n\nimport type { FlowOptions, TypeAwareOps } from \"./types\";\nimport { store } from \"./store\";\n\n// Path cache to avoid repeated array allocations\nconst pathCache = new WeakMap<string[], Map<string, string[]>>();\n\nfunction getCachedPath(path: string[], prop: string): string[] {\n let cache = pathCache.get(path);\n if (!cache) {\n cache = new Map();\n pathCache.set(path, cache);\n }\n\n let cached = cache.get(prop);\n if (!cached) {\n cached = [...path, prop];\n cache.set(prop, cached);\n }\n return cached;\n}\n\n/**\n * Creates a deep proxy that provides type-specific atomic operations for a flow.\n * The proxy tracks its path within the state tree and maps access to specific update logic.\n *\n * Reduced allocations, cached operations\n */\nexport function createDeepProxy<T = any, A = Record<string, any>>(\n key: string,\n path: string[],\n _initialVal: any, // Kept for signature compatibility but ignored for live state\n options: FlowOptions<any>,\n): TypeAwareOps<T, A> {\n // Pre-bind commit function\n const commit = (\n val: any,\n forceful: boolean,\n skipEquality = false,\n op?: string,\n ) => {\n try {\n const currentState = store.get(key, undefined, { bypassClone: true });\n const newState = setInPath(currentState, path, val);\n store.set(key, newState, {\n ...options,\n force: forceful,\n skipEquality,\n _op: op || (options as any)._op || \"set\",\n _path: path,\n } as any);\n } catch (error) {\n console.error(\n `[FlowProxy] Commit error at path ${path.join(\".\")}:`,\n error,\n );\n throw error;\n }\n };\n\n const update = (val: any, op?: string) => {\n commit(val, false, true, op);\n };\n\n return new Proxy(() => {}, {\n get(_target: any, prop: any) {\n if (typeof prop === \"symbol\") return undefined;\n\n // --- LIVE DATA FETCH ---\n // We fetch the latest root state and drill down to the current path.\n // This ensures Proxies are always \"live\" even if reused across updates.\n const rootState = store.get(key, undefined, { bypassClone: true });\n const currentVal =\n path.length === 0 ? rootState : getInPath(rootState, path);\n\n // --- Meta-Operations ---\n if (prop === \"_val\") return currentVal;\n if (prop === \"_set\")\n return (val: any) => {\n commit(val, true, false, \"_set\");\n };\n if (prop === \"_patch\")\n return (val: any) => {\n commit(val, false, false, \"_patch\");\n };\n if (prop === \"__actions__\") return (options as any).actions;\n if (prop === \"_undo\") return () => store.undo(key);\n if (prop === \"_redo\") return () => store.redo(key);\n if (prop === \"_canUndo\") return (store.getHistory(key)?.length || 0) > 1;\n if (prop === \"_canRedo\")\n return (store.getRedoStack(key)?.length || 0) > 0;\n if (prop === \"_history\") return store.getHistory(key);\n\n const pluginOps = store.getPluginOps(key, options);\n if (prop in pluginOps) return pluginOps[prop];\n\n const valType = typeof currentVal;\n const isArray = Array.isArray(currentVal);\n\n // --- Number Operations ---\n if (valType === \"number\") {\n switch (prop) {\n case \"_increment\":\n return (amount = 1) => update(currentVal + amount, \"_increment\");\n case \"_decrement\":\n return (amount = 1) => update(currentVal - amount, \"_decrement\");\n case \"_add\":\n return (amount: number) => update(currentVal + amount, \"_add\");\n case \"_subtract\":\n return (amount: number) => update(currentVal - amount, \"_subtract\");\n case \"_multiply\":\n return (amount: number) => update(currentVal * amount, \"_multiply\");\n case \"_divide\":\n return (amount: number) => {\n if (amount === 0) throw new Error(\"[FlowProxy] Division by zero\");\n update(currentVal / amount, \"_divide\");\n };\n case \"_pow\":\n return (n: number) => update(Math.pow(currentVal, n), \"_pow\");\n case \"_sqrt\":\n return () => update(Math.sqrt(currentVal), \"_sqrt\");\n case \"_abs\":\n return () => update(Math.abs(currentVal), \"_abs\");\n case \"_round\":\n return () => update(Math.round(currentVal), \"_round\");\n case \"_floor\":\n return () => update(Math.floor(currentVal), \"_floor\");\n case \"_ceil\":\n return () => update(Math.ceil(currentVal), \"_ceil\");\n case \"_mod\":\n return (n: number) => update(currentVal % n, \"_mod\");\n case \"_clamp\":\n return (min: number, max: number) =>\n update(Math.min(Math.max(currentVal, min), max), \"_clamp\");\n case \"_negate\":\n return () => update(-currentVal, \"_negate\");\n case \"_toPrecision\":\n return (p: number) =>\n update(parseFloat(currentVal.toPrecision(p)), \"_toPrecision\");\n }\n }\n\n // --- Array Operations ---\n if (isArray) {\n switch (prop) {\n case \"_push\":\n return (item: any) => {\n const len = currentVal.length;\n const newArr = new Array(len + 1);\n for (let i = 0; i < len; i++) newArr[i] = currentVal[i];\n newArr[len] = item;\n update(newArr, \"_push\");\n };\n case \"_pop\":\n return () => update(currentVal.slice(0, -1), \"_pop\");\n case \"_shift\":\n return () => update(currentVal.slice(1), \"_shift\");\n case \"_unshift\":\n return (item: any) => {\n const len = currentVal.length;\n const newArr = new Array(len + 1);\n newArr[0] = item;\n for (let i = 0; i < len; i++) newArr[i + 1] = currentVal[i];\n update(newArr, \"_unshift\");\n };\n case \"_filter\":\n return (fn: any) => update(currentVal.filter(fn), \"_filter\");\n case \"_map\":\n return (fn: any) => update(currentVal.map(fn), \"_map\");\n case \"_removeAt\":\n return (index: number) => {\n const len = currentVal.length;\n const newArr = new Array(len - 1);\n let j = 0;\n for (let i = 0; i < len; i++) {\n if (i !== index) newArr[j++] = currentVal[i];\n }\n update(newArr, \"_removeAt\");\n };\n case \"_insertAt\":\n return (index: number, item: any) => {\n const len = currentVal.length;\n const newArr = new Array(len + 1);\n for (let i = 0; i < index; i++) newArr[i] = currentVal[i];\n newArr[index] = item;\n for (let i = index; i < len; i++) newArr[i + 1] = currentVal[i];\n update(newArr, \"_insertAt\");\n };\n case \"_splice\":\n return (s: number, d: number, ...items: any[]) => {\n const next = [...currentVal];\n next.splice(s, d, ...items);\n update(next, \"_splice\");\n };\n case \"_reverse\":\n return () => update([...currentVal].reverse(), \"_reverse\");\n case \"_sort\":\n return (fn: any) => update([...currentVal].sort(fn), \"_sort\");\n case \"_fill\":\n return (v: any, s?: number, e?: number) => {\n const next = [...currentVal];\n next.fill(v, s, e);\n update(next, \"_fill\");\n };\n case \"_concat\":\n return (other: any[]) =>\n update(currentVal.concat(other), \"_concat\");\n case \"_uniq\":\n return () => update(Array.from(new Set(currentVal)), \"_uniq\");\n case \"_shuffle\":\n return () => {\n const next = [...currentVal];\n for (let i = next.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [next[i], next[j]] = [next[j], next[i]];\n }\n update(next, \"_shuffle\");\n };\n case \"_at\":\n return (i: number) => {\n const idx = i < 0 ? currentVal.length + i : i;\n return createDeepProxy(\n key,\n getCachedPath(path, idx.toString()),\n currentVal[idx],\n options,\n );\n };\n case \"_first\":\n return () =>\n createDeepProxy(\n key,\n getCachedPath(path, \"0\"),\n currentVal[0],\n options,\n );\n case \"_last\":\n return () =>\n createDeepProxy(\n key,\n getCachedPath(path, (currentVal.length - 1).toString()),\n currentVal[currentVal.length - 1],\n options,\n );\n case \"_findBy\":\n return (fn: (item: any, idx: number) => boolean) => {\n const idx = currentVal.findIndex(fn);\n if (idx === -1) return undefined;\n return createDeepProxy(\n key,\n getCachedPath(path, idx.toString()),\n currentVal[idx],\n options,\n );\n };\n }\n }\n\n // --- String Operations ---\n if (valType === \"string\") {\n switch (prop) {\n case \"_append\":\n return (str: string) => update(currentVal + str, \"_append\");\n case \"_prepend\":\n return (str: string) => update(str + currentVal, \"_prepend\");\n case \"_uppercase\":\n return () => update(currentVal.toUpperCase(), \"_uppercase\");\n case \"_lowercase\":\n return () => update(currentVal.toLowerCase(), \"_lowercase\");\n case \"_trim\":\n return () => update(currentVal.trim(), \"_trim\");\n case \"_replace\":\n return (p: string | RegExp, r: string) =>\n update(currentVal.replace(p, r), \"_replace\");\n case \"_replaceAll\":\n return (p: string | RegExp, r: string) =>\n update(currentVal.replaceAll(p, r), \"_replaceAll\");\n case \"_substring\":\n return (s: number, e?: number) =>\n update(currentVal.substring(s, e), \"_substring\");\n case \"_slice\":\n return (s: number, e?: number) =>\n update(currentVal.slice(s, e), \"_slice\");\n case \"_capitalize\":\n return () =>\n update(\n currentVal.charAt(0).toUpperCase() + currentVal.slice(1),\n \"_capitalize\",\n );\n case \"_truncate\":\n return (l: number, s = \"...\") =>\n update(\n currentVal.length > l\n ? currentVal.substring(0, l) + s\n : currentVal,\n \"_truncate\",\n );\n case \"_padEnd\":\n return (l: number, f?: string) =>\n update(currentVal.padEnd(l, f), \"_padEnd\");\n case \"_padStart\":\n return (l: number, f?: string) =>\n update(currentVal.padStart(l, f), \"_padStart\");\n case \"_repeat\":\n return (c: number) => update(currentVal.repeat(c), \"_repeat\");\n }\n }\n\n // --- Boolean Operations ---\n if (valType === \"boolean\") {\n if (prop === \"_toggle\") {\n return () => update(!currentVal, \"_toggle\");\n }\n }\n\n // --- Object Operations ---\n if (currentVal !== null && valType === \"object\" && !isArray) {\n if (prop === \"_merge\") {\n return (obj: any) => {\n const merged = Object.assign({}, currentVal, obj);\n update(merged, \"_merge\");\n };\n }\n if (prop === \"_delete\") {\n return (keyToDel: string) => {\n if (!(keyToDel in currentVal)) return;\n const keys = Object.keys(currentVal);\n const next: any = {};\n for (const k of keys) {\n if (k !== keyToDel) next[k] = currentVal[k];\n }\n update(next, \"_delete\");\n };\n }\n if (prop === \"_pick\") {\n return (keys: string[]) => {\n const next: any = {};\n keys.forEach((k) => {\n if (k in currentVal) next[k] = currentVal[k];\n });\n update(next, \"_pick\");\n };\n }\n if (prop === \"_omit\") {\n return (keys: string[]) => {\n const next = { ...currentVal };\n keys.forEach((k) => delete next[k]);\n update(next, \"_omit\");\n };\n }\n if (prop === \"_defaults\") {\n return (d: any) => update({ ...d, ...currentVal }, \"_defaults\");\n }\n if (prop === \"_clear\") return () => update({}, \"_clear\");\n if (prop === \"_clone\") return () => update({ ...currentVal }, \"_clone\");\n if (prop === \"_assign\")\n return (s: any) => update({ ...currentVal, ...s }, \"_assign\");\n if (prop === \"_mapValues\") {\n return (fn: any) => {\n const next: any = {};\n Object.keys(currentVal).forEach(\n (k) => (next[k] = fn(currentVal[k], k)),\n );\n update(next, \"_mapValues\");\n };\n }\n }\n\n // Recursive step: create a new proxy for the child property\n const nextVal =\n currentVal !== null && currentVal !== undefined\n ? currentVal[prop]\n : undefined;\n const newPath = getCachedPath(path, prop);\n return createDeepProxy(key, newPath, nextVal, options);\n },\n apply(_target, _thisArg, args) {\n // Re-fetch current value for apply trap too\n const rootState = store.get(key, undefined, { bypassClone: true });\n const currentVal =\n path.length === 0 ? rootState : getInPath(rootState, path);\n\n if (typeof currentVal === \"function\") {\n return currentVal(...args);\n }\n console.warn(\n `[FlowProxy] Attempted to call a non-function value at path: ${path.join(\".\")}`,\n );\n },\n }) as unknown as TypeAwareOps<T, A>;\n}\n\n/**\n * Immutable update utility that sets a value at a specific path within an object/array.\n */\nexport function setInPath(obj: any, path: string[], value: any): any {\n return setInPathRecursive(obj, path, value, 0);\n}\n\nfunction setInPathRecursive(\n obj: any,\n path: string[],\n value: any,\n index: number,\n): any {\n if (index === path.length) return value;\n\n const head = path[index];\n\n if (Array.isArray(obj)) {\n const i = parseInt(head, 10);\n if (isNaN(i) || i < 0)\n throw new Error(`[FlowProxy] Invalid array index: ${head}`);\n\n const len = obj.length;\n const newArr = new Array(Math.max(len, i + 1));\n\n // Fast copy with check for modified index\n for (let j = 0; j < newArr.length; j++) {\n if (j === i) {\n newArr[j] = setInPathRecursive(obj[j], path, value, index + 1);\n } else {\n newArr[j] = j < len ? obj[j] : undefined;\n }\n }\n return newArr;\n }\n\n // Object path\n const currentObj = obj ?? {};\n const keys = Object.keys(currentObj);\n const result: any = {};\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n result[key] =\n key === head\n ? setInPathRecursive(currentObj[key], path, value, index + 1)\n : currentObj[key];\n }\n\n if (!(head in currentObj)) {\n result[head] = setInPathRecursive(undefined, path, value, index + 1);\n }\n\n return result;\n}\n\n/**\n * Access utility to get a value at a specific path.\n */\nfunction getInPath(obj: any, path: string[]): any {\n let current = obj;\n for (let i = 0; i < path.length; i++) {\n if (current === null || current === undefined) return undefined;\n current = current[path[i]];\n }\n return current;\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BiF;AAKjF;AACA,MAAM,SAAS,GAAG,IAAI,OAAO,EAAmC;AAEhE,SAAS,aAAa,CAAC,IAAc,EAAE,IAAY,EAAA;IACjD,IAAI,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC;IAC/B,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,KAAK,GAAG,IAAI,GAAG,EAAE;AACjB,QAAA,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC;IAC5B;IAEA,IAAI,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;IAC5B,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC;AACxB,QAAA,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC;IACzB;AACA,IAAA,OAAO,MAAM;AACf;AAEA;;;;;AAKG;AACG,SAAU,eAAe,CAC7B,GAAW,EACX,IAAc,EACd,WAAgB;AAChB,OAAyB,EAAA;;AAGzB,IAAA,MAAM,MAAM,GAAG,CACb,GAAQ,EACR,QAAiB,EACjB,YAAY,GAAG,KAAK,EACpB,EAAW,KACT;AACF,QAAA,IAAI;AACF,YAAA,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;YACrE,MAAM,QAAQ,GAAG,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,GAAG,CAAC;AACnD,YAAA,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE;AAC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