@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
|
@@ -111,25 +111,59 @@ function ProjectNameSDK.new(options)
|
|
|
111
111
|
-- declares `transport: 'wrap'` wrap whatever is current, so `test`
|
|
112
112
|
-- must be added before them to sit at the base of the chain.
|
|
113
113
|
local feature_opts = helpers.to_map(vs.getprop(self.options, "feature"))
|
|
114
|
+
local function active(fname)
|
|
115
|
+
local fopts = feature_opts ~= nil and helpers.to_map(feature_opts[fname]) or nil
|
|
116
|
+
return fopts ~= nil and fopts["active"] == true
|
|
117
|
+
end
|
|
118
|
+
local extend = {}
|
|
119
|
+
local given = vs.getprop(self.options, "extend")
|
|
120
|
+
if type(given) == "table" then
|
|
121
|
+
for _, f in ipairs(given) do
|
|
122
|
+
if type(f) == "table" and type(f.get_name) == "function" then
|
|
123
|
+
table.insert(extend, f)
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
local placed = {}
|
|
114
128
|
if feature_opts ~= nil then
|
|
115
129
|
local featureorder = vs.getpath(self.options, "__derived__.featureorder")
|
|
116
130
|
if type(featureorder) == "table" then
|
|
117
131
|
for _, fname in ipairs(featureorder) do
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
132
|
+
if active(fname) then
|
|
133
|
+
-- An active name with no generated class is legal when an
|
|
134
|
+
-- extend-supplied instance carries that name (station's adopt
|
|
135
|
+
-- path): the instance takes the slot the order gives its name.
|
|
136
|
+
local carried = nil
|
|
137
|
+
if features_factory[fname] == nil then
|
|
138
|
+
for _, f in ipairs(extend) do
|
|
139
|
+
if f:get_name() == fname then
|
|
140
|
+
carried = f
|
|
141
|
+
break
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
if carried ~= nil then
|
|
146
|
+
placed[carried] = true
|
|
147
|
+
utility.feature_add(self._rootctx, carried)
|
|
148
|
+
else
|
|
149
|
+
utility.feature_add(self._rootctx, _make_feature(fname))
|
|
150
|
+
end
|
|
121
151
|
end
|
|
122
152
|
end
|
|
123
153
|
end
|
|
124
154
|
end
|
|
125
155
|
|
|
126
|
-
--
|
|
127
|
-
local
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
156
|
+
-- An extend feature is active by its option, else by its own flag.
|
|
157
|
+
local function ext_active(f)
|
|
158
|
+
local fopts = feature_opts ~= nil and helpers.to_map(feature_opts[f:get_name()]) or nil
|
|
159
|
+
if fopts ~= nil and fopts["active"] ~= nil then
|
|
160
|
+
return fopts["active"] == true
|
|
161
|
+
end
|
|
162
|
+
return f.active == true
|
|
163
|
+
end
|
|
164
|
+
for _, f in ipairs(extend) do
|
|
165
|
+
if not placed[f] and ext_active(f) then
|
|
166
|
+
utility.feature_add(self._rootctx, f)
|
|
133
167
|
end
|
|
134
168
|
end
|
|
135
169
|
|
|
@@ -21,8 +21,9 @@ function formatLuaTable(obj: any, indent: number = 0): string {
|
|
|
21
21
|
const padInner = ' '.repeat(indent + 1)
|
|
22
22
|
|
|
23
23
|
if (Array.isArray(obj)) {
|
|
24
|
+
// A bare {} reads as a map; the struct port's marker keeps an empty list a list.
|
|
24
25
|
if (obj.length === 0) {
|
|
25
|
-
return '{}'
|
|
26
|
+
return 'setmetatable({}, { __jsontype = "array" })'
|
|
26
27
|
}
|
|
27
28
|
const items = obj.map(v => padInner + formatLuaValue(v, indent + 1)).join(',\n')
|
|
28
29
|
return `{\n${items},\n${pad}}`
|
|
@@ -490,6 +490,19 @@ let () =
|
|
|
490
490
|
let direct = Sdk_client.direct (make_sdk (List.nth scenarios 3) sinks []) (jo [("path", Str "raw")]) in
|
|
491
491
|
check "a transport failure should fail direct()" (getp direct "ok" = Bool false);
|
|
492
492
|
value_forms sinks "direct" direct;
|
|
493
|
+
(* The clean registry holds every credential in plain form, and is no option. *)
|
|
494
|
+
let key = canary_of "apikey" in
|
|
495
|
+
let held = client_options_map (construct (jo [("apikey", Str key)])) in
|
|
496
|
+
let heldjson = jsonify held in
|
|
497
|
+
check_vstr "options_map keeps the caller's apikey" (getp held "apikey") key;
|
|
498
|
+
let heldrest =
|
|
499
|
+
let n = String.length key and m = String.length heldjson in
|
|
500
|
+
let rec find i = if i + n > m then None else if String.sub heldjson i n = key then Some i else find (i + 1) in
|
|
501
|
+
match find 0 with
|
|
502
|
+
| Some i -> String.sub heldjson 0 i ^ String.sub heldjson (i + n) (m - i - n)
|
|
503
|
+
| None -> heldjson in
|
|
504
|
+
if leaks heldrest <> [] then
|
|
505
|
+
failwith ("options_map carries a credential beyond the option the caller set: " ^ heldjson);
|
|
493
506
|
let leaked = List.filter (fun (_, text) -> leaks text <> []) !sinks in
|
|
494
507
|
Printf.printf "clean: swept %d surface(s), %d leak(s)\\n%!" (List.length !sinks) (List.length leaked);
|
|
495
508
|
if leaked <> [] then
|
|
@@ -553,7 +566,7 @@ let () =
|
|
|
553
566
|
let clean_ctx () : value * ctx =
|
|
554
567
|
let cfg = make_clean_config (jo [("keys", Str "key,secret,token")]) in
|
|
555
568
|
let base = make_context_impl (default_ctxspec ()) None in
|
|
556
|
-
(cfg, { base with
|
|
569
|
+
(cfg, { base with c_cleancfg = cfg })
|
|
557
570
|
|
|
558
571
|
let () =
|
|
559
572
|
test "clean.a_registered_value_used_as_a_property_name" (fun () ->
|
|
@@ -579,7 +592,8 @@ let () =
|
|
|
579
592
|
("apikey", Str (canary_of "apikey"));
|
|
580
593
|
("feature", jo [
|
|
581
594
|
("secrets", jo [("active", Bool false); ("name", Str "ZZNAME-feat123");
|
|
582
|
-
("
|
|
595
|
+
("providers", ja [jo [("name", Str "static");
|
|
596
|
+
("token", Str "ZZTOKEN-feat456")]])]);
|
|
583
597
|
("rbac", jo [("active", Bool false);
|
|
584
598
|
("rules", jo [("zztoken.load", Str "PLAINRULE-k7j5h3g1")])]);
|
|
585
599
|
("test", jo [("active", Bool false); ("entity", seeded)])]);
|
|
@@ -601,9 +615,10 @@ let () =
|
|
|
601
615
|
let base = make_context_impl (default_ctxspec ()) None in
|
|
602
616
|
let config = jo [("options", jo [("clean", jo [
|
|
603
617
|
("keys", Str "zzsens"); ("values", Str "CONFIG-SEEDED-1")])])] in
|
|
604
|
-
let
|
|
605
|
-
|
|
606
|
-
let
|
|
618
|
+
let cctx = { base with c_config = config;
|
|
619
|
+
c_options = jo [("clean", jo [("values", Str "CALLER-SEEDED-2")])] } in
|
|
620
|
+
let opts = make_options_util cctx in
|
|
621
|
+
let ctx = { cctx with c_options = opts } in
|
|
607
622
|
check_vstr "both seeded values are masked"
|
|
608
623
|
(clean_util ctx (Str "a CONFIG-SEEDED-1 b CALLER-SEEDED-2")) ("a " ^ mask ^ " b " ^ mask);
|
|
609
624
|
let out = clean_util ctx (jo [("my_zzsens", Str "x"); ("other", Str "y")]) in
|
|
@@ -22,26 +22,41 @@ let unexpected (ctx : ctx) (e : exn) : value =
|
|
|
22
22
|
* returns resdata when throw is disabled, or raises). *)
|
|
23
23
|
let run_op (ctx : ctx) (post_done : unit -> unit) : value =
|
|
24
24
|
let utility = cu ctx in
|
|
25
|
+
let predone = ref false in
|
|
25
26
|
let bail (err : sdk_error option) = raise (Op_return (utility.u_make_error ctx err)) in
|
|
26
|
-
|
|
27
|
+
(* A refusal, a failed step or a raise left before PreDone. What the late
|
|
28
|
+
* hook raises leaves cleaned, in place of the error on its way out. *)
|
|
29
|
+
let late () =
|
|
30
|
+
if not !predone then begin
|
|
31
|
+
predone := true;
|
|
32
|
+
(try feature_hook ctx "PreDone"
|
|
33
|
+
with hookerr ->
|
|
34
|
+
if ctx.c_ctrl.ctrl_throw <> Some false then raise (clean_exn ctx hookerr))
|
|
35
|
+
end in
|
|
36
|
+
match
|
|
27
37
|
(try
|
|
28
|
-
(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
(try
|
|
39
|
+
(* #PrePoint-Hook *)
|
|
40
|
+
let point = (match utility.u_make_point ctx with (p, None) -> p | (_, e) -> bail e) in
|
|
41
|
+
Hashtbl.replace ctx.c_out "point" (OPoint point);
|
|
42
|
+
(* #PreSpec-Hook *)
|
|
43
|
+
let spec = (match utility.u_make_spec ctx with (Some s, None) -> s | (_, e) -> bail e) in
|
|
44
|
+
Hashtbl.replace ctx.c_out "spec" (OSpec spec);
|
|
45
|
+
(* #PreRequest-Hook *)
|
|
46
|
+
let resp = (match utility.u_make_request ctx with (Some r, None) -> r | (_, e) -> bail e) in
|
|
47
|
+
Hashtbl.replace ctx.c_out "request" (OResponse resp);
|
|
48
|
+
(* #PreResponse-Hook *)
|
|
49
|
+
let resp2 = (match utility.u_make_response ctx with (Some r, None) -> r | (_, e) -> bail e) in
|
|
50
|
+
Hashtbl.replace ctx.c_out "response" (OResponse resp2);
|
|
51
|
+
(* #PreResult-Hook *)
|
|
52
|
+
let result = (match utility.u_make_result ctx with (Some r, None) -> r | (_, e) -> bail e) in
|
|
53
|
+
Hashtbl.replace ctx.c_out "result" (OResult result);
|
|
54
|
+
predone := true;
|
|
55
|
+
(* #PreDone-Hook *)
|
|
56
|
+
post_done ();
|
|
57
|
+
utility.u_done ctx
|
|
58
|
+
with Op_return v -> v)
|
|
59
|
+
with e -> unexpected ctx e)
|
|
60
|
+
with
|
|
61
|
+
| v -> late (); v
|
|
62
|
+
| exception e -> late (); raise e
|
|
@@ -484,7 +484,7 @@ sub make_sdk {
|
|
|
484
484
|
$feature{log} = { 'active' => 1,
|
|
485
485
|
'logger' => sub { push @$sinks, { 'name' => 'log', 'text' => "$_[0]" }; return } }
|
|
486
486
|
if has_feature('log');
|
|
487
|
-
$feature{debug} = { 'active' => 1, '
|
|
487
|
+
$feature{debug} = { 'active' => 1, 'onEntry' => $capture->('debug') } if has_feature('debug');
|
|
488
488
|
$feature{audit} = { 'active' => 1, 'sink' => $capture->('audit') } if has_feature('audit');
|
|
489
489
|
$feature{telemetry} = { 'active' => 1, 'exporter' => $capture->('telemetry') }
|
|
490
490
|
if has_feature('telemetry');
|
|
@@ -745,12 +745,12 @@ SKIP: {
|
|
|
745
745
|
# is not changed by it.
|
|
746
746
|
my $util = $hooked->get_utility();
|
|
747
747
|
my $cfgclean = { 'keys' => 'zzsens', 'values' => $CANARY{config} };
|
|
748
|
-
my $
|
|
748
|
+
my $cfgctx = $util->{make_context}->({
|
|
749
749
|
'utility' => $util,
|
|
750
750
|
'config' => { 'options' => { 'clean' => $cfgclean } },
|
|
751
751
|
'options' => { 'clean' => { 'values' => $CANARY{value} } },
|
|
752
|
-
}, undef)
|
|
753
|
-
|
|
752
|
+
}, undef);
|
|
753
|
+
$cfgctx->{options} = $util->{make_options}->($cfgctx);
|
|
754
754
|
my $seeded = $util->{clean}->($cfgctx, "config $CANARY{config} caller $CANARY{value}");
|
|
755
755
|
push @sinks, { 'name' => 'config-clean', 'text' => "$seeded" };
|
|
756
756
|
is($seeded, "config $MASK caller $MASK", "the config's clean values are registered");
|
|
@@ -794,6 +794,15 @@ SKIP: {
|
|
|
794
794
|
my $falias = $fclean->($featured->get_root_ctx(), 'alias PLAINALIAS-m2n4b6v8');
|
|
795
795
|
my $frule = $fclean->($featured->get_root_ctx(), 'rule PLAINRULE-k7j5h3g1');
|
|
796
796
|
|
|
797
|
+
# The clean registry holds every credential in plain form, and is no option.
|
|
798
|
+
my $held = construct({ 'apikey' => $CANARY{apikey} })->options_map();
|
|
799
|
+
my $heldjson = $JSON->encode($held);
|
|
800
|
+
my $heldquoted = $JSON->encode([$CANARY{apikey}]) =~ s/^\\[|\\]$//gr;
|
|
801
|
+
is($held->{apikey}, $CANARY{apikey}, 'options_map keeps the apikey the caller set');
|
|
802
|
+
is_deeply([ leaks($heldjson =~ s/\\Q$heldquoted\\E//r) ], [],
|
|
803
|
+
'options_map carries no credential beyond the option the caller set')
|
|
804
|
+
or diag($heldjson);
|
|
805
|
+
|
|
797
806
|
my @leaked = grep { @{ $_->{found} } }
|
|
798
807
|
map { { 'name' => $_->{name}, 'found' => [ leaks($_->{text}) ] } } @sinks;
|
|
799
808
|
|
|
@@ -229,6 +229,7 @@ sub stream {
|
|
|
229
229
|
sub _run_op {
|
|
230
230
|
my ($self, $ctx, $post_done) = @_;
|
|
231
231
|
my $utility = $self->{_utility};
|
|
232
|
+
my $predone = 0;
|
|
232
233
|
|
|
233
234
|
my $out = eval {
|
|
234
235
|
# #PrePoint-Hook
|
|
@@ -261,6 +262,7 @@ sub _run_op {
|
|
|
261
262
|
$ctx->{out}{result} = $result;
|
|
262
263
|
return $utility->{make_error}->($ctx, $result_err) if $result_err;
|
|
263
264
|
|
|
265
|
+
$predone = 1;
|
|
264
266
|
# #PreDone-Hook
|
|
265
267
|
|
|
266
268
|
$post_done->();
|
|
@@ -302,12 +304,31 @@ sub _run_op {
|
|
|
302
304
|
}
|
|
303
305
|
|
|
304
306
|
my $e = $self->_unexpected($ctx, $operr);
|
|
307
|
+
# A refusal, a failed step or a die left before PreDone.
|
|
308
|
+
$self->_late_done($ctx) unless $predone;
|
|
305
309
|
die $e if defined $e;
|
|
306
310
|
return undef;
|
|
307
311
|
}
|
|
312
|
+
$self->_late_done($ctx) unless $predone;
|
|
308
313
|
return $out;
|
|
309
314
|
}
|
|
310
315
|
|
|
316
|
+
# PreDone on an exit that left before it. What the hook dies with leaves
|
|
317
|
+
# cleaned, in place of the error already on its way out.
|
|
318
|
+
sub _late_done {
|
|
319
|
+
my ($self, $ctx) = @_;
|
|
320
|
+
my $fired = eval {
|
|
321
|
+
$self->{_utility}{feature_hook}->($ctx, 'PreDone');
|
|
322
|
+
1;
|
|
323
|
+
};
|
|
324
|
+
return if $fired;
|
|
325
|
+
my $hookerr = $@;
|
|
326
|
+
$ctx->{ctrl}{err} = $hookerr;
|
|
327
|
+
my $e = $self->_unexpected($ctx, $hookerr);
|
|
328
|
+
die $e if defined $e;
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
|
|
311
332
|
# An exception the pipeline did not build still leaves through the
|
|
312
333
|
# caller: it is cleaned, and so is the explain record it interrupted.
|
|
313
334
|
# Answers undef when throwing is disabled, as the pipeline's own errors do.
|
|
@@ -72,22 +72,41 @@ sub new {
|
|
|
72
72
|
my $featureorder = ProjectNameHelpers::gpath(
|
|
73
73
|
$self->{options}, '__derived__.featureorder');
|
|
74
74
|
$featureorder = [] unless Voxgig::Struct::islist($featureorder);
|
|
75
|
+
my $extend = ProjectNameHelpers::gp($self->{options}, 'extend');
|
|
76
|
+
my @extend = grep { Scalar::Util::blessed($_) && $_->can('get_name') }
|
|
77
|
+
(Voxgig::Struct::islist($extend) ? @$extend : ());
|
|
78
|
+
my $active = sub {
|
|
79
|
+
my $fopts = ProjectNameHelpers::to_map($feature_opts->{ $_[0] });
|
|
80
|
+
return $fopts && ProjectNameHelpers::is_true($fopts->{active});
|
|
81
|
+
};
|
|
82
|
+
my %placed;
|
|
75
83
|
for my $fname (@$featureorder) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
next unless $active->($fname);
|
|
85
|
+
my $gen = ProjectNameFeatures::make_feature($fname);
|
|
86
|
+
# An active name with no generated class is legal when an
|
|
87
|
+
# extend-supplied instance carries that name (station's adopt path):
|
|
88
|
+
# the instance takes the slot the order gives its name.
|
|
89
|
+
my ($carried) = $gen->get_name eq $fname ? () :
|
|
90
|
+
grep { $_->get_name eq $fname } @extend;
|
|
91
|
+
if ($carried) {
|
|
92
|
+
$placed{ Scalar::Util::refaddr($carried) } = 1;
|
|
93
|
+
$utility->{feature_add}->($self->{_rootctx}, $carried);
|
|
94
|
+
next;
|
|
80
95
|
}
|
|
96
|
+
$utility->{feature_add}->($self->{_rootctx}, $gen);
|
|
81
97
|
}
|
|
82
98
|
|
|
83
|
-
#
|
|
84
|
-
my $
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
99
|
+
# An extend feature is active by its option, else by its own flag.
|
|
100
|
+
my $ext_active = sub {
|
|
101
|
+
my ($f) = @_;
|
|
102
|
+
my $fopts = ProjectNameHelpers::to_map($feature_opts->{ $f->get_name });
|
|
103
|
+
return ProjectNameHelpers::is_true($fopts->{active})
|
|
104
|
+
if $fopts && defined $fopts->{active};
|
|
105
|
+
return $f->can('get_active') && ProjectNameHelpers::is_true($f->get_active);
|
|
106
|
+
};
|
|
107
|
+
for my $f (@extend) {
|
|
108
|
+
next if $placed{ Scalar::Util::refaddr($f) } || !$ext_active->($f);
|
|
109
|
+
$utility->{feature_add}->($self->{_rootctx}, $f);
|
|
91
110
|
}
|
|
92
111
|
|
|
93
112
|
# Initialize features.
|
|
@@ -846,12 +846,12 @@ class CleanTest extends TestCase
|
|
|
846
846
|
// and is not changed by it.
|
|
847
847
|
$config = ['options' => ['clean' => ['keys' => 'zzsens', 'values' => self::CANARY['config']]]];
|
|
848
848
|
$util = $hooked->get_utility();
|
|
849
|
-
$
|
|
849
|
+
$cfgctx = new ${Name}Context([
|
|
850
850
|
'utility' => $util,
|
|
851
851
|
'config' => $config,
|
|
852
852
|
'options' => ['clean' => ['values' => self::CANARY['value']]],
|
|
853
|
-
], null)
|
|
854
|
-
$cfgctx =
|
|
853
|
+
], null);
|
|
854
|
+
$cfgctx->options = ($util->make_options)($cfgctx);
|
|
855
855
|
$seeded = ($util->clean)($cfgctx, 'config ' . self::CANARY['config'] . ' caller ' . self::CANARY['value']);
|
|
856
856
|
$sinks[] = ['name' => 'config-clean', 'text' => (string)$seeded];
|
|
857
857
|
$this->assertSame('config ' . self::MASK . ' caller ' . self::MASK, $seeded);
|
|
@@ -899,6 +899,13 @@ class CleanTest extends TestCase
|
|
|
899
899
|
$falias = $fclean($featured->get_root_ctx(), 'alias PLAINALIAS-m2n4b6v8');
|
|
900
900
|
$frule = $fclean($featured->get_root_ctx(), 'rule PLAINRULE-k7j5h3g1');
|
|
901
901
|
|
|
902
|
+
// The clean registry holds every credential in plain form, and is no option.
|
|
903
|
+
$held = self::construct(['apikey' => self::CANARY['apikey']])->options_map();
|
|
904
|
+
$heldjson = (string)json_encode($held, JSON_PARTIAL_OUTPUT_ON_ERROR);
|
|
905
|
+
$this->assertSame(self::CANARY['apikey'], $held['apikey'] ?? null);
|
|
906
|
+
$this->assertSame([], self::leaks(preg_replace('/' . preg_quote(json_encode(self::CANARY['apikey']), '/') . '/',
|
|
907
|
+
'', $heldjson, 1)), 'options_map carries a credential beyond the option the caller set: ' . $heldjson);
|
|
908
|
+
|
|
902
909
|
$leaked = [];
|
|
903
910
|
$excerpt = '';
|
|
904
911
|
foreach ($sinks as $s) {
|
|
@@ -181,8 +181,13 @@ class EntyClass
|
|
|
181
181
|
|
|
182
182
|
// The pipeline runs as the caller iterates, so its errors leave
|
|
183
183
|
// through the same catch path as an operation's.
|
|
184
|
+
$predone = false;
|
|
184
185
|
try {
|
|
185
186
|
$failed = $this->_stream_steps($ctx);
|
|
187
|
+
if ($failed === null) {
|
|
188
|
+
$predone = true;
|
|
189
|
+
($utility->feature_hook)($ctx, "PreDone");
|
|
190
|
+
}
|
|
186
191
|
$result = $ctx->result;
|
|
187
192
|
|
|
188
193
|
// Inbound: prefer the streaming feature's incremental generator;
|
|
@@ -231,10 +236,14 @@ class EntyClass
|
|
|
231
236
|
if ($err !== null) {
|
|
232
237
|
throw $err;
|
|
233
238
|
}
|
|
239
|
+
} finally {
|
|
240
|
+
if (!$predone) {
|
|
241
|
+
$this->_late_done($ctx);
|
|
242
|
+
}
|
|
234
243
|
}
|
|
235
244
|
}
|
|
236
245
|
|
|
237
|
-
// The steps
|
|
246
|
+
// The steps before PreDone, with their hooks; the first that fails
|
|
238
247
|
// hands back its error.
|
|
239
248
|
private function _stream_steps($ctx): mixed
|
|
240
249
|
{
|
|
@@ -275,7 +284,6 @@ class EntyClass
|
|
|
275
284
|
return $err;
|
|
276
285
|
}
|
|
277
286
|
|
|
278
|
-
($utility->feature_hook)($ctx, "PreDone");
|
|
279
287
|
return null;
|
|
280
288
|
}
|
|
281
289
|
|
|
@@ -294,9 +302,10 @@ class EntyClass
|
|
|
294
302
|
private function _run_op($ctx, callable $post_done): mixed
|
|
295
303
|
{
|
|
296
304
|
$utility = $this->_utility;
|
|
305
|
+
$predone = false;
|
|
297
306
|
|
|
298
307
|
try {
|
|
299
|
-
return $this->_run_steps($ctx, $post_done);
|
|
308
|
+
return $this->_run_steps($ctx, $post_done, $predone);
|
|
300
309
|
} catch (\Throwable $err) {
|
|
301
310
|
// What a hook throws here must not escape the cleaning below.
|
|
302
311
|
try {
|
|
@@ -312,6 +321,25 @@ class EntyClass
|
|
|
312
321
|
throw $err;
|
|
313
322
|
}
|
|
314
323
|
return null;
|
|
324
|
+
} finally {
|
|
325
|
+
// A refusal, a failed step or a throw left before PreDone.
|
|
326
|
+
if (!$predone) {
|
|
327
|
+
$this->_late_done($ctx);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// PreDone on an exit that left before it. What the hook throws leaves
|
|
333
|
+
// cleaned, in place of the error already on its way out.
|
|
334
|
+
private function _late_done($ctx): void
|
|
335
|
+
{
|
|
336
|
+
try {
|
|
337
|
+
($this->_utility->feature_hook)($ctx, "PreDone");
|
|
338
|
+
} catch (\Throwable $hookerr) {
|
|
339
|
+
$err = $this->_unexpected($ctx, $hookerr);
|
|
340
|
+
if ($err !== null) {
|
|
341
|
+
throw $err;
|
|
342
|
+
}
|
|
315
343
|
}
|
|
316
344
|
}
|
|
317
345
|
|
|
@@ -325,7 +353,7 @@ class EntyClass
|
|
|
325
353
|
return $ctx->ctrl->throw_err === false ? null : $cleaned;
|
|
326
354
|
}
|
|
327
355
|
|
|
328
|
-
private function _run_steps($ctx, callable $post_done): mixed
|
|
356
|
+
private function _run_steps($ctx, callable $post_done, bool &$predone): mixed
|
|
329
357
|
{
|
|
330
358
|
$utility = $this->_utility;
|
|
331
359
|
|
|
@@ -369,6 +397,7 @@ class EntyClass
|
|
|
369
397
|
return ($utility->make_error)($ctx, $err);
|
|
370
398
|
}
|
|
371
399
|
|
|
400
|
+
$predone = true;
|
|
372
401
|
// #PreDone-Hook
|
|
373
402
|
|
|
374
403
|
$post_done();
|
|
@@ -70,6 +70,7 @@ class ProjectNameSDK implements \JsonSerializable
|
|
|
70
70
|
// whose model declares `transport: 'wrap'` wrap whatever is
|
|
71
71
|
// current, so `test` must be added before them to sit at the base.
|
|
72
72
|
$feature_opts = ProjectNameHelpers::to_map(Struct::getprop($this->options, "feature"));
|
|
73
|
+
$placed = [];
|
|
73
74
|
if ($feature_opts) {
|
|
74
75
|
$featureorder = Struct::getpath($this->options, "__derived__.featureorder");
|
|
75
76
|
if (is_array($featureorder)) {
|
|
@@ -78,14 +79,14 @@ class ProjectNameSDK implements \JsonSerializable
|
|
|
78
79
|
if ($fopts && isset($fopts["active"]) && $fopts["active"] === true) {
|
|
79
80
|
// An active name with no generated feature class is
|
|
80
81
|
// legal when an extend-supplied instance carries that
|
|
81
|
-
// name (station's adopt path): the instance
|
|
82
|
-
//
|
|
83
|
-
// skip it here rather than add a BaseFeature stray
|
|
84
|
-
// that would silently shift feature positions.
|
|
82
|
+
// name (station's adopt path): the instance takes the
|
|
83
|
+
// slot the order gives its name.
|
|
85
84
|
if (!ProjectNameFeatures::has_feature($fname)) {
|
|
86
85
|
foreach ($extend_val as $ef) {
|
|
87
86
|
if (is_object($ef) && method_exists($ef, 'get_name')
|
|
88
87
|
&& $fname === $ef->get_name()) {
|
|
88
|
+
$placed[] = $ef;
|
|
89
|
+
($utility->feature_add)($this->_rootctx, $ef);
|
|
89
90
|
continue 2;
|
|
90
91
|
}
|
|
91
92
|
}
|
|
@@ -96,9 +97,15 @@ class ProjectNameSDK implements \JsonSerializable
|
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
//
|
|
100
|
+
// An extend feature is active by its option, else by its own flag.
|
|
100
101
|
foreach ($extend_val as $f) {
|
|
101
|
-
if (is_object($f)
|
|
102
|
+
if (!is_object($f) || !method_exists($f, 'get_name') || in_array($f, $placed, true)) {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
$fopts = ProjectNameHelpers::to_map($feature_opts[$f->get_name()] ?? null);
|
|
106
|
+
$fa = $fopts ? ($fopts["active"] ?? null) : null;
|
|
107
|
+
$own = method_exists($f, 'get_active') ? $f->get_active() : ($f->active ?? null);
|
|
108
|
+
if (true === $fa || (null === $fa && true === $own)) {
|
|
102
109
|
($utility->feature_add)($this->_rootctx, $f);
|
|
103
110
|
}
|
|
104
111
|
}
|
|
@@ -613,12 +613,12 @@ class TestClean:
|
|
|
613
613
|
# The generated config's own clean block is read beside the caller's,
|
|
614
614
|
# and is not changed by it.
|
|
615
615
|
cfgclean = {"keys": "zzsens", "values": CANARY["config"]}
|
|
616
|
-
|
|
616
|
+
cfgctx = util.make_context({
|
|
617
617
|
"utility": util,
|
|
618
618
|
"config": {"options": {"clean": cfgclean}},
|
|
619
619
|
"options": {"clean": {"values": CANARY["value"]}},
|
|
620
|
-
}, None)
|
|
621
|
-
cfgctx = util.
|
|
620
|
+
}, None)
|
|
621
|
+
cfgctx.options = util.make_options(cfgctx)
|
|
622
622
|
seeded = util.clean(cfgctx, "config " + CANARY["config"] + " caller " + CANARY["value"])
|
|
623
623
|
sinks.append(("config-clean", seeded))
|
|
624
624
|
assert seeded == "config " + MASK + " caller " + MASK, seeded
|
|
@@ -658,6 +658,13 @@ class TestClean:
|
|
|
658
658
|
falias = fclean(froot, "alias PLAINALIAS-m2n4b6v8")
|
|
659
659
|
frule = fclean(froot, "rule PLAINRULE-k7j5h3g1")
|
|
660
660
|
|
|
661
|
+
# The clean registry holds every credential in plain form, and is no option.
|
|
662
|
+
held = _construct({"apikey": CANARY["apikey"]}).options_map()
|
|
663
|
+
optsjson = json.dumps(held, default=str)
|
|
664
|
+
assert held.get("apikey") == CANARY["apikey"], optsjson
|
|
665
|
+
assert _leaks(optsjson.replace(json.dumps(CANARY["apikey"]), "", 1)) == [], \\
|
|
666
|
+
"options_map() carries a credential beyond the option the caller set: " + optsjson
|
|
667
|
+
|
|
661
668
|
leaked = [(name, _leaks(text)) for name, text in sinks]
|
|
662
669
|
leaked = [(name, found) for name, found in leaked if 0 < len(found)]
|
|
663
670
|
|
|
@@ -108,10 +108,15 @@ class EntyClass:
|
|
|
108
108
|
return bool(signal())
|
|
109
109
|
return bool(getattr(signal, "aborted", False))
|
|
110
110
|
|
|
111
|
+
predone = False
|
|
112
|
+
|
|
111
113
|
# The pipeline runs as the caller iterates, so its errors leave
|
|
112
114
|
# through the same catch path as an operation's.
|
|
113
115
|
try:
|
|
114
116
|
failed = self._stream_steps(ctx)
|
|
117
|
+
if failed is None:
|
|
118
|
+
predone = True
|
|
119
|
+
utility.feature_hook(ctx, "PreDone")
|
|
115
120
|
result = ctx.result
|
|
116
121
|
|
|
117
122
|
# Inbound: prefer the streaming feature's incremental generator;
|
|
@@ -148,8 +153,11 @@ class EntyClass:
|
|
|
148
153
|
err = hookerr
|
|
149
154
|
if self._unexpected(ctx, err) is not None:
|
|
150
155
|
raise err from None
|
|
156
|
+
finally:
|
|
157
|
+
if not predone:
|
|
158
|
+
self._late_done(ctx)
|
|
151
159
|
|
|
152
|
-
# The steps
|
|
160
|
+
# The steps before PreDone, with their hooks; the first that fails
|
|
153
161
|
# hands back its error.
|
|
154
162
|
def _stream_steps(self, ctx):
|
|
155
163
|
utility = self._utility
|
|
@@ -184,7 +192,6 @@ class EntyClass:
|
|
|
184
192
|
if err is not None:
|
|
185
193
|
return err
|
|
186
194
|
|
|
187
|
-
utility.feature_hook(ctx, "PreDone")
|
|
188
195
|
return None
|
|
189
196
|
|
|
190
197
|
# #LoadOp
|
|
@@ -201,6 +208,7 @@ class EntyClass:
|
|
|
201
208
|
|
|
202
209
|
def _run_op(self, ctx, post_done):
|
|
203
210
|
utility = self._utility
|
|
211
|
+
predone = False
|
|
204
212
|
|
|
205
213
|
try:
|
|
206
214
|
# #PrePoint-Hook
|
|
@@ -238,6 +246,7 @@ class EntyClass:
|
|
|
238
246
|
if err is not None:
|
|
239
247
|
return utility.make_error(ctx, err)
|
|
240
248
|
|
|
249
|
+
predone = True
|
|
241
250
|
# #PreDone-Hook
|
|
242
251
|
|
|
243
252
|
post_done()
|
|
@@ -273,6 +282,20 @@ class EntyClass:
|
|
|
273
282
|
return None
|
|
274
283
|
raise err from None
|
|
275
284
|
|
|
285
|
+
finally:
|
|
286
|
+
# A refusal, a failed step or a raise left before PreDone.
|
|
287
|
+
if not predone:
|
|
288
|
+
self._late_done(ctx)
|
|
289
|
+
|
|
290
|
+
# PreDone on an exit that left before it. What the hook raises leaves
|
|
291
|
+
# cleaned, in place of the error already on its way out.
|
|
292
|
+
def _late_done(self, ctx):
|
|
293
|
+
try:
|
|
294
|
+
self._utility.feature_hook(ctx, "PreDone")
|
|
295
|
+
except Exception as err:
|
|
296
|
+
if self._unexpected(ctx, err) is not None:
|
|
297
|
+
raise err from None
|
|
298
|
+
|
|
276
299
|
# An error a hook raised never passed through make_error: it is cleaned,
|
|
277
300
|
# and so is the explain record it interrupted. None when the caller
|
|
278
301
|
# switched throwing off.
|