@tracecode/harness 0.5.0 → 0.5.1
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/LICENSE +67 -80
- package/README.md +2 -1
- package/dist/index.cjs +51 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +51 -33
- package/dist/index.js.map +1 -1
- package/dist/javascript.cjs +37 -19
- package/dist/javascript.cjs.map +1 -1
- package/dist/javascript.js +37 -19
- package/dist/javascript.js.map +1 -1
- package/dist/python.cjs +14 -14
- package/dist/python.cjs.map +1 -1
- package/dist/python.d.cts +8 -8
- package/dist/python.d.ts +8 -8
- package/dist/python.js +14 -14
- package/dist/python.js.map +1 -1
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
GNU GENERAL PUBLIC LICENSE
|
|
2
|
-
Version 3,
|
|
1
|
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 19 November 2007
|
|
3
3
|
|
|
4
4
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
5
|
Everyone is permitted to copy and distribute verbatim copies
|
|
@@ -7,17 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
Preamble
|
|
9
9
|
|
|
10
|
-
The GNU General Public License is a free, copyleft license for
|
|
11
|
-
software and other kinds of works
|
|
10
|
+
The GNU Affero General Public License is a free, copyleft license for
|
|
11
|
+
software and other kinds of works, specifically designed to ensure
|
|
12
|
+
cooperation with the community in the case of network server software.
|
|
12
13
|
|
|
13
14
|
The licenses for most software and other practical works are designed
|
|
14
15
|
to take away your freedom to share and change the works. By contrast,
|
|
15
|
-
|
|
16
|
+
our General Public Licenses are intended to guarantee your freedom to
|
|
16
17
|
share and change all versions of a program--to make sure it remains free
|
|
17
|
-
software for all its users.
|
|
18
|
-
GNU General Public License for most of our software; it applies also to
|
|
19
|
-
any other work released this way by its authors. You can apply it to
|
|
20
|
-
your programs, too.
|
|
18
|
+
software for all its users.
|
|
21
19
|
|
|
22
20
|
When we speak of free software, we are referring to freedom, not
|
|
23
21
|
price. Our General Public Licenses are designed to make sure that you
|
|
@@ -26,44 +24,34 @@ them if you wish), that you receive source code or can get it if you
|
|
|
26
24
|
want it, that you can change the software or use pieces of it in new
|
|
27
25
|
free programs, and that you know you can do these things.
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
that
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
products. If such problems arise substantially in other domains, we
|
|
58
|
-
stand ready to extend this provision to those domains in future versions
|
|
59
|
-
of the GPL, as needed to protect the freedom of users.
|
|
60
|
-
|
|
61
|
-
Finally, every program is threatened constantly by software patents.
|
|
62
|
-
States should not allow patents to restrict development and use of
|
|
63
|
-
software on general-purpose computers, but in those that do, we wish to
|
|
64
|
-
avoid the special danger that patents applied to a free program could
|
|
65
|
-
make it effectively proprietary. To prevent this, the GPL assures that
|
|
66
|
-
patents cannot be used to render the program non-free.
|
|
27
|
+
Developers that use our General Public Licenses protect your rights
|
|
28
|
+
with two steps: (1) assert copyright on the software, and (2) offer
|
|
29
|
+
you this License which gives you legal permission to copy, distribute
|
|
30
|
+
and/or modify the software.
|
|
31
|
+
|
|
32
|
+
A secondary benefit of defending all users' freedom is that
|
|
33
|
+
improvements made in alternate versions of the program, if they
|
|
34
|
+
receive widespread use, become available for other developers to
|
|
35
|
+
incorporate. Many developers of free software are heartened and
|
|
36
|
+
encouraged by the resulting cooperation. However, in the case of
|
|
37
|
+
software used on network servers, this result may fail to come about.
|
|
38
|
+
The GNU General Public License permits making a modified version and
|
|
39
|
+
letting the public access it on a server without ever releasing its
|
|
40
|
+
source code to the public.
|
|
41
|
+
|
|
42
|
+
The GNU Affero General Public License is designed specifically to
|
|
43
|
+
ensure that, in such cases, the modified source code becomes available
|
|
44
|
+
to the community. It requires the operator of a network server to
|
|
45
|
+
provide the source code of the modified version running there to the
|
|
46
|
+
users of that server. Therefore, public use of a modified version, on
|
|
47
|
+
a publicly accessible server, gives the public access to the source
|
|
48
|
+
code of the modified version.
|
|
49
|
+
|
|
50
|
+
An older license, called the Affero General Public License and
|
|
51
|
+
published by Affero, was designed to accomplish similar goals. This is
|
|
52
|
+
a different license, not a version of the Affero GPL, but Affero has
|
|
53
|
+
released a new version of the Affero GPL which permits relicensing under
|
|
54
|
+
this license.
|
|
67
55
|
|
|
68
56
|
The precise terms and conditions for copying, distribution and
|
|
69
57
|
modification follow.
|
|
@@ -72,7 +60,7 @@ modification follow.
|
|
|
72
60
|
|
|
73
61
|
0. Definitions.
|
|
74
62
|
|
|
75
|
-
"This License" refers to version 3 of the GNU General Public License.
|
|
63
|
+
"This License" refers to version 3 of the GNU Affero General Public License.
|
|
76
64
|
|
|
77
65
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
78
66
|
works, such as semiconductor masks.
|
|
@@ -549,35 +537,45 @@ to collect a royalty for further conveying from those to whom you convey
|
|
|
549
537
|
the Program, the only way you could satisfy both those terms and this
|
|
550
538
|
License would be to refrain entirely from conveying the Program.
|
|
551
539
|
|
|
552
|
-
13. Use with the GNU
|
|
540
|
+
13. Remote Network Interaction; Use with the GNU General Public License.
|
|
541
|
+
|
|
542
|
+
Notwithstanding any other provision of this License, if you modify the
|
|
543
|
+
Program, your modified version must prominently offer all users
|
|
544
|
+
interacting with it remotely through a computer network (if your version
|
|
545
|
+
supports such interaction) an opportunity to receive the Corresponding
|
|
546
|
+
Source of your version by providing access to the Corresponding Source
|
|
547
|
+
from a network server at no charge, through some standard or customary
|
|
548
|
+
means of facilitating copying of software. This Corresponding Source
|
|
549
|
+
shall include the Corresponding Source for any work covered by version 3
|
|
550
|
+
of the GNU General Public License that is incorporated pursuant to the
|
|
551
|
+
following paragraph.
|
|
553
552
|
|
|
554
553
|
Notwithstanding any other provision of this License, you have
|
|
555
554
|
permission to link or combine any covered work with a work licensed
|
|
556
|
-
under version 3 of the GNU
|
|
555
|
+
under version 3 of the GNU General Public License into a single
|
|
557
556
|
combined work, and to convey the resulting work. The terms of this
|
|
558
557
|
License will continue to apply to the part which is the covered work,
|
|
559
|
-
but the
|
|
560
|
-
|
|
561
|
-
combination as such.
|
|
558
|
+
but the work with which it is combined will remain governed by version
|
|
559
|
+
3 of the GNU General Public License.
|
|
562
560
|
|
|
563
561
|
14. Revised Versions of this License.
|
|
564
562
|
|
|
565
563
|
The Free Software Foundation may publish revised and/or new versions of
|
|
566
|
-
the GNU General Public License from time to time. Such new versions
|
|
567
|
-
be similar in spirit to the present version, but may differ in detail to
|
|
564
|
+
the GNU Affero General Public License from time to time. Such new versions
|
|
565
|
+
will be similar in spirit to the present version, but may differ in detail to
|
|
568
566
|
address new problems or concerns.
|
|
569
567
|
|
|
570
568
|
Each version is given a distinguishing version number. If the
|
|
571
|
-
Program specifies that a certain numbered version of the GNU General
|
|
569
|
+
Program specifies that a certain numbered version of the GNU Affero General
|
|
572
570
|
Public License "or any later version" applies to it, you have the
|
|
573
571
|
option of following the terms and conditions either of that numbered
|
|
574
572
|
version or of any later version published by the Free Software
|
|
575
573
|
Foundation. If the Program does not specify a version number of the
|
|
576
|
-
GNU General Public License, you may choose any version ever published
|
|
574
|
+
GNU Affero General Public License, you may choose any version ever published
|
|
577
575
|
by the Free Software Foundation.
|
|
578
576
|
|
|
579
577
|
If the Program specifies that a proxy can decide which future
|
|
580
|
-
versions of the GNU General Public License can be used, that proxy's
|
|
578
|
+
versions of the GNU Affero General Public License can be used, that proxy's
|
|
581
579
|
public statement of acceptance of a version permanently authorizes you
|
|
582
580
|
to choose that version for the Program.
|
|
583
581
|
|
|
@@ -635,40 +633,29 @@ the "copyright" line and a pointer to where the full notice is found.
|
|
|
635
633
|
Copyright (C) <year> <name of author>
|
|
636
634
|
|
|
637
635
|
This program is free software: you can redistribute it and/or modify
|
|
638
|
-
it under the terms of the GNU General Public License as published by
|
|
636
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
639
637
|
the Free Software Foundation, either version 3 of the License, or
|
|
640
638
|
(at your option) any later version.
|
|
641
639
|
|
|
642
640
|
This program is distributed in the hope that it will be useful,
|
|
643
641
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
644
642
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
645
|
-
GNU General Public License for more details.
|
|
643
|
+
GNU Affero General Public License for more details.
|
|
646
644
|
|
|
647
|
-
You should have received a copy of the GNU General Public License
|
|
645
|
+
You should have received a copy of the GNU Affero General Public License
|
|
648
646
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
649
647
|
|
|
650
648
|
Also add information on how to contact you by electronic and paper mail.
|
|
651
649
|
|
|
652
|
-
If
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
661
|
-
parts of the General Public License. Of course, your program's commands
|
|
662
|
-
might be different; for a GUI interface, you would use an "about box".
|
|
650
|
+
If your software can interact with users remotely through a computer
|
|
651
|
+
network, you should also make sure that it provides a way for users to
|
|
652
|
+
get its source. For example, if your program is a web application, its
|
|
653
|
+
interface could display a "Source" link that leads users to an archive
|
|
654
|
+
of the code. There are many ways you could offer source, and different
|
|
655
|
+
solutions will be better for different programs; see section 13 for the
|
|
656
|
+
specific requirements.
|
|
663
657
|
|
|
664
658
|
You should also get your employer (if you work as a programmer) or school,
|
|
665
659
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
666
|
-
For more information on this, and how to apply and follow the GNU
|
|
660
|
+
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
667
661
|
<https://www.gnu.org/licenses/>.
|
|
668
|
-
|
|
669
|
-
The GNU General Public License does not permit incorporating your program
|
|
670
|
-
into proprietary programs. If your program is a subroutine library, you
|
|
671
|
-
may consider it more useful to permit linking proprietary applications with
|
|
672
|
-
the library. If this is what you want to do, use the GNU Lesser General
|
|
673
|
-
Public License instead of this License. But first, please read
|
|
674
|
-
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
package/README.md
CHANGED
|
@@ -254,6 +254,7 @@ pnpm generate:python-harness
|
|
|
254
254
|
|
|
255
255
|
This repo uses explicit versioned release boundaries.
|
|
256
256
|
|
|
257
|
+
- `0.5.0` improves JavaScript tree/list input hydration, fixes sparse tree deserialization, and trims GitHub CI to the non-browser verification set
|
|
257
258
|
- `0.1.0` introduced the public harness baseline
|
|
258
259
|
- `0.2.0` introduced structured runtime capability profiles
|
|
259
260
|
- `0.3.0` introduced runtime access metadata in traces
|
|
@@ -263,4 +264,4 @@ Detailed release notes live in [CHANGELOG.md](./CHANGELOG.md).
|
|
|
263
264
|
|
|
264
265
|
## License
|
|
265
266
|
|
|
266
|
-
|
|
267
|
+
AGPL-3.0-only
|
package/dist/index.cjs
CHANGED
|
@@ -1479,7 +1479,7 @@ def _serialize(obj, depth=0, node_refs=None):
|
|
|
1479
1479
|
except TypeError:
|
|
1480
1480
|
sorted_vals = [_serialize(x, depth + 1, node_refs) for x in obj]
|
|
1481
1481
|
return {"__type__": "set", "values": sorted_vals}
|
|
1482
|
-
elif (
|
|
1482
|
+
elif isinstance(obj, TreeNode):
|
|
1483
1483
|
obj_ref = id(obj)
|
|
1484
1484
|
if obj_ref in node_refs:
|
|
1485
1485
|
return {"__ref__": node_refs[obj_ref]}
|
|
@@ -1495,7 +1495,7 @@ def _serialize(obj, depth=0, node_refs=None):
|
|
|
1495
1495
|
if hasattr(obj, 'right'):
|
|
1496
1496
|
result["right"] = _serialize(obj.right, depth + 1, node_refs)
|
|
1497
1497
|
return result
|
|
1498
|
-
elif (
|
|
1498
|
+
elif isinstance(obj, ListNode):
|
|
1499
1499
|
obj_ref = id(obj)
|
|
1500
1500
|
if obj_ref in node_refs:
|
|
1501
1501
|
return {"__ref__": node_refs[obj_ref]}
|
|
@@ -1573,14 +1573,14 @@ def _serialize(obj, depth=0):
|
|
|
1573
1573
|
return {"__type__": "set", "values": sorted([_serialize(x, depth + 1) for x in obj])}
|
|
1574
1574
|
except TypeError:
|
|
1575
1575
|
return {"__type__": "set", "values": [_serialize(x, depth + 1) for x in obj]}
|
|
1576
|
-
elif (
|
|
1576
|
+
elif isinstance(obj, TreeNode):
|
|
1577
1577
|
result = {"__type__": "TreeNode", "val": _serialize(getattr(obj, 'val', getattr(obj, 'value', None)), depth + 1)}
|
|
1578
1578
|
if hasattr(obj, 'left'):
|
|
1579
1579
|
result["left"] = _serialize(obj.left, depth + 1)
|
|
1580
1580
|
if hasattr(obj, 'right'):
|
|
1581
1581
|
result["right"] = _serialize(obj.right, depth + 1)
|
|
1582
1582
|
return result
|
|
1583
|
-
elif (
|
|
1583
|
+
elif isinstance(obj, ListNode):
|
|
1584
1584
|
result = {"__type__": "ListNode", "val": _serialize(getattr(obj, 'val', getattr(obj, 'value', None)), depth + 1)}
|
|
1585
1585
|
result["next"] = _serialize(obj.next, depth + 1)
|
|
1586
1586
|
return result
|
|
@@ -1655,14 +1655,14 @@ def _serialize(obj, depth=0):
|
|
|
1655
1655
|
return {"__type__": "set", "values": sorted([_serialize(x, depth + 1) for x in obj])}
|
|
1656
1656
|
except TypeError:
|
|
1657
1657
|
return {"__type__": "set", "values": [_serialize(x, depth + 1) for x in obj]}
|
|
1658
|
-
elif
|
|
1658
|
+
elif isinstance(obj, TreeNode):
|
|
1659
1659
|
result = {"__type__": "TreeNode", "val": _serialize(getattr(obj, 'val', None), depth + 1)}
|
|
1660
1660
|
if hasattr(obj, 'left'):
|
|
1661
1661
|
result["left"] = _serialize(obj.left, depth + 1)
|
|
1662
1662
|
if hasattr(obj, 'right'):
|
|
1663
1663
|
result["right"] = _serialize(obj.right, depth + 1)
|
|
1664
1664
|
return result
|
|
1665
|
-
elif
|
|
1665
|
+
elif isinstance(obj, ListNode):
|
|
1666
1666
|
result = {"__type__": "ListNode", "val": _serialize(getattr(obj, 'val', None), depth + 1)}
|
|
1667
1667
|
result["next"] = _serialize(obj.next, depth + 1)
|
|
1668
1668
|
return result
|
|
@@ -1694,14 +1694,14 @@ def _serialize(obj, depth=0):
|
|
|
1694
1694
|
return {"__type__": "set", "values": sorted([_serialize(x, depth + 1) for x in obj])}
|
|
1695
1695
|
except TypeError:
|
|
1696
1696
|
return {"__type__": "set", "values": [_serialize(x, depth + 1) for x in obj]}
|
|
1697
|
-
elif (
|
|
1697
|
+
elif isinstance(obj, TreeNode):
|
|
1698
1698
|
result = {"__type__": "TreeNode", "val": _serialize(getattr(obj, 'val', getattr(obj, 'value', None)), depth + 1)}
|
|
1699
1699
|
if hasattr(obj, 'left'):
|
|
1700
1700
|
result["left"] = _serialize(obj.left, depth + 1)
|
|
1701
1701
|
if hasattr(obj, 'right'):
|
|
1702
1702
|
result["right"] = _serialize(obj.right, depth + 1)
|
|
1703
1703
|
return result
|
|
1704
|
-
elif (
|
|
1704
|
+
elif isinstance(obj, ListNode):
|
|
1705
1705
|
result = {"__type__": "ListNode", "val": _serialize(getattr(obj, 'val', getattr(obj, 'value', None)), depth + 1)}
|
|
1706
1706
|
result["next"] = _serialize(obj.next, depth + 1)
|
|
1707
1707
|
return result
|
|
@@ -1929,7 +1929,7 @@ def _serialize(obj, depth=0, node_refs=None):
|
|
|
1929
1929
|
except TypeError:
|
|
1930
1930
|
sorted_vals = [_serialize(x, depth + 1, node_refs) for x in obj]
|
|
1931
1931
|
return {"__type__": "set", "values": sorted_vals}
|
|
1932
|
-
elif (
|
|
1932
|
+
elif isinstance(obj, TreeNode):
|
|
1933
1933
|
obj_ref = id(obj)
|
|
1934
1934
|
if obj_ref in node_refs:
|
|
1935
1935
|
return {"__ref__": node_refs[obj_ref]}
|
|
@@ -1945,7 +1945,7 @@ def _serialize(obj, depth=0, node_refs=None):
|
|
|
1945
1945
|
if hasattr(obj, 'right'):
|
|
1946
1946
|
result["right"] = _serialize(obj.right, depth + 1, node_refs)
|
|
1947
1947
|
return result
|
|
1948
|
-
elif (
|
|
1948
|
+
elif isinstance(obj, ListNode):
|
|
1949
1949
|
obj_ref = id(obj)
|
|
1950
1950
|
if obj_ref in node_refs:
|
|
1951
1951
|
return {"__ref__": node_refs[obj_ref]}
|
|
@@ -2023,14 +2023,14 @@ def _serialize(obj, depth=0):
|
|
|
2023
2023
|
return {"__type__": "set", "values": sorted([_serialize(x, depth + 1) for x in obj])}
|
|
2024
2024
|
except TypeError:
|
|
2025
2025
|
return {"__type__": "set", "values": [_serialize(x, depth + 1) for x in obj]}
|
|
2026
|
-
elif (
|
|
2026
|
+
elif isinstance(obj, TreeNode):
|
|
2027
2027
|
result = {"__type__": "TreeNode", "val": _serialize(getattr(obj, 'val', getattr(obj, 'value', None)), depth + 1)}
|
|
2028
2028
|
if hasattr(obj, 'left'):
|
|
2029
2029
|
result["left"] = _serialize(obj.left, depth + 1)
|
|
2030
2030
|
if hasattr(obj, 'right'):
|
|
2031
2031
|
result["right"] = _serialize(obj.right, depth + 1)
|
|
2032
2032
|
return result
|
|
2033
|
-
elif (
|
|
2033
|
+
elif isinstance(obj, ListNode):
|
|
2034
2034
|
result = {"__type__": "ListNode", "val": _serialize(getattr(obj, 'val', getattr(obj, 'value', None)), depth + 1)}
|
|
2035
2035
|
result["next"] = _serialize(obj.next, depth + 1)
|
|
2036
2036
|
return result
|
|
@@ -2105,14 +2105,14 @@ def _serialize(obj, depth=0):
|
|
|
2105
2105
|
return {"__type__": "set", "values": sorted([_serialize(x, depth + 1) for x in obj])}
|
|
2106
2106
|
except TypeError:
|
|
2107
2107
|
return {"__type__": "set", "values": [_serialize(x, depth + 1) for x in obj]}
|
|
2108
|
-
elif
|
|
2108
|
+
elif isinstance(obj, TreeNode):
|
|
2109
2109
|
result = {"__type__": "TreeNode", "val": _serialize(getattr(obj, 'val', None), depth + 1)}
|
|
2110
2110
|
if hasattr(obj, 'left'):
|
|
2111
2111
|
result["left"] = _serialize(obj.left, depth + 1)
|
|
2112
2112
|
if hasattr(obj, 'right'):
|
|
2113
2113
|
result["right"] = _serialize(obj.right, depth + 1)
|
|
2114
2114
|
return result
|
|
2115
|
-
elif
|
|
2115
|
+
elif isinstance(obj, ListNode):
|
|
2116
2116
|
result = {"__type__": "ListNode", "val": _serialize(getattr(obj, 'val', None), depth + 1)}
|
|
2117
2117
|
result["next"] = _serialize(obj.next, depth + 1)
|
|
2118
2118
|
return result
|
|
@@ -2206,16 +2206,17 @@ function createConsoleProxy(output) {
|
|
|
2206
2206
|
}
|
|
2207
2207
|
function isLikelyTreeNodeValue(value) {
|
|
2208
2208
|
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
2209
|
-
const
|
|
2210
|
-
|
|
2211
|
-
|
|
2209
|
+
const record = value;
|
|
2210
|
+
if (record.__type__ === "TreeNode") return true;
|
|
2211
|
+
const ctor = value.constructor;
|
|
2212
|
+
return ctor?.name === "TreeNode";
|
|
2212
2213
|
}
|
|
2213
2214
|
function isLikelyListNodeValue(value) {
|
|
2214
2215
|
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
2215
|
-
const
|
|
2216
|
-
|
|
2217
|
-
const
|
|
2218
|
-
return
|
|
2216
|
+
const record = value;
|
|
2217
|
+
if (record.__type__ === "ListNode") return true;
|
|
2218
|
+
const ctor = value.constructor;
|
|
2219
|
+
return ctor?.name === "ListNode";
|
|
2219
2220
|
}
|
|
2220
2221
|
function getCustomClassName(value) {
|
|
2221
2222
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
@@ -2270,22 +2271,25 @@ function serializeValue(value, depth = 0, seen = /* @__PURE__ */ new WeakSet(),
|
|
|
2270
2271
|
const nodePrefix = isTree ? "tree" : "list";
|
|
2271
2272
|
const nodeId = `${nodePrefix}-${nodeRefState.nextId++}`;
|
|
2272
2273
|
nodeRefState.ids.set(objectValue, nodeId);
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
};
|
|
2281
|
-
}
|
|
2282
|
-
return {
|
|
2274
|
+
const out2 = isTree ? {
|
|
2275
|
+
__type__: "TreeNode",
|
|
2276
|
+
__id__: nodeId,
|
|
2277
|
+
val: serializeValue(nodeValue.val ?? nodeValue.value ?? null, depth + 1, seen, nodeRefState),
|
|
2278
|
+
left: serializeValue(nodeValue.left ?? null, depth + 1, seen, nodeRefState),
|
|
2279
|
+
right: serializeValue(nodeValue.right ?? null, depth + 1, seen, nodeRefState)
|
|
2280
|
+
} : {
|
|
2283
2281
|
__type__: "ListNode",
|
|
2284
2282
|
__id__: nodeId,
|
|
2285
2283
|
val: serializeValue(nodeValue.val ?? nodeValue.value ?? null, depth + 1, seen, nodeRefState),
|
|
2286
2284
|
next: serializeValue(nodeValue.next ?? null, depth + 1, seen, nodeRefState),
|
|
2287
2285
|
..."prev" in nodeValue ? { prev: serializeValue(nodeValue.prev ?? null, depth + 1, seen, nodeRefState) } : {}
|
|
2288
2286
|
};
|
|
2287
|
+
const skipped = isTree ? /* @__PURE__ */ new Set(["__id__", "__type__", "__class__", "val", "value", "left", "right"]) : /* @__PURE__ */ new Set(["__id__", "__type__", "__class__", "val", "value", "next", "prev"]);
|
|
2288
|
+
for (const [k, v] of Object.entries(nodeValue)) {
|
|
2289
|
+
if (skipped.has(k)) continue;
|
|
2290
|
+
out2[k] = serializeValue(v, depth + 1, seen, nodeRefState);
|
|
2291
|
+
}
|
|
2292
|
+
return out2;
|
|
2289
2293
|
}
|
|
2290
2294
|
const customClassName = getCustomClassName(value);
|
|
2291
2295
|
if (customClassName) {
|
|
@@ -2449,21 +2453,31 @@ function materializeTreeInput(value) {
|
|
|
2449
2453
|
}
|
|
2450
2454
|
const record = value;
|
|
2451
2455
|
if (isLikelyTreeNodeValue(record)) {
|
|
2452
|
-
|
|
2456
|
+
const node = {
|
|
2453
2457
|
val: record.val ?? record.value ?? null,
|
|
2454
2458
|
value: record.val ?? record.value ?? null,
|
|
2455
2459
|
left: materializeTreeInput(record.left ?? null),
|
|
2456
2460
|
right: materializeTreeInput(record.right ?? null)
|
|
2457
2461
|
};
|
|
2462
|
+
for (const [key, nested] of Object.entries(record)) {
|
|
2463
|
+
if (key === "__id__" || key === "__type__" || key === "val" || key === "value" || key === "left" || key === "right") continue;
|
|
2464
|
+
node[key] = materializeTreeInput(nested);
|
|
2465
|
+
}
|
|
2466
|
+
return node;
|
|
2458
2467
|
}
|
|
2459
2468
|
const taggedRecord = value;
|
|
2460
2469
|
if (taggedRecord.__type__ === "TreeNode") {
|
|
2461
|
-
|
|
2470
|
+
const node = {
|
|
2462
2471
|
val: taggedRecord.val ?? taggedRecord.value ?? null,
|
|
2463
2472
|
value: taggedRecord.val ?? taggedRecord.value ?? null,
|
|
2464
2473
|
left: materializeTreeInput(taggedRecord.left ?? null),
|
|
2465
2474
|
right: materializeTreeInput(taggedRecord.right ?? null)
|
|
2466
2475
|
};
|
|
2476
|
+
for (const [key, nested] of Object.entries(taggedRecord)) {
|
|
2477
|
+
if (key === "__id__" || key === "__type__" || key === "val" || key === "value" || key === "left" || key === "right") continue;
|
|
2478
|
+
node[key] = materializeTreeInput(nested);
|
|
2479
|
+
}
|
|
2480
|
+
return node;
|
|
2467
2481
|
}
|
|
2468
2482
|
return value;
|
|
2469
2483
|
}
|
|
@@ -2507,6 +2521,10 @@ function materializeListInput(value, refs = /* @__PURE__ */ new Map(), materiali
|
|
|
2507
2521
|
refs.set(taggedRecord.__id__, node);
|
|
2508
2522
|
}
|
|
2509
2523
|
node.next = materializeListInput(taggedRecord.next ?? null, refs, materialized);
|
|
2524
|
+
for (const [key, nested] of Object.entries(taggedRecord)) {
|
|
2525
|
+
if (key === "__id__" || key === "__type__" || key === "__class__" || key === "val" || key === "value" || key === "next") continue;
|
|
2526
|
+
node[key] = materializeListInput(nested, refs, materialized);
|
|
2527
|
+
}
|
|
2510
2528
|
return node;
|
|
2511
2529
|
}
|
|
2512
2530
|
return value;
|