@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
|
@@ -116,34 +116,9 @@ public class TestFeature : BaseFeature
|
|
|
116
116
|
var entmap = Helpers.ToMapAny(StructUtils.GetProp(entity, op.Entity))
|
|
117
117
|
?? new Dictionary<string, object?>();
|
|
118
118
|
|
|
119
|
-
// For single-entity ops (load, remove) with an empty explicit
|
|
120
|
-
// match, fall back to the id the entity client already knows from
|
|
121
|
-
// a prior create/load (in ctx.Match / ctx.Data). Mirrors the TS
|
|
122
|
-
// mock where param() resolves the id from that accumulated state.
|
|
123
|
-
Dictionary<string, object?> ResolveMatch(Dictionary<string, object?> explicitMatch)
|
|
124
|
-
{
|
|
125
|
-
if (explicitMatch.Count > 0)
|
|
126
|
-
{
|
|
127
|
-
return explicitMatch;
|
|
128
|
-
}
|
|
129
|
-
foreach (var src in new object?[] { ctx2.Match, ctx2.Data })
|
|
130
|
-
{
|
|
131
|
-
if (src == null)
|
|
132
|
-
{
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
var v = StructUtils.GetProp(src, "id");
|
|
136
|
-
if (v != null && !Equals(v, "__UNDEFINED__"))
|
|
137
|
-
{
|
|
138
|
-
return new Dictionary<string, object?> { ["id"] = v };
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return new Dictionary<string, object?>();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
119
|
if (op.Name == "load")
|
|
145
120
|
{
|
|
146
|
-
var args = BuildArgs(ctx2, op,
|
|
121
|
+
var args = BuildArgs(ctx2, op, ctx2.Reqmatch);
|
|
147
122
|
var found = StructUtils.Select(entmap, args);
|
|
148
123
|
var ent = StructUtils.GetElem(found, 0);
|
|
149
124
|
if (ent == null)
|
|
@@ -177,30 +152,7 @@ public class TestFeature : BaseFeature
|
|
|
177
152
|
}
|
|
178
153
|
else if (op.Name == "update" || op.Name == "patch")
|
|
179
154
|
{
|
|
180
|
-
|
|
181
|
-
// Reqdata also contains the new field values, which would
|
|
182
|
-
// otherwise cause Select to filter out the entity we want to
|
|
183
|
-
// update. When reqdata has no id, fall back to the id the
|
|
184
|
-
// entity client carries from a prior create/load.
|
|
185
|
-
var updateMatch = new Dictionary<string, object?>();
|
|
186
|
-
if (ctx2.Reqdata != null)
|
|
187
|
-
{
|
|
188
|
-
if (ctx2.Reqdata.TryGetValue("id", out var idv))
|
|
189
|
-
{
|
|
190
|
-
updateMatch["id"] = idv;
|
|
191
|
-
}
|
|
192
|
-
if (op.Alias != null &&
|
|
193
|
-
StructUtils.GetProp(op.Alias, "id") is string aliasId &&
|
|
194
|
-
ctx2.Reqdata.TryGetValue(aliasId, out var av))
|
|
195
|
-
{
|
|
196
|
-
updateMatch[aliasId] = av;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
if (updateMatch.Count == 0)
|
|
200
|
-
{
|
|
201
|
-
updateMatch = ResolveMatch(new Dictionary<string, object?>());
|
|
202
|
-
}
|
|
203
|
-
var args = BuildArgs(ctx2, op, updateMatch);
|
|
155
|
+
var args = BuildArgs(ctx2, op, Record(ctx2.Reqdata));
|
|
204
156
|
var found = StructUtils.Select(entmap, args);
|
|
205
157
|
var ent = StructUtils.GetElem(found, 0);
|
|
206
158
|
if (ent == null)
|
|
@@ -221,7 +173,7 @@ public class TestFeature : BaseFeature
|
|
|
221
173
|
}
|
|
222
174
|
else if (op.Name == "remove")
|
|
223
175
|
{
|
|
224
|
-
var args = BuildArgs(ctx2, op,
|
|
176
|
+
var args = BuildArgs(ctx2, op, ctx2.Reqmatch);
|
|
225
177
|
var found = StructUtils.Select(entmap, args);
|
|
226
178
|
var ent = StructUtils.GetElem(found, 0);
|
|
227
179
|
// Remove only the first matched entity. If nothing matches,
|
|
@@ -384,6 +336,12 @@ public class TestFeature : BaseFeature
|
|
|
384
336
|
return m.Success ? m.Groups[1].Value : null;
|
|
385
337
|
}
|
|
386
338
|
|
|
339
|
+
private static bool Held(object? src, string key)
|
|
340
|
+
{
|
|
341
|
+
var v = src == null ? null : StructUtils.GetProp(src, key);
|
|
342
|
+
return v != null && !Equals(v, "__UNDEFINED__");
|
|
343
|
+
}
|
|
344
|
+
|
|
387
345
|
private static object BuildArgs(Context ctx, Operation op, Dictionary<string, object?>? args)
|
|
388
346
|
{
|
|
389
347
|
var opname = op.Name;
|
|
@@ -442,30 +400,60 @@ public class TestFeature : BaseFeature
|
|
|
442
400
|
var qand = new List<object?>();
|
|
443
401
|
var q = new Dictionary<string, object?> { ["`$AND`"] = qand };
|
|
444
402
|
|
|
445
|
-
|
|
403
|
+
var entityName = ctx.Entity!.GetName();
|
|
404
|
+
var idfrom = StructUtils.GetPath(ctx.Config, StructUtils.Jt("entity", entityName, "id", "from"));
|
|
405
|
+
|
|
406
|
+
var names = args == null ? new List<string>() : new List<string>(StructUtils.KeysOf(args));
|
|
407
|
+
|
|
408
|
+
// With no id in the call, the entity's held id (or composite parts) stands in.
|
|
409
|
+
if (args == null || StructUtils.GetProp(args, "id") == null)
|
|
410
|
+
{
|
|
411
|
+
var parts = StructUtils.GetPath(ctx.Config, StructUtils.Jt("entity", entityName, "id", "parts"))
|
|
412
|
+
as List<object?> ?? (opname == "list" ? new List<object?>() : new List<object?> { "id" });
|
|
413
|
+
foreach (var part in parts)
|
|
414
|
+
{
|
|
415
|
+
var pname = Convert.ToString(part) ?? "";
|
|
416
|
+
if (!names.Contains(pname) && (Held(ctx.Match, pname) || Held(ctx.Data, pname)))
|
|
417
|
+
{
|
|
418
|
+
names.Add(pname);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
foreach (var key in names)
|
|
446
424
|
{
|
|
447
|
-
|
|
425
|
+
var isId = key == "id";
|
|
426
|
+
var selected = StructUtils.Select(reqd, key);
|
|
427
|
+
var isReqd = !StructUtils.IsEmpty(selected);
|
|
428
|
+
|
|
429
|
+
if (isId || isReqd)
|
|
448
430
|
{
|
|
449
|
-
var
|
|
450
|
-
var
|
|
451
|
-
var isReqd = !StructUtils.IsEmpty(selected);
|
|
431
|
+
var v = ctx.Utility!.Param(ctx, key);
|
|
432
|
+
var ka = StructUtils.GetProp(op.Alias, key);
|
|
452
433
|
|
|
453
|
-
|
|
434
|
+
var qor = new List<object?>
|
|
435
|
+
{
|
|
436
|
+
new Dictionary<string, object?> { [key] = v },
|
|
437
|
+
};
|
|
438
|
+
if (ka is string kas)
|
|
454
439
|
{
|
|
455
|
-
|
|
456
|
-
|
|
440
|
+
qor.Add(new Dictionary<string, object?> { [kas] = v });
|
|
441
|
+
}
|
|
457
442
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
443
|
+
// An alternative, never a replacement: a seed keeping the
|
|
444
|
+
// parameter flat is still found.
|
|
445
|
+
if (StructUtils.GetProp(idfrom, key) is string kf && kf != key)
|
|
446
|
+
{
|
|
447
|
+
object? nest = v;
|
|
448
|
+
var segs = kf.Split('.');
|
|
449
|
+
for (var i = segs.Length - 1; 0 <= i; i--)
|
|
463
450
|
{
|
|
464
|
-
|
|
451
|
+
nest = new Dictionary<string, object?> { [segs[i]] = nest };
|
|
465
452
|
}
|
|
466
|
-
|
|
467
|
-
qand.Add(new Dictionary<string, object?> { ["`$OR`"] = qor });
|
|
453
|
+
qor.Add(nest);
|
|
468
454
|
}
|
|
455
|
+
|
|
456
|
+
qand.Add(new Dictionary<string, object?> { ["`$OR`"] = qor });
|
|
469
457
|
}
|
|
470
458
|
}
|
|
471
459
|
|
|
@@ -572,6 +572,82 @@ public class FeatureCacheTest
|
|
|
572
572
|
Assert.Equal(2, f.Bypass);
|
|
573
573
|
}
|
|
574
574
|
|
|
575
|
+
[Fact]
|
|
576
|
+
public void KeysOnRequestHeaders()
|
|
577
|
+
{
|
|
578
|
+
if (Fh.SkipWithout("cache")) return;
|
|
579
|
+
var rec = new FhRecorder();
|
|
580
|
+
var h = Fh.Make(rec.Fetch, (new CacheFeature(), new Dictionary<string, object?> { ["ttl"] = 10000 }));
|
|
581
|
+
h.Op(new FhOpSpec { Op = "load", Path = "/w/1", Headers = new() { ["x-tenant"] = "tenant-a" } });
|
|
582
|
+
h.Op(new FhOpSpec { Op = "load", Path = "/w/1", Headers = new() { ["X-Tenant"] = "tenant-b" } });
|
|
583
|
+
Assert.Equal(2, rec.Calls.Count);
|
|
584
|
+
h.Op(new FhOpSpec { Op = "load", Path = "/w/1", Headers = new() { ["x-tenant"] = "tenant-b" } });
|
|
585
|
+
Assert.Equal(2, rec.Calls.Count);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
[Fact]
|
|
589
|
+
public void AWriteDropsItsCollection()
|
|
590
|
+
{
|
|
591
|
+
if (Fh.SkipWithout("cache")) return;
|
|
592
|
+
var rec = new FhRecorder();
|
|
593
|
+
var f = new CacheFeature();
|
|
594
|
+
var h = Fh.Make(rec.Fetch, (f, new Dictionary<string, object?> { ["ttl"] = 10000 }));
|
|
595
|
+
var paths = new[] { "/w/1", "/w", "/w/1/part", "/other/1", "/w/2" };
|
|
596
|
+
foreach (var p in paths)
|
|
597
|
+
{
|
|
598
|
+
h.Op(new FhOpSpec { Op = "load", Path = p });
|
|
599
|
+
}
|
|
600
|
+
h.Op(new FhOpSpec { Op = "update", Method = "PUT", Path = "/w/1" });
|
|
601
|
+
foreach (var p in paths)
|
|
602
|
+
{
|
|
603
|
+
h.Op(new FhOpSpec { Op = "load", Path = p });
|
|
604
|
+
}
|
|
605
|
+
Assert.Equal(9, rec.Calls.Count);
|
|
606
|
+
Assert.Equal(2, f.Hit);
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
[Fact]
|
|
610
|
+
public void CacheControlPreventsStoring()
|
|
611
|
+
{
|
|
612
|
+
if (Fh.SkipWithout("cache")) return;
|
|
613
|
+
foreach (var control in new[] { "no-store", "private", "No-Cache", "max-age=60, private" })
|
|
614
|
+
{
|
|
615
|
+
var rec = new FhRecorder
|
|
616
|
+
{
|
|
617
|
+
Reply = (_, _) => Fh.Response(200, new Dictionary<string, object?> { ["ok"] = true },
|
|
618
|
+
new Dictionary<string, object?> { ["Cache-Control"] = control }),
|
|
619
|
+
};
|
|
620
|
+
var h = Fh.Make(rec.Fetch, (new CacheFeature(), new Dictionary<string, object?> { ["ttl"] = 10000 }));
|
|
621
|
+
h.Op(new FhOpSpec { Op = "load", Path = "/w" });
|
|
622
|
+
h.Op(new FhOpSpec { Op = "load", Path = "/w" });
|
|
623
|
+
Assert.True(2 == rec.Calls.Count, control + " was stored");
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
[Fact]
|
|
628
|
+
public void MaxAgeCapsTheTtl()
|
|
629
|
+
{
|
|
630
|
+
if (Fh.SkipWithout("cache")) return;
|
|
631
|
+
var clock = new FhClock();
|
|
632
|
+
var rec = new FhRecorder
|
|
633
|
+
{
|
|
634
|
+
Reply = (_, _) => Fh.Response(200, new Dictionary<string, object?> { ["ok"] = true },
|
|
635
|
+
new Dictionary<string, object?> { ["cache-control"] = "max-age=1" }),
|
|
636
|
+
};
|
|
637
|
+
var h = Fh.Make(rec.Fetch, (new CacheFeature(), new Dictionary<string, object?>
|
|
638
|
+
{
|
|
639
|
+
["ttl"] = 10000,
|
|
640
|
+
["now"] = (Func<long>)clock.Now,
|
|
641
|
+
}));
|
|
642
|
+
h.Op(new FhOpSpec { Op = "load", Path = "/w" });
|
|
643
|
+
clock.Advance(500);
|
|
644
|
+
h.Op(new FhOpSpec { Op = "load", Path = "/w" });
|
|
645
|
+
Assert.Single(rec.Calls);
|
|
646
|
+
clock.Advance(600);
|
|
647
|
+
h.Op(new FhOpSpec { Op = "load", Path = "/w" });
|
|
648
|
+
Assert.Equal(2, rec.Calls.Count);
|
|
649
|
+
}
|
|
650
|
+
|
|
575
651
|
[Fact]
|
|
576
652
|
public void InactiveDoesNotWrap()
|
|
577
653
|
{
|
|
@@ -1170,6 +1246,136 @@ public class FeaturePagingTest
|
|
|
1170
1246
|
Assert.Equal(true, res.Result.Paging["hasMore"]);
|
|
1171
1247
|
}
|
|
1172
1248
|
|
|
1249
|
+
// The documented hasMore loop, one request per page.
|
|
1250
|
+
private static List<string> Walk(Func<int, Dictionary<string, object?>> reply,
|
|
1251
|
+
out Dictionary<string, object?> paging, Dictionary<string, object?>? options = null)
|
|
1252
|
+
{
|
|
1253
|
+
var rec = new FhRecorder { Reply = (n, _) => reply(n) };
|
|
1254
|
+
var h = Fh.Make(rec.Fetch, (new PagingFeature(), options));
|
|
1255
|
+
paging = new Dictionary<string, object?>();
|
|
1256
|
+
var ctrl = new Dictionary<string, object?> { ["paging"] = paging };
|
|
1257
|
+
h.Op(new FhOpSpec { Op = "list", Path = "/w", Ctrl = ctrl });
|
|
1258
|
+
while (true.Equals(paging["hasMore"]) && rec.Calls.Count < 4)
|
|
1259
|
+
{
|
|
1260
|
+
h.Op(new FhOpSpec { Op = "list", Path = "/w", Ctrl = ctrl });
|
|
1261
|
+
}
|
|
1262
|
+
return Enumerable.Range(0, rec.Calls.Count).Select(rec.Url).ToList();
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
[Fact]
|
|
1266
|
+
public void BodyNextIsSentAsTheCursor()
|
|
1267
|
+
{
|
|
1268
|
+
if (Fh.SkipWithout("paging")) return;
|
|
1269
|
+
var pages = new object?[] { "c3", "c6", null };
|
|
1270
|
+
var urls = Walk(n => Fh.Response(200, new Dictionary<string, object?>
|
|
1271
|
+
{
|
|
1272
|
+
["next"] = pages[n - 1],
|
|
1273
|
+
}, null), out var paging);
|
|
1274
|
+
Assert.Equal(new List<string>
|
|
1275
|
+
{
|
|
1276
|
+
"http://api.test/w?page=1",
|
|
1277
|
+
"http://api.test/w?cursor=c3",
|
|
1278
|
+
"http://api.test/w?cursor=c6",
|
|
1279
|
+
}, urls);
|
|
1280
|
+
Assert.Equal(false, paging["hasMore"]);
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
[Fact]
|
|
1284
|
+
public void BodyNextUrlIsTheNextRequest()
|
|
1285
|
+
{
|
|
1286
|
+
if (Fh.SkipWithout("paging")) return;
|
|
1287
|
+
var pages = new object?[]
|
|
1288
|
+
{
|
|
1289
|
+
"http://api.test/v2/w?cursor=c%2F3&limit=3", "/v2/w?cursor=c6", null,
|
|
1290
|
+
};
|
|
1291
|
+
var urls = Walk(n => Fh.Response(200, new Dictionary<string, object?>
|
|
1292
|
+
{
|
|
1293
|
+
["next"] = pages[n - 1],
|
|
1294
|
+
}, null), out var paging);
|
|
1295
|
+
Assert.Equal(new List<string>
|
|
1296
|
+
{
|
|
1297
|
+
"http://api.test/w?page=1",
|
|
1298
|
+
"http://api.test/v2/w?cursor=c%2F3&limit=3",
|
|
1299
|
+
"http://api.test/v2/w?cursor=c6",
|
|
1300
|
+
}, urls);
|
|
1301
|
+
Assert.Equal(false, paging["hasMore"]);
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
[Fact]
|
|
1305
|
+
public void LinkNextUrlIsTheNextRequest()
|
|
1306
|
+
{
|
|
1307
|
+
if (Fh.SkipWithout("paging")) return;
|
|
1308
|
+
var links = new[] { "<http://api.test/w?after=b3>; rel=\"next\"", "</w?after=b6>; rel=\"next\"" };
|
|
1309
|
+
var urls = Walk(n => Fh.Response(200, new List<object?>(),
|
|
1310
|
+
n <= links.Length ? new Dictionary<string, object?> { ["link"] = links[n - 1] } : null),
|
|
1311
|
+
out var paging);
|
|
1312
|
+
Assert.Equal(new List<string>
|
|
1313
|
+
{
|
|
1314
|
+
"http://api.test/w?page=1",
|
|
1315
|
+
"http://api.test/w?after=b3",
|
|
1316
|
+
"http://api.test/w?after=b6",
|
|
1317
|
+
}, urls);
|
|
1318
|
+
Assert.Equal(false, paging["hasMore"]);
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
[Fact]
|
|
1322
|
+
public void QueryOnlyLinkKeepsThePath()
|
|
1323
|
+
{
|
|
1324
|
+
if (Fh.SkipWithout("paging")) return;
|
|
1325
|
+
var links = new[] { "</v1/items?page=2>; rel=\"next\"", "<?page=3>; rel=\"next\"" };
|
|
1326
|
+
var urls = Walk(n => Fh.Response(200, new List<object?>(),
|
|
1327
|
+
n <= links.Length ? new Dictionary<string, object?> { ["link"] = links[n - 1] } : null),
|
|
1328
|
+
out _);
|
|
1329
|
+
Assert.Equal(new List<string>
|
|
1330
|
+
{
|
|
1331
|
+
"http://api.test/w?page=1",
|
|
1332
|
+
"http://api.test/v1/items?page=2",
|
|
1333
|
+
"http://api.test/v1/items?page=3",
|
|
1334
|
+
}, urls);
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
[Fact]
|
|
1338
|
+
public void PathRelativeLinkResolvesAgainstTheRequest()
|
|
1339
|
+
{
|
|
1340
|
+
if (Fh.SkipWithout("paging")) return;
|
|
1341
|
+
var links = new[] { "</v1/items?page=2>; rel=\"next\"", "<more?page=3>; rel=\"next\"" };
|
|
1342
|
+
var urls = Walk(n => Fh.Response(200, new List<object?>(),
|
|
1343
|
+
n <= links.Length ? new Dictionary<string, object?> { ["link"] = links[n - 1] } : null),
|
|
1344
|
+
out _);
|
|
1345
|
+
Assert.Equal(new List<string>
|
|
1346
|
+
{
|
|
1347
|
+
"http://api.test/w?page=1",
|
|
1348
|
+
"http://api.test/v1/items?page=2",
|
|
1349
|
+
"http://api.test/v1/more?page=3",
|
|
1350
|
+
}, urls);
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
[Fact]
|
|
1354
|
+
public void ForeignLinkEndsTheWalk()
|
|
1355
|
+
{
|
|
1356
|
+
if (Fh.SkipWithout("paging")) return;
|
|
1357
|
+
var urls = Walk(n => Fh.Response(200, new List<object?>(), new Dictionary<string, object?>
|
|
1358
|
+
{
|
|
1359
|
+
["link"] = "<https://elsewhere.test/w?after=b3>; rel=\"next\"",
|
|
1360
|
+
}), out var paging);
|
|
1361
|
+
Assert.Equal(new List<string> { "http://api.test/w?page=1" }, urls);
|
|
1362
|
+
Assert.Equal(false, paging["hasMore"]);
|
|
1363
|
+
Assert.Equal("https://elsewhere.test/w?after=b3", paging["foreign"]);
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
[Fact]
|
|
1367
|
+
public void CursorModeSendsASlashCursor()
|
|
1368
|
+
{
|
|
1369
|
+
if (Fh.SkipWithout("paging")) return;
|
|
1370
|
+
var pages = new object?[] { "/c3", null };
|
|
1371
|
+
var urls = Walk(n => Fh.Response(200, new Dictionary<string, object?>
|
|
1372
|
+
{
|
|
1373
|
+
["next"] = pages[n - 1],
|
|
1374
|
+
}, null), out var paging, new Dictionary<string, object?> { ["next"] = "cursor" });
|
|
1375
|
+
Assert.Equal(new List<string> { "http://api.test/w?page=1", "http://api.test/w?cursor=%2Fc3" }, urls);
|
|
1376
|
+
Assert.Equal(false, paging["hasMore"]);
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1173
1379
|
[Fact]
|
|
1174
1380
|
public void NonListNotPaged()
|
|
1175
1381
|
{
|
|
@@ -1242,6 +1448,38 @@ public class FeatureStreamingTest
|
|
|
1242
1448
|
"expected chunked batches");
|
|
1243
1449
|
}
|
|
1244
1450
|
|
|
1451
|
+
[Fact]
|
|
1452
|
+
public void FailedResultIsNotStreamed()
|
|
1453
|
+
{
|
|
1454
|
+
if (Fh.SkipWithout("streaming")) return;
|
|
1455
|
+
var rec = new FhRecorder
|
|
1456
|
+
{
|
|
1457
|
+
Reply = (_, _) =>
|
|
1458
|
+
{
|
|
1459
|
+
var res = Fh.Response(200, new List<object?>(), null);
|
|
1460
|
+
res["err"] = new Exception("terminated");
|
|
1461
|
+
return res;
|
|
1462
|
+
},
|
|
1463
|
+
};
|
|
1464
|
+
var f = new StreamingFeature();
|
|
1465
|
+
var h = Fh.Make(rec.Fetch, (f, null));
|
|
1466
|
+
var res = h.Op(new FhOpSpec { Op = "list", Path = "/w" });
|
|
1467
|
+
Assert.False(res.Ok);
|
|
1468
|
+
Assert.False(res.Result!.Streaming || res.Result.Stream != null,
|
|
1469
|
+
"a failed result must keep no stream");
|
|
1470
|
+
Assert.Equal(0, f.Opened);
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
[Fact]
|
|
1474
|
+
public void EmptyListStreamsNothing()
|
|
1475
|
+
{
|
|
1476
|
+
if (Fh.SkipWithout("streaming")) return;
|
|
1477
|
+
var rec = new FhRecorder { Reply = (_, _) => Fh.Response(200, new List<object?>(), null) };
|
|
1478
|
+
var h = Fh.Make(rec.Fetch, (new StreamingFeature(), null));
|
|
1479
|
+
var res = h.Op(new FhOpSpec { Op = "list", Path = "/w" });
|
|
1480
|
+
Assert.Empty(res.Result!.Stream!().ToList());
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1245
1483
|
[Fact]
|
|
1246
1484
|
public void NonListNotStreamed()
|
|
1247
1485
|
{
|
|
@@ -13,10 +13,9 @@ using Voxgig.Struct;
|
|
|
13
13
|
|
|
14
14
|
namespace ProjectNameSdk.Util;
|
|
15
15
|
|
|
16
|
-
// The
|
|
16
|
+
// The clean registry, MUTABLE after MakeOptions since features register
|
|
17
17
|
// values later. Fields rather than properties: System.Text.Json serialises
|
|
18
|
-
// properties, so a JSON of
|
|
19
|
-
// registry it holds.
|
|
18
|
+
// properties, so a JSON of a context never shows the registry it holds.
|
|
20
19
|
public sealed class CleanConfig
|
|
21
20
|
{
|
|
22
21
|
public bool Active = true;
|
|
@@ -119,15 +118,11 @@ public static partial class SdkUtility
|
|
|
119
118
|
};
|
|
120
119
|
}
|
|
121
120
|
|
|
122
|
-
// A context without
|
|
123
|
-
// the schema defaults.
|
|
121
|
+
// A context without a registry (MakeError accepts a bare one) still masks
|
|
122
|
+
// by the schema defaults.
|
|
124
123
|
internal static CleanConfig CleanConfigOf(Context? ctx)
|
|
125
124
|
{
|
|
126
|
-
if (ctx?.
|
|
127
|
-
ctx.Options.TryGetValue("__derived__", out var draw) &&
|
|
128
|
-
draw is Dictionary<string, object?> derived &&
|
|
129
|
-
derived.TryGetValue("clean", out var craw) &&
|
|
130
|
-
craw is CleanConfig cfg)
|
|
125
|
+
if (ctx?.CleanCfg is CleanConfig cfg)
|
|
131
126
|
{
|
|
132
127
|
return cfg;
|
|
133
128
|
}
|
|
@@ -239,7 +239,13 @@ public static partial class SdkUtility
|
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
|
|
242
|
+
// A bound in milliseconds, for a caller beneath the timeout feature.
|
|
243
|
+
using var bound = new System.Threading.CancellationTokenSource();
|
|
244
|
+
if (Helpers.ToInt(fetchdef.GetValueOrDefault("timeout")) is var ms && 0 < ms)
|
|
245
|
+
{
|
|
246
|
+
bound.CancelAfter(ms);
|
|
247
|
+
}
|
|
248
|
+
using var resp = ClientFor(fetchdef).Send(req, HttpCompletionOption.ResponseContentRead, bound.Token);
|
|
243
249
|
|
|
244
250
|
var bodyText = resp.Content.ReadAsStringAsync().GetAwaiter().GetResult();
|
|
245
251
|
|
|
@@ -154,13 +154,7 @@ public static partial class SdkUtility
|
|
|
154
154
|
cleanlayers.Add(cleanraw);
|
|
155
155
|
}
|
|
156
156
|
var cleancfg = MakeCleanConfig(StructUtils.Merge(cleanlayers));
|
|
157
|
-
var cleanctx = new Context(new Dictionary<string, object?>
|
|
158
|
-
{
|
|
159
|
-
["options"] = new Dictionary<string, object?>
|
|
160
|
-
{
|
|
161
|
-
["__derived__"] = new Dictionary<string, object?> { ["clean"] = cleancfg },
|
|
162
|
-
},
|
|
163
|
-
}, null);
|
|
157
|
+
var cleanctx = new Context(new Dictionary<string, object?> { ["cleancfg"] = cleancfg }, null);
|
|
164
158
|
CleanAddOptions(cleanctx, opts, "clean");
|
|
165
159
|
foreach (var raw in CleanSplitValues(
|
|
166
160
|
StructUtils.GetPath(cfgopts, StructUtils.Jt("clean", "values")))
|
|
@@ -194,6 +188,13 @@ public static partial class SdkUtility
|
|
|
194
188
|
opts["feature"] = fmap;
|
|
195
189
|
}
|
|
196
190
|
|
|
191
|
+
var fdefaults = FeatureDefaults(StructUtils.GetProp(config, "feature"),
|
|
192
|
+
StructUtils.GetProp(opts, "feature"));
|
|
193
|
+
if (fdefaults != null)
|
|
194
|
+
{
|
|
195
|
+
opts["feature"] = fdefaults;
|
|
196
|
+
}
|
|
197
|
+
|
|
197
198
|
// THE OPTION SPEC IS GENERATED, NOT WRITTEN HERE.
|
|
198
199
|
//
|
|
199
200
|
// Built from the model: `main.kit.optspec` for the standard options,
|
|
@@ -225,6 +226,7 @@ public static partial class SdkUtility
|
|
|
225
226
|
object? validated;
|
|
226
227
|
try
|
|
227
228
|
{
|
|
229
|
+
RefuseStrayKeys(merged, optspec);
|
|
228
230
|
validated = StructUtils.Validate(merged, optspec);
|
|
229
231
|
}
|
|
230
232
|
catch (Exception verr)
|
|
@@ -310,23 +312,23 @@ public static partial class SdkUtility
|
|
|
310
312
|
}
|
|
311
313
|
}
|
|
312
314
|
|
|
313
|
-
// Resolve the feature add-order: an explicit list order (above) wins
|
|
314
|
-
//
|
|
315
|
-
//
|
|
316
|
-
// transport.
|
|
317
|
-
if (featureorder.Count == 0)
|
|
315
|
+
// Resolve the feature add-order: an explicit list order (above) wins, and
|
|
316
|
+
// the names it leaves out follow it test-first, then sorted, so the
|
|
317
|
+
// outcome is deterministic and `test` is the base transport of a map.
|
|
318
318
|
{
|
|
319
319
|
var fmap = Helpers.ToMapAny(StructUtils.GetProp(opts, "feature"))
|
|
320
320
|
?? new Dictionary<string, object?>();
|
|
321
|
-
var names = fmap.Keys.
|
|
321
|
+
var names = fmap.Keys.Where(k => !featureorder.Contains(k))
|
|
322
|
+
.OrderBy(k => k, StringComparer.Ordinal).ToList();
|
|
323
|
+
var rest = new List<object?>();
|
|
322
324
|
if (names.Contains("test"))
|
|
323
325
|
{
|
|
324
|
-
|
|
326
|
+
rest.Add("test");
|
|
325
327
|
foreach (var n in names)
|
|
326
328
|
{
|
|
327
329
|
if (n != "test")
|
|
328
330
|
{
|
|
329
|
-
|
|
331
|
+
rest.Add(n);
|
|
330
332
|
}
|
|
331
333
|
}
|
|
332
334
|
}
|
|
@@ -334,7 +336,7 @@ public static partial class SdkUtility
|
|
|
334
336
|
{
|
|
335
337
|
foreach (var n in names)
|
|
336
338
|
{
|
|
337
|
-
|
|
339
|
+
rest.Add(n);
|
|
338
340
|
}
|
|
339
341
|
}
|
|
340
342
|
|
|
@@ -344,19 +346,19 @@ public static partial class SdkUtility
|
|
|
344
346
|
// test - or first, when no test entry exists. Without this the
|
|
345
347
|
// sorted default would init station last and wrap OUTSIDE the
|
|
346
348
|
// recording features, turning its wire-truth events into fiction.
|
|
347
|
-
var si =
|
|
349
|
+
var si = rest.IndexOf("station");
|
|
348
350
|
if (si >= 0)
|
|
349
351
|
{
|
|
350
|
-
|
|
351
|
-
|
|
352
|
+
rest.RemoveAt(si);
|
|
353
|
+
rest.Insert(rest.IndexOf("test") + 1, "station");
|
|
352
354
|
}
|
|
355
|
+
featureorder.AddRange(rest);
|
|
353
356
|
}
|
|
354
357
|
|
|
355
|
-
opts["__derived__"] = new Dictionary<string, object?>
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
};
|
|
358
|
+
opts["__derived__"] = new Dictionary<string, object?> { ["featureorder"] = featureorder };
|
|
359
|
+
|
|
360
|
+
// Beside the options, not in them: OptionsMap hands them to callers.
|
|
361
|
+
ctx.CleanCfg = cleancfg;
|
|
360
362
|
|
|
361
363
|
// Again over the merged result: the config's own defaults can carry one.
|
|
362
364
|
CleanAddOptions(cleanctx, opts, "clean", "__derived__");
|
|
@@ -364,10 +366,78 @@ public static partial class SdkUtility
|
|
|
364
366
|
return opts;
|
|
365
367
|
}
|
|
366
368
|
|
|
369
|
+
// Before validate: the struct's own refusal prints the value without its
|
|
370
|
+
// functions, so a misspelled callback key would go unnamed.
|
|
371
|
+
private static void RefuseStrayKeys(object? opts, Dictionary<string, object?> optspec)
|
|
372
|
+
{
|
|
373
|
+
var fspecs = optspec.TryGetValue("feature", out var fs) ? fs as Dictionary<string, object?> : null;
|
|
374
|
+
var feature = (opts as Dictionary<string, object?>)?.GetValueOrDefault("feature") as Dictionary<string, object?>;
|
|
375
|
+
if (fspecs == null || feature == null)
|
|
376
|
+
{
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
foreach (var (name, fopts) in feature)
|
|
380
|
+
{
|
|
381
|
+
var spec = SpecMap(fspecs.GetValueOrDefault(name));
|
|
382
|
+
if (spec == null || spec.ContainsKey("`$OPEN`") || fopts is not Dictionary<string, object?> fm)
|
|
383
|
+
{
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
var stray = fm.Keys.Where(k => !spec.ContainsKey(k)).ToList();
|
|
387
|
+
if (0 < stray.Count)
|
|
388
|
+
{
|
|
389
|
+
throw new Exception("Unexpected keys at field feature." + name + ": " + string.Join(", ", stray));
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
private static Dictionary<string, object?>? SpecMap(object? spec)
|
|
395
|
+
{
|
|
396
|
+
if (spec is List<object?> alts)
|
|
397
|
+
{
|
|
398
|
+
var from = 0 < alts.Count && "`$NOF`".Equals(alts[0]) ? 2 : 0;
|
|
399
|
+
return alts.Skip(from).OfType<Dictionary<string, object?>>().FirstOrDefault();
|
|
400
|
+
}
|
|
401
|
+
return spec as Dictionary<string, object?>;
|
|
402
|
+
}
|
|
403
|
+
|
|
367
404
|
// A feature's name is not a field name: a feature called `secrets` does
|
|
368
405
|
// not make every one of its options a secret. Entity blocks (entity
|
|
369
406
|
// settings, seeded records) hold no credential, and nor do rbac's rules,
|
|
370
407
|
// keyed by entity and operation names.
|
|
408
|
+
// The model's options for a feature sit beneath the caller's, key by key: a
|
|
409
|
+
// key the caller sets replaces the default whole, so a list is never merged.
|
|
410
|
+
private static Dictionary<string, object?>? FeatureDefaults(object? cfgfeature, object? feature)
|
|
411
|
+
{
|
|
412
|
+
if (feature != null && feature is not Dictionary<string, object?>)
|
|
413
|
+
{
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
var output = feature is Dictionary<string, object?> fm
|
|
417
|
+
? new Dictionary<string, object?>(fm) : new Dictionary<string, object?>();
|
|
418
|
+
foreach (var kv in Helpers.ToMapAny(cfgfeature) ?? new Dictionary<string, object?>())
|
|
419
|
+
{
|
|
420
|
+
var dflt = Helpers.ToMapAny(StructUtils.GetProp(Helpers.ToMapAny(kv.Value), "options"));
|
|
421
|
+
output.TryGetValue(kv.Key, out var given);
|
|
422
|
+
if (dflt == null || (given == null && !true.Equals(StructUtils.GetProp(dflt, "active"))) ||
|
|
423
|
+
(given != null && given is not Dictionary<string, object?>))
|
|
424
|
+
{
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
var merged = new Dictionary<string, object?>(
|
|
428
|
+
Helpers.ToMapAny(StructUtils.Clone(dflt)) ?? new Dictionary<string, object?>());
|
|
429
|
+
if (given is Dictionary<string, object?> gm)
|
|
430
|
+
{
|
|
431
|
+
foreach (var g in gm)
|
|
432
|
+
{
|
|
433
|
+
merged[g.Key] = g.Value;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
output[kv.Key] = merged;
|
|
437
|
+
}
|
|
438
|
+
return output;
|
|
439
|
+
}
|
|
440
|
+
|
|
371
441
|
private static void CleanAddOptions(Context cleanctx, Dictionary<string, object?> opts,
|
|
372
442
|
params string[] omit)
|
|
373
443
|
{
|
|
@@ -94,6 +94,8 @@ defmodule ProjectName.Context do
|
|
|
94
94
|
S.setprop(ctx, "config", inh_map.("config"))
|
|
95
95
|
S.setprop(ctx, "entopts", inh_map.("entopts"))
|
|
96
96
|
S.setprop(ctx, "options", inh_map.("options"))
|
|
97
|
+
# The clean registry, beside the options rather than in them.
|
|
98
|
+
S.setprop(ctx, "cleancfg", inh_map.("cleancfg"))
|
|
97
99
|
S.setprop(ctx, "entity", inh.("entity"))
|
|
98
100
|
S.setprop(ctx, "shared", inh_map.("shared"))
|
|
99
101
|
|