palistor 0.0.24 → 0.0.26
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/README.md +574 -542
- package/README.ru.md +979 -0
- package/dist/index.d.ts +19 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -28
- package/dist/index.js.map +1 -1
- package/dist/react/createTrackingProxy.d.ts +27 -27
- package/dist/react/createTrackingProxy.d.ts.map +1 -1
- package/dist/react/createTrackingProxy.js +92 -42
- package/dist/react/createTrackingProxy.js.map +1 -1
- package/dist/react/useForm.d.ts +42 -43
- package/dist/react/useForm.d.ts.map +1 -1
- package/dist/react/useForm.js +38 -38
- package/dist/react/useForm.js.map +1 -1
- package/dist/react/usePersist.d.ts +14 -14
- package/dist/react/usePersist.js +18 -18
- package/dist/react/usePersist.js.map +1 -1
- package/dist/react/useStoreContext.d.ts +11 -11
- package/dist/react/useStoreContext.js +11 -11
- package/dist/react/useTranslator.d.ts +12 -12
- package/dist/react/useTranslator.js +12 -12
- package/dist/store/applyPatch/applyPatch.d.ts +8 -8
- package/dist/store/applyPatch/applyPatch.js +12 -12
- package/dist/store/applyPatch/applyPatch.js.map +1 -1
- package/dist/store/buildProxy/buildEntityProjectionProxy.js +6 -6
- package/dist/store/buildProxy/buildEntityProjectionProxy.js.map +1 -1
- package/dist/store/buildProxy/buildListProxy.d.ts +8 -8
- package/dist/store/buildProxy/buildListProxy.js +30 -30
- package/dist/store/buildProxy/buildListProxy.js.map +1 -1
- package/dist/store/buildProxy/buildProxy.d.ts +8 -8
- package/dist/store/buildProxy/buildProxy.d.ts.map +1 -1
- package/dist/store/buildProxy/buildProxy.js +84 -33
- package/dist/store/buildProxy/buildProxy.js.map +1 -1
- package/dist/store/buildProxy/computeProxyKeys.d.ts +8 -8
- package/dist/store/buildProxy/computeProxyKeys.d.ts.map +1 -1
- package/dist/store/buildProxy/computeProxyKeys.js +18 -13
- package/dist/store/buildProxy/computeProxyKeys.js.map +1 -1
- package/dist/store/buildProxy/handleLazyResolve.d.ts +3 -3
- package/dist/store/buildProxy/handleLazyResolve.js +3 -3
- package/dist/store/buildProxy/initProxyCaches.d.ts +5 -5
- package/dist/store/buildProxy/initProxyCaches.js +5 -5
- package/dist/store/compute/computeFieldState.d.ts +3 -3
- package/dist/store/compute/computeFieldState.js +8 -8
- package/dist/store/compute/computeFieldState.js.map +1 -1
- package/dist/store/compute/fieldStateChanged.d.ts +1 -1
- package/dist/store/compute/fieldStateChanged.js +1 -1
- package/dist/store/compute/recompute/collectGroupComputeNodes.d.ts +4 -4
- package/dist/store/compute/recompute/collectGroupComputeNodes.js +7 -7
- package/dist/store/compute/recompute/collectGroupComputeNodes.js.map +1 -1
- package/dist/store/compute/recompute/recomputeAndNotify.d.ts +3 -3
- package/dist/store/compute/recompute/recomputeAndNotify.js +3 -3
- package/dist/store/compute/recompute/recomputeLeaves.d.ts +11 -10
- package/dist/store/compute/recompute/recomputeLeaves.d.ts.map +1 -1
- package/dist/store/compute/recompute/recomputeLeaves.js +26 -27
- package/dist/store/compute/recompute/recomputeLeaves.js.map +1 -1
- package/dist/store/compute/recompute/recomputeTargeted.d.ts +7 -7
- package/dist/store/compute/recompute/recomputeTargeted.js +12 -12
- package/dist/store/compute/recompute/recomputeTargeted.js.map +1 -1
- package/dist/store/compute/recompute/topologicalSortComputed.d.ts +4 -4
- package/dist/store/compute/recompute/topologicalSortComputed.d.ts.map +1 -1
- package/dist/store/compute/recompute/topologicalSortComputed.js +11 -13
- package/dist/store/compute/recompute/topologicalSortComputed.js.map +1 -1
- package/dist/store/compute/recompute/types.d.ts +4 -4
- package/dist/store/compute/resolveFlag.d.ts +2 -2
- package/dist/store/compute/resolveFlag.js +2 -2
- package/dist/store/compute/resolveString.d.ts +5 -5
- package/dist/store/compute/resolveString.js +6 -6
- package/dist/store/compute/resolveString.js.map +1 -1
- package/dist/store/compute/types.d.ts +3 -3
- package/dist/store/constants.d.ts +57 -38
- package/dist/store/constants.d.ts.map +1 -1
- package/dist/store/constants.js +70 -35
- package/dist/store/constants.js.map +1 -1
- package/dist/store/defineFieldMapping.d.ts +21 -19
- package/dist/store/defineFieldMapping.d.ts.map +1 -1
- package/dist/store/defineFieldMapping.js +21 -19
- package/dist/store/defineFieldMapping.js.map +1 -1
- package/dist/store/dirtyTracking/collectInitialSnapshot.js +1 -1
- package/dist/store/dirtyTracking/collectInitialSnapshot.js.map +1 -1
- package/dist/store/dirtyTracking/recomputeDirtyTargeted.d.ts +3 -3
- package/dist/store/dirtyTracking/recomputeDirtyTargeted.js +11 -11
- package/dist/store/dirtyTracking/recomputeDirtyTargeted.js.map +1 -1
- package/dist/store/dirtyTracking/setGroupRevalidate.d.ts +6 -6
- package/dist/store/dirtyTracking/setGroupRevalidate.js +7 -7
- package/dist/store/dirtyTracking/setGroupRevalidate.js.map +1 -1
- package/dist/store/entityRegistry/entityRegistry.d.ts +72 -72
- package/dist/store/entityRegistry/entityRegistry.d.ts.map +1 -1
- package/dist/store/entityRegistry/entityRegistry.js +91 -91
- package/dist/store/entityRegistry/entityRegistry.js.map +1 -1
- package/dist/store/entityRegistry/generateId.d.ts +3 -3
- package/dist/store/entityRegistry/generateId.js +3 -3
- package/dist/store/entityRegistry/types.d.ts +17 -17
- package/dist/store/entityRegistry/types.d.ts.map +1 -1
- package/dist/store/flow/buildFlowStepsProxy.d.ts +17 -0
- package/dist/store/flow/buildFlowStepsProxy.d.ts.map +1 -0
- package/dist/store/flow/buildFlowStepsProxy.js +72 -0
- package/dist/store/flow/buildFlowStepsProxy.js.map +1 -0
- package/dist/store/flow/defineFlow.d.ts +92 -0
- package/dist/store/flow/defineFlow.d.ts.map +1 -0
- package/dist/store/flow/defineFlow.js +99 -0
- package/dist/store/flow/defineFlow.js.map +1 -0
- package/dist/store/flow/flowApi.d.ts +18 -0
- package/dist/store/flow/flowApi.d.ts.map +1 -0
- package/dist/store/flow/flowApi.js +18 -0
- package/dist/store/flow/flowApi.js.map +1 -0
- package/dist/store/flow/flowNavigation.d.ts +137 -0
- package/dist/store/flow/flowNavigation.d.ts.map +1 -0
- package/dist/store/flow/flowNavigation.js +384 -0
- package/dist/store/flow/flowNavigation.js.map +1 -0
- package/dist/store/flow/flowState.d.ts +41 -0
- package/dist/store/flow/flowState.d.ts.map +1 -0
- package/dist/store/flow/flowState.js +51 -0
- package/dist/store/flow/flowState.js.map +1 -0
- package/dist/store/flow/index.d.ts +10 -0
- package/dist/store/flow/index.d.ts.map +1 -0
- package/dist/store/flow/index.js +6 -0
- package/dist/store/flow/index.js.map +1 -0
- package/dist/store/groupDeps/createGroupDeps.d.ts +3 -3
- package/dist/store/groupDeps/createGroupDeps.js +6 -6
- package/dist/store/groupDeps/createGroupDeps.js.map +1 -1
- package/dist/store/groupDeps/createTrackingValues.d.ts +9 -9
- package/dist/store/groupDeps/createTrackingValues.js +11 -11
- package/dist/store/groupDeps/createTrackingValues.js.map +1 -1
- package/dist/store/groupDeps/getNodeGroupPath.d.ts +3 -3
- package/dist/store/groupDeps/getNodeGroupPath.js +5 -5
- package/dist/store/groupDeps/getNodeGroupPath.js.map +1 -1
- package/dist/store/groupDeps/getRecipientGroups.d.ts +1 -1
- package/dist/store/groupDeps/getRecipientGroups.js +1 -1
- package/dist/store/groupDeps/groupDeps.d.ts +7 -7
- package/dist/store/groupDeps/groupDeps.js +7 -7
- package/dist/store/groupDeps/pairKey.d.ts +3 -3
- package/dist/store/groupDeps/pairKey.d.ts.map +1 -1
- package/dist/store/groupDeps/pairKey.js +4 -4
- package/dist/store/groupDeps/pairKey.js.map +1 -1
- package/dist/store/groupDeps/resolveGroupByPath.d.ts +3 -3
- package/dist/store/groupDeps/resolveGroupByPath.js +3 -3
- package/dist/store/init/createNotificationHub.d.ts +31 -31
- package/dist/store/init/createNotificationHub.d.ts.map +1 -1
- package/dist/store/init/createNotificationHub.js +36 -37
- package/dist/store/init/createNotificationHub.js.map +1 -1
- package/dist/store/init/createResolveManager.d.ts +72 -69
- package/dist/store/init/createResolveManager.d.ts.map +1 -1
- package/dist/store/init/createResolveManager.js +101 -98
- package/dist/store/init/createResolveManager.js.map +1 -1
- package/dist/store/init/initGroupSubmitting.d.ts +2 -2
- package/dist/store/init/initGroupSubmitting.js +4 -4
- package/dist/store/init/initGroupSubmitting.js.map +1 -1
- package/dist/store/normalizeConfig.d.ts +20 -18
- package/dist/store/normalizeConfig.d.ts.map +1 -1
- package/dist/store/normalizeConfig.js +31 -29
- package/dist/store/normalizeConfig.js.map +1 -1
- package/dist/store/onChangePipeline/computeFieldKey.d.ts +2 -2
- package/dist/store/onChangePipeline/computeFieldKey.js +2 -2
- package/dist/store/onChangePipeline/findOnChangeAncestors.d.ts +2 -2
- package/dist/store/onChangePipeline/findOnChangeAncestors.js +4 -4
- package/dist/store/onChangePipeline/findOnChangeAncestors.js.map +1 -1
- package/dist/store/onChangePipeline/onChangePipeline.d.ts +13 -12
- package/dist/store/onChangePipeline/onChangePipeline.d.ts.map +1 -1
- package/dist/store/onChangePipeline/onChangePipeline.js +14 -13
- package/dist/store/onChangePipeline/onChangePipeline.js.map +1 -1
- package/dist/store/persist/drivers.d.ts +7 -7
- package/dist/store/persist/drivers.js +8 -8
- package/dist/store/persist/drivers.js.map +1 -1
- package/dist/store/persist/index.d.ts +1 -1
- package/dist/store/persist/persistManager.d.ts +23 -23
- package/dist/store/persist/persistManager.d.ts.map +1 -1
- package/dist/store/persist/persistManager.js +73 -42
- package/dist/store/persist/persistManager.js.map +1 -1
- package/dist/store/persist/types.d.ts +23 -23
- package/dist/store/persist/types.d.ts.map +1 -1
- package/dist/store/persist/types.js +4 -4
- package/dist/store/resetPipeline/buildResetPatch.d.ts +5 -5
- package/dist/store/resetPipeline/buildResetPatch.js +5 -5
- package/dist/store/resetPipeline/collectDefaults.d.ts +5 -5
- package/dist/store/resetPipeline/collectDefaults.js +6 -6
- package/dist/store/resetPipeline/collectDefaults.js.map +1 -1
- package/dist/store/resetPipeline/resetPipeline.d.ts +7 -7
- package/dist/store/resetPipeline/resetPipeline.d.ts.map +1 -1
- package/dist/store/resetPipeline/resetPipeline.js +17 -12
- package/dist/store/resetPipeline/resetPipeline.js.map +1 -1
- package/dist/store/resolvePipeline/applyPendingWrites.d.ts +10 -10
- package/dist/store/resolvePipeline/applyPendingWrites.d.ts.map +1 -1
- package/dist/store/resolvePipeline/applyPendingWrites.js +35 -38
- package/dist/store/resolvePipeline/applyPendingWrites.js.map +1 -1
- package/dist/store/resolvePipeline/createContextTrackingProxy.d.ts +8 -7
- package/dist/store/resolvePipeline/createContextTrackingProxy.d.ts.map +1 -1
- package/dist/store/resolvePipeline/createContextTrackingProxy.js +6 -5
- package/dist/store/resolvePipeline/createContextTrackingProxy.js.map +1 -1
- package/dist/store/resolvePipeline/createValuesTrackingProxy.d.ts +43 -43
- package/dist/store/resolvePipeline/createValuesTrackingProxy.d.ts.map +1 -1
- package/dist/store/resolvePipeline/createValuesTrackingProxy.js +70 -70
- package/dist/store/resolvePipeline/createValuesTrackingProxy.js.map +1 -1
- package/dist/store/resolvePipeline/executeListResolve.d.ts +14 -14
- package/dist/store/resolvePipeline/executeListResolve.js +27 -27
- package/dist/store/resolvePipeline/executeListResolve.js.map +1 -1
- package/dist/store/resolvePipeline/executeResolve.d.ts +15 -15
- package/dist/store/resolvePipeline/executeResolve.js +46 -46
- package/dist/store/resolvePipeline/executeResolve.js.map +1 -1
- package/dist/store/store/NodeRegistry/nodeRegistry.d.ts +69 -56
- package/dist/store/store/NodeRegistry/nodeRegistry.d.ts.map +1 -1
- package/dist/store/store/NodeRegistry/nodeRegistry.js +94 -78
- package/dist/store/store/NodeRegistry/nodeRegistry.js.map +1 -1
- package/dist/store/store/NodeRegistry/nodeUtils.d.ts +5 -5
- package/dist/store/store/NodeRegistry/nodeUtils.d.ts.map +1 -1
- package/dist/store/store/NodeRegistry/nodeUtils.js +5 -5
- package/dist/store/store/NodeRegistry/nodeUtils.js.map +1 -1
- package/dist/store/store/groupDepsMap.d.ts +23 -23
- package/dist/store/store/groupDepsMap.d.ts.map +1 -1
- package/dist/store/store/groupDepsMap.js +40 -34
- package/dist/store/store/groupDepsMap.js.map +1 -1
- package/dist/store/store/hasComputedProps.d.ts +2 -2
- package/dist/store/store/hasComputedProps.js +2 -2
- package/dist/store/store/nodeMap.d.ts +5 -5
- package/dist/store/store/nodeMap.js +7 -7
- package/dist/store/store/nodeMap.js.map +1 -1
- package/dist/store/store/palistor.d.ts +80 -80
- package/dist/store/store/palistor.d.ts.map +1 -1
- package/dist/store/store/palistor.js +151 -165
- package/dist/store/store/palistor.js.map +1 -1
- package/dist/store/store/registerNodes.d.ts +10 -10
- package/dist/store/store/registerNodes.d.ts.map +1 -1
- package/dist/store/store/registerNodes.js +33 -18
- package/dist/store/store/registerNodes.js.map +1 -1
- package/dist/store/store/serviceRegistry.d.ts +8 -8
- package/dist/store/store/serviceRegistry.d.ts.map +1 -1
- package/dist/store/store/serviceRegistry.js +8 -8
- package/dist/store/store/serviceRegistry.js.map +1 -1
- package/dist/store/store/types.d.ts +277 -223
- package/dist/store/store/types.d.ts.map +1 -1
- package/dist/store/submitPipeline/applyLeafBeforeSubmit.d.ts +2 -2
- package/dist/store/submitPipeline/applyLeafBeforeSubmit.js +2 -2
- package/dist/store/submitPipeline/collectLeafStates.d.ts +2 -2
- package/dist/store/submitPipeline/collectLeafStates.js +2 -2
- package/dist/store/submitPipeline/submitPipeline.d.ts +8 -8
- package/dist/store/submitPipeline/submitPipeline.d.ts.map +1 -1
- package/dist/store/submitPipeline/submitPipeline.js +15 -11
- package/dist/store/submitPipeline/submitPipeline.js.map +1 -1
- package/dist/store/submitPipeline/types.d.ts +1 -1
- package/dist/store/submitPipeline/types.d.ts.map +1 -1
- package/dist/store/traversal/nodeClassifier.d.ts +9 -9
- package/dist/store/traversal/nodeClassifier.d.ts.map +1 -1
- package/dist/store/traversal/nodeClassifier.js +11 -11
- package/dist/store/traversal/nodeClassifier.js.map +1 -1
- package/dist/store/traversal/walkFull.d.ts +14 -14
- package/dist/store/traversal/walkFull.js +2 -2
- package/dist/store/valuesCache/valuesCache.d.ts +9 -9
- package/dist/store/valuesCache/valuesCache.d.ts.map +1 -1
- package/dist/store/valuesCache/valuesCache.js +6 -6
- package/dist/store/writePipeline/formatPatch.d.ts +5 -5
- package/dist/store/writePipeline/formatPatch.js +7 -7
- package/dist/store/writePipeline/formatPatch.js.map +1 -1
- package/dist/store/writePipeline/formatValue.d.ts +5 -5
- package/dist/store/writePipeline/formatValue.js +5 -5
- package/dist/store/writePipeline/mergeChanged.d.ts +4 -4
- package/dist/store/writePipeline/mergeChanged.js +4 -4
- package/dist/store/writePipeline/runSetter.d.ts +6 -6
- package/dist/store/writePipeline/runSetter.js +8 -8
- package/dist/store/writePipeline/storeValue.d.ts +3 -3
- package/dist/store/writePipeline/storeValue.js +3 -3
- package/dist/store/writePipeline/types.d.ts +4 -4
- package/dist/store/writePipeline/types.d.ts.map +1 -1
- package/dist/store/writePipeline/writePipeline.d.ts +7 -7
- package/dist/store/writePipeline/writePipeline.d.ts.map +1 -1
- package/dist/store/writePipeline/writePipeline.js +15 -15
- package/dist/store/writePipeline/writePipeline.js.map +1 -1
- package/package.json +11 -4
- package/dist/store/compute/recompute/collectGroupLeafNodes.d.ts +0 -11
- package/dist/store/compute/recompute/collectGroupLeafNodes.d.ts.map +0 -1
- package/dist/store/compute/recompute/collectGroupLeafNodes.js +0 -26
- package/dist/store/compute/recompute/collectGroupLeafNodes.js.map +0 -1
- package/dist/store/fieldMapping.typecheck.d.ts +0 -2
- package/dist/store/fieldMapping.typecheck.d.ts.map +0 -1
- package/dist/store/fieldMapping.typecheck.js +0 -71
- package/dist/store/fieldMapping.typecheck.js.map +0 -1
- package/dist/store/submitPipeline/getSubValues.d.ts +0 -9
- package/dist/store/submitPipeline/getSubValues.d.ts.map +0 -1
- package/dist/store/submitPipeline/getSubValues.js +0 -26
- package/dist/store/submitPipeline/getSubValues.js.map +0 -1
|
@@ -3,78 +3,90 @@ import { type GroupComputeMap, type ComputeEntry } from "../registerNodes";
|
|
|
3
3
|
import type { AnyConfigNode, TranslateFn, ListState } from "../types";
|
|
4
4
|
import { isLeafNode, isGroupNode, isListNode } from "./nodeUtils";
|
|
5
5
|
import { type NodeView, type NodeViewKernel } from "./nodeView";
|
|
6
|
+
import { type FlowState } from "../../flow/flowState";
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* Registry of config nodes.
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* groupComputeMap, proxyCache.
|
|
10
|
+
* Bundles the data used by `Palistor`: nodeState, nodePaths, nodeParents,
|
|
11
|
+
* computeNodes, groupComputeMap, proxyCache.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Runs initialization (registerNodes + buildNodeMaps + initGroupSubmitting)
|
|
14
|
+
* in the constructor.
|
|
15
15
|
*
|
|
16
|
-
* @internal
|
|
16
|
+
* @internal used by pipelines and subsystems via the kernel
|
|
17
17
|
*/
|
|
18
18
|
export declare class NodeRegistry {
|
|
19
19
|
constructor(rootConfig: AnyConfigNode, initialValues: Record<string, unknown>, translate: TranslateFn);
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* Computed state of every config node.
|
|
22
|
+
* Key — the node object, value — its FieldState.
|
|
23
23
|
*/
|
|
24
24
|
readonly nodeState: WeakMap<object, FieldState>;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* Absolute dot-path of every config node.
|
|
27
|
+
* e.g. passport.number → "passport.number".
|
|
28
|
+
* The root node has no entry in this map ("" is used).
|
|
29
29
|
*/
|
|
30
30
|
readonly nodePaths: WeakMap<object, string>;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* Direct parent of every config node.
|
|
33
|
+
* The root node has no entry.
|
|
34
34
|
*/
|
|
35
35
|
readonly nodeParents: WeakMap<object, object>;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* All compute nodes in traversal (DFS) order.
|
|
38
|
+
* Contains leaf nodes and group nodes with computed props.
|
|
39
|
+
* Used by NotificationHub for bumpLeafVersions().
|
|
40
40
|
*/
|
|
41
41
|
readonly computeNodes: ComputeEntry[];
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
* Group node → array of its direct child entries (leaves + groups with computed props).
|
|
44
|
+
* Used by recomputeTargeted to recompute a subtree.
|
|
45
45
|
*/
|
|
46
46
|
readonly groupComputeMap: GroupComputeMap;
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
48
|
+
* Proxy object cache — one proxy per config node.
|
|
49
|
+
* Guarantees stable (===) proxy references.
|
|
50
50
|
*/
|
|
51
51
|
readonly proxyCache: WeakMap<object, unknown>;
|
|
52
52
|
/**
|
|
53
|
-
* ListState
|
|
54
|
-
*
|
|
55
|
-
*
|
|
53
|
+
* ListState for every ListNode in the config.
|
|
54
|
+
* Key — the config array object (the ListNode itself).
|
|
55
|
+
* Populated during registerNodes.
|
|
56
56
|
*/
|
|
57
57
|
readonly listStates: WeakMap<object, ListState>;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
59
|
+
* All ListState objects in registration order.
|
|
60
|
+
* Used by Palistor to register lists in EntityRegistry.rekey().
|
|
61
61
|
*/
|
|
62
62
|
readonly allListStates: ListState[];
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* `ListState`,
|
|
64
|
+
* Single list-proxy cache (root + per-entity) — keyed by the `ListState` object.
|
|
65
|
+
* Guarantees stable list-proxy references for React (like proxyCache for groups).
|
|
66
|
+
* Every (owner, listConfigNode) pair and every root list has its own
|
|
67
|
+
* `ListState`, so keying by it gives correct isolation.
|
|
68
68
|
*/
|
|
69
69
|
readonly listProxyCache: WeakMap<object, object>;
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* (`["contacts"]
|
|
74
|
-
*
|
|
75
|
-
* projectionObj
|
|
71
|
+
* Reverse index `listConfigNode → fieldPath`.
|
|
72
|
+
* The path is an array of keys relative to the owner's entity scope
|
|
73
|
+
* (`["contacts"]`, or `["profile", "contacts"]` for a list in a nested group).
|
|
74
|
+
* Used to write per-entity list membership into the right nested spot of
|
|
75
|
+
* the owner's projectionObj — so `store.getValues()` includes nested lists.
|
|
76
76
|
*/
|
|
77
77
|
readonly listFieldKeys: WeakMap<object, string[]>;
|
|
78
|
+
/**
|
|
79
|
+
* FlowState for every flow node (defineFlow) in the config.
|
|
80
|
+
* Key — the flow's config node. Populated in collectFlowStates.
|
|
81
|
+
*/
|
|
82
|
+
readonly flowStates: WeakMap<object, FlowState>;
|
|
83
|
+
/** All FlowStates in registration order (persist, reset, init lifecycle). */
|
|
84
|
+
readonly allFlowStates: FlowState[];
|
|
85
|
+
/**
|
|
86
|
+
* Reverse index: step config node → FlowState of the owning flow.
|
|
87
|
+
* Used by the group proxy to compute step.status / step.isInvalid.
|
|
88
|
+
*/
|
|
89
|
+
readonly stepToFlow: WeakMap<object, FlowState>;
|
|
78
90
|
/**
|
|
79
91
|
* NodeView per storage node.
|
|
80
92
|
* - Config-mode: populated lazily via getView (identity views cached in _identityViews).
|
|
@@ -92,47 +104,48 @@ export declare class NodeRegistry {
|
|
|
92
104
|
* - via present → entity view registered by _setEntitiesRaw; throws if not found.
|
|
93
105
|
*/
|
|
94
106
|
getView(storage: AnyConfigNode, via?: object): NodeView;
|
|
95
|
-
/**
|
|
107
|
+
/** Get the computed state of a node. */
|
|
96
108
|
getState(node: object): FieldState | undefined;
|
|
97
|
-
/**
|
|
109
|
+
/** Set the state of a node. */
|
|
98
110
|
setState(node: object, state: FieldState): void;
|
|
99
|
-
/**
|
|
111
|
+
/** Get the absolute dot-path of a node. undefined for the root. */
|
|
100
112
|
getPath(node: object): string | undefined;
|
|
101
|
-
/**
|
|
113
|
+
/** Get the direct parent of a node. */
|
|
102
114
|
getParent(node: object): object | undefined;
|
|
103
115
|
/**
|
|
104
|
-
*
|
|
105
|
-
* -
|
|
106
|
-
* -
|
|
107
|
-
* -
|
|
116
|
+
* Get the path of the group a node belongs to.
|
|
117
|
+
* - Leaf node → the parent group's path
|
|
118
|
+
* - Group node → its own path
|
|
119
|
+
* - Root → ""
|
|
108
120
|
*/
|
|
109
121
|
getGroupPath(node: object): string;
|
|
110
|
-
/**
|
|
122
|
+
/** Find a node by dot-path. Scans computeNodes and checks their paths. */
|
|
111
123
|
findByPath(path: string): object | undefined;
|
|
112
|
-
/**
|
|
124
|
+
/** Iterate over all compute nodes. */
|
|
113
125
|
forEachCompute(callback: (entry: ComputeEntry) => void): void;
|
|
114
126
|
isLeafNode: typeof isLeafNode;
|
|
115
127
|
isGroupNode: typeof isGroupNode;
|
|
116
128
|
isListNode: typeof isListNode;
|
|
117
129
|
/**
|
|
118
|
-
*
|
|
130
|
+
* Register a leaf node created at runtime (e.g. an entity leaf on store.set()).
|
|
119
131
|
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
132
|
+
* Updates all registry WeakMaps and appends an entry to `computeNodes`,
|
|
133
|
+
* so `bumpLeafVersions` (NotificationHub) automatically picks up the new node.
|
|
122
134
|
*
|
|
123
|
-
* @param node
|
|
124
|
-
* @param path
|
|
125
|
-
* @param parent
|
|
126
|
-
* @param state
|
|
135
|
+
* @param node Node object (`{ value }`)
|
|
136
|
+
* @param path Absolute dot-path, e.g. "users.0.name"
|
|
137
|
+
* @param parent Direct parent node object
|
|
138
|
+
* @param state Initial FieldState
|
|
127
139
|
*/
|
|
128
140
|
registerDynamicLeaf(node: object, path: string, parent: object, state: import("../../compute/index").FieldState): void;
|
|
129
141
|
/**
|
|
130
|
-
*
|
|
142
|
+
* Unregister a leaf node (e.g. when an entity is deleted).
|
|
131
143
|
*
|
|
132
|
-
*
|
|
133
|
-
* WeakMap
|
|
144
|
+
* Removes the entry from `computeNodes` and from the parent's
|
|
145
|
+
* `groupComputeMap`. WeakMap entries (nodeState, nodePaths, nodeParents)
|
|
146
|
+
* are reclaimed by the GC automatically.
|
|
134
147
|
*
|
|
135
|
-
* @param node
|
|
148
|
+
* @param node Leaf node object
|
|
136
149
|
*/
|
|
137
150
|
unregisterLeaf(node: object): void;
|
|
138
151
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeRegistry.d.ts","sourceRoot":"","sources":["../../../../store/store/NodeRegistry/nodeRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAiB,KAAK,eAAe,EAAE,KAAK,YAAY,EAAqB,MAAM,kBAAkB,CAAC;AAK7G,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAoB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"nodeRegistry.d.ts","sourceRoot":"","sources":["../../../../store/store/NodeRegistry/nodeRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAiB,KAAK,eAAe,EAAE,KAAK,YAAY,EAAqB,MAAM,kBAAkB,CAAC;AAK7G,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAoB,MAAM,YAAY,CAAC;AAClF,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AA0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{ getNodeGroupPath } from "../../groupDeps/getNodeGroupPath";
|
|
|
5
5
|
import { CONFIG_PROPS } from "../../constants";
|
|
6
6
|
import { isLeafNode, isGroupNode, isListNode } from "./nodeUtils";
|
|
7
7
|
import { makeIdentityView } from "./nodeView";
|
|
8
|
+
import { collectFlowStates } from "../../flow/flowState";
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Recursively build the reverse index `listConfigNode → fieldPath` for ALL
|
|
11
|
+
* lists in the config, including lists nested inside a list template
|
|
12
|
+
* (per-entity lists) and inside nested groups.
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* -
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
14
|
+
* The path is stored as an array of keys **relative to the nearest entity
|
|
15
|
+
* scope**:
|
|
16
|
+
* - a list directly under a template → `["contacts"]`;
|
|
17
|
+
* - a list inside a nested group → `["profile", "contacts"]`.
|
|
18
|
+
* The path resets at every list boundary (`child[0]` opens a new entity
|
|
19
|
+
* scope — its items are separate entities with their own projectionObj).
|
|
20
|
+
* This lets `syncListValuesCache` (per-entity branch) write the membership
|
|
21
|
+
* into the right nested spot of the owner's projectionObj.
|
|
20
22
|
*/
|
|
21
23
|
function collectListFieldKeys(node, map, prefix = []) {
|
|
22
24
|
for (const key of Object.keys(node)) {
|
|
@@ -29,7 +31,7 @@ function collectListFieldKeys(node, map, prefix = []) {
|
|
|
29
31
|
map.set(child, [...prefix, key]);
|
|
30
32
|
const template = child[0];
|
|
31
33
|
if (template && typeof template === "object") {
|
|
32
|
-
//
|
|
34
|
+
// New entity scope — the path resets.
|
|
33
35
|
collectListFieldKeys(template, map, []);
|
|
34
36
|
}
|
|
35
37
|
continue;
|
|
@@ -40,79 +42,90 @@ function collectListFieldKeys(node, map, prefix = []) {
|
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
/**
|
|
43
|
-
*
|
|
45
|
+
* Registry of config nodes.
|
|
44
46
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* groupComputeMap, proxyCache.
|
|
47
|
+
* Bundles the data used by `Palistor`: nodeState, nodePaths, nodeParents,
|
|
48
|
+
* computeNodes, groupComputeMap, proxyCache.
|
|
48
49
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
50
|
+
* Runs initialization (registerNodes + buildNodeMaps + initGroupSubmitting)
|
|
51
|
+
* in the constructor.
|
|
51
52
|
*
|
|
52
|
-
* @internal
|
|
53
|
+
* @internal used by pipelines and subsystems via the kernel
|
|
53
54
|
*/
|
|
54
55
|
export class NodeRegistry {
|
|
55
|
-
// ───
|
|
56
|
+
// ─── Initialization ──────────────────────────────────────────────────────
|
|
56
57
|
constructor(rootConfig, initialValues, translate) {
|
|
57
|
-
// ───
|
|
58
|
+
// ─── Data ────────────────────────────────────────────────────────────────
|
|
58
59
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
60
|
+
* Computed state of every config node.
|
|
61
|
+
* Key — the node object, value — its FieldState.
|
|
61
62
|
*/
|
|
62
63
|
this.nodeState = new WeakMap();
|
|
63
64
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
65
|
+
* Absolute dot-path of every config node.
|
|
66
|
+
* e.g. passport.number → "passport.number".
|
|
67
|
+
* The root node has no entry in this map ("" is used).
|
|
67
68
|
*/
|
|
68
69
|
this.nodePaths = new WeakMap();
|
|
69
70
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
71
|
+
* Direct parent of every config node.
|
|
72
|
+
* The root node has no entry.
|
|
72
73
|
*/
|
|
73
74
|
this.nodeParents = new WeakMap();
|
|
74
75
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
76
|
+
* All compute nodes in traversal (DFS) order.
|
|
77
|
+
* Contains leaf nodes and group nodes with computed props.
|
|
78
|
+
* Used by NotificationHub for bumpLeafVersions().
|
|
78
79
|
*/
|
|
79
80
|
this.computeNodes = [];
|
|
80
81
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
82
|
+
* Group node → array of its direct child entries (leaves + groups with computed props).
|
|
83
|
+
* Used by recomputeTargeted to recompute a subtree.
|
|
83
84
|
*/
|
|
84
85
|
this.groupComputeMap = new WeakMap();
|
|
85
86
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
87
|
+
* Proxy object cache — one proxy per config node.
|
|
88
|
+
* Guarantees stable (===) proxy references.
|
|
88
89
|
*/
|
|
89
90
|
this.proxyCache = new WeakMap();
|
|
90
91
|
/**
|
|
91
|
-
* ListState
|
|
92
|
-
*
|
|
93
|
-
*
|
|
92
|
+
* ListState for every ListNode in the config.
|
|
93
|
+
* Key — the config array object (the ListNode itself).
|
|
94
|
+
* Populated during registerNodes.
|
|
94
95
|
*/
|
|
95
96
|
this.listStates = new WeakMap();
|
|
96
97
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
98
|
+
* All ListState objects in registration order.
|
|
99
|
+
* Used by Palistor to register lists in EntityRegistry.rekey().
|
|
99
100
|
*/
|
|
100
101
|
this.allListStates = [];
|
|
101
102
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* `ListState`,
|
|
103
|
+
* Single list-proxy cache (root + per-entity) — keyed by the `ListState` object.
|
|
104
|
+
* Guarantees stable list-proxy references for React (like proxyCache for groups).
|
|
105
|
+
* Every (owner, listConfigNode) pair and every root list has its own
|
|
106
|
+
* `ListState`, so keying by it gives correct isolation.
|
|
106
107
|
*/
|
|
107
108
|
this.listProxyCache = new WeakMap();
|
|
108
109
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* (`["contacts"]
|
|
112
|
-
*
|
|
113
|
-
* projectionObj
|
|
110
|
+
* Reverse index `listConfigNode → fieldPath`.
|
|
111
|
+
* The path is an array of keys relative to the owner's entity scope
|
|
112
|
+
* (`["contacts"]`, or `["profile", "contacts"]` for a list in a nested group).
|
|
113
|
+
* Used to write per-entity list membership into the right nested spot of
|
|
114
|
+
* the owner's projectionObj — so `store.getValues()` includes nested lists.
|
|
114
115
|
*/
|
|
115
116
|
this.listFieldKeys = new WeakMap();
|
|
117
|
+
/**
|
|
118
|
+
* FlowState for every flow node (defineFlow) in the config.
|
|
119
|
+
* Key — the flow's config node. Populated in collectFlowStates.
|
|
120
|
+
*/
|
|
121
|
+
this.flowStates = new WeakMap();
|
|
122
|
+
/** All FlowStates in registration order (persist, reset, init lifecycle). */
|
|
123
|
+
this.allFlowStates = [];
|
|
124
|
+
/**
|
|
125
|
+
* Reverse index: step config node → FlowState of the owning flow.
|
|
126
|
+
* Used by the group proxy to compute step.status / step.isInvalid.
|
|
127
|
+
*/
|
|
128
|
+
this.stepToFlow = new WeakMap();
|
|
116
129
|
/**
|
|
117
130
|
* NodeView per storage node.
|
|
118
131
|
* - Config-mode: populated lazily via getView (identity views cached in _identityViews).
|
|
@@ -124,15 +137,19 @@ export class NodeRegistry {
|
|
|
124
137
|
this.isLeafNode = isLeafNode;
|
|
125
138
|
this.isGroupNode = isGroupNode;
|
|
126
139
|
this.isListNode = isListNode;
|
|
127
|
-
//
|
|
140
|
+
// Phase 1: register all leaf nodes and set initial values
|
|
128
141
|
registerNodes(rootConfig, initialValues, this.computeNodes, this.nodeState, "", this.groupComputeMap, translate, this.listStates, this.allListStates);
|
|
129
|
-
//
|
|
142
|
+
// Phase 2: initialize submitting/dirty/revalidate for groups
|
|
130
143
|
initGroupSubmitting(rootConfig, this.nodeState);
|
|
131
|
-
//
|
|
144
|
+
// Phase 3: build path and parent mappings
|
|
132
145
|
buildNodeMaps(rootConfig, this.nodePaths, this.nodeParents);
|
|
133
|
-
//
|
|
134
|
-
//
|
|
146
|
+
// Phase 4: reverse index listConfigNode → fieldKey, needed to
|
|
147
|
+
// materialize per-entity lists into projectionObj (getValues).
|
|
135
148
|
collectListFieldKeys(rootConfig, this.listFieldKeys);
|
|
149
|
+
// Phase 5 (defineFlow): register FlowState for nodes carrying the
|
|
150
|
+
// __flowSteps marker. Runs after buildNodeMaps — flow node paths are
|
|
151
|
+
// already assigned (needed for the persist snapshot and reset scope).
|
|
152
|
+
collectFlowStates(rootConfig, this);
|
|
136
153
|
}
|
|
137
154
|
/** Called by Palistor after construction to wire the kernel reference. */
|
|
138
155
|
setKernel(kernel) {
|
|
@@ -161,33 +178,33 @@ export class NodeRegistry {
|
|
|
161
178
|
}
|
|
162
179
|
return view;
|
|
163
180
|
}
|
|
164
|
-
// ───
|
|
165
|
-
/**
|
|
181
|
+
// ─── Navigation ──────────────────────────────────────────────────────────
|
|
182
|
+
/** Get the computed state of a node. */
|
|
166
183
|
getState(node) {
|
|
167
184
|
return this.nodeState.get(node);
|
|
168
185
|
}
|
|
169
|
-
/**
|
|
186
|
+
/** Set the state of a node. */
|
|
170
187
|
setState(node, state) {
|
|
171
188
|
this.nodeState.set(node, state);
|
|
172
189
|
}
|
|
173
|
-
/**
|
|
190
|
+
/** Get the absolute dot-path of a node. undefined for the root. */
|
|
174
191
|
getPath(node) {
|
|
175
192
|
return this.nodePaths.get(node);
|
|
176
193
|
}
|
|
177
|
-
/**
|
|
194
|
+
/** Get the direct parent of a node. */
|
|
178
195
|
getParent(node) {
|
|
179
196
|
return this.nodeParents.get(node);
|
|
180
197
|
}
|
|
181
198
|
/**
|
|
182
|
-
*
|
|
183
|
-
* -
|
|
184
|
-
* -
|
|
185
|
-
* -
|
|
199
|
+
* Get the path of the group a node belongs to.
|
|
200
|
+
* - Leaf node → the parent group's path
|
|
201
|
+
* - Group node → its own path
|
|
202
|
+
* - Root → ""
|
|
186
203
|
*/
|
|
187
204
|
getGroupPath(node) {
|
|
188
205
|
return getNodeGroupPath(node, this.nodeParents, this.nodePaths);
|
|
189
206
|
}
|
|
190
|
-
/**
|
|
207
|
+
/** Find a node by dot-path. Scans computeNodes and checks their paths. */
|
|
191
208
|
findByPath(path) {
|
|
192
209
|
for (const entry of this.computeNodes) {
|
|
193
210
|
if (entry.path === path)
|
|
@@ -195,22 +212,22 @@ export class NodeRegistry {
|
|
|
195
212
|
}
|
|
196
213
|
return undefined;
|
|
197
214
|
}
|
|
198
|
-
/**
|
|
215
|
+
/** Iterate over all compute nodes. */
|
|
199
216
|
forEachCompute(callback) {
|
|
200
217
|
for (const entry of this.computeNodes) {
|
|
201
218
|
callback(entry);
|
|
202
219
|
}
|
|
203
220
|
}
|
|
204
221
|
/**
|
|
205
|
-
*
|
|
222
|
+
* Register a leaf node created at runtime (e.g. an entity leaf on store.set()).
|
|
206
223
|
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
224
|
+
* Updates all registry WeakMaps and appends an entry to `computeNodes`,
|
|
225
|
+
* so `bumpLeafVersions` (NotificationHub) automatically picks up the new node.
|
|
209
226
|
*
|
|
210
|
-
* @param node
|
|
211
|
-
* @param path
|
|
212
|
-
* @param parent
|
|
213
|
-
* @param state
|
|
227
|
+
* @param node Node object (`{ value }`)
|
|
228
|
+
* @param path Absolute dot-path, e.g. "users.0.name"
|
|
229
|
+
* @param parent Direct parent node object
|
|
230
|
+
* @param state Initial FieldState
|
|
214
231
|
*/
|
|
215
232
|
registerDynamicLeaf(node, path, parent, state) {
|
|
216
233
|
const entry = { node: node, path };
|
|
@@ -218,7 +235,7 @@ export class NodeRegistry {
|
|
|
218
235
|
this.nodeState.set(node, state);
|
|
219
236
|
this.nodePaths.set(node, path);
|
|
220
237
|
this.nodeParents.set(node, parent);
|
|
221
|
-
// groupComputeMap:
|
|
238
|
+
// groupComputeMap: append to the parent group's list
|
|
222
239
|
let list = this.groupComputeMap.get(parent);
|
|
223
240
|
if (!list) {
|
|
224
241
|
list = [];
|
|
@@ -227,20 +244,19 @@ export class NodeRegistry {
|
|
|
227
244
|
list.push(entry);
|
|
228
245
|
}
|
|
229
246
|
/**
|
|
230
|
-
*
|
|
247
|
+
* Unregister a leaf node (e.g. when an entity is deleted).
|
|
231
248
|
*
|
|
232
|
-
*
|
|
233
|
-
* WeakMap
|
|
249
|
+
* Removes the entry from `computeNodes` and from the parent's
|
|
250
|
+
* `groupComputeMap`. WeakMap entries (nodeState, nodePaths, nodeParents)
|
|
251
|
+
* are reclaimed by the GC automatically.
|
|
234
252
|
*
|
|
235
|
-
* @param node
|
|
253
|
+
* @param node Leaf node object
|
|
236
254
|
*/
|
|
237
255
|
unregisterLeaf(node) {
|
|
238
|
-
// Удалить из computeNodes
|
|
239
256
|
const idx = this.computeNodes.findIndex((e) => e.node === node);
|
|
240
257
|
if (idx !== -1) {
|
|
241
258
|
this.computeNodes.splice(idx, 1);
|
|
242
259
|
}
|
|
243
|
-
// Удалить из groupComputeMap родителя
|
|
244
260
|
const parent = this.nodeParents.get(node);
|
|
245
261
|
if (parent) {
|
|
246
262
|
const list = this.groupComputeMap.get(parent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeRegistry.js","sourceRoot":"","sources":["../../../../store/store/NodeRegistry/nodeRegistry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAA8D,MAAM,kBAAkB,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAsC,gBAAgB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"nodeRegistry.js","sourceRoot":"","sources":["../../../../store/store/NodeRegistry/nodeRegistry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAA8D,MAAM,kBAAkB,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EA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AO,KAAK,CAAC,CAAC;oBAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { isLeafNode, isGroupNode } from "../../traversal/nodeClassifier";
|
|
2
2
|
export { isLeafNode, isGroupNode } from "../../traversal/nodeClassifier";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* array[0] — template (
|
|
4
|
+
* Whether the node is a list (array of length 1-2).
|
|
5
|
+
* array[0] — template (a regular group), array[1] — optional listConfig.
|
|
6
6
|
*
|
|
7
|
-
* NOTE:
|
|
8
|
-
*
|
|
7
|
+
* NOTE: Stricter check than traversal.isListNode (length 1-2).
|
|
8
|
+
* Used when building proxies and expanding keys.
|
|
9
9
|
*/
|
|
10
10
|
export declare function isListNode(node: unknown): node is readonly [object, ...unknown[]];
|
|
11
|
-
/**
|
|
11
|
+
/** Utility class for node type checks. Constructed without arguments. */
|
|
12
12
|
export declare class NodeUtils {
|
|
13
13
|
isLeafNode: typeof isLeafNode;
|
|
14
14
|
isGroupNode: typeof isGroupNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeUtils.d.ts","sourceRoot":"","sources":["../../../../store/store/NodeRegistry/nodeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AACzE;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,SAAS,CAAC,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC,CAEjF;AAED,
|
|
1
|
+
{"version":3,"file":"nodeUtils.d.ts","sourceRoot":"","sources":["../../../../store/store/NodeRegistry/nodeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AACzE;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,SAAS,CAAC,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC,CAEjF;AAED,yEAAyE;AACzE,qBAAa,SAAS;IACpB,UAAU,oBAAc;IACxB,WAAW,qBAAe;IAC1B,UAAU,oBAAc;CACzB"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { isLeafNode, isGroupNode } from "../../traversal/nodeClassifier";
|
|
2
2
|
export { isLeafNode, isGroupNode } from "../../traversal/nodeClassifier";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* array[0] — template (
|
|
4
|
+
* Whether the node is a list (array of length 1-2).
|
|
5
|
+
* array[0] — template (a regular group), array[1] — optional listConfig.
|
|
6
6
|
*
|
|
7
|
-
* NOTE:
|
|
8
|
-
*
|
|
7
|
+
* NOTE: Stricter check than traversal.isListNode (length 1-2).
|
|
8
|
+
* Used when building proxies and expanding keys.
|
|
9
9
|
*/
|
|
10
10
|
export function isListNode(node) {
|
|
11
11
|
return Array.isArray(node) && node.length >= 1 && node.length <= 2;
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
13
|
+
/** Utility class for node type checks. Constructed without arguments. */
|
|
14
14
|
export class NodeUtils {
|
|
15
15
|
constructor() {
|
|
16
16
|
this.isLeafNode = isLeafNode;
|