@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
|
@@ -26,7 +26,7 @@ function makeOptions(ctx: Context) {
|
|
|
26
26
|
const layer = (b: any) => null != b && 'object' === typeof b && !Array.isArray(b) ? b : {}
|
|
27
27
|
const cleancfg = makeCleanConfig(merge([{}, (OPTSPEC as any).clean,
|
|
28
28
|
struct.clone(layer(cfgopts.clean)), layer(opts.clean)]))
|
|
29
|
-
const cleanctx: any = {
|
|
29
|
+
const cleanctx: any = { cleancfg }
|
|
30
30
|
cleanAddSensitive(cleanctx, settings(opts))
|
|
31
31
|
for (const raw of [...splitvalues(cfgopts.clean?.values), ...splitvalues(opts.clean?.values)]) {
|
|
32
32
|
cleanAdd(cleanctx, raw)
|
|
@@ -45,6 +45,11 @@ function makeOptions(ctx: Context) {
|
|
|
45
45
|
opts = { ...opts, feature: fmap }
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
const fdefaults = featureDefaults(struct, config.feature, opts.feature)
|
|
49
|
+
if (fdefaults !== opts.feature) {
|
|
50
|
+
opts = { ...opts, feature: fdefaults }
|
|
51
|
+
}
|
|
52
|
+
|
|
48
53
|
const customUtils = opts.utility || {}
|
|
49
54
|
for (let [key, val] of items(customUtils)) {
|
|
50
55
|
setprop(utility, key, val)
|
|
@@ -58,6 +63,7 @@ function makeOptions(ctx: Context) {
|
|
|
58
63
|
opts = merge([{}, struct.clone(cfgopts), opts])
|
|
59
64
|
|
|
60
65
|
try {
|
|
66
|
+
refuseStrayKeys(opts, optspec)
|
|
61
67
|
opts = validate(opts, optspec)
|
|
62
68
|
}
|
|
63
69
|
catch (err: any) {
|
|
@@ -95,11 +101,12 @@ function makeOptions(ctx: Context) {
|
|
|
95
101
|
})
|
|
96
102
|
}
|
|
97
103
|
|
|
98
|
-
// Resolve the feature add-order: an explicit array order (above) wins
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
let names = Object.keys(opts.feature || {})
|
|
104
|
+
// Resolve the feature add-order: an explicit array order (above) wins, and
|
|
105
|
+
// the names it leaves out follow it test-first, then sorted, so the outcome
|
|
106
|
+
// is deterministic and `test` is the base transport of a map.
|
|
107
|
+
{
|
|
108
|
+
let names = Object.keys(opts.feature || {})
|
|
109
|
+
.filter((n: string) => !featureorder.includes(n)).sort()
|
|
103
110
|
names = names.indexOf('test') < 0
|
|
104
111
|
? names
|
|
105
112
|
: ['test'].concat(names.filter((n: string) => 'test' !== n))
|
|
@@ -108,20 +115,64 @@ function makeOptions(ctx: Context) {
|
|
|
108
115
|
names.splice(si, 1)
|
|
109
116
|
names.splice(names.indexOf('test') + 1, 0, 'station')
|
|
110
117
|
}
|
|
111
|
-
featureorder = names
|
|
118
|
+
featureorder = featureorder.concat(names)
|
|
112
119
|
}
|
|
113
120
|
|
|
114
|
-
opts.__derived__ = {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
121
|
+
opts.__derived__ = { featureorder }
|
|
122
|
+
|
|
123
|
+
// Beside the options, not in them: options() hands them to callers.
|
|
124
|
+
ctx.cleancfg = cleancfg
|
|
118
125
|
|
|
119
126
|
// Again over the merged result: the config's own defaults can carry one.
|
|
120
|
-
cleanAddSensitive(
|
|
127
|
+
cleanAddSensitive(cleanctx, settings(opts))
|
|
121
128
|
|
|
122
129
|
return opts
|
|
123
130
|
}
|
|
124
131
|
|
|
132
|
+
// Before validate: the struct's own refusal prints the value without its
|
|
133
|
+
// functions, so a misspelled callback key would go unnamed.
|
|
134
|
+
function refuseStrayKeys(opts: any, optspec: any) {
|
|
135
|
+
const fspecs = optspec.feature || {}
|
|
136
|
+
for (const [name, fopts] of Object.entries<any>(opts.feature || {})) {
|
|
137
|
+
const spec = specMap(fspecs[name])
|
|
138
|
+
if (null == spec || spec['`$OPEN`'] || null == fopts || 'object' !== typeof fopts) {
|
|
139
|
+
continue
|
|
140
|
+
}
|
|
141
|
+
const stray = Object.keys(fopts)
|
|
142
|
+
.filter((k) => undefined !== fopts[k] && !Object.prototype.hasOwnProperty.call(spec, k))
|
|
143
|
+
if (0 < stray.length) {
|
|
144
|
+
throw new Error('Unexpected keys at field feature.' + name + ': ' + stray.join(', '))
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
function specMap(spec: any): any {
|
|
151
|
+
const alts = Array.isArray(spec) ? spec.slice('`$NOF`' === spec[0] ? 2 : 0) : [spec]
|
|
152
|
+
return alts.find((a: any) => null != a && 'object' === typeof a && !Array.isArray(a))
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
// The model's options for a feature sit beneath the caller's, key by key: a
|
|
157
|
+
// key the caller sets replaces the default whole, so a list is never merged.
|
|
158
|
+
function featureDefaults(struct: any, cfgfeature: any, feature: any): any {
|
|
159
|
+
const isMap = (b: any) => null != b && 'object' === typeof b && !Array.isArray(b)
|
|
160
|
+
if (null != feature && !isMap(feature)) {
|
|
161
|
+
return feature
|
|
162
|
+
}
|
|
163
|
+
const out: any = { ...(feature || {}) }
|
|
164
|
+
for (const name of Object.keys(cfgfeature || {})) {
|
|
165
|
+
const dflt = cfgfeature[name]?.options
|
|
166
|
+
const given = out[name]
|
|
167
|
+
if (!isMap(dflt) || (null == given && true !== dflt.active) ||
|
|
168
|
+
(null != given && !isMap(given))) {
|
|
169
|
+
continue
|
|
170
|
+
}
|
|
171
|
+
out[name] = { ...struct.clone(dflt), ...(given || {}) }
|
|
172
|
+
}
|
|
173
|
+
return null == feature && 0 === Object.keys(out).length ? feature : out
|
|
174
|
+
}
|
|
175
|
+
|
|
125
176
|
|
|
126
177
|
// Registration skips entity blocks, and rbac's rules, keyed by entity and op names.
|
|
127
178
|
function settings(opts: any): any {
|
|
@@ -29,11 +29,15 @@ type OpRef = {
|
|
|
29
29
|
|
|
30
30
|
// A scripted transport built from a case's `res` list. Responses are consumed
|
|
31
31
|
// in order and the last one repeats, so a case that does not care how many
|
|
32
|
-
// attempts happen need only declare one.
|
|
33
|
-
|
|
32
|
+
// attempts happen need only declare one. Each URL it is sent is kept in `sent`,
|
|
33
|
+
// and the time it was sent in `at`; a `cut` response is one whose body stops
|
|
34
|
+
// before its end.
|
|
35
|
+
function scriptedFetcher(res: any[], sent: string[] = [], at: number[] = []) {
|
|
34
36
|
let n = -1
|
|
35
|
-
return async function (_ctx: any,
|
|
37
|
+
return async function (_ctx: any, url: string, _fetchdef: any) {
|
|
36
38
|
n++
|
|
39
|
+
sent.push(url)
|
|
40
|
+
at.push(Date.now())
|
|
37
41
|
const spec = res[n < res.length ? n : res.length - 1] || {}
|
|
38
42
|
|
|
39
43
|
if (true === spec.throw) {
|
|
@@ -47,7 +51,10 @@ function scriptedFetcher(res: any[]) {
|
|
|
47
51
|
status,
|
|
48
52
|
statusText: status < 400 ? 'OK' : 'ERR',
|
|
49
53
|
body: 'not-used',
|
|
50
|
-
json: async () =>
|
|
54
|
+
json: async () => {
|
|
55
|
+
if (true === spec.cut) { throw new TypeError('terminated') }
|
|
56
|
+
return undefined === spec.body ? {} : spec.body
|
|
57
|
+
},
|
|
51
58
|
headers: {
|
|
52
59
|
get(key: string) {
|
|
53
60
|
const lower = String(key).toLowerCase()
|
|
@@ -63,11 +70,11 @@ function scriptedFetcher(res: any[]) {
|
|
|
63
70
|
}
|
|
64
71
|
|
|
65
72
|
|
|
66
|
-
function makeClient(kase: any): any {
|
|
73
|
+
function makeClient(kase: any, sent: string[] = [], at: number[] = []): any {
|
|
67
74
|
return new (SDK as any)({
|
|
68
75
|
test: { active: true },
|
|
69
76
|
feature: kase.feature,
|
|
70
|
-
utility: { fetcher: scriptedFetcher(kase.res || [{ status: 200, body: {} }]) },
|
|
77
|
+
utility: { fetcher: scriptedFetcher(kase.res || [{ status: 200, body: {} }], sent, at) },
|
|
71
78
|
})
|
|
72
79
|
}
|
|
73
80
|
|
|
@@ -119,6 +126,106 @@ async function usableOps(want: number): Promise<OpRef[]> {
|
|
|
119
126
|
}
|
|
120
127
|
|
|
121
128
|
|
|
129
|
+
|
|
130
|
+
const READ_OPS = ['list', 'load']
|
|
131
|
+
const WRITE_OPS = ['create', 'update', 'patch', 'remove']
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
// A read and a write of one entity (#READ, #WRITE), each driven as usableOps
|
|
135
|
+
// drives an op; #ITEM is a write of the same entity driven with ITEM_ARGS.
|
|
136
|
+
async function usablePair(): Promise<{ read: OpRef, write: OpRef, item?: OpRef } | undefined> {
|
|
137
|
+
const found: Record<string, { read?: OpRef, write?: OpRef }> = {}
|
|
138
|
+
for (const cand of candidates(makeClient({}))) {
|
|
139
|
+
const role: 'read' | 'write' | '' = READ_OPS.includes(cand.op) ? 'read' : WRITE_OPS.includes(cand.op) ? 'write' : ''
|
|
140
|
+
const seen = found[cand.entity] = found[cand.entity] || {}
|
|
141
|
+
if ('' === role || null != seen[role]) { continue }
|
|
142
|
+
try {
|
|
143
|
+
await makeClient({})[cand.accessor]()[cand.op]({}, {})
|
|
144
|
+
}
|
|
145
|
+
catch (e) { continue }
|
|
146
|
+
seen[role] = cand
|
|
147
|
+
if (null != seen.read && null != seen.write) {
|
|
148
|
+
return { read: seen.read, write: seen.write, item: await usableItem(cand.entity) }
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return undefined
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
const ITEM_ARGS = { id: 'corpus-item' }
|
|
156
|
+
|
|
157
|
+
async function usableItem(entity: string): Promise<OpRef | undefined> {
|
|
158
|
+
for (const cand of candidates(makeClient({}))) {
|
|
159
|
+
if (entity !== cand.entity || !['update', 'patch', 'remove'].includes(cand.op)) { continue }
|
|
160
|
+
try {
|
|
161
|
+
await makeClient({})[cand.accessor]()[cand.op]({ ...ITEM_ARGS }, {})
|
|
162
|
+
return cand
|
|
163
|
+
}
|
|
164
|
+
catch (e) { continue }
|
|
165
|
+
}
|
|
166
|
+
return undefined
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
// A step may wait before its call, may add request headers for its call, and
|
|
171
|
+
// may pass `args` as the operation's first argument. A `stream` step reads the
|
|
172
|
+
// operation through the entity's stream(), and `items` is how many it yields.
|
|
173
|
+
async function runStep(client: any, ref: OpRef, step: any, ctrl: any) {
|
|
174
|
+
if (null != step.wait) {
|
|
175
|
+
await new Promise((resolve) => setTimeout(resolve, step.wait))
|
|
176
|
+
}
|
|
177
|
+
const options = client._rootctx.options
|
|
178
|
+
const prior = options.headers
|
|
179
|
+
if (null != step.headers) {
|
|
180
|
+
options.headers = { ...(prior || {}), ...step.headers }
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
if (true === step.stream) {
|
|
184
|
+
let items = 0
|
|
185
|
+
for await (const _item of client[ref.accessor]().stream(ref.op, { ...(step.args || {}) }, { ctrl })) {
|
|
186
|
+
items++
|
|
187
|
+
}
|
|
188
|
+
if (null != step.items) {
|
|
189
|
+
deepStrictEqual(items, step.items, `${ref.key}: items streamed`)
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
await client[ref.accessor]()[ref.op]({ ...(step.args || {}) }, ctrl)
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
finally {
|
|
197
|
+
options.headers = prior
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// A step with `together: N` makes N overlapping calls; each call's error, or
|
|
202
|
+
// undefined, is returned.
|
|
203
|
+
async function runCalls(client: any, ref: OpRef, step: any, ctrl: any): Promise<any[]> {
|
|
204
|
+
const calls = Array.from({ length: null == step.together ? 1 : step.together },
|
|
205
|
+
() => runStep(client, ref, step, ctrl).then(() => undefined, (e: any) => e))
|
|
206
|
+
return Promise.all(calls)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
// Each request a case expects, in order: its path, and its whole query. A
|
|
211
|
+
// path is compared without its leading slash, which an SDK with no base omits.
|
|
212
|
+
function checkSent(sent: string[], expect: any[], label: string) {
|
|
213
|
+
deepStrictEqual(sent.length, expect.length, `${label}: requests sent: ${sent.join(' | ')}`)
|
|
214
|
+
expect.forEach((want: any, i: number) => {
|
|
215
|
+
const url = new URL(sent[i], 'http://corpus.invalid')
|
|
216
|
+
if (null != want.path) {
|
|
217
|
+
deepStrictEqual(url.pathname.replace(/^\/+/, ''), want.path.replace(/^\/+/, ''),
|
|
218
|
+
`${label}: request ${i} path`)
|
|
219
|
+
}
|
|
220
|
+
if (null != want.query) {
|
|
221
|
+
const query: Record<string, string> = {}
|
|
222
|
+
url.searchParams.forEach((v, k) => { query[k] = v })
|
|
223
|
+
deepStrictEqual(query, want.query, `${label}: request ${i} query`)
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
|
|
122
229
|
// Replace #OP1/#OP2 throughout a case, keys included.
|
|
123
230
|
function resolve(node: any, tokens: Record<string, string>): any {
|
|
124
231
|
if ('string' === typeof node) {
|
|
@@ -132,7 +239,9 @@ function resolve(node: any, tokens: Record<string, string>): any {
|
|
|
132
239
|
if (null != node && 'object' === typeof node) {
|
|
133
240
|
const out: any = {}
|
|
134
241
|
for (const k of Object.keys(node)) {
|
|
135
|
-
out
|
|
242
|
+
Object.defineProperty(out, resolve(k, tokens), {
|
|
243
|
+
value: resolve(node[k], tokens), enumerable: true, writable: true, configurable: true,
|
|
244
|
+
})
|
|
136
245
|
}
|
|
137
246
|
return out
|
|
138
247
|
}
|
|
@@ -140,6 +249,15 @@ function resolve(node: any, tokens: Record<string, string>): any {
|
|
|
140
249
|
}
|
|
141
250
|
|
|
142
251
|
|
|
252
|
+
// No case may write onto the shared prototypes, as a `__proto__` key can.
|
|
253
|
+
function shared(): string {
|
|
254
|
+
return [Object.prototype, Object]
|
|
255
|
+
.map((o) => Object.getOwnPropertyNames(o).sort().join(',')).join(' | ')
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const PRISTINE = shared()
|
|
259
|
+
|
|
260
|
+
|
|
143
261
|
// Which #OPn tokens a case uses. A case wanting more operations than this SDK
|
|
144
262
|
// has is skipped rather than failed.
|
|
145
263
|
function tokensUsed(kase: any): number {
|
|
@@ -168,15 +286,32 @@ function subset(actual: any, expect: any, path: string) {
|
|
|
168
286
|
}
|
|
169
287
|
return
|
|
170
288
|
}
|
|
289
|
+
if (Array.isArray(expect)) {
|
|
290
|
+
ok(Array.isArray(actual) && actual.length === expect.length,
|
|
291
|
+
`${path}: want ${expect.length} item(s), got ${JSON.stringify(actual)}`)
|
|
292
|
+
expect.forEach((e: any, i: number) => subset(actual[i], e, `${path}[${i}]`))
|
|
293
|
+
return
|
|
294
|
+
}
|
|
171
295
|
deepStrictEqual(actual, expect, path)
|
|
172
296
|
}
|
|
173
297
|
|
|
174
298
|
|
|
299
|
+
// The most requests the transport saw in any window of `ms`.
|
|
300
|
+
function busiest(sent: number[], ms: number): number {
|
|
301
|
+
let most = 0
|
|
302
|
+
for (let i = 0; i < sent.length; i++) {
|
|
303
|
+
most = Math.max(most, sent.filter((t) => sent[i] <= t && t < sent[i] + ms).length)
|
|
304
|
+
}
|
|
305
|
+
return most
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
|
|
175
309
|
describe('FeatureCorpus', () => {
|
|
176
310
|
|
|
177
311
|
let corpus: any
|
|
178
312
|
let ops: OpRef[] = []
|
|
179
313
|
let byKey: Record<string, OpRef> = {}
|
|
314
|
+
let pair: { read: OpRef, write: OpRef, item?: OpRef } | undefined
|
|
180
315
|
|
|
181
316
|
|
|
182
317
|
before(async () => {
|
|
@@ -184,6 +319,10 @@ describe('FeatureCorpus', () => {
|
|
|
184
319
|
ops = await usableOps(2)
|
|
185
320
|
byKey = {}
|
|
186
321
|
for (const o of ops) { byKey[o.key] = o }
|
|
322
|
+
pair = await usablePair()
|
|
323
|
+
for (const o of pair ? [pair.read, pair.write, pair.item] : []) {
|
|
324
|
+
if (null != o) { byKey[o.key] = o }
|
|
325
|
+
}
|
|
187
326
|
})
|
|
188
327
|
|
|
189
328
|
|
|
@@ -234,6 +373,21 @@ describe('FeatureCorpus', () => {
|
|
|
234
373
|
continue
|
|
235
374
|
}
|
|
236
375
|
|
|
376
|
+
const paired = /#(READ|WRITE|ITEM|OTHER)\b/.test(JSON.stringify(raw))
|
|
377
|
+
if (paired && null == pair) {
|
|
378
|
+
t.diagnostic(`skip "${raw.name}": needs a read and a write of one entity, this SDK offers none`)
|
|
379
|
+
continue
|
|
380
|
+
}
|
|
381
|
+
const other = null == pair ? undefined :
|
|
382
|
+
ops.find((o) => o.entity !== pair!.read.entity)
|
|
383
|
+
const needed: [string, OpRef | undefined][] = [['#ITEM', pair?.item], ['#OTHER', other]]
|
|
384
|
+
const lacking = needed
|
|
385
|
+
.find(([tok, op]) => null == op && new RegExp(tok + '\\b').test(JSON.stringify(raw)))
|
|
386
|
+
if (null != lacking) {
|
|
387
|
+
t.diagnostic(`skip "${raw.name}": needs ${lacking[0]}, which this SDK cannot drive`)
|
|
388
|
+
continue
|
|
389
|
+
}
|
|
390
|
+
|
|
237
391
|
const missing = missingFeature(probe, raw)
|
|
238
392
|
if (null != missing) {
|
|
239
393
|
t.diagnostic(`skip "${raw.name}": needs the ${missing} feature, ` +
|
|
@@ -243,36 +397,51 @@ describe('FeatureCorpus', () => {
|
|
|
243
397
|
|
|
244
398
|
const tokens: Record<string, string> = {}
|
|
245
399
|
for (let i = 0; i < need; i++) { tokens['#OP' + (i + 1)] = ops[i].key }
|
|
400
|
+
if (paired && null != pair) {
|
|
401
|
+
tokens['#READ'] = pair.read.key
|
|
402
|
+
tokens['#WRITE'] = pair.write.key
|
|
403
|
+
if (null != pair.item) { tokens['#ITEM'] = pair.item.key }
|
|
404
|
+
if (null != other) { tokens['#OTHER'] = other.key }
|
|
405
|
+
}
|
|
246
406
|
|
|
247
407
|
const kase = resolve(raw, tokens)
|
|
248
408
|
ran++
|
|
249
409
|
|
|
250
410
|
// Every failing case is reported, not only the first.
|
|
251
411
|
try {
|
|
252
|
-
const
|
|
412
|
+
const sent: string[] = []
|
|
413
|
+
const at: number[] = []
|
|
414
|
+
const client = makeClient(kase, sent, at)
|
|
253
415
|
|
|
416
|
+
// A case-level ctrl is one control object every step shares.
|
|
254
417
|
for (const step of (kase.op || [])) {
|
|
255
418
|
const ref = byKey[step.op]
|
|
256
419
|
ok(null != ref, `${kase.name}: no operation ${step.op}`)
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
continue
|
|
268
|
-
}
|
|
269
|
-
ok(undefined !== err, `${kase.name}: ${step.op} was expected to fail, and did not`)
|
|
270
|
-
if ('string' === typeof step.err) {
|
|
271
|
-
deepStrictEqual(err.code, step.err, `${kase.name}: wrong error code`)
|
|
420
|
+
for (const err of await runCalls(client, ref, step, step.ctrl || kase.ctrl || {})) {
|
|
421
|
+
if (null == step.err) {
|
|
422
|
+
ok(undefined === err,
|
|
423
|
+
`${kase.name}: ${step.op} failed unexpectedly: ${err?.message}`)
|
|
424
|
+
continue
|
|
425
|
+
}
|
|
426
|
+
ok(undefined !== err, `${kase.name}: ${step.op} was expected to fail, and did not`)
|
|
427
|
+
if ('string' === typeof step.err) {
|
|
428
|
+
deepStrictEqual(err.code, step.err, `${kase.name}: wrong error code`)
|
|
429
|
+
}
|
|
272
430
|
}
|
|
273
431
|
}
|
|
274
432
|
|
|
433
|
+
if (null != kase.pace) {
|
|
434
|
+
const most = busiest(at, kase.pace.ms)
|
|
435
|
+
ok(most <= kase.pace.max, `${kase.name}: ${most} requests within ${kase.pace.ms} ms, ` +
|
|
436
|
+
`want at most ${kase.pace.max}`)
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
if (null != kase.sent) {
|
|
440
|
+
checkSent(sent, kase.sent, kase.name)
|
|
441
|
+
}
|
|
275
442
|
subset(client[`_${name}`], kase.out, `${kase.name}: _${name}`)
|
|
443
|
+
deepStrictEqual(shared(), PRISTINE,
|
|
444
|
+
`${kase.name}: the case wrote onto Object or Object.prototype`)
|
|
276
445
|
}
|
|
277
446
|
catch (err: any) {
|
|
278
447
|
const msg = String(err?.message ?? err)
|
|
@@ -93,9 +93,8 @@ function makeClient(spec: {
|
|
|
93
93
|
|
|
94
94
|
// One clean registry per client, as makeOptions gives a real one, so a value
|
|
95
95
|
// a feature registers with cleanAdd is masked by every clean after it.
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
}).__derived__
|
|
96
|
+
const regctx: any = { utility, options: { feature: { test: { active: true } } }, config: {} }
|
|
97
|
+
const derived = (stdutil as any).makeOptions(regctx).__derived__
|
|
99
98
|
|
|
100
99
|
const client: any = {
|
|
101
100
|
_mode: spec.mode || 'test',
|
|
@@ -121,6 +120,7 @@ function makeClient(spec: {
|
|
|
121
120
|
client,
|
|
122
121
|
utility,
|
|
123
122
|
options: client._options,
|
|
123
|
+
cleancfg: regctx.cleancfg,
|
|
124
124
|
out: {},
|
|
125
125
|
ctrl: over.ctrl || {},
|
|
126
126
|
meta: {},
|
|
@@ -379,6 +379,17 @@ describe('feature', () => {
|
|
|
379
379
|
strictEqual(m.total.err, 1)
|
|
380
380
|
strictEqual(m.ops['widget.load'].count, 2)
|
|
381
381
|
})
|
|
382
|
+
|
|
383
|
+
test('the sink gets the counters once per operation', async () => {
|
|
384
|
+
const seen: any[] = []
|
|
385
|
+
const h = makeClient({ features: [
|
|
386
|
+
{ name: 'metrics', options: { sink: (m: any) => seen.push(m) } },
|
|
387
|
+
] })
|
|
388
|
+
await h.op({ op: 'load' })
|
|
389
|
+
await h.op({ op: 'list' })
|
|
390
|
+
deepStrictEqual(seen.map((m) => m.total.count), [1, 2])
|
|
391
|
+
strictEqual(seen[1].ops['widget.list'].count, 1)
|
|
392
|
+
})
|
|
382
393
|
})
|
|
383
394
|
|
|
384
395
|
|
|
@@ -732,7 +743,9 @@ describe('feature', () => {
|
|
|
732
743
|
test('default id generation and no exporter', async () => {
|
|
733
744
|
const h = makeClient({ features: [{ name: 'telemetry' }] })
|
|
734
745
|
await h.op({ op: 'load' })
|
|
735
|
-
|
|
746
|
+
const span = h.client._telemetry.spans[0]
|
|
747
|
+
ok(/^[0-9a-f]{32}$/.test(span.traceId) && !/^0+$/.test(span.traceId), span.traceId)
|
|
748
|
+
ok(/^[0-9a-f]{16}$/.test(span.spanId) && !/^0+$/.test(span.spanId), span.spanId)
|
|
736
749
|
})
|
|
737
750
|
})
|
|
738
751
|
|
|
@@ -545,7 +545,7 @@ describe('pipeline:result helpers', () => {
|
|
|
545
545
|
const secret = 'PIPELINE-SECRET-a1b2c3d4e5f6'
|
|
546
546
|
const text = 'x'.repeat(150) + secret + 'y'.repeat(100)
|
|
547
547
|
const ctx = base({
|
|
548
|
-
|
|
548
|
+
cleancfg: { active: true, keys: [], values: [], mask: '[redacted]', hint: 0, min: 4 },
|
|
549
549
|
spec: { headers: { 'user-agent': 'Probe ' + secret } },
|
|
550
550
|
response: { body: 'body', json: async () => { throw Object.assign(new SyntaxError('bad json'), { text }) } },
|
|
551
551
|
result: { status: 200, headers: { 'content-type': 'text/html' } },
|
|
@@ -39,6 +39,7 @@ pub const CtxSpec = struct {
|
|
|
39
39
|
config: ?Value = null,
|
|
40
40
|
entopts: ?Value = null,
|
|
41
41
|
options: ?Value = null,
|
|
42
|
+
cleancfg: ?Value = null,
|
|
42
43
|
entity: ?Entity = null,
|
|
43
44
|
shared: ?Value = null,
|
|
44
45
|
opmap: ?*OpMap = null,
|
|
@@ -64,6 +65,8 @@ pub const Context = struct {
|
|
|
64
65
|
config: Value,
|
|
65
66
|
entopts: Value,
|
|
66
67
|
options: Value,
|
|
68
|
+
// The clean registry, beside the options rather than in them.
|
|
69
|
+
cleancfg: Value,
|
|
67
70
|
opmap: *OpMap,
|
|
68
71
|
response: ?*Response,
|
|
69
72
|
result: ?*SdkResult,
|
|
@@ -118,6 +121,7 @@ pub const Context = struct {
|
|
|
118
121
|
const config: Value = ctxspec.config orelse (if (basectx) |b| b.config else h.vnull());
|
|
119
122
|
const entopts: Value = ctxspec.entopts orelse (if (basectx) |b| b.entopts else h.vnull());
|
|
120
123
|
const options: Value = ctxspec.options orelse (if (basectx) |b| b.options else h.vnull());
|
|
124
|
+
const cleancfg: Value = ctxspec.cleancfg orelse (if (basectx) |b| b.cleancfg else h.vnull());
|
|
121
125
|
const entity: ?Entity = ctxspec.entity orelse (if (basectx) |b| b.entity else null);
|
|
122
126
|
const shared: Value = ctxspec.shared orelse blk: {
|
|
123
127
|
if (basectx) |b| {
|
|
@@ -163,6 +167,7 @@ pub const Context = struct {
|
|
|
163
167
|
.config = config,
|
|
164
168
|
.entopts = entopts,
|
|
165
169
|
.options = options,
|
|
170
|
+
.cleancfg = cleancfg,
|
|
166
171
|
.opmap = opmap,
|
|
167
172
|
.response = response,
|
|
168
173
|
.result = result,
|