@voxgig/sdkgen 1.3.8 → 1.3.10
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 +62 -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 +55 -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 +53 -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 +48 -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 +50 -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/TestEntity_ts.ts +8 -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,2897 @@
|
|
|
1
|
+
# Copyright (c) 2025-2026 Voxgig Ltd. MIT LICENSE.
|
|
2
|
+
# Perl port of the canonical TypeScript implementation (ts/src/StructUtility.ts).
|
|
3
|
+
# See ../REPORT.md for cross-language parity.
|
|
4
|
+
package Voxgig::Struct;
|
|
5
|
+
|
|
6
|
+
use 5.018;
|
|
7
|
+
use strict;
|
|
8
|
+
use warnings;
|
|
9
|
+
use utf8;
|
|
10
|
+
|
|
11
|
+
our $VERSION = '0.1.0';
|
|
12
|
+
|
|
13
|
+
use Scalar::Util qw(blessed reftype looks_like_number refaddr);
|
|
14
|
+
use List::Util qw();
|
|
15
|
+
use B qw();
|
|
16
|
+
|
|
17
|
+
# ============================================================================
|
|
18
|
+
# Voxgig::Struct::OrderedHash — minimal insertion-ordered tied hash.
|
|
19
|
+
#
|
|
20
|
+
# Perl hashes randomise key order; the canonical contract requires that
|
|
21
|
+
# JSON object key order survive every operation. Other ports either get
|
|
22
|
+
# this for free (Python 3.7+ dict, Ruby Hash, PHP array, JS object) or
|
|
23
|
+
# hand-roll an OrderedMap (C / C++ / Zig). This is the Perl equivalent —
|
|
24
|
+
# keeps the port dependency-free. Implements the standard `Tie::Hash`
|
|
25
|
+
# protocol plus a `Keys()` direct accessor for fast iteration.
|
|
26
|
+
# ============================================================================
|
|
27
|
+
|
|
28
|
+
package Voxgig::Struct::OrderedHash;
|
|
29
|
+
|
|
30
|
+
sub TIEHASH {
|
|
31
|
+
my ($class) = @_;
|
|
32
|
+
return bless { _keys => [], _data => {} }, $class;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
sub STORE {
|
|
36
|
+
my ($self, $key, $value) = @_;
|
|
37
|
+
if (!exists $self->{_data}{$key}) {
|
|
38
|
+
push @{ $self->{_keys} }, $key;
|
|
39
|
+
}
|
|
40
|
+
$self->{_data}{$key} = $value;
|
|
41
|
+
return $value;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
sub FETCH {
|
|
45
|
+
my ($self, $key) = @_;
|
|
46
|
+
return $self->{_data}{$key};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
sub EXISTS {
|
|
50
|
+
my ($self, $key) = @_;
|
|
51
|
+
return exists $self->{_data}{$key} ? 1 : 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
sub DELETE {
|
|
55
|
+
my ($self, $key) = @_;
|
|
56
|
+
return unless exists $self->{_data}{$key};
|
|
57
|
+
my $v = delete $self->{_data}{$key};
|
|
58
|
+
@{ $self->{_keys} } = grep { $_ ne $key } @{ $self->{_keys} };
|
|
59
|
+
return $v;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
sub CLEAR {
|
|
63
|
+
my ($self) = @_;
|
|
64
|
+
@{ $self->{_keys} } = ();
|
|
65
|
+
%{ $self->{_data} } = ();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
sub FIRSTKEY {
|
|
69
|
+
my ($self) = @_;
|
|
70
|
+
$self->{_iter} = 0;
|
|
71
|
+
return unless @{ $self->{_keys} };
|
|
72
|
+
return $self->{_keys}[0];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
sub NEXTKEY {
|
|
76
|
+
my ($self, $lastkey) = @_;
|
|
77
|
+
$self->{_iter}++;
|
|
78
|
+
my $i = $self->{_iter};
|
|
79
|
+
return if $i >= scalar @{ $self->{_keys} };
|
|
80
|
+
return $self->{_keys}[$i];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
sub SCALAR {
|
|
84
|
+
my ($self) = @_;
|
|
85
|
+
return scalar @{ $self->{_keys} };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
# Direct ordered-keys accessor (matches Tie::IxHash's `Keys` so the
|
|
89
|
+
# rest of Voxgig::Struct's hot path can skip iterator overhead).
|
|
90
|
+
sub Keys { @{ $_[0]{_keys} } }
|
|
91
|
+
|
|
92
|
+
package Voxgig::Struct;
|
|
93
|
+
|
|
94
|
+
# Distinguish numbers from strings at the SV level. JSON numbers come in with
|
|
95
|
+
# IOK / NOK flags set (because our parser does `0+$n`); JSON strings stay
|
|
96
|
+
# pure POK. Used in getpath / typify to keep TS's typeof(path) === 'number'
|
|
97
|
+
# branch reachable.
|
|
98
|
+
sub _is_number_sv {
|
|
99
|
+
my ($val) = @_;
|
|
100
|
+
return 0 unless defined $val;
|
|
101
|
+
return 0 if ref $val;
|
|
102
|
+
my $sv = B::svref_2object(\$val);
|
|
103
|
+
my $flags = $sv->FLAGS;
|
|
104
|
+
return ($flags & (B::SVf_NOK() | B::SVf_IOK())) ? 1 : 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
sub _is_string_sv {
|
|
108
|
+
my ($val) = @_;
|
|
109
|
+
return 0 unless defined $val;
|
|
110
|
+
return 0 if ref $val;
|
|
111
|
+
my $sv = B::svref_2object(\$val);
|
|
112
|
+
my $flags = $sv->FLAGS;
|
|
113
|
+
# POK without IOK/NOK → pure string.
|
|
114
|
+
return ($flags & B::SVf_POK()) && !($flags & (B::SVf_NOK() | B::SVf_IOK())) ? 1 : 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
# ============================================================================
|
|
118
|
+
# Constants
|
|
119
|
+
# ============================================================================
|
|
120
|
+
|
|
121
|
+
# Injection modes (a key is injected three times: pre / val / post).
|
|
122
|
+
use constant M_KEYPRE => 1;
|
|
123
|
+
use constant M_KEYPOST => 2;
|
|
124
|
+
use constant M_VAL => 4;
|
|
125
|
+
|
|
126
|
+
# Backtick-quoted command names.
|
|
127
|
+
use constant S_BKEY => '`$KEY`';
|
|
128
|
+
use constant S_BANNO => '`$ANNO`';
|
|
129
|
+
use constant S_BEXACT => '`$EXACT`';
|
|
130
|
+
use constant S_BVAL => '`$VAL`';
|
|
131
|
+
use constant S_BOPEN => '`$OPEN`';
|
|
132
|
+
|
|
133
|
+
# Annotation keys.
|
|
134
|
+
use constant S_DKEY => '$KEY';
|
|
135
|
+
use constant S_DTOP => '$TOP';
|
|
136
|
+
use constant S_DERRS => '$ERRS';
|
|
137
|
+
use constant S_DSPEC => '$SPEC';
|
|
138
|
+
use constant S_DMETA => '$META';
|
|
139
|
+
|
|
140
|
+
# Type names.
|
|
141
|
+
use constant S_list => 'list';
|
|
142
|
+
use constant S_base => 'base';
|
|
143
|
+
use constant S_boolean => 'boolean';
|
|
144
|
+
use constant S_function => 'function';
|
|
145
|
+
use constant S_symbol => 'symbol';
|
|
146
|
+
use constant S_instance => 'instance';
|
|
147
|
+
use constant S_key => 'key';
|
|
148
|
+
use constant S_any => 'any';
|
|
149
|
+
use constant S_nil => 'nil';
|
|
150
|
+
use constant S_null => 'null';
|
|
151
|
+
use constant S_number => 'number';
|
|
152
|
+
use constant S_object => 'object';
|
|
153
|
+
use constant S_string => 'string';
|
|
154
|
+
use constant S_decimal => 'decimal';
|
|
155
|
+
use constant S_integer => 'integer';
|
|
156
|
+
use constant S_map => 'map';
|
|
157
|
+
use constant S_scalar => 'scalar';
|
|
158
|
+
use constant S_node => 'node';
|
|
159
|
+
|
|
160
|
+
# Common single-character strings.
|
|
161
|
+
use constant S_BT => '`';
|
|
162
|
+
use constant S_CN => ':';
|
|
163
|
+
use constant S_CS => ']';
|
|
164
|
+
use constant S_DS => '$';
|
|
165
|
+
use constant S_DT => '.';
|
|
166
|
+
use constant S_FS => '/';
|
|
167
|
+
use constant S_KEY => 'KEY';
|
|
168
|
+
use constant S_MT => '';
|
|
169
|
+
use constant S_OS => '[';
|
|
170
|
+
use constant S_SP => ' ';
|
|
171
|
+
use constant S_CM => ',';
|
|
172
|
+
use constant S_VIZ => ': ';
|
|
173
|
+
|
|
174
|
+
# Type bit flags. Same numeric layout as the canonical TS:
|
|
175
|
+
# T_any is all-bits-below set; the others are distinct bits decreasing
|
|
176
|
+
# down the list. The order matches TYPENAME below for table-driven lookup.
|
|
177
|
+
# Type bit-flags. Values match the canonical TypeScript scheme exactly so that
|
|
178
|
+
# typify()/typename() return the same numbers the shared corpus pins.
|
|
179
|
+
use constant T_any => (1 << 31) - 1;
|
|
180
|
+
use constant T_noval => 1 << 30;
|
|
181
|
+
use constant T_boolean => 1 << 29;
|
|
182
|
+
use constant T_decimal => 1 << 28;
|
|
183
|
+
use constant T_integer => 1 << 27;
|
|
184
|
+
use constant T_number => 1 << 26;
|
|
185
|
+
use constant T_string => 1 << 25;
|
|
186
|
+
use constant T_function => 1 << 24;
|
|
187
|
+
use constant T_symbol => 1 << 23;
|
|
188
|
+
use constant T_null => 1 << 22;
|
|
189
|
+
use constant T_list => 1 << 14;
|
|
190
|
+
use constant T_map => 1 << 13;
|
|
191
|
+
use constant T_instance => 1 << 12;
|
|
192
|
+
use constant T_scalar => 1 << 7;
|
|
193
|
+
use constant T_node => 1 << 6;
|
|
194
|
+
|
|
195
|
+
our %TYPENAME = (
|
|
196
|
+
T_noval() => S_nil,
|
|
197
|
+
T_boolean() => S_boolean,
|
|
198
|
+
T_decimal() => S_decimal,
|
|
199
|
+
T_integer() => S_integer,
|
|
200
|
+
T_number() => S_number,
|
|
201
|
+
T_string() => S_string,
|
|
202
|
+
T_function() => S_function,
|
|
203
|
+
T_symbol() => S_symbol,
|
|
204
|
+
T_null() => S_null,
|
|
205
|
+
T_list() => S_list,
|
|
206
|
+
T_map() => S_map,
|
|
207
|
+
T_instance() => S_instance,
|
|
208
|
+
T_scalar() => S_scalar,
|
|
209
|
+
T_node() => S_node,
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
# Mode → human-readable name (mirrors TS MODENAME).
|
|
213
|
+
our %MODENAME = (
|
|
214
|
+
M_KEYPRE() => 'key:pre',
|
|
215
|
+
M_KEYPOST() => 'key:post',
|
|
216
|
+
M_VAL() => 'val',
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
# Sentinel for "absent" (corresponds to TS undefined / Python NULLMARK).
|
|
220
|
+
# Use a unique blessed reference — refaddr identifies it.
|
|
221
|
+
our $NONE = do { my $x = \"$$"; bless $x, 'Voxgig::Struct::None' };
|
|
222
|
+
sub NONE { return $NONE }
|
|
223
|
+
sub is_none { return defined $_[0] && blessed($_[0]) && blessed($_[0]) eq 'Voxgig::Struct::None' }
|
|
224
|
+
|
|
225
|
+
# JSON null sentinel — distinct from Perl undef (which is "absent").
|
|
226
|
+
our $JNULL = bless \(my $jn_dummy = 'null'), 'Voxgig::Struct::Null';
|
|
227
|
+
sub JNULL { return $JNULL }
|
|
228
|
+
sub is_jnull { return defined $_[0] && blessed($_[0]) && blessed($_[0]) eq 'Voxgig::Struct::Null' }
|
|
229
|
+
|
|
230
|
+
# Booleans (JSON true/false).
|
|
231
|
+
our $JTRUE = bless \(my $jt_dummy = 1), 'Voxgig::Struct::Bool';
|
|
232
|
+
our $JFALSE = bless \(my $jf_dummy = 0), 'Voxgig::Struct::Bool';
|
|
233
|
+
sub JTRUE { return $JTRUE }
|
|
234
|
+
sub JFALSE { return $JFALSE }
|
|
235
|
+
sub is_jbool { return defined $_[0] && blessed($_[0]) && blessed($_[0]) eq 'Voxgig::Struct::Bool' }
|
|
236
|
+
sub jbool { return $_[0] ? $JTRUE : $JFALSE }
|
|
237
|
+
|
|
238
|
+
# Bool overloading so $JTRUE/$JFALSE evaluate sanely in boolean context.
|
|
239
|
+
package Voxgig::Struct::Bool;
|
|
240
|
+
use overload
|
|
241
|
+
'bool' => sub { ${ $_[0] } ? 1 : 0 },
|
|
242
|
+
'0+' => sub { ${ $_[0] } ? 1 : 0 },
|
|
243
|
+
'""' => sub { ${ $_[0] } ? 'true' : 'false' },
|
|
244
|
+
fallback => 1;
|
|
245
|
+
sub TO_JSON { return ${ $_[0] } ? \1 : \0 }
|
|
246
|
+
|
|
247
|
+
# Stringify the JSON-null singleton as 'null' rather than the blessed
|
|
248
|
+
# scalar's address (matches TS / JS toString of null).
|
|
249
|
+
package Voxgig::Struct::Null;
|
|
250
|
+
use overload
|
|
251
|
+
'bool' => sub { 0 },
|
|
252
|
+
'0+' => sub { 0 },
|
|
253
|
+
'""' => sub { 'null' },
|
|
254
|
+
fallback => 1;
|
|
255
|
+
|
|
256
|
+
package Voxgig::Struct;
|
|
257
|
+
|
|
258
|
+
# Sentinels (immutable singletons). SKIP omits the slot, DELETE removes it.
|
|
259
|
+
our $SKIP = _make_sentinel('`$SKIP`');
|
|
260
|
+
our $DELETE = _make_sentinel('`$DELETE`');
|
|
261
|
+
sub SKIP { return $SKIP }
|
|
262
|
+
sub DELETE { return $DELETE }
|
|
263
|
+
sub is_sentinel {
|
|
264
|
+
my ($val) = @_;
|
|
265
|
+
return 0 unless defined $val && blessed($val) && blessed($val) eq 'Voxgig::Struct::Sentinel';
|
|
266
|
+
return 1;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
sub _make_sentinel {
|
|
270
|
+
my ($mark) = @_;
|
|
271
|
+
my %h;
|
|
272
|
+
tie %h, 'Voxgig::Struct::OrderedHash';
|
|
273
|
+
$h{$mark} = $JTRUE;
|
|
274
|
+
return bless \%h, 'Voxgig::Struct::Sentinel';
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
# Common regex patterns (precompiled).
|
|
278
|
+
our $R_INTEGER_KEY = qr/^-?[0-9]+$/;
|
|
279
|
+
our $R_ESCAPE_REGEXP = qr/[.*+?^\${}()|\[\]\\]/;
|
|
280
|
+
our $R_QUOTES = qr/"/;
|
|
281
|
+
our $R_DOT = qr/\./;
|
|
282
|
+
our $R_CLONE_REF = qr/^`\$REF:([0-9]+)`$/;
|
|
283
|
+
our $R_META_PATH = qr/^([^\$]+)\$([=~])(.+)$/;
|
|
284
|
+
our $R_DOUBLE_DOLLAR = qr/\$\$/;
|
|
285
|
+
our $R_TRANSFORM_NAME = qr/`\$([A-Z]+)`/;
|
|
286
|
+
our $R_INJECTION_FULL = qr/^`(\$[A-Z]+|[^`]*)[0-9]*`$/;
|
|
287
|
+
our $R_BT_ESCAPE = qr/\$BT/;
|
|
288
|
+
our $R_DS_ESCAPE = qr/\$DS/;
|
|
289
|
+
our $R_INJECTION_PARTIAL = qr/`([^`]+)`/;
|
|
290
|
+
|
|
291
|
+
use constant MAXDEPTH => 32;
|
|
292
|
+
|
|
293
|
+
# ============================================================================
|
|
294
|
+
# Map helpers (insertion-ordered hashes via Tie::IxHash).
|
|
295
|
+
# ============================================================================
|
|
296
|
+
|
|
297
|
+
# Build a new empty insertion-ordered map.
|
|
298
|
+
sub _mkmap {
|
|
299
|
+
my %h;
|
|
300
|
+
tie %h, 'Voxgig::Struct::OrderedHash';
|
|
301
|
+
return \%h;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
# Build a new empty list.
|
|
305
|
+
sub _mklist { return [] }
|
|
306
|
+
|
|
307
|
+
# Detect whether a hash reference is tied to Tie::IxHash (i.e. our map type).
|
|
308
|
+
sub _is_tied_hash {
|
|
309
|
+
my ($ref) = @_;
|
|
310
|
+
return 0 unless defined $ref;
|
|
311
|
+
my $rt = reftype($ref) // '';
|
|
312
|
+
return 0 unless $rt eq 'HASH';
|
|
313
|
+
return defined tied(%$ref) ? 1 : 0;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
# Get the in-order keys of a map (or sorted-as-strings for plain hashes).
|
|
317
|
+
# Works on plain HASH refs AND blessed hash-backed objects (e.g. sentinels).
|
|
318
|
+
sub _map_keys {
|
|
319
|
+
my ($ref) = @_;
|
|
320
|
+
return () unless defined $ref;
|
|
321
|
+
my $rt = reftype($ref) // '';
|
|
322
|
+
return () unless $rt eq 'HASH';
|
|
323
|
+
if (my $tied = tied(%$ref)) {
|
|
324
|
+
return $tied->Keys;
|
|
325
|
+
}
|
|
326
|
+
return keys %$ref;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
# Ensure a hash is tied to Tie::IxHash (preserving current keys/values in
|
|
330
|
+
# their existing order). No-op if already tied.
|
|
331
|
+
sub _ensure_ordered {
|
|
332
|
+
my ($ref) = @_;
|
|
333
|
+
return $ref unless ref $ref eq 'HASH';
|
|
334
|
+
return $ref if _is_tied_hash($ref);
|
|
335
|
+
my @pairs;
|
|
336
|
+
push @pairs, $_, $ref->{$_} for keys %$ref;
|
|
337
|
+
%$ref = ();
|
|
338
|
+
tie %$ref, 'Voxgig::Struct::OrderedHash';
|
|
339
|
+
for (my $i = 0; $i < @pairs; $i += 2) {
|
|
340
|
+
$ref->{ $pairs[$i] } = $pairs[ $i + 1 ];
|
|
341
|
+
}
|
|
342
|
+
return $ref;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
# ============================================================================
|
|
346
|
+
# Type predicates
|
|
347
|
+
# ============================================================================
|
|
348
|
+
|
|
349
|
+
# TYPENAME indexed by clz32(typebit): the human name of a type bit-field is the
|
|
350
|
+
# name of its highest set bit (matches canonical getelem(TYPENAME, clz32(t))).
|
|
351
|
+
our @TYPENAME = (
|
|
352
|
+
S_any, S_nil, S_boolean, S_decimal, S_integer, S_number, S_string,
|
|
353
|
+
S_function, S_symbol, S_null,
|
|
354
|
+
'', '', '', '', '', '', '',
|
|
355
|
+
S_list, S_map, S_instance,
|
|
356
|
+
'', '', '', '',
|
|
357
|
+
S_scalar, S_node,
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
sub typename {
|
|
361
|
+
my ($t) = @_;
|
|
362
|
+
$t = 0 unless defined $t;
|
|
363
|
+
$t = int($t) & 0xFFFFFFFF;
|
|
364
|
+
return $TYPENAME[0] if $t == 0;
|
|
365
|
+
# clz32: index of the highest set bit, counted from the top of 32 bits.
|
|
366
|
+
my $hb = 0;
|
|
367
|
+
my $v = $t;
|
|
368
|
+
while ($v > 1) { $v >>= 1; $hb++ }
|
|
369
|
+
my $clz = 31 - $hb;
|
|
370
|
+
my $name = $TYPENAME[$clz];
|
|
371
|
+
return (defined $name && $name ne '') ? $name : $TYPENAME[0];
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
sub getdef {
|
|
375
|
+
my ($val, $alt) = @_;
|
|
376
|
+
return is_none($val) ? $alt : (defined $val ? $val : $alt);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
sub isnode {
|
|
380
|
+
my ($val) = @_;
|
|
381
|
+
return 0 unless defined $val;
|
|
382
|
+
return 0 if is_none($val) || is_jnull($val) || is_sentinel($val) || is_jbool($val);
|
|
383
|
+
return 0 unless ref $val;
|
|
384
|
+
my $r = reftype($val) // ref($val);
|
|
385
|
+
return 1 if $r eq 'HASH' || $r eq 'ARRAY';
|
|
386
|
+
return 0;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
sub ismap {
|
|
390
|
+
my ($val) = @_;
|
|
391
|
+
return 0 unless defined $val;
|
|
392
|
+
return 0 if is_none($val) || is_jnull($val) || is_sentinel($val) || is_jbool($val);
|
|
393
|
+
return 0 unless ref $val;
|
|
394
|
+
my $r = reftype($val) // ref($val);
|
|
395
|
+
return $r eq 'HASH' ? 1 : 0;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
sub islist {
|
|
399
|
+
my ($val) = @_;
|
|
400
|
+
return 0 unless defined $val;
|
|
401
|
+
return 0 if is_none($val) || is_jnull($val) || is_sentinel($val) || is_jbool($val);
|
|
402
|
+
return 0 unless ref $val;
|
|
403
|
+
my $r = reftype($val) // ref($val);
|
|
404
|
+
return $r eq 'ARRAY' ? 1 : 0;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
sub iskey {
|
|
408
|
+
my ($k) = @_;
|
|
409
|
+
return 0 unless defined $k;
|
|
410
|
+
return 0 if is_none($k) || is_jnull($k);
|
|
411
|
+
if (!ref $k) {
|
|
412
|
+
return 0 if $k eq '';
|
|
413
|
+
# Either a non-empty string, or a number.
|
|
414
|
+
return 1;
|
|
415
|
+
}
|
|
416
|
+
return 0;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
sub isempty {
|
|
420
|
+
my ($val) = @_;
|
|
421
|
+
return 1 if !defined $val || is_none($val) || is_jnull($val);
|
|
422
|
+
if (!ref $val) {
|
|
423
|
+
return $val eq '' ? 1 : 0;
|
|
424
|
+
}
|
|
425
|
+
if (islist($val)) { return @$val == 0 ? 1 : 0 }
|
|
426
|
+
if (ismap($val)) { return _map_keys($val) == 0 ? 1 : 0 }
|
|
427
|
+
return 0;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
sub isfunc {
|
|
431
|
+
my ($val) = @_;
|
|
432
|
+
return defined $val && ref $val eq 'CODE' ? 1 : 0;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
sub size {
|
|
436
|
+
my ($val) = @_;
|
|
437
|
+
return 0 if !defined $val || is_none($val) || is_jnull($val);
|
|
438
|
+
if (is_jbool($val)) { return $$val ? 1 : 0 }
|
|
439
|
+
if (ref $val) {
|
|
440
|
+
if (islist($val)) { return scalar @$val }
|
|
441
|
+
if (ismap($val)) { return scalar _map_keys($val) }
|
|
442
|
+
return 0;
|
|
443
|
+
}
|
|
444
|
+
if (looks_like_number($val) && "$val" !~ /[^0-9eE.+\-]/) {
|
|
445
|
+
# Number: floor.
|
|
446
|
+
my $n = 0 + $val;
|
|
447
|
+
return int($n); # int() in Perl truncates toward zero; matches floor for >=0
|
|
448
|
+
}
|
|
449
|
+
return length($val);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
# Slice a list, string or number (clamp). Negative indices supported.
|
|
453
|
+
# When `mutate` is set, mutates the list in place.
|
|
454
|
+
sub slice {
|
|
455
|
+
my ($val, $start, $end, $mutate) = @_;
|
|
456
|
+
if (defined $val && !ref($val) && looks_like_number($val) && $val !~ /[^0-9eE.+\-]/ && $val ne '') {
|
|
457
|
+
# Number → clamp.
|
|
458
|
+
my $lo = (defined $start && looks_like_number($start)) ? 0 + $start : -2**52;
|
|
459
|
+
my $hi = (defined $end && looks_like_number($end)) ? (0 + $end) - 1 : 2**52;
|
|
460
|
+
my $v = 0 + $val;
|
|
461
|
+
$v = $lo if $v < $lo;
|
|
462
|
+
$v = $hi if $v > $hi;
|
|
463
|
+
return $v;
|
|
464
|
+
}
|
|
465
|
+
my $vlen = size($val);
|
|
466
|
+
if (defined $end && !defined $start) { $start = 0 }
|
|
467
|
+
if (defined $start) {
|
|
468
|
+
if ($start < 0) {
|
|
469
|
+
$end = $vlen + $start;
|
|
470
|
+
$end = 0 if $end < 0;
|
|
471
|
+
$start = 0;
|
|
472
|
+
}
|
|
473
|
+
elsif (defined $end) {
|
|
474
|
+
if ($end < 0) {
|
|
475
|
+
$end = $vlen + $end;
|
|
476
|
+
$end = 0 if $end < 0;
|
|
477
|
+
}
|
|
478
|
+
elsif ($vlen < $end) {
|
|
479
|
+
$end = $vlen;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
$end = $vlen;
|
|
484
|
+
}
|
|
485
|
+
$start = $vlen if $vlen < $start;
|
|
486
|
+
if (-1 < $start && $start <= $end && $end <= $vlen) {
|
|
487
|
+
if (islist($val)) {
|
|
488
|
+
if ($mutate) {
|
|
489
|
+
my @kept = @{$val}[ $start .. $end - 1 ];
|
|
490
|
+
@$val = @kept;
|
|
491
|
+
return $val;
|
|
492
|
+
}
|
|
493
|
+
return [ @{$val}[ $start .. $end - 1 ] ];
|
|
494
|
+
}
|
|
495
|
+
elsif (!ref $val) {
|
|
496
|
+
return substr($val, $start, $end - $start);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
if (islist($val)) {
|
|
501
|
+
@$val = () if $mutate;
|
|
502
|
+
return $mutate ? $val : [];
|
|
503
|
+
}
|
|
504
|
+
elsif (!ref $val) {
|
|
505
|
+
return '';
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return $val;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
sub pad {
|
|
513
|
+
my ($str, $padding, $padchar) = @_;
|
|
514
|
+
$str = _is_string_sv($str) ? $str : stringify($str);
|
|
515
|
+
$padding = 44 unless defined $padding;
|
|
516
|
+
# Use the first character of padchar (or a space); a multi-char padchar
|
|
517
|
+
# collapses to its first char, matching the canonical TS implementation.
|
|
518
|
+
$padchar = (defined $padchar && length $padchar) ? substr($padchar, 0, 1) : ' ';
|
|
519
|
+
my $s = "$str";
|
|
520
|
+
my $need = abs($padding) - length($s);
|
|
521
|
+
return $s if $need <= 0;
|
|
522
|
+
my $fill = $padchar x $need;
|
|
523
|
+
return $padding < 0 ? $fill . $s : $s . $fill;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
# Compute a bit-flag describing the type of value.
|
|
527
|
+
sub typify {
|
|
528
|
+
my ($value) = @_;
|
|
529
|
+
return T_noval if !defined $value || is_none($value);
|
|
530
|
+
return T_scalar | T_null if is_jnull($value);
|
|
531
|
+
if (is_jbool($value)) { return T_scalar | T_boolean }
|
|
532
|
+
if (is_sentinel($value)) { return T_node | T_map }
|
|
533
|
+
if (ref $value) {
|
|
534
|
+
if (islist($value)) { return T_node | T_list }
|
|
535
|
+
if (isfunc($value)) { return T_scalar | T_function }
|
|
536
|
+
if (ismap($value)) { return T_node | T_map }
|
|
537
|
+
return T_node | T_instance;
|
|
538
|
+
}
|
|
539
|
+
# Scalar.
|
|
540
|
+
if (_is_number_sv($value)) {
|
|
541
|
+
if ($value =~ /[.eE]/ || (int($value) != $value)) {
|
|
542
|
+
return T_scalar | T_number | T_decimal;
|
|
543
|
+
}
|
|
544
|
+
return T_scalar | T_number | T_integer;
|
|
545
|
+
}
|
|
546
|
+
return T_scalar | T_string;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
# Get an element from a list with negative-index support and a fallback.
|
|
550
|
+
# Mirrors TS getelem.
|
|
551
|
+
sub getelem {
|
|
552
|
+
my ($val, $key, $alt) = @_;
|
|
553
|
+
$alt = is_none($_[2]) ? $NONE : (exists $_[2] ? $alt : $NONE);
|
|
554
|
+
return $alt unless islist($val);
|
|
555
|
+
my $len = scalar @$val;
|
|
556
|
+
my $k;
|
|
557
|
+
if (defined $key && !ref($key) && looks_like_number($key)) { $k = int($key) }
|
|
558
|
+
elsif (ref $key eq 'CODE') {
|
|
559
|
+
# Fallback callback (TS supports getelem(val, key, () => ...)).
|
|
560
|
+
return $key->();
|
|
561
|
+
}
|
|
562
|
+
else { return $alt }
|
|
563
|
+
$k = $len + $k if $k < 0;
|
|
564
|
+
return $alt if $k < 0 || $k >= $len;
|
|
565
|
+
my $v = $val->[$k];
|
|
566
|
+
# A null (or absent/NONE) slot counts as "no value" → alt, the same
|
|
567
|
+
# Group A rule getprop applies; a function alt is called.
|
|
568
|
+
if (!defined $v || is_none($v) || is_jnull($v)) {
|
|
569
|
+
return (typify($alt) & T_function) ? $alt->() : $alt;
|
|
570
|
+
}
|
|
571
|
+
return $v;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
sub getprop {
|
|
575
|
+
my ($val, $key, $alt) = @_;
|
|
576
|
+
$alt = NONE() unless exists $_[2];
|
|
577
|
+
return $alt unless defined $val && ref $val;
|
|
578
|
+
if (islist($val)) {
|
|
579
|
+
return getelem($val, $key, $alt);
|
|
580
|
+
}
|
|
581
|
+
if (ismap($val)) {
|
|
582
|
+
my $k = strkey($key);
|
|
583
|
+
return $alt if $k eq '';
|
|
584
|
+
return $alt unless exists $val->{$k};
|
|
585
|
+
my $v = $val->{$k};
|
|
586
|
+
# Group A semantics: stored null counts as absent for getprop.
|
|
587
|
+
return $alt if !defined $v || is_jnull($v) || is_none($v);
|
|
588
|
+
return $v;
|
|
589
|
+
}
|
|
590
|
+
return $alt;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
# Group B: read raw stored value (including JSON null) at a slot.
|
|
594
|
+
sub _lookup {
|
|
595
|
+
my ($val, $key) = @_;
|
|
596
|
+
return NONE() unless defined $val && ref $val;
|
|
597
|
+
if (islist($val)) {
|
|
598
|
+
return NONE() unless defined $key && !ref($key) && looks_like_number($key);
|
|
599
|
+
my $k = int($key);
|
|
600
|
+
my $len = scalar @$val;
|
|
601
|
+
$k = $len + $k if $k < 0;
|
|
602
|
+
return NONE() if $k < 0 || $k >= $len;
|
|
603
|
+
my $v = $val->[$k];
|
|
604
|
+
return is_none($v) ? NONE() : $v;
|
|
605
|
+
}
|
|
606
|
+
if (ismap($val)) {
|
|
607
|
+
my $k = strkey($key);
|
|
608
|
+
return NONE() if $k eq '';
|
|
609
|
+
return NONE() unless exists $val->{$k};
|
|
610
|
+
return $val->{$k};
|
|
611
|
+
}
|
|
612
|
+
return NONE();
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
sub strkey {
|
|
616
|
+
my ($key) = @_;
|
|
617
|
+
return S_MT if !defined $key || is_none($key);
|
|
618
|
+
my $t = typify($key);
|
|
619
|
+
if ($t & T_string) { return $key }
|
|
620
|
+
if ($t & T_boolean) { return S_MT }
|
|
621
|
+
if ($t & T_number) {
|
|
622
|
+
# Integers stringify as-is; non-integers truncate toward zero.
|
|
623
|
+
return ($key == int($key)) ? "" . $key : "" . int($key);
|
|
624
|
+
}
|
|
625
|
+
return S_MT;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
sub keysof {
|
|
629
|
+
my ($val) = @_;
|
|
630
|
+
return [] unless defined $val && ref $val;
|
|
631
|
+
if (islist($val)) {
|
|
632
|
+
my @k = map { "$_" } 0 .. $#$val;
|
|
633
|
+
return \@k;
|
|
634
|
+
}
|
|
635
|
+
if (ismap($val)) {
|
|
636
|
+
my @keys = _map_keys($val);
|
|
637
|
+
return [ sort @keys ];
|
|
638
|
+
}
|
|
639
|
+
return [];
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
sub haskey {
|
|
643
|
+
my ($val, $key) = @_;
|
|
644
|
+
return 0 unless defined $val && ref $val;
|
|
645
|
+
if (islist($val)) {
|
|
646
|
+
return 0 unless defined $key && !ref($key) && looks_like_number($key);
|
|
647
|
+
my $k = int($key);
|
|
648
|
+
my $len = scalar @$val;
|
|
649
|
+
$k = $len + $k if $k < 0;
|
|
650
|
+
return 0 if $k < 0 || $k >= $len;
|
|
651
|
+
my $v = $val->[$k];
|
|
652
|
+
return (defined $v && !is_jnull($v) && !is_none($v)) ? 1 : 0;
|
|
653
|
+
}
|
|
654
|
+
if (ismap($val)) {
|
|
655
|
+
my $k = strkey($key);
|
|
656
|
+
return 0 if $k eq '';
|
|
657
|
+
return 0 unless exists $val->{$k};
|
|
658
|
+
my $v = $val->{$k};
|
|
659
|
+
return (defined $v && !is_jnull($v) && !is_none($v)) ? 1 : 0;
|
|
660
|
+
}
|
|
661
|
+
return 0;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
# items: return [ [k0,v0], [k1,v1] ... ]. With $apply, apply to each pair.
|
|
665
|
+
sub items {
|
|
666
|
+
my ($val, $apply) = @_;
|
|
667
|
+
my $islist = islist($val);
|
|
668
|
+
my @out;
|
|
669
|
+
# keysof() returns sorted map keys (and '0','1',… for lists), so items are
|
|
670
|
+
# in the same order the canonical implementation produces.
|
|
671
|
+
for my $k (@{ keysof($val) }) {
|
|
672
|
+
my $v = $islist ? $val->[$k] : $val->{$k};
|
|
673
|
+
my $pair = [ "$k", $v ];
|
|
674
|
+
push @out, defined $apply ? $apply->($pair) : $pair;
|
|
675
|
+
}
|
|
676
|
+
return \@out;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
sub flatten {
|
|
680
|
+
my ($list, $depth) = @_;
|
|
681
|
+
return $list unless islist($list);
|
|
682
|
+
$depth = getdef($depth, 1);
|
|
683
|
+
return _flatten_depth($list, $depth);
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
sub _flatten_depth {
|
|
687
|
+
my ($list, $depth) = @_;
|
|
688
|
+
my @out;
|
|
689
|
+
for my $item (@$list) {
|
|
690
|
+
if ($depth > 0 && islist($item)) {
|
|
691
|
+
push @out, @{ _flatten_depth($item, $depth - 1) };
|
|
692
|
+
}
|
|
693
|
+
else {
|
|
694
|
+
push @out, $item;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
return \@out;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
# Filter a list or map by predicate. Lists return [v...]; maps return [[k,v]...].
|
|
701
|
+
sub filter {
|
|
702
|
+
my ($val, $pred) = @_;
|
|
703
|
+
return [] unless defined $val && ref $val;
|
|
704
|
+
my @out;
|
|
705
|
+
if (islist($val)) {
|
|
706
|
+
for (my $i = 0; $i < @$val; $i++) {
|
|
707
|
+
my $pair = [ "$i", $val->[$i] ];
|
|
708
|
+
push @out, $val->[$i] if $pred->($pair);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
elsif (ismap($val)) {
|
|
712
|
+
for my $k (_map_keys($val)) {
|
|
713
|
+
my $pair = [ "$k", $val->{$k} ];
|
|
714
|
+
push @out, $val->{$k} if $pred->($pair);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
return \@out;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
# Escape a string for use as a literal pattern in a regular expression.
|
|
721
|
+
sub escre {
|
|
722
|
+
my ($s) = @_;
|
|
723
|
+
return '' unless defined $s;
|
|
724
|
+
$s = "$s";
|
|
725
|
+
$s =~ s/([.*+?^\${}()|\[\]\\])/\\$1/g;
|
|
726
|
+
return $s;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
# Escape characters that are unsafe in a URL component.
|
|
730
|
+
sub escurl {
|
|
731
|
+
my ($s) = @_;
|
|
732
|
+
return '' unless defined $s;
|
|
733
|
+
$s = "$s";
|
|
734
|
+
$s =~ s/([^A-Za-z0-9\-_.~])/sprintf('%%%02X', ord($1))/ge;
|
|
735
|
+
return $s;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
# Join list parts with a separator. With trailing-separator option.
|
|
739
|
+
sub join {
|
|
740
|
+
my ($arr, $sep, $url) = @_;
|
|
741
|
+
my $sarr = size($arr);
|
|
742
|
+
my $sepdef = getdef($sep, S_CM);
|
|
743
|
+
my $sepre = (size($sepdef) == 1) ? escre($sepdef) : $NONE;
|
|
744
|
+
|
|
745
|
+
# Keep only the non-empty string elements.
|
|
746
|
+
my $inner = filter($arr, sub {
|
|
747
|
+
my $n = $_[0];
|
|
748
|
+
return (0 < (T_string & typify($n->[1]))) && (S_MT ne $n->[1]);
|
|
749
|
+
});
|
|
750
|
+
|
|
751
|
+
# Strip the separator at element boundaries and collapse internal runs of
|
|
752
|
+
# the separator to a single one, so a single sep ends up between elements.
|
|
753
|
+
my $mapped = items($inner, sub {
|
|
754
|
+
my $n = $_[0];
|
|
755
|
+
my $i = 0 + $n->[0];
|
|
756
|
+
my $s = $n->[1];
|
|
757
|
+
if (!is_none($sepre) && S_MT ne $sepre) {
|
|
758
|
+
if ($url && 0 == $i) {
|
|
759
|
+
return re_replace($sepre . '+$', $s, S_MT);
|
|
760
|
+
}
|
|
761
|
+
if (0 < $i) {
|
|
762
|
+
$s = re_replace('^' . $sepre . '+', $s, S_MT);
|
|
763
|
+
}
|
|
764
|
+
if ($i < $sarr - 1 || !$url) {
|
|
765
|
+
$s = re_replace($sepre . '+$', $s, S_MT);
|
|
766
|
+
}
|
|
767
|
+
$s = re_replace(
|
|
768
|
+
'([^' . $sepre . '])' . $sepre . '+([^' . $sepre . '])',
|
|
769
|
+
$s,
|
|
770
|
+
sub { $_[0][1] . $sepdef . $_[0][2] },
|
|
771
|
+
);
|
|
772
|
+
}
|
|
773
|
+
return $s;
|
|
774
|
+
});
|
|
775
|
+
|
|
776
|
+
my $result = filter($mapped, sub { S_MT ne $_[0]->[1] });
|
|
777
|
+
return CORE::join($sepdef, @$result);
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
# Convert a path to a dotted string. depth>0 → start at that depth.
|
|
781
|
+
sub pathify {
|
|
782
|
+
my ($val, $startin, $endin) = @_;
|
|
783
|
+
my $pathstr = $NONE;
|
|
784
|
+
|
|
785
|
+
my $path;
|
|
786
|
+
if (islist($val)) {
|
|
787
|
+
$path = $val;
|
|
788
|
+
}
|
|
789
|
+
elsif (!ref($val) && defined($val) && _is_string_sv($val)) {
|
|
790
|
+
$path = [$val];
|
|
791
|
+
}
|
|
792
|
+
elsif (!ref($val) && defined($val) && _is_number_sv($val)) {
|
|
793
|
+
$path = [$val];
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
$path = $NONE;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
my $start = (!defined $startin) ? 0 : ($startin > -1 ? $startin : 0);
|
|
800
|
+
my $end = (!defined $endin) ? 0 : ($endin > -1 ? $endin : 0);
|
|
801
|
+
|
|
802
|
+
if (!is_none($path) && $start >= 0) {
|
|
803
|
+
$path = slice($path, $start, scalar(@$path) - $end);
|
|
804
|
+
if (scalar(@$path) == 0) {
|
|
805
|
+
$pathstr = '<root>';
|
|
806
|
+
}
|
|
807
|
+
else {
|
|
808
|
+
# Drop non-key segments (booleans, null, nodes); render numbers as
|
|
809
|
+
# truncated integers and strip dots out of string segments.
|
|
810
|
+
my $kept = filter($path, sub { iskey($_[0]->[1]) });
|
|
811
|
+
my $segs = items($kept, sub {
|
|
812
|
+
my $p = $_[0]->[1];
|
|
813
|
+
if (!ref($p) && _is_number_sv($p)) { return S_MT . int($p) }
|
|
814
|
+
my $s = "$p";
|
|
815
|
+
$s =~ s/\.//g;
|
|
816
|
+
return $s;
|
|
817
|
+
});
|
|
818
|
+
$pathstr = Voxgig::Struct::join($segs, S_DT);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
if (is_none($pathstr)) {
|
|
823
|
+
# Canonical NONE is `undefined`, so an absent value renders the same as
|
|
824
|
+
# NONE (no trailing ":value").
|
|
825
|
+
my $absent = is_none($val) || !defined($val);
|
|
826
|
+
$pathstr = '<unknown-path'
|
|
827
|
+
. ($absent ? S_MT : (S_CN . stringify($val, 47)))
|
|
828
|
+
. '>';
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
return $pathstr;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
# Compact-format a JSON-like value to a string (no whitespace).
|
|
835
|
+
sub jsonify {
|
|
836
|
+
my ($val, $flags) = @_;
|
|
837
|
+
# Canonical signature: jsonify(val, { indent => N, offset => M }). Default
|
|
838
|
+
# indent is 2 (pretty). A bare numeric second arg is also accepted as the
|
|
839
|
+
# indent for backward compatibility.
|
|
840
|
+
my $indent = 2;
|
|
841
|
+
my $offset = 0;
|
|
842
|
+
if (defined $flags) {
|
|
843
|
+
if (ismap($flags)) {
|
|
844
|
+
$indent = $flags->{indent} if defined $flags->{indent};
|
|
845
|
+
$offset = $flags->{offset} if defined $flags->{offset};
|
|
846
|
+
}
|
|
847
|
+
elsif (!ref $flags && Scalar::Util::looks_like_number($flags)) {
|
|
848
|
+
$indent = $flags;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
my $str = _jsonify_inner($val, $indent, 0);
|
|
852
|
+
if (defined $offset && $offset > 0) {
|
|
853
|
+
# Left-offset the entire indented JSON so it aligns with surrounding
|
|
854
|
+
# code indented by $offset. The first brace stays on the assignment line.
|
|
855
|
+
my @lines = split /\n/, $str, -1;
|
|
856
|
+
shift @lines;
|
|
857
|
+
my @padded = map { (' ' x $offset) . $_ } @lines;
|
|
858
|
+
$str = "{\n" . CORE::join("\n", @padded);
|
|
859
|
+
}
|
|
860
|
+
return $str;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
sub _jsonify_inner {
|
|
864
|
+
my ($val, $indent, $depth) = @_;
|
|
865
|
+
return 'null' if !defined $val || is_jnull($val);
|
|
866
|
+
return 'null' if is_none($val); # NONE collapses to null when serialised.
|
|
867
|
+
if (is_jbool($val)) { return $$val ? 'true' : 'false' }
|
|
868
|
+
if (is_sentinel($val)) {
|
|
869
|
+
# Sentinel — emit its own backtick marker.
|
|
870
|
+
my ($mark) = _map_keys($val);
|
|
871
|
+
return "\"$mark\"";
|
|
872
|
+
}
|
|
873
|
+
if (!ref $val) {
|
|
874
|
+
if (_is_number_sv($val)) {
|
|
875
|
+
return _format_number($val);
|
|
876
|
+
}
|
|
877
|
+
return _json_string($val);
|
|
878
|
+
}
|
|
879
|
+
if (islist($val)) {
|
|
880
|
+
return '[]' unless @$val;
|
|
881
|
+
my @parts;
|
|
882
|
+
for my $v (@$val) {
|
|
883
|
+
push @parts, _jsonify_inner($v, $indent, $depth + 1);
|
|
884
|
+
}
|
|
885
|
+
if ($indent > 0) {
|
|
886
|
+
my $pad = (' ' x $indent) x ($depth + 1);
|
|
887
|
+
my $end = (' ' x $indent) x $depth;
|
|
888
|
+
return "[\n$pad" . CORE::join(",\n$pad", @parts) . "\n$end]";
|
|
889
|
+
}
|
|
890
|
+
return '[' . CORE::join(',', @parts) . ']';
|
|
891
|
+
}
|
|
892
|
+
if (ismap($val)) {
|
|
893
|
+
my @keys = _map_keys($val);
|
|
894
|
+
return '{}' unless @keys;
|
|
895
|
+
my @parts;
|
|
896
|
+
for my $k (@keys) {
|
|
897
|
+
my $kj = _json_string($k);
|
|
898
|
+
my $vj = _jsonify_inner($val->{$k}, $indent, $depth + 1);
|
|
899
|
+
if ($indent > 0) {
|
|
900
|
+
push @parts, "$kj: $vj";
|
|
901
|
+
}
|
|
902
|
+
else {
|
|
903
|
+
push @parts, "$kj:$vj";
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
if ($indent > 0) {
|
|
907
|
+
my $pad = (' ' x $indent) x ($depth + 1);
|
|
908
|
+
my $end = (' ' x $indent) x $depth;
|
|
909
|
+
return "{\n$pad" . CORE::join(",\n$pad", @parts) . "\n$end}";
|
|
910
|
+
}
|
|
911
|
+
return '{' . CORE::join(',', @parts) . '}';
|
|
912
|
+
}
|
|
913
|
+
if (isfunc($val)) { return '"<function>"' }
|
|
914
|
+
return 'null';
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
# Format a number using TS / JS %g-style: drop trailing zeros, no trailing dot.
|
|
918
|
+
sub _format_number {
|
|
919
|
+
my ($v) = @_;
|
|
920
|
+
if ($v == int($v) && $v !~ /[.eE]/) {
|
|
921
|
+
return "" . int($v);
|
|
922
|
+
}
|
|
923
|
+
my $s = sprintf('%.15g', 0 + $v);
|
|
924
|
+
return $s;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
# Escape and quote a JSON string.
|
|
928
|
+
sub _json_string {
|
|
929
|
+
my ($s) = @_;
|
|
930
|
+
return '""' unless defined $s;
|
|
931
|
+
$s = "$s";
|
|
932
|
+
$s =~ s/\\/\\\\/g;
|
|
933
|
+
$s =~ s/"/\\"/g;
|
|
934
|
+
$s =~ s/\x08/\\b/g;
|
|
935
|
+
$s =~ s/\x09/\\t/g;
|
|
936
|
+
$s =~ s/\x0A/\\n/g;
|
|
937
|
+
$s =~ s/\x0C/\\f/g;
|
|
938
|
+
$s =~ s/\x0D/\\r/g;
|
|
939
|
+
$s =~ s/([\x00-\x1F])/sprintf('\\u%04x', ord($1))/ge;
|
|
940
|
+
return '"' . $s . '"';
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
# Human-friendly stringification (TS canonical stringify): JSON.stringify
|
|
944
|
+
# with a replacer that sorts map keys alphabetically (mirrors TS), then
|
|
945
|
+
# strip all double-quotes. Numbers, booleans and null are emitted as bare
|
|
946
|
+
# values. Strings come out unquoted at the root.
|
|
947
|
+
sub stringify {
|
|
948
|
+
my ($val, $maxlen, $pretty) = @_;
|
|
949
|
+
return $pretty ? '<>' : '' if is_none($val);
|
|
950
|
+
my $s;
|
|
951
|
+
if (!defined $val) {
|
|
952
|
+
$s = '';
|
|
953
|
+
}
|
|
954
|
+
elsif (!ref $val && _is_string_sv($val)) {
|
|
955
|
+
$s = $val;
|
|
956
|
+
}
|
|
957
|
+
else {
|
|
958
|
+
$s = _stringify_inner($val, 1);
|
|
959
|
+
$s =~ s/"//g;
|
|
960
|
+
}
|
|
961
|
+
if (defined $maxlen && $maxlen > -1) {
|
|
962
|
+
if (length($s) > $maxlen) {
|
|
963
|
+
$s = substr($s, 0, $maxlen - 3) . '...';
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
return $s;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
sub _stringify_inner {
|
|
970
|
+
my ($val, $sort_keys) = @_;
|
|
971
|
+
return 'null' if !defined $val || is_jnull($val) || is_none($val);
|
|
972
|
+
if (is_jbool($val)) { return $$val ? 'true' : 'false' }
|
|
973
|
+
if (is_sentinel($val)) {
|
|
974
|
+
my ($mark) = _map_keys($val);
|
|
975
|
+
return "\"$mark\"";
|
|
976
|
+
}
|
|
977
|
+
if (!ref $val) {
|
|
978
|
+
if (_is_number_sv($val)) { return _format_number($val) }
|
|
979
|
+
return _json_string($val);
|
|
980
|
+
}
|
|
981
|
+
if (islist($val)) {
|
|
982
|
+
return '[]' unless @$val;
|
|
983
|
+
return '[' . CORE::join(',', map { _stringify_inner($_, $sort_keys) } @$val) . ']';
|
|
984
|
+
}
|
|
985
|
+
if (ismap($val)) {
|
|
986
|
+
my @keys = _map_keys($val);
|
|
987
|
+
@keys = sort @keys if $sort_keys;
|
|
988
|
+
return '{}' unless @keys;
|
|
989
|
+
my @parts = map {
|
|
990
|
+
_json_string($_) . ':' . _stringify_inner($val->{$_}, $sort_keys)
|
|
991
|
+
} @keys;
|
|
992
|
+
return '{' . CORE::join(',', @parts) . '}';
|
|
993
|
+
}
|
|
994
|
+
if (isfunc($val)) { return '"<function>"' }
|
|
995
|
+
return 'null';
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
# Deep clone with reference-stability tracking for shared structures.
|
|
999
|
+
sub clone {
|
|
1000
|
+
my ($val) = @_;
|
|
1001
|
+
return _clone_inner($val, {});
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
sub _clone_inner {
|
|
1005
|
+
my ($val, $seen) = @_;
|
|
1006
|
+
return $val unless defined $val;
|
|
1007
|
+
return $val if is_none($val) || is_jnull($val) || is_jbool($val);
|
|
1008
|
+
return $val if is_sentinel($val);
|
|
1009
|
+
return $val unless ref $val;
|
|
1010
|
+
return $val if isfunc($val);
|
|
1011
|
+
my $addr = refaddr($val);
|
|
1012
|
+
return $seen->{$addr} if defined $addr && exists $seen->{$addr};
|
|
1013
|
+
if (islist($val)) {
|
|
1014
|
+
my $out = [];
|
|
1015
|
+
$seen->{$addr} = $out if defined $addr;
|
|
1016
|
+
push @$out, _clone_inner($_, $seen) for @$val;
|
|
1017
|
+
return $out;
|
|
1018
|
+
}
|
|
1019
|
+
if (ismap($val)) {
|
|
1020
|
+
my $out = _mkmap();
|
|
1021
|
+
$seen->{$addr} = $out if defined $addr;
|
|
1022
|
+
for my $k (_map_keys($val)) {
|
|
1023
|
+
$out->{$k} = _clone_inner($val->{$k}, $seen);
|
|
1024
|
+
}
|
|
1025
|
+
return $out;
|
|
1026
|
+
}
|
|
1027
|
+
return $val;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
# Delete a property; safe on lists (negative index) and maps.
|
|
1031
|
+
sub delprop {
|
|
1032
|
+
my ($val, $key) = @_;
|
|
1033
|
+
return $val unless defined $val && ref $val;
|
|
1034
|
+
if (islist($val)) {
|
|
1035
|
+
return $val unless defined $key && !ref($key) && looks_like_number($key);
|
|
1036
|
+
my $k = int($key);
|
|
1037
|
+
my $len = scalar @$val;
|
|
1038
|
+
# A negative or out-of-bounds index is a no-op (no end-relative delete).
|
|
1039
|
+
return $val if $k < 0 || $k >= $len;
|
|
1040
|
+
splice(@$val, $k, 1);
|
|
1041
|
+
return $val;
|
|
1042
|
+
}
|
|
1043
|
+
if (ismap($val)) {
|
|
1044
|
+
my $k = strkey($key);
|
|
1045
|
+
return $val if $k eq '';
|
|
1046
|
+
delete $val->{$k};
|
|
1047
|
+
return $val;
|
|
1048
|
+
}
|
|
1049
|
+
return $val;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
# Set a property; sentinels SKIP/DELETE handled specially.
|
|
1053
|
+
sub setprop {
|
|
1054
|
+
my ($val, $key, $newval) = @_;
|
|
1055
|
+
return $val unless defined $val && ref $val;
|
|
1056
|
+
if (is_sentinel($newval)) {
|
|
1057
|
+
my ($mark) = _map_keys($newval);
|
|
1058
|
+
if ($mark eq '`$SKIP`') { return $val }
|
|
1059
|
+
if ($mark eq '`$DELETE`') { return delprop($val, $key) }
|
|
1060
|
+
}
|
|
1061
|
+
if (is_none($newval)) { return delprop($val, $key) }
|
|
1062
|
+
if (islist($val)) {
|
|
1063
|
+
return $val unless defined $key && !ref($key) && looks_like_number($key);
|
|
1064
|
+
my $k = int($key);
|
|
1065
|
+
my $len = scalar @$val;
|
|
1066
|
+
if ($k >= 0) {
|
|
1067
|
+
# Set or append; an out-of-bounds index clamps to the end (append).
|
|
1068
|
+
$k = $len if $k > $len;
|
|
1069
|
+
$val->[$k] = $newval;
|
|
1070
|
+
}
|
|
1071
|
+
else {
|
|
1072
|
+
# A negative index prepends.
|
|
1073
|
+
unshift @$val, $newval;
|
|
1074
|
+
}
|
|
1075
|
+
return $val;
|
|
1076
|
+
}
|
|
1077
|
+
if (ismap($val)) {
|
|
1078
|
+
my $k = strkey($key);
|
|
1079
|
+
return $val if $k eq '';
|
|
1080
|
+
$val->{$k} = $newval;
|
|
1081
|
+
return $val;
|
|
1082
|
+
}
|
|
1083
|
+
return $val;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
1; # End of Voxgig::Struct (more to come).
|
|
1087
|
+
|
|
1088
|
+
# ============================================================================
|
|
1089
|
+
# Insertion-order-preserving JSON parser.
|
|
1090
|
+
# Needed because Cpanel::JSON::XS / JSON::PP return plain Perl hashes whose
|
|
1091
|
+
# key order is randomised. We hand-roll a minimal recursive-descent parser
|
|
1092
|
+
# that builds Tie::IxHash maps. Numbers stay as Perl scalars; booleans
|
|
1093
|
+
# become $JTRUE / $JFALSE; null becomes $JNULL; strings stay scalar.
|
|
1094
|
+
# ============================================================================
|
|
1095
|
+
|
|
1096
|
+
package Voxgig::Struct::JsonParser;
|
|
1097
|
+
use strict;
|
|
1098
|
+
use warnings;
|
|
1099
|
+
use Scalar::Util qw();
|
|
1100
|
+
|
|
1101
|
+
sub parse {
|
|
1102
|
+
my ($text) = @_;
|
|
1103
|
+
my $self = bless { text => $text, pos => 0, len => length($text) }, __PACKAGE__;
|
|
1104
|
+
$self->_skip_ws;
|
|
1105
|
+
my $v = $self->_parse_value;
|
|
1106
|
+
$self->_skip_ws;
|
|
1107
|
+
die "JSON: trailing data at pos $self->{pos}" if $self->{pos} < $self->{len};
|
|
1108
|
+
return $v;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
sub _skip_ws {
|
|
1112
|
+
my ($self) = @_;
|
|
1113
|
+
while ($self->{pos} < $self->{len}) {
|
|
1114
|
+
my $c = substr($self->{text}, $self->{pos}, 1);
|
|
1115
|
+
last unless $c eq ' ' || $c eq "\t" || $c eq "\n" || $c eq "\r";
|
|
1116
|
+
$self->{pos}++;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
sub _peek {
|
|
1121
|
+
my ($self) = @_;
|
|
1122
|
+
return $self->{pos} < $self->{len} ? substr($self->{text}, $self->{pos}, 1) : '';
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
sub _parse_value {
|
|
1126
|
+
my ($self) = @_;
|
|
1127
|
+
$self->_skip_ws;
|
|
1128
|
+
my $c = $self->_peek;
|
|
1129
|
+
return $self->_parse_object if $c eq '{';
|
|
1130
|
+
return $self->_parse_array if $c eq '[';
|
|
1131
|
+
return $self->_parse_string if $c eq '"';
|
|
1132
|
+
return $self->_parse_keyword if $c eq 't' || $c eq 'f' || $c eq 'n';
|
|
1133
|
+
return $self->_parse_number;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
sub _parse_object {
|
|
1137
|
+
my ($self) = @_;
|
|
1138
|
+
$self->{pos}++; # consume {
|
|
1139
|
+
my %h;
|
|
1140
|
+
tie %h, 'Voxgig::Struct::OrderedHash';
|
|
1141
|
+
$self->_skip_ws;
|
|
1142
|
+
if ($self->_peek eq '}') { $self->{pos}++; return \%h }
|
|
1143
|
+
while (1) {
|
|
1144
|
+
$self->_skip_ws;
|
|
1145
|
+
die "JSON: expected string key at pos $self->{pos}" unless $self->_peek eq '"';
|
|
1146
|
+
my $k = $self->_parse_string;
|
|
1147
|
+
$self->_skip_ws;
|
|
1148
|
+
die "JSON: expected : at pos $self->{pos}" unless $self->_peek eq ':';
|
|
1149
|
+
$self->{pos}++;
|
|
1150
|
+
my $v = $self->_parse_value;
|
|
1151
|
+
$h{$k} = $v;
|
|
1152
|
+
$self->_skip_ws;
|
|
1153
|
+
my $c = $self->_peek;
|
|
1154
|
+
if ($c eq ',') { $self->{pos}++; next }
|
|
1155
|
+
if ($c eq '}') { $self->{pos}++; last }
|
|
1156
|
+
die "JSON: expected , or } at pos $self->{pos}";
|
|
1157
|
+
}
|
|
1158
|
+
return \%h;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
sub _parse_array {
|
|
1162
|
+
my ($self) = @_;
|
|
1163
|
+
$self->{pos}++; # consume [
|
|
1164
|
+
my @a;
|
|
1165
|
+
$self->_skip_ws;
|
|
1166
|
+
if ($self->_peek eq ']') { $self->{pos}++; return \@a }
|
|
1167
|
+
while (1) {
|
|
1168
|
+
my $v = $self->_parse_value;
|
|
1169
|
+
push @a, $v;
|
|
1170
|
+
$self->_skip_ws;
|
|
1171
|
+
my $c = $self->_peek;
|
|
1172
|
+
if ($c eq ',') { $self->{pos}++; next }
|
|
1173
|
+
if ($c eq ']') { $self->{pos}++; last }
|
|
1174
|
+
die "JSON: expected , or ] at pos $self->{pos}";
|
|
1175
|
+
}
|
|
1176
|
+
return \@a;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
sub _parse_string {
|
|
1180
|
+
my ($self) = @_;
|
|
1181
|
+
$self->{pos}++; # consume "
|
|
1182
|
+
my $out = '';
|
|
1183
|
+
while ($self->{pos} < $self->{len}) {
|
|
1184
|
+
my $c = substr($self->{text}, $self->{pos}, 1);
|
|
1185
|
+
if ($c eq '"') { $self->{pos}++; return $out }
|
|
1186
|
+
if ($c eq '\\') {
|
|
1187
|
+
my $esc = substr($self->{text}, $self->{pos} + 1, 1);
|
|
1188
|
+
if ($esc eq '"') { $out .= '"'; $self->{pos} += 2 }
|
|
1189
|
+
elsif ($esc eq '\\') { $out .= '\\'; $self->{pos} += 2 }
|
|
1190
|
+
elsif ($esc eq '/') { $out .= '/'; $self->{pos} += 2 }
|
|
1191
|
+
elsif ($esc eq 'b') { $out .= "\x08"; $self->{pos} += 2 }
|
|
1192
|
+
elsif ($esc eq 'f') { $out .= "\x0C"; $self->{pos} += 2 }
|
|
1193
|
+
elsif ($esc eq 'n') { $out .= "\x0A"; $self->{pos} += 2 }
|
|
1194
|
+
elsif ($esc eq 'r') { $out .= "\x0D"; $self->{pos} += 2 }
|
|
1195
|
+
elsif ($esc eq 't') { $out .= "\x09"; $self->{pos} += 2 }
|
|
1196
|
+
elsif ($esc eq 'u') {
|
|
1197
|
+
my $hex = substr($self->{text}, $self->{pos} + 2, 4);
|
|
1198
|
+
$out .= chr(hex($hex));
|
|
1199
|
+
$self->{pos} += 6;
|
|
1200
|
+
}
|
|
1201
|
+
else {
|
|
1202
|
+
$out .= $esc;
|
|
1203
|
+
$self->{pos} += 2;
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
else {
|
|
1207
|
+
$out .= $c;
|
|
1208
|
+
$self->{pos}++;
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
die "JSON: unterminated string";
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
sub _parse_keyword {
|
|
1215
|
+
my ($self) = @_;
|
|
1216
|
+
if (substr($self->{text}, $self->{pos}, 4) eq 'true') {
|
|
1217
|
+
$self->{pos} += 4;
|
|
1218
|
+
return $Voxgig::Struct::JTRUE;
|
|
1219
|
+
}
|
|
1220
|
+
if (substr($self->{text}, $self->{pos}, 5) eq 'false') {
|
|
1221
|
+
$self->{pos} += 5;
|
|
1222
|
+
return $Voxgig::Struct::JFALSE;
|
|
1223
|
+
}
|
|
1224
|
+
if (substr($self->{text}, $self->{pos}, 4) eq 'null') {
|
|
1225
|
+
$self->{pos} += 4;
|
|
1226
|
+
return $Voxgig::Struct::JNULL;
|
|
1227
|
+
}
|
|
1228
|
+
die "JSON: invalid keyword at pos $self->{pos}";
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
sub _parse_number {
|
|
1232
|
+
my ($self) = @_;
|
|
1233
|
+
my $start = $self->{pos};
|
|
1234
|
+
my $c = $self->_peek;
|
|
1235
|
+
$self->{pos}++ if $c eq '-';
|
|
1236
|
+
while ($self->{pos} < $self->{len}) {
|
|
1237
|
+
my $d = substr($self->{text}, $self->{pos}, 1);
|
|
1238
|
+
last unless $d =~ /[0-9.eE+\-]/;
|
|
1239
|
+
$self->{pos}++;
|
|
1240
|
+
}
|
|
1241
|
+
my $s = substr($self->{text}, $start, $self->{pos} - $start);
|
|
1242
|
+
# Force the SV to be IOK or NOK so callers can distinguish from a string.
|
|
1243
|
+
if ($s =~ /[.eE]/) {
|
|
1244
|
+
my $n = 0 + $s;
|
|
1245
|
+
$n += 0; # ensure NOK
|
|
1246
|
+
return $n;
|
|
1247
|
+
}
|
|
1248
|
+
else {
|
|
1249
|
+
my $n = int($s);
|
|
1250
|
+
$n += 0; # ensure IOK
|
|
1251
|
+
return $n;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
package Voxgig::Struct;
|
|
1256
|
+
|
|
1257
|
+
sub parse_json {
|
|
1258
|
+
my ($text) = @_;
|
|
1259
|
+
return Voxgig::Struct::JsonParser::parse($text);
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
# ============================================================================
|
|
1263
|
+
# Walk: recursive descent with before/after callbacks and depth control.
|
|
1264
|
+
# ============================================================================
|
|
1265
|
+
|
|
1266
|
+
sub walk {
|
|
1267
|
+
my ($val, $before, $after, $maxdepth) = @_;
|
|
1268
|
+
$maxdepth = MAXDEPTH unless defined $maxdepth;
|
|
1269
|
+
return _walk_inner($val, undef, undef, [], $before, $after, $maxdepth, 0);
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
sub _walk_inner {
|
|
1273
|
+
my ($val, $key, $parent, $path, $before, $after, $maxdepth, $depth) = @_;
|
|
1274
|
+
if (defined $before) {
|
|
1275
|
+
$val = $before->($key, $val, $parent, $path);
|
|
1276
|
+
}
|
|
1277
|
+
if ($depth >= $maxdepth) {
|
|
1278
|
+
return $val;
|
|
1279
|
+
}
|
|
1280
|
+
if (islist($val)) {
|
|
1281
|
+
for (my $i = 0; $i < @$val; $i++) {
|
|
1282
|
+
my $sub_path = [ @$path, "$i" ];
|
|
1283
|
+
$val->[$i] = _walk_inner($val->[$i], "$i", $val, $sub_path, $before, $after, $maxdepth, $depth + 1);
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
elsif (ismap($val)) {
|
|
1287
|
+
for my $k (_map_keys($val)) {
|
|
1288
|
+
my $sub_path = [ @$path, "$k" ];
|
|
1289
|
+
$val->{$k} = _walk_inner($val->{$k}, $k, $val, $sub_path, $before, $after, $maxdepth, $depth + 1);
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
if (defined $after) {
|
|
1293
|
+
$val = $after->($key, $val, $parent, $path);
|
|
1294
|
+
}
|
|
1295
|
+
return $val;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
# ============================================================================
|
|
1299
|
+
# Merge: deep merge of a list of nodes. Later wins; nodes deep-merge,
|
|
1300
|
+
# scalars overwrite. With $depth=1, only top-level merges.
|
|
1301
|
+
# ============================================================================
|
|
1302
|
+
|
|
1303
|
+
sub merge {
|
|
1304
|
+
my ($vals, $depth) = @_;
|
|
1305
|
+
return $vals unless islist($vals);
|
|
1306
|
+
return unless @$vals;
|
|
1307
|
+
return $vals->[0] if @$vals == 1;
|
|
1308
|
+
my $out = $vals->[0];
|
|
1309
|
+
$depth = MAXDEPTH unless defined $depth;
|
|
1310
|
+
for (my $i = 1; $i < @$vals; $i++) {
|
|
1311
|
+
$out = _merge_pair($out, $vals->[$i], $depth, 0);
|
|
1312
|
+
}
|
|
1313
|
+
return $out;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
sub _merge_pair {
|
|
1317
|
+
my ($a, $b, $maxdepth, $depth) = @_;
|
|
1318
|
+
return $b if !defined $a || is_none($a);
|
|
1319
|
+
return $b unless isnode($a);
|
|
1320
|
+
return $b unless isnode($b);
|
|
1321
|
+
return $b if islist($a) != islist($b); # type mismatch → replace
|
|
1322
|
+
if ($depth >= $maxdepth) { return $b }
|
|
1323
|
+
if (islist($a)) {
|
|
1324
|
+
for (my $i = 0; $i < @$b; $i++) {
|
|
1325
|
+
if ($i < @$a) {
|
|
1326
|
+
$a->[$i] = _merge_pair($a->[$i], $b->[$i], $maxdepth, $depth + 1);
|
|
1327
|
+
}
|
|
1328
|
+
else {
|
|
1329
|
+
$a->[$i] = $b->[$i];
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
return $a;
|
|
1333
|
+
}
|
|
1334
|
+
# Map.
|
|
1335
|
+
for my $k (_map_keys($b)) {
|
|
1336
|
+
my $bv = $b->{$k};
|
|
1337
|
+
if (exists $a->{$k}) {
|
|
1338
|
+
$a->{$k} = _merge_pair($a->{$k}, $bv, $maxdepth, $depth + 1);
|
|
1339
|
+
}
|
|
1340
|
+
else {
|
|
1341
|
+
$a->{$k} = $bv;
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
return $a;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
# ============================================================================
|
|
1348
|
+
# setpath: descend a dotted path and set a leaf value (creating maps/lists).
|
|
1349
|
+
# ============================================================================
|
|
1350
|
+
|
|
1351
|
+
sub setpath {
|
|
1352
|
+
my ($store, $path_in, $val, $injdef) = @_;
|
|
1353
|
+
|
|
1354
|
+
# Coerce the path into a parts list via typify, matching canonical:
|
|
1355
|
+
# a list path is used as-is, a string path is dot-split, a number path
|
|
1356
|
+
# becomes a single-element list; anything else returns NONE.
|
|
1357
|
+
my $ptype = typify($path_in);
|
|
1358
|
+
my @parts;
|
|
1359
|
+
if ($ptype & T_list) {
|
|
1360
|
+
@parts = @$path_in;
|
|
1361
|
+
}
|
|
1362
|
+
elsif ($ptype & T_string) {
|
|
1363
|
+
@parts = split /\./, "$path_in", -1;
|
|
1364
|
+
}
|
|
1365
|
+
elsif ($ptype & T_number) {
|
|
1366
|
+
@parts = ($path_in);
|
|
1367
|
+
}
|
|
1368
|
+
else {
|
|
1369
|
+
return NONE();
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
my $base = getprop($injdef, S_base);
|
|
1373
|
+
my $numparts = scalar @parts;
|
|
1374
|
+
# parent = store[base] (defaulting to store), the node we descend from.
|
|
1375
|
+
my $parent = getprop($store, $base, $store);
|
|
1376
|
+
|
|
1377
|
+
for (my $i = 0; $i < $numparts - 1; $i++) {
|
|
1378
|
+
my $part_key = getelem(\@parts, $i);
|
|
1379
|
+
my $next_parent = getprop($parent, $part_key);
|
|
1380
|
+
if (!isnode($next_parent)) {
|
|
1381
|
+
# A list part is created only when the NEXT path part is a real
|
|
1382
|
+
# number; a string-digit (e.g. "0" from a dotted path) makes a map.
|
|
1383
|
+
my $nexttype = typify(getelem(\@parts, $i + 1));
|
|
1384
|
+
$next_parent = ($nexttype & T_number) ? [] : _mkmap();
|
|
1385
|
+
setprop($parent, $part_key, $next_parent);
|
|
1386
|
+
}
|
|
1387
|
+
$parent = $next_parent;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
# setprop already routes a DELETE sentinel (and NONE) to delprop, matching
|
|
1391
|
+
# canonical's `DELETE === val ? delprop(...) : setprop(...)`.
|
|
1392
|
+
my $last = getelem(\@parts, -1);
|
|
1393
|
+
setprop($parent, $last, $val);
|
|
1394
|
+
|
|
1395
|
+
# Return the leaf key's PARENT node (canonical), not the whole store.
|
|
1396
|
+
return $parent;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
# ============================================================================
|
|
1400
|
+
# getpath: descend a dotted path with optional injection context.
|
|
1401
|
+
# Supports ancestor traversal via consecutive dots (".." = parent of parent).
|
|
1402
|
+
# Absolute paths starting with a top-level key; relative paths starting with
|
|
1403
|
+
# "." use the injection's dparent.
|
|
1404
|
+
# ============================================================================
|
|
1405
|
+
|
|
1406
|
+
sub getpath {
|
|
1407
|
+
my ($store, $path_in, $inj) = @_;
|
|
1408
|
+
|
|
1409
|
+
# Coerce path into a parts list. Anything else returns NONE.
|
|
1410
|
+
my @parts;
|
|
1411
|
+
if (islist($path_in)) {
|
|
1412
|
+
@parts = @$path_in;
|
|
1413
|
+
}
|
|
1414
|
+
elsif (defined $path_in && !ref($path_in) && !is_jbool($path_in) && !is_jnull($path_in)) {
|
|
1415
|
+
if (_is_number_sv($path_in)) {
|
|
1416
|
+
@parts = (strkey($path_in));
|
|
1417
|
+
}
|
|
1418
|
+
elsif ("$path_in" eq '') {
|
|
1419
|
+
@parts = ('');
|
|
1420
|
+
}
|
|
1421
|
+
else {
|
|
1422
|
+
@parts = split /\./, "$path_in", -1;
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
else {
|
|
1426
|
+
return NONE();
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
my $val = $store;
|
|
1430
|
+
my $base = defined $inj ? $inj->{base} : undef;
|
|
1431
|
+
my $src = defined $base ? getprop($store, $base, $store) : $store;
|
|
1432
|
+
my $numparts = scalar @parts;
|
|
1433
|
+
my $dparent = defined $inj ? $inj->{dparent} : undef;
|
|
1434
|
+
|
|
1435
|
+
if (!defined $path_in || !defined $store
|
|
1436
|
+
|| ($numparts == 1 && $parts[0] eq S_MT))
|
|
1437
|
+
{
|
|
1438
|
+
$val = $src;
|
|
1439
|
+
}
|
|
1440
|
+
elsif ($numparts > 0) {
|
|
1441
|
+
# Single-part lookup may hit a function.
|
|
1442
|
+
if ($numparts == 1) {
|
|
1443
|
+
$val = getprop($store, $parts[0]);
|
|
1444
|
+
}
|
|
1445
|
+
if (!isfunc($val)) {
|
|
1446
|
+
$val = $src;
|
|
1447
|
+
# Meta-path syntax on first part.
|
|
1448
|
+
if (defined $inj && $inj->{meta} && $parts[0] =~ $R_META_PATH) {
|
|
1449
|
+
my ($name, $sym, $rest) = ($1, $2, $3);
|
|
1450
|
+
$val = getprop($inj->{meta}, $name);
|
|
1451
|
+
$parts[0] = $rest;
|
|
1452
|
+
}
|
|
1453
|
+
my $dpath = defined $inj ? $inj->{dpath} : undef;
|
|
1454
|
+
for (my $pI = 0; defined $val && !is_none($val) && $pI < $numparts; $pI++) {
|
|
1455
|
+
my $part = $parts[$pI];
|
|
1456
|
+
if (defined $inj && defined $part && $part eq S_DKEY) {
|
|
1457
|
+
$part = $inj->{key};
|
|
1458
|
+
}
|
|
1459
|
+
elsif (defined $inj && defined $part && index($part, '$GET:') == 0) {
|
|
1460
|
+
my $sub = substr($part, 5, length($part) - 6);
|
|
1461
|
+
$part = stringify(getpath($src, $sub));
|
|
1462
|
+
}
|
|
1463
|
+
elsif (defined $inj && defined $part && index($part, '$REF:') == 0) {
|
|
1464
|
+
my $sub = substr($part, 5, length($part) - 6);
|
|
1465
|
+
$part = stringify(getpath(getprop($store, S_DSPEC), $sub));
|
|
1466
|
+
}
|
|
1467
|
+
elsif (defined $inj && defined $part && index($part, '$META:') == 0) {
|
|
1468
|
+
my $sub = substr($part, 6, length($part) - 7);
|
|
1469
|
+
$part = stringify(getpath($inj->{meta}, $sub));
|
|
1470
|
+
}
|
|
1471
|
+
$part = '' unless defined $part;
|
|
1472
|
+
$part =~ s/\$\$/\$/g;
|
|
1473
|
+
if ($part eq S_MT) {
|
|
1474
|
+
my $ascends = 0;
|
|
1475
|
+
while ($pI + 1 < $numparts && $parts[$pI + 1] eq S_MT) {
|
|
1476
|
+
$ascends++;
|
|
1477
|
+
$pI++;
|
|
1478
|
+
}
|
|
1479
|
+
if (defined $inj && $ascends > 0) {
|
|
1480
|
+
$ascends-- if $pI == $#parts;
|
|
1481
|
+
if ($ascends == 0) { $val = $dparent }
|
|
1482
|
+
else {
|
|
1483
|
+
my @dp = islist($dpath) ? @$dpath : ();
|
|
1484
|
+
my $cut = @dp - $ascends;
|
|
1485
|
+
$cut = 0 if $cut < 0;
|
|
1486
|
+
my @full = @dp[0 .. $cut - 1];
|
|
1487
|
+
push @full, @parts[$pI + 1 .. $#parts] if $pI + 1 <= $#parts;
|
|
1488
|
+
if ($ascends <= scalar @dp) {
|
|
1489
|
+
$val = getpath($store, \@full);
|
|
1490
|
+
}
|
|
1491
|
+
else { $val = NONE() }
|
|
1492
|
+
last;
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
else {
|
|
1496
|
+
$val = $dparent;
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
else {
|
|
1500
|
+
$val = getprop($val, $part);
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
# Optional handler callback.
|
|
1507
|
+
if (defined $inj && defined $inj->{handler} && isfunc($inj->{handler})) {
|
|
1508
|
+
my $ref = pathify($path_in);
|
|
1509
|
+
$val = $inj->{handler}->($inj, $val, $ref, $store);
|
|
1510
|
+
}
|
|
1511
|
+
return $val;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
# ============================================================================
|
|
1515
|
+
# Injection — recursive state for inject / transform / validate / select.
|
|
1516
|
+
# Modelled as a plain hashref (not a Perl class) to keep the port lean; the
|
|
1517
|
+
# canonical TS Injection methods (`child`, `descend`, `setval`) appear as
|
|
1518
|
+
# helper functions that take the inj hashref as their first argument.
|
|
1519
|
+
# ============================================================================
|
|
1520
|
+
|
|
1521
|
+
# Construct a root Injection bound to a value and its synthetic parent.
|
|
1522
|
+
sub _new_injection {
|
|
1523
|
+
my ($val, $parent) = @_;
|
|
1524
|
+
my $meta = _mkmap();
|
|
1525
|
+
$meta->{'__d'} = 0;
|
|
1526
|
+
return {
|
|
1527
|
+
mode => M_VAL,
|
|
1528
|
+
full => 0,
|
|
1529
|
+
keyI => 0,
|
|
1530
|
+
keys => [S_DTOP],
|
|
1531
|
+
key => S_DTOP,
|
|
1532
|
+
val => $val,
|
|
1533
|
+
parent => $parent,
|
|
1534
|
+
path => [S_DTOP],
|
|
1535
|
+
nodes => [$parent],
|
|
1536
|
+
handler => \&_injecthandler,
|
|
1537
|
+
errs => [],
|
|
1538
|
+
meta => $meta,
|
|
1539
|
+
dparent => $NONE,
|
|
1540
|
+
dpath => [S_DTOP],
|
|
1541
|
+
base => S_DTOP,
|
|
1542
|
+
};
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
# child(keyI, keys): build a child injection for the next descent step.
|
|
1546
|
+
sub _inj_child {
|
|
1547
|
+
my ($inj, $keyI, $keys) = @_;
|
|
1548
|
+
my $key = strkey($keys->[$keyI]);
|
|
1549
|
+
my $val = $inj->{val};
|
|
1550
|
+
my $cinj = _new_injection(getprop($val, $key), $val);
|
|
1551
|
+
$cinj->{keyI} = $keyI;
|
|
1552
|
+
$cinj->{keys} = $keys;
|
|
1553
|
+
$cinj->{key} = $key;
|
|
1554
|
+
$cinj->{path} = [ @{ $inj->{path} || [] }, $key ];
|
|
1555
|
+
$cinj->{nodes} = [ @{ $inj->{nodes} || [] }, $val ];
|
|
1556
|
+
$cinj->{mode} = $inj->{mode};
|
|
1557
|
+
$cinj->{handler} = $inj->{handler};
|
|
1558
|
+
$cinj->{modify} = $inj->{modify};
|
|
1559
|
+
$cinj->{base} = $inj->{base};
|
|
1560
|
+
$cinj->{meta} = $inj->{meta};
|
|
1561
|
+
$cinj->{errs} = $inj->{errs};
|
|
1562
|
+
$cinj->{prior} = $inj;
|
|
1563
|
+
$cinj->{dpath} = [ @{ $inj->{dpath} || [] } ];
|
|
1564
|
+
$cinj->{dparent} = $inj->{dparent};
|
|
1565
|
+
return $cinj;
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
# descend(): step into the current node. dparent walks down by parentkey,
|
|
1569
|
+
# dpath grows or contracts past synthetic $:KEY markers (TS canonical).
|
|
1570
|
+
sub _inj_descend {
|
|
1571
|
+
my ($inj) = @_;
|
|
1572
|
+
$inj->{meta}{'__d'} = ($inj->{meta}{'__d'} // 0) + 1;
|
|
1573
|
+
my $parentkey;
|
|
1574
|
+
my $plen = scalar @{ $inj->{path} || [] };
|
|
1575
|
+
if ($plen >= 2) { $parentkey = $inj->{path}[ $plen - 2 ] }
|
|
1576
|
+
if (is_none($inj->{dparent})) {
|
|
1577
|
+
# No data: still grow dpath so relative paths line up with path.
|
|
1578
|
+
if (defined $inj->{dpath} && scalar(@{ $inj->{dpath} }) > 1 && defined $parentkey) {
|
|
1579
|
+
push @{ $inj->{dpath} }, $parentkey;
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
elsif (defined $parentkey) {
|
|
1583
|
+
$inj->{dparent} = getprop($inj->{dparent}, $parentkey);
|
|
1584
|
+
my $last = (scalar @{ $inj->{dpath} || [] }) > 0
|
|
1585
|
+
? $inj->{dpath}[ scalar(@{ $inj->{dpath} }) - 1 ]
|
|
1586
|
+
: '';
|
|
1587
|
+
if (defined $last && $last eq '$:' . $parentkey) {
|
|
1588
|
+
pop @{ $inj->{dpath} };
|
|
1589
|
+
}
|
|
1590
|
+
else {
|
|
1591
|
+
push @{ $inj->{dpath} }, $parentkey;
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
return $inj->{dparent};
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
# setval(val, ancestor?): write a value into the parent (or a higher
|
|
1598
|
+
# ancestor when ancestor>=2). NONE / SKIP / DELETE delete the slot.
|
|
1599
|
+
sub _inj_setval {
|
|
1600
|
+
my ($inj, $val, $ancestor) = @_;
|
|
1601
|
+
my $target;
|
|
1602
|
+
my $tkey;
|
|
1603
|
+
if (!defined $ancestor || $ancestor < 2) {
|
|
1604
|
+
$target = $inj->{parent};
|
|
1605
|
+
$tkey = $inj->{key};
|
|
1606
|
+
}
|
|
1607
|
+
else {
|
|
1608
|
+
my $nlen = scalar @{ $inj->{nodes} || [] };
|
|
1609
|
+
my $plen = scalar @{ $inj->{path} || [] };
|
|
1610
|
+
return $inj->{parent} if $ancestor > $nlen || $ancestor > $plen;
|
|
1611
|
+
$target = $inj->{nodes}[ $nlen - $ancestor ];
|
|
1612
|
+
$tkey = $inj->{path}[ $plen - $ancestor ];
|
|
1613
|
+
}
|
|
1614
|
+
if (is_none($val)) { delprop($target, $tkey) }
|
|
1615
|
+
else { setprop($target, $tkey, $val) }
|
|
1616
|
+
return $target;
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
# Default inject handler: if the resolved value is a function and the
|
|
1620
|
+
# reference looks like a `$NAME` command, invoke it; otherwise return val.
|
|
1621
|
+
sub _injecthandler {
|
|
1622
|
+
my ($inj, $val, $ref, $store) = @_;
|
|
1623
|
+
my $iscmd = isfunc($val) && (is_none($ref) || (defined $ref && index($ref, S_DS) == 0));
|
|
1624
|
+
if ($iscmd) {
|
|
1625
|
+
return $val->($inj, $val, $ref, $store);
|
|
1626
|
+
}
|
|
1627
|
+
elsif ($inj->{mode} == M_VAL && $inj->{full}) {
|
|
1628
|
+
_inj_setval($inj, $val);
|
|
1629
|
+
}
|
|
1630
|
+
return $val;
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
# Resolve a string scalar that may contain backtick injection refs.
|
|
1634
|
+
# Returns the resolved value (full injection) or the substituted string
|
|
1635
|
+
# (partial injection). Mirrors TS _injectstr.
|
|
1636
|
+
sub _injectstr {
|
|
1637
|
+
my ($val, $store, $inj) = @_;
|
|
1638
|
+
return '' unless defined $val && !ref($val);
|
|
1639
|
+
return '' if $val eq '';
|
|
1640
|
+
# Full injection: pattern is `($NAME or [^`]*)[0-9]*`. The optional
|
|
1641
|
+
# trailing digits are part of the *match* but NOT part of m[1] —
|
|
1642
|
+
# they're an ordering suffix on $NAME commands only. This matches
|
|
1643
|
+
# canonical TS R_INJECTION_FULL exactly.
|
|
1644
|
+
if ($val =~ /^`(\$[A-Z]+|[^`]*)[0-9]*`$/) {
|
|
1645
|
+
my $pathref = $1;
|
|
1646
|
+
$inj->{full} = 1 if defined $inj;
|
|
1647
|
+
if (length($pathref) > 3) {
|
|
1648
|
+
$pathref =~ s/\$BT/`/g;
|
|
1649
|
+
$pathref =~ s/\$DS/\$/g;
|
|
1650
|
+
}
|
|
1651
|
+
return getpath($store, $pathref, $inj);
|
|
1652
|
+
}
|
|
1653
|
+
return $val if index($val, '`') == -1;
|
|
1654
|
+
$inj->{full} = 0 if defined $inj;
|
|
1655
|
+
my $out = $val;
|
|
1656
|
+
$out =~ s{`([^`]+)`}{
|
|
1657
|
+
my $ref = $1;
|
|
1658
|
+
if (length($ref) > 3) {
|
|
1659
|
+
$ref =~ s/\$BT/`/g;
|
|
1660
|
+
$ref =~ s/\$DS/\$/g;
|
|
1661
|
+
}
|
|
1662
|
+
$inj->{full} = 0 if defined $inj;
|
|
1663
|
+
my $found = getpath($store, $ref, $inj);
|
|
1664
|
+
if (is_none($found)) { '' }
|
|
1665
|
+
elsif (!ref $found && _is_string_sv($found)) { $found }
|
|
1666
|
+
elsif (is_jnull($found)) { 'null' }
|
|
1667
|
+
elsif (is_jbool($found)) { $$found ? 'true' : 'false' }
|
|
1668
|
+
elsif (isnode($found)) { _stringify_inner($found, 0) }
|
|
1669
|
+
elsif (!ref $found && _is_number_sv($found)) { _format_number($found) }
|
|
1670
|
+
else { stringify($found) }
|
|
1671
|
+
}ge;
|
|
1672
|
+
if (defined $inj && isfunc($inj->{handler})) {
|
|
1673
|
+
$inj->{full} = 1;
|
|
1674
|
+
$out = $inj->{handler}->($inj, $out, $val, $store);
|
|
1675
|
+
}
|
|
1676
|
+
return $out;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
# Recursive inject. Walks $val, performing 3-phase key injection on each
|
|
1680
|
+
# child of a node, or full / partial string injection on a scalar.
|
|
1681
|
+
sub inject {
|
|
1682
|
+
my ($val, $store, $injdef) = @_;
|
|
1683
|
+
my $inj;
|
|
1684
|
+
if (!defined $injdef || !defined $injdef->{mode}) {
|
|
1685
|
+
my $vp = _mkmap();
|
|
1686
|
+
$vp->{ S_DTOP() } = $val;
|
|
1687
|
+
$inj = _new_injection($val, $vp);
|
|
1688
|
+
$inj->{dparent} = $store;
|
|
1689
|
+
$inj->{errs} = getprop($store, S_DERRS, []);
|
|
1690
|
+
$inj->{meta}{'__d'} = 0;
|
|
1691
|
+
if (defined $injdef) {
|
|
1692
|
+
$inj->{modify} = $injdef->{modify} if defined $injdef->{modify};
|
|
1693
|
+
$inj->{extra} = $injdef->{extra} if defined $injdef->{extra};
|
|
1694
|
+
$inj->{meta} = $injdef->{meta} if defined $injdef->{meta};
|
|
1695
|
+
$inj->{handler} = $injdef->{handler} if defined $injdef->{handler};
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
else {
|
|
1699
|
+
$inj = $injdef;
|
|
1700
|
+
}
|
|
1701
|
+
_inj_descend($inj);
|
|
1702
|
+
|
|
1703
|
+
if (isnode($val)) {
|
|
1704
|
+
my @nodekeys;
|
|
1705
|
+
if (ismap($val)) {
|
|
1706
|
+
my @rawk = _map_keys($val);
|
|
1707
|
+
my @raw = sort @rawk;
|
|
1708
|
+
my @plain = grep { index($_, S_DS) < 0 } @raw;
|
|
1709
|
+
my @cmd = grep { index($_, S_DS) >= 0 } @raw;
|
|
1710
|
+
@nodekeys = (@plain, @cmd);
|
|
1711
|
+
}
|
|
1712
|
+
else {
|
|
1713
|
+
@nodekeys = map { "$_" } 0 .. $#$val;
|
|
1714
|
+
}
|
|
1715
|
+
my $nkI = 0;
|
|
1716
|
+
while ($nkI < scalar @nodekeys) {
|
|
1717
|
+
my $childinj = _inj_child($inj, $nkI, [@nodekeys]);
|
|
1718
|
+
my $nodekey = $childinj->{key};
|
|
1719
|
+
$childinj->{mode} = M_KEYPRE;
|
|
1720
|
+
my $prekey = _injectstr($nodekey, $store, $childinj);
|
|
1721
|
+
$nkI = $childinj->{keyI};
|
|
1722
|
+
@nodekeys = @{ $childinj->{keys} };
|
|
1723
|
+
if (!is_none($prekey)) {
|
|
1724
|
+
$childinj->{val} = getprop($val, $prekey);
|
|
1725
|
+
$childinj->{mode} = M_VAL;
|
|
1726
|
+
inject($childinj->{val}, $store, $childinj);
|
|
1727
|
+
$nkI = $childinj->{keyI};
|
|
1728
|
+
@nodekeys = @{ $childinj->{keys} };
|
|
1729
|
+
$childinj->{mode} = M_KEYPOST;
|
|
1730
|
+
_injectstr($nodekey, $store, $childinj);
|
|
1731
|
+
$nkI = $childinj->{keyI};
|
|
1732
|
+
@nodekeys = @{ $childinj->{keys} };
|
|
1733
|
+
}
|
|
1734
|
+
$nkI++;
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
elsif (defined $val && !ref($val) && _is_string_sv($val)) {
|
|
1738
|
+
$inj->{mode} = M_VAL;
|
|
1739
|
+
$val = _injectstr($val, $store, $inj);
|
|
1740
|
+
if (!(is_sentinel($val) && (_map_keys($val))[0] eq '`$SKIP`')) {
|
|
1741
|
+
_inj_setval($inj, $val);
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
if ($inj->{modify} && !(is_sentinel($val) && (_map_keys($val))[0] eq '`$SKIP`')) {
|
|
1746
|
+
my $mkey = $inj->{key};
|
|
1747
|
+
my $mparent = $inj->{parent};
|
|
1748
|
+
my $mval = getprop($mparent, $mkey);
|
|
1749
|
+
$inj->{modify}->($mval, $mkey, $mparent, $inj, $store);
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
$inj->{val} = $val;
|
|
1753
|
+
return _lookup($inj->{parent}, S_DTOP);
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
# ============================================================================
|
|
1757
|
+
# Builder helpers: jm = JSON-map literal, jt = JSON-list literal.
|
|
1758
|
+
# Both produce insertion-ordered map / list structures from Perl args.
|
|
1759
|
+
# ============================================================================
|
|
1760
|
+
|
|
1761
|
+
sub jm {
|
|
1762
|
+
my $m = _mkmap();
|
|
1763
|
+
for (my $i = 0; $i < @_; $i += 2) {
|
|
1764
|
+
my $k = $_[$i];
|
|
1765
|
+
my $v = $_[ $i + 1 ];
|
|
1766
|
+
$m->{$k} = $v;
|
|
1767
|
+
}
|
|
1768
|
+
return $m;
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
sub jt {
|
|
1772
|
+
return [@_];
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
# ============================================================================
|
|
1776
|
+
# checkPlacement / injectorArgs / injectChild — helpers used by custom
|
|
1777
|
+
# injectors (mirrors TS exports).
|
|
1778
|
+
# ============================================================================
|
|
1779
|
+
|
|
1780
|
+
# Placement names for error messages (a key-mode is "key", value-mode "value").
|
|
1781
|
+
our %PLACEMENT = (
|
|
1782
|
+
M_VAL() => 'value',
|
|
1783
|
+
M_KEYPRE() => S_key,
|
|
1784
|
+
M_KEYPOST() => S_key,
|
|
1785
|
+
);
|
|
1786
|
+
|
|
1787
|
+
sub checkPlacement {
|
|
1788
|
+
my ($modes, $name, $parent_types, $inj) = @_;
|
|
1789
|
+
# modes can be a single mode bitmask. parent_types is a type-flag mask.
|
|
1790
|
+
if (!($inj->{mode} & $modes)) {
|
|
1791
|
+
push @{ $inj->{errs} }, '$' . $name . ': invalid placement as '
|
|
1792
|
+
. ($PLACEMENT{ $inj->{mode} } // 'unknown') . ', expected: '
|
|
1793
|
+
. CORE::join(',', map { $PLACEMENT{$_} // '?' } grep { $modes & $_ } (M_KEYPRE, M_KEYPOST, M_VAL))
|
|
1794
|
+
. '.';
|
|
1795
|
+
return 0;
|
|
1796
|
+
}
|
|
1797
|
+
if ($parent_types) {
|
|
1798
|
+
my $ptype = typify($inj->{parent});
|
|
1799
|
+
if (!($ptype & $parent_types)) {
|
|
1800
|
+
push @{ $inj->{errs} }, '$' . $name . ': invalid placement in parent '
|
|
1801
|
+
. typename($ptype) . ', expected: ' . typename($parent_types) . '.';
|
|
1802
|
+
return 0;
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
return 1;
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
sub injectorArgs {
|
|
1809
|
+
my ($types, $args) = @_;
|
|
1810
|
+
return (NONE(), @$args) unless islist($args);
|
|
1811
|
+
my @out;
|
|
1812
|
+
for (my $i = 0; $i < @$types; $i++) {
|
|
1813
|
+
my $expected = $types->[$i];
|
|
1814
|
+
my $arg = $args->[$i];
|
|
1815
|
+
my $atype = typify($arg);
|
|
1816
|
+
if ($expected != T_any && !($atype & $expected)) {
|
|
1817
|
+
return (
|
|
1818
|
+
'invalid argument: ' . stringify($arg, 22) . ' (' . typename($atype)
|
|
1819
|
+
. ' at position ' . ($i + 1) . ') is not of type: ' . typename($expected) . '.',
|
|
1820
|
+
@$args,
|
|
1821
|
+
);
|
|
1822
|
+
}
|
|
1823
|
+
push @out, $arg;
|
|
1824
|
+
}
|
|
1825
|
+
return (NONE(), @out);
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
sub injectChild {
|
|
1829
|
+
my ($child, $store, $inj) = @_;
|
|
1830
|
+
my $cinj = $inj;
|
|
1831
|
+
if (defined $inj->{prior}) {
|
|
1832
|
+
if (defined $inj->{prior}{prior}) {
|
|
1833
|
+
$cinj = _inj_child($inj->{prior}{prior}, $inj->{prior}{keyI}, $inj->{prior}{keys});
|
|
1834
|
+
$cinj->{val} = $child;
|
|
1835
|
+
setprop($cinj->{parent}, $inj->{prior}{key}, $child);
|
|
1836
|
+
}
|
|
1837
|
+
else {
|
|
1838
|
+
$cinj = _inj_child($inj->{prior}, $inj->{keyI}, $inj->{keys});
|
|
1839
|
+
$cinj->{val} = $child;
|
|
1840
|
+
setprop($cinj->{parent}, $inj->{key}, $child);
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
inject($child, $store, $cinj);
|
|
1844
|
+
return $cinj;
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
# ============================================================================
|
|
1848
|
+
# Transform commands (11)
|
|
1849
|
+
# ============================================================================
|
|
1850
|
+
|
|
1851
|
+
sub transform_DELETE {
|
|
1852
|
+
my ($inj) = @_;
|
|
1853
|
+
_inj_setval($inj, NONE());
|
|
1854
|
+
return NONE();
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
sub transform_COPY {
|
|
1858
|
+
my ($inj, $val, $ref, $store) = @_;
|
|
1859
|
+
return NONE() unless checkPlacement(M_VAL, 'COPY', T_any, $inj);
|
|
1860
|
+
my $out = _lookup($inj->{dparent}, $inj->{key});
|
|
1861
|
+
_inj_setval($inj, $out);
|
|
1862
|
+
return $out;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
sub transform_KEY {
|
|
1866
|
+
my ($inj) = @_;
|
|
1867
|
+
return NONE() if $inj->{mode} != M_VAL;
|
|
1868
|
+
my $parent = $inj->{parent};
|
|
1869
|
+
my $keyspec = _lookup($parent, S_BKEY);
|
|
1870
|
+
if (!is_none($keyspec)) {
|
|
1871
|
+
delprop($parent, S_BKEY);
|
|
1872
|
+
return getprop($inj->{dparent}, $keyspec);
|
|
1873
|
+
}
|
|
1874
|
+
my $anno = _lookup($parent, S_BANNO);
|
|
1875
|
+
my $k = _lookup($anno, S_KEY);
|
|
1876
|
+
if (!is_none($k)) { return $k }
|
|
1877
|
+
return getelem($inj->{path}, -2);
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
sub transform_META {
|
|
1881
|
+
my ($inj) = @_;
|
|
1882
|
+
delprop($inj->{parent}, S_DMETA);
|
|
1883
|
+
return NONE();
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
sub transform_ANNO {
|
|
1887
|
+
my ($inj) = @_;
|
|
1888
|
+
delprop($inj->{parent}, S_BANNO);
|
|
1889
|
+
return NONE();
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
sub transform_MERGE {
|
|
1893
|
+
my ($inj) = @_;
|
|
1894
|
+
my $mode = $inj->{mode};
|
|
1895
|
+
my $key = $inj->{key};
|
|
1896
|
+
my $parent = $inj->{parent};
|
|
1897
|
+
my $out = NONE();
|
|
1898
|
+
if ($mode == M_KEYPRE) { $out = $key }
|
|
1899
|
+
elsif ($mode == M_KEYPOST) {
|
|
1900
|
+
$out = $key;
|
|
1901
|
+
my $args = getprop($parent, $key);
|
|
1902
|
+
$args = islist($args) ? $args : [$args];
|
|
1903
|
+
_inj_setval($inj, NONE());
|
|
1904
|
+
my $merge_list = flatten([[$parent], $args, [clone($parent)]]);
|
|
1905
|
+
merge($merge_list);
|
|
1906
|
+
}
|
|
1907
|
+
return $out;
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
sub transform_EACH {
|
|
1911
|
+
my ($inj, $val, $ref, $store) = @_;
|
|
1912
|
+
return NONE() unless checkPlacement(M_VAL, 'EACH', T_list, $inj);
|
|
1913
|
+
slice($inj->{keys}, 0, 1, 1);
|
|
1914
|
+
my $rest = slice($inj->{parent}, 1);
|
|
1915
|
+
my ($err, $srcpath, $child) = injectorArgs([T_string, T_any], $rest);
|
|
1916
|
+
if (!is_none($err)) {
|
|
1917
|
+
push @{ $inj->{errs} }, '$EACH: ' . $err;
|
|
1918
|
+
return NONE();
|
|
1919
|
+
}
|
|
1920
|
+
my $srcstore = getprop($store, $inj->{base}, $store);
|
|
1921
|
+
my $src = getpath($srcstore, $srcpath, $inj);
|
|
1922
|
+
my $srctype = typify($src);
|
|
1923
|
+
my $tcur = [];
|
|
1924
|
+
my $tval = [];
|
|
1925
|
+
my $tkey = getelem($inj->{path}, -2);
|
|
1926
|
+
my $target = getelem(
|
|
1927
|
+
$inj->{nodes}, -2,
|
|
1928
|
+
sub { getelem($inj->{nodes}, -1) },
|
|
1929
|
+
);
|
|
1930
|
+
if ($srctype & T_list) {
|
|
1931
|
+
$tval = items($src, sub { clone($child) });
|
|
1932
|
+
}
|
|
1933
|
+
elsif ($srctype & T_map) {
|
|
1934
|
+
$tval = items($src, sub {
|
|
1935
|
+
my ($pair) = @_;
|
|
1936
|
+
my $ann = _mkmap();
|
|
1937
|
+
$ann->{ S_BANNO() } = jm('KEY', $pair->[0]);
|
|
1938
|
+
merge([clone($child), $ann], 1);
|
|
1939
|
+
});
|
|
1940
|
+
}
|
|
1941
|
+
my $rval = [];
|
|
1942
|
+
if (size($tval) > 0) {
|
|
1943
|
+
$tcur = (!defined $src || is_none($src)) ? NONE() : items($src, sub { $_[0]->[1] });
|
|
1944
|
+
my $ckey = getelem($inj->{path}, -2);
|
|
1945
|
+
my $tpath = slice($inj->{path}, -1);
|
|
1946
|
+
my $dpath = flatten([S_DTOP, [split /\./, "$srcpath", -1], '$:' . $ckey]);
|
|
1947
|
+
my $tcurmap = jm($ckey, $tcur);
|
|
1948
|
+
if (size($tpath) > 1) {
|
|
1949
|
+
my $pkey = getelem($inj->{path}, -3, S_DTOP);
|
|
1950
|
+
$tcurmap = jm($pkey, $tcurmap);
|
|
1951
|
+
push @$dpath, '$:' . $pkey;
|
|
1952
|
+
}
|
|
1953
|
+
my $tinj = _inj_child($inj, 0, [$ckey]);
|
|
1954
|
+
$tinj->{path} = $tpath;
|
|
1955
|
+
$tinj->{nodes} = slice($inj->{nodes}, -1);
|
|
1956
|
+
$tinj->{parent} = getelem($tinj->{nodes}, -1);
|
|
1957
|
+
setprop($tinj->{parent}, $ckey, $tval);
|
|
1958
|
+
$tinj->{val} = $tval;
|
|
1959
|
+
$tinj->{dpath} = $dpath;
|
|
1960
|
+
$tinj->{dparent} = $tcurmap;
|
|
1961
|
+
inject($tval, $store, $tinj);
|
|
1962
|
+
$rval = $tinj->{val};
|
|
1963
|
+
}
|
|
1964
|
+
setprop($target, $tkey, $rval);
|
|
1965
|
+
return getelem($rval, 0);
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
sub transform_PACK {
|
|
1969
|
+
my ($inj, $val, $ref, $store) = @_;
|
|
1970
|
+
my $key = $inj->{key};
|
|
1971
|
+
my $path = $inj->{path};
|
|
1972
|
+
my $parent = $inj->{parent};
|
|
1973
|
+
my $nodes = $inj->{nodes};
|
|
1974
|
+
return NONE() unless checkPlacement(M_KEYPRE, 'EACH', T_map, $inj);
|
|
1975
|
+
my $args = getprop($parent, $key);
|
|
1976
|
+
my ($err, $srcpath, $origchildspec) = injectorArgs([T_string, T_any], $args);
|
|
1977
|
+
if (!is_none($err)) {
|
|
1978
|
+
push @{ $inj->{errs} }, '$EACH: ' . $err;
|
|
1979
|
+
return NONE();
|
|
1980
|
+
}
|
|
1981
|
+
my $tkey = getelem($path, -2);
|
|
1982
|
+
my $pathsize = size($path);
|
|
1983
|
+
my $target = getelem(
|
|
1984
|
+
$nodes, $pathsize - 2,
|
|
1985
|
+
sub { getelem($nodes, $pathsize - 1) },
|
|
1986
|
+
);
|
|
1987
|
+
my $srcstore = getprop($store, $inj->{base}, $store);
|
|
1988
|
+
my $src = getpath($srcstore, $srcpath, $inj);
|
|
1989
|
+
if (!islist($src)) {
|
|
1990
|
+
if (ismap($src)) {
|
|
1991
|
+
$src = items($src, sub {
|
|
1992
|
+
my ($item) = @_;
|
|
1993
|
+
setprop($item->[1], S_BANNO, jm('KEY', $item->[0]));
|
|
1994
|
+
$item->[1];
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1997
|
+
else { $src = NONE() }
|
|
1998
|
+
}
|
|
1999
|
+
return NONE() if is_none($src) || !defined $src;
|
|
2000
|
+
my $keypath = getprop($origchildspec, S_BKEY);
|
|
2001
|
+
my $childspec = delprop($origchildspec, S_BKEY);
|
|
2002
|
+
my $child = getprop($childspec, S_BVAL, $childspec);
|
|
2003
|
+
my $tval = _mkmap();
|
|
2004
|
+
items($src, sub {
|
|
2005
|
+
my ($item) = @_;
|
|
2006
|
+
my ($srckey, $srcnode) = ($item->[0], $item->[1]);
|
|
2007
|
+
my $kk = $srckey;
|
|
2008
|
+
if (!is_none($keypath)) {
|
|
2009
|
+
if (index($keypath, '`') == 0) {
|
|
2010
|
+
my $tmap = jm( S_DTOP, $srcnode );
|
|
2011
|
+
my $mstore = merge([_mkmap(), $store, $tmap], 1);
|
|
2012
|
+
$kk = inject($keypath, $mstore);
|
|
2013
|
+
}
|
|
2014
|
+
else {
|
|
2015
|
+
$kk = getpath($srcnode, $keypath, $inj);
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
my $tchild = clone($child);
|
|
2019
|
+
setprop($tval, $kk, $tchild);
|
|
2020
|
+
my $anno = getprop($srcnode, S_BANNO);
|
|
2021
|
+
if (is_none($anno)) { delprop($tchild, S_BANNO) }
|
|
2022
|
+
else { setprop($tchild, S_BANNO, $anno) }
|
|
2023
|
+
});
|
|
2024
|
+
my $rval = _mkmap();
|
|
2025
|
+
if (!isempty($tval)) {
|
|
2026
|
+
my $tsrc = _mkmap();
|
|
2027
|
+
for (my $i = 0; $i < @$src; $i++) {
|
|
2028
|
+
my $n = $src->[$i];
|
|
2029
|
+
my $kn;
|
|
2030
|
+
if (is_none($keypath)) { $kn = $i }
|
|
2031
|
+
elsif (index($keypath, '`') == 0) {
|
|
2032
|
+
my $tmap = jm( S_DTOP, $n );
|
|
2033
|
+
my $mstore = merge([_mkmap(), $store, $tmap], 1);
|
|
2034
|
+
$kn = inject($keypath, $mstore);
|
|
2035
|
+
}
|
|
2036
|
+
else { $kn = getpath($n, $keypath, $inj) }
|
|
2037
|
+
setprop($tsrc, $kn, $n);
|
|
2038
|
+
}
|
|
2039
|
+
my $tpath = slice($inj->{path}, -1);
|
|
2040
|
+
my $ckey = getelem($inj->{path}, -2);
|
|
2041
|
+
my $dpath = flatten([S_DTOP, [split /\./, "$srcpath", -1], '$:' . $ckey]);
|
|
2042
|
+
my $tcur = jm($ckey, $tsrc);
|
|
2043
|
+
if (size($tpath) > 1) {
|
|
2044
|
+
my $pkey = getelem($inj->{path}, -3, S_DTOP);
|
|
2045
|
+
$tcur = jm($pkey, $tcur);
|
|
2046
|
+
push @$dpath, '$:' . $pkey;
|
|
2047
|
+
}
|
|
2048
|
+
my $tinj = _inj_child($inj, 0, [$ckey]);
|
|
2049
|
+
$tinj->{path} = $tpath;
|
|
2050
|
+
$tinj->{nodes} = slice($inj->{nodes}, -1);
|
|
2051
|
+
$tinj->{parent} = getelem($tinj->{nodes}, -1);
|
|
2052
|
+
$tinj->{val} = $tval;
|
|
2053
|
+
$tinj->{dpath} = $dpath;
|
|
2054
|
+
$tinj->{dparent} = $tcur;
|
|
2055
|
+
inject($tval, $store, $tinj);
|
|
2056
|
+
$rval = $tinj->{val};
|
|
2057
|
+
}
|
|
2058
|
+
setprop($target, $tkey, $rval);
|
|
2059
|
+
return NONE();
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
sub transform_REF {
|
|
2063
|
+
my ($inj, $val, $ref, $store) = @_;
|
|
2064
|
+
return NONE() if $inj->{mode} != M_VAL;
|
|
2065
|
+
my $nodes = $inj->{nodes};
|
|
2066
|
+
my $refpath = _lookup($inj->{parent}, 1);
|
|
2067
|
+
$inj->{keyI} = size($inj->{keys});
|
|
2068
|
+
my $specfn = getprop($store, S_DSPEC);
|
|
2069
|
+
my $spec = isfunc($specfn) ? $specfn->() : $specfn;
|
|
2070
|
+
my $dpath = slice($inj->{path}, 1);
|
|
2071
|
+
my $sub_inj = {
|
|
2072
|
+
dpath => $dpath,
|
|
2073
|
+
dparent => getpath($spec, $dpath),
|
|
2074
|
+
base => S_DTOP,
|
|
2075
|
+
meta => $inj->{meta},
|
|
2076
|
+
};
|
|
2077
|
+
my $resolved = getpath($spec, $refpath, $sub_inj);
|
|
2078
|
+
my $hasSubRef = 0;
|
|
2079
|
+
if (isnode($resolved)) {
|
|
2080
|
+
walk($resolved, sub {
|
|
2081
|
+
my ($k, $v) = @_;
|
|
2082
|
+
if (defined $v && !ref($v) && $v eq '`$REF`') { $hasSubRef = 1 }
|
|
2083
|
+
return $v;
|
|
2084
|
+
});
|
|
2085
|
+
}
|
|
2086
|
+
my $tref = clone($resolved);
|
|
2087
|
+
my $cpath = slice($inj->{path}, -3);
|
|
2088
|
+
my $tpath = slice($inj->{path}, -1);
|
|
2089
|
+
my $tcur = getpath($store, $cpath);
|
|
2090
|
+
my $tval = getpath($store, $tpath);
|
|
2091
|
+
my $rval = NONE();
|
|
2092
|
+
if (!$hasSubRef || !is_none($tval)) {
|
|
2093
|
+
my $tinj = _inj_child($inj, 0, [getelem($tpath, -1)]);
|
|
2094
|
+
$tinj->{path} = $tpath;
|
|
2095
|
+
$tinj->{nodes} = slice($inj->{nodes}, -1);
|
|
2096
|
+
$tinj->{parent} = getelem($nodes, -2);
|
|
2097
|
+
$tinj->{val} = $tref;
|
|
2098
|
+
$tinj->{dpath} = flatten([$cpath]);
|
|
2099
|
+
$tinj->{dparent} = $tcur;
|
|
2100
|
+
inject($tref, $store, $tinj);
|
|
2101
|
+
$rval = $tinj->{val};
|
|
2102
|
+
}
|
|
2103
|
+
my $grandparent = _inj_setval($inj, $rval, 2);
|
|
2104
|
+
if (islist($grandparent) && $inj->{prior}) {
|
|
2105
|
+
$inj->{prior}{keyI}--;
|
|
2106
|
+
}
|
|
2107
|
+
return $val;
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
our %FORMATTER = (
|
|
2111
|
+
identity => sub { $_[1] },
|
|
2112
|
+
upper => sub {
|
|
2113
|
+
my (undef, $v) = @_;
|
|
2114
|
+
return $v if isnode($v);
|
|
2115
|
+
my $s = defined $v ? "$v" : '';
|
|
2116
|
+
return uc $s;
|
|
2117
|
+
},
|
|
2118
|
+
lower => sub {
|
|
2119
|
+
my (undef, $v) = @_;
|
|
2120
|
+
return $v if isnode($v);
|
|
2121
|
+
my $s = defined $v ? "$v" : '';
|
|
2122
|
+
return lc $s;
|
|
2123
|
+
},
|
|
2124
|
+
string => sub {
|
|
2125
|
+
my (undef, $v) = @_;
|
|
2126
|
+
return $v if isnode($v);
|
|
2127
|
+
return defined $v ? "$v" : '';
|
|
2128
|
+
},
|
|
2129
|
+
number => sub {
|
|
2130
|
+
my (undef, $v) = @_;
|
|
2131
|
+
return $v if isnode($v);
|
|
2132
|
+
my $n = defined $v && looks_like_number($v) ? 0 + $v : 0;
|
|
2133
|
+
return $n;
|
|
2134
|
+
},
|
|
2135
|
+
integer => sub {
|
|
2136
|
+
my (undef, $v) = @_;
|
|
2137
|
+
return $v if isnode($v);
|
|
2138
|
+
my $n = defined $v && looks_like_number($v) ? int(0 + $v) : 0;
|
|
2139
|
+
return $n;
|
|
2140
|
+
},
|
|
2141
|
+
concat => sub {
|
|
2142
|
+
my ($k, $v) = @_;
|
|
2143
|
+
if (!defined $k && islist($v)) {
|
|
2144
|
+
my $out = '';
|
|
2145
|
+
for my $e (@$v) {
|
|
2146
|
+
$out .= isnode($e) ? '' : (defined $e ? "$e" : '');
|
|
2147
|
+
}
|
|
2148
|
+
return $out;
|
|
2149
|
+
}
|
|
2150
|
+
return $v;
|
|
2151
|
+
},
|
|
2152
|
+
);
|
|
2153
|
+
|
|
2154
|
+
sub transform_FORMAT {
|
|
2155
|
+
my ($inj, $val, $ref, $store) = @_;
|
|
2156
|
+
slice($inj->{keys}, 0, 1, 1);
|
|
2157
|
+
return NONE() if $inj->{mode} != M_VAL;
|
|
2158
|
+
my $name = _lookup($inj->{parent}, 1);
|
|
2159
|
+
my $child = _lookup($inj->{parent}, 2);
|
|
2160
|
+
my $tkey = getelem($inj->{path}, -2);
|
|
2161
|
+
my $target = getelem(
|
|
2162
|
+
$inj->{nodes}, -2,
|
|
2163
|
+
sub { getelem($inj->{nodes}, -1) },
|
|
2164
|
+
);
|
|
2165
|
+
my $cinj = injectChild($child, $store, $inj);
|
|
2166
|
+
my $resolved = $cinj->{val};
|
|
2167
|
+
my $formatter = (typify($name) & T_function) ? $name : $FORMATTER{$name // ''};
|
|
2168
|
+
if (!defined $formatter) {
|
|
2169
|
+
push @{ $inj->{errs} }, '$FORMAT: unknown format: ' . (defined $name ? $name : '') . '.';
|
|
2170
|
+
return NONE();
|
|
2171
|
+
}
|
|
2172
|
+
my $out = walk($resolved, $formatter);
|
|
2173
|
+
setprop($target, $tkey, $out);
|
|
2174
|
+
return $out;
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
sub transform_APPLY {
|
|
2178
|
+
my ($inj, $val, $ref, $store) = @_;
|
|
2179
|
+
return NONE() unless checkPlacement(M_VAL, 'APPLY', T_list, $inj);
|
|
2180
|
+
my $rest = slice($inj->{parent}, 1);
|
|
2181
|
+
my ($err, $apply, $child) = injectorArgs([T_function, T_any], $rest);
|
|
2182
|
+
if (!is_none($err)) {
|
|
2183
|
+
push @{ $inj->{errs} }, '$APPLY: ' . $err;
|
|
2184
|
+
return NONE();
|
|
2185
|
+
}
|
|
2186
|
+
my $tkey = getelem($inj->{path}, -2);
|
|
2187
|
+
my $target = getelem(
|
|
2188
|
+
$inj->{nodes}, -2,
|
|
2189
|
+
sub { getelem($inj->{nodes}, -1) },
|
|
2190
|
+
);
|
|
2191
|
+
my $cinj = injectChild($child, $store, $inj);
|
|
2192
|
+
my $resolved = $cinj->{val};
|
|
2193
|
+
my $out = $apply->($resolved, $store, $cinj);
|
|
2194
|
+
setprop($target, $tkey, $out);
|
|
2195
|
+
return $out;
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
# ============================================================================
|
|
2199
|
+
# Transform — top-level wrapper.
|
|
2200
|
+
# ============================================================================
|
|
2201
|
+
|
|
2202
|
+
sub transform {
|
|
2203
|
+
my ($data, $spec, $injdef) = @_;
|
|
2204
|
+
my $origspec = $spec;
|
|
2205
|
+
$spec = clone($origspec);
|
|
2206
|
+
my $extra = defined $injdef ? $injdef->{extra} : undef;
|
|
2207
|
+
my $collect = defined $injdef && defined $injdef->{errs};
|
|
2208
|
+
my $errs = ($injdef && $injdef->{errs}) ? $injdef->{errs} : [];
|
|
2209
|
+
my $extraTransforms = _mkmap();
|
|
2210
|
+
my $extraData;
|
|
2211
|
+
if (defined $extra) {
|
|
2212
|
+
$extraData = _mkmap();
|
|
2213
|
+
for my $pair (@{ items($extra) }) {
|
|
2214
|
+
my ($k, $v) = @$pair;
|
|
2215
|
+
if (index($k, S_DS) == 0) {
|
|
2216
|
+
$extraTransforms->{$k} = $v;
|
|
2217
|
+
}
|
|
2218
|
+
else {
|
|
2219
|
+
$extraData->{$k} = $v;
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
my $dataClone = merge([
|
|
2224
|
+
(defined $extraData && !isempty($extraData)) ? clone($extraData) : NONE(),
|
|
2225
|
+
clone($data),
|
|
2226
|
+
]);
|
|
2227
|
+
my $base_store = jm(
|
|
2228
|
+
S_DTOP, $dataClone,
|
|
2229
|
+
'$SPEC', sub { $origspec },
|
|
2230
|
+
'$BT', sub { S_BT },
|
|
2231
|
+
'$DS', sub { S_DS },
|
|
2232
|
+
'$WHEN', sub {
|
|
2233
|
+
my @t = gmtime;
|
|
2234
|
+
return sprintf('%04d-%02d-%02dT%02d:%02d:%02d.000Z',
|
|
2235
|
+
$t[5]+1900, $t[4]+1, $t[3], $t[2], $t[1], $t[0]);
|
|
2236
|
+
},
|
|
2237
|
+
'$DELETE', \&transform_DELETE,
|
|
2238
|
+
'$COPY', \&transform_COPY,
|
|
2239
|
+
'$KEY', \&transform_KEY,
|
|
2240
|
+
'$META', \&transform_META,
|
|
2241
|
+
'$ANNO', \&transform_ANNO,
|
|
2242
|
+
'$MERGE', \&transform_MERGE,
|
|
2243
|
+
'$EACH', \&transform_EACH,
|
|
2244
|
+
'$PACK', \&transform_PACK,
|
|
2245
|
+
'$REF', \&transform_REF,
|
|
2246
|
+
'$FORMAT', \&transform_FORMAT,
|
|
2247
|
+
'$APPLY', \&transform_APPLY,
|
|
2248
|
+
);
|
|
2249
|
+
my $errs_map = jm(S_DERRS, $errs);
|
|
2250
|
+
my $store = merge([$base_store, $extraTransforms, $errs_map], 1);
|
|
2251
|
+
my $out = inject($spec, $store, $injdef);
|
|
2252
|
+
if (size($errs) > 0 && !$collect) {
|
|
2253
|
+
die CORE::join(' | ', map { defined $_ ? "$_" : '' } @$errs);
|
|
2254
|
+
}
|
|
2255
|
+
return $out;
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
# ============================================================================
|
|
2259
|
+
# Validate checkers (15)
|
|
2260
|
+
# ============================================================================
|
|
2261
|
+
|
|
2262
|
+
sub _invalid_type_msg {
|
|
2263
|
+
my ($path, $needtype, $vt, $v, $whence) = @_;
|
|
2264
|
+
# Canonical: `null == v` (null OR undefined) renders as "no value", with no
|
|
2265
|
+
# "typename: " prefix. Absent (NONE) and JSON null both count.
|
|
2266
|
+
my $novalue = (!defined $v || is_none($v) || is_jnull($v));
|
|
2267
|
+
my $vs = $novalue ? 'no value' : stringify($v);
|
|
2268
|
+
my $field = (size($path) > 1) ? ('field ' . pathify($path, 1) . ' to be ') : '';
|
|
2269
|
+
my $extra = $novalue ? '' : (typename($vt) . S_VIZ);
|
|
2270
|
+
return 'Expected ' . $field . $needtype . ', but found ' . $extra . $vs . '.';
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
sub validate_STRING {
|
|
2274
|
+
my ($inj) = @_;
|
|
2275
|
+
my $out = _lookup($inj->{dparent}, $inj->{key});
|
|
2276
|
+
my $t = typify($out);
|
|
2277
|
+
if (!($t & T_string)) {
|
|
2278
|
+
push @{ $inj->{errs} }, _invalid_type_msg($inj->{path}, S_string, $t, $out, 'V1010');
|
|
2279
|
+
return NONE();
|
|
2280
|
+
}
|
|
2281
|
+
if (defined $out && !ref($out) && $out eq '') {
|
|
2282
|
+
push @{ $inj->{errs} }, 'Empty string at ' . pathify($inj->{path}, 1);
|
|
2283
|
+
return NONE();
|
|
2284
|
+
}
|
|
2285
|
+
return $out;
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
sub validate_TYPE {
|
|
2289
|
+
my ($inj, $val, $ref) = @_;
|
|
2290
|
+
my $tname = lc substr($ref, 1);
|
|
2291
|
+
my %TNAME_TO_BIT = (
|
|
2292
|
+
S_nil() => T_noval,
|
|
2293
|
+
S_boolean() => T_boolean,
|
|
2294
|
+
S_decimal() => T_decimal,
|
|
2295
|
+
S_integer() => T_integer,
|
|
2296
|
+
S_number() => T_number,
|
|
2297
|
+
S_string() => T_string,
|
|
2298
|
+
S_function() => T_function,
|
|
2299
|
+
S_symbol() => T_symbol,
|
|
2300
|
+
S_null() => T_null,
|
|
2301
|
+
S_list() => T_list,
|
|
2302
|
+
S_map() => T_map,
|
|
2303
|
+
S_instance() => T_instance,
|
|
2304
|
+
S_scalar() => T_scalar,
|
|
2305
|
+
S_node() => T_node,
|
|
2306
|
+
S_any() => T_any,
|
|
2307
|
+
);
|
|
2308
|
+
my $typev = $TNAME_TO_BIT{$tname} // 0;
|
|
2309
|
+
# Special "number" matches integers & decimals.
|
|
2310
|
+
if ($tname eq S_number) {
|
|
2311
|
+
$typev = T_integer | T_decimal | T_number;
|
|
2312
|
+
}
|
|
2313
|
+
my $out = _lookup($inj->{dparent}, $inj->{key});
|
|
2314
|
+
my $t = typify($out);
|
|
2315
|
+
if (!($t & $typev)) {
|
|
2316
|
+
push @{ $inj->{errs} }, _invalid_type_msg($inj->{path}, $tname, $t, $out, 'V1001');
|
|
2317
|
+
return NONE();
|
|
2318
|
+
}
|
|
2319
|
+
return $out;
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2322
|
+
sub validate_ANY {
|
|
2323
|
+
my ($inj) = @_;
|
|
2324
|
+
return _lookup($inj->{dparent}, $inj->{key});
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
sub validate_CHILD {
|
|
2328
|
+
my ($inj) = @_;
|
|
2329
|
+
my $mode = $inj->{mode};
|
|
2330
|
+
my $key = $inj->{key};
|
|
2331
|
+
my $parent = $inj->{parent};
|
|
2332
|
+
my $keys = $inj->{keys};
|
|
2333
|
+
my $path = $inj->{path};
|
|
2334
|
+
if ($mode == M_KEYPRE) {
|
|
2335
|
+
my $childtm = getprop($parent, $key);
|
|
2336
|
+
my $pkey = getelem($path, -2);
|
|
2337
|
+
my $tval = getprop($inj->{dparent}, $pkey);
|
|
2338
|
+
if (!defined $tval || is_none($tval)) { $tval = _mkmap() }
|
|
2339
|
+
elsif (!ismap($tval)) {
|
|
2340
|
+
push @{ $inj->{errs} }, _invalid_type_msg(slice($inj->{path}, -1), S_object, typify($tval), $tval, 'V0220');
|
|
2341
|
+
return NONE();
|
|
2342
|
+
}
|
|
2343
|
+
my $ckeys = keysof($tval);
|
|
2344
|
+
for my $ckey (@$ckeys) {
|
|
2345
|
+
setprop($parent, $ckey, clone($childtm));
|
|
2346
|
+
push @$keys, $ckey;
|
|
2347
|
+
}
|
|
2348
|
+
_inj_setval($inj, NONE());
|
|
2349
|
+
return NONE();
|
|
2350
|
+
}
|
|
2351
|
+
if ($mode == M_VAL) {
|
|
2352
|
+
if (!islist($parent)) {
|
|
2353
|
+
push @{ $inj->{errs} }, 'Invalid $CHILD as value';
|
|
2354
|
+
return NONE();
|
|
2355
|
+
}
|
|
2356
|
+
my $childtm = _lookup($parent, 1);
|
|
2357
|
+
if (is_none($inj->{dparent})) {
|
|
2358
|
+
slice($parent, 0, 0, 1);
|
|
2359
|
+
return NONE();
|
|
2360
|
+
}
|
|
2361
|
+
if (!islist($inj->{dparent})) {
|
|
2362
|
+
my $msg = _invalid_type_msg(slice($inj->{path}, -1), S_list, typify($inj->{dparent}), $inj->{dparent}, 'V0230');
|
|
2363
|
+
push @{ $inj->{errs} }, $msg;
|
|
2364
|
+
$inj->{keyI} = size($parent);
|
|
2365
|
+
return $inj->{dparent};
|
|
2366
|
+
}
|
|
2367
|
+
items($inj->{dparent}, sub {
|
|
2368
|
+
my ($n) = @_;
|
|
2369
|
+
setprop($parent, $n->[0], clone($childtm));
|
|
2370
|
+
});
|
|
2371
|
+
slice($parent, 0, scalar @{ $inj->{dparent} }, 1);
|
|
2372
|
+
$inj->{keyI} = 0;
|
|
2373
|
+
return getprop($inj->{dparent}, 0);
|
|
2374
|
+
}
|
|
2375
|
+
return NONE();
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
sub validate_ONE {
|
|
2379
|
+
my ($inj, $val, $ref, $store) = @_;
|
|
2380
|
+
my $mode = $inj->{mode};
|
|
2381
|
+
my $parent = $inj->{parent};
|
|
2382
|
+
my $keyI = $inj->{keyI};
|
|
2383
|
+
if ($mode == M_VAL) {
|
|
2384
|
+
if (!islist($parent) || $keyI != 0) {
|
|
2385
|
+
push @{ $inj->{errs} },
|
|
2386
|
+
'The $ONE validator at field ' . pathify($inj->{path}, 1, 1) .
|
|
2387
|
+
' must be the first element of an array.';
|
|
2388
|
+
return;
|
|
2389
|
+
}
|
|
2390
|
+
$inj->{keyI} = size($inj->{keys});
|
|
2391
|
+
_inj_setval($inj, $inj->{dparent}, 2);
|
|
2392
|
+
$inj->{path} = slice($inj->{path}, -1);
|
|
2393
|
+
$inj->{key} = getelem($inj->{path}, -1);
|
|
2394
|
+
my $tvals = slice($parent, 1);
|
|
2395
|
+
if (size($tvals) == 0) {
|
|
2396
|
+
push @{ $inj->{errs} },
|
|
2397
|
+
'The $ONE validator at field ' . pathify($inj->{path}, 1, 1) .
|
|
2398
|
+
' must have at least one argument.';
|
|
2399
|
+
return;
|
|
2400
|
+
}
|
|
2401
|
+
for my $tval (@$tvals) {
|
|
2402
|
+
my $terrs = [];
|
|
2403
|
+
my $vstore = merge([_mkmap(), $store], 1);
|
|
2404
|
+
$vstore->{ S_DTOP() } = $inj->{dparent};
|
|
2405
|
+
my $vcurrent = validate($inj->{dparent}, $tval, {
|
|
2406
|
+
extra => $vstore,
|
|
2407
|
+
errs => $terrs,
|
|
2408
|
+
meta => $inj->{meta},
|
|
2409
|
+
});
|
|
2410
|
+
_inj_setval($inj, $vcurrent, -2);
|
|
2411
|
+
return if size($terrs) == 0;
|
|
2412
|
+
}
|
|
2413
|
+
my $valdesc = CORE::join(', ', map { stringify($_) } @$tvals);
|
|
2414
|
+
$valdesc =~ s/`\$([A-Z]+)`/lc($1)/ge;
|
|
2415
|
+
push @{ $inj->{errs} }, _invalid_type_msg(
|
|
2416
|
+
$inj->{path},
|
|
2417
|
+
(size($tvals) > 1 ? 'one of ' : '') . $valdesc,
|
|
2418
|
+
typify($inj->{dparent}),
|
|
2419
|
+
$inj->{dparent},
|
|
2420
|
+
'V0210',
|
|
2421
|
+
);
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
|
|
2425
|
+
sub validate_EXACT {
|
|
2426
|
+
my ($inj) = @_;
|
|
2427
|
+
my $mode = $inj->{mode};
|
|
2428
|
+
my $parent = $inj->{parent};
|
|
2429
|
+
my $key = $inj->{key};
|
|
2430
|
+
my $keyI = $inj->{keyI};
|
|
2431
|
+
if ($mode == M_VAL) {
|
|
2432
|
+
if (!islist($parent) || $keyI != 0) {
|
|
2433
|
+
push @{ $inj->{errs} },
|
|
2434
|
+
'The $EXACT validator at field ' . pathify($inj->{path}, 1, 1) .
|
|
2435
|
+
' must be the first element of an array.';
|
|
2436
|
+
return;
|
|
2437
|
+
}
|
|
2438
|
+
$inj->{keyI} = size($inj->{keys});
|
|
2439
|
+
_inj_setval($inj, $inj->{dparent}, 2);
|
|
2440
|
+
$inj->{path} = slice($inj->{path}, 0, -1);
|
|
2441
|
+
$inj->{key} = getelem($inj->{path}, -1);
|
|
2442
|
+
my $tvals = slice($parent, 1);
|
|
2443
|
+
if (size($tvals) == 0) {
|
|
2444
|
+
push @{ $inj->{errs} },
|
|
2445
|
+
'The $EXACT validator at field ' . pathify($inj->{path}, 1, 1) .
|
|
2446
|
+
' must have at least one argument.';
|
|
2447
|
+
return;
|
|
2448
|
+
}
|
|
2449
|
+
my $currentstr;
|
|
2450
|
+
for my $tval (@$tvals) {
|
|
2451
|
+
my $exactmatch = _exact_eq($tval, $inj->{dparent});
|
|
2452
|
+
if (!$exactmatch && isnode($tval)) {
|
|
2453
|
+
$currentstr //= stringify($inj->{dparent});
|
|
2454
|
+
my $tvalstr = stringify($tval);
|
|
2455
|
+
$exactmatch = ($tvalstr eq $currentstr);
|
|
2456
|
+
}
|
|
2457
|
+
return if $exactmatch;
|
|
2458
|
+
}
|
|
2459
|
+
my $valdesc = CORE::join(', ', map { stringify($_) } @$tvals);
|
|
2460
|
+
$valdesc =~ s/`\$([A-Z]+)`/lc($1)/ge;
|
|
2461
|
+
push @{ $inj->{errs} }, _invalid_type_msg(
|
|
2462
|
+
$inj->{path},
|
|
2463
|
+
(size($inj->{path}) > 1 ? '' : 'value ') . 'exactly equal to ' .
|
|
2464
|
+
(size($tvals) == 1 ? '' : 'one of ') . $valdesc,
|
|
2465
|
+
typify($inj->{dparent}),
|
|
2466
|
+
$inj->{dparent},
|
|
2467
|
+
'V0110',
|
|
2468
|
+
);
|
|
2469
|
+
}
|
|
2470
|
+
else {
|
|
2471
|
+
delprop($parent, $key);
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
sub _exact_eq {
|
|
2476
|
+
my ($a, $b) = @_;
|
|
2477
|
+
# NONE/undef: treat both forms as equivalent.
|
|
2478
|
+
my $a_na = !defined $a || is_none($a);
|
|
2479
|
+
my $b_na = !defined $b || is_none($b);
|
|
2480
|
+
return 1 if $a_na && $b_na;
|
|
2481
|
+
return 0 if $a_na || $b_na;
|
|
2482
|
+
return 1 if is_jnull($a) && is_jnull($b);
|
|
2483
|
+
return 0 if is_jnull($a) || is_jnull($b);
|
|
2484
|
+
if (is_jbool($a) && is_jbool($b)) { return $$a == $$b }
|
|
2485
|
+
return 0 if is_jbool($a) || is_jbool($b);
|
|
2486
|
+
if (!ref($a) && !ref($b)) {
|
|
2487
|
+
if (_is_number_sv($a) && _is_number_sv($b)) {
|
|
2488
|
+
return 0 + $a == 0 + $b;
|
|
2489
|
+
}
|
|
2490
|
+
return "$a" eq "$b";
|
|
2491
|
+
}
|
|
2492
|
+
return 0;
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
# Validation modify: runs after each child's inject pass.
|
|
2496
|
+
sub _validation {
|
|
2497
|
+
my ($pval, $key, $parent, $inj) = @_;
|
|
2498
|
+
return if is_none($inj);
|
|
2499
|
+
return if is_sentinel($pval) && (_map_keys($pval))[0] eq '`$SKIP`';
|
|
2500
|
+
my $exact = getprop($inj->{meta}, S_BEXACT, $JFALSE);
|
|
2501
|
+
my $exact_bool = is_jbool($exact) ? !!$$exact : ($exact ? 1 : 0);
|
|
2502
|
+
my $cval = getprop($inj->{dparent}, $key);
|
|
2503
|
+
return if is_none($inj) || (!$exact_bool && is_none($cval));
|
|
2504
|
+
my $ptype = typify($pval);
|
|
2505
|
+
if (($ptype & T_string) && defined $pval && !ref($pval) && index($pval, S_DS) >= 0) {
|
|
2506
|
+
return;
|
|
2507
|
+
}
|
|
2508
|
+
my $ctype = typify($cval);
|
|
2509
|
+
if ($ptype != $ctype && !is_none($pval)) {
|
|
2510
|
+
push @{ $inj->{errs} },
|
|
2511
|
+
_invalid_type_msg($inj->{path}, typename($ptype), $ctype, $cval, 'V0010');
|
|
2512
|
+
return;
|
|
2513
|
+
}
|
|
2514
|
+
if (ismap($cval)) {
|
|
2515
|
+
if (!ismap($pval)) {
|
|
2516
|
+
push @{ $inj->{errs} },
|
|
2517
|
+
_invalid_type_msg($inj->{path}, typename($ptype), $ctype, $cval, 'V0020');
|
|
2518
|
+
return;
|
|
2519
|
+
}
|
|
2520
|
+
my $ckeys = keysof($cval);
|
|
2521
|
+
my $pkeys = keysof($pval);
|
|
2522
|
+
# A map is open only if `$OPEN` is literally true; an absent flag (NONE,
|
|
2523
|
+
# which is itself truthy in Perl) leaves the map closed.
|
|
2524
|
+
my $open_flag = getprop($pval, '`$OPEN`');
|
|
2525
|
+
my $is_open = (is_jbool($open_flag) && ${$open_flag}) ? 1 : 0;
|
|
2526
|
+
if (size($pkeys) > 0 && !$is_open) {
|
|
2527
|
+
my @badkeys;
|
|
2528
|
+
for my $ck (@$ckeys) {
|
|
2529
|
+
if (is_none(_lookup($pval, $ck))) {
|
|
2530
|
+
push @badkeys, $ck;
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
if (@badkeys) {
|
|
2534
|
+
push @{ $inj->{errs} },
|
|
2535
|
+
'Unexpected keys at field ' . pathify($inj->{path}, 1) . S_VIZ . CORE::join(', ', @badkeys);
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
else {
|
|
2539
|
+
merge([$pval, $cval]);
|
|
2540
|
+
if (isnode($pval)) { delprop($pval, '`$OPEN`') }
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
elsif (islist($cval)) {
|
|
2544
|
+
if (!islist($pval)) {
|
|
2545
|
+
push @{ $inj->{errs} },
|
|
2546
|
+
_invalid_type_msg($inj->{path}, typename($ptype), $ctype, $cval, 'V0030');
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
elsif ($exact_bool) {
|
|
2550
|
+
my $eq = _exact_eq($cval, $pval);
|
|
2551
|
+
if (!$eq) {
|
|
2552
|
+
my $pathmsg = size($inj->{path}) > 1
|
|
2553
|
+
? 'at field ' . pathify($inj->{path}, 1) . S_VIZ
|
|
2554
|
+
: S_MT;
|
|
2555
|
+
push @{ $inj->{errs} },
|
|
2556
|
+
'Value ' . $pathmsg . stringify($cval) . ' should equal ' . stringify($pval) . S_DT;
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
else {
|
|
2560
|
+
setprop($parent, $key, $cval);
|
|
2561
|
+
}
|
|
2562
|
+
return;
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
sub _validatehandler {
|
|
2566
|
+
my ($inj, $val, $ref, $store) = @_;
|
|
2567
|
+
if (defined $ref && !ref($ref) && $ref =~ $R_META_PATH) {
|
|
2568
|
+
my ($name, $sym, $rest) = ($1, $2, $3);
|
|
2569
|
+
if ($sym eq '=') {
|
|
2570
|
+
_inj_setval($inj, [S_BEXACT, $val]);
|
|
2571
|
+
}
|
|
2572
|
+
else {
|
|
2573
|
+
_inj_setval($inj, $val);
|
|
2574
|
+
}
|
|
2575
|
+
$inj->{keyI} = -1;
|
|
2576
|
+
return SKIP();
|
|
2577
|
+
}
|
|
2578
|
+
return _injecthandler($inj, $val, $ref, $store);
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2581
|
+
sub validate {
|
|
2582
|
+
my ($data, $spec, $injdef) = @_;
|
|
2583
|
+
my $extra = defined $injdef ? $injdef->{extra} : undef;
|
|
2584
|
+
my $collect = defined $injdef && defined $injdef->{errs};
|
|
2585
|
+
my $errs = ($injdef && $injdef->{errs}) ? $injdef->{errs} : [];
|
|
2586
|
+
my $base = jm(
|
|
2587
|
+
'$DELETE', $JNULL,
|
|
2588
|
+
'$COPY', $JNULL,
|
|
2589
|
+
'$KEY', $JNULL,
|
|
2590
|
+
'$META', $JNULL,
|
|
2591
|
+
'$MERGE', $JNULL,
|
|
2592
|
+
'$EACH', $JNULL,
|
|
2593
|
+
'$PACK', $JNULL,
|
|
2594
|
+
'$STRING', \&validate_STRING,
|
|
2595
|
+
'$NUMBER', \&validate_TYPE,
|
|
2596
|
+
'$INTEGER', \&validate_TYPE,
|
|
2597
|
+
'$DECIMAL', \&validate_TYPE,
|
|
2598
|
+
'$BOOLEAN', \&validate_TYPE,
|
|
2599
|
+
'$NULL', \&validate_TYPE,
|
|
2600
|
+
'$NIL', \&validate_TYPE,
|
|
2601
|
+
'$MAP', \&validate_TYPE,
|
|
2602
|
+
'$LIST', \&validate_TYPE,
|
|
2603
|
+
'$FUNCTION', \&validate_TYPE,
|
|
2604
|
+
'$INSTANCE', \&validate_TYPE,
|
|
2605
|
+
'$ANY', \&validate_ANY,
|
|
2606
|
+
'$CHILD', \&validate_CHILD,
|
|
2607
|
+
'$ONE', \&validate_ONE,
|
|
2608
|
+
'$EXACT', \&validate_EXACT,
|
|
2609
|
+
);
|
|
2610
|
+
my $errsmap = jm(S_DERRS, $errs);
|
|
2611
|
+
my $store = merge([$base, getdef($extra, _mkmap()), $errsmap], 1);
|
|
2612
|
+
my $meta = getprop($injdef, 'meta', _mkmap());
|
|
2613
|
+
setprop($meta, S_BEXACT, getprop($meta, S_BEXACT, $JFALSE));
|
|
2614
|
+
my $out = transform($data, $spec, {
|
|
2615
|
+
meta => $meta,
|
|
2616
|
+
extra => $store,
|
|
2617
|
+
modify => \&_validation,
|
|
2618
|
+
handler => \&_validatehandler,
|
|
2619
|
+
errs => $errs,
|
|
2620
|
+
});
|
|
2621
|
+
if (size($errs) > 0 && !$collect) {
|
|
2622
|
+
die CORE::join(' | ', map { defined $_ ? "$_" : '' } @$errs);
|
|
2623
|
+
}
|
|
2624
|
+
return $out;
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
# ============================================================================
|
|
2628
|
+
# Select operators (4)
|
|
2629
|
+
# ============================================================================
|
|
2630
|
+
|
|
2631
|
+
sub select_AND {
|
|
2632
|
+
my ($inj, $val, $ref, $store) = @_;
|
|
2633
|
+
return NONE() unless $inj->{mode} == M_KEYPRE;
|
|
2634
|
+
my $terms = _lookup($inj->{parent}, $inj->{key});
|
|
2635
|
+
my $ppath = slice($inj->{path}, -1);
|
|
2636
|
+
my $point = getpath($store, $ppath);
|
|
2637
|
+
my $vstore = merge([_mkmap(), $store], 1);
|
|
2638
|
+
$vstore->{ S_DTOP() } = $point;
|
|
2639
|
+
for my $term (@$terms) {
|
|
2640
|
+
my $terrs = [];
|
|
2641
|
+
validate($point, $term, {
|
|
2642
|
+
extra => $vstore,
|
|
2643
|
+
errs => $terrs,
|
|
2644
|
+
meta => $inj->{meta},
|
|
2645
|
+
});
|
|
2646
|
+
if (size($terrs) != 0) {
|
|
2647
|
+
push @{ $inj->{errs} },
|
|
2648
|
+
'AND:' . pathify($ppath) . S_VIZ . stringify($point) .
|
|
2649
|
+
' fail:' . stringify($terms);
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
my $gkey = getelem($inj->{path}, -2);
|
|
2653
|
+
my $gp = getelem($inj->{nodes}, -2);
|
|
2654
|
+
setprop($gp, $gkey, $point);
|
|
2655
|
+
return NONE();
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
sub select_OR {
|
|
2659
|
+
my ($inj, $val, $ref, $store) = @_;
|
|
2660
|
+
return NONE() unless $inj->{mode} == M_KEYPRE;
|
|
2661
|
+
my $terms = _lookup($inj->{parent}, $inj->{key});
|
|
2662
|
+
my $ppath = slice($inj->{path}, -1);
|
|
2663
|
+
my $point = getpath($store, $ppath);
|
|
2664
|
+
my $vstore = merge([_mkmap(), $store], 1);
|
|
2665
|
+
$vstore->{ S_DTOP() } = $point;
|
|
2666
|
+
for my $term (@$terms) {
|
|
2667
|
+
my $terrs = [];
|
|
2668
|
+
validate($point, $term, {
|
|
2669
|
+
extra => $vstore,
|
|
2670
|
+
errs => $terrs,
|
|
2671
|
+
meta => $inj->{meta},
|
|
2672
|
+
});
|
|
2673
|
+
if (size($terrs) == 0) {
|
|
2674
|
+
my $gkey = getelem($inj->{path}, -2);
|
|
2675
|
+
my $gp = getelem($inj->{nodes}, -2);
|
|
2676
|
+
setprop($gp, $gkey, $point);
|
|
2677
|
+
return NONE();
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
push @{ $inj->{errs} },
|
|
2681
|
+
'OR:' . pathify($ppath) . S_VIZ . stringify($point) .
|
|
2682
|
+
' fail:' . stringify($terms);
|
|
2683
|
+
return NONE();
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
sub select_NOT {
|
|
2687
|
+
my ($inj, $val, $ref, $store) = @_;
|
|
2688
|
+
return NONE() unless $inj->{mode} == M_KEYPRE;
|
|
2689
|
+
my $term = _lookup($inj->{parent}, $inj->{key});
|
|
2690
|
+
my $ppath = slice($inj->{path}, -1);
|
|
2691
|
+
my $point = getpath($store, $ppath);
|
|
2692
|
+
my $vstore = merge([_mkmap(), $store], 1);
|
|
2693
|
+
$vstore->{ S_DTOP() } = $point;
|
|
2694
|
+
my $terrs = [];
|
|
2695
|
+
validate($point, $term, {
|
|
2696
|
+
extra => $vstore,
|
|
2697
|
+
errs => $terrs,
|
|
2698
|
+
meta => $inj->{meta},
|
|
2699
|
+
});
|
|
2700
|
+
if (size($terrs) == 0) {
|
|
2701
|
+
push @{ $inj->{errs} },
|
|
2702
|
+
'NOT:' . pathify($ppath) . S_VIZ . stringify($point) .
|
|
2703
|
+
' fail:' . stringify($term);
|
|
2704
|
+
}
|
|
2705
|
+
my $gkey = getelem($inj->{path}, -2);
|
|
2706
|
+
my $gp = getelem($inj->{nodes}, -2);
|
|
2707
|
+
setprop($gp, $gkey, $point);
|
|
2708
|
+
return NONE();
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
|
+
sub select_CMP {
|
|
2712
|
+
my ($inj, $val, $ref, $store) = @_;
|
|
2713
|
+
return NONE() unless $inj->{mode} == M_KEYPRE;
|
|
2714
|
+
my $term = _lookup($inj->{parent}, $inj->{key});
|
|
2715
|
+
my $gkey = getelem($inj->{path}, -2);
|
|
2716
|
+
my $ppath = slice($inj->{path}, -1);
|
|
2717
|
+
my $point = getpath($store, $ppath);
|
|
2718
|
+
my $pass = 0;
|
|
2719
|
+
# NOTE: avoid numifying $point / $term via `0 + $x` — that mutates the
|
|
2720
|
+
# SV's IOK flag (so a string "123" becomes typify=integer afterwards).
|
|
2721
|
+
# We probe types via Scalar::Util::looks_like_number on a COPY.
|
|
2722
|
+
my $pc = $point;
|
|
2723
|
+
my $tc = $term;
|
|
2724
|
+
my $both_num = defined $point && defined $term
|
|
2725
|
+
&& !ref($point) && !ref($term)
|
|
2726
|
+
&& looks_like_number($pc) && looks_like_number($tc);
|
|
2727
|
+
if ($ref eq '$GT') {
|
|
2728
|
+
$pass = $both_num ? ((0 + $pc) > (0 + $tc))
|
|
2729
|
+
: (defined $point && defined $term && "$point" gt "$term");
|
|
2730
|
+
}
|
|
2731
|
+
elsif ($ref eq '$LT') {
|
|
2732
|
+
$pass = $both_num ? ((0 + $pc) < (0 + $tc))
|
|
2733
|
+
: (defined $point && defined $term && "$point" lt "$term");
|
|
2734
|
+
}
|
|
2735
|
+
elsif ($ref eq '$GTE') {
|
|
2736
|
+
$pass = $both_num ? ((0 + $pc) >= (0 + $tc))
|
|
2737
|
+
: (defined $point && defined $term && "$point" ge "$term");
|
|
2738
|
+
}
|
|
2739
|
+
elsif ($ref eq '$LTE') {
|
|
2740
|
+
$pass = $both_num ? ((0 + $pc) <= (0 + $tc))
|
|
2741
|
+
: (defined $point && defined $term && "$point" le "$term");
|
|
2742
|
+
}
|
|
2743
|
+
elsif ($ref eq '$LIKE') {
|
|
2744
|
+
my $s = stringify($point);
|
|
2745
|
+
$pass = (defined $term && $s =~ /$term/) ? 1 : 0;
|
|
2746
|
+
}
|
|
2747
|
+
if ($pass) {
|
|
2748
|
+
my $gp = getelem($inj->{nodes}, -2);
|
|
2749
|
+
setprop($gp, $gkey, $point);
|
|
2750
|
+
}
|
|
2751
|
+
else {
|
|
2752
|
+
push @{ $inj->{errs} },
|
|
2753
|
+
'CMP: ' . pathify($ppath) . S_VIZ . stringify($point) .
|
|
2754
|
+
' fail:' . $ref . ' ' . stringify($term);
|
|
2755
|
+
}
|
|
2756
|
+
return NONE();
|
|
2757
|
+
}
|
|
2758
|
+
|
|
2759
|
+
sub select {
|
|
2760
|
+
my ($children, $query) = @_;
|
|
2761
|
+
return [] unless isnode($children);
|
|
2762
|
+
if (ismap($children)) {
|
|
2763
|
+
$children = items($children, sub {
|
|
2764
|
+
my ($n) = @_;
|
|
2765
|
+
setprop($n->[1], S_DKEY, $n->[0]);
|
|
2766
|
+
return $n->[1];
|
|
2767
|
+
});
|
|
2768
|
+
}
|
|
2769
|
+
else {
|
|
2770
|
+
$children = items($children, sub {
|
|
2771
|
+
my ($n) = @_;
|
|
2772
|
+
setprop($n->[1], S_DKEY, int($n->[0]));
|
|
2773
|
+
return $n->[1];
|
|
2774
|
+
});
|
|
2775
|
+
}
|
|
2776
|
+
my $results = [];
|
|
2777
|
+
my $meta = _mkmap();
|
|
2778
|
+
$meta->{ S_BEXACT() } = $JTRUE;
|
|
2779
|
+
my $extra = jm(
|
|
2780
|
+
'$AND', \&select_AND,
|
|
2781
|
+
'$OR', \&select_OR,
|
|
2782
|
+
'$NOT', \&select_NOT,
|
|
2783
|
+
'$GT', \&select_CMP,
|
|
2784
|
+
'$LT', \&select_CMP,
|
|
2785
|
+
'$GTE', \&select_CMP,
|
|
2786
|
+
'$LTE', \&select_CMP,
|
|
2787
|
+
'$LIKE', \&select_CMP,
|
|
2788
|
+
);
|
|
2789
|
+
my $q = clone($query);
|
|
2790
|
+
walk($q, sub {
|
|
2791
|
+
my ($k, $v) = @_;
|
|
2792
|
+
if (ismap($v)) {
|
|
2793
|
+
my $existing = getprop($v, '`$OPEN`', $JTRUE);
|
|
2794
|
+
setprop($v, '`$OPEN`', $existing);
|
|
2795
|
+
}
|
|
2796
|
+
return $v;
|
|
2797
|
+
});
|
|
2798
|
+
for my $child (@$children) {
|
|
2799
|
+
my $errs = [];
|
|
2800
|
+
my $injdef = {
|
|
2801
|
+
errs => $errs,
|
|
2802
|
+
meta => $meta,
|
|
2803
|
+
extra => $extra,
|
|
2804
|
+
};
|
|
2805
|
+
validate($child, clone($q), $injdef);
|
|
2806
|
+
if (size($errs) == 0) {
|
|
2807
|
+
push @$results, $child;
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
return $results;
|
|
2811
|
+
}
|
|
2812
|
+
|
|
2813
|
+
# ============================================================================
|
|
2814
|
+
# Regex utility — uniform API across ports (see /REGEX.md). Perl's built-in
|
|
2815
|
+
# regex handles the RE2 subset directly; these are thin wrappers so the
|
|
2816
|
+
# canonical names exist for cross-port parity.
|
|
2817
|
+
# ============================================================================
|
|
2818
|
+
|
|
2819
|
+
sub re_compile {
|
|
2820
|
+
my ($pattern, $flags) = @_;
|
|
2821
|
+
return $pattern if ref($pattern) eq 'Regexp';
|
|
2822
|
+
return $flags ? qr/(?$flags:$pattern)/ : qr/$pattern/;
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
sub re_test {
|
|
2826
|
+
my ($pattern, $input) = @_;
|
|
2827
|
+
return 0 unless defined $input;
|
|
2828
|
+
my $re = re_compile($pattern);
|
|
2829
|
+
return $input =~ $re ? 1 : 0;
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2832
|
+
# Single match. Returns [whole, $1, $2, ...] or undef. Mirrors JS String.match.
|
|
2833
|
+
sub re_find {
|
|
2834
|
+
my ($pattern, $input) = @_;
|
|
2835
|
+
return unless defined $input;
|
|
2836
|
+
my $re = re_compile($pattern);
|
|
2837
|
+
if ($input =~ $re) {
|
|
2838
|
+
my $whole = substr($input, $-[0], $+[0] - $-[0]);
|
|
2839
|
+
my @caps;
|
|
2840
|
+
for (my $i = 1; $i < scalar @-; $i++) {
|
|
2841
|
+
push @caps, defined $-[$i]
|
|
2842
|
+
? substr($input, $-[$i], $+[$i] - $-[$i])
|
|
2843
|
+
: undef;
|
|
2844
|
+
}
|
|
2845
|
+
return [ $whole, @caps ];
|
|
2846
|
+
}
|
|
2847
|
+
return;
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
# All non-overlapping left-to-right matches. Same shape as re_find per element.
|
|
2851
|
+
sub re_find_all {
|
|
2852
|
+
my ($pattern, $input) = @_;
|
|
2853
|
+
return [] unless defined $input;
|
|
2854
|
+
my $re = re_compile($pattern);
|
|
2855
|
+
my @out;
|
|
2856
|
+
while ($input =~ /$re/g) {
|
|
2857
|
+
my $whole = substr($input, $-[0], $+[0] - $-[0]);
|
|
2858
|
+
my @caps;
|
|
2859
|
+
for (my $i = 1; $i < scalar @-; $i++) {
|
|
2860
|
+
push @caps, defined $-[$i]
|
|
2861
|
+
? substr($input, $-[$i], $+[$i] - $-[$i])
|
|
2862
|
+
: undef;
|
|
2863
|
+
}
|
|
2864
|
+
push @out, [ $whole, @caps ];
|
|
2865
|
+
last if length($whole) == 0 && (pos($input) // 0) >= length($input);
|
|
2866
|
+
}
|
|
2867
|
+
return \@out;
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2870
|
+
# Replace every match. `replacement` is either a string (literal) or a coderef
|
|
2871
|
+
# receiving the same array re_find returns.
|
|
2872
|
+
sub re_replace {
|
|
2873
|
+
my ($pattern, $input, $replacement) = @_;
|
|
2874
|
+
return '' unless defined $input;
|
|
2875
|
+
my $re = re_compile($pattern);
|
|
2876
|
+
if (ref($replacement) eq 'CODE') {
|
|
2877
|
+
my $s = $input;
|
|
2878
|
+
$s =~ s{$re}{
|
|
2879
|
+
my $whole = substr($input, $-[0], $+[0] - $-[0]);
|
|
2880
|
+
my @caps;
|
|
2881
|
+
for (my $i = 1; $i < scalar @-; $i++) {
|
|
2882
|
+
push @caps, defined $-[$i]
|
|
2883
|
+
? substr($input, $-[$i], $+[$i] - $-[$i])
|
|
2884
|
+
: undef;
|
|
2885
|
+
}
|
|
2886
|
+
$replacement->([ $whole, @caps ]);
|
|
2887
|
+
}ge;
|
|
2888
|
+
return $s;
|
|
2889
|
+
}
|
|
2890
|
+
my $s = $input;
|
|
2891
|
+
$s =~ s/$re/$replacement/g;
|
|
2892
|
+
return $s;
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
sub re_escape { return escre($_[0]) }
|
|
2896
|
+
|
|
2897
|
+
1;
|