@voxgig/sdkgen 4.8.2 → 4.9.0
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/dist/action/doctor.d.ts +1 -0
- package/dist/action/doctor.js +50 -2
- package/dist/action/doctor.js.map +1 -1
- package/dist/helpers/naming.js +4 -2
- package/dist/helpers/naming.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/model/sdkgen.aon +21 -0
- package/package.json +1 -1
- package/project/.sdk/model/feature/secrets.aon +120 -18
- package/project/.sdk/model/target/c.aon +10 -0
- package/project/.sdk/model/target/clojure.aon +13 -0
- package/project/.sdk/model/target/cpp.aon +10 -0
- package/project/.sdk/model/target/csharp.aon +9 -0
- package/project/.sdk/model/target/dart.aon +10 -0
- package/project/.sdk/model/target/elixir.aon +9 -0
- package/project/.sdk/model/target/go.aon +13 -0
- package/project/.sdk/model/target/java.aon +9 -0
- package/project/.sdk/model/target/js.aon +7 -0
- package/project/.sdk/model/target/kotlin.aon +9 -0
- package/project/.sdk/model/target/lean.aon +17 -0
- package/project/.sdk/model/target/lua.aon +8 -0
- package/project/.sdk/model/target/ocaml.aon +9 -0
- package/project/.sdk/model/target/perl.aon +8 -0
- package/project/.sdk/model/target/php.aon +8 -0
- package/project/.sdk/model/target/py.aon +13 -0
- package/project/.sdk/model/target/rb.aon +8 -0
- package/project/.sdk/model/target/rust.aon +10 -0
- package/project/.sdk/model/target/scala.aon +21 -2
- package/project/.sdk/model/target/swift.aon +18 -0
- package/project/.sdk/model/target/ts.aon +13 -0
- package/project/.sdk/model/target/zig.aon +9 -0
- package/project/.sdk/src/cmp/clojure/Package_clojure.ts +9 -2
- package/project/.sdk/src/cmp/cpp/Gitignore_cpp.ts +3 -0
- package/project/.sdk/src/cmp/dart/Test_dart.ts +2 -0
- package/project/.sdk/src/cmp/elixir/Package_elixir.ts +4 -1
- package/project/.sdk/src/cmp/go/Config_go.ts +59 -2
- package/project/.sdk/src/cmp/go/Main_go.ts +8 -2
- package/project/.sdk/src/cmp/java/Test_java.ts +6 -5
- package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +6 -5
- package/project/.sdk/src/cmp/lean/Package_lean.ts +23 -0
- package/project/.sdk/src/cmp/lean/ReadmeInstall_lean.ts +1 -0
- package/project/.sdk/src/cmp/lean/ReadmeTopTest_lean.ts +1 -0
- package/project/.sdk/src/cmp/ocaml/Gitignore_ocaml.ts +1 -0
- package/project/.sdk/src/cmp/ocaml/Main_ocaml.ts +7 -3
- package/project/.sdk/src/cmp/py/Config_py.ts +82 -1
- package/project/.sdk/src/cmp/py/Main_py.ts +44 -0
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +2 -0
- package/project/.sdk/src/cmp/swift/Main_swift.ts +10 -0
- package/project/.sdk/src/cmp/swift/Package_swift.ts +13 -1
- package/project/.sdk/src/cmp/ts/Config_ts.ts +42 -17
- package/project/.sdk/src/cmp/ts/fragment/Config.data.fragment.ts +13 -1
- package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +13 -1
- package/project/.sdk/src/cmp/zig/Package_zig.ts +15 -11
- package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +3 -3
- package/project/.sdk/src/cmp/zig/fragment/EntityListOp.fragment.zig +3 -3
- package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +3 -3
- package/project/.sdk/src/cmp/zig/utility_zig.ts +50 -1
- package/project/.sdk/tm/c/Makefile +38 -3
- package/project/.sdk/tm/c/tests/omni_resolver.h +361 -0
- package/project/.sdk/tm/c/tests/omni_smoke_test.c +237 -0
- package/project/.sdk/tm/c/tests/primary_corpus_test.c +205 -284
- package/project/.sdk/tm/c/tests/struct_corpus_test.c +292 -212
- package/project/.sdk/tm/c/tests/vendor/omni/json.c +811 -0
- package/project/.sdk/tm/c/tests/vendor/omni/omni.h +240 -0
- package/project/.sdk/tm/c/tests/vendor/omni/runner.c +940 -0
- package/project/.sdk/tm/c/tests/vendor/omni/util.c +351 -0
- package/project/.sdk/tm/c/utility/struct/utility.c +7 -2
- package/project/.sdk/tm/clojure/test/sdk/test/omni.clj +401 -0
- package/project/.sdk/tm/clojure/test/sdk/test/omni_smoke.clj +81 -0
- package/project/.sdk/tm/clojure/test/sdk/test/primary.clj +92 -58
- package/project/.sdk/tm/clojure/test/sdk/test/struct_corpus.clj +122 -149
- package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +8 -3
- package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/json.clj +145 -0
- package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/runner.clj +445 -0
- package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/util.clj +145 -0
- package/project/.sdk/tm/cpp/Makefile +5 -1
- package/project/.sdk/tm/cpp/test/omni_resolver.hpp +473 -0
- package/project/.sdk/tm/cpp/test/omni_smoke_test.cpp +209 -0
- package/project/.sdk/tm/cpp/test/primary_utility_test.cpp +243 -184
- package/project/.sdk/tm/cpp/test/runner_support.hpp +68 -181
- package/project/.sdk/tm/cpp/test/struct_corpus_test.cpp +183 -56
- package/project/.sdk/tm/cpp/test/vendor/omni/json.hpp +406 -0
- package/project/.sdk/tm/cpp/test/vendor/omni/omni.hpp +751 -0
- package/project/.sdk/tm/cpp/test/vendor/omni/util.hpp +256 -0
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +7 -1
- package/project/.sdk/tm/csharp/test/OmniResolver.cs +491 -0
- package/project/.sdk/tm/csharp/test/OmniSmokeTest.cs +106 -0
- package/project/.sdk/tm/csharp/test/PrimaryUtilityTest.cs +299 -316
- package/project/.sdk/tm/csharp/test/Runner.cs +104 -269
- package/project/.sdk/tm/csharp/test/StructUtilityTest.cs +535 -724
- package/project/.sdk/tm/csharp/test/vendor/omni/Runner.cs +864 -0
- package/project/.sdk/tm/csharp/test/vendor/omni/Util.cs +347 -0
- package/project/.sdk/tm/csharp/utility/MakeSpec.cs +3 -1
- package/project/.sdk/tm/csharp/utility/PrepareMethod.cs +6 -1
- package/project/.sdk/tm/csharp/utility/struct/Struct.cs +21 -5
- package/project/.sdk/tm/dart/test/omni.dart +520 -0
- package/project/.sdk/tm/dart/test/omni_smoke_test.dart +143 -0
- package/project/.sdk/tm/dart/test/primary_test.dart +86 -28
- package/project/.sdk/tm/dart/test/struct_test.dart +438 -11
- package/project/.sdk/tm/dart/test/vendor/omni/omni.dart +7 -0
- package/project/.sdk/tm/dart/test/vendor/omni/runner.dart +653 -0
- package/project/.sdk/tm/dart/test/vendor/omni/util.dart +232 -0
- package/project/.sdk/tm/elixir/Makefile +11 -3
- package/project/.sdk/tm/elixir/test/omni_smoke_test.exs +117 -0
- package/project/.sdk/tm/elixir/test/primary_utility_test.exs +341 -16
- package/project/.sdk/tm/elixir/test/struct_corpus_test.exs +554 -9
- package/project/.sdk/tm/elixir/test/support/omni.ex +377 -0
- package/project/.sdk/tm/elixir/test/vendor/omni/json.ex +122 -0
- package/project/.sdk/tm/elixir/test/vendor/omni/runner.ex +623 -0
- package/project/.sdk/tm/elixir/test/vendor/omni/util.ex +187 -0
- package/project/.sdk/tm/go/core/context.go +32 -16
- package/project/.sdk/tm/go/feature/secrets/plugin/capability.go +261 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/catalog.go +78 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/config.go +652 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/depend.go +250 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/env.go +194 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/export.go +80 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/graph.go +238 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/host.go +1575 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/order.go +248 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/point.go +184 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/ref.go +123 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/resolve.go +79 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/types.go +296 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/util.go +87 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/version.go +161 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/aws/aws.go +292 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/aws/sigv4.go +201 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/azuresecrets/azuresecrets.go +187 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/boru/boru.go +184 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/doppler/doppler.go +114 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/gcpsecrets/gcpsecrets.go +156 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/hashicorp/hashicorp.go +208 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/httpjson/httpjson.go +241 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/infisical/infisical.go +150 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/onepassword/onepassword.go +152 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/secretspec/secretspec.go +143 -0
- package/project/.sdk/tm/go/feature/secrets/sekreto/addr.go +120 -0
- package/project/.sdk/tm/go/feature/secrets/sekreto/providers.go +442 -0
- package/project/.sdk/tm/go/feature/secrets/sekreto/sekreto.go +714 -0
- package/project/.sdk/tm/go/feature/secrets_feature.go +675 -0
- package/project/.sdk/tm/go/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/go/test/feature/secrets/secrets_feature_test.go +799 -0
- package/project/.sdk/tm/go/test/omni/omni.go +902 -0
- package/project/.sdk/tm/go/test/omni/util.go +381 -0
- package/project/.sdk/tm/go/test/omniresolver_test.go +748 -0
- package/project/.sdk/tm/go/test/omnismoke_test.go +112 -0
- package/project/.sdk/tm/go/test/primary_utility_test.go +123 -191
- package/project/.sdk/tm/go/test/struct_utility_test.go +323 -16
- package/project/.sdk/tm/go/test/testsupport_test.go +294 -0
- package/project/.sdk/tm/go/utility/make_options.go +8 -1
- package/project/.sdk/tm/go/utility/prepare_method.go +5 -1
- package/project/.sdk/tm/go/utility/struct/voxgigstruct.go +2 -2
- package/project/.sdk/tm/java/test/OmniResolver.java +355 -0
- package/project/.sdk/tm/java/test/OmniSmokeTest.java +99 -0
- package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +254 -280
- package/project/.sdk/tm/java/test/RunnerSupport.java +9 -194
- package/project/.sdk/tm/java/test/StructCorpusTest.java +119 -42
- package/project/.sdk/tm/java/test/vendor/omni/Json.java +287 -0
- package/project/.sdk/tm/java/test/vendor/omni/Runner.java +851 -0
- package/project/.sdk/tm/java/test/vendor/omni/Util.java +322 -0
- package/project/.sdk/tm/java/utility/MakeSpec.java +3 -1
- package/project/.sdk/tm/java/utility/PrepareMethod.java +5 -5
- package/project/.sdk/tm/java/utility/struct/Struct.java +17 -4
- package/project/.sdk/tm/js/src/utility/StructUtility.js +3 -3
- package/project/.sdk/tm/js/test/omni.js +251 -0
- package/project/.sdk/tm/js/test/omni.test.js +105 -0
- package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +6 -2
- package/project/.sdk/tm/js/test/utility/StructUtility.test.js +27 -2
- package/project/.sdk/tm/js/test/vendor/omni/index.js +77 -0
- package/project/.sdk/tm/js/test/vendor/omni/runner.js +628 -0
- package/project/.sdk/tm/js/test/vendor/omni/util.js +229 -0
- package/project/.sdk/tm/kotlin/core/Utility.kt +1 -1
- package/project/.sdk/tm/kotlin/test/OmniResolver.kt +343 -0
- package/project/.sdk/tm/kotlin/test/OmniSmokeTest.kt +100 -0
- package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +244 -262
- package/project/.sdk/tm/kotlin/test/RunnerSupport.kt +9 -178
- package/project/.sdk/tm/kotlin/test/StructCorpusTest.kt +121 -32
- package/project/.sdk/tm/kotlin/test/vendor/omni/Json.kt +264 -0
- package/project/.sdk/tm/kotlin/test/vendor/omni/Runner.kt +615 -0
- package/project/.sdk/tm/kotlin/test/vendor/omni/Util.kt +139 -0
- package/project/.sdk/tm/kotlin/utility/MakeSpecUrl.kt +6 -3
- package/project/.sdk/tm/kotlin/utility/Prepare.kt +6 -6
- package/project/.sdk/tm/kotlin/utility/struct/Struct.kt +18 -2
- package/project/.sdk/tm/lean/Makefile +12 -5
- package/project/.sdk/tm/lean/src/SdkUtility.lean +14 -1
- package/project/.sdk/tm/lean/test/OmniResolver.lean +358 -0
- package/project/.sdk/tm/lean/test/OmniSmoke.lean +174 -0
- package/project/.sdk/tm/lean/test/StructCorpus.lean +245 -574
- package/project/.sdk/tm/lean/test/TPrimaryUtility.lean +155 -291
- package/project/.sdk/tm/lean/test/vendor/omni/Omni.lean +997 -0
- package/project/.sdk/tm/lua/test/omni.lua +456 -0
- package/project/.sdk/tm/lua/test/omni_smoke_test.lua +103 -0
- package/project/.sdk/tm/lua/test/primary_utility_test.lua +250 -509
- package/project/.sdk/tm/lua/test/struct_utility_test.lua +161 -70
- package/project/.sdk/tm/lua/test/vendor/omni/json.lua +268 -0
- package/project/.sdk/tm/lua/test/vendor/omni/regex.lua +385 -0
- package/project/.sdk/tm/lua/test/vendor/omni/runner.lua +641 -0
- package/project/.sdk/tm/lua/test/vendor/omni/util.lua +282 -0
- package/project/.sdk/tm/lua/utility/prepare_method.lua +5 -1
- package/project/.sdk/tm/lua/utility/struct/regex.lua +663 -0
- package/project/.sdk/tm/lua/utility/struct/struct.lua +660 -420
- package/project/.sdk/tm/ocaml/Makefile +37 -12
- package/project/.sdk/tm/ocaml/test/omni_resolver.ml +284 -0
- package/project/.sdk/tm/ocaml/test/omni_smoke_test.ml +169 -0
- package/project/.sdk/tm/ocaml/test/primary_utility_test.ml +84 -100
- package/project/.sdk/tm/ocaml/test/struct_corpus.ml +225 -201
- package/project/.sdk/tm/ocaml/test/vendor/omni/omni.ml +1157 -0
- package/project/.sdk/tm/perl/lib/Voxgig/Struct.pm +88 -12
- package/project/.sdk/tm/perl/t/omni.pm +647 -0
- package/project/.sdk/tm/perl/t/omni_smoke.t +87 -0
- package/project/.sdk/tm/perl/t/primary_utility.t +189 -487
- package/project/.sdk/tm/perl/t/struct_utility.t +455 -389
- package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni/Runner.pm +649 -0
- package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni/Util.pm +253 -0
- package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni.pm +24 -0
- package/project/.sdk/tm/perl/utility/prepare_method.pm +7 -2
- package/project/.sdk/tm/php/test/Omni.php +691 -0
- package/project/.sdk/tm/php/test/OmniSmokeTest.php +93 -0
- package/project/.sdk/tm/php/test/PrimaryUtilityTest.php +210 -571
- package/project/.sdk/tm/php/test/StructUtilityTest.php +320 -342
- package/project/.sdk/tm/php/test/vendor/omni/Runner.php +644 -0
- package/project/.sdk/tm/php/test/vendor/omni/Util.php +283 -0
- package/project/.sdk/tm/php/utility/MakeSpec.php +10 -3
- package/project/.sdk/tm/php/utility/PrepareBody.php +7 -1
- package/project/.sdk/tm/php/utility/PrepareMethod.php +6 -2
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/__init__.py +36 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/capability.py +141 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/catalog.py +50 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/config.py +333 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/depend.py +198 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/env.py +147 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/export.py +52 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/graph.py +139 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/host.py +1053 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/order.py +171 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/point.py +95 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/ref.py +116 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/resolve.py +59 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/types.py +87 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/version.py +112 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/__init__.py +76 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/addr.py +116 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/aws.py +192 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/azuresecrets.py +120 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/boru.py +140 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/doppler.py +62 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/gcpsecrets.py +101 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/hashicorp.py +151 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/httpjson.py +115 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/infisical.py +90 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/onepassword.py +101 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/secretspec.py +119 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/sigv4.py +125 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/providers.py +211 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/sekreto.py +475 -0
- package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +467 -0
- package/project/.sdk/tm/py/pkg/utility/prepare_method.py +5 -1
- package/project/.sdk/tm/py/pkg/utility/voxgig_struct/__init__.py +0 -2
- package/project/.sdk/tm/py/pkg/utility/voxgig_struct/voxgig_struct.py +780 -529
- package/project/.sdk/tm/py/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/py/test/feature/__init__.py +0 -0
- package/project/.sdk/tm/py/test/feature/secrets/__init__.py +0 -0
- package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +337 -0
- package/project/.sdk/tm/py/test/omni.py +415 -0
- package/project/.sdk/tm/py/test/test_omni_smoke.py +74 -0
- package/project/.sdk/tm/py/test/test_primary_utility.py +144 -668
- package/project/.sdk/tm/py/test/test_struct_utility.py +74 -27
- package/project/.sdk/tm/py/test/voxgig_omni/__init__.py +62 -0
- package/project/.sdk/tm/py/test/voxgig_omni/runner.py +580 -0
- package/project/.sdk/tm/py/test/voxgig_omni/util.py +252 -0
- package/project/.sdk/tm/rb/test/omni.rb +505 -0
- package/project/.sdk/tm/rb/test/omni_smoke_test.rb +72 -0
- package/project/.sdk/tm/rb/test/primary_utility_test.rb +174 -560
- package/project/.sdk/tm/rb/test/struct_utility_test.rb +13 -7
- package/project/.sdk/tm/rb/test/vendor/omni/runner.rb +493 -0
- package/project/.sdk/tm/rb/test/vendor/omni/util.rb +199 -0
- package/project/.sdk/tm/rb/test/vendor/omni/voxgig_omni.rb +15 -0
- package/project/.sdk/tm/rb/utility/prepare_method.rb +5 -1
- package/project/.sdk/tm/rust/tests/common/mod.rs +19 -242
- package/project/.sdk/tm/rust/tests/omni_resolver/mod.rs +888 -0
- package/project/.sdk/tm/rust/tests/omni_smoke_test.rs +286 -0
- package/project/.sdk/tm/rust/tests/primary_utility_test.rs +318 -312
- package/project/.sdk/tm/rust/tests/struct_utility_test.rs +66 -28
- package/project/.sdk/tm/rust/tests/vendor/omni/json.rs +412 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/mod.rs +38 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/regex.rs +392 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/runner.rs +1001 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/util.rs +161 -0
- package/project/.sdk/tm/rust/utility/prepare_method.rs +5 -1
- package/project/.sdk/tm/scala/Makefile +16 -6
- package/project/.sdk/tm/scala/sdktest/OmniResolver.scala +497 -0
- package/project/.sdk/tm/scala/sdktest/OmniSmoke.scala +192 -0
- package/project/.sdk/tm/scala/sdktest/PrimaryCorpus.scala +47 -19
- package/project/.sdk/tm/scala/sdktest/StructCorpus.scala +0 -0
- package/project/.sdk/tm/scala/sdktest/vendor/omni/Json.scala +229 -0
- package/project/.sdk/tm/scala/sdktest/vendor/omni/Runner.scala +552 -0
- package/project/.sdk/tm/scala/sdktest/vendor/omni/Util.scala +104 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Constants.swift +10 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Inject.swift +28 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Injection.swift +5 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Minor.swift +4 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Validate.swift +15 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Prepare.swift +6 -1
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/OmniResolver.swift +474 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/OmniSmokeTest.swift +107 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PrimaryUtilityTest.swift +141 -178
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/Runner.swift +17 -113
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/StructUtilityTest.swift +295 -446
- package/project/.sdk/tm/swift/Tests/vendor/omni/Json.swift +364 -0
- package/project/.sdk/tm/swift/Tests/vendor/omni/Runner.swift +730 -0
- package/project/.sdk/tm/swift/Tests/vendor/omni/Util.swift +162 -0
- package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +7 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Capability.ts +148 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Catalog.ts +55 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Config.ts +344 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Depend.ts +205 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Env.ts +138 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Export.ts +46 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/FeatureHost.ts +349 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Graph.ts +181 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Host.ts +1132 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Order.ts +177 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Point.ts +119 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Ref.ts +102 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Resolve.ts +61 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Types.ts +112 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Version.ts +100 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/index.ts +37 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/Sekreto.ts +163 -30
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/index.ts +27 -22
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/aws.ts +26 -36
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/azuresecrets.ts +19 -21
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/boru.ts +36 -17
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/doppler.ts +14 -21
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/gcpsecrets.ts +27 -27
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/hashicorp.ts +25 -39
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/httpjson.ts +99 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/infisical.ts +14 -16
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/onepassword.ts +15 -22
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/secretspec.ts +98 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{Sigv4.ts → plugins/sigv4.ts} +7 -6
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/addr.ts +97 -23
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/builtin.ts +37 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/dotenv.ts +4 -17
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/env.ts +4 -16
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/file.ts +11 -25
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/memory.ts +6 -23
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/support.ts +106 -39
- package/project/.sdk/tm/ts/src/utility/StructUtility.ts +3 -3
- package/project/.sdk/tm/ts/test/omni.ts +104 -32
- package/project/.sdk/tm/ts/test/utility/StructUtility.test.ts +27 -0
- package/project/.sdk/tm/ts/test/vendor/omni/Runner.ts +32 -5
- package/project/.sdk/tm/ts/test/vendor/omni/Util.ts +2 -2
- package/project/.sdk/tm/ts/test/vendor/omni/index.ts +2 -2
- package/project/.sdk/tm/zig/Makefile +15 -1
- package/project/.sdk/tm/zig/build.zig +23 -5
- package/project/.sdk/tm/zig/core/helpers.zig +52 -11
- package/project/.sdk/tm/zig/core/mem.zig +17 -1
- package/project/.sdk/tm/zig/core/utility.zig +23 -19
- package/project/.sdk/tm/zig/feature/audit.zig +2 -2
- package/project/.sdk/tm/zig/feature/cache.zig +2 -2
- package/project/.sdk/tm/zig/feature/debug.zig +5 -5
- package/project/.sdk/tm/zig/feature/netsim.zig +2 -2
- package/project/.sdk/tm/zig/feature/paging.zig +2 -2
- package/project/.sdk/tm/zig/feature/proxy.zig +15 -8
- package/project/.sdk/tm/zig/feature/streaming.zig +5 -5
- package/project/.sdk/tm/zig/feature/support.zig +3 -3
- package/project/.sdk/tm/zig/feature/telemetry.zig +5 -5
- package/project/.sdk/tm/zig/feature/test.zig +10 -5
- package/project/.sdk/tm/zig/test/fh.zig +10 -10
- package/project/.sdk/tm/zig/test/gotcha_test.zig +5 -5
- package/project/.sdk/tm/zig/test/omniresolver.zig +515 -0
- package/project/.sdk/tm/zig/test/omnismoke_test.zig +284 -0
- package/project/.sdk/tm/zig/test/pipeline_test.zig +8 -8
- package/project/.sdk/tm/zig/test/primary_utility_test.zig +145 -155
- package/project/.sdk/tm/zig/test/struct_corpus.zig +264 -187
- package/project/.sdk/tm/zig/test/vendor/omni/omni.zig +1314 -0
- package/project/.sdk/tm/zig/test/vendor/omni/regex.zig +446 -0
- package/project/.sdk/tm/zig/utility/voxgigstruct/regex.zig +7 -4
- package/project/.sdk/tm/zig/utility/voxgigstruct/struct.zig +356 -157
- package/project/sdkgen-package.json +1 -1
- package/src/action/doctor.ts +66 -2
- package/src/helpers/naming.ts +4 -2
- package/project/.sdk/tm/c/tests/runner.h +0 -274
- package/project/.sdk/tm/cpp/test/struct_runner.hpp +0 -314
- package/project/.sdk/tm/csharp/test/StructRunner.cs +0 -276
- package/project/.sdk/tm/dart/test/runner.dart +0 -406
- package/project/.sdk/tm/dart/test/struct_corpus.dart +0 -531
- package/project/.sdk/tm/elixir/test/support/struct_corpus.ex +0 -1088
- package/project/.sdk/tm/go/test/runner_test.go +0 -629
- package/project/.sdk/tm/go/test/struct_runner_test.go +0 -1094
- package/project/.sdk/tm/java/test/StructRunner.java +0 -281
- package/project/.sdk/tm/js/test/runner.js +0 -387
- package/project/.sdk/tm/kotlin/test/StructRunner.kt +0 -177
- package/project/.sdk/tm/lua/test/struct_runner.lua +0 -602
- package/project/.sdk/tm/ocaml/test/corpus_runner.ml +0 -185
- package/project/.sdk/tm/perl/t/struct_runner.pm +0 -275
- package/project/.sdk/tm/php/test/StructRunner.php +0 -275
- package/project/.sdk/tm/py/test/struct_runner.py +0 -411
- package/project/.sdk/tm/rb/test/struct_runner.rb +0 -309
- package/project/.sdk/tm/rust/tests/struct_runner/mod.rs +0 -424
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/Registry.ts +0 -90
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/http.ts +0 -66
- package/project/.sdk/tm/ts/test/vendor/omni/compat.ts +0 -188
- package/project/.sdk/tm/zig/test/struct_runner.zig +0 -464
|
@@ -1,438 +1,504 @@
|
|
|
1
1
|
#!perl
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
2
|
+
# VERSION: @voxgig/struct 0.1.1 (vendored; driven via t/omni.pm)
|
|
3
|
+
#
|
|
4
|
+
# ProjectName SDK struct utility test
|
|
5
|
+
#
|
|
6
|
+
# Corpus sections run through the vendored omni runner, via the resolver
|
|
7
|
+
# in t/omni.pm (struct-runner shape over native Voxgig::Omni;
|
|
8
|
+
# t/struct_runner.pm is retired - see docs/design/vendor-tag-rollout.md).
|
|
9
|
+
# This file only says WHICH subject answers each group and with which
|
|
10
|
+
# flags - the entry loop, the comparison, the error and `match` handling
|
|
11
|
+
# all live in the runner, identically for every port. Flags mirror
|
|
12
|
+
# canonical (tm/ts/test/utility/StructUtility.test.ts).
|
|
6
13
|
|
|
7
14
|
use 5.018;
|
|
8
15
|
use strict;
|
|
9
16
|
use warnings;
|
|
10
17
|
use Test::More;
|
|
11
18
|
use FindBin;
|
|
19
|
+
use lib "$FindBin::Bin/../lib";
|
|
12
20
|
use Scalar::Util ();
|
|
13
|
-
|
|
14
21
|
use File::Basename ();
|
|
15
22
|
use Cwd ();
|
|
16
|
-
require(Cwd::abs_path("$FindBin::Bin/../lib/Voxgig/Struct.pm"));
|
|
17
|
-
require(Cwd::abs_path("$FindBin::Bin/struct_runner.pm"));
|
|
18
23
|
|
|
19
|
-
|
|
24
|
+
use ProjectNameSDK;
|
|
25
|
+
|
|
26
|
+
require(Cwd::abs_path("$FindBin::Bin/omni.pm"));
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
my $corpus_path = Cwd::abs_path("$FindBin::Bin/../../.sdk/test/test.json");
|
|
29
|
+
|
|
30
|
+
unless (defined $corpus_path && -e $corpus_path) {
|
|
31
|
+
plan skip_all => "Corpus file not found";
|
|
23
32
|
}
|
|
24
33
|
|
|
25
|
-
|
|
26
|
-
my $
|
|
27
|
-
my $
|
|
28
|
-
my $
|
|
29
|
-
|
|
34
|
+
# The struct corpus drives the LIVE SDK's struct utilities, as ts does.
|
|
35
|
+
my $client = ProjectNameSDK->test(undef, undef);
|
|
36
|
+
my $runner = ProjectNameOmni::make_runner($corpus_path, $client);
|
|
37
|
+
my $R = $runner->('struct');
|
|
38
|
+
|
|
39
|
+
my $struct_spec = $R->{spec};
|
|
40
|
+
my $runset = $R->{runset};
|
|
41
|
+
my $runsetflags = $R->{runsetflags};
|
|
30
42
|
|
|
31
43
|
# The struct facade exposed via the client utility carries the full API.
|
|
44
|
+
my $S = $client->get_utility->{struct};
|
|
45
|
+
|
|
32
46
|
for my $meth (qw(
|
|
33
47
|
clone delprop escre escurl filter flatten getdef getelem getpath getprop
|
|
34
48
|
haskey inject isempty isfunc iskey islist ismap isnode items join jsonify
|
|
35
49
|
keysof merge pad pathify select setpath setprop size slice strkey stringify
|
|
36
50
|
transform typify typename validate walk jm jt
|
|
37
51
|
)) {
|
|
38
|
-
|
|
52
|
+
ok(ref $S->{$meth} eq 'CODE', "utility struct facade has $meth");
|
|
39
53
|
}
|
|
40
54
|
|
|
55
|
+
my $jbool = \&Voxgig::Struct::jbool;
|
|
56
|
+
my $NULLMARK = ProjectNameOmni::NULLMARK();
|
|
57
|
+
|
|
58
|
+
# Canonical comparison string for the single-entry cases below (they are
|
|
59
|
+
# not sets, so they are compared here rather than by the runner): sorted
|
|
60
|
+
# map keys, so key order is not significant.
|
|
41
61
|
sub canon {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
# comparison ignores insertion order (matches node's deepStrictEqual).
|
|
45
|
-
return Voxgig::Struct::_stringify_inner($v, 1);
|
|
62
|
+
my ($v) = @_;
|
|
63
|
+
return Voxgig::Struct::_stringify_inner($v, 1);
|
|
46
64
|
}
|
|
47
65
|
|
|
48
|
-
#
|
|
49
|
-
#
|
|
50
|
-
sub
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
my $this = $idx;
|
|
66
|
-
$idx++;
|
|
67
|
-
if (!$err) {
|
|
68
|
-
$fail++;
|
|
69
|
-
diag("[$label#$this] expected error but none thrown (err=" . canon($err_field) . ")");
|
|
70
|
-
next;
|
|
71
|
-
}
|
|
72
|
-
my $msg = "$err";
|
|
73
|
-
my $ok;
|
|
74
|
-
if (Voxgig::Struct::is_jbool($err_field)) {
|
|
75
|
-
$ok = ${$err_field} ? 1 : 0; # err: true -> any error
|
|
76
|
-
}
|
|
77
|
-
elsif (!ref $err_field) {
|
|
78
|
-
if ($err_field =~ m{^/(.+)/$}s) {
|
|
79
|
-
my $re = $1;
|
|
80
|
-
$ok = ($msg =~ /$re/) ? 1 : 0;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
$ok = (index(lc $msg, lc $err_field) >= 0) ? 1 : 0;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
$ok = 1;
|
|
88
|
-
}
|
|
89
|
-
if ($ok) { $pass++ }
|
|
90
|
-
else {
|
|
91
|
-
$fail++;
|
|
92
|
-
diag("[$label#$this] err mismatch: expected=" . canon($err_field) . " got=[$msg]");
|
|
93
|
-
}
|
|
94
|
-
next;
|
|
95
|
-
}
|
|
96
|
-
if ($err) {
|
|
97
|
-
$fail++;
|
|
98
|
-
diag("[$label#$idx] unexpected error: $err");
|
|
99
|
-
$idx++;
|
|
100
|
-
next;
|
|
101
|
-
}
|
|
102
|
-
my $got_j = canon($got);
|
|
103
|
-
my $exp_j = canon($expected);
|
|
104
|
-
if ($got_j eq $exp_j) {
|
|
105
|
-
$pass++;
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
$fail++;
|
|
109
|
-
diag("[$label#$idx] expected=$exp_j got=$got_j");
|
|
110
|
-
}
|
|
111
|
-
$idx++;
|
|
112
|
-
}
|
|
113
|
-
ok($fail == 0, "$label: $pass/" . ($pass + $fail));
|
|
66
|
+
# Each group is one Test::More assertion, so a failure names the group and
|
|
67
|
+
# the entry (omni's message carries the index, the entry and both values).
|
|
68
|
+
sub group {
|
|
69
|
+
my ($label, $testspec, $flags, $subject) = @_;
|
|
70
|
+
unless (ref($testspec) eq 'HASH' && ref($testspec->{set}) eq 'ARRAY') {
|
|
71
|
+
fail("$label: corpus group missing");
|
|
72
|
+
return 0;
|
|
73
|
+
}
|
|
74
|
+
my $ok = eval { $runsetflags->($testspec, $flags, $subject); 1 };
|
|
75
|
+
if ($ok) {
|
|
76
|
+
pass($label);
|
|
77
|
+
return 1;
|
|
78
|
+
}
|
|
79
|
+
my $err = $@;
|
|
80
|
+
fail($label);
|
|
81
|
+
diag("$label: $err");
|
|
82
|
+
return 0;
|
|
114
83
|
}
|
|
115
84
|
|
|
116
|
-
#
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
sub { Voxgig::Struct::isnode($_[0]) ? Voxgig::Struct::JTRUE() : Voxgig::Struct::JFALSE() });
|
|
121
|
-
runset('minor.ismap', $minor->{ismap}{set},
|
|
122
|
-
sub { Voxgig::Struct::ismap($_[0]) ? Voxgig::Struct::JTRUE() : Voxgig::Struct::JFALSE() });
|
|
123
|
-
runset('minor.islist', $minor->{islist}{set},
|
|
124
|
-
sub { Voxgig::Struct::islist($_[0]) ? Voxgig::Struct::JTRUE() : Voxgig::Struct::JFALSE() });
|
|
125
|
-
runset('minor.iskey', $minor->{iskey}{set},
|
|
126
|
-
sub { Voxgig::Struct::iskey($_[0]) ? Voxgig::Struct::JTRUE() : Voxgig::Struct::JFALSE() });
|
|
127
|
-
runset('minor.isempty', $minor->{isempty}{set},
|
|
128
|
-
sub { Voxgig::Struct::isempty($_[0]) ? Voxgig::Struct::JTRUE() : Voxgig::Struct::JFALSE() });
|
|
129
|
-
runset('minor.size', $minor->{size}{set},
|
|
130
|
-
sub { Voxgig::Struct::size($_[0]) });
|
|
131
|
-
runset('minor.keysof', $minor->{keysof}{set},
|
|
132
|
-
sub { Voxgig::Struct::keysof($_[0]) });
|
|
133
|
-
runset('minor.haskey', $minor->{haskey}{set},
|
|
134
|
-
sub {
|
|
135
|
-
my $in = $_[0];
|
|
136
|
-
Voxgig::Struct::haskey($in->{src}, $in->{key}) ? Voxgig::Struct::JTRUE() : Voxgig::Struct::JFALSE();
|
|
137
|
-
});
|
|
138
|
-
runset('minor.getprop', $minor->{getprop}{set},
|
|
139
|
-
sub {
|
|
140
|
-
my $in = $_[0];
|
|
141
|
-
my $r = Voxgig::Struct::getprop($in->{val}, $in->{key}, $in->{alt});
|
|
142
|
-
Voxgig::Struct::is_none($r) ? undef : $r;
|
|
143
|
-
});
|
|
144
|
-
runset('minor.clone', $minor->{clone}{set},
|
|
145
|
-
sub { Voxgig::Struct::clone($_[0]) });
|
|
146
|
-
runset('minor.escre', $minor->{escre}{set},
|
|
147
|
-
sub { Voxgig::Struct::escre($_[0]) });
|
|
148
|
-
runset('minor.escurl', $minor->{escurl}{set},
|
|
149
|
-
sub { Voxgig::Struct::escurl($_[0]) });
|
|
150
|
-
runset('minor.stringify', $minor->{stringify}{set},
|
|
151
|
-
sub {
|
|
152
|
-
my $in = $_[0];
|
|
153
|
-
if (Voxgig::Struct::ismap($in)) {
|
|
154
|
-
return Voxgig::Struct::stringify($in->{val}, $in->{max});
|
|
155
|
-
}
|
|
156
|
-
return Voxgig::Struct::stringify($in);
|
|
157
|
-
});
|
|
158
|
-
runset('minor.slice', $minor->{slice}{set},
|
|
159
|
-
sub {
|
|
160
|
-
my $in = $_[0];
|
|
161
|
-
return Voxgig::Struct::slice($in->{val}, $in->{start}, $in->{end});
|
|
162
|
-
});
|
|
163
|
-
my %filter_checks = (
|
|
164
|
-
gt3 => sub { $_[0][1] > 3 },
|
|
165
|
-
lt3 => sub { $_[0][1] < 3 },
|
|
166
|
-
);
|
|
167
|
-
runset('minor.filter', $minor->{filter}{set},
|
|
168
|
-
sub {
|
|
169
|
-
my $in = $_[0];
|
|
170
|
-
return Voxgig::Struct::filter($in->{val}, $filter_checks{$in->{check}});
|
|
171
|
-
});
|
|
172
|
-
runset('minor.isfunc', $minor->{isfunc}{set},
|
|
173
|
-
sub { Voxgig::Struct::isfunc($_[0]) ? Voxgig::Struct::JTRUE() : Voxgig::Struct::JFALSE() });
|
|
174
|
-
runset('minor.getelem', $minor->{getelem}{set},
|
|
175
|
-
sub {
|
|
176
|
-
my $in = $_[0];
|
|
177
|
-
my $r = Voxgig::Struct::getelem($in->{val}, $in->{key}, $in->{alt});
|
|
178
|
-
Voxgig::Struct::is_none($r) ? undef : $r;
|
|
179
|
-
});
|
|
180
|
-
runset('minor.items', $minor->{items}{set},
|
|
181
|
-
sub { Voxgig::Struct::items($_[0]) });
|
|
182
|
-
runset('minor.flatten', $minor->{flatten}{set},
|
|
183
|
-
sub { my $in = $_[0]; Voxgig::Struct::flatten($in->{val}, $in->{depth}) });
|
|
184
|
-
runset('minor.typename', $minor->{typename}{set},
|
|
185
|
-
sub { Voxgig::Struct::typename($_[0]) });
|
|
186
|
-
runset('minor.typify', $minor->{typify}{set},
|
|
187
|
-
sub { Voxgig::Struct::typify($_[0]) });
|
|
188
|
-
runset('minor.join', $minor->{join}{set},
|
|
189
|
-
sub { my $in = $_[0]; Voxgig::Struct::join($in->{val}, $in->{sep}, $in->{url}) });
|
|
190
|
-
runset('minor.jsonify', $minor->{jsonify}{set},
|
|
191
|
-
sub { my $in = $_[0]; Voxgig::Struct::jsonify($in->{val}, $in->{flags}) });
|
|
192
|
-
runset('minor.pad', $minor->{pad}{set},
|
|
193
|
-
sub { my $in = $_[0]; Voxgig::Struct::pad($in->{val}, $in->{pad}, $in->{char}) });
|
|
194
|
-
runset('minor.setprop', $minor->{setprop}{set},
|
|
195
|
-
sub { my $in = $_[0]; Voxgig::Struct::setprop(Voxgig::Struct::clone($in->{parent}), $in->{key}, $in->{val}) });
|
|
196
|
-
runset('minor.delprop', $minor->{delprop}{set},
|
|
197
|
-
sub { my $in = $_[0]; Voxgig::Struct::delprop(Voxgig::Struct::clone($in->{parent}), $in->{key}) });
|
|
198
|
-
runset('minor.setpath', $minor->{setpath}{set},
|
|
199
|
-
sub {
|
|
200
|
-
my ($in, $entry) = @_;
|
|
201
|
-
my $store = $in->{store};
|
|
202
|
-
my $r = Voxgig::Struct::setpath($store, $in->{path}, $in->{val});
|
|
203
|
-
my $want_store = eval { $entry->{match}{args}{'0'}{store} };
|
|
204
|
-
if (defined $want_store) {
|
|
205
|
-
my $got = canon($store);
|
|
206
|
-
my $exp = canon($want_store);
|
|
207
|
-
if ($got ne $exp) {
|
|
208
|
-
diag("[minor.setpath store-mutation] expected=$exp got=$got");
|
|
209
|
-
die "minor.setpath store mutation mismatch\n";
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
Voxgig::Struct::is_none($r) ? undef : $r;
|
|
213
|
-
});
|
|
214
|
-
runset('minor.strkey', $minor->{strkey}{set},
|
|
215
|
-
sub { Voxgig::Struct::strkey($_[0]) });
|
|
216
|
-
runset('minor.pathify', $minor->{pathify}{set},
|
|
217
|
-
sub { my $in = $_[0]; Voxgig::Struct::pathify($in->{path}, $in->{from}) });
|
|
85
|
+
# One group, omni's default flags (`null` on).
|
|
86
|
+
sub grun {
|
|
87
|
+
my ($label, $testspec, $subject) = @_;
|
|
88
|
+
return group($label, $testspec, {}, $subject);
|
|
218
89
|
}
|
|
219
90
|
|
|
220
|
-
#
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
return $val if !defined $val || ref $val;
|
|
225
|
-
return $val if Voxgig::Struct::is_jbool($val) || Voxgig::Struct::is_jnull($val);
|
|
226
|
-
my $is_str = !Scalar::Util::looks_like_number($val) || "$val" =~ /[^0-9eE.+\-]/;
|
|
227
|
-
return $val unless $is_str;
|
|
228
|
-
return $val . '~' . CORE::join('.', @$path);
|
|
229
|
-
};
|
|
230
|
-
runset('walk.basic', $struct_spec->{walk}{basic}{set},
|
|
231
|
-
sub {
|
|
232
|
-
my $in = Voxgig::Struct::clone($_[0]);
|
|
233
|
-
return Voxgig::Struct::walk($in, $walkpath);
|
|
234
|
-
});
|
|
91
|
+
# One group with explicit flags.
|
|
92
|
+
sub grunflags {
|
|
93
|
+
my ($label, $testspec, $flags, $subject) = @_;
|
|
94
|
+
return group($label, $testspec, $flags, $subject);
|
|
235
95
|
}
|
|
236
96
|
|
|
237
|
-
# Merge.
|
|
238
|
-
if (Voxgig::Struct::ismap($struct_spec->{merge})) {
|
|
239
|
-
runset('merge.basic', $struct_spec->{merge}{basic}{set},
|
|
240
|
-
sub {
|
|
241
|
-
my $in = $_[0];
|
|
242
|
-
return Voxgig::Struct::merge($in);
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
97
|
|
|
246
|
-
#
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
98
|
+
# ===========================================================================
|
|
99
|
+
# minor
|
|
100
|
+
# ===========================================================================
|
|
101
|
+
|
|
102
|
+
my $minor = $struct_spec->{minor};
|
|
103
|
+
|
|
104
|
+
grun('minor.isnode', $minor->{isnode}, sub { $jbool->($S->{isnode}->($_[0])) });
|
|
105
|
+
grun('minor.ismap', $minor->{ismap}, sub { $jbool->($S->{ismap}->($_[0])) });
|
|
106
|
+
grun('minor.islist', $minor->{islist}, sub { $jbool->($S->{islist}->($_[0])) });
|
|
107
|
+
|
|
108
|
+
grunflags('minor.iskey', $minor->{iskey}, { null => 0 },
|
|
109
|
+
sub { $jbool->($S->{iskey}->($_[0])) });
|
|
110
|
+
|
|
111
|
+
grunflags('minor.strkey', $minor->{strkey}, { null => 0 },
|
|
112
|
+
sub { $S->{strkey}->($_[0]) });
|
|
113
|
+
|
|
114
|
+
grunflags('minor.isempty', $minor->{isempty}, { null => 0 },
|
|
115
|
+
sub { $jbool->($S->{isempty}->($_[0])) });
|
|
116
|
+
|
|
117
|
+
grun('minor.isfunc', $minor->{isfunc}, sub { $jbool->($S->{isfunc}->($_[0])) });
|
|
118
|
+
|
|
119
|
+
grunflags('minor.clone', $minor->{clone}, { null => 0 },
|
|
120
|
+
sub { $S->{clone}->($_[0]) });
|
|
121
|
+
|
|
122
|
+
# The corpus names the predicate; the test file supplies it.
|
|
123
|
+
my %checkmap = (
|
|
124
|
+
gt3 => sub { $_[0][1] > 3 },
|
|
125
|
+
lt3 => sub { $_[0][1] < 3 },
|
|
126
|
+
);
|
|
127
|
+
grun('minor.filter', $minor->{filter},
|
|
128
|
+
sub { $S->{filter}->($_[0]{val}, $checkmap{ $_[0]{check} }) });
|
|
129
|
+
|
|
130
|
+
grun('minor.flatten', $minor->{flatten},
|
|
131
|
+
sub { $S->{flatten}->($_[0]{val}, $_[0]{depth}) });
|
|
132
|
+
|
|
133
|
+
grun('minor.escre', $minor->{escre}, sub { $S->{escre}->($_[0]) });
|
|
134
|
+
grun('minor.escurl', $minor->{escurl}, sub { $S->{escurl}->($_[0]) });
|
|
135
|
+
|
|
136
|
+
# An entry with NO `val` is canonical stringify(undefined) == ''; a
|
|
137
|
+
# NULLMARK val (null flag on) is a real JSON null to stringify.
|
|
138
|
+
grun('minor.stringify', $minor->{stringify}, sub {
|
|
139
|
+
my ($in) = @_;
|
|
140
|
+
return '' if ref($in) ne 'HASH' || !exists $in->{val};
|
|
141
|
+
my $val = $in->{val};
|
|
142
|
+
my $isnul = defined $val && !ref $val && $val eq $NULLMARK;
|
|
143
|
+
return $S->{stringify}->($isnul ? 'null' : $val, $in->{max});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
grunflags('minor.jsonify', $minor->{jsonify}, { null => 0 },
|
|
147
|
+
sub { $S->{jsonify}->($_[0]{val}, $_[0]{flags}) });
|
|
148
|
+
|
|
149
|
+
# `null: true`, so an absent path arrives as NULLMARK and the rendered
|
|
150
|
+
# path has to be put back the way canonical renders a real undefined
|
|
151
|
+
# (ported from upstream struct's t/struct.t).
|
|
152
|
+
grunflags('minor.pathify', $minor->{pathify}, { null => 1 }, sub {
|
|
153
|
+
my ($in) = @_;
|
|
154
|
+
return '<unknown-path>' if ref($in) ne 'HASH' || !exists $in->{path};
|
|
155
|
+
my $raw = $in->{path};
|
|
156
|
+
my $isnul = defined $raw && !ref $raw && $raw eq $NULLMARK;
|
|
157
|
+
my $path = $isnul ? undef : $raw;
|
|
158
|
+
my $str = $S->{pathify}->($path, $in->{from});
|
|
159
|
+
$str =~ s/\Q$NULLMARK\E\.//;
|
|
160
|
+
$str =~ s/>/:null>/g if $isnul;
|
|
161
|
+
return $str;
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
grun('minor.items', $minor->{items}, sub { $S->{items}->($_[0]) });
|
|
165
|
+
|
|
166
|
+
# `alt` is omitted where the corpus omits it: passing an explicit undef is
|
|
167
|
+
# a different call, and getelem/getprop differ on whether a NULL alt
|
|
168
|
+
# counts.
|
|
169
|
+
grunflags('minor.getelem', $minor->{getelem}, { null => 0 }, sub {
|
|
170
|
+
my ($in) = @_;
|
|
171
|
+
my $alt = $in->{alt};
|
|
172
|
+
return (!defined $alt || Voxgig::Struct::is_jnull($alt))
|
|
173
|
+
? $S->{getelem}->($in->{val}, $in->{key})
|
|
174
|
+
: $S->{getelem}->($in->{val}, $in->{key}, $alt);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
grunflags('minor.getprop', $minor->{getprop}, { null => 0 }, sub {
|
|
178
|
+
my ($in) = @_;
|
|
179
|
+
return exists $in->{alt}
|
|
180
|
+
? $S->{getprop}->($in->{val}, $in->{key}, $in->{alt})
|
|
181
|
+
: $S->{getprop}->($in->{val}, $in->{key});
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
grun('minor.setprop', $minor->{setprop},
|
|
185
|
+
sub { $S->{setprop}->($_[0]{parent}, $_[0]{key}, $_[0]{val}) });
|
|
186
|
+
|
|
187
|
+
grun('minor.delprop', $minor->{delprop},
|
|
188
|
+
sub { $S->{delprop}->($_[0]{parent}, $_[0]{key}) });
|
|
189
|
+
|
|
190
|
+
grunflags('minor.haskey', $minor->{haskey}, { null => 0 },
|
|
191
|
+
sub { $jbool->($S->{haskey}->($_[0]{src}, $_[0]{key})) });
|
|
192
|
+
|
|
193
|
+
grun('minor.keysof', $minor->{keysof}, sub { $S->{keysof}->($_[0]) });
|
|
194
|
+
|
|
195
|
+
grunflags('minor.join', $minor->{join}, { null => 0 },
|
|
196
|
+
sub { $S->{join}->($_[0]{val}, $_[0]{sep}, $_[0]{url}) });
|
|
197
|
+
|
|
198
|
+
grun('minor.typename', $minor->{typename}, sub { $S->{typename}->($_[0]) });
|
|
199
|
+
|
|
200
|
+
grunflags('minor.typify', $minor->{typify}, { null => 0 },
|
|
201
|
+
sub { $S->{typify}->($_[0]) });
|
|
202
|
+
|
|
203
|
+
grunflags('minor.size', $minor->{size}, { null => 0 },
|
|
204
|
+
sub { $S->{size}->($_[0]) });
|
|
205
|
+
|
|
206
|
+
grunflags('minor.slice', $minor->{slice}, { null => 0 },
|
|
207
|
+
sub { $S->{slice}->($_[0]{val}, $_[0]{start}, $_[0]{end}) });
|
|
208
|
+
|
|
209
|
+
grunflags('minor.pad', $minor->{pad}, { null => 0 },
|
|
210
|
+
sub { $S->{pad}->($_[0]{val}, $_[0]{pad}, $_[0]{char}) });
|
|
211
|
+
|
|
212
|
+
# setpath rewrites `store` IN PLACE, and the entries assert that rewrite
|
|
213
|
+
# through `match.args` - the resolver's in-place model conversion is what
|
|
214
|
+
# lets the runner see it (t/omni.pm, decision 2).
|
|
215
|
+
grunflags('minor.setpath', $minor->{setpath}, { null => 0 },
|
|
216
|
+
sub { $S->{setpath}->($_[0]{store}, $_[0]{path}, $_[0]{val}) });
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
# ===========================================================================
|
|
220
|
+
# nullsem - does a PRESENT key holding a JSON null read as "no value"?
|
|
221
|
+
# Opt-in per target (create-sdkgen ships it; an older project corpus may
|
|
222
|
+
# predate it - the skip says so OUT LOUD rather than passing vacuously).
|
|
223
|
+
# All lanes {null: 0}, so the stored nulls are REAL (JNULL after the model
|
|
224
|
+
# conversion), not the NULLMARK string.
|
|
225
|
+
# ===========================================================================
|
|
226
|
+
|
|
227
|
+
SKIP: {
|
|
228
|
+
my $nullsem = (ref($struct_spec) eq 'HASH') ? $struct_spec->{nullsem} : undef;
|
|
229
|
+
skip 'corpus predates struct.nullsem - refresh .sdk/test/struct from create-sdkgen', 5
|
|
230
|
+
unless ref($nullsem) eq 'HASH';
|
|
231
|
+
|
|
232
|
+
grunflags('nullsem.getprop', $nullsem->{getprop}, { null => 0 }, sub {
|
|
233
|
+
my ($in) = @_;
|
|
234
|
+
return exists $in->{alt}
|
|
235
|
+
? $S->{getprop}->($in->{val}, $in->{key}, $in->{alt})
|
|
236
|
+
: $S->{getprop}->($in->{val}, $in->{key});
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
grunflags('nullsem.getelem', $nullsem->{getelem}, { null => 0 }, sub {
|
|
240
|
+
my ($in) = @_;
|
|
241
|
+
return exists $in->{alt}
|
|
242
|
+
? $S->{getelem}->($in->{val}, $in->{key}, $in->{alt})
|
|
243
|
+
: $S->{getelem}->($in->{val}, $in->{key});
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
grunflags('nullsem.getpath', $nullsem->{getpath}, { null => 0 },
|
|
247
|
+
sub { $S->{getpath}->($_[0]{store}, $_[0]{path}) });
|
|
248
|
+
|
|
249
|
+
grunflags('nullsem.haskey', $nullsem->{haskey}, { null => 0 },
|
|
250
|
+
sub { $jbool->($S->{haskey}->($_[0]{src}, $_[0]{key})) });
|
|
251
|
+
|
|
252
|
+
grunflags('nullsem.keysof', $nullsem->{keysof}, { null => 0 },
|
|
253
|
+
sub { $S->{keysof}->($_[0]) });
|
|
277
254
|
}
|
|
278
255
|
|
|
279
|
-
|
|
280
|
-
#
|
|
281
|
-
#
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
$
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
256
|
+
|
|
257
|
+
# ===========================================================================
|
|
258
|
+
# walk
|
|
259
|
+
# ===========================================================================
|
|
260
|
+
|
|
261
|
+
my $walk_spec = $struct_spec->{walk};
|
|
262
|
+
|
|
263
|
+
grun('walk.basic', $walk_spec->{basic}, sub {
|
|
264
|
+
my $walkpath = sub {
|
|
265
|
+
my ($_key, $val, $_parent, $path) = @_;
|
|
266
|
+
return $val if ref $val || !defined $val;
|
|
267
|
+
return $val if !Voxgig::Struct::_is_string_sv($val);
|
|
268
|
+
return $val . '~' . CORE::join('.', @$path);
|
|
269
|
+
};
|
|
270
|
+
return $S->{walk}->($_[0], $walkpath);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
grun('walk.copy', $walk_spec->{copy}, sub {
|
|
274
|
+
my ($in) = @_;
|
|
275
|
+
my $cur;
|
|
276
|
+
my $walkcopy = sub {
|
|
277
|
+
my ($key, $val, $_parent, $path) = @_;
|
|
278
|
+
if (!defined $key) {
|
|
279
|
+
$cur = [];
|
|
280
|
+
$cur->[0] =
|
|
281
|
+
Voxgig::Struct::ismap($val) ? Voxgig::Struct::jm()
|
|
282
|
+
: Voxgig::Struct::islist($val) ? []
|
|
283
|
+
: $val;
|
|
284
|
+
return $val;
|
|
296
285
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
my $
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
if (Voxgig::Struct::ismap($parent)) { $parent->{$key} = Voxgig::Struct::JNULL() }
|
|
304
|
-
elsif (Voxgig::Struct::islist($parent)) { $parent->[$key] = Voxgig::Struct::JNULL() }
|
|
286
|
+
|
|
287
|
+
my $v = $val;
|
|
288
|
+
my $i = Voxgig::Struct::size($path);
|
|
289
|
+
|
|
290
|
+
if (Voxgig::Struct::isnode($v)) {
|
|
291
|
+
$v = $cur->[$i] = Voxgig::Struct::ismap($v) ? Voxgig::Struct::jm() : [];
|
|
305
292
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
293
|
+
|
|
294
|
+
Voxgig::Struct::setprop($cur->[$i - 1], $key, $v);
|
|
295
|
+
|
|
296
|
+
return $val;
|
|
297
|
+
};
|
|
298
|
+
$S->{walk}->($in, $walkcopy);
|
|
299
|
+
return $cur->[0];
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
grunflags('walk.depth', $walk_spec->{depth}, { null => 0 }, sub {
|
|
303
|
+
my ($in) = @_;
|
|
304
|
+
my ($top, $cur);
|
|
305
|
+
my $copy = sub {
|
|
306
|
+
my ($key, $val, $_parent, $_path) = @_;
|
|
307
|
+
if (!defined $key || Voxgig::Struct::isnode($val)) {
|
|
308
|
+
my $child = Voxgig::Struct::islist($val) ? [] : Voxgig::Struct::jm();
|
|
309
|
+
if (!defined $key) { $top = $cur = $child }
|
|
310
|
+
else {
|
|
311
|
+
Voxgig::Struct::setprop($cur, $key, $child);
|
|
312
|
+
$cur = $child;
|
|
313
|
+
}
|
|
311
314
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
# Inject - inject.basic is a single entry, not a set.
|
|
315
|
-
if (Voxgig::Struct::ismap($struct_spec->{inject})) {
|
|
316
|
-
my $basic = $struct_spec->{inject}{basic};
|
|
317
|
-
if (Voxgig::Struct::ismap($basic) && exists $basic->{in}) {
|
|
318
|
-
my $got_b = Voxgig::Struct::inject(
|
|
319
|
-
Voxgig::Struct::clone($basic->{in}{val}),
|
|
320
|
-
$basic->{in}{store},
|
|
321
|
-
);
|
|
322
|
-
my $exp_b = $basic->{out};
|
|
323
|
-
is(canon($got_b), canon($exp_b), 'inject.basic');
|
|
315
|
+
else {
|
|
316
|
+
Voxgig::Struct::setprop($cur, $key, $val);
|
|
324
317
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
318
|
+
return $val;
|
|
319
|
+
};
|
|
320
|
+
$S->{walk}->($in->{src}, $copy, undef, $in->{maxdepth});
|
|
321
|
+
return $top;
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
# walk.log is a single entry, not a set: the callback log for the after,
|
|
325
|
+
# before and both walks, in canonical's own rendering.
|
|
326
|
+
{
|
|
327
|
+
my $td = ProjectNameOmni::tostruct(
|
|
328
|
+
Voxgig::Omni::Util::clone($walk_spec->{log}));
|
|
329
|
+
|
|
330
|
+
my $mklog = sub {
|
|
331
|
+
my ($log) = @_;
|
|
332
|
+
return sub {
|
|
333
|
+
my ($key, $val, $parent, $path) = @_;
|
|
334
|
+
push @$log, 'k=' . (defined $key ? Voxgig::Struct::stringify($key) : '')
|
|
335
|
+
. ', v=' . Voxgig::Struct::stringify($val)
|
|
336
|
+
. ', p=' . (defined $parent ? Voxgig::Struct::stringify($parent) : '')
|
|
337
|
+
. ', t=' . Voxgig::Struct::pathify($path);
|
|
338
|
+
return $val;
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
my %lanes = (
|
|
343
|
+
after => sub { my ($in, $log) = @_; $S->{walk}->($in, undef, $mklog->($log)) },
|
|
344
|
+
before => sub { my ($in, $log) = @_; $S->{walk}->($in, $mklog->($log)) },
|
|
345
|
+
both => sub { my ($in, $log) = @_; my $l = $mklog->($log); $S->{walk}->($in, $l, $l) },
|
|
346
|
+
);
|
|
347
|
+
|
|
348
|
+
for my $lane (sort keys %lanes) {
|
|
349
|
+
my $log = [];
|
|
350
|
+
$lanes{$lane}->(Voxgig::Struct::clone($td->{in}), $log);
|
|
351
|
+
is_deeply($log, $td->{out}{$lane}, "walk.log $lane");
|
|
352
|
+
}
|
|
340
353
|
}
|
|
341
354
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
runset("transform.$sec", $tx->{$sec}{set},
|
|
355
|
-
sub {
|
|
356
|
-
my $in = $_[0];
|
|
357
|
-
return Voxgig::Struct::transform(
|
|
358
|
-
Voxgig::Struct::clone($in->{data}),
|
|
359
|
-
Voxgig::Struct::clone($in->{spec}),
|
|
360
|
-
);
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
runset('transform.modify', $tx->{modify}{set},
|
|
364
|
-
sub {
|
|
365
|
-
my $in = $_[0];
|
|
366
|
-
return Voxgig::Struct::transform(
|
|
367
|
-
Voxgig::Struct::clone($in->{data}),
|
|
368
|
-
Voxgig::Struct::clone($in->{spec}),
|
|
369
|
-
{ modify => sub {
|
|
370
|
-
my ($val, $key, $parent) = @_;
|
|
371
|
-
return unless defined $key && defined $parent && ref $parent;
|
|
372
|
-
return if ref $val;
|
|
373
|
-
return if !defined $val;
|
|
374
|
-
return if Voxgig::Struct::is_jbool($val) || Voxgig::Struct::is_jnull($val);
|
|
375
|
-
return unless Voxgig::Struct::_is_string_sv($val);
|
|
376
|
-
my $new = '@' . $val;
|
|
377
|
-
if (Voxgig::Struct::ismap($parent)) { $parent->{$key} = $new }
|
|
378
|
-
elsif (Voxgig::Struct::islist($parent)) { $parent->[$key] = $new }
|
|
379
|
-
}},
|
|
380
|
-
);
|
|
381
|
-
});
|
|
355
|
+
|
|
356
|
+
# ===========================================================================
|
|
357
|
+
# merge
|
|
358
|
+
# ===========================================================================
|
|
359
|
+
|
|
360
|
+
my $merge_spec = $struct_spec->{merge};
|
|
361
|
+
|
|
362
|
+
# `merge.basic` is a single entry, not a set.
|
|
363
|
+
{
|
|
364
|
+
my $basic = ProjectNameOmni::tostruct(
|
|
365
|
+
Voxgig::Omni::Util::clone($merge_spec->{basic}));
|
|
366
|
+
is(canon($S->{merge}->($basic->{in})), canon($basic->{out}), 'merge.basic');
|
|
382
367
|
}
|
|
383
368
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
#
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
369
|
+
grun('merge.cases', $merge_spec->{cases}, sub { $S->{merge}->($_[0]) });
|
|
370
|
+
grun('merge.array', $merge_spec->{array}, sub { $S->{merge}->($_[0]) });
|
|
371
|
+
|
|
372
|
+
# The entries assert the in-place result through `match.args`.
|
|
373
|
+
grun('merge.integrity', $merge_spec->{integrity}, sub { $S->{merge}->($_[0]) });
|
|
374
|
+
|
|
375
|
+
grun('merge.depth', $merge_spec->{depth},
|
|
376
|
+
sub { $S->{merge}->($_[0]{val}, $_[0]{depth}) });
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
# ===========================================================================
|
|
380
|
+
# getpath
|
|
381
|
+
# ===========================================================================
|
|
382
|
+
|
|
383
|
+
my $getpath_spec = $struct_spec->{getpath};
|
|
384
|
+
|
|
385
|
+
grun('getpath.basic', $getpath_spec->{basic},
|
|
386
|
+
sub { $S->{getpath}->($_[0]{store}, $_[0]{path}) });
|
|
387
|
+
|
|
388
|
+
grun('getpath.relative', $getpath_spec->{relative}, sub {
|
|
389
|
+
my ($in) = @_;
|
|
390
|
+
my $dpath = $in->{dpath};
|
|
391
|
+
return $S->{getpath}->($in->{store}, $in->{path}, {
|
|
392
|
+
dparent => $in->{dparent},
|
|
393
|
+
(defined $dpath && !ref $dpath ? (dpath => [ split /\./, $dpath ]) : ()),
|
|
394
|
+
});
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
grun('getpath.special', $getpath_spec->{special},
|
|
398
|
+
sub { $S->{getpath}->($_[0]{store}, $_[0]{path}, $_[0]{inj}) });
|
|
399
|
+
|
|
400
|
+
grun('getpath.handler', $getpath_spec->{handler}, sub {
|
|
401
|
+
my ($in) = @_;
|
|
402
|
+
return $S->{getpath}->(
|
|
403
|
+
Voxgig::Struct::jm('$TOP', $in->{store}, '$FOO', sub { 'foo' }),
|
|
404
|
+
$in->{path},
|
|
405
|
+
{ handler => sub { my ($_inj, $val, $_cur, $_ref) = @_; return $val->() } },
|
|
406
|
+
);
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
# ===========================================================================
|
|
411
|
+
# inject
|
|
412
|
+
# ===========================================================================
|
|
413
|
+
|
|
414
|
+
my $inject_spec = $struct_spec->{inject};
|
|
415
|
+
|
|
416
|
+
# `inject.basic` is a single entry, not a set.
|
|
417
|
+
{
|
|
418
|
+
my $basic = ProjectNameOmni::tostruct(
|
|
419
|
+
Voxgig::Omni::Util::clone($inject_spec->{basic}));
|
|
420
|
+
is(canon($S->{inject}->($basic->{in}{val}, $basic->{in}{store})),
|
|
421
|
+
canon($basic->{out}), 'inject.basic');
|
|
416
422
|
}
|
|
417
423
|
|
|
418
|
-
#
|
|
419
|
-
#
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
424
|
+
# The runner encodes "value is JSON null" as the NULLMARK string so it
|
|
425
|
+
# survives a JSON round trip; the resolver's null_modifier puts THIS
|
|
426
|
+
# port's null (JNULL) back as the structure is built.
|
|
427
|
+
grun('inject.string', $inject_spec->{string},
|
|
428
|
+
sub { $S->{inject}->($_[0]{val}, $_[0]{store},
|
|
429
|
+
{ modify => \&ProjectNameOmni::null_modifier }) });
|
|
430
|
+
|
|
431
|
+
grun('inject.deep', $inject_spec->{deep},
|
|
432
|
+
sub { $S->{inject}->($_[0]{val}, $_[0]{store}) });
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
# ===========================================================================
|
|
436
|
+
# transform
|
|
437
|
+
# ===========================================================================
|
|
438
|
+
|
|
439
|
+
my $transform_spec = $struct_spec->{transform};
|
|
440
|
+
|
|
441
|
+
# `transform.basic` is a single entry, not a set.
|
|
442
|
+
{
|
|
443
|
+
my $basic = ProjectNameOmni::tostruct(
|
|
444
|
+
Voxgig::Omni::Util::clone($transform_spec->{basic}));
|
|
445
|
+
my $got = eval { $S->{transform}->($basic->{in}{data}, $basic->{in}{spec}) };
|
|
446
|
+
is(canon($got), canon($basic->{out}), 'transform.basic');
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
for my $sec (qw(paths cmds each pack ref apply)) {
|
|
450
|
+
grun("transform.$sec", $transform_spec->{$sec},
|
|
451
|
+
sub { $S->{transform}->($_[0]{data}, $_[0]{spec}) });
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
grunflags('transform.format', $transform_spec->{format}, { null => 0 },
|
|
455
|
+
sub { $S->{transform}->($_[0]{data}, $_[0]{spec}) });
|
|
456
|
+
|
|
457
|
+
grun('transform.modify', $transform_spec->{modify}, sub {
|
|
458
|
+
my ($in) = @_;
|
|
459
|
+
return $S->{transform}->($in->{data}, $in->{spec}, {
|
|
460
|
+
modify => sub {
|
|
461
|
+
my ($val, $key, $parent) = @_;
|
|
462
|
+
return if !defined $key || !defined $parent || !ref $parent;
|
|
463
|
+
return if ref $val || !defined $val;
|
|
464
|
+
return if !Voxgig::Struct::_is_string_sv($val);
|
|
465
|
+
Voxgig::Struct::setprop($parent, $key, '@' . $val);
|
|
466
|
+
return;
|
|
467
|
+
},
|
|
468
|
+
});
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
# ===========================================================================
|
|
473
|
+
# validate
|
|
474
|
+
# ===========================================================================
|
|
475
|
+
|
|
476
|
+
my $validate_spec = $struct_spec->{validate};
|
|
477
|
+
|
|
478
|
+
grunflags('validate.basic', $validate_spec->{basic}, { null => 0 },
|
|
479
|
+
sub { $S->{validate}->($_[0]{data}, $_[0]{spec}) });
|
|
480
|
+
|
|
481
|
+
for my $sec (qw(child one exact)) {
|
|
482
|
+
grun("validate.$sec", $validate_spec->{$sec},
|
|
483
|
+
sub { $S->{validate}->($_[0]{data}, $_[0]{spec}) });
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
grunflags('validate.invalid', $validate_spec->{invalid}, { null => 0 },
|
|
487
|
+
sub { $S->{validate}->($_[0]{data}, $_[0]{spec}) });
|
|
488
|
+
|
|
489
|
+
grun('validate.special', $validate_spec->{special},
|
|
490
|
+
sub { $S->{validate}->($_[0]{data}, $_[0]{spec}, $_[0]{inj}) });
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
# ===========================================================================
|
|
494
|
+
# select
|
|
495
|
+
# ===========================================================================
|
|
496
|
+
|
|
497
|
+
my $select_spec = $struct_spec->{select};
|
|
498
|
+
|
|
499
|
+
for my $sec (qw(basic operators edge alts)) {
|
|
500
|
+
grun("select.$sec", $select_spec->{$sec},
|
|
501
|
+
sub { $S->{select}->($_[0]{obj}, $_[0]{query}) });
|
|
436
502
|
}
|
|
437
503
|
|
|
438
504
|
done_testing();
|