@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
|
@@ -124,21 +124,8 @@ class ProjectNameTestFeature(ProjectNameBaseFeature):
|
|
|
124
124
|
if not isinstance(entmap, dict):
|
|
125
125
|
entmap = {}
|
|
126
126
|
|
|
127
|
-
# For single-entity ops (load, remove) with an empty explicit
|
|
128
|
-
# match, fall back to the id the entity client already knows from a
|
|
129
|
-
# prior create/load (in fctx.match / fctx.data). Mirrors the TS
|
|
130
|
-
# mock where param() resolves the id from that accumulated state.
|
|
131
|
-
def _resolve_match(explicit):
|
|
132
|
-
if isinstance(explicit, dict) and len(explicit) > 0:
|
|
133
|
-
return explicit
|
|
134
|
-
for src in (getattr(fctx, "match", None), getattr(fctx, "data", None)):
|
|
135
|
-
v = vs.getprop(src, "id") if src is not None else None
|
|
136
|
-
if v is not None and v != "__UNDEFINED__":
|
|
137
|
-
return {"id": v}
|
|
138
|
-
return {}
|
|
139
|
-
|
|
140
127
|
if op.name == "load":
|
|
141
|
-
args = test_self.build_args(fctx, op,
|
|
128
|
+
args = test_self.build_args(fctx, op, fctx.reqmatch)
|
|
142
129
|
found = vs.select(entmap, args)
|
|
143
130
|
ent = vs.getelem(found, 0)
|
|
144
131
|
if ent is None:
|
|
@@ -159,25 +146,7 @@ class ProjectNameTestFeature(ProjectNameBaseFeature):
|
|
|
159
146
|
return respond(200, out)
|
|
160
147
|
|
|
161
148
|
elif op.name == "update" or op.name == "patch":
|
|
162
|
-
|
|
163
|
-
# also contains the new field values, which would otherwise
|
|
164
|
-
# cause select to filter out the entity we want to update.
|
|
165
|
-
# When reqdata has no id, fall back to the id the entity
|
|
166
|
-
# client carries from a prior create/load (in fctx.match /
|
|
167
|
-
# fctx.data), mirroring the TS mock where param(ctx,'id')
|
|
168
|
-
# resolves from accumulated state.
|
|
169
|
-
update_match = {}
|
|
170
|
-
if isinstance(fctx.reqdata, dict):
|
|
171
|
-
if "id" in fctx.reqdata:
|
|
172
|
-
update_match["id"] = fctx.reqdata["id"]
|
|
173
|
-
alias_map = getattr(op, "alias_map", None)
|
|
174
|
-
if alias_map is not None:
|
|
175
|
-
alias_id = vs.getprop(alias_map, "id")
|
|
176
|
-
if alias_id is not None and alias_id in fctx.reqdata:
|
|
177
|
-
update_match[alias_id] = fctx.reqdata[alias_id]
|
|
178
|
-
if not update_match:
|
|
179
|
-
update_match = _resolve_match({})
|
|
180
|
-
args = test_self.build_args(fctx, op, update_match)
|
|
149
|
+
args = test_self.build_args(fctx, op, _record(fctx.reqdata))
|
|
181
150
|
found = vs.select(entmap, args)
|
|
182
151
|
ent = vs.getelem(found, 0)
|
|
183
152
|
if ent is None:
|
|
@@ -190,7 +159,7 @@ class ProjectNameTestFeature(ProjectNameBaseFeature):
|
|
|
190
159
|
return respond(200, out)
|
|
191
160
|
|
|
192
161
|
elif op.name == "remove":
|
|
193
|
-
args = test_self.build_args(fctx, op,
|
|
162
|
+
args = test_self.build_args(fctx, op, fctx.reqmatch)
|
|
194
163
|
found = vs.select(entmap, args)
|
|
195
164
|
ent = vs.getelem(found, 0)
|
|
196
165
|
# Remove only the first matched entity. If nothing matches,
|
|
@@ -336,25 +305,46 @@ class ProjectNameTestFeature(ProjectNameBaseFeature):
|
|
|
336
305
|
qand = []
|
|
337
306
|
q = {"`$AND`": qand}
|
|
338
307
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
308
|
+
ename = ctx.entity.get_name()
|
|
309
|
+
idfrom = vs.getpath(ctx.config, "entity." + ename + ".id.from")
|
|
310
|
+
if not isinstance(idfrom, dict):
|
|
311
|
+
idfrom = {}
|
|
312
|
+
|
|
313
|
+
names = list(vs.keysof(args) or []) if args is not None else []
|
|
314
|
+
|
|
315
|
+
# With no id in the call, the entity's held id (or composite parts) stands in.
|
|
316
|
+
if vs.getprop(args, "id") is None:
|
|
317
|
+
parts = vs.getpath(ctx.config, "entity." + ename + ".id.parts")
|
|
318
|
+
if not isinstance(parts, list):
|
|
319
|
+
parts = [] if opname == "list" else ["id"]
|
|
320
|
+
for part in parts:
|
|
321
|
+
pname = str(part)
|
|
322
|
+
if pname not in names and (_held(getattr(ctx, "match", None), pname) or
|
|
323
|
+
_held(getattr(ctx, "data", None), pname)):
|
|
324
|
+
names.append(pname)
|
|
325
|
+
|
|
326
|
+
for key in names:
|
|
327
|
+
is_id = (key == "id")
|
|
328
|
+
selected = vs.select(reqd, key)
|
|
329
|
+
is_reqd = not vs.isempty(selected)
|
|
330
|
+
|
|
331
|
+
if is_id or is_reqd:
|
|
332
|
+
v = ctx.utility.param(ctx, key)
|
|
333
|
+
ka = None
|
|
334
|
+
if op.alias is not None:
|
|
335
|
+
ka = vs.getprop(op.alias, key)
|
|
336
|
+
|
|
337
|
+
qor = [{key: v}]
|
|
338
|
+
if ka is not None and isinstance(ka, str):
|
|
339
|
+
qor.append({ka: v})
|
|
340
|
+
|
|
341
|
+
# An alternative, never a replacement: a seed keeping the
|
|
342
|
+
# parameter flat is still found.
|
|
343
|
+
kf = idfrom.get(key)
|
|
344
|
+
if isinstance(kf, str) and kf != key:
|
|
345
|
+
qor.append(_nest(kf, v))
|
|
346
|
+
|
|
347
|
+
qand.append({"`$OR`": qor})
|
|
358
348
|
|
|
359
349
|
q["`$AND`"] = qand
|
|
360
350
|
|
|
@@ -362,3 +352,16 @@ class ProjectNameTestFeature(ProjectNameBaseFeature):
|
|
|
362
352
|
ctx.ctrl.explain["test"] = {"query": q}
|
|
363
353
|
|
|
364
354
|
return q
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
def _held(src, key):
|
|
358
|
+
v = vs.getprop(src, key) if src is not None else None
|
|
359
|
+
return v is not None and v != "__UNDEFINED__"
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
# The value under a dotted record path, as a nested dict.
|
|
363
|
+
def _nest(path, value):
|
|
364
|
+
out = value
|
|
365
|
+
for key in reversed(path.split(".")):
|
|
366
|
+
out = {key: out}
|
|
367
|
+
return out
|
|
@@ -68,17 +68,11 @@ def _prop(obj, name):
|
|
|
68
68
|
return getattr(obj, name, None)
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
# The derived block make_options builds; a context without options
|
|
76
|
-
# (make_error is reached with a bare one) falls back to the schema defaults,
|
|
77
|
-
# so nothing leaves raw for want of a constructor.
|
|
71
|
+
# The registry make_options builds; a context without one (make_error is
|
|
72
|
+
# reached with a bare one) falls back to the schema defaults, so nothing
|
|
73
|
+
# leaves raw for want of a constructor.
|
|
78
74
|
def _clean_config(ctx):
|
|
79
|
-
|
|
80
|
-
derived = options.get("__derived__") if isinstance(options, dict) else None
|
|
81
|
-
cfg = derived.get("clean") if isinstance(derived, dict) else None
|
|
75
|
+
cfg = _prop(ctx, "cleancfg")
|
|
82
76
|
if isinstance(cfg, dict) and isinstance(cfg.get("values"), list):
|
|
83
77
|
return cfg
|
|
84
78
|
return make_clean_config(OPTSPEC.get("clean"))
|
|
@@ -7,11 +7,11 @@ from projectname_sdk.utility.clean import (
|
|
|
7
7
|
clean_util, clean_add_util, clean_add_sensitive, make_clean_config, split_values)
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
# A context carrying only the
|
|
11
|
-
#
|
|
10
|
+
# A context carrying only the clean registry, which exists before the real
|
|
11
|
+
# options do.
|
|
12
12
|
class _CleanCtx:
|
|
13
13
|
def __init__(self, cleancfg):
|
|
14
|
-
self.
|
|
14
|
+
self.cleancfg = cleancfg
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -133,6 +133,11 @@ def make_options_util(ctx):
|
|
|
133
133
|
featureorder.append(name)
|
|
134
134
|
opts["feature"] = fmap
|
|
135
135
|
|
|
136
|
+
fdefaults = _feature_defaults(
|
|
137
|
+
config.get("feature") if isinstance(config, dict) else None, opts.get("feature"))
|
|
138
|
+
if fdefaults is not None:
|
|
139
|
+
opts["feature"] = fdefaults
|
|
140
|
+
|
|
136
141
|
# THE OPTION SPEC IS GENERATED, NOT WRITTEN HERE.
|
|
137
142
|
#
|
|
138
143
|
# `schema.OPTSPEC` is built from the model: `main.kit.optspec` for the
|
|
@@ -156,6 +161,7 @@ def make_options_util(ctx):
|
|
|
156
161
|
# ...) would contaminate every instance constructed after it.
|
|
157
162
|
merged = vs.merge([{}, vs.clone(cfgopts), opts])
|
|
158
163
|
try:
|
|
164
|
+
_refuse_stray_keys(merged, optspec)
|
|
159
165
|
validated = vs.validate(merged, optspec)
|
|
160
166
|
except Exception as err:
|
|
161
167
|
# The message quotes the offending value.
|
|
@@ -211,33 +217,33 @@ def make_options_util(ctx):
|
|
|
211
217
|
else:
|
|
212
218
|
opts["system"] = {"fetch": sys_fetch}
|
|
213
219
|
|
|
214
|
-
# Resolve the feature add-order: an explicit list order (above) wins
|
|
215
|
-
#
|
|
216
|
-
#
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
220
|
+
# Resolve the feature add-order: an explicit list order (above) wins, and
|
|
221
|
+
# the names it leaves out follow it test-first, then sorted, so the outcome
|
|
222
|
+
# is deterministic and `test` is the base transport of a map.
|
|
223
|
+
fmap = opts.get("feature")
|
|
224
|
+
names = sorted(n for n in fmap.keys() if n not in featureorder) \
|
|
225
|
+
if isinstance(fmap, dict) else []
|
|
226
|
+
if "test" in names:
|
|
227
|
+
rest = ["test"] + [n for n in names if n != "test"]
|
|
228
|
+
else:
|
|
229
|
+
rest = names
|
|
230
|
+
# Station special case, mirroring test's: its transport wrap must
|
|
231
|
+
# sit immediately outside the base transport (inside every other
|
|
232
|
+
# transport wrap), so map-form activation hoists it to just after
|
|
233
|
+
# test - or first, when no test entry exists. Without this the
|
|
234
|
+
# sorted default would init station last and wrap OUTSIDE the
|
|
235
|
+
# recording features, turning its wire-truth events into fiction.
|
|
236
|
+
if "station" in rest:
|
|
237
|
+
rest = [n for n in rest if n != "station"]
|
|
238
|
+
at = rest.index("test") + 1 if "test" in rest else 0
|
|
239
|
+
rest.insert(at, "station")
|
|
240
|
+
featureorder = featureorder + rest
|
|
241
|
+
|
|
242
|
+
opts["__derived__"] = {"featureorder": featureorder}
|
|
243
|
+
|
|
244
|
+
# The registry stays MUTABLE, as features register what they resolve after
|
|
245
|
+
# construction, and sits beside the options: callers read those back.
|
|
246
|
+
ctx.cleancfg = cleancfg
|
|
241
247
|
|
|
242
248
|
# Again over the merged result: the config's own defaults can carry one.
|
|
243
249
|
_clean_add_options(cleanctx, {
|
|
@@ -246,6 +252,24 @@ def make_options_util(ctx):
|
|
|
246
252
|
return opts
|
|
247
253
|
|
|
248
254
|
|
|
255
|
+
# The model's options for a feature sit beneath the caller's, key by key: a
|
|
256
|
+
# key the caller sets replaces the default whole, so a list is never merged.
|
|
257
|
+
def _feature_defaults(cfgfeature, feature):
|
|
258
|
+
if feature is not None and not isinstance(feature, dict):
|
|
259
|
+
return None
|
|
260
|
+
out = dict(feature or {})
|
|
261
|
+
for name, fdef in (cfgfeature if isinstance(cfgfeature, dict) else {}).items():
|
|
262
|
+
dflt = fdef.get("options") if isinstance(fdef, dict) else None
|
|
263
|
+
given = out.get(name)
|
|
264
|
+
if not isinstance(dflt, dict) or (given is None and dflt.get("active") is not True) \
|
|
265
|
+
or (given is not None and not isinstance(given, dict)):
|
|
266
|
+
continue
|
|
267
|
+
merged = vs.clone(dflt)
|
|
268
|
+
merged.update(given or {})
|
|
269
|
+
out[name] = merged
|
|
270
|
+
return out
|
|
271
|
+
|
|
272
|
+
|
|
249
273
|
# A feature's name is not a field name: only the sensitive names inside its
|
|
250
274
|
# settings count, so `secrets` does not make every setting a secret. Entity
|
|
251
275
|
# blocks (per-entity settings, seeded records) hold no credential, and nor do
|
|
@@ -271,3 +295,26 @@ def _plain(block, name):
|
|
|
271
295
|
omit = ("entity", "rules") if "rbac" == name else ("entity",)
|
|
272
296
|
return {k: v for k, v in block.items() if k not in omit}
|
|
273
297
|
return block
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
# Before validate: the struct's own refusal prints the value without its
|
|
301
|
+
# functions, so a misspelled callback key would go unnamed.
|
|
302
|
+
def _refuse_stray_keys(opts, optspec):
|
|
303
|
+
fspecs = optspec.get("feature") if isinstance(optspec, dict) else None
|
|
304
|
+
feature = opts.get("feature") if isinstance(opts, dict) else None
|
|
305
|
+
if not isinstance(fspecs, dict) or not isinstance(feature, dict):
|
|
306
|
+
return
|
|
307
|
+
for name, fopts in feature.items():
|
|
308
|
+
spec = _spec_map(fspecs.get(name))
|
|
309
|
+
if spec is None or spec.get("`$OPEN`") or not isinstance(fopts, dict):
|
|
310
|
+
continue
|
|
311
|
+
stray = [k for k in fopts if k not in spec]
|
|
312
|
+
if stray:
|
|
313
|
+
raise ValueError("Unexpected keys at field feature." + name + ": " + ", ".join(stray))
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
def _spec_map(spec):
|
|
317
|
+
if isinstance(spec, list):
|
|
318
|
+
start = 2 if spec and "`$NOF`" == spec[0] else 0
|
|
319
|
+
return next((a for a in spec[start:] if isinstance(a, dict)), None)
|
|
320
|
+
return spec if isinstance(spec, dict) else None
|
|
@@ -33,6 +33,12 @@ import unittest
|
|
|
33
33
|
|
|
34
34
|
import pytest
|
|
35
35
|
|
|
36
|
+
try:
|
|
37
|
+
import requests # noqa: F401
|
|
38
|
+
HAVE_REQUESTS = True
|
|
39
|
+
except ImportError:
|
|
40
|
+
HAVE_REQUESTS = False
|
|
41
|
+
|
|
36
42
|
from projectname_sdk import ProjectNameSDK
|
|
37
43
|
from projectname_sdk.config import shared_config
|
|
38
44
|
from projectname_sdk.features import _has_feature
|
|
@@ -48,6 +54,10 @@ NOAUTH = "auth" not in shared_config().get("options", {})
|
|
|
48
54
|
placing = pytest.mark.skipif(
|
|
49
55
|
NOAUTH, reason="this SDK's config declares no auth, so it places no credential")
|
|
50
56
|
|
|
57
|
+
# The exchange goes through the SDK's default transport, which needs requests.
|
|
58
|
+
over_default_transport = pytest.mark.skipif(
|
|
59
|
+
not HAVE_REQUESTS, reason="the default transport needs the requests module")
|
|
60
|
+
|
|
51
61
|
|
|
52
62
|
def cred_header():
|
|
53
63
|
"""The header the credential travels in: the DEFAULT client's
|
|
@@ -449,8 +459,9 @@ if __name__ == "__main__":
|
|
|
449
459
|
|
|
450
460
|
# ---------------------------------------------------------------------
|
|
451
461
|
# Review-hardening pins (vendor-tag rollout, PR review): the exchange
|
|
452
|
-
# works with ORDINARY options (no custom transport
|
|
453
|
-
# carries the purchase), and an uncached miss retracts the
|
|
462
|
+
# works with ORDINARY options (no custom transport: the SDK's own default
|
|
463
|
+
# transport carries the purchase), and an uncached miss retracts the
|
|
464
|
+
# credential.
|
|
454
465
|
|
|
455
466
|
class _TokenEndpoint(http.server.BaseHTTPRequestHandler):
|
|
456
467
|
refresh_seen = None
|
|
@@ -476,10 +487,11 @@ class _TokenEndpoint(http.server.BaseHTTPRequestHandler):
|
|
|
476
487
|
@placing
|
|
477
488
|
class TestSecretsReviewPins(unittest.TestCase):
|
|
478
489
|
|
|
479
|
-
|
|
490
|
+
@over_default_transport
|
|
491
|
+
def test_exchange_uses_the_default_transport_and_marshals_the_body(self):
|
|
480
492
|
# A refresh token full of JSON-hostile characters must arrive at
|
|
481
|
-
# the endpoint as its literal value, through the
|
|
482
|
-
#
|
|
493
|
+
# the endpoint as its literal value, through the SDK's default
|
|
494
|
+
# transport - ordinary options carry no system.fetch for it.
|
|
483
495
|
tricky = 're"fresh\\to\nken'
|
|
484
496
|
_TokenEndpoint.refresh_seen = None
|
|
485
497
|
|
|
@@ -489,9 +501,9 @@ class TestSecretsReviewPins(unittest.TestCase):
|
|
|
489
501
|
try:
|
|
490
502
|
# NO system.fetch anywhere: with the seam set, the purchase
|
|
491
503
|
# rightly prefers it - the point of this pin is the OTHER
|
|
492
|
-
# case, ordinary options, where the
|
|
493
|
-
#
|
|
494
|
-
#
|
|
504
|
+
# case, ordinary options, where the default transport must
|
|
505
|
+
# carry the exchange. Only PreSpec runs, so no API call ever
|
|
506
|
+
# leaves; the one HTTP request is the purchase.
|
|
495
507
|
sdk = secrets_sdk({
|
|
496
508
|
"base": "http://127.0.0.1:%d/api" % srv.server_port,
|
|
497
509
|
"feature": {"secrets": {
|
|
@@ -548,7 +560,8 @@ class TestSecretsReviewPins(unittest.TestCase):
|
|
|
548
560
|
srv.shutdown()
|
|
549
561
|
srv.server_close()
|
|
550
562
|
|
|
551
|
-
# Real listeners and the
|
|
563
|
+
# Real listeners and the default transport: a stub follows nothing.
|
|
564
|
+
@over_default_transport
|
|
552
565
|
def test_a_redirect_answering_the_exchange_is_a_failure(self):
|
|
553
566
|
with _origins() as o:
|
|
554
567
|
answers = [[307, o["away"]], [308, o["away"]], [302, o["away"]],
|
|
@@ -577,6 +590,7 @@ class TestSecretsReviewPins(unittest.TestCase):
|
|
|
577
590
|
self.assertEqual([], allowed, "a redirect was not a failed exchange")
|
|
578
591
|
self.assertEqual(len(answers), refused)
|
|
579
592
|
|
|
593
|
+
@over_default_transport
|
|
580
594
|
def test_with_the_option_a_redirect_on_the_exchange_s_own_origin_is_followed(self):
|
|
581
595
|
with _origins() as o:
|
|
582
596
|
# Each case: the status, the Location, and the path the exchange is
|
|
@@ -367,6 +367,56 @@ class TestCacheFeature:
|
|
|
367
367
|
assert b["ctx"].response is sent[1]
|
|
368
368
|
assert h.client._cache["bypass"] == 2
|
|
369
369
|
|
|
370
|
+
def test_keys_on_the_request_headers(self):
|
|
371
|
+
server, calls = recording_server()
|
|
372
|
+
h = make_client([{"name": "cache", "options": {"ttl": 10000}}],
|
|
373
|
+
server=server)
|
|
374
|
+
h.op(op="load", path="/w/1", headers={"x-tenant": "tenant-a"})
|
|
375
|
+
h.op(op="load", path="/w/1", headers={"X-Tenant": "tenant-b"})
|
|
376
|
+
assert len(calls) == 2
|
|
377
|
+
h.op(op="load", path="/w/1", headers={"x-tenant": "tenant-b"})
|
|
378
|
+
assert len(calls) == 2
|
|
379
|
+
cache = [f for f in h.client.features if f.name == "cache"][0]
|
|
380
|
+
assert "tenant-" not in "\n".join(cache.store.keys())
|
|
381
|
+
|
|
382
|
+
def test_a_write_drops_its_collection(self):
|
|
383
|
+
server, calls = recording_server()
|
|
384
|
+
h = make_client([{"name": "cache", "options": {"ttl": 10000}}],
|
|
385
|
+
server=server)
|
|
386
|
+
paths = ["/w/1", "/w", "/w/1/part", "/other/1", "/w/2"]
|
|
387
|
+
for path in paths:
|
|
388
|
+
h.op(op="load", path=path)
|
|
389
|
+
h.op(op="update", method="PUT", path="/w/1")
|
|
390
|
+
for path in paths:
|
|
391
|
+
h.op(op="load", path=path)
|
|
392
|
+
assert len(calls) == 9
|
|
393
|
+
assert h.client._cache["hit"] == 2
|
|
394
|
+
|
|
395
|
+
def test_cache_control_prevents_storing(self):
|
|
396
|
+
for control in ["no-store", "private", "No-Cache", "max-age=60, private"]:
|
|
397
|
+
server, calls = recording_server(
|
|
398
|
+
lambda _n, _fd: make_response(200, {"ok": True}, {"Cache-Control": control}))
|
|
399
|
+
h = make_client([{"name": "cache", "options": {"ttl": 10000}}],
|
|
400
|
+
server=server)
|
|
401
|
+
h.op(op="load", path="/w")
|
|
402
|
+
h.op(op="load", path="/w")
|
|
403
|
+
assert len(calls) == 2, control
|
|
404
|
+
|
|
405
|
+
def test_max_age_caps_the_ttl(self):
|
|
406
|
+
clock = make_clock()
|
|
407
|
+
server, calls = recording_server(
|
|
408
|
+
lambda _n, _fd: make_response(200, {"ok": True}, {"cache-control": "max-age=1"}))
|
|
409
|
+
h = make_client([{"name": "cache",
|
|
410
|
+
"options": {"ttl": 10000, "now": clock.now}}],
|
|
411
|
+
server=server)
|
|
412
|
+
h.op(op="load", path="/w")
|
|
413
|
+
clock.advance(500)
|
|
414
|
+
h.op(op="load", path="/w")
|
|
415
|
+
assert len(calls) == 1
|
|
416
|
+
clock.advance(600)
|
|
417
|
+
h.op(op="load", path="/w")
|
|
418
|
+
assert len(calls) == 2
|
|
419
|
+
|
|
370
420
|
def test_inactive_cache_does_not_wrap(self):
|
|
371
421
|
server, calls = recording_server()
|
|
372
422
|
h = make_client([{"name": "cache", "options": {"active": False}}],
|
|
@@ -494,6 +544,14 @@ class TestMetricsFeature:
|
|
|
494
544
|
assert metrics["total"]["err"] == 1
|
|
495
545
|
assert metrics["ops"]["widget.load"]["count"] == 2
|
|
496
546
|
|
|
547
|
+
def test_sink_gets_the_counters_once_per_operation(self):
|
|
548
|
+
seen = []
|
|
549
|
+
h = make_client([{"name": "metrics", "options": {"sink": seen.append}}])
|
|
550
|
+
h.op(op="load")
|
|
551
|
+
h.op(op="list")
|
|
552
|
+
assert [m["total"]["count"] for m in seen] == [1, 2]
|
|
553
|
+
assert seen[1]["ops"]["widget.list"]["count"] == 1
|
|
554
|
+
|
|
497
555
|
def test_injected_clock_records_duration(self):
|
|
498
556
|
clock = make_clock()
|
|
499
557
|
|
|
@@ -569,7 +627,9 @@ class TestTelemetryFeature:
|
|
|
569
627
|
def test_default_id_generation_and_no_exporter(self):
|
|
570
628
|
h = make_client([{"name": "telemetry"}])
|
|
571
629
|
h.op(op="load")
|
|
572
|
-
|
|
630
|
+
span = h.client._telemetry["spans"][0]
|
|
631
|
+
assert re.fullmatch(r"[0-9a-f]{32}", span["traceId"]) and span["traceId"].strip("0")
|
|
632
|
+
assert re.fullmatch(r"[0-9a-f]{16}", span["spanId"]) and span["spanId"].strip("0")
|
|
573
633
|
|
|
574
634
|
def test_inactive_telemetry_records_nothing(self):
|
|
575
635
|
h = make_client([{"name": "telemetry", "options": {"active": False}}])
|