@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,2688 @@
|
|
|
1
|
+
// Copyright (c) 2025-2026 Voxgig Ltd. MIT LICENSE.
|
|
2
|
+
// VERSION: @voxgig/struct 0.1.0
|
|
3
|
+
//
|
|
4
|
+
// Major utilities — walk, merge, getpath, setpath, and (staged) the
|
|
5
|
+
// inject / transform / validate / select machinery. See rs/PLAN.md §8-§11.
|
|
6
|
+
//
|
|
7
|
+
// `merge` is implemented walk-based to stay close to the canonical; the
|
|
8
|
+
// `cur`/`dst` scratch vectors are shared between the before/after closures
|
|
9
|
+
// via `Rc<RefCell<…>>` (Rust can't have two FnMut closures both holding a
|
|
10
|
+
// `&mut` to the same Vec).
|
|
11
|
+
|
|
12
|
+
use std::cell::RefCell;
|
|
13
|
+
use std::rc::Rc;
|
|
14
|
+
|
|
15
|
+
use crate::utility::voxgigstruct::consts::*;
|
|
16
|
+
use crate::utility::voxgigstruct::mini::*;
|
|
17
|
+
use crate::utility::voxgigstruct::ordered_map::OrderedMap;
|
|
18
|
+
use crate::utility::voxgigstruct::value::{js_string, js_to_int32, js_to_number, Value};
|
|
19
|
+
use crate::utility::voxgigstruct::StructError;
|
|
20
|
+
|
|
21
|
+
// ---------------------------------------------------------------------
|
|
22
|
+
// callback / function types
|
|
23
|
+
// ---------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
/// `WalkApply` — `(key, val, parent, path) -> any`. `key` is `Noval` at the
|
|
26
|
+
/// root and a `Str` for every descendant (matches the canonical, where
|
|
27
|
+
/// `items` always yields string keys).
|
|
28
|
+
pub type WalkClosure<'a> = dyn FnMut(&Value, &Value, &Value, &[String]) -> Value + 'a;
|
|
29
|
+
|
|
30
|
+
/// `Injector` — `(inj, val, ref, store) -> any`.
|
|
31
|
+
pub type NativeFn = crate::utility::voxgigstruct::value::NativeFn;
|
|
32
|
+
|
|
33
|
+
/// `Modify` — `(val, key, parent, inj, store)`.
|
|
34
|
+
pub type Modify = crate::utility::voxgigstruct::value::ModifyFn;
|
|
35
|
+
|
|
36
|
+
pub type Inj = Rc<RefCell<Injection>>;
|
|
37
|
+
pub type SVec = Rc<RefCell<Vec<String>>>;
|
|
38
|
+
|
|
39
|
+
// ---------------------------------------------------------------------
|
|
40
|
+
// walk
|
|
41
|
+
// ---------------------------------------------------------------------
|
|
42
|
+
|
|
43
|
+
pub fn walk(
|
|
44
|
+
val: Value,
|
|
45
|
+
before: Option<&mut WalkClosure>,
|
|
46
|
+
after: Option<&mut WalkClosure>,
|
|
47
|
+
maxdepth: Option<i64>,
|
|
48
|
+
) -> Value {
|
|
49
|
+
let mut path: Vec<String> = Vec::new();
|
|
50
|
+
walk_impl(
|
|
51
|
+
val,
|
|
52
|
+
before,
|
|
53
|
+
after,
|
|
54
|
+
maxdepth,
|
|
55
|
+
&Value::Noval,
|
|
56
|
+
&Value::Noval,
|
|
57
|
+
&mut path,
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
fn walk_impl(
|
|
62
|
+
val: Value,
|
|
63
|
+
mut before: Option<&mut WalkClosure>,
|
|
64
|
+
mut after: Option<&mut WalkClosure>,
|
|
65
|
+
maxdepth: Option<i64>,
|
|
66
|
+
key: &Value,
|
|
67
|
+
parent: &Value,
|
|
68
|
+
path: &mut Vec<String>,
|
|
69
|
+
) -> Value {
|
|
70
|
+
let depth = path.len() as i64;
|
|
71
|
+
|
|
72
|
+
let out = match before {
|
|
73
|
+
Some(ref mut f) => f(key, &val, parent, path),
|
|
74
|
+
None => val,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
let md = match maxdepth {
|
|
78
|
+
Some(m) if m >= 0 => m,
|
|
79
|
+
_ => MAXDEPTH,
|
|
80
|
+
};
|
|
81
|
+
if md == 0 || (md > 0 && md <= depth) {
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if is_node(&out) {
|
|
86
|
+
let entries = items_vec(&out);
|
|
87
|
+
for (ckey, child) in entries {
|
|
88
|
+
path.push(ckey.clone());
|
|
89
|
+
let res = walk_impl(
|
|
90
|
+
child,
|
|
91
|
+
before.as_deref_mut(),
|
|
92
|
+
after.as_deref_mut(),
|
|
93
|
+
maxdepth,
|
|
94
|
+
&Value::str(ckey.clone()),
|
|
95
|
+
&out,
|
|
96
|
+
path,
|
|
97
|
+
);
|
|
98
|
+
path.pop();
|
|
99
|
+
set_prop(out.clone(), &Value::str(ckey), res);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
match after {
|
|
104
|
+
Some(ref mut f) => f(key, &out, parent, path),
|
|
105
|
+
None => out,
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// ---------------------------------------------------------------------
|
|
110
|
+
// merge
|
|
111
|
+
// ---------------------------------------------------------------------
|
|
112
|
+
|
|
113
|
+
const T_INSTANCE_I: i64 = T_INSTANCE as i64;
|
|
114
|
+
|
|
115
|
+
pub fn merge(val: &Value, maxdepth: Option<i64>) -> Value {
|
|
116
|
+
let md = match slice(
|
|
117
|
+
Value::Num(maxdepth.unwrap_or(MAXDEPTH) as f64),
|
|
118
|
+
Some(0),
|
|
119
|
+
None,
|
|
120
|
+
false,
|
|
121
|
+
) {
|
|
122
|
+
Value::Num(n) => n as i64,
|
|
123
|
+
_ => MAXDEPTH,
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
let list: Vec<Value> = match val {
|
|
127
|
+
Value::List(l) => l.borrow().clone(),
|
|
128
|
+
other => return other.clone(),
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
if list.is_empty() {
|
|
132
|
+
return Value::Noval;
|
|
133
|
+
}
|
|
134
|
+
if list.len() == 1 {
|
|
135
|
+
return list[0].clone();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
let mut out = match &list[0] {
|
|
139
|
+
Value::Noval => Value::empty_map(),
|
|
140
|
+
other => other.clone(),
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
for obj in list.iter().skip(1) {
|
|
144
|
+
let obj = obj.clone();
|
|
145
|
+
if !is_node(&obj) {
|
|
146
|
+
out = obj;
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
let cur: Rc<RefCell<Vec<Value>>> = Rc::new(RefCell::new(vec![out.clone()]));
|
|
151
|
+
let dst: Rc<RefCell<Vec<Value>>> = Rc::new(RefCell::new(vec![out.clone()]));
|
|
152
|
+
|
|
153
|
+
let cur_b = cur.clone();
|
|
154
|
+
let dst_b = dst.clone();
|
|
155
|
+
let mut before = move |key: &Value, v: &Value, _parent: &Value, path: &[String]| -> Value {
|
|
156
|
+
let pi = path.len() as i64;
|
|
157
|
+
let mut ret = v.clone();
|
|
158
|
+
|
|
159
|
+
if md <= pi {
|
|
160
|
+
let target = cur_b
|
|
161
|
+
.borrow()
|
|
162
|
+
.get((pi - 1) as usize)
|
|
163
|
+
.cloned()
|
|
164
|
+
.unwrap_or(Value::Noval);
|
|
165
|
+
set_prop(target, key, v.clone());
|
|
166
|
+
} else if !is_node(v) {
|
|
167
|
+
let mut cb = cur_b.borrow_mut();
|
|
168
|
+
grow(&mut cb, pi as usize);
|
|
169
|
+
cb[pi as usize] = v.clone();
|
|
170
|
+
} else {
|
|
171
|
+
let tval = {
|
|
172
|
+
let d = if pi > 0 {
|
|
173
|
+
let prev = dst_b
|
|
174
|
+
.borrow()
|
|
175
|
+
.get((pi - 1) as usize)
|
|
176
|
+
.cloned()
|
|
177
|
+
.unwrap_or(Value::Noval);
|
|
178
|
+
get_prop(&prev, key, Value::Noval)
|
|
179
|
+
} else {
|
|
180
|
+
dst_b
|
|
181
|
+
.borrow()
|
|
182
|
+
.get(pi as usize)
|
|
183
|
+
.cloned()
|
|
184
|
+
.unwrap_or(Value::Noval)
|
|
185
|
+
};
|
|
186
|
+
let mut db = dst_b.borrow_mut();
|
|
187
|
+
grow(&mut db, pi as usize);
|
|
188
|
+
db[pi as usize] = d.clone();
|
|
189
|
+
d
|
|
190
|
+
};
|
|
191
|
+
let mut cb = cur_b.borrow_mut();
|
|
192
|
+
grow(&mut cb, pi as usize);
|
|
193
|
+
if tval.is_noval() && (typify(v) & T_INSTANCE_I) == 0 {
|
|
194
|
+
cb[pi as usize] = if is_list(v) {
|
|
195
|
+
Value::empty_list()
|
|
196
|
+
} else {
|
|
197
|
+
Value::empty_map()
|
|
198
|
+
};
|
|
199
|
+
} else if typify(v) == typify(&tval) {
|
|
200
|
+
cb[pi as usize] = tval;
|
|
201
|
+
} else {
|
|
202
|
+
cb[pi as usize] = v.clone();
|
|
203
|
+
ret = Value::Noval;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
ret
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
let cur_a = cur.clone();
|
|
210
|
+
let mut after = move |key: &Value, _v: &Value, _parent: &Value, path: &[String]| -> Value {
|
|
211
|
+
let ci = path.len() as i64;
|
|
212
|
+
let (target, value) = {
|
|
213
|
+
let cb = cur_a.borrow();
|
|
214
|
+
(
|
|
215
|
+
cb.get((ci - 1) as usize).cloned().unwrap_or(Value::Noval),
|
|
216
|
+
cb.get(ci as usize).cloned().unwrap_or(Value::Noval),
|
|
217
|
+
)
|
|
218
|
+
};
|
|
219
|
+
set_prop(target, key, value.clone());
|
|
220
|
+
value
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
out = walk(obj, Some(&mut before), Some(&mut after), maxdepth);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if md == 0 {
|
|
227
|
+
let last = get_elem(&Value::list(list.clone()), &Value::Num(-1.0), Value::Noval);
|
|
228
|
+
out = match &last {
|
|
229
|
+
Value::List(_) => Value::empty_list(),
|
|
230
|
+
Value::Map(_) => Value::empty_map(),
|
|
231
|
+
other => other.clone(),
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
out
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
fn grow(v: &mut Vec<Value>, idx: usize) {
|
|
239
|
+
while v.len() <= idx {
|
|
240
|
+
v.push(Value::Noval);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// ---------------------------------------------------------------------
|
|
245
|
+
// Injection state
|
|
246
|
+
// ---------------------------------------------------------------------
|
|
247
|
+
|
|
248
|
+
pub struct Injection {
|
|
249
|
+
pub mode: i64,
|
|
250
|
+
pub full: bool,
|
|
251
|
+
pub key_i: i64,
|
|
252
|
+
pub keys: SVec,
|
|
253
|
+
pub key: String,
|
|
254
|
+
pub val: Value,
|
|
255
|
+
pub parent: Value,
|
|
256
|
+
pub path: Vec<String>,
|
|
257
|
+
pub nodes: Vec<Value>,
|
|
258
|
+
pub handler: NativeFn,
|
|
259
|
+
pub errs: Value, // Value::List
|
|
260
|
+
pub meta: Value, // Value::Map
|
|
261
|
+
pub dparent: Value,
|
|
262
|
+
pub dpath: Vec<String>,
|
|
263
|
+
pub base: Option<String>,
|
|
264
|
+
pub modify: Option<Modify>,
|
|
265
|
+
pub extra: Option<Value>,
|
|
266
|
+
pub prior: Option<Inj>,
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/// Public `injdef` argument — the subset of `Partial<Injection>` callers set.
|
|
270
|
+
#[derive(Default, Clone)]
|
|
271
|
+
pub struct InjectDef {
|
|
272
|
+
pub base: Option<String>,
|
|
273
|
+
pub errs: Option<Value>,
|
|
274
|
+
pub meta: Option<Value>,
|
|
275
|
+
pub modify: Option<Modify>,
|
|
276
|
+
pub handler: Option<NativeFn>,
|
|
277
|
+
pub extra: Option<Value>,
|
|
278
|
+
pub dparent: Option<Value>,
|
|
279
|
+
pub dpath: Option<Vec<String>>,
|
|
280
|
+
pub key: Option<Value>,
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
impl Injection {
|
|
284
|
+
/// Build a (mostly-empty) injection carrying just the fields the public
|
|
285
|
+
/// `getpath` / `setpath` read from an `injdef`.
|
|
286
|
+
pub fn from_def(def: Option<&InjectDef>) -> Inj {
|
|
287
|
+
let inj = Injection {
|
|
288
|
+
mode: M_VAL,
|
|
289
|
+
full: false,
|
|
290
|
+
key_i: 0,
|
|
291
|
+
keys: Rc::new(RefCell::new(vec![S_DTOP.to_string()])),
|
|
292
|
+
key: S_DTOP.to_string(),
|
|
293
|
+
val: Value::Noval,
|
|
294
|
+
parent: Value::Noval,
|
|
295
|
+
path: vec![S_DTOP.to_string()],
|
|
296
|
+
nodes: vec![Value::Noval],
|
|
297
|
+
handler: inject_handler_fn(),
|
|
298
|
+
errs: Value::empty_list(),
|
|
299
|
+
meta: Value::empty_map(),
|
|
300
|
+
dparent: Value::Noval,
|
|
301
|
+
dpath: vec![S_DTOP.to_string()],
|
|
302
|
+
base: None,
|
|
303
|
+
modify: None,
|
|
304
|
+
extra: None,
|
|
305
|
+
prior: None,
|
|
306
|
+
};
|
|
307
|
+
let inj = Rc::new(RefCell::new(inj));
|
|
308
|
+
if let Some(d) = def {
|
|
309
|
+
let mut b = inj.borrow_mut();
|
|
310
|
+
if let Some(x) = &d.base {
|
|
311
|
+
b.base = Some(x.clone());
|
|
312
|
+
}
|
|
313
|
+
if let Some(x) = &d.errs {
|
|
314
|
+
b.errs = x.clone();
|
|
315
|
+
}
|
|
316
|
+
if let Some(x) = &d.meta {
|
|
317
|
+
b.meta = x.clone();
|
|
318
|
+
}
|
|
319
|
+
if let Some(x) = &d.modify {
|
|
320
|
+
b.modify = Some(x.clone());
|
|
321
|
+
}
|
|
322
|
+
if let Some(x) = &d.handler {
|
|
323
|
+
b.handler = x.clone();
|
|
324
|
+
}
|
|
325
|
+
if let Some(x) = &d.extra {
|
|
326
|
+
b.extra = Some(x.clone());
|
|
327
|
+
}
|
|
328
|
+
if let Some(x) = &d.dparent {
|
|
329
|
+
b.dparent = x.clone();
|
|
330
|
+
}
|
|
331
|
+
if let Some(x) = &d.dpath {
|
|
332
|
+
b.dpath = x.clone();
|
|
333
|
+
}
|
|
334
|
+
if let Some(x) = &d.key {
|
|
335
|
+
b.key = str_key(x.clone());
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
inj
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
fn has_handler(def: Option<&InjectDef>) -> bool {
|
|
342
|
+
def.map(|d| d.handler.is_some()).unwrap_or(false)
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/// Fresh root injection: `val` wrapped in the virtual parent holder.
|
|
346
|
+
pub fn root(val: Value, parent: Value) -> Inj {
|
|
347
|
+
let parent_clone = parent.clone();
|
|
348
|
+
Rc::new(RefCell::new(Injection {
|
|
349
|
+
mode: M_VAL,
|
|
350
|
+
full: false,
|
|
351
|
+
key_i: 0,
|
|
352
|
+
keys: Rc::new(RefCell::new(vec![S_DTOP.to_string()])),
|
|
353
|
+
key: S_DTOP.to_string(),
|
|
354
|
+
val,
|
|
355
|
+
parent,
|
|
356
|
+
path: vec![S_DTOP.to_string()],
|
|
357
|
+
nodes: vec![parent_clone],
|
|
358
|
+
handler: inject_handler_fn(),
|
|
359
|
+
errs: Value::empty_list(),
|
|
360
|
+
meta: Value::empty_map(),
|
|
361
|
+
dparent: Value::Noval,
|
|
362
|
+
dpath: vec![S_DTOP.to_string()],
|
|
363
|
+
base: Some(S_DTOP.to_string()),
|
|
364
|
+
modify: None,
|
|
365
|
+
extra: None,
|
|
366
|
+
prior: None,
|
|
367
|
+
}))
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
pub fn descend(this: &Inj) {
|
|
371
|
+
// meta.__d++
|
|
372
|
+
{
|
|
373
|
+
let b = this.borrow();
|
|
374
|
+
if let Value::Map(m) = &b.meta {
|
|
375
|
+
let cur = m
|
|
376
|
+
.borrow()
|
|
377
|
+
.get("__d")
|
|
378
|
+
.and_then(|v| v.as_num())
|
|
379
|
+
.unwrap_or(0.0);
|
|
380
|
+
m.borrow_mut()
|
|
381
|
+
.insert("__d".to_string(), Value::Num(cur + 1.0));
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
let (parentkey, has_dparent, dpath_len, last_part) = {
|
|
385
|
+
let b = this.borrow();
|
|
386
|
+
let parentkey = if b.path.len() >= 2 {
|
|
387
|
+
Some(b.path[b.path.len() - 2].clone())
|
|
388
|
+
} else {
|
|
389
|
+
None
|
|
390
|
+
};
|
|
391
|
+
(
|
|
392
|
+
parentkey,
|
|
393
|
+
!b.dparent.is_noval(),
|
|
394
|
+
b.dpath.len(),
|
|
395
|
+
b.dpath.last().cloned(),
|
|
396
|
+
)
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
if !has_dparent {
|
|
400
|
+
if dpath_len > 1 {
|
|
401
|
+
if let Some(pk) = parentkey {
|
|
402
|
+
this.borrow_mut().dpath.push(pk);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
} else if let Some(pk) = parentkey {
|
|
406
|
+
let newdparent = {
|
|
407
|
+
let b = this.borrow();
|
|
408
|
+
get_prop(&b.dparent, &Value::str(pk.clone()), Value::Noval)
|
|
409
|
+
};
|
|
410
|
+
let mut b = this.borrow_mut();
|
|
411
|
+
b.dparent = newdparent;
|
|
412
|
+
if last_part.as_deref() == Some(format!("$:{pk}").as_str()) {
|
|
413
|
+
let n = b.dpath.len();
|
|
414
|
+
b.dpath.truncate(n.saturating_sub(1));
|
|
415
|
+
} else {
|
|
416
|
+
b.dpath.push(pk);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
pub fn child(this: &Inj, key_i: i64, keys: SVec) -> Inj {
|
|
422
|
+
let (
|
|
423
|
+
key,
|
|
424
|
+
parent_val,
|
|
425
|
+
cval,
|
|
426
|
+
path,
|
|
427
|
+
nodes,
|
|
428
|
+
mode,
|
|
429
|
+
handler,
|
|
430
|
+
modify,
|
|
431
|
+
base,
|
|
432
|
+
meta,
|
|
433
|
+
errs,
|
|
434
|
+
dpath,
|
|
435
|
+
dparent,
|
|
436
|
+
) = {
|
|
437
|
+
let b = this.borrow();
|
|
438
|
+
let key = str_key(
|
|
439
|
+
keys.borrow()
|
|
440
|
+
.get(key_i.max(0) as usize)
|
|
441
|
+
.cloned()
|
|
442
|
+
.map(Value::Str)
|
|
443
|
+
.unwrap_or(Value::Noval),
|
|
444
|
+
);
|
|
445
|
+
let parent_val = b.val.clone();
|
|
446
|
+
let cval = get_prop(&parent_val, &Value::str(key.clone()), Value::Noval);
|
|
447
|
+
let mut path = b.path.clone();
|
|
448
|
+
path.push(key.clone());
|
|
449
|
+
let mut nodes = b.nodes.clone();
|
|
450
|
+
nodes.push(parent_val.clone());
|
|
451
|
+
(
|
|
452
|
+
key,
|
|
453
|
+
parent_val,
|
|
454
|
+
cval,
|
|
455
|
+
path,
|
|
456
|
+
nodes,
|
|
457
|
+
b.mode,
|
|
458
|
+
b.handler.clone(),
|
|
459
|
+
b.modify.clone(),
|
|
460
|
+
b.base.clone(),
|
|
461
|
+
b.meta.clone(),
|
|
462
|
+
b.errs.clone(),
|
|
463
|
+
b.dpath.clone(),
|
|
464
|
+
b.dparent.clone(),
|
|
465
|
+
)
|
|
466
|
+
};
|
|
467
|
+
Rc::new(RefCell::new(Injection {
|
|
468
|
+
mode,
|
|
469
|
+
full: false,
|
|
470
|
+
key_i,
|
|
471
|
+
keys,
|
|
472
|
+
key,
|
|
473
|
+
val: cval,
|
|
474
|
+
parent: parent_val,
|
|
475
|
+
path,
|
|
476
|
+
nodes,
|
|
477
|
+
handler,
|
|
478
|
+
errs,
|
|
479
|
+
meta,
|
|
480
|
+
dparent,
|
|
481
|
+
dpath,
|
|
482
|
+
base,
|
|
483
|
+
modify,
|
|
484
|
+
extra: None,
|
|
485
|
+
prior: Some(Rc::clone(this)),
|
|
486
|
+
}))
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
pub fn setval(this: &Inj, val: Value, ancestor: Option<i64>) -> Value {
|
|
490
|
+
let anc = ancestor.unwrap_or(0);
|
|
491
|
+
if anc < 2 {
|
|
492
|
+
let (parent, key) = {
|
|
493
|
+
let b = this.borrow();
|
|
494
|
+
(b.parent.clone(), b.key.clone())
|
|
495
|
+
};
|
|
496
|
+
if val.is_noval() {
|
|
497
|
+
let np = del_prop(parent, &Value::str(key));
|
|
498
|
+
this.borrow_mut().parent = np.clone();
|
|
499
|
+
np
|
|
500
|
+
} else {
|
|
501
|
+
set_prop(parent, &Value::str(key), val)
|
|
502
|
+
}
|
|
503
|
+
} else {
|
|
504
|
+
let (aval, akey) = {
|
|
505
|
+
let b = this.borrow();
|
|
506
|
+
let n = b.nodes.len() as i64;
|
|
507
|
+
let aval = if n - anc >= 0 {
|
|
508
|
+
b.nodes[(n - anc) as usize].clone()
|
|
509
|
+
} else {
|
|
510
|
+
Value::Noval
|
|
511
|
+
};
|
|
512
|
+
let pn = b.path.len() as i64;
|
|
513
|
+
let akey = if pn - anc >= 0 {
|
|
514
|
+
b.path[(pn - anc) as usize].clone()
|
|
515
|
+
} else {
|
|
516
|
+
String::new()
|
|
517
|
+
};
|
|
518
|
+
(aval, akey)
|
|
519
|
+
};
|
|
520
|
+
if val.is_noval() {
|
|
521
|
+
del_prop(aval, &Value::str(akey))
|
|
522
|
+
} else {
|
|
523
|
+
set_prop(aval, &Value::str(akey), val)
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// ---------------------------------------------------------------------
|
|
530
|
+
// getpath
|
|
531
|
+
// ---------------------------------------------------------------------
|
|
532
|
+
|
|
533
|
+
pub fn get_path(store: &Value, path: &Value, injdef: Option<&InjectDef>) -> Value {
|
|
534
|
+
let inj: Option<Inj> = injdef.map(|_| Injection::from_def(injdef));
|
|
535
|
+
get_path_inj(store, path, inj.as_ref())
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/// Internal `getpath` working against a full `Inj` (used by the inject
|
|
539
|
+
/// machinery and by the public `get_path` wrapper).
|
|
540
|
+
pub fn get_path_inj(store: &Value, path: &Value, injdef: Option<&Inj>) -> Value {
|
|
541
|
+
let mut parts: Vec<String> = match path {
|
|
542
|
+
Value::List(l) => l
|
|
543
|
+
.borrow()
|
|
544
|
+
.iter()
|
|
545
|
+
.map(|x| match x {
|
|
546
|
+
Value::Str(s) => s.clone(),
|
|
547
|
+
other => js_string(other),
|
|
548
|
+
})
|
|
549
|
+
.collect(),
|
|
550
|
+
Value::Str(s) => s.split('.').map(|p| p.to_string()).collect(),
|
|
551
|
+
Value::Num(n) => vec![str_key(Value::Num(*n))],
|
|
552
|
+
_ => return Value::Noval,
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
let base = injdef.and_then(|i| i.borrow().base.clone());
|
|
556
|
+
let src = match &base {
|
|
557
|
+
Some(b) => get_prop(store, &Value::str(b.clone()), store.clone()),
|
|
558
|
+
None => store.clone(),
|
|
559
|
+
};
|
|
560
|
+
let numparts = parts.len();
|
|
561
|
+
let dparent = injdef
|
|
562
|
+
.map(|i| i.borrow().dparent.clone())
|
|
563
|
+
.unwrap_or(Value::Noval);
|
|
564
|
+
|
|
565
|
+
let mut val = store.clone();
|
|
566
|
+
|
|
567
|
+
let path_nullish = matches!(path, Value::Noval | Value::Null);
|
|
568
|
+
if path_nullish
|
|
569
|
+
|| matches!(store, Value::Noval | Value::Null)
|
|
570
|
+
|| (numparts == 1 && parts[0].is_empty())
|
|
571
|
+
{
|
|
572
|
+
val = src.clone();
|
|
573
|
+
} else if numparts > 0 {
|
|
574
|
+
if numparts == 1 {
|
|
575
|
+
val = get_prop(store, &Value::str(parts[0].clone()), Value::Noval);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
if !is_func(&val) {
|
|
579
|
+
val = src.clone();
|
|
580
|
+
|
|
581
|
+
// meta path prefix: "name$=..." / "name$~..."
|
|
582
|
+
if let Some(inj) = injdef {
|
|
583
|
+
let meta = inj.borrow().meta.clone();
|
|
584
|
+
let first = parts[0].clone();
|
|
585
|
+
if let Some(caps) = R_META_PATH.captures(&first) {
|
|
586
|
+
if !meta.is_noval() {
|
|
587
|
+
val = get_prop(&meta, &Value::str(caps[1].to_string()), Value::Noval);
|
|
588
|
+
parts[0] = caps[3].to_string();
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
let dpath: Vec<String> = injdef.map(|i| i.borrow().dpath.clone()).unwrap_or_default();
|
|
594
|
+
|
|
595
|
+
let mut p_i = 0usize;
|
|
596
|
+
while !val.is_noval() && p_i < numparts {
|
|
597
|
+
let mut part = parts[p_i].clone();
|
|
598
|
+
|
|
599
|
+
if let Some(inj) = injdef {
|
|
600
|
+
if part == S_DKEY {
|
|
601
|
+
part = inj.borrow().key.clone();
|
|
602
|
+
} else if let Some(rest) = part.strip_prefix("$GET:") {
|
|
603
|
+
part = js_string(&get_path_inj(&src, &Value::str(drop_last(rest)), None));
|
|
604
|
+
} else if let Some(rest) = part.strip_prefix("$REF:") {
|
|
605
|
+
let spec = get_prop(store, &Value::str(S_DSPEC), Value::Noval);
|
|
606
|
+
part = js_string(&get_path_inj(&spec, &Value::str(drop_last(rest)), None));
|
|
607
|
+
} else if let Some(rest) = part.strip_prefix("$META:") {
|
|
608
|
+
let meta = inj.borrow().meta.clone();
|
|
609
|
+
part = js_string(&get_path_inj(&meta, &Value::str(drop_last(rest)), None));
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
part = part.replace("$$", "$");
|
|
614
|
+
|
|
615
|
+
if part.is_empty() {
|
|
616
|
+
let mut ascends = 0i64;
|
|
617
|
+
while parts.get(1 + p_i).map(|s| s.is_empty()).unwrap_or(false) {
|
|
618
|
+
ascends += 1;
|
|
619
|
+
p_i += 1;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
if injdef.is_some() && ascends > 0 {
|
|
623
|
+
if p_i == parts.len() - 1 {
|
|
624
|
+
ascends -= 1;
|
|
625
|
+
}
|
|
626
|
+
if ascends == 0 {
|
|
627
|
+
val = dparent.clone();
|
|
628
|
+
} else {
|
|
629
|
+
// fullpath = slice(dpath, -ascends) ++ parts[p_i+1..]
|
|
630
|
+
let head = slice(
|
|
631
|
+
Value::list(dpath.iter().cloned().map(Value::Str).collect()),
|
|
632
|
+
Some(-ascends),
|
|
633
|
+
None,
|
|
634
|
+
false,
|
|
635
|
+
);
|
|
636
|
+
let mut fullpath: Vec<String> = match &head {
|
|
637
|
+
Value::List(l) => l
|
|
638
|
+
.borrow()
|
|
639
|
+
.iter()
|
|
640
|
+
.map(|x| x.as_str().map(|s| s.to_string()).unwrap_or_default())
|
|
641
|
+
.collect(),
|
|
642
|
+
_ => Vec::new(),
|
|
643
|
+
};
|
|
644
|
+
fullpath.extend_from_slice(&parts[p_i + 1..]);
|
|
645
|
+
if ascends <= dpath.len() as i64 {
|
|
646
|
+
val = get_path_inj(
|
|
647
|
+
store,
|
|
648
|
+
&Value::list(fullpath.into_iter().map(Value::Str).collect()),
|
|
649
|
+
None,
|
|
650
|
+
);
|
|
651
|
+
} else {
|
|
652
|
+
val = Value::Noval;
|
|
653
|
+
}
|
|
654
|
+
break;
|
|
655
|
+
}
|
|
656
|
+
} else {
|
|
657
|
+
val = dparent.clone();
|
|
658
|
+
}
|
|
659
|
+
} else {
|
|
660
|
+
val = get_prop(&val, &Value::str(part), Value::Noval);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
p_i += 1;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
if let Some(inj) = injdef {
|
|
669
|
+
let handler = inj.borrow().handler.clone();
|
|
670
|
+
let r = pathify(path, None, None);
|
|
671
|
+
val = handler(inj, &val, &r, store);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
val
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
fn drop_last(s: &str) -> String {
|
|
678
|
+
let chars: Vec<char> = s.chars().collect();
|
|
679
|
+
if chars.is_empty() {
|
|
680
|
+
String::new()
|
|
681
|
+
} else {
|
|
682
|
+
chars[..chars.len() - 1].iter().collect()
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
// ---------------------------------------------------------------------
|
|
687
|
+
// setpath
|
|
688
|
+
// ---------------------------------------------------------------------
|
|
689
|
+
|
|
690
|
+
pub fn set_path(store: &Value, path: &Value, val: Value, injdef: Option<&InjectDef>) -> Value {
|
|
691
|
+
// Keep parts as Values so a numeric part (only possible when `path` is an
|
|
692
|
+
// array) makes its parent a list, while a string part makes a map.
|
|
693
|
+
let parts: Vec<Value> = match path {
|
|
694
|
+
Value::List(l) => l.borrow().clone(),
|
|
695
|
+
Value::Str(s) => s.split('.').map(Value::str).collect(),
|
|
696
|
+
Value::Num(n) => vec![Value::Num(*n)],
|
|
697
|
+
_ => return Value::Noval,
|
|
698
|
+
};
|
|
699
|
+
if parts.is_empty() {
|
|
700
|
+
return Value::Noval;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
let base = injdef.and_then(|d| d.base.clone());
|
|
704
|
+
let numparts = parts.len();
|
|
705
|
+
let mut parent = match &base {
|
|
706
|
+
Some(b) => get_prop(store, &Value::str(b.clone()), store.clone()),
|
|
707
|
+
None => store.clone(),
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
for p_i in 0..numparts - 1 {
|
|
711
|
+
let part_key = parts[p_i].clone();
|
|
712
|
+
let next_parent = get_prop(&parent, &part_key, Value::Noval);
|
|
713
|
+
let next_parent = if !is_node(&next_parent) {
|
|
714
|
+
let next_is_num = parts
|
|
715
|
+
.get(p_i + 1)
|
|
716
|
+
.map(|p| typify(p) & (T_NUMBER as i64) != 0)
|
|
717
|
+
.unwrap_or(false);
|
|
718
|
+
let np = if next_is_num {
|
|
719
|
+
Value::empty_list()
|
|
720
|
+
} else {
|
|
721
|
+
Value::empty_map()
|
|
722
|
+
};
|
|
723
|
+
set_prop(parent.clone(), &part_key, np.clone());
|
|
724
|
+
np
|
|
725
|
+
} else {
|
|
726
|
+
next_parent
|
|
727
|
+
};
|
|
728
|
+
parent = next_parent;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
let last = parts[numparts - 1].clone();
|
|
732
|
+
if val.is_delete() {
|
|
733
|
+
del_prop(parent.clone(), &last);
|
|
734
|
+
} else {
|
|
735
|
+
set_prop(parent.clone(), &last, val);
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
parent
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
// ---------------------------------------------------------------------
|
|
742
|
+
// inject / transform / validate / select — staged (see rs/PLAN.md, NOTES.md)
|
|
743
|
+
// ---------------------------------------------------------------------
|
|
744
|
+
|
|
745
|
+
/// Default inject handler (`_injecthandler`): if the value is a `$NAME`
|
|
746
|
+
/// command function, call it; otherwise, in `val` mode for a full-string
|
|
747
|
+
/// injection, write the value back into the parent.
|
|
748
|
+
pub fn inject_handler_fn() -> NativeFn {
|
|
749
|
+
Rc::new(inject_handler)
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
fn inject_handler(inj: &Inj, val: &Value, r: &str, store: &Value) -> Value {
|
|
753
|
+
let iscmd = is_func(val) && (r.is_empty() || r.starts_with('$'));
|
|
754
|
+
if iscmd {
|
|
755
|
+
if let Value::Func(f) = val {
|
|
756
|
+
return f(inj, val, r, store);
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
let (mode, full) = {
|
|
760
|
+
let b = inj.borrow();
|
|
761
|
+
(b.mode, b.full)
|
|
762
|
+
};
|
|
763
|
+
if mode == M_VAL && full {
|
|
764
|
+
Injection::setval(inj, val.clone(), None);
|
|
765
|
+
}
|
|
766
|
+
val.clone()
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/// `_injectstr` — substitute `` `path` `` references inside a string.
|
|
770
|
+
fn injectstr(val: &str, store: &Value, inj: Option<&Inj>) -> Value {
|
|
771
|
+
if val.is_empty() {
|
|
772
|
+
return Value::str("");
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
if let Some(caps) = R_INJECTION_FULL.captures(val) {
|
|
776
|
+
if let Some(i) = inj {
|
|
777
|
+
i.borrow_mut().full = true;
|
|
778
|
+
}
|
|
779
|
+
let mut pathref = caps[1].to_string();
|
|
780
|
+
if pathref.chars().count() > 3 {
|
|
781
|
+
pathref = pathref.replace("$BT", S_BT).replace("$DS", S_DS);
|
|
782
|
+
}
|
|
783
|
+
return get_path_inj(store, &Value::str(pathref), inj);
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
// partial injection: replace each `ref` occurrence
|
|
787
|
+
let out_str = R_INJECTION_PARTIAL
|
|
788
|
+
.replace_all(val, |caps: &crate::utility::voxgigstruct::re::Captures<'_>| -> String {
|
|
789
|
+
let mut r = caps[1].to_string();
|
|
790
|
+
if r.chars().count() > 3 {
|
|
791
|
+
r = r.replace("$BT", S_BT).replace("$DS", S_DS);
|
|
792
|
+
}
|
|
793
|
+
if let Some(i) = inj {
|
|
794
|
+
i.borrow_mut().full = false;
|
|
795
|
+
}
|
|
796
|
+
let found = get_path_inj(store, &Value::str(r), inj);
|
|
797
|
+
match &found {
|
|
798
|
+
Value::Noval => String::new(),
|
|
799
|
+
Value::Str(s) => s.clone(),
|
|
800
|
+
other => jsonify(
|
|
801
|
+
other,
|
|
802
|
+
Some(&JsonFlags {
|
|
803
|
+
indent: 0,
|
|
804
|
+
offset: 0,
|
|
805
|
+
}),
|
|
806
|
+
),
|
|
807
|
+
}
|
|
808
|
+
})
|
|
809
|
+
.to_string();
|
|
810
|
+
|
|
811
|
+
if let Some(i) = inj {
|
|
812
|
+
let handler = {
|
|
813
|
+
i.borrow_mut().full = true;
|
|
814
|
+
i.borrow().handler.clone()
|
|
815
|
+
};
|
|
816
|
+
return handler(i, &Value::str(out_str), val, store);
|
|
817
|
+
}
|
|
818
|
+
Value::str(out_str)
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
pub fn inject(val: Value, store: &Value, injdef: Option<&InjectDef>) -> Value {
|
|
822
|
+
let inj = make_root_injection(val.clone(), store, injdef);
|
|
823
|
+
inject_inj(val, store, &inj)
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
/// Build the root injection for a top-level `inject` (mirrors the TS setup
|
|
827
|
+
/// block when `injdef.mode == null`).
|
|
828
|
+
fn make_root_injection(val: Value, store: &Value, injdef: Option<&InjectDef>) -> Inj {
|
|
829
|
+
let mut top = OrderedMap::new();
|
|
830
|
+
top.insert(S_DTOP.to_string(), val.clone());
|
|
831
|
+
let inj = Injection::root(val, Value::map(top));
|
|
832
|
+
{
|
|
833
|
+
let mut b = inj.borrow_mut();
|
|
834
|
+
b.dparent = store.clone();
|
|
835
|
+
let store_errs = get_prop(store, &Value::str(S_DERRS), Value::Noval);
|
|
836
|
+
if !store_errs.is_noval() {
|
|
837
|
+
b.errs = store_errs;
|
|
838
|
+
}
|
|
839
|
+
if let Value::Map(m) = &b.meta {
|
|
840
|
+
m.borrow_mut().insert("__d".to_string(), Value::Num(0.0));
|
|
841
|
+
}
|
|
842
|
+
if let Some(d) = injdef {
|
|
843
|
+
if let Some(x) = &d.modify {
|
|
844
|
+
b.modify = Some(x.clone());
|
|
845
|
+
}
|
|
846
|
+
if let Some(x) = &d.extra {
|
|
847
|
+
b.extra = Some(x.clone());
|
|
848
|
+
}
|
|
849
|
+
if let Some(x) = &d.meta {
|
|
850
|
+
b.meta = x.clone();
|
|
851
|
+
}
|
|
852
|
+
if let Some(x) = &d.handler {
|
|
853
|
+
b.handler = x.clone();
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
inj
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
/// Recursive `inject` working against an existing injection.
|
|
861
|
+
// `nk_i` is re-read after every child phase to match the canonical loop
|
|
862
|
+
// (an injector in the M_VAL phase, e.g. $REF, may change `key_i`).
|
|
863
|
+
#[allow(unused_assignments)]
|
|
864
|
+
fn inject_inj(mut val: Value, store: &Value, inj: &Inj) -> Value {
|
|
865
|
+
Injection::descend(inj);
|
|
866
|
+
|
|
867
|
+
if is_node(&val) {
|
|
868
|
+
// node keys: sorted, then `$`-bearing keys last (for maps).
|
|
869
|
+
let nodekeys: SVec = {
|
|
870
|
+
let ks = keysof_vec(&val);
|
|
871
|
+
if is_map(&val) {
|
|
872
|
+
let (mut plain, dollar): (Vec<String>, Vec<String>) =
|
|
873
|
+
ks.into_iter().partition(|k| !k.contains(S_DS));
|
|
874
|
+
plain.extend(dollar);
|
|
875
|
+
Rc::new(RefCell::new(plain))
|
|
876
|
+
} else {
|
|
877
|
+
Rc::new(RefCell::new(ks))
|
|
878
|
+
}
|
|
879
|
+
};
|
|
880
|
+
|
|
881
|
+
let mut nk_i: i64 = 0;
|
|
882
|
+
loop {
|
|
883
|
+
if nk_i < 0 {
|
|
884
|
+
nk_i += 1;
|
|
885
|
+
continue;
|
|
886
|
+
}
|
|
887
|
+
if nk_i as usize >= nodekeys.borrow().len() {
|
|
888
|
+
break;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
let childinj = Injection::child(inj, nk_i, nodekeys.clone());
|
|
892
|
+
let nodekey = childinj.borrow().key.clone();
|
|
893
|
+
childinj.borrow_mut().mode = M_KEYPRE;
|
|
894
|
+
|
|
895
|
+
let prekey = injectstr(&nodekey, store, Some(&childinj));
|
|
896
|
+
nk_i = childinj.borrow().key_i;
|
|
897
|
+
// (keys may have been replaced by an injector — `nodekeys` itself
|
|
898
|
+
// is the shared Rc, so re-reading is implicit.)
|
|
899
|
+
|
|
900
|
+
if !prekey.is_noval() {
|
|
901
|
+
let cval = get_prop(&val, &prekey, Value::Noval);
|
|
902
|
+
{
|
|
903
|
+
let mut b = childinj.borrow_mut();
|
|
904
|
+
b.val = cval.clone();
|
|
905
|
+
b.mode = M_VAL;
|
|
906
|
+
}
|
|
907
|
+
inject_inj(cval, store, &childinj);
|
|
908
|
+
nk_i = childinj.borrow().key_i;
|
|
909
|
+
|
|
910
|
+
childinj.borrow_mut().mode = M_KEYPOST;
|
|
911
|
+
injectstr(&nodekey, store, Some(&childinj));
|
|
912
|
+
nk_i = childinj.borrow().key_i;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
nk_i += 1;
|
|
916
|
+
}
|
|
917
|
+
} else if let Value::Str(s) = val.clone() {
|
|
918
|
+
inj.borrow_mut().mode = M_VAL;
|
|
919
|
+
let r = injectstr(&s, store, Some(inj));
|
|
920
|
+
val = r.clone();
|
|
921
|
+
if !val.is_skip() {
|
|
922
|
+
Injection::setval(inj, val.clone(), None);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
// custom modification
|
|
927
|
+
let modify = inj.borrow().modify.clone();
|
|
928
|
+
if let Some(m) = modify {
|
|
929
|
+
if !val.is_skip() {
|
|
930
|
+
let (mkey, mparent) = {
|
|
931
|
+
let b = inj.borrow();
|
|
932
|
+
(b.key.clone(), b.parent.clone())
|
|
933
|
+
};
|
|
934
|
+
let mval = get_prop(&mparent, &Value::str(mkey.clone()), Value::Noval);
|
|
935
|
+
m(&mval, &Value::str(mkey), &mparent, inj, store);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
inj.borrow_mut().val = val;
|
|
940
|
+
let parent = inj.borrow().parent.clone();
|
|
941
|
+
// Read back the root via raw lookup (canonical TS `_lookup(inj.parent,
|
|
942
|
+
// S_DTOP)`) so a null result is preserved, not dropped by Group A.
|
|
943
|
+
lookup(&parent, &Value::str(S_DTOP))
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// ---- transform commands ----------------------------------------------
|
|
947
|
+
|
|
948
|
+
const T_ANY_I: i64 = T_ANY as i64;
|
|
949
|
+
|
|
950
|
+
fn errs_push(inj: &Inj, msg: String) {
|
|
951
|
+
let errs = inj.borrow().errs.clone();
|
|
952
|
+
if let Value::List(l) = &errs {
|
|
953
|
+
l.borrow_mut().push(Value::Str(msg));
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
fn placement_str(mode: i64) -> &'static str {
|
|
958
|
+
match mode {
|
|
959
|
+
M_VAL => "value",
|
|
960
|
+
M_KEYPRE | M_KEYPOST => "key",
|
|
961
|
+
_ => "",
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
pub fn check_placement(modes: i64, ijname: &str, parent_types: i64, inj: &Inj) -> bool {
|
|
966
|
+
let (mode, parent) = {
|
|
967
|
+
let b = inj.borrow();
|
|
968
|
+
(b.mode, b.parent.clone())
|
|
969
|
+
};
|
|
970
|
+
if modes & mode == 0 {
|
|
971
|
+
let expected: Vec<&str> = [M_KEYPRE, M_KEYPOST, M_VAL]
|
|
972
|
+
.iter()
|
|
973
|
+
.filter(|m| modes & **m != 0)
|
|
974
|
+
.map(|m| placement_str(*m))
|
|
975
|
+
.collect();
|
|
976
|
+
errs_push(
|
|
977
|
+
inj,
|
|
978
|
+
format!(
|
|
979
|
+
"${ijname}: invalid placement as {}, expected: {}.",
|
|
980
|
+
placement_str(mode),
|
|
981
|
+
expected.join(",")
|
|
982
|
+
),
|
|
983
|
+
);
|
|
984
|
+
return false;
|
|
985
|
+
}
|
|
986
|
+
if !is_empty(&Value::Num(parent_types as f64)) {
|
|
987
|
+
let ptype = typify(&parent);
|
|
988
|
+
if parent_types & ptype == 0 {
|
|
989
|
+
errs_push(
|
|
990
|
+
inj,
|
|
991
|
+
format!(
|
|
992
|
+
"${ijname}: invalid placement in parent {}, expected: {}.",
|
|
993
|
+
type_name(ptype),
|
|
994
|
+
type_name(parent_types)
|
|
995
|
+
),
|
|
996
|
+
);
|
|
997
|
+
return false;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
true
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
pub fn injector_args(arg_types: &[i64], args: &[Value]) -> Vec<Value> {
|
|
1004
|
+
let mut found: Vec<Value> = Vec::with_capacity(1 + arg_types.len());
|
|
1005
|
+
found.push(Value::Noval);
|
|
1006
|
+
for (i, at) in arg_types.iter().enumerate() {
|
|
1007
|
+
let arg = args.get(i).cloned().unwrap_or(Value::Noval);
|
|
1008
|
+
let argtype = typify(&arg);
|
|
1009
|
+
if at & argtype == 0 {
|
|
1010
|
+
found[0] = Value::str(format!(
|
|
1011
|
+
"invalid argument: {} ({} at position {}) is not of type: {}.",
|
|
1012
|
+
stringify(&arg, Some(22), false),
|
|
1013
|
+
type_name(argtype),
|
|
1014
|
+
1 + i,
|
|
1015
|
+
type_name(*at)
|
|
1016
|
+
));
|
|
1017
|
+
return found;
|
|
1018
|
+
}
|
|
1019
|
+
found.push(arg);
|
|
1020
|
+
}
|
|
1021
|
+
found
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
pub fn inject_child(child: Value, store: &Value, inj: &Inj) -> Inj {
|
|
1025
|
+
let prior = inj.borrow().prior.clone();
|
|
1026
|
+
let cinj: Inj = match prior {
|
|
1027
|
+
None => Rc::clone(inj),
|
|
1028
|
+
Some(p) => {
|
|
1029
|
+
let pprior = p.borrow().prior.clone();
|
|
1030
|
+
match pprior {
|
|
1031
|
+
Some(pp) => {
|
|
1032
|
+
let (pki, pkeys, pkey) = {
|
|
1033
|
+
let b = p.borrow();
|
|
1034
|
+
(b.key_i, b.keys.clone(), b.key.clone())
|
|
1035
|
+
};
|
|
1036
|
+
let c = Injection::child(&pp, pki, pkeys);
|
|
1037
|
+
c.borrow_mut().val = child.clone();
|
|
1038
|
+
let cparent = c.borrow().parent.clone();
|
|
1039
|
+
set_prop(cparent, &Value::str(pkey), child.clone());
|
|
1040
|
+
c
|
|
1041
|
+
}
|
|
1042
|
+
None => {
|
|
1043
|
+
let (ki, keys, key) = {
|
|
1044
|
+
let b = inj.borrow();
|
|
1045
|
+
(b.key_i, b.keys.clone(), b.key.clone())
|
|
1046
|
+
};
|
|
1047
|
+
let c = Injection::child(&p, ki, keys);
|
|
1048
|
+
c.borrow_mut().val = child.clone();
|
|
1049
|
+
let cparent = c.borrow().parent.clone();
|
|
1050
|
+
set_prop(cparent, &Value::str(key), child.clone());
|
|
1051
|
+
c
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
};
|
|
1056
|
+
let _ = inject_inj(child, store, &cinj);
|
|
1057
|
+
cinj
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
const FORMATTER_NAMES: [&str; 7] = [
|
|
1061
|
+
"identity", "upper", "lower", "string", "number", "integer", "concat",
|
|
1062
|
+
];
|
|
1063
|
+
|
|
1064
|
+
fn apply_formatter(name: &str, k: &Value, v: &Value) -> Value {
|
|
1065
|
+
match name {
|
|
1066
|
+
"identity" => v.clone(),
|
|
1067
|
+
"upper" => {
|
|
1068
|
+
if is_node(v) {
|
|
1069
|
+
v.clone()
|
|
1070
|
+
} else {
|
|
1071
|
+
Value::str(js_string(v).to_uppercase())
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
"lower" => {
|
|
1075
|
+
if is_node(v) {
|
|
1076
|
+
v.clone()
|
|
1077
|
+
} else {
|
|
1078
|
+
Value::str(js_string(v).to_lowercase())
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
"string" => {
|
|
1082
|
+
if is_node(v) {
|
|
1083
|
+
v.clone()
|
|
1084
|
+
} else {
|
|
1085
|
+
Value::str(js_string(v))
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
"number" => {
|
|
1089
|
+
if is_node(v) {
|
|
1090
|
+
v.clone()
|
|
1091
|
+
} else {
|
|
1092
|
+
let n = js_to_number(v);
|
|
1093
|
+
Value::Num(if n.is_nan() { 0.0 } else { n })
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
"integer" => {
|
|
1097
|
+
if is_node(v) {
|
|
1098
|
+
v.clone()
|
|
1099
|
+
} else {
|
|
1100
|
+
let n = js_to_number(v);
|
|
1101
|
+
let n = if n.is_nan() { 0.0 } else { n };
|
|
1102
|
+
Value::Num(js_to_int32(n) as f64)
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
"concat" => {
|
|
1106
|
+
if k.is_noval() && is_list(v) {
|
|
1107
|
+
Value::str(
|
|
1108
|
+
items_vec(v)
|
|
1109
|
+
.iter()
|
|
1110
|
+
.map(|(_, n)| {
|
|
1111
|
+
if is_node(n) {
|
|
1112
|
+
String::new()
|
|
1113
|
+
} else {
|
|
1114
|
+
js_string(n)
|
|
1115
|
+
}
|
|
1116
|
+
})
|
|
1117
|
+
.collect::<Vec<_>>()
|
|
1118
|
+
.join(""),
|
|
1119
|
+
)
|
|
1120
|
+
} else {
|
|
1121
|
+
v.clone()
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
_ => v.clone(),
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
// `$FORMAT` — render a templated value through a named (or supplied) formatter.
|
|
1129
|
+
fn transform_format(inj: &Inj, _val: &Value, _r: &str, store: &Value) -> Value {
|
|
1130
|
+
inj.borrow().keys.borrow_mut().truncate(1);
|
|
1131
|
+
if inj.borrow().mode != M_VAL {
|
|
1132
|
+
return Value::Noval;
|
|
1133
|
+
}
|
|
1134
|
+
let (parent, path, nodes) = {
|
|
1135
|
+
let b = inj.borrow();
|
|
1136
|
+
(b.parent.clone(), b.path.clone(), b.nodes.clone())
|
|
1137
|
+
};
|
|
1138
|
+
let name = lookup(&parent, &Value::Num(1.0));
|
|
1139
|
+
let child = lookup(&parent, &Value::Num(2.0));
|
|
1140
|
+
let tkey = path
|
|
1141
|
+
.get(path.len().saturating_sub(2))
|
|
1142
|
+
.cloned()
|
|
1143
|
+
.unwrap_or_default();
|
|
1144
|
+
let nlen = nodes.len();
|
|
1145
|
+
let target = if nlen >= 2 {
|
|
1146
|
+
nodes[nlen - 2].clone()
|
|
1147
|
+
} else if nlen >= 1 {
|
|
1148
|
+
nodes[nlen - 1].clone()
|
|
1149
|
+
} else {
|
|
1150
|
+
Value::Noval
|
|
1151
|
+
};
|
|
1152
|
+
|
|
1153
|
+
let cinj = inject_child(child, store, inj);
|
|
1154
|
+
let resolved = cinj.borrow().val.clone();
|
|
1155
|
+
|
|
1156
|
+
let fname: Option<String> = name
|
|
1157
|
+
.as_str()
|
|
1158
|
+
.filter(|n| FORMATTER_NAMES.contains(n))
|
|
1159
|
+
.map(|s| s.to_string());
|
|
1160
|
+
if fname.is_none() && !is_func(&name) {
|
|
1161
|
+
errs_push(
|
|
1162
|
+
inj,
|
|
1163
|
+
format!("$FORMAT: unknown format: {}.", js_string(&name)),
|
|
1164
|
+
);
|
|
1165
|
+
return Value::Noval;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
let out = if let Some(fn_name) = &fname {
|
|
1169
|
+
let mut fmt = |k: &Value, v: &Value, _p: &Value, _t: &[String]| -> Value {
|
|
1170
|
+
apply_formatter(fn_name, k, v)
|
|
1171
|
+
};
|
|
1172
|
+
walk(resolved, Some(&mut fmt), None, None)
|
|
1173
|
+
} else if let Value::Func(f) = &name {
|
|
1174
|
+
let f = f.clone();
|
|
1175
|
+
let mut fmt =
|
|
1176
|
+
|_k: &Value, v: &Value, _p: &Value, _t: &[String]| -> Value { f(inj, v, "", store) };
|
|
1177
|
+
walk(resolved, Some(&mut fmt), None, None)
|
|
1178
|
+
} else {
|
|
1179
|
+
resolved
|
|
1180
|
+
};
|
|
1181
|
+
|
|
1182
|
+
set_prop(target, &Value::str(tkey), out.clone());
|
|
1183
|
+
out
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
// `$APPLY` — call a function (from the spec args) on the resolved child.
|
|
1187
|
+
fn transform_apply(inj: &Inj, _val: &Value, _r: &str, store: &Value) -> Value {
|
|
1188
|
+
if !check_placement(M_VAL, "APPLY", T_LIST as i64, inj) {
|
|
1189
|
+
return Value::Noval;
|
|
1190
|
+
}
|
|
1191
|
+
let (parent, path, nodes) = {
|
|
1192
|
+
let b = inj.borrow();
|
|
1193
|
+
(b.parent.clone(), b.path.clone(), b.nodes.clone())
|
|
1194
|
+
};
|
|
1195
|
+
let args: Vec<Value> = slice(parent.clone(), Some(1), None, false)
|
|
1196
|
+
.as_list()
|
|
1197
|
+
.map(|l| l.borrow().clone())
|
|
1198
|
+
.unwrap_or_default();
|
|
1199
|
+
let ia = injector_args(&[T_FUNCTION as i64, T_ANY as i64], &args);
|
|
1200
|
+
if let Value::Str(e) = &ia[0] {
|
|
1201
|
+
errs_push(inj, format!("$APPLY: {e}"));
|
|
1202
|
+
return Value::Noval;
|
|
1203
|
+
}
|
|
1204
|
+
let apply = ia.get(1).cloned().unwrap_or(Value::Noval);
|
|
1205
|
+
let child = ia.get(2).cloned().unwrap_or(Value::Noval);
|
|
1206
|
+
let tkey = path
|
|
1207
|
+
.get(path.len().saturating_sub(2))
|
|
1208
|
+
.cloned()
|
|
1209
|
+
.unwrap_or_default();
|
|
1210
|
+
let nlen = nodes.len();
|
|
1211
|
+
let target = if nlen >= 2 {
|
|
1212
|
+
nodes[nlen - 2].clone()
|
|
1213
|
+
} else if nlen >= 1 {
|
|
1214
|
+
nodes[nlen - 1].clone()
|
|
1215
|
+
} else {
|
|
1216
|
+
Value::Noval
|
|
1217
|
+
};
|
|
1218
|
+
let cinj = inject_child(child, store, inj);
|
|
1219
|
+
let resolved = cinj.borrow().val.clone();
|
|
1220
|
+
// The corpus only exercises the error paths; if `apply` is a callable, do
|
|
1221
|
+
// a best-effort call (the canonical passes (resolved, store, cinj)).
|
|
1222
|
+
let out = if let Value::Func(f) = &apply {
|
|
1223
|
+
f(&cinj, &resolved, "", store)
|
|
1224
|
+
} else {
|
|
1225
|
+
resolved
|
|
1226
|
+
};
|
|
1227
|
+
set_prop(target, &Value::str(tkey), out.clone());
|
|
1228
|
+
out
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
fn transform_delete(inj: &Inj, _v: &Value, _r: &str, _store: &Value) -> Value {
|
|
1232
|
+
Injection::setval(inj, Value::Noval, None);
|
|
1233
|
+
Value::Noval
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
fn transform_copy(inj: &Inj, _v: &Value, _r: &str, _store: &Value) -> Value {
|
|
1237
|
+
if !check_placement(M_VAL, "COPY", T_ANY_I, inj) {
|
|
1238
|
+
return Value::Noval;
|
|
1239
|
+
}
|
|
1240
|
+
let (dparent, key) = {
|
|
1241
|
+
let b = inj.borrow();
|
|
1242
|
+
(b.dparent.clone(), b.key.clone())
|
|
1243
|
+
};
|
|
1244
|
+
// Group B: preserve a stored null (canonical `_lookup(inj.dparent, inj.key)`).
|
|
1245
|
+
let out = lookup(&dparent, &Value::str(key));
|
|
1246
|
+
Injection::setval(inj, out.clone(), None);
|
|
1247
|
+
out
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
fn transform_key(inj: &Inj, _v: &Value, _r: &str, _store: &Value) -> Value {
|
|
1251
|
+
let (mode, parent, dparent, anno_key) = {
|
|
1252
|
+
let b = inj.borrow();
|
|
1253
|
+
let anno_key = b.path.get(b.path.len().saturating_sub(2)).cloned();
|
|
1254
|
+
(b.mode, b.parent.clone(), b.dparent.clone(), anno_key)
|
|
1255
|
+
};
|
|
1256
|
+
if mode != M_VAL {
|
|
1257
|
+
return Value::Noval;
|
|
1258
|
+
}
|
|
1259
|
+
// Literal presence of the $KEY meta (canonical `_lookup(parent, S_BKEY)`):
|
|
1260
|
+
// a null keyspec still counts as declared, so use the raw lookup.
|
|
1261
|
+
let keyspec = lookup(&parent, &Value::str(S_BKEY));
|
|
1262
|
+
if !keyspec.is_noval() {
|
|
1263
|
+
del_prop(parent.clone(), &Value::str(S_BKEY));
|
|
1264
|
+
return get_prop(&dparent, &keyspec, Value::Noval);
|
|
1265
|
+
}
|
|
1266
|
+
let anno = get_prop(&parent, &Value::str(S_BANNO), Value::Noval);
|
|
1267
|
+
get_prop(
|
|
1268
|
+
&anno,
|
|
1269
|
+
&Value::str(S_KEY),
|
|
1270
|
+
anno_key.map(Value::Str).unwrap_or(Value::Noval),
|
|
1271
|
+
)
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
fn transform_anno(inj: &Inj, _v: &Value, _r: &str, _store: &Value) -> Value {
|
|
1275
|
+
let parent = inj.borrow().parent.clone();
|
|
1276
|
+
del_prop(parent, &Value::str(S_BANNO));
|
|
1277
|
+
Value::Noval
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
fn transform_merge(inj: &Inj, _v: &Value, _r: &str, _store: &Value) -> Value {
|
|
1281
|
+
let (mode, key, parent) = {
|
|
1282
|
+
let b = inj.borrow();
|
|
1283
|
+
(b.mode, b.key.clone(), b.parent.clone())
|
|
1284
|
+
};
|
|
1285
|
+
let mut out = Value::Noval;
|
|
1286
|
+
if mode == M_KEYPRE {
|
|
1287
|
+
out = Value::str(key);
|
|
1288
|
+
} else if mode == M_KEYPOST {
|
|
1289
|
+
out = Value::str(key.clone());
|
|
1290
|
+
let mut args = get_prop(&parent, &Value::str(key.clone()), Value::Noval);
|
|
1291
|
+
if !is_list(&args) {
|
|
1292
|
+
args = Value::list(vec![args]);
|
|
1293
|
+
}
|
|
1294
|
+
Injection::setval(inj, Value::Noval, None); // remove $MERGE key from parent
|
|
1295
|
+
let args_vec: Vec<Value> = args
|
|
1296
|
+
.as_list()
|
|
1297
|
+
.map(|l| l.borrow().clone())
|
|
1298
|
+
.unwrap_or_default();
|
|
1299
|
+
let mut mergelist: Vec<Value> = vec![parent.clone()];
|
|
1300
|
+
mergelist.extend(args_vec);
|
|
1301
|
+
mergelist.push(clone(&parent));
|
|
1302
|
+
merge(&Value::list(mergelist), Some(1));
|
|
1303
|
+
}
|
|
1304
|
+
out
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
fn slice_str_vec(v: &[String], start: Option<i64>, end: Option<i64>) -> Vec<String> {
|
|
1308
|
+
match slice(path_value(v), start, end, false) {
|
|
1309
|
+
Value::List(l) => l
|
|
1310
|
+
.borrow()
|
|
1311
|
+
.iter()
|
|
1312
|
+
.map(|x| x.as_str().map(|s| s.to_string()).unwrap_or_default())
|
|
1313
|
+
.collect(),
|
|
1314
|
+
_ => Vec::new(),
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
// `$REF` — reference the original spec (enables recursive transforms).
|
|
1319
|
+
fn transform_ref(inj: &Inj, val: &Value, _r: &str, store: &Value) -> Value {
|
|
1320
|
+
let (mode, parent, path, nodes) = {
|
|
1321
|
+
let b = inj.borrow();
|
|
1322
|
+
(b.mode, b.parent.clone(), b.path.clone(), b.nodes.clone())
|
|
1323
|
+
};
|
|
1324
|
+
if mode != M_VAL {
|
|
1325
|
+
return Value::Noval;
|
|
1326
|
+
}
|
|
1327
|
+
// Group B raw read of the ref arg (canonical `_lookup(inj.parent, 1)`).
|
|
1328
|
+
let refpath = lookup(&parent, &Value::Num(1.0));
|
|
1329
|
+
{
|
|
1330
|
+
let keylen = inj.borrow().keys.borrow().len() as i64;
|
|
1331
|
+
inj.borrow_mut().key_i = keylen;
|
|
1332
|
+
}
|
|
1333
|
+
// spec = ($SPEC)()
|
|
1334
|
+
let spec = {
|
|
1335
|
+
let sf = get_prop(store, &Value::str(S_DSPEC), Value::Noval);
|
|
1336
|
+
match &sf {
|
|
1337
|
+
Value::Func(f) => f(inj, &Value::Noval, "", store),
|
|
1338
|
+
_ => Value::Noval,
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1341
|
+
let dpath = slice_str_vec(&path, Some(1), None);
|
|
1342
|
+
let dparent_for_ref = get_path_inj(&spec, &path_value(&dpath), None);
|
|
1343
|
+
let ref_def = InjectDef {
|
|
1344
|
+
dpath: Some(dpath.clone()),
|
|
1345
|
+
dparent: Some(dparent_for_ref),
|
|
1346
|
+
..Default::default()
|
|
1347
|
+
};
|
|
1348
|
+
let refval = get_path(&spec, &refpath, Some(&ref_def));
|
|
1349
|
+
|
|
1350
|
+
let mut has_sub_ref = false;
|
|
1351
|
+
if is_node(&refval) {
|
|
1352
|
+
let mut probe = |_k: &Value, v: &Value, _p: &Value, _t: &[String]| -> Value {
|
|
1353
|
+
if matches!(v, Value::Str(s) if s == "`$REF`") {
|
|
1354
|
+
has_sub_ref = true;
|
|
1355
|
+
}
|
|
1356
|
+
v.clone()
|
|
1357
|
+
};
|
|
1358
|
+
walk(refval.clone(), Some(&mut probe), None, None);
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
let tref = clone(&refval);
|
|
1362
|
+
let cpath = slice_str_vec(&path, Some(-3), None);
|
|
1363
|
+
let tpath = slice_str_vec(&path, Some(-1), None);
|
|
1364
|
+
let tcur = get_path_inj(store, &path_value(&cpath), None);
|
|
1365
|
+
let tval_at = get_path_inj(store, &path_value(&tpath), None);
|
|
1366
|
+
|
|
1367
|
+
let rval = if !has_sub_ref || !tval_at.is_noval() {
|
|
1368
|
+
let tinj = Injection::child(
|
|
1369
|
+
inj,
|
|
1370
|
+
0,
|
|
1371
|
+
Rc::new(RefCell::new(vec![tpath
|
|
1372
|
+
.last()
|
|
1373
|
+
.cloned()
|
|
1374
|
+
.unwrap_or_default()])),
|
|
1375
|
+
);
|
|
1376
|
+
{
|
|
1377
|
+
let mut b = tinj.borrow_mut();
|
|
1378
|
+
b.path = tpath.clone();
|
|
1379
|
+
let nlen = nodes.len();
|
|
1380
|
+
b.nodes = if nlen >= 1 {
|
|
1381
|
+
nodes[..nlen - 1].to_vec()
|
|
1382
|
+
} else {
|
|
1383
|
+
Vec::new()
|
|
1384
|
+
};
|
|
1385
|
+
b.parent = if nlen >= 2 {
|
|
1386
|
+
nodes[nlen - 2].clone()
|
|
1387
|
+
} else {
|
|
1388
|
+
Value::Noval
|
|
1389
|
+
};
|
|
1390
|
+
b.val = tref.clone();
|
|
1391
|
+
b.dpath = cpath.clone();
|
|
1392
|
+
b.dparent = tcur.clone();
|
|
1393
|
+
}
|
|
1394
|
+
let _ = inject_inj(tref.clone(), store, &tinj);
|
|
1395
|
+
let v = tinj.borrow().val.clone();
|
|
1396
|
+
v
|
|
1397
|
+
} else {
|
|
1398
|
+
Value::Noval
|
|
1399
|
+
};
|
|
1400
|
+
|
|
1401
|
+
let grandparent = Injection::setval(inj, rval, Some(2));
|
|
1402
|
+
if is_list(&grandparent) {
|
|
1403
|
+
let prior = inj.borrow().prior.clone();
|
|
1404
|
+
if let Some(p) = prior {
|
|
1405
|
+
p.borrow_mut().key_i -= 1;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
val.clone()
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
fn srcpath_split(srcpath: &str) -> Vec<String> {
|
|
1412
|
+
srcpath.split('.').map(|s| s.to_string()).collect()
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
// `$EACH` — apply a child template to every entry of a list or map.
|
|
1416
|
+
// Spec form (a list): ['`$EACH`', 'source-path', child-template]
|
|
1417
|
+
fn transform_each(inj: &Inj, _val: &Value, _r: &str, store: &Value) -> Value {
|
|
1418
|
+
if !check_placement(M_VAL, "EACH", T_LIST as i64, inj) {
|
|
1419
|
+
return Value::Noval;
|
|
1420
|
+
}
|
|
1421
|
+
// remove remaining keys to avoid spurious processing
|
|
1422
|
+
inj.borrow().keys.borrow_mut().truncate(1);
|
|
1423
|
+
|
|
1424
|
+
let (parent, path, nodes, base) = {
|
|
1425
|
+
let b = inj.borrow();
|
|
1426
|
+
(
|
|
1427
|
+
b.parent.clone(),
|
|
1428
|
+
b.path.clone(),
|
|
1429
|
+
b.nodes.clone(),
|
|
1430
|
+
b.base.clone(),
|
|
1431
|
+
)
|
|
1432
|
+
};
|
|
1433
|
+
let args: Vec<Value> = slice(parent.clone(), Some(1), None, false)
|
|
1434
|
+
.as_list()
|
|
1435
|
+
.map(|l| l.borrow().clone())
|
|
1436
|
+
.unwrap_or_default();
|
|
1437
|
+
let ia = injector_args(&[T_STRING as i64, T_ANY as i64], &args);
|
|
1438
|
+
if let Value::Str(e) = &ia[0] {
|
|
1439
|
+
errs_push(inj, format!("$EACH: {e}"));
|
|
1440
|
+
return Value::Noval;
|
|
1441
|
+
}
|
|
1442
|
+
let srcpath = ia.get(1).cloned().unwrap_or(Value::Noval);
|
|
1443
|
+
let child = ia.get(2).cloned().unwrap_or(Value::Noval);
|
|
1444
|
+
let srcpath_str = srcpath.as_str().unwrap_or("").to_string();
|
|
1445
|
+
|
|
1446
|
+
let srcstore = get_prop(
|
|
1447
|
+
store,
|
|
1448
|
+
&Value::str(base.clone().unwrap_or_default()),
|
|
1449
|
+
store.clone(),
|
|
1450
|
+
);
|
|
1451
|
+
let src = get_path_inj(&srcstore, &srcpath, Some(inj));
|
|
1452
|
+
let srctype = typify(&src);
|
|
1453
|
+
|
|
1454
|
+
let tkey = path
|
|
1455
|
+
.get(path.len().saturating_sub(2))
|
|
1456
|
+
.cloned()
|
|
1457
|
+
.unwrap_or_default();
|
|
1458
|
+
let nlen = nodes.len();
|
|
1459
|
+
let target = if nlen >= 2 {
|
|
1460
|
+
nodes[nlen - 2].clone()
|
|
1461
|
+
} else if nlen >= 1 {
|
|
1462
|
+
nodes[nlen - 1].clone()
|
|
1463
|
+
} else {
|
|
1464
|
+
Value::Noval
|
|
1465
|
+
};
|
|
1466
|
+
|
|
1467
|
+
let tval: Vec<Value> = if srctype & (T_LIST as i64) != 0 {
|
|
1468
|
+
items_vec(&src).iter().map(|_| clone(&child)).collect()
|
|
1469
|
+
} else if srctype & (T_MAP as i64) != 0 {
|
|
1470
|
+
items_vec(&src)
|
|
1471
|
+
.iter()
|
|
1472
|
+
.map(|(k, _)| {
|
|
1473
|
+
merge(
|
|
1474
|
+
&Value::list(vec![
|
|
1475
|
+
clone(&child),
|
|
1476
|
+
Value::map_of([(
|
|
1477
|
+
S_BANNO.to_string(),
|
|
1478
|
+
Value::map_of([(S_KEY.to_string(), Value::str(k.clone()))]),
|
|
1479
|
+
)]),
|
|
1480
|
+
]),
|
|
1481
|
+
Some(1),
|
|
1482
|
+
)
|
|
1483
|
+
})
|
|
1484
|
+
.collect()
|
|
1485
|
+
} else {
|
|
1486
|
+
Vec::new()
|
|
1487
|
+
};
|
|
1488
|
+
|
|
1489
|
+
let mut rval = Value::empty_list();
|
|
1490
|
+
if !tval.is_empty() {
|
|
1491
|
+
let tcur_inner: Value = if src.is_nullish() {
|
|
1492
|
+
Value::Noval
|
|
1493
|
+
} else {
|
|
1494
|
+
Value::list(items_vec(&src).into_iter().map(|(_, v)| v).collect())
|
|
1495
|
+
};
|
|
1496
|
+
let ckey = path
|
|
1497
|
+
.get(path.len().saturating_sub(2))
|
|
1498
|
+
.cloned()
|
|
1499
|
+
.unwrap_or_default();
|
|
1500
|
+
let tpath = slice_str_vec(&path, Some(-1), None);
|
|
1501
|
+
let mut dpath: Vec<String> = vec![S_DTOP.to_string()];
|
|
1502
|
+
dpath.extend(srcpath_split(&srcpath_str));
|
|
1503
|
+
dpath.push(format!("$:{ckey}"));
|
|
1504
|
+
|
|
1505
|
+
let mut tcur = Value::map_of([(ckey.clone(), tcur_inner)]);
|
|
1506
|
+
if tpath.len() > 1 {
|
|
1507
|
+
let pkey = path
|
|
1508
|
+
.get(path.len().saturating_sub(3))
|
|
1509
|
+
.cloned()
|
|
1510
|
+
.unwrap_or_else(|| S_DTOP.to_string());
|
|
1511
|
+
tcur = Value::map_of([(pkey.clone(), tcur)]);
|
|
1512
|
+
dpath.push(format!("$:{pkey}"));
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
let tval_v = Value::list(tval);
|
|
1516
|
+
let tinj = Injection::child(inj, 0, Rc::new(RefCell::new(vec![ckey.clone()])));
|
|
1517
|
+
{
|
|
1518
|
+
let mut b = tinj.borrow_mut();
|
|
1519
|
+
b.path = tpath;
|
|
1520
|
+
b.nodes = if nlen >= 1 {
|
|
1521
|
+
nodes[..nlen - 1].to_vec()
|
|
1522
|
+
} else {
|
|
1523
|
+
Vec::new()
|
|
1524
|
+
};
|
|
1525
|
+
b.parent = b.nodes.last().cloned().unwrap_or(Value::Noval);
|
|
1526
|
+
b.val = tval_v.clone();
|
|
1527
|
+
b.dpath = dpath;
|
|
1528
|
+
b.dparent = tcur;
|
|
1529
|
+
}
|
|
1530
|
+
let pclone = tinj.borrow().parent.clone();
|
|
1531
|
+
set_prop(pclone, &Value::str(ckey), tval_v.clone());
|
|
1532
|
+
let _ = inject_inj(tval_v.clone(), store, &tinj);
|
|
1533
|
+
rval = tinj.borrow().val.clone();
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
set_prop(target, &Value::str(tkey), rval.clone());
|
|
1537
|
+
get_prop(&rval, &Value::Num(0.0), Value::Noval)
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
// `$PACK` — repack a list/map into a map keyed by `$KEY`.
|
|
1541
|
+
// Spec form (a map): { '`$PACK`': ['source-path', child-template] }
|
|
1542
|
+
fn transform_pack(inj: &Inj, _val: &Value, _r: &str, store: &Value) -> Value {
|
|
1543
|
+
if !check_placement(M_KEYPRE, "EACH", T_MAP as i64, inj) {
|
|
1544
|
+
return Value::Noval;
|
|
1545
|
+
}
|
|
1546
|
+
let (key, parent, path, nodes, base) = {
|
|
1547
|
+
let b = inj.borrow();
|
|
1548
|
+
(
|
|
1549
|
+
b.key.clone(),
|
|
1550
|
+
b.parent.clone(),
|
|
1551
|
+
b.path.clone(),
|
|
1552
|
+
b.nodes.clone(),
|
|
1553
|
+
b.base.clone(),
|
|
1554
|
+
)
|
|
1555
|
+
};
|
|
1556
|
+
let args = get_prop(&parent, &Value::str(key), Value::Noval);
|
|
1557
|
+
let args_vec: Vec<Value> = args
|
|
1558
|
+
.as_list()
|
|
1559
|
+
.map(|l| l.borrow().clone())
|
|
1560
|
+
.unwrap_or_default();
|
|
1561
|
+
let ia = injector_args(&[T_STRING as i64, T_ANY as i64], &args_vec);
|
|
1562
|
+
if let Value::Str(e) = &ia[0] {
|
|
1563
|
+
errs_push(inj, format!("$EACH: {e}"));
|
|
1564
|
+
return Value::Noval;
|
|
1565
|
+
}
|
|
1566
|
+
let srcpath = ia.get(1).cloned().unwrap_or(Value::Noval);
|
|
1567
|
+
let origchildspec = ia.get(2).cloned().unwrap_or(Value::Noval);
|
|
1568
|
+
let srcpath_str = srcpath.as_str().unwrap_or("").to_string();
|
|
1569
|
+
|
|
1570
|
+
let tkey = path
|
|
1571
|
+
.get(path.len().saturating_sub(2))
|
|
1572
|
+
.cloned()
|
|
1573
|
+
.unwrap_or_default();
|
|
1574
|
+
let pathsize = path.len();
|
|
1575
|
+
let nlen = nodes.len();
|
|
1576
|
+
let target = if pathsize >= 2 {
|
|
1577
|
+
nodes.get(pathsize - 2).cloned().unwrap_or(Value::Noval)
|
|
1578
|
+
} else {
|
|
1579
|
+
nodes
|
|
1580
|
+
.get(pathsize.saturating_sub(1))
|
|
1581
|
+
.cloned()
|
|
1582
|
+
.unwrap_or(Value::Noval)
|
|
1583
|
+
};
|
|
1584
|
+
let target = if target.is_noval() {
|
|
1585
|
+
nodes
|
|
1586
|
+
.get(pathsize.saturating_sub(1))
|
|
1587
|
+
.cloned()
|
|
1588
|
+
.unwrap_or(Value::Noval)
|
|
1589
|
+
} else {
|
|
1590
|
+
target
|
|
1591
|
+
};
|
|
1592
|
+
|
|
1593
|
+
let srcstore = get_prop(
|
|
1594
|
+
store,
|
|
1595
|
+
&Value::str(base.clone().unwrap_or_default()),
|
|
1596
|
+
store.clone(),
|
|
1597
|
+
);
|
|
1598
|
+
let src_raw = get_path_inj(&srcstore, &srcpath, Some(inj));
|
|
1599
|
+
let src: Value = if is_list(&src_raw) {
|
|
1600
|
+
src_raw
|
|
1601
|
+
} else if is_map(&src_raw) {
|
|
1602
|
+
Value::list(
|
|
1603
|
+
items_vec(&src_raw)
|
|
1604
|
+
.into_iter()
|
|
1605
|
+
.map(|(k, v)| {
|
|
1606
|
+
set_prop(
|
|
1607
|
+
v.clone(),
|
|
1608
|
+
&Value::str(S_BANNO),
|
|
1609
|
+
Value::map_of([(S_KEY.to_string(), Value::str(k))]),
|
|
1610
|
+
);
|
|
1611
|
+
v
|
|
1612
|
+
})
|
|
1613
|
+
.collect(),
|
|
1614
|
+
)
|
|
1615
|
+
} else {
|
|
1616
|
+
return Value::Noval;
|
|
1617
|
+
};
|
|
1618
|
+
if src.is_nullish() {
|
|
1619
|
+
return Value::Noval;
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
let keypath = get_prop(&origchildspec, &Value::str(S_BKEY), Value::Noval);
|
|
1623
|
+
let childspec = del_prop(origchildspec.clone(), &Value::str(S_BKEY));
|
|
1624
|
+
let child = get_prop(&childspec, &Value::str(S_BVAL), childspec.clone());
|
|
1625
|
+
|
|
1626
|
+
let resolve_key = |srckey: &str, srcnode: &Value| -> Value {
|
|
1627
|
+
if keypath.is_noval() {
|
|
1628
|
+
Value::str(srckey)
|
|
1629
|
+
} else if let Value::Str(kp) = &keypath {
|
|
1630
|
+
if kp.starts_with('`') {
|
|
1631
|
+
let m = merge(
|
|
1632
|
+
&Value::list(vec![
|
|
1633
|
+
Value::empty_map(),
|
|
1634
|
+
store.clone(),
|
|
1635
|
+
Value::map_of([(S_DTOP.to_string(), srcnode.clone())]),
|
|
1636
|
+
]),
|
|
1637
|
+
Some(1),
|
|
1638
|
+
);
|
|
1639
|
+
inject(Value::str(kp.clone()), &m, None)
|
|
1640
|
+
} else {
|
|
1641
|
+
get_path_inj(srcnode, &Value::str(kp.clone()), Some(inj))
|
|
1642
|
+
}
|
|
1643
|
+
} else {
|
|
1644
|
+
Value::str(srckey)
|
|
1645
|
+
}
|
|
1646
|
+
};
|
|
1647
|
+
|
|
1648
|
+
let tval = Value::empty_map();
|
|
1649
|
+
for (srckey, srcnode) in items_vec(&src) {
|
|
1650
|
+
let k = resolve_key(&srckey, &srcnode);
|
|
1651
|
+
let tchild = clone(&child);
|
|
1652
|
+
set_prop(tval.clone(), &k, tchild.clone());
|
|
1653
|
+
let anno = get_prop(&srcnode, &Value::str(S_BANNO), Value::Noval);
|
|
1654
|
+
if anno.is_noval() {
|
|
1655
|
+
del_prop(tchild, &Value::str(S_BANNO));
|
|
1656
|
+
} else {
|
|
1657
|
+
set_prop(tchild, &Value::str(S_BANNO), anno);
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
let mut rval = Value::empty_map();
|
|
1662
|
+
if !is_empty(&tval) {
|
|
1663
|
+
let tsrc = Value::empty_map();
|
|
1664
|
+
for (i, (_, n)) in items_vec(&src).into_iter().enumerate() {
|
|
1665
|
+
let kn = if keypath.is_noval() {
|
|
1666
|
+
Value::Num(i as f64)
|
|
1667
|
+
} else {
|
|
1668
|
+
resolve_key("", &n)
|
|
1669
|
+
};
|
|
1670
|
+
set_prop(tsrc.clone(), &kn, n);
|
|
1671
|
+
}
|
|
1672
|
+
let tpath = slice_str_vec(&path, Some(-1), None);
|
|
1673
|
+
let ckey = path
|
|
1674
|
+
.get(path.len().saturating_sub(2))
|
|
1675
|
+
.cloned()
|
|
1676
|
+
.unwrap_or_default();
|
|
1677
|
+
let mut dpath: Vec<String> = vec![S_DTOP.to_string()];
|
|
1678
|
+
dpath.extend(srcpath_split(&srcpath_str));
|
|
1679
|
+
dpath.push(format!("$:{ckey}"));
|
|
1680
|
+
let mut tcur = Value::map_of([(ckey.clone(), tsrc)]);
|
|
1681
|
+
if tpath.len() > 1 {
|
|
1682
|
+
let pkey = path
|
|
1683
|
+
.get(path.len().saturating_sub(3))
|
|
1684
|
+
.cloned()
|
|
1685
|
+
.unwrap_or_else(|| S_DTOP.to_string());
|
|
1686
|
+
tcur = Value::map_of([(pkey.clone(), tcur)]);
|
|
1687
|
+
dpath.push(format!("$:{pkey}"));
|
|
1688
|
+
}
|
|
1689
|
+
let tinj = Injection::child(inj, 0, Rc::new(RefCell::new(vec![ckey.clone()])));
|
|
1690
|
+
{
|
|
1691
|
+
let mut b = tinj.borrow_mut();
|
|
1692
|
+
b.path = tpath;
|
|
1693
|
+
b.nodes = if nlen >= 1 {
|
|
1694
|
+
nodes[..nlen - 1].to_vec()
|
|
1695
|
+
} else {
|
|
1696
|
+
Vec::new()
|
|
1697
|
+
};
|
|
1698
|
+
b.parent = b.nodes.last().cloned().unwrap_or(Value::Noval);
|
|
1699
|
+
b.val = tval.clone();
|
|
1700
|
+
b.dpath = dpath;
|
|
1701
|
+
b.dparent = tcur;
|
|
1702
|
+
}
|
|
1703
|
+
let _ = inject_inj(tval.clone(), store, &tinj);
|
|
1704
|
+
rval = tinj.borrow().val.clone();
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
set_prop(target, &Value::str(tkey), rval);
|
|
1708
|
+
Value::Noval
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
pub fn transform(
|
|
1712
|
+
data: &Value,
|
|
1713
|
+
spec: &Value,
|
|
1714
|
+
injdef: Option<&InjectDef>,
|
|
1715
|
+
) -> Result<Value, StructError> {
|
|
1716
|
+
let origspec = spec.clone();
|
|
1717
|
+
let spec_clone = clone(&origspec);
|
|
1718
|
+
|
|
1719
|
+
let extra = injdef.and_then(|d| d.extra.clone());
|
|
1720
|
+
let collect = injdef.map(|d| d.errs.is_some()).unwrap_or(false);
|
|
1721
|
+
let errs = injdef
|
|
1722
|
+
.and_then(|d| d.errs.clone())
|
|
1723
|
+
.unwrap_or_else(Value::empty_list);
|
|
1724
|
+
|
|
1725
|
+
// split `extra` into data-extras (non-$) and transform-extras ($)
|
|
1726
|
+
let mut extra_transforms = OrderedMap::new();
|
|
1727
|
+
let extra_data: Value = match &extra {
|
|
1728
|
+
None => Value::Noval,
|
|
1729
|
+
Some(e) => {
|
|
1730
|
+
let mut a = OrderedMap::new();
|
|
1731
|
+
for (k, v) in items_vec(e) {
|
|
1732
|
+
if k.starts_with(S_DS) {
|
|
1733
|
+
extra_transforms.insert(k, v);
|
|
1734
|
+
} else {
|
|
1735
|
+
a.insert(k, v);
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
Value::map(a)
|
|
1739
|
+
}
|
|
1740
|
+
};
|
|
1741
|
+
|
|
1742
|
+
let data_clone = merge(
|
|
1743
|
+
&Value::list(vec![
|
|
1744
|
+
if is_empty(&extra_data) {
|
|
1745
|
+
Value::Noval
|
|
1746
|
+
} else {
|
|
1747
|
+
clone(&extra_data)
|
|
1748
|
+
},
|
|
1749
|
+
clone(data),
|
|
1750
|
+
]),
|
|
1751
|
+
None,
|
|
1752
|
+
);
|
|
1753
|
+
|
|
1754
|
+
// build the transform store
|
|
1755
|
+
let origspec_for_thunk = origspec.clone();
|
|
1756
|
+
let mut store_base: OrderedMap<Value> = OrderedMap::new();
|
|
1757
|
+
store_base.insert(S_DTOP.to_string(), data_clone);
|
|
1758
|
+
store_base.insert(
|
|
1759
|
+
"$SPEC".to_string(),
|
|
1760
|
+
Value::func(move |_i: &Inj, _v: &Value, _r: &str, _s: &Value| origspec_for_thunk.clone()),
|
|
1761
|
+
);
|
|
1762
|
+
store_base.insert(
|
|
1763
|
+
"$BT".to_string(),
|
|
1764
|
+
Value::func(|_i: &Inj, _v: &Value, _r: &str, _s: &Value| Value::str(S_BT)),
|
|
1765
|
+
);
|
|
1766
|
+
store_base.insert(
|
|
1767
|
+
"$DS".to_string(),
|
|
1768
|
+
Value::func(|_i: &Inj, _v: &Value, _r: &str, _s: &Value| Value::str(S_DS)),
|
|
1769
|
+
);
|
|
1770
|
+
store_base.insert(
|
|
1771
|
+
"$WHEN".to_string(),
|
|
1772
|
+
Value::func(|_i: &Inj, _v: &Value, _r: &str, _s: &Value| Value::str(iso_now())),
|
|
1773
|
+
);
|
|
1774
|
+
store_base.insert("$DELETE".to_string(), Value::func(transform_delete));
|
|
1775
|
+
store_base.insert("$COPY".to_string(), Value::func(transform_copy));
|
|
1776
|
+
store_base.insert("$KEY".to_string(), Value::func(transform_key));
|
|
1777
|
+
store_base.insert("$ANNO".to_string(), Value::func(transform_anno));
|
|
1778
|
+
store_base.insert("$MERGE".to_string(), Value::func(transform_merge));
|
|
1779
|
+
store_base.insert("$EACH".to_string(), Value::func(transform_each));
|
|
1780
|
+
store_base.insert("$PACK".to_string(), Value::func(transform_pack));
|
|
1781
|
+
store_base.insert("$REF".to_string(), Value::func(transform_ref));
|
|
1782
|
+
store_base.insert("$FORMAT".to_string(), Value::func(transform_format));
|
|
1783
|
+
store_base.insert("$APPLY".to_string(), Value::func(transform_apply));
|
|
1784
|
+
|
|
1785
|
+
let store = merge(
|
|
1786
|
+
&Value::list(vec![
|
|
1787
|
+
Value::map(store_base),
|
|
1788
|
+
Value::map(extra_transforms),
|
|
1789
|
+
Value::map_of([(S_DERRS.to_string(), errs.clone())]),
|
|
1790
|
+
]),
|
|
1791
|
+
Some(1),
|
|
1792
|
+
);
|
|
1793
|
+
|
|
1794
|
+
let out = inject(spec_clone, &store, injdef);
|
|
1795
|
+
|
|
1796
|
+
let errlen = errs.as_list().map(|l| l.borrow().len()).unwrap_or(0);
|
|
1797
|
+
if errlen > 0 && !collect {
|
|
1798
|
+
let msgs: Vec<String> = errs
|
|
1799
|
+
.as_list()
|
|
1800
|
+
.map(|l| l.borrow().iter().map(js_string).collect())
|
|
1801
|
+
.unwrap_or_default();
|
|
1802
|
+
return Err(StructError {
|
|
1803
|
+
message: msgs.join(" | "),
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
Ok(out)
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
fn iso_now() -> String {
|
|
1811
|
+
// best-effort ISO-8601 UTC string; the corpus can't assert the exact
|
|
1812
|
+
// value (it changes), so granularity to the second is fine.
|
|
1813
|
+
use std::time::{SystemTime, UNIX_EPOCH};
|
|
1814
|
+
let dur = SystemTime::now()
|
|
1815
|
+
.duration_since(UNIX_EPOCH)
|
|
1816
|
+
.unwrap_or_default();
|
|
1817
|
+
let secs = dur.as_secs() as i64;
|
|
1818
|
+
let millis = dur.subsec_millis();
|
|
1819
|
+
// days since 1970-01-01
|
|
1820
|
+
let days = secs.div_euclid(86_400);
|
|
1821
|
+
let tod = secs.rem_euclid(86_400);
|
|
1822
|
+
let (h, m, s) = (tod / 3600, (tod % 3600) / 60, tod % 60);
|
|
1823
|
+
let (y, mo, d) = civil_from_days(days);
|
|
1824
|
+
format!("{y:04}-{mo:02}-{d:02}T{h:02}:{m:02}:{s:02}.{millis:03}Z")
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
fn civil_from_days(z: i64) -> (i64, i64, i64) {
|
|
1828
|
+
// Howard Hinnant's algorithm.
|
|
1829
|
+
let z = z + 719_468;
|
|
1830
|
+
let era = if z >= 0 { z } else { z - 146_096 } / 146_097;
|
|
1831
|
+
let doe = z - era * 146_097;
|
|
1832
|
+
let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365;
|
|
1833
|
+
let y = yoe + era * 400;
|
|
1834
|
+
let doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
|
|
1835
|
+
let mp = (5 * doy + 2) / 153;
|
|
1836
|
+
let d = doy - (153 * mp + 2) / 5 + 1;
|
|
1837
|
+
let m = if mp < 10 { mp + 3 } else { mp - 9 };
|
|
1838
|
+
(if m <= 2 { y + 1 } else { y }, m, d)
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
// ---- validate --------------------------------------------------------
|
|
1842
|
+
|
|
1843
|
+
fn path_value(path: &[String]) -> Value {
|
|
1844
|
+
Value::list(path.iter().cloned().map(Value::Str).collect())
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
fn invalid_type_msg(path: &[String], needtype: &str, vt: i64, v: &Value) -> String {
|
|
1848
|
+
let vs = if v.is_nullish() {
|
|
1849
|
+
"no value".to_string()
|
|
1850
|
+
} else {
|
|
1851
|
+
stringify(v, None, false)
|
|
1852
|
+
};
|
|
1853
|
+
let field_part = if path.len() > 1 {
|
|
1854
|
+
format!("field {} to be ", pathify(&path_value(path), Some(1), None))
|
|
1855
|
+
} else {
|
|
1856
|
+
String::new()
|
|
1857
|
+
};
|
|
1858
|
+
let type_part = if !v.is_nullish() {
|
|
1859
|
+
format!("{}{}", type_name(vt), S_VIZ)
|
|
1860
|
+
} else {
|
|
1861
|
+
String::new()
|
|
1862
|
+
};
|
|
1863
|
+
format!("Expected {field_part}{needtype}, but found {type_part}{vs}.")
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
fn validate_string(inj: &Inj, _v: &Value, _r: &str, _store: &Value) -> Value {
|
|
1867
|
+
let (dparent, key, path) = {
|
|
1868
|
+
let b = inj.borrow();
|
|
1869
|
+
(b.dparent.clone(), b.key.clone(), b.path.clone())
|
|
1870
|
+
};
|
|
1871
|
+
let out = lookup(&dparent, &Value::str(key));
|
|
1872
|
+
let t = typify(&out);
|
|
1873
|
+
if t & (T_STRING as i64) == 0 {
|
|
1874
|
+
errs_push(inj, invalid_type_msg(&path, "string", t, &out));
|
|
1875
|
+
return Value::Noval;
|
|
1876
|
+
}
|
|
1877
|
+
if matches!(&out, Value::Str(s) if s.is_empty()) {
|
|
1878
|
+
errs_push(
|
|
1879
|
+
inj,
|
|
1880
|
+
format!(
|
|
1881
|
+
"Empty string at {}",
|
|
1882
|
+
pathify(&path_value(&path), Some(1), None)
|
|
1883
|
+
),
|
|
1884
|
+
);
|
|
1885
|
+
return Value::Noval;
|
|
1886
|
+
}
|
|
1887
|
+
out
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
fn validate_type(inj: &Inj, _v: &Value, r: &str, _store: &Value) -> Value {
|
|
1891
|
+
let tname: String = r.chars().skip(1).collect::<String>().to_lowercase();
|
|
1892
|
+
let typev: i64 = match TYPENAME.iter().position(|x| *x == tname) {
|
|
1893
|
+
Some(idx) => 1i64 << (31 - idx as i64),
|
|
1894
|
+
None => 0,
|
|
1895
|
+
};
|
|
1896
|
+
let (dparent, key, path) = {
|
|
1897
|
+
let b = inj.borrow();
|
|
1898
|
+
(b.dparent.clone(), b.key.clone(), b.path.clone())
|
|
1899
|
+
};
|
|
1900
|
+
let out = lookup(&dparent, &Value::str(key));
|
|
1901
|
+
let t = typify(&out);
|
|
1902
|
+
if t & typev == 0 {
|
|
1903
|
+
errs_push(inj, invalid_type_msg(&path, &tname, t, &out));
|
|
1904
|
+
return Value::Noval;
|
|
1905
|
+
}
|
|
1906
|
+
out
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
fn validate_any(inj: &Inj, _v: &Value, _r: &str, _store: &Value) -> Value {
|
|
1910
|
+
let (dparent, key) = {
|
|
1911
|
+
let b = inj.borrow();
|
|
1912
|
+
(b.dparent.clone(), b.key.clone())
|
|
1913
|
+
};
|
|
1914
|
+
lookup(&dparent, &Value::str(key))
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
/// Render a list of tvals as `"a, b, c"`, lowering `` `$NAME` `` -> `name`.
|
|
1918
|
+
fn tvals_desc(tvals: &[Value]) -> String {
|
|
1919
|
+
let joined = tvals
|
|
1920
|
+
.iter()
|
|
1921
|
+
.map(|v| stringify(v, None, false))
|
|
1922
|
+
.collect::<Vec<_>>()
|
|
1923
|
+
.join(", ");
|
|
1924
|
+
R_TRANSFORM_NAME
|
|
1925
|
+
.replace_all(&joined, |caps: &crate::utility::voxgigstruct::re::Captures<'_>| {
|
|
1926
|
+
caps[1].to_lowercase()
|
|
1927
|
+
})
|
|
1928
|
+
.to_string()
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
// Map / list `$CHILD`: apply a child template to every direct child.
|
|
1932
|
+
fn validate_child(inj: &Inj, _v: &Value, _r: &str, _store: &Value) -> Value {
|
|
1933
|
+
let (mode, key, parent, path, dparent) = {
|
|
1934
|
+
let b = inj.borrow();
|
|
1935
|
+
(
|
|
1936
|
+
b.mode,
|
|
1937
|
+
b.key.clone(),
|
|
1938
|
+
b.parent.clone(),
|
|
1939
|
+
b.path.clone(),
|
|
1940
|
+
b.dparent.clone(),
|
|
1941
|
+
)
|
|
1942
|
+
};
|
|
1943
|
+
|
|
1944
|
+
if mode == M_KEYPRE {
|
|
1945
|
+
let childtm = get_prop(&parent, &Value::str(key), Value::Noval);
|
|
1946
|
+
let pkey = path
|
|
1947
|
+
.get(path.len().saturating_sub(2))
|
|
1948
|
+
.cloned()
|
|
1949
|
+
.unwrap_or_default();
|
|
1950
|
+
let mut tval = get_prop(&dparent, &Value::str(pkey), Value::Noval);
|
|
1951
|
+
if tval.is_noval() {
|
|
1952
|
+
tval = Value::empty_map();
|
|
1953
|
+
} else if !is_map(&tval) {
|
|
1954
|
+
errs_push(
|
|
1955
|
+
inj,
|
|
1956
|
+
invalid_type_msg(
|
|
1957
|
+
&path[..path.len().saturating_sub(1)],
|
|
1958
|
+
S_object,
|
|
1959
|
+
typify(&tval),
|
|
1960
|
+
&tval,
|
|
1961
|
+
),
|
|
1962
|
+
);
|
|
1963
|
+
return Value::Noval;
|
|
1964
|
+
}
|
|
1965
|
+
let ckeys = keysof_vec(&tval);
|
|
1966
|
+
for ck in ckeys {
|
|
1967
|
+
set_prop(parent.clone(), &Value::str(ck.clone()), clone(&childtm));
|
|
1968
|
+
inj.borrow().keys.borrow_mut().push(ck);
|
|
1969
|
+
}
|
|
1970
|
+
Injection::setval(inj, Value::Noval, None);
|
|
1971
|
+
return Value::Noval;
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
if mode == M_VAL {
|
|
1975
|
+
if !is_list(&parent) {
|
|
1976
|
+
errs_push(inj, "Invalid $CHILD as value".to_string());
|
|
1977
|
+
return Value::Noval;
|
|
1978
|
+
}
|
|
1979
|
+
// List $CHILD template (canonical `_lookup(parent, 1)`): preserve a
|
|
1980
|
+
// null template literally rather than dropping it as Group A would.
|
|
1981
|
+
let childtm = lookup(&parent, &Value::Num(1.0));
|
|
1982
|
+
if dparent.is_noval() {
|
|
1983
|
+
slice(parent.clone(), Some(0), Some(0), true); // empty default
|
|
1984
|
+
return Value::Noval;
|
|
1985
|
+
}
|
|
1986
|
+
if !is_list(&dparent) {
|
|
1987
|
+
errs_push(
|
|
1988
|
+
inj,
|
|
1989
|
+
invalid_type_msg(
|
|
1990
|
+
&path[..path.len().saturating_sub(1)],
|
|
1991
|
+
S_list,
|
|
1992
|
+
typify(&dparent),
|
|
1993
|
+
&dparent,
|
|
1994
|
+
),
|
|
1995
|
+
);
|
|
1996
|
+
let plen = parent.as_list().map(|l| l.borrow().len()).unwrap_or(0) as i64;
|
|
1997
|
+
inj.borrow_mut().key_i = plen;
|
|
1998
|
+
return dparent;
|
|
1999
|
+
}
|
|
2000
|
+
let dlen = dparent.as_list().map(|l| l.borrow().len()).unwrap_or(0);
|
|
2001
|
+
for n in 0..dlen {
|
|
2002
|
+
set_prop(parent.clone(), &Value::Num(n as f64), clone(&childtm));
|
|
2003
|
+
}
|
|
2004
|
+
slice(parent.clone(), Some(0), Some(dlen as i64), true);
|
|
2005
|
+
inj.borrow_mut().key_i = 0;
|
|
2006
|
+
return get_prop(&dparent, &Value::Num(0.0), Value::Noval);
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
Value::Noval
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
// `$ONE`: value must match exactly one of a list of alternative sub-specs.
|
|
2013
|
+
fn validate_one(inj: &Inj, _v: &Value, _r: &str, store: &Value) -> Value {
|
|
2014
|
+
let (mode, parent, key_i) = {
|
|
2015
|
+
let b = inj.borrow();
|
|
2016
|
+
(b.mode, b.parent.clone(), b.key_i)
|
|
2017
|
+
};
|
|
2018
|
+
if mode != M_VAL {
|
|
2019
|
+
return Value::Noval;
|
|
2020
|
+
}
|
|
2021
|
+
if !is_list(&parent) || key_i != 0 {
|
|
2022
|
+
let path = inj.borrow().path.clone();
|
|
2023
|
+
errs_push(
|
|
2024
|
+
inj,
|
|
2025
|
+
format!(
|
|
2026
|
+
"The $ONE validator at field {} must be the first element of an array.",
|
|
2027
|
+
pathify(&path_value(&path), Some(1), Some(1))
|
|
2028
|
+
),
|
|
2029
|
+
);
|
|
2030
|
+
return Value::Noval;
|
|
2031
|
+
}
|
|
2032
|
+
let keylen = inj.borrow().keys.borrow().len() as i64;
|
|
2033
|
+
inj.borrow_mut().key_i = keylen;
|
|
2034
|
+
let dparent = inj.borrow().dparent.clone();
|
|
2035
|
+
Injection::setval(inj, dparent.clone(), Some(2));
|
|
2036
|
+
{
|
|
2037
|
+
let mut b = inj.borrow_mut();
|
|
2038
|
+
let n = b.path.len();
|
|
2039
|
+
b.path.truncate(n.saturating_sub(1));
|
|
2040
|
+
b.key = b.path.last().cloned().unwrap_or_default();
|
|
2041
|
+
}
|
|
2042
|
+
let path_after = inj.borrow().path.clone();
|
|
2043
|
+
let meta = inj.borrow().meta.clone();
|
|
2044
|
+
let tvals: Vec<Value> = slice(parent.clone(), Some(1), None, false)
|
|
2045
|
+
.as_list()
|
|
2046
|
+
.map(|l| l.borrow().clone())
|
|
2047
|
+
.unwrap_or_default();
|
|
2048
|
+
if tvals.is_empty() {
|
|
2049
|
+
errs_push(
|
|
2050
|
+
inj,
|
|
2051
|
+
format!(
|
|
2052
|
+
"The $ONE validator at field {} must have at least one argument.",
|
|
2053
|
+
pathify(&path_value(&path_after), Some(1), Some(1))
|
|
2054
|
+
),
|
|
2055
|
+
);
|
|
2056
|
+
return Value::Noval;
|
|
2057
|
+
}
|
|
2058
|
+
for tval in &tvals {
|
|
2059
|
+
let terrs = Value::empty_list();
|
|
2060
|
+
let mut vstore = match merge(
|
|
2061
|
+
&Value::list(vec![Value::empty_map(), store.clone()]),
|
|
2062
|
+
Some(1),
|
|
2063
|
+
) {
|
|
2064
|
+
v @ Value::Map(_) => v,
|
|
2065
|
+
_ => Value::empty_map(),
|
|
2066
|
+
};
|
|
2067
|
+
set_prop(vstore.clone(), &Value::str(S_DTOP), dparent.clone());
|
|
2068
|
+
let _ = &mut vstore;
|
|
2069
|
+
let vd = InjectDef {
|
|
2070
|
+
extra: Some(vstore.clone()),
|
|
2071
|
+
errs: Some(terrs.clone()),
|
|
2072
|
+
meta: Some(meta.clone()),
|
|
2073
|
+
..Default::default()
|
|
2074
|
+
};
|
|
2075
|
+
let vcur = validate(&dparent, tval, Some(&vd)).unwrap_or(Value::Noval);
|
|
2076
|
+
Injection::setval(inj, vcur, Some(-2)); // hmm: ancestor -2 -> handled below
|
|
2077
|
+
let terrlen = terrs.as_list().map(|l| l.borrow().len()).unwrap_or(0);
|
|
2078
|
+
if terrlen == 0 {
|
|
2079
|
+
return Value::Noval;
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
let valdesc = tvals_desc(&tvals);
|
|
2083
|
+
errs_push(
|
|
2084
|
+
inj,
|
|
2085
|
+
invalid_type_msg(
|
|
2086
|
+
&path_after,
|
|
2087
|
+
&format!(
|
|
2088
|
+
"{}{}",
|
|
2089
|
+
if tvals.len() > 1 { "one of " } else { "" },
|
|
2090
|
+
valdesc
|
|
2091
|
+
),
|
|
2092
|
+
typify(&dparent),
|
|
2093
|
+
&dparent,
|
|
2094
|
+
),
|
|
2095
|
+
);
|
|
2096
|
+
Value::Noval
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
// `$EXACT`: value must equal a literal exactly (no shape coercion).
|
|
2100
|
+
fn validate_exact(inj: &Inj, _v: &Value, _r: &str, _store: &Value) -> Value {
|
|
2101
|
+
let (mode, parent, key, key_i) = {
|
|
2102
|
+
let b = inj.borrow();
|
|
2103
|
+
(b.mode, b.parent.clone(), b.key.clone(), b.key_i)
|
|
2104
|
+
};
|
|
2105
|
+
if mode != M_VAL {
|
|
2106
|
+
del_prop(parent, &Value::str(key));
|
|
2107
|
+
return Value::Noval;
|
|
2108
|
+
}
|
|
2109
|
+
if !is_list(&parent) || key_i != 0 {
|
|
2110
|
+
let path = inj.borrow().path.clone();
|
|
2111
|
+
errs_push(
|
|
2112
|
+
inj,
|
|
2113
|
+
format!(
|
|
2114
|
+
"The $EXACT validator at field {} must be the first element of an array.",
|
|
2115
|
+
pathify(&path_value(&path), Some(1), Some(1))
|
|
2116
|
+
),
|
|
2117
|
+
);
|
|
2118
|
+
return Value::Noval;
|
|
2119
|
+
}
|
|
2120
|
+
let keylen = inj.borrow().keys.borrow().len() as i64;
|
|
2121
|
+
inj.borrow_mut().key_i = keylen;
|
|
2122
|
+
let dparent = inj.borrow().dparent.clone();
|
|
2123
|
+
Injection::setval(inj, dparent.clone(), Some(2));
|
|
2124
|
+
{
|
|
2125
|
+
let mut b = inj.borrow_mut();
|
|
2126
|
+
let n = b.path.len();
|
|
2127
|
+
b.path.truncate(n.saturating_sub(1));
|
|
2128
|
+
b.key = b.path.last().cloned().unwrap_or_default();
|
|
2129
|
+
}
|
|
2130
|
+
let path_after = inj.borrow().path.clone();
|
|
2131
|
+
let tvals: Vec<Value> = slice(parent.clone(), Some(1), None, false)
|
|
2132
|
+
.as_list()
|
|
2133
|
+
.map(|l| l.borrow().clone())
|
|
2134
|
+
.unwrap_or_default();
|
|
2135
|
+
if tvals.is_empty() {
|
|
2136
|
+
errs_push(
|
|
2137
|
+
inj,
|
|
2138
|
+
format!(
|
|
2139
|
+
"The $EXACT validator at field {} must have at least one argument.",
|
|
2140
|
+
pathify(&path_value(&path_after), Some(1), Some(1))
|
|
2141
|
+
),
|
|
2142
|
+
);
|
|
2143
|
+
return Value::Noval;
|
|
2144
|
+
}
|
|
2145
|
+
let mut currentstr: Option<String> = None;
|
|
2146
|
+
for tval in &tvals {
|
|
2147
|
+
let mut exactmatch = tval == &dparent;
|
|
2148
|
+
if !exactmatch && is_node(tval) {
|
|
2149
|
+
let cs = currentstr
|
|
2150
|
+
.get_or_insert_with(|| stringify(&dparent, None, false))
|
|
2151
|
+
.clone();
|
|
2152
|
+
exactmatch = stringify(tval, None, false) == cs;
|
|
2153
|
+
}
|
|
2154
|
+
if exactmatch {
|
|
2155
|
+
return Value::Noval;
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
let valdesc = tvals_desc(&tvals);
|
|
2159
|
+
let need = format!(
|
|
2160
|
+
"{}exactly equal to {}{}",
|
|
2161
|
+
if path_after.len() > 1 { "" } else { "value " },
|
|
2162
|
+
if tvals.len() == 1 { "" } else { "one of " },
|
|
2163
|
+
valdesc
|
|
2164
|
+
);
|
|
2165
|
+
errs_push(
|
|
2166
|
+
inj,
|
|
2167
|
+
invalid_type_msg(&path_after, &need, typify(&dparent), &dparent),
|
|
2168
|
+
);
|
|
2169
|
+
Value::Noval
|
|
2170
|
+
}
|
|
2171
|
+
|
|
2172
|
+
/// `_validation` — the modify hook installed by `validate` (runs after the
|
|
2173
|
+
/// per-key special commands).
|
|
2174
|
+
fn validation_modify(pval: &Value, key: &Value, parent: &Value, inj: &Inj, _store: &Value) {
|
|
2175
|
+
if pval.is_skip() {
|
|
2176
|
+
return;
|
|
2177
|
+
}
|
|
2178
|
+
let (meta, dparent, path) = {
|
|
2179
|
+
let b = inj.borrow();
|
|
2180
|
+
(b.meta.clone(), b.dparent.clone(), b.path.clone())
|
|
2181
|
+
};
|
|
2182
|
+
let exact = matches!(
|
|
2183
|
+
get_prop(&meta, &Value::str(S_BEXACT), Value::Bool(false)),
|
|
2184
|
+
Value::Bool(true)
|
|
2185
|
+
);
|
|
2186
|
+
let cval = get_prop(&dparent, key, Value::Noval);
|
|
2187
|
+
if !exact && cval.is_noval() {
|
|
2188
|
+
return;
|
|
2189
|
+
}
|
|
2190
|
+
let ptype = typify(pval);
|
|
2191
|
+
if ptype & (T_STRING as i64) != 0 {
|
|
2192
|
+
if let Value::Str(s) = pval {
|
|
2193
|
+
if s.contains(S_DS) {
|
|
2194
|
+
return; // remaining special command — leave it
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
let ctype = typify(&cval);
|
|
2199
|
+
if ptype != ctype && !pval.is_noval() {
|
|
2200
|
+
errs_push(
|
|
2201
|
+
inj,
|
|
2202
|
+
invalid_type_msg(&path, &type_name(ptype), ctype, &cval),
|
|
2203
|
+
);
|
|
2204
|
+
return;
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
if is_map(&cval) {
|
|
2208
|
+
if !is_map(pval) {
|
|
2209
|
+
errs_push(
|
|
2210
|
+
inj,
|
|
2211
|
+
invalid_type_msg(&path, &type_name(ptype), ctype, &cval),
|
|
2212
|
+
);
|
|
2213
|
+
return;
|
|
2214
|
+
}
|
|
2215
|
+
let ckeys = keysof_vec(&cval);
|
|
2216
|
+
let pkeys = keysof_vec(pval);
|
|
2217
|
+
let open = matches!(
|
|
2218
|
+
get_prop(pval, &Value::str(S_BOPEN), Value::Noval),
|
|
2219
|
+
Value::Bool(true)
|
|
2220
|
+
);
|
|
2221
|
+
if !pkeys.is_empty() && !open {
|
|
2222
|
+
// Literal presence: the shape must be checked with a raw lookup
|
|
2223
|
+
// (canonical TS `NONE === _lookup(pval, ckey)`); the Group A
|
|
2224
|
+
// has_key would treat a null-valued shape slot as absent.
|
|
2225
|
+
let badkeys: Vec<String> = ckeys
|
|
2226
|
+
.iter()
|
|
2227
|
+
.filter(|ck| lookup(pval, &Value::str((*ck).clone())).is_noval())
|
|
2228
|
+
.cloned()
|
|
2229
|
+
.collect();
|
|
2230
|
+
if !badkeys.is_empty() {
|
|
2231
|
+
errs_push(
|
|
2232
|
+
inj,
|
|
2233
|
+
format!(
|
|
2234
|
+
"Unexpected keys at field {}{}{}",
|
|
2235
|
+
pathify(&path_value(&path), Some(1), None),
|
|
2236
|
+
S_VIZ,
|
|
2237
|
+
badkeys.join(", ")
|
|
2238
|
+
),
|
|
2239
|
+
);
|
|
2240
|
+
}
|
|
2241
|
+
} else {
|
|
2242
|
+
merge(&Value::list(vec![pval.clone(), cval.clone()]), None);
|
|
2243
|
+
if is_node(pval) {
|
|
2244
|
+
del_prop(pval.clone(), &Value::str(S_BOPEN));
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
} else if is_list(&cval) {
|
|
2248
|
+
if !is_list(pval) {
|
|
2249
|
+
errs_push(
|
|
2250
|
+
inj,
|
|
2251
|
+
invalid_type_msg(&path, &type_name(ptype), ctype, &cval),
|
|
2252
|
+
);
|
|
2253
|
+
}
|
|
2254
|
+
} else if exact {
|
|
2255
|
+
if &cval != pval {
|
|
2256
|
+
let pathmsg = if path.len() > 1 {
|
|
2257
|
+
format!(
|
|
2258
|
+
"at field {}{}",
|
|
2259
|
+
pathify(&path_value(&path), Some(1), None),
|
|
2260
|
+
S_VIZ
|
|
2261
|
+
)
|
|
2262
|
+
} else {
|
|
2263
|
+
String::new()
|
|
2264
|
+
};
|
|
2265
|
+
errs_push(
|
|
2266
|
+
inj,
|
|
2267
|
+
format!(
|
|
2268
|
+
"Value {}{} should equal {}{}",
|
|
2269
|
+
pathmsg,
|
|
2270
|
+
js_string(&cval),
|
|
2271
|
+
js_string(pval),
|
|
2272
|
+
S_DT
|
|
2273
|
+
),
|
|
2274
|
+
);
|
|
2275
|
+
}
|
|
2276
|
+
} else {
|
|
2277
|
+
set_prop(parent.clone(), key, cval.clone());
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
/// `_validatehandler` — `getpath`/`_injectstr` handler installed by `validate`.
|
|
2282
|
+
fn validatehandler(inj: &Inj, val: &Value, r: &str, store: &Value) -> Value {
|
|
2283
|
+
if let Some(caps) = R_META_PATH.captures(r) {
|
|
2284
|
+
if &caps[2] == "=" {
|
|
2285
|
+
Injection::setval(
|
|
2286
|
+
inj,
|
|
2287
|
+
Value::list(vec![Value::str(S_BEXACT), val.clone()]),
|
|
2288
|
+
None,
|
|
2289
|
+
);
|
|
2290
|
+
} else {
|
|
2291
|
+
Injection::setval(inj, val.clone(), None);
|
|
2292
|
+
}
|
|
2293
|
+
inj.borrow_mut().key_i = -1;
|
|
2294
|
+
return Value::skip();
|
|
2295
|
+
}
|
|
2296
|
+
inject_handler(inj, val, r, store)
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
pub fn validate(
|
|
2300
|
+
data: &Value,
|
|
2301
|
+
spec: &Value,
|
|
2302
|
+
injdef: Option<&InjectDef>,
|
|
2303
|
+
) -> Result<Value, StructError> {
|
|
2304
|
+
let extra = injdef.and_then(|d| d.extra.clone());
|
|
2305
|
+
let collect = injdef.map(|d| d.errs.is_some()).unwrap_or(false);
|
|
2306
|
+
let errs = injdef
|
|
2307
|
+
.and_then(|d| d.errs.clone())
|
|
2308
|
+
.unwrap_or_else(Value::empty_list);
|
|
2309
|
+
|
|
2310
|
+
// build the validator store
|
|
2311
|
+
let mut vmap: OrderedMap<Value> = OrderedMap::new();
|
|
2312
|
+
for k in [
|
|
2313
|
+
"$DELETE", "$COPY", "$KEY", "$META", "$MERGE", "$EACH", "$PACK",
|
|
2314
|
+
] {
|
|
2315
|
+
vmap.insert(k.to_string(), Value::Null);
|
|
2316
|
+
}
|
|
2317
|
+
vmap.insert("$STRING".to_string(), Value::func(validate_string));
|
|
2318
|
+
for k in [
|
|
2319
|
+
"$NUMBER",
|
|
2320
|
+
"$INTEGER",
|
|
2321
|
+
"$DECIMAL",
|
|
2322
|
+
"$BOOLEAN",
|
|
2323
|
+
"$NULL",
|
|
2324
|
+
"$NIL",
|
|
2325
|
+
"$MAP",
|
|
2326
|
+
"$LIST",
|
|
2327
|
+
"$FUNCTION",
|
|
2328
|
+
"$INSTANCE",
|
|
2329
|
+
] {
|
|
2330
|
+
vmap.insert(k.to_string(), Value::func(validate_type));
|
|
2331
|
+
}
|
|
2332
|
+
vmap.insert("$ANY".to_string(), Value::func(validate_any));
|
|
2333
|
+
vmap.insert("$CHILD".to_string(), Value::func(validate_child));
|
|
2334
|
+
vmap.insert("$ONE".to_string(), Value::func(validate_one));
|
|
2335
|
+
vmap.insert("$EXACT".to_string(), Value::func(validate_exact));
|
|
2336
|
+
|
|
2337
|
+
let extra_or_empty = match &extra {
|
|
2338
|
+
Some(e) => e.clone(),
|
|
2339
|
+
None => Value::empty_map(),
|
|
2340
|
+
};
|
|
2341
|
+
let store = merge(
|
|
2342
|
+
&Value::list(vec![
|
|
2343
|
+
Value::map(vmap),
|
|
2344
|
+
extra_or_empty,
|
|
2345
|
+
Value::map_of([(S_DERRS.to_string(), errs.clone())]),
|
|
2346
|
+
]),
|
|
2347
|
+
Some(1),
|
|
2348
|
+
);
|
|
2349
|
+
|
|
2350
|
+
let meta = match injdef.and_then(|d| d.meta.clone()) {
|
|
2351
|
+
Some(m) => m,
|
|
2352
|
+
None => Value::empty_map(),
|
|
2353
|
+
};
|
|
2354
|
+
let exact_cur = get_prop(&meta, &Value::str(S_BEXACT), Value::Bool(false));
|
|
2355
|
+
set_prop(meta.clone(), &Value::str(S_BEXACT), exact_cur);
|
|
2356
|
+
|
|
2357
|
+
let td = InjectDef {
|
|
2358
|
+
meta: Some(meta),
|
|
2359
|
+
extra: Some(store),
|
|
2360
|
+
modify: Some(Rc::new(validation_modify) as Modify),
|
|
2361
|
+
handler: Some(Rc::new(validatehandler) as NativeFn),
|
|
2362
|
+
errs: Some(errs.clone()),
|
|
2363
|
+
..Default::default()
|
|
2364
|
+
};
|
|
2365
|
+
|
|
2366
|
+
let out = transform(data, spec, Some(&td)).unwrap_or(Value::Noval);
|
|
2367
|
+
|
|
2368
|
+
let errlen = errs.as_list().map(|l| l.borrow().len()).unwrap_or(0);
|
|
2369
|
+
if errlen > 0 && !collect {
|
|
2370
|
+
let msgs: Vec<String> = errs
|
|
2371
|
+
.as_list()
|
|
2372
|
+
.map(|l| l.borrow().iter().map(js_string).collect())
|
|
2373
|
+
.unwrap_or_default();
|
|
2374
|
+
return Err(StructError {
|
|
2375
|
+
message: msgs.join(" | "),
|
|
2376
|
+
});
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2379
|
+
Ok(out)
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2382
|
+
// ---- select ----------------------------------------------------------
|
|
2383
|
+
|
|
2384
|
+
fn js_lt(a: &Value, b: &Value) -> bool {
|
|
2385
|
+
match (a, b) {
|
|
2386
|
+
(Value::Str(x), Value::Str(y)) => x < y,
|
|
2387
|
+
_ => {
|
|
2388
|
+
let (x, y) = (js_to_number(a), js_to_number(b));
|
|
2389
|
+
x < y // NaN -> false, matches JS
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
fn js_gt(a: &Value, b: &Value) -> bool {
|
|
2394
|
+
match (a, b) {
|
|
2395
|
+
(Value::Str(x), Value::Str(y)) => x > y,
|
|
2396
|
+
_ => {
|
|
2397
|
+
let (x, y) = (js_to_number(a), js_to_number(b));
|
|
2398
|
+
x > y
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
fn select_subvalidate(point: &Value, term: &Value, store: &Value, meta: &Value) -> bool {
|
|
2404
|
+
let vstore = match merge(
|
|
2405
|
+
&Value::list(vec![Value::empty_map(), store.clone()]),
|
|
2406
|
+
Some(1),
|
|
2407
|
+
) {
|
|
2408
|
+
v @ Value::Map(_) => v,
|
|
2409
|
+
_ => Value::empty_map(),
|
|
2410
|
+
};
|
|
2411
|
+
set_prop(vstore.clone(), &Value::str(S_DTOP), point.clone());
|
|
2412
|
+
let terrs = Value::empty_list();
|
|
2413
|
+
let vd = InjectDef {
|
|
2414
|
+
extra: Some(vstore),
|
|
2415
|
+
errs: Some(terrs.clone()),
|
|
2416
|
+
meta: Some(meta.clone()),
|
|
2417
|
+
..Default::default()
|
|
2418
|
+
};
|
|
2419
|
+
let _ = validate(point, term, Some(&vd));
|
|
2420
|
+
terrs
|
|
2421
|
+
.as_list()
|
|
2422
|
+
.map(|l| l.borrow().is_empty())
|
|
2423
|
+
.unwrap_or(true)
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
fn select_and(inj: &Inj, _v: &Value, _r: &str, store: &Value) -> Value {
|
|
2427
|
+
if inj.borrow().mode != M_KEYPRE {
|
|
2428
|
+
return Value::Noval;
|
|
2429
|
+
}
|
|
2430
|
+
let (key, parent, path, nodes, meta) = {
|
|
2431
|
+
let b = inj.borrow();
|
|
2432
|
+
(
|
|
2433
|
+
b.key.clone(),
|
|
2434
|
+
b.parent.clone(),
|
|
2435
|
+
b.path.clone(),
|
|
2436
|
+
b.nodes.clone(),
|
|
2437
|
+
b.meta.clone(),
|
|
2438
|
+
)
|
|
2439
|
+
};
|
|
2440
|
+
let terms: Vec<Value> = lookup(&parent, &Value::str(key))
|
|
2441
|
+
.as_list()
|
|
2442
|
+
.map(|l| l.borrow().clone())
|
|
2443
|
+
.unwrap_or_default();
|
|
2444
|
+
let ppath = slice_str_vec(&path, Some(-1), None);
|
|
2445
|
+
let point = get_path_inj(store, &path_value(&ppath), None);
|
|
2446
|
+
for term in &terms {
|
|
2447
|
+
if !select_subvalidate(&point, term, store, &meta) {
|
|
2448
|
+
errs_push(
|
|
2449
|
+
inj,
|
|
2450
|
+
format!(
|
|
2451
|
+
"AND:{}{}{} fail:{}",
|
|
2452
|
+
pathify(&path_value(&ppath), None, None),
|
|
2453
|
+
S_VIZ,
|
|
2454
|
+
stringify(&point, None, false),
|
|
2455
|
+
stringify(&Value::list(terms.clone()), None, false)
|
|
2456
|
+
),
|
|
2457
|
+
);
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
let gkey = path
|
|
2461
|
+
.get(path.len().saturating_sub(2))
|
|
2462
|
+
.cloned()
|
|
2463
|
+
.unwrap_or_default();
|
|
2464
|
+
let nlen = nodes.len();
|
|
2465
|
+
if nlen >= 2 {
|
|
2466
|
+
set_prop(nodes[nlen - 2].clone(), &Value::str(gkey), point);
|
|
2467
|
+
}
|
|
2468
|
+
Value::Noval
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
fn select_or(inj: &Inj, _v: &Value, _r: &str, store: &Value) -> Value {
|
|
2472
|
+
if inj.borrow().mode != M_KEYPRE {
|
|
2473
|
+
return Value::Noval;
|
|
2474
|
+
}
|
|
2475
|
+
let (key, parent, path, nodes, meta) = {
|
|
2476
|
+
let b = inj.borrow();
|
|
2477
|
+
(
|
|
2478
|
+
b.key.clone(),
|
|
2479
|
+
b.parent.clone(),
|
|
2480
|
+
b.path.clone(),
|
|
2481
|
+
b.nodes.clone(),
|
|
2482
|
+
b.meta.clone(),
|
|
2483
|
+
)
|
|
2484
|
+
};
|
|
2485
|
+
let terms: Vec<Value> = lookup(&parent, &Value::str(key))
|
|
2486
|
+
.as_list()
|
|
2487
|
+
.map(|l| l.borrow().clone())
|
|
2488
|
+
.unwrap_or_default();
|
|
2489
|
+
let ppath = slice_str_vec(&path, Some(-1), None);
|
|
2490
|
+
let point = get_path_inj(store, &path_value(&ppath), None);
|
|
2491
|
+
for term in &terms {
|
|
2492
|
+
if select_subvalidate(&point, term, store, &meta) {
|
|
2493
|
+
let gkey = path
|
|
2494
|
+
.get(path.len().saturating_sub(2))
|
|
2495
|
+
.cloned()
|
|
2496
|
+
.unwrap_or_default();
|
|
2497
|
+
let nlen = nodes.len();
|
|
2498
|
+
if nlen >= 2 {
|
|
2499
|
+
set_prop(nodes[nlen - 2].clone(), &Value::str(gkey), point);
|
|
2500
|
+
}
|
|
2501
|
+
return Value::Noval;
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
errs_push(
|
|
2505
|
+
inj,
|
|
2506
|
+
format!(
|
|
2507
|
+
"OR:{}{}{} fail:{}",
|
|
2508
|
+
pathify(&path_value(&ppath), None, None),
|
|
2509
|
+
S_VIZ,
|
|
2510
|
+
stringify(&point, None, false),
|
|
2511
|
+
stringify(&Value::list(terms.clone()), None, false)
|
|
2512
|
+
),
|
|
2513
|
+
);
|
|
2514
|
+
Value::Noval
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
fn select_not(inj: &Inj, _v: &Value, _r: &str, store: &Value) -> Value {
|
|
2518
|
+
if inj.borrow().mode != M_KEYPRE {
|
|
2519
|
+
return Value::Noval;
|
|
2520
|
+
}
|
|
2521
|
+
let (key, parent, path, nodes, meta) = {
|
|
2522
|
+
let b = inj.borrow();
|
|
2523
|
+
(
|
|
2524
|
+
b.key.clone(),
|
|
2525
|
+
b.parent.clone(),
|
|
2526
|
+
b.path.clone(),
|
|
2527
|
+
b.nodes.clone(),
|
|
2528
|
+
b.meta.clone(),
|
|
2529
|
+
)
|
|
2530
|
+
};
|
|
2531
|
+
let term = lookup(&parent, &Value::str(key));
|
|
2532
|
+
let ppath = slice_str_vec(&path, Some(-1), None);
|
|
2533
|
+
let point = get_path_inj(store, &path_value(&ppath), None);
|
|
2534
|
+
if select_subvalidate(&point, &term, store, &meta) {
|
|
2535
|
+
errs_push(
|
|
2536
|
+
inj,
|
|
2537
|
+
format!(
|
|
2538
|
+
"NOT:{}{}{} fail:{}",
|
|
2539
|
+
pathify(&path_value(&ppath), None, None),
|
|
2540
|
+
S_VIZ,
|
|
2541
|
+
stringify(&point, None, false),
|
|
2542
|
+
stringify(&term, None, false)
|
|
2543
|
+
),
|
|
2544
|
+
);
|
|
2545
|
+
}
|
|
2546
|
+
let gkey = path
|
|
2547
|
+
.get(path.len().saturating_sub(2))
|
|
2548
|
+
.cloned()
|
|
2549
|
+
.unwrap_or_default();
|
|
2550
|
+
let nlen = nodes.len();
|
|
2551
|
+
if nlen >= 2 {
|
|
2552
|
+
set_prop(nodes[nlen - 2].clone(), &Value::str(gkey), point);
|
|
2553
|
+
}
|
|
2554
|
+
Value::Noval
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
fn select_cmp(inj: &Inj, _v: &Value, r: &str, store: &Value) -> Value {
|
|
2558
|
+
if inj.borrow().mode != M_KEYPRE {
|
|
2559
|
+
return Value::Noval;
|
|
2560
|
+
}
|
|
2561
|
+
let (key, parent, path, nodes) = {
|
|
2562
|
+
let b = inj.borrow();
|
|
2563
|
+
(
|
|
2564
|
+
b.key.clone(),
|
|
2565
|
+
b.parent.clone(),
|
|
2566
|
+
b.path.clone(),
|
|
2567
|
+
b.nodes.clone(),
|
|
2568
|
+
)
|
|
2569
|
+
};
|
|
2570
|
+
let term = lookup(&parent, &Value::str(key));
|
|
2571
|
+
let gkey = path
|
|
2572
|
+
.get(path.len().saturating_sub(2))
|
|
2573
|
+
.cloned()
|
|
2574
|
+
.unwrap_or_default();
|
|
2575
|
+
let ppath = slice_str_vec(&path, Some(-1), None);
|
|
2576
|
+
let point = get_path_inj(store, &path_value(&ppath), None);
|
|
2577
|
+
|
|
2578
|
+
let pass = match r {
|
|
2579
|
+
"$GT" => js_gt(&point, &term),
|
|
2580
|
+
"$LT" => js_lt(&point, &term),
|
|
2581
|
+
"$GTE" => js_gt(&point, &term) || point == term,
|
|
2582
|
+
"$LTE" => js_lt(&point, &term) || point == term,
|
|
2583
|
+
"$LIKE" => {
|
|
2584
|
+
let pat = term.as_str().unwrap_or("").to_string();
|
|
2585
|
+
crate::utility::voxgigstruct::re::Regex::new(&pat)
|
|
2586
|
+
.map(|re| re.is_match(&stringify(&point, None, false)))
|
|
2587
|
+
.unwrap_or(false)
|
|
2588
|
+
}
|
|
2589
|
+
_ => false,
|
|
2590
|
+
};
|
|
2591
|
+
|
|
2592
|
+
if pass {
|
|
2593
|
+
let nlen = nodes.len();
|
|
2594
|
+
if nlen >= 2 {
|
|
2595
|
+
set_prop(nodes[nlen - 2].clone(), &Value::str(gkey), point);
|
|
2596
|
+
}
|
|
2597
|
+
} else {
|
|
2598
|
+
errs_push(
|
|
2599
|
+
inj,
|
|
2600
|
+
format!(
|
|
2601
|
+
"CMP: {}{}{} fail:{} {}",
|
|
2602
|
+
pathify(&path_value(&ppath), None, None),
|
|
2603
|
+
S_VIZ,
|
|
2604
|
+
stringify(&point, None, false),
|
|
2605
|
+
r,
|
|
2606
|
+
stringify(&term, None, false)
|
|
2607
|
+
),
|
|
2608
|
+
);
|
|
2609
|
+
}
|
|
2610
|
+
Value::Noval
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
pub fn select(children: &Value, query: &Value) -> Value {
|
|
2614
|
+
if !is_node(children) {
|
|
2615
|
+
return Value::empty_list();
|
|
2616
|
+
}
|
|
2617
|
+
|
|
2618
|
+
let child_list: Vec<Value> = match children {
|
|
2619
|
+
Value::Map(_) => items_vec(children)
|
|
2620
|
+
.into_iter()
|
|
2621
|
+
.map(|(k, v)| {
|
|
2622
|
+
set_prop(v.clone(), &Value::str(S_DKEY), Value::str(k));
|
|
2623
|
+
v
|
|
2624
|
+
})
|
|
2625
|
+
.collect(),
|
|
2626
|
+
Value::List(_) => items_vec(children)
|
|
2627
|
+
.into_iter()
|
|
2628
|
+
.map(|(k, v)| {
|
|
2629
|
+
set_prop(
|
|
2630
|
+
v.clone(),
|
|
2631
|
+
&Value::str(S_DKEY),
|
|
2632
|
+
Value::Num(k.parse::<f64>().unwrap_or(f64::NAN)),
|
|
2633
|
+
);
|
|
2634
|
+
v
|
|
2635
|
+
})
|
|
2636
|
+
.collect(),
|
|
2637
|
+
_ => return Value::empty_list(),
|
|
2638
|
+
};
|
|
2639
|
+
|
|
2640
|
+
let extra = Value::map_of([
|
|
2641
|
+
("$AND".to_string(), Value::func(select_and)),
|
|
2642
|
+
("$OR".to_string(), Value::func(select_or)),
|
|
2643
|
+
("$NOT".to_string(), Value::func(select_not)),
|
|
2644
|
+
("$GT".to_string(), Value::func(select_cmp)),
|
|
2645
|
+
("$LT".to_string(), Value::func(select_cmp)),
|
|
2646
|
+
("$GTE".to_string(), Value::func(select_cmp)),
|
|
2647
|
+
("$LTE".to_string(), Value::func(select_cmp)),
|
|
2648
|
+
("$LIKE".to_string(), Value::func(select_cmp)),
|
|
2649
|
+
]);
|
|
2650
|
+
let meta = Value::map_of([(S_BEXACT.to_string(), Value::Bool(true))]);
|
|
2651
|
+
|
|
2652
|
+
let q = clone(query);
|
|
2653
|
+
let mut open = |_k: &Value, v: &Value, _p: &Value, _t: &[String]| -> Value {
|
|
2654
|
+
if is_map(v) {
|
|
2655
|
+
let cur = get_prop(v, &Value::str(S_BOPEN), Value::Bool(true));
|
|
2656
|
+
set_prop(v.clone(), &Value::str(S_BOPEN), cur);
|
|
2657
|
+
}
|
|
2658
|
+
v.clone()
|
|
2659
|
+
};
|
|
2660
|
+
walk(q.clone(), Some(&mut open), None, None);
|
|
2661
|
+
|
|
2662
|
+
let mut results: Vec<Value> = Vec::new();
|
|
2663
|
+
for child in &child_list {
|
|
2664
|
+
let errs = Value::empty_list();
|
|
2665
|
+
let vd = InjectDef {
|
|
2666
|
+
errs: Some(errs.clone()),
|
|
2667
|
+
meta: Some(meta.clone()),
|
|
2668
|
+
extra: Some(extra.clone()),
|
|
2669
|
+
..Default::default()
|
|
2670
|
+
};
|
|
2671
|
+
let _ = validate(child, &clone(&q), Some(&vd));
|
|
2672
|
+
if errs
|
|
2673
|
+
.as_list()
|
|
2674
|
+
.map(|l| l.borrow().is_empty())
|
|
2675
|
+
.unwrap_or(true)
|
|
2676
|
+
{
|
|
2677
|
+
results.push(child.clone());
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
Value::list(results)
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
// keep `Injection::has_handler` referenced (used once staging is complete)
|
|
2684
|
+
#[allow(dead_code)]
|
|
2685
|
+
fn _keepalive() {
|
|
2686
|
+
let _ = Injection::has_handler(None);
|
|
2687
|
+
let _ = inject_child as fn(Value, &Value, &Inj) -> Inj;
|
|
2688
|
+
}
|