@voxgig/sdkgen 4.50.0 → 4.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/voxgig-sdkgen +1 -1
- package/dist/cmp/ReadmeExplanation.js +5 -2
- package/dist/cmp/ReadmeExplanation.js.map +1 -1
- package/dist/cmp/ReadmeFeatures.js +20 -6
- package/dist/cmp/ReadmeFeatures.js.map +1 -1
- package/dist/helpers/optspec.js +2 -2
- package/dist/helpers/optspec.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/model/sdkgen.aontu +1 -1
- package/package.json +1 -1
- package/project/.sdk/model/feature/audit.aontu +1 -1
- package/project/.sdk/model/feature/cache.aontu +7 -5
- package/project/.sdk/model/feature/clienttrack.aontu +1 -1
- package/project/.sdk/model/feature/cost.aontu +1 -1
- package/project/.sdk/model/feature/debug.aontu +1 -1
- package/project/.sdk/model/feature/idempotency.aontu +1 -1
- package/project/.sdk/model/feature/log.aontu +1 -1
- package/project/.sdk/model/feature/metrics.aontu +3 -1
- package/project/.sdk/model/feature/netsim.aontu +1 -1
- package/project/.sdk/model/feature/paging.aontu +4 -1
- package/project/.sdk/model/feature/proxy.aontu +1 -1
- package/project/.sdk/model/feature/ratelimit.aontu +3 -3
- package/project/.sdk/model/feature/rbac.aontu +1 -1
- package/project/.sdk/model/feature/retry.aontu +1 -1
- package/project/.sdk/model/feature/secrets.aontu +1 -1
- package/project/.sdk/model/feature/streaming.aontu +1 -1
- package/project/.sdk/model/feature/telemetry.aontu +2 -2
- package/project/.sdk/model/feature/test.aontu +1 -1
- package/project/.sdk/model/feature/timeout.aontu +1 -1
- package/project/.sdk/model/feature/validate.aontu +1 -1
- package/project/.sdk/model/target/lua.aontu +6 -0
- package/project/.sdk/src/cmp/c/Config_c.ts +3 -134
- package/project/.sdk/src/cmp/c/TestClean_c.ts +26 -11
- package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +17 -10
- package/project/.sdk/src/cmp/clojure/TestClean_clojure.ts +10 -5
- package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +18 -1
- package/project/.sdk/src/cmp/cpp/TestClean_cpp.ts +15 -1
- package/project/.sdk/src/cmp/csharp/TestClean_csharp.ts +9 -0
- package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +30 -2
- package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +31 -12
- package/project/.sdk/src/cmp/elixir/TestClean_elixir.ts +13 -4
- package/project/.sdk/src/cmp/elixir/fragment/Main.fragment.ex +51 -15
- package/project/.sdk/src/cmp/elixir/fragment/Pipeline.fragment.ex +17 -0
- package/project/.sdk/src/cmp/go/TestClean_go.ts +39 -3
- package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +42 -2
- package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +42 -14
- package/project/.sdk/src/cmp/java/TestClean_java.ts +17 -4
- package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +21 -0
- package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +13 -8
- package/project/.sdk/src/cmp/js/TestClean_js.ts +13 -5
- package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +26 -2
- package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/EntityPatchOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +12 -5
- package/project/.sdk/src/cmp/kotlin/TestClean_kotlin.ts +31 -4
- package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +19 -0
- package/project/.sdk/src/cmp/lua/TestClean_lua.ts +14 -4
- package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +42 -5
- package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +44 -10
- package/project/.sdk/src/cmp/lua/utility_lua.ts +2 -1
- package/project/.sdk/src/cmp/ocaml/TestClean_ocaml.ts +20 -5
- package/project/.sdk/src/cmp/ocaml/fragment/RunOp.fragment.ml +36 -21
- package/project/.sdk/src/cmp/perl/TestClean_perl.ts +13 -4
- package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +21 -0
- package/project/.sdk/src/cmp/perl/fragment/Main.fragment.pm +31 -12
- package/project/.sdk/src/cmp/php/TestClean_php.ts +10 -3
- package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +33 -4
- package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +13 -6
- package/project/.sdk/src/cmp/py/TestClean_py.ts +10 -3
- package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +25 -2
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +26 -12
- package/project/.sdk/src/cmp/rb/TestClean_rb.ts +11 -4
- package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +23 -2
- package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +27 -11
- package/project/.sdk/src/cmp/rust/TestClean_rust.ts +24 -17
- package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +22 -2
- package/project/.sdk/src/cmp/scala/TestClean_scala.ts +45 -11
- package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +14 -0
- package/project/.sdk/src/cmp/swift/TestClean_swift.ts +31 -21
- package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +9 -0
- package/project/.sdk/src/cmp/swift/fragment/Main.fragment.swift +24 -10
- package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +13 -8
- package/project/.sdk/src/cmp/ts/TestClean_ts.ts +13 -5
- package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +26 -2
- package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityPatchOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +12 -5
- package/project/.sdk/src/cmp/zig/TestClean_zig.ts +23 -11
- package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +17 -10
- package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +41 -6
- package/project/.sdk/tm/c/core/context.c +1 -0
- package/project/.sdk/tm/c/core/sdk.h +7 -4
- package/project/.sdk/tm/c/feature/cache.c +243 -13
- package/project/.sdk/tm/c/feature/metrics.c +7 -0
- package/project/.sdk/tm/c/feature/paging.c +231 -2
- package/project/.sdk/tm/c/feature/ratelimit.c +5 -9
- package/project/.sdk/tm/c/feature/retry.c +51 -4
- package/project/.sdk/tm/c/feature/secrets.c +27 -38
- package/project/.sdk/tm/c/feature/streaming.c +2 -1
- package/project/.sdk/tm/c/feature/telemetry.c +19 -18
- package/project/.sdk/tm/c/feature/test.c +78 -54
- package/project/.sdk/tm/c/tests/feature_test.c +288 -0
- package/project/.sdk/tm/c/tests/primary_utility_test.c +2 -0
- package/project/.sdk/tm/c/utility/clean.c +26 -33
- package/project/.sdk/tm/c/utility/make_options.c +89 -17
- package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +14 -11
- package/project/.sdk/tm/clojure/src/sdk/client.clj +3 -1
- package/project/.sdk/tm/clojure/src/sdk/core.clj +50 -22
- package/project/.sdk/tm/clojure/src/sdk/features.clj +279 -80
- package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +103 -1
- package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +1 -0
- package/project/.sdk/tm/cpp/Makefile +5 -0
- package/project/.sdk/tm/cpp/core/types.hpp +148 -72
- package/project/.sdk/tm/cpp/feature/audit.hpp +12 -8
- package/project/.sdk/tm/cpp/feature/cache.hpp +188 -9
- package/project/.sdk/tm/cpp/feature/metrics.hpp +19 -0
- package/project/.sdk/tm/cpp/feature/paging.hpp +160 -2
- package/project/.sdk/tm/cpp/feature/ratelimit.hpp +18 -14
- package/project/.sdk/tm/cpp/feature/retry.hpp +46 -5
- package/project/.sdk/tm/cpp/feature/secrets.hpp +12 -0
- package/project/.sdk/tm/cpp/feature/streaming.hpp +2 -1
- package/project/.sdk/tm/cpp/feature/telemetry.hpp +17 -10
- package/project/.sdk/tm/cpp/feature/test.hpp +63 -53
- package/project/.sdk/tm/cpp/test/feature_test.cpp +236 -0
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +44 -12
- package/project/.sdk/tm/csharp/core/Context.cs +4 -0
- package/project/.sdk/tm/csharp/feature/AuditFeature.cs +8 -1
- package/project/.sdk/tm/csharp/feature/CacheFeature.cs +126 -12
- package/project/.sdk/tm/csharp/feature/MetricsFeature.cs +23 -0
- package/project/.sdk/tm/csharp/feature/PagingFeature.cs +130 -3
- package/project/.sdk/tm/csharp/feature/RatelimitFeature.cs +26 -19
- package/project/.sdk/tm/csharp/feature/RetryFeature.cs +41 -7
- package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +9 -27
- package/project/.sdk/tm/csharp/feature/StreamingFeature.cs +2 -1
- package/project/.sdk/tm/csharp/feature/TelemetryFeature.cs +11 -9
- package/project/.sdk/tm/csharp/feature/TestFeature.cs +55 -67
- package/project/.sdk/tm/csharp/test/FeatureTest.cs +238 -0
- package/project/.sdk/tm/csharp/utility/Clean.cs +5 -10
- package/project/.sdk/tm/csharp/utility/Fetcher.cs +7 -1
- package/project/.sdk/tm/csharp/utility/MakeOptions.cs +94 -24
- package/project/.sdk/tm/elixir/lib/projectname/context.ex +2 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/cache.ex +146 -30
- package/project/.sdk/tm/elixir/lib/projectname/feature/metrics.ex +13 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/paging.ex +110 -5
- package/project/.sdk/tm/elixir/lib/projectname/feature/ratelimit.ex +6 -12
- package/project/.sdk/tm/elixir/lib/projectname/feature/retry.ex +33 -9
- package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +10 -56
- package/project/.sdk/tm/elixir/lib/projectname/feature/streaming.ex +2 -1
- package/project/.sdk/tm/elixir/lib/projectname/feature/telemetry.ex +7 -7
- package/project/.sdk/tm/elixir/lib/projectname/feature/test.ex +52 -48
- package/project/.sdk/tm/elixir/lib/projectname/utility.ex +77 -47
- package/project/.sdk/tm/elixir/test/feature_test.exs +198 -0
- package/project/.sdk/tm/go/core/context.go +6 -0
- package/project/.sdk/tm/go/feature/audit_feature.go +1 -3
- package/project/.sdk/tm/go/feature/base_feature.go +11 -0
- package/project/.sdk/tm/go/feature/cache_feature.go +131 -4
- package/project/.sdk/tm/go/feature/metrics_feature.go +14 -0
- package/project/.sdk/tm/go/feature/paging_feature.go +108 -2
- package/project/.sdk/tm/go/feature/ratelimit_feature.go +19 -17
- package/project/.sdk/tm/go/feature/retry_feature.go +81 -9
- package/project/.sdk/tm/go/feature/secrets_feature.go +17 -71
- package/project/.sdk/tm/go/feature/streaming_feature.go +2 -1
- package/project/.sdk/tm/go/feature/telemetry_feature.go +18 -11
- package/project/.sdk/tm/go/feature/test_feature.go +65 -55
- package/project/.sdk/tm/go/test/feature_corpus_test.go +357 -28
- package/project/.sdk/tm/go/test/feature_test.go +93 -0
- package/project/.sdk/tm/go/utility/clean.go +5 -7
- package/project/.sdk/tm/go/utility/fetcher.go +11 -0
- package/project/.sdk/tm/go/utility/make_options.go +116 -13
- package/project/.sdk/tm/java/core/Context.java +9 -0
- package/project/.sdk/tm/java/core/SdkClient.java +43 -14
- package/project/.sdk/tm/java/feature/AuditFeature.java +5 -1
- package/project/.sdk/tm/java/feature/CacheFeature.java +123 -17
- package/project/.sdk/tm/java/feature/MetricsFeature.java +31 -0
- package/project/.sdk/tm/java/feature/PagingFeature.java +156 -2
- package/project/.sdk/tm/java/feature/RatelimitFeature.java +15 -13
- package/project/.sdk/tm/java/feature/RetryFeature.java +33 -6
- package/project/.sdk/tm/java/feature/SecretsFeature.java +9 -92
- package/project/.sdk/tm/java/feature/StreamingFeature.java +2 -1
- package/project/.sdk/tm/java/feature/TelemetryFeature.java +17 -9
- package/project/.sdk/tm/java/feature/TestFeature.java +50 -63
- package/project/.sdk/tm/java/test/FeatureCorpusTest.java +309 -17
- package/project/.sdk/tm/java/test/FeatureTest.java +60 -0
- package/project/.sdk/tm/java/utility/Clean.java +6 -10
- package/project/.sdk/tm/java/utility/Fetcher.java +5 -1
- package/project/.sdk/tm/java/utility/MakeOptions.java +131 -15
- package/project/.sdk/tm/js/src/Context.js +4 -0
- package/project/.sdk/tm/js/src/feature/cache/CacheFeature.js +118 -11
- package/project/.sdk/tm/js/src/feature/cost/CostFeature.js +3 -2
- package/project/.sdk/tm/js/src/feature/metrics/MetricsFeature.js +9 -4
- package/project/.sdk/tm/js/src/feature/paging/PagingFeature.js +103 -5
- package/project/.sdk/tm/js/src/feature/ratelimit/RatelimitFeature.js +5 -9
- package/project/.sdk/tm/js/src/feature/rbac/RbacFeature.js +4 -4
- package/project/.sdk/tm/js/src/feature/retry/RetryFeature.js +25 -3
- package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +16 -6
- package/project/.sdk/tm/js/src/feature/streaming/StreamingFeature.js +2 -1
- package/project/.sdk/tm/js/src/feature/telemetry/TelemetryFeature.js +11 -6
- package/project/.sdk/tm/js/src/feature/test/TestFeature.js +38 -1
- package/project/.sdk/tm/js/src/feature/validate/ValidateFeature.js +2 -1
- package/project/.sdk/tm/js/src/utility/CleanUtility.js +1 -1
- package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +61 -12
- package/project/.sdk/tm/js/test/feature/Corpus.test.js +191 -23
- package/project/.sdk/tm/js/test/feature/harness.js +3 -3
- package/project/.sdk/tm/js/test/feature.test.js +14 -1
- package/project/.sdk/tm/js/test/pipeline.test.js +1 -1
- package/project/.sdk/tm/kotlin/core/Context.kt +3 -0
- package/project/.sdk/tm/kotlin/core/SdkClient.kt +23 -10
- package/project/.sdk/tm/kotlin/feature/AuditFeature.kt +5 -1
- package/project/.sdk/tm/kotlin/feature/CacheFeature.kt +102 -7
- package/project/.sdk/tm/kotlin/feature/MetricsFeature.kt +22 -0
- package/project/.sdk/tm/kotlin/feature/PagingFeature.kt +125 -2
- package/project/.sdk/tm/kotlin/feature/RatelimitFeature.kt +16 -13
- package/project/.sdk/tm/kotlin/feature/RetryFeature.kt +36 -14
- package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +10 -20
- package/project/.sdk/tm/kotlin/feature/StreamingFeature.kt +4 -0
- package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +12 -10
- package/project/.sdk/tm/kotlin/feature/TestFeature.kt +45 -48
- package/project/.sdk/tm/kotlin/test/FeatureTest.kt +173 -0
- package/project/.sdk/tm/kotlin/utility/CoreUtil.kt +5 -5
- package/project/.sdk/tm/kotlin/utility/Fetcher.kt +4 -0
- package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +86 -15
- package/project/.sdk/tm/lua/core/context.lua +6 -0
- package/project/.sdk/tm/lua/feature/cache_feature.lua +212 -15
- package/project/.sdk/tm/lua/feature/debug_feature.lua +2 -3
- package/project/.sdk/tm/lua/feature/metrics_feature.lua +5 -0
- package/project/.sdk/tm/lua/feature/paging_feature.lua +143 -2
- package/project/.sdk/tm/lua/feature/ratelimit_feature.lua +5 -9
- package/project/.sdk/tm/lua/feature/retry_feature.lua +43 -5
- package/project/.sdk/tm/lua/feature/secrets_feature.lua +15 -80
- package/project/.sdk/tm/lua/feature/streaming_feature.lua +2 -1
- package/project/.sdk/tm/lua/feature/telemetry_feature.lua +18 -7
- package/project/.sdk/tm/lua/feature/test_feature.lua +60 -62
- package/project/.sdk/tm/lua/test/feature_test.lua +181 -3
- package/project/.sdk/tm/lua/utility/clean.lua +6 -9
- package/project/.sdk/tm/lua/utility/fetcher.lua +9 -0
- package/project/.sdk/tm/lua/utility/make_options.lua +60 -18
- package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +21 -6
- package/project/.sdk/tm/ocaml/sdk_features.ml +392 -68
- package/project/.sdk/tm/ocaml/sdk_runtime.ml +47 -21
- package/project/.sdk/tm/ocaml/sdk_types.ml +2 -0
- package/project/.sdk/tm/ocaml/test/t_feature.ml +107 -2
- package/project/.sdk/tm/perl/core/context.pm +3 -0
- package/project/.sdk/tm/perl/feature/audit_feature.pm +4 -7
- package/project/.sdk/tm/perl/feature/cache_feature.pm +111 -15
- package/project/.sdk/tm/perl/feature/debug_feature.pm +2 -2
- package/project/.sdk/tm/perl/feature/metrics_feature.pm +5 -0
- package/project/.sdk/tm/perl/feature/paging_feature.pm +139 -2
- package/project/.sdk/tm/perl/feature/ratelimit_feature.pm +5 -11
- package/project/.sdk/tm/perl/feature/retry_feature.pm +22 -4
- package/project/.sdk/tm/perl/feature/secrets_feature.pm +13 -18
- package/project/.sdk/tm/perl/feature/streaming_feature.pm +2 -0
- package/project/.sdk/tm/perl/feature/telemetry_feature.pm +17 -8
- package/project/.sdk/tm/perl/feature/test_feature.pm +45 -50
- package/project/.sdk/tm/perl/t/feature.t +68 -2
- package/project/.sdk/tm/perl/t/feature_corpus.t +204 -25
- package/project/.sdk/tm/perl/utility/clean.pm +6 -8
- package/project/.sdk/tm/perl/utility/fetcher.pm +4 -0
- package/project/.sdk/tm/perl/utility/make_options.pm +38 -15
- package/project/.sdk/tm/php/core/Context.php +4 -0
- package/project/.sdk/tm/php/feature/CacheFeature.php +98 -13
- package/project/.sdk/tm/php/feature/MetricsFeature.php +8 -0
- package/project/.sdk/tm/php/feature/PagingFeature.php +128 -1
- package/project/.sdk/tm/php/feature/RatelimitFeature.php +5 -9
- package/project/.sdk/tm/php/feature/RetryFeature.php +27 -3
- package/project/.sdk/tm/php/feature/SecretsFeature.php +18 -15
- package/project/.sdk/tm/php/feature/StreamingFeature.php +2 -1
- package/project/.sdk/tm/php/feature/TelemetryFeature.php +10 -7
- package/project/.sdk/tm/php/feature/TestFeature.php +55 -47
- package/project/.sdk/tm/php/test/FeatureCorpusTest.php +262 -17
- package/project/.sdk/tm/php/test/FeatureTest.php +68 -0
- package/project/.sdk/tm/php/utility/Clean.php +3 -10
- package/project/.sdk/tm/php/utility/Fetcher.php +8 -3
- package/project/.sdk/tm/php/utility/MakeOptions.php +45 -20
- package/project/.sdk/tm/py/pkg/core/context.py +4 -0
- package/project/.sdk/tm/py/pkg/feature/cache_feature.py +79 -13
- package/project/.sdk/tm/py/pkg/feature/metrics_feature.py +7 -0
- package/project/.sdk/tm/py/pkg/feature/paging_feature.py +86 -1
- package/project/.sdk/tm/py/pkg/feature/ratelimit_feature.py +13 -16
- package/project/.sdk/tm/py/pkg/feature/retry_feature.py +31 -6
- package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +15 -66
- package/project/.sdk/tm/py/pkg/feature/streaming_feature.py +2 -1
- package/project/.sdk/tm/py/pkg/feature/telemetry_feature.py +10 -6
- package/project/.sdk/tm/py/pkg/feature/test_feature.py +56 -53
- package/project/.sdk/tm/py/pkg/utility/clean.py +4 -10
- package/project/.sdk/tm/py/pkg/utility/make_options.py +77 -30
- package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +23 -9
- package/project/.sdk/tm/py/test/test_feature.py +61 -1
- package/project/.sdk/tm/py/test/test_feature_corpus.py +197 -17
- package/project/.sdk/tm/py-data/pkg/fetch.py +6 -3
- package/project/.sdk/tm/py-data/test/test_fetch.py +7 -4
- package/project/.sdk/tm/rb/core/context.rb +4 -1
- package/project/.sdk/tm/rb/feature/audit_feature.rb +6 -5
- package/project/.sdk/tm/rb/feature/cache_feature.rb +75 -11
- package/project/.sdk/tm/rb/feature/debug_feature.rb +2 -2
- package/project/.sdk/tm/rb/feature/metrics_feature.rb +8 -0
- package/project/.sdk/tm/rb/feature/paging_feature.rb +87 -1
- package/project/.sdk/tm/rb/feature/ratelimit_feature.rb +12 -16
- package/project/.sdk/tm/rb/feature/retry_feature.rb +19 -3
- package/project/.sdk/tm/rb/feature/secrets_feature.rb +9 -64
- package/project/.sdk/tm/rb/feature/streaming_feature.rb +2 -1
- package/project/.sdk/tm/rb/feature/telemetry_feature.rb +11 -6
- package/project/.sdk/tm/rb/feature/test_feature.rb +42 -49
- package/project/.sdk/tm/rb/test/feature_corpus_test.rb +191 -25
- package/project/.sdk/tm/rb/test/feature_test.rb +75 -1
- package/project/.sdk/tm/rb/utility/clean.rb +6 -7
- package/project/.sdk/tm/rb/utility/fetcher.rb +6 -0
- package/project/.sdk/tm/rb/utility/make_options.rb +37 -16
- package/project/.sdk/tm/rust/core/context.rs +8 -0
- package/project/.sdk/tm/rust/feature/audit.rs +2 -2
- package/project/.sdk/tm/rust/feature/cache.rs +120 -3
- package/project/.sdk/tm/rust/feature/metrics.rs +24 -1
- package/project/.sdk/tm/rust/feature/paging.rs +189 -3
- package/project/.sdk/tm/rust/feature/ratelimit.rs +5 -10
- package/project/.sdk/tm/rust/feature/retry.rs +59 -6
- package/project/.sdk/tm/rust/feature/secrets.rs +36 -98
- package/project/.sdk/tm/rust/feature/streaming.rs +3 -2
- package/project/.sdk/tm/rust/feature/support.rs +4 -0
- package/project/.sdk/tm/rust/feature/telemetry.rs +22 -11
- package/project/.sdk/tm/rust/feature/test.rs +63 -57
- package/project/.sdk/tm/rust/tests/feature/secrets/main.rs +3 -3
- package/project/.sdk/tm/rust/tests/feature_test.rs +274 -0
- package/project/.sdk/tm/rust/tests/primary_utility_test.rs +1 -0
- package/project/.sdk/tm/rust/utility/clean.rs +35 -43
- package/project/.sdk/tm/rust/utility/fetcher.rs +6 -0
- package/project/.sdk/tm/rust/utility/make_options.rs +130 -38
- package/project/.sdk/tm/scala/core/Context.scala +4 -0
- package/project/.sdk/tm/scala/core/SdkClient.scala +45 -11
- package/project/.sdk/tm/scala/feature/AuditFeature.scala +6 -1
- package/project/.sdk/tm/scala/feature/CacheFeature.scala +117 -11
- package/project/.sdk/tm/scala/feature/MetricsFeature.scala +31 -1
- package/project/.sdk/tm/scala/feature/PagingFeature.scala +122 -2
- package/project/.sdk/tm/scala/feature/RatelimitFeature.scala +14 -11
- package/project/.sdk/tm/scala/feature/RetryFeature.scala +29 -7
- package/project/.sdk/tm/scala/feature/SecretsFeature.scala +11 -24
- package/project/.sdk/tm/scala/feature/StreamingFeature.scala +2 -1
- package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +12 -10
- package/project/.sdk/tm/scala/feature/TestFeature.scala +44 -44
- package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +69 -0
- package/project/.sdk/tm/scala/utility/Fetcher.scala +5 -0
- package/project/.sdk/tm/scala/utility/Make.scala +99 -14
- package/project/.sdk/tm/scala/utility/Misc.scala +5 -8
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +3 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +3 -2
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/CacheFeature.swift +122 -11
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/MetricsFeature.swift +20 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/PagingFeature.swift +102 -2
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RatelimitFeature.swift +19 -13
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RetryFeature.swift +40 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/SecretsFeature.swift +9 -13
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/StreamingFeature.swift +2 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +11 -9
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TestFeature.swift +55 -49
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Fetcher.swift +4 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +56 -17
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +4 -5
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +166 -0
- package/project/.sdk/tm/ts/src/Context.ts +4 -0
- package/project/.sdk/tm/ts/src/feature/cache/CacheFeature.ts +115 -4
- package/project/.sdk/tm/ts/src/feature/cost/CostFeature.ts +3 -2
- package/project/.sdk/tm/ts/src/feature/metrics/MetricsFeature.ts +6 -1
- package/project/.sdk/tm/ts/src/feature/paging/PagingFeature.ts +103 -5
- package/project/.sdk/tm/ts/src/feature/ratelimit/RatelimitFeature.ts +5 -9
- package/project/.sdk/tm/ts/src/feature/rbac/RbacFeature.ts +4 -4
- package/project/.sdk/tm/ts/src/feature/retry/RetryFeature.ts +25 -3
- package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +14 -2
- package/project/.sdk/tm/ts/src/feature/streaming/StreamingFeature.ts +2 -1
- package/project/.sdk/tm/ts/src/feature/telemetry/TelemetryFeature.ts +11 -6
- package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +8 -7
- package/project/.sdk/tm/ts/src/feature/validate/ValidateFeature.ts +2 -1
- package/project/.sdk/tm/ts/src/utility/CleanUtility.ts +1 -1
- package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +63 -12
- package/project/.sdk/tm/ts/test/feature/Corpus.test.ts +192 -23
- package/project/.sdk/tm/ts/test/feature/harness.ts +3 -3
- package/project/.sdk/tm/ts/test/feature.test.ts +14 -1
- package/project/.sdk/tm/ts/test/pipeline.test.ts +1 -1
- package/project/.sdk/tm/zig/core/context.zig +5 -0
- package/project/.sdk/tm/zig/core/utility.zig +118 -17
- package/project/.sdk/tm/zig/feature/cache.zig +144 -13
- package/project/.sdk/tm/zig/feature/metrics.zig +19 -0
- package/project/.sdk/tm/zig/feature/paging.zig +172 -4
- package/project/.sdk/tm/zig/feature/ratelimit.zig +5 -11
- package/project/.sdk/tm/zig/feature/retry.zig +41 -3
- package/project/.sdk/tm/zig/feature/secrets.zig +6 -1
- package/project/.sdk/tm/zig/feature/streaming.zig +2 -0
- package/project/.sdk/tm/zig/feature/telemetry.zig +15 -9
- package/project/.sdk/tm/zig/feature/test.zig +56 -40
- package/project/.sdk/tm/zig/test/feature_test.zig +174 -0
- package/project/.sdk/tm/zig/test/primary_utility_test.zig +2 -0
- package/project/sdkgen-package.json +1 -1
- package/src/cmp/ReadmeExplanation.ts +5 -2
- package/src/cmp/ReadmeFeatures.ts +21 -6
- package/src/helpers/optspec.ts +2 -2
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
require "minitest/autorun"
|
|
17
17
|
require "json"
|
|
18
|
+
require "uri"
|
|
18
19
|
require_relative "../ProjectName_sdk"
|
|
19
20
|
|
|
20
21
|
class FeatureCorpusTest < Minitest::Test
|
|
@@ -39,14 +40,21 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
39
40
|
# Returns the shape the real fetcher returns: a [response, err] PAIR, with
|
|
40
41
|
# the parsed body behind a `json` lambda and `body` as the raw string. A
|
|
41
42
|
# script that only set `body` would look like an empty result, which reads
|
|
42
|
-
# as a feature defect rather than a mis-shaped script.
|
|
43
|
-
|
|
43
|
+
# as a feature defect rather than a mis-shaped script. Each URL it is sent
|
|
44
|
+
# is kept in `sent`, and when it arrived in `times`; a `cut` response is one
|
|
45
|
+
# whose body stops before its end.
|
|
46
|
+
def scripted_fetcher(res, sent = [], times = [])
|
|
44
47
|
n = -1
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
lock = Mutex.new
|
|
49
|
+
lambda do |_ctx, fullurl, _fetchdef|
|
|
50
|
+
at = lock.synchronize do
|
|
51
|
+
sent << fullurl
|
|
52
|
+
times << Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
|
|
53
|
+
n += 1
|
|
54
|
+
end
|
|
47
55
|
spec = {}
|
|
48
56
|
if res.is_a?(Array) && !res.empty?
|
|
49
|
-
i =
|
|
57
|
+
i = at >= res.length ? res.length - 1 : at
|
|
50
58
|
spec = res[i] || {}
|
|
51
59
|
end
|
|
52
60
|
|
|
@@ -55,6 +63,18 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
55
63
|
status = spec["status"].nil? ? 200 : spec["status"].to_i
|
|
56
64
|
body = spec["body"].nil? ? {} : spec["body"]
|
|
57
65
|
|
|
66
|
+
if spec["cut"] == true
|
|
67
|
+
raw = JSON.generate(body)
|
|
68
|
+
return [{
|
|
69
|
+
"status" => status,
|
|
70
|
+
"statusText" => status < 400 ? "OK" : "ERR",
|
|
71
|
+
"headers" => (spec["headers"] || {}).dup,
|
|
72
|
+
"json" => -> { nil },
|
|
73
|
+
"body" => raw[0, raw.length / 2],
|
|
74
|
+
"unreadable" => true,
|
|
75
|
+
}, nil]
|
|
76
|
+
end
|
|
77
|
+
|
|
58
78
|
[{
|
|
59
79
|
"status" => status,
|
|
60
80
|
"statusText" => status < 400 ? "OK" : "ERR",
|
|
@@ -70,7 +90,7 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
70
90
|
# ProjectNameSDK.new, not ProjectNameSDK.test: the `test` feature is
|
|
71
91
|
# transport: 'base' and REPLACES the transport, so a client in test mode
|
|
72
92
|
# would shadow the script.
|
|
73
|
-
def build_client(kase)
|
|
93
|
+
def build_client(kase, sent = [], times = [])
|
|
74
94
|
# "test" here is the OPTION, not the `test` FEATURE. It says "this
|
|
75
95
|
# client is not live", which is what makes a REQUIRED OpenAPI server
|
|
76
96
|
# variable resolve to a deterministic test-<name> rather than raise at
|
|
@@ -78,7 +98,7 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
78
98
|
# scripted fetcher still stands.
|
|
79
99
|
opts = {
|
|
80
100
|
"test" => { "active" => true },
|
|
81
|
-
"utility" => { "fetcher" => scripted_fetcher(kase["res"]) },
|
|
101
|
+
"utility" => { "fetcher" => scripted_fetcher(kase["res"], sent, times) },
|
|
82
102
|
}
|
|
83
103
|
opts["feature"] = kase["feature"] unless kase["feature"].nil?
|
|
84
104
|
ProjectNameSDK.new(opts)
|
|
@@ -125,8 +145,24 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
125
145
|
out.sort_by { |o| [safe.fetch(o["op"], 2), o["key"]] }
|
|
126
146
|
end
|
|
127
147
|
|
|
128
|
-
def invoke(client, op, ctrl)
|
|
129
|
-
client.public_send(op["accessor"]).public_send(op["op"], {}, ctrl)
|
|
148
|
+
def invoke(client, op, ctrl, args = nil)
|
|
149
|
+
client.public_send(op["accessor"]).public_send(op["op"], (args || {}).dup, ctrl)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
ITEM_ARGS = { "id" => "corpus-item" }.freeze
|
|
153
|
+
|
|
154
|
+
# A write of one entity (#ITEM) that completes when driven with ITEM_ARGS.
|
|
155
|
+
def usable_item(accessor)
|
|
156
|
+
candidates(build_client({})).each do |cand|
|
|
157
|
+
next unless cand["accessor"] == accessor && %w[update patch remove].include?(cand["op"])
|
|
158
|
+
begin
|
|
159
|
+
invoke(build_client({}), cand, {}, ITEM_ARGS)
|
|
160
|
+
rescue StandardError
|
|
161
|
+
next
|
|
162
|
+
end
|
|
163
|
+
return cand
|
|
164
|
+
end
|
|
165
|
+
nil
|
|
130
166
|
end
|
|
131
167
|
|
|
132
168
|
# Pick operations by DRIVING them: an op is usable when it completes
|
|
@@ -147,6 +183,96 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
147
183
|
picked
|
|
148
184
|
end
|
|
149
185
|
|
|
186
|
+
READ_OPS = ["list", "load"].freeze
|
|
187
|
+
WRITE_OPS = ["create", "update", "patch", "remove"].freeze
|
|
188
|
+
|
|
189
|
+
# A read and a write of one entity (#READ, #WRITE), each driven as
|
|
190
|
+
# usable_ops drives an op.
|
|
191
|
+
def usable_pair
|
|
192
|
+
found = {}
|
|
193
|
+
candidates(build_client({})).each do |cand|
|
|
194
|
+
role = READ_OPS.include?(cand["op"]) ? "read" : (WRITE_OPS.include?(cand["op"]) ? "write" : nil)
|
|
195
|
+
seen = (found[cand["accessor"]] ||= {})
|
|
196
|
+
next if role.nil? || seen.key?(role)
|
|
197
|
+
begin
|
|
198
|
+
invoke(build_client({}), cand, {})
|
|
199
|
+
rescue StandardError
|
|
200
|
+
next
|
|
201
|
+
end
|
|
202
|
+
seen[role] = cand
|
|
203
|
+
return seen if seen.key?("read") && seen.key?("write")
|
|
204
|
+
end
|
|
205
|
+
nil
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Read one operation through the entity's stream; how many it yields.
|
|
209
|
+
def stream_call(client, op, ctrl, args = nil)
|
|
210
|
+
client.public_send(op["accessor"]).stream(op["op"], (args || {}).dup, { "ctrl" => ctrl }).count
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Each request a case expects, in order: its path, and its whole query. A
|
|
214
|
+
# path is compared without its leading slash, which an SDK with no base
|
|
215
|
+
# omits.
|
|
216
|
+
def check_sent(sent, expect, label)
|
|
217
|
+
assert_equal expect.length, sent.length, "#{label}: requests sent: #{sent.join(' | ')}"
|
|
218
|
+
expect.each_with_index do |want, i|
|
|
219
|
+
url = URI.parse(sent[i])
|
|
220
|
+
unless want["path"].nil?
|
|
221
|
+
assert_equal want["path"].sub(%r{\A/+}, ""), url.path.to_s.sub(%r{\A/+}, ""),
|
|
222
|
+
"#{label}: request #{i} path"
|
|
223
|
+
end
|
|
224
|
+
unless want["query"].nil?
|
|
225
|
+
query = URI.decode_www_form(url.query || "").to_h
|
|
226
|
+
assert_equal want["query"], query, "#{label}: request #{i} query"
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# One step: it may wait before its call, may add request headers for its
|
|
232
|
+
# call, and may pass `args` as the operation's first argument. A `stream`
|
|
233
|
+
# step reads the operation through stream, and `items` is how many it
|
|
234
|
+
# yields.
|
|
235
|
+
def step_call(client, op, step, ctrl)
|
|
236
|
+
sleep(step["wait"] / 1000.0) unless step["wait"].nil?
|
|
237
|
+
if step["stream"] == true
|
|
238
|
+
items = stream_call(client, op, ctrl, step["args"])
|
|
239
|
+
assert_equal step["items"], items, "#{op['key']}: items streamed" unless step["items"].nil?
|
|
240
|
+
return items
|
|
241
|
+
end
|
|
242
|
+
return invoke(client, op, ctrl, step["args"]) if step["headers"].nil?
|
|
243
|
+
options = client.options
|
|
244
|
+
had = options.key?("headers")
|
|
245
|
+
prior = options["headers"]
|
|
246
|
+
options["headers"] = (prior || {}).merge(step["headers"])
|
|
247
|
+
begin
|
|
248
|
+
invoke(client, op, ctrl, step["args"])
|
|
249
|
+
ensure
|
|
250
|
+
if had
|
|
251
|
+
options["headers"] = prior
|
|
252
|
+
else
|
|
253
|
+
options.delete("headers")
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# Runs a step once, or with `together: N` as N overlapping calls, and
|
|
259
|
+
# returns each call's error or nil.
|
|
260
|
+
def calls(client, op, step, ctrl)
|
|
261
|
+
Array.new((step["together"] || 1).to_i) do
|
|
262
|
+
Thread.new do
|
|
263
|
+
step_call(client, op, step, ctrl)
|
|
264
|
+
nil
|
|
265
|
+
rescue StandardError => e
|
|
266
|
+
e
|
|
267
|
+
end
|
|
268
|
+
end.map(&:value)
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# The most requests seen in any window of `ms`.
|
|
272
|
+
def busiest(sent, ms)
|
|
273
|
+
sent.map { |from| sent.count { |t| from <= t && t < from + ms } }.max || 0
|
|
274
|
+
end
|
|
275
|
+
|
|
150
276
|
# Replace #OPn throughout a case, keys included.
|
|
151
277
|
def resolve(node, tokens)
|
|
152
278
|
case node
|
|
@@ -188,6 +314,13 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
188
314
|
return
|
|
189
315
|
end
|
|
190
316
|
|
|
317
|
+
if expect.is_a?(Array)
|
|
318
|
+
assert actual.is_a?(Array) && actual.length == expect.length,
|
|
319
|
+
"#{path}: want #{expect.length} item(s), got #{actual.inspect}"
|
|
320
|
+
expect.each_with_index { |want, i| subset(actual[i], want, "#{path}[#{i}]") }
|
|
321
|
+
return
|
|
322
|
+
end
|
|
323
|
+
|
|
191
324
|
if expect.is_a?(Numeric)
|
|
192
325
|
assert actual.is_a?(Numeric), "#{path}: expected a number, got #{actual.inspect}"
|
|
193
326
|
# Money is float arithmetic; compare with a tolerance far below any
|
|
@@ -286,6 +419,11 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
286
419
|
|
|
287
420
|
ops = usable_ops(2)
|
|
288
421
|
by_key = ops.each_with_object({}) { |o, h| h[o["key"]] = o }
|
|
422
|
+
pair = usable_pair
|
|
423
|
+
pair&.each_value { |o| by_key[o["key"]] = o }
|
|
424
|
+
item = pair && usable_item(pair["read"]["accessor"])
|
|
425
|
+
by_key[item["key"]] = item unless item.nil?
|
|
426
|
+
other = pair && ops.find { |o| o["accessor"] != pair["read"]["accessor"] }
|
|
289
427
|
|
|
290
428
|
ran = 0
|
|
291
429
|
cases.each do |raw|
|
|
@@ -295,6 +433,19 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
295
433
|
next
|
|
296
434
|
end
|
|
297
435
|
|
|
436
|
+
paired = JSON.generate(raw).match?(/#(READ|WRITE|ITEM|OTHER)\b/)
|
|
437
|
+
if paired && pair.nil?
|
|
438
|
+
puts "skip \"#{raw['name']}\": needs a read and a write of one entity, this SDK offers none"
|
|
439
|
+
next
|
|
440
|
+
end
|
|
441
|
+
lacking = [["#ITEM", item], ["#OTHER", other]].find do |tok, op|
|
|
442
|
+
paired && op.nil? && JSON.generate(raw).match?(/#{tok}\b/)
|
|
443
|
+
end
|
|
444
|
+
unless lacking.nil?
|
|
445
|
+
puts "skip \"#{raw['name']}\": needs #{lacking[0]}, which this SDK cannot drive"
|
|
446
|
+
next
|
|
447
|
+
end
|
|
448
|
+
|
|
298
449
|
missing = missing_feature(raw, have)
|
|
299
450
|
unless missing.nil?
|
|
300
451
|
puts "skip \"#{raw['name']}\": needs the #{missing} feature, " \
|
|
@@ -304,38 +455,53 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
304
455
|
|
|
305
456
|
tokens = {}
|
|
306
457
|
need.times { |i| tokens["#OP#{i + 1}"] = ops[i]["key"] }
|
|
458
|
+
if paired
|
|
459
|
+
tokens["#READ"] = pair["read"]["key"]
|
|
460
|
+
tokens["#WRITE"] = pair["write"]["key"]
|
|
461
|
+
tokens["#ITEM"] = item["key"] unless item.nil?
|
|
462
|
+
tokens["#OTHER"] = other["key"] unless other.nil?
|
|
463
|
+
end
|
|
307
464
|
kase = resolve(raw, tokens)
|
|
308
465
|
label = kase["name"].to_s
|
|
309
466
|
ran += 1
|
|
310
467
|
|
|
311
468
|
# Every failing case is reported, not only the first.
|
|
312
469
|
begin
|
|
313
|
-
|
|
470
|
+
sent = []
|
|
471
|
+
times = []
|
|
472
|
+
client = build_client(kase, sent, times)
|
|
314
473
|
|
|
474
|
+
# A case-level ctrl is one control object every step shares.
|
|
475
|
+
shared = kase["ctrl"]
|
|
315
476
|
(kase["op"] || []).each do |step|
|
|
316
477
|
op = by_key[step["op"]]
|
|
317
478
|
refute_nil op, "#{label}: no operation #{step['op']}"
|
|
318
|
-
ctrl = step["ctrl"] || {}
|
|
479
|
+
ctrl = step["ctrl"] || shared || {}
|
|
319
480
|
wanterr = step["err"]
|
|
320
481
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
raise
|
|
326
|
-
rescue StandardError => e
|
|
327
|
-
refute_nil wanterr, "#{label}: #{step['op']} failed unexpectedly: #{e}"
|
|
328
|
-
if wanterr.is_a?(String)
|
|
329
|
-
# The CODE, not the message: make_error prefixes and humanises
|
|
330
|
-
# the text, so matching it would pass on any error that
|
|
331
|
-
# happened to mention the word.
|
|
332
|
-
code = e.respond_to?(:code) ? e.code : nil
|
|
333
|
-
assert_equal wanterr, code,
|
|
334
|
-
"#{label}: wrong error code (#{e})"
|
|
482
|
+
calls(client, op, step, ctrl).each do |e|
|
|
483
|
+
if e.nil?
|
|
484
|
+
assert_nil wanterr, "#{label}: #{step['op']} was expected to fail, and did not"
|
|
485
|
+
next
|
|
335
486
|
end
|
|
487
|
+
refute_nil wanterr, "#{label}: #{step['op']} failed unexpectedly: #{e}"
|
|
488
|
+
next unless wanterr.is_a?(String)
|
|
489
|
+
# The CODE, not the message: make_error prefixes and humanises
|
|
490
|
+
# the text, so matching it would pass on any error that
|
|
491
|
+
# happened to mention the word.
|
|
492
|
+
code = e.respond_to?(:code) ? e.code : nil
|
|
493
|
+
assert_equal wanterr, code, "#{label}: wrong error code (#{e})"
|
|
336
494
|
end
|
|
337
495
|
end
|
|
338
496
|
|
|
497
|
+
pace = kase["pace"]
|
|
498
|
+
unless pace.nil?
|
|
499
|
+
most = busiest(times, pace["ms"])
|
|
500
|
+
assert most <= pace["max"],
|
|
501
|
+
"#{label}: #{most} requests within #{pace['ms']} ms, want at most #{pace['max']}"
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
check_sent(sent, kase["sent"], label) unless kase["sent"].nil?
|
|
339
505
|
subset(record(client, name), kase["out"], "#{label}: _#{name}")
|
|
340
506
|
rescue Minitest::Assertion, StandardError => e
|
|
341
507
|
failed << (e.message.start_with?(label) ? e.message : "#{label}: #{e.message}")
|
|
@@ -610,6 +610,58 @@ class FeatureTest < Minitest::Test
|
|
|
610
610
|
assert_equal 3, calls.length
|
|
611
611
|
end
|
|
612
612
|
|
|
613
|
+
def test_cache_keys_on_the_request_headers
|
|
614
|
+
skip_unless_feature("cache")
|
|
615
|
+
server, calls = H.recording_server
|
|
616
|
+
h = harness([fspec("cache", "ttl" => 10000)], server: server)
|
|
617
|
+
h.op(path: "/w/1", headers: { "x-tenant" => "tenant-a" })
|
|
618
|
+
h.op(path: "/w/1", headers: { "X-Tenant" => "tenant-b" })
|
|
619
|
+
assert_equal 2, calls.length
|
|
620
|
+
h.op(path: "/w/1", headers: { "x-tenant" => "tenant-b" })
|
|
621
|
+
assert_equal 2, calls.length
|
|
622
|
+
end
|
|
623
|
+
|
|
624
|
+
def test_cache_a_write_drops_its_collection
|
|
625
|
+
skip_unless_feature("cache")
|
|
626
|
+
server, calls = H.recording_server
|
|
627
|
+
h = harness([fspec("cache", "ttl" => 10000)], server: server)
|
|
628
|
+
paths = ["/w/1", "/w", "/w/1/part", "/other/1", "/w/2"]
|
|
629
|
+
paths.each { |p| h.op(path: p) }
|
|
630
|
+
h.op(opname: "update", method: "PUT", path: "/w/1")
|
|
631
|
+
paths.each { |p| h.op(path: p) }
|
|
632
|
+
assert_equal 9, calls.length
|
|
633
|
+
assert_equal 2, h.track(:@_cache)["hit"]
|
|
634
|
+
end
|
|
635
|
+
|
|
636
|
+
def test_cache_control_prevents_storing
|
|
637
|
+
skip_unless_feature("cache")
|
|
638
|
+
["no-store", "private", "No-Cache", "max-age=60, private"].each do |control|
|
|
639
|
+
server, calls = H.recording_server do |_n, _fd|
|
|
640
|
+
[H.make_response(200, { "ok" => true }, { "Cache-Control" => control }), nil]
|
|
641
|
+
end
|
|
642
|
+
h = harness([fspec("cache", "ttl" => 10000)], server: server)
|
|
643
|
+
h.op(path: "/w")
|
|
644
|
+
h.op(path: "/w")
|
|
645
|
+
assert_equal 2, calls.length, control
|
|
646
|
+
end
|
|
647
|
+
end
|
|
648
|
+
|
|
649
|
+
def test_cache_max_age_caps_the_ttl
|
|
650
|
+
skip_unless_feature("cache")
|
|
651
|
+
clock = H::Clock.new
|
|
652
|
+
server, calls = H.recording_server do |_n, _fd|
|
|
653
|
+
[H.make_response(200, { "ok" => true }, { "cache-control" => "max-age=1" }), nil]
|
|
654
|
+
end
|
|
655
|
+
h = harness([fspec("cache", "ttl" => 10000, "now" => clock.now)], server: server)
|
|
656
|
+
h.op(path: "/w")
|
|
657
|
+
clock.advance(500)
|
|
658
|
+
h.op(path: "/w")
|
|
659
|
+
assert_equal 1, calls.length
|
|
660
|
+
clock.advance(600)
|
|
661
|
+
h.op(path: "/w")
|
|
662
|
+
assert_equal 2, calls.length
|
|
663
|
+
end
|
|
664
|
+
|
|
613
665
|
def test_cache_inactive_does_not_wrap
|
|
614
666
|
skip_unless_feature("cache")
|
|
615
667
|
server, calls = H.recording_server
|
|
@@ -777,7 +829,7 @@ class FeatureTest < Minitest::Test
|
|
|
777
829
|
def test_debug_captures_a_redacted_trace_and_honours_on_entry_and_max
|
|
778
830
|
skip_unless_feature("debug")
|
|
779
831
|
seen = []
|
|
780
|
-
h = harness([fspec("debug", "max" => 1, "
|
|
832
|
+
h = harness([fspec("debug", "max" => 1, "onEntry" => ->(e) { seen << e })])
|
|
781
833
|
h.op(headers: { "authorization" => "Bearer secret" })
|
|
782
834
|
h.op(opname: "list")
|
|
783
835
|
entries = h.track(:@_debug)["entries"]
|
|
@@ -853,6 +905,28 @@ class FeatureTest < Minitest::Test
|
|
|
853
905
|
end
|
|
854
906
|
|
|
855
907
|
|
|
908
|
+
# === per-call state ===
|
|
909
|
+
|
|
910
|
+
def test_no_feature_keeps_a_context_past_its_call
|
|
911
|
+
skip_unless_feature("netsim")
|
|
912
|
+
names = %w[audit debug telemetry metrics cost].select { |n| H.has_feature?(n) }
|
|
913
|
+
skip "no feature here keeps per-call state" if names.empty?
|
|
914
|
+
h = harness([fspec("netsim", "failEvery" => 2, "failStatus" => 500)] +
|
|
915
|
+
names.map { |n| fspec(n) })
|
|
916
|
+
20.times { |i| h.op(path: "/w/#{i}") }
|
|
917
|
+
names.each do |n|
|
|
918
|
+
f = h.feature(n)
|
|
919
|
+
f.instance_variables.each do |iv|
|
|
920
|
+
table = f.instance_variable_get(iv)
|
|
921
|
+
next unless table.is_a?(Hash)
|
|
922
|
+
held = table.keys.count { |k| k.is_a?(ProjectNameContext) }
|
|
923
|
+
assert_equal 0, held, "#{n} #{iv} still holds #{held} context(s) after 20 calls"
|
|
924
|
+
end
|
|
925
|
+
end
|
|
926
|
+
assert_equal 20, h.track(:@_audit)["records"].length if names.include?("audit")
|
|
927
|
+
end
|
|
928
|
+
|
|
929
|
+
|
|
856
930
|
# === one call, one id ===
|
|
857
931
|
|
|
858
932
|
def test_telemetry_debug_and_audit_carry_one_calls_context_id
|
|
@@ -44,14 +44,13 @@ module ProjectNameUtilities
|
|
|
44
44
|
n.nil? || n.nan? || n.infinite? || n < 0 ? dflt : n.floor
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
# The
|
|
48
|
-
#
|
|
49
|
-
#
|
|
50
|
-
#
|
|
47
|
+
# The registry make_options builds; a context without one (make_error is
|
|
48
|
+
# reached with a bare one) falls back to the schema defaults, so nothing
|
|
49
|
+
# leaves raw for want of a constructor. A Hash stands in for a context
|
|
50
|
+
# before one exists (make_options).
|
|
51
51
|
def self.config(ctx)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return derived if derived.is_a?(Hash)
|
|
52
|
+
cfg = ctx.respond_to?(:cleancfg) ? ctx.cleancfg : (ctx.is_a?(Hash) ? ctx["cleancfg"] : nil)
|
|
53
|
+
return cfg if cfg.is_a?(Hash)
|
|
55
54
|
make_config(ProjectNameSchema::OPTSPEC["clean"])
|
|
56
55
|
end
|
|
57
56
|
|
|
@@ -189,6 +189,12 @@ module ProjectNameUtilities
|
|
|
189
189
|
end
|
|
190
190
|
|
|
191
191
|
http = ProjectNameUtilities.http_checkout(key, uri, proxy)
|
|
192
|
+
# A bound in milliseconds, for a caller beneath the timeout feature;
|
|
193
|
+
# a pooled connection goes back with Net::HTTP's own.
|
|
194
|
+
bound = fetchdef["timeout"]
|
|
195
|
+
bound = bound.is_a?(Numeric) && bound > 0 ? bound / 1000.0 : 60
|
|
196
|
+
http.read_timeout = bound
|
|
197
|
+
http.write_timeout = bound
|
|
192
198
|
begin
|
|
193
199
|
# Net::HTTP retries idempotent requests; an EOF can follow a committed POST.
|
|
194
200
|
resp = http.request(request) do |r|
|
|
@@ -3,6 +3,22 @@ require_relative 'struct/voxgig_struct'
|
|
|
3
3
|
require_relative '../schema'
|
|
4
4
|
require_relative 'clean'
|
|
5
5
|
module ProjectNameUtilities
|
|
6
|
+
# The model's options for a feature sit beneath the caller's, key by key: a
|
|
7
|
+
# key the caller sets replaces the default whole, so a list is never merged.
|
|
8
|
+
def self.feature_defaults(cfgfeature, feature)
|
|
9
|
+
return nil unless feature.nil? || feature.is_a?(Hash)
|
|
10
|
+
out = (feature || {}).dup
|
|
11
|
+
(cfgfeature.is_a?(Hash) ? cfgfeature : {}).each do |name, fdef|
|
|
12
|
+
dflt = fdef.is_a?(Hash) ? fdef["options"] : nil
|
|
13
|
+
given = out[name]
|
|
14
|
+
next unless dflt.is_a?(Hash)
|
|
15
|
+
next if given.nil? && dflt["active"] != true
|
|
16
|
+
next unless given.nil? || given.is_a?(Hash)
|
|
17
|
+
out[name] = VoxgigStruct.clone(dflt).merge(given || {})
|
|
18
|
+
end
|
|
19
|
+
out
|
|
20
|
+
end
|
|
21
|
+
|
|
6
22
|
MakeOptions = ->(ctx) {
|
|
7
23
|
options = ctx.options || {}
|
|
8
24
|
options = {} unless options.is_a?(Hash)
|
|
@@ -68,7 +84,7 @@ module ProjectNameUtilities
|
|
|
68
84
|
cfgclean = cfgopts["clean"].is_a?(Hash) ? VoxgigStruct.clone(cfgopts["clean"]) : nil
|
|
69
85
|
cleancfg = CleanSupport.make_config(VoxgigStruct.merge(
|
|
70
86
|
[{}, ProjectNameSchema::OPTSPEC["clean"], cfgclean, opts["clean"]].select { |c| c.is_a?(Hash) }))
|
|
71
|
-
cleanctx = { "
|
|
87
|
+
cleanctx = { "cleancfg" => cleancfg }
|
|
72
88
|
CleanSupport.add_options(cleanctx, opts.reject { |k, _| k == "clean" })
|
|
73
89
|
[cfgopts, opts].each do |block|
|
|
74
90
|
CleanSupport.splitvalues(VoxgigStruct.getpath(block, "clean.values")).each do |raw|
|
|
@@ -96,6 +112,9 @@ module ProjectNameUtilities
|
|
|
96
112
|
opts["feature"] = fmap
|
|
97
113
|
end
|
|
98
114
|
|
|
115
|
+
fdefaults = ProjectNameUtilities.feature_defaults(config["feature"], opts["feature"])
|
|
116
|
+
opts["feature"] = fdefaults unless fdefaults.nil?
|
|
117
|
+
|
|
99
118
|
# THE OPTION SPEC IS GENERATED, NOT WRITTEN HERE.
|
|
100
119
|
#
|
|
101
120
|
# `ProjectNameSchema::OPTSPEC` is built from the model:
|
|
@@ -166,16 +185,17 @@ module ProjectNameUtilities
|
|
|
166
185
|
opts["system"]["fetch"] = sys_fetch
|
|
167
186
|
end
|
|
168
187
|
|
|
169
|
-
# Resolve the feature add-order: an explicit array order (above) wins
|
|
170
|
-
#
|
|
171
|
-
#
|
|
172
|
-
|
|
188
|
+
# Resolve the feature add-order: an explicit array order (above) wins, and
|
|
189
|
+
# the names it leaves out follow it test-first, then sorted, so the outcome
|
|
190
|
+
# is deterministic and `test` is the base transport of a map.
|
|
191
|
+
begin
|
|
173
192
|
fmap = opts["feature"]
|
|
174
|
-
names = fmap.is_a?(Hash) ?
|
|
193
|
+
names = fmap.is_a?(Hash) ?
|
|
194
|
+
fmap.keys.select { |k| k.is_a?(String) && !featureorder.include?(k) }.sort : []
|
|
175
195
|
if names.include?("test")
|
|
176
|
-
|
|
196
|
+
rest = ["test"] + names.reject { |n| n == "test" }
|
|
177
197
|
else
|
|
178
|
-
|
|
198
|
+
rest = names
|
|
179
199
|
end
|
|
180
200
|
# Station special case, mirroring test's: its transport wrap must
|
|
181
201
|
# sit immediately outside the base transport (inside every other
|
|
@@ -183,21 +203,22 @@ module ProjectNameUtilities
|
|
|
183
203
|
# test - or first, when no test entry exists. Without this the
|
|
184
204
|
# sorted default would init station last and wrap OUTSIDE the
|
|
185
205
|
# recording features, turning its wire-truth events into fiction.
|
|
186
|
-
si =
|
|
206
|
+
si = rest.index("station")
|
|
187
207
|
unless si.nil?
|
|
188
|
-
|
|
189
|
-
ti =
|
|
190
|
-
|
|
208
|
+
rest.delete_at(si)
|
|
209
|
+
ti = rest.index("test")
|
|
210
|
+
rest.insert(ti.nil? ? 0 : ti + 1, "station")
|
|
191
211
|
end
|
|
212
|
+
featureorder += rest
|
|
192
213
|
end
|
|
193
214
|
|
|
194
215
|
# Again over the merged result: the config's own defaults can carry one.
|
|
195
216
|
CleanSupport.add_options(cleanctx, opts.reject { |k, _| k == "clean" })
|
|
196
217
|
|
|
197
|
-
opts["__derived__"] = {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
218
|
+
opts["__derived__"] = { "featureorder" => featureorder }
|
|
219
|
+
|
|
220
|
+
# Beside the options, not in them: options_map hands them to callers.
|
|
221
|
+
ctx.cleancfg = cleancfg
|
|
201
222
|
|
|
202
223
|
opts
|
|
203
224
|
}
|
|
@@ -32,6 +32,7 @@ pub struct CtxSpec {
|
|
|
32
32
|
pub config: Option<Value>,
|
|
33
33
|
pub entopts: Option<Value>,
|
|
34
34
|
pub options: Option<Value>,
|
|
35
|
+
pub cleancfg: Option<Value>,
|
|
35
36
|
pub entity: Option<Rc<dyn Entity>>,
|
|
36
37
|
pub shared: Option<Value>,
|
|
37
38
|
pub opmap: Option<OpMap>,
|
|
@@ -57,6 +58,8 @@ pub struct Context {
|
|
|
57
58
|
pub config: RefCell<Value>,
|
|
58
59
|
pub entopts: RefCell<Value>,
|
|
59
60
|
pub options: RefCell<Value>,
|
|
61
|
+
/// The clean registry, beside the options rather than in them.
|
|
62
|
+
pub cleancfg: RefCell<Value>,
|
|
60
63
|
pub opmap: RefCell<OpMap>,
|
|
61
64
|
pub response: RefCell<Option<Rc<RefCell<Response>>>>,
|
|
62
65
|
pub result: RefCell<Option<Rc<RefCell<SdkResult>>>>,
|
|
@@ -135,6 +138,10 @@ impl Context {
|
|
|
135
138
|
.options
|
|
136
139
|
.or_else(|| basectx.map(|b| b.options.borrow().clone()))
|
|
137
140
|
.unwrap_or(Value::Noval);
|
|
141
|
+
let cleancfg = ctxspec
|
|
142
|
+
.cleancfg
|
|
143
|
+
.or_else(|| basectx.map(|b| b.cleancfg.borrow().clone()))
|
|
144
|
+
.unwrap_or(Value::Noval);
|
|
138
145
|
let entity = ctxspec
|
|
139
146
|
.entity
|
|
140
147
|
.or_else(|| basectx.and_then(|b| b.entity.borrow().clone()));
|
|
@@ -212,6 +219,7 @@ impl Context {
|
|
|
212
219
|
config: RefCell::new(config),
|
|
213
220
|
entopts: RefCell::new(entopts),
|
|
214
221
|
options: RefCell::new(options),
|
|
222
|
+
cleancfg: RefCell::new(cleancfg),
|
|
215
223
|
opmap: RefCell::new(opmap),
|
|
216
224
|
response: RefCell::new(response),
|
|
217
225
|
result: RefCell::new(result),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
use std::rc::Rc;
|
|
3
3
|
|
|
4
4
|
use crate::core::context::Context;
|
|
5
|
-
use crate::core::helpers::{
|
|
5
|
+
use crate::core::helpers::{getp, setp};
|
|
6
6
|
use crate::core::types::{Feature, OutVal};
|
|
7
7
|
use crate::feature::support::*;
|
|
8
8
|
use crate::utility::voxgigstruct::Value;
|
|
@@ -90,7 +90,7 @@ impl AuditFeature {
|
|
|
90
90
|
|
|
91
91
|
let sink = getp(&self.options, "sink");
|
|
92
92
|
if let Value::Func(_) = sink {
|
|
93
|
-
|
|
93
|
+
call_sink(&sink, &record);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}
|