@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
|
@@ -2,304 +2,95 @@
|
|
|
2
2
|
declare(strict_types=1);
|
|
3
3
|
|
|
4
4
|
// ProjectName SDK primary utility test
|
|
5
|
+
//
|
|
6
|
+
// Corpus sections run through the vendored omni runner, via the resolver
|
|
7
|
+
// in test/Omni.php (struct-runner shape over native Voxgig\Omni). The
|
|
8
|
+
// inline corpus engine this file used to carry is retired: omni resolves
|
|
9
|
+
// arguments, applies the null rules, and enforces out/err/match - the
|
|
10
|
+
// subjects below only adapt each utility's calling convention.
|
|
11
|
+
//
|
|
12
|
+
// Three conventions to know when adding a section:
|
|
13
|
+
//
|
|
14
|
+
// - Utilities that answer as a (value, err) TUPLE go through
|
|
15
|
+
// ProjectNameOmni::unwrap, which throws the err so omni can match it
|
|
16
|
+
// against `err:` expectations. Utilities that answer bare values (or
|
|
17
|
+
// throw) are returned straight.
|
|
18
|
+
//
|
|
19
|
+
// - Contexts stay MAPS across the runner (Omni.php decision 2): a subject
|
|
20
|
+
// builds the typed context with ProjectNameOmni::ctx_from_map, runs the
|
|
21
|
+
// utility, and writes the observable state back with
|
|
22
|
+
// ProjectNameOmni::sync_ctx BEFORE throwing any error - that map is
|
|
23
|
+
// where a `match: {ctx: ...}` assertion reads.
|
|
24
|
+
//
|
|
25
|
+
// - `runsection` fails loudly when a section would run ZERO cases; a
|
|
26
|
+
// deliberately-empty (pending) section is named in PENDING.
|
|
5
27
|
|
|
6
28
|
require_once __DIR__ . '/../projectname_sdk.php';
|
|
7
29
|
require_once __DIR__ . '/Runner.php';
|
|
30
|
+
require_once __DIR__ . '/Omni.php';
|
|
8
31
|
|
|
9
32
|
use PHPUnit\Framework\TestCase;
|
|
10
|
-
use Voxgig\Struct\Struct;
|
|
11
33
|
|
|
12
34
|
class PrimaryUtilityTest extends TestCase
|
|
13
35
|
{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
private
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
36
|
+
// Resolved against test/Omni.php's own directory, so the suite works
|
|
37
|
+
// from any working directory.
|
|
38
|
+
private const TEST_JSON_FILE = '../../.sdk/test/test.json';
|
|
39
|
+
|
|
40
|
+
// Sections deliberately left empty in the shared corpus
|
|
41
|
+
// (.sdk/test/primary/<name>.aon carries a PENDING header). Everything
|
|
42
|
+
// else MUST contribute cases.
|
|
43
|
+
private const PENDING = [
|
|
44
|
+
'fetcher', 'makeFetchDef', 'makeResult',
|
|
45
|
+
'featureAdd', 'featureHook', 'featureInit',
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
private static ?array $run = null;
|
|
49
|
+
|
|
50
|
+
/** The 'primary' runpack, built once for the whole class. */
|
|
51
|
+
private static function runpack(): array
|
|
52
|
+
{
|
|
53
|
+
if (self::$run === null) {
|
|
54
|
+
$runner = ProjectNameOmni::makeRunner(
|
|
55
|
+
self::TEST_JSON_FILE, ProjectNameSDK::test(null, null));
|
|
56
|
+
self::$run = $runner('primary');
|
|
25
57
|
}
|
|
26
|
-
|
|
27
|
-
if (json_last_error() !== JSON_ERROR_NONE) {
|
|
28
|
-
throw new RuntimeException("Failed to parse test.json: " . json_last_error_msg());
|
|
29
|
-
}
|
|
30
|
-
self::$test_spec = $data;
|
|
31
|
-
return $data;
|
|
58
|
+
return self::$run;
|
|
32
59
|
}
|
|
33
60
|
|
|
34
|
-
|
|
61
|
+
/** The live SDK behind the runpack's provider client. */
|
|
62
|
+
private static function client(): ProjectNameSDK
|
|
35
63
|
{
|
|
36
|
-
|
|
37
|
-
foreach ($keys as $key) {
|
|
38
|
-
if (!is_array($cur) || !array_key_exists($key, $cur)) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
$cur = $cur[$key];
|
|
42
|
-
}
|
|
43
|
-
return is_array($cur) ? $cur : null;
|
|
64
|
+
return self::runpack()['client']['sdk'];
|
|
44
65
|
}
|
|
45
66
|
|
|
46
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Run one corpus section, failing loudly when it would run ZERO
|
|
69
|
+
* cases. A renamed section or a fixture that compiled to an empty
|
|
70
|
+
* `set` used to pass silently, which defeats the point of a shared
|
|
71
|
+
* oracle. EVERY corpus-backed test goes through here (mirrors ts/py).
|
|
72
|
+
*/
|
|
73
|
+
private function runsection(string $name, callable $subject): void
|
|
47
74
|
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
$set = $testspec['set'];
|
|
52
|
-
|
|
53
|
-
foreach ($set as $i => $entry) {
|
|
54
|
-
if (!is_array($entry)) {
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
$mark = '';
|
|
59
|
-
if (isset($entry['mark'])) {
|
|
60
|
-
$mark = " (mark={$entry['mark']})";
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
$result = null;
|
|
64
|
-
$err = null;
|
|
65
|
-
|
|
66
|
-
try {
|
|
67
|
-
[$result, $err] = $subject($entry);
|
|
68
|
-
} catch (\Throwable $e) {
|
|
69
|
-
$err = $e;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
$expected_err = $entry['err'] ?? null;
|
|
73
|
-
|
|
74
|
-
if ($err !== null) {
|
|
75
|
-
if ($expected_err !== null) {
|
|
76
|
-
$err_msg = ($err instanceof \Throwable) ? $err->getMessage() : (string)$err;
|
|
77
|
-
if (is_string($expected_err)) {
|
|
78
|
-
$this->assertTrue(
|
|
79
|
-
$this->match_string($expected_err, $err_msg),
|
|
80
|
-
"entry {$i}{$mark}: error mismatch: got \"{$err_msg}\", want contains \"{$expected_err}\""
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
// err: true means any error is acceptable
|
|
84
|
-
|
|
85
|
-
if (isset($entry['match']) && is_array($entry['match'])) {
|
|
86
|
-
$result_map = [
|
|
87
|
-
'in' => $entry['in'] ?? null,
|
|
88
|
-
'out' => $this->json_normalize($result),
|
|
89
|
-
'err' => ['message' => ($err instanceof \Throwable) ? $err->getMessage() : (string)$err],
|
|
90
|
-
];
|
|
91
|
-
$this->match_deep($i, $mark, $entry['match'], $result_map, '');
|
|
92
|
-
}
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
$err_msg = ($err instanceof \Throwable) ? $err->getMessage() : (string)$err;
|
|
96
|
-
$this->fail("entry {$i}{$mark}: unexpected error: {$err_msg}");
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if ($expected_err !== null) {
|
|
101
|
-
$this->fail(
|
|
102
|
-
"entry {$i}{$mark}: expected error containing \"{$expected_err}\" but got result: "
|
|
103
|
-
. json_encode($result)
|
|
104
|
-
);
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
$matched = false;
|
|
109
|
-
if (isset($entry['match']) && is_array($entry['match'])) {
|
|
110
|
-
$result_map = [
|
|
111
|
-
'in' => $entry['in'] ?? null,
|
|
112
|
-
'out' => $this->json_normalize($result),
|
|
113
|
-
];
|
|
114
|
-
if (isset($entry['args'])) {
|
|
115
|
-
$result_map['args'] = $entry['args'];
|
|
116
|
-
} elseif (isset($entry['in'])) {
|
|
117
|
-
$result_map['args'] = [$entry['in']];
|
|
118
|
-
}
|
|
119
|
-
if (isset($entry['ctx'])) {
|
|
120
|
-
$result_map['ctx'] = $entry['ctx'];
|
|
121
|
-
}
|
|
122
|
-
$this->match_deep($i, $mark, $entry['match'], $result_map, '');
|
|
123
|
-
$this->assertTrue(true, "entry {$i}{$mark}: match completed");
|
|
124
|
-
$matched = true;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
$expected_out = $entry['out'] ?? null;
|
|
128
|
-
if ($expected_out === null && $matched) {
|
|
129
|
-
continue;
|
|
130
|
-
}
|
|
131
|
-
if ($expected_out !== null) {
|
|
132
|
-
$norm_result = $this->json_normalize($result);
|
|
133
|
-
$norm_expected = $this->json_normalize($expected_out);
|
|
134
|
-
$this->assertEquals(
|
|
135
|
-
$norm_expected,
|
|
136
|
-
$norm_result,
|
|
137
|
-
"entry {$i}{$mark}: output mismatch"
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
private function json_normalize(mixed $val): mixed
|
|
144
|
-
{
|
|
145
|
-
if ($val === null) {
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
148
|
-
$j = json_encode($val);
|
|
149
|
-
if ($j === false) {
|
|
150
|
-
return $val;
|
|
151
|
-
}
|
|
152
|
-
return json_decode($j, true);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
private function match_deep(int $entry_idx, string $mark, mixed $check, mixed $base, string $path): void
|
|
156
|
-
{
|
|
157
|
-
if ($check === null) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
75
|
+
$R = self::runpack();
|
|
76
|
+
$spec = $R['spec'];
|
|
160
77
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
$child_path = $path . '.' . $key;
|
|
165
|
-
$base_val = null;
|
|
166
|
-
if (is_array($base) && array_key_exists($key, $base)) {
|
|
167
|
-
$base_val = $base[$key];
|
|
168
|
-
}
|
|
169
|
-
$this->match_deep($entry_idx, $mark, $check_val, $base_val, $child_path);
|
|
170
|
-
}
|
|
171
|
-
} elseif (is_array($check) && $this->is_list($check)) {
|
|
172
|
-
// Indexed array (list)
|
|
173
|
-
foreach ($check as $i => $check_val) {
|
|
174
|
-
$child_path = $path . "[{$i}]";
|
|
175
|
-
$base_val = null;
|
|
176
|
-
if (is_array($base) && isset($base[$i])) {
|
|
177
|
-
$base_val = $base[$i];
|
|
178
|
-
}
|
|
179
|
-
$this->match_deep($entry_idx, $mark, $check_val, $base_val, $child_path);
|
|
180
|
-
}
|
|
181
|
-
} else {
|
|
182
|
-
if (is_string($check) && $check === '__EXISTS__') {
|
|
183
|
-
$this->assertNotNull(
|
|
184
|
-
$base,
|
|
185
|
-
"entry {$entry_idx}{$mark}: match {$path}: expected value to exist but got null"
|
|
186
|
-
);
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
if (is_string($check) && $check === '__UNDEF__') {
|
|
190
|
-
$this->assertNull(
|
|
191
|
-
$base,
|
|
192
|
-
"entry {$entry_idx}{$mark}: match {$path}: expected null but got " . json_encode($base)
|
|
193
|
-
);
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
$norm_check = $this->json_normalize($check);
|
|
198
|
-
$norm_base = $this->json_normalize($base);
|
|
199
|
-
|
|
200
|
-
if ($norm_check !== $norm_base) {
|
|
201
|
-
if (is_string($check) && $check !== '') {
|
|
202
|
-
$base_str = Struct::stringify($base);
|
|
203
|
-
if ($this->match_string($check, $base_str)) {
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
$this->assertEquals(
|
|
208
|
-
$norm_check,
|
|
209
|
-
$norm_base,
|
|
210
|
-
"entry {$entry_idx}{$mark}: match {$path}"
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
private function match_string(string $pattern, string $val): bool
|
|
217
|
-
{
|
|
218
|
-
if (strlen($pattern) >= 2 && $pattern[0] === '/' && $pattern[strlen($pattern) - 1] === '/') {
|
|
219
|
-
$re = substr($pattern, 1, -1);
|
|
220
|
-
return (bool)preg_match('/' . $re . '/', $val);
|
|
221
|
-
}
|
|
222
|
-
return str_contains(strtolower($val), strtolower($pattern));
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
private function is_list(array $arr): bool
|
|
226
|
-
{
|
|
227
|
-
if (empty($arr)) {
|
|
228
|
-
return true;
|
|
229
|
-
}
|
|
230
|
-
return array_keys($arr) === range(0, count($arr) - 1);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
private static function make_ctx_from_map(
|
|
234
|
-
?array $ctxmap,
|
|
235
|
-
ProjectNameSDK $client,
|
|
236
|
-
ProjectNameUtility $utility
|
|
237
|
-
): ProjectNameContext {
|
|
238
|
-
if ($ctxmap === null) {
|
|
239
|
-
$ctxmap = [];
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
$ctx = new ProjectNameContext($ctxmap, null);
|
|
243
|
-
|
|
244
|
-
$ctx->client = $client;
|
|
245
|
-
$ctx->utility = $utility;
|
|
246
|
-
|
|
247
|
-
if ($ctx->options === null) {
|
|
248
|
-
$ctx->options = $client->options_map();
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// Handle spec from JSON map
|
|
252
|
-
if (isset($ctxmap['spec']) && is_array($ctxmap['spec'])) {
|
|
253
|
-
$ctx->spec = new ProjectNameSpec($ctxmap['spec']);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// Handle result from JSON map
|
|
257
|
-
if (isset($ctxmap['result']) && is_array($ctxmap['result'])) {
|
|
258
|
-
$ctx->result = new ProjectNameResult($ctxmap['result']);
|
|
259
|
-
if (isset($ctxmap['result']['err']) && is_array($ctxmap['result']['err'])) {
|
|
260
|
-
$msg = $ctxmap['result']['err']['message'] ?? '';
|
|
261
|
-
$ctx->result->err = new ProjectNameError('', $msg);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// Handle response from JSON map
|
|
266
|
-
if (isset($ctxmap['response']) && is_array($ctxmap['response'])) {
|
|
267
|
-
$ctx->response = new ProjectNameResponse($ctxmap['response']);
|
|
268
|
-
if (isset($ctxmap['response']['body'])) {
|
|
269
|
-
$body_copy = $ctxmap['response']['body'];
|
|
270
|
-
$ctx->response->json_func = function () use ($body_copy) { return $body_copy; };
|
|
271
|
-
$ctx->response->body = $body_copy;
|
|
272
|
-
}
|
|
273
|
-
if (isset($ctxmap['response']['headers']) && is_array($ctxmap['response']['headers'])) {
|
|
274
|
-
$lower_headers = [];
|
|
275
|
-
foreach ($ctxmap['response']['headers'] as $k => $v) {
|
|
276
|
-
$lower_headers[strtolower($k)] = $v;
|
|
277
|
-
}
|
|
278
|
-
$ctx->response->headers = $lower_headers;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
78
|
+
$section = is_array($spec) ? ($spec[$name] ?? null) : null;
|
|
79
|
+
$this->assertIsArray($section,
|
|
80
|
+
"test corpus section '{$name}' missing - check the name against .sdk/test/primary/");
|
|
281
81
|
|
|
282
|
-
|
|
283
|
-
|
|
82
|
+
$basic = $section['basic'] ?? null;
|
|
83
|
+
$this->assertTrue(is_array($basic) && is_array($basic['set'] ?? null),
|
|
84
|
+
"test corpus section '{$name}' has no basic.set list");
|
|
284
85
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
86
|
+
if (0 === count($basic['set']) && !in_array($name, self::PENDING, true)) {
|
|
87
|
+
$this->fail(
|
|
88
|
+
"test corpus section '{$name}' is EMPTY - zero cases would run; " .
|
|
89
|
+
"add cases, or mark the fixture PENDING in .sdk/test/primary/");
|
|
289
90
|
}
|
|
290
|
-
}
|
|
291
91
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
if ($m === null) {
|
|
295
|
-
return null;
|
|
296
|
-
}
|
|
297
|
-
$msg = $m['message'] ?? '';
|
|
298
|
-
if ($msg === '') {
|
|
299
|
-
return null;
|
|
300
|
-
}
|
|
301
|
-
$code = $m['code'] ?? '';
|
|
302
|
-
return new ProjectNameError($code, $msg);
|
|
92
|
+
$R['runset']($basic, $subject);
|
|
93
|
+
$this->assertTrue(true, "corpus section '{$name}' completed");
|
|
303
94
|
}
|
|
304
95
|
|
|
305
96
|
private static function make_test_ctx(
|
|
@@ -396,20 +187,14 @@ class PrimaryUtilityTest extends TestCase
|
|
|
396
187
|
|
|
397
188
|
public function test_done_basic(): void
|
|
398
189
|
{
|
|
399
|
-
$
|
|
400
|
-
$primary = self::get_spec($spec, 'primary');
|
|
401
|
-
$client = ProjectNameSDK::test(null, null);
|
|
190
|
+
$client = self::client();
|
|
402
191
|
$utility = $client->get_utility();
|
|
403
192
|
|
|
404
|
-
$this->
|
|
405
|
-
$
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
// runset catches). Re-wrap success into a (result, err) tuple so the
|
|
410
|
-
// data-driven spec matcher keeps working.
|
|
411
|
-
$out = ($utility->done)($ctx);
|
|
412
|
-
return [$out, null];
|
|
193
|
+
$this->runsection('done', function (array $ctxmap) use ($client, $utility) {
|
|
194
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $client, $utility);
|
|
195
|
+
// done returns the bare result data, or raises on error - which
|
|
196
|
+
// omni matches against the entry's `err`.
|
|
197
|
+
return ($utility->done)($ctx);
|
|
413
198
|
});
|
|
414
199
|
}
|
|
415
200
|
|
|
@@ -418,34 +203,17 @@ class PrimaryUtilityTest extends TestCase
|
|
|
418
203
|
|
|
419
204
|
public function test_make_error_basic(): void
|
|
420
205
|
{
|
|
421
|
-
$
|
|
422
|
-
$primary = self::get_spec($spec, 'primary');
|
|
423
|
-
$client = ProjectNameSDK::test(null, null);
|
|
206
|
+
$client = self::client();
|
|
424
207
|
$utility = $client->get_utility();
|
|
425
208
|
|
|
426
|
-
$this->
|
|
427
|
-
$
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
$ctxmap = [];
|
|
435
|
-
}
|
|
436
|
-
$ctx = self::make_ctx_from_map($ctxmap, $client, $utility);
|
|
437
|
-
self::fixctx($ctx, $client);
|
|
438
|
-
|
|
439
|
-
$err = null;
|
|
440
|
-
if (count($args) > 1 && is_array($args[1])) {
|
|
441
|
-
$err = self::err_from_map($args[1]);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
// make_error now RAISES the constructed exception (default throw
|
|
445
|
-
// path); runset catches it. On the no-throw path it returns the
|
|
446
|
-
// bare result data, which we re-wrap into a (result, err) tuple.
|
|
447
|
-
$out = ($utility->make_error)($ctx, $err);
|
|
448
|
-
return [$out, null];
|
|
209
|
+
$this->runsection('makeError', function ($ctxmap = null, $errmap = null) use ($client, $utility) {
|
|
210
|
+
$ctx = ProjectNameOmni::ctx_from_map(
|
|
211
|
+
is_array($ctxmap) ? $ctxmap : [], $client, $utility);
|
|
212
|
+
$err = ProjectNameOmni::err_from_map(is_array($errmap) ? $errmap : null);
|
|
213
|
+
// make_error RAISES the constructed exception on the default
|
|
214
|
+
// (throw) path; omni matches it against the entry's err. On the
|
|
215
|
+
// no-throw path it returns the bare result data.
|
|
216
|
+
return ($utility->make_error)($ctx, $err);
|
|
449
217
|
});
|
|
450
218
|
}
|
|
451
219
|
|
|
@@ -649,27 +417,23 @@ class PrimaryUtilityTest extends TestCase
|
|
|
649
417
|
|
|
650
418
|
public function test_make_context_basic(): void
|
|
651
419
|
{
|
|
652
|
-
$
|
|
653
|
-
$primary = self::get_spec($spec, 'primary');
|
|
654
|
-
$client = ProjectNameSDK::test(null, null);
|
|
655
|
-
$utility = $client->get_utility();
|
|
420
|
+
$utility = self::client()->get_utility();
|
|
656
421
|
|
|
657
|
-
$this->
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
422
|
+
$this->runsection('makeContext', function ($vin = null) use ($utility) {
|
|
423
|
+
if (!is_array($vin)) {
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
426
|
+
$ctx = ($utility->make_context)($vin, null);
|
|
427
|
+
$out = [
|
|
428
|
+
'id' => $ctx->id,
|
|
429
|
+
];
|
|
430
|
+
if ($ctx->op !== null) {
|
|
431
|
+
$out['op'] = [
|
|
432
|
+
'name' => $ctx->op->name,
|
|
433
|
+
'input' => $ctx->op->input,
|
|
663
434
|
];
|
|
664
|
-
if ($ctx->op !== null) {
|
|
665
|
-
$out['op'] = [
|
|
666
|
-
'name' => $ctx->op->name,
|
|
667
|
-
'input' => $ctx->op->input,
|
|
668
|
-
];
|
|
669
|
-
}
|
|
670
|
-
return [$out, null];
|
|
671
435
|
}
|
|
672
|
-
return
|
|
436
|
+
return $out;
|
|
673
437
|
});
|
|
674
438
|
}
|
|
675
439
|
|
|
@@ -740,20 +504,20 @@ class PrimaryUtilityTest extends TestCase
|
|
|
740
504
|
|
|
741
505
|
public function test_make_options_basic(): void
|
|
742
506
|
{
|
|
743
|
-
$
|
|
744
|
-
$primary = self::get_spec($spec, 'primary');
|
|
745
|
-
$client = ProjectNameSDK::test(null, null);
|
|
507
|
+
$client = self::client();
|
|
746
508
|
$utility = $client->get_utility();
|
|
747
509
|
|
|
748
|
-
$this->
|
|
749
|
-
|
|
510
|
+
$this->runsection('makeOptions', function ($vin = null) use ($client, $utility) {
|
|
511
|
+
if (!is_array($vin)) {
|
|
512
|
+
$vin = [];
|
|
513
|
+
}
|
|
750
514
|
$ctx = ($utility->make_context)([
|
|
751
|
-
'options' => $
|
|
752
|
-
'config' => $
|
|
515
|
+
'options' => $vin['options'] ?? null,
|
|
516
|
+
'config' => $vin['config'] ?? null,
|
|
753
517
|
], null);
|
|
754
518
|
$ctx->client = $client;
|
|
755
519
|
$ctx->utility = $utility;
|
|
756
|
-
return
|
|
520
|
+
return ($utility->make_options)($ctx);
|
|
757
521
|
});
|
|
758
522
|
}
|
|
759
523
|
|
|
@@ -762,27 +526,20 @@ class PrimaryUtilityTest extends TestCase
|
|
|
762
526
|
|
|
763
527
|
public function test_make_request_basic(): void
|
|
764
528
|
{
|
|
765
|
-
$
|
|
766
|
-
$primary = self::get_spec($spec, 'primary');
|
|
767
|
-
$client = ProjectNameSDK::test(null, null);
|
|
529
|
+
$client = self::client();
|
|
768
530
|
$utility = $client->get_utility();
|
|
769
531
|
|
|
770
|
-
$this->
|
|
771
|
-
$
|
|
772
|
-
$ctx = self::make_ctx_from_map($ctxmap, $client, $utility);
|
|
532
|
+
$this->runsection('makeRequest', function (array $ctxmap) use ($client, $utility) {
|
|
533
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $client, $utility);
|
|
773
534
|
$ctx->options = $client->options_map();
|
|
774
535
|
|
|
775
536
|
[$_, $err] = ($utility->make_request)($ctx);
|
|
776
537
|
|
|
777
|
-
|
|
778
|
-
if ($
|
|
779
|
-
$
|
|
780
|
-
}
|
|
781
|
-
if ($ctx->result !== null) {
|
|
782
|
-
$entry['ctx']['result'] = 'exists';
|
|
538
|
+
ProjectNameOmni::sync_ctx($ctxmap, $ctx);
|
|
539
|
+
if ($err !== null) {
|
|
540
|
+
throw $err;
|
|
783
541
|
}
|
|
784
|
-
|
|
785
|
-
return [null, $err];
|
|
542
|
+
return null;
|
|
786
543
|
});
|
|
787
544
|
}
|
|
788
545
|
|
|
@@ -791,30 +548,19 @@ class PrimaryUtilityTest extends TestCase
|
|
|
791
548
|
|
|
792
549
|
public function test_make_response_basic(): void
|
|
793
550
|
{
|
|
794
|
-
$
|
|
795
|
-
$primary = self::get_spec($spec, 'primary');
|
|
796
|
-
$client = ProjectNameSDK::test(null, null);
|
|
551
|
+
$client = self::client();
|
|
797
552
|
$utility = $client->get_utility();
|
|
798
553
|
|
|
799
|
-
$this->
|
|
800
|
-
$
|
|
801
|
-
$ctx = self::make_ctx_from_map($ctxmap, $client, $utility);
|
|
802
|
-
self::fixctx($ctx, $client);
|
|
554
|
+
$this->runsection('makeResponse', function (array $ctxmap) use ($client, $utility) {
|
|
555
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $client, $utility);
|
|
803
556
|
|
|
804
557
|
[$_, $err] = ($utility->make_response)($ctx);
|
|
805
558
|
|
|
806
|
-
|
|
807
|
-
if ($
|
|
808
|
-
$
|
|
809
|
-
'ok' => $ctx->result->ok,
|
|
810
|
-
'status' => $ctx->result->status,
|
|
811
|
-
'statusText' => $ctx->result->status_text,
|
|
812
|
-
'headers' => $ctx->result->headers,
|
|
813
|
-
'body' => $ctx->result->body,
|
|
814
|
-
];
|
|
559
|
+
ProjectNameOmni::sync_ctx($ctxmap, $ctx);
|
|
560
|
+
if ($err !== null) {
|
|
561
|
+
throw $err;
|
|
815
562
|
}
|
|
816
|
-
|
|
817
|
-
return [null, $err];
|
|
563
|
+
return null;
|
|
818
564
|
});
|
|
819
565
|
}
|
|
820
566
|
|
|
@@ -891,36 +637,23 @@ class PrimaryUtilityTest extends TestCase
|
|
|
891
637
|
|
|
892
638
|
public function test_make_spec_basic(): void
|
|
893
639
|
{
|
|
894
|
-
$
|
|
895
|
-
$
|
|
896
|
-
$
|
|
897
|
-
$spec_client = ProjectNameSDK::test(null, $setup_opts);
|
|
640
|
+
$R = self::runpack();
|
|
641
|
+
$setup = $R['spec']['makeSpec']['DEF']['setup']['a'] ?? null;
|
|
642
|
+
$spec_client = ProjectNameSDK::test(null, is_array($setup) ? $setup : null);
|
|
898
643
|
$spec_utility = $spec_client->get_utility();
|
|
899
|
-
$
|
|
900
|
-
$utility = $client->get_utility();
|
|
644
|
+
$utility = self::client()->get_utility();
|
|
901
645
|
|
|
902
|
-
$this->
|
|
903
|
-
$
|
|
904
|
-
$ctx = self::make_ctx_from_map($ctxmap, $spec_client, $spec_utility);
|
|
646
|
+
$this->runsection('makeSpec', function (array $ctxmap) use ($spec_client, $spec_utility, $utility) {
|
|
647
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $spec_client, $spec_utility);
|
|
905
648
|
$ctx->options = $spec_client->options_map();
|
|
906
649
|
|
|
907
650
|
[$_, $err] = ($utility->make_spec)($ctx);
|
|
908
651
|
|
|
909
|
-
|
|
910
|
-
if ($
|
|
911
|
-
$
|
|
912
|
-
'base' => $ctx->spec->base,
|
|
913
|
-
'prefix' => $ctx->spec->prefix,
|
|
914
|
-
'suffix' => $ctx->spec->suffix,
|
|
915
|
-
'method' => $ctx->spec->method,
|
|
916
|
-
'params' => $ctx->spec->params,
|
|
917
|
-
'query' => $ctx->spec->query,
|
|
918
|
-
'headers' => $ctx->spec->headers,
|
|
919
|
-
'step' => $ctx->spec->step,
|
|
920
|
-
];
|
|
652
|
+
ProjectNameOmni::sync_ctx($ctxmap, $ctx);
|
|
653
|
+
if ($err !== null) {
|
|
654
|
+
throw $err;
|
|
921
655
|
}
|
|
922
|
-
|
|
923
|
-
return [null, $err];
|
|
656
|
+
return null;
|
|
924
657
|
});
|
|
925
658
|
}
|
|
926
659
|
|
|
@@ -953,18 +686,15 @@ class PrimaryUtilityTest extends TestCase
|
|
|
953
686
|
|
|
954
687
|
public function test_make_url_basic(): void
|
|
955
688
|
{
|
|
956
|
-
$
|
|
957
|
-
$primary = self::get_spec($spec, 'primary');
|
|
958
|
-
$client = ProjectNameSDK::test(null, null);
|
|
689
|
+
$client = self::client();
|
|
959
690
|
$utility = $client->get_utility();
|
|
960
691
|
|
|
961
|
-
$this->
|
|
962
|
-
$
|
|
963
|
-
$ctx = self::make_ctx_from_map($ctxmap, $client, $utility);
|
|
692
|
+
$this->runsection('makeUrl', function (array $ctxmap) use ($client, $utility) {
|
|
693
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $client, $utility);
|
|
964
694
|
if ($ctx->result === null) {
|
|
965
695
|
$ctx->result = new ProjectNameResult([]);
|
|
966
696
|
}
|
|
967
|
-
return ($utility->make_url)($ctx);
|
|
697
|
+
return ProjectNameOmni::unwrap(($utility->make_url)($ctx));
|
|
968
698
|
});
|
|
969
699
|
}
|
|
970
700
|
|
|
@@ -973,18 +703,17 @@ class PrimaryUtilityTest extends TestCase
|
|
|
973
703
|
|
|
974
704
|
public function test_operator_basic(): void
|
|
975
705
|
{
|
|
976
|
-
$
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
$
|
|
981
|
-
|
|
982
|
-
return [[
|
|
706
|
+
$this->runsection('operator', function ($vin = null) {
|
|
707
|
+
if (!is_array($vin)) {
|
|
708
|
+
$vin = [];
|
|
709
|
+
}
|
|
710
|
+
$op = new ProjectNameOperation($vin);
|
|
711
|
+
return [
|
|
983
712
|
'entity' => $op->entity,
|
|
984
713
|
'name' => $op->name,
|
|
985
714
|
'input' => $op->input,
|
|
986
715
|
'points' => $op->points,
|
|
987
|
-
]
|
|
716
|
+
];
|
|
988
717
|
});
|
|
989
718
|
}
|
|
990
719
|
|
|
@@ -993,46 +722,19 @@ class PrimaryUtilityTest extends TestCase
|
|
|
993
722
|
|
|
994
723
|
public function test_param_basic(): void
|
|
995
724
|
{
|
|
996
|
-
$
|
|
997
|
-
$primary = self::get_spec($spec, 'primary');
|
|
998
|
-
$client = ProjectNameSDK::test(null, null);
|
|
725
|
+
$client = self::client();
|
|
999
726
|
$utility = $client->get_utility();
|
|
1000
727
|
|
|
1001
|
-
$this->
|
|
1002
|
-
$
|
|
1003
|
-
|
|
1004
|
-
return [null, null];
|
|
1005
|
-
}
|
|
728
|
+
$this->runsection('param', function ($ctxmap = null, $name = null) use ($client, $utility) {
|
|
729
|
+
$ctx = ProjectNameOmni::ctx_from_map(
|
|
730
|
+
is_array($ctxmap) ? $ctxmap : [], $client, $utility);
|
|
1006
731
|
|
|
1007
|
-
$
|
|
1008
|
-
if (!is_array($ctxmap)) {
|
|
1009
|
-
$ctxmap = [];
|
|
1010
|
-
}
|
|
1011
|
-
$ctx = self::make_ctx_from_map($ctxmap, $client, $utility);
|
|
1012
|
-
$paramdef = $args[1];
|
|
1013
|
-
|
|
1014
|
-
$result = ($utility->param)($ctx, $paramdef);
|
|
1015
|
-
|
|
1016
|
-
// Update entry ctx for match
|
|
1017
|
-
if (isset($entry['match']) && is_array($entry['match'])) {
|
|
1018
|
-
if (isset($entry['match']['ctx']) && is_array($entry['match']['ctx'])) {
|
|
1019
|
-
$ctx_match = $entry['match']['ctx'];
|
|
1020
|
-
if (!isset($entry['ctx'])) {
|
|
1021
|
-
$entry['ctx'] = [];
|
|
1022
|
-
}
|
|
1023
|
-
if (isset($ctx_match['spec']) && is_array($ctx_match['spec'])) {
|
|
1024
|
-
if ($ctx->spec !== null) {
|
|
1025
|
-
if (isset($ctx_match['spec']['alias'])) {
|
|
1026
|
-
$entry['ctx']['spec'] = [
|
|
1027
|
-
'alias' => $ctx->spec->alias_map,
|
|
1028
|
-
];
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
732
|
+
$result = ($utility->param)($ctx, $name);
|
|
1034
733
|
|
|
1035
|
-
|
|
734
|
+
if (is_array($ctxmap)) {
|
|
735
|
+
ProjectNameOmni::sync_ctx($ctxmap, $ctx);
|
|
736
|
+
}
|
|
737
|
+
return $result;
|
|
1036
738
|
});
|
|
1037
739
|
}
|
|
1038
740
|
|
|
@@ -1041,29 +743,22 @@ class PrimaryUtilityTest extends TestCase
|
|
|
1041
743
|
|
|
1042
744
|
public function test_prepare_auth_basic(): void
|
|
1043
745
|
{
|
|
1044
|
-
$
|
|
1045
|
-
$
|
|
1046
|
-
$
|
|
1047
|
-
$auth_client = ProjectNameSDK::test(null, $setup_opts);
|
|
746
|
+
$R = self::runpack();
|
|
747
|
+
$setup = $R['spec']['prepareAuth']['DEF']['setup']['a'] ?? null;
|
|
748
|
+
$auth_client = ProjectNameSDK::test(null, is_array($setup) ? $setup : null);
|
|
1048
749
|
$auth_utility = $auth_client->get_utility();
|
|
1049
|
-
$
|
|
1050
|
-
$utility = $client->get_utility();
|
|
750
|
+
$utility = self::client()->get_utility();
|
|
1051
751
|
|
|
1052
|
-
$this->
|
|
1053
|
-
$
|
|
1054
|
-
$ctx = self::make_ctx_from_map($ctxmap, $auth_client, $auth_utility);
|
|
1055
|
-
self::fixctx($ctx, $auth_client);
|
|
752
|
+
$this->runsection('prepareAuth', function (array $ctxmap) use ($auth_client, $auth_utility, $utility) {
|
|
753
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $auth_client, $auth_utility);
|
|
1056
754
|
|
|
1057
755
|
[$_, $err] = ($utility->prepare_auth)($ctx);
|
|
1058
756
|
|
|
1059
|
-
|
|
1060
|
-
if ($
|
|
1061
|
-
$
|
|
1062
|
-
'headers' => $ctx->spec->headers,
|
|
1063
|
-
];
|
|
757
|
+
ProjectNameOmni::sync_ctx($ctxmap, $ctx);
|
|
758
|
+
if ($err !== null) {
|
|
759
|
+
throw $err;
|
|
1064
760
|
}
|
|
1065
|
-
|
|
1066
|
-
return [null, $err];
|
|
761
|
+
return null;
|
|
1067
762
|
});
|
|
1068
763
|
}
|
|
1069
764
|
|
|
@@ -1072,16 +767,12 @@ class PrimaryUtilityTest extends TestCase
|
|
|
1072
767
|
|
|
1073
768
|
public function test_prepare_body_basic(): void
|
|
1074
769
|
{
|
|
1075
|
-
$
|
|
1076
|
-
$primary = self::get_spec($spec, 'primary');
|
|
1077
|
-
$client = ProjectNameSDK::test(null, null);
|
|
770
|
+
$client = self::client();
|
|
1078
771
|
$utility = $client->get_utility();
|
|
1079
772
|
|
|
1080
|
-
$this->
|
|
1081
|
-
$
|
|
1082
|
-
|
|
1083
|
-
self::fixctx($ctx, $client);
|
|
1084
|
-
return [($utility->prepare_body)($ctx), null];
|
|
773
|
+
$this->runsection('prepareBody', function (array $ctxmap) use ($client, $utility) {
|
|
774
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $client, $utility);
|
|
775
|
+
return ($utility->prepare_body)($ctx);
|
|
1085
776
|
});
|
|
1086
777
|
}
|
|
1087
778
|
|
|
@@ -1090,15 +781,12 @@ class PrimaryUtilityTest extends TestCase
|
|
|
1090
781
|
|
|
1091
782
|
public function test_prepare_headers_basic(): void
|
|
1092
783
|
{
|
|
1093
|
-
$
|
|
1094
|
-
$primary = self::get_spec($spec, 'primary');
|
|
1095
|
-
$client = ProjectNameSDK::test(null, null);
|
|
784
|
+
$client = self::client();
|
|
1096
785
|
$utility = $client->get_utility();
|
|
1097
786
|
|
|
1098
|
-
$this->
|
|
1099
|
-
$
|
|
1100
|
-
|
|
1101
|
-
return [($utility->prepare_headers)($ctx), null];
|
|
787
|
+
$this->runsection('prepareHeaders', function (array $ctxmap) use ($client, $utility) {
|
|
788
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $client, $utility);
|
|
789
|
+
return ($utility->prepare_headers)($ctx);
|
|
1102
790
|
});
|
|
1103
791
|
}
|
|
1104
792
|
|
|
@@ -1107,15 +795,12 @@ class PrimaryUtilityTest extends TestCase
|
|
|
1107
795
|
|
|
1108
796
|
public function test_prepare_method_basic(): void
|
|
1109
797
|
{
|
|
1110
|
-
$
|
|
1111
|
-
$primary = self::get_spec($spec, 'primary');
|
|
1112
|
-
$client = ProjectNameSDK::test(null, null);
|
|
798
|
+
$client = self::client();
|
|
1113
799
|
$utility = $client->get_utility();
|
|
1114
800
|
|
|
1115
|
-
$this->
|
|
1116
|
-
$
|
|
1117
|
-
|
|
1118
|
-
return [($utility->prepare_method)($ctx), null];
|
|
801
|
+
$this->runsection('prepareMethod', function (array $ctxmap) use ($client, $utility) {
|
|
802
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $client, $utility);
|
|
803
|
+
return ($utility->prepare_method)($ctx);
|
|
1119
804
|
});
|
|
1120
805
|
}
|
|
1121
806
|
|
|
@@ -1124,15 +809,12 @@ class PrimaryUtilityTest extends TestCase
|
|
|
1124
809
|
|
|
1125
810
|
public function test_prepare_params_basic(): void
|
|
1126
811
|
{
|
|
1127
|
-
$
|
|
1128
|
-
$primary = self::get_spec($spec, 'primary');
|
|
1129
|
-
$client = ProjectNameSDK::test(null, null);
|
|
812
|
+
$client = self::client();
|
|
1130
813
|
$utility = $client->get_utility();
|
|
1131
814
|
|
|
1132
|
-
$this->
|
|
1133
|
-
$
|
|
1134
|
-
|
|
1135
|
-
return [($utility->prepare_params)($ctx), null];
|
|
815
|
+
$this->runsection('prepareParams', function (array $ctxmap) use ($client, $utility) {
|
|
816
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $client, $utility);
|
|
817
|
+
return ($utility->prepare_params)($ctx);
|
|
1136
818
|
});
|
|
1137
819
|
}
|
|
1138
820
|
|
|
@@ -1141,17 +823,12 @@ class PrimaryUtilityTest extends TestCase
|
|
|
1141
823
|
|
|
1142
824
|
public function test_prepare_path_basic(): void
|
|
1143
825
|
{
|
|
1144
|
-
|
|
1145
|
-
// (the preparePath fixture shipped as an empty `set: []`).
|
|
1146
|
-
$spec = self::load_test_spec();
|
|
1147
|
-
$primary = self::get_spec($spec, 'primary');
|
|
1148
|
-
$client = ProjectNameSDK::test(null, null);
|
|
826
|
+
$client = self::client();
|
|
1149
827
|
$utility = $client->get_utility();
|
|
1150
828
|
|
|
1151
|
-
$this->
|
|
1152
|
-
$
|
|
1153
|
-
|
|
1154
|
-
return [($utility->prepare_path)($ctx), null];
|
|
829
|
+
$this->runsection('preparePath', function (array $ctxmap) use ($client, $utility) {
|
|
830
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $client, $utility);
|
|
831
|
+
return ($utility->prepare_path)($ctx);
|
|
1155
832
|
});
|
|
1156
833
|
}
|
|
1157
834
|
|
|
@@ -1177,15 +854,12 @@ class PrimaryUtilityTest extends TestCase
|
|
|
1177
854
|
|
|
1178
855
|
public function test_prepare_query_basic(): void
|
|
1179
856
|
{
|
|
1180
|
-
$
|
|
1181
|
-
$primary = self::get_spec($spec, 'primary');
|
|
1182
|
-
$client = ProjectNameSDK::test(null, null);
|
|
857
|
+
$client = self::client();
|
|
1183
858
|
$utility = $client->get_utility();
|
|
1184
859
|
|
|
1185
|
-
$this->
|
|
1186
|
-
$
|
|
1187
|
-
|
|
1188
|
-
return [($utility->prepare_query)($ctx), null];
|
|
860
|
+
$this->runsection('prepareQuery', function (array $ctxmap) use ($client, $utility) {
|
|
861
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $client, $utility);
|
|
862
|
+
return ($utility->prepare_query)($ctx);
|
|
1189
863
|
});
|
|
1190
864
|
}
|
|
1191
865
|
|
|
@@ -1194,15 +868,11 @@ class PrimaryUtilityTest extends TestCase
|
|
|
1194
868
|
|
|
1195
869
|
public function test_result_basic_basic(): void
|
|
1196
870
|
{
|
|
1197
|
-
$
|
|
1198
|
-
$primary = self::get_spec($spec, 'primary');
|
|
1199
|
-
$client = ProjectNameSDK::test(null, null);
|
|
871
|
+
$client = self::client();
|
|
1200
872
|
$utility = $client->get_utility();
|
|
1201
873
|
|
|
1202
|
-
$this->
|
|
1203
|
-
$
|
|
1204
|
-
$ctx = self::make_ctx_from_map($ctxmap, $client, $utility);
|
|
1205
|
-
self::fixctx($ctx, $client);
|
|
874
|
+
$this->runsection('resultBasic', function (array $ctxmap) use ($client, $utility) {
|
|
875
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $client, $utility);
|
|
1206
876
|
|
|
1207
877
|
$result = ($utility->result_basic)($ctx);
|
|
1208
878
|
|
|
@@ -1211,11 +881,12 @@ class PrimaryUtilityTest extends TestCase
|
|
|
1211
881
|
'statusText' => $result->status_text,
|
|
1212
882
|
];
|
|
1213
883
|
if ($result->err !== null) {
|
|
1214
|
-
$err_msg = ($result->err instanceof ProjectNameError)
|
|
884
|
+
$err_msg = ($result->err instanceof ProjectNameError)
|
|
885
|
+
? $result->err->msg : (string) $result->err;
|
|
1215
886
|
$out['err'] = ['message' => $err_msg];
|
|
1216
887
|
}
|
|
1217
888
|
|
|
1218
|
-
return
|
|
889
|
+
return $out;
|
|
1219
890
|
});
|
|
1220
891
|
}
|
|
1221
892
|
|
|
@@ -1224,25 +895,16 @@ class PrimaryUtilityTest extends TestCase
|
|
|
1224
895
|
|
|
1225
896
|
public function test_result_body_basic(): void
|
|
1226
897
|
{
|
|
1227
|
-
$
|
|
1228
|
-
$primary = self::get_spec($spec, 'primary');
|
|
1229
|
-
$client = ProjectNameSDK::test(null, null);
|
|
898
|
+
$client = self::client();
|
|
1230
899
|
$utility = $client->get_utility();
|
|
1231
900
|
|
|
1232
|
-
$this->
|
|
1233
|
-
$
|
|
1234
|
-
$ctx = self::make_ctx_from_map($ctxmap, $client, $utility);
|
|
901
|
+
$this->runsection('resultBody', function (array $ctxmap) use ($client, $utility) {
|
|
902
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $client, $utility);
|
|
1235
903
|
|
|
1236
904
|
($utility->result_body)($ctx);
|
|
1237
905
|
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
$entry['ctx']['result'] = [
|
|
1241
|
-
'body' => $ctx->result->body,
|
|
1242
|
-
];
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
|
-
return [null, null];
|
|
906
|
+
ProjectNameOmni::sync_ctx($ctxmap, $ctx);
|
|
907
|
+
return null;
|
|
1246
908
|
});
|
|
1247
909
|
}
|
|
1248
910
|
|
|
@@ -1251,25 +913,16 @@ class PrimaryUtilityTest extends TestCase
|
|
|
1251
913
|
|
|
1252
914
|
public function test_result_headers_basic(): void
|
|
1253
915
|
{
|
|
1254
|
-
$
|
|
1255
|
-
$primary = self::get_spec($spec, 'primary');
|
|
1256
|
-
$client = ProjectNameSDK::test(null, null);
|
|
916
|
+
$client = self::client();
|
|
1257
917
|
$utility = $client->get_utility();
|
|
1258
918
|
|
|
1259
|
-
$this->
|
|
1260
|
-
$
|
|
1261
|
-
$ctx = self::make_ctx_from_map($ctxmap, $client, $utility);
|
|
919
|
+
$this->runsection('resultHeaders', function (array $ctxmap) use ($client, $utility) {
|
|
920
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $client, $utility);
|
|
1262
921
|
|
|
1263
922
|
($utility->result_headers)($ctx);
|
|
1264
923
|
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
$entry['ctx']['result'] = [
|
|
1268
|
-
'headers' => $ctx->result->headers,
|
|
1269
|
-
];
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
return [null, null];
|
|
924
|
+
ProjectNameOmni::sync_ctx($ctxmap, $ctx);
|
|
925
|
+
return null;
|
|
1273
926
|
});
|
|
1274
927
|
}
|
|
1275
928
|
|
|
@@ -1278,23 +931,16 @@ class PrimaryUtilityTest extends TestCase
|
|
|
1278
931
|
|
|
1279
932
|
public function test_transform_request_basic(): void
|
|
1280
933
|
{
|
|
1281
|
-
$
|
|
1282
|
-
$primary = self::get_spec($spec, 'primary');
|
|
1283
|
-
$client = ProjectNameSDK::test(null, null);
|
|
934
|
+
$client = self::client();
|
|
1284
935
|
$utility = $client->get_utility();
|
|
1285
936
|
|
|
1286
|
-
$this->
|
|
1287
|
-
$
|
|
1288
|
-
$ctx = self::make_ctx_from_map($ctxmap, $client, $utility);
|
|
937
|
+
$this->runsection('transformRequest', function (array $ctxmap) use ($client, $utility) {
|
|
938
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $client, $utility);
|
|
1289
939
|
|
|
1290
940
|
$result = ($utility->transform_request)($ctx);
|
|
1291
941
|
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
$entry['ctx']['spec']['step'] = $ctx->spec->step;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
return [$result, null];
|
|
942
|
+
ProjectNameOmni::sync_ctx($ctxmap, $ctx);
|
|
943
|
+
return $result;
|
|
1298
944
|
});
|
|
1299
945
|
}
|
|
1300
946
|
|
|
@@ -1303,23 +949,16 @@ class PrimaryUtilityTest extends TestCase
|
|
|
1303
949
|
|
|
1304
950
|
public function test_transform_response_basic(): void
|
|
1305
951
|
{
|
|
1306
|
-
$
|
|
1307
|
-
$primary = self::get_spec($spec, 'primary');
|
|
1308
|
-
$client = ProjectNameSDK::test(null, null);
|
|
952
|
+
$client = self::client();
|
|
1309
953
|
$utility = $client->get_utility();
|
|
1310
954
|
|
|
1311
|
-
$this->
|
|
1312
|
-
$
|
|
1313
|
-
$ctx = self::make_ctx_from_map($ctxmap, $client, $utility);
|
|
955
|
+
$this->runsection('transformResponse', function (array $ctxmap) use ($client, $utility) {
|
|
956
|
+
$ctx = ProjectNameOmni::ctx_from_map($ctxmap, $client, $utility);
|
|
1314
957
|
|
|
1315
958
|
$result = ($utility->transform_response)($ctx);
|
|
1316
959
|
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
$entry['ctx']['spec']['step'] = $ctx->spec->step;
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
return [$result, null];
|
|
960
|
+
ProjectNameOmni::sync_ctx($ctxmap, $ctx);
|
|
961
|
+
return $result;
|
|
1323
962
|
});
|
|
1324
963
|
}
|
|
1325
964
|
}
|