@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
|
@@ -60,28 +60,42 @@ class ProjectNameSDK:
|
|
|
60
60
|
extend = options.get("extend") if isinstance(options, dict) else None
|
|
61
61
|
if not isinstance(extend, list):
|
|
62
62
|
extend = []
|
|
63
|
+
def fname_of(f):
|
|
64
|
+
return f.get("name") if isinstance(f, dict) else getattr(f, "name", None)
|
|
65
|
+
|
|
66
|
+
def is_active(fname):
|
|
67
|
+
fopts = helpers.to_map((feature_opts or {}).get(fname))
|
|
68
|
+
return fopts is not None and fopts.get("active") is True
|
|
69
|
+
|
|
70
|
+
placed = []
|
|
63
71
|
if feature_opts is not None:
|
|
64
72
|
featureorder = vs.getpath(self.options, "__derived__.featureorder")
|
|
65
73
|
if isinstance(featureorder, list):
|
|
66
74
|
for fname in featureorder:
|
|
67
|
-
|
|
68
|
-
if fopts is not None and fopts.get("active") is True:
|
|
75
|
+
if is_active(fname):
|
|
69
76
|
# An active name with no generated feature class is
|
|
70
77
|
# legal when an extend-supplied instance carries that
|
|
71
|
-
# name (station's adopt path): the instance
|
|
72
|
-
#
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
for f in extend
|
|
79
|
-
):
|
|
78
|
+
# name (station's adopt path): the instance takes the
|
|
79
|
+
# slot the order gives its name.
|
|
80
|
+
carried = None if _has_feature(fname) else next(
|
|
81
|
+
(f for f in extend if fname == fname_of(f)), None)
|
|
82
|
+
if carried is not None:
|
|
83
|
+
placed.append(carried)
|
|
84
|
+
utility.feature_add(self._rootctx, carried)
|
|
80
85
|
continue
|
|
81
86
|
utility.feature_add(self._rootctx, _make_feature(fname))
|
|
82
87
|
|
|
83
|
-
#
|
|
88
|
+
# An extend feature is active by its option, else by its own flag.
|
|
89
|
+
def ext_active(f):
|
|
90
|
+
fopts = helpers.to_map((feature_opts or {}).get(fname_of(f)))
|
|
91
|
+
if fopts is not None and fopts.get("active") is not None:
|
|
92
|
+
return fopts.get("active") is True
|
|
93
|
+
own = f.get("active") if isinstance(f, dict) else getattr(f, "active", None)
|
|
94
|
+
return own is True
|
|
95
|
+
|
|
84
96
|
for f in extend:
|
|
97
|
+
if any(f is p for p in placed) or not ext_active(f):
|
|
98
|
+
continue
|
|
85
99
|
if isinstance(f, dict) or (hasattr(f, "get_name") and callable(f.get_name)):
|
|
86
100
|
utility.feature_add(self._rootctx, f)
|
|
87
101
|
|
|
@@ -320,7 +320,7 @@ class ${Name}CleanTest < Minitest::Test
|
|
|
320
320
|
capture = ->(name) { ->(rec) { sinks.concat(Sweep.forms(name, rec)) } }
|
|
321
321
|
feature = {}
|
|
322
322
|
feature["log"] = { "active" => true, "logger" => CaptureLogger.new(sinks) } if has_feature?("log")
|
|
323
|
-
feature["debug"] = { "active" => true, "
|
|
323
|
+
feature["debug"] = { "active" => true, "onEntry" => capture.call("debug") } if has_feature?("debug")
|
|
324
324
|
feature["audit"] = { "active" => true, "sink" => capture.call("audit") } if has_feature?("audit")
|
|
325
325
|
feature["telemetry"] = { "active" => true, "exporter" => capture.call("telemetry") } if has_feature?("telemetry")
|
|
326
326
|
feature["cost"] = { "active" => true, "sink" => capture.call("cost") } if has_feature?("cost")
|
|
@@ -548,12 +548,12 @@ class ${Name}CleanTest < Minitest::Test
|
|
|
548
548
|
# and is not changed by it.
|
|
549
549
|
util = hooked.get_utility
|
|
550
550
|
cfgclean = { "keys" => "zzsens", "values" => CANARY["config"] }
|
|
551
|
-
|
|
551
|
+
cfgctx = util.make_context.call({
|
|
552
552
|
"utility" => util,
|
|
553
553
|
"config" => { "options" => { "clean" => cfgclean } },
|
|
554
554
|
"options" => { "clean" => { "values" => CANARY["value"] } },
|
|
555
|
-
}, nil)
|
|
556
|
-
cfgctx = util.
|
|
555
|
+
}, nil)
|
|
556
|
+
cfgctx.options = util.make_options.call(cfgctx)
|
|
557
557
|
seeded = util.clean.call(cfgctx, "config #{CANARY['config']} caller #{CANARY['value']}")
|
|
558
558
|
sinks << { "name" => "config-clean", "text" => seeded.to_s }
|
|
559
559
|
assert_equal "config #{MASK} caller #{MASK}", seeded
|
|
@@ -592,6 +592,13 @@ class ${Name}CleanTest < Minitest::Test
|
|
|
592
592
|
falias = fclean.call(featured.get_root_ctx, "alias PLAINALIAS-m2n4b6v8")
|
|
593
593
|
frule = fclean.call(featured.get_root_ctx, "rule PLAINRULE-k7j5h3g1")
|
|
594
594
|
|
|
595
|
+
# The clean registry holds every credential in plain form, and is no option.
|
|
596
|
+
held = construct({ "apikey" => CANARY["apikey"] }).options_map
|
|
597
|
+
heldjson = JSON.generate(held) rescue held.inspect
|
|
598
|
+
assert_equal CANARY["apikey"], held["apikey"]
|
|
599
|
+
assert_equal [], Sweep.leaks(heldjson.sub(CANARY["apikey"].to_json, "")),
|
|
600
|
+
"options_map carries a credential beyond the option the caller set: #{heldjson}"
|
|
601
|
+
|
|
595
602
|
leaked = sinks
|
|
596
603
|
.map { |s| [s["name"], Sweep.leaks(s["text"])] }
|
|
597
604
|
.reject { |_, found| found.empty? }
|
|
@@ -134,9 +134,14 @@ class EntyClass
|
|
|
134
134
|
yielder << item
|
|
135
135
|
inblock = false
|
|
136
136
|
end
|
|
137
|
+
predone = false
|
|
137
138
|
begin
|
|
138
139
|
catch(:stream_stop) do
|
|
139
140
|
failed = _stream_steps(ctx)
|
|
141
|
+
if failed.nil?
|
|
142
|
+
predone = true
|
|
143
|
+
utility.feature_hook.call(ctx, "PreDone")
|
|
144
|
+
end
|
|
140
145
|
result = ctx.result
|
|
141
146
|
|
|
142
147
|
# Inbound: prefer the streaming feature's incremental Enumerator;
|
|
@@ -173,11 +178,13 @@ class EntyClass
|
|
|
173
178
|
|
|
174
179
|
e = _unexpected(ctx, operr)
|
|
175
180
|
raise e, cause: nil unless e.nil?
|
|
181
|
+
ensure
|
|
182
|
+
_late_done(ctx) unless predone
|
|
176
183
|
end
|
|
177
184
|
end
|
|
178
185
|
end
|
|
179
186
|
|
|
180
|
-
# The steps
|
|
187
|
+
# The steps before PreDone, with their hooks; the first that fails hands
|
|
181
188
|
# back its error.
|
|
182
189
|
private def _stream_steps(ctx)
|
|
183
190
|
utility = @_utility
|
|
@@ -207,7 +214,6 @@ class EntyClass
|
|
|
207
214
|
ctx.out["result"] = result
|
|
208
215
|
return err if err
|
|
209
216
|
|
|
210
|
-
utility.feature_hook.call(ctx, "PreDone")
|
|
211
217
|
nil
|
|
212
218
|
end
|
|
213
219
|
|
|
@@ -227,6 +233,7 @@ class EntyClass
|
|
|
227
233
|
|
|
228
234
|
def _run_op(ctx, &post_done)
|
|
229
235
|
utility = @_utility
|
|
236
|
+
predone = false
|
|
230
237
|
|
|
231
238
|
begin
|
|
232
239
|
# #PrePoint-Hook
|
|
@@ -259,6 +266,7 @@ class EntyClass
|
|
|
259
266
|
ctx.out["result"] = result
|
|
260
267
|
return utility.make_error.call(ctx, err) if err
|
|
261
268
|
|
|
269
|
+
predone = true
|
|
262
270
|
# #PreDone-Hook
|
|
263
271
|
|
|
264
272
|
post_done.call
|
|
@@ -299,9 +307,22 @@ class EntyClass
|
|
|
299
307
|
# Not a cause: the raw error would print beneath the cleaned one.
|
|
300
308
|
raise e, cause: nil unless e.nil?
|
|
301
309
|
nil
|
|
310
|
+
ensure
|
|
311
|
+
# A refusal, a failed step or a raise left before PreDone.
|
|
312
|
+
_late_done(ctx) unless predone
|
|
302
313
|
end
|
|
303
314
|
end
|
|
304
315
|
|
|
316
|
+
# PreDone on an exit that left before it. What the hook raises leaves
|
|
317
|
+
# cleaned, in place of the error already on its way out.
|
|
318
|
+
def _late_done(ctx)
|
|
319
|
+
@_utility.feature_hook.call(ctx, "PreDone")
|
|
320
|
+
rescue StandardError => hookerr
|
|
321
|
+
ctx.ctrl.err = hookerr
|
|
322
|
+
e = _unexpected(ctx, hookerr)
|
|
323
|
+
raise e, cause: nil unless e.nil?
|
|
324
|
+
end
|
|
325
|
+
|
|
305
326
|
# An exception the pipeline did not build still leaves through the
|
|
306
327
|
# caller: it is cleaned, and so is the explain record it interrupted.
|
|
307
328
|
# Answers nil when throwing is disabled, as the pipeline's own errors do.
|
|
@@ -52,26 +52,42 @@ class ProjectNameSDK
|
|
|
52
52
|
# declares `transport: 'wrap'` wrap whatever is current, so `test`
|
|
53
53
|
# must be added before them to sit at the base of the chain.
|
|
54
54
|
feature_opts = ProjectNameHelpers.to_map(VoxgigStruct.getprop(@options, "feature"))
|
|
55
|
+
active = lambda do |fname|
|
|
56
|
+
fopts = feature_opts && ProjectNameHelpers.to_map(feature_opts[fname])
|
|
57
|
+
!fopts.nil? && fopts["active"] == true
|
|
58
|
+
end
|
|
59
|
+
extend_val = VoxgigStruct.getprop(@options, "extend")
|
|
60
|
+
extend_list = (extend_val.is_a?(Array) ? extend_val : []).select { |f| f.respond_to?(:get_name) }
|
|
61
|
+
placed = []
|
|
55
62
|
if feature_opts
|
|
56
63
|
featureorder = VoxgigStruct.getpath(@options, "__derived__.featureorder")
|
|
57
64
|
if featureorder.is_a?(Array)
|
|
58
65
|
featureorder.each do |fname|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
next unless active.call(fname)
|
|
67
|
+
gen = ProjectNameFeatures.make_feature(fname)
|
|
68
|
+
# An active name with no generated class is legal when an
|
|
69
|
+
# extend-supplied instance carries that name (station's adopt
|
|
70
|
+
# path): the instance takes the slot the order gives its name.
|
|
71
|
+
carried = gen.get_name == fname ? nil : extend_list.find { |f| f.get_name == fname }
|
|
72
|
+
if carried
|
|
73
|
+
placed << carried
|
|
74
|
+
utility.feature_add.call(@_rootctx, carried)
|
|
75
|
+
else
|
|
76
|
+
utility.feature_add.call(@_rootctx, gen)
|
|
62
77
|
end
|
|
63
78
|
end
|
|
64
79
|
end
|
|
65
80
|
end
|
|
66
81
|
|
|
67
|
-
#
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
82
|
+
# An extend feature is active by its option, else by its own flag.
|
|
83
|
+
ext_active = lambda do |f|
|
|
84
|
+
fopts = feature_opts && ProjectNameHelpers.to_map(feature_opts[f.get_name])
|
|
85
|
+
next fopts["active"] == true if fopts && !fopts["active"].nil?
|
|
86
|
+
f.respond_to?(:get_active) && f.get_active == true
|
|
87
|
+
end
|
|
88
|
+
extend_list.each do |f|
|
|
89
|
+
next if placed.any? { |p| p.equal?(f) } || !ext_active.call(f)
|
|
90
|
+
utility.feature_add.call(@_rootctx, f)
|
|
75
91
|
end
|
|
76
92
|
|
|
77
93
|
# Initialize features.
|
|
@@ -788,24 +788,18 @@ fn clean_no_credential_leaves_the_sdk_in_any_form() {
|
|
|
788
788
|
Some(jo(vec![("name", Value::str("zzcred"))])));
|
|
789
789
|
drive(&renamed, &target, Value::Noval, &sinks);
|
|
790
790
|
|
|
791
|
-
// A credential mistyped as a map
|
|
792
|
-
//
|
|
793
|
-
|
|
794
|
-
// string quoting the value, cleaned the way a validation message is.
|
|
795
|
-
let mistyped = construct(jo(vec![
|
|
791
|
+
// A credential mistyped as a map is rejected by validation, whose message
|
|
792
|
+
// quotes the value it rejected.
|
|
793
|
+
match ${Name}SDK::new(offline(jo(vec![
|
|
796
794
|
("apikey", jo(vec![("value", Value::str(CANARY_APIKEY))])),
|
|
797
795
|
("clean", jo(vec![("values", Value::str(CANARY_VALUE))])),
|
|
798
|
-
]))
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
&mistyped.get_root_ctx(),
|
|
806
|
-
&format!("apikey: expected string, got {{\\"value\\":\\"{}\\"}}", CANARY_APIKEY),
|
|
807
|
-
),
|
|
808
|
-
);
|
|
796
|
+
]))) {
|
|
797
|
+
Ok(_) => panic!("a credential mistyped as a map should be rejected"),
|
|
798
|
+
Err(err) => {
|
|
799
|
+
push(&sinks, "rejected:msg", err.msg.clone());
|
|
800
|
+
push(&sinks, "rejected:display", format!("{}", err));
|
|
801
|
+
}
|
|
802
|
+
}
|
|
809
803
|
|
|
810
804
|
// An error a feature hook raises, quoting the request, with explain on.
|
|
811
805
|
let hooked = make_sdk(
|
|
@@ -870,6 +864,16 @@ fn clean_no_credential_leaves_the_sdk_in_any_form() {
|
|
|
870
864
|
assert_eq!(getp(&raw, "ok"), Value::Bool(false), "a transport failure should fail direct()");
|
|
871
865
|
push_value(&sinks, "direct", &raw);
|
|
872
866
|
|
|
867
|
+
// The clean registry holds every credential in plain form, and is no option.
|
|
868
|
+
let held = construct(jo(vec![("apikey", Value::str(CANARY_APIKEY))])).options_map();
|
|
869
|
+
let heldjson = vs::jsonify(&held, None);
|
|
870
|
+
assert_eq!(getp(&held, "apikey"), Value::str(CANARY_APIKEY));
|
|
871
|
+
assert!(
|
|
872
|
+
leaks(&heldjson.replacen(CANARY_APIKEY, "", 1)).is_empty(),
|
|
873
|
+
"options_map carries a credential beyond the option the caller set: {}",
|
|
874
|
+
heldjson
|
|
875
|
+
);
|
|
876
|
+
|
|
873
877
|
let leaked: Vec<String> = sinks
|
|
874
878
|
.borrow()
|
|
875
879
|
.iter()
|
|
@@ -1016,7 +1020,10 @@ fn clean_reads_a_feature_name_as_a_name() {
|
|
|
1016
1020
|
jo(vec![
|
|
1017
1021
|
("active", Value::Bool(false)),
|
|
1018
1022
|
("name", Value::str("ZZNAME-feat123")),
|
|
1019
|
-
("
|
|
1023
|
+
("providers", Value::list(vec![jo(vec![
|
|
1024
|
+
("name", Value::str("static")),
|
|
1025
|
+
("token", Value::str("ZZTOKEN-feat456")),
|
|
1026
|
+
])])),
|
|
1020
1027
|
]),
|
|
1021
1028
|
),
|
|
1022
1029
|
(
|
|
@@ -82,6 +82,21 @@ impl EntyClass {
|
|
|
82
82
|
&self,
|
|
83
83
|
ctx: &Rc<Context>,
|
|
84
84
|
post_done: &dyn Fn(&Rc<Context>),
|
|
85
|
+
) -> Result<Value, ProjectNameError> {
|
|
86
|
+
let predone = std::cell::Cell::new(false);
|
|
87
|
+
let out = self.run_steps(ctx, post_done, &predone);
|
|
88
|
+
// A refusal or a failed step left before PreDone.
|
|
89
|
+
if !predone.get() {
|
|
90
|
+
self.utility.feature_hook(ctx, "PreDone");
|
|
91
|
+
}
|
|
92
|
+
out
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
fn run_steps(
|
|
96
|
+
&self,
|
|
97
|
+
ctx: &Rc<Context>,
|
|
98
|
+
post_done: &dyn Fn(&Rc<Context>),
|
|
99
|
+
predone: &std::cell::Cell<bool>,
|
|
85
100
|
) -> Result<Value, ProjectNameError> {
|
|
86
101
|
let utility = &self.utility;
|
|
87
102
|
|
|
@@ -125,6 +140,7 @@ impl EntyClass {
|
|
|
125
140
|
};
|
|
126
141
|
ctx.out_set("result", crate::core::types::OutVal::Result(result));
|
|
127
142
|
|
|
143
|
+
predone.set(true);
|
|
128
144
|
// #PreDone-Hook
|
|
129
145
|
|
|
130
146
|
post_done(ctx);
|
|
@@ -172,8 +188,12 @@ impl EntyClass {
|
|
|
172
188
|
);
|
|
173
189
|
|
|
174
190
|
// Run the same pipeline as run_op. A failed step leaves through
|
|
175
|
-
// make_error, as an operation's does.
|
|
176
|
-
let fail = |e: ProjectNameError|
|
|
191
|
+
// make_error, then PreDone, as an operation's does.
|
|
192
|
+
let fail = |e: ProjectNameError| {
|
|
193
|
+
let out = self.utility.make_error(&ctx, Some(e)).map(stream_items);
|
|
194
|
+
self.utility.feature_hook(&ctx, "PreDone");
|
|
195
|
+
out
|
|
196
|
+
};
|
|
177
197
|
self.utility.feature_hook(&ctx, "PrePoint");
|
|
178
198
|
let point = match self.utility.make_point(&ctx) {
|
|
179
199
|
Ok(p) => p,
|
|
@@ -106,6 +106,32 @@ object SdkCleanTestMain {
|
|
|
106
106
|
private def I(n: Int): java.lang.Integer = java.lang.Integer.valueOf(n)
|
|
107
107
|
private def B(b: Boolean): java.lang.Boolean = java.lang.Boolean.valueOf(b)
|
|
108
108
|
|
|
109
|
+
// Every string a value holds, private fields included, as a debugger shows them.
|
|
110
|
+
private def dump(v: Any, depth: Int = 0): String =
|
|
111
|
+
if (v == null || 12 < depth) ""
|
|
112
|
+
else v match {
|
|
113
|
+
case s: String => s
|
|
114
|
+
case m: JMap[_, _] =>
|
|
115
|
+
val out = new StringBuilder("{")
|
|
116
|
+
val it = m.entrySet().iterator()
|
|
117
|
+
while (it.hasNext) {
|
|
118
|
+
val e = it.next()
|
|
119
|
+
out.append(dump(e.getKey, depth + 1)).append('=').append(dump(e.getValue, depth + 1)).append(' ')
|
|
120
|
+
}
|
|
121
|
+
out.append('}').toString
|
|
122
|
+
case l: java.lang.Iterable[_] =>
|
|
123
|
+
val out = new StringBuilder("[")
|
|
124
|
+
val it = l.iterator()
|
|
125
|
+
while (it.hasNext) out.append(dump(it.next(), depth + 1)).append(' ')
|
|
126
|
+
out.append(']').toString
|
|
127
|
+
case _ if v.getClass.getName.startsWith("java.") || v.getClass.getName.startsWith("scala.") =>
|
|
128
|
+
String.valueOf(v)
|
|
129
|
+
case _ =>
|
|
130
|
+
v.getClass.getDeclaredFields.filter(f => !Modifier.isStatic(f.getModifiers)).map { f =>
|
|
131
|
+
try { f.trySetAccessible(); dump(f.get(v), depth + 1) } catch { case _: Exception => "" }
|
|
132
|
+
}.mkString("{", " ", "}")
|
|
133
|
+
}
|
|
134
|
+
|
|
109
135
|
private def hasFeature(name: String): Boolean = {
|
|
110
136
|
val fm = Helpers.toMapAny(Config.sharedConfig().get("feature"))
|
|
111
137
|
fm != null && fm.get(name) != null
|
|
@@ -544,17 +570,17 @@ object SdkCleanTestMain {
|
|
|
544
570
|
// out whichever name prepareAuth placed.
|
|
545
571
|
drive(makeSdk(SCENARIOS.head, sinks, null, auth = om("name" -> "zzcred")), target, null, sinks)
|
|
546
572
|
|
|
547
|
-
// A credential mistyped as a map
|
|
548
|
-
//
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
573
|
+
// A credential mistyped as a map is rejected by validation, whose message
|
|
574
|
+
// quotes the value it rejected.
|
|
575
|
+
val rejected =
|
|
576
|
+
try {
|
|
577
|
+
new ${SDK}(offline(om("apikey" -> om("value" -> CANARY_APIKEY),
|
|
578
|
+
"clean" -> om("values" -> CANARY_VALUE))))
|
|
579
|
+
null
|
|
580
|
+
}
|
|
581
|
+
catch { case e: RuntimeException => e }
|
|
582
|
+
rep.check("clean.mistyped", rejected != null, "a credential mistyped as a map should be rejected")
|
|
583
|
+
if (rejected != null) collect(sinks, "rejected", rejected)
|
|
558
584
|
|
|
559
585
|
// An exception a feature hook throws, quoting the request, skips makeError.
|
|
560
586
|
for (unexpected <- List(false, true)) {
|
|
@@ -597,6 +623,14 @@ object SdkCleanTestMain {
|
|
|
597
623
|
val coded = probe.getUtility().clean(probe.getRootCtx(), new SdkError("code_" + CANARY_VALUE, "coded", null))
|
|
598
624
|
collect(sinks, "coded", coded)
|
|
599
625
|
|
|
626
|
+
// The clean registry holds every credential in plain form, and is no option.
|
|
627
|
+
val held = construct(om("apikey" -> CANARY_APIKEY)).optionsMap()
|
|
628
|
+
val helddump = dump(held)
|
|
629
|
+
rep.check("clean.options-apikey", CANARY_APIKEY == held.get("apikey"), "optionsMap lost the caller's apikey")
|
|
630
|
+
rep.check("clean.options-registry",
|
|
631
|
+
leaks(helddump.replaceFirst(java.util.regex.Pattern.quote(CANARY_APIKEY), "")).isEmpty,
|
|
632
|
+
"optionsMap carries a credential beyond the option the caller set: " + helddump)
|
|
633
|
+
|
|
600
634
|
val all = sinks.toArray(new Array[Sink](0)).toList
|
|
601
635
|
val leaked = all.map(s => (s.name, leaks(s.text))).filter(l => l._2.nonEmpty)
|
|
602
636
|
|
|
@@ -74,6 +74,7 @@ abstract class EntityBase(name0: String, client0: SdkClient, entopts0: JMap[Stri
|
|
|
74
74
|
|
|
75
75
|
protected def runOp(ctx: Context, postDone: () => Unit): Object = {
|
|
76
76
|
val utility = this.utility
|
|
77
|
+
var predone = false
|
|
77
78
|
|
|
78
79
|
try {
|
|
79
80
|
// #PrePoint-Hook
|
|
@@ -101,6 +102,7 @@ abstract class EntityBase(name0: String, client0: SdkClient, entopts0: JMap[Stri
|
|
|
101
102
|
val result = utility.makeResult(ctx)
|
|
102
103
|
ctx.out.put("result", result)
|
|
103
104
|
|
|
105
|
+
predone = true
|
|
104
106
|
// #PreDone-Hook
|
|
105
107
|
|
|
106
108
|
postDone()
|
|
@@ -124,9 +126,21 @@ abstract class EntityBase(name0: String, client0: SdkClient, entopts0: JMap[Stri
|
|
|
124
126
|
else out
|
|
125
127
|
} catch {
|
|
126
128
|
case NonFatal(err) => unexpected(ctx, err)
|
|
129
|
+
} finally {
|
|
130
|
+
// A refusal, a failed step or a throw left before PreDone.
|
|
131
|
+
if (!predone) lateDone(ctx)
|
|
127
132
|
}
|
|
128
133
|
}
|
|
129
134
|
|
|
135
|
+
// PreDone on an exit that left before it. What the hook throws leaves
|
|
136
|
+
// cleaned, in place of the error already on its way out.
|
|
137
|
+
private def lateDone(ctx: Context): Unit =
|
|
138
|
+
try this.utility.featureHook(ctx, "PreDone")
|
|
139
|
+
catch {
|
|
140
|
+
case NonFatal(err) if !(java.lang.Boolean.FALSE == ctx.ctrl.throwing) => throw cleanError(ctx, err)
|
|
141
|
+
case NonFatal(_) => ()
|
|
142
|
+
}
|
|
143
|
+
|
|
130
144
|
// The catch path. makeError fires PreUnexpected; an error a hook throws
|
|
131
145
|
// there escapes it, even under throw false, so it is cleaned here.
|
|
132
146
|
private def unexpected(ctx: Context, err: Throwable): Object = {
|
|
@@ -625,13 +625,14 @@ ${candidateLines}
|
|
|
625
625
|
${Name}CleanTest.makeSdk(${Name}CleanTest.scenarios[0], box, auth: vm(("name", .string("zzcred")))),
|
|
626
626
|
target, VMap(), box)
|
|
627
627
|
|
|
628
|
-
// A credential mistyped as a map
|
|
629
|
-
//
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
628
|
+
// A credential mistyped as a map traps at construction, so the refusal
|
|
629
|
+
// that trap carries is cleaned here as makeOptions cleans it.
|
|
630
|
+
let quotectx = Context(["options": vm(("apikey", .string(canaryApikey)),
|
|
631
|
+
("clean", .map(vm(("values", .string(canaryValue))))))], nil)
|
|
632
|
+
quotectx.options = makeOptionsUtil(quotectx)
|
|
633
|
+
let refusal = cleanUtil(quotectx, .string("invalid options: Expected field apikey to be string, " +
|
|
634
|
+
"but found map: {\\"value\\":\\"" + canaryApikey + "\\",\\"note\\":\\"" + canaryValue + "\\"}"))
|
|
635
|
+
box.sinks.append(Sink(name: "rejected", text: refusal.asString ?? ""))
|
|
635
636
|
|
|
636
637
|
// An error a feature hook raises, quoting the request, skips makeError.
|
|
637
638
|
// A swift hook cannot throw, so no variant fails from PreUnexpected.
|
|
@@ -659,9 +660,9 @@ ${candidateLines}
|
|
|
659
660
|
// and is not changed by it.
|
|
660
661
|
let config = vm(("options", .map(vm(("clean", .map(vm(
|
|
661
662
|
("keys", .string("zzsens")), ("values", .string(canaryConfig)))))))))
|
|
662
|
-
let
|
|
663
|
-
["config": config, "options": vm(("clean", .map(vm(("values", .string(canaryValue))))))], nil)
|
|
664
|
-
|
|
663
|
+
let cfgctx = Context(
|
|
664
|
+
["config": config, "options": vm(("clean", .map(vm(("values", .string(canaryValue))))))], nil)
|
|
665
|
+
cfgctx.options = makeOptionsUtil(cfgctx)
|
|
665
666
|
let seeded = cleanUtil(cfgctx, .string("config " + canaryConfig + " caller " + canaryValue)).asString ?? ""
|
|
666
667
|
box.sinks.append(Sink(name: "config-clean", text: seeded))
|
|
667
668
|
XCTAssertEqual(seeded, "config " + mask + " caller " + mask)
|
|
@@ -676,9 +677,8 @@ ${candidateLines}
|
|
|
676
677
|
("err", .nat(${Name}Error("denied_" + canaryValue, "coded failure", nil))))))
|
|
677
678
|
box.sinks += ${Name}CleanTest.formsOf("coded-nested", nested)
|
|
678
679
|
|
|
679
|
-
// With no clean option at all, or
|
|
680
|
-
|
|
681
|
-
for clean in [Value.noval, Value.bool(true)] {
|
|
680
|
+
// With no clean option at all, or a null one, the schema defaults still apply.
|
|
681
|
+
for clean in [Value.noval, Value.null] {
|
|
682
682
|
let fetch404: FetcherFunc = { _, url, fetchdef in
|
|
683
683
|
try ${Name}CleanTest.scenarios[1].respond(url, fetchdef)
|
|
684
684
|
}
|
|
@@ -687,7 +687,7 @@ ${candidateLines}
|
|
|
687
687
|
bareopts.entries["secret"] = .string(canarySecret)
|
|
688
688
|
bareopts.entries["headers"] = .map(vm(("X-Custom-Token", .string(canaryHeader))))
|
|
689
689
|
bareopts.entries["utility"] = .map(vm(("fetcher", .nat(fetch404))))
|
|
690
|
-
if !
|
|
690
|
+
if !clean.isNoval {
|
|
691
691
|
bareopts.entries["clean"] = clean
|
|
692
692
|
}
|
|
693
693
|
let bareerr = ${Name}CleanTest.drive(
|
|
@@ -710,7 +710,8 @@ ${candidateLines}
|
|
|
710
710
|
("rules", .map(vm(("zztoken.load", .string("PLAINRULE-k7j5h3g1")))))))),
|
|
711
711
|
("test", .map(vm(("active", .bool(false)), ("entity", .map(record)))))))
|
|
712
712
|
featopts.entries["entity"] = .map(alias)
|
|
713
|
-
let fctx = Context(["options":
|
|
713
|
+
let fctx = Context(["options": featopts], nil)
|
|
714
|
+
fctx.options = makeOptionsUtil(fctx)
|
|
714
715
|
let fplain = cleanUtil(fctx, .string("kind PLAINSETTING-q8w2e4r6")).asString
|
|
715
716
|
let ftoken = cleanUtil(fctx, .string("token FEATTOKEN-z9y8x7w6")).asString
|
|
716
717
|
let frecord = cleanUtil(fctx, .string("record PLAINRECORD-t5r3e1w9")).asString
|
|
@@ -724,6 +725,16 @@ ${candidateLines}
|
|
|
724
725
|
let rawerr = gp(raw, "err").asNative as? ${Name}Error
|
|
725
726
|
box.sinks += ${Name}CleanTest.formsOf("direct", rawerr)
|
|
726
727
|
|
|
728
|
+
// The clean registry holds every credential in plain form, and is no option.
|
|
729
|
+
let heldopts = VMap()
|
|
730
|
+
heldopts.entries["apikey"] = .string(canaryApikey)
|
|
731
|
+
let held = ${Name}SDK(${Name}CleanTest.offline(heldopts)).optionsMap()
|
|
732
|
+
var helddump = ""
|
|
733
|
+
dump(held, to: &helddump, maxDepth: 16)
|
|
734
|
+
XCTAssertEqual(gp(held, "apikey"), .string(canaryApikey))
|
|
735
|
+
let heldrest = helddump.range(of: canaryApikey).map { helddump.replacingCharacters(in: $0, with: "") } ?? helddump
|
|
736
|
+
XCTAssertEqual(leaks(heldrest), [], "optionsMap carries a credential beyond the option the caller set: " + helddump)
|
|
737
|
+
|
|
727
738
|
let leaked = box.sinks
|
|
728
739
|
.map { (name: $0.name, found: leaks($0.text)) }
|
|
729
740
|
.filter { !$0.found.isEmpty }
|
|
@@ -798,7 +809,7 @@ ${candidateLines}
|
|
|
798
809
|
|
|
799
810
|
func testARegisteredValueUsedAsAPropertyNameIsMaskedCollisionsKept() {
|
|
800
811
|
let cfg = makeCleanConfig(gp(SdkSchema.optspec, "clean"))
|
|
801
|
-
let ctx = Context(["
|
|
812
|
+
let ctx = Context(["cleancfg": cfg], nil)
|
|
802
813
|
cleanAddUtil(ctx, .string("ZZVAL-abc123"))
|
|
803
814
|
cleanAddUtil(ctx, .string("ZZVAL-xyz789"))
|
|
804
815
|
let src = vm(("ZZVAL-abc123", .int(1)), ("ZZVAL-xyz789", .int(2)), ("plain", .int(3)))
|
|
@@ -814,7 +825,7 @@ ${candidateLines}
|
|
|
814
825
|
|
|
815
826
|
func testCleanAddSensitiveRegistersEveryScalarUnderASensitiveName() {
|
|
816
827
|
let cfg = makeCleanConfig(gp(SdkSchema.optspec, "clean"))
|
|
817
|
-
let ctx = Context(["
|
|
828
|
+
let ctx = Context(["cleancfg": cfg], nil)
|
|
818
829
|
cleanAddSensitiveUtil(ctx, .map(vm(
|
|
819
830
|
("apikey", .map(vm(("value", .string("NESTED-SECRET-1"))))),
|
|
820
831
|
("headers", .map(vm(("X-Api-Token", .list(VList([.string("LISTED-SECRET-2")])))))),
|
|
@@ -912,8 +923,7 @@ ${candidateLines}
|
|
|
912
923
|
|
|
913
924
|
func testBytesAreDescribedWhereverTheySit() {
|
|
914
925
|
let cfg = makeCleanConfig(gp(SdkSchema.optspec, "clean"))
|
|
915
|
-
let
|
|
916
|
-
let ctx = Context(["options": options], nil)
|
|
926
|
+
let ctx = Context(["cleancfg": cfg], nil)
|
|
917
927
|
let bytes = ${Name}CleanTest.described(canaryContentBytes.count, nil)
|
|
918
928
|
|
|
919
929
|
let live = Value.nat(Data(canaryContentBytes))
|
|
@@ -934,13 +944,13 @@ ${candidateLines}
|
|
|
934
944
|
XCTAssertEqual(cleanUtil(ctx, .string(canaryContent)), .string(canaryContent))
|
|
935
945
|
|
|
936
946
|
let offcfg = makeCleanConfig(.map(vm(("active", .bool(false)))))
|
|
937
|
-
let offctx = Context(["
|
|
947
|
+
let offctx = Context(["cleancfg": offcfg], nil)
|
|
938
948
|
XCTAssertEqual(cleanUtil(offctx, live), live)
|
|
939
949
|
|
|
940
950
|
// By the model: only at a point marked binary is a string body bytes.
|
|
941
951
|
func cleanedAt(_ declared: VMap, _ body: Value) -> Value {
|
|
942
952
|
let pctx = Context([
|
|
943
|
-
"
|
|
953
|
+
"cleancfg": cfg,
|
|
944
954
|
"point": vm(("body", .map(declared))),
|
|
945
955
|
"spec": Spec(vm(("body", body))),
|
|
946
956
|
"reqdata": vm(("$body", body)),
|
|
@@ -103,6 +103,14 @@ open class ProjectNameEntityBase: Entity {
|
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
func runOp(_ ctx: Context, _ postDone: () -> Void) throws -> Value {
|
|
106
|
+
var predone = false
|
|
107
|
+
// A refusal or a failed step left before PreDone.
|
|
108
|
+
defer {
|
|
109
|
+
if !predone {
|
|
110
|
+
utility.featureHook(ctx, "PreDone")
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
106
114
|
// #PrePoint-Hook
|
|
107
115
|
|
|
108
116
|
do {
|
|
@@ -148,6 +156,7 @@ open class ProjectNameEntityBase: Entity {
|
|
|
148
156
|
return try utility.makeError(ctx, error)
|
|
149
157
|
}
|
|
150
158
|
|
|
159
|
+
predone = true
|
|
151
160
|
// #PreDone-Hook
|
|
152
161
|
|
|
153
162
|
postDone()
|
|
@@ -54,23 +54,37 @@ public final class ProjectNameSDK {
|
|
|
54
54
|
// declares `transport: 'wrap'` wrap whatever is current, so `test`
|
|
55
55
|
// must be added before them to sit at the base of the chain.
|
|
56
56
|
let featureOpts = gp(options, "feature").asMap ?? ProjectNameSdk.VMap()
|
|
57
|
+
func active(_ fname: String) -> Bool {
|
|
58
|
+
gp(featureOpts, fname).asMap?.entries["active"]?.asBool == true
|
|
59
|
+
}
|
|
60
|
+
let extend: [BaseFeature] = (gp(options, "extend").asList?.items ?? [])
|
|
61
|
+
.compactMap { $0.asNative as? BaseFeature }
|
|
62
|
+
var placed: [BaseFeature] = []
|
|
57
63
|
if let featureOrder = gpath(options, "__derived__", "featureorder").asList {
|
|
58
64
|
for fnameVal in featureOrder.items {
|
|
59
65
|
let fname = fnameVal.asString ?? ""
|
|
60
|
-
if fname
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
if fname == "" || !active(fname) {
|
|
67
|
+
continue
|
|
68
|
+
}
|
|
69
|
+
let gen = SdkConfig.makeFeature(fname)
|
|
70
|
+
// An active name with no generated class is legal when an
|
|
71
|
+
// extend-supplied instance carries that name (station's adopt
|
|
72
|
+
// path): the instance takes the slot the order gives its name.
|
|
73
|
+
if gen.getName() != fname, let carried = extend.first(where: { $0.getName() == fname }) {
|
|
74
|
+
placed.append(carried)
|
|
75
|
+
utility.featureAdd(rootctx, carried)
|
|
76
|
+
} else {
|
|
77
|
+
utility.featureAdd(rootctx, gen)
|
|
63
78
|
}
|
|
64
79
|
}
|
|
65
80
|
}
|
|
66
81
|
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
82
|
+
// An extend feature is active by its option, else by its own flag.
|
|
83
|
+
func extActive(_ feat: BaseFeature) -> Bool {
|
|
84
|
+
gp(featureOpts, feat.getName()).asMap?.entries["active"]?.asBool ?? feat.getActive()
|
|
85
|
+
}
|
|
86
|
+
for feat in extend where !placed.contains(where: { $0 === feat }) && extActive(feat) {
|
|
87
|
+
utility.featureAdd(rootctx, feat)
|
|
74
88
|
}
|
|
75
89
|
|
|
76
90
|
// Initialize features.
|