@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
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
-- ProjectName SDK primary utility test
|
|
2
|
+
--
|
|
3
|
+
-- Corpus sections run through the vendored omni runner, via the resolver
|
|
4
|
+
-- in test/omni.lua (struct-runner shape over native vendored omni). The
|
|
5
|
+
-- inline corpus engine this file used to carry is retired: omni resolves
|
|
6
|
+
-- arguments, applies the null rules, and enforces out/err/match - the
|
|
7
|
+
-- subjects below only adapt each utility's calling convention.
|
|
8
|
+
--
|
|
9
|
+
-- Three conventions to know when adding a section:
|
|
10
|
+
--
|
|
11
|
+
-- - Utilities that answer as a (value, err) PAIR go through `unwrap`,
|
|
12
|
+
-- which raises the err so omni can match it against `err:` expectations.
|
|
13
|
+
-- Utilities that answer bare values are passed straight through.
|
|
14
|
+
--
|
|
15
|
+
-- - A subject receives omni's RESOLVED arguments (the entry's ctx map, or
|
|
16
|
+
-- its `in`/`args` values), not the raw entry. The ctx map arrives in
|
|
17
|
+
-- the SDK's value model; `make_ctx_from_map` materialises the real
|
|
18
|
+
-- Context from it, exactly as the retired engine did.
|
|
19
|
+
--
|
|
20
|
+
-- - `match: {ctx: ...}` assertions read the entry's ctx AFTER the subject
|
|
21
|
+
-- ran, so a subject whose section asserts on context state writes the
|
|
22
|
+
-- relevant live-context fields back onto the ctx map it received - the
|
|
23
|
+
-- resolver splices those writebacks into the entry omni matches on.
|
|
2
24
|
|
|
3
|
-
local json = require("dkjson")
|
|
4
|
-
local vs = require("utility.struct.struct")
|
|
5
25
|
local sdk = require("project-name-_sdk")
|
|
6
|
-
local
|
|
7
|
-
local runner = require("test.runner")
|
|
26
|
+
local omni = require("test.omni")
|
|
8
27
|
local Context = require("core.context")
|
|
9
28
|
local Spec = require("core.spec")
|
|
10
29
|
local Result = require("core.result")
|
|
@@ -13,30 +32,31 @@ local Operation = require("core.operation")
|
|
|
13
32
|
local BaseFeature = require("feature.base_feature")
|
|
14
33
|
local ProjectNameError = require("core.error")
|
|
15
34
|
|
|
16
|
-
local _test_dir = debug.getinfo(1, "S").source:match("^@(.+/)") or "./"
|
|
17
35
|
|
|
36
|
+
-- Resolved against test/omni.lua's own directory, so the suite works from
|
|
37
|
+
-- any working directory.
|
|
38
|
+
local TEST_JSON_FILE = "../../.sdk/test/test.json"
|
|
18
39
|
|
|
19
|
-
|
|
20
|
-
local
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
end
|
|
40
|
+
|
|
41
|
+
local runner = omni.makeRunner(TEST_JSON_FILE, sdk.test(nil, nil))
|
|
42
|
+
local run = runner("primary")
|
|
43
|
+
|
|
44
|
+
local spec = run.spec
|
|
45
|
+
local runset = run.runset
|
|
46
|
+
local runsetflags = run.runsetflags
|
|
47
|
+
|
|
48
|
+
-- Under the old inline runner the suite drove the SDK directly; under omni
|
|
49
|
+
-- the runpack's client is the read-through provider wrapping it. This
|
|
50
|
+
-- suite treats the client as the SDK - so unwrap the real instance
|
|
51
|
+
-- (mirrors ts/py).
|
|
52
|
+
local client = run.client.sdk
|
|
53
|
+
local utility = client:get_utility()
|
|
34
54
|
|
|
35
55
|
|
|
36
56
|
-- Navigate into nested map by keys
|
|
37
|
-
local function get_spec(
|
|
38
|
-
local cur =
|
|
39
|
-
local keys = {...}
|
|
57
|
+
local function get_spec(base, ...)
|
|
58
|
+
local cur = base
|
|
59
|
+
local keys = { ... }
|
|
40
60
|
for _, key in ipairs(keys) do
|
|
41
61
|
if type(cur) ~= "table" then
|
|
42
62
|
return nil
|
|
@@ -50,251 +70,62 @@ local function get_spec(spec, ...)
|
|
|
50
70
|
end
|
|
51
71
|
|
|
52
72
|
|
|
53
|
-
--
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
--
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
-- Converts common PCRE patterns (\w, \d, \s) to Lua patterns (%w, %d, %s)
|
|
82
|
-
local function match_string(pattern, val)
|
|
83
|
-
if #pattern >= 2 and pattern:sub(1, 1) == "/" and pattern:sub(-1) == "/" then
|
|
84
|
-
local re = pattern:sub(2, -2)
|
|
85
|
-
-- Convert PCRE character classes to Lua pattern equivalents
|
|
86
|
-
re = re:gsub("\\w", "%%w")
|
|
87
|
-
re = re:gsub("\\d", "%%d")
|
|
88
|
-
re = re:gsub("\\s", "%%s")
|
|
89
|
-
local ok = string.find(val, re)
|
|
90
|
-
return ok ~= nil
|
|
91
|
-
end
|
|
92
|
-
return string.find(string.lower(val), string.lower(pattern), 1, true) ~= nil
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
-- Deep match: check that all keys in 'check' exist and match in 'base'
|
|
97
|
-
local function match_deep(check, base, path, errors)
|
|
98
|
-
if check == nil then
|
|
99
|
-
return
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
path = path or ""
|
|
103
|
-
errors = errors or {}
|
|
104
|
-
|
|
105
|
-
if type(check) == "table" then
|
|
106
|
-
-- Determine if check is a list (array) or map
|
|
107
|
-
local is_list = false
|
|
108
|
-
if #check > 0 then
|
|
109
|
-
is_list = true
|
|
110
|
-
for k, _ in pairs(check) do
|
|
111
|
-
if type(k) ~= "number" then
|
|
112
|
-
is_list = false
|
|
113
|
-
break
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
if is_list then
|
|
119
|
-
for i, check_val in ipairs(check) do
|
|
120
|
-
local child_path = path .. "[" .. i .. "]"
|
|
121
|
-
local base_val = nil
|
|
122
|
-
if type(base) == "table" and base[i] ~= nil then
|
|
123
|
-
base_val = base[i]
|
|
124
|
-
end
|
|
125
|
-
match_deep(check_val, base_val, child_path, errors)
|
|
126
|
-
end
|
|
127
|
-
else
|
|
128
|
-
for key, check_val in pairs(check) do
|
|
129
|
-
local child_path = path .. "." .. tostring(key)
|
|
130
|
-
local base_val = nil
|
|
131
|
-
if type(base) == "table" then
|
|
132
|
-
base_val = base[key]
|
|
133
|
-
end
|
|
134
|
-
match_deep(check_val, base_val, child_path, errors)
|
|
135
|
-
end
|
|
136
|
-
end
|
|
137
|
-
else
|
|
138
|
-
local check_str = nil
|
|
139
|
-
if type(check) == "string" then
|
|
140
|
-
check_str = check
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
if check_str == "__EXISTS__" then
|
|
144
|
-
if base == nil then
|
|
145
|
-
table.insert(errors, "match " .. path .. ": expected value to exist but got nil")
|
|
146
|
-
end
|
|
147
|
-
return
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
if check_str == "__UNDEF__" then
|
|
151
|
-
if base ~= nil then
|
|
152
|
-
table.insert(errors, "match " .. path .. ": expected nil but got " .. json_str(base))
|
|
153
|
-
end
|
|
154
|
-
return
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
local norm_check = json_normalize(check)
|
|
158
|
-
local norm_base = json_normalize(base)
|
|
159
|
-
|
|
160
|
-
-- Compare normalized values
|
|
161
|
-
local check_json = json.encode(norm_check)
|
|
162
|
-
local base_json = json.encode(norm_base)
|
|
163
|
-
|
|
164
|
-
if check_json ~= base_json then
|
|
165
|
-
if check_str ~= nil and check_str ~= "" then
|
|
166
|
-
local base_str = tostring(base or "")
|
|
167
|
-
if match_string(check_str, base_str) then
|
|
168
|
-
return
|
|
169
|
-
end
|
|
170
|
-
end
|
|
171
|
-
table.insert(errors, "match " .. path .. ": got " ..
|
|
172
|
-
json_str(norm_base) .. ", want " .. json_str(norm_check))
|
|
173
|
-
end
|
|
73
|
+
-- Sections deliberately left empty in the shared corpus
|
|
74
|
+
-- (.sdk/test/primary/<name>.aon carries a PENDING header). Everything else
|
|
75
|
+
-- MUST contribute cases.
|
|
76
|
+
local PENDING = {
|
|
77
|
+
fetcher = true,
|
|
78
|
+
makeFetchDef = true,
|
|
79
|
+
makeResult = true,
|
|
80
|
+
featureAdd = true,
|
|
81
|
+
featureHook = true,
|
|
82
|
+
featureInit = true,
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
-- Run one corpus section, failing loudly when it would run ZERO cases. A
|
|
87
|
+
-- renamed section or a fixture that compiled to an empty `set` used to
|
|
88
|
+
-- pass silently, which defeats the point of a shared oracle. EVERY
|
|
89
|
+
-- corpus-backed test goes through here (mirrors ts/py).
|
|
90
|
+
local function runsection(name, subject)
|
|
91
|
+
local section = get_spec(spec, name)
|
|
92
|
+
assert(section ~= nil,
|
|
93
|
+
"test corpus section '" .. name .. "' missing - check the name " ..
|
|
94
|
+
"against .sdk/test/primary/")
|
|
95
|
+
local basic = get_spec(section, "basic")
|
|
96
|
+
assert(basic ~= nil and type(basic.set) == "table",
|
|
97
|
+
"test corpus section '" .. name .. "' has no basic.set list")
|
|
98
|
+
if #basic.set == 0 and not PENDING[name] then
|
|
99
|
+
error("test corpus section '" .. name .. "' is EMPTY - zero cases " ..
|
|
100
|
+
"would run; add cases, or mark the fixture PENDING in .sdk/test/primary/")
|
|
174
101
|
end
|
|
102
|
+
return runset(basic, subject)
|
|
175
103
|
end
|
|
176
104
|
|
|
177
105
|
|
|
178
|
-
--
|
|
179
|
-
local function
|
|
180
|
-
if
|
|
181
|
-
|
|
182
|
-
end
|
|
183
|
-
local set = testspec["set"]
|
|
184
|
-
if type(set) ~= "table" then
|
|
185
|
-
return
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
for si, entry_ref in ipairs(set) do
|
|
189
|
-
local i = si - 1
|
|
190
|
-
local entry = entry_ref
|
|
191
|
-
|
|
192
|
-
local mark = ""
|
|
193
|
-
if entry["mark"] ~= nil then
|
|
194
|
-
mark = " (mark=" .. tostring(entry["mark"]) .. ")"
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
local result, err = subject(entry)
|
|
198
|
-
|
|
199
|
-
local expected_err = entry["err"]
|
|
200
|
-
|
|
201
|
-
if err ~= nil then
|
|
202
|
-
if expected_err ~= nil then
|
|
203
|
-
local err_msg = tostring(err)
|
|
204
|
-
if type(err) == "table" and err.msg ~= nil then
|
|
205
|
-
err_msg = err.msg
|
|
206
|
-
end
|
|
207
|
-
if type(expected_err) == "string" then
|
|
208
|
-
if not match_string(expected_err, err_msg) then
|
|
209
|
-
error("entry " .. i .. mark .. ": error mismatch: got " ..
|
|
210
|
-
json_str(err_msg) .. ", want contains " .. json_str(expected_err))
|
|
211
|
-
end
|
|
212
|
-
elseif type(expected_err) == "boolean" and expected_err == true then
|
|
213
|
-
-- err: true means any error is acceptable
|
|
214
|
-
end
|
|
215
|
-
if entry["match"] ~= nil then
|
|
216
|
-
local result_map = {
|
|
217
|
-
["in"] = entry["in"],
|
|
218
|
-
out = json_normalize(result),
|
|
219
|
-
err = { message = tostring(err) },
|
|
220
|
-
}
|
|
221
|
-
local errors = {}
|
|
222
|
-
match_deep(entry["match"], result_map, "", errors)
|
|
223
|
-
if #errors > 0 then
|
|
224
|
-
error("entry " .. i .. mark .. ": " .. table.concat(errors, "; "))
|
|
225
|
-
end
|
|
226
|
-
end
|
|
227
|
-
goto continue
|
|
228
|
-
end
|
|
229
|
-
error("entry " .. i .. mark .. ": unexpected error: " .. tostring(err))
|
|
230
|
-
end
|
|
231
|
-
|
|
232
|
-
if expected_err ~= nil then
|
|
233
|
-
error("entry " .. i .. mark .. ": expected error containing " ..
|
|
234
|
-
json_str(expected_err) .. " but got result: " .. json_str(result))
|
|
235
|
-
end
|
|
236
|
-
|
|
237
|
-
do
|
|
238
|
-
local matched = false
|
|
239
|
-
if entry["match"] ~= nil then
|
|
240
|
-
local result_map = {
|
|
241
|
-
["in"] = entry["in"],
|
|
242
|
-
out = json_normalize(result),
|
|
243
|
-
}
|
|
244
|
-
if entry["args"] ~= nil then
|
|
245
|
-
result_map["args"] = entry["args"]
|
|
246
|
-
elseif entry["in"] ~= nil then
|
|
247
|
-
result_map["args"] = { entry["in"] }
|
|
248
|
-
end
|
|
249
|
-
if entry["ctx"] ~= nil then
|
|
250
|
-
result_map["ctx"] = entry["ctx"]
|
|
251
|
-
end
|
|
252
|
-
local errors = {}
|
|
253
|
-
match_deep(entry["match"], result_map, "", errors)
|
|
254
|
-
if #errors > 0 then
|
|
255
|
-
error("entry " .. i .. mark .. ": " .. table.concat(errors, "; "))
|
|
256
|
-
end
|
|
257
|
-
matched = true
|
|
258
|
-
end
|
|
259
|
-
|
|
260
|
-
local expected_out = entry["out"]
|
|
261
|
-
if expected_out == nil and matched then
|
|
262
|
-
goto continue
|
|
263
|
-
end
|
|
264
|
-
if expected_out ~= nil then
|
|
265
|
-
local norm_result = json_normalize(result)
|
|
266
|
-
local norm_expected = json_normalize(expected_out)
|
|
267
|
-
local rj = json.encode(norm_result)
|
|
268
|
-
local ej = json.encode(norm_expected)
|
|
269
|
-
-- Treat empty [] and {} as equivalent
|
|
270
|
-
local rj_norm = (rj == "[]") and "{}" or rj
|
|
271
|
-
local ej_norm = (ej == "[]") and "{}" or ej
|
|
272
|
-
if rj_norm ~= ej_norm then
|
|
273
|
-
error("entry " .. i .. mark .. ": output mismatch: got " ..
|
|
274
|
-
json_str(norm_result) .. ", want " .. json_str(norm_expected))
|
|
275
|
-
end
|
|
276
|
-
end
|
|
277
|
-
end
|
|
278
|
-
|
|
279
|
-
::continue::
|
|
106
|
+
-- (value, err) pair convention -> value-or-raise, omni's shape.
|
|
107
|
+
local function unwrap(val, err)
|
|
108
|
+
if err ~= nil then
|
|
109
|
+
error(err)
|
|
280
110
|
end
|
|
111
|
+
return val
|
|
281
112
|
end
|
|
282
113
|
|
|
283
114
|
|
|
284
115
|
-- Create a context from a JSON map (like makeCtxFromMap in Go)
|
|
285
|
-
local function make_ctx_from_map(ctxmap,
|
|
116
|
+
local function make_ctx_from_map(ctxmap, ctxclient, ctxutility)
|
|
286
117
|
if ctxmap == nil then
|
|
287
118
|
ctxmap = {}
|
|
288
119
|
end
|
|
289
120
|
|
|
290
121
|
local ctx = Context.new(ctxmap, nil)
|
|
291
122
|
|
|
292
|
-
if
|
|
293
|
-
ctx.client =
|
|
294
|
-
ctx.utility =
|
|
123
|
+
if ctxclient ~= nil then
|
|
124
|
+
ctx.client = ctxclient
|
|
125
|
+
ctx.utility = ctxutility
|
|
295
126
|
end
|
|
296
|
-
if ctx.options == nil and
|
|
297
|
-
ctx.options =
|
|
127
|
+
if ctx.options == nil and ctxclient ~= nil then
|
|
128
|
+
ctx.options = ctxclient:options_map()
|
|
298
129
|
end
|
|
299
130
|
|
|
300
131
|
-- Handle spec from JSON map
|
|
@@ -336,7 +167,7 @@ end
|
|
|
336
167
|
|
|
337
168
|
|
|
338
169
|
-- Fix context options
|
|
339
|
-
local function fixctx(ctx,
|
|
170
|
+
local function fixctx(ctx, ctxclient)
|
|
340
171
|
if ctx ~= nil and ctx.client ~= nil and ctx.options == nil then
|
|
341
172
|
ctx.options = ctx.client:options_map()
|
|
342
173
|
end
|
|
@@ -358,24 +189,24 @@ end
|
|
|
358
189
|
|
|
359
190
|
|
|
360
191
|
-- Create a basic test context
|
|
361
|
-
local function make_test_ctx(
|
|
192
|
+
local function make_test_ctx(ctxclient, ctxutility, overrides)
|
|
362
193
|
local ctxmap = {
|
|
363
194
|
opname = "load",
|
|
364
|
-
client =
|
|
365
|
-
utility =
|
|
195
|
+
client = ctxclient,
|
|
196
|
+
utility = ctxutility,
|
|
366
197
|
}
|
|
367
198
|
if overrides ~= nil then
|
|
368
199
|
for k, v in pairs(overrides) do
|
|
369
200
|
ctxmap[k] = v
|
|
370
201
|
end
|
|
371
202
|
end
|
|
372
|
-
return
|
|
203
|
+
return ctxutility.make_context(ctxmap, ctxclient:get_root_ctx())
|
|
373
204
|
end
|
|
374
205
|
|
|
375
206
|
|
|
376
207
|
-- Create a full test context with point and match
|
|
377
|
-
local function make_test_full_ctx(
|
|
378
|
-
local ctx = make_test_ctx(
|
|
208
|
+
local function make_test_full_ctx(ctxclient, ctxutility)
|
|
209
|
+
local ctx = make_test_ctx(ctxclient, ctxutility, nil)
|
|
379
210
|
ctx.point = {
|
|
380
211
|
parts = { "items", "{id}" },
|
|
381
212
|
args = { params = { { name = "id", reqd = true } } },
|
|
@@ -392,13 +223,6 @@ end
|
|
|
392
223
|
|
|
393
224
|
|
|
394
225
|
describe("PrimaryUtility", function()
|
|
395
|
-
local spec = load_test_spec()
|
|
396
|
-
local primary = get_spec(spec, "primary")
|
|
397
|
-
assert.is_not_nil(primary, "primary section not found in test.json")
|
|
398
|
-
|
|
399
|
-
local client = sdk.test(nil, nil)
|
|
400
|
-
local utility = client:get_utility()
|
|
401
|
-
|
|
402
226
|
|
|
403
227
|
it("exists", function()
|
|
404
228
|
assert.is_not_nil(utility.clean, "clean should not be nil")
|
|
@@ -442,40 +266,31 @@ describe("PrimaryUtility", function()
|
|
|
442
266
|
|
|
443
267
|
|
|
444
268
|
it("done-basic", function()
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
ctxmap = {}
|
|
269
|
+
runsection("done", function(cin)
|
|
270
|
+
if type(cin) ~= "table" then
|
|
271
|
+
cin = {}
|
|
449
272
|
end
|
|
450
|
-
local ctx = make_ctx_from_map(
|
|
273
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
451
274
|
fixctx(ctx, client)
|
|
452
|
-
return utility.done(ctx)
|
|
275
|
+
return unwrap(utility.done(ctx))
|
|
453
276
|
end)
|
|
454
277
|
end)
|
|
455
278
|
|
|
456
279
|
|
|
457
280
|
it("makeError-basic", function()
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
args = { {} }
|
|
281
|
+
runsection("makeError", function(cin, errmap)
|
|
282
|
+
if type(cin) ~= "table" then
|
|
283
|
+
cin = {}
|
|
462
284
|
end
|
|
463
|
-
|
|
464
|
-
local ctxmap = args[1]
|
|
465
|
-
if type(ctxmap) ~= "table" then
|
|
466
|
-
ctxmap = {}
|
|
467
|
-
end
|
|
468
|
-
local ctx = make_ctx_from_map(ctxmap, client, utility)
|
|
285
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
469
286
|
fixctx(ctx, client)
|
|
470
287
|
|
|
471
288
|
local err_val = nil
|
|
472
|
-
if
|
|
473
|
-
|
|
474
|
-
err_val = err_from_map(args[2])
|
|
475
|
-
end
|
|
289
|
+
if type(errmap) == "table" then
|
|
290
|
+
err_val = err_from_map(errmap)
|
|
476
291
|
end
|
|
477
292
|
|
|
478
|
-
return utility.make_error(ctx, err_val)
|
|
293
|
+
return unwrap(utility.make_error(ctx, err_val))
|
|
479
294
|
end)
|
|
480
295
|
end)
|
|
481
296
|
|
|
@@ -632,22 +447,21 @@ describe("PrimaryUtility", function()
|
|
|
632
447
|
|
|
633
448
|
|
|
634
449
|
it("makeContext-basic", function()
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
450
|
+
runsection("makeContext", function(vin)
|
|
451
|
+
if type(vin) ~= "table" then
|
|
452
|
+
return nil
|
|
453
|
+
end
|
|
454
|
+
local ctx = utility.make_context(vin, nil)
|
|
455
|
+
local out = {
|
|
456
|
+
id = ctx.id,
|
|
457
|
+
}
|
|
458
|
+
if ctx.op ~= nil then
|
|
459
|
+
out["op"] = {
|
|
460
|
+
name = ctx.op.name,
|
|
461
|
+
input = ctx.op.input,
|
|
641
462
|
}
|
|
642
|
-
if ctx.op ~= nil then
|
|
643
|
-
out["op"] = {
|
|
644
|
-
name = ctx.op.name,
|
|
645
|
-
input = ctx.op.input,
|
|
646
|
-
}
|
|
647
|
-
end
|
|
648
|
-
return out, nil
|
|
649
463
|
end
|
|
650
|
-
return
|
|
464
|
+
return out
|
|
651
465
|
end)
|
|
652
466
|
end)
|
|
653
467
|
|
|
@@ -708,70 +522,58 @@ describe("PrimaryUtility", function()
|
|
|
708
522
|
|
|
709
523
|
|
|
710
524
|
it("makeOptions-basic", function()
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
in_val = {}
|
|
525
|
+
runsection("makeOptions", function(vin)
|
|
526
|
+
if type(vin) ~= "table" then
|
|
527
|
+
vin = {}
|
|
715
528
|
end
|
|
716
529
|
local ctx = utility.make_context({
|
|
717
|
-
options =
|
|
718
|
-
config =
|
|
530
|
+
options = vin["options"],
|
|
531
|
+
config = vin["config"],
|
|
719
532
|
}, nil)
|
|
720
533
|
ctx.client = client
|
|
721
534
|
ctx.utility = utility
|
|
722
|
-
return utility.make_options(ctx)
|
|
535
|
+
return (utility.make_options(ctx))
|
|
723
536
|
end)
|
|
724
537
|
end)
|
|
725
538
|
|
|
726
539
|
|
|
727
540
|
it("makeRequest-basic", function()
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
ctxmap = {}
|
|
541
|
+
runsection("makeRequest", function(cin)
|
|
542
|
+
if type(cin) ~= "table" then
|
|
543
|
+
cin = {}
|
|
732
544
|
end
|
|
733
|
-
local ctx = make_ctx_from_map(
|
|
545
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
734
546
|
ctx.options = client:options_map()
|
|
735
547
|
|
|
736
|
-
|
|
737
|
-
if err ~= nil then
|
|
738
|
-
return nil, err
|
|
739
|
-
end
|
|
548
|
+
unwrap(utility.make_request(ctx))
|
|
740
549
|
|
|
741
|
-
--
|
|
742
|
-
|
|
743
|
-
if
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
entry_ctx["result"] = "exists"
|
|
749
|
-
end
|
|
550
|
+
-- Write live-context state back for match checking (the corpus
|
|
551
|
+
-- asserts `__EXISTS__`, so presence is what matters).
|
|
552
|
+
if ctx.response ~= nil then
|
|
553
|
+
cin["response"] = "exists"
|
|
554
|
+
end
|
|
555
|
+
if ctx.result ~= nil then
|
|
556
|
+
cin["result"] = "exists"
|
|
750
557
|
end
|
|
751
558
|
|
|
752
|
-
return nil
|
|
559
|
+
return nil
|
|
753
560
|
end)
|
|
754
561
|
end)
|
|
755
562
|
|
|
756
563
|
|
|
757
564
|
it("makeResponse-basic", function()
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
ctxmap = {}
|
|
565
|
+
runsection("makeResponse", function(cin)
|
|
566
|
+
if type(cin) ~= "table" then
|
|
567
|
+
cin = {}
|
|
762
568
|
end
|
|
763
|
-
local ctx = make_ctx_from_map(
|
|
569
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
764
570
|
fixctx(ctx, client)
|
|
765
571
|
|
|
766
|
-
|
|
767
|
-
if err ~= nil then
|
|
768
|
-
return nil, err
|
|
769
|
-
end
|
|
572
|
+
unwrap(utility.make_response(ctx))
|
|
770
573
|
|
|
771
|
-
--
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
entry_ctx["result"] = {
|
|
574
|
+
-- Write live-context result state back for match checking
|
|
575
|
+
if ctx.result ~= nil then
|
|
576
|
+
cin["result"] = {
|
|
775
577
|
ok = ctx.result.ok,
|
|
776
578
|
status = ctx.result.status,
|
|
777
579
|
statusText = ctx.result.status_text,
|
|
@@ -780,7 +582,7 @@ describe("PrimaryUtility", function()
|
|
|
780
582
|
}
|
|
781
583
|
end
|
|
782
584
|
|
|
783
|
-
return nil
|
|
585
|
+
return nil
|
|
784
586
|
end)
|
|
785
587
|
end)
|
|
786
588
|
|
|
@@ -839,27 +641,22 @@ describe("PrimaryUtility", function()
|
|
|
839
641
|
|
|
840
642
|
|
|
841
643
|
it("makeSpec-basic", function()
|
|
842
|
-
local setup_opts = get_spec(
|
|
644
|
+
local setup_opts = omni.tostruct(get_spec(spec, "makeSpec", "DEF", "setup", "a"))
|
|
843
645
|
local spec_client = sdk.test(nil, setup_opts)
|
|
844
646
|
local spec_utility = spec_client:get_utility()
|
|
845
647
|
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
ctxmap = {}
|
|
648
|
+
runsection("makeSpec", function(cin)
|
|
649
|
+
if type(cin) ~= "table" then
|
|
650
|
+
cin = {}
|
|
850
651
|
end
|
|
851
|
-
local ctx = make_ctx_from_map(
|
|
652
|
+
local ctx = make_ctx_from_map(cin, spec_client, spec_utility)
|
|
852
653
|
ctx.options = spec_client:options_map()
|
|
853
654
|
|
|
854
|
-
|
|
855
|
-
if err ~= nil then
|
|
856
|
-
return nil, err
|
|
857
|
-
end
|
|
655
|
+
unwrap(utility.make_spec(ctx))
|
|
858
656
|
|
|
859
|
-
--
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
entry_ctx["spec"] = {
|
|
657
|
+
-- Write live-context spec state back for match checking
|
|
658
|
+
if ctx.spec ~= nil then
|
|
659
|
+
cin["spec"] = {
|
|
863
660
|
base = ctx.spec.base,
|
|
864
661
|
prefix = ctx.spec.prefix,
|
|
865
662
|
suffix = ctx.spec.suffix,
|
|
@@ -871,7 +668,7 @@ describe("PrimaryUtility", function()
|
|
|
871
668
|
}
|
|
872
669
|
end
|
|
873
670
|
|
|
874
|
-
return nil
|
|
671
|
+
return nil
|
|
875
672
|
end)
|
|
876
673
|
end)
|
|
877
674
|
|
|
@@ -896,175 +693,135 @@ describe("PrimaryUtility", function()
|
|
|
896
693
|
|
|
897
694
|
|
|
898
695
|
it("makeUrl-basic", function()
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
ctxmap = {}
|
|
696
|
+
runsection("makeUrl", function(cin)
|
|
697
|
+
if type(cin) ~= "table" then
|
|
698
|
+
cin = {}
|
|
903
699
|
end
|
|
904
|
-
local ctx = make_ctx_from_map(
|
|
700
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
905
701
|
if ctx.result == nil then
|
|
906
702
|
ctx.result = Result.new({})
|
|
907
703
|
end
|
|
908
|
-
return utility.make_url(ctx)
|
|
704
|
+
return unwrap(utility.make_url(ctx))
|
|
909
705
|
end)
|
|
910
706
|
end)
|
|
911
707
|
|
|
912
708
|
|
|
913
709
|
it("operator-basic", function()
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
in_val = {}
|
|
710
|
+
runsection("operator", function(vin)
|
|
711
|
+
if type(vin) ~= "table" then
|
|
712
|
+
vin = {}
|
|
918
713
|
end
|
|
919
|
-
local op = Operation.new(
|
|
714
|
+
local op = Operation.new(vin)
|
|
920
715
|
return {
|
|
921
716
|
entity = op.entity,
|
|
922
717
|
name = op.name,
|
|
923
718
|
input = op.input,
|
|
924
719
|
points = op.points,
|
|
925
|
-
}
|
|
720
|
+
}
|
|
926
721
|
end)
|
|
927
722
|
end)
|
|
928
723
|
|
|
929
724
|
|
|
930
725
|
it("param-basic", function()
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
return nil, nil
|
|
935
|
-
end
|
|
936
|
-
|
|
937
|
-
local ctxmap = args[1]
|
|
938
|
-
if type(ctxmap) ~= "table" then
|
|
939
|
-
ctxmap = {}
|
|
726
|
+
runsection("param", function(cin, paramdef)
|
|
727
|
+
if type(cin) ~= "table" then
|
|
728
|
+
cin = {}
|
|
940
729
|
end
|
|
941
|
-
local ctx = make_ctx_from_map(
|
|
942
|
-
local paramdef = args[2]
|
|
730
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
943
731
|
|
|
944
732
|
local result = utility.param(ctx, paramdef)
|
|
945
733
|
|
|
946
|
-
--
|
|
947
|
-
if
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
local entry_ctx = entry["ctx"]
|
|
951
|
-
if entry_ctx == nil then
|
|
952
|
-
entry_ctx = {}
|
|
953
|
-
entry["ctx"] = entry_ctx
|
|
954
|
-
end
|
|
955
|
-
-- Copy spec alias back to entry ctx for matching
|
|
956
|
-
local spec_match = ctx_match["spec"]
|
|
957
|
-
if type(spec_match) == "table" then
|
|
958
|
-
if ctx.spec ~= nil then
|
|
959
|
-
if entry_ctx["spec"] == nil then
|
|
960
|
-
entry_ctx["spec"] = {}
|
|
961
|
-
end
|
|
962
|
-
local alias_match = spec_match["alias"]
|
|
963
|
-
if type(alias_match) == "table" then
|
|
964
|
-
entry_ctx["spec"] = {
|
|
965
|
-
alias = ctx.spec.alias,
|
|
966
|
-
}
|
|
967
|
-
end
|
|
968
|
-
end
|
|
969
|
-
end
|
|
734
|
+
-- Write spec alias back for `match: {ctx: {spec: {alias: ...}}}`
|
|
735
|
+
if ctx.spec ~= nil and ctx.spec.alias ~= nil then
|
|
736
|
+
if type(cin["spec"]) ~= "table" then
|
|
737
|
+
cin["spec"] = {}
|
|
970
738
|
end
|
|
739
|
+
cin["spec"]["alias"] = ctx.spec.alias
|
|
971
740
|
end
|
|
972
741
|
|
|
973
|
-
return result
|
|
742
|
+
return result
|
|
974
743
|
end)
|
|
975
744
|
end)
|
|
976
745
|
|
|
977
746
|
|
|
978
747
|
it("prepareAuth-basic", function()
|
|
979
|
-
local setup_opts = get_spec(
|
|
748
|
+
local setup_opts = omni.tostruct(get_spec(spec, "prepareAuth", "DEF", "setup", "a"))
|
|
980
749
|
local auth_client = sdk.test(nil, setup_opts)
|
|
981
750
|
local auth_utility = auth_client:get_utility()
|
|
982
751
|
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
ctxmap = {}
|
|
752
|
+
runsection("prepareAuth", function(cin)
|
|
753
|
+
if type(cin) ~= "table" then
|
|
754
|
+
cin = {}
|
|
987
755
|
end
|
|
988
|
-
local ctx = make_ctx_from_map(
|
|
756
|
+
local ctx = make_ctx_from_map(cin, auth_client, auth_utility)
|
|
989
757
|
fixctx(ctx, auth_client)
|
|
990
758
|
|
|
991
|
-
|
|
992
|
-
if err ~= nil then
|
|
993
|
-
return nil, err
|
|
994
|
-
end
|
|
759
|
+
unwrap(utility.prepare_auth(ctx))
|
|
995
760
|
|
|
996
|
-
--
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
entry_ctx["spec"] = {
|
|
761
|
+
-- Write live-context spec headers back for match checking
|
|
762
|
+
if ctx.spec ~= nil then
|
|
763
|
+
cin["spec"] = {
|
|
1000
764
|
headers = ctx.spec.headers,
|
|
1001
765
|
}
|
|
1002
766
|
end
|
|
1003
767
|
|
|
1004
|
-
return nil
|
|
768
|
+
return nil
|
|
1005
769
|
end)
|
|
1006
770
|
end)
|
|
1007
771
|
|
|
1008
772
|
|
|
1009
773
|
it("prepareBody-basic", function()
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
ctxmap = {}
|
|
774
|
+
runsection("prepareBody", function(cin)
|
|
775
|
+
if type(cin) ~= "table" then
|
|
776
|
+
cin = {}
|
|
1014
777
|
end
|
|
1015
|
-
local ctx = make_ctx_from_map(
|
|
778
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
1016
779
|
fixctx(ctx, client)
|
|
1017
|
-
return utility.prepare_body(ctx)
|
|
780
|
+
return (utility.prepare_body(ctx))
|
|
1018
781
|
end)
|
|
1019
782
|
end)
|
|
1020
783
|
|
|
1021
784
|
|
|
1022
785
|
it("prepareHeaders-basic", function()
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
ctxmap = {}
|
|
786
|
+
runsection("prepareHeaders", function(cin)
|
|
787
|
+
if type(cin) ~= "table" then
|
|
788
|
+
cin = {}
|
|
1027
789
|
end
|
|
1028
|
-
local ctx = make_ctx_from_map(
|
|
1029
|
-
return utility.prepare_headers(ctx)
|
|
790
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
791
|
+
return (utility.prepare_headers(ctx))
|
|
1030
792
|
end)
|
|
1031
793
|
end)
|
|
1032
794
|
|
|
1033
795
|
|
|
1034
796
|
it("prepareMethod-basic", function()
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
ctxmap = {}
|
|
797
|
+
runsection("prepareMethod", function(cin)
|
|
798
|
+
if type(cin) ~= "table" then
|
|
799
|
+
cin = {}
|
|
1039
800
|
end
|
|
1040
|
-
local ctx = make_ctx_from_map(
|
|
1041
|
-
return utility.prepare_method(ctx)
|
|
801
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
802
|
+
return (utility.prepare_method(ctx))
|
|
1042
803
|
end)
|
|
1043
804
|
end)
|
|
1044
805
|
|
|
1045
806
|
|
|
1046
807
|
it("prepareParams-basic", function()
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
ctxmap = {}
|
|
808
|
+
runsection("prepareParams", function(cin)
|
|
809
|
+
if type(cin) ~= "table" then
|
|
810
|
+
cin = {}
|
|
1051
811
|
end
|
|
1052
|
-
local ctx = make_ctx_from_map(
|
|
1053
|
-
return utility.prepare_params(ctx)
|
|
812
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
813
|
+
return (utility.prepare_params(ctx))
|
|
1054
814
|
end)
|
|
1055
815
|
end)
|
|
1056
816
|
|
|
1057
817
|
|
|
1058
818
|
it("preparePath-basic", function()
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
local ctxmap = entry["ctx"]
|
|
1063
|
-
if type(ctxmap) ~= "table" then
|
|
1064
|
-
ctxmap = {}
|
|
819
|
+
runsection("preparePath", function(cin)
|
|
820
|
+
if type(cin) ~= "table" then
|
|
821
|
+
cin = {}
|
|
1065
822
|
end
|
|
1066
|
-
local ctx = make_ctx_from_map(
|
|
1067
|
-
return utility.prepare_path(ctx)
|
|
823
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
824
|
+
return (utility.prepare_path(ctx))
|
|
1068
825
|
end)
|
|
1069
826
|
end)
|
|
1070
827
|
|
|
@@ -1082,24 +839,22 @@ describe("PrimaryUtility", function()
|
|
|
1082
839
|
|
|
1083
840
|
|
|
1084
841
|
it("prepareQuery-basic", function()
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
ctxmap = {}
|
|
842
|
+
runsection("prepareQuery", function(cin)
|
|
843
|
+
if type(cin) ~= "table" then
|
|
844
|
+
cin = {}
|
|
1089
845
|
end
|
|
1090
|
-
local ctx = make_ctx_from_map(
|
|
1091
|
-
return utility.prepare_query(ctx)
|
|
846
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
847
|
+
return (utility.prepare_query(ctx))
|
|
1092
848
|
end)
|
|
1093
849
|
end)
|
|
1094
850
|
|
|
1095
851
|
|
|
1096
852
|
it("resultBasic-basic", function()
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
ctxmap = {}
|
|
853
|
+
runsection("resultBasic", function(cin)
|
|
854
|
+
if type(cin) ~= "table" then
|
|
855
|
+
cin = {}
|
|
1101
856
|
end
|
|
1102
|
-
local ctx = make_ctx_from_map(
|
|
857
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
1103
858
|
fixctx(ctx, client)
|
|
1104
859
|
|
|
1105
860
|
local result = utility.result_basic(ctx)
|
|
@@ -1118,101 +873,87 @@ describe("PrimaryUtility", function()
|
|
|
1118
873
|
}
|
|
1119
874
|
end
|
|
1120
875
|
|
|
1121
|
-
return out
|
|
876
|
+
return out
|
|
1122
877
|
end)
|
|
1123
878
|
end)
|
|
1124
879
|
|
|
1125
880
|
|
|
1126
881
|
it("resultBody-basic", function()
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
ctxmap = {}
|
|
882
|
+
runsection("resultBody", function(cin)
|
|
883
|
+
if type(cin) ~= "table" then
|
|
884
|
+
cin = {}
|
|
1131
885
|
end
|
|
1132
|
-
local ctx = make_ctx_from_map(
|
|
886
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
1133
887
|
|
|
1134
888
|
utility.result_body(ctx)
|
|
1135
889
|
|
|
1136
|
-
--
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
entry_ctx["result"] = {
|
|
890
|
+
-- Write live-context result state back for match checking
|
|
891
|
+
if ctx.result ~= nil then
|
|
892
|
+
cin["result"] = {
|
|
1140
893
|
body = ctx.result.body,
|
|
1141
894
|
}
|
|
1142
895
|
end
|
|
1143
896
|
|
|
1144
|
-
return nil
|
|
897
|
+
return nil
|
|
1145
898
|
end)
|
|
1146
899
|
end)
|
|
1147
900
|
|
|
1148
901
|
|
|
1149
902
|
it("resultHeaders-basic", function()
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
ctxmap = {}
|
|
903
|
+
runsection("resultHeaders", function(cin)
|
|
904
|
+
if type(cin) ~= "table" then
|
|
905
|
+
cin = {}
|
|
1154
906
|
end
|
|
1155
|
-
local ctx = make_ctx_from_map(
|
|
907
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
1156
908
|
|
|
1157
909
|
utility.result_headers(ctx)
|
|
1158
910
|
|
|
1159
|
-
--
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
entry_ctx["result"] = {
|
|
911
|
+
-- Write live-context result state back for match checking
|
|
912
|
+
if ctx.result ~= nil then
|
|
913
|
+
cin["result"] = {
|
|
1163
914
|
headers = ctx.result.headers,
|
|
1164
915
|
}
|
|
1165
916
|
end
|
|
1166
917
|
|
|
1167
|
-
return nil
|
|
918
|
+
return nil
|
|
1168
919
|
end)
|
|
1169
920
|
end)
|
|
1170
921
|
|
|
1171
922
|
|
|
1172
923
|
it("transformRequest-basic", function()
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
ctxmap = {}
|
|
924
|
+
runsection("transformRequest", function(cin)
|
|
925
|
+
if type(cin) ~= "table" then
|
|
926
|
+
cin = {}
|
|
1177
927
|
end
|
|
1178
|
-
local ctx = make_ctx_from_map(
|
|
928
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
1179
929
|
|
|
1180
930
|
local result = utility.transform_request(ctx)
|
|
1181
931
|
|
|
1182
|
-
--
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
local spec_map = entry_ctx["spec"]
|
|
1186
|
-
if type(spec_map) == "table" then
|
|
1187
|
-
spec_map["step"] = ctx.spec.step
|
|
1188
|
-
end
|
|
932
|
+
-- Write the step change back for match checking
|
|
933
|
+
if ctx.spec ~= nil and type(cin["spec"]) == "table" then
|
|
934
|
+
cin["spec"]["step"] = ctx.spec.step
|
|
1189
935
|
end
|
|
1190
936
|
|
|
1191
|
-
return result
|
|
937
|
+
return result
|
|
1192
938
|
end)
|
|
1193
939
|
end)
|
|
1194
940
|
|
|
1195
941
|
|
|
1196
942
|
it("transformResponse-basic", function()
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
ctxmap = {}
|
|
943
|
+
runsection("transformResponse", function(cin)
|
|
944
|
+
if type(cin) ~= "table" then
|
|
945
|
+
cin = {}
|
|
1201
946
|
end
|
|
1202
|
-
local ctx = make_ctx_from_map(
|
|
947
|
+
local ctx = make_ctx_from_map(cin, client, utility)
|
|
1203
948
|
|
|
1204
949
|
local result = utility.transform_response(ctx)
|
|
1205
950
|
|
|
1206
|
-
--
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
local spec_map = entry_ctx["spec"]
|
|
1210
|
-
if type(spec_map) == "table" then
|
|
1211
|
-
spec_map["step"] = ctx.spec.step
|
|
1212
|
-
end
|
|
951
|
+
-- Write the step change back for match checking
|
|
952
|
+
if ctx.spec ~= nil and type(cin["spec"]) == "table" then
|
|
953
|
+
cin["spec"]["step"] = ctx.spec.step
|
|
1213
954
|
end
|
|
1214
955
|
|
|
1215
|
-
return result
|
|
956
|
+
return result
|
|
1216
957
|
end)
|
|
1217
958
|
end)
|
|
1218
959
|
|