@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,644 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
// VENDORED: @voxgig/omni sdk-20260904-1610-0 (php/src/Runner.php)
|
|
3
|
+
// Source: https://github.com/voxgig/omni @ 8c3e1b573a8d35796f7fc45e3226b977023cabf7 [tag: sdk-20260904-1610-0]
|
|
4
|
+
// License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Omni: the shared multi-language test runner.
|
|
8
|
+
*
|
|
9
|
+
* Port of the canonical TypeScript implementation
|
|
10
|
+
* (typescript/src/Runner.ts). Behaviour must match, case for case.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
declare(strict_types=1);
|
|
14
|
+
|
|
15
|
+
namespace Voxgig\Omni;
|
|
16
|
+
|
|
17
|
+
require_once __DIR__ . '/Util.php';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A test failure (or a malformed spec). Distinct from errors thrown by the
|
|
21
|
+
* subject under test, which are candidates for an `err` expectation.
|
|
22
|
+
*/
|
|
23
|
+
class OmniError extends \Exception
|
|
24
|
+
{
|
|
25
|
+
public $entry;
|
|
26
|
+
|
|
27
|
+
public function __construct(string $message, $entry = null)
|
|
28
|
+
{
|
|
29
|
+
parent::__construct($message);
|
|
30
|
+
$this->entry = $entry;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
final class Runner
|
|
35
|
+
{
|
|
36
|
+
public const NULLMARK = Util::NULLMARK;
|
|
37
|
+
public const UNDEFMARK = Util::UNDEFMARK;
|
|
38
|
+
public const EXISTSMARK = Util::EXISTSMARK;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The newest spec format version this runner understands. A spec with
|
|
42
|
+
* no OMNI block is version 0: the original, lenient format, frozen
|
|
43
|
+
* forever. Version 1 turns on strict entry validation (see checkentry).
|
|
44
|
+
*/
|
|
45
|
+
public const SPECVERSION = 1;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Capability strings this runner supports beyond the version baseline.
|
|
49
|
+
* A spec's OMNI.requires list is checked against this: an unknown
|
|
50
|
+
* capability refuses the spec loudly at load time, instead of a
|
|
51
|
+
* lagging port silently mis-running it. (Empty today; future format
|
|
52
|
+
* features mint a string here.)
|
|
53
|
+
*/
|
|
54
|
+
public const CAPABILITIES = [];
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The complete set of fields an entry may carry. Under version 1
|
|
58
|
+
* anything else is an error: an unrecognised key is almost always a
|
|
59
|
+
* typo'd assertion, and a typo'd assertion is a test that silently
|
|
60
|
+
* stopped testing.
|
|
61
|
+
*/
|
|
62
|
+
private const ENTRYFIELDS = ['in', 'args', 'ctx', 'out', 'err', 'match', 'client', 'id', 'doc'];
|
|
63
|
+
|
|
64
|
+
/** Load a spec: a path to a JSON file, or an already-parsed value. */
|
|
65
|
+
public static function loadspec($specref)
|
|
66
|
+
{
|
|
67
|
+
if (is_string($specref)) {
|
|
68
|
+
$text = file_get_contents($specref);
|
|
69
|
+
if (false === $text) {
|
|
70
|
+
throw new OmniError('omni: cannot read spec: ' . $specref);
|
|
71
|
+
}
|
|
72
|
+
return json_decode($text, true, 512, JSON_THROW_ON_ERROR);
|
|
73
|
+
}
|
|
74
|
+
return $specref;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Read the spec's format version from its optional top-level OMNI
|
|
79
|
+
* block, and refuse a spec this runner cannot faithfully run: a
|
|
80
|
+
* version newer than SPECVERSION, or a required capability not in
|
|
81
|
+
* CAPABILITIES.
|
|
82
|
+
*/
|
|
83
|
+
public static function resolveversion($alltests): int
|
|
84
|
+
{
|
|
85
|
+
if (!Util::ismap($alltests) || !array_key_exists('OMNI', $alltests)) {
|
|
86
|
+
return 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
$meta = $alltests['OMNI'];
|
|
90
|
+
$version = Util::ismap($meta) ? ($meta['version'] ?? null) : null;
|
|
91
|
+
|
|
92
|
+
if (!Util::ismap($meta) || !Util::isnum($version) || 0.0 !== fmod((float) $version, 1.0)) {
|
|
93
|
+
throw new OmniError('omni: malformed OMNI version block');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if ($version < 0 || self::SPECVERSION < $version) {
|
|
97
|
+
throw new OmniError('omni: unsupported spec version: ' . Util::stringify($version));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (array_key_exists('requires', $meta)) {
|
|
101
|
+
$requires = $meta['requires'];
|
|
102
|
+
if (!Util::islist($requires)) {
|
|
103
|
+
throw new OmniError('omni: malformed OMNI requires list');
|
|
104
|
+
}
|
|
105
|
+
foreach ($requires as $cap) {
|
|
106
|
+
if (!is_string($cap) || !in_array($cap, self::CAPABILITIES, true)) {
|
|
107
|
+
throw new OmniError('omni: spec requires unsupported capability: ' . Util::stringify($cap));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return (int) $version;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Strict entry validation, applied when the spec declares version 1 or
|
|
117
|
+
* later. The lenient format converts each of these mistakes into a
|
|
118
|
+
* silent pass or a dead field; here they fail with the entry named.
|
|
119
|
+
*/
|
|
120
|
+
public static function checkentry(array $flags, int $index, $entry): void
|
|
121
|
+
{
|
|
122
|
+
if (!Util::ismap($entry)) {
|
|
123
|
+
throw self::fail($flags, $index, $entry, 'entry is not a map');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
foreach (array_keys($entry) as $key) {
|
|
127
|
+
if (!in_array($key, self::ENTRYFIELDS, true)) {
|
|
128
|
+
throw self::fail($flags, $index, $entry, 'unknown entry field: ' . $key);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
$argsources = 0;
|
|
133
|
+
foreach (['in', 'args', 'ctx'] as $key) {
|
|
134
|
+
if (array_key_exists($key, $entry)) {
|
|
135
|
+
$argsources++;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (1 < $argsources) {
|
|
139
|
+
throw self::fail($flags, $index, $entry, 'entry has more than one of in, args, ctx');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (null !== ($entry['err'] ?? null) && array_key_exists('out', $entry)) {
|
|
143
|
+
throw self::fail($flags, $index, $entry, 'entry has both err and out');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (array_key_exists('id', $entry) && !is_string($entry['id'])) {
|
|
147
|
+
throw self::fail($flags, $index, $entry, 'entry id is not a string');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Validate a version-1 group up front, against the AUTHORED entries -
|
|
153
|
+
* null-normalisation would otherwise rewrite an authored null (e.g.
|
|
154
|
+
* id: null) into a sentinel string and hide it from validation. A
|
|
155
|
+
* malformed spec is a spec error, not a test result, so it fails
|
|
156
|
+
* before any subject runs.
|
|
157
|
+
*/
|
|
158
|
+
public static function checkset(array $flags, $testspec, array $normalset): void
|
|
159
|
+
{
|
|
160
|
+
$origset = Util::ismap($testspec) && Util::islist($testspec['set'] ?? null)
|
|
161
|
+
? $testspec['set'] : $normalset;
|
|
162
|
+
|
|
163
|
+
if (0 === count($origset) && true !== (Util::ismap($testspec) ? ($testspec['empty'] ?? null) : null)) {
|
|
164
|
+
throw new OmniError('omni: empty test set: ' . $flags['name']);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
foreach ($origset as $index => $entry) {
|
|
168
|
+
self::checkentry($flags, $index, $entry);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** Find `primary.<name>`, then `<name>`, then the whole spec. */
|
|
173
|
+
public static function resolvespec(?string $name, $alltests)
|
|
174
|
+
{
|
|
175
|
+
if (null === $name) {
|
|
176
|
+
return $alltests;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
$primary = Util::ismap($alltests) ? ($alltests['primary'] ?? null) : null;
|
|
180
|
+
if (Util::ismap($primary) && null !== ($primary[$name] ?? null)) {
|
|
181
|
+
return $primary[$name];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (is_array($alltests) && null !== ($alltests[$name] ?? null)) {
|
|
185
|
+
return $alltests[$name];
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return $alltests;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** Build the named clients declared by the spec's DEF.client block. */
|
|
192
|
+
public static function resolveclients(array $provider, $spec, $store): array
|
|
193
|
+
{
|
|
194
|
+
$clients = [];
|
|
195
|
+
|
|
196
|
+
$defclient = Util::ismap($spec) && Util::ismap($spec['DEF'] ?? null)
|
|
197
|
+
? ($spec['DEF']['client'] ?? null) : null;
|
|
198
|
+
if (!Util::ismap($defclient)) {
|
|
199
|
+
return $clients;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// A spec may define clients that a given test run never references.
|
|
203
|
+
$clientmaker = $provider['client'] ?? null;
|
|
204
|
+
if (null === $clientmaker) {
|
|
205
|
+
return $clients;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
foreach ($defclient as $clientname => $cdef) {
|
|
209
|
+
$copts = Util::clone(
|
|
210
|
+
(Util::ismap($cdef) && Util::ismap($cdef['test'] ?? null)
|
|
211
|
+
? ($cdef['test']['options'] ?? null) : null) ?? []
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
$injector = $provider['inject'] ?? null;
|
|
215
|
+
if (is_array($store) && null !== $injector) {
|
|
216
|
+
$injector($copts, $store);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
$clients[$clientname] = $clientmaker($copts);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return $clients;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
public static function resolvesubject(?string $name, array $provider)
|
|
226
|
+
{
|
|
227
|
+
if (null === $name || null === ($provider['subject'] ?? null)) {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
return $provider['subject']($name) ?: null;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
public static function resolveflags(?array $flags): array
|
|
234
|
+
{
|
|
235
|
+
$out = null === $flags ? [] : $flags;
|
|
236
|
+
$out['null'] = !isset($out['null']) ? true : (bool) $out['null'];
|
|
237
|
+
return $out;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** An entry with no `out` expects a null (or absent) result. */
|
|
241
|
+
public static function resolveentry(array $entry, array $flags): array
|
|
242
|
+
{
|
|
243
|
+
if (null === ($entry['out'] ?? null) && $flags['null']) {
|
|
244
|
+
$entry['out'] = Util::NULLMARK;
|
|
245
|
+
}
|
|
246
|
+
return $entry;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
public static function resolvetestpack(?string $name, array $entry, $subject, array $provider, array $clients): array
|
|
250
|
+
{
|
|
251
|
+
$testpack = ['client' => $provider, 'subject' => $subject];
|
|
252
|
+
|
|
253
|
+
if (null !== ($entry['client'] ?? null)) {
|
|
254
|
+
$client = $clients[$entry['client']] ?? null;
|
|
255
|
+
if (null === $client) {
|
|
256
|
+
throw new OmniError('omni: unknown client: ' . $entry['client'], $entry);
|
|
257
|
+
}
|
|
258
|
+
$testpack['client'] = $client;
|
|
259
|
+
$testpack['subject'] = self::resolvesubject($name, $client) ?: $subject;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return $testpack;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** Build the argument list: `ctx`, `args`, or `in`. */
|
|
266
|
+
public static function resolveargs(array &$entry, array $testpack, array $provider): array
|
|
267
|
+
{
|
|
268
|
+
if (array_key_exists('ctx', $entry)) {
|
|
269
|
+
$args = [$entry['ctx']];
|
|
270
|
+
} elseif (array_key_exists('args', $entry)) {
|
|
271
|
+
$args = $entry['args'];
|
|
272
|
+
} else {
|
|
273
|
+
$args = [Util::clone($entry['in'] ?? null)];
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (array_key_exists('ctx', $entry) || array_key_exists('args', $entry)) {
|
|
277
|
+
if (0 < count($args)) {
|
|
278
|
+
$first = $args[0];
|
|
279
|
+
if (Util::ismap($first)) {
|
|
280
|
+
$first = Util::clone($first);
|
|
281
|
+
$contextify = $provider['contextify'] ?? null;
|
|
282
|
+
if (null !== $contextify) {
|
|
283
|
+
$first = $contextify($first);
|
|
284
|
+
}
|
|
285
|
+
if (is_array($first)) {
|
|
286
|
+
$first['client'] = $testpack['client'];
|
|
287
|
+
}
|
|
288
|
+
$args[0] = $first;
|
|
289
|
+
$entry['ctx'] = $first;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return $args;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/** Nulls become NULLMARK, errors become {name,message}. Always a copy. */
|
|
298
|
+
public static function fixjson($val, ?array $flags = null)
|
|
299
|
+
{
|
|
300
|
+
$donull = (null === $flags || !isset($flags['null'])) ? true : (bool) $flags['null'];
|
|
301
|
+
return self::fixjsonval($val, $donull);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
public static function fixjsonval($val, bool $donull)
|
|
305
|
+
{
|
|
306
|
+
if (null === $val || Util::isabsent($val)) {
|
|
307
|
+
return $donull ? Util::NULLMARK : null;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if ($val instanceof \Throwable) {
|
|
311
|
+
return self::errify($val);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (is_array($val)) {
|
|
315
|
+
$out = [];
|
|
316
|
+
foreach ($val as $key => $subval) {
|
|
317
|
+
$out[$key] = self::fixjsonval($subval, $donull);
|
|
318
|
+
}
|
|
319
|
+
return $out;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return $val;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/** The JSON form of an error: always at least {name,message}. */
|
|
326
|
+
public static function errify($err): array
|
|
327
|
+
{
|
|
328
|
+
if ($err instanceof \Throwable) {
|
|
329
|
+
return ['name' => (new \ReflectionClass($err))->getShortName(), 'message' => $err->getMessage()];
|
|
330
|
+
}
|
|
331
|
+
return ['name' => 'Error', 'message' => (string) $err];
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// The error base a `match.err` sees: the provider's own, when it has one.
|
|
335
|
+
// A library whose errors carry a `code` reaches
|
|
336
|
+
// `match: {err: {code}}` through `Provider.errify`, which replaces
|
|
337
|
+
// `errify` entirely rather than adding to it.
|
|
338
|
+
public static function errbase($err, ?array $provider)
|
|
339
|
+
{
|
|
340
|
+
$hook = null === $provider ? null : ($provider['errify'] ?? null);
|
|
341
|
+
return null === $hook ? self::errify($err) : $hook($err);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
public static function errmessage($err): string
|
|
345
|
+
{
|
|
346
|
+
return $err instanceof \Throwable ? $err->getMessage() : (string) $err;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/** The label of one entry, for failure messages. */
|
|
350
|
+
public static function entryref(array $flags, int $index, $entry): string
|
|
351
|
+
{
|
|
352
|
+
$label = $flags['name'] ?? 'set';
|
|
353
|
+
$entryid = (is_array($entry) && null !== ($entry['id'] ?? null))
|
|
354
|
+
? ' (' . $entry['id'] . ')' : '';
|
|
355
|
+
return $label . '[' . $index . ']' . $entryid;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
public static function fail(array $flags, int $index, $entry, string $reason, ?string $expected = null, ?string $actual = null): OmniError
|
|
359
|
+
{
|
|
360
|
+
$msg = 'omni: ' . self::entryref($flags, $index, $entry) . ': ' . $reason;
|
|
361
|
+
if (null !== $expected) {
|
|
362
|
+
$msg .= "\n expected: " . $expected;
|
|
363
|
+
}
|
|
364
|
+
if (null !== $actual) {
|
|
365
|
+
$msg .= "\n actual: " . $actual;
|
|
366
|
+
}
|
|
367
|
+
$msg .= "\n entry: " . Util::stringify(self::entrysummary($entry));
|
|
368
|
+
return new OmniError($msg, $entry);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/** The spec-defined part of an entry (drop runner bookkeeping). */
|
|
372
|
+
public static function entrysummary($entry)
|
|
373
|
+
{
|
|
374
|
+
if (!is_array($entry)) {
|
|
375
|
+
return $entry;
|
|
376
|
+
}
|
|
377
|
+
$out = [];
|
|
378
|
+
foreach ($entry as $key => $val) {
|
|
379
|
+
if (!in_array($key, ['res', 'thrown', 'ctx'], true)) {
|
|
380
|
+
$out[$key] = $val;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return $out;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
public static function checkresult(array $flags, int $index, array $entry, array $args, $res): void
|
|
387
|
+
{
|
|
388
|
+
$matched = false;
|
|
389
|
+
|
|
390
|
+
if (null !== ($entry['err'] ?? null)) {
|
|
391
|
+
throw self::fail(
|
|
392
|
+
$flags,
|
|
393
|
+
$index,
|
|
394
|
+
$entry,
|
|
395
|
+
'expected error did not occur',
|
|
396
|
+
Util::stringify($entry['err']),
|
|
397
|
+
Util::stringify($res)
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (null !== ($entry['match'] ?? null)) {
|
|
402
|
+
self::match($flags, $index, $entry, $entry['match'], [
|
|
403
|
+
'in' => $entry['in'] ?? null,
|
|
404
|
+
'args' => $args,
|
|
405
|
+
'out' => $entry['res'] ?? null,
|
|
406
|
+
'ctx' => $entry['ctx'] ?? null,
|
|
407
|
+
]);
|
|
408
|
+
$matched = true;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
$out = $entry['out'] ?? null;
|
|
412
|
+
|
|
413
|
+
if (Util::deepequal($res, $out)) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// NOTE: a match with no explicit out is a complete check on its own.
|
|
418
|
+
if ($matched && (Util::NULLMARK === $out || null === $out)) {
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
throw self::fail($flags, $index, $entry, 'result mismatch', Util::stringify($out), Util::stringify($res));
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
public static function handleerror(array $flags, int $index, array $entry, \Throwable $err, ?array $provider = null): void
|
|
426
|
+
{
|
|
427
|
+
$entryerr = $entry['err'] ?? null;
|
|
428
|
+
|
|
429
|
+
if (null !== $entryerr) {
|
|
430
|
+
if (true === $entryerr || self::matchval($entryerr, self::errmessage($err))) {
|
|
431
|
+
if (null !== ($entry['match'] ?? null)) {
|
|
432
|
+
self::match($flags, $index, $entry, $entry['match'], [
|
|
433
|
+
'in' => $entry['in'] ?? null,
|
|
434
|
+
'out' => $entry['res'] ?? null,
|
|
435
|
+
'ctx' => $entry['ctx'] ?? null,
|
|
436
|
+
'err' => self::errbase($err, $provider),
|
|
437
|
+
]);
|
|
438
|
+
}
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
throw self::fail($flags, $index, $entry, 'error mismatch', Util::stringify($entryerr), self::errmessage($err));
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
throw self::fail($flags, $index, $entry, 'unexpected error', null, self::errmessage($err));
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/** Check that every leaf of `check` is present, and matches, in `base`. */
|
|
449
|
+
public static function match(array $flags, int $index, array $entry, $check, $base): void
|
|
450
|
+
{
|
|
451
|
+
$cbase = Util::clone($base);
|
|
452
|
+
|
|
453
|
+
$at = function (array $path): string {
|
|
454
|
+
return 0 === count($path) ? '<root>' : Util::pathify($path);
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
Util::walk(Util::clone($check), function ($_key, $val, $_parent, $path) use ($flags, $index, $entry, $cbase, $at) {
|
|
458
|
+
// An empty container in the check is a structural placeholder:
|
|
459
|
+
// walk visits no leaves inside {} or [], so it asserts nothing
|
|
460
|
+
// about the base. (struct's corpus relies on this "map is here,
|
|
461
|
+
// contents unchecked" behaviour, so omni stays a faithful drop-in.)
|
|
462
|
+
if (!Util::isnode($val)) {
|
|
463
|
+
$baseval = Util::getpath($cbase, $path);
|
|
464
|
+
|
|
465
|
+
// The sentinels are tested BEFORE the identity check below.
|
|
466
|
+
// Otherwise a subject returning the literal string
|
|
467
|
+
// "__UNDEF__" satisfies an assertion that the key is absent
|
|
468
|
+
// - two mutually exclusive states passing one check. A
|
|
469
|
+
// sentinel that accepts its own literal is not a sentinel.
|
|
470
|
+
// (NULLMARK still accepts NULLMARK: under the default null
|
|
471
|
+
// flag a real null has already been normalised to it, so the
|
|
472
|
+
// two are genuinely indistinguishable here - that one needs a
|
|
473
|
+
// raw-value escape, not an ordering change.)
|
|
474
|
+
|
|
475
|
+
// Explicitly absent: satisfied only by a genuinely missing
|
|
476
|
+
// key, never by a present null (the distinction the
|
|
477
|
+
// sentinels exist to keep).
|
|
478
|
+
if (Util::UNDEFMARK === $val) {
|
|
479
|
+
if (Util::isabsent($baseval)) {
|
|
480
|
+
return $val;
|
|
481
|
+
}
|
|
482
|
+
throw self::fail($flags, $index, $entry, 'expected absent at ' . $at($path), 'absent', Util::stringify($baseval));
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// Explicitly null: satisfied only by a present null.
|
|
486
|
+
if (Util::NULLMARK === $val) {
|
|
487
|
+
if (null === $baseval || Util::NULLMARK === $baseval) {
|
|
488
|
+
return $val;
|
|
489
|
+
}
|
|
490
|
+
throw self::fail($flags, $index, $entry, 'expected null at ' . $at($path), 'null', Util::stringify($baseval));
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// Explicitly present: any present value, including null.
|
|
494
|
+
if (Util::EXISTSMARK === $val) {
|
|
495
|
+
if (!Util::isabsent($baseval)) {
|
|
496
|
+
return $val;
|
|
497
|
+
}
|
|
498
|
+
throw self::fail($flags, $index, $entry, 'expected present at ' . $at($path), 'present', 'absent');
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
// Identical values match. This sits below the sentinel
|
|
502
|
+
// branches on purpose - see the note above.
|
|
503
|
+
if ($baseval === $val) {
|
|
504
|
+
return $val;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// A concrete expectation never matches a missing key - a
|
|
508
|
+
// match leaf against an absent value must fail, not
|
|
509
|
+
// substring-match the stringified absent value.
|
|
510
|
+
if (Util::isabsent($baseval)) {
|
|
511
|
+
throw self::fail($flags, $index, $entry, 'match failed at ' . $at($path), Util::stringify($val), 'absent');
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
if (!self::matchval($val, $baseval)) {
|
|
515
|
+
throw self::fail($flags, $index, $entry, 'match failed at ' . $at($path), Util::stringify($val), Util::stringify($baseval));
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
return $val;
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/** Match one leaf: /regex/ or case-insensitive substring for strings. */
|
|
524
|
+
public static function matchval($check, $base): bool
|
|
525
|
+
{
|
|
526
|
+
if (Util::deepequal($check, $base)) {
|
|
527
|
+
return true;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
$want = $check;
|
|
531
|
+
if (Util::UNDEFMARK === $want || Util::NULLMARK === $want) {
|
|
532
|
+
$want = null;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
if (null === $want) {
|
|
536
|
+
return null === $base || Util::isabsent($base) || Util::NULLMARK === $base;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
if (is_string($want)) {
|
|
540
|
+
// An empty want is not a wildcard: the empty string is a substring
|
|
541
|
+
// of everything, so `match:{out:""}` (or `err:""`) would accept any
|
|
542
|
+
// value.
|
|
543
|
+
if ('' === $want) {
|
|
544
|
+
return '' === $base;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
$basestr = Util::stringify($base);
|
|
548
|
+
|
|
549
|
+
if (1 === preg_match('#^/(.+)/$#s', $want, $rem)) {
|
|
550
|
+
return 1 === preg_match('#' . str_replace('#', '\\#', $rem[1]) . '#', $basestr);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
return false !== stripos($basestr, $want);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
if (is_callable($want)) {
|
|
557
|
+
return true;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
return Util::deepequal($want, $base);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/** Convert NULLMARK sentinels back into real nulls. */
|
|
564
|
+
public static function nullmodifier($val, $key, &$parent): void
|
|
565
|
+
{
|
|
566
|
+
if (Util::NULLMARK === $val) {
|
|
567
|
+
$parent[$key] = null;
|
|
568
|
+
} elseif (is_string($val)) {
|
|
569
|
+
$parent[$key] = str_replace(Util::NULLMARK, 'null', $val);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Make a runner for a spec file (or spec value) and a provider.
|
|
575
|
+
*
|
|
576
|
+
* Returns a callable: (?string $name, $store) => array with keys
|
|
577
|
+
* spec, runset, runsetflags, subject, client.
|
|
578
|
+
*/
|
|
579
|
+
public static function makeRunner($specref, ?array $provider = null): callable
|
|
580
|
+
{
|
|
581
|
+
$alltests = self::loadspec($specref);
|
|
582
|
+
$specversion = self::resolveversion($alltests);
|
|
583
|
+
$useprovider = $provider ?? [];
|
|
584
|
+
|
|
585
|
+
return function (?string $name = null, $store = null) use ($alltests, $specversion, $useprovider): array {
|
|
586
|
+
$spec = self::resolvespec($name, $alltests);
|
|
587
|
+
$clients = self::resolveclients($useprovider, $spec, null === $store ? [] : $store);
|
|
588
|
+
$defsubject = self::resolvesubject($name, $useprovider);
|
|
589
|
+
|
|
590
|
+
$runsetflags = function ($testspec, ?array $flags, $testsubject = null) use ($name, $specversion, $useprovider, $clients, $defsubject): void {
|
|
591
|
+
$useflags = self::resolveflags($flags);
|
|
592
|
+
$useflags['name'] = $useflags['name'] ?? ($name ?? 'set');
|
|
593
|
+
|
|
594
|
+
$subject = $testsubject ?: $defsubject;
|
|
595
|
+
if (null === $subject) {
|
|
596
|
+
throw new OmniError('omni: no test subject for: ' . $useflags['name']);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
$testspecmap = self::fixjson($testspec, $useflags);
|
|
600
|
+
|
|
601
|
+
if (!Util::ismap($testspecmap) || !Util::islist($testspecmap['set'] ?? null)) {
|
|
602
|
+
throw new OmniError('omni: test spec has no set: ' . $useflags['name']);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
$testset = $testspecmap['set'];
|
|
606
|
+
|
|
607
|
+
if (1 <= $specversion) {
|
|
608
|
+
self::checkset($useflags, $testspec, $testset);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
foreach ($testset as $index => $entry) {
|
|
612
|
+
try {
|
|
613
|
+
$entry = self::resolveentry($entry, $useflags);
|
|
614
|
+
|
|
615
|
+
$testpack = self::resolvetestpack($name, $entry, $subject, $useprovider, $clients);
|
|
616
|
+
$args = self::resolveargs($entry, $testpack, $useprovider);
|
|
617
|
+
|
|
618
|
+
$res = ($testpack['subject'])(...$args);
|
|
619
|
+
$res = self::fixjson($res, $useflags);
|
|
620
|
+
$entry['res'] = $res;
|
|
621
|
+
|
|
622
|
+
self::checkresult($useflags, $index, $entry, $args, $res);
|
|
623
|
+
} catch (OmniError $omnierr) {
|
|
624
|
+
throw $omnierr;
|
|
625
|
+
} catch (\Throwable $err) {
|
|
626
|
+
self::handleerror($useflags, $index, $entry, $err, $useprovider);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
$runset = function ($testspec, $testsubject = null) use ($runsetflags): void {
|
|
632
|
+
$runsetflags($testspec, [], $testsubject);
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
return [
|
|
636
|
+
'spec' => $spec,
|
|
637
|
+
'runset' => $runset,
|
|
638
|
+
'runsetflags' => $runsetflags,
|
|
639
|
+
'subject' => $defsubject,
|
|
640
|
+
'client' => $useprovider,
|
|
641
|
+
];
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
}
|