@voxgig/sdkgen 4.8.1 → 4.8.3
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 +2 -2
- 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/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/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 +209 -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 +151 -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 +439 -0
- package/project/.sdk/tm/go/feature/secrets/sekreto/sekreto.go +685 -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 +897 -0
- package/project/.sdk/tm/go/test/omni/util.go +360 -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 +613 -0
- package/project/.sdk/tm/js/test/vendor/omni/util.js +212 -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 +74 -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 +152 -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 +92 -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 +455 -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 +566 -0
- package/project/.sdk/tm/py/test/voxgig_omni/util.py +237 -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/test/primary_utility_test.zig +1 -1
- package/project/.sdk/tm/zig/test/struct_runner.zig +5 -4
- 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
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
// VENDORED: @voxgig/omni sdk-20260904-1610-0 (kotlin/src/Runner.kt)
|
|
2
|
+
// Source: https://github.com/voxgig/omni @ 8c3e1b573a8d35796f7fc45e3226b977023cabf7 [tag: sdk-20260904-1610-0]
|
|
3
|
+
// License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
|
|
4
|
+
// Omni: the shared multi-language test runner (Kotlin port).
|
|
5
|
+
//
|
|
6
|
+
// Port of the canonical TypeScript implementation
|
|
7
|
+
// (typescript/src/Runner.ts). Behaviour must match, case for case.
|
|
8
|
+
|
|
9
|
+
package voxgig.omni
|
|
10
|
+
|
|
11
|
+
import java.io.File
|
|
12
|
+
import java.util.regex.Pattern
|
|
13
|
+
import java.util.regex.PatternSyntaxException
|
|
14
|
+
import kotlin.math.truncate
|
|
15
|
+
|
|
16
|
+
/** The function under test. Arguments arrive as JSON values. */
|
|
17
|
+
typealias Subject = (List<Json>) -> Json
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A test failure (or a malformed spec). Distinct from an exception thrown
|
|
21
|
+
* by the subject under test, which is a candidate for an `err` expectation.
|
|
22
|
+
*/
|
|
23
|
+
class OmniError(message: String, val entry: Json = Json.Absent) : RuntimeException(message)
|
|
24
|
+
|
|
25
|
+
/** Run-time options for a set of test entries. */
|
|
26
|
+
data class Flags(val nulls: Boolean = true, val name: String? = null) {
|
|
27
|
+
companion object {
|
|
28
|
+
fun nonull(): Flags = Flags(nulls = false)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The host of the system under test. Every hook is optional. */
|
|
33
|
+
class Provider(
|
|
34
|
+
val subject: ((String) -> Subject?)? = null,
|
|
35
|
+
val client: ((Json) -> Provider)? = null,
|
|
36
|
+
val contextify: ((Json) -> Json)? = null,
|
|
37
|
+
val inject: ((Json, Json) -> Json)? = null,
|
|
38
|
+
// Build the `match.err` base from the raised error, REPLACING `errify`.
|
|
39
|
+
// A library whose errors carry a code can then assert on it with
|
|
40
|
+
// `match: {err: {code: "x"}}` instead of pattern-matching prose.
|
|
41
|
+
val errify: ((Throwable) -> Json)? = null,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
// The newest spec format version this runner understands. A spec with no
|
|
45
|
+
// OMNI block is version 0: the original, lenient format, frozen forever.
|
|
46
|
+
// Version 1 turns on strict entry validation (see checkentry).
|
|
47
|
+
const val SPECVERSION = 1
|
|
48
|
+
|
|
49
|
+
// Capability strings this runner supports beyond the version baseline. A
|
|
50
|
+
// spec's OMNI.requires list is checked against this: an unknown capability
|
|
51
|
+
// refuses the spec loudly at load time, instead of a lagging port silently
|
|
52
|
+
// mis-running it. (Empty today; future format features mint a string here.)
|
|
53
|
+
val CAPABILITIES: List<String> = emptyList()
|
|
54
|
+
|
|
55
|
+
// The complete set of fields an entry may carry. Under version 1 anything
|
|
56
|
+
// else is an error: an unrecognised key is almost always a typo'd
|
|
57
|
+
// assertion, and a typo'd assertion is a test that silently stopped
|
|
58
|
+
// testing.
|
|
59
|
+
private val ENTRYFIELDS = listOf("in", "args", "ctx", "out", "err", "match", "client", "id", "doc")
|
|
60
|
+
|
|
61
|
+
/** Load a spec: a path to a JSON file. */
|
|
62
|
+
fun loadspec(path: String): Json {
|
|
63
|
+
val file = File(path)
|
|
64
|
+
if (!file.exists()) {
|
|
65
|
+
throw OmniError("omni: cannot read spec: $path")
|
|
66
|
+
}
|
|
67
|
+
return Json.parse(file.readText())
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Find `primary.<name>`, then `<name>`, then the whole spec. */
|
|
71
|
+
fun resolvespec(name: String, alltests: Json): Json {
|
|
72
|
+
if (name.isEmpty()) {
|
|
73
|
+
return alltests
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
val primary = alltests.get("primary").get(name)
|
|
77
|
+
if (!primary.isabsent) {
|
|
78
|
+
return primary
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
val section = alltests.get(name)
|
|
82
|
+
if (!section.isabsent) {
|
|
83
|
+
return section
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return alltests
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Read the spec's format version from its optional top-level OMNI block,
|
|
90
|
+
// and refuse a spec this runner cannot faithfully run: a version newer
|
|
91
|
+
// than SPECVERSION, or a required capability not in CAPABILITIES. A
|
|
92
|
+
// present-but-null OMNI block is malformed - only a genuinely absent key
|
|
93
|
+
// means legacy version 0.
|
|
94
|
+
fun resolveversion(alltests: Json): Int {
|
|
95
|
+
if (!alltests.has("OMNI")) {
|
|
96
|
+
return 0
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
val meta = alltests.get("OMNI")
|
|
100
|
+
val version = meta.get("version").asnum
|
|
101
|
+
|
|
102
|
+
if (!meta.ismap || null == version || version != truncate(version)) {
|
|
103
|
+
throw OmniError("omni: malformed OMNI version block")
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (0 > version || SPECVERSION.toDouble() < version) {
|
|
107
|
+
throw OmniError("omni: unsupported spec version: " + numstr(version))
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (meta.has("requires")) {
|
|
111
|
+
val requires = meta.get("requires")
|
|
112
|
+
if (!requires.islist) {
|
|
113
|
+
throw OmniError("omni: malformed OMNI requires list")
|
|
114
|
+
}
|
|
115
|
+
for (cap in requires.aslist!!) {
|
|
116
|
+
val capstr = cap.asstr
|
|
117
|
+
if (null == capstr || !CAPABILITIES.contains(capstr)) {
|
|
118
|
+
throw OmniError("omni: spec requires unsupported capability: " + stringify(cap))
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return version.toInt()
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** Nulls (and absent values) become NULLMARK. Always a fresh copy. */
|
|
127
|
+
fun fixjson(val_: Json, donull: Boolean): Json {
|
|
128
|
+
if (val_.isnone) {
|
|
129
|
+
// Canonical returns the value UNCHANGED when donull is false
|
|
130
|
+
// (typescript/src/Runner.ts): absent stays absent and null stays null.
|
|
131
|
+
// Answering Json.Null for both collapsed two states the corpus
|
|
132
|
+
// distinguishes. Same defect omni-lua and omni-rust carried
|
|
133
|
+
// (voxgig/omni#17, #23).
|
|
134
|
+
return if (donull) Json.str(NULLMARK) else val_
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (val_ is Json.JList) {
|
|
138
|
+
return Json.JList(val_.value.map { fixjson(it, donull) }.toMutableList())
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (val_ is Json.JMap) {
|
|
142
|
+
val out = LinkedHashMap<String, Json>()
|
|
143
|
+
for ((key, entry) in val_.value) {
|
|
144
|
+
out[key] = fixjson(entry, donull)
|
|
145
|
+
}
|
|
146
|
+
return Json.JMap(out)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return val_
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** The JSON form of an error: always at least {name,message}. */
|
|
153
|
+
fun errify(err: Throwable): Json =
|
|
154
|
+
Json.map(
|
|
155
|
+
"name" to Json.str(err::class.simpleName ?: "Error"),
|
|
156
|
+
"message" to Json.str(errmessage(err)),
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
fun errmessage(err: Throwable): String = err.message ?: (err::class.simpleName ?: "Error")
|
|
160
|
+
|
|
161
|
+
/** Match one leaf: /regex/ or case-insensitive substring for strings. */
|
|
162
|
+
fun matchval(check: Json, base: Json): Boolean {
|
|
163
|
+
if (deepequal(check, base)) {
|
|
164
|
+
return true
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
val text = check.asstr
|
|
168
|
+
if (null != text) {
|
|
169
|
+
// An empty want would substring-match anything.
|
|
170
|
+
if (text.isEmpty()) {
|
|
171
|
+
return false
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
val basestr = stringify(base)
|
|
175
|
+
|
|
176
|
+
if (2 < text.length && text.startsWith("/") && text.endsWith("/")) {
|
|
177
|
+
return try {
|
|
178
|
+
Pattern.compile(text.substring(1, text.length - 1)).matcher(basestr).find()
|
|
179
|
+
} catch (err: PatternSyntaxException) {
|
|
180
|
+
false
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return basestr.lowercase().contains(text.lowercase())
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return deepequal(check, base)
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** Convert NULLMARK sentinels back into real nulls. */
|
|
191
|
+
fun nullmodifier(val_: Json): Json {
|
|
192
|
+
val text = val_.asstr ?: return val_
|
|
193
|
+
return if (NULLMARK == text) Json.Null else Json.str(text.replace(NULLMARK, "null"))
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** What a runner returns for one named spec section. */
|
|
197
|
+
class RunPack(
|
|
198
|
+
val spec: Json,
|
|
199
|
+
val subject: Subject?,
|
|
200
|
+
val client: Provider,
|
|
201
|
+
private val clients: Map<String, Provider>,
|
|
202
|
+
private val name: String,
|
|
203
|
+
private val specversion: Int,
|
|
204
|
+
) {
|
|
205
|
+
/** A named group of the resolved spec. */
|
|
206
|
+
fun set(setname: String): Json = spec.get(setname)
|
|
207
|
+
|
|
208
|
+
/** Run one set of test entries. */
|
|
209
|
+
fun runset(testspec: Json, testsubject: Subject? = null) {
|
|
210
|
+
runsetflags(testspec, Flags(), testsubject)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Run one set of test entries with flags. */
|
|
214
|
+
fun runsetflags(testspec: Json, flags: Flags, testsubject: Subject? = null) {
|
|
215
|
+
val label = flags.name ?: if (name.isEmpty()) "set" else name
|
|
216
|
+
|
|
217
|
+
val usesubject = testsubject ?: subject
|
|
218
|
+
?: throw OmniError("omni: no test subject for: $label")
|
|
219
|
+
|
|
220
|
+
val testspecmap = fixjson(testspec, flags.nulls)
|
|
221
|
+
val testset = testspecmap.get("set").aslist
|
|
222
|
+
?: throw OmniError("omni: test spec has no set: $label")
|
|
223
|
+
|
|
224
|
+
if (1 <= specversion) {
|
|
225
|
+
checkset(label, testspec, testset)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
for ((index, entry) in testset.withIndex()) {
|
|
229
|
+
if (!entry.ismap) {
|
|
230
|
+
throw OmniError("omni: $label[$index]: entry is not a map")
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// An entry with no `out` expects a null (or absent) result.
|
|
234
|
+
if (flags.nulls && entry.get("out").isnone) {
|
|
235
|
+
entry.set("out", Json.str(NULLMARK))
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
var entrysubject = usesubject
|
|
239
|
+
var entryclient = client
|
|
240
|
+
|
|
241
|
+
val clientname = entry.get("client").asstr
|
|
242
|
+
if (null != clientname) {
|
|
243
|
+
val found = clients[clientname]
|
|
244
|
+
?: throw OmniError("omni: unknown client: $clientname", entry)
|
|
245
|
+
entryclient = found
|
|
246
|
+
val clientsubject = found.subject?.invoke(name)
|
|
247
|
+
if (null != clientsubject) {
|
|
248
|
+
entrysubject = clientsubject
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
val args = resolveargs(entry, entryclient)
|
|
253
|
+
|
|
254
|
+
val res: Json
|
|
255
|
+
try {
|
|
256
|
+
res = entrysubject(args)
|
|
257
|
+
} catch (omnierr: OmniError) {
|
|
258
|
+
throw omnierr
|
|
259
|
+
} catch (err: Throwable) {
|
|
260
|
+
handleerror(label, index, entry, err)
|
|
261
|
+
continue
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
val fixed = fixjson(res, flags.nulls)
|
|
265
|
+
entry.set("res", fixed)
|
|
266
|
+
|
|
267
|
+
checkresult(label, index, entry, args, fixed)
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Build the argument list: `ctx`, `args`, or `in`.
|
|
272
|
+
private fun resolveargs(entry: Json, entryclient: Provider): List<Json> {
|
|
273
|
+
val hasctx = entry.has("ctx")
|
|
274
|
+
val hasargs = entry.has("args")
|
|
275
|
+
|
|
276
|
+
val args: MutableList<Json> = when {
|
|
277
|
+
hasctx -> mutableListOf(entry.get("ctx"))
|
|
278
|
+
hasargs -> entry.get("args").aslist ?: mutableListOf(entry.get("args"))
|
|
279
|
+
else -> mutableListOf(clone(entry.get("in")))
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if ((hasctx || hasargs) && args.isNotEmpty() && args[0].ismap) {
|
|
283
|
+
var first = clone(args[0])
|
|
284
|
+
val contextify = client.contextify
|
|
285
|
+
if (null != contextify) {
|
|
286
|
+
first = contextify(first)
|
|
287
|
+
}
|
|
288
|
+
args[0] = first
|
|
289
|
+
entry.set("ctx", first)
|
|
290
|
+
|
|
291
|
+
if (first.ismap) {
|
|
292
|
+
// The resolved client is a live Provider (closures over the
|
|
293
|
+
// system under test), and this port's Json carries no
|
|
294
|
+
// host-object variant to hold one - so canonical's
|
|
295
|
+
// `first.client = testpack.client` becomes presence, not
|
|
296
|
+
// identity: enough for a subject to prove the runner
|
|
297
|
+
// attached a client at all. `entryclient` is always set
|
|
298
|
+
// (root provider, or the entry's own `client:`), so the
|
|
299
|
+
// marker is unconditional once we get here.
|
|
300
|
+
first.set("client", Json.Bool(true))
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return args
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Validate a version-1 group up front, against the AUTHORED entries -
|
|
308
|
+
// null-normalisation would otherwise rewrite an authored null (e.g.
|
|
309
|
+
// id: null) into a sentinel string and hide it from validation. A
|
|
310
|
+
// malformed spec is a spec error, not a test result, so it fails before
|
|
311
|
+
// any subject runs.
|
|
312
|
+
private fun checkset(label: String, testspec: Json, normalset: List<Json>) {
|
|
313
|
+
val origset = if (testspec.ismap && testspec.get("set").islist) {
|
|
314
|
+
testspec.get("set").aslist!!
|
|
315
|
+
} else {
|
|
316
|
+
normalset
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
val emptyflag = testspec.get("empty")
|
|
320
|
+
val markedempty = emptyflag is Json.Bool && emptyflag.value
|
|
321
|
+
|
|
322
|
+
if (origset.isEmpty() && !markedempty) {
|
|
323
|
+
throw OmniError("omni: empty test set: $label")
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
for ((index, entry) in origset.withIndex()) {
|
|
327
|
+
checkentry(label, index, entry)
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Strict entry validation, applied when the spec declares version 1 or
|
|
332
|
+
// later. The lenient format converts each of these mistakes into a
|
|
333
|
+
// silent pass or a dead field; here they fail with the entry named.
|
|
334
|
+
private fun checkentry(label: String, index: Int, entry: Json) {
|
|
335
|
+
if (!entry.ismap) {
|
|
336
|
+
throw fail(label, index, entry, "entry is not a map")
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
for (key in entry.asmap!!.keys) {
|
|
340
|
+
if (key !in ENTRYFIELDS) {
|
|
341
|
+
throw fail(label, index, entry, "unknown entry field: $key")
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
var argsources = 0
|
|
346
|
+
for (key in listOf("in", "args", "ctx")) {
|
|
347
|
+
if (entry.has(key)) {
|
|
348
|
+
argsources++
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
if (1 < argsources) {
|
|
352
|
+
throw fail(label, index, entry, "entry has more than one of in, args, ctx")
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (!entry.get("err").isnone && entry.has("out")) {
|
|
356
|
+
throw fail(label, index, entry, "entry has both err and out")
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (entry.has("id") && null == entry.get("id").asstr) {
|
|
360
|
+
throw fail(label, index, entry, "entry id is not a string")
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
private fun checkresult(label: String, index: Int, entry: Json, args: List<Json>, res: Json) {
|
|
365
|
+
var matched = false
|
|
366
|
+
|
|
367
|
+
val entryerr = entry.get("err")
|
|
368
|
+
if (!entryerr.isnone) {
|
|
369
|
+
throw fail(
|
|
370
|
+
label, index, entry, "expected error did not occur",
|
|
371
|
+
stringify(entryerr), stringify(res),
|
|
372
|
+
)
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
val check = entry.get("match")
|
|
376
|
+
if (!check.isnone) {
|
|
377
|
+
val base = Json.map(
|
|
378
|
+
"in" to entry.get("in"),
|
|
379
|
+
"args" to Json.JList(args.toMutableList()),
|
|
380
|
+
"out" to entry.get("res"),
|
|
381
|
+
"ctx" to entry.get("ctx"),
|
|
382
|
+
)
|
|
383
|
+
matchcheck(label, index, entry, check, base)
|
|
384
|
+
matched = true
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
val out = entry.get("out")
|
|
388
|
+
|
|
389
|
+
if (deepequal(res, out)) {
|
|
390
|
+
return
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// NOTE: a match with no explicit out is a complete check on its own.
|
|
394
|
+
if (matched && (out.isnone || NULLMARK == out.asstr)) {
|
|
395
|
+
return
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
throw fail(label, index, entry, "result mismatch", stringify(out), stringify(res))
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/** The error base a `match.err` sees: the provider's own, when it has one. */
|
|
402
|
+
private fun errbase(err: Throwable): Json {
|
|
403
|
+
val hook = client.errify
|
|
404
|
+
return if (null != hook) hook(err) else errify(err)
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
private fun handleerror(label: String, index: Int, entry: Json, err: Throwable) {
|
|
408
|
+
val entryerr = entry.get("err")
|
|
409
|
+
|
|
410
|
+
if (!entryerr.isnone) {
|
|
411
|
+
val istrue = entryerr is Json.Bool && entryerr.value
|
|
412
|
+
|
|
413
|
+
if (istrue || matchval(entryerr, Json.str(errmessage(err)))) {
|
|
414
|
+
val check = entry.get("match")
|
|
415
|
+
if (!check.isnone) {
|
|
416
|
+
val base = Json.map(
|
|
417
|
+
"in" to entry.get("in"),
|
|
418
|
+
"out" to entry.get("res"),
|
|
419
|
+
"ctx" to entry.get("ctx"),
|
|
420
|
+
"err" to errbase(err),
|
|
421
|
+
)
|
|
422
|
+
matchcheck(label, index, entry, check, base)
|
|
423
|
+
}
|
|
424
|
+
return
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
throw fail(label, index, entry, "error mismatch", stringify(entryerr), errmessage(err))
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
throw fail(label, index, entry, "unexpected error", null, errmessage(err))
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// Check that every leaf of `check` is present, and matches, in `base`.
|
|
434
|
+
private fun matchcheck(
|
|
435
|
+
label: String,
|
|
436
|
+
index: Int,
|
|
437
|
+
entry: Json,
|
|
438
|
+
check: Json,
|
|
439
|
+
base: Json,
|
|
440
|
+
path: List<String> = listOf(),
|
|
441
|
+
) {
|
|
442
|
+
val where = if (path.isEmpty()) "<root>" else pathify(path)
|
|
443
|
+
|
|
444
|
+
if (check is Json.JList) {
|
|
445
|
+
for ((at, subcheck) in check.value.withIndex()) {
|
|
446
|
+
matchcheck(label, index, entry, subcheck, base, path + "$at")
|
|
447
|
+
}
|
|
448
|
+
return
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
if (check is Json.JMap) {
|
|
452
|
+
for ((key, subcheck) in check.value) {
|
|
453
|
+
matchcheck(label, index, entry, subcheck, base, path + key)
|
|
454
|
+
}
|
|
455
|
+
return
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
val baseval = getpath(base, path)
|
|
459
|
+
|
|
460
|
+
// The sentinels are tested BEFORE the identity check below. Otherwise
|
|
461
|
+
// a subject returning the literal string "__UNDEF__" satisfies an
|
|
462
|
+
// assertion that the key is absent - two mutually exclusive states
|
|
463
|
+
// passing one check. A sentinel that accepts its own literal is not a
|
|
464
|
+
// sentinel. (NULLMARK still accepts NULLMARK: under the default null
|
|
465
|
+
// flag a real null has already been normalised to it, so the two are
|
|
466
|
+
// genuinely indistinguishable here - that one needs a raw-value
|
|
467
|
+
// escape, not an ordering change.)
|
|
468
|
+
|
|
469
|
+
// Explicitly absent: satisfied only by a genuinely missing key, never
|
|
470
|
+
// by a present null (the distinction the sentinels exist to keep).
|
|
471
|
+
if (UNDEFMARK == check.asstr) {
|
|
472
|
+
if (baseval.isabsent) {
|
|
473
|
+
return
|
|
474
|
+
}
|
|
475
|
+
throw fail(
|
|
476
|
+
label, index, entry, "expected absent at $where",
|
|
477
|
+
"absent", stringify(baseval),
|
|
478
|
+
)
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// Explicitly null: satisfied only by a present null.
|
|
482
|
+
if (NULLMARK == check.asstr) {
|
|
483
|
+
if (baseval.isnull || NULLMARK == baseval.asstr) {
|
|
484
|
+
return
|
|
485
|
+
}
|
|
486
|
+
throw fail(
|
|
487
|
+
label, index, entry, "expected null at $where",
|
|
488
|
+
"null", stringify(baseval),
|
|
489
|
+
)
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
// Explicitly present: any present value, including null.
|
|
493
|
+
if (EXISTSMARK == check.asstr) {
|
|
494
|
+
if (!baseval.isabsent) {
|
|
495
|
+
return
|
|
496
|
+
}
|
|
497
|
+
throw fail(
|
|
498
|
+
label, index, entry, "expected present at $where",
|
|
499
|
+
"present", "absent",
|
|
500
|
+
)
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// Identical values match. This sits below the sentinel branches on
|
|
504
|
+
// purpose - see the note above.
|
|
505
|
+
if (deepequal(check, baseval)) {
|
|
506
|
+
return
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// A concrete expectation never matches a missing key - a match leaf
|
|
510
|
+
// against an absent value must fail, not substring-match "undefined".
|
|
511
|
+
if (baseval.isabsent) {
|
|
512
|
+
throw fail(
|
|
513
|
+
label, index, entry, "match failed at $where",
|
|
514
|
+
stringify(check), "absent",
|
|
515
|
+
)
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
if (matchval(check, baseval)) {
|
|
519
|
+
return
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
throw fail(
|
|
523
|
+
label, index, entry, "match failed at $where",
|
|
524
|
+
stringify(check), stringify(baseval),
|
|
525
|
+
)
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// The label of one entry, for failure messages.
|
|
529
|
+
private fun entryref(label: String, index: Int, entry: Json): String {
|
|
530
|
+
val id = entry.get("id")
|
|
531
|
+
val idpart = if (id.isabsent) "" else " (${stringify(id)})"
|
|
532
|
+
return "$label[$index]$idpart"
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
private fun fail(
|
|
536
|
+
label: String,
|
|
537
|
+
index: Int,
|
|
538
|
+
entry: Json,
|
|
539
|
+
reason: String,
|
|
540
|
+
expected: String? = null,
|
|
541
|
+
actual: String? = null,
|
|
542
|
+
): OmniError {
|
|
543
|
+
val msg = StringBuilder("omni: ${entryref(label, index, entry)}: $reason")
|
|
544
|
+
|
|
545
|
+
if (null != expected) {
|
|
546
|
+
msg.append("\n expected: $expected")
|
|
547
|
+
}
|
|
548
|
+
if (null != actual) {
|
|
549
|
+
msg.append("\n actual: $actual")
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
msg.append("\n entry: ${stringify(entrysummary(entry))}")
|
|
553
|
+
|
|
554
|
+
return OmniError(msg.toString(), entry)
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
// The spec-defined part of an entry (drop runner bookkeeping). A
|
|
558
|
+
// strict-mode "entry is not a map" failure (checkentry) reaches this
|
|
559
|
+
// with a non-map entry - dumped as-is, same as canonical.
|
|
560
|
+
private fun entrysummary(entry: Json): Json {
|
|
561
|
+
if (!entry.ismap) {
|
|
562
|
+
return entry
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
val summary = LinkedHashMap<String, Json>()
|
|
566
|
+
entry.asmap!!.forEach { (key, value) ->
|
|
567
|
+
if ("res" != key && "thrown" != key && "ctx" != key) {
|
|
568
|
+
summary[key] = value
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
return Json.JMap(summary)
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/** A loaded spec plus its provider. */
|
|
576
|
+
class Runner(private val alltests: Json, private val provider: Provider) {
|
|
577
|
+
// Resolved once, at construction (i.e. inside makeRunner) - fail fast on
|
|
578
|
+
// a spec version this runner cannot faithfully run, before any set runs.
|
|
579
|
+
private val specversion: Int = resolveversion(alltests)
|
|
580
|
+
|
|
581
|
+
/** Resolve one named section of the spec. */
|
|
582
|
+
fun runner(name: String, store: Json = Json.Absent): RunPack {
|
|
583
|
+
val spec = resolvespec(name, alltests)
|
|
584
|
+
val clients = mutableMapOf<String, Provider>()
|
|
585
|
+
|
|
586
|
+
val defclient = spec.get("DEF").get("client").asmap
|
|
587
|
+
val clientmaker = provider.client
|
|
588
|
+
|
|
589
|
+
// A spec may define clients that a given test run never references.
|
|
590
|
+
if (null != defclient && null != clientmaker) {
|
|
591
|
+
for ((clientname, cdef) in defclient) {
|
|
592
|
+
var copts = cdef.get("test").get("options")
|
|
593
|
+
if (copts.isabsent) {
|
|
594
|
+
copts = Json.map()
|
|
595
|
+
}
|
|
596
|
+
val inject = provider.inject
|
|
597
|
+
if (null != inject && store.ismap) {
|
|
598
|
+
copts = inject(copts, store)
|
|
599
|
+
}
|
|
600
|
+
clients[clientname] = clientmaker(copts)
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
val subject = if (name.isEmpty()) null else provider.subject?.invoke(name)
|
|
605
|
+
|
|
606
|
+
return RunPack(spec, subject, provider, clients, name, specversion)
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/** Make a runner for a spec file path and a provider. */
|
|
611
|
+
fun makeRunner(path: String, provider: Provider = Provider()): Runner =
|
|
612
|
+
Runner(loadspec(path), provider)
|
|
613
|
+
|
|
614
|
+
/** Make a runner for an in-memory spec and a provider. */
|
|
615
|
+
fun makeRunner(spec: Json, provider: Provider = Provider()): Runner = Runner(spec, provider)
|