@voxgig/sdkgen 1.3.8 → 1.3.9
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/bin/voxgig-sdkgen +1 -1
- package/package.json +1 -1
- package/project/.sdk/model/feature/audit.aontu +22 -0
- package/project/.sdk/model/feature/cache.aontu +23 -0
- package/project/.sdk/model/feature/clienttrack.aontu +20 -0
- package/project/.sdk/model/feature/debug.aontu +25 -0
- package/project/.sdk/model/feature/feature-index.aontu +20 -1
- package/project/.sdk/model/feature/idempotency.aontu +21 -0
- package/project/.sdk/model/feature/metrics.aontu +20 -0
- package/project/.sdk/model/feature/netsim.aontu +36 -0
- package/project/.sdk/model/feature/paging.aontu +23 -0
- package/project/.sdk/model/feature/proxy.aontu +23 -0
- package/project/.sdk/model/feature/ratelimit.aontu +21 -0
- package/project/.sdk/model/feature/rbac.aontu +24 -0
- package/project/.sdk/model/feature/retry.aontu +23 -0
- package/project/.sdk/model/feature/streaming.aontu +22 -0
- package/project/.sdk/model/feature/telemetry.aontu +21 -0
- package/project/.sdk/model/feature/timeout.aontu +18 -0
- package/project/.sdk/model/target/c.aontu +37 -0
- package/project/.sdk/model/target/clojure.aontu +36 -0
- package/project/.sdk/model/target/cpp.aontu +35 -0
- package/project/.sdk/model/target/csharp.aontu +35 -0
- package/project/.sdk/model/target/dart.aontu +34 -0
- package/project/.sdk/model/target/elixir.aontu +33 -0
- package/project/.sdk/model/target/haskell.aontu +47 -0
- package/project/.sdk/model/target/java.aontu +37 -0
- package/project/.sdk/model/target/kotlin.aontu +37 -0
- package/project/.sdk/model/target/ocaml.aontu +36 -0
- package/project/.sdk/model/target/perl.aontu +37 -0
- package/project/.sdk/model/target/rust.aontu +37 -0
- package/project/.sdk/model/target/scala.aontu +37 -0
- package/project/.sdk/model/target/swift.aontu +35 -0
- package/project/.sdk/model/target/zig.aontu +27 -0
- package/project/.sdk/src/cmp/c/Config_c.ts +109 -0
- package/project/.sdk/src/cmp/c/EntityBase_c.ts +61 -0
- package/project/.sdk/src/cmp/c/EntityOperation_c.ts +41 -0
- package/project/.sdk/src/cmp/c/Entity_c.ts +85 -0
- package/project/.sdk/src/cmp/c/Gitignore_c.ts +29 -0
- package/project/.sdk/src/cmp/c/MainEntity_c.ts +31 -0
- package/project/.sdk/src/cmp/c/Main_c.ts +83 -0
- package/project/.sdk/src/cmp/c/Package_c.ts +17 -0
- package/project/.sdk/src/cmp/c/TestDirect_c.ts +227 -0
- package/project/.sdk/src/cmp/c/TestEntity_c.ts +82 -0
- package/project/.sdk/src/cmp/c/Test_c.ts +51 -0
- package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +265 -0
- package/project/.sdk/src/cmp/c/fragment/EntityCreateOp.fragment.c +27 -0
- package/project/.sdk/src/cmp/c/fragment/EntityListOp.fragment.c +24 -0
- package/project/.sdk/src/cmp/c/fragment/EntityLoadOp.fragment.c +29 -0
- package/project/.sdk/src/cmp/c/fragment/EntityRemoveOp.fragment.c +29 -0
- package/project/.sdk/src/cmp/c/fragment/EntityUpdateOp.fragment.c +29 -0
- package/project/.sdk/src/cmp/c/fragment/Main.fragment.c +220 -0
- package/project/.sdk/src/cmp/c/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/c/utility_c.ts +102 -0
- package/project/.sdk/src/cmp/clojure/Config_clojure.ts +94 -0
- package/project/.sdk/src/cmp/clojure/EntityOperation_clojure.ts +35 -0
- package/project/.sdk/src/cmp/clojure/Entity_clojure.ts +77 -0
- package/project/.sdk/src/cmp/clojure/Gitignore_clojure.ts +28 -0
- package/project/.sdk/src/cmp/clojure/MainEntity_clojure.ts +21 -0
- package/project/.sdk/src/cmp/clojure/Main_clojure.ts +88 -0
- package/project/.sdk/src/cmp/clojure/Package_clojure.ts +41 -0
- package/project/.sdk/src/cmp/clojure/Test_clojure.ts +120 -0
- package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +158 -0
- package/project/.sdk/src/cmp/clojure/fragment/EntityCreateOp.fragment.clj +14 -0
- package/project/.sdk/src/cmp/clojure/fragment/EntityListOp.fragment.clj +17 -0
- package/project/.sdk/src/cmp/clojure/fragment/EntityLoadOp.fragment.clj +15 -0
- package/project/.sdk/src/cmp/clojure/fragment/EntityRemoveOp.fragment.clj +15 -0
- package/project/.sdk/src/cmp/clojure/fragment/EntityUpdateOp.fragment.clj +15 -0
- package/project/.sdk/src/cmp/clojure/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/clojure/utility_clojure.ts +82 -0
- package/project/.sdk/src/cmp/cpp/Config_cpp.ts +136 -0
- package/project/.sdk/src/cmp/cpp/EntityBase_cpp.ts +51 -0
- package/project/.sdk/src/cmp/cpp/EntityOperation_cpp.ts +37 -0
- package/project/.sdk/src/cmp/cpp/Entity_cpp.ts +78 -0
- package/project/.sdk/src/cmp/cpp/Gitignore_cpp.ts +27 -0
- package/project/.sdk/src/cmp/cpp/MainEntity_cpp.ts +35 -0
- package/project/.sdk/src/cmp/cpp/Main_cpp.ts +84 -0
- package/project/.sdk/src/cmp/cpp/Package_cpp.ts +17 -0
- package/project/.sdk/src/cmp/cpp/TestDirect_cpp.ts +258 -0
- package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +454 -0
- package/project/.sdk/src/cmp/cpp/Test_cpp.ts +36 -0
- package/project/.sdk/src/cmp/cpp/fragment/Entity.fragment.cpp +40 -0
- package/project/.sdk/src/cmp/cpp/fragment/EntityCreateOp.fragment.cpp +22 -0
- package/project/.sdk/src/cmp/cpp/fragment/EntityListOp.fragment.cpp +21 -0
- package/project/.sdk/src/cmp/cpp/fragment/EntityLoadOp.fragment.cpp +25 -0
- package/project/.sdk/src/cmp/cpp/fragment/EntityRemoveOp.fragment.cpp +21 -0
- package/project/.sdk/src/cmp/cpp/fragment/EntityUpdateOp.fragment.cpp +22 -0
- package/project/.sdk/src/cmp/cpp/fragment/Main.fragment.cpp +43 -0
- package/project/.sdk/src/cmp/cpp/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/cpp/utility_cpp.ts +83 -0
- package/project/.sdk/src/cmp/csharp/Config_csharp.ts +134 -0
- package/project/.sdk/src/cmp/csharp/EntityBase_csharp.ts +39 -0
- package/project/.sdk/src/cmp/csharp/EntityOperation_csharp.ts +41 -0
- package/project/.sdk/src/cmp/csharp/Entity_csharp.ts +85 -0
- package/project/.sdk/src/cmp/csharp/Gitignore_csharp.ts +38 -0
- package/project/.sdk/src/cmp/csharp/MainEntity_csharp.ts +36 -0
- package/project/.sdk/src/cmp/csharp/Main_csharp.ts +91 -0
- package/project/.sdk/src/cmp/csharp/Package_csharp.ts +101 -0
- package/project/.sdk/src/cmp/csharp/SdkError_csharp.ts +42 -0
- package/project/.sdk/src/cmp/csharp/TestDirect_csharp.ts +560 -0
- package/project/.sdk/src/cmp/csharp/TestEntity_csharp.ts +618 -0
- package/project/.sdk/src/cmp/csharp/Test_csharp.ts +38 -0
- package/project/.sdk/src/cmp/csharp/fragment/Entity.fragment.cs +28 -0
- package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +268 -0
- package/project/.sdk/src/cmp/csharp/fragment/EntityCreateOp.fragment.cs +37 -0
- package/project/.sdk/src/cmp/csharp/fragment/EntityListOp.fragment.cs +35 -0
- package/project/.sdk/src/cmp/csharp/fragment/EntityLoadOp.fragment.cs +41 -0
- package/project/.sdk/src/cmp/csharp/fragment/EntityRemoveOp.fragment.cs +41 -0
- package/project/.sdk/src/cmp/csharp/fragment/EntityUpdateOp.fragment.cs +41 -0
- package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +278 -0
- package/project/.sdk/src/cmp/csharp/fragment/SdkError.fragment.cs +21 -0
- package/project/.sdk/src/cmp/csharp/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/csharp/utility_csharp.ts +143 -0
- package/project/.sdk/src/cmp/dart/Config_dart.ts +99 -0
- package/project/.sdk/src/cmp/dart/EntityBase_dart.ts +34 -0
- package/project/.sdk/src/cmp/dart/EntityOperation_dart.ts +43 -0
- package/project/.sdk/src/cmp/dart/EntityTypes_dart.ts +190 -0
- package/project/.sdk/src/cmp/dart/Entity_dart.ts +79 -0
- package/project/.sdk/src/cmp/dart/Gitignore_dart.ts +34 -0
- package/project/.sdk/src/cmp/dart/MainEntity_dart.ts +33 -0
- package/project/.sdk/src/cmp/dart/Main_dart.ts +105 -0
- package/project/.sdk/src/cmp/dart/Package_dart.ts +81 -0
- package/project/.sdk/src/cmp/dart/SdkError_dart.ts +42 -0
- package/project/.sdk/src/cmp/dart/TestDirect_dart.ts +498 -0
- package/project/.sdk/src/cmp/dart/TestEntity_dart.ts +552 -0
- package/project/.sdk/src/cmp/dart/Test_dart.ts +105 -0
- package/project/.sdk/src/cmp/dart/fragment/Config.fragment.dart +48 -0
- package/project/.sdk/src/cmp/dart/fragment/Direct.test.fragment.dart +25 -0
- package/project/.sdk/src/cmp/dart/fragment/Entity.fragment.dart +31 -0
- package/project/.sdk/src/cmp/dart/fragment/Entity.test.fragment.dart +67 -0
- package/project/.sdk/src/cmp/dart/fragment/EntityBase.fragment.dart +285 -0
- package/project/.sdk/src/cmp/dart/fragment/EntityCreateOp.fragment.dart +90 -0
- package/project/.sdk/src/cmp/dart/fragment/EntityListOp.fragment.dart +90 -0
- package/project/.sdk/src/cmp/dart/fragment/EntityLoadOp.fragment.dart +94 -0
- package/project/.sdk/src/cmp/dart/fragment/EntityRemoveOp.fragment.dart +94 -0
- package/project/.sdk/src/cmp/dart/fragment/EntityUpdateOp.fragment.dart +94 -0
- package/project/.sdk/src/cmp/dart/fragment/Main.fragment.dart +240 -0
- package/project/.sdk/src/cmp/dart/fragment/SdkError.fragment.dart +18 -0
- package/project/.sdk/src/cmp/dart/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/dart/utility_dart.ts +86 -0
- package/project/.sdk/src/cmp/elixir/Config_elixir.ts +101 -0
- package/project/.sdk/src/cmp/elixir/EntityOperation_elixir.ts +27 -0
- package/project/.sdk/src/cmp/elixir/Entity_elixir.ts +54 -0
- package/project/.sdk/src/cmp/elixir/Gitignore_elixir.ts +28 -0
- package/project/.sdk/src/cmp/elixir/MainEntity_elixir.ts +26 -0
- package/project/.sdk/src/cmp/elixir/Main_elixir.ts +124 -0
- package/project/.sdk/src/cmp/elixir/Package_elixir.ts +64 -0
- package/project/.sdk/src/cmp/elixir/TestDirect_elixir.ts +95 -0
- package/project/.sdk/src/cmp/elixir/TestEntity_elixir.ts +115 -0
- package/project/.sdk/src/cmp/elixir/Test_elixir.ts +47 -0
- package/project/.sdk/src/cmp/elixir/fragment/Entity.fragment.ex +37 -0
- package/project/.sdk/src/cmp/elixir/fragment/EntityCreateOp.fragment.ex +28 -0
- package/project/.sdk/src/cmp/elixir/fragment/EntityListOp.fragment.ex +30 -0
- package/project/.sdk/src/cmp/elixir/fragment/EntityLoadOp.fragment.ex +32 -0
- package/project/.sdk/src/cmp/elixir/fragment/EntityRemoveOp.fragment.ex +32 -0
- package/project/.sdk/src/cmp/elixir/fragment/EntityUpdateOp.fragment.ex +30 -0
- package/project/.sdk/src/cmp/elixir/fragment/Main.fragment.ex +218 -0
- package/project/.sdk/src/cmp/elixir/fragment/Pipeline.fragment.ex +62 -0
- package/project/.sdk/src/cmp/elixir/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/elixir/utility_elixir.ts +85 -0
- package/project/.sdk/src/cmp/go/TestEntity_go.ts +54 -0
- package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +133 -0
- package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +14 -8
- package/project/.sdk/src/cmp/haskell/Config_haskell.ts +115 -0
- package/project/.sdk/src/cmp/haskell/Entity_haskell.ts +13 -0
- package/project/.sdk/src/cmp/haskell/Gitignore_haskell.ts +27 -0
- package/project/.sdk/src/cmp/haskell/Main_haskell.ts +123 -0
- package/project/.sdk/src/cmp/haskell/Package_haskell.ts +58 -0
- package/project/.sdk/src/cmp/haskell/Test_haskell.ts +263 -0
- package/project/.sdk/src/cmp/haskell/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/haskell/utility_haskell.ts +105 -0
- package/project/.sdk/src/cmp/java/Config_java.ts +138 -0
- package/project/.sdk/src/cmp/java/EntityBase_java.ts +50 -0
- package/project/.sdk/src/cmp/java/EntityOperation_java.ts +48 -0
- package/project/.sdk/src/cmp/java/Entity_java.ts +95 -0
- package/project/.sdk/src/cmp/java/Gitignore_java.ts +37 -0
- package/project/.sdk/src/cmp/java/MainEntity_java.ts +41 -0
- package/project/.sdk/src/cmp/java/Main_java.ts +100 -0
- package/project/.sdk/src/cmp/java/Package_java.ts +126 -0
- package/project/.sdk/src/cmp/java/SdkError_java.ts +49 -0
- package/project/.sdk/src/cmp/java/TestDirect_java.ts +509 -0
- package/project/.sdk/src/cmp/java/TestEntity_java.ts +599 -0
- package/project/.sdk/src/cmp/java/Test_java.ts +42 -0
- package/project/.sdk/src/cmp/java/fragment/Entity.fragment.java +35 -0
- package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +235 -0
- package/project/.sdk/src/cmp/java/fragment/EntityCreateOp.fragment.java +42 -0
- package/project/.sdk/src/cmp/java/fragment/EntityListOp.fragment.java +39 -0
- package/project/.sdk/src/cmp/java/fragment/EntityLoadOp.fragment.java +45 -0
- package/project/.sdk/src/cmp/java/fragment/EntityRemoveOp.fragment.java +45 -0
- package/project/.sdk/src/cmp/java/fragment/EntityUpdateOp.fragment.java +45 -0
- package/project/.sdk/src/cmp/java/fragment/Main.fragment.java +34 -0
- package/project/.sdk/src/cmp/java/fragment/SdkError.fragment.java +27 -0
- package/project/.sdk/src/cmp/java/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/java/utility_java.ts +102 -0
- package/project/.sdk/src/cmp/js/Config_js.ts +4 -2
- package/project/.sdk/src/cmp/js/TestEntity_js.ts +1 -0
- package/project/.sdk/src/cmp/js/fragment/Entity.test.fragment.js +32 -1
- package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +81 -0
- package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +10 -5
- package/project/.sdk/src/cmp/kotlin/Config_kotlin.ts +128 -0
- package/project/.sdk/src/cmp/kotlin/EntityBase_kotlin.ts +50 -0
- package/project/.sdk/src/cmp/kotlin/EntityOperation_kotlin.ts +48 -0
- package/project/.sdk/src/cmp/kotlin/Entity_kotlin.ts +93 -0
- package/project/.sdk/src/cmp/kotlin/Gitignore_kotlin.ts +41 -0
- package/project/.sdk/src/cmp/kotlin/MainEntity_kotlin.ts +40 -0
- package/project/.sdk/src/cmp/kotlin/Main_kotlin.ts +94 -0
- package/project/.sdk/src/cmp/kotlin/Package_kotlin.ts +110 -0
- package/project/.sdk/src/cmp/kotlin/SdkError_kotlin.ts +48 -0
- package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +479 -0
- package/project/.sdk/src/cmp/kotlin/TestEntity_kotlin.ts +567 -0
- package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +42 -0
- package/project/.sdk/src/cmp/kotlin/fragment/Entity.fragment.kt +28 -0
- package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +195 -0
- package/project/.sdk/src/cmp/kotlin/fragment/EntityCreateOp.fragment.kt +37 -0
- package/project/.sdk/src/cmp/kotlin/fragment/EntityListOp.fragment.kt +34 -0
- package/project/.sdk/src/cmp/kotlin/fragment/EntityLoadOp.fragment.kt +40 -0
- package/project/.sdk/src/cmp/kotlin/fragment/EntityRemoveOp.fragment.kt +40 -0
- package/project/.sdk/src/cmp/kotlin/fragment/EntityUpdateOp.fragment.kt +40 -0
- package/project/.sdk/src/cmp/kotlin/fragment/Main.fragment.kt +28 -0
- package/project/.sdk/src/cmp/kotlin/fragment/SdkError.fragment.kt +24 -0
- package/project/.sdk/src/cmp/kotlin/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/kotlin/utility_kotlin.ts +101 -0
- package/project/.sdk/src/cmp/lua/Entity_lua.ts +7 -9
- package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +47 -0
- package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +137 -0
- package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +9 -6
- package/project/.sdk/src/cmp/ocaml/Config_ocaml.ts +114 -0
- package/project/.sdk/src/cmp/ocaml/EntityOperation_ocaml.ts +63 -0
- package/project/.sdk/src/cmp/ocaml/Entity_ocaml.ts +152 -0
- package/project/.sdk/src/cmp/ocaml/Gitignore_ocaml.ts +37 -0
- package/project/.sdk/src/cmp/ocaml/MainEntity_ocaml.ts +28 -0
- package/project/.sdk/src/cmp/ocaml/Main_ocaml.ts +111 -0
- package/project/.sdk/src/cmp/ocaml/Package_ocaml.ts +47 -0
- package/project/.sdk/src/cmp/ocaml/SdkError_ocaml.ts +42 -0
- package/project/.sdk/src/cmp/ocaml/TestDirect_ocaml.ts +47 -0
- package/project/.sdk/src/cmp/ocaml/TestEntity_ocaml.ts +130 -0
- package/project/.sdk/src/cmp/ocaml/Test_ocaml.ts +35 -0
- package/project/.sdk/src/cmp/ocaml/fragment/RunOp.fragment.ml +32 -0
- package/project/.sdk/src/cmp/ocaml/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/ocaml/utility_ocaml.ts +129 -0
- package/project/.sdk/src/cmp/perl/Config_perl.ts +127 -0
- package/project/.sdk/src/cmp/perl/EntityOperation_perl.ts +42 -0
- package/project/.sdk/src/cmp/perl/Entity_perl.ts +84 -0
- package/project/.sdk/src/cmp/perl/Gitignore_perl.ts +32 -0
- package/project/.sdk/src/cmp/perl/MainEntity_perl.ts +34 -0
- package/project/.sdk/src/cmp/perl/Main_perl.ts +140 -0
- package/project/.sdk/src/cmp/perl/Package_perl.ts +63 -0
- package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +433 -0
- package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +515 -0
- package/project/.sdk/src/cmp/perl/Test_perl.ts +54 -0
- package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +235 -0
- package/project/.sdk/src/cmp/perl/fragment/EntityCreateOp.fragment.pm +31 -0
- package/project/.sdk/src/cmp/perl/fragment/EntityListOp.fragment.pm +43 -0
- package/project/.sdk/src/cmp/perl/fragment/EntityLoadOp.fragment.pm +34 -0
- package/project/.sdk/src/cmp/perl/fragment/EntityRemoveOp.fragment.pm +32 -0
- package/project/.sdk/src/cmp/perl/fragment/EntityUpdateOp.fragment.pm +32 -0
- package/project/.sdk/src/cmp/perl/fragment/Main.fragment.pm +263 -0
- package/project/.sdk/src/cmp/perl/fragment/SdkError.fragment.pm +27 -0
- package/project/.sdk/src/cmp/perl/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/perl/utility_perl.ts +30 -0
- package/project/.sdk/src/cmp/php/TestEntity_php.ts +45 -0
- package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +124 -0
- package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +13 -6
- package/project/.sdk/src/cmp/py/Entity_py.ts +8 -9
- package/project/.sdk/src/cmp/py/TestEntity_py.ts +40 -0
- package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +135 -28
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +9 -6
- package/project/.sdk/src/cmp/rb/Entity_rb.ts +8 -9
- package/project/.sdk/src/cmp/rb/ReadmeExamplesTest_rb.ts +4 -1
- package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +42 -0
- package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +122 -23
- package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +9 -6
- package/project/.sdk/src/cmp/rust/Config_rust.ts +118 -0
- package/project/.sdk/src/cmp/rust/EntityBase_rust.ts +59 -0
- package/project/.sdk/src/cmp/rust/EntityOperation_rust.ts +44 -0
- package/project/.sdk/src/cmp/rust/Entity_rust.ts +94 -0
- package/project/.sdk/src/cmp/rust/Gitignore_rust.ts +29 -0
- package/project/.sdk/src/cmp/rust/MainEntity_rust.ts +37 -0
- package/project/.sdk/src/cmp/rust/Main_rust.ts +146 -0
- package/project/.sdk/src/cmp/rust/Package_rust.ts +80 -0
- package/project/.sdk/src/cmp/rust/SdkError_rust.ts +42 -0
- package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +448 -0
- package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +635 -0
- package/project/.sdk/src/cmp/rust/Test_rust.ts +51 -0
- package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +288 -0
- package/project/.sdk/src/cmp/rust/fragment/EntityCreateOp.fragment.rs +29 -0
- package/project/.sdk/src/cmp/rust/fragment/EntityListOp.fragment.rs +26 -0
- package/project/.sdk/src/cmp/rust/fragment/EntityLoadOp.fragment.rs +35 -0
- package/project/.sdk/src/cmp/rust/fragment/EntityRemoveOp.fragment.rs +35 -0
- package/project/.sdk/src/cmp/rust/fragment/EntityUpdateOp.fragment.rs +35 -0
- package/project/.sdk/src/cmp/rust/fragment/Main.fragment.rs +296 -0
- package/project/.sdk/src/cmp/rust/fragment/SdkError.fragment.rs +34 -0
- package/project/.sdk/src/cmp/rust/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/rust/utility_rust.ts +104 -0
- package/project/.sdk/src/cmp/scala/Config_scala.ts +126 -0
- package/project/.sdk/src/cmp/scala/EntityBase_scala.ts +50 -0
- package/project/.sdk/src/cmp/scala/EntityOperation_scala.ts +46 -0
- package/project/.sdk/src/cmp/scala/Entity_scala.ts +87 -0
- package/project/.sdk/src/cmp/scala/Gitignore_scala.ts +31 -0
- package/project/.sdk/src/cmp/scala/MainEntity_scala.ts +40 -0
- package/project/.sdk/src/cmp/scala/Main_scala.ts +93 -0
- package/project/.sdk/src/cmp/scala/Package_scala.ts +22 -0
- package/project/.sdk/src/cmp/scala/TestDirect_scala.ts +233 -0
- package/project/.sdk/src/cmp/scala/TestEntity_scala.ts +397 -0
- package/project/.sdk/src/cmp/scala/Test_scala.ts +93 -0
- package/project/.sdk/src/cmp/scala/fragment/Entity.fragment.scala +24 -0
- package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +169 -0
- package/project/.sdk/src/cmp/scala/fragment/EntityCreateOp.fragment.scala +32 -0
- package/project/.sdk/src/cmp/scala/fragment/EntityListOp.fragment.scala +28 -0
- package/project/.sdk/src/cmp/scala/fragment/EntityLoadOp.fragment.scala +33 -0
- package/project/.sdk/src/cmp/scala/fragment/EntityRemoveOp.fragment.scala +33 -0
- package/project/.sdk/src/cmp/scala/fragment/EntityUpdateOp.fragment.scala +33 -0
- package/project/.sdk/src/cmp/scala/fragment/Main.fragment.scala +27 -0
- package/project/.sdk/src/cmp/scala/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/scala/utility_scala.ts +99 -0
- package/project/.sdk/src/cmp/swift/Config_swift.ts +127 -0
- package/project/.sdk/src/cmp/swift/EntityBase_swift.ts +38 -0
- package/project/.sdk/src/cmp/swift/EntityOperation_swift.ts +39 -0
- package/project/.sdk/src/cmp/swift/Entity_swift.ts +86 -0
- package/project/.sdk/src/cmp/swift/Gitignore_swift.ts +32 -0
- package/project/.sdk/src/cmp/swift/MainEntity_swift.ts +35 -0
- package/project/.sdk/src/cmp/swift/Main_swift.ts +94 -0
- package/project/.sdk/src/cmp/swift/Package_swift.ts +66 -0
- package/project/.sdk/src/cmp/swift/SdkError_swift.ts +41 -0
- package/project/.sdk/src/cmp/swift/TestDirect_swift.ts +84 -0
- package/project/.sdk/src/cmp/swift/TestEntity_swift.ts +84 -0
- package/project/.sdk/src/cmp/swift/Test_swift.ts +39 -0
- package/project/.sdk/src/cmp/swift/fragment/Entity.fragment.swift +23 -0
- package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +202 -0
- package/project/.sdk/src/cmp/swift/fragment/EntityCreateOp.fragment.swift +23 -0
- package/project/.sdk/src/cmp/swift/fragment/EntityListOp.fragment.swift +21 -0
- package/project/.sdk/src/cmp/swift/fragment/EntityLoadOp.fragment.swift +24 -0
- package/project/.sdk/src/cmp/swift/fragment/EntityRemoveOp.fragment.swift +24 -0
- package/project/.sdk/src/cmp/swift/fragment/EntityUpdateOp.fragment.swift +24 -0
- package/project/.sdk/src/cmp/swift/fragment/Main.fragment.swift +211 -0
- package/project/.sdk/src/cmp/swift/fragment/SdkError.fragment.swift +22 -0
- package/project/.sdk/src/cmp/swift/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/swift/utility_swift.ts +76 -0
- package/project/.sdk/src/cmp/ts/Config_ts.ts +4 -2
- package/project/.sdk/src/cmp/ts/Package_ts.ts +12 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +81 -0
- package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +10 -5
- package/project/.sdk/src/cmp/zig/Config_zig.ts +113 -0
- package/project/.sdk/src/cmp/zig/EntityOperation_zig.ts +39 -0
- package/project/.sdk/src/cmp/zig/Entity_zig.ts +89 -0
- package/project/.sdk/src/cmp/zig/Gitignore_zig.ts +27 -0
- package/project/.sdk/src/cmp/zig/MainEntity_zig.ts +38 -0
- package/project/.sdk/src/cmp/zig/Main_zig.ts +78 -0
- package/project/.sdk/src/cmp/zig/Test_zig.ts +114 -0
- package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +278 -0
- package/project/.sdk/src/cmp/zig/fragment/EntityCreateOp.fragment.zig +24 -0
- package/project/.sdk/src/cmp/zig/fragment/EntityListOp.fragment.zig +21 -0
- package/project/.sdk/src/cmp/zig/fragment/EntityLoadOp.fragment.zig +26 -0
- package/project/.sdk/src/cmp/zig/fragment/EntityRemoveOp.fragment.zig +26 -0
- package/project/.sdk/src/cmp/zig/fragment/EntityUpdateOp.fragment.zig +26 -0
- package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +258 -0
- package/project/.sdk/src/cmp/zig/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/zig/utility_zig.ts +95 -0
- package/project/.sdk/tm/c/LICENSE +22 -0
- package/project/.sdk/tm/c/Makefile +50 -0
- package/project/.sdk/tm/c/VERSION +1 -0
- package/project/.sdk/tm/c/core/context.c +145 -0
- package/project/.sdk/tm/c/core/control.c +19 -0
- package/project/.sdk/tm/c/core/error.c +24 -0
- package/project/.sdk/tm/c/core/helpers.c +228 -0
- package/project/.sdk/tm/c/core/operation.c +34 -0
- package/project/.sdk/tm/c/core/point.c +49 -0
- package/project/.sdk/tm/c/core/response.c +29 -0
- package/project/.sdk/tm/c/core/result.c +60 -0
- package/project/.sdk/tm/c/core/sdk.h +514 -0
- package/project/.sdk/tm/c/core/spec.c +94 -0
- package/project/.sdk/tm/c/core/utility.c +74 -0
- package/project/.sdk/tm/c/feature/audit.c +134 -0
- package/project/.sdk/tm/c/feature/base.c +40 -0
- package/project/.sdk/tm/c/feature/cache.c +262 -0
- package/project/.sdk/tm/c/feature/clienttrack.c +144 -0
- package/project/.sdk/tm/c/feature/debug.c +230 -0
- package/project/.sdk/tm/c/feature/idempotency.c +164 -0
- package/project/.sdk/tm/c/feature/log.c +79 -0
- package/project/.sdk/tm/c/feature/metrics.c +177 -0
- package/project/.sdk/tm/c/feature/netsim.c +211 -0
- package/project/.sdk/tm/c/feature/paging.c +223 -0
- package/project/.sdk/tm/c/feature/proxy.c +249 -0
- package/project/.sdk/tm/c/feature/ratelimit.c +124 -0
- package/project/.sdk/tm/c/feature/rbac.c +167 -0
- package/project/.sdk/tm/c/feature/retry.c +164 -0
- package/project/.sdk/tm/c/feature/streaming.c +147 -0
- package/project/.sdk/tm/c/feature/support.c +115 -0
- package/project/.sdk/tm/c/feature/telemetry.c +205 -0
- package/project/.sdk/tm/c/feature/test.c +385 -0
- package/project/.sdk/tm/c/feature/timeout.c +106 -0
- package/project/.sdk/tm/c/src/feature/README.md +1 -0
- package/project/.sdk/tm/c/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/c/tests/ctest.h +58 -0
- package/project/.sdk/tm/c/tests/feature_harness.h +441 -0
- package/project/.sdk/tm/c/tests/feature_test.c +1210 -0
- package/project/.sdk/tm/c/tests/pipeline_test.c +561 -0
- package/project/.sdk/tm/c/tests/primary_utility_test.c +573 -0
- package/project/.sdk/tm/c/tests/runner.h +274 -0
- package/project/.sdk/tm/c/tests/sdk_pipeline_test.c +89 -0
- package/project/.sdk/tm/c/tests/struct_corpus_test.c +939 -0
- package/project/.sdk/tm/c/utility/clean.c +20 -0
- package/project/.sdk/tm/c/utility/done.c +26 -0
- package/project/.sdk/tm/c/utility/feature_add.c +42 -0
- package/project/.sdk/tm/c/utility/feature_hook.c +22 -0
- package/project/.sdk/tm/c/utility/feature_init.c +22 -0
- package/project/.sdk/tm/c/utility/fetcher.c +78 -0
- package/project/.sdk/tm/c/utility/jsonparse.c +11 -0
- package/project/.sdk/tm/c/utility/make_context.c +7 -0
- package/project/.sdk/tm/c/utility/make_error.c +66 -0
- package/project/.sdk/tm/c/utility/make_fetch_def.c +43 -0
- package/project/.sdk/tm/c/utility/make_options.c +179 -0
- package/project/.sdk/tm/c/utility/make_point.c +109 -0
- package/project/.sdk/tm/c/utility/make_request.c +62 -0
- package/project/.sdk/tm/c/utility/make_response.c +45 -0
- package/project/.sdk/tm/c/utility/make_result.c +61 -0
- package/project/.sdk/tm/c/utility/make_spec.c +60 -0
- package/project/.sdk/tm/c/utility/make_url.c +88 -0
- package/project/.sdk/tm/c/utility/param.c +58 -0
- package/project/.sdk/tm/c/utility/prepare_auth.c +65 -0
- package/project/.sdk/tm/c/utility/prepare_body.c +12 -0
- package/project/.sdk/tm/c/utility/prepare_headers.c +13 -0
- package/project/.sdk/tm/c/utility/prepare_method.c +16 -0
- package/project/.sdk/tm/c/utility/prepare_params.c +30 -0
- package/project/.sdk/tm/c/utility/prepare_path.c +17 -0
- package/project/.sdk/tm/c/utility/prepare_query.c +37 -0
- package/project/.sdk/tm/c/utility/result_basic.c +43 -0
- package/project/.sdk/tm/c/utility/result_body.c +17 -0
- package/project/.sdk/tm/c/utility/result_headers.c +17 -0
- package/project/.sdk/tm/c/utility/struct/inject.c +703 -0
- package/project/.sdk/tm/c/utility/struct/re_util.c +221 -0
- package/project/.sdk/tm/c/utility/struct/regex.c +1103 -0
- package/project/.sdk/tm/c/utility/struct/regex.h +84 -0
- package/project/.sdk/tm/c/utility/struct/transform.c +2224 -0
- package/project/.sdk/tm/c/utility/struct/utility.c +1971 -0
- package/project/.sdk/tm/c/utility/struct/value.c +640 -0
- package/project/.sdk/tm/c/utility/struct/value.h +273 -0
- package/project/.sdk/tm/c/utility/struct/value_io.c +366 -0
- package/project/.sdk/tm/c/utility/struct/value_io.h +31 -0
- package/project/.sdk/tm/c/utility/struct/voxgig_struct.h +216 -0
- package/project/.sdk/tm/c/utility/transform_request.c +21 -0
- package/project/.sdk/tm/c/utility/transform_response.c +36 -0
- package/project/.sdk/tm/clojure/LICENSE +22 -0
- package/project/.sdk/tm/clojure/Makefile +15 -0
- package/project/.sdk/tm/clojure/VERSION +1 -0
- package/project/.sdk/tm/clojure/src/feature/README.md +1 -0
- package/project/.sdk/tm/clojure/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/sdk/client.clj +119 -0
- package/project/.sdk/tm/clojure/src/sdk/core.clj +901 -0
- package/project/.sdk/tm/clojure/src/sdk/features.clj +1027 -0
- package/project/.sdk/tm/clojure/src/voxgig/struct.clj +1734 -0
- package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +596 -0
- package/project/.sdk/tm/clojure/test/sdk/test/netsim.clj +42 -0
- package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +314 -0
- package/project/.sdk/tm/clojure/test/sdk/test/primary.clj +52 -0
- package/project/.sdk/tm/clojure/test/sdk/test/struct_corpus.clj +337 -0
- package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +39 -0
- package/project/.sdk/tm/clojure/test/sdk/testutil.clj +35 -0
- package/project/.sdk/tm/cpp/LICENSE +22 -0
- package/project/.sdk/tm/cpp/Makefile +36 -0
- package/project/.sdk/tm/cpp/VERSION +1 -0
- package/project/.sdk/tm/cpp/core/sdk.hpp +16 -0
- package/project/.sdk/tm/cpp/core/struct.hpp +225 -0
- package/project/.sdk/tm/cpp/core/types.hpp +1105 -0
- package/project/.sdk/tm/cpp/feature/audit.hpp +107 -0
- package/project/.sdk/tm/cpp/feature/base.hpp +34 -0
- package/project/.sdk/tm/cpp/feature/cache.hpp +189 -0
- package/project/.sdk/tm/cpp/feature/clienttrack.hpp +105 -0
- package/project/.sdk/tm/cpp/feature/debug.hpp +157 -0
- package/project/.sdk/tm/cpp/feature/idempotency.hpp +119 -0
- package/project/.sdk/tm/cpp/feature/log.hpp +90 -0
- package/project/.sdk/tm/cpp/feature/metrics.hpp +103 -0
- package/project/.sdk/tm/cpp/feature/netsim.hpp +152 -0
- package/project/.sdk/tm/cpp/feature/options.hpp +156 -0
- package/project/.sdk/tm/cpp/feature/paging.hpp +156 -0
- package/project/.sdk/tm/cpp/feature/proxy.hpp +145 -0
- package/project/.sdk/tm/cpp/feature/ratelimit.hpp +87 -0
- package/project/.sdk/tm/cpp/feature/rbac.hpp +108 -0
- package/project/.sdk/tm/cpp/feature/retry.hpp +130 -0
- package/project/.sdk/tm/cpp/feature/streaming.hpp +98 -0
- package/project/.sdk/tm/cpp/feature/telemetry.hpp +139 -0
- package/project/.sdk/tm/cpp/feature/test.hpp +289 -0
- package/project/.sdk/tm/cpp/feature/timeout.hpp +88 -0
- package/project/.sdk/tm/cpp/src/feature/README.md +1 -0
- package/project/.sdk/tm/cpp/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/test/custom_utility_test.cpp +57 -0
- package/project/.sdk/tm/cpp/test/exists_test.cpp +16 -0
- package/project/.sdk/tm/cpp/test/feature_test.cpp +911 -0
- package/project/.sdk/tm/cpp/test/harness.hpp +344 -0
- package/project/.sdk/tm/cpp/test/netsim_test.cpp +48 -0
- package/project/.sdk/tm/cpp/test/pipeline_test.cpp +526 -0
- package/project/.sdk/tm/cpp/test/primary_utility_test.cpp +841 -0
- package/project/.sdk/tm/cpp/test/runner_support.hpp +437 -0
- package/project/.sdk/tm/cpp/test/sdk-test-control.json +19 -0
- package/project/.sdk/tm/cpp/test/struct_corpus_test.cpp +494 -0
- package/project/.sdk/tm/cpp/test/struct_runner.hpp +314 -0
- package/project/.sdk/tm/cpp/test/testlib.hpp +82 -0
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +1054 -0
- package/project/.sdk/tm/cpp/utility/voxgigstruct/value.hpp +525 -0
- package/project/.sdk/tm/cpp/utility/voxgigstruct/value_io.hpp +315 -0
- package/project/.sdk/tm/cpp/utility/voxgigstruct/voxgig_struct.hpp +3379 -0
- package/project/.sdk/tm/csharp/LICENSE +22 -0
- package/project/.sdk/tm/csharp/Makefile +43 -0
- package/project/.sdk/tm/csharp/VERSION +1 -0
- package/project/.sdk/tm/csharp/core/Context.cs +257 -0
- package/project/.sdk/tm/csharp/core/Control.cs +17 -0
- package/project/.sdk/tm/csharp/core/Helpers.cs +61 -0
- package/project/.sdk/tm/csharp/core/Operation.cs +51 -0
- package/project/.sdk/tm/csharp/core/Point.cs +68 -0
- package/project/.sdk/tm/csharp/core/Response.cs +45 -0
- package/project/.sdk/tm/csharp/core/Result.cs +63 -0
- package/project/.sdk/tm/csharp/core/Spec.cs +81 -0
- package/project/.sdk/tm/csharp/core/Types.cs +21 -0
- package/project/.sdk/tm/csharp/core/Utility.cs +88 -0
- package/project/.sdk/tm/csharp/feature/AuditFeature.cs +116 -0
- package/project/.sdk/tm/csharp/feature/BaseFeature.cs +39 -0
- package/project/.sdk/tm/csharp/feature/CacheFeature.cs +186 -0
- package/project/.sdk/tm/csharp/feature/ClienttrackFeature.cs +103 -0
- package/project/.sdk/tm/csharp/feature/DebugFeature.cs +157 -0
- package/project/.sdk/tm/csharp/feature/FeatureOptions.cs +197 -0
- package/project/.sdk/tm/csharp/feature/IdempotencyFeature.cs +97 -0
- package/project/.sdk/tm/csharp/feature/LogFeature.cs +109 -0
- package/project/.sdk/tm/csharp/feature/MetricsFeature.cs +117 -0
- package/project/.sdk/tm/csharp/feature/NetsimFeature.cs +200 -0
- package/project/.sdk/tm/csharp/feature/PagingFeature.cs +187 -0
- package/project/.sdk/tm/csharp/feature/ProxyFeature.cs +138 -0
- package/project/.sdk/tm/csharp/feature/RatelimitFeature.cs +89 -0
- package/project/.sdk/tm/csharp/feature/RbacFeature.cs +124 -0
- package/project/.sdk/tm/csharp/feature/RetryFeature.cs +174 -0
- package/project/.sdk/tm/csharp/feature/StreamingFeature.cs +93 -0
- package/project/.sdk/tm/csharp/feature/TelemetryFeature.cs +145 -0
- package/project/.sdk/tm/csharp/feature/TestFeature.cs +368 -0
- package/project/.sdk/tm/csharp/feature/TimeoutFeature.cs +69 -0
- package/project/.sdk/tm/csharp/src/feature/README.md +1 -0
- package/project/.sdk/tm/csharp/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/test/CustomUtilityTest.cs +51 -0
- package/project/.sdk/tm/csharp/test/ExistsTest.cs +17 -0
- package/project/.sdk/tm/csharp/test/FeatureTest.cs +1653 -0
- package/project/.sdk/tm/csharp/test/NetsimTest.cs +67 -0
- package/project/.sdk/tm/csharp/test/PipelineTest.cs +605 -0
- package/project/.sdk/tm/csharp/test/PrimaryUtilityTest.cs +957 -0
- package/project/.sdk/tm/csharp/test/Runner.cs +626 -0
- package/project/.sdk/tm/csharp/test/StructRunner.cs +276 -0
- package/project/.sdk/tm/csharp/test/StructUtilityTest.cs +1273 -0
- package/project/.sdk/tm/csharp/test/sdk-test-control.json +19 -0
- package/project/.sdk/tm/csharp/utility/Clean.cs +11 -0
- package/project/.sdk/tm/csharp/utility/Done.cs +28 -0
- package/project/.sdk/tm/csharp/utility/FeatureAdd.cs +54 -0
- package/project/.sdk/tm/csharp/utility/FeatureHook.cs +35 -0
- package/project/.sdk/tm/csharp/utility/FeatureInit.cs +28 -0
- package/project/.sdk/tm/csharp/utility/Fetcher.cs +181 -0
- package/project/.sdk/tm/csharp/utility/MakeContext.cs +11 -0
- package/project/.sdk/tm/csharp/utility/MakeError.cs +69 -0
- package/project/.sdk/tm/csharp/utility/MakeFetchDef.cs +38 -0
- package/project/.sdk/tm/csharp/utility/MakeOptions.cs +203 -0
- package/project/.sdk/tm/csharp/utility/MakePoint.cs +127 -0
- package/project/.sdk/tm/csharp/utility/MakeRequest.cs +87 -0
- package/project/.sdk/tm/csharp/utility/MakeResponse.cs +55 -0
- package/project/.sdk/tm/csharp/utility/MakeResult.cs +64 -0
- package/project/.sdk/tm/csharp/utility/MakeSpec.cs +64 -0
- package/project/.sdk/tm/csharp/utility/MakeUrl.cs +54 -0
- package/project/.sdk/tm/csharp/utility/Param.cs +67 -0
- package/project/.sdk/tm/csharp/utility/PrepareAuth.cs +54 -0
- package/project/.sdk/tm/csharp/utility/PrepareBody.cs +19 -0
- package/project/.sdk/tm/csharp/utility/PrepareHeaders.cs +22 -0
- package/project/.sdk/tm/csharp/utility/PrepareMethod.cs +22 -0
- package/project/.sdk/tm/csharp/utility/PrepareParams.cs +38 -0
- package/project/.sdk/tm/csharp/utility/PreparePath.cs +18 -0
- package/project/.sdk/tm/csharp/utility/PrepareQuery.cs +40 -0
- package/project/.sdk/tm/csharp/utility/Register.cs +41 -0
- package/project/.sdk/tm/csharp/utility/ResultBasic.cs +39 -0
- package/project/.sdk/tm/csharp/utility/ResultBody.cs +22 -0
- package/project/.sdk/tm/csharp/utility/ResultHeaders.cs +26 -0
- package/project/.sdk/tm/csharp/utility/TransformRequest.cs +39 -0
- package/project/.sdk/tm/csharp/utility/TransformResponse.cs +53 -0
- package/project/.sdk/tm/csharp/utility/struct/Struct.cs +3582 -0
- package/project/.sdk/tm/dart/LICENSE +22 -0
- package/project/.sdk/tm/dart/Makefile +50 -0
- package/project/.sdk/tm/dart/lib/Context.dart +150 -0
- package/project/.sdk/tm/dart/lib/Control.dart +15 -0
- package/project/.sdk/tm/dart/lib/Operation.dart +31 -0
- package/project/.sdk/tm/dart/lib/Point.dart +43 -0
- package/project/.sdk/tm/dart/lib/Response.dart +32 -0
- package/project/.sdk/tm/dart/lib/Result.dart +39 -0
- package/project/.sdk/tm/dart/lib/Spec.dart +49 -0
- package/project/.sdk/tm/dart/lib/feature/audit/AuditFeature.dart +103 -0
- package/project/.sdk/tm/dart/lib/feature/base/BaseFeature.dart +76 -0
- package/project/.sdk/tm/dart/lib/feature/cache/CacheFeature.dart +152 -0
- package/project/.sdk/tm/dart/lib/feature/clienttrack/ClienttrackFeature.dart +104 -0
- package/project/.sdk/tm/dart/lib/feature/debug/DebugFeature.dart +153 -0
- package/project/.sdk/tm/dart/lib/feature/idempotency/IdempotencyFeature.dart +92 -0
- package/project/.sdk/tm/dart/lib/feature/log/LogFeature.dart +85 -0
- package/project/.sdk/tm/dart/lib/feature/metrics/MetricsFeature.dart +103 -0
- package/project/.sdk/tm/dart/lib/feature/netsim/NetsimFeature.dart +186 -0
- package/project/.sdk/tm/dart/lib/feature/paging/PagingFeature.dart +145 -0
- package/project/.sdk/tm/dart/lib/feature/proxy/ProxyFeature.dart +118 -0
- package/project/.sdk/tm/dart/lib/feature/ratelimit/RatelimitFeature.dart +103 -0
- package/project/.sdk/tm/dart/lib/feature/rbac/RbacFeature.dart +121 -0
- package/project/.sdk/tm/dart/lib/feature/retry/RetryFeature.dart +155 -0
- package/project/.sdk/tm/dart/lib/feature/streaming/StreamingFeature.dart +97 -0
- package/project/.sdk/tm/dart/lib/feature/telemetry/TelemetryFeature.dart +136 -0
- package/project/.sdk/tm/dart/lib/feature/test/TestFeature.dart +270 -0
- package/project/.sdk/tm/dart/lib/feature/timeout/TimeoutFeature.dart +104 -0
- package/project/.sdk/tm/dart/lib/utility/CleanUtility.dart +12 -0
- package/project/.sdk/tm/dart/lib/utility/DoneUtility.dart +18 -0
- package/project/.sdk/tm/dart/lib/utility/ErrUtility.dart +46 -0
- package/project/.sdk/tm/dart/lib/utility/FeatureAddUtility.dart +35 -0
- package/project/.sdk/tm/dart/lib/utility/FeatureHookUtility.dart +20 -0
- package/project/.sdk/tm/dart/lib/utility/FeatureInitUtility.dart +9 -0
- package/project/.sdk/tm/dart/lib/utility/FetcherUtility.dart +95 -0
- package/project/.sdk/tm/dart/lib/utility/MakeContextUtility.dart +6 -0
- package/project/.sdk/tm/dart/lib/utility/MakeErrorUtility.dart +67 -0
- package/project/.sdk/tm/dart/lib/utility/MakeFetchDefUtility.dart +42 -0
- package/project/.sdk/tm/dart/lib/utility/MakeOptionsUtility.dart +147 -0
- package/project/.sdk/tm/dart/lib/utility/MakePointUtility.dart +84 -0
- package/project/.sdk/tm/dart/lib/utility/MakeRequestUtility.dart +63 -0
- package/project/.sdk/tm/dart/lib/utility/MakeResponseUtility.dart +54 -0
- package/project/.sdk/tm/dart/lib/utility/MakeResultUtility.dart +49 -0
- package/project/.sdk/tm/dart/lib/utility/MakeSpecUtility.dart +61 -0
- package/project/.sdk/tm/dart/lib/utility/MakeUrlUtility.dart +51 -0
- package/project/.sdk/tm/dart/lib/utility/ParamUtility.dart +56 -0
- package/project/.sdk/tm/dart/lib/utility/PrepareAuthUtility.dart +46 -0
- package/project/.sdk/tm/dart/lib/utility/PrepareBodyUtility.dart +19 -0
- package/project/.sdk/tm/dart/lib/utility/PrepareHeadersUtility.dart +11 -0
- package/project/.sdk/tm/dart/lib/utility/PrepareMethodUtility.dart +15 -0
- package/project/.sdk/tm/dart/lib/utility/PrepareParamsUtility.dart +23 -0
- package/project/.sdk/tm/dart/lib/utility/PreparePathUtility.dart +9 -0
- package/project/.sdk/tm/dart/lib/utility/PrepareQueryUtility.dart +18 -0
- package/project/.sdk/tm/dart/lib/utility/ResultBasicUtility.dart +29 -0
- package/project/.sdk/tm/dart/lib/utility/ResultBodyUtility.dart +15 -0
- package/project/.sdk/tm/dart/lib/utility/ResultHeadersUtility.dart +18 -0
- package/project/.sdk/tm/dart/lib/utility/StructUtility.dart +127 -0
- package/project/.sdk/tm/dart/lib/utility/TransformRequestUtility.dart +28 -0
- package/project/.sdk/tm/dart/lib/utility/TransformResponseUtility.dart +44 -0
- package/project/.sdk/tm/dart/lib/utility/Utility.dart +230 -0
- package/project/.sdk/tm/dart/lib/utility/voxgig_struct.dart +2456 -0
- package/project/.sdk/tm/dart/src/feature/README.md +3 -0
- package/project/.sdk/tm/dart/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/dart/test/custom_test.dart +65 -0
- package/project/.sdk/tm/dart/test/exists_test.dart +12 -0
- package/project/.sdk/tm/dart/test/feature/harness.dart +329 -0
- package/project/.sdk/tm/dart/test/feature_test.dart +1139 -0
- package/project/.sdk/tm/dart/test/harness.dart +153 -0
- package/project/.sdk/tm/dart/test/netsim_test.dart +48 -0
- package/project/.sdk/tm/dart/test/pipeline_test.dart +608 -0
- package/project/.sdk/tm/dart/test/primary_test.dart +411 -0
- package/project/.sdk/tm/dart/test/runner.dart +406 -0
- package/project/.sdk/tm/dart/test/sdk-test-control.json +19 -0
- package/project/.sdk/tm/dart/test/struct_corpus.dart +531 -0
- package/project/.sdk/tm/dart/test/struct_test.dart +41 -0
- package/project/.sdk/tm/dart/test/utility.dart +159 -0
- package/project/.sdk/tm/elixir/LICENSE +21 -0
- package/project/.sdk/tm/elixir/Makefile +15 -0
- package/project/.sdk/tm/elixir/VERSION +1 -0
- package/project/.sdk/tm/elixir/lib/projectname/context.ex +138 -0
- package/project/.sdk/tm/elixir/lib/projectname/core.ex +125 -0
- package/project/.sdk/tm/elixir/lib/projectname/entity_base.ex +155 -0
- package/project/.sdk/tm/elixir/lib/projectname/error.ex +16 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/audit.ex +125 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/cache.ex +170 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/clienttrack.ex +136 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/debug.ex +232 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/idempotency.ex +107 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/log.ex +62 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/metrics.ex +130 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/netsim.ex +213 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/paging.ex +191 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/proxy.ex +142 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/ratelimit.ex +81 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/rbac.ex +139 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/retry.ex +150 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/streaming.ex +107 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/telemetry.ex +172 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/test.ex +285 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/timeout.ex +64 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature.ex +90 -0
- package/project/.sdk/tm/elixir/lib/projectname/helpers.ex +66 -0
- package/project/.sdk/tm/elixir/lib/projectname/json.ex +115 -0
- package/project/.sdk/tm/elixir/lib/projectname/utility.ex +1257 -0
- package/project/.sdk/tm/elixir/lib/utility/struct/voxgig_struct.ex +2615 -0
- package/project/.sdk/tm/elixir/src/feature/README.md +3 -0
- package/project/.sdk/tm/elixir/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/test/feature_test.exs +879 -0
- package/project/.sdk/tm/elixir/test/netsim_test.exs +58 -0
- package/project/.sdk/tm/elixir/test/pipeline_test.exs +558 -0
- package/project/.sdk/tm/elixir/test/primary_utility_test.exs +133 -0
- package/project/.sdk/tm/elixir/test/stream_test.exs +119 -0
- package/project/.sdk/tm/elixir/test/struct_corpus_test.exs +18 -0
- package/project/.sdk/tm/elixir/test/support/feature_harness.ex +346 -0
- package/project/.sdk/tm/elixir/test/support/struct_corpus.ex +677 -0
- package/project/.sdk/tm/elixir/test/test_helper.exs +1 -0
- package/project/.sdk/tm/go/core/context.go +10 -0
- package/project/.sdk/tm/go/core/control.go +2 -0
- package/project/.sdk/tm/go/core/result.go +6 -0
- package/project/.sdk/tm/go/core/types.go +1 -0
- package/project/.sdk/tm/go/feature/audit_feature.go +110 -0
- package/project/.sdk/tm/go/feature/base_feature.go +8 -0
- package/project/.sdk/tm/go/feature/cache_feature.go +171 -0
- package/project/.sdk/tm/go/feature/clienttrack_feature.go +100 -0
- package/project/.sdk/tm/go/feature/debug_feature.go +159 -0
- package/project/.sdk/tm/go/feature/feature_options.go +204 -0
- package/project/.sdk/tm/go/feature/idempotency_feature.go +115 -0
- package/project/.sdk/tm/go/feature/metrics_feature.go +112 -0
- package/project/.sdk/tm/go/feature/netsim_feature.go +184 -0
- package/project/.sdk/tm/go/feature/paging_feature.go +173 -0
- package/project/.sdk/tm/go/feature/proxy_feature.go +121 -0
- package/project/.sdk/tm/go/feature/ratelimit_feature.go +88 -0
- package/project/.sdk/tm/go/feature/rbac_feature.go +126 -0
- package/project/.sdk/tm/go/feature/retry_feature.go +165 -0
- package/project/.sdk/tm/go/feature/streaming_feature.go +119 -0
- package/project/.sdk/tm/go/feature/telemetry_feature.go +142 -0
- package/project/.sdk/tm/go/feature/test_feature.go +78 -3
- package/project/.sdk/tm/go/feature/timeout_feature.go +88 -0
- package/project/.sdk/tm/go/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/go/test/feature_test.go +1465 -0
- package/project/.sdk/tm/go/test/netsim_test.go +70 -0
- package/project/.sdk/tm/go/test/pipeline_test.go +571 -0
- package/project/.sdk/tm/go/utility/feature_add.go +38 -0
- package/project/.sdk/tm/go/utility/fetcher.go +13 -1
- package/project/.sdk/tm/go/utility/make_error.go +8 -0
- package/project/.sdk/tm/go/utility/make_options.go +62 -0
- package/project/.sdk/tm/go/utility/make_point.go +6 -0
- package/project/.sdk/tm/go-cli/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/LICENSE +21 -0
- package/project/.sdk/tm/haskell/Makefile +22 -0
- package/project/.sdk/tm/haskell/VERSION +1 -0
- package/project/.sdk/tm/haskell/src/SdkFeatures.hs +1278 -0
- package/project/.sdk/tm/haskell/src/SdkHelpers.hs +337 -0
- package/project/.sdk/tm/haskell/src/SdkRuntime.hs +1007 -0
- package/project/.sdk/tm/haskell/src/SdkTypes.hs +186 -0
- package/project/.sdk/tm/haskell/src/VoxgigStruct.hs +2299 -0
- package/project/.sdk/tm/haskell/src/Vregex.hs +237 -0
- package/project/.sdk/tm/haskell/src/feature/README.md +5 -0
- package/project/.sdk/tm/haskell/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/test/Harness.hs +276 -0
- package/project/.sdk/tm/haskell/test/Runner.hs +47 -0
- package/project/.sdk/tm/haskell/test/StructCorpus.hs +449 -0
- package/project/.sdk/tm/haskell/test/TCustomUtility.hs +38 -0
- package/project/.sdk/tm/haskell/test/TFeature.hs +794 -0
- package/project/.sdk/tm/haskell/test/TNetsim.hs +50 -0
- package/project/.sdk/tm/haskell/test/TPipeline.hs +334 -0
- package/project/.sdk/tm/haskell/test/TPrimaryUtility.hs +386 -0
- package/project/.sdk/tm/haskell/test/TestJson.hs +107 -0
- package/project/.sdk/tm/haskell/test/Testutil.hs +59 -0
- package/project/.sdk/tm/java/LICENSE +22 -0
- package/project/.sdk/tm/java/Makefile +44 -0
- package/project/.sdk/tm/java/VERSION +1 -0
- package/project/.sdk/tm/java/core/Context.java +269 -0
- package/project/.sdk/tm/java/core/Control.java +23 -0
- package/project/.sdk/tm/java/core/Entity.java +13 -0
- package/project/.sdk/tm/java/core/Feature.java +45 -0
- package/project/.sdk/tm/java/core/FeaturePlacement.java +13 -0
- package/project/.sdk/tm/java/core/Helpers.java +50 -0
- package/project/.sdk/tm/java/core/Operation.java +47 -0
- package/project/.sdk/tm/java/core/Point.java +90 -0
- package/project/.sdk/tm/java/core/Response.java +48 -0
- package/project/.sdk/tm/java/core/Result.java +64 -0
- package/project/.sdk/tm/java/core/SdkClient.java +280 -0
- package/project/.sdk/tm/java/core/SdkEntity.java +28 -0
- package/project/.sdk/tm/java/core/Spec.java +84 -0
- package/project/.sdk/tm/java/core/Utility.java +128 -0
- package/project/.sdk/tm/java/feature/AuditFeature.java +113 -0
- package/project/.sdk/tm/java/feature/BaseFeature.java +91 -0
- package/project/.sdk/tm/java/feature/CacheFeature.java +184 -0
- package/project/.sdk/tm/java/feature/ClienttrackFeature.java +103 -0
- package/project/.sdk/tm/java/feature/DebugFeature.java +163 -0
- package/project/.sdk/tm/java/feature/FeatureOptions.java +204 -0
- package/project/.sdk/tm/java/feature/IdempotencyFeature.java +115 -0
- package/project/.sdk/tm/java/feature/LogFeature.java +143 -0
- package/project/.sdk/tm/java/feature/MetricsFeature.java +115 -0
- package/project/.sdk/tm/java/feature/NetsimFeature.java +181 -0
- package/project/.sdk/tm/java/feature/PagingFeature.java +178 -0
- package/project/.sdk/tm/java/feature/ProxyFeature.java +122 -0
- package/project/.sdk/tm/java/feature/RatelimitFeature.java +83 -0
- package/project/.sdk/tm/java/feature/RbacFeature.java +132 -0
- package/project/.sdk/tm/java/feature/RetryFeature.java +156 -0
- package/project/.sdk/tm/java/feature/StreamingFeature.java +110 -0
- package/project/.sdk/tm/java/feature/TelemetryFeature.java +146 -0
- package/project/.sdk/tm/java/feature/TestFeature.java +333 -0
- package/project/.sdk/tm/java/feature/TimeoutFeature.java +89 -0
- package/project/.sdk/tm/java/src/feature/README.md +1 -0
- package/project/.sdk/tm/java/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/java/test/CustomUtilityTest.java +59 -0
- package/project/.sdk/tm/java/test/ExistsTest.java +16 -0
- package/project/.sdk/tm/java/test/FeatureHarness.java +448 -0
- package/project/.sdk/tm/java/test/FeatureTest.java +1018 -0
- package/project/.sdk/tm/java/test/NetsimTest.java +59 -0
- package/project/.sdk/tm/java/test/PipelineTest.java +618 -0
- package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +864 -0
- package/project/.sdk/tm/java/test/RunnerSupport.java +545 -0
- package/project/.sdk/tm/java/test/StructCorpusTest.java +351 -0
- package/project/.sdk/tm/java/test/StructRunner.java +281 -0
- package/project/.sdk/tm/java/test/sdk-test-control.json +19 -0
- package/project/.sdk/tm/java/utility/Clean.java +12 -0
- package/project/.sdk/tm/java/utility/Done.java +29 -0
- package/project/.sdk/tm/java/utility/FeatureAdd.java +59 -0
- package/project/.sdk/tm/java/utility/FeatureHookUtil.java +72 -0
- package/project/.sdk/tm/java/utility/FeatureInit.java +35 -0
- package/project/.sdk/tm/java/utility/Fetcher.java +170 -0
- package/project/.sdk/tm/java/utility/Json.java +268 -0
- package/project/.sdk/tm/java/utility/MakeContext.java +14 -0
- package/project/.sdk/tm/java/utility/MakeError.java +81 -0
- package/project/.sdk/tm/java/utility/MakeFetchDef.java +48 -0
- package/project/.sdk/tm/java/utility/MakeOptions.java +168 -0
- package/project/.sdk/tm/java/utility/MakePoint.java +118 -0
- package/project/.sdk/tm/java/utility/MakeRequest.java +83 -0
- package/project/.sdk/tm/java/utility/MakeResponse.java +54 -0
- package/project/.sdk/tm/java/utility/MakeResult.java +68 -0
- package/project/.sdk/tm/java/utility/MakeSpec.java +69 -0
- package/project/.sdk/tm/java/utility/MakeUrl.java +67 -0
- package/project/.sdk/tm/java/utility/Param.java +74 -0
- package/project/.sdk/tm/java/utility/PrepareAuth.java +66 -0
- package/project/.sdk/tm/java/utility/PrepareBody.java +16 -0
- package/project/.sdk/tm/java/utility/PrepareHeaders.java +28 -0
- package/project/.sdk/tm/java/utility/PrepareMethod.java +28 -0
- package/project/.sdk/tm/java/utility/PrepareParams.java +50 -0
- package/project/.sdk/tm/java/utility/PreparePath.java +26 -0
- package/project/.sdk/tm/java/utility/PrepareQuery.java +54 -0
- package/project/.sdk/tm/java/utility/Register.java +41 -0
- package/project/.sdk/tm/java/utility/ResultBasic.java +36 -0
- package/project/.sdk/tm/java/utility/ResultBody.java +23 -0
- package/project/.sdk/tm/java/utility/ResultHeaders.java +36 -0
- package/project/.sdk/tm/java/utility/TransformRequest.java +35 -0
- package/project/.sdk/tm/java/utility/TransformResponse.java +52 -0
- package/project/.sdk/tm/java/utility/struct/Struct.java +3550 -0
- package/project/.sdk/tm/js/src/feature/audit/AuditFeature.js +96 -0
- package/project/.sdk/tm/js/src/feature/cache/CacheFeature.js +150 -0
- package/project/.sdk/tm/js/src/feature/clienttrack/ClienttrackFeature.js +104 -0
- package/project/.sdk/tm/js/src/feature/debug/DebugFeature.js +132 -0
- package/project/.sdk/tm/js/src/feature/idempotency/IdempotencyFeature.js +95 -0
- package/project/.sdk/tm/js/src/feature/metrics/MetricsFeature.js +102 -0
- package/project/.sdk/tm/js/src/feature/netsim/NetsimFeature.js +187 -0
- package/project/.sdk/tm/js/src/feature/paging/PagingFeature.js +139 -0
- package/project/.sdk/tm/js/src/feature/proxy/ProxyFeature.js +110 -0
- package/project/.sdk/tm/js/src/feature/ratelimit/RatelimitFeature.js +106 -0
- package/project/.sdk/tm/js/src/feature/rbac/RbacFeature.js +102 -0
- package/project/.sdk/tm/js/src/feature/retry/RetryFeature.js +158 -0
- package/project/.sdk/tm/js/src/feature/streaming/StreamingFeature.js +96 -0
- package/project/.sdk/tm/js/src/feature/telemetry/TelemetryFeature.js +128 -0
- package/project/.sdk/tm/js/src/feature/test/TestFeature.js +58 -1
- package/project/.sdk/tm/js/src/feature/timeout/TimeoutFeature.js +101 -0
- package/project/.sdk/tm/js/src/utility/FeatureHookUtility.js +4 -1
- package/project/.sdk/tm/js/src/utility/MakeErrorUtility.js +9 -0
- package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +31 -1
- package/project/.sdk/tm/js/test/feature/harness.js +275 -0
- package/project/.sdk/tm/js/test/feature.test.js +772 -0
- package/project/.sdk/tm/js/test/netsim.test.js +43 -0
- package/project/.sdk/tm/js/test/pipeline.test.js +382 -0
- package/project/.sdk/tm/kotlin/LICENSE +22 -0
- package/project/.sdk/tm/kotlin/Makefile +43 -0
- package/project/.sdk/tm/kotlin/VERSION +1 -0
- package/project/.sdk/tm/kotlin/core/Context.kt +247 -0
- package/project/.sdk/tm/kotlin/core/Control.kt +21 -0
- package/project/.sdk/tm/kotlin/core/Helpers.kt +49 -0
- package/project/.sdk/tm/kotlin/core/Interfaces.kt +88 -0
- package/project/.sdk/tm/kotlin/core/Operation.kt +43 -0
- package/project/.sdk/tm/kotlin/core/Point.kt +83 -0
- package/project/.sdk/tm/kotlin/core/Response.kt +43 -0
- package/project/.sdk/tm/kotlin/core/Result.kt +61 -0
- package/project/.sdk/tm/kotlin/core/SdkClient.kt +266 -0
- package/project/.sdk/tm/kotlin/core/Spec.kt +76 -0
- package/project/.sdk/tm/kotlin/core/Utility.kt +93 -0
- package/project/.sdk/tm/kotlin/feature/AuditFeature.kt +96 -0
- package/project/.sdk/tm/kotlin/feature/BaseFeature.kt +57 -0
- package/project/.sdk/tm/kotlin/feature/CacheFeature.kt +167 -0
- package/project/.sdk/tm/kotlin/feature/ClienttrackFeature.kt +84 -0
- package/project/.sdk/tm/kotlin/feature/DebugFeature.kt +141 -0
- package/project/.sdk/tm/kotlin/feature/FeatureOptions.kt +191 -0
- package/project/.sdk/tm/kotlin/feature/IdempotencyFeature.kt +98 -0
- package/project/.sdk/tm/kotlin/feature/LogFeature.kt +92 -0
- package/project/.sdk/tm/kotlin/feature/MetricsFeature.kt +96 -0
- package/project/.sdk/tm/kotlin/feature/NetsimFeature.kt +162 -0
- package/project/.sdk/tm/kotlin/feature/PagingFeature.kt +143 -0
- package/project/.sdk/tm/kotlin/feature/ProxyFeature.kt +109 -0
- package/project/.sdk/tm/kotlin/feature/RatelimitFeature.kt +77 -0
- package/project/.sdk/tm/kotlin/feature/RbacFeature.kt +100 -0
- package/project/.sdk/tm/kotlin/feature/RetryFeature.kt +140 -0
- package/project/.sdk/tm/kotlin/feature/StreamingFeature.kt +90 -0
- package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +118 -0
- package/project/.sdk/tm/kotlin/feature/TestFeature.kt +306 -0
- package/project/.sdk/tm/kotlin/feature/TimeoutFeature.kt +74 -0
- package/project/.sdk/tm/kotlin/src/feature/README.md +1 -0
- package/project/.sdk/tm/kotlin/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/test/CustomUtilityTest.kt +51 -0
- package/project/.sdk/tm/kotlin/test/ExistsTest.kt +15 -0
- package/project/.sdk/tm/kotlin/test/FeatureHarness.kt +380 -0
- package/project/.sdk/tm/kotlin/test/FeatureTest.kt +924 -0
- package/project/.sdk/tm/kotlin/test/NetsimTest.kt +50 -0
- package/project/.sdk/tm/kotlin/test/PipelineTest.kt +556 -0
- package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +829 -0
- package/project/.sdk/tm/kotlin/test/RunnerSupport.kt +477 -0
- package/project/.sdk/tm/kotlin/test/StructCorpusTest.kt +297 -0
- package/project/.sdk/tm/kotlin/test/StructRunner.kt +177 -0
- package/project/.sdk/tm/kotlin/test/sdk-test-control.json +19 -0
- package/project/.sdk/tm/kotlin/utility/CoreUtil.kt +96 -0
- package/project/.sdk/tm/kotlin/utility/FeatureUtil.kt +121 -0
- package/project/.sdk/tm/kotlin/utility/Fetcher.kt +156 -0
- package/project/.sdk/tm/kotlin/utility/Json.kt +237 -0
- package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +152 -0
- package/project/.sdk/tm/kotlin/utility/MakePoint.kt +108 -0
- package/project/.sdk/tm/kotlin/utility/MakeReqRes.kt +152 -0
- package/project/.sdk/tm/kotlin/utility/MakeSpecUrl.kt +142 -0
- package/project/.sdk/tm/kotlin/utility/Prepare.kt +236 -0
- package/project/.sdk/tm/kotlin/utility/Register.kt +39 -0
- package/project/.sdk/tm/kotlin/utility/ResultTransform.kt +109 -0
- package/project/.sdk/tm/kotlin/utility/struct/Struct.kt +2697 -0
- package/project/.sdk/tm/lua/feature/audit_feature.lua +132 -0
- package/project/.sdk/tm/lua/feature/cache_feature.lua +188 -0
- package/project/.sdk/tm/lua/feature/clienttrack_feature.lua +127 -0
- package/project/.sdk/tm/lua/feature/debug_feature.lua +194 -0
- package/project/.sdk/tm/lua/feature/idempotency_feature.lua +127 -0
- package/project/.sdk/tm/lua/feature/metrics_feature.lua +135 -0
- package/project/.sdk/tm/lua/feature/netsim_feature.lua +205 -0
- package/project/.sdk/tm/lua/feature/paging_feature.lua +180 -0
- package/project/.sdk/tm/lua/feature/proxy_feature.lua +147 -0
- package/project/.sdk/tm/lua/feature/ratelimit_feature.lua +120 -0
- package/project/.sdk/tm/lua/feature/rbac_feature.lua +141 -0
- package/project/.sdk/tm/lua/feature/retry_feature.lua +188 -0
- package/project/.sdk/tm/lua/feature/streaming_feature.lua +143 -0
- package/project/.sdk/tm/lua/feature/telemetry_feature.lua +159 -0
- package/project/.sdk/tm/lua/feature/test_feature.lua +85 -1
- package/project/.sdk/tm/lua/feature/timeout_feature.lua +94 -0
- package/project/.sdk/tm/lua/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/lua/test/feature_test.lua +1244 -0
- package/project/.sdk/tm/lua/test/netsim_test.lua +61 -0
- package/project/.sdk/tm/lua/test/pipeline_test.lua +613 -0
- package/project/.sdk/tm/lua/utility/feature_add.lua +28 -1
- package/project/.sdk/tm/lua/utility/make_error.lua +9 -0
- package/project/.sdk/tm/lua/utility/make_options.lua +58 -0
- package/project/.sdk/tm/lua/utility/make_point.lua +8 -1
- package/project/.sdk/tm/ocaml/LICENSE +21 -0
- package/project/.sdk/tm/ocaml/Makefile +58 -0
- package/project/.sdk/tm/ocaml/VERSION +1 -0
- package/project/.sdk/tm/ocaml/sdk_features.ml +1127 -0
- package/project/.sdk/tm/ocaml/sdk_helpers.ml +110 -0
- package/project/.sdk/tm/ocaml/sdk_runtime.ml +942 -0
- package/project/.sdk/tm/ocaml/sdk_types.ml +259 -0
- package/project/.sdk/tm/ocaml/src/feature/README.md +1 -0
- package/project/.sdk/tm/ocaml/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/test/custom_utility.ml +30 -0
- package/project/.sdk/tm/ocaml/test/harness.ml +198 -0
- package/project/.sdk/tm/ocaml/test/struct_corpus.ml +487 -0
- package/project/.sdk/tm/ocaml/test/t_feature.ml +533 -0
- package/project/.sdk/tm/ocaml/test/t_main.ml +5 -0
- package/project/.sdk/tm/ocaml/test/t_pipeline.ml +354 -0
- package/project/.sdk/tm/ocaml/test/testutil.ml +57 -0
- package/project/.sdk/tm/ocaml/utility/voxgig_struct.ml +1858 -0
- package/project/.sdk/tm/ocaml/utility/vregex.ml +254 -0
- package/project/.sdk/tm/perl/LICENSE +22 -0
- package/project/.sdk/tm/perl/Makefile +57 -0
- package/project/.sdk/tm/perl/core/context.pm +138 -0
- package/project/.sdk/tm/perl/core/control.pm +22 -0
- package/project/.sdk/tm/perl/core/error.pm +30 -0
- package/project/.sdk/tm/perl/core/helpers.pm +142 -0
- package/project/.sdk/tm/perl/core/operation.pm +47 -0
- package/project/.sdk/tm/perl/core/response.pm +40 -0
- package/project/.sdk/tm/perl/core/result.pm +45 -0
- package/project/.sdk/tm/perl/core/spec.pm +33 -0
- package/project/.sdk/tm/perl/core/utility_type.pm +32 -0
- package/project/.sdk/tm/perl/feature/audit_feature.pm +128 -0
- package/project/.sdk/tm/perl/feature/base_feature.pm +41 -0
- package/project/.sdk/tm/perl/feature/cache_feature.pm +168 -0
- package/project/.sdk/tm/perl/feature/clienttrack_feature.pm +126 -0
- package/project/.sdk/tm/perl/feature/debug_feature.pm +168 -0
- package/project/.sdk/tm/perl/feature/idempotency_feature.pm +104 -0
- package/project/.sdk/tm/perl/feature/log_feature.pm +77 -0
- package/project/.sdk/tm/perl/feature/metrics_feature.pm +124 -0
- package/project/.sdk/tm/perl/feature/netsim_feature.pm +215 -0
- package/project/.sdk/tm/perl/feature/paging_feature.pm +158 -0
- package/project/.sdk/tm/perl/feature/proxy_feature.pm +128 -0
- package/project/.sdk/tm/perl/feature/ratelimit_feature.pm +126 -0
- package/project/.sdk/tm/perl/feature/rbac_feature.pm +124 -0
- package/project/.sdk/tm/perl/feature/retry_feature.pm +153 -0
- package/project/.sdk/tm/perl/feature/streaming_feature.pm +112 -0
- package/project/.sdk/tm/perl/feature/telemetry_feature.pm +155 -0
- package/project/.sdk/tm/perl/feature/test_feature.pm +314 -0
- package/project/.sdk/tm/perl/feature/timeout_feature.pm +110 -0
- package/project/.sdk/tm/perl/lib/Voxgig/Struct.pm +2897 -0
- package/project/.sdk/tm/perl/src/feature/README.md +3 -0
- package/project/.sdk/tm/perl/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/perl/t/feature.t +1054 -0
- package/project/.sdk/tm/perl/t/netsim.t +55 -0
- package/project/.sdk/tm/perl/t/pipeline.t +632 -0
- package/project/.sdk/tm/perl/t/primary_utility.t +1023 -0
- package/project/.sdk/tm/perl/t/runner.pm +140 -0
- package/project/.sdk/tm/perl/t/sdk-test-control.json +19 -0
- package/project/.sdk/tm/perl/t/stream.t +132 -0
- package/project/.sdk/tm/perl/t/struct_runner.pm +275 -0
- package/project/.sdk/tm/perl/t/struct_utility.t +438 -0
- package/project/.sdk/tm/perl/utility/clean.pm +15 -0
- package/project/.sdk/tm/perl/utility/done.pm +34 -0
- package/project/.sdk/tm/perl/utility/feature_add.pm +47 -0
- package/project/.sdk/tm/perl/utility/feature_hook.pm +25 -0
- package/project/.sdk/tm/perl/utility/feature_init.pm +33 -0
- package/project/.sdk/tm/perl/utility/fetcher.pm +112 -0
- package/project/.sdk/tm/perl/utility/make_context.pm +22 -0
- package/project/.sdk/tm/perl/utility/make_error.pm +74 -0
- package/project/.sdk/tm/perl/utility/make_fetch_def.pm +46 -0
- package/project/.sdk/tm/perl/utility/make_options.pm +123 -0
- package/project/.sdk/tm/perl/utility/make_point.pm +104 -0
- package/project/.sdk/tm/perl/utility/make_request.pm +66 -0
- package/project/.sdk/tm/perl/utility/make_response.pm +38 -0
- package/project/.sdk/tm/perl/utility/make_result.pm +53 -0
- package/project/.sdk/tm/perl/utility/make_spec.pm +71 -0
- package/project/.sdk/tm/perl/utility/make_url.pm +63 -0
- package/project/.sdk/tm/perl/utility/param.pm +65 -0
- package/project/.sdk/tm/perl/utility/prepare_auth.pm +56 -0
- package/project/.sdk/tm/perl/utility/prepare_body.pm +17 -0
- package/project/.sdk/tm/perl/utility/prepare_headers.pm +27 -0
- package/project/.sdk/tm/perl/utility/prepare_method.pm +25 -0
- package/project/.sdk/tm/perl/utility/prepare_params.pm +41 -0
- package/project/.sdk/tm/perl/utility/prepare_path.pm +29 -0
- package/project/.sdk/tm/perl/utility/prepare_query.pm +40 -0
- package/project/.sdk/tm/perl/utility/register.pm +53 -0
- package/project/.sdk/tm/perl/utility/result_basic.pm +38 -0
- package/project/.sdk/tm/perl/utility/result_body.pm +28 -0
- package/project/.sdk/tm/perl/utility/result_headers.pm +32 -0
- package/project/.sdk/tm/perl/utility/transform_request.pm +30 -0
- package/project/.sdk/tm/perl/utility/transform_response.pm +43 -0
- package/project/.sdk/tm/php/core/Result.php +10 -0
- package/project/.sdk/tm/php/feature/AuditFeature.php +125 -0
- package/project/.sdk/tm/php/feature/BaseFeature.php +6 -0
- package/project/.sdk/tm/php/feature/CacheFeature.php +158 -0
- package/project/.sdk/tm/php/feature/ClienttrackFeature.php +126 -0
- package/project/.sdk/tm/php/feature/DebugFeature.php +167 -0
- package/project/.sdk/tm/php/feature/IdempotencyFeature.php +102 -0
- package/project/.sdk/tm/php/feature/MetricsFeature.php +122 -0
- package/project/.sdk/tm/php/feature/NetsimFeature.php +190 -0
- package/project/.sdk/tm/php/feature/PagingFeature.php +153 -0
- package/project/.sdk/tm/php/feature/ProxyFeature.php +136 -0
- package/project/.sdk/tm/php/feature/RatelimitFeature.php +116 -0
- package/project/.sdk/tm/php/feature/RbacFeature.php +133 -0
- package/project/.sdk/tm/php/feature/RetryFeature.php +159 -0
- package/project/.sdk/tm/php/feature/StreamingFeature.php +107 -0
- package/project/.sdk/tm/php/feature/TelemetryFeature.php +156 -0
- package/project/.sdk/tm/php/feature/TestFeature.php +80 -1
- package/project/.sdk/tm/php/feature/TimeoutFeature.php +95 -0
- package/project/.sdk/tm/php/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/php/test/FeatureTest.php +1259 -0
- package/project/.sdk/tm/php/test/NetsimTest.php +53 -0
- package/project/.sdk/tm/php/test/PipelineTest.php +674 -0
- package/project/.sdk/tm/php/utility/FeatureAdd.php +32 -1
- package/project/.sdk/tm/php/utility/MakeError.php +9 -0
- package/project/.sdk/tm/php/utility/MakeOptions.php +46 -0
- package/project/.sdk/tm/php/utility/MakePoint.php +7 -0
- package/project/.sdk/tm/py/core/context.py +4 -0
- package/project/.sdk/tm/py/core/control.py +3 -0
- package/project/.sdk/tm/py/feature/audit_feature.py +98 -0
- package/project/.sdk/tm/py/feature/cache_feature.py +138 -0
- package/project/.sdk/tm/py/feature/clienttrack_feature.py +97 -0
- package/project/.sdk/tm/py/feature/debug_feature.py +134 -0
- package/project/.sdk/tm/py/feature/idempotency_feature.py +89 -0
- package/project/.sdk/tm/py/feature/metrics_feature.py +93 -0
- package/project/.sdk/tm/py/feature/netsim_feature.py +170 -0
- package/project/.sdk/tm/py/feature/paging_feature.py +134 -0
- package/project/.sdk/tm/py/feature/proxy_feature.py +104 -0
- package/project/.sdk/tm/py/feature/ratelimit_feature.py +98 -0
- package/project/.sdk/tm/py/feature/rbac_feature.py +102 -0
- package/project/.sdk/tm/py/feature/retry_feature.py +142 -0
- package/project/.sdk/tm/py/feature/streaming_feature.py +84 -0
- package/project/.sdk/tm/py/feature/telemetry_feature.py +128 -0
- package/project/.sdk/tm/py/feature/test_feature.py +70 -1
- package/project/.sdk/tm/py/feature/timeout_feature.py +78 -0
- package/project/.sdk/tm/py/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/py/test/feature_harness.py +336 -0
- package/project/.sdk/tm/py/test/test_feature.py +807 -0
- package/project/.sdk/tm/py/test/test_netsim.py +52 -0
- package/project/.sdk/tm/py/test/test_pipeline.py +606 -0
- package/project/.sdk/tm/py/utility/feature_add.py +25 -1
- package/project/.sdk/tm/py/utility/make_error.py +8 -0
- package/project/.sdk/tm/py/utility/make_options.py +32 -0
- package/project/.sdk/tm/py/utility/make_point.py +8 -2
- package/project/.sdk/tm/py/utility/make_request.py +6 -2
- package/project/.sdk/tm/py/utility/make_response.py +6 -2
- package/project/.sdk/tm/py/utility/make_result.py +6 -2
- package/project/.sdk/tm/py/utility/make_spec.py +6 -2
- package/project/.sdk/tm/rb/core/context.rb +2 -0
- package/project/.sdk/tm/rb/core/control.rb +5 -1
- package/project/.sdk/tm/rb/core/result.rb +2 -1
- package/project/.sdk/tm/rb/feature/audit_feature.rb +103 -0
- package/project/.sdk/tm/rb/feature/base_feature.rb +5 -0
- package/project/.sdk/tm/rb/feature/cache_feature.rb +133 -0
- package/project/.sdk/tm/rb/feature/clienttrack_feature.rb +91 -0
- package/project/.sdk/tm/rb/feature/debug_feature.rb +138 -0
- package/project/.sdk/tm/rb/feature/idempotency_feature.rb +78 -0
- package/project/.sdk/tm/rb/feature/metrics_feature.rb +91 -0
- package/project/.sdk/tm/rb/feature/netsim_feature.rb +167 -0
- package/project/.sdk/tm/rb/feature/paging_feature.rb +120 -0
- package/project/.sdk/tm/rb/feature/proxy_feature.rb +93 -0
- package/project/.sdk/tm/rb/feature/ratelimit_feature.rb +95 -0
- package/project/.sdk/tm/rb/feature/rbac_feature.rb +96 -0
- package/project/.sdk/tm/rb/feature/retry_feature.rb +116 -0
- package/project/.sdk/tm/rb/feature/streaming_feature.rb +85 -0
- package/project/.sdk/tm/rb/feature/telemetry_feature.rb +122 -0
- package/project/.sdk/tm/rb/feature/test_feature.rb +65 -1
- package/project/.sdk/tm/rb/feature/timeout_feature.rb +74 -0
- package/project/.sdk/tm/rb/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/rb/test/feature_test.rb +1031 -0
- package/project/.sdk/tm/rb/test/netsim_test.rb +48 -0
- package/project/.sdk/tm/rb/test/pipeline_test.rb +584 -0
- package/project/.sdk/tm/rb/utility/feature_add.rb +28 -1
- package/project/.sdk/tm/rb/utility/make_error.rb +8 -0
- package/project/.sdk/tm/rb/utility/make_options.rb +35 -0
- package/project/.sdk/tm/rb/utility/make_point.rb +7 -1
- package/project/.sdk/tm/rust/LICENSE +22 -0
- package/project/.sdk/tm/rust/Makefile +41 -0
- package/project/.sdk/tm/rust/VERSION +1 -0
- package/project/.sdk/tm/rust/core/context.rs +320 -0
- package/project/.sdk/tm/rust/core/control.rs +37 -0
- package/project/.sdk/tm/rust/core/helpers.rs +168 -0
- package/project/.sdk/tm/rust/core/mod.rs +18 -0
- package/project/.sdk/tm/rust/core/operation.rs +35 -0
- package/project/.sdk/tm/rust/core/point.rs +68 -0
- package/project/.sdk/tm/rust/core/response.rs +38 -0
- package/project/.sdk/tm/rust/core/result.rs +90 -0
- package/project/.sdk/tm/rust/core/spec.rs +109 -0
- package/project/.sdk/tm/rust/core/types.rs +105 -0
- package/project/.sdk/tm/rust/core/utility_type.rs +184 -0
- package/project/.sdk/tm/rust/feature/audit.rs +138 -0
- package/project/.sdk/tm/rust/feature/base.rs +49 -0
- package/project/.sdk/tm/rust/feature/cache.rs +198 -0
- package/project/.sdk/tm/rust/feature/clienttrack.rs +154 -0
- package/project/.sdk/tm/rust/feature/debug.rs +188 -0
- package/project/.sdk/tm/rust/feature/idempotency.rs +139 -0
- package/project/.sdk/tm/rust/feature/log.rs +114 -0
- package/project/.sdk/tm/rust/feature/metrics.rs +136 -0
- package/project/.sdk/tm/rust/feature/mod.rs +24 -0
- package/project/.sdk/tm/rust/feature/netsim.rs +233 -0
- package/project/.sdk/tm/rust/feature/paging.rs +209 -0
- package/project/.sdk/tm/rust/feature/proxy.rs +165 -0
- package/project/.sdk/tm/rust/feature/ratelimit.rs +116 -0
- package/project/.sdk/tm/rust/feature/rbac.rs +152 -0
- package/project/.sdk/tm/rust/feature/retry.rs +190 -0
- package/project/.sdk/tm/rust/feature/streaming.rs +124 -0
- package/project/.sdk/tm/rust/feature/support.rs +145 -0
- package/project/.sdk/tm/rust/feature/telemetry.rs +185 -0
- package/project/.sdk/tm/rust/feature/test.rs +397 -0
- package/project/.sdk/tm/rust/feature/timeout.rs +103 -0
- package/project/.sdk/tm/rust/src/feature/README.md +1 -0
- package/project/.sdk/tm/rust/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/rust/tests/common/mod.rs +969 -0
- package/project/.sdk/tm/rust/tests/custom_utility_test.rs +69 -0
- package/project/.sdk/tm/rust/tests/feature_test.rs +1864 -0
- package/project/.sdk/tm/rust/tests/netsim_test.rs +78 -0
- package/project/.sdk/tm/rust/tests/pipeline_test.rs +699 -0
- package/project/.sdk/tm/rust/tests/primary_utility_test.rs +999 -0
- package/project/.sdk/tm/rust/tests/sdk-test-control.json +19 -0
- package/project/.sdk/tm/rust/tests/struct_runner/mod.rs +424 -0
- package/project/.sdk/tm/rust/tests/struct_utility_test.rs +733 -0
- package/project/.sdk/tm/rust/utility/clean.rs +13 -0
- package/project/.sdk/tm/rust/utility/done.rs +31 -0
- package/project/.sdk/tm/rust/utility/feature_add.rs +46 -0
- package/project/.sdk/tm/rust/utility/feature_hook.rs +18 -0
- package/project/.sdk/tm/rust/utility/feature_init.rs +26 -0
- package/project/.sdk/tm/rust/utility/fetcher.rs +142 -0
- package/project/.sdk/tm/rust/utility/jsonparse.rs +211 -0
- package/project/.sdk/tm/rust/utility/make_context.rs +7 -0
- package/project/.sdk/tm/rust/utility/make_error.rs +79 -0
- package/project/.sdk/tm/rust/utility/make_fetch_def.rs +42 -0
- package/project/.sdk/tm/rust/utility/make_options.rs +175 -0
- package/project/.sdk/tm/rust/utility/make_point.rs +116 -0
- package/project/.sdk/tm/rust/utility/make_request.rs +73 -0
- package/project/.sdk/tm/rust/utility/make_response.rs +56 -0
- package/project/.sdk/tm/rust/utility/make_result.rs +64 -0
- package/project/.sdk/tm/rust/utility/make_spec.rs +70 -0
- package/project/.sdk/tm/rust/utility/make_url.rs +83 -0
- package/project/.sdk/tm/rust/utility/mod.rs +36 -0
- package/project/.sdk/tm/rust/utility/param.rs +67 -0
- package/project/.sdk/tm/rust/utility/prepare_auth.rs +65 -0
- package/project/.sdk/tm/rust/utility/prepare_body.rs +14 -0
- package/project/.sdk/tm/rust/utility/prepare_headers.rs +23 -0
- package/project/.sdk/tm/rust/utility/prepare_method.rs +18 -0
- package/project/.sdk/tm/rust/utility/prepare_params.rs +33 -0
- package/project/.sdk/tm/rust/utility/prepare_path.rs +17 -0
- package/project/.sdk/tm/rust/utility/prepare_query.rs +47 -0
- package/project/.sdk/tm/rust/utility/result_basic.rs +35 -0
- package/project/.sdk/tm/rust/utility/result_body.rs +26 -0
- package/project/.sdk/tm/rust/utility/result_headers.rs +24 -0
- package/project/.sdk/tm/rust/utility/transform_request.rs +31 -0
- package/project/.sdk/tm/rust/utility/transform_response.rs +55 -0
- package/project/.sdk/tm/rust/utility/voxgigstruct/consts.rs +122 -0
- package/project/.sdk/tm/rust/utility/voxgigstruct/major.rs +2688 -0
- package/project/.sdk/tm/rust/utility/voxgigstruct/mini.rs +1081 -0
- package/project/.sdk/tm/rust/utility/voxgigstruct/mod.rs +70 -0
- package/project/.sdk/tm/rust/utility/voxgigstruct/ordered_map.rs +159 -0
- package/project/.sdk/tm/rust/utility/voxgigstruct/re.rs +1229 -0
- package/project/.sdk/tm/rust/utility/voxgigstruct/value.rs +372 -0
- package/project/.sdk/tm/scala/LICENSE +22 -0
- package/project/.sdk/tm/scala/Makefile +24 -0
- package/project/.sdk/tm/scala/VERSION +1 -0
- package/project/.sdk/tm/scala/core/Context.scala +160 -0
- package/project/.sdk/tm/scala/core/Contracts.scala +76 -0
- package/project/.sdk/tm/scala/core/Control.scala +23 -0
- package/project/.sdk/tm/scala/core/Helpers.scala +38 -0
- package/project/.sdk/tm/scala/core/Operation.scala +37 -0
- package/project/.sdk/tm/scala/core/Point.scala +44 -0
- package/project/.sdk/tm/scala/core/Response.scala +37 -0
- package/project/.sdk/tm/scala/core/Result.scala +42 -0
- package/project/.sdk/tm/scala/core/SdkClient.scala +220 -0
- package/project/.sdk/tm/scala/core/SdkError.scala +15 -0
- package/project/.sdk/tm/scala/core/Spec.scala +39 -0
- package/project/.sdk/tm/scala/core/Types.scala +31 -0
- package/project/.sdk/tm/scala/core/Utility.scala +85 -0
- package/project/.sdk/tm/scala/feature/AuditFeature.scala +101 -0
- package/project/.sdk/tm/scala/feature/BaseFeature.scala +21 -0
- package/project/.sdk/tm/scala/feature/CacheFeature.scala +181 -0
- package/project/.sdk/tm/scala/feature/ClienttrackFeature.scala +93 -0
- package/project/.sdk/tm/scala/feature/DebugFeature.scala +149 -0
- package/project/.sdk/tm/scala/feature/FeatureOptions.scala +111 -0
- package/project/.sdk/tm/scala/feature/IdempotencyFeature.scala +106 -0
- package/project/.sdk/tm/scala/feature/LogFeature.scala +64 -0
- package/project/.sdk/tm/scala/feature/MetricsFeature.scala +105 -0
- package/project/.sdk/tm/scala/feature/NetsimFeature.scala +134 -0
- package/project/.sdk/tm/scala/feature/PagingFeature.scala +170 -0
- package/project/.sdk/tm/scala/feature/ProxyFeature.scala +113 -0
- package/project/.sdk/tm/scala/feature/RatelimitFeature.scala +58 -0
- package/project/.sdk/tm/scala/feature/RbacFeature.scala +90 -0
- package/project/.sdk/tm/scala/feature/RetryFeature.scala +104 -0
- package/project/.sdk/tm/scala/feature/StreamingFeature.scala +98 -0
- package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +129 -0
- package/project/.sdk/tm/scala/feature/TestFeature.scala +253 -0
- package/project/.sdk/tm/scala/feature/TimeoutFeature.scala +57 -0
- package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +766 -0
- package/project/.sdk/tm/scala/sdktest/SdkTestSupport.scala +93 -0
- package/project/.sdk/tm/scala/sdktest/StructCorpus.scala +0 -0
- package/project/.sdk/tm/scala/sdktest/sdk-test-control.json +19 -0
- package/project/.sdk/tm/scala/src/feature/README.md +1 -0
- package/project/.sdk/tm/scala/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/scala/utility/FeatureUtils.scala +68 -0
- package/project/.sdk/tm/scala/utility/Fetcher.scala +129 -0
- package/project/.sdk/tm/scala/utility/Json.java +268 -0
- package/project/.sdk/tm/scala/utility/Make.scala +463 -0
- package/project/.sdk/tm/scala/utility/MakeSpec.scala +49 -0
- package/project/.sdk/tm/scala/utility/Misc.scala +68 -0
- package/project/.sdk/tm/scala/utility/Prepare.scala +142 -0
- package/project/.sdk/tm/scala/utility/Register.scala +38 -0
- package/project/.sdk/tm/scala/utility/Results.scala +63 -0
- package/project/.sdk/tm/scala/utility/StructUtility.scala +29 -0
- package/project/.sdk/tm/scala/utility/Transform.scala +52 -0
- package/project/.sdk/tm/scala/utility/struct/Struct.java +3550 -0
- package/project/.sdk/tm/scala/utility/struct/voxgig_struct.scala +1833 -0
- package/project/.sdk/tm/swift/LICENSE +22 -0
- package/project/.sdk/tm/swift/Makefile +41 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Constants.swift +113 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Inject.swift +260 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Injection.swift +111 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/JSON.swift +327 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Merge.swift +55 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Minor.swift +601 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/OrderedDictionary.swift +79 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Path.swift +157 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Select.swift +259 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Transform.swift +462 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Validate.swift +378 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Value.swift +184 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Walk.swift +44 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +161 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Control.swift +20 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Operation.swift +27 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Point.swift +37 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Response.swift +29 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Result.swift +41 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Spec.swift +36 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Support.swift +98 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Types.swift +25 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Utility.swift +81 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +99 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/BaseFeature.swift +60 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/CacheFeature.swift +164 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/ClienttrackFeature.swift +95 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/DebugFeature.swift +126 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/FeatureOptions.swift +96 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/IdempotencyFeature.swift +80 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/LogFeature.swift +69 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/MetricsFeature.swift +103 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/NetsimFeature.swift +177 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/PagingFeature.swift +154 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/ProxyFeature.swift +122 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RatelimitFeature.swift +79 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RbacFeature.swift +103 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RetryFeature.swift +150 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/StreamingFeature.swift +82 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +119 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TestFeature.swift +257 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TimeoutFeature.swift +83 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Feature.swift +56 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Fetcher.swift +107 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Make.swift +321 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeError.swift +56 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +151 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Prepare.swift +157 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Register.swift +40 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +107 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/CustomUtilityTest.swift +44 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/ExistsTest.swift +12 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +1049 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/NetsimTest.swift +50 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PipelineTest.swift +398 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PrimaryUtilityTest.swift +750 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/Runner.swift +237 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/StructUtilityTest.swift +523 -0
- package/project/.sdk/tm/swift/VERSION +1 -0
- package/project/.sdk/tm/swift/src/feature/README.md +6 -0
- package/project/.sdk/tm/swift/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/ts/Makefile +6 -1
- package/project/.sdk/tm/ts/src/feature/audit/AuditFeature.ts +98 -0
- package/project/.sdk/tm/ts/src/feature/cache/CacheFeature.ts +152 -0
- package/project/.sdk/tm/ts/src/feature/clienttrack/ClienttrackFeature.ts +106 -0
- package/project/.sdk/tm/ts/src/feature/debug/DebugFeature.ts +134 -0
- package/project/.sdk/tm/ts/src/feature/idempotency/IdempotencyFeature.ts +97 -0
- package/project/.sdk/tm/ts/src/feature/metrics/MetricsFeature.ts +104 -0
- package/project/.sdk/tm/ts/src/feature/netsim/NetsimFeature.ts +189 -0
- package/project/.sdk/tm/ts/src/feature/paging/PagingFeature.ts +141 -0
- package/project/.sdk/tm/ts/src/feature/proxy/ProxyFeature.ts +112 -0
- package/project/.sdk/tm/ts/src/feature/ratelimit/RatelimitFeature.ts +108 -0
- package/project/.sdk/tm/ts/src/feature/rbac/RbacFeature.ts +104 -0
- package/project/.sdk/tm/ts/src/feature/retry/RetryFeature.ts +160 -0
- package/project/.sdk/tm/ts/src/feature/streaming/StreamingFeature.ts +98 -0
- package/project/.sdk/tm/ts/src/feature/telemetry/TelemetryFeature.ts +130 -0
- package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +58 -1
- package/project/.sdk/tm/ts/src/feature/timeout/TimeoutFeature.ts +103 -0
- package/project/.sdk/tm/ts/src/utility/FeatureHookUtility.ts +4 -1
- package/project/.sdk/tm/ts/src/utility/MakeErrorUtility.ts +9 -0
- package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +31 -1
- package/project/.sdk/tm/ts/test/feature/harness.ts +293 -0
- package/project/.sdk/tm/ts/test/feature.test.ts +772 -0
- package/project/.sdk/tm/ts/test/netsim.test.ts +43 -0
- package/project/.sdk/tm/ts/test/pipeline.test.ts +382 -0
- package/project/.sdk/tm/zig/LICENSE +21 -0
- package/project/.sdk/tm/zig/Makefile +31 -0
- package/project/.sdk/tm/zig/VERSION +1 -0
- package/project/.sdk/tm/zig/build.zig +58 -0
- package/project/.sdk/tm/zig/build.zig.zon +11 -0
- package/project/.sdk/tm/zig/core/context.zig +258 -0
- package/project/.sdk/tm/zig/core/control.zig +26 -0
- package/project/.sdk/tm/zig/core/error.zig +28 -0
- package/project/.sdk/tm/zig/core/helpers.zig +326 -0
- package/project/.sdk/tm/zig/core/mem.zig +20 -0
- package/project/.sdk/tm/zig/core/operation.zig +34 -0
- package/project/.sdk/tm/zig/core/point.zig +63 -0
- package/project/.sdk/tm/zig/core/response.zig +32 -0
- package/project/.sdk/tm/zig/core/result.zig +73 -0
- package/project/.sdk/tm/zig/core/spec.zig +68 -0
- package/project/.sdk/tm/zig/core/types.zig +101 -0
- package/project/.sdk/tm/zig/core/utility.zig +1115 -0
- package/project/.sdk/tm/zig/feature/audit.zig +131 -0
- package/project/.sdk/tm/zig/feature/base.zig +52 -0
- package/project/.sdk/tm/zig/feature/cache.zig +216 -0
- package/project/.sdk/tm/zig/feature/clienttrack.zig +129 -0
- package/project/.sdk/tm/zig/feature/debug.zig +191 -0
- package/project/.sdk/tm/zig/feature/idempotency.zig +121 -0
- package/project/.sdk/tm/zig/feature/log.zig +93 -0
- package/project/.sdk/tm/zig/feature/metrics.zig +145 -0
- package/project/.sdk/tm/zig/feature/netsim.zig +186 -0
- package/project/.sdk/tm/zig/feature/paging.zig +201 -0
- package/project/.sdk/tm/zig/feature/proxy.zig +180 -0
- package/project/.sdk/tm/zig/feature/ratelimit.zig +123 -0
- package/project/.sdk/tm/zig/feature/rbac.zig +126 -0
- package/project/.sdk/tm/zig/feature/retry.zig +167 -0
- package/project/.sdk/tm/zig/feature/streaming.zig +127 -0
- package/project/.sdk/tm/zig/feature/support.zig +128 -0
- package/project/.sdk/tm/zig/feature/telemetry.zig +165 -0
- package/project/.sdk/tm/zig/feature/test.zig +315 -0
- package/project/.sdk/tm/zig/feature/timeout.zig +105 -0
- package/project/.sdk/tm/zig/root.zig +74 -0
- package/project/.sdk/tm/zig/src/feature/README.md +1 -0
- package/project/.sdk/tm/zig/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/zig/test/feature_test.zig +1045 -0
- package/project/.sdk/tm/zig/test/fh.zig +531 -0
- package/project/.sdk/tm/zig/test/gotcha_test.zig +230 -0
- package/project/.sdk/tm/zig/test/pipeline_test.zig +493 -0
- package/project/.sdk/tm/zig/test/primary_utility_test.zig +346 -0
- package/project/.sdk/tm/zig/test/struct_corpus.zig +1145 -0
- package/project/.sdk/tm/zig/test/struct_runner.zig +226 -0
- package/project/.sdk/tm/zig/utility/jsonparse.zig +13 -0
- package/project/.sdk/tm/zig/utility/voxgigstruct/regex.zig +779 -0
- package/project/.sdk/tm/zig/utility/voxgigstruct/struct.zig +4400 -0
|
@@ -0,0 +1,3582 @@
|
|
|
1
|
+
/* Copyright (c) 2025-2026 Voxgig Ltd. MIT LICENSE. */
|
|
2
|
+
|
|
3
|
+
// Vendored from github.com/voxgig/struct csharp/Struct.cs — do not edit here;
|
|
4
|
+
// upstream is the canonical source.
|
|
5
|
+
|
|
6
|
+
// VERSION: @voxgig/struct 0.0.10
|
|
7
|
+
|
|
8
|
+
/* Voxgig Struct
|
|
9
|
+
* =============
|
|
10
|
+
*
|
|
11
|
+
* Utility functions to manipulate in-memory JSON-like data
|
|
12
|
+
* structures. These structures assumed to be composed of nested
|
|
13
|
+
* "nodes", where a node is a list or map, and has named or indexed
|
|
14
|
+
* fields. The general design principle is "by-example". Transform
|
|
15
|
+
* specifications mirror the desired output. This implementation is
|
|
16
|
+
* designed for porting to multiple language, and to be tolerant of
|
|
17
|
+
* undefined values.
|
|
18
|
+
*
|
|
19
|
+
* Main utilities
|
|
20
|
+
* - GetPath: get the value at a key path deep inside an object.
|
|
21
|
+
* - Merge: merge multiple nodes, overriding values in earlier nodes.
|
|
22
|
+
* - Walk: walk a node tree, applying a function at each node and leaf.
|
|
23
|
+
* - Inject: inject values from a data store into a new data structure.
|
|
24
|
+
* - Transform: transform a data structure to an example structure.
|
|
25
|
+
* - Validate: validate a data structure against a shape specification.
|
|
26
|
+
*
|
|
27
|
+
* Minor utilities
|
|
28
|
+
* - IsNode, IsMap, IsKey, IsList, IsFunc: identify value kinds.
|
|
29
|
+
* - IsEmpty: undefined values, or empty nodes.
|
|
30
|
+
* - KeysOf: sorted list of node keys (ascending).
|
|
31
|
+
* - HasKey: true if key value is defined.
|
|
32
|
+
* - Clone: create a copy of a JSON-like data structure.
|
|
33
|
+
* - Items: list entries of a map or list as [key, value] pairs.
|
|
34
|
+
* - GetProp: safely get a property value by key.
|
|
35
|
+
* - SetProp: safely set a property value by key.
|
|
36
|
+
* - Stringify: human-friendly string version of a value.
|
|
37
|
+
* - EscRe: escape a regular expression string.
|
|
38
|
+
* - EscUrl: escape a url.
|
|
39
|
+
* - Join: join parts of a string, merging sep chars as needed.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
using System.Globalization;
|
|
43
|
+
using System.Text.Json;
|
|
44
|
+
using System.Text.RegularExpressions;
|
|
45
|
+
|
|
46
|
+
namespace Voxgig.Struct
|
|
47
|
+
{
|
|
48
|
+
|
|
49
|
+
// Type bit-flags (matching TypeScript).
|
|
50
|
+
public static class T
|
|
51
|
+
{
|
|
52
|
+
private static int _t = 31;
|
|
53
|
+
public static readonly int Any = (1 << _t--) - 1;
|
|
54
|
+
public static readonly int NoVal = 1 << _t--;
|
|
55
|
+
public static readonly int Boolean = 1 << _t--;
|
|
56
|
+
public static readonly int Decimal = 1 << _t--;
|
|
57
|
+
public static readonly int Integer = 1 << _t--;
|
|
58
|
+
public static readonly int Number = 1 << _t--;
|
|
59
|
+
public static readonly int Str = 1 << _t--;
|
|
60
|
+
public static readonly int Func = 1 << _t--;
|
|
61
|
+
public static readonly int Symbol = 1 << _t--;
|
|
62
|
+
public static readonly int Null = 1 << _t--;
|
|
63
|
+
|
|
64
|
+
static T() { _t -= 7; }
|
|
65
|
+
|
|
66
|
+
private static int _t2 = 31 - 10 - 7;
|
|
67
|
+
public static readonly int List = 1 << (_t2--);
|
|
68
|
+
public static readonly int Map = 1 << (_t2--);
|
|
69
|
+
public static readonly int Instance = 1 << (_t2--);
|
|
70
|
+
|
|
71
|
+
private static int _t3 = 31 - 10 - 7 - 3 - 4;
|
|
72
|
+
public static readonly int Scalar = 1 << (_t3--);
|
|
73
|
+
public static readonly int Node = 1 << (_t3--);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
/// <summary>
|
|
78
|
+
/// Callback invoked for each node visited by <see cref="StructUtils.Walk"/>.
|
|
79
|
+
/// </summary>
|
|
80
|
+
/// <remarks>
|
|
81
|
+
/// The <paramref name="path"/> argument is a single mutable list per depth,
|
|
82
|
+
/// shared across all callback invocations for the lifetime of the top-level
|
|
83
|
+
/// Walk call. Callbacks that need to retain the path MUST clone it
|
|
84
|
+
/// (e.g. <c>new List<object?>(path)</c> or <c>path.ToList()</c>);
|
|
85
|
+
/// otherwise its contents will be overwritten by subsequent visits.
|
|
86
|
+
/// </remarks>
|
|
87
|
+
public delegate object? WalkApply(object? key, object? val, object? parent, List<object?> path);
|
|
88
|
+
public delegate object? Modify(object? val, object? key, object? parent, object? inj, object? store);
|
|
89
|
+
public delegate object? Injector(InjectState inj, object? val, string? refStr, object? store);
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
public class InjectState
|
|
93
|
+
{
|
|
94
|
+
public int Mode { get; set; } // M_KEYPRE | M_KEYPOST | M_VAL
|
|
95
|
+
public bool Full { get; set; }
|
|
96
|
+
public int KeyI { get; set; }
|
|
97
|
+
public List<object?> Keys { get; set; } = [];
|
|
98
|
+
public string? Key { get; set; }
|
|
99
|
+
public object? Val { get; set; }
|
|
100
|
+
public object? Parent { get; set; }
|
|
101
|
+
public List<object?> Path { get; set; } = [];
|
|
102
|
+
public List<object?> Nodes { get; set; } = [];
|
|
103
|
+
public Injector? Handler { get; set; }
|
|
104
|
+
public List<object?>? Errs { get; set; }
|
|
105
|
+
public string? Base { get; set; }
|
|
106
|
+
public Modify? ModifyFn { get; set; }
|
|
107
|
+
public object? DParent { get; set; }
|
|
108
|
+
public List<object?> DPath { get; set; } = [];
|
|
109
|
+
public InjectState? Prior { get; set; }
|
|
110
|
+
public Dictionary<string, object?> Meta { get; set; } = [];
|
|
111
|
+
public object? Extra { get; set; }
|
|
112
|
+
public object? Root { get; set; }
|
|
113
|
+
|
|
114
|
+
public object? Descend()
|
|
115
|
+
{
|
|
116
|
+
if (!Meta.TryGetValue("__d", out object? value))
|
|
117
|
+
{
|
|
118
|
+
value = 0;
|
|
119
|
+
Meta["__d"] = value;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
Meta["__d"] = Convert.ToInt64(value, CultureInfo.InvariantCulture) + 1L;
|
|
123
|
+
|
|
124
|
+
object? parentkey = StructUtils.GetElem(Path, -2);
|
|
125
|
+
|
|
126
|
+
if (DParent == null)
|
|
127
|
+
{
|
|
128
|
+
if (StructUtils.Size(DPath) > 1)
|
|
129
|
+
{
|
|
130
|
+
DPath = [.. DPath, parentkey];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else
|
|
134
|
+
{
|
|
135
|
+
if (parentkey != null)
|
|
136
|
+
{
|
|
137
|
+
DParent = StructUtils.GetProp(DParent, parentkey);
|
|
138
|
+
string pkStr = StructUtils.StrKey(parentkey);
|
|
139
|
+
object? lastpart = StructUtils.GetElem(DPath, -1);
|
|
140
|
+
string? lastStr = lastpart as string;
|
|
141
|
+
DPath = lastStr == "$:" + pkStr ? ([.. DPath.Take(DPath.Count - 1)]) : ([.. DPath, parentkey]);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return DParent;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
public InjectState Child(int keyI, List<object?> keys)
|
|
149
|
+
{
|
|
150
|
+
string keyStr = StructUtils.StrKey(keys[keyI]);
|
|
151
|
+
// Parent / nodes must be the container (this.Val), not the child — same as TS
|
|
152
|
+
// cinj.parent = val; cinj.val = getprop(val, key). Object initializer Val is assigned first,
|
|
153
|
+
// so Parent = Val would wrongly use the child if written as a single block.
|
|
154
|
+
object? parentNode = Val;
|
|
155
|
+
var cinj = new InjectState
|
|
156
|
+
{
|
|
157
|
+
Mode = Mode,
|
|
158
|
+
Full = false,
|
|
159
|
+
KeyI = keyI,
|
|
160
|
+
Keys = keys,
|
|
161
|
+
Key = keyStr,
|
|
162
|
+
Val = StructUtils.GetProp(parentNode, keyStr),
|
|
163
|
+
Parent = parentNode,
|
|
164
|
+
Path = [.. Path, keyStr],
|
|
165
|
+
Nodes = [.. Nodes, parentNode],
|
|
166
|
+
Handler = Handler,
|
|
167
|
+
Errs = Errs,
|
|
168
|
+
Meta = Meta,
|
|
169
|
+
Base = Base,
|
|
170
|
+
ModifyFn = ModifyFn,
|
|
171
|
+
Prior = this,
|
|
172
|
+
DPath = [.. DPath],
|
|
173
|
+
DParent = DParent,
|
|
174
|
+
Extra = Extra,
|
|
175
|
+
Root = Root
|
|
176
|
+
};
|
|
177
|
+
return cinj;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
public object? SetVal(object? val, int ancestor = 0)
|
|
181
|
+
{
|
|
182
|
+
// Match TS: setval(NONE) deletes the key; null also deletes.
|
|
183
|
+
bool del = val == null || ReferenceEquals(val, StructUtils.NONE);
|
|
184
|
+
if (ancestor < 2)
|
|
185
|
+
{
|
|
186
|
+
if (del)
|
|
187
|
+
{
|
|
188
|
+
StructUtils.DelProp(Parent, Key);
|
|
189
|
+
}
|
|
190
|
+
else
|
|
191
|
+
{
|
|
192
|
+
StructUtils.SetProp(Parent, Key, val);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return Parent;
|
|
196
|
+
}
|
|
197
|
+
object? anode = StructUtils.GetElem(Nodes, -ancestor);
|
|
198
|
+
object? akey = StructUtils.GetElem(Path, -ancestor);
|
|
199
|
+
if (del)
|
|
200
|
+
{
|
|
201
|
+
StructUtils.DelProp(anode, akey);
|
|
202
|
+
}
|
|
203
|
+
else
|
|
204
|
+
{
|
|
205
|
+
StructUtils.SetProp(anode, akey, val);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return anode;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
public static partial class StructUtils
|
|
214
|
+
{
|
|
215
|
+
// Inject mode flags.
|
|
216
|
+
public const int M_KEYPRE = 1;
|
|
217
|
+
public const int M_KEYPOST = 2;
|
|
218
|
+
public const int M_VAL = 4;
|
|
219
|
+
|
|
220
|
+
// Special strings.
|
|
221
|
+
public const string S_BKEY = "`$KEY`";
|
|
222
|
+
public const string S_BANNO = "`$ANNO`";
|
|
223
|
+
public const string S_BEXACT = "`$EXACT`";
|
|
224
|
+
public const string S_BVAL = "`$VAL`";
|
|
225
|
+
public const string S_DKEY = "$KEY";
|
|
226
|
+
public const string S_DTOP = "$TOP";
|
|
227
|
+
public const string S_DERRS = "$ERRS";
|
|
228
|
+
public const string S_DSPEC = "$SPEC";
|
|
229
|
+
|
|
230
|
+
// General strings.
|
|
231
|
+
public const string S_list = "list";
|
|
232
|
+
public const string S_base = "base";
|
|
233
|
+
public const string S_boolean = "boolean";
|
|
234
|
+
public const string S_function = "function";
|
|
235
|
+
public const string S_number = "number";
|
|
236
|
+
public const string S_object = "object";
|
|
237
|
+
public const string S_string = "string";
|
|
238
|
+
public const string S_decimal = "decimal";
|
|
239
|
+
public const string S_integer = "integer";
|
|
240
|
+
public const string S_map = "map";
|
|
241
|
+
public const string S_scalar = "scalar";
|
|
242
|
+
public const string S_node = "node";
|
|
243
|
+
public const string S_instance = "instance";
|
|
244
|
+
public const string S_any = "any";
|
|
245
|
+
public const string S_nil = "nil";
|
|
246
|
+
public const string S_null = "null";
|
|
247
|
+
public const string S_key = "key";
|
|
248
|
+
|
|
249
|
+
// Character strings.
|
|
250
|
+
public const string S_BT = "`";
|
|
251
|
+
public const string S_CN = ":";
|
|
252
|
+
public const string S_CS = "]";
|
|
253
|
+
public const string S_DS = "$";
|
|
254
|
+
public const string S_DT = ".";
|
|
255
|
+
public const string S_FS = "/";
|
|
256
|
+
public const string S_KEY = "KEY";
|
|
257
|
+
public const string S_MT = "";
|
|
258
|
+
public const string S_OS = "[";
|
|
259
|
+
public const string S_SP = " ";
|
|
260
|
+
public const string S_CM = ",";
|
|
261
|
+
public const string S_VIZ = ": ";
|
|
262
|
+
|
|
263
|
+
// Cached JSON serializer options (avoid allocating per call - CA1869).
|
|
264
|
+
private static readonly JsonSerializerOptions JSON_OPTS_COMPACT = new()
|
|
265
|
+
{
|
|
266
|
+
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
|
267
|
+
WriteIndented = false,
|
|
268
|
+
};
|
|
269
|
+
private static readonly JsonSerializerOptions JSON_OPTS_INDENTED = new()
|
|
270
|
+
{
|
|
271
|
+
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
|
272
|
+
WriteIndented = true,
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
// Private markers.
|
|
276
|
+
public static readonly Dictionary<string, object?> SKIP = new() { ["`$SKIP`"] = true };
|
|
277
|
+
public static readonly Dictionary<string, object?> DELETE = new() { ["`$DELETE`"] = true };
|
|
278
|
+
|
|
279
|
+
// Sentinel for "value is not defined / absent" (analogous to TS undefined).
|
|
280
|
+
// Use this to distinguish "value is null (JSON null)" from "value is not present".
|
|
281
|
+
public static readonly object NONE = new();
|
|
282
|
+
|
|
283
|
+
// Typename lookup (indexed by bit position from MSB of type code).
|
|
284
|
+
private static readonly string[] TYPENAME =
|
|
285
|
+
[
|
|
286
|
+
S_any,
|
|
287
|
+
S_nil,
|
|
288
|
+
S_boolean,
|
|
289
|
+
S_decimal,
|
|
290
|
+
S_integer,
|
|
291
|
+
S_number,
|
|
292
|
+
S_string,
|
|
293
|
+
S_function,
|
|
294
|
+
S_nil,
|
|
295
|
+
S_null,
|
|
296
|
+
"",
|
|
297
|
+
"",
|
|
298
|
+
"",
|
|
299
|
+
"",
|
|
300
|
+
"",
|
|
301
|
+
"",
|
|
302
|
+
"",
|
|
303
|
+
S_list,
|
|
304
|
+
S_map,
|
|
305
|
+
S_instance,
|
|
306
|
+
"",
|
|
307
|
+
"",
|
|
308
|
+
"",
|
|
309
|
+
"",
|
|
310
|
+
S_scalar,
|
|
311
|
+
S_node
|
|
312
|
+
];
|
|
313
|
+
|
|
314
|
+
// Regular expressions (compile-time generated; see partial methods at end of class).
|
|
315
|
+
private static readonly Regex R_INTEGER_KEY = R_IntegerKeyGen();
|
|
316
|
+
private static readonly Regex R_ESCAPE_REGEXP = R_EscapeRegexpGen();
|
|
317
|
+
private static readonly Regex R_CLONE_REF = R_CloneRefGen();
|
|
318
|
+
private static readonly Regex R_INJECTION_FULL = R_InjectionFullGen();
|
|
319
|
+
private static readonly Regex R_INJECTION_PARTIAL = R_InjectionPartialGen();
|
|
320
|
+
private static readonly Regex R_DOUBLE_DOLLAR = R_DoubleDollarGen();
|
|
321
|
+
private static readonly Regex R_META_PATH = R_MetaPathGen();
|
|
322
|
+
private static readonly Regex R_TRANSFORM_NAME = R_TransformNameGen();
|
|
323
|
+
private static readonly Regex R_DOT = R_DotGen();
|
|
324
|
+
|
|
325
|
+
public const int MAXDEPTH = 32;
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
// ========================================================================
|
|
329
|
+
// Minor utilities
|
|
330
|
+
// ========================================================================
|
|
331
|
+
|
|
332
|
+
// Value is a node - a map (Dictionary) or list (List).
|
|
333
|
+
public static bool IsNode(object? val)
|
|
334
|
+
{
|
|
335
|
+
return val is Dictionary<string, object?> or List<object?>;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// Value is a map (Dictionary with string keys).
|
|
339
|
+
public static bool IsMap(object? val)
|
|
340
|
+
{
|
|
341
|
+
return val is Dictionary<string, object?>;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// Value is a list (List).
|
|
345
|
+
public static bool IsList(object? val)
|
|
346
|
+
{
|
|
347
|
+
return val is List<object?>;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// Value is a valid key: non-empty string or any number (matches TS where numbers are keys).
|
|
351
|
+
public static bool IsKey(object? key)
|
|
352
|
+
{
|
|
353
|
+
return key is string s ? s.Length > 0 : key is int or long or double or float;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// Value is "empty": null, empty string, empty list, or empty map.
|
|
357
|
+
public static bool IsEmpty(object? val)
|
|
358
|
+
{
|
|
359
|
+
// Match TS isempty: undefined/null/empty-string/empty-array/empty-object → true.
|
|
360
|
+
if (val == null || ReferenceEquals(val, NONE))
|
|
361
|
+
{
|
|
362
|
+
return true;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
if (val is string s)
|
|
366
|
+
{
|
|
367
|
+
return s.Length == 0;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
return val is List<object?> l ? l.Count == 0 : val is Dictionary<string, object?> d && d.Count == 0;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// Value is a delegate/function.
|
|
374
|
+
public static bool IsFunc(object? val)
|
|
375
|
+
{
|
|
376
|
+
return val is Delegate;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// Get a defined value; return alt if val is null.
|
|
380
|
+
public static object? GetDef(object? val, object? alt)
|
|
381
|
+
{
|
|
382
|
+
return val ?? alt;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// Return the typename for the narrowest type bit-flag.
|
|
386
|
+
public static string TypeName(int t)
|
|
387
|
+
{
|
|
388
|
+
int pos = System.Numerics.BitOperations.LeadingZeroCount((uint)t);
|
|
389
|
+
return pos < TYPENAME.Length ? TYPENAME[pos] : S_any;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// Determine the type of a value as a bit code.
|
|
393
|
+
public static int Typify(object? value)
|
|
394
|
+
{
|
|
395
|
+
// Match TS: undefined/NONE → noval; JSON null is its own type (T_null), not noval.
|
|
396
|
+
return ReferenceEquals(value, NONE)
|
|
397
|
+
? T.NoVal
|
|
398
|
+
: value == null
|
|
399
|
+
? T.Scalar | T.Null
|
|
400
|
+
: value switch
|
|
401
|
+
{
|
|
402
|
+
bool => T.Scalar | T.Boolean,
|
|
403
|
+
int => T.Scalar | T.Number | T.Integer,
|
|
404
|
+
long => T.Scalar | T.Number | T.Integer,
|
|
405
|
+
double d => double.IsNaN(d) ? T.NoVal : double.IsInteger(d)
|
|
406
|
+
? T.Scalar | T.Number | T.Integer
|
|
407
|
+
: T.Scalar | T.Number | T.Decimal,
|
|
408
|
+
float f => float.IsNaN(f) ? T.NoVal : (f % 1 == 0)
|
|
409
|
+
? T.Scalar | T.Number | T.Integer
|
|
410
|
+
: T.Scalar | T.Number | T.Decimal,
|
|
411
|
+
string => T.Scalar | T.Str,
|
|
412
|
+
Delegate => T.Scalar | T.Func,
|
|
413
|
+
List<object?> => T.Node | T.List,
|
|
414
|
+
Dictionary<string, object?> => T.Node | T.Map,
|
|
415
|
+
_ => T.Any,
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// The integer size of a value.
|
|
420
|
+
public static int Size(object? val)
|
|
421
|
+
{
|
|
422
|
+
return val switch
|
|
423
|
+
{
|
|
424
|
+
List<string> ls => ls.Count,
|
|
425
|
+
List<object?> l => l.Count,
|
|
426
|
+
Dictionary<string, object?> d => d.Count,
|
|
427
|
+
string s => s.Length,
|
|
428
|
+
int i => i,
|
|
429
|
+
long lg => (int)lg,
|
|
430
|
+
double d => (int)Math.Floor(d),
|
|
431
|
+
float f => (int)Math.Floor(f),
|
|
432
|
+
bool b => b ? 1 : 0,
|
|
433
|
+
_ => 0,
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// Extract a sub-range from a list or string (negative indices count from end).
|
|
438
|
+
// For numbers: clamp between start (inclusive) and end (exclusive).
|
|
439
|
+
public static object? Slice(object? val, int? start = null, int? end = null, bool mutate = false)
|
|
440
|
+
{
|
|
441
|
+
if (val is int or long or double or float)
|
|
442
|
+
{
|
|
443
|
+
long lv = Convert.ToInt64(val, CultureInfo.InvariantCulture);
|
|
444
|
+
long lo = start ?? long.MinValue;
|
|
445
|
+
long hi = end.HasValue ? (long)end.Value - 1 : long.MaxValue;
|
|
446
|
+
return Math.Min(Math.Max(lv, lo), hi);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
int vlen = Size(val);
|
|
450
|
+
|
|
451
|
+
if (end != null && start == null)
|
|
452
|
+
{
|
|
453
|
+
start = 0;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (start == null)
|
|
457
|
+
{
|
|
458
|
+
return val;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
int s = start.Value;
|
|
462
|
+
int e;
|
|
463
|
+
|
|
464
|
+
if (s < 0)
|
|
465
|
+
{
|
|
466
|
+
e = vlen + s;
|
|
467
|
+
if (e < 0)
|
|
468
|
+
{
|
|
469
|
+
e = 0;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
s = 0;
|
|
473
|
+
}
|
|
474
|
+
else if (end != null)
|
|
475
|
+
{
|
|
476
|
+
e = end.Value;
|
|
477
|
+
if (e < 0)
|
|
478
|
+
{
|
|
479
|
+
e = vlen + e;
|
|
480
|
+
if (e < 0)
|
|
481
|
+
{
|
|
482
|
+
e = 0;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
else if (vlen < e)
|
|
486
|
+
{
|
|
487
|
+
e = vlen;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
else
|
|
491
|
+
{
|
|
492
|
+
e = vlen;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
if (s > vlen)
|
|
496
|
+
{
|
|
497
|
+
s = vlen;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
if (s < 0 || s > e || e > vlen)
|
|
501
|
+
{
|
|
502
|
+
return val is List<object?> ? new List<object?>() : val is string ? S_MT : val;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
if (val is List<object?> list)
|
|
506
|
+
{
|
|
507
|
+
var sub = list.GetRange(s, e - s);
|
|
508
|
+
if (mutate)
|
|
509
|
+
{
|
|
510
|
+
list.Clear();
|
|
511
|
+
list.AddRange(sub);
|
|
512
|
+
return list;
|
|
513
|
+
}
|
|
514
|
+
return sub;
|
|
515
|
+
}
|
|
516
|
+
return val is string str ? str[s..e] : val;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// String padding.
|
|
520
|
+
public static string Pad(object? str, int padding = 44, string? padchar = null)
|
|
521
|
+
{
|
|
522
|
+
string s = str is string ss ? ss : Stringify(str);
|
|
523
|
+
string pc = padchar != null ? (padchar + S_SP)[0].ToString() : S_SP;
|
|
524
|
+
return padding >= 0 ? s.PadRight(padding, pc[0]) : s.PadLeft(-padding, pc[0]);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// Get a list element by integer index (negative counts from end).
|
|
528
|
+
public static object? GetElem(object? val, object? key, object? alt = null)
|
|
529
|
+
{
|
|
530
|
+
if (val == null || key == null)
|
|
531
|
+
{
|
|
532
|
+
return alt;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
object? out2 = alt;
|
|
536
|
+
if (val is List<object?> list)
|
|
537
|
+
{
|
|
538
|
+
if (!int.TryParse(key?.ToString(), out int nkey))
|
|
539
|
+
{
|
|
540
|
+
return alt;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
if (!R_INTEGER_KEY.IsMatch(key!.ToString()!))
|
|
544
|
+
{
|
|
545
|
+
return alt;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
if (nkey < 0)
|
|
549
|
+
{
|
|
550
|
+
nkey = list.Count + nkey;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
if (nkey >= 0 && nkey < list.Count)
|
|
554
|
+
{
|
|
555
|
+
out2 = list[nkey];
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// null at a slot counts as "no value" — same Group A rule as getprop.
|
|
560
|
+
if (out2 == null)
|
|
561
|
+
{
|
|
562
|
+
return alt is Delegate d2 ? d2.DynamicInvoke() : alt;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
return out2;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// Safely get a property of a node.
|
|
569
|
+
public static object? GetProp(object? val, object? key, object? alt = null)
|
|
570
|
+
{
|
|
571
|
+
if (val == null || key == null)
|
|
572
|
+
{
|
|
573
|
+
return alt;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
object? out2 = alt;
|
|
577
|
+
if (val is Dictionary<string, object?> map)
|
|
578
|
+
{
|
|
579
|
+
string k = StrKey(key) ?? S_MT;
|
|
580
|
+
if (map.TryGetValue(k, out object? v))
|
|
581
|
+
{
|
|
582
|
+
out2 = v;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
else if (val is List<object?> list)
|
|
586
|
+
{
|
|
587
|
+
string? ks = key?.ToString();
|
|
588
|
+
if (ks != null && int.TryParse(ks, out int i))
|
|
589
|
+
{
|
|
590
|
+
if (i < 0)
|
|
591
|
+
{
|
|
592
|
+
i = list.Count + i;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
if (i >= 0 && i < list.Count)
|
|
596
|
+
{
|
|
597
|
+
out2 = list[i];
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// JSON null at a key is treated as "no value" for the default-substitution
|
|
603
|
+
// rule (Group A). This unifies cross-port behaviour.
|
|
604
|
+
if (out2 == null)
|
|
605
|
+
{
|
|
606
|
+
return alt;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
return out2;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
// Internal: literal value lookup that preserves stored JSON null. Group B
|
|
613
|
+
// callers (validate / transform commands / builders / inject internals) use
|
|
614
|
+
// this when they need to inspect the raw stored value at a slot regardless
|
|
615
|
+
// of whether it is null. The public GetProp / GetElem / HasKey APIs treat
|
|
616
|
+
// null as absent (Group A) per UNDEF_SPEC.md. Returns NONE when truly absent.
|
|
617
|
+
public static object? Lookup(object? val, object? key)
|
|
618
|
+
{
|
|
619
|
+
if (val == null || key == null || ReferenceEquals(val, NONE))
|
|
620
|
+
{
|
|
621
|
+
return NONE;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
if (val is Dictionary<string, object?> map)
|
|
625
|
+
{
|
|
626
|
+
string k = StrKey(key) ?? S_MT;
|
|
627
|
+
return map.TryGetValue(k, out object? v) ? v : NONE;
|
|
628
|
+
}
|
|
629
|
+
if (val is List<object?> list)
|
|
630
|
+
{
|
|
631
|
+
string? ks = key.ToString();
|
|
632
|
+
if (ks != null && int.TryParse(ks, out int i))
|
|
633
|
+
{
|
|
634
|
+
if (i < 0)
|
|
635
|
+
{
|
|
636
|
+
i = list.Count + i;
|
|
637
|
+
}
|
|
638
|
+
if (i >= 0 && i < list.Count)
|
|
639
|
+
{
|
|
640
|
+
return list[i];
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
return NONE;
|
|
644
|
+
}
|
|
645
|
+
return NONE;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
// Convert a key to its string representation.
|
|
649
|
+
public static string? StrKey(object? key = null)
|
|
650
|
+
{
|
|
651
|
+
if (key == null)
|
|
652
|
+
{
|
|
653
|
+
return S_MT;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
int t = Typify(key);
|
|
657
|
+
if (0 < (T.Str & t))
|
|
658
|
+
{
|
|
659
|
+
return (string)key;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
if (0 < (T.Boolean & t))
|
|
663
|
+
{
|
|
664
|
+
return S_MT;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
if (0 < (T.Number & t))
|
|
668
|
+
{
|
|
669
|
+
double d = Convert.ToDouble(key, CultureInfo.InvariantCulture);
|
|
670
|
+
return ((long)Math.Floor(d)).ToString(CultureInfo.InvariantCulture);
|
|
671
|
+
}
|
|
672
|
+
return S_MT;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
// Sorted keys of a map (strings) or list (index strings).
|
|
676
|
+
public static List<string> KeysOf(object? val)
|
|
677
|
+
{
|
|
678
|
+
if (val is Dictionary<string, object?> map)
|
|
679
|
+
{
|
|
680
|
+
var keys = map.Keys.ToList();
|
|
681
|
+
keys.Sort(StringComparer.Ordinal);
|
|
682
|
+
return keys;
|
|
683
|
+
}
|
|
684
|
+
return val is List<object?> list
|
|
685
|
+
? Enumerable.Range(0, list.Count)
|
|
686
|
+
.Select(i => i.ToString(CultureInfo.InvariantCulture))
|
|
687
|
+
.ToList()
|
|
688
|
+
: (List<string>)([]);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
// True if the key exists with a non-null value in val.
|
|
692
|
+
// Canonical: haskey is `null != getprop(val, key)`, so a present-but-null
|
|
693
|
+
// key is false (Group A null unification).
|
|
694
|
+
public static bool HasKey(object? val, object? key)
|
|
695
|
+
{
|
|
696
|
+
return GetProp(val, key) != null;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// Items of a map/list as [[key, value], ...] pairs.
|
|
700
|
+
public static List<List<object?>> Items(object? val)
|
|
701
|
+
{
|
|
702
|
+
var keys = KeysOf(val);
|
|
703
|
+
return keys.Select(k => (List<object?>)[k, GetProp(val, k)]).ToList();
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
// Items with a transform applied to each [key, value] pair.
|
|
707
|
+
public static List<T2> Items<T2>(object? val, Func<List<object?>, T2> apply)
|
|
708
|
+
{
|
|
709
|
+
return Items(val).Select(apply).ToList();
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
// Flatten nested lists up to the given depth (default 1).
|
|
713
|
+
public static List<object?> Flatten(List<object?> list, int depth = 1)
|
|
714
|
+
{
|
|
715
|
+
if (!IsList(list))
|
|
716
|
+
{
|
|
717
|
+
return list;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
if (depth <= 0)
|
|
721
|
+
{
|
|
722
|
+
return list;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
var result = new List<object?>();
|
|
726
|
+
foreach (var item in list)
|
|
727
|
+
{
|
|
728
|
+
if (item is List<object?> inner)
|
|
729
|
+
{
|
|
730
|
+
result.AddRange(depth > 1 ? Flatten(inner, depth - 1) : inner);
|
|
731
|
+
}
|
|
732
|
+
else
|
|
733
|
+
{
|
|
734
|
+
result.Add(item);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
return result;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
// Filter items using a predicate on [key, value] pairs.
|
|
741
|
+
public static List<object?> Filter(object? val, Func<List<object?>, bool> check)
|
|
742
|
+
{
|
|
743
|
+
var all = Items(val);
|
|
744
|
+
var result = new List<object?>();
|
|
745
|
+
foreach (var item in all)
|
|
746
|
+
{
|
|
747
|
+
if (check(item))
|
|
748
|
+
{
|
|
749
|
+
result.Add(item[1]);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
return result;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
// Escape for use in a regular expression.
|
|
757
|
+
public static string EscRe(string? s)
|
|
758
|
+
{
|
|
759
|
+
return s == null ? S_MT : R_ESCAPE_REGEXP.Replace(s, m => @"\" + m.Value);
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
// ---------------------------------------------------------------
|
|
763
|
+
// Regex utility — uniform Re* API (see /REGEX_API.md).
|
|
764
|
+
// .NET's System.Text.RegularExpressions is a strict superset of RE2.
|
|
765
|
+
// ---------------------------------------------------------------
|
|
766
|
+
|
|
767
|
+
public static Regex ReCompile(string pattern)
|
|
768
|
+
{
|
|
769
|
+
return new(pattern);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
public static bool ReTest(string pattern, string input)
|
|
773
|
+
{
|
|
774
|
+
return new Regex(pattern).IsMatch(input ?? "");
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
public static string[]? ReFind(string pattern, string input)
|
|
778
|
+
{
|
|
779
|
+
var m = new Regex(pattern).Match(input ?? "");
|
|
780
|
+
if (!m.Success)
|
|
781
|
+
{
|
|
782
|
+
return null;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
var groups = m.Groups;
|
|
786
|
+
var out_ = new string[groups.Count];
|
|
787
|
+
for (int i = 0; i < groups.Count; i++)
|
|
788
|
+
{
|
|
789
|
+
out_[i] = groups[i].Success ? groups[i].Value : "";
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
return out_;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
public static List<string[]> ReFindAll(string pattern, string input)
|
|
796
|
+
{
|
|
797
|
+
var rx = new Regex(pattern);
|
|
798
|
+
var outs = new List<string[]>();
|
|
799
|
+
foreach (Match m in rx.Matches(input ?? "").Cast<Match>())
|
|
800
|
+
{
|
|
801
|
+
var row = new string[m.Groups.Count];
|
|
802
|
+
for (int i = 0; i < m.Groups.Count; i++)
|
|
803
|
+
{
|
|
804
|
+
row[i] = m.Groups[i].Success ? m.Groups[i].Value : "";
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
outs.Add(row);
|
|
808
|
+
}
|
|
809
|
+
return outs;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
public static string ReReplace(string pattern, string input, string replacement)
|
|
813
|
+
{
|
|
814
|
+
// Translate JS-style $& to $0
|
|
815
|
+
var dotnetRepl = replacement.Replace("$&", "$0");
|
|
816
|
+
return new Regex(pattern).Replace(input ?? "", dotnetRepl);
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
public static string ReEscape(string s)
|
|
820
|
+
{
|
|
821
|
+
return EscRe(s);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
// URL-encode a string.
|
|
825
|
+
public static string EscUrl(string? s)
|
|
826
|
+
{
|
|
827
|
+
return s == null ? S_MT : Uri.EscapeDataString(s);
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
// Replace in a string (all occurrences).
|
|
831
|
+
private static string ReplaceStr(string? s, Regex from, string to)
|
|
832
|
+
{
|
|
833
|
+
return s == null ? S_MT : from.Replace(s, to);
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
// Join an array of strings with a separator, stripping leading/trailing separators.
|
|
837
|
+
// Matches TypeScript: filter(items(filter(arr, string-non-empty), strip), non-empty).join(sep)
|
|
838
|
+
public static string Join(List<object?> arr, string? sep = null, bool url = false)
|
|
839
|
+
{
|
|
840
|
+
string sepdef = sep ?? S_CM;
|
|
841
|
+
string? sepre = sepdef.Length == 1 ? EscRe(sepdef) : null;
|
|
842
|
+
int sarr = Size(arr);
|
|
843
|
+
|
|
844
|
+
// Step 1: filter arr to non-empty strings.
|
|
845
|
+
var step1 = Filter(arr, n => (0 < (T.Str & Typify(n[1]))) && (string?)n[1] != S_MT);
|
|
846
|
+
|
|
847
|
+
// Step 2: items(step1, apply sep-stripping per element).
|
|
848
|
+
var step2 = Items(step1, n =>
|
|
849
|
+
{
|
|
850
|
+
int i = int.Parse((string)n[0]!, CultureInfo.InvariantCulture);
|
|
851
|
+
string s = (string)n[1]!;
|
|
852
|
+
|
|
853
|
+
if (sepre is not null and not S_MT)
|
|
854
|
+
{
|
|
855
|
+
if (url && i == 0)
|
|
856
|
+
{
|
|
857
|
+
return Regex.Replace(s, sepre + @"+$", S_MT);
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
if (i > 0)
|
|
861
|
+
{
|
|
862
|
+
s = Regex.Replace(s, @"^" + sepre + @"+", S_MT);
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
if (i < sarr - 1 || !url)
|
|
866
|
+
{
|
|
867
|
+
s = Regex.Replace(s, sepre + @"+$", S_MT);
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
s = Regex.Replace(s, @"([^" + sepre + @"])" + sepre + @"+([^" + sepre + @"])",
|
|
871
|
+
"$1" + sepdef + "$2");
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
return s;
|
|
875
|
+
});
|
|
876
|
+
|
|
877
|
+
// Step 3: filter out empty and join.
|
|
878
|
+
var nonEmpty = step2.Where(s => s != S_MT).ToList();
|
|
879
|
+
return string.Join(sepdef, nonEmpty);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
// Join URL parts.
|
|
883
|
+
public static string JoinUrl(params string[] parts)
|
|
884
|
+
{
|
|
885
|
+
return Join(parts.Cast<object?>().ToList(), S_FS, url: true);
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
// JSON.stringify-style output (indent = spaces per level, like TS jsonify flags.indent).
|
|
889
|
+
public static string Jsonify(object? val, int indent = 2, int offset = 0)
|
|
890
|
+
{
|
|
891
|
+
if (val == null)
|
|
892
|
+
{
|
|
893
|
+
return S_null;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
try
|
|
897
|
+
{
|
|
898
|
+
var opts = indent > 0 ? JSON_OPTS_INDENTED : JSON_OPTS_COMPACT;
|
|
899
|
+
string str = JsonSerializer.Serialize(SortKeys(val), opts);
|
|
900
|
+
// System.Text.Json on .NET 8 emits Environment.NewLine for indented
|
|
901
|
+
// output, which is "\r\n" on Windows. The TS-canonical corpus expects
|
|
902
|
+
// "\n", so normalise here. (.NET 9 adds JsonWriterOptions.NewLine.)
|
|
903
|
+
if (indent > 0)
|
|
904
|
+
{
|
|
905
|
+
str = str.Replace("\r\n", "\n");
|
|
906
|
+
}
|
|
907
|
+
// System.Text.Json always uses 2 spaces per level; rescale to match TS JSON.stringify(,,indent).
|
|
908
|
+
if (indent is > 0 and not 2)
|
|
909
|
+
{
|
|
910
|
+
const int netPerLevel = 2;
|
|
911
|
+
var lines = str.Split('\n');
|
|
912
|
+
var rescaled = new List<string>(lines.Length);
|
|
913
|
+
foreach (string line in lines)
|
|
914
|
+
{
|
|
915
|
+
int lead = 0;
|
|
916
|
+
while (lead < line.Length && line[lead] == ' ')
|
|
917
|
+
{
|
|
918
|
+
lead++;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
int levels = lead / netPerLevel;
|
|
922
|
+
string rest = line[lead..];
|
|
923
|
+
rescaled.Add(levels == 0 ? rest : new string(' ', levels * indent) + rest);
|
|
924
|
+
}
|
|
925
|
+
str = string.Join("\n", rescaled);
|
|
926
|
+
}
|
|
927
|
+
if (offset > 0)
|
|
928
|
+
{
|
|
929
|
+
var lines = str.Split('\n').Skip(1).Select(l =>
|
|
930
|
+
Pad(l, -(offset + Size(l)))).ToList();
|
|
931
|
+
return "{\n" + Join(lines.Cast<object?>().ToList(), "\n");
|
|
932
|
+
}
|
|
933
|
+
return str;
|
|
934
|
+
}
|
|
935
|
+
catch
|
|
936
|
+
{
|
|
937
|
+
return "__JSONIFY_FAILED__";
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
// Human-friendly stringify (NOT JSON, removes quotes). Keys are sorted alphabetically.
|
|
942
|
+
public static string Stringify(object? val, int? maxlen = null)
|
|
943
|
+
{
|
|
944
|
+
string valstr;
|
|
945
|
+
// Match TS: NONE (undefined) -> "" but JSON null -> "null".
|
|
946
|
+
if (ReferenceEquals(val, NONE))
|
|
947
|
+
{
|
|
948
|
+
return S_MT;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
if (val is string s)
|
|
952
|
+
{
|
|
953
|
+
valstr = s;
|
|
954
|
+
}
|
|
955
|
+
else
|
|
956
|
+
{
|
|
957
|
+
try
|
|
958
|
+
{
|
|
959
|
+
valstr = JsonSerializer.Serialize(SortKeys(val), JSON_OPTS_COMPACT);
|
|
960
|
+
valstr = valstr.Replace("\"", S_MT);
|
|
961
|
+
}
|
|
962
|
+
catch
|
|
963
|
+
{
|
|
964
|
+
return "__STRINGIFY_FAILED__";
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
if (maxlen is not null and >= 0)
|
|
969
|
+
{
|
|
970
|
+
if (valstr.Length > maxlen)
|
|
971
|
+
{
|
|
972
|
+
valstr = valstr[..Math.Max(0, maxlen.Value - 3)] + "...";
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
return valstr;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
// Recursively sort dictionary keys for deterministic output (matches TS behavior).
|
|
980
|
+
private static object? SortKeys(object? val)
|
|
981
|
+
{
|
|
982
|
+
if (val is Dictionary<string, object?> map)
|
|
983
|
+
{
|
|
984
|
+
var sorted = new Dictionary<string, object?>();
|
|
985
|
+
foreach (var k in map.Keys.OrderBy(k => k, StringComparer.Ordinal))
|
|
986
|
+
{
|
|
987
|
+
sorted[k] = SortKeys(map[k]);
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
return sorted;
|
|
991
|
+
}
|
|
992
|
+
return val is List<object?> list ? list.Select(SortKeys).ToList() : val;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
// Build a human-friendly path string.
|
|
996
|
+
// Pass StructUtils.NONE (not null) to indicate "path was not provided at all".
|
|
997
|
+
public static string Pathify(object? val, int startIn = 0, int endIn = 0)
|
|
998
|
+
{
|
|
999
|
+
// Distinguish "truly absent" (NONE) from "explicitly null" (null).
|
|
1000
|
+
bool isNone = ReferenceEquals(val, NONE);
|
|
1001
|
+
if (isNone)
|
|
1002
|
+
{
|
|
1003
|
+
val = null;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
List<object?>? path = null;
|
|
1007
|
+
|
|
1008
|
+
if (val is List<object?> lv)
|
|
1009
|
+
{
|
|
1010
|
+
path = lv;
|
|
1011
|
+
}
|
|
1012
|
+
else if (val is string sv)
|
|
1013
|
+
{
|
|
1014
|
+
path = [sv];
|
|
1015
|
+
}
|
|
1016
|
+
else if (val is int or long or double or float)
|
|
1017
|
+
{
|
|
1018
|
+
path = [val];
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
int start = startIn >= 0 ? startIn : 0;
|
|
1022
|
+
int end = endIn >= 0 ? endIn : 0;
|
|
1023
|
+
|
|
1024
|
+
if (path == null)
|
|
1025
|
+
{
|
|
1026
|
+
// val=null → <unknown-path:null>, val=absent(NONE) → <unknown-path>
|
|
1027
|
+
string suffix = (val == null && !isNone) ? S_CN + "null" :
|
|
1028
|
+
(val != null) ? S_CN + Stringify(val, 47) : S_MT;
|
|
1029
|
+
return "<unknown-path" + suffix + ">";
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
if (start >= 0)
|
|
1033
|
+
{
|
|
1034
|
+
var sub = Slice(path, start, path.Count - end) as List<object?> ?? [];
|
|
1035
|
+
if (sub.Count == 0)
|
|
1036
|
+
{
|
|
1037
|
+
return "<root>";
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
var parts = Filter(sub, n => IsKey(n[1]))
|
|
1041
|
+
.Select(p =>
|
|
1042
|
+
{
|
|
1043
|
+
if (p is int pi)
|
|
1044
|
+
{
|
|
1045
|
+
return ((long)pi).ToString(CultureInfo.InvariantCulture);
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
if (p is long pl)
|
|
1049
|
+
{
|
|
1050
|
+
return pl.ToString(CultureInfo.InvariantCulture);
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
return p is double pd
|
|
1054
|
+
? ((long)Math.Floor(pd)).ToString(CultureInfo.InvariantCulture)
|
|
1055
|
+
: p is float pf
|
|
1056
|
+
? ((long)Math.Floor(pf)).ToString(CultureInfo.InvariantCulture)
|
|
1057
|
+
: R_DOT.Replace((string)p!, S_MT);
|
|
1058
|
+
})
|
|
1059
|
+
.Cast<object?>()
|
|
1060
|
+
.ToList();
|
|
1061
|
+
|
|
1062
|
+
return Join(parts, S_DT);
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
string sfx = (val == null && !isNone) ? S_CN + "null" :
|
|
1066
|
+
(val != null) ? S_CN + Stringify(val, 47) : S_MT;
|
|
1067
|
+
return "<unknown-path" + sfx + ">";
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
// Deep-clone a JSON-like structure (functions/instances are shallow-copied).
|
|
1071
|
+
public static object? Clone(object? val)
|
|
1072
|
+
{
|
|
1073
|
+
if (val == null)
|
|
1074
|
+
{
|
|
1075
|
+
return null;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
var refs = new List<object?>();
|
|
1079
|
+
int reftype = T.Func | T.Instance;
|
|
1080
|
+
|
|
1081
|
+
object? Replacer(object? v)
|
|
1082
|
+
{
|
|
1083
|
+
int tv = Typify(v);
|
|
1084
|
+
if (0 < (reftype & tv))
|
|
1085
|
+
{
|
|
1086
|
+
refs.Add(v);
|
|
1087
|
+
return "`$REF:" + (refs.Count - 1) + "`";
|
|
1088
|
+
}
|
|
1089
|
+
return v;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
object? Reviver(object? v)
|
|
1093
|
+
{
|
|
1094
|
+
if (v is string sv)
|
|
1095
|
+
{
|
|
1096
|
+
var m = R_CLONE_REF.Match(sv);
|
|
1097
|
+
if (m.Success && int.TryParse(m.Groups[1].Value, out int idx))
|
|
1098
|
+
{
|
|
1099
|
+
return refs[idx];
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
return v;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
return DeepClone(val, Replacer, Reviver);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
private static object? DeepClone(object? val, Func<object?, object?> replacer, Func<object?, object?> reviver)
|
|
1109
|
+
{
|
|
1110
|
+
if (val == null)
|
|
1111
|
+
{
|
|
1112
|
+
return null;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
var replaced = replacer(val);
|
|
1116
|
+
if (replaced is string refStr && R_CLONE_REF.IsMatch(refStr))
|
|
1117
|
+
{
|
|
1118
|
+
return reviver(refStr);
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
if (val is Dictionary<string, object?> map)
|
|
1122
|
+
{
|
|
1123
|
+
var result = new Dictionary<string, object?>();
|
|
1124
|
+
foreach (var kv in map)
|
|
1125
|
+
{
|
|
1126
|
+
result[kv.Key] = DeepClone(kv.Value, replacer, reviver);
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
return result;
|
|
1130
|
+
}
|
|
1131
|
+
return val is List<object?> list ? list.Select(item => DeepClone(item, replacer, reviver)).ToList() : val;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
// Define a JSON object (dictionary) from alternating key/value arguments.
|
|
1135
|
+
// Jm("a", 1, "b", 2) => { "a": 1, "b": 2 }. A missing trailing value is null.
|
|
1136
|
+
public static Dictionary<string, object?> Jm(params object?[] kv)
|
|
1137
|
+
{
|
|
1138
|
+
var o = new Dictionary<string, object?>();
|
|
1139
|
+
for (int i = 0; i < kv.Length; i += 2)
|
|
1140
|
+
{
|
|
1141
|
+
var k = kv[i];
|
|
1142
|
+
var ks = k is string s ? s : Stringify(k);
|
|
1143
|
+
o[ks] = i + 1 < kv.Length ? kv[i + 1] : null;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
return o;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
// Define a JSON array (list) from positional arguments.
|
|
1150
|
+
// Jt(1, "x", true) => [1, "x", true].
|
|
1151
|
+
public static List<object?> Jt(params object?[] v)
|
|
1152
|
+
{
|
|
1153
|
+
var a = new List<object?>(v.Length);
|
|
1154
|
+
a.AddRange(v);
|
|
1155
|
+
return a;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
// Safely set a property. Returns the (possibly modified) parent.
|
|
1159
|
+
public static object? SetProp(object? parent, object? key, object? val)
|
|
1160
|
+
{
|
|
1161
|
+
if (!IsKey(key))
|
|
1162
|
+
{
|
|
1163
|
+
return parent;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
if (parent is Dictionary<string, object?> map)
|
|
1167
|
+
{
|
|
1168
|
+
string k = StrKey(key) ?? S_MT;
|
|
1169
|
+
map[k] = val;
|
|
1170
|
+
}
|
|
1171
|
+
else if (parent is List<object?> list)
|
|
1172
|
+
{
|
|
1173
|
+
string? ks = key?.ToString();
|
|
1174
|
+
if (ks == null || !long.TryParse(ks, out long keyL))
|
|
1175
|
+
{
|
|
1176
|
+
return parent;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
int keyI = (int)Math.Floor((double)keyL);
|
|
1180
|
+
if (keyI >= 0)
|
|
1181
|
+
{
|
|
1182
|
+
int clamped = Convert.ToInt32(Slice(keyI, 0, list.Count + 1), CultureInfo.InvariantCulture);
|
|
1183
|
+
while (list.Count <= clamped)
|
|
1184
|
+
{
|
|
1185
|
+
list.Add(null);
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
list[clamped] = val;
|
|
1189
|
+
}
|
|
1190
|
+
else
|
|
1191
|
+
{
|
|
1192
|
+
list.Insert(0, val);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
return parent;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
// Safely delete a property. Returns the (possibly modified) parent.
|
|
1200
|
+
public static object? DelProp(object? parent, object? key)
|
|
1201
|
+
{
|
|
1202
|
+
if (!IsKey(key))
|
|
1203
|
+
{
|
|
1204
|
+
return parent;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
if (parent is Dictionary<string, object?> map)
|
|
1208
|
+
{
|
|
1209
|
+
string k = StrKey(key) ?? S_MT;
|
|
1210
|
+
map.Remove(k);
|
|
1211
|
+
}
|
|
1212
|
+
else if (parent is List<object?> list)
|
|
1213
|
+
{
|
|
1214
|
+
if (!int.TryParse(key?.ToString(), out int keyI))
|
|
1215
|
+
{
|
|
1216
|
+
return parent;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
keyI = (int)Math.Floor((double)keyI);
|
|
1220
|
+
if (keyI >= 0 && keyI < list.Count)
|
|
1221
|
+
{
|
|
1222
|
+
list.RemoveAt(keyI);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
return parent;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
// ========================================================================
|
|
1231
|
+
// SetPath
|
|
1232
|
+
// ========================================================================
|
|
1233
|
+
|
|
1234
|
+
// Set a value at path inside store. Returns the parent node where the
|
|
1235
|
+
// last key was set (matches TypeScript behavior).
|
|
1236
|
+
public static object? SetPath(object? store, object? path, object? val)
|
|
1237
|
+
{
|
|
1238
|
+
if (store == null)
|
|
1239
|
+
{
|
|
1240
|
+
return null;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
int pathType = Typify(path);
|
|
1244
|
+
List<object?> parts;
|
|
1245
|
+
|
|
1246
|
+
if (0 < (T.List & pathType) && path is List<object?> lp)
|
|
1247
|
+
{
|
|
1248
|
+
parts = lp;
|
|
1249
|
+
}
|
|
1250
|
+
else if (0 < (T.Str & pathType) && path is string ps)
|
|
1251
|
+
{
|
|
1252
|
+
parts = ps.Split('.').Cast<object?>().ToList();
|
|
1253
|
+
}
|
|
1254
|
+
else if (0 < (T.Number & pathType))
|
|
1255
|
+
{
|
|
1256
|
+
parts = [path];
|
|
1257
|
+
}
|
|
1258
|
+
else
|
|
1259
|
+
{
|
|
1260
|
+
return null;
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
if (parts.Count == 0)
|
|
1264
|
+
{
|
|
1265
|
+
return null;
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
object? parent = store;
|
|
1269
|
+
|
|
1270
|
+
for (int pI = 0; pI < parts.Count - 1; pI++)
|
|
1271
|
+
{
|
|
1272
|
+
object? partKey = parts[pI];
|
|
1273
|
+
object? nextParent = GetProp(parent, partKey);
|
|
1274
|
+
if (!IsNode(nextParent))
|
|
1275
|
+
{
|
|
1276
|
+
// Create list if next key is numeric, otherwise map.
|
|
1277
|
+
object? nextPartKey = GetElem(parts, pI + 1);
|
|
1278
|
+
nextParent = (0 < (T.Number & Typify(nextPartKey)))
|
|
1279
|
+
? (object?)new List<object?>()
|
|
1280
|
+
: new Dictionary<string, object?>();
|
|
1281
|
+
SetProp(parent, partKey, nextParent);
|
|
1282
|
+
}
|
|
1283
|
+
parent = nextParent;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
object? lastKey = GetElem(parts, -1);
|
|
1287
|
+
if (val is Dictionary<string, object?> deleteMarker &&
|
|
1288
|
+
deleteMarker.ContainsKey("`$DELETE`"))
|
|
1289
|
+
{
|
|
1290
|
+
DelProp(parent, lastKey);
|
|
1291
|
+
}
|
|
1292
|
+
else
|
|
1293
|
+
{
|
|
1294
|
+
SetProp(parent, lastKey, val);
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
return parent;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
|
|
1301
|
+
// ========================================================================
|
|
1302
|
+
// GetPath
|
|
1303
|
+
// ========================================================================
|
|
1304
|
+
|
|
1305
|
+
// Get the value at a dot-separated key path deep inside a store.
|
|
1306
|
+
// path: string ("a.b.c"), List<object?>, or number.
|
|
1307
|
+
// state: optional InjectState providing base, dparent, dpath, meta,
|
|
1308
|
+
// key, and a post-processing handler.
|
|
1309
|
+
public static object? GetPath(object? store, object? path,
|
|
1310
|
+
object? current = null, InjectState? state = null)
|
|
1311
|
+
{
|
|
1312
|
+
// Resolve path to a mutable list of string parts.
|
|
1313
|
+
List<string> parts;
|
|
1314
|
+
if (path is List<object?> lp)
|
|
1315
|
+
{
|
|
1316
|
+
parts = lp.Select(p => StrKey(p) ?? S_MT).ToList();
|
|
1317
|
+
}
|
|
1318
|
+
else if (path is List<string> ls)
|
|
1319
|
+
{
|
|
1320
|
+
parts = new List<string>(ls);
|
|
1321
|
+
}
|
|
1322
|
+
else if (path is string sp)
|
|
1323
|
+
{
|
|
1324
|
+
parts = sp == S_MT ? [S_MT] : [.. sp.Split('.')];
|
|
1325
|
+
}
|
|
1326
|
+
else if (0 < (T.Number & Typify(path)))
|
|
1327
|
+
{
|
|
1328
|
+
parts = [StrKey(path) ?? S_MT];
|
|
1329
|
+
}
|
|
1330
|
+
else
|
|
1331
|
+
{
|
|
1332
|
+
return null;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
string? baseKey = state?.Base;
|
|
1336
|
+
object? src = GetProp(store, baseKey, store) ?? store;
|
|
1337
|
+
object? dparent = state?.DParent;
|
|
1338
|
+
int numparts = parts.Count;
|
|
1339
|
+
|
|
1340
|
+
object? val = store;
|
|
1341
|
+
|
|
1342
|
+
// Empty path (or empty string path) → return src.
|
|
1343
|
+
if (path == null || store == null || (numparts == 1 && S_MT == parts[0]))
|
|
1344
|
+
{
|
|
1345
|
+
val = src;
|
|
1346
|
+
}
|
|
1347
|
+
else if (numparts > 0)
|
|
1348
|
+
{
|
|
1349
|
+
// Single-part path: check for $ACTION functions stored in the root.
|
|
1350
|
+
if (numparts == 1)
|
|
1351
|
+
{
|
|
1352
|
+
val = GetProp(store, parts[0]);
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
if (!IsFunc(val))
|
|
1356
|
+
{
|
|
1357
|
+
val = src;
|
|
1358
|
+
|
|
1359
|
+
// Meta path syntax: "q0$~x" or "q0$=x" — navigate into meta.
|
|
1360
|
+
var m = R_META_PATH.Match(parts[0]);
|
|
1361
|
+
if (m.Success && state?.Meta != null)
|
|
1362
|
+
{
|
|
1363
|
+
val = GetProp(state.Meta, m.Groups[1].Value);
|
|
1364
|
+
parts[0] = m.Groups[3].Value;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
List<object?> dpath = state?.DPath ?? [];
|
|
1368
|
+
|
|
1369
|
+
for (int pI = 0; val != null && pI < numparts; pI++)
|
|
1370
|
+
{
|
|
1371
|
+
string part = parts[pI];
|
|
1372
|
+
|
|
1373
|
+
// Special path keywords and dynamic substitution.
|
|
1374
|
+
if (state != null && part == S_DKEY)
|
|
1375
|
+
{
|
|
1376
|
+
part = state.Key ?? S_MT;
|
|
1377
|
+
}
|
|
1378
|
+
else if (state != null && part.StartsWith("$GET:", StringComparison.Ordinal))
|
|
1379
|
+
{
|
|
1380
|
+
string sub = part[5..^1];
|
|
1381
|
+
part = Stringify(GetPath(src, sub));
|
|
1382
|
+
}
|
|
1383
|
+
else if (state != null && part.StartsWith("$REF:", StringComparison.Ordinal))
|
|
1384
|
+
{
|
|
1385
|
+
string sub = part[5..^1];
|
|
1386
|
+
object? specVal = GetProp(store, S_DSPEC);
|
|
1387
|
+
part = specVal != null ? Stringify(GetPath(specVal, sub)) : S_MT;
|
|
1388
|
+
}
|
|
1389
|
+
else if (state != null && part.StartsWith("$META:", StringComparison.Ordinal))
|
|
1390
|
+
{
|
|
1391
|
+
string sub = part[6..^1];
|
|
1392
|
+
part = Stringify(GetPath(state.Meta, sub));
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
// $$ is an escape for a literal $.
|
|
1396
|
+
part = part.Replace("$$", "$");
|
|
1397
|
+
|
|
1398
|
+
if (S_MT == part)
|
|
1399
|
+
{
|
|
1400
|
+
// Count consecutive empty parts (each "." adds one).
|
|
1401
|
+
int ascends = 0;
|
|
1402
|
+
while (1 + pI < numparts && S_MT == parts[1 + pI])
|
|
1403
|
+
{
|
|
1404
|
+
ascends++;
|
|
1405
|
+
pI++;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
if (state != null && ascends > 0)
|
|
1409
|
+
{
|
|
1410
|
+
// Last empty part cancels one ascend (the "." that
|
|
1411
|
+
// ended the path string is a trailing separator).
|
|
1412
|
+
if (pI == numparts - 1)
|
|
1413
|
+
{
|
|
1414
|
+
ascends--;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
if (ascends == 0)
|
|
1418
|
+
{
|
|
1419
|
+
val = dparent;
|
|
1420
|
+
}
|
|
1421
|
+
else
|
|
1422
|
+
{
|
|
1423
|
+
int dpathLen = dpath.Count;
|
|
1424
|
+
int cutLen = Math.Max(0, dpathLen - ascends);
|
|
1425
|
+
var fullpath = new List<string>();
|
|
1426
|
+
for (int i = 0; i < cutLen; i++)
|
|
1427
|
+
{
|
|
1428
|
+
fullpath.Add(StrKey(dpath[i]) ?? S_MT);
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
if (pI + 1 < numparts)
|
|
1432
|
+
{
|
|
1433
|
+
fullpath.AddRange(parts.Skip(pI + 1));
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
val = ascends <= dpathLen
|
|
1437
|
+
? GetPath(store, fullpath.Cast<object?>().ToList())
|
|
1438
|
+
: null;
|
|
1439
|
+
break;
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
else
|
|
1443
|
+
{
|
|
1444
|
+
val = dparent;
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
else
|
|
1448
|
+
{
|
|
1449
|
+
val = GetProp(val, part);
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
// Optional post-processing via a handler function in the state.
|
|
1456
|
+
if (state?.Handler != null)
|
|
1457
|
+
{
|
|
1458
|
+
string refStr = Pathify(path);
|
|
1459
|
+
val = state.Handler(state, val, refStr, store);
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
return val;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
|
|
1466
|
+
// ========================================================================
|
|
1467
|
+
// Walk
|
|
1468
|
+
// ========================================================================
|
|
1469
|
+
|
|
1470
|
+
// Walk a data structure depth-first, applying before/after callbacks.
|
|
1471
|
+
// key=null and parent=null at the root. path contains string keys.
|
|
1472
|
+
// maxdepth: null or negative → MAXDEPTH. 0 → no descent at all.
|
|
1473
|
+
// Stops descending when path.Count >= md (children beyond depth are not visited).
|
|
1474
|
+
//
|
|
1475
|
+
// The `path` argument passed to the before/after callbacks is a single
|
|
1476
|
+
// mutable list per depth, shared across all callback invocations for the
|
|
1477
|
+
// lifetime of this top-level Walk call. Callbacks that need to store the
|
|
1478
|
+
// path MUST clone it (e.g. new List<object?>(path)); the contents will
|
|
1479
|
+
// otherwise be overwritten by subsequent visits.
|
|
1480
|
+
public static object? Walk(
|
|
1481
|
+
object? val,
|
|
1482
|
+
WalkApply? before = null,
|
|
1483
|
+
WalkApply? after = null,
|
|
1484
|
+
int? maxdepth = null,
|
|
1485
|
+
object? key = null,
|
|
1486
|
+
object? parent = null,
|
|
1487
|
+
List<object?>? path = null,
|
|
1488
|
+
List<List<object?>>? pool = null)
|
|
1489
|
+
{
|
|
1490
|
+
pool ??= [[]];
|
|
1491
|
+
path ??= pool[0];
|
|
1492
|
+
|
|
1493
|
+
int depth = path.Count;
|
|
1494
|
+
|
|
1495
|
+
object? out_ = before == null ? val : before(key, val, parent, path);
|
|
1496
|
+
|
|
1497
|
+
int md = (maxdepth.HasValue && maxdepth.Value >= 0) ? maxdepth.Value : MAXDEPTH;
|
|
1498
|
+
if (md == 0 || depth >= md)
|
|
1499
|
+
{
|
|
1500
|
+
return out_;
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
if (IsNode(out_))
|
|
1504
|
+
{
|
|
1505
|
+
int childDepth = depth + 1;
|
|
1506
|
+
|
|
1507
|
+
// Grow pool on demand so pool[childDepth] exists.
|
|
1508
|
+
while (pool.Count <= childDepth)
|
|
1509
|
+
{
|
|
1510
|
+
pool.Add(new List<object?>(pool.Count));
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
List<object?> childPath = pool[childDepth];
|
|
1514
|
+
|
|
1515
|
+
// Ensure childPath has exactly childDepth slots (mutated in place below).
|
|
1516
|
+
if (childPath.Count < childDepth)
|
|
1517
|
+
{
|
|
1518
|
+
while (childPath.Count < childDepth)
|
|
1519
|
+
{
|
|
1520
|
+
childPath.Add(null);
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
else if (childPath.Count > childDepth)
|
|
1524
|
+
{
|
|
1525
|
+
childPath.RemoveRange(childDepth, childPath.Count - childDepth);
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
// Sync prefix [0..depth-1] from the current path. Only needed once per
|
|
1529
|
+
// parent: siblings share the same prefix and will each overwrite slot
|
|
1530
|
+
// [depth] below.
|
|
1531
|
+
for (int i = 0; i < depth; i++)
|
|
1532
|
+
{
|
|
1533
|
+
childPath[i] = path[i];
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
foreach (var item in Items(out_))
|
|
1537
|
+
{
|
|
1538
|
+
string ckey = StrKey(item[0]) ?? S_MT;
|
|
1539
|
+
object? child = item[1];
|
|
1540
|
+
childPath[depth] = ckey;
|
|
1541
|
+
SetProp(out_, ckey, Walk(child, before, after, maxdepth, ckey, out_, childPath, pool));
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
out_ = after == null ? out_ : after(key, out_, parent, path);
|
|
1546
|
+
|
|
1547
|
+
return out_;
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
|
|
1551
|
+
// ========================================================================
|
|
1552
|
+
// Merge
|
|
1553
|
+
// ========================================================================
|
|
1554
|
+
|
|
1555
|
+
// Merge a list of values into each other. Later values take precedence.
|
|
1556
|
+
// Nodes override scalars; mismatched node kinds override rather than merge.
|
|
1557
|
+
// maxdepth: null/-1 → MAXDEPTH (full deep merge). 0 → empty-shell output.
|
|
1558
|
+
public static object? Merge(object? val, int? maxdepth = null)
|
|
1559
|
+
{
|
|
1560
|
+
if (!IsList(val))
|
|
1561
|
+
{
|
|
1562
|
+
return val;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
int md = maxdepth.HasValue ? (maxdepth.Value < 0 ? 0 : maxdepth.Value) : MAXDEPTH;
|
|
1566
|
+
|
|
1567
|
+
var list = (List<object?>)val!;
|
|
1568
|
+
int lenlist = list.Count;
|
|
1569
|
+
|
|
1570
|
+
if (lenlist == 0)
|
|
1571
|
+
{
|
|
1572
|
+
return null;
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
if (lenlist == 1)
|
|
1576
|
+
{
|
|
1577
|
+
return list[0];
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
// Start with first element (or empty map if null).
|
|
1581
|
+
object? out_ = GetProp(list, 0) ?? new Dictionary<string, object?>();
|
|
1582
|
+
|
|
1583
|
+
for (int oI = 1; oI < lenlist; oI++)
|
|
1584
|
+
{
|
|
1585
|
+
object? obj = list[oI];
|
|
1586
|
+
|
|
1587
|
+
if (!IsNode(obj))
|
|
1588
|
+
{
|
|
1589
|
+
out_ = obj; // Scalar wins.
|
|
1590
|
+
}
|
|
1591
|
+
else
|
|
1592
|
+
{
|
|
1593
|
+
// cur[pI] = working value at depth pI in the output.
|
|
1594
|
+
// dst[pI] = existing value at depth pI in the destination (out_).
|
|
1595
|
+
var cur = new object?[MAXDEPTH + 2];
|
|
1596
|
+
var dst = new object?[MAXDEPTH + 2];
|
|
1597
|
+
cur[0] = out_;
|
|
1598
|
+
dst[0] = out_;
|
|
1599
|
+
|
|
1600
|
+
object? mergeBefore(object? key, object? mval, object? _parent, List<object?> path)
|
|
1601
|
+
{
|
|
1602
|
+
int pI = path.Count;
|
|
1603
|
+
|
|
1604
|
+
if (md <= pI)
|
|
1605
|
+
{
|
|
1606
|
+
// Beyond max depth: copy directly.
|
|
1607
|
+
if (key != null)
|
|
1608
|
+
{
|
|
1609
|
+
SetProp(cur[pI - 1], key, mval);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
else if (!IsNode(mval))
|
|
1613
|
+
{
|
|
1614
|
+
cur[pI] = mval;
|
|
1615
|
+
}
|
|
1616
|
+
else
|
|
1617
|
+
{
|
|
1618
|
+
// Navigate destination parallel to current override path.
|
|
1619
|
+
if (pI > 0 && key != null)
|
|
1620
|
+
{
|
|
1621
|
+
dst[pI] = GetProp(dst[pI - 1], key);
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
object? tval = dst[pI];
|
|
1625
|
+
|
|
1626
|
+
if (tval == null && 0 == (T.Instance & Typify(mval)))
|
|
1627
|
+
{
|
|
1628
|
+
// Destination absent → create empty node.
|
|
1629
|
+
cur[pI] = IsList(mval)
|
|
1630
|
+
? (object?)new List<object?>()
|
|
1631
|
+
: new Dictionary<string, object?>();
|
|
1632
|
+
}
|
|
1633
|
+
else if (Typify(mval) == Typify(tval))
|
|
1634
|
+
{
|
|
1635
|
+
// Same type → merge into existing destination node.
|
|
1636
|
+
cur[pI] = tval;
|
|
1637
|
+
}
|
|
1638
|
+
else
|
|
1639
|
+
{
|
|
1640
|
+
// Type mismatch → override wins, skip descending.
|
|
1641
|
+
cur[pI] = mval;
|
|
1642
|
+
mval = null;
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
return mval;
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
object? mergeAfter(object? key, object? _, object? _parent, List<object?> path)
|
|
1650
|
+
{
|
|
1651
|
+
int cI = path.Count;
|
|
1652
|
+
if (key == null || cI <= 0)
|
|
1653
|
+
{
|
|
1654
|
+
return cur[0];
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
object? value = cur[cI];
|
|
1658
|
+
cur[cI - 1] = SetProp(cur[cI - 1], key, value) ?? cur[cI - 1];
|
|
1659
|
+
return value;
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
Walk(obj, mergeBefore, mergeAfter, md);
|
|
1663
|
+
out_ = cur[0];
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
// md=0: return empty shell of last element's type.
|
|
1668
|
+
if (md == 0)
|
|
1669
|
+
{
|
|
1670
|
+
out_ = GetElem(list, -1);
|
|
1671
|
+
if (IsList(out_))
|
|
1672
|
+
{
|
|
1673
|
+
out_ = new List<object?>();
|
|
1674
|
+
}
|
|
1675
|
+
else if (IsMap(out_))
|
|
1676
|
+
{
|
|
1677
|
+
out_ = new Dictionary<string, object?>();
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
return out_;
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
|
|
1685
|
+
// ========================================================================
|
|
1686
|
+
// Inject
|
|
1687
|
+
// ========================================================================
|
|
1688
|
+
|
|
1689
|
+
// Default handler: invokes transform functions (keys starting with $)
|
|
1690
|
+
// or updates the parent node when a full-match injection is resolved.
|
|
1691
|
+
private static readonly Injector _InjectHandler = (inj, val, refStr, store) =>
|
|
1692
|
+
{
|
|
1693
|
+
object? out_ = val;
|
|
1694
|
+
bool iscmd = IsFunc(val) && (refStr == null || refStr.StartsWith(S_DS, StringComparison.Ordinal));
|
|
1695
|
+
if (iscmd && val is Injector injFn)
|
|
1696
|
+
{
|
|
1697
|
+
out_ = injFn(inj, val, refStr, store);
|
|
1698
|
+
}
|
|
1699
|
+
else if (inj.Mode == M_VAL && inj.Full)
|
|
1700
|
+
{
|
|
1701
|
+
inj.SetVal(val);
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
return out_;
|
|
1705
|
+
};
|
|
1706
|
+
|
|
1707
|
+
|
|
1708
|
+
// Inject store values into a string. Not a public utility – used by Inject.
|
|
1709
|
+
// Backtick-delimited references (e.g. "`a.b`") are resolved via GetPath.
|
|
1710
|
+
// A string that is entirely one reference returns the raw resolved value.
|
|
1711
|
+
// A string with embedded references has each one stringified in-place.
|
|
1712
|
+
private static object? _InjectStr(string val, object? store, object? current, InjectState? state)
|
|
1713
|
+
{
|
|
1714
|
+
if (val == S_MT)
|
|
1715
|
+
{
|
|
1716
|
+
return S_MT;
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
var m = R_INJECTION_FULL.Match(val);
|
|
1720
|
+
|
|
1721
|
+
if (m.Success)
|
|
1722
|
+
{
|
|
1723
|
+
if (state != null)
|
|
1724
|
+
{
|
|
1725
|
+
state.Full = true;
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
string pathref = m.Groups[1].Value;
|
|
1729
|
+
// Unescape $BT → ` and $DS → $
|
|
1730
|
+
if (pathref.Length > 3)
|
|
1731
|
+
{
|
|
1732
|
+
pathref = pathref.Replace("$BT", S_BT).Replace("$DS", S_DS);
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
return GetPath(store, pathref, current, state);
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
// Replace every embedded `ref` with its stringified resolved value.
|
|
1739
|
+
object? outStr = R_INJECTION_PARTIAL.Replace(val, match =>
|
|
1740
|
+
{
|
|
1741
|
+
string ref_ = match.Groups[1].Value;
|
|
1742
|
+
if (ref_.Length > 3)
|
|
1743
|
+
{
|
|
1744
|
+
ref_ = ref_.Replace("$BT", S_BT).Replace("$DS", S_DS);
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
if (state != null)
|
|
1748
|
+
{
|
|
1749
|
+
state.Full = false;
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
object? found = GetPath(store, ref_, current, state);
|
|
1753
|
+
if (found == null)
|
|
1754
|
+
{
|
|
1755
|
+
// Distinguish an explicit null value (key exists) from a
|
|
1756
|
+
// missing key. Only top-level single-segment paths are checked.
|
|
1757
|
+
bool keyExists = !ref_.Contains('.')
|
|
1758
|
+
&& store is Dictionary<string, object?> sm
|
|
1759
|
+
&& sm.ContainsKey(ref_);
|
|
1760
|
+
return keyExists ? S_null : S_MT;
|
|
1761
|
+
}
|
|
1762
|
+
if (found is string fs)
|
|
1763
|
+
{
|
|
1764
|
+
return fs;
|
|
1765
|
+
}
|
|
1766
|
+
// Non-string, non-null → serialize as compact JSON.
|
|
1767
|
+
try
|
|
1768
|
+
{
|
|
1769
|
+
return JsonSerializer.Serialize(found, JSON_OPTS_COMPACT);
|
|
1770
|
+
}
|
|
1771
|
+
catch { return Stringify(found); }
|
|
1772
|
+
});
|
|
1773
|
+
|
|
1774
|
+
// Custom handler on the whole string (e.g. for post-processing by transforms).
|
|
1775
|
+
if (state?.Handler != null && IsFunc(state.Handler))
|
|
1776
|
+
{
|
|
1777
|
+
state.Full = true;
|
|
1778
|
+
outStr = state.Handler(state, outStr, val, store);
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
return outStr;
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
|
|
1785
|
+
// Inject values from a data store into a node recursively.
|
|
1786
|
+
// Backtick-delimited path references in string values are replaced with
|
|
1787
|
+
// the resolved store values. The optional state carries context for
|
|
1788
|
+
// recursive calls; callers at the root should pass null.
|
|
1789
|
+
public static object? Inject(object? val, object? store, InjectState? state = null)
|
|
1790
|
+
{
|
|
1791
|
+
// ── Root initialisation ──────────────────────────────────────────────
|
|
1792
|
+
if (state == null || state.Mode == 0)
|
|
1793
|
+
{
|
|
1794
|
+
// Wrap val inside a virtual {$TOP: val} parent so every code path
|
|
1795
|
+
// can use the same "set value in parent" logic.
|
|
1796
|
+
var parent = new Dictionary<string, object?> { [S_DTOP] = val };
|
|
1797
|
+
var newState = new InjectState
|
|
1798
|
+
{
|
|
1799
|
+
Mode = M_VAL,
|
|
1800
|
+
Full = false,
|
|
1801
|
+
KeyI = 0,
|
|
1802
|
+
Keys = [(object?)S_DTOP],
|
|
1803
|
+
Key = S_DTOP,
|
|
1804
|
+
Val = val,
|
|
1805
|
+
Parent = parent,
|
|
1806
|
+
Path = [(object?)S_DTOP],
|
|
1807
|
+
Nodes = [(object?)parent],
|
|
1808
|
+
Handler = _InjectHandler,
|
|
1809
|
+
Base = S_DTOP,
|
|
1810
|
+
Errs = (GetProp(store, S_DERRS) as List<object?>) ?? [],
|
|
1811
|
+
Meta = new Dictionary<string, object?> { ["__d"] = 0L },
|
|
1812
|
+
DParent = store,
|
|
1813
|
+
DPath = [(object?)S_DTOP],
|
|
1814
|
+
};
|
|
1815
|
+
|
|
1816
|
+
// Allow a partial injdef to override defaults.
|
|
1817
|
+
if (state != null)
|
|
1818
|
+
{
|
|
1819
|
+
if (state.ModifyFn != null)
|
|
1820
|
+
{
|
|
1821
|
+
newState.ModifyFn = state.ModifyFn;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
if (state.Extra != null)
|
|
1825
|
+
{
|
|
1826
|
+
newState.Extra = state.Extra;
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
if (state.Meta != null)
|
|
1830
|
+
{
|
|
1831
|
+
newState.Meta = state.Meta;
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
if (state.Handler != null)
|
|
1835
|
+
{
|
|
1836
|
+
newState.Handler = state.Handler;
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
state = newState;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
state.Descend();
|
|
1844
|
+
|
|
1845
|
+
// ── Node: recurse into children ──────────────────────────────────────
|
|
1846
|
+
if (IsNode(val))
|
|
1847
|
+
{
|
|
1848
|
+
// Non-$ keys first (deterministic order), then $ transform keys.
|
|
1849
|
+
var allKeys = KeysOf(val);
|
|
1850
|
+
List<object?> keys;
|
|
1851
|
+
if (IsMap(val))
|
|
1852
|
+
{
|
|
1853
|
+
var normal = allKeys.Where(k => !k.Contains(S_DS)).ToList();
|
|
1854
|
+
var transform = allKeys.Where(k => k.Contains(S_DS)).ToList();
|
|
1855
|
+
keys = [.. normal.Cast<object?>(), .. transform.Cast<object?>()];
|
|
1856
|
+
}
|
|
1857
|
+
else
|
|
1858
|
+
{
|
|
1859
|
+
keys = allKeys.Cast<object?>().ToList();
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
int nkI = 0;
|
|
1863
|
+
while (nkI < keys.Count)
|
|
1864
|
+
{
|
|
1865
|
+
string nodekey = StrKey(keys[nkI]) ?? S_MT;
|
|
1866
|
+
var childinj = state.Child(nkI, keys);
|
|
1867
|
+
childinj.Mode = M_KEYPRE;
|
|
1868
|
+
|
|
1869
|
+
object? preKey = _InjectStr(nodekey, store, state.DParent, childinj);
|
|
1870
|
+
|
|
1871
|
+
// Read back any key-list / index modifications from the child.
|
|
1872
|
+
nkI = childinj.KeyI;
|
|
1873
|
+
keys = childinj.Keys;
|
|
1874
|
+
val = childinj.Parent;
|
|
1875
|
+
|
|
1876
|
+
// TS: if (NONE !== prekey) — skip NONE/undefined (e.g. $CHILD KEYPRE). Also skip null prekey.
|
|
1877
|
+
if (preKey != null && !ReferenceEquals(preKey, NONE))
|
|
1878
|
+
{
|
|
1879
|
+
object? childval = GetProp(val, preKey);
|
|
1880
|
+
childinj.Val = childval;
|
|
1881
|
+
childinj.Mode = M_VAL;
|
|
1882
|
+
|
|
1883
|
+
Inject(childval, store, childinj);
|
|
1884
|
+
|
|
1885
|
+
nkI = childinj.KeyI;
|
|
1886
|
+
keys = childinj.Keys;
|
|
1887
|
+
val = childinj.Parent;
|
|
1888
|
+
|
|
1889
|
+
childinj.Mode = M_KEYPOST;
|
|
1890
|
+
_InjectStr(nodekey, store, state.DParent, childinj);
|
|
1891
|
+
|
|
1892
|
+
nkI = childinj.KeyI;
|
|
1893
|
+
keys = childinj.Keys;
|
|
1894
|
+
val = childinj.Parent;
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
nkI++;
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
// ── String scalar: resolve backtick references ──────────────────────
|
|
1902
|
+
else if (0 < (T.Str & Typify(val)) && val is string strVal)
|
|
1903
|
+
{
|
|
1904
|
+
state.Mode = M_VAL;
|
|
1905
|
+
object? injected = _InjectStr(strVal, store, state.DParent, state);
|
|
1906
|
+
bool isSkip = injected is Dictionary<string, object?> sd && sd.ContainsKey("`$SKIP`");
|
|
1907
|
+
if (!isSkip)
|
|
1908
|
+
{
|
|
1909
|
+
state.SetVal(injected);
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
val = injected;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
// ── Custom modify callback ───────────────────────────────────────────
|
|
1916
|
+
if (state.ModifyFn != null)
|
|
1917
|
+
{
|
|
1918
|
+
bool isSkip = val is Dictionary<string, object?> sd2 && sd2.ContainsKey("`$SKIP`");
|
|
1919
|
+
if (!isSkip)
|
|
1920
|
+
{
|
|
1921
|
+
object? mparent = state.Parent;
|
|
1922
|
+
object? mval = GetProp(mparent, state.Key);
|
|
1923
|
+
state.ModifyFn(mval, state.Key, mparent, state, store);
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
state.Val = val;
|
|
1928
|
+
|
|
1929
|
+
// The top-level return is the injected value extracted from its wrapper.
|
|
1930
|
+
return GetProp(state.Parent, S_DTOP);
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1933
|
+
|
|
1934
|
+
// ========================================================================
|
|
1935
|
+
// Transform helpers
|
|
1936
|
+
// ========================================================================
|
|
1937
|
+
|
|
1938
|
+
// Verify the injection mode is valid for a given transform.
|
|
1939
|
+
public static bool CheckPlacement(int modes, string name, int parentType, InjectState state)
|
|
1940
|
+
{
|
|
1941
|
+
static string PlacementName(int mode)
|
|
1942
|
+
{
|
|
1943
|
+
return mode == M_VAL ? "value" : S_key;
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
if (0 == (modes & state.Mode))
|
|
1947
|
+
{
|
|
1948
|
+
var expected = new List<string>();
|
|
1949
|
+
foreach (int m in new[] { M_KEYPRE, M_KEYPOST, M_VAL })
|
|
1950
|
+
{
|
|
1951
|
+
if (0 != (modes & m))
|
|
1952
|
+
{
|
|
1953
|
+
expected.Add(PlacementName(m));
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
string exp = Join(expected.Cast<object?>().ToList(), ", ");
|
|
1958
|
+
state.Errs.Add($"${name}: invalid placement as {PlacementName(state.Mode)}, expected: {exp}.");
|
|
1959
|
+
return false;
|
|
1960
|
+
}
|
|
1961
|
+
if (parentType != 0 && parentType != T.Any && 0 == (parentType & Typify(state.Parent)))
|
|
1962
|
+
{
|
|
1963
|
+
state.Errs.Add($"${name}: invalid placement in parent {TypeName(Typify(state.Parent))}, " +
|
|
1964
|
+
$"expected: {TypeName(parentType)}.");
|
|
1965
|
+
return false;
|
|
1966
|
+
}
|
|
1967
|
+
return true;
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
// Validate injector arguments: returns [null|errMsg, arg0, arg1, ...].
|
|
1971
|
+
public static List<object?> InjectorArgs(List<int> argTypes, object? args)
|
|
1972
|
+
{
|
|
1973
|
+
var argslist = args as List<object?> ?? [];
|
|
1974
|
+
int numargs = argTypes.Count;
|
|
1975
|
+
var found = new List<object?> { null }; // found[0] = null means OK
|
|
1976
|
+
|
|
1977
|
+
for (int ai = 0; ai < numargs; ai++)
|
|
1978
|
+
{
|
|
1979
|
+
object? arg = GetElem(argslist, ai);
|
|
1980
|
+
int argType = Typify(arg);
|
|
1981
|
+
if (0 == (argTypes[ai] & argType))
|
|
1982
|
+
{
|
|
1983
|
+
found[0] = $"invalid argument: {Stringify(arg, 22)} " +
|
|
1984
|
+
$"({TypeName(argType)} at position {1 + ai}) " +
|
|
1985
|
+
$"is not of type: {TypeName(argTypes[ai])}.";
|
|
1986
|
+
while (found.Count <= numargs)
|
|
1987
|
+
{
|
|
1988
|
+
found.Add(null);
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
return found;
|
|
1992
|
+
}
|
|
1993
|
+
found.Add(arg);
|
|
1994
|
+
}
|
|
1995
|
+
while (found.Count <= numargs)
|
|
1996
|
+
{
|
|
1997
|
+
found.Add(null);
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
return found;
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
// Create an inject child context to re-inject a sub-value in the right scope.
|
|
2004
|
+
private static InjectState _InjectChild(object? child, object? store, InjectState inj)
|
|
2005
|
+
{
|
|
2006
|
+
InjectState cinj = inj;
|
|
2007
|
+
if (inj.Prior != null)
|
|
2008
|
+
{
|
|
2009
|
+
if (inj.Prior.Prior != null)
|
|
2010
|
+
{
|
|
2011
|
+
cinj = inj.Prior.Prior.Child(inj.Prior.KeyI, inj.Prior.Keys);
|
|
2012
|
+
cinj.Val = child;
|
|
2013
|
+
SetProp(cinj.Parent, inj.Prior.Key, child);
|
|
2014
|
+
}
|
|
2015
|
+
else
|
|
2016
|
+
{
|
|
2017
|
+
cinj = inj.Prior.Child(inj.KeyI, inj.Keys);
|
|
2018
|
+
cinj.Val = child;
|
|
2019
|
+
SetProp(cinj.Parent, inj.Key, child);
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
Inject(child, store, cinj);
|
|
2023
|
+
return cinj;
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
// ========================================================================
|
|
2027
|
+
// Transform sub-transforms
|
|
2028
|
+
// ========================================================================
|
|
2029
|
+
|
|
2030
|
+
// Delete a key from its parent.
|
|
2031
|
+
private static readonly Injector _TransformDelete = (inj, val, refStr, store) =>
|
|
2032
|
+
{
|
|
2033
|
+
inj.SetVal(null);
|
|
2034
|
+
return null;
|
|
2035
|
+
};
|
|
2036
|
+
|
|
2037
|
+
// Copy value from source data (DParent) at the same key.
|
|
2038
|
+
private static readonly Injector _TransformCopy = (inj, val, refStr, store) =>
|
|
2039
|
+
{
|
|
2040
|
+
if (!CheckPlacement(M_VAL, "COPY", T.Any, inj))
|
|
2041
|
+
{
|
|
2042
|
+
return null;
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2045
|
+
object? out_ = GetProp(inj.DParent, inj.Key);
|
|
2046
|
+
inj.SetVal(out_);
|
|
2047
|
+
return out_;
|
|
2048
|
+
};
|
|
2049
|
+
|
|
2050
|
+
// Return the key of the current node from $KEY meta or $ANNO or path.
|
|
2051
|
+
private static readonly Injector _TransformKey = (inj, val, refStr, store) =>
|
|
2052
|
+
{
|
|
2053
|
+
if (inj.Mode != M_VAL)
|
|
2054
|
+
{
|
|
2055
|
+
return null;
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
object? keyspec = GetProp(inj.Parent, S_BKEY);
|
|
2059
|
+
if (keyspec != null)
|
|
2060
|
+
{
|
|
2061
|
+
DelProp(inj.Parent, S_BKEY);
|
|
2062
|
+
return GetProp(inj.DParent, keyspec);
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
object? anno = GetProp(inj.Parent, S_BANNO);
|
|
2066
|
+
object? pkey = GetProp(anno, S_KEY);
|
|
2067
|
+
return pkey ?? GetElem(inj.Path, -2);
|
|
2068
|
+
};
|
|
2069
|
+
|
|
2070
|
+
// Remove the $ANNO annotation from the parent node.
|
|
2071
|
+
private static readonly Injector _TransformAnno = (inj, val, refStr, store) =>
|
|
2072
|
+
{
|
|
2073
|
+
DelProp(inj.Parent, S_BANNO);
|
|
2074
|
+
return null;
|
|
2075
|
+
};
|
|
2076
|
+
|
|
2077
|
+
// Remove the $META annotation from the parent node.
|
|
2078
|
+
private static readonly Injector _TransformMeta = (inj, val, refStr, store) =>
|
|
2079
|
+
{
|
|
2080
|
+
DelProp(inj.Parent, "`$META`");
|
|
2081
|
+
return null;
|
|
2082
|
+
};
|
|
2083
|
+
|
|
2084
|
+
// Merge a list of objects into the current node.
|
|
2085
|
+
private static readonly Injector _TransformMerge = (inj, val, refStr, store) =>
|
|
2086
|
+
{
|
|
2087
|
+
if (inj.Mode == M_KEYPRE)
|
|
2088
|
+
{
|
|
2089
|
+
return inj.Key;
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
if (inj.Mode == M_KEYPOST)
|
|
2093
|
+
{
|
|
2094
|
+
object? args = GetProp(inj.Parent, inj.Key);
|
|
2095
|
+
if (args is string sa && sa == S_MT)
|
|
2096
|
+
{
|
|
2097
|
+
args = new List<object?> { GetProp(store, S_DTOP) };
|
|
2098
|
+
}
|
|
2099
|
+
else if (!IsList(args))
|
|
2100
|
+
{
|
|
2101
|
+
args = new List<object?> { args };
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
inj.SetVal(null); // remove the $MERGE key from parent
|
|
2105
|
+
|
|
2106
|
+
if (args is not List<object?> list)
|
|
2107
|
+
{
|
|
2108
|
+
return inj.Key;
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
var mergeList = new List<object?> { inj.Parent };
|
|
2112
|
+
mergeList.AddRange(list);
|
|
2113
|
+
mergeList.Add(Clone(inj.Parent));
|
|
2114
|
+
Merge(mergeList);
|
|
2115
|
+
|
|
2116
|
+
return inj.Key;
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
return null; // VAL mode: skip
|
|
2120
|
+
};
|
|
2121
|
+
|
|
2122
|
+
// Convert a node to a list by iterating over a source path.
|
|
2123
|
+
private static readonly Injector _TransformEach = (inj, val, refStr, store) =>
|
|
2124
|
+
{
|
|
2125
|
+
if (!CheckPlacement(M_VAL, "EACH", T.List, inj))
|
|
2126
|
+
{
|
|
2127
|
+
return null;
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
// Truncate keys to just the first element.
|
|
2131
|
+
if (inj.Keys.Count > 1)
|
|
2132
|
+
{
|
|
2133
|
+
inj.Keys.RemoveRange(1, inj.Keys.Count - 1);
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
// Get args: ['`$EACH`', 'source-path', child-template]
|
|
2137
|
+
var parentList = inj.Parent as List<object?> ?? [];
|
|
2138
|
+
var sliced = parentList.Count > 1 ? parentList.GetRange(1, parentList.Count - 1) : [];
|
|
2139
|
+
var args = InjectorArgs([T.Str, T.Any], sliced);
|
|
2140
|
+
if (args[0] != null)
|
|
2141
|
+
{
|
|
2142
|
+
inj.Errs.Add("$EACH: " + args[0]);
|
|
2143
|
+
return null;
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
string srcpath = (string)args[1]!;
|
|
2147
|
+
object? child = args[2];
|
|
2148
|
+
|
|
2149
|
+
// Source data.
|
|
2150
|
+
object? srcstore = GetProp(store, inj.Base, store);
|
|
2151
|
+
object? src = GetPath(srcstore, srcpath, null, inj);
|
|
2152
|
+
int srctype = Typify(src);
|
|
2153
|
+
|
|
2154
|
+
object? tval = null;
|
|
2155
|
+
|
|
2156
|
+
if (0 < (T.List & srctype))
|
|
2157
|
+
{
|
|
2158
|
+
var sl = (List<object?>)src!;
|
|
2159
|
+
tval = sl.Select(_ => Clone(child)).ToList();
|
|
2160
|
+
}
|
|
2161
|
+
else if (0 < (T.Map & srctype))
|
|
2162
|
+
{
|
|
2163
|
+
tval = Items(src).Select(item => Merge(
|
|
2164
|
+
new List<object?> {
|
|
2165
|
+
Clone(child),
|
|
2166
|
+
new Dictionary<string, object?> { [S_BANNO] = new Dictionary<string, object?> { [S_KEY] = item[0] } }
|
|
2167
|
+
}, 1)).ToList();
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
var rval = new List<object?>();
|
|
2171
|
+
|
|
2172
|
+
if (tval != null && Size(tval) > 0)
|
|
2173
|
+
{
|
|
2174
|
+
var tvalList = (List<object?>)tval;
|
|
2175
|
+
|
|
2176
|
+
// Source values for DParent navigation.
|
|
2177
|
+
List<object?> srcVals = IsMap(src) ? Items(src).Select(item => item[1]).ToList() : src as List<object?> ?? [];
|
|
2178
|
+
string ckey = StrKey(GetElem(inj.Path, -2)) ?? S_DTOP;
|
|
2179
|
+
string tkey = ckey;
|
|
2180
|
+
object? target = GetElem(inj.Nodes, -2) ?? GetElem(inj.Nodes, -1);
|
|
2181
|
+
|
|
2182
|
+
// tpath = path[:-1] (all but last element, same as Go)
|
|
2183
|
+
var tpath = inj.Path.Count > 0
|
|
2184
|
+
? inj.Path.GetRange(0, inj.Path.Count - 1).Cast<object?>().ToList()
|
|
2185
|
+
: [];
|
|
2186
|
+
|
|
2187
|
+
// dpath: [$TOP, ...srcpath.split('.'), $:ckey, ...]
|
|
2188
|
+
var dpath = new List<object?> { (object?)S_DTOP };
|
|
2189
|
+
foreach (var p in srcpath.Split('.'))
|
|
2190
|
+
{
|
|
2191
|
+
dpath.Add(p);
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
dpath.Add("$:" + ckey);
|
|
2195
|
+
|
|
2196
|
+
// tcur: {ckey: srcVals}
|
|
2197
|
+
object? tcur = (object?)new Dictionary<string, object?> { [ckey] = (object?)srcVals };
|
|
2198
|
+
|
|
2199
|
+
if (tpath.Count > 1)
|
|
2200
|
+
{
|
|
2201
|
+
string pkey = StrKey(GetElem(inj.Path, -3)) ?? S_DTOP;
|
|
2202
|
+
tcur = new Dictionary<string, object?> { [pkey] = tcur };
|
|
2203
|
+
dpath.Add("$:" + pkey);
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
// Build tinj child state.
|
|
2207
|
+
var tinj = inj.Child(0, [(object?)ckey]);
|
|
2208
|
+
tinj.Path = tpath;
|
|
2209
|
+
tinj.Nodes = inj.Nodes.Count > 0
|
|
2210
|
+
? [inj.Nodes[^1]]
|
|
2211
|
+
: [];
|
|
2212
|
+
tinj.Parent = tinj.Nodes.Count > 0 ? tinj.Nodes[^1] : null;
|
|
2213
|
+
|
|
2214
|
+
SetProp(tinj.Parent, ckey, tvalList);
|
|
2215
|
+
tinj.Val = tvalList;
|
|
2216
|
+
tinj.DPath = dpath;
|
|
2217
|
+
tinj.DParent = tcur;
|
|
2218
|
+
|
|
2219
|
+
Inject(tvalList, store, tinj);
|
|
2220
|
+
|
|
2221
|
+
rval = tinj.Val as List<object?> ?? rval;
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
// Set result on the parent target.
|
|
2225
|
+
string ftkey = StrKey(GetElem(inj.Path, -2)) ?? S_DTOP;
|
|
2226
|
+
object? ftarget = GetElem(inj.Nodes, -2) ?? GetElem(inj.Nodes, -1);
|
|
2227
|
+
SetProp(ftarget, ftkey, rval);
|
|
2228
|
+
|
|
2229
|
+
return rval.Count > 0 ? rval[0] : null;
|
|
2230
|
+
};
|
|
2231
|
+
|
|
2232
|
+
// Convert a node to a map by packing source items.
|
|
2233
|
+
private static readonly Injector _TransformPack = (inj, val, refStr, store) =>
|
|
2234
|
+
{
|
|
2235
|
+
if (!CheckPlacement(M_KEYPRE, "PACK", T.Map, inj))
|
|
2236
|
+
{
|
|
2237
|
+
return null;
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
// Get args: [srcpath, childspec]
|
|
2241
|
+
object? argsRaw = GetProp(inj.Parent, inj.Key);
|
|
2242
|
+
var argsList = argsRaw as List<object?> ?? [];
|
|
2243
|
+
var args = InjectorArgs([T.Str, T.Any], argsList);
|
|
2244
|
+
if (args[0] != null)
|
|
2245
|
+
{
|
|
2246
|
+
inj.Errs.Add("$PACK: " + args[0]);
|
|
2247
|
+
return null;
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
string srcpath = (string)args[1]!;
|
|
2251
|
+
object? origchildspec = args[2];
|
|
2252
|
+
|
|
2253
|
+
// Target key and node.
|
|
2254
|
+
string tkey = StrKey(GetElem(inj.Path, -2)) ?? S_DTOP;
|
|
2255
|
+
int psz = inj.Path.Count;
|
|
2256
|
+
object? target = psz >= 2 ? inj.Nodes[psz - 2] : (psz >= 1 ? inj.Nodes[psz - 1] : null);
|
|
2257
|
+
|
|
2258
|
+
// Source data.
|
|
2259
|
+
object? srcstore = GetProp(store, inj.Base, store);
|
|
2260
|
+
object? src = GetPath(srcstore, srcpath, null, inj);
|
|
2261
|
+
|
|
2262
|
+
// Normalise src to a flat list.
|
|
2263
|
+
if (!IsList(src))
|
|
2264
|
+
{
|
|
2265
|
+
if (IsMap(src))
|
|
2266
|
+
{
|
|
2267
|
+
src = Items(src).Select(item =>
|
|
2268
|
+
{
|
|
2269
|
+
var node = item[1];
|
|
2270
|
+
if (IsMap(node))
|
|
2271
|
+
{
|
|
2272
|
+
SetProp(node, S_BANNO, new Dictionary<string, object?> { [S_KEY] = item[0] });
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
return node;
|
|
2276
|
+
}).ToList();
|
|
2277
|
+
}
|
|
2278
|
+
else
|
|
2279
|
+
{
|
|
2280
|
+
return null;
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
if (src == null)
|
|
2285
|
+
{
|
|
2286
|
+
return null;
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
// Extract keypath and child template.
|
|
2290
|
+
object? keypath = GetProp(origchildspec, S_BKEY);
|
|
2291
|
+
object? childspec = DelProp(Clone(origchildspec), S_BKEY) ?? origchildspec;
|
|
2292
|
+
object? child = GetProp(childspec, S_BVAL, childspec);
|
|
2293
|
+
|
|
2294
|
+
var srclist = (List<object?>)src;
|
|
2295
|
+
|
|
2296
|
+
// Resolve output key for a source item.
|
|
2297
|
+
string ResolveKey(object? srcItem, int idx)
|
|
2298
|
+
{
|
|
2299
|
+
if (keypath == null)
|
|
2300
|
+
{
|
|
2301
|
+
return idx.ToString(CultureInfo.InvariantCulture);
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2304
|
+
if (keypath is not string kpStr)
|
|
2305
|
+
{
|
|
2306
|
+
return "";
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
if (kpStr.StartsWith('`'))
|
|
2310
|
+
{
|
|
2311
|
+
// inject keypath with srcItem as $TOP
|
|
2312
|
+
var ks = new Dictionary<string, object?>(store is Dictionary<string, object?> sd ? sd : []) { [S_DTOP] = srcItem };
|
|
2313
|
+
var kr = Inject(kpStr, ks);
|
|
2314
|
+
return kr?.ToString() ?? "";
|
|
2315
|
+
}
|
|
2316
|
+
else
|
|
2317
|
+
{
|
|
2318
|
+
var kval = GetPath(srcItem, kpStr, null, inj);
|
|
2319
|
+
return kval?.ToString() ?? "";
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
// Build tval (output map with injected children).
|
|
2324
|
+
var tval = new Dictionary<string, object?>();
|
|
2325
|
+
|
|
2326
|
+
for (int i = 0; i < srclist.Count; i++)
|
|
2327
|
+
{
|
|
2328
|
+
object? srcItem = srclist[i];
|
|
2329
|
+
string outKey = ResolveKey(srcItem, i);
|
|
2330
|
+
if (outKey == "")
|
|
2331
|
+
{
|
|
2332
|
+
continue;
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
object? tchild = Clone(child);
|
|
2336
|
+
|
|
2337
|
+
// Forward $ANNO from src (for map sources annotated above).
|
|
2338
|
+
object? anno = GetProp(srcItem, S_BANNO);
|
|
2339
|
+
if (anno != null && IsMap(tchild))
|
|
2340
|
+
{
|
|
2341
|
+
SetProp(tchild, S_BANNO, anno);
|
|
2342
|
+
}
|
|
2343
|
+
else if (anno == null && IsMap(tchild))
|
|
2344
|
+
{
|
|
2345
|
+
DelProp(tchild, S_BANNO);
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2348
|
+
tval[outKey] = tchild;
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
var rval = new Dictionary<string, object?>();
|
|
2352
|
+
|
|
2353
|
+
if (tval.Count > 0)
|
|
2354
|
+
{
|
|
2355
|
+
// Build parallel source map for DParent navigation.
|
|
2356
|
+
var tsrc = new Dictionary<string, object?>();
|
|
2357
|
+
for (int i = 0; i < srclist.Count; i++)
|
|
2358
|
+
{
|
|
2359
|
+
string ok = ResolveKey(srclist[i], i);
|
|
2360
|
+
if (ok != "")
|
|
2361
|
+
{
|
|
2362
|
+
tsrc[ok] = srclist[i];
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
string ckey = tkey;
|
|
2367
|
+
var tpath = inj.Path.Count > 0
|
|
2368
|
+
? inj.Path.GetRange(0, inj.Path.Count - 1).Cast<object?>().ToList()
|
|
2369
|
+
: [];
|
|
2370
|
+
|
|
2371
|
+
var dpath = new List<object?> { (object?)S_DTOP };
|
|
2372
|
+
foreach (var p in srcpath.Split('.'))
|
|
2373
|
+
{
|
|
2374
|
+
dpath.Add(p);
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
dpath.Add("$:" + ckey);
|
|
2378
|
+
|
|
2379
|
+
object? tcur = (object?)new Dictionary<string, object?> { [ckey] = (object?)tsrc };
|
|
2380
|
+
|
|
2381
|
+
if (tpath.Count > 1)
|
|
2382
|
+
{
|
|
2383
|
+
string pkey = StrKey(GetElem(inj.Path, -3)) ?? S_DTOP;
|
|
2384
|
+
tcur = new Dictionary<string, object?> { [pkey] = tcur };
|
|
2385
|
+
dpath.Add("$:" + pkey);
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
var tinj = inj.Child(0, [(object?)ckey]);
|
|
2389
|
+
tinj.Path = tpath;
|
|
2390
|
+
tinj.Nodes = [inj.Nodes.Count > 0 ? inj.Nodes[^1] : null];
|
|
2391
|
+
tinj.Parent = tinj.Nodes[0];
|
|
2392
|
+
tinj.Val = tval;
|
|
2393
|
+
tinj.DPath = dpath;
|
|
2394
|
+
tinj.DParent = tcur;
|
|
2395
|
+
|
|
2396
|
+
Inject(tval, store, tinj);
|
|
2397
|
+
|
|
2398
|
+
if (tinj.Val is Dictionary<string, object?> rv)
|
|
2399
|
+
{
|
|
2400
|
+
rval = rv;
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2404
|
+
SetProp(target, tkey, rval);
|
|
2405
|
+
return null;
|
|
2406
|
+
};
|
|
2407
|
+
|
|
2408
|
+
// Reference a value from the original spec.
|
|
2409
|
+
private static readonly Injector _TransformRef = (inj, val, refStr, store) =>
|
|
2410
|
+
{
|
|
2411
|
+
if (inj.Mode != M_VAL)
|
|
2412
|
+
{
|
|
2413
|
+
return null;
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
// Get refpath from parent list element 1.
|
|
2417
|
+
object? refpath = GetProp(inj.Parent, 1);
|
|
2418
|
+
inj.KeyI = inj.Keys.Count; // skip remaining keys
|
|
2419
|
+
|
|
2420
|
+
// Get the original spec via $SPEC function.
|
|
2421
|
+
object? specFn = GetProp(store, S_DSPEC);
|
|
2422
|
+
if (specFn == null)
|
|
2423
|
+
{
|
|
2424
|
+
return null;
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
object? spec = specFn is Injector si ? si(inj, null, null, store) : null;
|
|
2428
|
+
if (spec == null)
|
|
2429
|
+
{
|
|
2430
|
+
return null;
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
// Build dpath from current path (skip first element "$TOP").
|
|
2434
|
+
var dpath = inj.Path.Count > 1
|
|
2435
|
+
? inj.Path.GetRange(1, inj.Path.Count - 1).Select(p => (object?)(StrKey(p) ?? S_MT)).ToList()
|
|
2436
|
+
: [];
|
|
2437
|
+
var dpathInj = new InjectState
|
|
2438
|
+
{
|
|
2439
|
+
DPath = dpath,
|
|
2440
|
+
DParent = GetPath(spec, dpath.Cast<object?>().ToList())
|
|
2441
|
+
};
|
|
2442
|
+
|
|
2443
|
+
object? refResult = GetPath(spec, refpath, null, dpathInj);
|
|
2444
|
+
|
|
2445
|
+
// Check if refResult contains sub-references.
|
|
2446
|
+
bool hasSubRef = false;
|
|
2447
|
+
if (IsNode(refResult))
|
|
2448
|
+
{
|
|
2449
|
+
Walk(refResult, (k, v, parent2, path2) =>
|
|
2450
|
+
{
|
|
2451
|
+
if (v is string sv && sv == "`$REF`")
|
|
2452
|
+
{
|
|
2453
|
+
hasSubRef = true;
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
return v;
|
|
2457
|
+
});
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
object? tref = Clone(refResult);
|
|
2461
|
+
int pathLen = inj.Path.Count;
|
|
2462
|
+
|
|
2463
|
+
var cpath = pathLen > 3
|
|
2464
|
+
? inj.Path.GetRange(0, pathLen - 3).Cast<object?>().ToList()
|
|
2465
|
+
: [];
|
|
2466
|
+
var tpath = pathLen >= 1
|
|
2467
|
+
? inj.Path.GetRange(0, pathLen - 1).Cast<object?>().ToList()
|
|
2468
|
+
: [];
|
|
2469
|
+
|
|
2470
|
+
object? tcur = GetPath(store, cpath, null, null);
|
|
2471
|
+
object? tvalRef = GetPath(store, tpath, null, null);
|
|
2472
|
+
|
|
2473
|
+
if (!hasSubRef || tvalRef != null)
|
|
2474
|
+
{
|
|
2475
|
+
string lastPath = tpath.Count > 0
|
|
2476
|
+
? (StrKey(tpath[^1]) ?? S_DTOP)
|
|
2477
|
+
: S_DTOP;
|
|
2478
|
+
|
|
2479
|
+
var tinj = inj.Child(0, [(object?)lastPath]);
|
|
2480
|
+
tinj.Path = tpath;
|
|
2481
|
+
|
|
2482
|
+
int nodesLen = inj.Nodes.Count;
|
|
2483
|
+
tinj.Nodes = nodesLen > 1
|
|
2484
|
+
? inj.Nodes.GetRange(0, nodesLen - 1).Cast<object?>().ToList()
|
|
2485
|
+
: [];
|
|
2486
|
+
tinj.Parent = nodesLen >= 2 ? inj.Nodes[nodesLen - 2] : null;
|
|
2487
|
+
tinj.Val = tref;
|
|
2488
|
+
tinj.DPath = cpath;
|
|
2489
|
+
tinj.DParent = tcur;
|
|
2490
|
+
|
|
2491
|
+
Inject(tref, store, tinj);
|
|
2492
|
+
object? rval = tinj.Val;
|
|
2493
|
+
|
|
2494
|
+
inj.SetVal(rval, 2);
|
|
2495
|
+
|
|
2496
|
+
if (IsList(GetElem(inj.Nodes, -2)) && inj.Prior != null)
|
|
2497
|
+
{
|
|
2498
|
+
inj.Prior.KeyI--;
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
else
|
|
2502
|
+
{
|
|
2503
|
+
// Circular self-reference with no data: delete the key from the grandparent.
|
|
2504
|
+
inj.SetVal(null, 2);
|
|
2505
|
+
if (IsList(GetElem(inj.Nodes, -2)) && inj.Prior != null)
|
|
2506
|
+
{
|
|
2507
|
+
inj.Prior.KeyI--;
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2511
|
+
return val;
|
|
2512
|
+
};
|
|
2513
|
+
|
|
2514
|
+
// Apply a named format function to a child value.
|
|
2515
|
+
private static readonly Injector _TransformFormat = (inj, val, refStr, store) =>
|
|
2516
|
+
{
|
|
2517
|
+
// Truncate remaining keys.
|
|
2518
|
+
if (inj.Keys.Count > 1)
|
|
2519
|
+
{
|
|
2520
|
+
inj.Keys.RemoveRange(1, inj.Keys.Count - 1);
|
|
2521
|
+
}
|
|
2522
|
+
|
|
2523
|
+
if (inj.Mode != M_VAL)
|
|
2524
|
+
{
|
|
2525
|
+
return null;
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2528
|
+
object? name = GetProp(inj.Parent, 1);
|
|
2529
|
+
object? child = GetProp(inj.Parent, 2);
|
|
2530
|
+
|
|
2531
|
+
// Resolve child through injection using the proper DParent context.
|
|
2532
|
+
var rcInj = _InjectChild(child, store, inj);
|
|
2533
|
+
object? resolved = rcInj.Val;
|
|
2534
|
+
|
|
2535
|
+
// Target key and node.
|
|
2536
|
+
string tkey = StrKey(GetElem(inj.Path, -2)) ?? S_DTOP;
|
|
2537
|
+
int psz = inj.Path.Count;
|
|
2538
|
+
object? target = psz >= 2 ? GetElem(inj.Nodes, -2) : GetElem(inj.Nodes, -1);
|
|
2539
|
+
|
|
2540
|
+
// Helper: scalar to string.
|
|
2541
|
+
static string FmtStr(object? v)
|
|
2542
|
+
{
|
|
2543
|
+
return v switch
|
|
2544
|
+
{
|
|
2545
|
+
null => "null",
|
|
2546
|
+
bool b => b ? "true" : "false",
|
|
2547
|
+
_ => v.ToString() ?? "null",
|
|
2548
|
+
};
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
// Determine formatter.
|
|
2552
|
+
WalkApply? formatter = null;
|
|
2553
|
+
|
|
2554
|
+
if (name is string nameStr)
|
|
2555
|
+
{
|
|
2556
|
+
formatter = nameStr switch
|
|
2557
|
+
{
|
|
2558
|
+
"upper" => (k, v, p, path) => IsNode(v) ? v : (object?)FmtStr(v).ToUpperInvariant(),
|
|
2559
|
+
"lower" => (k, v, p, path) => IsNode(v) ? v : (object?)FmtStr(v).ToLowerInvariant(),
|
|
2560
|
+
"string" => (k, v, p, path) => IsNode(v) ? v : (object?)FmtStr(v),
|
|
2561
|
+
"number" => (k, v, p, path) =>
|
|
2562
|
+
{
|
|
2563
|
+
if (IsNode(v))
|
|
2564
|
+
{
|
|
2565
|
+
return v;
|
|
2566
|
+
}
|
|
2567
|
+
|
|
2568
|
+
if (v is long li)
|
|
2569
|
+
{
|
|
2570
|
+
return (object?)li;
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
return v is double di ? (object?)di : v is string sv ? double.TryParse(sv, out double d) ? (object?)d : 0 : (object?)0;
|
|
2574
|
+
}
|
|
2575
|
+
,
|
|
2576
|
+
"integer" => (k, v, p, path) =>
|
|
2577
|
+
{
|
|
2578
|
+
if (IsNode(v))
|
|
2579
|
+
{
|
|
2580
|
+
return v;
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
if (v is long li)
|
|
2584
|
+
{
|
|
2585
|
+
return (object?)li;
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2588
|
+
return v is double di
|
|
2589
|
+
? (object?)(long)di
|
|
2590
|
+
: v is string sv ? double.TryParse(sv, out double d) ? (object?)(long)d : (object?)0L : (object?)0L;
|
|
2591
|
+
}
|
|
2592
|
+
,
|
|
2593
|
+
"concat" => (k, v, p, path) =>
|
|
2594
|
+
{
|
|
2595
|
+
if (k == null && IsList(v))
|
|
2596
|
+
{
|
|
2597
|
+
var parts2 = (v as List<object?>)!.Select(x => IsNode(x) ? "" : FmtStr(x));
|
|
2598
|
+
return (object?)string.Join("", parts2);
|
|
2599
|
+
}
|
|
2600
|
+
return v;
|
|
2601
|
+
}
|
|
2602
|
+
,
|
|
2603
|
+
"identity" => (k, v, p, path) => v,
|
|
2604
|
+
_ => null,
|
|
2605
|
+
};
|
|
2606
|
+
|
|
2607
|
+
if (formatter == null)
|
|
2608
|
+
{
|
|
2609
|
+
inj.Errs.Add($"$FORMAT: unknown format: {nameStr}.");
|
|
2610
|
+
SetProp(target, tkey, null);
|
|
2611
|
+
return null;
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
else
|
|
2615
|
+
{
|
|
2616
|
+
inj.Errs.Add($"$FORMAT: unknown format: {Stringify(name)}.");
|
|
2617
|
+
SetProp(target, tkey, null);
|
|
2618
|
+
return null;
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
// Apply formatter.
|
|
2622
|
+
object? out_ = !IsNode(resolved)
|
|
2623
|
+
? formatter(null, resolved, null, [])
|
|
2624
|
+
: name is string ns && ns == "concat" ? formatter(null, resolved, null, []) : Walk(resolved, before: formatter);
|
|
2625
|
+
SetProp(target, tkey, out_);
|
|
2626
|
+
return out_;
|
|
2627
|
+
};
|
|
2628
|
+
|
|
2629
|
+
// Apply a function to a child value.
|
|
2630
|
+
private static readonly Injector _TransformApply = (inj, val, refStr, store) =>
|
|
2631
|
+
{
|
|
2632
|
+
if (inj.Keys.Count > 1)
|
|
2633
|
+
{
|
|
2634
|
+
inj.Keys.RemoveRange(1, inj.Keys.Count - 1);
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
if (!CheckPlacement(M_VAL, "APPLY", T.List, inj))
|
|
2638
|
+
{
|
|
2639
|
+
return null;
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
var parentList = inj.Parent as List<object?> ?? [];
|
|
2643
|
+
var sliced = parentList.Count > 1 ? parentList.GetRange(1, parentList.Count - 1) : [];
|
|
2644
|
+
var args = InjectorArgs([T.Func, T.Any], sliced);
|
|
2645
|
+
|
|
2646
|
+
string tkey = StrKey(GetElem(inj.Path, -2)) ?? S_DTOP;
|
|
2647
|
+
object? target = GetElem(inj.Nodes, -2) ?? GetElem(inj.Nodes, -1);
|
|
2648
|
+
|
|
2649
|
+
if (args[0] != null)
|
|
2650
|
+
{
|
|
2651
|
+
inj.Errs.Add("$APPLY: " + args[0]);
|
|
2652
|
+
SetProp(target, tkey, null);
|
|
2653
|
+
return null;
|
|
2654
|
+
}
|
|
2655
|
+
|
|
2656
|
+
object? applyFn = args[1];
|
|
2657
|
+
object? child2 = args[2];
|
|
2658
|
+
|
|
2659
|
+
// Resolve child.
|
|
2660
|
+
object? resolved = child2;
|
|
2661
|
+
if (child2 is string cs)
|
|
2662
|
+
{
|
|
2663
|
+
resolved = _InjectStr(cs, store, inj.DParent, inj);
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
// Invoke.
|
|
2667
|
+
object? out_ = null;
|
|
2668
|
+
if (applyFn is Func<object?, object?> fn1)
|
|
2669
|
+
{
|
|
2670
|
+
out_ = fn1(resolved);
|
|
2671
|
+
}
|
|
2672
|
+
else if (applyFn is Func<object?, object?, object?, object?> fn3)
|
|
2673
|
+
{
|
|
2674
|
+
out_ = fn3(resolved, store, inj);
|
|
2675
|
+
}
|
|
2676
|
+
else if (applyFn is Injector aInj)
|
|
2677
|
+
{
|
|
2678
|
+
out_ = aInj(inj, resolved, null, store);
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
SetProp(target, tkey, out_);
|
|
2682
|
+
return out_;
|
|
2683
|
+
};
|
|
2684
|
+
|
|
2685
|
+
|
|
2686
|
+
// ========================================================================
|
|
2687
|
+
// Transform
|
|
2688
|
+
// ========================================================================
|
|
2689
|
+
|
|
2690
|
+
public static object? Transform(object? data, object? spec, InjectState? injdef = null)
|
|
2691
|
+
{
|
|
2692
|
+
object? origspec = spec;
|
|
2693
|
+
spec = Clone(spec);
|
|
2694
|
+
|
|
2695
|
+
// Separate extra-data from extra-transforms (keys starting with $).
|
|
2696
|
+
var extraTransforms = new Dictionary<string, object?>();
|
|
2697
|
+
var extraData = new Dictionary<string, object?>();
|
|
2698
|
+
|
|
2699
|
+
object? extra = injdef?.Extra;
|
|
2700
|
+
if (extra != null)
|
|
2701
|
+
{
|
|
2702
|
+
foreach (var kv in Items(extra))
|
|
2703
|
+
{
|
|
2704
|
+
string k = kv[0]?.ToString() ?? "";
|
|
2705
|
+
if (k.StartsWith(S_DS, StringComparison.Ordinal))
|
|
2706
|
+
{
|
|
2707
|
+
extraTransforms[k] = kv[1];
|
|
2708
|
+
}
|
|
2709
|
+
else
|
|
2710
|
+
{
|
|
2711
|
+
extraData[k] = kv[1];
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2716
|
+
// Merge extra data + source data (match TS: clone(data), no default map when data is null).
|
|
2717
|
+
object? dataClone = Merge(new List<object?>
|
|
2718
|
+
{
|
|
2719
|
+
IsEmpty(extraData) ? null : Clone(extraData),
|
|
2720
|
+
Clone(data),
|
|
2721
|
+
});
|
|
2722
|
+
|
|
2723
|
+
// Build the transform store.
|
|
2724
|
+
var store = new Dictionary<string, object?>
|
|
2725
|
+
{
|
|
2726
|
+
[S_DTOP] = dataClone,
|
|
2727
|
+
[S_DSPEC] = (Injector)((inj2, v, r, s) => Clone(origspec)),
|
|
2728
|
+
["$BT"] = (Injector)((inj2, v, r, s) => (object?)S_BT),
|
|
2729
|
+
["$DS"] = (Injector)((inj2, v, r, s) => (object?)S_DS),
|
|
2730
|
+
["$WHEN"] = (Injector)((inj2, v, r, s) => (object?)DateTime.UtcNow.ToString("o")),
|
|
2731
|
+
["$DELETE"] = _TransformDelete,
|
|
2732
|
+
["$COPY"] = _TransformCopy,
|
|
2733
|
+
["$KEY"] = _TransformKey,
|
|
2734
|
+
["$ANNO"] = _TransformAnno,
|
|
2735
|
+
["$META"] = _TransformMeta,
|
|
2736
|
+
["$MERGE"] = _TransformMerge,
|
|
2737
|
+
["$MERGE0"] = _TransformMerge,
|
|
2738
|
+
["$MERGE1"] = _TransformMerge,
|
|
2739
|
+
["$EACH"] = _TransformEach,
|
|
2740
|
+
["$PACK"] = _TransformPack,
|
|
2741
|
+
["$REF"] = _TransformRef,
|
|
2742
|
+
["$FORMAT"] = _TransformFormat,
|
|
2743
|
+
["$APPLY"] = _TransformApply,
|
|
2744
|
+
};
|
|
2745
|
+
|
|
2746
|
+
// Merge extra transforms into the store.
|
|
2747
|
+
foreach (var kv in extraTransforms)
|
|
2748
|
+
{
|
|
2749
|
+
store[kv.Key] = kv.Value;
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2752
|
+
// Error collection: collect=true when caller explicitly provided an errs list.
|
|
2753
|
+
bool collect = injdef?.Errs != null;
|
|
2754
|
+
List<object?> errs = injdef?.Errs ?? [];
|
|
2755
|
+
store[S_DERRS] = errs;
|
|
2756
|
+
|
|
2757
|
+
// Build an inject state with any overrides from injdef.
|
|
2758
|
+
var injState = new InjectState
|
|
2759
|
+
{
|
|
2760
|
+
ModifyFn = injdef?.ModifyFn,
|
|
2761
|
+
Extra = injdef?.Extra,
|
|
2762
|
+
Meta = injdef?.Meta ?? [],
|
|
2763
|
+
Handler = injdef?.Handler,
|
|
2764
|
+
};
|
|
2765
|
+
|
|
2766
|
+
object? out_ = Inject(spec, store, injState);
|
|
2767
|
+
|
|
2768
|
+
return errs.Count > 0 && !collect
|
|
2769
|
+
? throw new InvalidOperationException(string.Join(" | ", errs.Select(e => e?.ToString() ?? "")))
|
|
2770
|
+
: out_;
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2773
|
+
|
|
2774
|
+
// ========================================================================
|
|
2775
|
+
// VALIDATE
|
|
2776
|
+
// ========================================================================
|
|
2777
|
+
|
|
2778
|
+
// Build a "Expected X, but found Y: v." error message.
|
|
2779
|
+
private static string _InvalidTypeMsg(object? path, string needtype, int vt, object? v)
|
|
2780
|
+
{
|
|
2781
|
+
// TS: null == v → "no value"; NONE is undefined in TS and uses the same wording.
|
|
2782
|
+
bool absent = v == null || ReferenceEquals(v, NONE);
|
|
2783
|
+
string vs = absent ? "no value" : Stringify(v);
|
|
2784
|
+
string loc = Size(path) > 1 ? "field " + Pathify(path, 1) + " to be " : "";
|
|
2785
|
+
string found = !absent ? TypeName(vt) + S_VIZ : "";
|
|
2786
|
+
return "Expected " + loc + needtype + ", but found " + found + vs + S_DT;
|
|
2787
|
+
}
|
|
2788
|
+
|
|
2789
|
+
// Require a non-empty string.
|
|
2790
|
+
private static readonly Injector _ValidateString = (inj, val, refStr, store) =>
|
|
2791
|
+
{
|
|
2792
|
+
bool keyExists = TryGetDataValue(inj.DParent, inj.Key, out object? out_);
|
|
2793
|
+
int t = keyExists ? Typify(out_) : T.NoVal;
|
|
2794
|
+
|
|
2795
|
+
if (0 == (T.Str & t))
|
|
2796
|
+
{
|
|
2797
|
+
inj.Errs.Add(_InvalidTypeMsg(inj.Path, S_string, t, keyExists ? out_ : NONE));
|
|
2798
|
+
return NONE;
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
if (S_MT == (out_ as string))
|
|
2802
|
+
{
|
|
2803
|
+
inj.Errs.Add("Empty string at " + Pathify(inj.Path, 1));
|
|
2804
|
+
return NONE;
|
|
2805
|
+
}
|
|
2806
|
+
|
|
2807
|
+
return out_;
|
|
2808
|
+
};
|
|
2809
|
+
|
|
2810
|
+
// Require a value of the named type ($NUMBER, $INTEGER, etc.).
|
|
2811
|
+
private static readonly Injector _ValidateType = (inj, val, refStr, store) =>
|
|
2812
|
+
{
|
|
2813
|
+
string tname = refStr != null && refStr.Length > 1 ? refStr[1..].ToLowerInvariant() : "";
|
|
2814
|
+
int idx = Array.IndexOf(TYPENAME, tname);
|
|
2815
|
+
int typev = idx >= 0 ? (1 << (31 - idx)) : 0;
|
|
2816
|
+
|
|
2817
|
+
bool keyExists = TryGetDataValue(inj.DParent, inj.Key, out object? out_);
|
|
2818
|
+
int t = keyExists ? Typify(out_) : T.NoVal;
|
|
2819
|
+
|
|
2820
|
+
if (0 == (t & typev))
|
|
2821
|
+
{
|
|
2822
|
+
inj.Errs.Add(_InvalidTypeMsg(inj.Path, tname, t, keyExists ? out_ : NONE));
|
|
2823
|
+
return NONE;
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
return out_;
|
|
2827
|
+
};
|
|
2828
|
+
|
|
2829
|
+
// Allow any value without type check.
|
|
2830
|
+
private static readonly Injector _ValidateAny = (inj, val, refStr, store) =>
|
|
2831
|
+
GetProp(inj.DParent, inj.Key);
|
|
2832
|
+
|
|
2833
|
+
// Validate every child of a map or list against a template.
|
|
2834
|
+
private static readonly Injector _ValidateChild = (inj, val, refStr, store) =>
|
|
2835
|
+
{
|
|
2836
|
+
int mode = inj.Mode;
|
|
2837
|
+
|
|
2838
|
+
// Map syntax: {'`$CHILD`': childTemplate} — runs at M_KEYPRE.
|
|
2839
|
+
if (M_KEYPRE == mode)
|
|
2840
|
+
{
|
|
2841
|
+
object? childtm = GetProp(inj.Parent, inj.Key);
|
|
2842
|
+
|
|
2843
|
+
object? pkey = GetElem(inj.Path, -2);
|
|
2844
|
+
object? tval = GetProp(inj.DParent, pkey);
|
|
2845
|
+
|
|
2846
|
+
if (tval == NONE || tval == null)
|
|
2847
|
+
{
|
|
2848
|
+
tval = new Dictionary<string, object?>();
|
|
2849
|
+
}
|
|
2850
|
+
else if (!IsMap(tval))
|
|
2851
|
+
{
|
|
2852
|
+
inj.Errs.Add(_InvalidTypeMsg(Slice(inj.Path, -1), S_object, Typify(tval), tval));
|
|
2853
|
+
inj.SetVal(NONE);
|
|
2854
|
+
return NONE;
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
foreach (string ckey in KeysOf(tval))
|
|
2858
|
+
{
|
|
2859
|
+
SetProp(inj.Parent, ckey, Clone(childtm));
|
|
2860
|
+
inj.Keys.Add(ckey);
|
|
2861
|
+
}
|
|
2862
|
+
|
|
2863
|
+
inj.SetVal(NONE);
|
|
2864
|
+
return NONE;
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
|
+
// List syntax: ['`$CHILD`', childTemplate] — runs at M_VAL.
|
|
2868
|
+
if (M_VAL == mode)
|
|
2869
|
+
{
|
|
2870
|
+
if (!IsList(inj.Parent))
|
|
2871
|
+
{
|
|
2872
|
+
inj.Errs.Add("Invalid $CHILD as value");
|
|
2873
|
+
return NONE;
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
object? childtm = GetProp(inj.Parent, 1);
|
|
2877
|
+
|
|
2878
|
+
if (inj.DParent == NONE || inj.DParent == null)
|
|
2879
|
+
{
|
|
2880
|
+
Slice(inj.Parent, 0, 0, true);
|
|
2881
|
+
return NONE;
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
if (!IsList(inj.DParent))
|
|
2885
|
+
{
|
|
2886
|
+
string msg = _InvalidTypeMsg(
|
|
2887
|
+
Slice(inj.Path, -1), S_list, Typify(inj.DParent), inj.DParent);
|
|
2888
|
+
inj.Errs.Add(msg);
|
|
2889
|
+
inj.KeyI = Size(inj.Parent);
|
|
2890
|
+
return inj.DParent;
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2893
|
+
var dpList = (List<object?>)inj.DParent;
|
|
2894
|
+
foreach (var item in Items(inj.DParent))
|
|
2895
|
+
{
|
|
2896
|
+
SetProp(inj.Parent, item[0], Clone(childtm));
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
Slice(inj.Parent, 0, dpList.Count, true);
|
|
2900
|
+
inj.KeyI = 0;
|
|
2901
|
+
|
|
2902
|
+
return GetProp(inj.DParent, 0);
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2905
|
+
return NONE;
|
|
2906
|
+
};
|
|
2907
|
+
|
|
2908
|
+
// Match at least one of the provided alternatives.
|
|
2909
|
+
private static readonly Injector _ValidateOne = (inj, val, refStr, store) =>
|
|
2910
|
+
{
|
|
2911
|
+
if (M_VAL != inj.Mode)
|
|
2912
|
+
{
|
|
2913
|
+
return null;
|
|
2914
|
+
}
|
|
2915
|
+
|
|
2916
|
+
if (!IsList(inj.Parent) || 0 != inj.KeyI)
|
|
2917
|
+
{
|
|
2918
|
+
inj.Errs.Add("The $ONE validator at field " +
|
|
2919
|
+
Pathify(inj.Path, 1, 1) +
|
|
2920
|
+
" must be the first element of an array.");
|
|
2921
|
+
return null;
|
|
2922
|
+
}
|
|
2923
|
+
|
|
2924
|
+
inj.KeyI = Size(inj.Keys);
|
|
2925
|
+
|
|
2926
|
+
inj.SetVal(inj.DParent, 2);
|
|
2927
|
+
inj.Path = (List<object?>)Slice(inj.Path, -1)!;
|
|
2928
|
+
inj.Key = StrKey(GetElem(inj.Path, -1)) ?? S_MT;
|
|
2929
|
+
|
|
2930
|
+
var tvals = (List<object?>)Slice(inj.Parent, 1)!;
|
|
2931
|
+
if (0 == Size(tvals))
|
|
2932
|
+
{
|
|
2933
|
+
inj.Errs.Add("The $ONE validator at field " +
|
|
2934
|
+
Pathify(inj.Path, 1, 1) +
|
|
2935
|
+
" must have at least one argument.");
|
|
2936
|
+
return null;
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2939
|
+
foreach (object? tval in tvals)
|
|
2940
|
+
{
|
|
2941
|
+
var terrs = new List<object?>();
|
|
2942
|
+
var vstore = (Dictionary<string, object?>)Merge(
|
|
2943
|
+
new List<object?> { new Dictionary<string, object?>(), store }, 1)!;
|
|
2944
|
+
vstore[S_DTOP] = inj.DParent;
|
|
2945
|
+
|
|
2946
|
+
object? vcurrent = Validate(inj.DParent, tval, new InjectState
|
|
2947
|
+
{
|
|
2948
|
+
Extra = vstore,
|
|
2949
|
+
Errs = terrs,
|
|
2950
|
+
Meta = inj.Meta,
|
|
2951
|
+
});
|
|
2952
|
+
|
|
2953
|
+
inj.SetVal(vcurrent, -2);
|
|
2954
|
+
|
|
2955
|
+
if (0 == Size(terrs))
|
|
2956
|
+
{
|
|
2957
|
+
return null;
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
// No match found.
|
|
2962
|
+
string valdesc = R_TRANSFORM_NAME.Replace(
|
|
2963
|
+
Join(Items(tvals, n => (object?)Stringify(n[1])), ", "),
|
|
2964
|
+
m => m.Groups[1].Value.ToLowerInvariant());
|
|
2965
|
+
|
|
2966
|
+
inj.Errs.Add(_InvalidTypeMsg(
|
|
2967
|
+
inj.Path,
|
|
2968
|
+
(1 < Size(tvals) ? "one of " : "") + valdesc,
|
|
2969
|
+
Typify(inj.DParent), inj.DParent));
|
|
2970
|
+
|
|
2971
|
+
return null;
|
|
2972
|
+
};
|
|
2973
|
+
|
|
2974
|
+
// Match one of the provided exact values.
|
|
2975
|
+
private static readonly Injector _ValidateExact = (inj, val, refStr, store) =>
|
|
2976
|
+
{
|
|
2977
|
+
if (M_VAL == inj.Mode)
|
|
2978
|
+
{
|
|
2979
|
+
if (!IsList(inj.Parent) || 0 != inj.KeyI)
|
|
2980
|
+
{
|
|
2981
|
+
inj.Errs.Add("The $EXACT validator at field " +
|
|
2982
|
+
Pathify(inj.Path, 1, 1) +
|
|
2983
|
+
" must be the first element of an array.");
|
|
2984
|
+
return null;
|
|
2985
|
+
}
|
|
2986
|
+
|
|
2987
|
+
inj.KeyI = Size(inj.Keys);
|
|
2988
|
+
|
|
2989
|
+
inj.SetVal(inj.DParent, 2);
|
|
2990
|
+
inj.Path = (List<object?>)Slice(inj.Path, 0, -1)!;
|
|
2991
|
+
inj.Key = StrKey(GetElem(inj.Path, -1)) ?? S_MT;
|
|
2992
|
+
|
|
2993
|
+
var tvals = (List<object?>)Slice(inj.Parent, 1)!;
|
|
2994
|
+
if (0 == Size(tvals))
|
|
2995
|
+
{
|
|
2996
|
+
inj.Errs.Add("The $EXACT validator at field " +
|
|
2997
|
+
Pathify(inj.Path, 1, 1) +
|
|
2998
|
+
" must have at least one argument.");
|
|
2999
|
+
return null;
|
|
3000
|
+
}
|
|
3001
|
+
|
|
3002
|
+
string? currentStr = null;
|
|
3003
|
+
foreach (object? tval in tvals)
|
|
3004
|
+
{
|
|
3005
|
+
bool exactMatch = Equals(tval, inj.DParent);
|
|
3006
|
+
if (!exactMatch && IsNode(tval))
|
|
3007
|
+
{
|
|
3008
|
+
currentStr ??= Stringify(inj.DParent);
|
|
3009
|
+
exactMatch = Stringify(tval) == currentStr;
|
|
3010
|
+
}
|
|
3011
|
+
if (exactMatch)
|
|
3012
|
+
{
|
|
3013
|
+
return null;
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
|
|
3017
|
+
string valdesc = R_TRANSFORM_NAME.Replace(
|
|
3018
|
+
Join(Items(tvals, n => (object?)Stringify(n[1])), ", "),
|
|
3019
|
+
m => m.Groups[1].Value.ToLowerInvariant());
|
|
3020
|
+
|
|
3021
|
+
inj.Errs.Add(_InvalidTypeMsg(
|
|
3022
|
+
inj.Path,
|
|
3023
|
+
(1 < Size(inj.Path) ? "" : "value ") +
|
|
3024
|
+
"exactly equal to " + (1 == Size(tvals) ? "" : "one of ") + valdesc,
|
|
3025
|
+
Typify(inj.DParent), inj.DParent));
|
|
3026
|
+
}
|
|
3027
|
+
else
|
|
3028
|
+
{
|
|
3029
|
+
DelProp(inj.Parent, inj.Key);
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
return null;
|
|
3033
|
+
};
|
|
3034
|
+
|
|
3035
|
+
// True if key exists on node (JSON null counts as present); sets value when present.
|
|
3036
|
+
private static bool TryGetDataValue(object? node, object? key, out object? value)
|
|
3037
|
+
{
|
|
3038
|
+
value = null;
|
|
3039
|
+
if (node == null || key == null)
|
|
3040
|
+
{
|
|
3041
|
+
return false;
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3044
|
+
if (node is Dictionary<string, object?> map)
|
|
3045
|
+
{
|
|
3046
|
+
string k = StrKey(key) ?? S_MT;
|
|
3047
|
+
return map.TryGetValue(k, out value);
|
|
3048
|
+
}
|
|
3049
|
+
if (node is List<object?> list)
|
|
3050
|
+
{
|
|
3051
|
+
string? ks = key?.ToString();
|
|
3052
|
+
if (ks != null && int.TryParse(ks, out int i))
|
|
3053
|
+
{
|
|
3054
|
+
if (i < 0)
|
|
3055
|
+
{
|
|
3056
|
+
i = list.Count + i;
|
|
3057
|
+
}
|
|
3058
|
+
|
|
3059
|
+
if (i >= 0 && i < list.Count)
|
|
3060
|
+
{
|
|
3061
|
+
value = list[i];
|
|
3062
|
+
return true;
|
|
3063
|
+
}
|
|
3064
|
+
}
|
|
3065
|
+
return false;
|
|
3066
|
+
}
|
|
3067
|
+
return false;
|
|
3068
|
+
}
|
|
3069
|
+
|
|
3070
|
+
// Modify callback: runs after each inject step to perform type/structure validation.
|
|
3071
|
+
private static object? _Validation(
|
|
3072
|
+
object? pval, object? key, object? parent, object? injObj, object? store)
|
|
3073
|
+
{
|
|
3074
|
+
if (injObj is not InjectState inj)
|
|
3075
|
+
{
|
|
3076
|
+
return null;
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
bool isSkipVal = pval is Dictionary<string, object?> sd && sd.ContainsKey("`$SKIP`");
|
|
3080
|
+
if (isSkipVal)
|
|
3081
|
+
{
|
|
3082
|
+
return null;
|
|
3083
|
+
}
|
|
3084
|
+
|
|
3085
|
+
bool exact = GetProp(inj.Meta, S_BEXACT) is bool b && b;
|
|
3086
|
+
|
|
3087
|
+
bool cKeyExists = TryGetDataValue(inj.DParent, key, out object? cval);
|
|
3088
|
+
|
|
3089
|
+
// TS: if (!exact && NONE === cval) return — only skip when key is absent, not when value is JSON null.
|
|
3090
|
+
if (!exact && !cKeyExists)
|
|
3091
|
+
{
|
|
3092
|
+
return null;
|
|
3093
|
+
}
|
|
3094
|
+
|
|
3095
|
+
int ptype = Typify(pval);
|
|
3096
|
+
|
|
3097
|
+
// Skip if spec value still contains a $ command name.
|
|
3098
|
+
if (0 < (T.Str & ptype) && pval is string ps && ps.Contains(S_DS))
|
|
3099
|
+
{
|
|
3100
|
+
return null;
|
|
3101
|
+
}
|
|
3102
|
+
|
|
3103
|
+
int ctype = Typify(cval);
|
|
3104
|
+
|
|
3105
|
+
// TS: ptype !== ctype && NONE !== pval — deleted spec keys read as undefined; C# GetProp gives null.
|
|
3106
|
+
// Distinguish absent key (skip) vs JSON null present (Typify null) via TryGetDataValue on parent.
|
|
3107
|
+
bool specKeyPresent = TryGetDataValue(parent, key, out _);
|
|
3108
|
+
|
|
3109
|
+
// Type mismatch.
|
|
3110
|
+
if (ptype != ctype && !ReferenceEquals(pval, NONE) && specKeyPresent)
|
|
3111
|
+
{
|
|
3112
|
+
inj.Errs.Add(_InvalidTypeMsg(inj.Path, TypeName(ptype), ctype, cval));
|
|
3113
|
+
return null;
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
if (IsMap(cval))
|
|
3117
|
+
{
|
|
3118
|
+
if (!IsMap(pval))
|
|
3119
|
+
{
|
|
3120
|
+
inj.Errs.Add(_InvalidTypeMsg(inj.Path, TypeName(ptype), ctype, cval));
|
|
3121
|
+
return null;
|
|
3122
|
+
}
|
|
3123
|
+
|
|
3124
|
+
var ckeys = KeysOf(cval);
|
|
3125
|
+
var pkeys = KeysOf(pval);
|
|
3126
|
+
|
|
3127
|
+
object? openFlag = GetProp(pval, "`$OPEN`");
|
|
3128
|
+
bool isOpen = true == (openFlag as bool?);
|
|
3129
|
+
|
|
3130
|
+
// Empty spec map means open (accepts any keys).
|
|
3131
|
+
if (0 < Size(pkeys) && !isOpen)
|
|
3132
|
+
{
|
|
3133
|
+
var badkeys = new List<string>();
|
|
3134
|
+
foreach (string ck in ckeys)
|
|
3135
|
+
{
|
|
3136
|
+
// Literal presence: validation needs to know if the SHAPE
|
|
3137
|
+
// declares this key, regardless of whether the validator
|
|
3138
|
+
// stored null in that slot. Group A HasKey would miss
|
|
3139
|
+
// null-valued slots (canonical uses _lookup here).
|
|
3140
|
+
if (ReferenceEquals(Lookup(pval, ck), NONE))
|
|
3141
|
+
{
|
|
3142
|
+
badkeys.Add(ck);
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
|
|
3146
|
+
if (0 < badkeys.Count)
|
|
3147
|
+
{
|
|
3148
|
+
string msg = "Unexpected keys at field " + Pathify(inj.Path, 1) +
|
|
3149
|
+
S_VIZ + Join(badkeys.Cast<object?>().ToList());
|
|
3150
|
+
inj.Errs.Add(msg);
|
|
3151
|
+
return null;
|
|
3152
|
+
}
|
|
3153
|
+
}
|
|
3154
|
+
else
|
|
3155
|
+
{
|
|
3156
|
+
Merge(new List<object?> { pval, cval });
|
|
3157
|
+
if (IsNode(pval))
|
|
3158
|
+
{
|
|
3159
|
+
DelProp(pval, "`$OPEN`");
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
else if (IsList(cval))
|
|
3164
|
+
{
|
|
3165
|
+
if (!IsList(pval))
|
|
3166
|
+
{
|
|
3167
|
+
inj.Errs.Add(_InvalidTypeMsg(inj.Path, TypeName(ptype), ctype, cval));
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
else if (exact)
|
|
3171
|
+
{
|
|
3172
|
+
// Missing key (TS undefined) must not match JSON null in the spec.
|
|
3173
|
+
object? cExact = cKeyExists ? cval : NONE;
|
|
3174
|
+
if (!Equals(cExact, pval))
|
|
3175
|
+
{
|
|
3176
|
+
string pathmsg = 1 < Size(inj.Path)
|
|
3177
|
+
? "at field " + Pathify(inj.Path, 1) + S_VIZ
|
|
3178
|
+
: S_MT;
|
|
3179
|
+
inj.Errs.Add("Value " + pathmsg + Stringify(cExact) +
|
|
3180
|
+
" should equal " + Stringify(pval) + S_DT);
|
|
3181
|
+
}
|
|
3182
|
+
}
|
|
3183
|
+
else
|
|
3184
|
+
{
|
|
3185
|
+
// Use data value as output.
|
|
3186
|
+
SetProp(parent, key, cval);
|
|
3187
|
+
}
|
|
3188
|
+
|
|
3189
|
+
return null;
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3192
|
+
// Inject handler for validation: intercepts meta-path syntax.
|
|
3193
|
+
private static readonly Injector _ValidateHandler = (inj, val, refStr, store) =>
|
|
3194
|
+
{
|
|
3195
|
+
if (refStr == null)
|
|
3196
|
+
{
|
|
3197
|
+
return _InjectHandler(inj, val, refStr, store);
|
|
3198
|
+
}
|
|
3199
|
+
|
|
3200
|
+
var m = R_META_PATH.Match(refStr);
|
|
3201
|
+
if (m.Success)
|
|
3202
|
+
{
|
|
3203
|
+
if (m.Groups[2].Value == "=")
|
|
3204
|
+
{
|
|
3205
|
+
inj.SetVal(new List<object?> { (object?)S_BEXACT, val });
|
|
3206
|
+
}
|
|
3207
|
+
else
|
|
3208
|
+
{
|
|
3209
|
+
inj.SetVal(val);
|
|
3210
|
+
}
|
|
3211
|
+
|
|
3212
|
+
inj.KeyI = -1;
|
|
3213
|
+
return SKIP;
|
|
3214
|
+
}
|
|
3215
|
+
|
|
3216
|
+
return _InjectHandler(inj, val, refStr, store);
|
|
3217
|
+
};
|
|
3218
|
+
|
|
3219
|
+
// Validate a data structure against a shape specification.
|
|
3220
|
+
public static object? Validate(
|
|
3221
|
+
object? data,
|
|
3222
|
+
object? spec,
|
|
3223
|
+
InjectState? injdef = null)
|
|
3224
|
+
{
|
|
3225
|
+
bool collect = injdef?.Errs != null;
|
|
3226
|
+
var errs = injdef?.Errs ?? [];
|
|
3227
|
+
|
|
3228
|
+
// Extra validation commands override / supplement default store.
|
|
3229
|
+
var extraStore = new Dictionary<string, object?>();
|
|
3230
|
+
if (injdef?.Extra != null)
|
|
3231
|
+
{
|
|
3232
|
+
foreach (var kv in Items(injdef.Extra))
|
|
3233
|
+
{
|
|
3234
|
+
extraStore[kv[0]?.ToString() ?? ""] = kv[1];
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
|
|
3238
|
+
var store = (Dictionary<string, object?>)Merge(new List<object?>
|
|
3239
|
+
{
|
|
3240
|
+
new Dictionary<string, object?>
|
|
3241
|
+
{
|
|
3242
|
+
// Null out transform-only commands so they don't fire.
|
|
3243
|
+
["$DELETE"] = null,
|
|
3244
|
+
["$COPY"] = null,
|
|
3245
|
+
["$KEY"] = null,
|
|
3246
|
+
["$META"] = null,
|
|
3247
|
+
["$MERGE"] = null,
|
|
3248
|
+
["$EACH"] = null,
|
|
3249
|
+
["$PACK"] = null,
|
|
3250
|
+
|
|
3251
|
+
// Validation commands.
|
|
3252
|
+
["$STRING"] = _ValidateString,
|
|
3253
|
+
["$NUMBER"] = _ValidateType,
|
|
3254
|
+
["$INTEGER"] = _ValidateType,
|
|
3255
|
+
["$DECIMAL"] = _ValidateType,
|
|
3256
|
+
["$BOOLEAN"] = _ValidateType,
|
|
3257
|
+
["$NULL"] = _ValidateType,
|
|
3258
|
+
["$NIL"] = _ValidateType,
|
|
3259
|
+
["$MAP"] = _ValidateType,
|
|
3260
|
+
["$LIST"] = _ValidateType,
|
|
3261
|
+
["$FUNCTION"] = _ValidateType,
|
|
3262
|
+
["$INSTANCE"] = _ValidateType,
|
|
3263
|
+
["$ANY"] = _ValidateAny,
|
|
3264
|
+
["$CHILD"] = _ValidateChild,
|
|
3265
|
+
["$ONE"] = _ValidateOne,
|
|
3266
|
+
["$EXACT"] = _ValidateExact,
|
|
3267
|
+
|
|
3268
|
+
[S_DERRS] = errs,
|
|
3269
|
+
},
|
|
3270
|
+
// Match TS merge([..., getdef(extra, {}), ...]): empty extra is {}, not null —
|
|
3271
|
+
// null would be treated as a scalar and wipe the validation command map.
|
|
3272
|
+
IsEmpty(extraStore) ? [] : extraStore,
|
|
3273
|
+
new Dictionary<string, object?> { [S_DERRS] = errs },
|
|
3274
|
+
}, 1)!;
|
|
3275
|
+
|
|
3276
|
+
var meta = injdef?.Meta ?? [];
|
|
3277
|
+
SetProp(meta, S_BEXACT, GetProp(meta, S_BEXACT) ?? false);
|
|
3278
|
+
|
|
3279
|
+
// Pass errs explicitly so Transform collects (doesn't throw) internally.
|
|
3280
|
+
object? out_ = Transform(data, spec, new InjectState
|
|
3281
|
+
{
|
|
3282
|
+
Extra = store,
|
|
3283
|
+
ModifyFn = _Validation,
|
|
3284
|
+
Handler = _ValidateHandler,
|
|
3285
|
+
Meta = meta,
|
|
3286
|
+
Errs = errs,
|
|
3287
|
+
});
|
|
3288
|
+
|
|
3289
|
+
return errs.Count > 0 && !collect
|
|
3290
|
+
? throw new InvalidOperationException(
|
|
3291
|
+
string.Join(" | ", errs.Select(e => e?.ToString() ?? "")))
|
|
3292
|
+
: out_;
|
|
3293
|
+
}
|
|
3294
|
+
|
|
3295
|
+
|
|
3296
|
+
// ========================================================================
|
|
3297
|
+
// SELECT
|
|
3298
|
+
// ========================================================================
|
|
3299
|
+
|
|
3300
|
+
private static double _SelectToDouble(object? v)
|
|
3301
|
+
{
|
|
3302
|
+
return v switch
|
|
3303
|
+
{
|
|
3304
|
+
int i => i,
|
|
3305
|
+
long l => l,
|
|
3306
|
+
double d => d,
|
|
3307
|
+
float f => f,
|
|
3308
|
+
_ => double.TryParse(v?.ToString(), NumberStyles.Any,
|
|
3309
|
+
CultureInfo.InvariantCulture, out double x)
|
|
3310
|
+
? x : double.NaN,
|
|
3311
|
+
};
|
|
3312
|
+
}
|
|
3313
|
+
|
|
3314
|
+
// $AND: all terms must match.
|
|
3315
|
+
private static readonly Injector _SelectAnd = (inj, val, refStr, store) =>
|
|
3316
|
+
{
|
|
3317
|
+
if (M_KEYPRE != inj.Mode)
|
|
3318
|
+
{
|
|
3319
|
+
return null;
|
|
3320
|
+
}
|
|
3321
|
+
|
|
3322
|
+
var terms = GetProp(inj.Parent, inj.Key) as List<object?> ?? [];
|
|
3323
|
+
var ppath = (List<object?>)Slice(inj.Path, -1)!;
|
|
3324
|
+
object? point = GetPath(store, ppath);
|
|
3325
|
+
|
|
3326
|
+
var vstore = (Dictionary<string, object?>)Merge(
|
|
3327
|
+
new List<object?> { new Dictionary<string, object?>(), store }, 1)!;
|
|
3328
|
+
vstore[S_DTOP] = point;
|
|
3329
|
+
|
|
3330
|
+
foreach (object? term in terms)
|
|
3331
|
+
{
|
|
3332
|
+
var terrs = new List<object?>();
|
|
3333
|
+
Validate(point, term, new InjectState { Extra = vstore, Errs = terrs, Meta = inj.Meta });
|
|
3334
|
+
if (0 != Size(terrs))
|
|
3335
|
+
{
|
|
3336
|
+
inj.Errs.Add("AND:" + Pathify(ppath) + S_VIZ + Stringify(point) +
|
|
3337
|
+
" fail:" + Stringify(terms));
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
|
|
3341
|
+
object? gkey = GetElem(inj.Path, -2);
|
|
3342
|
+
object? gp = GetElem(inj.Nodes, -2);
|
|
3343
|
+
SetProp(gp, gkey, point);
|
|
3344
|
+
return null;
|
|
3345
|
+
};
|
|
3346
|
+
|
|
3347
|
+
// $OR: at least one term must match.
|
|
3348
|
+
private static readonly Injector _SelectOr = (inj, val, refStr, store) =>
|
|
3349
|
+
{
|
|
3350
|
+
if (M_KEYPRE != inj.Mode)
|
|
3351
|
+
{
|
|
3352
|
+
return null;
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3355
|
+
var terms = GetProp(inj.Parent, inj.Key) as List<object?> ?? [];
|
|
3356
|
+
var ppath = (List<object?>)Slice(inj.Path, -1)!;
|
|
3357
|
+
object? point = GetPath(store, ppath);
|
|
3358
|
+
|
|
3359
|
+
var vstore = (Dictionary<string, object?>)Merge(
|
|
3360
|
+
new List<object?> { new Dictionary<string, object?>(), store }, 1)!;
|
|
3361
|
+
vstore[S_DTOP] = point;
|
|
3362
|
+
|
|
3363
|
+
foreach (object? term in terms)
|
|
3364
|
+
{
|
|
3365
|
+
var terrs = new List<object?>();
|
|
3366
|
+
Validate(point, term, new InjectState { Extra = vstore, Errs = terrs, Meta = inj.Meta });
|
|
3367
|
+
if (0 == Size(terrs))
|
|
3368
|
+
{
|
|
3369
|
+
object? gkey2 = GetElem(inj.Path, -2);
|
|
3370
|
+
object? gp2 = GetElem(inj.Nodes, -2);
|
|
3371
|
+
SetProp(gp2, gkey2, point);
|
|
3372
|
+
return null;
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
|
|
3376
|
+
inj.Errs.Add("OR:" + Pathify(ppath) + S_VIZ + Stringify(point) +
|
|
3377
|
+
" fail:" + Stringify(terms));
|
|
3378
|
+
return null;
|
|
3379
|
+
};
|
|
3380
|
+
|
|
3381
|
+
// $NOT: term must NOT match.
|
|
3382
|
+
private static readonly Injector _SelectNot = (inj, val, refStr, store) =>
|
|
3383
|
+
{
|
|
3384
|
+
if (M_KEYPRE != inj.Mode)
|
|
3385
|
+
{
|
|
3386
|
+
return null;
|
|
3387
|
+
}
|
|
3388
|
+
|
|
3389
|
+
object? term = GetProp(inj.Parent, inj.Key);
|
|
3390
|
+
var ppath = (List<object?>)Slice(inj.Path, -1)!;
|
|
3391
|
+
object? point = GetPath(store, ppath);
|
|
3392
|
+
|
|
3393
|
+
var vstore = (Dictionary<string, object?>)Merge(
|
|
3394
|
+
new List<object?> { new Dictionary<string, object?>(), store }, 1)!;
|
|
3395
|
+
vstore[S_DTOP] = point;
|
|
3396
|
+
|
|
3397
|
+
var terrs = new List<object?>();
|
|
3398
|
+
Validate(point, term, new InjectState { Extra = vstore, Errs = terrs, Meta = inj.Meta });
|
|
3399
|
+
|
|
3400
|
+
if (0 == Size(terrs))
|
|
3401
|
+
{
|
|
3402
|
+
inj.Errs.Add("NOT:" + Pathify(ppath) + S_VIZ + Stringify(point) +
|
|
3403
|
+
" fail:" + Stringify(term));
|
|
3404
|
+
}
|
|
3405
|
+
|
|
3406
|
+
object? gkey = GetElem(inj.Path, -2);
|
|
3407
|
+
object? gp = GetElem(inj.Nodes, -2);
|
|
3408
|
+
SetProp(gp, gkey, point);
|
|
3409
|
+
return null;
|
|
3410
|
+
};
|
|
3411
|
+
|
|
3412
|
+
// $GT, $LT, $GTE, $LTE, $LIKE: comparison operators.
|
|
3413
|
+
private static readonly Injector _SelectCmp = (inj, val, refStr, store) =>
|
|
3414
|
+
{
|
|
3415
|
+
if (M_KEYPRE != inj.Mode)
|
|
3416
|
+
{
|
|
3417
|
+
return NONE;
|
|
3418
|
+
}
|
|
3419
|
+
|
|
3420
|
+
object? term = GetProp(inj.Parent, inj.Key);
|
|
3421
|
+
object? gkey = GetElem(inj.Path, -2);
|
|
3422
|
+
var ppath = (List<object?>)Slice(inj.Path, -1)!;
|
|
3423
|
+
object? point = GetPath(store, ppath);
|
|
3424
|
+
|
|
3425
|
+
bool pass = false;
|
|
3426
|
+
|
|
3427
|
+
double pd = _SelectToDouble(point);
|
|
3428
|
+
double td = _SelectToDouble(term);
|
|
3429
|
+
if (!double.IsNaN(pd) && !double.IsNaN(td))
|
|
3430
|
+
{
|
|
3431
|
+
if (refStr == "$GT" && pd > td)
|
|
3432
|
+
{
|
|
3433
|
+
pass = true;
|
|
3434
|
+
}
|
|
3435
|
+
else if (refStr == "$LT" && pd < td)
|
|
3436
|
+
{
|
|
3437
|
+
pass = true;
|
|
3438
|
+
}
|
|
3439
|
+
else if (refStr == "$GTE" && pd >= td)
|
|
3440
|
+
{
|
|
3441
|
+
pass = true;
|
|
3442
|
+
}
|
|
3443
|
+
else if (refStr == "$LTE" && pd <= td)
|
|
3444
|
+
{
|
|
3445
|
+
pass = true;
|
|
3446
|
+
}
|
|
3447
|
+
}
|
|
3448
|
+
|
|
3449
|
+
if (!pass && refStr == "$LIKE")
|
|
3450
|
+
{
|
|
3451
|
+
string pattern = term?.ToString() ?? "";
|
|
3452
|
+
string subject2 = Stringify(point);
|
|
3453
|
+
try
|
|
3454
|
+
{
|
|
3455
|
+
if (Regex.IsMatch(subject2, pattern))
|
|
3456
|
+
{
|
|
3457
|
+
pass = true;
|
|
3458
|
+
}
|
|
3459
|
+
}
|
|
3460
|
+
catch { /* invalid pattern */ }
|
|
3461
|
+
}
|
|
3462
|
+
|
|
3463
|
+
if (pass)
|
|
3464
|
+
{
|
|
3465
|
+
object? gp = GetElem(inj.Nodes, -2);
|
|
3466
|
+
SetProp(gp, gkey, point);
|
|
3467
|
+
}
|
|
3468
|
+
else
|
|
3469
|
+
{
|
|
3470
|
+
inj.Errs.Add("CMP: " + Pathify(ppath) + S_VIZ + Stringify(point) +
|
|
3471
|
+
" fail:" + refStr + " " + Stringify(term));
|
|
3472
|
+
}
|
|
3473
|
+
|
|
3474
|
+
return NONE;
|
|
3475
|
+
};
|
|
3476
|
+
|
|
3477
|
+
// Select children from a collection that match a query.
|
|
3478
|
+
public static List<object?> Select(object? children, object? query)
|
|
3479
|
+
{
|
|
3480
|
+
if (!IsNode(children))
|
|
3481
|
+
{
|
|
3482
|
+
return [];
|
|
3483
|
+
}
|
|
3484
|
+
|
|
3485
|
+
List<object?> childList = IsMap(children)
|
|
3486
|
+
? Items(children, n =>
|
|
3487
|
+
{
|
|
3488
|
+
SetProp(n[1], S_DKEY, n[0]);
|
|
3489
|
+
return n[1];
|
|
3490
|
+
})
|
|
3491
|
+
: Items(children, n =>
|
|
3492
|
+
{
|
|
3493
|
+
object? idx = n[0];
|
|
3494
|
+
if (idx is string s && long.TryParse(s, out long li))
|
|
3495
|
+
{
|
|
3496
|
+
SetProp(n[1], S_DKEY, (object?)li);
|
|
3497
|
+
}
|
|
3498
|
+
else
|
|
3499
|
+
{
|
|
3500
|
+
SetProp(n[1], S_DKEY, idx);
|
|
3501
|
+
}
|
|
3502
|
+
|
|
3503
|
+
return n[1];
|
|
3504
|
+
});
|
|
3505
|
+
var results = new List<object?>();
|
|
3506
|
+
|
|
3507
|
+
var selectExtra = new Dictionary<string, object?>
|
|
3508
|
+
{
|
|
3509
|
+
["`$AND`"] = _SelectAnd,
|
|
3510
|
+
["`$OR`"] = _SelectOr,
|
|
3511
|
+
["`$NOT`"] = _SelectNot,
|
|
3512
|
+
["$AND"] = _SelectAnd,
|
|
3513
|
+
["$OR"] = _SelectOr,
|
|
3514
|
+
["$NOT"] = _SelectNot,
|
|
3515
|
+
// JSON/test fixtures use backtick-wrapped keys (`$GT`, etc.); GetPath resolves bare $NAME.
|
|
3516
|
+
["`$GT`"] = _SelectCmp,
|
|
3517
|
+
["`$LT`"] = _SelectCmp,
|
|
3518
|
+
["`$GTE`"] = _SelectCmp,
|
|
3519
|
+
["`$LTE`"] = _SelectCmp,
|
|
3520
|
+
["`$LIKE`"] = _SelectCmp,
|
|
3521
|
+
["$GT"] = _SelectCmp,
|
|
3522
|
+
["$LT"] = _SelectCmp,
|
|
3523
|
+
["$GTE"] = _SelectCmp,
|
|
3524
|
+
["$LTE"] = _SelectCmp,
|
|
3525
|
+
["$LIKE"] = _SelectCmp,
|
|
3526
|
+
};
|
|
3527
|
+
|
|
3528
|
+
var meta = new Dictionary<string, object?> { [S_BEXACT] = true };
|
|
3529
|
+
var q = Clone(query);
|
|
3530
|
+
|
|
3531
|
+
Walk(q, (k, v, p, path) =>
|
|
3532
|
+
{
|
|
3533
|
+
if (IsMap(v))
|
|
3534
|
+
{
|
|
3535
|
+
object? existing = GetProp(v, "`$OPEN`");
|
|
3536
|
+
if (existing == null)
|
|
3537
|
+
{
|
|
3538
|
+
SetProp(v, "`$OPEN`", true);
|
|
3539
|
+
}
|
|
3540
|
+
}
|
|
3541
|
+
return v;
|
|
3542
|
+
});
|
|
3543
|
+
|
|
3544
|
+
foreach (object? child in childList)
|
|
3545
|
+
{
|
|
3546
|
+
var errs = new List<object?>();
|
|
3547
|
+
Validate(child, Clone(q), new InjectState
|
|
3548
|
+
{
|
|
3549
|
+
Extra = selectExtra,
|
|
3550
|
+
Errs = errs,
|
|
3551
|
+
Meta = meta,
|
|
3552
|
+
});
|
|
3553
|
+
|
|
3554
|
+
if (0 == Size(errs))
|
|
3555
|
+
{
|
|
3556
|
+
results.Add(child);
|
|
3557
|
+
}
|
|
3558
|
+
}
|
|
3559
|
+
|
|
3560
|
+
return results;
|
|
3561
|
+
}
|
|
3562
|
+
|
|
3563
|
+
[GeneratedRegex(@"^[-0-9]+$")]
|
|
3564
|
+
private static partial Regex R_IntegerKeyGen();
|
|
3565
|
+
[GeneratedRegex(@"[.*+?^${}()|[\]\\]")]
|
|
3566
|
+
private static partial Regex R_EscapeRegexpGen();
|
|
3567
|
+
[GeneratedRegex(@"^`\$REF:([0-9]+)`$")]
|
|
3568
|
+
private static partial Regex R_CloneRefGen();
|
|
3569
|
+
[GeneratedRegex(@"^`(\$[A-Z]+|[^`]*)[0-9]*`$")]
|
|
3570
|
+
private static partial Regex R_InjectionFullGen();
|
|
3571
|
+
[GeneratedRegex(@"`([^`]+)`")]
|
|
3572
|
+
private static partial Regex R_InjectionPartialGen();
|
|
3573
|
+
[GeneratedRegex(@"\$\$")]
|
|
3574
|
+
private static partial Regex R_DoubleDollarGen();
|
|
3575
|
+
[GeneratedRegex(@"^([^$]+)\$([=~])(.+)$")]
|
|
3576
|
+
private static partial Regex R_MetaPathGen();
|
|
3577
|
+
[GeneratedRegex(@"`\$([A-Z]+)`")]
|
|
3578
|
+
private static partial Regex R_TransformNameGen();
|
|
3579
|
+
[GeneratedRegex(@"\.")]
|
|
3580
|
+
private static partial Regex R_DotGen();
|
|
3581
|
+
}
|
|
3582
|
+
}
|