@voxgig/sdkgen 1.3.8 → 1.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/voxgig-sdkgen +1 -1
- package/package.json +1 -1
- package/project/.sdk/model/feature/audit.aontu +22 -0
- package/project/.sdk/model/feature/cache.aontu +23 -0
- package/project/.sdk/model/feature/clienttrack.aontu +20 -0
- package/project/.sdk/model/feature/debug.aontu +25 -0
- package/project/.sdk/model/feature/feature-index.aontu +20 -1
- package/project/.sdk/model/feature/idempotency.aontu +21 -0
- package/project/.sdk/model/feature/metrics.aontu +20 -0
- package/project/.sdk/model/feature/netsim.aontu +36 -0
- package/project/.sdk/model/feature/paging.aontu +23 -0
- package/project/.sdk/model/feature/proxy.aontu +23 -0
- package/project/.sdk/model/feature/ratelimit.aontu +21 -0
- package/project/.sdk/model/feature/rbac.aontu +24 -0
- package/project/.sdk/model/feature/retry.aontu +23 -0
- package/project/.sdk/model/feature/streaming.aontu +22 -0
- package/project/.sdk/model/feature/telemetry.aontu +21 -0
- package/project/.sdk/model/feature/timeout.aontu +18 -0
- package/project/.sdk/model/target/c.aontu +37 -0
- package/project/.sdk/model/target/clojure.aontu +36 -0
- package/project/.sdk/model/target/cpp.aontu +35 -0
- package/project/.sdk/model/target/csharp.aontu +35 -0
- package/project/.sdk/model/target/dart.aontu +34 -0
- package/project/.sdk/model/target/elixir.aontu +33 -0
- package/project/.sdk/model/target/haskell.aontu +47 -0
- package/project/.sdk/model/target/java.aontu +37 -0
- package/project/.sdk/model/target/kotlin.aontu +37 -0
- package/project/.sdk/model/target/ocaml.aontu +36 -0
- package/project/.sdk/model/target/perl.aontu +37 -0
- package/project/.sdk/model/target/rust.aontu +37 -0
- package/project/.sdk/model/target/scala.aontu +37 -0
- package/project/.sdk/model/target/swift.aontu +35 -0
- package/project/.sdk/model/target/zig.aontu +27 -0
- package/project/.sdk/src/cmp/c/Config_c.ts +109 -0
- package/project/.sdk/src/cmp/c/EntityBase_c.ts +61 -0
- package/project/.sdk/src/cmp/c/EntityOperation_c.ts +41 -0
- package/project/.sdk/src/cmp/c/Entity_c.ts +85 -0
- package/project/.sdk/src/cmp/c/Gitignore_c.ts +29 -0
- package/project/.sdk/src/cmp/c/MainEntity_c.ts +31 -0
- package/project/.sdk/src/cmp/c/Main_c.ts +83 -0
- package/project/.sdk/src/cmp/c/Package_c.ts +17 -0
- package/project/.sdk/src/cmp/c/TestDirect_c.ts +227 -0
- package/project/.sdk/src/cmp/c/TestEntity_c.ts +82 -0
- package/project/.sdk/src/cmp/c/Test_c.ts +51 -0
- package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +265 -0
- package/project/.sdk/src/cmp/c/fragment/EntityCreateOp.fragment.c +27 -0
- package/project/.sdk/src/cmp/c/fragment/EntityListOp.fragment.c +24 -0
- package/project/.sdk/src/cmp/c/fragment/EntityLoadOp.fragment.c +29 -0
- package/project/.sdk/src/cmp/c/fragment/EntityRemoveOp.fragment.c +29 -0
- package/project/.sdk/src/cmp/c/fragment/EntityUpdateOp.fragment.c +29 -0
- package/project/.sdk/src/cmp/c/fragment/Main.fragment.c +220 -0
- package/project/.sdk/src/cmp/c/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/c/utility_c.ts +102 -0
- package/project/.sdk/src/cmp/clojure/Config_clojure.ts +94 -0
- package/project/.sdk/src/cmp/clojure/EntityOperation_clojure.ts +35 -0
- package/project/.sdk/src/cmp/clojure/Entity_clojure.ts +77 -0
- package/project/.sdk/src/cmp/clojure/Gitignore_clojure.ts +28 -0
- package/project/.sdk/src/cmp/clojure/MainEntity_clojure.ts +21 -0
- package/project/.sdk/src/cmp/clojure/Main_clojure.ts +88 -0
- package/project/.sdk/src/cmp/clojure/Package_clojure.ts +41 -0
- package/project/.sdk/src/cmp/clojure/Test_clojure.ts +120 -0
- package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +158 -0
- package/project/.sdk/src/cmp/clojure/fragment/EntityCreateOp.fragment.clj +14 -0
- package/project/.sdk/src/cmp/clojure/fragment/EntityListOp.fragment.clj +17 -0
- package/project/.sdk/src/cmp/clojure/fragment/EntityLoadOp.fragment.clj +15 -0
- package/project/.sdk/src/cmp/clojure/fragment/EntityRemoveOp.fragment.clj +15 -0
- package/project/.sdk/src/cmp/clojure/fragment/EntityUpdateOp.fragment.clj +15 -0
- package/project/.sdk/src/cmp/clojure/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/clojure/utility_clojure.ts +82 -0
- package/project/.sdk/src/cmp/cpp/Config_cpp.ts +136 -0
- package/project/.sdk/src/cmp/cpp/EntityBase_cpp.ts +51 -0
- package/project/.sdk/src/cmp/cpp/EntityOperation_cpp.ts +37 -0
- package/project/.sdk/src/cmp/cpp/Entity_cpp.ts +78 -0
- package/project/.sdk/src/cmp/cpp/Gitignore_cpp.ts +27 -0
- package/project/.sdk/src/cmp/cpp/MainEntity_cpp.ts +35 -0
- package/project/.sdk/src/cmp/cpp/Main_cpp.ts +84 -0
- package/project/.sdk/src/cmp/cpp/Package_cpp.ts +17 -0
- package/project/.sdk/src/cmp/cpp/TestDirect_cpp.ts +258 -0
- package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +454 -0
- package/project/.sdk/src/cmp/cpp/Test_cpp.ts +36 -0
- package/project/.sdk/src/cmp/cpp/fragment/Entity.fragment.cpp +40 -0
- package/project/.sdk/src/cmp/cpp/fragment/EntityCreateOp.fragment.cpp +22 -0
- package/project/.sdk/src/cmp/cpp/fragment/EntityListOp.fragment.cpp +21 -0
- package/project/.sdk/src/cmp/cpp/fragment/EntityLoadOp.fragment.cpp +25 -0
- package/project/.sdk/src/cmp/cpp/fragment/EntityRemoveOp.fragment.cpp +21 -0
- package/project/.sdk/src/cmp/cpp/fragment/EntityUpdateOp.fragment.cpp +22 -0
- package/project/.sdk/src/cmp/cpp/fragment/Main.fragment.cpp +43 -0
- package/project/.sdk/src/cmp/cpp/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/cpp/utility_cpp.ts +83 -0
- package/project/.sdk/src/cmp/csharp/Config_csharp.ts +134 -0
- package/project/.sdk/src/cmp/csharp/EntityBase_csharp.ts +39 -0
- package/project/.sdk/src/cmp/csharp/EntityOperation_csharp.ts +41 -0
- package/project/.sdk/src/cmp/csharp/Entity_csharp.ts +85 -0
- package/project/.sdk/src/cmp/csharp/Gitignore_csharp.ts +38 -0
- package/project/.sdk/src/cmp/csharp/MainEntity_csharp.ts +36 -0
- package/project/.sdk/src/cmp/csharp/Main_csharp.ts +91 -0
- package/project/.sdk/src/cmp/csharp/Package_csharp.ts +101 -0
- package/project/.sdk/src/cmp/csharp/SdkError_csharp.ts +42 -0
- package/project/.sdk/src/cmp/csharp/TestDirect_csharp.ts +560 -0
- package/project/.sdk/src/cmp/csharp/TestEntity_csharp.ts +618 -0
- package/project/.sdk/src/cmp/csharp/Test_csharp.ts +38 -0
- package/project/.sdk/src/cmp/csharp/fragment/Entity.fragment.cs +28 -0
- package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +268 -0
- package/project/.sdk/src/cmp/csharp/fragment/EntityCreateOp.fragment.cs +37 -0
- package/project/.sdk/src/cmp/csharp/fragment/EntityListOp.fragment.cs +35 -0
- package/project/.sdk/src/cmp/csharp/fragment/EntityLoadOp.fragment.cs +41 -0
- package/project/.sdk/src/cmp/csharp/fragment/EntityRemoveOp.fragment.cs +41 -0
- package/project/.sdk/src/cmp/csharp/fragment/EntityUpdateOp.fragment.cs +41 -0
- package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +278 -0
- package/project/.sdk/src/cmp/csharp/fragment/SdkError.fragment.cs +21 -0
- package/project/.sdk/src/cmp/csharp/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/csharp/utility_csharp.ts +143 -0
- package/project/.sdk/src/cmp/dart/Config_dart.ts +99 -0
- package/project/.sdk/src/cmp/dart/EntityBase_dart.ts +34 -0
- package/project/.sdk/src/cmp/dart/EntityOperation_dart.ts +43 -0
- package/project/.sdk/src/cmp/dart/EntityTypes_dart.ts +190 -0
- package/project/.sdk/src/cmp/dart/Entity_dart.ts +79 -0
- package/project/.sdk/src/cmp/dart/Gitignore_dart.ts +34 -0
- package/project/.sdk/src/cmp/dart/MainEntity_dart.ts +33 -0
- package/project/.sdk/src/cmp/dart/Main_dart.ts +105 -0
- package/project/.sdk/src/cmp/dart/Package_dart.ts +81 -0
- package/project/.sdk/src/cmp/dart/SdkError_dart.ts +42 -0
- package/project/.sdk/src/cmp/dart/TestDirect_dart.ts +498 -0
- package/project/.sdk/src/cmp/dart/TestEntity_dart.ts +552 -0
- package/project/.sdk/src/cmp/dart/Test_dart.ts +105 -0
- package/project/.sdk/src/cmp/dart/fragment/Config.fragment.dart +48 -0
- package/project/.sdk/src/cmp/dart/fragment/Direct.test.fragment.dart +25 -0
- package/project/.sdk/src/cmp/dart/fragment/Entity.fragment.dart +31 -0
- package/project/.sdk/src/cmp/dart/fragment/Entity.test.fragment.dart +67 -0
- package/project/.sdk/src/cmp/dart/fragment/EntityBase.fragment.dart +285 -0
- package/project/.sdk/src/cmp/dart/fragment/EntityCreateOp.fragment.dart +90 -0
- package/project/.sdk/src/cmp/dart/fragment/EntityListOp.fragment.dart +90 -0
- package/project/.sdk/src/cmp/dart/fragment/EntityLoadOp.fragment.dart +94 -0
- package/project/.sdk/src/cmp/dart/fragment/EntityRemoveOp.fragment.dart +94 -0
- package/project/.sdk/src/cmp/dart/fragment/EntityUpdateOp.fragment.dart +94 -0
- package/project/.sdk/src/cmp/dart/fragment/Main.fragment.dart +240 -0
- package/project/.sdk/src/cmp/dart/fragment/SdkError.fragment.dart +18 -0
- package/project/.sdk/src/cmp/dart/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/dart/utility_dart.ts +86 -0
- package/project/.sdk/src/cmp/elixir/Config_elixir.ts +101 -0
- package/project/.sdk/src/cmp/elixir/EntityOperation_elixir.ts +27 -0
- package/project/.sdk/src/cmp/elixir/Entity_elixir.ts +54 -0
- package/project/.sdk/src/cmp/elixir/Gitignore_elixir.ts +28 -0
- package/project/.sdk/src/cmp/elixir/MainEntity_elixir.ts +26 -0
- package/project/.sdk/src/cmp/elixir/Main_elixir.ts +124 -0
- package/project/.sdk/src/cmp/elixir/Package_elixir.ts +64 -0
- package/project/.sdk/src/cmp/elixir/TestDirect_elixir.ts +95 -0
- package/project/.sdk/src/cmp/elixir/TestEntity_elixir.ts +115 -0
- package/project/.sdk/src/cmp/elixir/Test_elixir.ts +47 -0
- package/project/.sdk/src/cmp/elixir/fragment/Entity.fragment.ex +37 -0
- package/project/.sdk/src/cmp/elixir/fragment/EntityCreateOp.fragment.ex +28 -0
- package/project/.sdk/src/cmp/elixir/fragment/EntityListOp.fragment.ex +30 -0
- package/project/.sdk/src/cmp/elixir/fragment/EntityLoadOp.fragment.ex +32 -0
- package/project/.sdk/src/cmp/elixir/fragment/EntityRemoveOp.fragment.ex +32 -0
- package/project/.sdk/src/cmp/elixir/fragment/EntityUpdateOp.fragment.ex +30 -0
- package/project/.sdk/src/cmp/elixir/fragment/Main.fragment.ex +218 -0
- package/project/.sdk/src/cmp/elixir/fragment/Pipeline.fragment.ex +62 -0
- package/project/.sdk/src/cmp/elixir/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/elixir/utility_elixir.ts +85 -0
- package/project/.sdk/src/cmp/go/TestEntity_go.ts +54 -0
- package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +133 -0
- package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +14 -8
- package/project/.sdk/src/cmp/haskell/Config_haskell.ts +115 -0
- package/project/.sdk/src/cmp/haskell/Entity_haskell.ts +13 -0
- package/project/.sdk/src/cmp/haskell/Gitignore_haskell.ts +27 -0
- package/project/.sdk/src/cmp/haskell/Main_haskell.ts +123 -0
- package/project/.sdk/src/cmp/haskell/Package_haskell.ts +58 -0
- package/project/.sdk/src/cmp/haskell/Test_haskell.ts +263 -0
- package/project/.sdk/src/cmp/haskell/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/haskell/utility_haskell.ts +105 -0
- package/project/.sdk/src/cmp/java/Config_java.ts +138 -0
- package/project/.sdk/src/cmp/java/EntityBase_java.ts +50 -0
- package/project/.sdk/src/cmp/java/EntityOperation_java.ts +48 -0
- package/project/.sdk/src/cmp/java/Entity_java.ts +95 -0
- package/project/.sdk/src/cmp/java/Gitignore_java.ts +37 -0
- package/project/.sdk/src/cmp/java/MainEntity_java.ts +41 -0
- package/project/.sdk/src/cmp/java/Main_java.ts +100 -0
- package/project/.sdk/src/cmp/java/Package_java.ts +126 -0
- package/project/.sdk/src/cmp/java/SdkError_java.ts +49 -0
- package/project/.sdk/src/cmp/java/TestDirect_java.ts +509 -0
- package/project/.sdk/src/cmp/java/TestEntity_java.ts +599 -0
- package/project/.sdk/src/cmp/java/Test_java.ts +42 -0
- package/project/.sdk/src/cmp/java/fragment/Entity.fragment.java +35 -0
- package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +235 -0
- package/project/.sdk/src/cmp/java/fragment/EntityCreateOp.fragment.java +42 -0
- package/project/.sdk/src/cmp/java/fragment/EntityListOp.fragment.java +39 -0
- package/project/.sdk/src/cmp/java/fragment/EntityLoadOp.fragment.java +45 -0
- package/project/.sdk/src/cmp/java/fragment/EntityRemoveOp.fragment.java +45 -0
- package/project/.sdk/src/cmp/java/fragment/EntityUpdateOp.fragment.java +45 -0
- package/project/.sdk/src/cmp/java/fragment/Main.fragment.java +34 -0
- package/project/.sdk/src/cmp/java/fragment/SdkError.fragment.java +27 -0
- package/project/.sdk/src/cmp/java/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/java/utility_java.ts +102 -0
- package/project/.sdk/src/cmp/js/Config_js.ts +4 -2
- package/project/.sdk/src/cmp/js/TestEntity_js.ts +1 -0
- package/project/.sdk/src/cmp/js/fragment/Entity.test.fragment.js +32 -1
- package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +81 -0
- package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +10 -5
- package/project/.sdk/src/cmp/kotlin/Config_kotlin.ts +128 -0
- package/project/.sdk/src/cmp/kotlin/EntityBase_kotlin.ts +50 -0
- package/project/.sdk/src/cmp/kotlin/EntityOperation_kotlin.ts +48 -0
- package/project/.sdk/src/cmp/kotlin/Entity_kotlin.ts +93 -0
- package/project/.sdk/src/cmp/kotlin/Gitignore_kotlin.ts +41 -0
- package/project/.sdk/src/cmp/kotlin/MainEntity_kotlin.ts +40 -0
- package/project/.sdk/src/cmp/kotlin/Main_kotlin.ts +94 -0
- package/project/.sdk/src/cmp/kotlin/Package_kotlin.ts +110 -0
- package/project/.sdk/src/cmp/kotlin/SdkError_kotlin.ts +48 -0
- package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +479 -0
- package/project/.sdk/src/cmp/kotlin/TestEntity_kotlin.ts +567 -0
- package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +42 -0
- package/project/.sdk/src/cmp/kotlin/fragment/Entity.fragment.kt +28 -0
- package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +195 -0
- package/project/.sdk/src/cmp/kotlin/fragment/EntityCreateOp.fragment.kt +37 -0
- package/project/.sdk/src/cmp/kotlin/fragment/EntityListOp.fragment.kt +34 -0
- package/project/.sdk/src/cmp/kotlin/fragment/EntityLoadOp.fragment.kt +40 -0
- package/project/.sdk/src/cmp/kotlin/fragment/EntityRemoveOp.fragment.kt +40 -0
- package/project/.sdk/src/cmp/kotlin/fragment/EntityUpdateOp.fragment.kt +40 -0
- package/project/.sdk/src/cmp/kotlin/fragment/Main.fragment.kt +28 -0
- package/project/.sdk/src/cmp/kotlin/fragment/SdkError.fragment.kt +24 -0
- package/project/.sdk/src/cmp/kotlin/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/kotlin/utility_kotlin.ts +101 -0
- package/project/.sdk/src/cmp/lua/Entity_lua.ts +7 -9
- package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +47 -0
- package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +137 -0
- package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +9 -6
- package/project/.sdk/src/cmp/ocaml/Config_ocaml.ts +114 -0
- package/project/.sdk/src/cmp/ocaml/EntityOperation_ocaml.ts +63 -0
- package/project/.sdk/src/cmp/ocaml/Entity_ocaml.ts +152 -0
- package/project/.sdk/src/cmp/ocaml/Gitignore_ocaml.ts +37 -0
- package/project/.sdk/src/cmp/ocaml/MainEntity_ocaml.ts +28 -0
- package/project/.sdk/src/cmp/ocaml/Main_ocaml.ts +111 -0
- package/project/.sdk/src/cmp/ocaml/Package_ocaml.ts +47 -0
- package/project/.sdk/src/cmp/ocaml/SdkError_ocaml.ts +42 -0
- package/project/.sdk/src/cmp/ocaml/TestDirect_ocaml.ts +47 -0
- package/project/.sdk/src/cmp/ocaml/TestEntity_ocaml.ts +130 -0
- package/project/.sdk/src/cmp/ocaml/Test_ocaml.ts +35 -0
- package/project/.sdk/src/cmp/ocaml/fragment/RunOp.fragment.ml +32 -0
- package/project/.sdk/src/cmp/ocaml/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/ocaml/utility_ocaml.ts +129 -0
- package/project/.sdk/src/cmp/perl/Config_perl.ts +127 -0
- package/project/.sdk/src/cmp/perl/EntityOperation_perl.ts +42 -0
- package/project/.sdk/src/cmp/perl/Entity_perl.ts +84 -0
- package/project/.sdk/src/cmp/perl/Gitignore_perl.ts +32 -0
- package/project/.sdk/src/cmp/perl/MainEntity_perl.ts +34 -0
- package/project/.sdk/src/cmp/perl/Main_perl.ts +140 -0
- package/project/.sdk/src/cmp/perl/Package_perl.ts +63 -0
- package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +433 -0
- package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +515 -0
- package/project/.sdk/src/cmp/perl/Test_perl.ts +54 -0
- package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +235 -0
- package/project/.sdk/src/cmp/perl/fragment/EntityCreateOp.fragment.pm +31 -0
- package/project/.sdk/src/cmp/perl/fragment/EntityListOp.fragment.pm +43 -0
- package/project/.sdk/src/cmp/perl/fragment/EntityLoadOp.fragment.pm +34 -0
- package/project/.sdk/src/cmp/perl/fragment/EntityRemoveOp.fragment.pm +32 -0
- package/project/.sdk/src/cmp/perl/fragment/EntityUpdateOp.fragment.pm +32 -0
- package/project/.sdk/src/cmp/perl/fragment/Main.fragment.pm +263 -0
- package/project/.sdk/src/cmp/perl/fragment/SdkError.fragment.pm +27 -0
- package/project/.sdk/src/cmp/perl/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/perl/utility_perl.ts +30 -0
- package/project/.sdk/src/cmp/php/TestEntity_php.ts +45 -0
- package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +124 -0
- package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +13 -6
- package/project/.sdk/src/cmp/py/Entity_py.ts +8 -9
- package/project/.sdk/src/cmp/py/TestEntity_py.ts +40 -0
- package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +135 -28
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +9 -6
- package/project/.sdk/src/cmp/rb/Entity_rb.ts +8 -9
- package/project/.sdk/src/cmp/rb/ReadmeExamplesTest_rb.ts +4 -1
- package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +42 -0
- package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +122 -23
- package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +9 -6
- package/project/.sdk/src/cmp/rust/Config_rust.ts +118 -0
- package/project/.sdk/src/cmp/rust/EntityBase_rust.ts +59 -0
- package/project/.sdk/src/cmp/rust/EntityOperation_rust.ts +44 -0
- package/project/.sdk/src/cmp/rust/Entity_rust.ts +94 -0
- package/project/.sdk/src/cmp/rust/Gitignore_rust.ts +29 -0
- package/project/.sdk/src/cmp/rust/MainEntity_rust.ts +37 -0
- package/project/.sdk/src/cmp/rust/Main_rust.ts +146 -0
- package/project/.sdk/src/cmp/rust/Package_rust.ts +80 -0
- package/project/.sdk/src/cmp/rust/SdkError_rust.ts +42 -0
- package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +448 -0
- package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +635 -0
- package/project/.sdk/src/cmp/rust/Test_rust.ts +51 -0
- package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +288 -0
- package/project/.sdk/src/cmp/rust/fragment/EntityCreateOp.fragment.rs +29 -0
- package/project/.sdk/src/cmp/rust/fragment/EntityListOp.fragment.rs +26 -0
- package/project/.sdk/src/cmp/rust/fragment/EntityLoadOp.fragment.rs +35 -0
- package/project/.sdk/src/cmp/rust/fragment/EntityRemoveOp.fragment.rs +35 -0
- package/project/.sdk/src/cmp/rust/fragment/EntityUpdateOp.fragment.rs +35 -0
- package/project/.sdk/src/cmp/rust/fragment/Main.fragment.rs +296 -0
- package/project/.sdk/src/cmp/rust/fragment/SdkError.fragment.rs +34 -0
- package/project/.sdk/src/cmp/rust/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/rust/utility_rust.ts +104 -0
- package/project/.sdk/src/cmp/scala/Config_scala.ts +126 -0
- package/project/.sdk/src/cmp/scala/EntityBase_scala.ts +50 -0
- package/project/.sdk/src/cmp/scala/EntityOperation_scala.ts +46 -0
- package/project/.sdk/src/cmp/scala/Entity_scala.ts +87 -0
- package/project/.sdk/src/cmp/scala/Gitignore_scala.ts +31 -0
- package/project/.sdk/src/cmp/scala/MainEntity_scala.ts +40 -0
- package/project/.sdk/src/cmp/scala/Main_scala.ts +93 -0
- package/project/.sdk/src/cmp/scala/Package_scala.ts +22 -0
- package/project/.sdk/src/cmp/scala/TestDirect_scala.ts +233 -0
- package/project/.sdk/src/cmp/scala/TestEntity_scala.ts +397 -0
- package/project/.sdk/src/cmp/scala/Test_scala.ts +93 -0
- package/project/.sdk/src/cmp/scala/fragment/Entity.fragment.scala +24 -0
- package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +169 -0
- package/project/.sdk/src/cmp/scala/fragment/EntityCreateOp.fragment.scala +32 -0
- package/project/.sdk/src/cmp/scala/fragment/EntityListOp.fragment.scala +28 -0
- package/project/.sdk/src/cmp/scala/fragment/EntityLoadOp.fragment.scala +33 -0
- package/project/.sdk/src/cmp/scala/fragment/EntityRemoveOp.fragment.scala +33 -0
- package/project/.sdk/src/cmp/scala/fragment/EntityUpdateOp.fragment.scala +33 -0
- package/project/.sdk/src/cmp/scala/fragment/Main.fragment.scala +27 -0
- package/project/.sdk/src/cmp/scala/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/scala/utility_scala.ts +99 -0
- package/project/.sdk/src/cmp/swift/Config_swift.ts +127 -0
- package/project/.sdk/src/cmp/swift/EntityBase_swift.ts +38 -0
- package/project/.sdk/src/cmp/swift/EntityOperation_swift.ts +39 -0
- package/project/.sdk/src/cmp/swift/Entity_swift.ts +86 -0
- package/project/.sdk/src/cmp/swift/Gitignore_swift.ts +32 -0
- package/project/.sdk/src/cmp/swift/MainEntity_swift.ts +35 -0
- package/project/.sdk/src/cmp/swift/Main_swift.ts +94 -0
- package/project/.sdk/src/cmp/swift/Package_swift.ts +66 -0
- package/project/.sdk/src/cmp/swift/SdkError_swift.ts +41 -0
- package/project/.sdk/src/cmp/swift/TestDirect_swift.ts +84 -0
- package/project/.sdk/src/cmp/swift/TestEntity_swift.ts +84 -0
- package/project/.sdk/src/cmp/swift/Test_swift.ts +39 -0
- package/project/.sdk/src/cmp/swift/fragment/Entity.fragment.swift +23 -0
- package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +202 -0
- package/project/.sdk/src/cmp/swift/fragment/EntityCreateOp.fragment.swift +23 -0
- package/project/.sdk/src/cmp/swift/fragment/EntityListOp.fragment.swift +21 -0
- package/project/.sdk/src/cmp/swift/fragment/EntityLoadOp.fragment.swift +24 -0
- package/project/.sdk/src/cmp/swift/fragment/EntityRemoveOp.fragment.swift +24 -0
- package/project/.sdk/src/cmp/swift/fragment/EntityUpdateOp.fragment.swift +24 -0
- package/project/.sdk/src/cmp/swift/fragment/Main.fragment.swift +211 -0
- package/project/.sdk/src/cmp/swift/fragment/SdkError.fragment.swift +22 -0
- package/project/.sdk/src/cmp/swift/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/swift/utility_swift.ts +76 -0
- package/project/.sdk/src/cmp/ts/Config_ts.ts +4 -2
- package/project/.sdk/src/cmp/ts/Package_ts.ts +12 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +81 -0
- package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +10 -5
- package/project/.sdk/src/cmp/zig/Config_zig.ts +113 -0
- package/project/.sdk/src/cmp/zig/EntityOperation_zig.ts +39 -0
- package/project/.sdk/src/cmp/zig/Entity_zig.ts +89 -0
- package/project/.sdk/src/cmp/zig/Gitignore_zig.ts +27 -0
- package/project/.sdk/src/cmp/zig/MainEntity_zig.ts +38 -0
- package/project/.sdk/src/cmp/zig/Main_zig.ts +78 -0
- package/project/.sdk/src/cmp/zig/Test_zig.ts +114 -0
- package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +278 -0
- package/project/.sdk/src/cmp/zig/fragment/EntityCreateOp.fragment.zig +24 -0
- package/project/.sdk/src/cmp/zig/fragment/EntityListOp.fragment.zig +21 -0
- package/project/.sdk/src/cmp/zig/fragment/EntityLoadOp.fragment.zig +26 -0
- package/project/.sdk/src/cmp/zig/fragment/EntityRemoveOp.fragment.zig +26 -0
- package/project/.sdk/src/cmp/zig/fragment/EntityUpdateOp.fragment.zig +26 -0
- package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +258 -0
- package/project/.sdk/src/cmp/zig/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/zig/utility_zig.ts +95 -0
- package/project/.sdk/tm/c/LICENSE +22 -0
- package/project/.sdk/tm/c/Makefile +50 -0
- package/project/.sdk/tm/c/VERSION +1 -0
- package/project/.sdk/tm/c/core/context.c +145 -0
- package/project/.sdk/tm/c/core/control.c +19 -0
- package/project/.sdk/tm/c/core/error.c +24 -0
- package/project/.sdk/tm/c/core/helpers.c +228 -0
- package/project/.sdk/tm/c/core/operation.c +34 -0
- package/project/.sdk/tm/c/core/point.c +49 -0
- package/project/.sdk/tm/c/core/response.c +29 -0
- package/project/.sdk/tm/c/core/result.c +60 -0
- package/project/.sdk/tm/c/core/sdk.h +514 -0
- package/project/.sdk/tm/c/core/spec.c +94 -0
- package/project/.sdk/tm/c/core/utility.c +74 -0
- package/project/.sdk/tm/c/feature/audit.c +134 -0
- package/project/.sdk/tm/c/feature/base.c +40 -0
- package/project/.sdk/tm/c/feature/cache.c +262 -0
- package/project/.sdk/tm/c/feature/clienttrack.c +144 -0
- package/project/.sdk/tm/c/feature/debug.c +230 -0
- package/project/.sdk/tm/c/feature/idempotency.c +164 -0
- package/project/.sdk/tm/c/feature/log.c +79 -0
- package/project/.sdk/tm/c/feature/metrics.c +177 -0
- package/project/.sdk/tm/c/feature/netsim.c +211 -0
- package/project/.sdk/tm/c/feature/paging.c +223 -0
- package/project/.sdk/tm/c/feature/proxy.c +249 -0
- package/project/.sdk/tm/c/feature/ratelimit.c +124 -0
- package/project/.sdk/tm/c/feature/rbac.c +167 -0
- package/project/.sdk/tm/c/feature/retry.c +164 -0
- package/project/.sdk/tm/c/feature/streaming.c +147 -0
- package/project/.sdk/tm/c/feature/support.c +115 -0
- package/project/.sdk/tm/c/feature/telemetry.c +205 -0
- package/project/.sdk/tm/c/feature/test.c +385 -0
- package/project/.sdk/tm/c/feature/timeout.c +106 -0
- package/project/.sdk/tm/c/src/feature/README.md +1 -0
- package/project/.sdk/tm/c/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/c/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/c/tests/ctest.h +58 -0
- package/project/.sdk/tm/c/tests/feature_harness.h +441 -0
- package/project/.sdk/tm/c/tests/feature_test.c +1210 -0
- package/project/.sdk/tm/c/tests/pipeline_test.c +561 -0
- package/project/.sdk/tm/c/tests/primary_utility_test.c +573 -0
- package/project/.sdk/tm/c/tests/runner.h +274 -0
- package/project/.sdk/tm/c/tests/sdk_pipeline_test.c +89 -0
- package/project/.sdk/tm/c/tests/struct_corpus_test.c +939 -0
- package/project/.sdk/tm/c/utility/clean.c +20 -0
- package/project/.sdk/tm/c/utility/done.c +26 -0
- package/project/.sdk/tm/c/utility/feature_add.c +42 -0
- package/project/.sdk/tm/c/utility/feature_hook.c +22 -0
- package/project/.sdk/tm/c/utility/feature_init.c +22 -0
- package/project/.sdk/tm/c/utility/fetcher.c +78 -0
- package/project/.sdk/tm/c/utility/jsonparse.c +11 -0
- package/project/.sdk/tm/c/utility/make_context.c +7 -0
- package/project/.sdk/tm/c/utility/make_error.c +66 -0
- package/project/.sdk/tm/c/utility/make_fetch_def.c +43 -0
- package/project/.sdk/tm/c/utility/make_options.c +179 -0
- package/project/.sdk/tm/c/utility/make_point.c +109 -0
- package/project/.sdk/tm/c/utility/make_request.c +62 -0
- package/project/.sdk/tm/c/utility/make_response.c +45 -0
- package/project/.sdk/tm/c/utility/make_result.c +61 -0
- package/project/.sdk/tm/c/utility/make_spec.c +60 -0
- package/project/.sdk/tm/c/utility/make_url.c +88 -0
- package/project/.sdk/tm/c/utility/param.c +58 -0
- package/project/.sdk/tm/c/utility/prepare_auth.c +65 -0
- package/project/.sdk/tm/c/utility/prepare_body.c +12 -0
- package/project/.sdk/tm/c/utility/prepare_headers.c +13 -0
- package/project/.sdk/tm/c/utility/prepare_method.c +16 -0
- package/project/.sdk/tm/c/utility/prepare_params.c +30 -0
- package/project/.sdk/tm/c/utility/prepare_path.c +17 -0
- package/project/.sdk/tm/c/utility/prepare_query.c +37 -0
- package/project/.sdk/tm/c/utility/result_basic.c +43 -0
- package/project/.sdk/tm/c/utility/result_body.c +17 -0
- package/project/.sdk/tm/c/utility/result_headers.c +17 -0
- package/project/.sdk/tm/c/utility/struct/inject.c +703 -0
- package/project/.sdk/tm/c/utility/struct/re_util.c +221 -0
- package/project/.sdk/tm/c/utility/struct/regex.c +1103 -0
- package/project/.sdk/tm/c/utility/struct/regex.h +84 -0
- package/project/.sdk/tm/c/utility/struct/transform.c +2224 -0
- package/project/.sdk/tm/c/utility/struct/utility.c +1971 -0
- package/project/.sdk/tm/c/utility/struct/value.c +640 -0
- package/project/.sdk/tm/c/utility/struct/value.h +273 -0
- package/project/.sdk/tm/c/utility/struct/value_io.c +366 -0
- package/project/.sdk/tm/c/utility/struct/value_io.h +31 -0
- package/project/.sdk/tm/c/utility/struct/voxgig_struct.h +216 -0
- package/project/.sdk/tm/c/utility/transform_request.c +21 -0
- package/project/.sdk/tm/c/utility/transform_response.c +36 -0
- package/project/.sdk/tm/clojure/LICENSE +22 -0
- package/project/.sdk/tm/clojure/Makefile +15 -0
- package/project/.sdk/tm/clojure/VERSION +1 -0
- package/project/.sdk/tm/clojure/src/feature/README.md +1 -0
- package/project/.sdk/tm/clojure/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/sdk/client.clj +119 -0
- package/project/.sdk/tm/clojure/src/sdk/core.clj +901 -0
- package/project/.sdk/tm/clojure/src/sdk/features.clj +1027 -0
- package/project/.sdk/tm/clojure/src/voxgig/struct.clj +1734 -0
- package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +596 -0
- package/project/.sdk/tm/clojure/test/sdk/test/netsim.clj +42 -0
- package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +314 -0
- package/project/.sdk/tm/clojure/test/sdk/test/primary.clj +52 -0
- package/project/.sdk/tm/clojure/test/sdk/test/struct_corpus.clj +337 -0
- package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +39 -0
- package/project/.sdk/tm/clojure/test/sdk/testutil.clj +35 -0
- package/project/.sdk/tm/cpp/LICENSE +22 -0
- package/project/.sdk/tm/cpp/Makefile +36 -0
- package/project/.sdk/tm/cpp/VERSION +1 -0
- package/project/.sdk/tm/cpp/core/sdk.hpp +16 -0
- package/project/.sdk/tm/cpp/core/struct.hpp +225 -0
- package/project/.sdk/tm/cpp/core/types.hpp +1105 -0
- package/project/.sdk/tm/cpp/feature/audit.hpp +107 -0
- package/project/.sdk/tm/cpp/feature/base.hpp +34 -0
- package/project/.sdk/tm/cpp/feature/cache.hpp +189 -0
- package/project/.sdk/tm/cpp/feature/clienttrack.hpp +105 -0
- package/project/.sdk/tm/cpp/feature/debug.hpp +157 -0
- package/project/.sdk/tm/cpp/feature/idempotency.hpp +119 -0
- package/project/.sdk/tm/cpp/feature/log.hpp +90 -0
- package/project/.sdk/tm/cpp/feature/metrics.hpp +103 -0
- package/project/.sdk/tm/cpp/feature/netsim.hpp +152 -0
- package/project/.sdk/tm/cpp/feature/options.hpp +156 -0
- package/project/.sdk/tm/cpp/feature/paging.hpp +156 -0
- package/project/.sdk/tm/cpp/feature/proxy.hpp +145 -0
- package/project/.sdk/tm/cpp/feature/ratelimit.hpp +87 -0
- package/project/.sdk/tm/cpp/feature/rbac.hpp +108 -0
- package/project/.sdk/tm/cpp/feature/retry.hpp +130 -0
- package/project/.sdk/tm/cpp/feature/streaming.hpp +98 -0
- package/project/.sdk/tm/cpp/feature/telemetry.hpp +139 -0
- package/project/.sdk/tm/cpp/feature/test.hpp +289 -0
- package/project/.sdk/tm/cpp/feature/timeout.hpp +88 -0
- package/project/.sdk/tm/cpp/src/feature/README.md +1 -0
- package/project/.sdk/tm/cpp/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/test/custom_utility_test.cpp +57 -0
- package/project/.sdk/tm/cpp/test/exists_test.cpp +16 -0
- package/project/.sdk/tm/cpp/test/feature_test.cpp +911 -0
- package/project/.sdk/tm/cpp/test/harness.hpp +344 -0
- package/project/.sdk/tm/cpp/test/netsim_test.cpp +48 -0
- package/project/.sdk/tm/cpp/test/pipeline_test.cpp +526 -0
- package/project/.sdk/tm/cpp/test/primary_utility_test.cpp +841 -0
- package/project/.sdk/tm/cpp/test/runner_support.hpp +437 -0
- package/project/.sdk/tm/cpp/test/sdk-test-control.json +19 -0
- package/project/.sdk/tm/cpp/test/struct_corpus_test.cpp +494 -0
- package/project/.sdk/tm/cpp/test/struct_runner.hpp +314 -0
- package/project/.sdk/tm/cpp/test/testlib.hpp +82 -0
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +1054 -0
- package/project/.sdk/tm/cpp/utility/voxgigstruct/value.hpp +525 -0
- package/project/.sdk/tm/cpp/utility/voxgigstruct/value_io.hpp +315 -0
- package/project/.sdk/tm/cpp/utility/voxgigstruct/voxgig_struct.hpp +3379 -0
- package/project/.sdk/tm/csharp/LICENSE +22 -0
- package/project/.sdk/tm/csharp/Makefile +43 -0
- package/project/.sdk/tm/csharp/VERSION +1 -0
- package/project/.sdk/tm/csharp/core/Context.cs +257 -0
- package/project/.sdk/tm/csharp/core/Control.cs +17 -0
- package/project/.sdk/tm/csharp/core/Helpers.cs +61 -0
- package/project/.sdk/tm/csharp/core/Operation.cs +51 -0
- package/project/.sdk/tm/csharp/core/Point.cs +68 -0
- package/project/.sdk/tm/csharp/core/Response.cs +45 -0
- package/project/.sdk/tm/csharp/core/Result.cs +63 -0
- package/project/.sdk/tm/csharp/core/Spec.cs +81 -0
- package/project/.sdk/tm/csharp/core/Types.cs +21 -0
- package/project/.sdk/tm/csharp/core/Utility.cs +88 -0
- package/project/.sdk/tm/csharp/feature/AuditFeature.cs +116 -0
- package/project/.sdk/tm/csharp/feature/BaseFeature.cs +39 -0
- package/project/.sdk/tm/csharp/feature/CacheFeature.cs +186 -0
- package/project/.sdk/tm/csharp/feature/ClienttrackFeature.cs +103 -0
- package/project/.sdk/tm/csharp/feature/DebugFeature.cs +157 -0
- package/project/.sdk/tm/csharp/feature/FeatureOptions.cs +197 -0
- package/project/.sdk/tm/csharp/feature/IdempotencyFeature.cs +97 -0
- package/project/.sdk/tm/csharp/feature/LogFeature.cs +109 -0
- package/project/.sdk/tm/csharp/feature/MetricsFeature.cs +117 -0
- package/project/.sdk/tm/csharp/feature/NetsimFeature.cs +200 -0
- package/project/.sdk/tm/csharp/feature/PagingFeature.cs +187 -0
- package/project/.sdk/tm/csharp/feature/ProxyFeature.cs +138 -0
- package/project/.sdk/tm/csharp/feature/RatelimitFeature.cs +89 -0
- package/project/.sdk/tm/csharp/feature/RbacFeature.cs +124 -0
- package/project/.sdk/tm/csharp/feature/RetryFeature.cs +174 -0
- package/project/.sdk/tm/csharp/feature/StreamingFeature.cs +93 -0
- package/project/.sdk/tm/csharp/feature/TelemetryFeature.cs +145 -0
- package/project/.sdk/tm/csharp/feature/TestFeature.cs +368 -0
- package/project/.sdk/tm/csharp/feature/TimeoutFeature.cs +69 -0
- package/project/.sdk/tm/csharp/src/feature/README.md +1 -0
- package/project/.sdk/tm/csharp/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/test/CustomUtilityTest.cs +51 -0
- package/project/.sdk/tm/csharp/test/ExistsTest.cs +17 -0
- package/project/.sdk/tm/csharp/test/FeatureTest.cs +1653 -0
- package/project/.sdk/tm/csharp/test/NetsimTest.cs +67 -0
- package/project/.sdk/tm/csharp/test/PipelineTest.cs +605 -0
- package/project/.sdk/tm/csharp/test/PrimaryUtilityTest.cs +957 -0
- package/project/.sdk/tm/csharp/test/Runner.cs +626 -0
- package/project/.sdk/tm/csharp/test/StructRunner.cs +276 -0
- package/project/.sdk/tm/csharp/test/StructUtilityTest.cs +1273 -0
- package/project/.sdk/tm/csharp/test/sdk-test-control.json +19 -0
- package/project/.sdk/tm/csharp/utility/Clean.cs +11 -0
- package/project/.sdk/tm/csharp/utility/Done.cs +28 -0
- package/project/.sdk/tm/csharp/utility/FeatureAdd.cs +54 -0
- package/project/.sdk/tm/csharp/utility/FeatureHook.cs +35 -0
- package/project/.sdk/tm/csharp/utility/FeatureInit.cs +28 -0
- package/project/.sdk/tm/csharp/utility/Fetcher.cs +181 -0
- package/project/.sdk/tm/csharp/utility/MakeContext.cs +11 -0
- package/project/.sdk/tm/csharp/utility/MakeError.cs +69 -0
- package/project/.sdk/tm/csharp/utility/MakeFetchDef.cs +38 -0
- package/project/.sdk/tm/csharp/utility/MakeOptions.cs +203 -0
- package/project/.sdk/tm/csharp/utility/MakePoint.cs +127 -0
- package/project/.sdk/tm/csharp/utility/MakeRequest.cs +87 -0
- package/project/.sdk/tm/csharp/utility/MakeResponse.cs +55 -0
- package/project/.sdk/tm/csharp/utility/MakeResult.cs +64 -0
- package/project/.sdk/tm/csharp/utility/MakeSpec.cs +64 -0
- package/project/.sdk/tm/csharp/utility/MakeUrl.cs +54 -0
- package/project/.sdk/tm/csharp/utility/Param.cs +67 -0
- package/project/.sdk/tm/csharp/utility/PrepareAuth.cs +54 -0
- package/project/.sdk/tm/csharp/utility/PrepareBody.cs +19 -0
- package/project/.sdk/tm/csharp/utility/PrepareHeaders.cs +22 -0
- package/project/.sdk/tm/csharp/utility/PrepareMethod.cs +22 -0
- package/project/.sdk/tm/csharp/utility/PrepareParams.cs +38 -0
- package/project/.sdk/tm/csharp/utility/PreparePath.cs +18 -0
- package/project/.sdk/tm/csharp/utility/PrepareQuery.cs +40 -0
- package/project/.sdk/tm/csharp/utility/Register.cs +41 -0
- package/project/.sdk/tm/csharp/utility/ResultBasic.cs +39 -0
- package/project/.sdk/tm/csharp/utility/ResultBody.cs +22 -0
- package/project/.sdk/tm/csharp/utility/ResultHeaders.cs +26 -0
- package/project/.sdk/tm/csharp/utility/TransformRequest.cs +39 -0
- package/project/.sdk/tm/csharp/utility/TransformResponse.cs +53 -0
- package/project/.sdk/tm/csharp/utility/struct/Struct.cs +3582 -0
- package/project/.sdk/tm/dart/LICENSE +22 -0
- package/project/.sdk/tm/dart/Makefile +50 -0
- package/project/.sdk/tm/dart/lib/Context.dart +150 -0
- package/project/.sdk/tm/dart/lib/Control.dart +15 -0
- package/project/.sdk/tm/dart/lib/Operation.dart +31 -0
- package/project/.sdk/tm/dart/lib/Point.dart +43 -0
- package/project/.sdk/tm/dart/lib/Response.dart +32 -0
- package/project/.sdk/tm/dart/lib/Result.dart +39 -0
- package/project/.sdk/tm/dart/lib/Spec.dart +49 -0
- package/project/.sdk/tm/dart/lib/feature/audit/AuditFeature.dart +103 -0
- package/project/.sdk/tm/dart/lib/feature/base/BaseFeature.dart +76 -0
- package/project/.sdk/tm/dart/lib/feature/cache/CacheFeature.dart +152 -0
- package/project/.sdk/tm/dart/lib/feature/clienttrack/ClienttrackFeature.dart +104 -0
- package/project/.sdk/tm/dart/lib/feature/debug/DebugFeature.dart +153 -0
- package/project/.sdk/tm/dart/lib/feature/idempotency/IdempotencyFeature.dart +92 -0
- package/project/.sdk/tm/dart/lib/feature/log/LogFeature.dart +85 -0
- package/project/.sdk/tm/dart/lib/feature/metrics/MetricsFeature.dart +103 -0
- package/project/.sdk/tm/dart/lib/feature/netsim/NetsimFeature.dart +186 -0
- package/project/.sdk/tm/dart/lib/feature/paging/PagingFeature.dart +145 -0
- package/project/.sdk/tm/dart/lib/feature/proxy/ProxyFeature.dart +118 -0
- package/project/.sdk/tm/dart/lib/feature/ratelimit/RatelimitFeature.dart +103 -0
- package/project/.sdk/tm/dart/lib/feature/rbac/RbacFeature.dart +121 -0
- package/project/.sdk/tm/dart/lib/feature/retry/RetryFeature.dart +155 -0
- package/project/.sdk/tm/dart/lib/feature/streaming/StreamingFeature.dart +97 -0
- package/project/.sdk/tm/dart/lib/feature/telemetry/TelemetryFeature.dart +136 -0
- package/project/.sdk/tm/dart/lib/feature/test/TestFeature.dart +270 -0
- package/project/.sdk/tm/dart/lib/feature/timeout/TimeoutFeature.dart +104 -0
- package/project/.sdk/tm/dart/lib/utility/CleanUtility.dart +12 -0
- package/project/.sdk/tm/dart/lib/utility/DoneUtility.dart +18 -0
- package/project/.sdk/tm/dart/lib/utility/ErrUtility.dart +46 -0
- package/project/.sdk/tm/dart/lib/utility/FeatureAddUtility.dart +35 -0
- package/project/.sdk/tm/dart/lib/utility/FeatureHookUtility.dart +20 -0
- package/project/.sdk/tm/dart/lib/utility/FeatureInitUtility.dart +9 -0
- package/project/.sdk/tm/dart/lib/utility/FetcherUtility.dart +95 -0
- package/project/.sdk/tm/dart/lib/utility/MakeContextUtility.dart +6 -0
- package/project/.sdk/tm/dart/lib/utility/MakeErrorUtility.dart +67 -0
- package/project/.sdk/tm/dart/lib/utility/MakeFetchDefUtility.dart +42 -0
- package/project/.sdk/tm/dart/lib/utility/MakeOptionsUtility.dart +147 -0
- package/project/.sdk/tm/dart/lib/utility/MakePointUtility.dart +84 -0
- package/project/.sdk/tm/dart/lib/utility/MakeRequestUtility.dart +63 -0
- package/project/.sdk/tm/dart/lib/utility/MakeResponseUtility.dart +54 -0
- package/project/.sdk/tm/dart/lib/utility/MakeResultUtility.dart +49 -0
- package/project/.sdk/tm/dart/lib/utility/MakeSpecUtility.dart +61 -0
- package/project/.sdk/tm/dart/lib/utility/MakeUrlUtility.dart +51 -0
- package/project/.sdk/tm/dart/lib/utility/ParamUtility.dart +56 -0
- package/project/.sdk/tm/dart/lib/utility/PrepareAuthUtility.dart +46 -0
- package/project/.sdk/tm/dart/lib/utility/PrepareBodyUtility.dart +19 -0
- package/project/.sdk/tm/dart/lib/utility/PrepareHeadersUtility.dart +11 -0
- package/project/.sdk/tm/dart/lib/utility/PrepareMethodUtility.dart +15 -0
- package/project/.sdk/tm/dart/lib/utility/PrepareParamsUtility.dart +23 -0
- package/project/.sdk/tm/dart/lib/utility/PreparePathUtility.dart +9 -0
- package/project/.sdk/tm/dart/lib/utility/PrepareQueryUtility.dart +18 -0
- package/project/.sdk/tm/dart/lib/utility/ResultBasicUtility.dart +29 -0
- package/project/.sdk/tm/dart/lib/utility/ResultBodyUtility.dart +15 -0
- package/project/.sdk/tm/dart/lib/utility/ResultHeadersUtility.dart +18 -0
- package/project/.sdk/tm/dart/lib/utility/StructUtility.dart +127 -0
- package/project/.sdk/tm/dart/lib/utility/TransformRequestUtility.dart +28 -0
- package/project/.sdk/tm/dart/lib/utility/TransformResponseUtility.dart +44 -0
- package/project/.sdk/tm/dart/lib/utility/Utility.dart +230 -0
- package/project/.sdk/tm/dart/lib/utility/voxgig_struct.dart +2456 -0
- package/project/.sdk/tm/dart/src/feature/README.md +3 -0
- package/project/.sdk/tm/dart/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/dart/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/dart/test/custom_test.dart +65 -0
- package/project/.sdk/tm/dart/test/exists_test.dart +12 -0
- package/project/.sdk/tm/dart/test/feature/harness.dart +329 -0
- package/project/.sdk/tm/dart/test/feature_test.dart +1139 -0
- package/project/.sdk/tm/dart/test/harness.dart +153 -0
- package/project/.sdk/tm/dart/test/netsim_test.dart +48 -0
- package/project/.sdk/tm/dart/test/pipeline_test.dart +608 -0
- package/project/.sdk/tm/dart/test/primary_test.dart +411 -0
- package/project/.sdk/tm/dart/test/runner.dart +406 -0
- package/project/.sdk/tm/dart/test/sdk-test-control.json +19 -0
- package/project/.sdk/tm/dart/test/struct_corpus.dart +531 -0
- package/project/.sdk/tm/dart/test/struct_test.dart +41 -0
- package/project/.sdk/tm/dart/test/utility.dart +159 -0
- package/project/.sdk/tm/elixir/LICENSE +21 -0
- package/project/.sdk/tm/elixir/Makefile +15 -0
- package/project/.sdk/tm/elixir/VERSION +1 -0
- package/project/.sdk/tm/elixir/lib/projectname/context.ex +138 -0
- package/project/.sdk/tm/elixir/lib/projectname/core.ex +125 -0
- package/project/.sdk/tm/elixir/lib/projectname/entity_base.ex +155 -0
- package/project/.sdk/tm/elixir/lib/projectname/error.ex +16 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/audit.ex +125 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/cache.ex +170 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/clienttrack.ex +136 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/debug.ex +232 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/idempotency.ex +107 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/log.ex +62 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/metrics.ex +130 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/netsim.ex +213 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/paging.ex +191 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/proxy.ex +142 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/ratelimit.ex +81 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/rbac.ex +139 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/retry.ex +150 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/streaming.ex +107 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/telemetry.ex +172 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/test.ex +285 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/timeout.ex +64 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature.ex +90 -0
- package/project/.sdk/tm/elixir/lib/projectname/helpers.ex +66 -0
- package/project/.sdk/tm/elixir/lib/projectname/json.ex +115 -0
- package/project/.sdk/tm/elixir/lib/projectname/utility.ex +1257 -0
- package/project/.sdk/tm/elixir/lib/utility/struct/voxgig_struct.ex +2615 -0
- package/project/.sdk/tm/elixir/src/feature/README.md +3 -0
- package/project/.sdk/tm/elixir/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/test/feature_test.exs +879 -0
- package/project/.sdk/tm/elixir/test/netsim_test.exs +58 -0
- package/project/.sdk/tm/elixir/test/pipeline_test.exs +558 -0
- package/project/.sdk/tm/elixir/test/primary_utility_test.exs +133 -0
- package/project/.sdk/tm/elixir/test/stream_test.exs +119 -0
- package/project/.sdk/tm/elixir/test/struct_corpus_test.exs +18 -0
- package/project/.sdk/tm/elixir/test/support/feature_harness.ex +346 -0
- package/project/.sdk/tm/elixir/test/support/struct_corpus.ex +677 -0
- package/project/.sdk/tm/elixir/test/test_helper.exs +1 -0
- package/project/.sdk/tm/go/core/context.go +10 -0
- package/project/.sdk/tm/go/core/control.go +2 -0
- package/project/.sdk/tm/go/core/result.go +6 -0
- package/project/.sdk/tm/go/core/types.go +1 -0
- package/project/.sdk/tm/go/feature/audit_feature.go +110 -0
- package/project/.sdk/tm/go/feature/base_feature.go +8 -0
- package/project/.sdk/tm/go/feature/cache_feature.go +171 -0
- package/project/.sdk/tm/go/feature/clienttrack_feature.go +100 -0
- package/project/.sdk/tm/go/feature/debug_feature.go +159 -0
- package/project/.sdk/tm/go/feature/feature_options.go +204 -0
- package/project/.sdk/tm/go/feature/idempotency_feature.go +115 -0
- package/project/.sdk/tm/go/feature/metrics_feature.go +112 -0
- package/project/.sdk/tm/go/feature/netsim_feature.go +184 -0
- package/project/.sdk/tm/go/feature/paging_feature.go +173 -0
- package/project/.sdk/tm/go/feature/proxy_feature.go +121 -0
- package/project/.sdk/tm/go/feature/ratelimit_feature.go +88 -0
- package/project/.sdk/tm/go/feature/rbac_feature.go +126 -0
- package/project/.sdk/tm/go/feature/retry_feature.go +165 -0
- package/project/.sdk/tm/go/feature/streaming_feature.go +119 -0
- package/project/.sdk/tm/go/feature/telemetry_feature.go +142 -0
- package/project/.sdk/tm/go/feature/test_feature.go +78 -3
- package/project/.sdk/tm/go/feature/timeout_feature.go +88 -0
- package/project/.sdk/tm/go/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/go/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/go/test/feature_test.go +1465 -0
- package/project/.sdk/tm/go/test/netsim_test.go +70 -0
- package/project/.sdk/tm/go/test/pipeline_test.go +571 -0
- package/project/.sdk/tm/go/utility/feature_add.go +38 -0
- package/project/.sdk/tm/go/utility/fetcher.go +13 -1
- package/project/.sdk/tm/go/utility/make_error.go +8 -0
- package/project/.sdk/tm/go/utility/make_options.go +62 -0
- package/project/.sdk/tm/go/utility/make_point.go +6 -0
- package/project/.sdk/tm/go-cli/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/LICENSE +21 -0
- package/project/.sdk/tm/haskell/Makefile +22 -0
- package/project/.sdk/tm/haskell/VERSION +1 -0
- package/project/.sdk/tm/haskell/src/SdkFeatures.hs +1278 -0
- package/project/.sdk/tm/haskell/src/SdkHelpers.hs +337 -0
- package/project/.sdk/tm/haskell/src/SdkRuntime.hs +1007 -0
- package/project/.sdk/tm/haskell/src/SdkTypes.hs +186 -0
- package/project/.sdk/tm/haskell/src/VoxgigStruct.hs +2299 -0
- package/project/.sdk/tm/haskell/src/Vregex.hs +237 -0
- package/project/.sdk/tm/haskell/src/feature/README.md +5 -0
- package/project/.sdk/tm/haskell/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/test/Harness.hs +276 -0
- package/project/.sdk/tm/haskell/test/Runner.hs +47 -0
- package/project/.sdk/tm/haskell/test/StructCorpus.hs +449 -0
- package/project/.sdk/tm/haskell/test/TCustomUtility.hs +38 -0
- package/project/.sdk/tm/haskell/test/TFeature.hs +794 -0
- package/project/.sdk/tm/haskell/test/TNetsim.hs +50 -0
- package/project/.sdk/tm/haskell/test/TPipeline.hs +334 -0
- package/project/.sdk/tm/haskell/test/TPrimaryUtility.hs +386 -0
- package/project/.sdk/tm/haskell/test/TestJson.hs +107 -0
- package/project/.sdk/tm/haskell/test/Testutil.hs +59 -0
- package/project/.sdk/tm/java/LICENSE +22 -0
- package/project/.sdk/tm/java/Makefile +44 -0
- package/project/.sdk/tm/java/VERSION +1 -0
- package/project/.sdk/tm/java/core/Context.java +269 -0
- package/project/.sdk/tm/java/core/Control.java +23 -0
- package/project/.sdk/tm/java/core/Entity.java +13 -0
- package/project/.sdk/tm/java/core/Feature.java +45 -0
- package/project/.sdk/tm/java/core/FeaturePlacement.java +13 -0
- package/project/.sdk/tm/java/core/Helpers.java +50 -0
- package/project/.sdk/tm/java/core/Operation.java +47 -0
- package/project/.sdk/tm/java/core/Point.java +90 -0
- package/project/.sdk/tm/java/core/Response.java +48 -0
- package/project/.sdk/tm/java/core/Result.java +64 -0
- package/project/.sdk/tm/java/core/SdkClient.java +280 -0
- package/project/.sdk/tm/java/core/SdkEntity.java +28 -0
- package/project/.sdk/tm/java/core/Spec.java +84 -0
- package/project/.sdk/tm/java/core/Utility.java +128 -0
- package/project/.sdk/tm/java/feature/AuditFeature.java +113 -0
- package/project/.sdk/tm/java/feature/BaseFeature.java +91 -0
- package/project/.sdk/tm/java/feature/CacheFeature.java +184 -0
- package/project/.sdk/tm/java/feature/ClienttrackFeature.java +103 -0
- package/project/.sdk/tm/java/feature/DebugFeature.java +163 -0
- package/project/.sdk/tm/java/feature/FeatureOptions.java +204 -0
- package/project/.sdk/tm/java/feature/IdempotencyFeature.java +115 -0
- package/project/.sdk/tm/java/feature/LogFeature.java +143 -0
- package/project/.sdk/tm/java/feature/MetricsFeature.java +115 -0
- package/project/.sdk/tm/java/feature/NetsimFeature.java +181 -0
- package/project/.sdk/tm/java/feature/PagingFeature.java +178 -0
- package/project/.sdk/tm/java/feature/ProxyFeature.java +122 -0
- package/project/.sdk/tm/java/feature/RatelimitFeature.java +83 -0
- package/project/.sdk/tm/java/feature/RbacFeature.java +132 -0
- package/project/.sdk/tm/java/feature/RetryFeature.java +156 -0
- package/project/.sdk/tm/java/feature/StreamingFeature.java +110 -0
- package/project/.sdk/tm/java/feature/TelemetryFeature.java +146 -0
- package/project/.sdk/tm/java/feature/TestFeature.java +333 -0
- package/project/.sdk/tm/java/feature/TimeoutFeature.java +89 -0
- package/project/.sdk/tm/java/src/feature/README.md +1 -0
- package/project/.sdk/tm/java/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/java/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/java/test/CustomUtilityTest.java +59 -0
- package/project/.sdk/tm/java/test/ExistsTest.java +16 -0
- package/project/.sdk/tm/java/test/FeatureHarness.java +448 -0
- package/project/.sdk/tm/java/test/FeatureTest.java +1018 -0
- package/project/.sdk/tm/java/test/NetsimTest.java +59 -0
- package/project/.sdk/tm/java/test/PipelineTest.java +618 -0
- package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +864 -0
- package/project/.sdk/tm/java/test/RunnerSupport.java +545 -0
- package/project/.sdk/tm/java/test/StructCorpusTest.java +351 -0
- package/project/.sdk/tm/java/test/StructRunner.java +281 -0
- package/project/.sdk/tm/java/test/sdk-test-control.json +19 -0
- package/project/.sdk/tm/java/utility/Clean.java +12 -0
- package/project/.sdk/tm/java/utility/Done.java +29 -0
- package/project/.sdk/tm/java/utility/FeatureAdd.java +59 -0
- package/project/.sdk/tm/java/utility/FeatureHookUtil.java +72 -0
- package/project/.sdk/tm/java/utility/FeatureInit.java +35 -0
- package/project/.sdk/tm/java/utility/Fetcher.java +170 -0
- package/project/.sdk/tm/java/utility/Json.java +268 -0
- package/project/.sdk/tm/java/utility/MakeContext.java +14 -0
- package/project/.sdk/tm/java/utility/MakeError.java +81 -0
- package/project/.sdk/tm/java/utility/MakeFetchDef.java +48 -0
- package/project/.sdk/tm/java/utility/MakeOptions.java +168 -0
- package/project/.sdk/tm/java/utility/MakePoint.java +118 -0
- package/project/.sdk/tm/java/utility/MakeRequest.java +83 -0
- package/project/.sdk/tm/java/utility/MakeResponse.java +54 -0
- package/project/.sdk/tm/java/utility/MakeResult.java +68 -0
- package/project/.sdk/tm/java/utility/MakeSpec.java +69 -0
- package/project/.sdk/tm/java/utility/MakeUrl.java +67 -0
- package/project/.sdk/tm/java/utility/Param.java +74 -0
- package/project/.sdk/tm/java/utility/PrepareAuth.java +66 -0
- package/project/.sdk/tm/java/utility/PrepareBody.java +16 -0
- package/project/.sdk/tm/java/utility/PrepareHeaders.java +28 -0
- package/project/.sdk/tm/java/utility/PrepareMethod.java +28 -0
- package/project/.sdk/tm/java/utility/PrepareParams.java +50 -0
- package/project/.sdk/tm/java/utility/PreparePath.java +26 -0
- package/project/.sdk/tm/java/utility/PrepareQuery.java +54 -0
- package/project/.sdk/tm/java/utility/Register.java +41 -0
- package/project/.sdk/tm/java/utility/ResultBasic.java +36 -0
- package/project/.sdk/tm/java/utility/ResultBody.java +23 -0
- package/project/.sdk/tm/java/utility/ResultHeaders.java +36 -0
- package/project/.sdk/tm/java/utility/TransformRequest.java +35 -0
- package/project/.sdk/tm/java/utility/TransformResponse.java +52 -0
- package/project/.sdk/tm/java/utility/struct/Struct.java +3550 -0
- package/project/.sdk/tm/js/src/feature/audit/AuditFeature.js +96 -0
- package/project/.sdk/tm/js/src/feature/cache/CacheFeature.js +150 -0
- package/project/.sdk/tm/js/src/feature/clienttrack/ClienttrackFeature.js +104 -0
- package/project/.sdk/tm/js/src/feature/debug/DebugFeature.js +132 -0
- package/project/.sdk/tm/js/src/feature/idempotency/IdempotencyFeature.js +95 -0
- package/project/.sdk/tm/js/src/feature/metrics/MetricsFeature.js +102 -0
- package/project/.sdk/tm/js/src/feature/netsim/NetsimFeature.js +187 -0
- package/project/.sdk/tm/js/src/feature/paging/PagingFeature.js +139 -0
- package/project/.sdk/tm/js/src/feature/proxy/ProxyFeature.js +110 -0
- package/project/.sdk/tm/js/src/feature/ratelimit/RatelimitFeature.js +106 -0
- package/project/.sdk/tm/js/src/feature/rbac/RbacFeature.js +102 -0
- package/project/.sdk/tm/js/src/feature/retry/RetryFeature.js +158 -0
- package/project/.sdk/tm/js/src/feature/streaming/StreamingFeature.js +96 -0
- package/project/.sdk/tm/js/src/feature/telemetry/TelemetryFeature.js +128 -0
- package/project/.sdk/tm/js/src/feature/test/TestFeature.js +58 -1
- package/project/.sdk/tm/js/src/feature/timeout/TimeoutFeature.js +101 -0
- package/project/.sdk/tm/js/src/utility/FeatureHookUtility.js +4 -1
- package/project/.sdk/tm/js/src/utility/MakeErrorUtility.js +9 -0
- package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +31 -1
- package/project/.sdk/tm/js/test/feature/harness.js +275 -0
- package/project/.sdk/tm/js/test/feature.test.js +772 -0
- package/project/.sdk/tm/js/test/netsim.test.js +43 -0
- package/project/.sdk/tm/js/test/pipeline.test.js +382 -0
- package/project/.sdk/tm/kotlin/LICENSE +22 -0
- package/project/.sdk/tm/kotlin/Makefile +43 -0
- package/project/.sdk/tm/kotlin/VERSION +1 -0
- package/project/.sdk/tm/kotlin/core/Context.kt +247 -0
- package/project/.sdk/tm/kotlin/core/Control.kt +21 -0
- package/project/.sdk/tm/kotlin/core/Helpers.kt +49 -0
- package/project/.sdk/tm/kotlin/core/Interfaces.kt +88 -0
- package/project/.sdk/tm/kotlin/core/Operation.kt +43 -0
- package/project/.sdk/tm/kotlin/core/Point.kt +83 -0
- package/project/.sdk/tm/kotlin/core/Response.kt +43 -0
- package/project/.sdk/tm/kotlin/core/Result.kt +61 -0
- package/project/.sdk/tm/kotlin/core/SdkClient.kt +266 -0
- package/project/.sdk/tm/kotlin/core/Spec.kt +76 -0
- package/project/.sdk/tm/kotlin/core/Utility.kt +93 -0
- package/project/.sdk/tm/kotlin/feature/AuditFeature.kt +96 -0
- package/project/.sdk/tm/kotlin/feature/BaseFeature.kt +57 -0
- package/project/.sdk/tm/kotlin/feature/CacheFeature.kt +167 -0
- package/project/.sdk/tm/kotlin/feature/ClienttrackFeature.kt +84 -0
- package/project/.sdk/tm/kotlin/feature/DebugFeature.kt +141 -0
- package/project/.sdk/tm/kotlin/feature/FeatureOptions.kt +191 -0
- package/project/.sdk/tm/kotlin/feature/IdempotencyFeature.kt +98 -0
- package/project/.sdk/tm/kotlin/feature/LogFeature.kt +92 -0
- package/project/.sdk/tm/kotlin/feature/MetricsFeature.kt +96 -0
- package/project/.sdk/tm/kotlin/feature/NetsimFeature.kt +162 -0
- package/project/.sdk/tm/kotlin/feature/PagingFeature.kt +143 -0
- package/project/.sdk/tm/kotlin/feature/ProxyFeature.kt +109 -0
- package/project/.sdk/tm/kotlin/feature/RatelimitFeature.kt +77 -0
- package/project/.sdk/tm/kotlin/feature/RbacFeature.kt +100 -0
- package/project/.sdk/tm/kotlin/feature/RetryFeature.kt +140 -0
- package/project/.sdk/tm/kotlin/feature/StreamingFeature.kt +90 -0
- package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +118 -0
- package/project/.sdk/tm/kotlin/feature/TestFeature.kt +306 -0
- package/project/.sdk/tm/kotlin/feature/TimeoutFeature.kt +74 -0
- package/project/.sdk/tm/kotlin/src/feature/README.md +1 -0
- package/project/.sdk/tm/kotlin/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/kotlin/test/CustomUtilityTest.kt +51 -0
- package/project/.sdk/tm/kotlin/test/ExistsTest.kt +15 -0
- package/project/.sdk/tm/kotlin/test/FeatureHarness.kt +380 -0
- package/project/.sdk/tm/kotlin/test/FeatureTest.kt +924 -0
- package/project/.sdk/tm/kotlin/test/NetsimTest.kt +50 -0
- package/project/.sdk/tm/kotlin/test/PipelineTest.kt +556 -0
- package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +829 -0
- package/project/.sdk/tm/kotlin/test/RunnerSupport.kt +477 -0
- package/project/.sdk/tm/kotlin/test/StructCorpusTest.kt +297 -0
- package/project/.sdk/tm/kotlin/test/StructRunner.kt +177 -0
- package/project/.sdk/tm/kotlin/test/sdk-test-control.json +19 -0
- package/project/.sdk/tm/kotlin/utility/CoreUtil.kt +96 -0
- package/project/.sdk/tm/kotlin/utility/FeatureUtil.kt +121 -0
- package/project/.sdk/tm/kotlin/utility/Fetcher.kt +156 -0
- package/project/.sdk/tm/kotlin/utility/Json.kt +237 -0
- package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +152 -0
- package/project/.sdk/tm/kotlin/utility/MakePoint.kt +108 -0
- package/project/.sdk/tm/kotlin/utility/MakeReqRes.kt +152 -0
- package/project/.sdk/tm/kotlin/utility/MakeSpecUrl.kt +142 -0
- package/project/.sdk/tm/kotlin/utility/Prepare.kt +236 -0
- package/project/.sdk/tm/kotlin/utility/Register.kt +39 -0
- package/project/.sdk/tm/kotlin/utility/ResultTransform.kt +109 -0
- package/project/.sdk/tm/kotlin/utility/struct/Struct.kt +2697 -0
- package/project/.sdk/tm/lua/feature/audit_feature.lua +132 -0
- package/project/.sdk/tm/lua/feature/cache_feature.lua +188 -0
- package/project/.sdk/tm/lua/feature/clienttrack_feature.lua +127 -0
- package/project/.sdk/tm/lua/feature/debug_feature.lua +194 -0
- package/project/.sdk/tm/lua/feature/idempotency_feature.lua +127 -0
- package/project/.sdk/tm/lua/feature/metrics_feature.lua +135 -0
- package/project/.sdk/tm/lua/feature/netsim_feature.lua +205 -0
- package/project/.sdk/tm/lua/feature/paging_feature.lua +180 -0
- package/project/.sdk/tm/lua/feature/proxy_feature.lua +147 -0
- package/project/.sdk/tm/lua/feature/ratelimit_feature.lua +120 -0
- package/project/.sdk/tm/lua/feature/rbac_feature.lua +141 -0
- package/project/.sdk/tm/lua/feature/retry_feature.lua +188 -0
- package/project/.sdk/tm/lua/feature/streaming_feature.lua +143 -0
- package/project/.sdk/tm/lua/feature/telemetry_feature.lua +159 -0
- package/project/.sdk/tm/lua/feature/test_feature.lua +85 -1
- package/project/.sdk/tm/lua/feature/timeout_feature.lua +94 -0
- package/project/.sdk/tm/lua/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/lua/test/feature_test.lua +1244 -0
- package/project/.sdk/tm/lua/test/netsim_test.lua +61 -0
- package/project/.sdk/tm/lua/test/pipeline_test.lua +613 -0
- package/project/.sdk/tm/lua/utility/feature_add.lua +28 -1
- package/project/.sdk/tm/lua/utility/make_error.lua +9 -0
- package/project/.sdk/tm/lua/utility/make_options.lua +58 -0
- package/project/.sdk/tm/lua/utility/make_point.lua +8 -1
- package/project/.sdk/tm/ocaml/LICENSE +21 -0
- package/project/.sdk/tm/ocaml/Makefile +58 -0
- package/project/.sdk/tm/ocaml/VERSION +1 -0
- package/project/.sdk/tm/ocaml/sdk_features.ml +1127 -0
- package/project/.sdk/tm/ocaml/sdk_helpers.ml +110 -0
- package/project/.sdk/tm/ocaml/sdk_runtime.ml +942 -0
- package/project/.sdk/tm/ocaml/sdk_types.ml +259 -0
- package/project/.sdk/tm/ocaml/src/feature/README.md +1 -0
- package/project/.sdk/tm/ocaml/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/test/custom_utility.ml +30 -0
- package/project/.sdk/tm/ocaml/test/harness.ml +198 -0
- package/project/.sdk/tm/ocaml/test/struct_corpus.ml +487 -0
- package/project/.sdk/tm/ocaml/test/t_feature.ml +533 -0
- package/project/.sdk/tm/ocaml/test/t_main.ml +5 -0
- package/project/.sdk/tm/ocaml/test/t_pipeline.ml +354 -0
- package/project/.sdk/tm/ocaml/test/testutil.ml +57 -0
- package/project/.sdk/tm/ocaml/utility/voxgig_struct.ml +1858 -0
- package/project/.sdk/tm/ocaml/utility/vregex.ml +254 -0
- package/project/.sdk/tm/perl/LICENSE +22 -0
- package/project/.sdk/tm/perl/Makefile +57 -0
- package/project/.sdk/tm/perl/core/context.pm +138 -0
- package/project/.sdk/tm/perl/core/control.pm +22 -0
- package/project/.sdk/tm/perl/core/error.pm +30 -0
- package/project/.sdk/tm/perl/core/helpers.pm +142 -0
- package/project/.sdk/tm/perl/core/operation.pm +47 -0
- package/project/.sdk/tm/perl/core/response.pm +40 -0
- package/project/.sdk/tm/perl/core/result.pm +45 -0
- package/project/.sdk/tm/perl/core/spec.pm +33 -0
- package/project/.sdk/tm/perl/core/utility_type.pm +32 -0
- package/project/.sdk/tm/perl/feature/audit_feature.pm +128 -0
- package/project/.sdk/tm/perl/feature/base_feature.pm +41 -0
- package/project/.sdk/tm/perl/feature/cache_feature.pm +168 -0
- package/project/.sdk/tm/perl/feature/clienttrack_feature.pm +126 -0
- package/project/.sdk/tm/perl/feature/debug_feature.pm +168 -0
- package/project/.sdk/tm/perl/feature/idempotency_feature.pm +104 -0
- package/project/.sdk/tm/perl/feature/log_feature.pm +77 -0
- package/project/.sdk/tm/perl/feature/metrics_feature.pm +124 -0
- package/project/.sdk/tm/perl/feature/netsim_feature.pm +215 -0
- package/project/.sdk/tm/perl/feature/paging_feature.pm +158 -0
- package/project/.sdk/tm/perl/feature/proxy_feature.pm +128 -0
- package/project/.sdk/tm/perl/feature/ratelimit_feature.pm +126 -0
- package/project/.sdk/tm/perl/feature/rbac_feature.pm +124 -0
- package/project/.sdk/tm/perl/feature/retry_feature.pm +153 -0
- package/project/.sdk/tm/perl/feature/streaming_feature.pm +112 -0
- package/project/.sdk/tm/perl/feature/telemetry_feature.pm +155 -0
- package/project/.sdk/tm/perl/feature/test_feature.pm +314 -0
- package/project/.sdk/tm/perl/feature/timeout_feature.pm +110 -0
- package/project/.sdk/tm/perl/lib/Voxgig/Struct.pm +2897 -0
- package/project/.sdk/tm/perl/src/feature/README.md +3 -0
- package/project/.sdk/tm/perl/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/perl/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/perl/t/feature.t +1054 -0
- package/project/.sdk/tm/perl/t/netsim.t +55 -0
- package/project/.sdk/tm/perl/t/pipeline.t +632 -0
- package/project/.sdk/tm/perl/t/primary_utility.t +1023 -0
- package/project/.sdk/tm/perl/t/runner.pm +140 -0
- package/project/.sdk/tm/perl/t/sdk-test-control.json +19 -0
- package/project/.sdk/tm/perl/t/stream.t +132 -0
- package/project/.sdk/tm/perl/t/struct_runner.pm +275 -0
- package/project/.sdk/tm/perl/t/struct_utility.t +438 -0
- package/project/.sdk/tm/perl/utility/clean.pm +15 -0
- package/project/.sdk/tm/perl/utility/done.pm +34 -0
- package/project/.sdk/tm/perl/utility/feature_add.pm +47 -0
- package/project/.sdk/tm/perl/utility/feature_hook.pm +25 -0
- package/project/.sdk/tm/perl/utility/feature_init.pm +33 -0
- package/project/.sdk/tm/perl/utility/fetcher.pm +112 -0
- package/project/.sdk/tm/perl/utility/make_context.pm +22 -0
- package/project/.sdk/tm/perl/utility/make_error.pm +74 -0
- package/project/.sdk/tm/perl/utility/make_fetch_def.pm +46 -0
- package/project/.sdk/tm/perl/utility/make_options.pm +123 -0
- package/project/.sdk/tm/perl/utility/make_point.pm +104 -0
- package/project/.sdk/tm/perl/utility/make_request.pm +66 -0
- package/project/.sdk/tm/perl/utility/make_response.pm +38 -0
- package/project/.sdk/tm/perl/utility/make_result.pm +53 -0
- package/project/.sdk/tm/perl/utility/make_spec.pm +71 -0
- package/project/.sdk/tm/perl/utility/make_url.pm +63 -0
- package/project/.sdk/tm/perl/utility/param.pm +65 -0
- package/project/.sdk/tm/perl/utility/prepare_auth.pm +56 -0
- package/project/.sdk/tm/perl/utility/prepare_body.pm +17 -0
- package/project/.sdk/tm/perl/utility/prepare_headers.pm +27 -0
- package/project/.sdk/tm/perl/utility/prepare_method.pm +25 -0
- package/project/.sdk/tm/perl/utility/prepare_params.pm +41 -0
- package/project/.sdk/tm/perl/utility/prepare_path.pm +29 -0
- package/project/.sdk/tm/perl/utility/prepare_query.pm +40 -0
- package/project/.sdk/tm/perl/utility/register.pm +53 -0
- package/project/.sdk/tm/perl/utility/result_basic.pm +38 -0
- package/project/.sdk/tm/perl/utility/result_body.pm +28 -0
- package/project/.sdk/tm/perl/utility/result_headers.pm +32 -0
- package/project/.sdk/tm/perl/utility/transform_request.pm +30 -0
- package/project/.sdk/tm/perl/utility/transform_response.pm +43 -0
- package/project/.sdk/tm/php/core/Result.php +10 -0
- package/project/.sdk/tm/php/feature/AuditFeature.php +125 -0
- package/project/.sdk/tm/php/feature/BaseFeature.php +6 -0
- package/project/.sdk/tm/php/feature/CacheFeature.php +158 -0
- package/project/.sdk/tm/php/feature/ClienttrackFeature.php +126 -0
- package/project/.sdk/tm/php/feature/DebugFeature.php +167 -0
- package/project/.sdk/tm/php/feature/IdempotencyFeature.php +102 -0
- package/project/.sdk/tm/php/feature/MetricsFeature.php +122 -0
- package/project/.sdk/tm/php/feature/NetsimFeature.php +190 -0
- package/project/.sdk/tm/php/feature/PagingFeature.php +153 -0
- package/project/.sdk/tm/php/feature/ProxyFeature.php +136 -0
- package/project/.sdk/tm/php/feature/RatelimitFeature.php +116 -0
- package/project/.sdk/tm/php/feature/RbacFeature.php +133 -0
- package/project/.sdk/tm/php/feature/RetryFeature.php +159 -0
- package/project/.sdk/tm/php/feature/StreamingFeature.php +107 -0
- package/project/.sdk/tm/php/feature/TelemetryFeature.php +156 -0
- package/project/.sdk/tm/php/feature/TestFeature.php +80 -1
- package/project/.sdk/tm/php/feature/TimeoutFeature.php +95 -0
- package/project/.sdk/tm/php/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/php/test/FeatureTest.php +1259 -0
- package/project/.sdk/tm/php/test/NetsimTest.php +53 -0
- package/project/.sdk/tm/php/test/PipelineTest.php +674 -0
- package/project/.sdk/tm/php/utility/FeatureAdd.php +32 -1
- package/project/.sdk/tm/php/utility/MakeError.php +9 -0
- package/project/.sdk/tm/php/utility/MakeOptions.php +46 -0
- package/project/.sdk/tm/php/utility/MakePoint.php +7 -0
- package/project/.sdk/tm/py/core/context.py +4 -0
- package/project/.sdk/tm/py/core/control.py +3 -0
- package/project/.sdk/tm/py/feature/audit_feature.py +98 -0
- package/project/.sdk/tm/py/feature/cache_feature.py +138 -0
- package/project/.sdk/tm/py/feature/clienttrack_feature.py +97 -0
- package/project/.sdk/tm/py/feature/debug_feature.py +134 -0
- package/project/.sdk/tm/py/feature/idempotency_feature.py +89 -0
- package/project/.sdk/tm/py/feature/metrics_feature.py +93 -0
- package/project/.sdk/tm/py/feature/netsim_feature.py +170 -0
- package/project/.sdk/tm/py/feature/paging_feature.py +134 -0
- package/project/.sdk/tm/py/feature/proxy_feature.py +104 -0
- package/project/.sdk/tm/py/feature/ratelimit_feature.py +98 -0
- package/project/.sdk/tm/py/feature/rbac_feature.py +102 -0
- package/project/.sdk/tm/py/feature/retry_feature.py +142 -0
- package/project/.sdk/tm/py/feature/streaming_feature.py +84 -0
- package/project/.sdk/tm/py/feature/telemetry_feature.py +128 -0
- package/project/.sdk/tm/py/feature/test_feature.py +70 -1
- package/project/.sdk/tm/py/feature/timeout_feature.py +78 -0
- package/project/.sdk/tm/py/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/py/test/feature_harness.py +336 -0
- package/project/.sdk/tm/py/test/test_feature.py +807 -0
- package/project/.sdk/tm/py/test/test_netsim.py +52 -0
- package/project/.sdk/tm/py/test/test_pipeline.py +606 -0
- package/project/.sdk/tm/py/utility/feature_add.py +25 -1
- package/project/.sdk/tm/py/utility/make_error.py +8 -0
- package/project/.sdk/tm/py/utility/make_options.py +32 -0
- package/project/.sdk/tm/py/utility/make_point.py +8 -2
- package/project/.sdk/tm/py/utility/make_request.py +6 -2
- package/project/.sdk/tm/py/utility/make_response.py +6 -2
- package/project/.sdk/tm/py/utility/make_result.py +6 -2
- package/project/.sdk/tm/py/utility/make_spec.py +6 -2
- package/project/.sdk/tm/rb/core/context.rb +2 -0
- package/project/.sdk/tm/rb/core/control.rb +5 -1
- package/project/.sdk/tm/rb/core/result.rb +2 -1
- package/project/.sdk/tm/rb/feature/audit_feature.rb +103 -0
- package/project/.sdk/tm/rb/feature/base_feature.rb +5 -0
- package/project/.sdk/tm/rb/feature/cache_feature.rb +133 -0
- package/project/.sdk/tm/rb/feature/clienttrack_feature.rb +91 -0
- package/project/.sdk/tm/rb/feature/debug_feature.rb +138 -0
- package/project/.sdk/tm/rb/feature/idempotency_feature.rb +78 -0
- package/project/.sdk/tm/rb/feature/metrics_feature.rb +91 -0
- package/project/.sdk/tm/rb/feature/netsim_feature.rb +167 -0
- package/project/.sdk/tm/rb/feature/paging_feature.rb +120 -0
- package/project/.sdk/tm/rb/feature/proxy_feature.rb +93 -0
- package/project/.sdk/tm/rb/feature/ratelimit_feature.rb +95 -0
- package/project/.sdk/tm/rb/feature/rbac_feature.rb +96 -0
- package/project/.sdk/tm/rb/feature/retry_feature.rb +116 -0
- package/project/.sdk/tm/rb/feature/streaming_feature.rb +85 -0
- package/project/.sdk/tm/rb/feature/telemetry_feature.rb +122 -0
- package/project/.sdk/tm/rb/feature/test_feature.rb +65 -1
- package/project/.sdk/tm/rb/feature/timeout_feature.rb +74 -0
- package/project/.sdk/tm/rb/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/rb/test/feature_test.rb +1031 -0
- package/project/.sdk/tm/rb/test/netsim_test.rb +48 -0
- package/project/.sdk/tm/rb/test/pipeline_test.rb +584 -0
- package/project/.sdk/tm/rb/utility/feature_add.rb +28 -1
- package/project/.sdk/tm/rb/utility/make_error.rb +8 -0
- package/project/.sdk/tm/rb/utility/make_options.rb +35 -0
- package/project/.sdk/tm/rb/utility/make_point.rb +7 -1
- package/project/.sdk/tm/rust/LICENSE +22 -0
- package/project/.sdk/tm/rust/Makefile +41 -0
- package/project/.sdk/tm/rust/VERSION +1 -0
- package/project/.sdk/tm/rust/core/context.rs +320 -0
- package/project/.sdk/tm/rust/core/control.rs +37 -0
- package/project/.sdk/tm/rust/core/helpers.rs +168 -0
- package/project/.sdk/tm/rust/core/mod.rs +18 -0
- package/project/.sdk/tm/rust/core/operation.rs +35 -0
- package/project/.sdk/tm/rust/core/point.rs +68 -0
- package/project/.sdk/tm/rust/core/response.rs +38 -0
- package/project/.sdk/tm/rust/core/result.rs +90 -0
- package/project/.sdk/tm/rust/core/spec.rs +109 -0
- package/project/.sdk/tm/rust/core/types.rs +105 -0
- package/project/.sdk/tm/rust/core/utility_type.rs +184 -0
- package/project/.sdk/tm/rust/feature/audit.rs +138 -0
- package/project/.sdk/tm/rust/feature/base.rs +49 -0
- package/project/.sdk/tm/rust/feature/cache.rs +198 -0
- package/project/.sdk/tm/rust/feature/clienttrack.rs +154 -0
- package/project/.sdk/tm/rust/feature/debug.rs +188 -0
- package/project/.sdk/tm/rust/feature/idempotency.rs +139 -0
- package/project/.sdk/tm/rust/feature/log.rs +114 -0
- package/project/.sdk/tm/rust/feature/metrics.rs +136 -0
- package/project/.sdk/tm/rust/feature/mod.rs +24 -0
- package/project/.sdk/tm/rust/feature/netsim.rs +233 -0
- package/project/.sdk/tm/rust/feature/paging.rs +209 -0
- package/project/.sdk/tm/rust/feature/proxy.rs +165 -0
- package/project/.sdk/tm/rust/feature/ratelimit.rs +116 -0
- package/project/.sdk/tm/rust/feature/rbac.rs +152 -0
- package/project/.sdk/tm/rust/feature/retry.rs +190 -0
- package/project/.sdk/tm/rust/feature/streaming.rs +124 -0
- package/project/.sdk/tm/rust/feature/support.rs +145 -0
- package/project/.sdk/tm/rust/feature/telemetry.rs +185 -0
- package/project/.sdk/tm/rust/feature/test.rs +397 -0
- package/project/.sdk/tm/rust/feature/timeout.rs +103 -0
- package/project/.sdk/tm/rust/src/feature/README.md +1 -0
- package/project/.sdk/tm/rust/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/rust/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/rust/tests/common/mod.rs +969 -0
- package/project/.sdk/tm/rust/tests/custom_utility_test.rs +69 -0
- package/project/.sdk/tm/rust/tests/feature_test.rs +1864 -0
- package/project/.sdk/tm/rust/tests/netsim_test.rs +78 -0
- package/project/.sdk/tm/rust/tests/pipeline_test.rs +699 -0
- package/project/.sdk/tm/rust/tests/primary_utility_test.rs +999 -0
- package/project/.sdk/tm/rust/tests/sdk-test-control.json +19 -0
- package/project/.sdk/tm/rust/tests/struct_runner/mod.rs +424 -0
- package/project/.sdk/tm/rust/tests/struct_utility_test.rs +733 -0
- package/project/.sdk/tm/rust/utility/clean.rs +13 -0
- package/project/.sdk/tm/rust/utility/done.rs +31 -0
- package/project/.sdk/tm/rust/utility/feature_add.rs +46 -0
- package/project/.sdk/tm/rust/utility/feature_hook.rs +18 -0
- package/project/.sdk/tm/rust/utility/feature_init.rs +26 -0
- package/project/.sdk/tm/rust/utility/fetcher.rs +142 -0
- package/project/.sdk/tm/rust/utility/jsonparse.rs +211 -0
- package/project/.sdk/tm/rust/utility/make_context.rs +7 -0
- package/project/.sdk/tm/rust/utility/make_error.rs +79 -0
- package/project/.sdk/tm/rust/utility/make_fetch_def.rs +42 -0
- package/project/.sdk/tm/rust/utility/make_options.rs +175 -0
- package/project/.sdk/tm/rust/utility/make_point.rs +116 -0
- package/project/.sdk/tm/rust/utility/make_request.rs +73 -0
- package/project/.sdk/tm/rust/utility/make_response.rs +56 -0
- package/project/.sdk/tm/rust/utility/make_result.rs +64 -0
- package/project/.sdk/tm/rust/utility/make_spec.rs +70 -0
- package/project/.sdk/tm/rust/utility/make_url.rs +83 -0
- package/project/.sdk/tm/rust/utility/mod.rs +36 -0
- package/project/.sdk/tm/rust/utility/param.rs +67 -0
- package/project/.sdk/tm/rust/utility/prepare_auth.rs +65 -0
- package/project/.sdk/tm/rust/utility/prepare_body.rs +14 -0
- package/project/.sdk/tm/rust/utility/prepare_headers.rs +23 -0
- package/project/.sdk/tm/rust/utility/prepare_method.rs +18 -0
- package/project/.sdk/tm/rust/utility/prepare_params.rs +33 -0
- package/project/.sdk/tm/rust/utility/prepare_path.rs +17 -0
- package/project/.sdk/tm/rust/utility/prepare_query.rs +47 -0
- package/project/.sdk/tm/rust/utility/result_basic.rs +35 -0
- package/project/.sdk/tm/rust/utility/result_body.rs +26 -0
- package/project/.sdk/tm/rust/utility/result_headers.rs +24 -0
- package/project/.sdk/tm/rust/utility/transform_request.rs +31 -0
- package/project/.sdk/tm/rust/utility/transform_response.rs +55 -0
- package/project/.sdk/tm/rust/utility/voxgigstruct/consts.rs +122 -0
- package/project/.sdk/tm/rust/utility/voxgigstruct/major.rs +2688 -0
- package/project/.sdk/tm/rust/utility/voxgigstruct/mini.rs +1081 -0
- package/project/.sdk/tm/rust/utility/voxgigstruct/mod.rs +70 -0
- package/project/.sdk/tm/rust/utility/voxgigstruct/ordered_map.rs +159 -0
- package/project/.sdk/tm/rust/utility/voxgigstruct/re.rs +1229 -0
- package/project/.sdk/tm/rust/utility/voxgigstruct/value.rs +372 -0
- package/project/.sdk/tm/scala/LICENSE +22 -0
- package/project/.sdk/tm/scala/Makefile +24 -0
- package/project/.sdk/tm/scala/VERSION +1 -0
- package/project/.sdk/tm/scala/core/Context.scala +160 -0
- package/project/.sdk/tm/scala/core/Contracts.scala +76 -0
- package/project/.sdk/tm/scala/core/Control.scala +23 -0
- package/project/.sdk/tm/scala/core/Helpers.scala +38 -0
- package/project/.sdk/tm/scala/core/Operation.scala +37 -0
- package/project/.sdk/tm/scala/core/Point.scala +44 -0
- package/project/.sdk/tm/scala/core/Response.scala +37 -0
- package/project/.sdk/tm/scala/core/Result.scala +42 -0
- package/project/.sdk/tm/scala/core/SdkClient.scala +220 -0
- package/project/.sdk/tm/scala/core/SdkError.scala +15 -0
- package/project/.sdk/tm/scala/core/Spec.scala +39 -0
- package/project/.sdk/tm/scala/core/Types.scala +31 -0
- package/project/.sdk/tm/scala/core/Utility.scala +85 -0
- package/project/.sdk/tm/scala/feature/AuditFeature.scala +101 -0
- package/project/.sdk/tm/scala/feature/BaseFeature.scala +21 -0
- package/project/.sdk/tm/scala/feature/CacheFeature.scala +181 -0
- package/project/.sdk/tm/scala/feature/ClienttrackFeature.scala +93 -0
- package/project/.sdk/tm/scala/feature/DebugFeature.scala +149 -0
- package/project/.sdk/tm/scala/feature/FeatureOptions.scala +111 -0
- package/project/.sdk/tm/scala/feature/IdempotencyFeature.scala +106 -0
- package/project/.sdk/tm/scala/feature/LogFeature.scala +64 -0
- package/project/.sdk/tm/scala/feature/MetricsFeature.scala +105 -0
- package/project/.sdk/tm/scala/feature/NetsimFeature.scala +134 -0
- package/project/.sdk/tm/scala/feature/PagingFeature.scala +170 -0
- package/project/.sdk/tm/scala/feature/ProxyFeature.scala +113 -0
- package/project/.sdk/tm/scala/feature/RatelimitFeature.scala +58 -0
- package/project/.sdk/tm/scala/feature/RbacFeature.scala +90 -0
- package/project/.sdk/tm/scala/feature/RetryFeature.scala +104 -0
- package/project/.sdk/tm/scala/feature/StreamingFeature.scala +98 -0
- package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +129 -0
- package/project/.sdk/tm/scala/feature/TestFeature.scala +253 -0
- package/project/.sdk/tm/scala/feature/TimeoutFeature.scala +57 -0
- package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +766 -0
- package/project/.sdk/tm/scala/sdktest/SdkTestSupport.scala +93 -0
- package/project/.sdk/tm/scala/sdktest/StructCorpus.scala +0 -0
- package/project/.sdk/tm/scala/sdktest/sdk-test-control.json +19 -0
- package/project/.sdk/tm/scala/src/feature/README.md +1 -0
- package/project/.sdk/tm/scala/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/scala/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/scala/utility/FeatureUtils.scala +68 -0
- package/project/.sdk/tm/scala/utility/Fetcher.scala +129 -0
- package/project/.sdk/tm/scala/utility/Json.java +268 -0
- package/project/.sdk/tm/scala/utility/Make.scala +463 -0
- package/project/.sdk/tm/scala/utility/MakeSpec.scala +49 -0
- package/project/.sdk/tm/scala/utility/Misc.scala +68 -0
- package/project/.sdk/tm/scala/utility/Prepare.scala +142 -0
- package/project/.sdk/tm/scala/utility/Register.scala +38 -0
- package/project/.sdk/tm/scala/utility/Results.scala +63 -0
- package/project/.sdk/tm/scala/utility/StructUtility.scala +29 -0
- package/project/.sdk/tm/scala/utility/Transform.scala +52 -0
- package/project/.sdk/tm/scala/utility/struct/Struct.java +3550 -0
- package/project/.sdk/tm/scala/utility/struct/voxgig_struct.scala +1833 -0
- package/project/.sdk/tm/swift/LICENSE +22 -0
- package/project/.sdk/tm/swift/Makefile +41 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Constants.swift +113 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Inject.swift +260 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Injection.swift +111 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/JSON.swift +327 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Merge.swift +55 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Minor.swift +601 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/OrderedDictionary.swift +79 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Path.swift +157 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Select.swift +259 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Transform.swift +462 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Validate.swift +378 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Value.swift +184 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Walk.swift +44 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +161 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Control.swift +20 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Operation.swift +27 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Point.swift +37 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Response.swift +29 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Result.swift +41 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Spec.swift +36 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Support.swift +98 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Types.swift +25 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Utility.swift +81 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +99 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/BaseFeature.swift +60 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/CacheFeature.swift +164 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/ClienttrackFeature.swift +95 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/DebugFeature.swift +126 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/FeatureOptions.swift +96 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/IdempotencyFeature.swift +80 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/LogFeature.swift +69 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/MetricsFeature.swift +103 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/NetsimFeature.swift +177 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/PagingFeature.swift +154 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/ProxyFeature.swift +122 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RatelimitFeature.swift +79 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RbacFeature.swift +103 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RetryFeature.swift +150 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/StreamingFeature.swift +82 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +119 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TestFeature.swift +257 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TimeoutFeature.swift +83 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Feature.swift +56 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Fetcher.swift +107 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Make.swift +321 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeError.swift +56 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +151 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Prepare.swift +157 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Register.swift +40 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +107 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/CustomUtilityTest.swift +44 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/ExistsTest.swift +12 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +1049 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/NetsimTest.swift +50 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PipelineTest.swift +398 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PrimaryUtilityTest.swift +750 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/Runner.swift +237 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/StructUtilityTest.swift +523 -0
- package/project/.sdk/tm/swift/VERSION +1 -0
- package/project/.sdk/tm/swift/src/feature/README.md +6 -0
- package/project/.sdk/tm/swift/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/swift/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/ts/Makefile +6 -1
- package/project/.sdk/tm/ts/src/feature/audit/AuditFeature.ts +98 -0
- package/project/.sdk/tm/ts/src/feature/cache/CacheFeature.ts +152 -0
- package/project/.sdk/tm/ts/src/feature/clienttrack/ClienttrackFeature.ts +106 -0
- package/project/.sdk/tm/ts/src/feature/debug/DebugFeature.ts +134 -0
- package/project/.sdk/tm/ts/src/feature/idempotency/IdempotencyFeature.ts +97 -0
- package/project/.sdk/tm/ts/src/feature/metrics/MetricsFeature.ts +104 -0
- package/project/.sdk/tm/ts/src/feature/netsim/NetsimFeature.ts +189 -0
- package/project/.sdk/tm/ts/src/feature/paging/PagingFeature.ts +141 -0
- package/project/.sdk/tm/ts/src/feature/proxy/ProxyFeature.ts +112 -0
- package/project/.sdk/tm/ts/src/feature/ratelimit/RatelimitFeature.ts +108 -0
- package/project/.sdk/tm/ts/src/feature/rbac/RbacFeature.ts +104 -0
- package/project/.sdk/tm/ts/src/feature/retry/RetryFeature.ts +160 -0
- package/project/.sdk/tm/ts/src/feature/streaming/StreamingFeature.ts +98 -0
- package/project/.sdk/tm/ts/src/feature/telemetry/TelemetryFeature.ts +130 -0
- package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +58 -1
- package/project/.sdk/tm/ts/src/feature/timeout/TimeoutFeature.ts +103 -0
- package/project/.sdk/tm/ts/src/utility/FeatureHookUtility.ts +4 -1
- package/project/.sdk/tm/ts/src/utility/MakeErrorUtility.ts +9 -0
- package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +31 -1
- package/project/.sdk/tm/ts/test/feature/harness.ts +293 -0
- package/project/.sdk/tm/ts/test/feature.test.ts +772 -0
- package/project/.sdk/tm/ts/test/netsim.test.ts +43 -0
- package/project/.sdk/tm/ts/test/pipeline.test.ts +382 -0
- package/project/.sdk/tm/zig/LICENSE +21 -0
- package/project/.sdk/tm/zig/Makefile +31 -0
- package/project/.sdk/tm/zig/VERSION +1 -0
- package/project/.sdk/tm/zig/build.zig +58 -0
- package/project/.sdk/tm/zig/build.zig.zon +11 -0
- package/project/.sdk/tm/zig/core/context.zig +258 -0
- package/project/.sdk/tm/zig/core/control.zig +26 -0
- package/project/.sdk/tm/zig/core/error.zig +28 -0
- package/project/.sdk/tm/zig/core/helpers.zig +326 -0
- package/project/.sdk/tm/zig/core/mem.zig +20 -0
- package/project/.sdk/tm/zig/core/operation.zig +34 -0
- package/project/.sdk/tm/zig/core/point.zig +63 -0
- package/project/.sdk/tm/zig/core/response.zig +32 -0
- package/project/.sdk/tm/zig/core/result.zig +73 -0
- package/project/.sdk/tm/zig/core/spec.zig +68 -0
- package/project/.sdk/tm/zig/core/types.zig +101 -0
- package/project/.sdk/tm/zig/core/utility.zig +1115 -0
- package/project/.sdk/tm/zig/feature/audit.zig +131 -0
- package/project/.sdk/tm/zig/feature/base.zig +52 -0
- package/project/.sdk/tm/zig/feature/cache.zig +216 -0
- package/project/.sdk/tm/zig/feature/clienttrack.zig +129 -0
- package/project/.sdk/tm/zig/feature/debug.zig +191 -0
- package/project/.sdk/tm/zig/feature/idempotency.zig +121 -0
- package/project/.sdk/tm/zig/feature/log.zig +93 -0
- package/project/.sdk/tm/zig/feature/metrics.zig +145 -0
- package/project/.sdk/tm/zig/feature/netsim.zig +186 -0
- package/project/.sdk/tm/zig/feature/paging.zig +201 -0
- package/project/.sdk/tm/zig/feature/proxy.zig +180 -0
- package/project/.sdk/tm/zig/feature/ratelimit.zig +123 -0
- package/project/.sdk/tm/zig/feature/rbac.zig +126 -0
- package/project/.sdk/tm/zig/feature/retry.zig +167 -0
- package/project/.sdk/tm/zig/feature/streaming.zig +127 -0
- package/project/.sdk/tm/zig/feature/support.zig +128 -0
- package/project/.sdk/tm/zig/feature/telemetry.zig +165 -0
- package/project/.sdk/tm/zig/feature/test.zig +315 -0
- package/project/.sdk/tm/zig/feature/timeout.zig +105 -0
- package/project/.sdk/tm/zig/root.zig +74 -0
- package/project/.sdk/tm/zig/src/feature/README.md +1 -0
- package/project/.sdk/tm/zig/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/zig/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/zig/test/feature_test.zig +1045 -0
- package/project/.sdk/tm/zig/test/fh.zig +531 -0
- package/project/.sdk/tm/zig/test/gotcha_test.zig +230 -0
- package/project/.sdk/tm/zig/test/pipeline_test.zig +493 -0
- package/project/.sdk/tm/zig/test/primary_utility_test.zig +346 -0
- package/project/.sdk/tm/zig/test/struct_corpus.zig +1145 -0
- package/project/.sdk/tm/zig/test/struct_runner.zig +226 -0
- package/project/.sdk/tm/zig/utility/jsonparse.zig +13 -0
- package/project/.sdk/tm/zig/utility/voxgigstruct/regex.zig +779 -0
- package/project/.sdk/tm/zig/utility/voxgigstruct/struct.zig +4400 -0
|
@@ -0,0 +1,2697 @@
|
|
|
1
|
+
package KOTLINPACKAGE.utility.struct
|
|
2
|
+
|
|
3
|
+
import java.net.URLEncoder
|
|
4
|
+
import java.nio.charset.StandardCharsets
|
|
5
|
+
import java.util.IdentityHashMap
|
|
6
|
+
import java.util.Locale
|
|
7
|
+
import java.util.function.Supplier
|
|
8
|
+
import java.util.regex.Pattern
|
|
9
|
+
import kotlin.math.floor
|
|
10
|
+
|
|
11
|
+
@Suppress("MemberVisibilityCanBePrivate")
|
|
12
|
+
object Struct {
|
|
13
|
+
val UNDEF: Any = Any()
|
|
14
|
+
val DELETE: Any = Any()
|
|
15
|
+
|
|
16
|
+
const val T_ANY: Int = (1 shl 31) - 1
|
|
17
|
+
const val T_NOVAL: Int = 1 shl 30
|
|
18
|
+
const val T_BOOLEAN: Int = 1 shl 29
|
|
19
|
+
const val T_DECIMAL: Int = 1 shl 28
|
|
20
|
+
const val T_INTEGER: Int = 1 shl 27
|
|
21
|
+
const val T_NUMBER: Int = 1 shl 26
|
|
22
|
+
const val T_STRING: Int = 1 shl 25
|
|
23
|
+
const val T_FUNCTION: Int = 1 shl 24
|
|
24
|
+
const val T_SYMBOL: Int = 1 shl 23
|
|
25
|
+
const val T_NULL: Int = 1 shl 22
|
|
26
|
+
const val T_LIST: Int = 1 shl 14
|
|
27
|
+
const val T_MAP: Int = 1 shl 13
|
|
28
|
+
const val T_INSTANCE: Int = 1 shl 12
|
|
29
|
+
const val T_SCALAR: Int = 1 shl 7
|
|
30
|
+
const val T_NODE: Int = 1 shl 6
|
|
31
|
+
const val S_DTOP: String = "\$TOP"
|
|
32
|
+
const val S_DSPEC: String = "\$SPEC"
|
|
33
|
+
const val S_DKEY: String = "\$KEY"
|
|
34
|
+
|
|
35
|
+
const val M_KEYPRE: Int = 1
|
|
36
|
+
const val M_KEYPOST: Int = 2
|
|
37
|
+
const val M_VAL: Int = 4
|
|
38
|
+
|
|
39
|
+
val MODENAME: Map<Int, String> =
|
|
40
|
+
mapOf(
|
|
41
|
+
M_VAL to "val",
|
|
42
|
+
M_KEYPRE to "key:pre",
|
|
43
|
+
M_KEYPOST to "key:post",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
private val R_META_PATH = Pattern.compile("^([^$]+)\\$([=~])(.+)$")
|
|
47
|
+
private val R_INJECT_FULL = Pattern.compile("^`(\\$[A-Z]+|[^`]*)[0-9]*`$")
|
|
48
|
+
private val R_INJECT_PART = Pattern.compile("`([^`]+)`")
|
|
49
|
+
private val R_CMD_KEY = Pattern.compile("^`(\\$[A-Z]+)(\\d*)`$")
|
|
50
|
+
private val R_TRANSFORM_NAME = Pattern.compile("^`(\\$[A-Z]+)`$")
|
|
51
|
+
val SKIP: Any = Any()
|
|
52
|
+
|
|
53
|
+
fun interface WalkApply {
|
|
54
|
+
fun apply(
|
|
55
|
+
key: String?,
|
|
56
|
+
value: Any?,
|
|
57
|
+
parent: Any?,
|
|
58
|
+
path: List<String>,
|
|
59
|
+
): Any?
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Mirrors TS/Java Injector functional interface. Custom dispatch hook for
|
|
64
|
+
* `$NAME` references during inject/transform/validate.
|
|
65
|
+
*/
|
|
66
|
+
fun interface Injector {
|
|
67
|
+
fun apply(
|
|
68
|
+
inj: Injection,
|
|
69
|
+
value: Any?,
|
|
70
|
+
ref: String?,
|
|
71
|
+
store: Any?,
|
|
72
|
+
): Any?
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Mirrors TS/Java Modify functional interface. Custom value-mutation hook
|
|
77
|
+
* applied after inject finishes a node.
|
|
78
|
+
*/
|
|
79
|
+
fun interface Modify {
|
|
80
|
+
fun apply(
|
|
81
|
+
value: Any?,
|
|
82
|
+
key: Any?,
|
|
83
|
+
parent: Any?,
|
|
84
|
+
inj: Injection?,
|
|
85
|
+
store: Any?,
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Injection state used for recursive injection into JSON-like data
|
|
91
|
+
* structures. Mirrors TS `class Injection` (StructUtility.ts:2613) and
|
|
92
|
+
* Java `static class Injection` (Struct.java:3077).
|
|
93
|
+
*/
|
|
94
|
+
class Injection(value: Any?, parent: Any?) {
|
|
95
|
+
var mode: Int = M_VAL // M_KEYPRE | M_KEYPOST | M_VAL
|
|
96
|
+
var full: Boolean = false // injection consumed the whole key string
|
|
97
|
+
var keyI: Int = 0 // index of current key in keys
|
|
98
|
+
var keys: MutableList<String> // sibling keys list (shared with prior)
|
|
99
|
+
var key: String // current key string
|
|
100
|
+
var `val`: Any? // current child value
|
|
101
|
+
var parent: Any? // current parent in spec
|
|
102
|
+
var path: MutableList<String> // ancestor key chain ending in key
|
|
103
|
+
var nodes: MutableList<Any?> // ancestor node stack ending in parent
|
|
104
|
+
var handler: Injector? = null // dispatch hook for `$NAME` references
|
|
105
|
+
var errs: MutableList<Any?> // shared error collector
|
|
106
|
+
var meta: MutableMap<String, Any?> // shared metadata bag (do not deep-copy)
|
|
107
|
+
var dparent: Any? = UNDEF // current data-side parent
|
|
108
|
+
var dpath: MutableList<String> // current data-side path
|
|
109
|
+
var base: String? = null // base key in store, if any
|
|
110
|
+
var modify: Modify? = null // optional value-mutation hook
|
|
111
|
+
var prior: Injection? = null // calling injection (chain upwards)
|
|
112
|
+
var extra: Any? = null // free-form passthrough
|
|
113
|
+
|
|
114
|
+
init {
|
|
115
|
+
this.`val` = value
|
|
116
|
+
this.parent = parent
|
|
117
|
+
this.errs = mutableListOf()
|
|
118
|
+
this.dpath = mutableListOf(S_DTOP)
|
|
119
|
+
this.keys = mutableListOf(S_DTOP)
|
|
120
|
+
this.key = S_DTOP
|
|
121
|
+
this.path = mutableListOf(S_DTOP)
|
|
122
|
+
this.nodes = mutableListOf(parent)
|
|
123
|
+
this.base = S_DTOP
|
|
124
|
+
this.meta = linkedMapOf()
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Resolve current data-side parent for relative paths and bump depth. */
|
|
128
|
+
fun descend(): Any? {
|
|
129
|
+
val dRaw = meta["__d"]
|
|
130
|
+
val d = if (dRaw is Number) dRaw.toInt() else 0
|
|
131
|
+
meta["__d"] = d + 1
|
|
132
|
+
|
|
133
|
+
val parentkey: String? = if (path.size >= 2) path[path.size - 2] else null
|
|
134
|
+
|
|
135
|
+
if (dparent === UNDEF) {
|
|
136
|
+
if (size(dpath) > 1 && parentkey != null) {
|
|
137
|
+
val nd = dpath.toMutableList()
|
|
138
|
+
nd.add(strkey(parentkey))
|
|
139
|
+
this.dpath = nd
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
if (parentkey != null) {
|
|
143
|
+
this.dparent = getprop(this.dparent, parentkey)
|
|
144
|
+
val lastpart = if (dpath.isEmpty()) null else dpath.last()
|
|
145
|
+
val marker = "$:" + strkey(parentkey)
|
|
146
|
+
if (marker == lastpart) {
|
|
147
|
+
@Suppress("UNCHECKED_CAST")
|
|
148
|
+
val sliced = slice(this.dpath, -1, null)
|
|
149
|
+
this.dpath = if (sliced is List<*>) sliced.map { it.toString() }.toMutableList() else mutableListOf()
|
|
150
|
+
} else {
|
|
151
|
+
val nd = dpath.toMutableList()
|
|
152
|
+
nd.add(strkey(parentkey))
|
|
153
|
+
this.dpath = nd
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return dparent
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Build a child injection at keys[keyI], sharing meta/errs/handler/keys. */
|
|
161
|
+
fun child(
|
|
162
|
+
keyI: Int,
|
|
163
|
+
keys: MutableList<String>,
|
|
164
|
+
): Injection {
|
|
165
|
+
val key = strkey(keys[keyI])
|
|
166
|
+
val v = this.`val`
|
|
167
|
+
val cinj = Injection(getprop(v, key), v)
|
|
168
|
+
cinj.keyI = keyI
|
|
169
|
+
cinj.keys = keys
|
|
170
|
+
cinj.key = key
|
|
171
|
+
val np = path.toMutableList()
|
|
172
|
+
np.add(key)
|
|
173
|
+
cinj.path = np
|
|
174
|
+
val nn = nodes.toMutableList()
|
|
175
|
+
nn.add(v)
|
|
176
|
+
cinj.nodes = nn
|
|
177
|
+
cinj.mode = this.mode
|
|
178
|
+
cinj.handler = this.handler
|
|
179
|
+
cinj.modify = this.modify
|
|
180
|
+
cinj.base = this.base
|
|
181
|
+
cinj.meta = this.meta // shared
|
|
182
|
+
cinj.errs = this.errs // shared
|
|
183
|
+
cinj.prior = this
|
|
184
|
+
cinj.dpath = this.dpath.toMutableList()
|
|
185
|
+
cinj.dparent = this.dparent
|
|
186
|
+
return cinj
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** Set the current child value on the immediate parent. */
|
|
190
|
+
fun setval(value: Any?): Any? = setval(value, 0)
|
|
191
|
+
|
|
192
|
+
/** Set/delete on parent or an ancestor at -ancestor in nodes/path. */
|
|
193
|
+
fun setval(
|
|
194
|
+
value: Any?,
|
|
195
|
+
ancestor: Int,
|
|
196
|
+
): Any? {
|
|
197
|
+
val out: Any?
|
|
198
|
+
if (ancestor < 2) {
|
|
199
|
+
out =
|
|
200
|
+
if (value === UNDEF) {
|
|
201
|
+
val p = delprop(this.parent, this.key)
|
|
202
|
+
this.parent = p
|
|
203
|
+
p
|
|
204
|
+
} else {
|
|
205
|
+
setprop(this.parent, this.key, value)
|
|
206
|
+
}
|
|
207
|
+
} else {
|
|
208
|
+
val aval = getelem(this.nodes, 0 - ancestor)
|
|
209
|
+
val akey = getelem(this.path, 0 - ancestor)
|
|
210
|
+
out = if (value === UNDEF) delprop(aval, akey) else setprop(aval, akey, value)
|
|
211
|
+
}
|
|
212
|
+
return out
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
override fun toString(): String = toString(null)
|
|
216
|
+
|
|
217
|
+
fun toString(prefix: String?): String {
|
|
218
|
+
val sb = StringBuilder()
|
|
219
|
+
sb.append("INJ")
|
|
220
|
+
if (prefix != null) sb.append("/").append(prefix)
|
|
221
|
+
sb.append(":").append(pathify(path, 1))
|
|
222
|
+
sb.append(":").append(MODENAME[mode] ?: "?")
|
|
223
|
+
if (full) sb.append("/full")
|
|
224
|
+
sb.append(": key=").append(keyI).append("/").append(key)
|
|
225
|
+
sb.append(" keys=").append(keys)
|
|
226
|
+
sb.append(" parent=").append(stringify(parent, 60))
|
|
227
|
+
sb.append(" dpath=").append(dpath)
|
|
228
|
+
return sb.toString()
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
private val TYPE_NAMES =
|
|
233
|
+
arrayOf(
|
|
234
|
+
"any", "nil", "boolean", "decimal", "integer", "number", "string",
|
|
235
|
+
"function", "symbol", "null",
|
|
236
|
+
"", "", "", "", "", "", "",
|
|
237
|
+
"list", "map", "instance",
|
|
238
|
+
"", "", "", "",
|
|
239
|
+
"scalar", "node",
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
fun isnode(value: Any?): Boolean = value is Map<*, *> || value is List<*>
|
|
243
|
+
|
|
244
|
+
fun ismap(value: Any?): Boolean = value is Map<*, *>
|
|
245
|
+
|
|
246
|
+
fun islist(value: Any?): Boolean = value is List<*>
|
|
247
|
+
|
|
248
|
+
fun iskey(key: Any?): Boolean {
|
|
249
|
+
if (key == null || key === UNDEF) return false
|
|
250
|
+
if (key is String) return key.isNotEmpty()
|
|
251
|
+
return key is Number
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
fun strkey(key: Any?): String {
|
|
255
|
+
if (key == null || key === UNDEF) return ""
|
|
256
|
+
val t = typify(key)
|
|
257
|
+
if (t and T_STRING != 0) return key as String
|
|
258
|
+
if (t and T_NUMBER != 0) {
|
|
259
|
+
val d = (key as Number).toDouble()
|
|
260
|
+
return if (floor(d) == d) d.toLong().toString() else floor(d).toLong().toString()
|
|
261
|
+
}
|
|
262
|
+
return ""
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
fun isempty(value: Any?): Boolean {
|
|
266
|
+
if (value == null || value === UNDEF) return true
|
|
267
|
+
return when (value) {
|
|
268
|
+
is String -> value.isEmpty()
|
|
269
|
+
is List<*> -> value.isEmpty()
|
|
270
|
+
is Map<*, *> -> value.isEmpty()
|
|
271
|
+
else -> false
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
fun isfunc(value: Any?): Boolean =
|
|
276
|
+
value is Function<*> || value is Supplier<*> || value is Injector || value is Modify || value is WalkApply
|
|
277
|
+
|
|
278
|
+
fun size(value: Any?): Int {
|
|
279
|
+
return when (value) {
|
|
280
|
+
is List<*> -> value.size
|
|
281
|
+
is Map<*, *> -> value.size
|
|
282
|
+
is String -> value.length
|
|
283
|
+
is Number -> floor(value.toDouble()).toInt()
|
|
284
|
+
is Boolean -> if (value) 1 else 0
|
|
285
|
+
else -> 0
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
fun typify(value: Any?): Int {
|
|
290
|
+
if (value === UNDEF) return T_NOVAL
|
|
291
|
+
if (value == null) return T_SCALAR or T_NULL
|
|
292
|
+
return when (value) {
|
|
293
|
+
is Number -> {
|
|
294
|
+
val d = value.toDouble()
|
|
295
|
+
if (d.isNaN()) {
|
|
296
|
+
T_NOVAL
|
|
297
|
+
} else if (floor(d) == d) {
|
|
298
|
+
T_SCALAR or T_NUMBER or T_INTEGER
|
|
299
|
+
} else {
|
|
300
|
+
T_SCALAR or T_NUMBER or T_DECIMAL
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
is String -> T_SCALAR or T_STRING
|
|
304
|
+
is Boolean -> T_SCALAR or T_BOOLEAN
|
|
305
|
+
is Function<*>, is java.util.function.Function<*, *>, is Supplier<*>,
|
|
306
|
+
is Injector, is Modify, is WalkApply,
|
|
307
|
+
-> T_SCALAR or T_FUNCTION
|
|
308
|
+
is List<*> -> T_NODE or T_LIST
|
|
309
|
+
is Map<*, *> -> T_NODE or T_MAP
|
|
310
|
+
else -> T_NODE or T_INSTANCE
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
fun typename(typeValue: Any?): String {
|
|
315
|
+
if (typeValue !is Number) return "any"
|
|
316
|
+
val t = typeValue.toInt()
|
|
317
|
+
if (t == 0) return "any"
|
|
318
|
+
val idx = Integer.numberOfLeadingZeros(t)
|
|
319
|
+
if (idx < 0 || idx >= TYPE_NAMES.size) return "any"
|
|
320
|
+
val out = TYPE_NAMES[idx]
|
|
321
|
+
return if (out.isEmpty()) "any" else out
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
fun keysof(value: Any?): List<String> {
|
|
325
|
+
if (!isnode(value)) return emptyList()
|
|
326
|
+
if (value is List<*>) return value.indices.map { it.toString() }
|
|
327
|
+
val keys = (value as Map<*, *>).keys.map { it.toString() }.toMutableList()
|
|
328
|
+
keys.sort()
|
|
329
|
+
return keys
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
fun items(value: Any?): List<List<Any?>> {
|
|
333
|
+
if (!isnode(value)) return emptyList()
|
|
334
|
+
return keysof(value).map { k -> listOf(k, lookup(value, k)) }
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
fun getelem(
|
|
338
|
+
value: Any?,
|
|
339
|
+
key: Any?,
|
|
340
|
+
): Any? = getelem(value, key, UNDEF)
|
|
341
|
+
|
|
342
|
+
fun getelem(
|
|
343
|
+
value: Any?,
|
|
344
|
+
key: Any?,
|
|
345
|
+
alt: Any?,
|
|
346
|
+
): Any? {
|
|
347
|
+
if (value !is List<*> || key == null || key === UNDEF) return resolveAlt(alt)
|
|
348
|
+
val idx = parseIntKey(key) ?: return resolveAlt(alt)
|
|
349
|
+
val useIdx = if (idx < 0) value.size + idx else idx
|
|
350
|
+
if (useIdx < 0 || useIdx >= value.size) return resolveAlt(alt)
|
|
351
|
+
val out = value[useIdx]
|
|
352
|
+
// Group A null-unification: a JSON null (or absent) slot counts as "no
|
|
353
|
+
// value" — return the alt (canonical TS getelem `if (null == out)`).
|
|
354
|
+
if (out == null || out === UNDEF) return resolveAlt(alt)
|
|
355
|
+
return out
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
fun getprop(
|
|
359
|
+
value: Any?,
|
|
360
|
+
key: Any?,
|
|
361
|
+
): Any? = getprop(value, key, UNDEF)
|
|
362
|
+
|
|
363
|
+
fun getprop(
|
|
364
|
+
value: Any?,
|
|
365
|
+
key: Any?,
|
|
366
|
+
alt: Any?,
|
|
367
|
+
): Any? {
|
|
368
|
+
if (value == null || value === UNDEF || key == null || key === UNDEF) return alt
|
|
369
|
+
var out: Any? = UNDEF
|
|
370
|
+
when (value) {
|
|
371
|
+
is Map<*, *> -> {
|
|
372
|
+
val sk = strkey(key)
|
|
373
|
+
if (value.containsKey(sk)) out = value[sk]
|
|
374
|
+
}
|
|
375
|
+
is List<*> -> {
|
|
376
|
+
val idx = parseIntKey(key)
|
|
377
|
+
if (idx != null && idx >= 0 && idx < value.size) out = value[idx]
|
|
378
|
+
}
|
|
379
|
+
else -> {}
|
|
380
|
+
}
|
|
381
|
+
// Group A null-unification: a stored JSON null (or absent) counts as
|
|
382
|
+
// "no value" → return the alt. Group B callers needing the raw stored
|
|
383
|
+
// null use `lookup`.
|
|
384
|
+
if (out == null || out === UNDEF) return alt
|
|
385
|
+
return out
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Group B raw value lookup (canonical TS `_lookup`): read the literally
|
|
390
|
+
* stored value at a slot, preserving JSON null; UNDEF when absent. Used by
|
|
391
|
+
* the validate checkers, closed-map check, transform command handlers and
|
|
392
|
+
* select operators that must distinguish a stored null from absence.
|
|
393
|
+
*/
|
|
394
|
+
fun lookup(
|
|
395
|
+
value: Any?,
|
|
396
|
+
key: Any?,
|
|
397
|
+
): Any? {
|
|
398
|
+
if (value == null || value === UNDEF || key == null || key === UNDEF) return UNDEF
|
|
399
|
+
return when (value) {
|
|
400
|
+
is Map<*, *> -> {
|
|
401
|
+
val sk = strkey(key)
|
|
402
|
+
if (value.containsKey(sk)) value[sk] else UNDEF
|
|
403
|
+
}
|
|
404
|
+
is List<*> -> {
|
|
405
|
+
val idx = parseIntKey(key) ?: return UNDEF
|
|
406
|
+
val i = if (idx < 0) value.size + idx else idx
|
|
407
|
+
if (i < 0 || i >= value.size) UNDEF else value[i]
|
|
408
|
+
}
|
|
409
|
+
else -> UNDEF
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
fun haskey(
|
|
414
|
+
value: Any?,
|
|
415
|
+
key: Any?,
|
|
416
|
+
): Boolean = getprop(value, key, UNDEF) !== UNDEF
|
|
417
|
+
|
|
418
|
+
fun setprop(
|
|
419
|
+
parent: Any?,
|
|
420
|
+
key: Any?,
|
|
421
|
+
value: Any?,
|
|
422
|
+
): Any? {
|
|
423
|
+
if (!iskey(key)) return parent
|
|
424
|
+
return when (parent) {
|
|
425
|
+
is MutableMap<*, *> -> {
|
|
426
|
+
(parent as MutableMap<String, Any?>)[strkey(key)] = value
|
|
427
|
+
parent
|
|
428
|
+
}
|
|
429
|
+
is MutableList<*> -> {
|
|
430
|
+
val list = parent as MutableList<Any?>
|
|
431
|
+
val idx = parseIntKey(key) ?: return parent
|
|
432
|
+
if (value == null) {
|
|
433
|
+
if (idx in list.indices) list.removeAt(idx)
|
|
434
|
+
return list
|
|
435
|
+
}
|
|
436
|
+
if (idx >= 0) {
|
|
437
|
+
val target = idx.coerceIn(0, list.size)
|
|
438
|
+
if (target < list.size) list[target] = value else list.add(value)
|
|
439
|
+
} else {
|
|
440
|
+
list.add(0, value)
|
|
441
|
+
}
|
|
442
|
+
list
|
|
443
|
+
}
|
|
444
|
+
else -> parent
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
fun delprop(
|
|
449
|
+
parent: Any?,
|
|
450
|
+
key: Any?,
|
|
451
|
+
): Any? {
|
|
452
|
+
if (!iskey(key)) return parent
|
|
453
|
+
return when (parent) {
|
|
454
|
+
is MutableMap<*, *> -> {
|
|
455
|
+
(parent as MutableMap<String, Any?>).remove(strkey(key))
|
|
456
|
+
parent
|
|
457
|
+
}
|
|
458
|
+
is MutableList<*> -> {
|
|
459
|
+
val idx = parseIntKey(key)
|
|
460
|
+
val list = parent as MutableList<Any?>
|
|
461
|
+
if (idx != null && idx in list.indices) list.removeAt(idx)
|
|
462
|
+
list
|
|
463
|
+
}
|
|
464
|
+
else -> parent
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
fun clone(value: Any?): Any? = cloneInner(value, IdentityHashMap())
|
|
469
|
+
|
|
470
|
+
private fun cloneInner(
|
|
471
|
+
value: Any?,
|
|
472
|
+
seen: IdentityHashMap<Any, Any?>,
|
|
473
|
+
): Any? {
|
|
474
|
+
if (value == null || value === UNDEF) return value
|
|
475
|
+
if (value is String || value is Number || value is Boolean || value is Function<*>) return value
|
|
476
|
+
if (seen.containsKey(value)) return seen[value]
|
|
477
|
+
return when (value) {
|
|
478
|
+
is List<*> -> {
|
|
479
|
+
val out = mutableListOf<Any?>()
|
|
480
|
+
seen[value] = out
|
|
481
|
+
value.forEach { out.add(cloneInner(it, seen)) }
|
|
482
|
+
out
|
|
483
|
+
}
|
|
484
|
+
is Map<*, *> -> {
|
|
485
|
+
val out = linkedMapOf<String, Any?>()
|
|
486
|
+
seen[value] = out
|
|
487
|
+
value.forEach { (k, v) -> out[k.toString()] = cloneInner(v, seen) }
|
|
488
|
+
out
|
|
489
|
+
}
|
|
490
|
+
else -> value
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
fun flatten(value: Any?): List<Any?> = flatten(value, 1)
|
|
495
|
+
|
|
496
|
+
fun flatten(
|
|
497
|
+
value: Any?,
|
|
498
|
+
depth: Int?,
|
|
499
|
+
): List<Any?> {
|
|
500
|
+
if (value !is List<*>) return emptyList()
|
|
501
|
+
val out = mutableListOf<Any?>()
|
|
502
|
+
flattenInto(value, depth ?: 1, out)
|
|
503
|
+
return out
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
private fun flattenInto(
|
|
507
|
+
input: List<*>,
|
|
508
|
+
depth: Int,
|
|
509
|
+
out: MutableList<Any?>,
|
|
510
|
+
) {
|
|
511
|
+
input.forEach {
|
|
512
|
+
if (depth > 0 && it is List<*>) {
|
|
513
|
+
flattenInto(it, depth - 1, out)
|
|
514
|
+
} else {
|
|
515
|
+
out.add(it)
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
fun filter(
|
|
521
|
+
value: Any?,
|
|
522
|
+
check: (List<Any?>) -> Boolean,
|
|
523
|
+
): List<Any?> {
|
|
524
|
+
return items(value).filter { check(it) }.map { it[1] }
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
fun getdef(
|
|
528
|
+
value: Any?,
|
|
529
|
+
alt: Any?,
|
|
530
|
+
): Any? = if (value === UNDEF) alt else value
|
|
531
|
+
|
|
532
|
+
fun jm(vararg kv: Any?): MutableMap<String, Any?> {
|
|
533
|
+
val out = linkedMapOf<String, Any?>()
|
|
534
|
+
var i = 0
|
|
535
|
+
while (i < kv.size) {
|
|
536
|
+
val raw = if (i < kv.size) kv[i] else UNDEF
|
|
537
|
+
val k = if (raw is String) raw else stringify(raw)
|
|
538
|
+
val v = if (i + 1 < kv.size) kv[i + 1] else null
|
|
539
|
+
out[k] = v
|
|
540
|
+
i += 2
|
|
541
|
+
}
|
|
542
|
+
return out
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
fun jt(vararg v: Any?): MutableList<Any?> {
|
|
546
|
+
val out = mutableListOf<Any?>()
|
|
547
|
+
v.forEach { out.add(it) }
|
|
548
|
+
return out
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
fun replace(
|
|
552
|
+
s: Any?,
|
|
553
|
+
from: Any?,
|
|
554
|
+
to: Any?,
|
|
555
|
+
): String {
|
|
556
|
+
val rs =
|
|
557
|
+
when {
|
|
558
|
+
s === UNDEF || s == null -> ""
|
|
559
|
+
s is String -> s
|
|
560
|
+
else -> stringify(s)
|
|
561
|
+
}
|
|
562
|
+
val toStr =
|
|
563
|
+
when {
|
|
564
|
+
to === UNDEF || to == null -> ""
|
|
565
|
+
to is String -> to
|
|
566
|
+
else -> stringify(to)
|
|
567
|
+
}
|
|
568
|
+
return when (from) {
|
|
569
|
+
is Pattern -> from.matcher(rs).replaceAll(java.util.regex.Matcher.quoteReplacement(toStr))
|
|
570
|
+
is Regex -> from.replace(rs, toStr)
|
|
571
|
+
null -> rs
|
|
572
|
+
else -> rs.replace(from.toString(), toStr)
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
fun escre(s: Any?): String {
|
|
577
|
+
val input = if (s == null || s === UNDEF) "" else s.toString()
|
|
578
|
+
return input.replace(Regex("""([\\.\[\]{}()*+?^$|])"""), """\\$1""")
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
// -----------------------------------------------------------------
|
|
582
|
+
// Regex utility — uniform re* API (see /REGEX_API.md). Kotlin's Regex
|
|
583
|
+
// backs onto java.util.regex.Pattern (an RE2 superset).
|
|
584
|
+
// -----------------------------------------------------------------
|
|
585
|
+
|
|
586
|
+
fun reCompile(pattern: String): Regex = Regex(pattern)
|
|
587
|
+
|
|
588
|
+
fun reTest(
|
|
589
|
+
pattern: String,
|
|
590
|
+
input: String,
|
|
591
|
+
): Boolean = Regex(pattern).containsMatchIn(input)
|
|
592
|
+
|
|
593
|
+
fun reFind(
|
|
594
|
+
pattern: String,
|
|
595
|
+
input: String,
|
|
596
|
+
): List<String>? {
|
|
597
|
+
val m = Regex(pattern).find(input) ?: return null
|
|
598
|
+
return m.groupValues
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
fun reFindAll(
|
|
602
|
+
pattern: String,
|
|
603
|
+
input: String,
|
|
604
|
+
): List<List<String>> = Regex(pattern).findAll(input).map { it.groupValues }.toList()
|
|
605
|
+
|
|
606
|
+
fun reReplace(
|
|
607
|
+
pattern: String,
|
|
608
|
+
input: String,
|
|
609
|
+
replacement: String,
|
|
610
|
+
): String {
|
|
611
|
+
// Translate JS $& to Kotlin $0
|
|
612
|
+
val kRepl = replacement.replace("$&", "\$0")
|
|
613
|
+
return Regex(pattern).replace(input, kRepl)
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
fun reEscape(s: String): String = escre(s)
|
|
617
|
+
|
|
618
|
+
fun escurl(s: Any?): String {
|
|
619
|
+
if (s == null || s === UNDEF) return ""
|
|
620
|
+
return URLEncoder.encode(s.toString(), StandardCharsets.UTF_8).replace("+", "%20")
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
fun join(
|
|
624
|
+
arr: Any?,
|
|
625
|
+
sep: Any?,
|
|
626
|
+
url: Any?,
|
|
627
|
+
): String {
|
|
628
|
+
if (arr !is List<*>) return ""
|
|
629
|
+
val sepDef = if (sep == null || sep === UNDEF) "," else sep.toString()
|
|
630
|
+
val urlMode = url == true
|
|
631
|
+
val parts = arr.filterIsInstance<String>().filter { it.isNotEmpty() }.toMutableList()
|
|
632
|
+
val sepre = Regex(escre(sepDef))
|
|
633
|
+
val clean = mutableListOf<String>()
|
|
634
|
+
for (i in parts.indices) {
|
|
635
|
+
var s = parts[i]
|
|
636
|
+
if (sepDef.length == 1 && sepDef.isNotEmpty()) {
|
|
637
|
+
if (urlMode && i == 0) s = s.replace(Regex("${sepre.pattern}+$"), "")
|
|
638
|
+
if (i > 0) s = s.replace(Regex("^${sepre.pattern}+"), "")
|
|
639
|
+
if (i < parts.size - 1 || !urlMode) s = s.replace(Regex("${sepre.pattern}+$"), "")
|
|
640
|
+
}
|
|
641
|
+
clean.add(s)
|
|
642
|
+
}
|
|
643
|
+
var out = clean.joinToString(sepDef)
|
|
644
|
+
if (!urlMode && sepDef.length == 1 && sepDef.isNotEmpty()) {
|
|
645
|
+
val cc = Regex.escape(sepDef)
|
|
646
|
+
out = out.replace(Regex("([^$cc])$cc+([^$cc])"), "$1$sepDef$2")
|
|
647
|
+
}
|
|
648
|
+
return out
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
fun slice(
|
|
652
|
+
value: Any?,
|
|
653
|
+
startObj: Any?,
|
|
654
|
+
endObj: Any?,
|
|
655
|
+
): Any? {
|
|
656
|
+
var start = if (startObj is Number) floor(startObj.toDouble()).toInt() else null
|
|
657
|
+
var end = if (endObj is Number) floor(endObj.toDouble()).toInt() else null
|
|
658
|
+
|
|
659
|
+
if (value is Number) {
|
|
660
|
+
val min = start ?: Int.MIN_VALUE
|
|
661
|
+
val max = (end ?: Int.MAX_VALUE) - 1
|
|
662
|
+
return value.toDouble().coerceIn(min.toDouble(), max.toDouble())
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
val vlen = size(value)
|
|
666
|
+
if (end != null && start == null) start = 0
|
|
667
|
+
if (start != null) {
|
|
668
|
+
if (start < 0) {
|
|
669
|
+
end = (vlen + start).coerceAtLeast(0)
|
|
670
|
+
start = 0
|
|
671
|
+
} else if (end != null) {
|
|
672
|
+
if (end < 0) {
|
|
673
|
+
end = (vlen + end).coerceAtLeast(0)
|
|
674
|
+
} else if (vlen < end) {
|
|
675
|
+
end = vlen
|
|
676
|
+
}
|
|
677
|
+
} else {
|
|
678
|
+
end = vlen
|
|
679
|
+
}
|
|
680
|
+
if (vlen < start) start = vlen
|
|
681
|
+
if (start >= 0 && start <= (end ?: 0) && (end ?: 0) <= vlen) {
|
|
682
|
+
if (value is List<*>) return value.subList(start, end!!).toMutableList()
|
|
683
|
+
if (value is String) return value.substring(start, end!!)
|
|
684
|
+
} else {
|
|
685
|
+
if (value is List<*>) return mutableListOf<Any?>()
|
|
686
|
+
if (value is String) return ""
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
return value
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
fun pad(
|
|
693
|
+
value: Any?,
|
|
694
|
+
paddingObj: Any?,
|
|
695
|
+
padcharObj: Any?,
|
|
696
|
+
): String {
|
|
697
|
+
val s = if (value is String) value else stringify(value)
|
|
698
|
+
val padding = if (paddingObj is Number) floor(paddingObj.toDouble()).toInt() else 44
|
|
699
|
+
val pc = ((padcharObj?.toString() ?: " ") + " ").substring(0, 1)
|
|
700
|
+
return if (padding >= 0) {
|
|
701
|
+
s + pc.repeat((padding - s.length).coerceAtLeast(0))
|
|
702
|
+
} else {
|
|
703
|
+
pc.repeat((-padding - s.length).coerceAtLeast(0)) + s
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
fun stringify(value: Any?): String = stringify(value, null)
|
|
708
|
+
|
|
709
|
+
fun stringify(
|
|
710
|
+
value: Any?,
|
|
711
|
+
maxlen: Int?,
|
|
712
|
+
): String {
|
|
713
|
+
val out =
|
|
714
|
+
when {
|
|
715
|
+
value === UNDEF -> ""
|
|
716
|
+
value is String -> value
|
|
717
|
+
else ->
|
|
718
|
+
try {
|
|
719
|
+
stringifyStable(value, IdentityHashMap())
|
|
720
|
+
} catch (_: Exception) {
|
|
721
|
+
"__STRINGIFY_FAILED__"
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
return if (maxlen != null && maxlen >= 0 && out.length > maxlen) out.substring(0, (maxlen - 3).coerceAtLeast(0)) + "..." else out
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
private fun stringifyStable(
|
|
728
|
+
value: Any?,
|
|
729
|
+
seen: IdentityHashMap<Any, Boolean>,
|
|
730
|
+
): String {
|
|
731
|
+
if (value == null) return "null"
|
|
732
|
+
if (value is String) return value
|
|
733
|
+
if (value is Number) return numstr(value)
|
|
734
|
+
if (value is Boolean || value is Function<*>) return value.toString()
|
|
735
|
+
if (seen.containsKey(value)) throw IllegalStateException("cycle")
|
|
736
|
+
seen[value] = true
|
|
737
|
+
return when (value) {
|
|
738
|
+
is List<*> -> {
|
|
739
|
+
val parts = value.map { stringifyStable(it, seen) }
|
|
740
|
+
seen.remove(value)
|
|
741
|
+
"[" + parts.joinToString(",") + "]"
|
|
742
|
+
}
|
|
743
|
+
is Map<*, *> -> {
|
|
744
|
+
val keys = value.keys.map { it.toString() }.sorted()
|
|
745
|
+
val parts = keys.map { "$it:${stringifyStable((value as Map<String, Any?>)[it], seen)}" }
|
|
746
|
+
seen.remove(value)
|
|
747
|
+
"{" + parts.joinToString(",") + "}"
|
|
748
|
+
}
|
|
749
|
+
else -> {
|
|
750
|
+
seen.remove(value)
|
|
751
|
+
value.toString()
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
fun jsonify(value: Any?): String = jsonify(value, null)
|
|
757
|
+
|
|
758
|
+
fun jsonify(
|
|
759
|
+
value: Any?,
|
|
760
|
+
flags: Any?,
|
|
761
|
+
): String {
|
|
762
|
+
if (value === UNDEF) return "null"
|
|
763
|
+
var indent = 2
|
|
764
|
+
var offset = 0
|
|
765
|
+
if (flags is Map<*, *>) {
|
|
766
|
+
val iv = flags["indent"]
|
|
767
|
+
val ov = flags["offset"]
|
|
768
|
+
if (iv is Number) indent = iv.toInt()
|
|
769
|
+
if (ov is Number) offset = ov.toInt()
|
|
770
|
+
}
|
|
771
|
+
return try {
|
|
772
|
+
val sb = StringBuilder()
|
|
773
|
+
_jsonifyInner(value, sb, indent, 0, IdentityHashMap())
|
|
774
|
+
var out = sb.toString()
|
|
775
|
+
if (offset > 0 && out.contains('\n')) {
|
|
776
|
+
val lines = out.split("\n")
|
|
777
|
+
val pad = " ".repeat(offset)
|
|
778
|
+
out = lines.first() + lines.drop(1).joinToString("") { "\n$pad$it" }
|
|
779
|
+
}
|
|
780
|
+
out
|
|
781
|
+
} catch (_: Exception) {
|
|
782
|
+
"__JSONIFY_FAILED__"
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
// Pure-Kotlin JSON emitter — mirrors c/src/utility.c::jsonify_inner.
|
|
787
|
+
// Map keys are emitted in INSERTION order (matching TS canonical's
|
|
788
|
+
// JSON.stringify). No third-party JSON library involved.
|
|
789
|
+
private fun _jsonifyInner(
|
|
790
|
+
v: Any?,
|
|
791
|
+
out: StringBuilder,
|
|
792
|
+
indent: Int,
|
|
793
|
+
depth: Int,
|
|
794
|
+
seen: IdentityHashMap<Any, Boolean>,
|
|
795
|
+
) {
|
|
796
|
+
if (v == null || v === UNDEF) {
|
|
797
|
+
out.append("null")
|
|
798
|
+
return
|
|
799
|
+
}
|
|
800
|
+
if (v is Boolean) {
|
|
801
|
+
out.append(if (v) "true" else "false")
|
|
802
|
+
return
|
|
803
|
+
}
|
|
804
|
+
if (v is Number) {
|
|
805
|
+
val d = v.toDouble()
|
|
806
|
+
if (!d.isFinite()) {
|
|
807
|
+
out.append("null")
|
|
808
|
+
return
|
|
809
|
+
}
|
|
810
|
+
if (floor(d) == d && Math.abs(d) < 1e15) {
|
|
811
|
+
out.append(d.toLong().toString())
|
|
812
|
+
} else {
|
|
813
|
+
var s = String.format(Locale.ROOT, "%g", d)
|
|
814
|
+
if (s.contains('.') && !s.contains('e') && !s.contains('E')) {
|
|
815
|
+
s = s.trimEnd('0').trimEnd('.')
|
|
816
|
+
}
|
|
817
|
+
out.append(s)
|
|
818
|
+
}
|
|
819
|
+
return
|
|
820
|
+
}
|
|
821
|
+
if (v is String) {
|
|
822
|
+
out.append('"')
|
|
823
|
+
_jsonEscape(v, out)
|
|
824
|
+
out.append('"')
|
|
825
|
+
return
|
|
826
|
+
}
|
|
827
|
+
if (v is Function<*>) {
|
|
828
|
+
out.append("null")
|
|
829
|
+
return
|
|
830
|
+
}
|
|
831
|
+
if (seen.containsKey(v)) {
|
|
832
|
+
out.append("null")
|
|
833
|
+
return
|
|
834
|
+
}
|
|
835
|
+
seen[v] = true
|
|
836
|
+
if (v is List<*>) {
|
|
837
|
+
if (v.isEmpty()) {
|
|
838
|
+
out.append("[]")
|
|
839
|
+
seen.remove(v)
|
|
840
|
+
return
|
|
841
|
+
}
|
|
842
|
+
out.append('[')
|
|
843
|
+
var first = true
|
|
844
|
+
for (e in v) {
|
|
845
|
+
if (!first) out.append(',')
|
|
846
|
+
first = false
|
|
847
|
+
if (indent > 0) {
|
|
848
|
+
out.append('\n').append(" ".repeat((depth + 1) * indent))
|
|
849
|
+
}
|
|
850
|
+
_jsonifyInner(e, out, indent, depth + 1, seen)
|
|
851
|
+
}
|
|
852
|
+
if (indent > 0) {
|
|
853
|
+
out.append('\n').append(" ".repeat(depth * indent))
|
|
854
|
+
}
|
|
855
|
+
out.append(']')
|
|
856
|
+
seen.remove(v)
|
|
857
|
+
return
|
|
858
|
+
}
|
|
859
|
+
if (v is Map<*, *>) {
|
|
860
|
+
if (v.isEmpty()) {
|
|
861
|
+
out.append("{}")
|
|
862
|
+
seen.remove(v)
|
|
863
|
+
return
|
|
864
|
+
}
|
|
865
|
+
out.append('{')
|
|
866
|
+
var first = true
|
|
867
|
+
for ((k, e) in v) {
|
|
868
|
+
if (!first) out.append(',')
|
|
869
|
+
first = false
|
|
870
|
+
if (indent > 0) {
|
|
871
|
+
out.append('\n').append(" ".repeat((depth + 1) * indent))
|
|
872
|
+
}
|
|
873
|
+
out.append('"')
|
|
874
|
+
_jsonEscape(k.toString(), out)
|
|
875
|
+
out.append(if (indent > 0) "\": " else "\":")
|
|
876
|
+
_jsonifyInner(e, out, indent, depth + 1, seen)
|
|
877
|
+
}
|
|
878
|
+
if (indent > 0) {
|
|
879
|
+
out.append('\n').append(" ".repeat(depth * indent))
|
|
880
|
+
}
|
|
881
|
+
out.append('}')
|
|
882
|
+
seen.remove(v)
|
|
883
|
+
return
|
|
884
|
+
}
|
|
885
|
+
seen.remove(v)
|
|
886
|
+
out.append("null")
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
private fun _jsonEscape(
|
|
890
|
+
s: String,
|
|
891
|
+
out: StringBuilder,
|
|
892
|
+
) {
|
|
893
|
+
for (c in s) {
|
|
894
|
+
when (c) {
|
|
895
|
+
'"' -> out.append("\\\"")
|
|
896
|
+
'\\' -> out.append("\\\\")
|
|
897
|
+
'\b' -> out.append("\\b")
|
|
898
|
+
'' -> out.append("\\f")
|
|
899
|
+
'\n' -> out.append("\\n")
|
|
900
|
+
'\r' -> out.append("\\r")
|
|
901
|
+
'\t' -> out.append("\\t")
|
|
902
|
+
else -> {
|
|
903
|
+
if (c.code < 0x20) {
|
|
904
|
+
out.append(String.format("\\u%04x", c.code))
|
|
905
|
+
} else {
|
|
906
|
+
out.append(c)
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
private fun numstr(n: Number): String {
|
|
914
|
+
val d = n.toDouble()
|
|
915
|
+
return if (d.isFinite() && floor(d) == d) d.toLong().toString() else n.toString().lowercase(Locale.ROOT)
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
private fun jsonNumber(n: Number): Number {
|
|
919
|
+
val d = n.toDouble()
|
|
920
|
+
return if (d.isFinite() && floor(d) == d) d.toLong() else d
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
fun pathify(value: Any?): String = pathify(value, null, null)
|
|
924
|
+
|
|
925
|
+
fun pathify(
|
|
926
|
+
value: Any?,
|
|
927
|
+
from: Any?,
|
|
928
|
+
): String = pathify(value, from, null)
|
|
929
|
+
|
|
930
|
+
fun pathify(
|
|
931
|
+
value: Any?,
|
|
932
|
+
startIn: Any?,
|
|
933
|
+
endIn: Any?,
|
|
934
|
+
): String {
|
|
935
|
+
val start = if (startIn is Number) startIn.toInt().coerceAtLeast(0) else 0
|
|
936
|
+
val end = if (endIn is Number) endIn.toInt().coerceAtLeast(0) else 0
|
|
937
|
+
val path: MutableList<Any?>? =
|
|
938
|
+
when (value) {
|
|
939
|
+
is List<*> -> value.toMutableList()
|
|
940
|
+
is String, is Number -> mutableListOf(value)
|
|
941
|
+
else -> null
|
|
942
|
+
}
|
|
943
|
+
if (path != null) {
|
|
944
|
+
val sp = slice(path, start, path.size - end)
|
|
945
|
+
val use = (sp as? List<*>) ?: emptyList<Any?>()
|
|
946
|
+
if (use.isEmpty()) return "<root>"
|
|
947
|
+
return use.filter { iskey(it) }.joinToString(".") {
|
|
948
|
+
when (it) {
|
|
949
|
+
is Number -> floor(it.toDouble()).toLong().toString()
|
|
950
|
+
else -> it.toString().replace(".", "")
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
return "<unknown-path" + (if (value === UNDEF) "" else ":" + stringify(value, 47)) + ">"
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
fun setpath(
|
|
958
|
+
store: Any?,
|
|
959
|
+
path: Any?,
|
|
960
|
+
value: Any?,
|
|
961
|
+
): Any? {
|
|
962
|
+
val parts: MutableList<Any?> =
|
|
963
|
+
when (path) {
|
|
964
|
+
is List<*> -> path.toMutableList()
|
|
965
|
+
is String -> path.split(".").toMutableList()
|
|
966
|
+
is Number -> mutableListOf(path)
|
|
967
|
+
else -> return UNDEF
|
|
968
|
+
}
|
|
969
|
+
if (parts.isEmpty()) return UNDEF
|
|
970
|
+
var parent = store
|
|
971
|
+
for (i in 0 until parts.size - 1) {
|
|
972
|
+
val key = parts[i]
|
|
973
|
+
var next = getprop(parent, key, UNDEF)
|
|
974
|
+
if (!isnode(next)) {
|
|
975
|
+
val nk = parts[i + 1]
|
|
976
|
+
next = if (nk is Number) mutableListOf<Any?>() else linkedMapOf<String, Any?>()
|
|
977
|
+
setprop(parent, key, next)
|
|
978
|
+
}
|
|
979
|
+
parent = next
|
|
980
|
+
}
|
|
981
|
+
val last = parts.last()
|
|
982
|
+
if (value === DELETE) delprop(parent, last) else setprop(parent, last, value)
|
|
983
|
+
return parent
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
fun walk(
|
|
987
|
+
value: Any?,
|
|
988
|
+
apply: WalkApply,
|
|
989
|
+
): Any? = walk(value, apply, null, 32)
|
|
990
|
+
|
|
991
|
+
fun walk(
|
|
992
|
+
value: Any?,
|
|
993
|
+
before: WalkApply?,
|
|
994
|
+
after: WalkApply?,
|
|
995
|
+
): Any? = walk(value, before, after, 32)
|
|
996
|
+
|
|
997
|
+
fun walk(
|
|
998
|
+
value: Any?,
|
|
999
|
+
before: WalkApply?,
|
|
1000
|
+
after: WalkApply?,
|
|
1001
|
+
maxdepth: Int,
|
|
1002
|
+
): Any? {
|
|
1003
|
+
return walkDescend(value, before, after, maxdepth, null, null, mutableListOf())
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
private fun walkDescend(
|
|
1007
|
+
value: Any?,
|
|
1008
|
+
before: WalkApply?,
|
|
1009
|
+
after: WalkApply?,
|
|
1010
|
+
maxdepth: Int,
|
|
1011
|
+
key: String?,
|
|
1012
|
+
parent: Any?,
|
|
1013
|
+
path: MutableList<String>,
|
|
1014
|
+
): Any? {
|
|
1015
|
+
var out = value
|
|
1016
|
+
if (before != null) out = before.apply(key, out, parent, path)
|
|
1017
|
+
val plen = path.size
|
|
1018
|
+
if (maxdepth == 0 || (maxdepth > 0 && maxdepth <= plen)) return out
|
|
1019
|
+
if (isnode(out)) {
|
|
1020
|
+
for (item in items(out)) {
|
|
1021
|
+
val ckey = item[0].toString()
|
|
1022
|
+
val child = item[1]
|
|
1023
|
+
val newPath = path.toMutableList()
|
|
1024
|
+
newPath.add(ckey)
|
|
1025
|
+
val newChild = walkDescend(child, before, after, maxdepth, ckey, out, newPath)
|
|
1026
|
+
out = setprop(out, ckey, newChild)
|
|
1027
|
+
}
|
|
1028
|
+
if (parent != null && key != null) setprop(parent, key, out)
|
|
1029
|
+
}
|
|
1030
|
+
if (after != null) out = after.apply(key, out, parent, path)
|
|
1031
|
+
return out
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
fun merge(value: Any?): Any? = merge(value, 32)
|
|
1035
|
+
|
|
1036
|
+
fun merge(
|
|
1037
|
+
value: Any?,
|
|
1038
|
+
maxdepthIn: Int,
|
|
1039
|
+
): Any? {
|
|
1040
|
+
val md = if (maxdepthIn < 0) 0 else maxdepthIn
|
|
1041
|
+
if (value !is List<*>) return value
|
|
1042
|
+
if (value.isEmpty()) return null
|
|
1043
|
+
if (value.size == 1) return value[0]
|
|
1044
|
+
var out: Any? = getprop(value, 0, linkedMapOf<String, Any?>())
|
|
1045
|
+
for (oI in 1 until value.size) {
|
|
1046
|
+
val obj = value[oI]
|
|
1047
|
+
if (!isnode(obj)) {
|
|
1048
|
+
out = obj
|
|
1049
|
+
} else {
|
|
1050
|
+
val cur = arrayOfNulls<Any>(33)
|
|
1051
|
+
val dst = arrayOfNulls<Any>(33)
|
|
1052
|
+
cur[0] = out
|
|
1053
|
+
dst[0] = out
|
|
1054
|
+
val before =
|
|
1055
|
+
WalkApply { key, v, _, path ->
|
|
1056
|
+
val pI = path.size
|
|
1057
|
+
if (md <= pI) {
|
|
1058
|
+
if (key != null) cur[pI - 1] = setprop(cur[pI - 1], key, v)
|
|
1059
|
+
} else if (!isnode(v)) {
|
|
1060
|
+
cur[pI] = v
|
|
1061
|
+
} else {
|
|
1062
|
+
if (pI > 0 && key != null) {
|
|
1063
|
+
dst[pI] = getprop(dst[pI - 1], key, UNDEF).let { if (it === UNDEF) null else it }
|
|
1064
|
+
}
|
|
1065
|
+
val tval = dst[pI]
|
|
1066
|
+
cur[pI] =
|
|
1067
|
+
when {
|
|
1068
|
+
tval == null && (typify(v) and T_INSTANCE) == 0 -> if (islist(v)) mutableListOf<Any?>() else linkedMapOf<String, Any?>()
|
|
1069
|
+
typify(v) == typify(tval) -> tval
|
|
1070
|
+
else -> v
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
v
|
|
1074
|
+
}
|
|
1075
|
+
val after =
|
|
1076
|
+
WalkApply { key, _, _, path ->
|
|
1077
|
+
val cI = path.size
|
|
1078
|
+
if (key == null || cI <= 0) return@WalkApply cur[0]
|
|
1079
|
+
val v = cur[cI]
|
|
1080
|
+
cur[cI - 1] = setprop(cur[cI - 1], key, v)
|
|
1081
|
+
v
|
|
1082
|
+
}
|
|
1083
|
+
walk(obj, before, after, md)
|
|
1084
|
+
out = cur[0]
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
if (md == 0) {
|
|
1088
|
+
out = getelem(value, -1)
|
|
1089
|
+
if (out is List<*>) {
|
|
1090
|
+
out = mutableListOf<Any?>()
|
|
1091
|
+
} else if (out is Map<*, *>) {
|
|
1092
|
+
out = linkedMapOf<String, Any?>()
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
return out
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
fun getpath(
|
|
1099
|
+
store: Any?,
|
|
1100
|
+
path: Any?,
|
|
1101
|
+
): Any? = getpath(store, path, null as Injection?)
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* Injection-based getpath. Builds a transient view from inj.base/dparent/dpath/
|
|
1105
|
+
* meta/key for getpathInner's special-path syntax ($KEY/$REF/$META), runs the
|
|
1106
|
+
* lookup, then invokes inj.handler if set. Mirrors Java getpath(Object, Object,
|
|
1107
|
+
* Injection) (Struct.java:1461).
|
|
1108
|
+
*/
|
|
1109
|
+
fun getpath(
|
|
1110
|
+
store: Any?,
|
|
1111
|
+
path: Any?,
|
|
1112
|
+
inj: Injection?,
|
|
1113
|
+
): Any? {
|
|
1114
|
+
val view: MutableMap<String, Any?>? =
|
|
1115
|
+
if (inj == null) {
|
|
1116
|
+
null
|
|
1117
|
+
} else {
|
|
1118
|
+
linkedMapOf<String, Any?>().also {
|
|
1119
|
+
if (inj.base != null) it["base"] = inj.base
|
|
1120
|
+
it["dparent"] = inj.dparent
|
|
1121
|
+
it["dpath"] = inj.dpath
|
|
1122
|
+
it["meta"] = inj.meta
|
|
1123
|
+
it["key"] = inj.key
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
val parts = pathParts(path)
|
|
1127
|
+
var value = getpathInner(store, path, parts, view)
|
|
1128
|
+
if (inj?.handler != null) {
|
|
1129
|
+
value = inj.handler!!.apply(inj, value, pathifyForHandler(path), store)
|
|
1130
|
+
}
|
|
1131
|
+
return value
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
fun inject(
|
|
1135
|
+
value: Any?,
|
|
1136
|
+
store: Any?,
|
|
1137
|
+
): Any? = inject(value, store, null as Injection?)
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
* Canonical Injection-based inject. Mirrors TS inject (StructUtility.ts:1264)
|
|
1141
|
+
* and Java inject(Object, Object, Injection) (Struct.java:1308). Drives the
|
|
1142
|
+
* three-phase machine (M_KEYPRE / M_VAL / M_KEYPOST) for map/list children
|
|
1143
|
+
* and dispatches `$NAME` references via inj.handler.
|
|
1144
|
+
*/
|
|
1145
|
+
fun inject(
|
|
1146
|
+
value: Any?,
|
|
1147
|
+
store: Any?,
|
|
1148
|
+
injdef: Injection?,
|
|
1149
|
+
): Any? {
|
|
1150
|
+
var v = value
|
|
1151
|
+
val inj: Injection
|
|
1152
|
+
val isInitial = injdef == null || injdef.prior == null
|
|
1153
|
+
|
|
1154
|
+
if (isInitial) {
|
|
1155
|
+
val wrapper = linkedMapOf<String, Any?>(S_DTOP to v)
|
|
1156
|
+
inj = Injection(v, wrapper)
|
|
1157
|
+
inj.dparent = store
|
|
1158
|
+
val errsRaw = getprop(store, "\$ERRS", UNDEF)
|
|
1159
|
+
@Suppress("UNCHECKED_CAST")
|
|
1160
|
+
if (errsRaw is MutableList<*>) inj.errs = errsRaw as MutableList<Any?>
|
|
1161
|
+
inj.meta["__d"] = 0
|
|
1162
|
+
if (injdef != null) {
|
|
1163
|
+
if (injdef.modify != null) inj.modify = injdef.modify
|
|
1164
|
+
if (injdef.extra != null) inj.extra = injdef.extra
|
|
1165
|
+
if (injdef.meta != null && injdef.meta.isNotEmpty()) inj.meta = injdef.meta.also { if (!it.containsKey("__d")) it["__d"] = 0 }
|
|
1166
|
+
if (injdef.handler != null) inj.handler = injdef.handler
|
|
1167
|
+
if (injdef.base != null) inj.base = injdef.base
|
|
1168
|
+
if (injdef.dparent !== UNDEF) inj.dparent = injdef.dparent
|
|
1169
|
+
}
|
|
1170
|
+
if (inj.handler == null) inj.handler = _injecthandler
|
|
1171
|
+
inj.nodes.clear()
|
|
1172
|
+
inj.nodes.add(wrapper)
|
|
1173
|
+
} else {
|
|
1174
|
+
inj = injdef!!
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
inj.descend()
|
|
1178
|
+
|
|
1179
|
+
if (isnode(v)) {
|
|
1180
|
+
var nodekeys: MutableList<String> = keysof(v).toMutableList()
|
|
1181
|
+
if (ismap(v)) {
|
|
1182
|
+
// $-suffix ordering: non-$ keys first, then $ keys.
|
|
1183
|
+
val nonDollar = mutableListOf<String>()
|
|
1184
|
+
val dollar = mutableListOf<String>()
|
|
1185
|
+
for (k in nodekeys) if (k.contains("$")) dollar.add(k) else nonDollar.add(k)
|
|
1186
|
+
nodekeys =
|
|
1187
|
+
mutableListOf<String>().also {
|
|
1188
|
+
it.addAll(nonDollar)
|
|
1189
|
+
it.addAll(dollar)
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
var nkI = 0
|
|
1193
|
+
while (nkI < nodekeys.size) {
|
|
1194
|
+
val childinj = inj.child(nkI, nodekeys)
|
|
1195
|
+
val nodekey = childinj.key
|
|
1196
|
+
childinj.mode = M_KEYPRE
|
|
1197
|
+
val prekey = _injectstr(nodekey, store, childinj)
|
|
1198
|
+
nkI = childinj.keyI
|
|
1199
|
+
nodekeys = childinj.keys
|
|
1200
|
+
if (prekey !== UNDEF) {
|
|
1201
|
+
childinj.`val` = getprop(v, prekey)
|
|
1202
|
+
childinj.mode = M_VAL
|
|
1203
|
+
inject(childinj.`val`, store, childinj)
|
|
1204
|
+
nkI = childinj.keyI
|
|
1205
|
+
nodekeys = childinj.keys
|
|
1206
|
+
childinj.mode = M_KEYPOST
|
|
1207
|
+
_injectstr(nodekey, store, childinj)
|
|
1208
|
+
nkI = childinj.keyI
|
|
1209
|
+
nodekeys = childinj.keys
|
|
1210
|
+
}
|
|
1211
|
+
nkI++
|
|
1212
|
+
}
|
|
1213
|
+
} else if (v is String) {
|
|
1214
|
+
inj.mode = M_VAL
|
|
1215
|
+
val newVal = _injectstr(v, store, inj)
|
|
1216
|
+
if (newVal !== SKIP) inj.setval(newVal)
|
|
1217
|
+
v = newVal
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
if (inj.modify != null && v !== SKIP) {
|
|
1221
|
+
val mkey = inj.key
|
|
1222
|
+
val mparent = inj.parent
|
|
1223
|
+
val mval = getprop(mparent, mkey)
|
|
1224
|
+
inj.modify!!.apply(mval, mkey, mparent, inj, store)
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
inj.`val` = v
|
|
1228
|
+
return lookup(inj.parent, S_DTOP)
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* String-injection helper. Mirrors TS _injectstr (StructUtility.ts) and Java
|
|
1233
|
+
* _injectstr (Struct.java:1490). Handles full `\`...\`` patterns (whole-string
|
|
1234
|
+
* match) and partial inline patterns, then invokes inj.handler on the result.
|
|
1235
|
+
*/
|
|
1236
|
+
private fun _injectstr(
|
|
1237
|
+
value: String?,
|
|
1238
|
+
store: Any?,
|
|
1239
|
+
inj: Injection?,
|
|
1240
|
+
): Any? {
|
|
1241
|
+
if (value.isNullOrEmpty()) return ""
|
|
1242
|
+
val full = R_INJECT_FULL.matcher(value)
|
|
1243
|
+
if (full.matches()) {
|
|
1244
|
+
inj?.full = true
|
|
1245
|
+
val pathref = unescapeInjectRef(full.group(1))
|
|
1246
|
+
return getpath(store, pathref, inj)
|
|
1247
|
+
}
|
|
1248
|
+
val m = R_INJECT_PART.matcher(value)
|
|
1249
|
+
val sb = StringBuilder()
|
|
1250
|
+
var cursor = 0
|
|
1251
|
+
while (m.find()) {
|
|
1252
|
+
sb.append(value, cursor, m.start())
|
|
1253
|
+
val ref = unescapeInjectRef(m.group(1))
|
|
1254
|
+
inj?.full = false
|
|
1255
|
+
val found = getpath(store, ref, inj)
|
|
1256
|
+
sb.append(injectPartialText(found))
|
|
1257
|
+
cursor = m.end()
|
|
1258
|
+
}
|
|
1259
|
+
sb.append(value.substring(cursor))
|
|
1260
|
+
var outVal: Any? = sb.toString()
|
|
1261
|
+
if (inj?.handler != null) {
|
|
1262
|
+
inj.full = true
|
|
1263
|
+
outVal = inj.handler!!.apply(inj, outVal, value, store)
|
|
1264
|
+
}
|
|
1265
|
+
return outVal
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
/**
|
|
1269
|
+
* Default Injector. When a backtick reference resolves to a callable, invoke
|
|
1270
|
+
* it with the Injection. In M_VAL mode with a "full" injection, set the
|
|
1271
|
+
* resolved value back onto inj.parent[inj.key]. Mirrors TS _injecthandler
|
|
1272
|
+
* (StructUtility.ts) and Java _injecthandler (Struct.java:1631).
|
|
1273
|
+
*/
|
|
1274
|
+
val _injecthandler: Injector =
|
|
1275
|
+
Injector { inj, value, ref, store ->
|
|
1276
|
+
var out = value
|
|
1277
|
+
val iscmd = isfunc(value) && (ref == null || ref.startsWith("$"))
|
|
1278
|
+
if (iscmd) {
|
|
1279
|
+
out =
|
|
1280
|
+
when (value) {
|
|
1281
|
+
is Injector -> value.apply(inj, value, ref, store)
|
|
1282
|
+
is java.util.function.Function<*, *> -> {
|
|
1283
|
+
@Suppress("UNCHECKED_CAST")
|
|
1284
|
+
(value as java.util.function.Function<Any?, Any?>).apply(inj)
|
|
1285
|
+
}
|
|
1286
|
+
is Function1<*, *> -> {
|
|
1287
|
+
@Suppress("UNCHECKED_CAST")
|
|
1288
|
+
(value as (Any?) -> Any?).invoke(inj)
|
|
1289
|
+
}
|
|
1290
|
+
is java.util.function.Supplier<*> -> value.get()
|
|
1291
|
+
else -> value
|
|
1292
|
+
}
|
|
1293
|
+
} else if (inj.mode == M_VAL && inj.full) {
|
|
1294
|
+
inj.setval(value)
|
|
1295
|
+
}
|
|
1296
|
+
out
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
// Mirrors TS checkPlacement (StructUtility.ts:2920) and Java (Struct.java:1537).
|
|
1300
|
+
private val PLACEMENT: Map<Int, String> =
|
|
1301
|
+
mapOf(
|
|
1302
|
+
M_VAL to "value",
|
|
1303
|
+
M_KEYPRE to "key",
|
|
1304
|
+
M_KEYPOST to "key",
|
|
1305
|
+
)
|
|
1306
|
+
|
|
1307
|
+
fun checkPlacement(
|
|
1308
|
+
modes: Int,
|
|
1309
|
+
ijname: String,
|
|
1310
|
+
parentTypes: Int,
|
|
1311
|
+
inj: Injection,
|
|
1312
|
+
): Boolean {
|
|
1313
|
+
if ((modes and inj.mode) == 0) {
|
|
1314
|
+
val expected =
|
|
1315
|
+
listOf(M_KEYPRE, M_KEYPOST, M_VAL)
|
|
1316
|
+
.filter { (modes and it) != 0 }
|
|
1317
|
+
.joinToString(",") { PLACEMENT[it] ?: "?" }
|
|
1318
|
+
inj.errs.add("\$$ijname: invalid placement as ${PLACEMENT[inj.mode]}, expected: $expected.")
|
|
1319
|
+
return false
|
|
1320
|
+
}
|
|
1321
|
+
if (parentTypes != 0) {
|
|
1322
|
+
val ptype = typify(inj.parent)
|
|
1323
|
+
if ((parentTypes and ptype) == 0) {
|
|
1324
|
+
inj.errs.add("\$$ijname: invalid placement in parent ${typename(ptype)}, expected: ${typename(parentTypes)}.")
|
|
1325
|
+
return false
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
return true
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
// Mirrors TS injectorArgs (StructUtility.ts:2947). Returns [errOrUNDEF, arg1, arg2, ...].
|
|
1332
|
+
fun injectorArgs(
|
|
1333
|
+
argTypes: IntArray,
|
|
1334
|
+
args: List<Any?>,
|
|
1335
|
+
): Array<Any?> {
|
|
1336
|
+
val numargs = argTypes.size
|
|
1337
|
+
val found = arrayOfNulls<Any?>(1 + numargs)
|
|
1338
|
+
found[0] = UNDEF
|
|
1339
|
+
for (argI in 0 until numargs) {
|
|
1340
|
+
val arg = if (argI < args.size) args[argI] else UNDEF
|
|
1341
|
+
val argType = typify(arg)
|
|
1342
|
+
if ((argTypes[argI] and argType) == 0) {
|
|
1343
|
+
found[0] = "invalid argument: ${stringify(arg, 22)} (${typename(argType)} at position ${1 + argI}) is not of type: ${typename(argTypes[argI])}."
|
|
1344
|
+
break
|
|
1345
|
+
}
|
|
1346
|
+
found[1 + argI] = arg
|
|
1347
|
+
}
|
|
1348
|
+
return found
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
// Mirrors TS injectChild (StructUtility.ts:2967). Walks inj.prior/inj.prior.prior
|
|
1352
|
+
// to relocate the child within a $FORMAT chain, then re-injects.
|
|
1353
|
+
fun injectChild(
|
|
1354
|
+
child: Any?,
|
|
1355
|
+
store: Any?,
|
|
1356
|
+
inj: Injection,
|
|
1357
|
+
): Injection {
|
|
1358
|
+
var cinj: Injection = inj
|
|
1359
|
+
val prior = inj.prior
|
|
1360
|
+
if (prior != null) {
|
|
1361
|
+
val priorPrior = prior.prior
|
|
1362
|
+
if (priorPrior != null) {
|
|
1363
|
+
cinj = priorPrior.child(prior.keyI, prior.keys)
|
|
1364
|
+
cinj.`val` = child
|
|
1365
|
+
setprop(cinj.parent, prior.key, child)
|
|
1366
|
+
} else {
|
|
1367
|
+
cinj = prior.child(inj.keyI, inj.keys)
|
|
1368
|
+
cinj.`val` = child
|
|
1369
|
+
setprop(cinj.parent, inj.key, child)
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
inject(child, store, cinj)
|
|
1373
|
+
return cinj
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
// ===========================================================================
|
|
1377
|
+
// Transform Injectors
|
|
1378
|
+
// ===========================================================================
|
|
1379
|
+
// Mirrors Java Struct.java:1660-2240 and TS StructUtility.ts:1393-1896.
|
|
1380
|
+
// Each Injector implements one of the 11 canonical transform commands.
|
|
1381
|
+
|
|
1382
|
+
/** $DELETE: drop the current key. */
|
|
1383
|
+
val transform_DELETE: Injector =
|
|
1384
|
+
Injector { inj, _, _, _ ->
|
|
1385
|
+
inj.setval(UNDEF)
|
|
1386
|
+
UNDEF
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
/** $COPY: copy the value at the current key from dparent. */
|
|
1390
|
+
val transform_COPY: Injector =
|
|
1391
|
+
Injector { inj, _, _, _ ->
|
|
1392
|
+
if (!checkPlacement(M_VAL, "COPY", T_ANY, inj)) return@Injector UNDEF
|
|
1393
|
+
val out = lookup(inj.dparent, inj.key)
|
|
1394
|
+
inj.setval(out)
|
|
1395
|
+
out
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
/** $KEY: emit the parent key, optionally renamed via `$KEY` or `$ANNO.KEY`. */
|
|
1399
|
+
val transform_KEY: Injector =
|
|
1400
|
+
Injector { inj, _, _, _ ->
|
|
1401
|
+
if (inj.mode != M_VAL) return@Injector UNDEF
|
|
1402
|
+
// Group B: the $KEY/$ANNO spec markers are read raw (TS _lookup).
|
|
1403
|
+
val keyspec = lookup(inj.parent, "`\$KEY`")
|
|
1404
|
+
if (keyspec !== UNDEF) {
|
|
1405
|
+
delprop(inj.parent, "`\$KEY`")
|
|
1406
|
+
return@Injector getprop(inj.dparent, keyspec)
|
|
1407
|
+
}
|
|
1408
|
+
val anno = lookup(inj.parent, "`\$ANNO`")
|
|
1409
|
+
// TS: _lookup(_lookup(parent,$ANNO),KEY) ?? getelem(path,-2) — fall
|
|
1410
|
+
// back only when absent or JSON null.
|
|
1411
|
+
val annoKey = lookup(anno, "KEY")
|
|
1412
|
+
if (annoKey === UNDEF || annoKey == null) getelem(inj.path, -2) else annoKey
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
/** $ANNO: drop the annotation marker. */
|
|
1416
|
+
val transform_ANNO: Injector =
|
|
1417
|
+
Injector { inj, _, _, _ ->
|
|
1418
|
+
delprop(inj.parent, "`\$ANNO`")
|
|
1419
|
+
UNDEF
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
/** $MERGE: deep-merge a list of objects over the current parent. */
|
|
1423
|
+
val transform_MERGE: Injector =
|
|
1424
|
+
Injector { inj, _, _, _ ->
|
|
1425
|
+
if (inj.mode == M_KEYPRE) return@Injector inj.key
|
|
1426
|
+
if (inj.mode != M_KEYPOST) return@Injector UNDEF
|
|
1427
|
+
val args = getprop(inj.parent, inj.key)
|
|
1428
|
+
val argList: MutableList<Any?> =
|
|
1429
|
+
if (args is List<*>) {
|
|
1430
|
+
@Suppress("UNCHECKED_CAST")
|
|
1431
|
+
(args.toMutableList() as MutableList<Any?>)
|
|
1432
|
+
} else {
|
|
1433
|
+
mutableListOf<Any?>(args)
|
|
1434
|
+
}
|
|
1435
|
+
inj.setval(UNDEF)
|
|
1436
|
+
val mergelist = mutableListOf<Any?>()
|
|
1437
|
+
mergelist.add(inj.parent)
|
|
1438
|
+
mergelist.addAll(argList)
|
|
1439
|
+
mergelist.add(clone(inj.parent))
|
|
1440
|
+
merge(mergelist)
|
|
1441
|
+
inj.key
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
// FORMATTER: name → WalkApply for $FORMAT.
|
|
1445
|
+
private fun jsString(v: Any?): String {
|
|
1446
|
+
if (v == null) return "null"
|
|
1447
|
+
if (v is Number) {
|
|
1448
|
+
val d = v.toDouble()
|
|
1449
|
+
if (d.isFinite() && floor(d) == d) return d.toLong().toString()
|
|
1450
|
+
return v.toString()
|
|
1451
|
+
}
|
|
1452
|
+
if (v is Boolean) return if (v) "true" else "false"
|
|
1453
|
+
return v.toString()
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
val FORMATTER: Map<String, WalkApply> =
|
|
1457
|
+
linkedMapOf(
|
|
1458
|
+
"identity" to WalkApply { _, v, _, _ -> v },
|
|
1459
|
+
"upper" to WalkApply { _, v, _, _ -> if (isnode(v)) v else jsString(v).uppercase(Locale.ROOT) },
|
|
1460
|
+
"lower" to WalkApply { _, v, _, _ -> if (isnode(v)) v else jsString(v).lowercase(Locale.ROOT) },
|
|
1461
|
+
"string" to WalkApply { _, v, _, _ -> if (isnode(v)) v else jsString(v) },
|
|
1462
|
+
"number" to
|
|
1463
|
+
WalkApply { _, v, _, _ ->
|
|
1464
|
+
if (isnode(v)) {
|
|
1465
|
+
v
|
|
1466
|
+
} else {
|
|
1467
|
+
try {
|
|
1468
|
+
val d = ("" + v).toDouble()
|
|
1469
|
+
when {
|
|
1470
|
+
d.isNaN() -> 0L
|
|
1471
|
+
floor(d) == d -> d.toLong()
|
|
1472
|
+
else -> d
|
|
1473
|
+
}
|
|
1474
|
+
} catch (_: Exception) {
|
|
1475
|
+
0L
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
},
|
|
1479
|
+
"integer" to
|
|
1480
|
+
WalkApply { _, v, _, _ ->
|
|
1481
|
+
if (isnode(v)) {
|
|
1482
|
+
v
|
|
1483
|
+
} else {
|
|
1484
|
+
try {
|
|
1485
|
+
("" + v).toDouble().toLong()
|
|
1486
|
+
} catch (_: Exception) {
|
|
1487
|
+
0L
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
},
|
|
1491
|
+
"concat" to
|
|
1492
|
+
WalkApply { k, v, _, _ ->
|
|
1493
|
+
if (k != null || v !is List<*>) {
|
|
1494
|
+
v
|
|
1495
|
+
} else {
|
|
1496
|
+
val sb = StringBuilder()
|
|
1497
|
+
for (item in items(v)) {
|
|
1498
|
+
val x = item[1]
|
|
1499
|
+
if (!isnode(x)) sb.append(jsString(x))
|
|
1500
|
+
}
|
|
1501
|
+
sb.toString()
|
|
1502
|
+
}
|
|
1503
|
+
},
|
|
1504
|
+
)
|
|
1505
|
+
|
|
1506
|
+
/** $FORMAT: walk a sub-spec applying a named formatter. */
|
|
1507
|
+
val transform_FORMAT: Injector =
|
|
1508
|
+
Injector { inj, _, _, store ->
|
|
1509
|
+
if (inj.keys.size > 1) {
|
|
1510
|
+
val first = inj.keys[0]
|
|
1511
|
+
inj.keys.clear()
|
|
1512
|
+
inj.keys.add(first)
|
|
1513
|
+
}
|
|
1514
|
+
if (inj.mode != M_VAL) return@Injector UNDEF
|
|
1515
|
+
|
|
1516
|
+
val name = lookup(inj.parent, 1)
|
|
1517
|
+
val child = lookup(inj.parent, 2)
|
|
1518
|
+
|
|
1519
|
+
val tkey = getelem(inj.path, -2)
|
|
1520
|
+
var target = getelem(inj.nodes, -2)
|
|
1521
|
+
if (target === UNDEF) target = getelem(inj.nodes, -1)
|
|
1522
|
+
|
|
1523
|
+
val cinj = injectChild(child, store, inj)
|
|
1524
|
+
val resolved = cinj.`val`
|
|
1525
|
+
|
|
1526
|
+
val formatter: WalkApply? = if (name is WalkApply) name else FORMATTER[name?.toString() ?: ""]
|
|
1527
|
+
if (formatter == null) {
|
|
1528
|
+
inj.errs.add("\$FORMAT: unknown format: $name.")
|
|
1529
|
+
return@Injector UNDEF
|
|
1530
|
+
}
|
|
1531
|
+
val out = walk(resolved, formatter)
|
|
1532
|
+
setprop(target, tkey, out)
|
|
1533
|
+
out
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
/** $APPLY: call a custom function on a resolved sub-spec value. */
|
|
1537
|
+
val transform_APPLY: Injector =
|
|
1538
|
+
Injector { inj, _, _, store ->
|
|
1539
|
+
if (!checkPlacement(M_VAL, "APPLY", T_LIST, inj)) return@Injector UNDEF
|
|
1540
|
+
|
|
1541
|
+
val args = mutableListOf<Any?>()
|
|
1542
|
+
val parent = inj.parent
|
|
1543
|
+
if (parent is List<*> && parent.size > 1) {
|
|
1544
|
+
for (i in 1 until parent.size) args.add(parent[i])
|
|
1545
|
+
}
|
|
1546
|
+
val checked = injectorArgs(intArrayOf(T_FUNCTION, T_ANY), args)
|
|
1547
|
+
if (checked[0] !== UNDEF) {
|
|
1548
|
+
inj.errs.add("\$APPLY: ${checked[0]}")
|
|
1549
|
+
return@Injector UNDEF
|
|
1550
|
+
}
|
|
1551
|
+
val applyFn = checked[1]
|
|
1552
|
+
val child = checked[2]
|
|
1553
|
+
|
|
1554
|
+
val tkey = getelem(inj.path, -2)
|
|
1555
|
+
var target = getelem(inj.nodes, -2)
|
|
1556
|
+
if (target === UNDEF) target = getelem(inj.nodes, -1)
|
|
1557
|
+
|
|
1558
|
+
val cinj = injectChild(child, store, inj)
|
|
1559
|
+
val resolved = cinj.`val`
|
|
1560
|
+
|
|
1561
|
+
val out: Any? =
|
|
1562
|
+
when (applyFn) {
|
|
1563
|
+
is java.util.function.Function<*, *> -> {
|
|
1564
|
+
@Suppress("UNCHECKED_CAST")
|
|
1565
|
+
(applyFn as java.util.function.Function<Any?, Any?>).apply(resolved)
|
|
1566
|
+
}
|
|
1567
|
+
is Function1<*, *> -> {
|
|
1568
|
+
@Suppress("UNCHECKED_CAST")
|
|
1569
|
+
(applyFn as (Any?) -> Any?).invoke(resolved)
|
|
1570
|
+
}
|
|
1571
|
+
else -> UNDEF
|
|
1572
|
+
}
|
|
1573
|
+
setprop(target, tkey, out)
|
|
1574
|
+
out
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
/** $EACH: convert a node into a list by cloning the child template per source entry. */
|
|
1578
|
+
val transform_EACH: Injector =
|
|
1579
|
+
Injector { inj, _, _, store ->
|
|
1580
|
+
if (!checkPlacement(M_VAL, "EACH", T_LIST, inj)) return@Injector UNDEF
|
|
1581
|
+
if (inj.keys.size > 1) inj.keys.subList(1, inj.keys.size).clear()
|
|
1582
|
+
|
|
1583
|
+
val args = mutableListOf<Any?>()
|
|
1584
|
+
val parent = inj.parent
|
|
1585
|
+
if (parent is List<*>) for (i in 1 until parent.size) args.add(parent[i])
|
|
1586
|
+
val checked = injectorArgs(intArrayOf(T_STRING, T_ANY), args)
|
|
1587
|
+
if (checked[0] !== UNDEF) {
|
|
1588
|
+
inj.errs.add("\$EACH: ${checked[0]}")
|
|
1589
|
+
return@Injector UNDEF
|
|
1590
|
+
}
|
|
1591
|
+
val srcpath = checked[1] as String
|
|
1592
|
+
val child = checked[2]
|
|
1593
|
+
|
|
1594
|
+
val srcstore = getprop(store, inj.base, store)
|
|
1595
|
+
val src = getpath(srcstore, srcpath, inj)
|
|
1596
|
+
val srctype = typify(src)
|
|
1597
|
+
|
|
1598
|
+
val tkey = getelem(inj.path, -2)
|
|
1599
|
+
var target = getelem(inj.nodes, -2)
|
|
1600
|
+
if (target === UNDEF) target = getelem(inj.nodes, -1)
|
|
1601
|
+
|
|
1602
|
+
val tval = mutableListOf<Any?>()
|
|
1603
|
+
if ((T_LIST and srctype) != 0 && src is List<*>) {
|
|
1604
|
+
for (i in src.indices) tval.add(clone(child))
|
|
1605
|
+
} else if ((T_MAP and srctype) != 0 && src is Map<*, *>) {
|
|
1606
|
+
for ((kAny, _) in src) {
|
|
1607
|
+
val cloned = clone(child)
|
|
1608
|
+
val keyMap = linkedMapOf<String, Any?>("KEY" to kAny.toString())
|
|
1609
|
+
val annoMap = linkedMapOf<String, Any?>("`\$ANNO`" to keyMap)
|
|
1610
|
+
val mergeArgs = mutableListOf<Any?>(cloned, annoMap)
|
|
1611
|
+
tval.add(merge(mergeArgs, 1))
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
var rval: Any? = mutableListOf<Any?>()
|
|
1616
|
+
|
|
1617
|
+
if (size(tval) > 0) {
|
|
1618
|
+
val tcur: Any? =
|
|
1619
|
+
when (src) {
|
|
1620
|
+
is List<*> -> src.toMutableList()
|
|
1621
|
+
is Map<*, *> -> src.values.toMutableList()
|
|
1622
|
+
else -> UNDEF
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
val ckey = getelem(inj.path, -2)
|
|
1626
|
+
val ckeyStr = strkey(ckey)
|
|
1627
|
+
|
|
1628
|
+
val tpathRaw = slice(inj.path, -1, null)
|
|
1629
|
+
|
|
1630
|
+
@Suppress("UNCHECKED_CAST")
|
|
1631
|
+
val tpath: MutableList<String> = if (tpathRaw is List<*>) (tpathRaw as List<String>).toMutableList() else mutableListOf()
|
|
1632
|
+
|
|
1633
|
+
val dpath = mutableListOf(S_DTOP)
|
|
1634
|
+
if (srcpath.isNotEmpty()) for (part in srcpath.split(".")) dpath.add(part)
|
|
1635
|
+
dpath.add("\$:$ckeyStr")
|
|
1636
|
+
|
|
1637
|
+
val tcurMap = linkedMapOf<String, Any?>(ckeyStr to tcur)
|
|
1638
|
+
var tcurOut: Any? = tcurMap
|
|
1639
|
+
|
|
1640
|
+
if (size(tpath) > 1) {
|
|
1641
|
+
val pkey = getelem(inj.path, -3, S_DTOP)
|
|
1642
|
+
val pkeyStr = strkey(pkey)
|
|
1643
|
+
val wrap = linkedMapOf<String, Any?>(pkeyStr to tcurOut)
|
|
1644
|
+
tcurOut = wrap
|
|
1645
|
+
dpath.add("\$:$pkeyStr")
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
val singleKey = mutableListOf(ckeyStr)
|
|
1649
|
+
val tinj = inj.child(0, singleKey)
|
|
1650
|
+
tinj.path = tpath
|
|
1651
|
+
val slicedNodes = slice(inj.nodes, -1, null)
|
|
1652
|
+
@Suppress("UNCHECKED_CAST")
|
|
1653
|
+
tinj.nodes = if (slicedNodes is List<*>) (slicedNodes as List<Any?>).toMutableList() else mutableListOf()
|
|
1654
|
+
|
|
1655
|
+
tinj.parent = getelem(tinj.nodes, -1)
|
|
1656
|
+
setprop(tinj.parent, ckey, tval)
|
|
1657
|
+
|
|
1658
|
+
tinj.`val` = tval
|
|
1659
|
+
tinj.dpath = dpath
|
|
1660
|
+
tinj.dparent = tcurOut
|
|
1661
|
+
|
|
1662
|
+
inject(tval, store, tinj)
|
|
1663
|
+
rval = tinj.`val`
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
setprop(target, tkey, rval)
|
|
1667
|
+
if (rval is List<*> && rval.isNotEmpty()) rval[0] else UNDEF
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
/** $PACK: convert a list/map into a keyed map. */
|
|
1671
|
+
val transform_PACK: Injector =
|
|
1672
|
+
Injector { inj, _, _, store ->
|
|
1673
|
+
if (!checkPlacement(M_KEYPRE, "PACK", T_MAP, inj)) return@Injector UNDEF
|
|
1674
|
+
|
|
1675
|
+
val argsRaw = getprop(inj.parent, inj.key)
|
|
1676
|
+
val argList = mutableListOf<Any?>()
|
|
1677
|
+
if (argsRaw is List<*>) argList.addAll(argsRaw)
|
|
1678
|
+
val checked = injectorArgs(intArrayOf(T_STRING, T_ANY), argList)
|
|
1679
|
+
if (checked[0] !== UNDEF) {
|
|
1680
|
+
inj.errs.add("\$PACK: ${checked[0]}")
|
|
1681
|
+
return@Injector UNDEF
|
|
1682
|
+
}
|
|
1683
|
+
val srcpath = checked[1] as String
|
|
1684
|
+
val origchildspec = checked[2]
|
|
1685
|
+
|
|
1686
|
+
val tkey = getelem(inj.path, -2)
|
|
1687
|
+
val pathsize = size(inj.path)
|
|
1688
|
+
var target = getelem(inj.nodes, pathsize - 2)
|
|
1689
|
+
if (target === UNDEF) target = getelem(inj.nodes, pathsize - 1)
|
|
1690
|
+
|
|
1691
|
+
val srcstore = getprop(store, inj.base, store)
|
|
1692
|
+
val src = getpath(srcstore, srcpath, inj)
|
|
1693
|
+
|
|
1694
|
+
var srcList: MutableList<Any?>? = null
|
|
1695
|
+
if (src is List<*>) {
|
|
1696
|
+
srcList = src.toMutableList()
|
|
1697
|
+
} else if (src is Map<*, *>) {
|
|
1698
|
+
srcList = mutableListOf()
|
|
1699
|
+
for ((kAny, node) in src) {
|
|
1700
|
+
if (isnode(node)) {
|
|
1701
|
+
val annoMap = linkedMapOf<String, Any?>("KEY" to kAny.toString())
|
|
1702
|
+
setprop(node, "`\$ANNO`", annoMap)
|
|
1703
|
+
srcList.add(node)
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
if (srcList == null) return@Injector UNDEF
|
|
1708
|
+
|
|
1709
|
+
var keypath: Any? = UNDEF
|
|
1710
|
+
var child: Any? = origchildspec
|
|
1711
|
+
if (origchildspec is Map<*, *>) {
|
|
1712
|
+
keypath = getprop(origchildspec, "`\$KEY`", UNDEF)
|
|
1713
|
+
delprop(origchildspec, "`\$KEY`")
|
|
1714
|
+
child = getprop(origchildspec, "`\$VAL`", origchildspec)
|
|
1715
|
+
}
|
|
1716
|
+
val keypathFinal = keypath
|
|
1717
|
+
val childFinal = child
|
|
1718
|
+
|
|
1719
|
+
val tval = linkedMapOf<String, Any?>()
|
|
1720
|
+
for (i in srcList.indices) {
|
|
1721
|
+
val item = srcList[i]
|
|
1722
|
+
val outKey: String =
|
|
1723
|
+
when {
|
|
1724
|
+
keypathFinal === UNDEF -> {
|
|
1725
|
+
if (item is Map<*, *> && item.containsKey(S_DKEY)) {
|
|
1726
|
+
item[S_DKEY]?.toString() ?: ""
|
|
1727
|
+
} else {
|
|
1728
|
+
i.toString()
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
keypathFinal is String && keypathFinal.startsWith("`") -> {
|
|
1732
|
+
val mergeList =
|
|
1733
|
+
mutableListOf<Any?>(linkedMapOf<String, Any?>(), store, linkedMapOf<String, Any?>(S_DTOP to item))
|
|
1734
|
+
val merged = merge(mergeList, 1)
|
|
1735
|
+
inject(keypathFinal, merged)?.toString() ?: ""
|
|
1736
|
+
}
|
|
1737
|
+
else -> getpath(item, keypathFinal, inj)?.toString() ?: ""
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
val tchild = clone(childFinal)
|
|
1741
|
+
setprop(tval, outKey, tchild)
|
|
1742
|
+
|
|
1743
|
+
val anno = getprop(item, "`\$ANNO`", UNDEF)
|
|
1744
|
+
if (anno === UNDEF) {
|
|
1745
|
+
delprop(tchild, "`\$ANNO`")
|
|
1746
|
+
} else {
|
|
1747
|
+
setprop(tchild, "`\$ANNO`", anno)
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
var rval: Map<String, Any?> = linkedMapOf()
|
|
1752
|
+
|
|
1753
|
+
if (!isempty(tval)) {
|
|
1754
|
+
val tsrc = linkedMapOf<String, Any?>()
|
|
1755
|
+
for (i in srcList.indices) {
|
|
1756
|
+
val item = srcList[i]
|
|
1757
|
+
val kn: String =
|
|
1758
|
+
when {
|
|
1759
|
+
keypathFinal === UNDEF -> i.toString()
|
|
1760
|
+
keypathFinal is String && keypathFinal.startsWith("`") -> {
|
|
1761
|
+
val mergeList =
|
|
1762
|
+
mutableListOf<Any?>(linkedMapOf<String, Any?>(), store, linkedMapOf<String, Any?>(S_DTOP to item))
|
|
1763
|
+
val merged = merge(mergeList, 1)
|
|
1764
|
+
inject(keypathFinal, merged)?.toString() ?: ""
|
|
1765
|
+
}
|
|
1766
|
+
else -> getpath(item, keypathFinal, inj)?.toString() ?: ""
|
|
1767
|
+
}
|
|
1768
|
+
setprop(tsrc, kn, item)
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
val tpathRaw = slice(inj.path, -1, null)
|
|
1772
|
+
|
|
1773
|
+
@Suppress("UNCHECKED_CAST")
|
|
1774
|
+
val tpath: MutableList<String> = if (tpathRaw is List<*>) (tpathRaw as List<String>).toMutableList() else mutableListOf()
|
|
1775
|
+
|
|
1776
|
+
val ckey = getelem(inj.path, -2)
|
|
1777
|
+
val ckeyStr = strkey(ckey)
|
|
1778
|
+
|
|
1779
|
+
val dpath = mutableListOf(S_DTOP)
|
|
1780
|
+
if (srcpath.isNotEmpty()) for (part in srcpath.split(".")) dpath.add(part)
|
|
1781
|
+
dpath.add("\$:$ckeyStr")
|
|
1782
|
+
|
|
1783
|
+
var tcurOut: Any? = linkedMapOf<String, Any?>(ckeyStr to tsrc)
|
|
1784
|
+
if (size(tpath) > 1) {
|
|
1785
|
+
val pkey = getelem(inj.path, -3, S_DTOP)
|
|
1786
|
+
val pkeyStr = strkey(pkey)
|
|
1787
|
+
tcurOut = linkedMapOf<String, Any?>(pkeyStr to tcurOut)
|
|
1788
|
+
dpath.add("\$:$pkeyStr")
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
val singleKey = mutableListOf(ckeyStr)
|
|
1792
|
+
val tinj = inj.child(0, singleKey)
|
|
1793
|
+
tinj.path = tpath
|
|
1794
|
+
val slicedNodes = slice(inj.nodes, -1, null)
|
|
1795
|
+
@Suppress("UNCHECKED_CAST")
|
|
1796
|
+
tinj.nodes = if (slicedNodes is List<*>) (slicedNodes as List<Any?>).toMutableList() else mutableListOf()
|
|
1797
|
+
|
|
1798
|
+
tinj.parent = getelem(tinj.nodes, -1)
|
|
1799
|
+
tinj.`val` = tval
|
|
1800
|
+
tinj.dpath = dpath
|
|
1801
|
+
tinj.dparent = tcurOut
|
|
1802
|
+
|
|
1803
|
+
inject(tval, store, tinj)
|
|
1804
|
+
val tv = tinj.`val`
|
|
1805
|
+
if (tv is Map<*, *>) {
|
|
1806
|
+
val out = linkedMapOf<String, Any?>()
|
|
1807
|
+
for ((k, vv) in tv) out[k.toString()] = vv
|
|
1808
|
+
rval = out
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
setprop(target, tkey, rval)
|
|
1813
|
+
UNDEF
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
/** $REF: resolve a named reference within the original spec, enabling recursive transformations. */
|
|
1817
|
+
val transform_REF: Injector =
|
|
1818
|
+
Injector { inj, value, _, store ->
|
|
1819
|
+
if (inj.mode != M_VAL) return@Injector UNDEF
|
|
1820
|
+
|
|
1821
|
+
val refpath = lookup(inj.parent, 1)
|
|
1822
|
+
inj.keyI = size(inj.keys)
|
|
1823
|
+
|
|
1824
|
+
val specHolder = getprop(store, S_DSPEC)
|
|
1825
|
+
val spec: Any? =
|
|
1826
|
+
when (specHolder) {
|
|
1827
|
+
is java.util.function.Supplier<*> -> specHolder.get()
|
|
1828
|
+
is Function0<*> -> specHolder.invoke()
|
|
1829
|
+
else -> specHolder
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
val dpathRaw = slice(inj.path, 1, null)
|
|
1833
|
+
|
|
1834
|
+
@Suppress("UNCHECKED_CAST")
|
|
1835
|
+
val dpath: MutableList<String> = if (dpathRaw is List<*>) (dpathRaw as List<String>).toMutableList() else mutableListOf()
|
|
1836
|
+
val refInj = Injection(null, null)
|
|
1837
|
+
refInj.dpath = dpath
|
|
1838
|
+
refInj.dparent = getpath(spec, dpath)
|
|
1839
|
+
refInj.handler = _injecthandler
|
|
1840
|
+
val refResolved = getpath(spec, refpath, refInj)
|
|
1841
|
+
|
|
1842
|
+
val tref = clone(refResolved)
|
|
1843
|
+
|
|
1844
|
+
val hasSubRef = booleanArrayOf(false)
|
|
1845
|
+
if (isnode(tref)) {
|
|
1846
|
+
walk(
|
|
1847
|
+
tref,
|
|
1848
|
+
WalkApply { _, v, _, _ ->
|
|
1849
|
+
if ("`\$REF`" == v) hasSubRef[0] = true
|
|
1850
|
+
v
|
|
1851
|
+
},
|
|
1852
|
+
)
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
val cpathRaw = slice(inj.path, -3, null)
|
|
1856
|
+
|
|
1857
|
+
@Suppress("UNCHECKED_CAST")
|
|
1858
|
+
val cpath: MutableList<String> = if (cpathRaw is List<*>) (cpathRaw as List<String>).toMutableList() else mutableListOf()
|
|
1859
|
+
val tpathRaw = slice(inj.path, -1, null)
|
|
1860
|
+
|
|
1861
|
+
@Suppress("UNCHECKED_CAST")
|
|
1862
|
+
val tpath: MutableList<String> = if (tpathRaw is List<*>) (tpathRaw as List<String>).toMutableList() else mutableListOf()
|
|
1863
|
+
val tval = getpath(store, tpath)
|
|
1864
|
+
var rval: Any? = UNDEF
|
|
1865
|
+
|
|
1866
|
+
if (!hasSubRef[0] || tval !== UNDEF) {
|
|
1867
|
+
val lastKey = getelem(tpath, -1)
|
|
1868
|
+
val singleKey = mutableListOf(strkey(lastKey))
|
|
1869
|
+
val tinj = inj.child(0, singleKey)
|
|
1870
|
+
tinj.path = tpath
|
|
1871
|
+
val slicedNodes = slice(inj.nodes, -1, null)
|
|
1872
|
+
@Suppress("UNCHECKED_CAST")
|
|
1873
|
+
tinj.nodes = if (slicedNodes is List<*>) (slicedNodes as List<Any?>).toMutableList() else mutableListOf()
|
|
1874
|
+
tinj.parent = getelem(inj.nodes, -2)
|
|
1875
|
+
tinj.`val` = tref
|
|
1876
|
+
tinj.dpath = cpath.toMutableList()
|
|
1877
|
+
tinj.dparent = getpath(store, cpath)
|
|
1878
|
+
|
|
1879
|
+
inject(tref, store, tinj)
|
|
1880
|
+
rval = tinj.`val`
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
val grandparent = inj.setval(rval, 2)
|
|
1884
|
+
if (islist(grandparent) && inj.prior != null) {
|
|
1885
|
+
inj.prior!!.keyI--
|
|
1886
|
+
}
|
|
1887
|
+
value
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
fun transform(
|
|
1891
|
+
data: Any?,
|
|
1892
|
+
spec: Any?,
|
|
1893
|
+
): Any? = transform(data, spec, null)
|
|
1894
|
+
|
|
1895
|
+
/**
|
|
1896
|
+
* Canonical TS-faithful transform: clone the spec, build a store with
|
|
1897
|
+
* transform_* injectors registered, then call inject(workspec, store, injdef).
|
|
1898
|
+
* Mirrors Java transform (Struct.java:2269) and TS transform (StructUtility.ts:1902).
|
|
1899
|
+
*/
|
|
1900
|
+
fun transform(
|
|
1901
|
+
data: Any?,
|
|
1902
|
+
spec: Any?,
|
|
1903
|
+
options: Map<String, Any?>?,
|
|
1904
|
+
): Any? {
|
|
1905
|
+
val origspec = spec
|
|
1906
|
+
val workspec = clone(origspec)
|
|
1907
|
+
|
|
1908
|
+
val extraRaw = options?.get("extra")
|
|
1909
|
+
val modifyRaw = options?.get("modify")
|
|
1910
|
+
val handlerRaw = options?.get("handler")
|
|
1911
|
+
val metaRaw = options?.get("meta")
|
|
1912
|
+
val errsRaw = options?.get("errs")
|
|
1913
|
+
|
|
1914
|
+
val collect = errsRaw is MutableList<*>
|
|
1915
|
+
|
|
1916
|
+
@Suppress("UNCHECKED_CAST")
|
|
1917
|
+
val errs: MutableList<Any?> = if (collect) errsRaw as MutableList<Any?> else mutableListOf()
|
|
1918
|
+
|
|
1919
|
+
val extraTransforms = linkedMapOf<String, Any?>()
|
|
1920
|
+
val extraData = linkedMapOf<String, Any?>()
|
|
1921
|
+
if (extraRaw is Map<*, *>) {
|
|
1922
|
+
for ((kAny, v) in extraRaw) {
|
|
1923
|
+
val k = kAny.toString()
|
|
1924
|
+
if (k.startsWith("$")) extraTransforms[k] = v else extraData[k] = v
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
val dataMergeList = mutableListOf<Any?>()
|
|
1929
|
+
if (!isempty(extraData)) dataMergeList.add(clone(extraData))
|
|
1930
|
+
dataMergeList.add(clone(data))
|
|
1931
|
+
val dataClone = merge(dataMergeList)
|
|
1932
|
+
|
|
1933
|
+
val baseStore = linkedMapOf<String, Any?>()
|
|
1934
|
+
baseStore[S_DTOP] = dataClone
|
|
1935
|
+
baseStore[S_DSPEC] = java.util.function.Supplier<Any?> { origspec }
|
|
1936
|
+
baseStore["\$BT"] = java.util.function.Supplier<Any?> { "`" }
|
|
1937
|
+
baseStore["\$DS"] = java.util.function.Supplier<Any?> { "$" }
|
|
1938
|
+
baseStore["\$WHEN"] = java.util.function.Supplier<Any?> { java.time.Instant.now().toString() }
|
|
1939
|
+
baseStore["\$DELETE"] = transform_DELETE
|
|
1940
|
+
baseStore["\$COPY"] = transform_COPY
|
|
1941
|
+
baseStore["\$KEY"] = transform_KEY
|
|
1942
|
+
baseStore["\$ANNO"] = transform_ANNO
|
|
1943
|
+
baseStore["\$MERGE"] = transform_MERGE
|
|
1944
|
+
baseStore["\$EACH"] = transform_EACH
|
|
1945
|
+
baseStore["\$PACK"] = transform_PACK
|
|
1946
|
+
baseStore["\$REF"] = transform_REF
|
|
1947
|
+
baseStore["\$FORMAT"] = transform_FORMAT
|
|
1948
|
+
baseStore["\$APPLY"] = transform_APPLY
|
|
1949
|
+
|
|
1950
|
+
val storeMergeList = mutableListOf<Any?>()
|
|
1951
|
+
storeMergeList.add(baseStore)
|
|
1952
|
+
if (extraTransforms.isNotEmpty()) storeMergeList.add(extraTransforms)
|
|
1953
|
+
val errsHolder = linkedMapOf<String, Any?>("\$ERRS" to errs)
|
|
1954
|
+
storeMergeList.add(errsHolder)
|
|
1955
|
+
val store = merge(storeMergeList, 1)
|
|
1956
|
+
|
|
1957
|
+
val injdef = Injection(workspec, null)
|
|
1958
|
+
injdef.prior = null
|
|
1959
|
+
if (modifyRaw is Modify) injdef.modify = modifyRaw
|
|
1960
|
+
if (handlerRaw is Injector) injdef.handler = handlerRaw
|
|
1961
|
+
if (metaRaw is Map<*, *>) {
|
|
1962
|
+
@Suppress("UNCHECKED_CAST")
|
|
1963
|
+
injdef.meta = (metaRaw as Map<String, Any?>).toMutableMap()
|
|
1964
|
+
}
|
|
1965
|
+
injdef.errs = errs
|
|
1966
|
+
|
|
1967
|
+
val out = inject(workspec, store, injdef)
|
|
1968
|
+
if (errs.isNotEmpty() && !collect) {
|
|
1969
|
+
throw IllegalArgumentException(errs.joinToString(" | ") { it?.toString() ?: "" })
|
|
1970
|
+
}
|
|
1971
|
+
return if (out === SKIP || out === UNDEF) null else out
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
private fun pathifyForHandler(path: Any?): String {
|
|
1975
|
+
return when (path) {
|
|
1976
|
+
null -> pathify(UNDEF)
|
|
1977
|
+
is String, is List<*>, is Number -> pathify(path)
|
|
1978
|
+
else -> pathify(path)
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
private fun pathParts(path: Any?): MutableList<String>? {
|
|
1983
|
+
return when (path) {
|
|
1984
|
+
is String -> if (path.isEmpty()) mutableListOf("") else path.split(".").toMutableList()
|
|
1985
|
+
is List<*> ->
|
|
1986
|
+
path.map {
|
|
1987
|
+
when (it) {
|
|
1988
|
+
is String -> it
|
|
1989
|
+
is Number -> strkey(it)
|
|
1990
|
+
else -> strkey(it)
|
|
1991
|
+
}
|
|
1992
|
+
}.toMutableList()
|
|
1993
|
+
else -> null
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
private fun getpathInner(
|
|
1998
|
+
store: Any?,
|
|
1999
|
+
pathOrig: Any?,
|
|
2000
|
+
parts: MutableList<String>?,
|
|
2001
|
+
inj: MutableMap<String, Any?>?,
|
|
2002
|
+
): Any? {
|
|
2003
|
+
if (parts == null) return null
|
|
2004
|
+
val base = inj?.get("base")
|
|
2005
|
+
val src = getprop(store, base, store)
|
|
2006
|
+
val dparent = inj?.get("dparent")
|
|
2007
|
+
val dpath =
|
|
2008
|
+
when (val dp = inj?.get("dpath")) {
|
|
2009
|
+
is List<*> -> dp.map { it.toString() }.toMutableList()
|
|
2010
|
+
is String -> dp.split(".").toMutableList()
|
|
2011
|
+
else -> null
|
|
2012
|
+
}
|
|
2013
|
+
val numparts = parts.size
|
|
2014
|
+
var value: Any? = store
|
|
2015
|
+
if (pathOrig == null || store == null || (numparts == 1 && parts[0].isEmpty())) {
|
|
2016
|
+
value = src
|
|
2017
|
+
} else if (numparts > 0) {
|
|
2018
|
+
if (numparts == 1) value = getprop(store, parts[0])
|
|
2019
|
+
if (!isfunc(value)) {
|
|
2020
|
+
value = src
|
|
2021
|
+
val m0 = R_META_PATH.matcher(parts[0])
|
|
2022
|
+
if (m0.matches() && inj?.get("meta") is Map<*, *>) {
|
|
2023
|
+
value = getprop(inj["meta"], m0.group(1))
|
|
2024
|
+
parts[0] = m0.group(3)
|
|
2025
|
+
}
|
|
2026
|
+
var pI = 0
|
|
2027
|
+
while (value != null && pI < numparts) {
|
|
2028
|
+
var part = parts[pI]
|
|
2029
|
+
if (inj != null && part == S_DKEY) {
|
|
2030
|
+
part = inj["key"]?.toString() ?: ""
|
|
2031
|
+
} else if (inj != null && part.startsWith("\$GET:")) {
|
|
2032
|
+
part = stringify(getpath(src, part.substring(5, part.length - 1)))
|
|
2033
|
+
} else if (inj != null && part.startsWith("\$REF:")) {
|
|
2034
|
+
val specVal = getprop(store, S_DSPEC)
|
|
2035
|
+
if (specVal != null) part = stringify(getpath(specVal, part.substring(5, part.length - 1)))
|
|
2036
|
+
} else if (inj != null && part.startsWith("\$META:")) {
|
|
2037
|
+
part = stringify(getpath(inj["meta"], part.substring(6, part.length - 1)))
|
|
2038
|
+
}
|
|
2039
|
+
part = part.replace("\$\$", "$")
|
|
2040
|
+
if (part.isEmpty()) {
|
|
2041
|
+
var ascends = 0
|
|
2042
|
+
while (pI + 1 < numparts && parts[pI + 1].isEmpty()) {
|
|
2043
|
+
ascends++
|
|
2044
|
+
pI++
|
|
2045
|
+
}
|
|
2046
|
+
if (inj != null && ascends > 0) {
|
|
2047
|
+
if (pI == numparts - 1) ascends--
|
|
2048
|
+
if (ascends == 0) {
|
|
2049
|
+
value = dparent
|
|
2050
|
+
} else if (dpath != null) {
|
|
2051
|
+
val cutLen = (dpath.size - ascends).coerceAtLeast(0)
|
|
2052
|
+
val fullpath = mutableListOf<String>()
|
|
2053
|
+
for (i in 0 until cutLen) fullpath.add(dpath[i])
|
|
2054
|
+
if (pI + 1 < numparts) for (j in pI + 1 until numparts) fullpath.add(parts[j])
|
|
2055
|
+
value = if (ascends <= size(dpath)) getpath(store, fullpath) else null
|
|
2056
|
+
break
|
|
2057
|
+
}
|
|
2058
|
+
} else {
|
|
2059
|
+
value = dparent
|
|
2060
|
+
}
|
|
2061
|
+
} else {
|
|
2062
|
+
value = getprop(value, part)
|
|
2063
|
+
}
|
|
2064
|
+
pI++
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
return value
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
private fun parseIntKey(key: Any?): Int? {
|
|
2072
|
+
return when (key) {
|
|
2073
|
+
is Number -> floor(key.toDouble()).toInt()
|
|
2074
|
+
is String -> key.toIntOrNull()
|
|
2075
|
+
else -> null
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
private fun unescapeInjectRef(ref: String?): String? {
|
|
2080
|
+
if (ref != null && ref.length > 3) {
|
|
2081
|
+
return ref.replace("\$BT", "`").replace("\$DS", "$")
|
|
2082
|
+
}
|
|
2083
|
+
return ref
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
private fun injectPartialText(found: Any?): String {
|
|
2087
|
+
if (found === UNDEF) return ""
|
|
2088
|
+
if (found == null) return "null"
|
|
2089
|
+
if (found is String) return found
|
|
2090
|
+
if (found is Map<*, *> || found is List<*>) {
|
|
2091
|
+
val sb = StringBuilder()
|
|
2092
|
+
_jsonifyInner(found, sb, 0, 0, IdentityHashMap())
|
|
2093
|
+
return sb.toString()
|
|
2094
|
+
}
|
|
2095
|
+
return stringify(found)
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
private fun resolveAlt(alt: Any?): Any? {
|
|
2099
|
+
return when (alt) {
|
|
2100
|
+
is java.util.function.Function<*, *> -> (alt as java.util.function.Function<Any?, Any?>).apply(null)
|
|
2101
|
+
is Function1<*, *> -> (alt as (Any?) -> Any?).invoke(null)
|
|
2102
|
+
else -> alt
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
// ===========================================================================
|
|
2107
|
+
// Validate Injectors
|
|
2108
|
+
// ===========================================================================
|
|
2109
|
+
|
|
2110
|
+
/** Build a type-mismatch error message. Mirrors Java _invalidTypeMsg (Struct.java:1439). */
|
|
2111
|
+
private fun _invalidTypeMsg(
|
|
2112
|
+
path: Any?,
|
|
2113
|
+
needtype: String,
|
|
2114
|
+
vt: Int,
|
|
2115
|
+
v: Any?,
|
|
2116
|
+
@Suppress("UNUSED_PARAMETER") whence: String,
|
|
2117
|
+
): String {
|
|
2118
|
+
val vs = if (v == null || v === UNDEF) "no value" else stringify(v)
|
|
2119
|
+
val sb = StringBuilder("Expected ")
|
|
2120
|
+
if (path is List<*> && path.size > 1) sb.append("field ").append(pathify(path, 1)).append(" to be ")
|
|
2121
|
+
sb.append(needtype).append(", but found ")
|
|
2122
|
+
if (v != null && v !== UNDEF) sb.append(typename(vt)).append(": ")
|
|
2123
|
+
sb.append(vs).append(".")
|
|
2124
|
+
return sb.toString()
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
/** $STRING: require a non-empty string. */
|
|
2128
|
+
val validate_STRING: Injector =
|
|
2129
|
+
Injector { inj, _, _, _ ->
|
|
2130
|
+
val out = lookup(inj.dparent, inj.key)
|
|
2131
|
+
val t = typify(out)
|
|
2132
|
+
when {
|
|
2133
|
+
(T_STRING and t) == 0 -> {
|
|
2134
|
+
inj.errs.add(_invalidTypeMsg(inj.path, "string", t, out, "V1010"))
|
|
2135
|
+
UNDEF
|
|
2136
|
+
}
|
|
2137
|
+
"" == out -> {
|
|
2138
|
+
inj.errs.add("Empty string at " + pathify(inj.path, 1))
|
|
2139
|
+
UNDEF
|
|
2140
|
+
}
|
|
2141
|
+
else -> out
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
/** Generic $TYPE handler. */
|
|
2146
|
+
val validate_TYPE: Injector =
|
|
2147
|
+
Injector { inj, _, ref, _ ->
|
|
2148
|
+
val tname = if (ref == null || ref.length < 2) "" else ref.substring(1).lowercase(Locale.ROOT)
|
|
2149
|
+
var idx = -1
|
|
2150
|
+
for (i in TYPE_NAMES.indices) {
|
|
2151
|
+
if (tname == TYPE_NAMES[i]) {
|
|
2152
|
+
idx = i
|
|
2153
|
+
break
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
if (idx < 0) {
|
|
2157
|
+
UNDEF
|
|
2158
|
+
} else {
|
|
2159
|
+
val typev = 1 shl (31 - idx)
|
|
2160
|
+
val out = lookup(inj.dparent, inj.key)
|
|
2161
|
+
val t = typify(out)
|
|
2162
|
+
if ((t and typev) == 0) {
|
|
2163
|
+
inj.errs.add(_invalidTypeMsg(inj.path, tname, t, out, "V1001"))
|
|
2164
|
+
UNDEF
|
|
2165
|
+
} else {
|
|
2166
|
+
out
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
/** $ANY: accept any value. */
|
|
2172
|
+
val validate_ANY: Injector = Injector { inj, _, _, _ -> lookup(inj.dparent, inj.key) }
|
|
2173
|
+
|
|
2174
|
+
/** $CHILD: validate every direct child of the current node against a template. */
|
|
2175
|
+
val validate_CHILD: Injector =
|
|
2176
|
+
Injector { inj, _, _, _ ->
|
|
2177
|
+
when (inj.mode) {
|
|
2178
|
+
M_KEYPRE -> {
|
|
2179
|
+
val childtm = getprop(inj.parent, inj.key)
|
|
2180
|
+
val pkey = getelem(inj.path, -2)
|
|
2181
|
+
var tval: Any? = getprop(inj.dparent, pkey)
|
|
2182
|
+
if (tval === UNDEF || tval == null) {
|
|
2183
|
+
tval = linkedMapOf<String, Any?>()
|
|
2184
|
+
} else if (!ismap(tval)) {
|
|
2185
|
+
val sp = slice(inj.path, -1, null)
|
|
2186
|
+
inj.errs.add(_invalidTypeMsg(sp, "object", typify(tval), tval, "V0220"))
|
|
2187
|
+
return@Injector UNDEF
|
|
2188
|
+
}
|
|
2189
|
+
val ckeys = keysof(tval)
|
|
2190
|
+
for (ck in ckeys) {
|
|
2191
|
+
setprop(inj.parent, ck, clone(childtm))
|
|
2192
|
+
inj.keys.add(ck)
|
|
2193
|
+
}
|
|
2194
|
+
inj.setval(UNDEF)
|
|
2195
|
+
UNDEF
|
|
2196
|
+
}
|
|
2197
|
+
M_VAL -> {
|
|
2198
|
+
if (!islist(inj.parent)) {
|
|
2199
|
+
inj.errs.add("Invalid \$CHILD as value")
|
|
2200
|
+
return@Injector UNDEF
|
|
2201
|
+
}
|
|
2202
|
+
val childtm = lookup(inj.parent, 1)
|
|
2203
|
+
if (inj.dparent === UNDEF || inj.dparent == null) {
|
|
2204
|
+
@Suppress("UNCHECKED_CAST")
|
|
2205
|
+
(inj.parent as MutableList<Any?>).clear()
|
|
2206
|
+
return@Injector UNDEF
|
|
2207
|
+
}
|
|
2208
|
+
if (!islist(inj.dparent)) {
|
|
2209
|
+
val sp = slice(inj.path, -1, null)
|
|
2210
|
+
inj.errs.add(_invalidTypeMsg(sp, "list", typify(inj.dparent), inj.dparent, "V0230"))
|
|
2211
|
+
inj.keyI = size(inj.parent)
|
|
2212
|
+
return@Injector inj.dparent
|
|
2213
|
+
}
|
|
2214
|
+
@Suppress("UNCHECKED_CAST")
|
|
2215
|
+
val dpl = inj.dparent as List<Any?>
|
|
2216
|
+
|
|
2217
|
+
@Suppress("UNCHECKED_CAST")
|
|
2218
|
+
val pl = inj.parent as MutableList<Any?>
|
|
2219
|
+
for (i in dpl.indices) setprop(pl, i, clone(childtm))
|
|
2220
|
+
while (pl.size > dpl.size) pl.removeAt(pl.size - 1)
|
|
2221
|
+
inj.keyI = 0
|
|
2222
|
+
getprop(inj.dparent, 0)
|
|
2223
|
+
}
|
|
2224
|
+
else -> UNDEF
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
/** $ONE: validate against any one of a list of alternative shapes. */
|
|
2229
|
+
val validate_ONE: Injector =
|
|
2230
|
+
Injector { inj, _, _, store ->
|
|
2231
|
+
if (inj.mode != M_VAL) return@Injector UNDEF
|
|
2232
|
+
if (!islist(inj.parent) || inj.keyI != 0) {
|
|
2233
|
+
inj.errs.add("The \$ONE validator at field " + pathify(inj.path, 1, 1) + " must be the first element of an array.")
|
|
2234
|
+
return@Injector UNDEF
|
|
2235
|
+
}
|
|
2236
|
+
inj.keyI = size(inj.keys)
|
|
2237
|
+
inj.setval(inj.dparent, 2)
|
|
2238
|
+
val sp = slice(inj.path, -1, null)
|
|
2239
|
+
@Suppress("UNCHECKED_CAST")
|
|
2240
|
+
inj.path = if (sp is List<*>) (sp as List<String>).toMutableList() else mutableListOf()
|
|
2241
|
+
inj.key = strkey(getelem(inj.path, -1))
|
|
2242
|
+
|
|
2243
|
+
val tvalsRaw = slice(inj.parent, 1, null)
|
|
2244
|
+
|
|
2245
|
+
@Suppress("UNCHECKED_CAST")
|
|
2246
|
+
val tvals: List<Any?> = if (tvalsRaw is List<*>) tvalsRaw as List<Any?> else listOf()
|
|
2247
|
+
if (tvals.isEmpty()) {
|
|
2248
|
+
inj.errs.add("The \$ONE validator at field " + pathify(inj.path, 1, 1) + " must have at least one argument.")
|
|
2249
|
+
return@Injector UNDEF
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
for (tval in tvals) {
|
|
2253
|
+
val terrs = mutableListOf<Any?>()
|
|
2254
|
+
val vstore = linkedMapOf<String, Any?>()
|
|
2255
|
+
if (store is Map<*, *>) for ((k, v) in store) vstore[k.toString()] = v
|
|
2256
|
+
vstore[S_DTOP] = inj.dparent
|
|
2257
|
+
val opts =
|
|
2258
|
+
linkedMapOf<String, Any?>(
|
|
2259
|
+
"extra" to vstore,
|
|
2260
|
+
"errs" to terrs,
|
|
2261
|
+
"meta" to inj.meta,
|
|
2262
|
+
)
|
|
2263
|
+
val vcurrent: Any? =
|
|
2264
|
+
try {
|
|
2265
|
+
validate(inj.dparent, tval, opts)
|
|
2266
|
+
} catch (e: Exception) {
|
|
2267
|
+
terrs.add(e.message)
|
|
2268
|
+
inj.dparent
|
|
2269
|
+
}
|
|
2270
|
+
inj.setval(vcurrent, -2)
|
|
2271
|
+
if (terrs.isEmpty()) return@Injector UNDEF
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2274
|
+
val valdesc = StringBuilder()
|
|
2275
|
+
for (i in tvals.indices) {
|
|
2276
|
+
if (i > 0) valdesc.append(", ")
|
|
2277
|
+
val tv = tvals[i]
|
|
2278
|
+
if (tv is String) {
|
|
2279
|
+
val mm = R_TRANSFORM_NAME.matcher(tv)
|
|
2280
|
+
if (mm.matches()) {
|
|
2281
|
+
valdesc.append(mm.group(1).substring(1).lowercase(Locale.ROOT))
|
|
2282
|
+
continue
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
valdesc.append(stringify(tv))
|
|
2286
|
+
}
|
|
2287
|
+
inj.errs.add(
|
|
2288
|
+
_invalidTypeMsg(inj.path, (if (size(tvals) > 1) "one of " else "") + valdesc, typify(inj.dparent), inj.dparent, "V0210"),
|
|
2289
|
+
)
|
|
2290
|
+
UNDEF
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
/** $EXACT: validate against any one of a list of literal alternatives. */
|
|
2294
|
+
val validate_EXACT: Injector =
|
|
2295
|
+
Injector { inj, _, _, _ ->
|
|
2296
|
+
if (inj.mode == M_VAL) {
|
|
2297
|
+
if (!islist(inj.parent) || inj.keyI != 0) {
|
|
2298
|
+
inj.errs.add("The \$EXACT validator at field " + pathify(inj.path, 1, 1) + " must be the first element of an array.")
|
|
2299
|
+
return@Injector UNDEF
|
|
2300
|
+
}
|
|
2301
|
+
inj.keyI = size(inj.keys)
|
|
2302
|
+
inj.setval(inj.dparent, 2)
|
|
2303
|
+
val sp = slice(inj.path, 0, -1)
|
|
2304
|
+
@Suppress("UNCHECKED_CAST")
|
|
2305
|
+
inj.path = if (sp is List<*>) (sp as List<String>).toMutableList() else mutableListOf()
|
|
2306
|
+
inj.key = strkey(getelem(inj.path, -1))
|
|
2307
|
+
|
|
2308
|
+
val tvalsRaw = slice(inj.parent, 1, null)
|
|
2309
|
+
|
|
2310
|
+
@Suppress("UNCHECKED_CAST")
|
|
2311
|
+
val tvals: List<Any?> = if (tvalsRaw is List<*>) tvalsRaw as List<Any?> else listOf()
|
|
2312
|
+
if (tvals.isEmpty()) {
|
|
2313
|
+
inj.errs.add("The \$EXACT validator at field " + pathify(inj.path, 1, 1) + " must have at least one argument.")
|
|
2314
|
+
return@Injector UNDEF
|
|
2315
|
+
}
|
|
2316
|
+
|
|
2317
|
+
var currentstr: String? = null
|
|
2318
|
+
for (tval in tvals) {
|
|
2319
|
+
var exactmatch = tval == inj.dparent
|
|
2320
|
+
if (!exactmatch && isnode(tval)) {
|
|
2321
|
+
if (currentstr == null) currentstr = stringify(inj.dparent)
|
|
2322
|
+
val tvalstr = stringify(tval)
|
|
2323
|
+
exactmatch = tvalstr == currentstr
|
|
2324
|
+
}
|
|
2325
|
+
if (exactmatch) return@Injector UNDEF
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
val valdesc = StringBuilder()
|
|
2329
|
+
for (i in tvals.indices) {
|
|
2330
|
+
if (i > 0) valdesc.append(", ")
|
|
2331
|
+
val tv = tvals[i]
|
|
2332
|
+
if (tv is String) {
|
|
2333
|
+
val mm = R_TRANSFORM_NAME.matcher(tv)
|
|
2334
|
+
if (mm.matches()) {
|
|
2335
|
+
valdesc.append(mm.group(1).substring(1).lowercase(Locale.ROOT))
|
|
2336
|
+
continue
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
valdesc.append(stringify(tv))
|
|
2340
|
+
}
|
|
2341
|
+
inj.errs.add(
|
|
2342
|
+
_invalidTypeMsg(
|
|
2343
|
+
inj.path,
|
|
2344
|
+
(if (size(inj.path) > 1) "" else "value ") + "exactly equal to " + (if (size(tvals) == 1) "" else "one of ") + valdesc,
|
|
2345
|
+
typify(inj.dparent),
|
|
2346
|
+
inj.dparent,
|
|
2347
|
+
"V0110",
|
|
2348
|
+
),
|
|
2349
|
+
)
|
|
2350
|
+
UNDEF
|
|
2351
|
+
} else {
|
|
2352
|
+
delprop(inj.parent, inj.key)
|
|
2353
|
+
UNDEF
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2357
|
+
/** Modify hook used by validate(): runs after each inject step. */
|
|
2358
|
+
val _validation: Modify =
|
|
2359
|
+
Modify { pval, key, parent, inj, _ ->
|
|
2360
|
+
if (inj == null) return@Modify
|
|
2361
|
+
if (pval === SKIP) return@Modify
|
|
2362
|
+
val exact = (getprop(inj.meta, "`\$EXACT`", false) == true)
|
|
2363
|
+
val cval = getprop(inj.dparent, key)
|
|
2364
|
+
if (!exact && (cval === UNDEF || cval == null)) return@Modify
|
|
2365
|
+
|
|
2366
|
+
val ptype = typify(pval)
|
|
2367
|
+
if ((T_STRING and ptype) != 0 && pval is String && pval.contains("$")) return@Modify
|
|
2368
|
+
|
|
2369
|
+
val ctype = typify(cval)
|
|
2370
|
+
if (ptype != ctype && pval !== UNDEF) {
|
|
2371
|
+
inj.errs.add(_invalidTypeMsg(inj.path, typename(ptype), ctype, cval, "V0010"))
|
|
2372
|
+
return@Modify
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
if (ismap(cval)) {
|
|
2376
|
+
if (!ismap(pval)) {
|
|
2377
|
+
inj.errs.add(_invalidTypeMsg(inj.path, typename(ptype), ctype, cval, "V0020"))
|
|
2378
|
+
return@Modify
|
|
2379
|
+
}
|
|
2380
|
+
val ckeys = keysof(cval)
|
|
2381
|
+
val pkeys = keysof(pval)
|
|
2382
|
+
if (size(pkeys) > 0 && getprop(pval, "`\$OPEN`") != true) {
|
|
2383
|
+
val badkeys = mutableListOf<String>()
|
|
2384
|
+
// Group B: a key present with a JSON null value is NOT a bad
|
|
2385
|
+
// key, so test raw presence (TS _lookup(pval,ck) === UNDEF).
|
|
2386
|
+
for (ck in ckeys) if (lookup(pval, ck) === UNDEF) badkeys.add(ck)
|
|
2387
|
+
if (badkeys.isNotEmpty()) {
|
|
2388
|
+
inj.errs.add("Unexpected keys at field " + pathify(inj.path, 1) + ": " + badkeys.joinToString(", "))
|
|
2389
|
+
}
|
|
2390
|
+
} else {
|
|
2391
|
+
val mergeArgs = mutableListOf<Any?>(pval, cval)
|
|
2392
|
+
merge(mergeArgs)
|
|
2393
|
+
if (isnode(pval)) delprop(pval, "`\$OPEN`")
|
|
2394
|
+
}
|
|
2395
|
+
} else if (islist(cval)) {
|
|
2396
|
+
if (!islist(pval)) {
|
|
2397
|
+
inj.errs.add(_invalidTypeMsg(inj.path, typename(ptype), ctype, cval, "V0030"))
|
|
2398
|
+
}
|
|
2399
|
+
} else if (exact) {
|
|
2400
|
+
if (cval != pval) {
|
|
2401
|
+
val pathmsg = if (size(inj.path) > 1) "at field " + pathify(inj.path, 1) + ": " else ""
|
|
2402
|
+
inj.errs.add("Value " + pathmsg + jsString(cval) + " should equal " + jsString(pval) + ".")
|
|
2403
|
+
}
|
|
2404
|
+
} else {
|
|
2405
|
+
setprop(parent, key, cval)
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
/** Custom Injector used by validate(): handles meta-path syntax `<root>$=value` / `<root>$~spec`. */
|
|
2410
|
+
val _validatehandler: Injector =
|
|
2411
|
+
Injector { inj, value, ref, store ->
|
|
2412
|
+
if (ref != null) {
|
|
2413
|
+
val m = R_META_PATH.matcher(ref)
|
|
2414
|
+
if (m.matches()) {
|
|
2415
|
+
val op = m.group(2)
|
|
2416
|
+
if ("=" == op) {
|
|
2417
|
+
val wrap = mutableListOf<Any?>("`\$EXACT`", value)
|
|
2418
|
+
inj.setval(wrap)
|
|
2419
|
+
} else {
|
|
2420
|
+
inj.setval(value)
|
|
2421
|
+
}
|
|
2422
|
+
inj.keyI = -1
|
|
2423
|
+
return@Injector SKIP
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
_injecthandler.apply(inj, value, ref, store)
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
fun validate(
|
|
2430
|
+
data: Any?,
|
|
2431
|
+
spec: Any?,
|
|
2432
|
+
): Any? = validate(data, spec, null)
|
|
2433
|
+
|
|
2434
|
+
/**
|
|
2435
|
+
* Canonical TS-faithful validate. Build a store with validate_* injectors plus
|
|
2436
|
+
* nulled transform commands, then dispatch via transform() with _validation as
|
|
2437
|
+
* modify and _validatehandler as handler. Mirrors Java validate (Struct.java:2903)
|
|
2438
|
+
* and TS validate (StructUtility.ts:2347).
|
|
2439
|
+
*/
|
|
2440
|
+
fun validate(
|
|
2441
|
+
data: Any?,
|
|
2442
|
+
spec: Any?,
|
|
2443
|
+
options: Map<String, Any?>?,
|
|
2444
|
+
): Any? {
|
|
2445
|
+
val extraRaw = options?.get("extra")
|
|
2446
|
+
val errsRaw = options?.get("errs")
|
|
2447
|
+
val metaRaw = options?.get("meta")
|
|
2448
|
+
|
|
2449
|
+
val collect = errsRaw is MutableList<*>
|
|
2450
|
+
|
|
2451
|
+
@Suppress("UNCHECKED_CAST")
|
|
2452
|
+
val errs: MutableList<Any?> = if (collect) errsRaw as MutableList<Any?> else mutableListOf()
|
|
2453
|
+
|
|
2454
|
+
val baseStore = linkedMapOf<String, Any?>()
|
|
2455
|
+
baseStore["\$DELETE"] = null
|
|
2456
|
+
baseStore["\$COPY"] = null
|
|
2457
|
+
baseStore["\$KEY"] = null
|
|
2458
|
+
baseStore["\$META"] = null
|
|
2459
|
+
baseStore["\$MERGE"] = null
|
|
2460
|
+
baseStore["\$EACH"] = null
|
|
2461
|
+
baseStore["\$PACK"] = null
|
|
2462
|
+
|
|
2463
|
+
baseStore["\$STRING"] = validate_STRING
|
|
2464
|
+
baseStore["\$NUMBER"] = validate_TYPE
|
|
2465
|
+
baseStore["\$INTEGER"] = validate_TYPE
|
|
2466
|
+
baseStore["\$DECIMAL"] = validate_TYPE
|
|
2467
|
+
baseStore["\$BOOLEAN"] = validate_TYPE
|
|
2468
|
+
baseStore["\$NULL"] = validate_TYPE
|
|
2469
|
+
baseStore["\$NIL"] = validate_TYPE
|
|
2470
|
+
baseStore["\$MAP"] = validate_TYPE
|
|
2471
|
+
baseStore["\$LIST"] = validate_TYPE
|
|
2472
|
+
baseStore["\$FUNCTION"] = validate_TYPE
|
|
2473
|
+
baseStore["\$INSTANCE"] = validate_TYPE
|
|
2474
|
+
baseStore["\$ANY"] = validate_ANY
|
|
2475
|
+
baseStore["\$CHILD"] = validate_CHILD
|
|
2476
|
+
baseStore["\$ONE"] = validate_ONE
|
|
2477
|
+
baseStore["\$EXACT"] = validate_EXACT
|
|
2478
|
+
|
|
2479
|
+
val mergeList = mutableListOf<Any?>(baseStore)
|
|
2480
|
+
if (extraRaw is Map<*, *>) mergeList.add(extraRaw)
|
|
2481
|
+
val errsHolder = linkedMapOf<String, Any?>("\$ERRS" to errs)
|
|
2482
|
+
mergeList.add(errsHolder)
|
|
2483
|
+
val store = merge(mergeList, 1)
|
|
2484
|
+
|
|
2485
|
+
val meta = linkedMapOf<String, Any?>()
|
|
2486
|
+
if (metaRaw is Map<*, *>) for ((k, v) in metaRaw) meta[k.toString()] = v
|
|
2487
|
+
if (!meta.containsKey("`\$EXACT`")) meta["`\$EXACT`"] = false
|
|
2488
|
+
|
|
2489
|
+
val opts =
|
|
2490
|
+
linkedMapOf<String, Any?>(
|
|
2491
|
+
"meta" to meta,
|
|
2492
|
+
"extra" to store,
|
|
2493
|
+
"modify" to _validation,
|
|
2494
|
+
"handler" to _validatehandler,
|
|
2495
|
+
"errs" to errs,
|
|
2496
|
+
)
|
|
2497
|
+
val out = transform(data, spec, opts)
|
|
2498
|
+
if (errs.isNotEmpty() && !collect) {
|
|
2499
|
+
throw IllegalArgumentException(errs.joinToString(" | ") { it?.toString() ?: "" })
|
|
2500
|
+
}
|
|
2501
|
+
return out
|
|
2502
|
+
}
|
|
2503
|
+
|
|
2504
|
+
// ===========================================================================
|
|
2505
|
+
// Select Injectors
|
|
2506
|
+
// ===========================================================================
|
|
2507
|
+
|
|
2508
|
+
/** Build the recursive validate options used by select_*. */
|
|
2509
|
+
private fun selectRecOpts(
|
|
2510
|
+
store: Any?,
|
|
2511
|
+
point: Any?,
|
|
2512
|
+
meta: MutableMap<String, Any?>,
|
|
2513
|
+
errs: MutableList<Any?>,
|
|
2514
|
+
): MutableMap<String, Any?> {
|
|
2515
|
+
val vstore = linkedMapOf<String, Any?>()
|
|
2516
|
+
if (store is Map<*, *>) for ((k, v) in store) vstore[k.toString()] = v
|
|
2517
|
+
vstore[S_DTOP] = point
|
|
2518
|
+
return linkedMapOf("errs" to errs, "meta" to meta, "extra" to vstore)
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
/** $AND: require every sub-term to validate against the current point. */
|
|
2522
|
+
val select_AND: Injector =
|
|
2523
|
+
Injector { inj, _, _, store ->
|
|
2524
|
+
if (inj.mode != M_KEYPRE) return@Injector UNDEF
|
|
2525
|
+
val terms = lookup(inj.parent, inj.key)
|
|
2526
|
+
if (terms !is List<*>) return@Injector UNDEF
|
|
2527
|
+
val ppath = slice(inj.path, -1, null)
|
|
2528
|
+
val point = getpath(store, ppath)
|
|
2529
|
+
for (term in terms) {
|
|
2530
|
+
val terrs = mutableListOf<Any?>()
|
|
2531
|
+
val opts = selectRecOpts(store, point, inj.meta, terrs)
|
|
2532
|
+
try {
|
|
2533
|
+
validate(point, term, opts)
|
|
2534
|
+
} catch (e: Exception) {
|
|
2535
|
+
terrs.add(e.message)
|
|
2536
|
+
}
|
|
2537
|
+
if (terrs.isNotEmpty()) {
|
|
2538
|
+
inj.errs.add("AND:${pathify(ppath)}: ${stringify(point)} fail:${stringify(terms)}")
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
val gkey = getelem(inj.path, -2)
|
|
2542
|
+
val gp = getelem(inj.nodes, -2)
|
|
2543
|
+
setprop(gp, gkey, point)
|
|
2544
|
+
UNDEF
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
/** $OR: require at least one sub-term to validate. */
|
|
2548
|
+
val select_OR: Injector =
|
|
2549
|
+
Injector { inj, _, _, store ->
|
|
2550
|
+
if (inj.mode != M_KEYPRE) return@Injector UNDEF
|
|
2551
|
+
val terms = lookup(inj.parent, inj.key)
|
|
2552
|
+
if (terms !is List<*>) return@Injector UNDEF
|
|
2553
|
+
val ppath = slice(inj.path, -1, null)
|
|
2554
|
+
val point = getpath(store, ppath)
|
|
2555
|
+
for (term in terms) {
|
|
2556
|
+
val terrs = mutableListOf<Any?>()
|
|
2557
|
+
val opts = selectRecOpts(store, point, inj.meta, terrs)
|
|
2558
|
+
try {
|
|
2559
|
+
validate(point, term, opts)
|
|
2560
|
+
} catch (e: Exception) {
|
|
2561
|
+
terrs.add(e.message)
|
|
2562
|
+
}
|
|
2563
|
+
if (terrs.isEmpty()) {
|
|
2564
|
+
val gkey = getelem(inj.path, -2)
|
|
2565
|
+
val gp = getelem(inj.nodes, -2)
|
|
2566
|
+
setprop(gp, gkey, point)
|
|
2567
|
+
return@Injector UNDEF
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
inj.errs.add("OR:${pathify(ppath)}: ${stringify(point)} fail:${stringify(terms)}")
|
|
2571
|
+
UNDEF
|
|
2572
|
+
}
|
|
2573
|
+
|
|
2574
|
+
/** $NOT: require the sub-term to fail validation. */
|
|
2575
|
+
val select_NOT: Injector =
|
|
2576
|
+
Injector { inj, _, _, store ->
|
|
2577
|
+
if (inj.mode != M_KEYPRE) return@Injector UNDEF
|
|
2578
|
+
val term = lookup(inj.parent, inj.key)
|
|
2579
|
+
val ppath = slice(inj.path, -1, null)
|
|
2580
|
+
val point = getpath(store, ppath)
|
|
2581
|
+
val terrs = mutableListOf<Any?>()
|
|
2582
|
+
val opts = selectRecOpts(store, point, inj.meta, terrs)
|
|
2583
|
+
try {
|
|
2584
|
+
validate(point, term, opts)
|
|
2585
|
+
} catch (e: Exception) {
|
|
2586
|
+
terrs.add(e.message)
|
|
2587
|
+
}
|
|
2588
|
+
if (terrs.isEmpty()) {
|
|
2589
|
+
inj.errs.add("NOT:${pathify(ppath)}: ${stringify(point)} fail:${stringify(term)}")
|
|
2590
|
+
}
|
|
2591
|
+
val gkey = getelem(inj.path, -2)
|
|
2592
|
+
val gp = getelem(inj.nodes, -2)
|
|
2593
|
+
setprop(gp, gkey, point)
|
|
2594
|
+
UNDEF
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2597
|
+
/** $GT/$LT/$GTE/$LTE/$LIKE comparators dispatched by ref. */
|
|
2598
|
+
val select_CMP: Injector =
|
|
2599
|
+
Injector { inj, _, ref, store ->
|
|
2600
|
+
if (inj.mode != M_KEYPRE) return@Injector UNDEF
|
|
2601
|
+
val term = lookup(inj.parent, inj.key)
|
|
2602
|
+
val gkey = getelem(inj.path, -2)
|
|
2603
|
+
val ppath = slice(inj.path, -1, null)
|
|
2604
|
+
val point = getpath(store, ppath)
|
|
2605
|
+
var pass = false
|
|
2606
|
+
if (point is Number && term is Number) {
|
|
2607
|
+
val a = point.toDouble()
|
|
2608
|
+
val b = term.toDouble()
|
|
2609
|
+
pass =
|
|
2610
|
+
when (ref) {
|
|
2611
|
+
"\$GT" -> a > b
|
|
2612
|
+
"\$LT" -> a < b
|
|
2613
|
+
"\$GTE" -> a >= b
|
|
2614
|
+
"\$LTE" -> a <= b
|
|
2615
|
+
else -> false
|
|
2616
|
+
}
|
|
2617
|
+
} else if ("\$LIKE" == ref && term is String) {
|
|
2618
|
+
pass =
|
|
2619
|
+
try {
|
|
2620
|
+
Pattern.compile(term).matcher(stringify(point)).find()
|
|
2621
|
+
} catch (_: Exception) {
|
|
2622
|
+
false
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
if (pass) {
|
|
2626
|
+
val gp = getelem(inj.nodes, -2)
|
|
2627
|
+
setprop(gp, gkey, point)
|
|
2628
|
+
} else {
|
|
2629
|
+
inj.errs.add("CMP: ${pathify(ppath)}: ${stringify(point)} fail:$ref ${stringify(term)}")
|
|
2630
|
+
}
|
|
2631
|
+
UNDEF
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2634
|
+
/**
|
|
2635
|
+
* Canonical TS-faithful select. Tag each child node with $KEY, walk the
|
|
2636
|
+
* (cloned) query annotating every map with `$OPEN`, then run validate
|
|
2637
|
+
* against each child with the select_* injectors as extras and
|
|
2638
|
+
* meta.`$EXACT` = true. Mirrors Java select (Struct.java:2981).
|
|
2639
|
+
*/
|
|
2640
|
+
fun select(
|
|
2641
|
+
children: Any?,
|
|
2642
|
+
query: Any?,
|
|
2643
|
+
): MutableList<Any?> {
|
|
2644
|
+
if (!isnode(children)) return mutableListOf()
|
|
2645
|
+
|
|
2646
|
+
val childList = mutableListOf<Any?>()
|
|
2647
|
+
if (ismap(children)) {
|
|
2648
|
+
for ((kAny, node) in (children as Map<*, *>)) {
|
|
2649
|
+
if (isnode(node)) setprop(node, S_DKEY, kAny.toString())
|
|
2650
|
+
childList.add(node)
|
|
2651
|
+
}
|
|
2652
|
+
} else {
|
|
2653
|
+
val cl = children as List<*>
|
|
2654
|
+
for (i in cl.indices) {
|
|
2655
|
+
val node = cl[i]
|
|
2656
|
+
if (isnode(node)) setprop(node, S_DKEY, i.toLong())
|
|
2657
|
+
childList.add(node)
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
|
|
2661
|
+
val meta = linkedMapOf<String, Any?>("`\$EXACT`" to true)
|
|
2662
|
+
|
|
2663
|
+
val extra =
|
|
2664
|
+
linkedMapOf<String, Any?>(
|
|
2665
|
+
"\$AND" to select_AND,
|
|
2666
|
+
"\$OR" to select_OR,
|
|
2667
|
+
"\$NOT" to select_NOT,
|
|
2668
|
+
"\$GT" to select_CMP,
|
|
2669
|
+
"\$LT" to select_CMP,
|
|
2670
|
+
"\$GTE" to select_CMP,
|
|
2671
|
+
"\$LTE" to select_CMP,
|
|
2672
|
+
"\$LIKE" to select_CMP,
|
|
2673
|
+
)
|
|
2674
|
+
|
|
2675
|
+
val q = clone(query)
|
|
2676
|
+
walk(
|
|
2677
|
+
q,
|
|
2678
|
+
WalkApply { _, v, _, _ ->
|
|
2679
|
+
if (ismap(v)) setprop(v, "`\$OPEN`", getprop(v, "`\$OPEN`", true))
|
|
2680
|
+
v
|
|
2681
|
+
},
|
|
2682
|
+
)
|
|
2683
|
+
|
|
2684
|
+
val results = mutableListOf<Any?>()
|
|
2685
|
+
for (child in childList) {
|
|
2686
|
+
val errs = mutableListOf<Any?>()
|
|
2687
|
+
val opts = linkedMapOf<String, Any?>("errs" to errs, "meta" to meta, "extra" to extra)
|
|
2688
|
+
try {
|
|
2689
|
+
validate(child, clone(q), opts)
|
|
2690
|
+
} catch (e: Exception) {
|
|
2691
|
+
errs.add(e.message)
|
|
2692
|
+
}
|
|
2693
|
+
if (errs.isEmpty()) results.add(child)
|
|
2694
|
+
}
|
|
2695
|
+
return results
|
|
2696
|
+
}
|
|
2697
|
+
}
|