@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
|
@@ -772,6 +772,106 @@ fn feature_cache_inactive_does_not_wrap() {
|
|
|
772
772
|
assert_eq!(calls.borrow().len(), 2, "expected 2 calls");
|
|
773
773
|
}
|
|
774
774
|
|
|
775
|
+
fn fh_cache_load(h: &FhHarness, path: &str, headers: Value) {
|
|
776
|
+
h.op(FhOpSpec {
|
|
777
|
+
op: "load".to_string(),
|
|
778
|
+
path: path.to_string(),
|
|
779
|
+
headers,
|
|
780
|
+
..Default::default()
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
#[test]
|
|
785
|
+
fn feature_cache_keys_on_request_headers() {
|
|
786
|
+
if !fh_present(&["cache"]) {
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
let (server, calls) = fh_recorder(None);
|
|
790
|
+
let f = Rc::new(RefCell::new(CacheFeature::new()));
|
|
791
|
+
let h = fh_make(Some(server), vec![(fr(&f), jo(vec![("ttl", Value::Num(10000.0))]))]);
|
|
792
|
+
fh_cache_load(&h, "/w/1", jo(vec![("x-tenant", Value::str("tenant-a"))]));
|
|
793
|
+
fh_cache_load(&h, "/w/1", jo(vec![("X-Tenant", Value::str("tenant-b"))]));
|
|
794
|
+
assert_eq!(calls.borrow().len(), 2, "a second tenant was served the first tenant's entry");
|
|
795
|
+
fh_cache_load(&h, "/w/1", jo(vec![("x-tenant", Value::str("tenant-b"))]));
|
|
796
|
+
assert_eq!(calls.borrow().len(), 2, "the same headers did not share an entry");
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
#[test]
|
|
800
|
+
fn feature_cache_a_write_drops_its_collection() {
|
|
801
|
+
if !fh_present(&["cache"]) {
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
let (server, calls) = fh_recorder(None);
|
|
805
|
+
let f = Rc::new(RefCell::new(CacheFeature::new()));
|
|
806
|
+
let h = fh_make(Some(server), vec![(fr(&f), jo(vec![("ttl", Value::Num(10000.0))]))]);
|
|
807
|
+
let paths = ["/w/1", "/w", "/w/1/part", "/other/1", "/w/2"];
|
|
808
|
+
for p in paths {
|
|
809
|
+
fh_cache_load(&h, p, Value::Noval);
|
|
810
|
+
}
|
|
811
|
+
h.op(FhOpSpec {
|
|
812
|
+
op: "update".to_string(),
|
|
813
|
+
method: "PUT".to_string(),
|
|
814
|
+
path: "/w/1".to_string(),
|
|
815
|
+
..Default::default()
|
|
816
|
+
});
|
|
817
|
+
for p in paths {
|
|
818
|
+
fh_cache_load(&h, p, Value::Noval);
|
|
819
|
+
}
|
|
820
|
+
assert_eq!(calls.borrow().len(), 9, "expected the collection refetched and /other cached");
|
|
821
|
+
assert_eq!(f.borrow().track.borrow().hit, 2, "expected /other served from cache");
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
#[test]
|
|
825
|
+
fn feature_cache_control_prevents_storing() {
|
|
826
|
+
if !fh_present(&["cache"]) {
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
for control in ["no-store", "private", "No-Cache", "max-age=60, private"] {
|
|
830
|
+
let (server, calls) = fh_recorder(Some(Rc::new(move |_n, _fd| {
|
|
831
|
+
Ok(fh_response(
|
|
832
|
+
200,
|
|
833
|
+
jo(vec![("ok", Value::Bool(true))]),
|
|
834
|
+
jo(vec![("Cache-Control", Value::str(control))]),
|
|
835
|
+
))
|
|
836
|
+
})));
|
|
837
|
+
let f = Rc::new(RefCell::new(CacheFeature::new()));
|
|
838
|
+
let h = fh_make(Some(server), vec![(fr(&f), jo(vec![("ttl", Value::Num(10000.0))]))]);
|
|
839
|
+
fh_cache_load(&h, "/w", Value::Noval);
|
|
840
|
+
fh_cache_load(&h, "/w", Value::Noval);
|
|
841
|
+
assert_eq!(calls.borrow().len(), 2, "{} was stored", control);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
#[test]
|
|
846
|
+
fn feature_cache_max_age_caps_the_ttl() {
|
|
847
|
+
if !fh_present(&["cache"]) {
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
850
|
+
let clock = FhClock::new();
|
|
851
|
+
let (server, calls) = fh_recorder(Some(Rc::new(|_n, _fd| {
|
|
852
|
+
Ok(fh_response(
|
|
853
|
+
200,
|
|
854
|
+
jo(vec![("ok", Value::Bool(true))]),
|
|
855
|
+
jo(vec![("cache-control", Value::str("max-age=1"))]),
|
|
856
|
+
))
|
|
857
|
+
})));
|
|
858
|
+
let f = Rc::new(RefCell::new(CacheFeature::new()));
|
|
859
|
+
let h = fh_make(
|
|
860
|
+
Some(server),
|
|
861
|
+
vec![(
|
|
862
|
+
fr(&f),
|
|
863
|
+
jo(vec![("ttl", Value::Num(10000.0)), ("now", clock.now_fn())]),
|
|
864
|
+
)],
|
|
865
|
+
);
|
|
866
|
+
fh_cache_load(&h, "/w", Value::Noval);
|
|
867
|
+
clock.advance(500);
|
|
868
|
+
fh_cache_load(&h, "/w", Value::Noval);
|
|
869
|
+
assert_eq!(calls.borrow().len(), 1, "expected a hit inside max-age");
|
|
870
|
+
clock.advance(600);
|
|
871
|
+
fh_cache_load(&h, "/w", Value::Noval);
|
|
872
|
+
assert_eq!(calls.borrow().len(), 2, "expected max-age=1 to expire the entry before the ttl");
|
|
873
|
+
}
|
|
874
|
+
|
|
775
875
|
// --- idempotency ----------------------------------------------------------------
|
|
776
876
|
|
|
777
877
|
#[test]
|
|
@@ -1629,6 +1729,137 @@ fn feature_paging_body_cursor_and_explicit_cursor() {
|
|
|
1629
1729
|
assert_eq!(getp(&paging, "hasMore"), Value::Bool(true));
|
|
1630
1730
|
}
|
|
1631
1731
|
|
|
1732
|
+
// The documented hasMore loop, one request per page.
|
|
1733
|
+
fn paging_walk(reply: FhReply) -> (Vec<String>, Value) {
|
|
1734
|
+
paging_walk_with(reply, Value::Noval)
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
fn paging_walk_with(reply: FhReply, options: Value) -> (Vec<String>, Value) {
|
|
1738
|
+
let (server, calls) = fh_recorder(Some(reply));
|
|
1739
|
+
let f = Rc::new(RefCell::new(PagingFeature::new()));
|
|
1740
|
+
let h = fh_make(Some(server), vec![(fr(&f), options)]);
|
|
1741
|
+
let paging = jo(vec![]);
|
|
1742
|
+
let ctrl = jo(vec![("paging", paging.clone())]);
|
|
1743
|
+
let list = || FhOpSpec {
|
|
1744
|
+
op: "list".to_string(),
|
|
1745
|
+
path: "/w".to_string(),
|
|
1746
|
+
ctrl: ctrl.clone(),
|
|
1747
|
+
..Default::default()
|
|
1748
|
+
};
|
|
1749
|
+
h.op(list());
|
|
1750
|
+
while getp(&paging, "hasMore") == Value::Bool(true) && calls.borrow().len() < 4 {
|
|
1751
|
+
h.op(list());
|
|
1752
|
+
}
|
|
1753
|
+
let n = calls.borrow().len();
|
|
1754
|
+
((0..n).map(|i| rec_url(&calls, i)).collect(), paging)
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
#[test]
|
|
1758
|
+
fn feature_paging_body_next_is_sent_as_the_cursor() {
|
|
1759
|
+
if !fh_present(&["paging"]) {
|
|
1760
|
+
return;
|
|
1761
|
+
}
|
|
1762
|
+
let (urls, paging) = paging_walk(Rc::new(|n, _fd| {
|
|
1763
|
+
let next = ["c3", "c6"].get(n as usize - 1).map_or(Value::Null, |c| Value::str(*c));
|
|
1764
|
+
Ok(fh_response(200, jo(vec![("next", next)]), Value::Noval))
|
|
1765
|
+
}));
|
|
1766
|
+
assert_eq!(urls, vec![
|
|
1767
|
+
"http://api.test/w?page=1", "http://api.test/w?cursor=c3", "http://api.test/w?cursor=c6",
|
|
1768
|
+
]);
|
|
1769
|
+
assert_eq!(getp(&paging, "hasMore"), Value::Bool(false));
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
#[test]
|
|
1773
|
+
fn feature_paging_body_next_url_is_the_next_request() {
|
|
1774
|
+
if !fh_present(&["paging"]) {
|
|
1775
|
+
return;
|
|
1776
|
+
}
|
|
1777
|
+
let (urls, paging) = paging_walk(Rc::new(|n, _fd| {
|
|
1778
|
+
let next = ["http://api.test/v2/w?cursor=c%2F3&limit=3", "/v2/w?cursor=c6"]
|
|
1779
|
+
.get(n as usize - 1).map_or(Value::Null, |c| Value::str(*c));
|
|
1780
|
+
Ok(fh_response(200, jo(vec![("next", next)]), Value::Noval))
|
|
1781
|
+
}));
|
|
1782
|
+
assert_eq!(urls, vec![
|
|
1783
|
+
"http://api.test/w?page=1",
|
|
1784
|
+
"http://api.test/v2/w?cursor=c%2F3&limit=3",
|
|
1785
|
+
"http://api.test/v2/w?cursor=c6",
|
|
1786
|
+
]);
|
|
1787
|
+
assert_eq!(getp(&paging, "hasMore"), Value::Bool(false));
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
#[test]
|
|
1791
|
+
fn feature_paging_link_next_url_is_the_next_request() {
|
|
1792
|
+
if !fh_present(&["paging"]) {
|
|
1793
|
+
return;
|
|
1794
|
+
}
|
|
1795
|
+
let (urls, paging) = paging_walk(Rc::new(|n, _fd| {
|
|
1796
|
+
let headers = ["<http://api.test/w?after=b3>; rel=\"next\"", "</w?after=b6>; rel=\"next\""]
|
|
1797
|
+
.get(n as usize - 1).map_or(Value::Noval, |l| jo(vec![("link", Value::str(*l))]));
|
|
1798
|
+
Ok(fh_response(200, ja(vec![]), headers))
|
|
1799
|
+
}));
|
|
1800
|
+
assert_eq!(urls, vec![
|
|
1801
|
+
"http://api.test/w?page=1", "http://api.test/w?after=b3", "http://api.test/w?after=b6",
|
|
1802
|
+
]);
|
|
1803
|
+
assert_eq!(getp(&paging, "hasMore"), Value::Bool(false));
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
#[test]
|
|
1807
|
+
fn feature_paging_query_only_link_keeps_the_path() {
|
|
1808
|
+
if !fh_present(&["paging"]) {
|
|
1809
|
+
return;
|
|
1810
|
+
}
|
|
1811
|
+
let (urls, _) = paging_walk(Rc::new(|n, _fd| {
|
|
1812
|
+
let headers = ["</v1/items?page=2>; rel=\"next\"", "<?page=3>; rel=\"next\""]
|
|
1813
|
+
.get(n as usize - 1).map_or(Value::Noval, |l| jo(vec![("link", Value::str(*l))]));
|
|
1814
|
+
Ok(fh_response(200, ja(vec![]), headers))
|
|
1815
|
+
}));
|
|
1816
|
+
assert_eq!(urls, vec![
|
|
1817
|
+
"http://api.test/w?page=1", "http://api.test/v1/items?page=2", "http://api.test/v1/items?page=3",
|
|
1818
|
+
]);
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
#[test]
|
|
1822
|
+
fn feature_paging_path_relative_link_resolves_against_the_request() {
|
|
1823
|
+
if !fh_present(&["paging"]) {
|
|
1824
|
+
return;
|
|
1825
|
+
}
|
|
1826
|
+
let (urls, _) = paging_walk(Rc::new(|n, _fd| {
|
|
1827
|
+
let headers = ["</v1/items?page=2>; rel=\"next\"", "<more?page=3>; rel=\"next\""]
|
|
1828
|
+
.get(n as usize - 1).map_or(Value::Noval, |l| jo(vec![("link", Value::str(*l))]));
|
|
1829
|
+
Ok(fh_response(200, ja(vec![]), headers))
|
|
1830
|
+
}));
|
|
1831
|
+
assert_eq!(urls, vec![
|
|
1832
|
+
"http://api.test/w?page=1", "http://api.test/v1/items?page=2", "http://api.test/v1/more?page=3",
|
|
1833
|
+
]);
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
#[test]
|
|
1837
|
+
fn feature_paging_foreign_link_ends_the_walk() {
|
|
1838
|
+
if !fh_present(&["paging"]) {
|
|
1839
|
+
return;
|
|
1840
|
+
}
|
|
1841
|
+
let (urls, paging) = paging_walk(Rc::new(|_n, _fd| {
|
|
1842
|
+
Ok(fh_response(200, ja(vec![]),
|
|
1843
|
+
jo(vec![("link", Value::str("<https://elsewhere.test/w?after=b3>; rel=\"next\""))])))
|
|
1844
|
+
}));
|
|
1845
|
+
assert_eq!(urls, vec!["http://api.test/w?page=1"]);
|
|
1846
|
+
assert_eq!(getp(&paging, "hasMore"), Value::Bool(false));
|
|
1847
|
+
assert_eq!(getp(&paging, "foreign"), Value::str("https://elsewhere.test/w?after=b3"));
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1850
|
+
#[test]
|
|
1851
|
+
fn feature_paging_cursor_mode_sends_a_slash_cursor() {
|
|
1852
|
+
if !fh_present(&["paging"]) {
|
|
1853
|
+
return;
|
|
1854
|
+
}
|
|
1855
|
+
let (urls, paging) = paging_walk_with(Rc::new(|n, _fd| {
|
|
1856
|
+
let next = if n == 1 { Value::str("/c3") } else { Value::Null };
|
|
1857
|
+
Ok(fh_response(200, jo(vec![("next", next)]), Value::Noval))
|
|
1858
|
+
}), jo(vec![("next", Value::str("cursor"))]));
|
|
1859
|
+
assert_eq!(urls, vec!["http://api.test/w?page=1", "http://api.test/w?cursor=%2Fc3"]);
|
|
1860
|
+
assert_eq!(getp(&paging, "hasMore"), Value::Bool(false));
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1632
1863
|
#[test]
|
|
1633
1864
|
fn feature_paging_non_list_not_paged() {
|
|
1634
1865
|
if !fh_present(&["paging"]) {
|
|
@@ -1754,6 +1985,49 @@ fn feature_streaming_batches_with_chunksize() {
|
|
|
1754
1985
|
assert_eq!(batches, want, "expected chunked batches");
|
|
1755
1986
|
}
|
|
1756
1987
|
|
|
1988
|
+
#[test]
|
|
1989
|
+
fn feature_streaming_failed_result_is_not_streamed() {
|
|
1990
|
+
if !fh_present(&["streaming"]) {
|
|
1991
|
+
return;
|
|
1992
|
+
}
|
|
1993
|
+
let (server, _calls) = fh_recorder(Some(Rc::new(|_n, _fd| {
|
|
1994
|
+
Ok(fh_response(503, ja(vec![]), Value::Noval))
|
|
1995
|
+
})));
|
|
1996
|
+
let f = Rc::new(RefCell::new(StreamingFeature::new()));
|
|
1997
|
+
let h = fh_make(Some(server), vec![(fr(&f), Value::Noval)]);
|
|
1998
|
+
let res = h.op(FhOpSpec {
|
|
1999
|
+
op: "list".to_string(),
|
|
2000
|
+
path: "/w".to_string(),
|
|
2001
|
+
..Default::default()
|
|
2002
|
+
});
|
|
2003
|
+
let result = res.result.unwrap();
|
|
2004
|
+
assert!(
|
|
2005
|
+
!result.borrow().streaming && result.borrow().stream.is_none(),
|
|
2006
|
+
"a failed result must keep no stream"
|
|
2007
|
+
);
|
|
2008
|
+
assert_eq!(f.borrow().opened, 0, "expected no opened streams");
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
#[test]
|
|
2012
|
+
fn feature_streaming_empty_list_streams_nothing() {
|
|
2013
|
+
if !fh_present(&["streaming"]) {
|
|
2014
|
+
return;
|
|
2015
|
+
}
|
|
2016
|
+
let (server, _calls) = fh_recorder(Some(Rc::new(|_n, _fd| {
|
|
2017
|
+
Ok(fh_response(200, ja(vec![]), Value::Noval))
|
|
2018
|
+
})));
|
|
2019
|
+
let f = Rc::new(RefCell::new(StreamingFeature::new()));
|
|
2020
|
+
let h = fh_make(Some(server), vec![(fr(&f), Value::Noval)]);
|
|
2021
|
+
let res = h.op(FhOpSpec {
|
|
2022
|
+
op: "list".to_string(),
|
|
2023
|
+
path: "/w".to_string(),
|
|
2024
|
+
..Default::default()
|
|
2025
|
+
});
|
|
2026
|
+
let result = res.result.unwrap();
|
|
2027
|
+
let stream = result.borrow().stream.clone().expect("expected stream fn");
|
|
2028
|
+
assert!(stream().is_empty(), "an empty list streams nothing");
|
|
2029
|
+
}
|
|
2030
|
+
|
|
1757
2031
|
#[test]
|
|
1758
2032
|
fn feature_streaming_non_list_not_streamed() {
|
|
1759
2033
|
if !fh_present(&["streaming"]) {
|
|
@@ -114,6 +114,7 @@ fn primary_utility_exists() {
|
|
|
114
114
|
assert!(matches!(utility.prepare_headers(&ctx), Value::Map(_)));
|
|
115
115
|
assert!(matches!(utility.prepare_query(&ctx), Value::Map(_)));
|
|
116
116
|
assert!(matches!(utility.prepare_params(&ctx), Value::Map(_)));
|
|
117
|
+
*ctx.options.borrow_mut() = jo(vec![]);
|
|
117
118
|
assert!(matches!(utility.make_options(&ctx), Ok(Value::Map(_))));
|
|
118
119
|
let _ = utility.clean(&ctx, &Value::str("x"));
|
|
119
120
|
}
|
|
@@ -3,7 +3,7 @@ use std::rc::Rc;
|
|
|
3
3
|
|
|
4
4
|
use crate::core::context::Context;
|
|
5
5
|
use crate::core::error::ProjectNameError;
|
|
6
|
-
use crate::core::helpers::{getp,
|
|
6
|
+
use crate::core::helpers::{getp, jo, setp};
|
|
7
7
|
use crate::core::response::{header_value, is_binary_response, Response};
|
|
8
8
|
use crate::core::spec::Spec;
|
|
9
9
|
use crate::utility::media::{is_raw_request, RAW_BODY};
|
|
@@ -13,8 +13,8 @@ use crate::utility::voxgigstruct::Value;
|
|
|
13
13
|
// Every registered secret VALUE (and its encoded forms) is replaced wherever
|
|
14
14
|
// it appears in a string, and every value under a sensitive KEY name is
|
|
15
15
|
// masked whatever it holds. The registry is the Rc-shared `values` list of
|
|
16
|
-
// `
|
|
17
|
-
// reaches the list every context reads.
|
|
16
|
+
// the context's `cleancfg`, held beside the options rather than in them, so a
|
|
17
|
+
// feature registering a value later reaches the list every context reads.
|
|
18
18
|
|
|
19
19
|
const MAXDEPTH: usize = 32;
|
|
20
20
|
const CIRCULAR: &str = "[circular]";
|
|
@@ -95,8 +95,8 @@ fn count(val: &Value, dflt: usize) -> usize {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
/// The
|
|
99
|
-
///
|
|
98
|
+
/// The clean registry from a clean option block: what make_options stores
|
|
99
|
+
/// on the context as `cleancfg`.
|
|
100
100
|
pub fn make_clean_config(cleanopts: &Value) -> Value {
|
|
101
101
|
let active = !matches!(getp(cleanopts, "active"), Value::Bool(false));
|
|
102
102
|
let mask = match getp(cleanopts, "mask") {
|
|
@@ -116,18 +116,13 @@ pub fn make_clean_config(cleanopts: &Value) -> Value {
|
|
|
116
116
|
])
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
getpath(&["__derived__", "clean"], options)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// A context without options (make_error is reached with a bare one) falls
|
|
119
|
+
// A context without a registry (make_error is reached with a bare one) falls
|
|
124
120
|
// back to the schema defaults, so nothing leaves raw for want of a
|
|
125
121
|
// constructor.
|
|
126
122
|
fn config_block(ctx: &Context) -> Value {
|
|
127
|
-
let
|
|
128
|
-
let
|
|
129
|
-
|
|
130
|
-
return derived;
|
|
123
|
+
let cfg = ctx.cleancfg.borrow().clone();
|
|
124
|
+
if let Value::Map(_) = cfg {
|
|
125
|
+
return cfg;
|
|
131
126
|
}
|
|
132
127
|
make_clean_config(&getp(&crate::core::schema::optspec(), "clean"))
|
|
133
128
|
}
|
|
@@ -192,23 +187,22 @@ fn forms(value: &str) -> Vec<String> {
|
|
|
192
187
|
out
|
|
193
188
|
}
|
|
194
189
|
|
|
195
|
-
/// Register a secret value
|
|
196
|
-
///
|
|
197
|
-
///
|
|
198
|
-
pub fn
|
|
199
|
-
let block = derived_block(options);
|
|
190
|
+
/// Register a secret value in a clean registry. Idempotent; shorter than
|
|
191
|
+
/// `min` is not a secret the SDK can mask without blanking ordinary text.
|
|
192
|
+
/// Anything but a registry map registers nothing.
|
|
193
|
+
pub fn clean_add_cfg(block: &Value, value: &str) {
|
|
200
194
|
if !matches!(block, Value::Map(_)) {
|
|
201
195
|
return;
|
|
202
196
|
}
|
|
203
|
-
let min = count(&getp(
|
|
197
|
+
let min = count(&getp(block, "min"), 4).max(1);
|
|
204
198
|
if value.chars().count() < min {
|
|
205
199
|
return;
|
|
206
200
|
}
|
|
207
|
-
let list = match getp(
|
|
201
|
+
let list = match getp(block, "values") {
|
|
208
202
|
Value::List(l) => l,
|
|
209
203
|
_ => {
|
|
210
204
|
let l = Value::empty_list();
|
|
211
|
-
setp(
|
|
205
|
+
setp(block, "values", l.clone());
|
|
212
206
|
match l {
|
|
213
207
|
Value::List(l) => l,
|
|
214
208
|
_ => return,
|
|
@@ -236,10 +230,10 @@ pub fn clean_add_opts(options: &Value, value: &str) {
|
|
|
236
230
|
}
|
|
237
231
|
}
|
|
238
232
|
|
|
239
|
-
/// Register a secret value the context's
|
|
233
|
+
/// Register a secret value the context's registry will mask from now on.
|
|
240
234
|
pub fn clean_add(ctx: &Rc<Context>, value: &str) {
|
|
241
|
-
let
|
|
242
|
-
|
|
235
|
+
let cfg = ctx.cleancfg.borrow().clone();
|
|
236
|
+
clean_add_cfg(&cfg, value);
|
|
243
237
|
}
|
|
244
238
|
|
|
245
239
|
fn mask_value(cfg: &CleanConfig, value: &str) -> String {
|
|
@@ -478,14 +472,13 @@ pub fn clean_str(ctx: &Rc<Context>, val: &str) -> String {
|
|
|
478
472
|
clean_string(&cfg, val)
|
|
479
473
|
}
|
|
480
474
|
|
|
481
|
-
/// Clean a value against
|
|
482
|
-
///
|
|
483
|
-
pub fn
|
|
484
|
-
let block = derived_block(options);
|
|
475
|
+
/// Clean a value against a registry rather than a context, for a feature
|
|
476
|
+
/// that holds the registry but no context.
|
|
477
|
+
pub fn clean_cfg(block: &Value, val: &Value) -> Value {
|
|
485
478
|
if !matches!(block, Value::Map(_)) {
|
|
486
479
|
return val.clone();
|
|
487
480
|
}
|
|
488
|
-
clean_with(&read_config(
|
|
481
|
+
clean_with(&read_config(block), None, val)
|
|
489
482
|
}
|
|
490
483
|
|
|
491
484
|
/// Is this key name sensitive under the context's clean configuration?
|
|
@@ -508,25 +501,24 @@ pub fn clean_error(ctx: &Rc<Context>, mut err: ProjectNameError) -> ProjectNameE
|
|
|
508
501
|
}
|
|
509
502
|
|
|
510
503
|
/// Every scalar under a sensitive name, at any depth and of any shape, is
|
|
511
|
-
/// registered
|
|
512
|
-
///
|
|
513
|
-
pub fn
|
|
514
|
-
let block = derived_block(options);
|
|
504
|
+
/// registered in `block`: a credential mistyped as a map or a number is
|
|
505
|
+
/// still a credential.
|
|
506
|
+
pub fn clean_add_sensitive_cfg(block: &Value, val: &Value) {
|
|
515
507
|
if !matches!(block, Value::Map(_)) {
|
|
516
508
|
return;
|
|
517
509
|
}
|
|
518
|
-
let cfg = read_config(
|
|
519
|
-
add_sensitive(&cfg,
|
|
510
|
+
let cfg = read_config(block);
|
|
511
|
+
add_sensitive(&cfg, block, val, false, 0, &mut Vec::new());
|
|
520
512
|
}
|
|
521
513
|
|
|
522
514
|
pub fn clean_add_sensitive(ctx: &Rc<Context>, val: &Value) {
|
|
523
|
-
let
|
|
524
|
-
|
|
515
|
+
let cfg = ctx.cleancfg.borrow().clone();
|
|
516
|
+
clean_add_sensitive_cfg(&cfg, val);
|
|
525
517
|
}
|
|
526
518
|
|
|
527
519
|
fn add_sensitive(
|
|
528
520
|
cfg: &CleanConfig,
|
|
529
|
-
|
|
521
|
+
block: &Value,
|
|
530
522
|
val: &Value,
|
|
531
523
|
under: bool,
|
|
532
524
|
depth: usize,
|
|
@@ -536,8 +528,8 @@ fn add_sensitive(
|
|
|
536
528
|
return;
|
|
537
529
|
}
|
|
538
530
|
match val {
|
|
539
|
-
Value::Str(s) if under =>
|
|
540
|
-
Value::Num(n) if under =>
|
|
531
|
+
Value::Str(s) if under => clean_add_cfg(block, s),
|
|
532
|
+
Value::Num(n) if under => clean_add_cfg(block, &vs::value::num_to_string(*n)),
|
|
541
533
|
Value::List(_) | Value::Map(_) => {
|
|
542
534
|
let ptr = node_ptr(val).unwrap_or(0);
|
|
543
535
|
if seen.contains(&ptr) {
|
|
@@ -547,13 +539,13 @@ fn add_sensitive(
|
|
|
547
539
|
match val {
|
|
548
540
|
Value::List(l) => {
|
|
549
541
|
for v in l.borrow().iter() {
|
|
550
|
-
add_sensitive(cfg,
|
|
542
|
+
add_sensitive(cfg, block, v, under, depth + 1, seen);
|
|
551
543
|
}
|
|
552
544
|
}
|
|
553
545
|
Value::Map(m) => {
|
|
554
546
|
for (k, v) in m.borrow().iter() {
|
|
555
547
|
let sub = under || sensitive_key(cfg, Some(k));
|
|
556
|
-
add_sensitive(cfg,
|
|
548
|
+
add_sensitive(cfg, block, v, sub, depth + 1, seen);
|
|
557
549
|
}
|
|
558
550
|
}
|
|
559
551
|
_ => {}
|
|
@@ -133,6 +133,12 @@ fn default_http_fetch(
|
|
|
133
133
|
|
|
134
134
|
let resp = loop {
|
|
135
135
|
let mut req = agent.request(&method, &url);
|
|
136
|
+
// A bound in milliseconds, for a caller beneath the timeout feature.
|
|
137
|
+
if let Value::Num(ms) = getp(fetchdef, "timeout") {
|
|
138
|
+
if 0.0 < ms {
|
|
139
|
+
req = req.timeout(std::time::Duration::from_millis(ms as u64));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
136
142
|
for (name, value) in &headers {
|
|
137
143
|
req = req.set(name, value);
|
|
138
144
|
}
|