@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
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
package JAVAPACKAGE.feature;
|
|
2
2
|
|
|
3
|
+
import java.net.URLDecoder;
|
|
4
|
+
import java.nio.charset.StandardCharsets;
|
|
3
5
|
import java.util.LinkedHashMap;
|
|
4
6
|
import java.util.LinkedHashSet;
|
|
5
7
|
import java.util.List;
|
|
@@ -81,6 +83,10 @@ public class PagingFeature extends BaseFeature {
|
|
|
81
83
|
if (cursor != null) {
|
|
82
84
|
spec.query.put(cursorParam, cursor);
|
|
83
85
|
}
|
|
86
|
+
else if (paging.get("next") instanceof String
|
|
87
|
+
&& !foreign((String) paging.get("next"), spec.base)) {
|
|
88
|
+
follow(spec, (String) paging.get("next"));
|
|
89
|
+
}
|
|
84
90
|
else if (spec.query.get(pageParam) == null) {
|
|
85
91
|
// A record written back by preResult holds the page just fetched as
|
|
86
92
|
// "page" and the one to fetch as "nextPage", so nextPage wins.
|
|
@@ -214,8 +220,13 @@ public class PagingFeature extends BaseFeature {
|
|
|
214
220
|
// Body-level signals; snake_case forms are read first so camelCase wins.
|
|
215
221
|
if (body instanceof Map) {
|
|
216
222
|
Map<String, Object> bm = (Map<String, Object>) body;
|
|
217
|
-
if (bm.get("next") != null
|
|
218
|
-
|
|
223
|
+
if (bm.get("next") != null) {
|
|
224
|
+
if (!isLink(bm.get("next"), FeatureOptions.foptStr(this.options, "next", "auto"))) {
|
|
225
|
+
paging.put("cursor", bm.get("next"));
|
|
226
|
+
}
|
|
227
|
+
else if (paging.get("next") == null) {
|
|
228
|
+
paging.put("next", bm.get("next"));
|
|
229
|
+
}
|
|
219
230
|
}
|
|
220
231
|
if (bm.get("next_cursor") != null) {
|
|
221
232
|
paging.put("cursor", bm.get("next_cursor"));
|
|
@@ -248,6 +259,17 @@ public class PagingFeature extends BaseFeature {
|
|
|
248
259
|
}
|
|
249
260
|
}
|
|
250
261
|
|
|
262
|
+
// A link to another origin is recorded, never followed, and ends the walk.
|
|
263
|
+
String base = ctx.spec != null ? ctx.spec.base
|
|
264
|
+
: ctx.options != null && ctx.options.get("base") instanceof String
|
|
265
|
+
? (String) ctx.options.get("base") : "";
|
|
266
|
+
if (paging.get("next") instanceof String && ctx.spec != null) {
|
|
267
|
+
paging.put("next", resolve((String) paging.get("next"), ctx.spec.url));
|
|
268
|
+
}
|
|
269
|
+
if (paging.get("next") instanceof String && foreign((String) paging.get("next"), base)) {
|
|
270
|
+
paging.put("foreign", paging.remove("next"));
|
|
271
|
+
}
|
|
272
|
+
|
|
251
273
|
// Cursor presence only INFERS another page. When the server stated the
|
|
252
274
|
// answer outright — relay's `hasNextPage: false`, or a body `hasMore` —
|
|
253
275
|
// that wins: a final page normally carries both an end cursor and
|
|
@@ -259,6 +281,11 @@ public class PagingFeature extends BaseFeature {
|
|
|
259
281
|
paging.put("hasMore", true);
|
|
260
282
|
}
|
|
261
283
|
|
|
284
|
+
if (paging.get("foreign") != null && paging.get("cursor") == null
|
|
285
|
+
&& paging.get("nextPage") == null) {
|
|
286
|
+
paging.put("hasMore", false);
|
|
287
|
+
}
|
|
288
|
+
|
|
262
289
|
result.paging = paging;
|
|
263
290
|
this.last = paging;
|
|
264
291
|
|
|
@@ -281,6 +308,133 @@ public class PagingFeature extends BaseFeature {
|
|
|
281
308
|
}
|
|
282
309
|
}
|
|
283
310
|
|
|
311
|
+
private static final Pattern ORIGIN =
|
|
312
|
+
Pattern.compile("^[a-z][a-z0-9+.-]*://[^/?#]*", Pattern.CASE_INSENSITIVE);
|
|
313
|
+
|
|
314
|
+
// Under the `next` option's default, a URL or an absolute path is a link
|
|
315
|
+
// and anything else a cursor; `cursor` and `url` pin the reading.
|
|
316
|
+
static boolean isLink(Object next, String mode) {
|
|
317
|
+
if (!(next instanceof String)) {
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
return "url".equals(mode) || (!"cursor".equals(mode)
|
|
321
|
+
&& (ORIGIN.matcher((String) next).find() || ((String) next).startsWith("/")));
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
static String origin(String text) {
|
|
325
|
+
Matcher m = ORIGIN.matcher(text == null ? "" : text);
|
|
326
|
+
return m.find() ? m.group().toLowerCase(java.util.Locale.ROOT) : "";
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
static boolean foreign(String link, String base) {
|
|
330
|
+
String origin = origin(link);
|
|
331
|
+
return !origin.isEmpty() && !origin.equals(origin(base));
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
private static final Pattern SCHEME =
|
|
335
|
+
Pattern.compile("^[a-z][a-z0-9+.-]*:", Pattern.CASE_INSENSITIVE);
|
|
336
|
+
|
|
337
|
+
// RFC 3986 reference resolution against the URL of the request that
|
|
338
|
+
// returned the link, by hand: java.net.URI resolves a query-only reference
|
|
339
|
+
// by RFC 2396 and drops the last path segment. A link on that URL's origin
|
|
340
|
+
// comes back as its path and query; an absolute link is left as it is.
|
|
341
|
+
static String resolve(String link, String url) {
|
|
342
|
+
if (url == null || url.isEmpty() || SCHEME.matcher(link).find()) {
|
|
343
|
+
return link;
|
|
344
|
+
}
|
|
345
|
+
link = link.split("#", 2)[0];
|
|
346
|
+
Matcher om = ORIGIN.matcher(url);
|
|
347
|
+
String origin = om.find() ? om.group() : "";
|
|
348
|
+
if (link.startsWith("//")) {
|
|
349
|
+
return origin.isEmpty() ? link : origin.split(":", 2)[0] + ":" + link;
|
|
350
|
+
}
|
|
351
|
+
String[] from = url.substring(origin.length()).split("#", 2)[0].split("\\?", 2);
|
|
352
|
+
String[] ref = link.split("\\?", 2);
|
|
353
|
+
String path;
|
|
354
|
+
String query;
|
|
355
|
+
if (ref[0].isEmpty()) {
|
|
356
|
+
path = from[0];
|
|
357
|
+
query = link.contains("?") ? (ref.length > 1 ? ref[1] : "") : (from.length > 1 ? from[1] : null);
|
|
358
|
+
} else {
|
|
359
|
+
query = link.contains("?") ? (ref.length > 1 ? ref[1] : "") : null;
|
|
360
|
+
String merged = ref[0];
|
|
361
|
+
if (!merged.startsWith("/")) {
|
|
362
|
+
int k = from[0].lastIndexOf('/');
|
|
363
|
+
merged = (k < 0 ? "" : from[0].substring(0, k + 1)) + merged;
|
|
364
|
+
}
|
|
365
|
+
path = removeDots(merged);
|
|
366
|
+
}
|
|
367
|
+
if (!path.startsWith("/")) {
|
|
368
|
+
path = "/" + path;
|
|
369
|
+
}
|
|
370
|
+
return query == null ? path : path + "?" + query;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// RFC 3986 section 5.2.4.
|
|
374
|
+
static String removeDots(String path) {
|
|
375
|
+
boolean abs = path.startsWith("/");
|
|
376
|
+
String[] segs = path.split("/", -1);
|
|
377
|
+
java.util.ArrayList<String> out = new java.util.ArrayList<>();
|
|
378
|
+
for (int i = abs ? 1 : 0; i < segs.length; i++) {
|
|
379
|
+
String seg = segs[i];
|
|
380
|
+
if (".".equals(seg) || "..".equals(seg)) {
|
|
381
|
+
if ("..".equals(seg) && !out.isEmpty()) {
|
|
382
|
+
out.remove(out.size() - 1);
|
|
383
|
+
}
|
|
384
|
+
if (i == segs.length - 1) {
|
|
385
|
+
out.add("");
|
|
386
|
+
}
|
|
387
|
+
} else {
|
|
388
|
+
out.add(seg);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
return (abs ? "/" : "") + String.join("/", out);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// The request goes to the link's path and query, on the SDK's own origin.
|
|
395
|
+
static void follow(Spec spec, String next) {
|
|
396
|
+
String rest = ORIGIN.matcher(next).replaceFirst("");
|
|
397
|
+
int hash = rest.indexOf('#');
|
|
398
|
+
if (hash >= 0) {
|
|
399
|
+
rest = rest.substring(0, hash);
|
|
400
|
+
}
|
|
401
|
+
int mark = rest.indexOf('?');
|
|
402
|
+
String path = mark < 0 ? rest : rest.substring(0, mark);
|
|
403
|
+
String rawquery = mark < 0 ? "" : rest.substring(mark + 1);
|
|
404
|
+
|
|
405
|
+
Map<String, Object> query = new LinkedHashMap<>();
|
|
406
|
+
for (String pair : rawquery.split("&")) {
|
|
407
|
+
if (pair.isEmpty()) {
|
|
408
|
+
continue;
|
|
409
|
+
}
|
|
410
|
+
int eq = pair.indexOf('=');
|
|
411
|
+
String key = eq < 0 ? pair : pair.substring(0, eq);
|
|
412
|
+
String val = eq < 0 ? "" : pair.substring(eq + 1);
|
|
413
|
+
query.put(unescape(key), unescape(val));
|
|
414
|
+
}
|
|
415
|
+
if (spec.authquery != null) {
|
|
416
|
+
for (String key : spec.authquery) {
|
|
417
|
+
query.put(key, spec.query.get(key));
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
Matcher origin = ORIGIN.matcher(spec.base == null ? "" : spec.base);
|
|
422
|
+
spec.base = origin.find() ? origin.group() : "";
|
|
423
|
+
spec.prefix = "";
|
|
424
|
+
spec.path = path;
|
|
425
|
+
spec.suffix = "";
|
|
426
|
+
spec.query = query;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
private static String unescape(String text) {
|
|
430
|
+
try {
|
|
431
|
+
return URLDecoder.decode(text, StandardCharsets.UTF_8);
|
|
432
|
+
}
|
|
433
|
+
catch (IllegalArgumentException e) {
|
|
434
|
+
return text;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
284
438
|
private boolean isList(Context ctx) {
|
|
285
439
|
String opname = "";
|
|
286
440
|
if (ctx.op != null) {
|
|
@@ -51,29 +51,31 @@ public class RatelimitFeature extends BaseFeature {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
private void acquire() {
|
|
54
|
+
int wait = reserve();
|
|
55
|
+
if (wait > 0) {
|
|
56
|
+
FeatureOptions.foptSleep(this.options).accept(wait);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Refill, then reserve this call's token before any wait, under the lock:
|
|
61
|
+
// a negative count is the calls already queued, so overlapping calls pace
|
|
62
|
+
// in turn.
|
|
63
|
+
private synchronized int reserve() {
|
|
54
64
|
double rate = FeatureOptions.foptNum(this.options, "rate", 5);
|
|
55
65
|
double burst = FeatureOptions.foptNum(this.options, "burst", rate);
|
|
56
66
|
|
|
57
|
-
// Refill according to elapsed time.
|
|
58
67
|
long now = FeatureOptions.foptNow(this.options).getAsLong();
|
|
59
68
|
long elapsed = now - this.last;
|
|
60
69
|
this.last = now;
|
|
61
|
-
this.tokens = Math.min(burst, this.tokens + (elapsed / 1000.0) * rate);
|
|
70
|
+
this.tokens = Math.min(burst, this.tokens + (elapsed / 1000.0) * rate) - 1;
|
|
62
71
|
|
|
63
|
-
if (this.tokens >=
|
|
64
|
-
|
|
65
|
-
return;
|
|
72
|
+
if (this.tokens >= 0) {
|
|
73
|
+
return 0;
|
|
66
74
|
}
|
|
67
75
|
|
|
68
|
-
|
|
69
|
-
double needed = 1 - this.tokens;
|
|
70
|
-
int wait = (int) Math.ceil((needed / rate) * 1000);
|
|
76
|
+
int wait = (int) Math.ceil((-this.tokens / rate) * 1000);
|
|
71
77
|
track(wait);
|
|
72
|
-
|
|
73
|
-
FeatureOptions.foptSleep(this.options).accept(wait);
|
|
74
|
-
}
|
|
75
|
-
this.last = FeatureOptions.foptNow(this.options).getAsLong();
|
|
76
|
-
this.tokens = 0;
|
|
78
|
+
return wait;
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
private void track(int wait) {
|
|
@@ -5,6 +5,11 @@ import java.util.LinkedHashMap;
|
|
|
5
5
|
import java.util.List;
|
|
6
6
|
import java.util.Map;
|
|
7
7
|
import java.util.concurrent.ThreadLocalRandom;
|
|
8
|
+
import java.util.regex.Matcher;
|
|
9
|
+
import java.util.regex.Pattern;
|
|
10
|
+
import java.time.DateTimeException;
|
|
11
|
+
import java.time.LocalDateTime;
|
|
12
|
+
import java.time.ZoneOffset;
|
|
8
13
|
|
|
9
14
|
import JAVAPACKAGE.core.Context;
|
|
10
15
|
import JAVAPACKAGE.core.SdkClient;
|
|
@@ -105,7 +110,7 @@ public class RetryFeature extends BaseFeature {
|
|
|
105
110
|
}
|
|
106
111
|
|
|
107
112
|
private int backoff(Object res, int attempt, int minDelay, int maxDelay, double factor) {
|
|
108
|
-
//
|
|
113
|
+
// A server-provided Retry-After wins over the computed backoff.
|
|
109
114
|
int ra = retryAfter(res);
|
|
110
115
|
if (ra >= 0) {
|
|
111
116
|
return Math.min(ra, maxDelay);
|
|
@@ -120,15 +125,37 @@ public class RetryFeature extends BaseFeature {
|
|
|
120
125
|
}
|
|
121
126
|
|
|
122
127
|
private int retryAfter(Object res) {
|
|
123
|
-
|
|
124
|
-
|
|
128
|
+
return retryAfterMs(FeatureOptions.fresHeader(res, "retry-after"), System.currentTimeMillis());
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
private static final String MONTHS = "JanFebMarAprMayJunJulAugSepOctNovDec";
|
|
132
|
+
|
|
133
|
+
private static final Pattern IMF_FIXDATE = Pattern.compile(
|
|
134
|
+
"(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), ([0-9]{2}) ([A-Z][a-z]{2}) ([0-9]{4}) "
|
|
135
|
+
+ "([0-9]{2}):([0-9]{2}):([0-9]{2}) GMT");
|
|
136
|
+
|
|
137
|
+
// RFC 9110 Retry-After: delay-seconds or an IMF-fixdate, else -1.
|
|
138
|
+
static int retryAfterMs(String value, long now) {
|
|
139
|
+
String s = value.replaceAll("^[ \\t]+|[ \\t]+$", "");
|
|
140
|
+
if (s.matches("[0-9]+")) {
|
|
141
|
+
return s.length() > 6 ? Integer.MAX_VALUE : Integer.parseInt(s) * 1000;
|
|
142
|
+
}
|
|
143
|
+
Matcher m = IMF_FIXDATE.matcher(s);
|
|
144
|
+
int month = m.matches() ? MONTHS.indexOf(m.group(2)) : -1;
|
|
145
|
+
if (month < 0 || month % 3 != 0) {
|
|
125
146
|
return -1;
|
|
126
147
|
}
|
|
127
|
-
int
|
|
128
|
-
|
|
148
|
+
int sec = Integer.parseInt(m.group(6));
|
|
149
|
+
try {
|
|
150
|
+
long at = LocalDateTime.of(Integer.parseInt(m.group(3)), month / 3 + 1,
|
|
151
|
+
Integer.parseInt(m.group(1)), Integer.parseInt(m.group(4)),
|
|
152
|
+
Integer.parseInt(m.group(5)), Math.min(sec, 59))
|
|
153
|
+
.toEpochSecond(ZoneOffset.UTC) * 1000 + (sec > 59 ? 1000 : 0);
|
|
154
|
+
return (int) Math.min(Integer.MAX_VALUE, Math.max(0, at - now));
|
|
155
|
+
}
|
|
156
|
+
catch (DateTimeException e) {
|
|
129
157
|
return -1;
|
|
130
158
|
}
|
|
131
|
-
return seconds * 1000;
|
|
132
159
|
}
|
|
133
160
|
|
|
134
161
|
private void sleep(int ms) {
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
package JAVAPACKAGE.feature;
|
|
2
2
|
|
|
3
|
-
import java.io.IOException;
|
|
4
3
|
import java.net.URI;
|
|
5
|
-
import java.net.http.HttpClient;
|
|
6
|
-
import java.net.http.HttpRequest;
|
|
7
|
-
import java.net.http.HttpResponse;
|
|
8
4
|
import java.nio.charset.StandardCharsets;
|
|
9
|
-
import java.time.Duration;
|
|
10
5
|
import java.util.ArrayList;
|
|
11
6
|
import java.util.Base64;
|
|
12
7
|
import java.util.Locale;
|
|
@@ -14,7 +9,6 @@ import java.util.LinkedHashMap;
|
|
|
14
9
|
import java.util.List;
|
|
15
10
|
import java.util.Map;
|
|
16
11
|
import java.util.concurrent.CountDownLatch;
|
|
17
|
-
import java.util.function.BiFunction;
|
|
18
12
|
import java.util.function.Supplier;
|
|
19
13
|
|
|
20
14
|
import JAVAPACKAGE.core.Config;
|
|
@@ -695,9 +689,6 @@ public class SecretsFeature extends BaseFeature {
|
|
|
695
689
|
}
|
|
696
690
|
String url = base + "/" + path;
|
|
697
691
|
|
|
698
|
-
Object sysRaw = opts.get("system");
|
|
699
|
-
Object fetchRaw = sysRaw instanceof Map
|
|
700
|
-
? ((Map<String, Object>) sysRaw).get("fetch") : null;
|
|
701
692
|
|
|
702
693
|
// The body is SERIALISED, never concatenated: a refresh token (or a
|
|
703
694
|
// configured request-field name) carrying a quote, backslash or
|
|
@@ -714,12 +705,11 @@ public class SecretsFeature extends BaseFeature {
|
|
|
714
705
|
fetchdef.put("body", Json.stringify(payload));
|
|
715
706
|
// Never followed by the client: a redirect would carry the refresh token on.
|
|
716
707
|
fetchdef.put("redirect", "manual");
|
|
708
|
+
// Its own bound, in milliseconds: the timeout feature's wrapper is above it.
|
|
709
|
+
fetchdef.put("timeout", 30000);
|
|
717
710
|
|
|
718
|
-
//
|
|
719
|
-
|
|
720
|
-
// recurse on the first expiry - and would route the exchange through
|
|
721
|
-
// the test mock, which knows nothing about it.
|
|
722
|
-
Object res = exchangeFetch(fetchRaw, url, fetchdef);
|
|
711
|
+
// Not the wrapped transport, which would recurse on the first expiry.
|
|
712
|
+
Object res = exchangeFetch(url, fetchdef);
|
|
723
713
|
|
|
724
714
|
// By option alone, and only while the exchange stays on its own origin.
|
|
725
715
|
String at = url;
|
|
@@ -729,7 +719,7 @@ public class SecretsFeature extends BaseFeature {
|
|
|
729
719
|
break;
|
|
730
720
|
}
|
|
731
721
|
at = next;
|
|
732
|
-
res = exchangeFetch(
|
|
722
|
+
res = exchangeFetch(at, fetchdef);
|
|
733
723
|
}
|
|
734
724
|
|
|
735
725
|
int status = FeatureOptions.fresStatus(res);
|
|
@@ -764,17 +754,10 @@ public class SecretsFeature extends BaseFeature {
|
|
|
764
754
|
return token;
|
|
765
755
|
}
|
|
766
756
|
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
.apply(url, fetchdef);
|
|
772
|
-
}
|
|
773
|
-
// No custom transport supplied - the ordinary case. makeOptions
|
|
774
|
-
// leaves system.fetch unset, so the exchange gets its own raw HTTP
|
|
775
|
-
// path: requiring a custom transport for the COMMON case would
|
|
776
|
-
// reject every live token purchase before a request was made.
|
|
777
|
-
return rawExchangeFetch(url, fetchdef);
|
|
757
|
+
// The SDK's own transport, beneath every feature's wrapper: it holds the
|
|
758
|
+
// test feature's block and the GET-only guard.
|
|
759
|
+
private Object exchangeFetch(String url, Map<String, Object> fetchdef) {
|
|
760
|
+
return Fetcher.fetcher(this.rootctx, url, fetchdef);
|
|
778
761
|
}
|
|
779
762
|
|
|
780
763
|
// Where a 307 or 308 points, when that is on the exchange's own origin. Any
|
|
@@ -809,72 +792,6 @@ public class SecretsFeature extends BaseFeature {
|
|
|
809
792
|
return scheme + "://" + host.toLowerCase(Locale.ROOT) + ":" + port;
|
|
810
793
|
}
|
|
811
794
|
|
|
812
|
-
// rawExchangeFetch is the token-exchange transport of last resort: plain
|
|
813
|
-
// java.net.http, in the same result shape the system.fetch seam promises
|
|
814
|
-
// ("status" + "json"). utility/Fetcher.defaultHttpFetch is
|
|
815
|
-
// package-private in JAVAPACKAGE.utility and unreachable from here, and
|
|
816
|
-
// reaching for it would put the exchange back on the SDK's own transport
|
|
817
|
-
// stack - which is the thing this must not use.
|
|
818
|
-
private static Map<String, Object> rawExchangeFetch(String fullurl,
|
|
819
|
-
Map<String, Object> fetchdef) {
|
|
820
|
-
|
|
821
|
-
Object methodRaw = fetchdef.get("method");
|
|
822
|
-
String method = methodRaw instanceof String && !"".equals(methodRaw)
|
|
823
|
-
? (String) methodRaw : "POST";
|
|
824
|
-
|
|
825
|
-
Object bodyRaw = fetchdef.get("body");
|
|
826
|
-
String body = bodyRaw instanceof String ? (String) bodyRaw : "";
|
|
827
|
-
|
|
828
|
-
HttpRequest.Builder reqb = HttpRequest.newBuilder(URI.create(fullurl))
|
|
829
|
-
.method(method, "".equals(body)
|
|
830
|
-
? HttpRequest.BodyPublishers.noBody()
|
|
831
|
-
: HttpRequest.BodyPublishers.ofString(body, StandardCharsets.UTF_8));
|
|
832
|
-
|
|
833
|
-
Object headersRaw = fetchdef.get("headers");
|
|
834
|
-
if (headersRaw instanceof Map) {
|
|
835
|
-
for (Map.Entry<String, Object> h : ((Map<String, Object>) headersRaw).entrySet()) {
|
|
836
|
-
if (h.getValue() instanceof String) {
|
|
837
|
-
reqb.setHeader(h.getKey(), (String) h.getValue());
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
HttpResponse<String> resp;
|
|
843
|
-
try {
|
|
844
|
-
resp = HttpClient.newBuilder()
|
|
845
|
-
.connectTimeout(Duration.ofSeconds(30))
|
|
846
|
-
.followRedirects(HttpClient.Redirect.NEVER)
|
|
847
|
-
.build()
|
|
848
|
-
.send(reqb.build(), HttpResponse.BodyHandlers.ofString());
|
|
849
|
-
}
|
|
850
|
-
catch (IOException | InterruptedException e) {
|
|
851
|
-
if (e instanceof InterruptedException) {
|
|
852
|
-
Thread.currentThread().interrupt();
|
|
853
|
-
}
|
|
854
|
-
throw new Sekreto.SekretoError(
|
|
855
|
-
"secrets: token exchange transport failed: " + e.getMessage());
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
String text = resp.body() == null ? "" : resp.body();
|
|
859
|
-
Object parsed;
|
|
860
|
-
try {
|
|
861
|
-
parsed = "".equals(text) ? null : Json.parse(text);
|
|
862
|
-
}
|
|
863
|
-
catch (RuntimeException e) {
|
|
864
|
-
parsed = null;
|
|
865
|
-
}
|
|
866
|
-
final Object jsonBody = parsed;
|
|
867
|
-
|
|
868
|
-
Map<String, Object> out = new LinkedHashMap<>();
|
|
869
|
-
out.put("status", resp.statusCode());
|
|
870
|
-
Map<String, Object> rheaders = new LinkedHashMap<>();
|
|
871
|
-
resp.headers().firstValue("location").ifPresent((v) -> rheaders.put("location", v));
|
|
872
|
-
out.put("headers", rheaders);
|
|
873
|
-
out.put("json", (Supplier<Object>) () -> jsonBody);
|
|
874
|
-
out.put("body", text);
|
|
875
|
-
return out;
|
|
876
|
-
}
|
|
877
|
-
|
|
878
795
|
private static void awaitLatch(CountDownLatch latch) {
|
|
879
796
|
try {
|
|
880
797
|
latch.await();
|
|
@@ -42,8 +42,9 @@ public class StreamingFeature extends BaseFeature {
|
|
|
42
42
|
if (!this.active || !streamable(ctx)) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
+
// A failed result keeps no stream, so the entity's stream() raises its error.
|
|
45
46
|
final Result result = ctx.result;
|
|
46
|
-
if (result == null) {
|
|
47
|
+
if (result == null || result.err != null) {
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
50
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package JAVAPACKAGE.feature;
|
|
2
2
|
|
|
3
|
+
import java.security.SecureRandom;
|
|
3
4
|
import java.util.ArrayList;
|
|
4
5
|
import java.util.LinkedHashMap;
|
|
5
6
|
import java.util.List;
|
|
@@ -25,7 +26,6 @@ public class TelemetryFeature extends BaseFeature {
|
|
|
25
26
|
|
|
26
27
|
private SdkClient client;
|
|
27
28
|
private Map<String, Object> options;
|
|
28
|
-
private int seq = 0;
|
|
29
29
|
|
|
30
30
|
// Activity tracking (mirrors the ts client._telemetry record).
|
|
31
31
|
public List<Map<String, Object>> spans = new ArrayList<>();
|
|
@@ -42,7 +42,6 @@ public class TelemetryFeature extends BaseFeature {
|
|
|
42
42
|
this.client = ctx.client;
|
|
43
43
|
this.options = options;
|
|
44
44
|
this.active = FeatureOptions.foptBool(options, "active", false);
|
|
45
|
-
this.seq = 0;
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
@Override
|
|
@@ -141,13 +140,22 @@ public class TelemetryFeature extends BaseFeature {
|
|
|
141
140
|
if (this.options.get("idgen") instanceof Function) {
|
|
142
141
|
return ((Function<String, String>) this.options.get("idgen")).apply(kind);
|
|
143
142
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
143
|
+
return randomHex("trace".equals(kind) ? 16 : 8);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
private static final SecureRandom RANDOM = new SecureRandom();
|
|
147
|
+
|
|
148
|
+
// W3C trace context: lowercase hex from the platform's random source, never all zeros.
|
|
149
|
+
private static String randomHex(int bytes) {
|
|
150
|
+
byte[] buf = new byte[bytes];
|
|
151
|
+
StringBuilder out = new StringBuilder();
|
|
152
|
+
while (out.length() == 0 || out.chars().allMatch((c) -> c == '0')) {
|
|
153
|
+
RANDOM.nextBytes(buf);
|
|
154
|
+
out.setLength(0);
|
|
155
|
+
for (byte b : buf) {
|
|
156
|
+
out.append(String.format("%02x", b & 0xff));
|
|
157
|
+
}
|
|
150
158
|
}
|
|
151
|
-
return
|
|
159
|
+
return out.toString();
|
|
152
160
|
}
|
|
153
161
|
}
|
|
@@ -201,28 +201,6 @@ public class TestFeature extends BaseFeature {
|
|
|
201
201
|
return out;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
// For single-entity ops (load, remove) with an empty explicit match,
|
|
205
|
-
// fall back to the id the entity client already knows from a prior
|
|
206
|
-
// create/load (in ctx.match / ctx.data). Mirrors the TS mock where
|
|
207
|
-
// param() resolves the id from that accumulated state.
|
|
208
|
-
private Map<String, Object> resolveMatch(Context ctx, Map<String, Object> explicit) {
|
|
209
|
-
if (explicit != null && !explicit.isEmpty()) {
|
|
210
|
-
return explicit;
|
|
211
|
-
}
|
|
212
|
-
for (Map<String, Object> src : new Map[] { ctx.match, ctx.data }) {
|
|
213
|
-
if (src == null) {
|
|
214
|
-
continue;
|
|
215
|
-
}
|
|
216
|
-
Object v = Struct.getprop(src, "id", null);
|
|
217
|
-
if (v != null && !"__UNDEFINED__".equals(v)) {
|
|
218
|
-
Map<String, Object> out = new LinkedHashMap<>();
|
|
219
|
-
out.put("id", v);
|
|
220
|
-
return out;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
return new LinkedHashMap<>();
|
|
224
|
-
}
|
|
225
|
-
|
|
226
204
|
private Object serve(Context ctx, Map<String, Object> entity) {
|
|
227
205
|
Operation op = ctx.op;
|
|
228
206
|
Map<String, Object> entmap = Helpers.toMapAny(Struct.getprop(entity, op.entity));
|
|
@@ -231,7 +209,7 @@ public class TestFeature extends BaseFeature {
|
|
|
231
209
|
}
|
|
232
210
|
|
|
233
211
|
if ("load".equals(op.name)) {
|
|
234
|
-
Object args = buildArgs(ctx, op,
|
|
212
|
+
Object args = buildArgs(ctx, op, ctx.reqmatch);
|
|
235
213
|
List<Object> found = Struct.select(entmap, args);
|
|
236
214
|
Object ent = Struct.getelem(found, 0, null);
|
|
237
215
|
if (ent == null) {
|
|
@@ -254,32 +232,7 @@ public class TestFeature extends BaseFeature {
|
|
|
254
232
|
return respond(ctx, 200, out, null);
|
|
255
233
|
}
|
|
256
234
|
else if ("update".equals(op.name) || "patch".equals(op.name)) {
|
|
257
|
-
|
|
258
|
-
// also contains the new field values, which would otherwise
|
|
259
|
-
// cause select to filter out the entity we want to update.
|
|
260
|
-
// When reqdata has no id, fall back to the id the entity
|
|
261
|
-
// client carries from a prior create/load (in ctx.match /
|
|
262
|
-
// ctx.data), mirroring the TS mock where param(ctx,'id')
|
|
263
|
-
// resolves from accumulated state.
|
|
264
|
-
Map<String, Object> updateMatch = new LinkedHashMap<>();
|
|
265
|
-
if (ctx.reqdata != null) {
|
|
266
|
-
if (ctx.reqdata.containsKey("id")) {
|
|
267
|
-
updateMatch.put("id", ctx.reqdata.get("id"));
|
|
268
|
-
}
|
|
269
|
-
if (op.alias != null) {
|
|
270
|
-
Object aliasIdRaw = Struct.getprop(op.alias, "id");
|
|
271
|
-
if (aliasIdRaw instanceof String) {
|
|
272
|
-
String aliasId = (String) aliasIdRaw;
|
|
273
|
-
if (ctx.reqdata.containsKey(aliasId)) {
|
|
274
|
-
updateMatch.put(aliasId, ctx.reqdata.get(aliasId));
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
if (updateMatch.isEmpty()) {
|
|
280
|
-
updateMatch = resolveMatch(ctx, new LinkedHashMap<>());
|
|
281
|
-
}
|
|
282
|
-
Object args = buildArgs(ctx, op, updateMatch);
|
|
235
|
+
Object args = buildArgs(ctx, op, record(ctx.reqdata));
|
|
283
236
|
List<Object> found = Struct.select(entmap, args);
|
|
284
237
|
Object ent = Struct.getelem(found, 0, null);
|
|
285
238
|
if (ent == null) {
|
|
@@ -294,7 +247,7 @@ public class TestFeature extends BaseFeature {
|
|
|
294
247
|
return respond(ctx, 200, out, null);
|
|
295
248
|
}
|
|
296
249
|
else if ("remove".equals(op.name)) {
|
|
297
|
-
Object args = buildArgs(ctx, op,
|
|
250
|
+
Object args = buildArgs(ctx, op, ctx.reqmatch);
|
|
298
251
|
List<Object> found = Struct.select(entmap, args);
|
|
299
252
|
Object ent = Struct.getelem(found, 0, null);
|
|
300
253
|
// Remove only the first matched entity. If nothing matches,
|
|
@@ -399,6 +352,11 @@ public class TestFeature extends BaseFeature {
|
|
|
399
352
|
FeatureOptions.foptSleep(net).accept(ms);
|
|
400
353
|
}
|
|
401
354
|
|
|
355
|
+
private static boolean held(Map<String, Object> src, String key) {
|
|
356
|
+
Object v = src == null ? null : Struct.getprop(src, key, null);
|
|
357
|
+
return v != null && !"__UNDEFINED__".equals(v);
|
|
358
|
+
}
|
|
359
|
+
|
|
402
360
|
private Object buildArgs(Context ctx, Operation op, Map<String, Object> args) {
|
|
403
361
|
String opname = op.name;
|
|
404
362
|
|
|
@@ -438,23 +396,52 @@ public class TestFeature extends BaseFeature {
|
|
|
438
396
|
List<Object> qand = Struct.jt();
|
|
439
397
|
Map<String, Object> q = Struct.jm("`$AND`", qand);
|
|
440
398
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
boolean isId = "id".equals(key);
|
|
444
|
-
List<Object> selected = Struct.select(reqd, key);
|
|
445
|
-
boolean isReqd = !Struct.isempty(selected);
|
|
399
|
+
String entityName = ctx.entity == null ? "" : ctx.entity.getName();
|
|
400
|
+
Object idfrom = Struct.getpath(ctx.config, List.of("entity", entityName, "id", "from"));
|
|
446
401
|
|
|
447
|
-
|
|
448
|
-
Object v = ctx.utility.param.apply(ctx, key);
|
|
449
|
-
Object ka = Struct.getprop(op.alias, key);
|
|
402
|
+
List<String> names = new ArrayList<>(args == null ? List.of() : Struct.keysof(args));
|
|
450
403
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
404
|
+
// With no id in the call, the entity's held id (or composite parts) stands in.
|
|
405
|
+
if (args == null || args.get("id") == null) {
|
|
406
|
+
Object parts = Struct.getpath(ctx.config, List.of("entity", entityName, "id", "parts"));
|
|
407
|
+
if (!(parts instanceof List)) {
|
|
408
|
+
parts = "list".equals(opname) ? List.of() : List.of("id");
|
|
409
|
+
}
|
|
410
|
+
for (Object part : (List<Object>) parts) {
|
|
411
|
+
String pname = String.valueOf(part);
|
|
412
|
+
if (!names.contains(pname) && (held(ctx.match, pname) || held(ctx.data, pname))) {
|
|
413
|
+
names.add(pname);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
for (String key : names) {
|
|
419
|
+
boolean isId = "id".equals(key);
|
|
420
|
+
List<Object> selected = Struct.select(reqd, key);
|
|
421
|
+
boolean isReqd = !Struct.isempty(selected);
|
|
455
422
|
|
|
456
|
-
|
|
423
|
+
if (isId || isReqd) {
|
|
424
|
+
Object v = ctx.utility.param.apply(ctx, key);
|
|
425
|
+
Object ka = Struct.getprop(op.alias, key);
|
|
426
|
+
|
|
427
|
+
List<Object> qor = Struct.jt(Struct.jm(key, v));
|
|
428
|
+
if (ka instanceof String) {
|
|
429
|
+
qor.add(Struct.jm((String) ka, v));
|
|
457
430
|
}
|
|
431
|
+
|
|
432
|
+
// An alternative, never a replacement: a seed keeping the parameter
|
|
433
|
+
// flat is still found.
|
|
434
|
+
Object kf = Struct.getprop(idfrom, key);
|
|
435
|
+
if (kf instanceof String && !key.equals(kf)) {
|
|
436
|
+
Object nest = v;
|
|
437
|
+
String[] segs = ((String) kf).split("\\.");
|
|
438
|
+
for (int i = segs.length - 1; 0 <= i; i--) {
|
|
439
|
+
nest = Struct.jm(segs[i], nest);
|
|
440
|
+
}
|
|
441
|
+
qor.add(nest);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
qand.add(Struct.jm("`$OR`", qor));
|
|
458
445
|
}
|
|
459
446
|
}
|
|
460
447
|
|