@voxgig/sdkgen 4.51.0 → 4.53.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/action/check.js +15 -0
- package/dist/action/check.js.map +1 -1
- package/dist/action/doctor.js +1 -1
- package/dist/action/doctor.js.map +1 -1
- package/dist/action/resolve.js +13 -3
- package/dist/action/resolve.js.map +1 -1
- package/dist/cmp/Deploy.js +19 -7
- package/dist/cmp/Deploy.js.map +1 -1
- package/dist/cmp/License.d.ts +3 -1
- package/dist/cmp/License.js +6 -1
- package/dist/cmp/License.js.map +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/clientOptions.js +1 -0
- package/dist/helpers/clientOptions.js.map +1 -1
- package/dist/helpers/definitionPlan.js +2 -2
- package/dist/helpers/definitionPlan.js.map +1 -1
- package/dist/helpers/doccheck.d.ts +9 -2
- package/dist/helpers/doccheck.js +20 -9
- package/dist/helpers/doccheck.js.map +1 -1
- package/dist/helpers/modelcheck.d.ts +7 -2
- package/dist/helpers/modelcheck.js +51 -0
- package/dist/helpers/modelcheck.js.map +1 -1
- package/dist/helpers/naming.js +1 -1
- package/dist/helpers/naming.js.map +1 -1
- package/dist/helpers/opShape.js +9 -3
- package/dist/helpers/opShape.js.map +1 -1
- package/dist/helpers/optspec.js +2 -2
- package/dist/helpers/optspec.js.map +1 -1
- package/dist/helpers/packageMeta.js +5 -7
- package/dist/helpers/packageMeta.js.map +1 -1
- package/dist/helpers/targetrun.d.ts +22 -0
- package/dist/helpers/targetrun.js +180 -0
- package/dist/helpers/targetrun.js.map +1 -0
- package/dist/helpers/testPolicy.d.ts +2 -1
- package/dist/helpers/testPolicy.js +13 -2
- package/dist/helpers/testPolicy.js.map +1 -1
- package/dist/sdkgen.d.ts +3 -3
- package/dist/sdkgen.js +34 -13
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utility.d.ts +2 -1
- package/dist/utility.js +20 -0
- package/dist/utility.js.map +1 -1
- package/model/sdkgen.aontu +7 -1
- package/package.json +1 -1
- package/project/.sdk/model/feature/audit.aontu +1 -1
- package/project/.sdk/model/feature/cache.aontu +1 -1
- 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/go-mcp.aontu +1 -1
- package/project/.sdk/model/target/py-data.aontu +1 -1
- package/project/.sdk/model/target/py.aontu +0 -5
- package/project/.sdk/model/target/rust.aontu +5 -0
- package/project/.sdk/src/cmp/c/Main_c.ts +3 -1
- package/project/.sdk/src/cmp/c/PrepareAuth_c.ts +40 -2
- package/project/.sdk/src/cmp/c/ReadmeHowto_c.ts +10 -5
- package/project/.sdk/src/cmp/c/TestClean_c.ts +12 -11
- package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +17 -10
- package/project/.sdk/src/cmp/clojure/Main_clojure.ts +3 -1
- package/project/.sdk/src/cmp/clojure/PrepareAuth_clojure.ts +15 -2
- package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +18 -1
- package/project/.sdk/src/cmp/cpp/Main_cpp.ts +3 -1
- package/project/.sdk/src/cmp/cpp/PrepareAuth_cpp.ts +12 -2
- package/project/.sdk/src/cmp/cpp/TestClean_cpp.ts +2 -1
- package/project/.sdk/src/cmp/csharp/Main_csharp.ts +3 -1
- package/project/.sdk/src/cmp/csharp/PrepareAuth_csharp.ts +19 -0
- package/project/.sdk/src/cmp/csharp/TestDirect_csharp.ts +4 -3
- 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/csharp/fragment/SdkError.fragment.cs +9 -0
- package/project/.sdk/src/cmp/elixir/Main_elixir.ts +3 -1
- package/project/.sdk/src/cmp/elixir/PrepareAuth_elixir.ts +28 -4
- package/project/.sdk/src/cmp/elixir/TestClean_elixir.ts +2 -1
- 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/EntityTypes_go.ts +2 -1
- package/project/.sdk/src/cmp/go/Main_go.ts +3 -1
- package/project/.sdk/src/cmp/go/PrepareAuth_go.ts +17 -1
- package/project/.sdk/src/cmp/go/ReadmeExamplesTest_go.ts +11 -6
- package/project/.sdk/src/cmp/go/TestDirect_go.ts +4 -6
- 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/go-cli/Main_go-cli.ts +45 -15
- package/project/.sdk/src/cmp/go-mcp/Main_go-mcp.ts +46 -11
- package/project/.sdk/src/cmp/go-mcp/fragment/tools.fragment.go +9 -0
- package/project/.sdk/src/cmp/java/Main_java.ts +3 -1
- package/project/.sdk/src/cmp/java/PrepareAuth_java.ts +17 -1
- package/project/.sdk/src/cmp/java/TestClean_java.ts +10 -5
- package/project/.sdk/src/cmp/java/TestDirect_java.ts +4 -3
- package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +21 -0
- package/project/.sdk/src/cmp/js/Main_js.ts +2 -0
- package/project/.sdk/src/cmp/js/PrepareAuth_js.ts +22 -2
- package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +13 -8
- package/project/.sdk/src/cmp/js/TestClean_js.ts +4 -2
- package/project/.sdk/src/cmp/js/TestDirect_js.ts +4 -7
- 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/Main_kotlin.ts +3 -1
- package/project/.sdk/src/cmp/kotlin/PrepareAuth_kotlin.ts +11 -0
- package/project/.sdk/src/cmp/kotlin/TestClean_kotlin.ts +10 -5
- package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +4 -3
- package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +19 -0
- package/project/.sdk/src/cmp/lua/Main_lua.ts +2 -1
- package/project/.sdk/src/cmp/lua/PrepareAuth_lua.ts +18 -2
- package/project/.sdk/src/cmp/lua/ReadmeExamplesTest_lua.ts +12 -3
- package/project/.sdk/src/cmp/lua/TestClean_lua.ts +2 -1
- package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +3 -2
- 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/Main_ocaml.ts +3 -1
- package/project/.sdk/src/cmp/ocaml/PrepareAuth_ocaml.ts +24 -0
- package/project/.sdk/src/cmp/ocaml/TestClean_ocaml.ts +2 -1
- package/project/.sdk/src/cmp/ocaml/fragment/RunOp.fragment.ml +36 -21
- package/project/.sdk/src/cmp/perl/Main_perl.ts +2 -1
- package/project/.sdk/src/cmp/perl/PrepareAuth_perl.ts +12 -2
- package/project/.sdk/src/cmp/perl/ReadmeExamplesTest_perl.ts +8 -2
- package/project/.sdk/src/cmp/perl/TestClean_perl.ts +1 -1
- package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +3 -2
- 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/Main_php.ts +3 -1
- package/project/.sdk/src/cmp/php/PrepareAuth_php.ts +28 -2
- package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +1 -1
- package/project/.sdk/src/cmp/php/ReadmeExamplesTest_php.ts +12 -3
- package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +1 -1
- package/project/.sdk/src/cmp/php/TestDirect_php.ts +3 -2
- 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/Main_py.ts +2 -1
- package/project/.sdk/src/cmp/py/Package_py.ts +6 -2
- package/project/.sdk/src/cmp/py/PrepareAuth_py.ts +12 -0
- package/project/.sdk/src/cmp/py/ReadmeInstall_py.ts +4 -0
- package/project/.sdk/src/cmp/py/TestDirect_py.ts +3 -2
- 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/py-data/Main_py-data.ts +4 -3
- package/project/.sdk/src/cmp/rb/EntityTypes_rb.ts +13 -10
- package/project/.sdk/src/cmp/rb/MainEntity_rb.ts +1 -1
- package/project/.sdk/src/cmp/rb/Main_rb.ts +2 -1
- package/project/.sdk/src/cmp/rb/PrepareAuth_rb.ts +23 -10
- package/project/.sdk/src/cmp/rb/ReadmeExamplesTest_rb.ts +14 -8
- package/project/.sdk/src/cmp/rb/ReadmeExplanation_rb.ts +5 -0
- package/project/.sdk/src/cmp/rb/TestClean_rb.ts +1 -1
- package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +3 -2
- package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +1 -1
- package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +276 -253
- package/project/.sdk/src/cmp/rb/fragment/EntityCreateOp.fragment.rb +1 -1
- package/project/.sdk/src/cmp/rb/fragment/EntityLoadOp.fragment.rb +1 -1
- package/project/.sdk/src/cmp/rb/fragment/EntityPatchOp.fragment.rb +1 -1
- package/project/.sdk/src/cmp/rb/fragment/EntityRemoveOp.fragment.rb +1 -1
- package/project/.sdk/src/cmp/rb/fragment/EntityUpdateOp.fragment.rb +1 -1
- package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +56 -40
- package/project/.sdk/src/cmp/rust/Main_rust.ts +3 -1
- package/project/.sdk/src/cmp/rust/PrepareAuth_rust.ts +19 -1
- package/project/.sdk/src/cmp/rust/TestClean_rust.ts +14 -17
- package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +3 -2
- package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +22 -2
- package/project/.sdk/src/cmp/rust/fragment/SdkError.fragment.rs +16 -1
- package/project/.sdk/src/cmp/scala/Main_scala.ts +3 -0
- package/project/.sdk/src/cmp/scala/PrepareAuth_scala.ts +14 -0
- package/project/.sdk/src/cmp/scala/TestClean_scala.ts +11 -11
- package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +14 -0
- package/project/.sdk/src/cmp/swift/Main_swift.ts +3 -1
- package/project/.sdk/src/cmp/swift/PrepareAuth_swift.ts +13 -0
- package/project/.sdk/src/cmp/swift/TestClean_swift.ts +11 -11
- 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/Main_ts.ts +2 -0
- package/project/.sdk/src/cmp/ts/PrepareAuth_ts.ts +20 -1
- package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +13 -8
- package/project/.sdk/src/cmp/ts/TestClean_ts.ts +4 -2
- package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +4 -7
- 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/Main_zig.ts +3 -0
- package/project/.sdk/src/cmp/zig/PrepareAuth_zig.ts +23 -0
- package/project/.sdk/src/cmp/zig/TestClean_zig.ts +11 -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/src/cmp/zig/fragment/Root.fragment.zig +2 -0
- package/project/.sdk/tm/c/core/context.c +4 -0
- package/project/.sdk/tm/c/core/control.c +19 -0
- package/project/.sdk/tm/c/core/result.c +3 -0
- package/project/.sdk/tm/c/core/sdk.h +17 -0
- package/project/.sdk/tm/c/feature/metrics.c +7 -0
- package/project/.sdk/tm/c/feature/netsim.c +20 -5
- package/project/.sdk/tm/c/feature/paging.c +231 -2
- package/project/.sdk/tm/c/feature/ratelimit.c +12 -15
- package/project/.sdk/tm/c/feature/retry.c +56 -6
- package/project/.sdk/tm/c/feature/streaming.c +2 -1
- package/project/.sdk/tm/c/feature/support.c +17 -0
- package/project/.sdk/tm/c/feature/telemetry.c +19 -18
- package/project/.sdk/tm/c/feature/test.c +94 -58
- package/project/.sdk/tm/c/tests/feature_harness.h +1 -0
- package/project/.sdk/tm/c/tests/feature_test.c +253 -0
- package/project/.sdk/tm/c/tests/primary_utility_test.c +2 -0
- package/project/.sdk/tm/c/utility/clean.c +6 -3
- package/project/.sdk/tm/c/utility/http.c +20 -9
- package/project/.sdk/tm/c/utility/make_fetch_def.c +3 -0
- package/project/.sdk/tm/c/utility/make_options.c +80 -9
- package/project/.sdk/tm/c/utility/make_point.c +43 -0
- package/project/.sdk/tm/c/utility/make_request.c +14 -1
- package/project/.sdk/tm/c/utility/make_spec.c +32 -0
- package/project/.sdk/tm/c/utility/media.c +31 -0
- package/project/.sdk/tm/c/utility/result_body.c +3 -0
- package/project/.sdk/tm/c/utility/tls/none.c +2 -2
- package/project/.sdk/tm/c/utility/tls/openssl.c +29 -4
- package/project/.sdk/tm/c/utility/tls/tls.h +4 -2
- package/project/.sdk/tm/clojure/src/sdk/core.clj +194 -31
- package/project/.sdk/tm/clojure/src/sdk/features.clj +237 -86
- package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +102 -1
- package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +1 -1
- package/project/.sdk/tm/cpp/core/types.hpp +171 -68
- package/project/.sdk/tm/cpp/feature/audit.hpp +6 -1
- package/project/.sdk/tm/cpp/feature/metrics.hpp +19 -0
- package/project/.sdk/tm/cpp/feature/netsim.hpp +9 -8
- package/project/.sdk/tm/cpp/feature/options.hpp +22 -0
- package/project/.sdk/tm/cpp/feature/paging.hpp +160 -2
- package/project/.sdk/tm/cpp/feature/ratelimit.hpp +15 -16
- package/project/.sdk/tm/cpp/feature/retry.hpp +52 -10
- 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 +71 -60
- package/project/.sdk/tm/cpp/feature/timeout.hpp +19 -1
- package/project/.sdk/tm/cpp/test/feature_test.cpp +207 -0
- package/project/.sdk/tm/cpp/test/harness.hpp +1 -0
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +136 -7
- package/project/.sdk/tm/csharp/core/Context.cs +8 -0
- package/project/.sdk/tm/csharp/core/Control.cs +6 -0
- package/project/.sdk/tm/csharp/core/Result.cs +3 -0
- package/project/.sdk/tm/csharp/feature/AuditFeature.cs +8 -1
- package/project/.sdk/tm/csharp/feature/FeatureOptions.cs +37 -0
- package/project/.sdk/tm/csharp/feature/MetricsFeature.cs +23 -0
- package/project/.sdk/tm/csharp/feature/NetsimFeature.cs +8 -9
- package/project/.sdk/tm/csharp/feature/PagingFeature.cs +130 -3
- package/project/.sdk/tm/csharp/feature/RatelimitFeature.cs +22 -21
- package/project/.sdk/tm/csharp/feature/RetryFeature.cs +46 -13
- 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 +62 -75
- package/project/.sdk/tm/csharp/feature/TimeoutFeature.cs +8 -2
- package/project/.sdk/tm/csharp/test/FeatureHarness.cs +4 -0
- package/project/.sdk/tm/csharp/test/FeatureTest.cs +230 -0
- package/project/.sdk/tm/csharp/utility/Clean.cs +1 -1
- package/project/.sdk/tm/csharp/utility/Fetcher.cs +101 -15
- package/project/.sdk/tm/csharp/utility/MakeError.cs +8 -1
- package/project/.sdk/tm/csharp/utility/MakeFetchDef.cs +5 -0
- package/project/.sdk/tm/csharp/utility/MakeOptions.cs +133 -12
- package/project/.sdk/tm/csharp/utility/MakePoint.cs +24 -0
- package/project/.sdk/tm/csharp/utility/MakeRequest.cs +11 -1
- package/project/.sdk/tm/csharp/utility/MakeSpec.cs +18 -0
- package/project/.sdk/tm/csharp/utility/Media.cs +29 -0
- package/project/.sdk/tm/csharp/utility/ResultBody.cs +4 -0
- package/project/.sdk/tm/elixir/lib/projectname/context.ex +4 -0
- package/project/.sdk/tm/elixir/lib/projectname/core.ex +6 -1
- package/project/.sdk/tm/elixir/lib/projectname/entity_base.ex +1 -1
- package/project/.sdk/tm/elixir/lib/projectname/feature/metrics.ex +13 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/netsim.ex +13 -6
- package/project/.sdk/tm/elixir/lib/projectname/feature/paging.ex +110 -5
- package/project/.sdk/tm/elixir/lib/projectname/feature/ratelimit.ex +11 -18
- package/project/.sdk/tm/elixir/lib/projectname/feature/retry.ex +39 -12
- package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +7 -1
- 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 +59 -58
- package/project/.sdk/tm/elixir/lib/projectname/feature.ex +36 -0
- package/project/.sdk/tm/elixir/lib/projectname/utility.ex +366 -46
- package/project/.sdk/tm/elixir/test/feature_test.exs +183 -0
- package/project/.sdk/tm/elixir/test/support/feature_harness.ex +2 -0
- package/project/.sdk/tm/go/core/context.go +7 -0
- package/project/.sdk/tm/go/core/control.go +6 -0
- package/project/.sdk/tm/go/core/error.go +6 -0
- package/project/.sdk/tm/go/core/result.go +2 -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/feature_options.go +39 -0
- package/project/.sdk/tm/go/feature/metrics_feature.go +14 -0
- package/project/.sdk/tm/go/feature/netsim_feature.go +17 -10
- package/project/.sdk/tm/go/feature/paging_feature.go +108 -2
- package/project/.sdk/tm/go/feature/ratelimit_feature.go +22 -19
- package/project/.sdk/tm/go/feature/retry_feature.go +83 -15
- 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 +79 -64
- package/project/.sdk/tm/go/feature/timeout_feature.go +24 -3
- package/project/.sdk/tm/go/test/feature_corpus_test.go +247 -28
- package/project/.sdk/tm/go/test/feature_test.go +32 -0
- package/project/.sdk/tm/go/utility/clean.go +6 -2
- package/project/.sdk/tm/go/utility/fetcher.go +151 -12
- package/project/.sdk/tm/go/utility/make_error.go +8 -0
- package/project/.sdk/tm/go/utility/make_fetch_def.go +4 -0
- package/project/.sdk/tm/go/utility/make_options.go +111 -6
- package/project/.sdk/tm/go/utility/make_point.go +40 -4
- package/project/.sdk/tm/go/utility/make_request.go +21 -3
- package/project/.sdk/tm/go/utility/make_spec.go +24 -0
- package/project/.sdk/tm/go/utility/media.go +28 -0
- package/project/.sdk/tm/go/utility/register.go +22 -2
- package/project/.sdk/tm/go/utility/result_body.go +5 -0
- package/project/.sdk/tm/java/core/Context.java +8 -0
- package/project/.sdk/tm/java/core/Control.java +9 -0
- package/project/.sdk/tm/java/core/Result.java +4 -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/FeatureOptions.java +44 -0
- package/project/.sdk/tm/java/feature/MetricsFeature.java +31 -0
- package/project/.sdk/tm/java/feature/NetsimFeature.java +8 -9
- package/project/.sdk/tm/java/feature/PagingFeature.java +156 -2
- package/project/.sdk/tm/java/feature/RatelimitFeature.java +12 -15
- package/project/.sdk/tm/java/feature/RetryFeature.java +38 -12
- 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 +57 -71
- package/project/.sdk/tm/java/feature/TimeoutFeature.java +27 -1
- package/project/.sdk/tm/java/test/FeatureCorpusTest.java +215 -17
- package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +1 -1
- package/project/.sdk/tm/java/utility/CallerFetchError.java +41 -0
- package/project/.sdk/tm/java/utility/Clean.java +2 -1
- package/project/.sdk/tm/java/utility/Fetcher.java +145 -7
- package/project/.sdk/tm/java/utility/MakeError.java +5 -0
- package/project/.sdk/tm/java/utility/MakeFetchDef.java +3 -0
- package/project/.sdk/tm/java/utility/MakeOptions.java +128 -14
- package/project/.sdk/tm/java/utility/MakePoint.java +24 -0
- package/project/.sdk/tm/java/utility/MakeRequest.java +9 -1
- package/project/.sdk/tm/java/utility/MakeSpec.java +13 -0
- package/project/.sdk/tm/java/utility/Media.java +31 -0
- package/project/.sdk/tm/java/utility/Register.java +4 -1
- package/project/.sdk/tm/java/utility/ResultBody.java +3 -0
- package/project/.sdk/tm/js/src/Control.js +1 -0
- package/project/.sdk/tm/js/src/Response.js +16 -5
- package/project/.sdk/tm/js/src/Result.js +1 -0
- package/project/.sdk/tm/js/src/feature/metrics/MetricsFeature.js +8 -3
- package/project/.sdk/tm/js/src/feature/paging/PagingFeature.js +99 -1
- package/project/.sdk/tm/js/src/feature/ratelimit/RatelimitFeature.js +5 -9
- package/project/.sdk/tm/js/src/feature/retry/RetryFeature.js +25 -3
- 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/utility/CleanUtility.js +1 -1
- package/project/.sdk/tm/js/src/utility/FetcherUtility.js +156 -4
- package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +55 -6
- package/project/.sdk/tm/js/src/utility/MakePointUtility.js +25 -2
- package/project/.sdk/tm/js/src/utility/MakeSpecUtility.js +15 -0
- package/project/.sdk/tm/js/src/utility/MediaUtility.js +18 -0
- package/project/.sdk/tm/js/src/utility/ResultBodyUtility.js +17 -0
- package/project/.sdk/tm/js/test/feature/Corpus.test.js +122 -26
- package/project/.sdk/tm/js/test/feature.test.js +14 -1
- package/project/.sdk/tm/js/test/live-runner.js +14 -4
- package/project/.sdk/tm/kotlin/core/Context.kt +5 -0
- package/project/.sdk/tm/kotlin/core/Control.kt +7 -0
- package/project/.sdk/tm/kotlin/core/Result.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/FeatureOptions.kt +39 -0
- package/project/.sdk/tm/kotlin/feature/MetricsFeature.kt +22 -0
- package/project/.sdk/tm/kotlin/feature/NetsimFeature.kt +8 -9
- package/project/.sdk/tm/kotlin/feature/PagingFeature.kt +125 -2
- package/project/.sdk/tm/kotlin/feature/RatelimitFeature.kt +13 -15
- package/project/.sdk/tm/kotlin/feature/RetryFeature.kt +41 -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 +52 -56
- package/project/.sdk/tm/kotlin/feature/TimeoutFeature.kt +25 -1
- package/project/.sdk/tm/kotlin/test/FeatureHarness.kt +1 -0
- package/project/.sdk/tm/kotlin/test/FeatureTest.kt +172 -0
- package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +1 -1
- package/project/.sdk/tm/kotlin/utility/CoreUtil.kt +2 -1
- package/project/.sdk/tm/kotlin/utility/Fetcher.kt +117 -8
- package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +109 -15
- package/project/.sdk/tm/kotlin/utility/MakePoint.kt +22 -0
- package/project/.sdk/tm/kotlin/utility/MakeReqRes.kt +8 -1
- package/project/.sdk/tm/kotlin/utility/MakeSpecUrl.kt +11 -0
- package/project/.sdk/tm/kotlin/utility/Media.kt +20 -0
- package/project/.sdk/tm/kotlin/utility/ResultTransform.kt +1 -0
- package/project/.sdk/tm/lua/core/context.lua +6 -0
- package/project/.sdk/tm/lua/core/control.lua +9 -0
- package/project/.sdk/tm/lua/core/result.lua +2 -0
- package/project/.sdk/tm/lua/feature/base_feature.lua +24 -0
- 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/netsim_feature.lua +17 -17
- package/project/.sdk/tm/lua/feature/paging_feature.lua +143 -2
- package/project/.sdk/tm/lua/feature/ratelimit_feature.lua +13 -25
- package/project/.sdk/tm/lua/feature/retry_feature.lua +50 -18
- 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 +74 -77
- package/project/.sdk/tm/lua/test/feature_test.lua +147 -3
- package/project/.sdk/tm/lua/utility/clean.lua +2 -1
- package/project/.sdk/tm/lua/utility/fetcher.lua +8 -3
- package/project/.sdk/tm/lua/utility/make_fetch_def.lua +4 -0
- package/project/.sdk/tm/lua/utility/make_options.lua +55 -13
- package/project/.sdk/tm/lua/utility/make_point.lua +24 -0
- package/project/.sdk/tm/lua/utility/make_request.lua +13 -2
- package/project/.sdk/tm/lua/utility/make_spec.lua +21 -0
- package/project/.sdk/tm/lua/utility/media.lua +33 -0
- package/project/.sdk/tm/lua/utility/result_body.lua +3 -0
- package/project/.sdk/tm/lua/utility/tls.lua +66 -4
- package/project/.sdk/tm/ocaml/sdk_features.ml +320 -77
- package/project/.sdk/tm/ocaml/sdk_helpers.ml +3 -0
- package/project/.sdk/tm/ocaml/sdk_runtime.ml +100 -16
- package/project/.sdk/tm/ocaml/sdk_types.ml +4 -0
- package/project/.sdk/tm/ocaml/test/harness.ml +1 -0
- package/project/.sdk/tm/ocaml/test/t_feature.ml +100 -1
- package/project/.sdk/tm/perl/core/context.pm +3 -0
- package/project/.sdk/tm/perl/core/control.pm +4 -0
- package/project/.sdk/tm/perl/core/helpers.pm +26 -0
- package/project/.sdk/tm/perl/core/result.pm +2 -0
- 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/netsim_feature.pm +12 -15
- package/project/.sdk/tm/perl/feature/paging_feature.pm +139 -2
- package/project/.sdk/tm/perl/feature/ratelimit_feature.pm +11 -25
- package/project/.sdk/tm/perl/feature/retry_feature.pm +27 -16
- 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 +55 -62
- package/project/.sdk/tm/perl/feature/timeout_feature.pm +5 -3
- package/project/.sdk/tm/perl/t/feature.t +2 -2
- package/project/.sdk/tm/perl/t/feature_corpus.t +147 -23
- package/project/.sdk/tm/perl/utility/clean.pm +2 -1
- package/project/.sdk/tm/perl/utility/fetcher.pm +66 -2
- package/project/.sdk/tm/perl/utility/make_fetch_def.pm +1 -0
- package/project/.sdk/tm/perl/utility/make_options.pm +33 -10
- package/project/.sdk/tm/perl/utility/make_point.pm +20 -0
- package/project/.sdk/tm/perl/utility/make_request.pm +10 -2
- package/project/.sdk/tm/perl/utility/make_spec.pm +17 -0
- package/project/.sdk/tm/perl/utility/media.pm +25 -0
- package/project/.sdk/tm/perl/utility/result_body.pm +3 -0
- package/project/.sdk/tm/php/core/Context.php +6 -0
- package/project/.sdk/tm/php/core/Control.php +12 -0
- package/project/.sdk/tm/php/core/Result.php +4 -0
- package/project/.sdk/tm/php/feature/BaseFeature.php +31 -0
- package/project/.sdk/tm/php/feature/MetricsFeature.php +8 -0
- package/project/.sdk/tm/php/feature/NetsimFeature.php +17 -15
- package/project/.sdk/tm/php/feature/PagingFeature.php +128 -1
- package/project/.sdk/tm/php/feature/RatelimitFeature.php +13 -23
- package/project/.sdk/tm/php/feature/RetryFeature.php +31 -13
- 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 +69 -61
- package/project/.sdk/tm/php/test/FeatureCorpusTest.php +175 -16
- package/project/.sdk/tm/php/test/FeatureTest.php +3 -1
- package/project/.sdk/tm/php/test/StructUtilityTest.php +5 -0
- package/project/.sdk/tm/php/utility/Clean.php +2 -1
- package/project/.sdk/tm/php/utility/Fetcher.php +111 -5
- package/project/.sdk/tm/php/utility/MakeFetchDef.php +3 -0
- package/project/.sdk/tm/php/utility/MakeOptions.php +40 -13
- package/project/.sdk/tm/php/utility/MakePoint.php +23 -0
- package/project/.sdk/tm/php/utility/MakeRequest.php +11 -2
- package/project/.sdk/tm/php/utility/MakeSpec.php +21 -0
- package/project/.sdk/tm/php/utility/Media.php +28 -0
- package/project/.sdk/tm/php/utility/ResultBody.php +3 -0
- package/project/.sdk/tm/py/pkg/core/context.py +4 -0
- package/project/.sdk/tm/py/pkg/core/control.py +9 -0
- package/project/.sdk/tm/py/pkg/core/result.py +2 -0
- package/project/.sdk/tm/py/pkg/feature/base_feature.py +23 -0
- package/project/.sdk/tm/py/pkg/feature/metrics_feature.py +7 -0
- package/project/.sdk/tm/py/pkg/feature/netsim_feature.py +13 -14
- package/project/.sdk/tm/py/pkg/feature/paging_feature.py +86 -1
- package/project/.sdk/tm/py/pkg/feature/ratelimit_feature.py +20 -27
- package/project/.sdk/tm/py/pkg/feature/retry_feature.py +39 -16
- 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 +67 -66
- package/project/.sdk/tm/py/pkg/utility/clean.py +2 -1
- package/project/.sdk/tm/py/pkg/utility/fetcher.py +451 -95
- package/project/.sdk/tm/py/pkg/utility/make_fetch_def.py +3 -0
- package/project/.sdk/tm/py/pkg/utility/make_options.py +68 -20
- package/project/.sdk/tm/py/pkg/utility/make_point.py +24 -3
- package/project/.sdk/tm/py/pkg/utility/make_request.py +11 -2
- package/project/.sdk/tm/py/pkg/utility/make_spec.py +16 -0
- package/project/.sdk/tm/py/pkg/utility/media.py +25 -0
- package/project/.sdk/tm/py/pkg/utility/requests_fetch.py +93 -0
- package/project/.sdk/tm/py/pkg/utility/result_body.py +2 -0
- package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +1 -24
- package/project/.sdk/tm/py/test/test_feature.py +11 -1
- package/project/.sdk/tm/py/test/test_feature_corpus.py +134 -16
- package/project/.sdk/tm/py/test/test_primary_utility.py +242 -48
- 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 +5 -3
- package/project/.sdk/tm/rb/core/control.rb +9 -1
- package/project/.sdk/tm/rb/core/operation.rb +5 -5
- package/project/.sdk/tm/rb/core/response.rb +7 -7
- package/project/.sdk/tm/rb/core/result.rb +11 -9
- package/project/.sdk/tm/rb/feature/base_feature.rb +22 -0
- package/project/.sdk/tm/rb/feature/cost_feature.rb +1 -1
- 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/netsim_feature.rb +7 -13
- package/project/.sdk/tm/rb/feature/paging_feature.rb +94 -8
- package/project/.sdk/tm/rb/feature/ratelimit_feature.rb +17 -27
- package/project/.sdk/tm/rb/feature/retry_feature.rb +24 -13
- package/project/.sdk/tm/rb/feature/secrets_feature.rb +4 -4
- 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 +80 -94
- package/project/.sdk/tm/rb/feature/validate_feature.rb +2 -2
- package/project/.sdk/tm/rb/test/feature/secrets/secrets_feature_test.rb +1 -1
- package/project/.sdk/tm/rb/test/feature_corpus_test.rb +128 -24
- package/project/.sdk/tm/rb/test/feature_test.rb +3 -3
- package/project/.sdk/tm/rb/test/omni.rb +7 -7
- package/project/.sdk/tm/rb/test/pipeline_test.rb +1 -1
- package/project/.sdk/tm/rb/test/runner.rb +1 -1
- package/project/.sdk/tm/rb/test/struct_utility_test.rb +120 -120
- package/project/.sdk/tm/rb/utility/clean.rb +6 -4
- package/project/.sdk/tm/rb/utility/feature_init.rb +2 -2
- package/project/.sdk/tm/rb/utility/fetcher.rb +52 -7
- package/project/.sdk/tm/rb/utility/graphql.rb +13 -13
- package/project/.sdk/tm/rb/utility/make_fetch_def.rb +1 -0
- package/project/.sdk/tm/rb/utility/make_options.rb +43 -22
- package/project/.sdk/tm/rb/utility/make_point.rb +38 -20
- package/project/.sdk/tm/rb/utility/make_request.rb +11 -2
- package/project/.sdk/tm/rb/utility/make_spec.rb +23 -6
- package/project/.sdk/tm/rb/utility/make_url.rb +6 -6
- package/project/.sdk/tm/rb/utility/media.rb +30 -11
- package/project/.sdk/tm/rb/utility/param.rb +18 -18
- package/project/.sdk/tm/rb/utility/prepare_body.rb +6 -6
- package/project/.sdk/tm/rb/utility/prepare_headers.rb +8 -8
- package/project/.sdk/tm/rb/utility/prepare_method.rb +1 -1
- package/project/.sdk/tm/rb/utility/prepare_params.rb +3 -3
- package/project/.sdk/tm/rb/utility/prepare_path.rb +2 -2
- package/project/.sdk/tm/rb/utility/prepare_query.rb +12 -12
- package/project/.sdk/tm/rb/utility/result_body.rb +1 -0
- package/project/.sdk/tm/rb/utility/struct/voxgig_struct.rb +31 -31
- package/project/.sdk/tm/rb/utility/transform_request.rb +5 -5
- package/project/.sdk/tm/rb/utility/transform_response.rb +3 -3
- package/project/.sdk/tm/rust/core/context.rs +6 -0
- package/project/.sdk/tm/rust/core/control.rs +11 -0
- package/project/.sdk/tm/rust/core/helpers.rs +4 -0
- package/project/.sdk/tm/rust/core/result.rs +9 -0
- package/project/.sdk/tm/rust/feature/audit.rs +2 -2
- package/project/.sdk/tm/rust/feature/metrics.rs +24 -1
- package/project/.sdk/tm/rust/feature/netsim.rs +11 -6
- package/project/.sdk/tm/rust/feature/paging.rs +189 -3
- package/project/.sdk/tm/rust/feature/ratelimit.rs +11 -16
- package/project/.sdk/tm/rust/feature/retry.rs +62 -9
- package/project/.sdk/tm/rust/feature/streaming.rs +3 -2
- package/project/.sdk/tm/rust/feature/support.rs +36 -1
- package/project/.sdk/tm/rust/feature/telemetry.rs +22 -11
- package/project/.sdk/tm/rust/feature/test.rs +73 -62
- package/project/.sdk/tm/rust/tests/common/mod.rs +6 -0
- package/project/.sdk/tm/rust/tests/feature_test.rs +257 -0
- package/project/.sdk/tm/rust/tests/primary_utility_test.rs +1 -0
- package/project/.sdk/tm/rust/utility/fetcher.rs +164 -17
- package/project/.sdk/tm/rust/utility/make_error.rs +10 -0
- package/project/.sdk/tm/rust/utility/make_fetch_def.rs +7 -0
- package/project/.sdk/tm/rust/utility/make_options.rs +122 -27
- package/project/.sdk/tm/rust/utility/make_point.rs +37 -0
- package/project/.sdk/tm/rust/utility/make_request.rs +13 -1
- package/project/.sdk/tm/rust/utility/make_spec.rs +27 -0
- package/project/.sdk/tm/rust/utility/media.rs +20 -0
- package/project/.sdk/tm/rust/utility/result_body.rs +3 -0
- package/project/.sdk/tm/scala/core/Context.scala +2 -0
- package/project/.sdk/tm/scala/core/Control.scala +7 -0
- package/project/.sdk/tm/scala/core/Result.scala +3 -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/FeatureOptions.scala +30 -0
- package/project/.sdk/tm/scala/feature/MetricsFeature.scala +31 -1
- package/project/.sdk/tm/scala/feature/NetsimFeature.scala +9 -8
- package/project/.sdk/tm/scala/feature/PagingFeature.scala +122 -2
- package/project/.sdk/tm/scala/feature/RatelimitFeature.scala +16 -13
- package/project/.sdk/tm/scala/feature/RetryFeature.scala +35 -12
- 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 +52 -51
- package/project/.sdk/tm/scala/feature/TimeoutFeature.scala +19 -1
- package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +72 -2
- package/project/.sdk/tm/scala/utility/Fetcher.scala +99 -8
- package/project/.sdk/tm/scala/utility/Make.scala +163 -16
- package/project/.sdk/tm/scala/utility/MakeSpec.scala +14 -0
- package/project/.sdk/tm/scala/utility/Media.scala +27 -0
- package/project/.sdk/tm/scala/utility/Misc.scala +2 -1
- package/project/.sdk/tm/scala/utility/Results.scala +3 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +2 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Control.swift +7 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Result.swift +3 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +3 -2
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/FeatureOptions.swift +32 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/MetricsFeature.swift +20 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/NetsimFeature.swift +8 -9
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/PagingFeature.swift +102 -2
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RatelimitFeature.swift +16 -15
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RetryFeature.swift +45 -11
- 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 +63 -56
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TimeoutFeature.swift +21 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Fetcher.swift +149 -4
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Make.swift +42 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +51 -13
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Media.swift +17 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +2 -1
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +165 -0
- package/project/.sdk/tm/ts/src/Control.ts +3 -0
- package/project/.sdk/tm/ts/src/Response.ts +17 -5
- package/project/.sdk/tm/ts/src/Result.ts +3 -0
- package/project/.sdk/tm/ts/src/feature/metrics/MetricsFeature.ts +5 -0
- package/project/.sdk/tm/ts/src/feature/paging/PagingFeature.ts +99 -1
- package/project/.sdk/tm/ts/src/feature/ratelimit/RatelimitFeature.ts +5 -9
- package/project/.sdk/tm/ts/src/feature/retry/RetryFeature.ts +25 -3
- 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/utility/CleanUtility.ts +1 -1
- package/project/.sdk/tm/ts/src/utility/FetcherUtility.ts +156 -4
- package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +57 -6
- package/project/.sdk/tm/ts/src/utility/MakePointUtility.ts +24 -2
- package/project/.sdk/tm/ts/src/utility/MakeSpecUtility.ts +15 -0
- package/project/.sdk/tm/ts/src/utility/MediaUtility.ts +18 -0
- package/project/.sdk/tm/ts/src/utility/ResultBodyUtility.ts +17 -0
- package/project/.sdk/tm/ts/test/feature/Corpus.test.ts +122 -26
- package/project/.sdk/tm/ts/test/feature.test.ts +14 -1
- package/project/.sdk/tm/ts/test/live-runner.ts +15 -4
- package/project/.sdk/tm/zig/core/context.zig +2 -0
- package/project/.sdk/tm/zig/core/control.zig +27 -0
- package/project/.sdk/tm/zig/core/result.zig +4 -0
- package/project/.sdk/tm/zig/core/utility.zig +185 -10
- package/project/.sdk/tm/zig/feature/metrics.zig +19 -0
- package/project/.sdk/tm/zig/feature/netsim.zig +5 -5
- package/project/.sdk/tm/zig/feature/paging.zig +172 -4
- package/project/.sdk/tm/zig/feature/ratelimit.zig +8 -14
- package/project/.sdk/tm/zig/feature/retry.zig +45 -7
- package/project/.sdk/tm/zig/feature/streaming.zig +2 -0
- package/project/.sdk/tm/zig/feature/support.zig +24 -0
- package/project/.sdk/tm/zig/feature/telemetry.zig +15 -9
- package/project/.sdk/tm/zig/feature/test.zig +60 -44
- package/project/.sdk/tm/zig/test/feature_test.zig +171 -0
- package/project/.sdk/tm/zig/test/fh.zig +1 -0
- package/project/.sdk/tm/zig/test/primary_utility_test.zig +2 -0
- package/project/sdkgen-package.json +1 -1
- package/src/action/check.ts +20 -0
- package/src/action/doctor.ts +1 -1
- package/src/action/resolve.ts +15 -3
- package/src/cmp/Deploy.ts +22 -7
- package/src/cmp/License.ts +7 -0
- package/src/cmp/ReadmeExplanation.ts +5 -2
- package/src/cmp/ReadmeFeatures.ts +21 -6
- package/src/helpers/clientOptions.ts +1 -0
- package/src/helpers/definitionPlan.ts +3 -3
- package/src/helpers/doccheck.ts +34 -11
- package/src/helpers/modelcheck.ts +67 -0
- package/src/helpers/naming.ts +1 -1
- package/src/helpers/opShape.ts +12 -3
- package/src/helpers/optspec.ts +2 -2
- package/src/helpers/packageMeta.ts +5 -7
- package/src/helpers/targetrun.ts +214 -0
- package/src/helpers/testPolicy.ts +14 -4
- package/src/sdkgen.ts +33 -11
- package/src/utility.ts +24 -0
|
@@ -46,6 +46,8 @@ object MakeError {
|
|
|
46
46
|
sdkErr.result = Clean.clean(ctx, result)
|
|
47
47
|
sdkErr.spec = Clean.clean(ctx, spec)
|
|
48
48
|
sdkErr.status = result.status
|
|
49
|
+
val cause = MakeOptions.callerCause(ctx, err)
|
|
50
|
+
if (cause != null) sdkErr.initCause(cause)
|
|
49
51
|
|
|
50
52
|
ctx.ctrl.err = sdkErr
|
|
51
53
|
|
|
@@ -203,6 +205,33 @@ object MakePoint {
|
|
|
203
205
|
// through whenever the fallback lands on the action point itself.
|
|
204
206
|
val unmatchedAction =
|
|
205
207
|
if (reqselector != null) Struct.getprop(reqselector, "$action", null) else null
|
|
208
|
+
val acting = new ArrayList[JMap[String, Object]]()
|
|
209
|
+
op.points.forEach { cand =>
|
|
210
|
+
if (unmatchedAction != null && Objects.equals(unmatchedAction,
|
|
211
|
+
Struct.getprop(Helpers.toMapAny(Struct.getprop(cand, "select")), "$action", null))) {
|
|
212
|
+
acting.add(cand)
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (!acting.isEmpty) {
|
|
216
|
+
val missing = new ArrayList[String]()
|
|
217
|
+
acting.forEach { cand =>
|
|
218
|
+
Struct.getprop(Helpers.toMapAny(Struct.getprop(cand, "select")), "exist") match {
|
|
219
|
+
case exist: JList[_] =>
|
|
220
|
+
exist.forEach { ek =>
|
|
221
|
+
val key = String.valueOf(ek)
|
|
222
|
+
if (Struct.getprop(reqselector, key, null) == null &&
|
|
223
|
+
Struct.getprop(selector, key, null) == null && !missing.contains(key)) {
|
|
224
|
+
missing.add(key)
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
case _ =>
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
throw ctx.makeError("point_no_match", "Operation \"" + op.name + "\" action \"" +
|
|
231
|
+
Struct.stringify(unmatchedAction) +
|
|
232
|
+
"\" has no endpoint whose required fields are all given (missing: " +
|
|
233
|
+
String.join(", ", missing) + ").")
|
|
234
|
+
}
|
|
206
235
|
if (unmatchedAction != null) {
|
|
207
236
|
throw ctx.makeError("point_action_invalid",
|
|
208
237
|
"Operation \"" + op.name + "\" action \"" +
|
|
@@ -274,6 +303,34 @@ object MakeOptions {
|
|
|
274
303
|
* camelCase and carry no underscore, so an underscore means the caller named
|
|
275
304
|
* something of their own rather than a member.
|
|
276
305
|
*/
|
|
306
|
+
// An exception the caller's own fetcher threw, which the SDK error keeps as
|
|
307
|
+
// its cause: the caller wrote that code, so it is not cleaned.
|
|
308
|
+
final class CallerFetchError(err: RuntimeException)
|
|
309
|
+
extends RuntimeException(err.getMessage, err, false, false)
|
|
310
|
+
|
|
311
|
+
def callerFetcher(fn: FetcherFn): FetcherFn = (ctx, fullurl, fetchdef) =>
|
|
312
|
+
try fn(ctx, fullurl, fetchdef)
|
|
313
|
+
catch {
|
|
314
|
+
case err: SdkError => throw err
|
|
315
|
+
case err: RuntimeException => throw new CallerFetchError(err)
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// The caller's exception, wherever the chain holds it, kept only when its
|
|
319
|
+
// printed trace holds nothing clean would mask: a cause reaches every log.
|
|
320
|
+
def callerCause(ctx: Context, err: Throwable): Throwable = {
|
|
321
|
+
var at = err
|
|
322
|
+
while (at != null && !at.isInstanceOf[CallerFetchError]) {
|
|
323
|
+
at = if (at.getCause eq at) null else at.getCause
|
|
324
|
+
}
|
|
325
|
+
if (at == null) null
|
|
326
|
+
else {
|
|
327
|
+
val trace = new java.io.StringWriter()
|
|
328
|
+
at.getCause.printStackTrace(new java.io.PrintWriter(trace))
|
|
329
|
+
val text = trace.toString
|
|
330
|
+
if (text == Clean.clean(ctx, text)) at.getCause else null
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
277
334
|
def overrideUtil(utility: Utility, key: String, value: Object): Boolean = {
|
|
278
335
|
if (null == key || key.isEmpty || key.contains("_") || "custom" == key) return false
|
|
279
336
|
if (null == value) return false
|
|
@@ -282,7 +339,7 @@ object MakeOptions {
|
|
|
282
339
|
val field = classOf[Utility].getDeclaredField(key)
|
|
283
340
|
if (!field.getType.isInstance(value)) return false
|
|
284
341
|
field.setAccessible(true)
|
|
285
|
-
field.set(utility, value)
|
|
342
|
+
field.set(utility, if ("fetcher" == key) callerFetcher(value.asInstanceOf[FetcherFn]) else value)
|
|
286
343
|
true
|
|
287
344
|
}
|
|
288
345
|
catch {
|
|
@@ -375,6 +432,9 @@ object MakeOptions {
|
|
|
375
432
|
case _ =>
|
|
376
433
|
}
|
|
377
434
|
|
|
435
|
+
val fdefaults = featureDefaults(config.get("feature"), opts.get("feature"))
|
|
436
|
+
if (fdefaults != null) opts.put("feature", fdefaults)
|
|
437
|
+
|
|
378
438
|
// THE OPTION SPEC IS GENERATED, NOT WRITTEN HERE.
|
|
379
439
|
//
|
|
380
440
|
// Built from the model: `main.kit.optspec` for the standard options, plus
|
|
@@ -401,19 +461,18 @@ object MakeOptions {
|
|
|
401
461
|
mergeList.add(Struct.clone(cfgopts))
|
|
402
462
|
mergeList.add(opts)
|
|
403
463
|
val merged = Struct.merge(mergeList)
|
|
464
|
+
val callbacks = holdCallbacks(merged, optspec)
|
|
404
465
|
|
|
405
|
-
//
|
|
406
|
-
val vopts = new LinkedHashMap[String, Object]()
|
|
407
|
-
vopts.put("errs", new ArrayList[Object]())
|
|
466
|
+
// A rejection quotes the value it rejected.
|
|
408
467
|
val validated =
|
|
409
|
-
try Struct.validate(merged, optspec
|
|
468
|
+
try Struct.validate(merged, optspec)
|
|
410
469
|
catch {
|
|
411
|
-
// A rejection quotes the value it rejected.
|
|
412
470
|
case err: RuntimeException =>
|
|
413
471
|
val text = if (err.getMessage == null) String.valueOf(err) else err.getMessage
|
|
414
472
|
throw new SdkError("options_invalid", Clean.cleanWith(cleancfg, text).asInstanceOf[String], ctx)
|
|
415
473
|
}
|
|
416
474
|
opts = validated.asInstanceOf[JMap[String, Object]]
|
|
475
|
+
restoreCallbacks(opts, callbacks)
|
|
417
476
|
|
|
418
477
|
// Restore the suppression the optspec default would otherwise erase.
|
|
419
478
|
if (authSuppressed) opts.put("auth", null)
|
|
@@ -457,21 +516,30 @@ object MakeOptions {
|
|
|
457
516
|
case _ =>
|
|
458
517
|
}
|
|
459
518
|
|
|
460
|
-
// Resolve the feature add-order: an explicit list order (above) wins
|
|
461
|
-
//
|
|
462
|
-
//
|
|
463
|
-
|
|
519
|
+
// Resolve the feature add-order: an explicit list order (above) wins, and
|
|
520
|
+
// the names it leaves out follow it test-first, then sorted, so the outcome
|
|
521
|
+
// is deterministic and `test` is the base transport of a map.
|
|
522
|
+
{
|
|
464
523
|
val fmap = Helpers.toMapAny(opts.get("feature"))
|
|
465
524
|
val names = new ArrayList[String]()
|
|
466
|
-
if (fmap != null)
|
|
525
|
+
if (fmap != null) fmap.keySet().forEach(n => if (!featureorder.contains(n)) names.add(n))
|
|
467
526
|
java.util.Collections.sort(names)
|
|
527
|
+
val rest = new ArrayList[Object]()
|
|
468
528
|
if (names.contains("test")) {
|
|
469
|
-
|
|
529
|
+
rest.add("test")
|
|
470
530
|
val nit = names.iterator()
|
|
471
|
-
while (nit.hasNext) { val n = nit.next(); if ("test" != n)
|
|
531
|
+
while (nit.hasNext) { val n = nit.next(); if ("test" != n) rest.add(n) }
|
|
472
532
|
} else {
|
|
473
|
-
|
|
533
|
+
rest.addAll(names)
|
|
534
|
+
}
|
|
535
|
+
// Station's transport wrap sits just outside the base transport, so a
|
|
536
|
+
// map-form activation hoists it to just after test, or first.
|
|
537
|
+
val si = rest.indexOf("station")
|
|
538
|
+
if (0 <= si) {
|
|
539
|
+
rest.remove(si)
|
|
540
|
+
rest.add(rest.indexOf("test") + 1, "station")
|
|
474
541
|
}
|
|
542
|
+
featureorder.addAll(rest)
|
|
475
543
|
}
|
|
476
544
|
|
|
477
545
|
val derived = new LinkedHashMap[String, Object]()
|
|
@@ -487,6 +555,78 @@ object MakeOptions {
|
|
|
487
555
|
opts
|
|
488
556
|
}
|
|
489
557
|
|
|
558
|
+
// This struct port's `$FUNCTION` admits only a java.util.function Function or
|
|
559
|
+
// Supplier, so a callback in a slot the spec types as a function is held out
|
|
560
|
+
// of validation and put back; any other key is still validated.
|
|
561
|
+
private def holdCallbacks(opts: Object, optspec: JMap[String, Object]): java.util.List[Array[Object]] = {
|
|
562
|
+
val held = new ArrayList[Array[Object]]()
|
|
563
|
+
val feature = Helpers.toMapAny(Helpers.toMapAny(opts) match { case null => null; case m => m.get("feature") })
|
|
564
|
+
val fspecs = Helpers.toMapAny(optspec.get("feature"))
|
|
565
|
+
if (feature != null && fspecs != null) feature.forEach((name, fopts) => {
|
|
566
|
+
val fm = Helpers.toMapAny(fopts)
|
|
567
|
+
val fspec = specMap(fspecs.get(name))
|
|
568
|
+
if (fm != null && fspec != null) new ArrayList[String](fm.keySet()).forEach(key => {
|
|
569
|
+
if (isFunctionSpec(fspec.get(key)) && isCallback(fm.get(key)))
|
|
570
|
+
held.add(Array[Object](name, key, fm.remove(key)))
|
|
571
|
+
})
|
|
572
|
+
})
|
|
573
|
+
held
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
private def specMap(spec: Object): JMap[String, Object] = spec match {
|
|
577
|
+
case alts: java.util.List[_] =>
|
|
578
|
+
val from = if (!alts.isEmpty && "`$NOF`" == alts.get(0)) 2 else 0
|
|
579
|
+
var found: JMap[String, Object] = null
|
|
580
|
+
var i = from
|
|
581
|
+
while (found == null && i < alts.size) {
|
|
582
|
+
found = Helpers.toMapAny(alts.get(i))
|
|
583
|
+
i += 1
|
|
584
|
+
}
|
|
585
|
+
found
|
|
586
|
+
case _ => Helpers.toMapAny(spec)
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
private def isFunctionSpec(spec: Object): Boolean =
|
|
590
|
+
"`$FUNCTION`" == spec || (spec match { case l: java.util.List[_] => l.contains("`$FUNCTION`"); case _ => false })
|
|
591
|
+
|
|
592
|
+
private def isCallback(v: Object): Boolean = v match {
|
|
593
|
+
case null => false
|
|
594
|
+
case _: Function0[_] | _: Function1[_, _] | _: Function2[_, _, _] | _: Function3[_, _, _, _] => true
|
|
595
|
+
case _ => v.getClass.getInterfaces.exists(i =>
|
|
596
|
+
i.isAnnotationPresent(classOf[FunctionalInterface]) || i.getName.startsWith("java.util.function."))
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
private def restoreCallbacks(opts: JMap[String, Object], held: java.util.List[Array[Object]]): Unit = {
|
|
600
|
+
val feature = Helpers.toMapAny(opts.get("feature"))
|
|
601
|
+
if (feature != null) held.forEach(h => {
|
|
602
|
+
val fm = Helpers.toMapAny(feature.get(h(0)))
|
|
603
|
+
if (fm != null) fm.put(h(1).asInstanceOf[String], h(2))
|
|
604
|
+
})
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// The model's options for a feature sit beneath the caller's, key by key: a
|
|
608
|
+
// key the caller sets replaces the default whole, so a list is never merged.
|
|
609
|
+
private def featureDefaults(cfgfeature: Object, feature: Object): JMap[String, Object] = {
|
|
610
|
+
if (feature != null && !feature.isInstanceOf[JMap[_, _]]) return null
|
|
611
|
+
val out = new LinkedHashMap[String, Object]()
|
|
612
|
+
if (feature != null) out.putAll(feature.asInstanceOf[JMap[String, Object]])
|
|
613
|
+
val cfg = Helpers.toMapAny(cfgfeature)
|
|
614
|
+
if (cfg != null) cfg.forEach((name, fdef) => {
|
|
615
|
+
val fm = Helpers.toMapAny(fdef)
|
|
616
|
+
val dflt = if (fm == null) null else Helpers.toMapAny(fm.get("options"))
|
|
617
|
+
val supplied = out.get(name)
|
|
618
|
+
val skip = dflt == null ||
|
|
619
|
+
(supplied == null && java.lang.Boolean.TRUE != dflt.get("active")) ||
|
|
620
|
+
(supplied != null && !supplied.isInstanceOf[JMap[_, _]])
|
|
621
|
+
if (!skip) {
|
|
622
|
+
val merged = new LinkedHashMap[String, Object](Helpers.toMapAny(Struct.clone(dflt)))
|
|
623
|
+
if (supplied != null) merged.putAll(supplied.asInstanceOf[JMap[String, Object]])
|
|
624
|
+
out.put(name, merged)
|
|
625
|
+
}
|
|
626
|
+
})
|
|
627
|
+
out
|
|
628
|
+
}
|
|
629
|
+
|
|
490
630
|
// A feature's name is not a field name: a feature called `secrets` does not
|
|
491
631
|
// make every one of its options a secret. Entity blocks (entity settings,
|
|
492
632
|
// seeded records) hold no credential, and nor do rbac's rules, keyed by
|
|
@@ -538,6 +678,7 @@ object MakeFetchDef {
|
|
|
538
678
|
fetchdef.put("url", url)
|
|
539
679
|
fetchdef.put("method", spec.method)
|
|
540
680
|
fetchdef.put("headers", spec.headers)
|
|
681
|
+
if (ctx.ctrl != null && ctx.ctrl.signal != null) fetchdef.put("signal", ctx.ctrl.signal)
|
|
541
682
|
|
|
542
683
|
if (spec.body != null) {
|
|
543
684
|
fetchdef.put("body", Media.requestBody(ctx.point, spec.body))
|
|
@@ -574,10 +715,16 @@ object MakeRequest {
|
|
|
574
715
|
val url = fetchdef.get("url")
|
|
575
716
|
var fetched: Object = null
|
|
576
717
|
var fetchErr: RuntimeException = null
|
|
577
|
-
try
|
|
718
|
+
try {
|
|
719
|
+
if (ctx.ctrl.cancelled) throw ctx.makeError("request_aborted", "request aborted")
|
|
720
|
+
fetched = utility.fetcher(ctx, url match { case s: String => s; case _ => "" }, fetchdef)
|
|
721
|
+
}
|
|
578
722
|
catch { case err: RuntimeException => fetchErr = err }
|
|
579
723
|
|
|
580
|
-
|
|
724
|
+
// A request that failed once its signal was done failed because of it,
|
|
725
|
+
// whatever the transport threw for it.
|
|
726
|
+
if (fetchErr != null && ctx.ctrl.cancelled) response.err = ctx.makeError("request_aborted", "request aborted")
|
|
727
|
+
else if (fetchErr != null) response.err = fetchErr
|
|
581
728
|
else if (fetched == null) {
|
|
582
729
|
val resmap = new LinkedHashMap[String, Object]()
|
|
583
730
|
resmap.put("err", ctx.makeError("request_no_response", "response: undefined"))
|
|
@@ -46,6 +46,20 @@ object MakeSpec {
|
|
|
46
46
|
ctx.spec.query = utility.prepareQuery(ctx)
|
|
47
47
|
ctx.spec.headers = utility.prepareHeaders(ctx)
|
|
48
48
|
|
|
49
|
+
// A call's accept names one declared response type, and wins over the client's.
|
|
50
|
+
if (ctx.ctrl != null && ctx.ctrl.accept != null) {
|
|
51
|
+
val want = ctx.ctrl.accept
|
|
52
|
+
val accept = Media.chosenMedia(ctx.point, want)
|
|
53
|
+
if (accept == null) {
|
|
54
|
+
val declared = String.join(", ", Media.declaredMedia(ctx.point))
|
|
55
|
+
throw ctx.makeError("spec_accept_undeclared", "Accept \"" + want +
|
|
56
|
+
"\" is not a response type operation \"" + ctx.op.name + "\" declares (declared: " +
|
|
57
|
+
(if (declared.isEmpty) "none" else declared) + ").")
|
|
58
|
+
}
|
|
59
|
+
ctx.spec.headers.keySet().removeIf((key: String) => "accept".equalsIgnoreCase(key))
|
|
60
|
+
ctx.spec.headers.put("accept", accept)
|
|
61
|
+
}
|
|
62
|
+
|
|
49
63
|
val pkind = Struct.getprop(ctx.point, "kind") match {
|
|
50
64
|
case s: String => s
|
|
51
65
|
case _ => ""
|
|
@@ -17,6 +17,33 @@ object Media {
|
|
|
17
17
|
m == "application/json" || m == "text/json" || m.endsWith("+json")
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
// Every response type a point declares, in model order.
|
|
21
|
+
def declaredMedia(point: Object): JList[String] = {
|
|
22
|
+
val res = Struct.getprop(point, "response")
|
|
23
|
+
val types = new ArrayList[String]()
|
|
24
|
+
Struct.getprop(res, "media") match { case m: String if m.nonEmpty => types.add(m); case _ => }
|
|
25
|
+
Struct.getprop(res, "alternatives") match {
|
|
26
|
+
case alts: JList[_] =>
|
|
27
|
+
alts.forEach { alt =>
|
|
28
|
+
Struct.getprop(alt, "media") match { case m: String if m.nonEmpty => types.add(m); case _ => }
|
|
29
|
+
}
|
|
30
|
+
case _ =>
|
|
31
|
+
}
|
|
32
|
+
types
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// The declared type a call names with ctrl.accept, in its declared spelling.
|
|
36
|
+
def chosenMedia(point: Object, accept: String): String = {
|
|
37
|
+
val want = accept.trim.toLowerCase(java.util.Locale.ROOT)
|
|
38
|
+
val it = declaredMedia(point).iterator()
|
|
39
|
+
var found: String = null
|
|
40
|
+
while (found == null && it.hasNext) {
|
|
41
|
+
val media = it.next()
|
|
42
|
+
if (want == media.toLowerCase(java.util.Locale.ROOT)) found = media
|
|
43
|
+
}
|
|
44
|
+
found
|
|
45
|
+
}
|
|
46
|
+
|
|
20
47
|
// The declared JSON type alone, else every declared type in the model's
|
|
21
48
|
// order; null when no success response declares a body.
|
|
22
49
|
def acceptOf(point: Object): String = {
|
|
@@ -227,7 +227,8 @@ object Clean {
|
|
|
227
227
|
val ctype = Response.headerValue(response.headers, "content-type")
|
|
228
228
|
if (Response.isBinaryResponse(ctx.point, ctype)) {
|
|
229
229
|
bodies = bodies :+ new BinaryBody(
|
|
230
|
-
List(response.body
|
|
230
|
+
List(response.body, if (ctx.result == null) null else ctx.result.text).filter(isBody),
|
|
231
|
+
if (ctype.isEmpty) null else ctype, false)
|
|
231
232
|
}
|
|
232
233
|
}
|
|
233
234
|
|
|
@@ -38,6 +38,9 @@ object ResultBody {
|
|
|
38
38
|
if (response != null && response.jsonFunc != null && response.body != null) {
|
|
39
39
|
result.body = response.jsonFunc.get()
|
|
40
40
|
}
|
|
41
|
+
if (response != null) {
|
|
42
|
+
response.body match { case text: String => result.text = text; case _ => }
|
|
43
|
+
}
|
|
41
44
|
if (response != null && response.unreadable) {
|
|
42
45
|
val sent = if (ctx.spec == null) null else ctx.spec.headers
|
|
43
46
|
result.err = Response.unreadableBody(ctx, result.status, result.headers, response.body,
|
|
@@ -57,7 +57,9 @@ public final class Context {
|
|
|
57
57
|
if let t = cm.entries["throw"]?.asBool { ctrl.throwErr = t }
|
|
58
58
|
if let e = cm.entries["explain"]?.asMap { ctrl.explain = e }
|
|
59
59
|
if let a = cm.entries["actor"]?.asString { ctrl.actor = a }
|
|
60
|
+
if let s = cm.entries["signal"]?.asNative as? () -> Bool { ctrl.signal = s }
|
|
60
61
|
if let p = cm.entries["paging"]?.asMap { ctrl.paging = p }
|
|
62
|
+
if let a = cm.entries["accept"]?.asString { ctrl.accept = a }
|
|
61
63
|
} else if let b = basectx, ctxProp(ctxmap, "opname") == nil {
|
|
62
64
|
ctrl = b.ctrl
|
|
63
65
|
}
|
|
@@ -10,6 +10,13 @@ public final class Control {
|
|
|
10
10
|
public var explain: VMap? = nil
|
|
11
11
|
public var actor: String = ""
|
|
12
12
|
public var paging: VMap? = nil
|
|
13
|
+
// Cancels the request: true once cancelled. A Task bridges its own cancel
|
|
14
|
+
// to it with withTaskCancellationHandler.
|
|
15
|
+
public var signal: (() -> Bool)? = nil
|
|
16
|
+
|
|
17
|
+
public var cancelled: Bool { signal?() == true }
|
|
18
|
+
// One of the point's declared response types, sent as Accept.
|
|
19
|
+
public var accept: String? = nil
|
|
13
20
|
|
|
14
21
|
public init() {}
|
|
15
22
|
}
|
|
@@ -8,6 +8,8 @@ public final class Result {
|
|
|
8
8
|
public var statusText: String = ""
|
|
9
9
|
public var headers: VMap = VMap()
|
|
10
10
|
public var body: Value = .noval
|
|
11
|
+
// The body verbatim, where the transport read it as text.
|
|
12
|
+
public var text: String? = nil
|
|
11
13
|
public var err: Error? = nil
|
|
12
14
|
public var resdata: Value = .noval
|
|
13
15
|
public var resmatch: VMap? = nil
|
|
@@ -31,6 +33,7 @@ public final class Result {
|
|
|
31
33
|
if let hm = getprop(m, .string("headers")).asMap { headers = hm }
|
|
32
34
|
|
|
33
35
|
body = getprop(m, .string("body"))
|
|
36
|
+
text = getprop(m, .string("text")).asString
|
|
34
37
|
|
|
35
38
|
if let e = getprop(m, .string("err")).asNative as? Error { err = e }
|
|
36
39
|
|
|
@@ -93,8 +93,9 @@ public final class AuditFeature: BaseFeature {
|
|
|
93
93
|
records.removeFirst()
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
// A sink may throw; its failure never changes the operation's outcome.
|
|
97
|
+
if let sink = gp(options, "sink").asNative as? (VMap) throws -> Void {
|
|
98
|
+
try? sink(record)
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
}
|
|
@@ -47,6 +47,38 @@ func foptSleep(_ options: VMap?) -> (Int) -> Void {
|
|
|
47
47
|
return { ms in if ms > 0 { Thread.sleep(forTimeInterval: Double(ms) / 1000.0) } }
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
// fsignal is the caller's cancellation, carried to the transport as
|
|
51
|
+
// fetchdef "signal".
|
|
52
|
+
func fsignal(_ fetchdef: VMap?) -> (() -> Bool)? {
|
|
53
|
+
return gp(fetchdef, "signal").asNative as? () -> Bool
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
func fcancelled(_ fetchdef: VMap?) -> Bool {
|
|
57
|
+
return fsignal(fetchdef)?() == true
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// fwait sleeps as foptSleep does, polling the signal; true once it is
|
|
61
|
+
// cancelled. An injected sleep is checked before and after.
|
|
62
|
+
func fwait(_ options: VMap?, _ fetchdef: VMap?, _ ms: Int) -> Bool {
|
|
63
|
+
guard let signal = fsignal(fetchdef) else {
|
|
64
|
+
foptSleep(options)(ms)
|
|
65
|
+
return false
|
|
66
|
+
}
|
|
67
|
+
if signal() { return true }
|
|
68
|
+
if ms <= 0 { return false }
|
|
69
|
+
if let fn = gp(options, "sleep").asNative as? (Int) -> Void {
|
|
70
|
+
fn(ms)
|
|
71
|
+
} else {
|
|
72
|
+
let end = Date().addingTimeInterval(Double(ms) / 1000.0)
|
|
73
|
+
while !signal() {
|
|
74
|
+
let left = end.timeIntervalSinceNow
|
|
75
|
+
if left <= 0 { break }
|
|
76
|
+
Thread.sleep(forTimeInterval: Swift.min(left, 0.01))
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return signal()
|
|
80
|
+
}
|
|
81
|
+
|
|
50
82
|
// FoptNow returns the injectable clock (option "now": () -> Int64, ms),
|
|
51
83
|
// defaulting to the wall clock.
|
|
52
84
|
func foptNow(_ options: VMap?) -> () -> Int64 {
|
|
@@ -14,6 +14,16 @@ public final class MetricsBucket {
|
|
|
14
14
|
public var totalMs: Int64 = 0
|
|
15
15
|
public var maxMs: Int64 = 0
|
|
16
16
|
public init() {}
|
|
17
|
+
|
|
18
|
+
func record() -> VMap {
|
|
19
|
+
let out = VMap()
|
|
20
|
+
out.entries["count"] = .int(Int64(count))
|
|
21
|
+
out.entries["ok"] = .int(Int64(ok))
|
|
22
|
+
out.entries["err"] = .int(Int64(err))
|
|
23
|
+
out.entries["totalMs"] = .int(totalMs)
|
|
24
|
+
out.entries["maxMs"] = .int(maxMs)
|
|
25
|
+
return out
|
|
26
|
+
}
|
|
17
27
|
}
|
|
18
28
|
|
|
19
29
|
public final class MetricsFeature: BaseFeature {
|
|
@@ -86,6 +96,16 @@ public final class MetricsFeature: BaseFeature {
|
|
|
86
96
|
|
|
87
97
|
bump(total, ok, dur)
|
|
88
98
|
bump(op, ok, dur)
|
|
99
|
+
|
|
100
|
+
// A sink may throw; its failure never changes the operation's outcome.
|
|
101
|
+
if let sink = gp(options, "sink").asNative as? (VMap) throws -> Void {
|
|
102
|
+
let opsOut = VMap()
|
|
103
|
+
for (k, b) in ops { opsOut.entries[k] = .map(b.record()) }
|
|
104
|
+
let raw = VMap()
|
|
105
|
+
raw.entries["total"] = .map(total.record())
|
|
106
|
+
raw.entries["ops"] = .map(opsOut)
|
|
107
|
+
try? sink(fclean(ctx, raw))
|
|
108
|
+
}
|
|
89
109
|
}
|
|
90
110
|
|
|
91
111
|
private func bump(_ bucket: MetricsBucket, _ ok: Bool, _ dur: Int64) {
|
|
@@ -57,7 +57,7 @@ public final class NetsimFeature: BaseFeature {
|
|
|
57
57
|
|
|
58
58
|
// Total outage: every call fails at the transport level.
|
|
59
59
|
if foptBool(opts, "offline", false) {
|
|
60
|
-
sleepMs(pickLatency())
|
|
60
|
+
try sleepMs(ctx, fetchdef, pickLatency())
|
|
61
61
|
applied.entries["offline"] = .bool(true)
|
|
62
62
|
track(ctx, applied)
|
|
63
63
|
throw ctx.makeError("netsim_offline",
|
|
@@ -66,7 +66,7 @@ public final class NetsimFeature: BaseFeature {
|
|
|
66
66
|
|
|
67
67
|
// Connection-level errors for the first N calls (e.g. ECONNRESET).
|
|
68
68
|
if call <= foptInt(opts, "errorTimes", 0) {
|
|
69
|
-
sleepMs(pickLatency())
|
|
69
|
+
try sleepMs(ctx, fetchdef, pickLatency())
|
|
70
70
|
applied.entries["error"] = .bool(true)
|
|
71
71
|
track(ctx, applied)
|
|
72
72
|
throw ctx.makeError("netsim_conn",
|
|
@@ -75,7 +75,7 @@ public final class NetsimFeature: BaseFeature {
|
|
|
75
75
|
|
|
76
76
|
// Rate-limit responses (HTTP 429 + Retry-After) for the first N calls.
|
|
77
77
|
if call <= foptInt(opts, "rateLimitTimes", 0) {
|
|
78
|
-
sleepMs(pickLatency())
|
|
78
|
+
try sleepMs(ctx, fetchdef, pickLatency())
|
|
79
79
|
applied.entries["rateLimited"] = .bool(true)
|
|
80
80
|
track(ctx, applied)
|
|
81
81
|
let extra = VMap()
|
|
@@ -95,7 +95,7 @@ public final class NetsimFeature: BaseFeature {
|
|
|
95
95
|
let failRate = foptNum(opts, "failRate", 0)
|
|
96
96
|
let failByRate = failRate > 0 && rand() < failRate
|
|
97
97
|
if failByCount || failByEvery || failByRate {
|
|
98
|
-
sleepMs(pickLatency())
|
|
98
|
+
try sleepMs(ctx, fetchdef, pickLatency())
|
|
99
99
|
applied.entries["failStatus"] = .int(Int64(failStatus))
|
|
100
100
|
track(ctx, applied)
|
|
101
101
|
let extra = VMap()
|
|
@@ -107,7 +107,7 @@ public final class NetsimFeature: BaseFeature {
|
|
|
107
107
|
let latency = pickLatency()
|
|
108
108
|
applied.entries["latency"] = .int(Int64(latency))
|
|
109
109
|
track(ctx, applied)
|
|
110
|
-
sleepMs(latency)
|
|
110
|
+
try sleepMs(ctx, fetchdef, latency)
|
|
111
111
|
return try inner(ctx, url, fetchdef)
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -129,11 +129,10 @@ public final class NetsimFeature: BaseFeature {
|
|
|
129
129
|
return fixedMs < 0 ? 0 : fixedMs
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
private func sleepMs(_ ms: Int) {
|
|
133
|
-
if
|
|
134
|
-
|
|
132
|
+
private func sleepMs(_ ctx: Context, _ fetchdef: VMap, _ ms: Int) throws {
|
|
133
|
+
if fwait(options, fetchdef, ms) {
|
|
134
|
+
throw ctx.makeError("request_aborted", "request aborted")
|
|
135
135
|
}
|
|
136
|
-
foptSleep(options)(ms)
|
|
137
136
|
}
|
|
138
137
|
|
|
139
138
|
// Rand yields a deterministic 0..1 pseudo-random via a linear congruential
|
|
@@ -65,6 +65,9 @@ public final class PagingFeature: BaseFeature {
|
|
|
65
65
|
|
|
66
66
|
if hasCursor {
|
|
67
67
|
spec.query.entries[cursorParam] = cursor
|
|
68
|
+
} else if let paging = paging, let link = gp(paging, "next").asString,
|
|
69
|
+
!PagingFeature.foreign(link, spec.base) {
|
|
70
|
+
PagingFeature.follow(spec, link)
|
|
68
71
|
} else if isNil(gp(spec.query, pageParam)) {
|
|
69
72
|
var page: Value? = nil
|
|
70
73
|
if let paging = paging {
|
|
@@ -183,8 +186,12 @@ public final class PagingFeature: BaseFeature {
|
|
|
183
186
|
// Body-level signals; snake_case forms are read first so camelCase wins.
|
|
184
187
|
if let bm = body.asMap {
|
|
185
188
|
let next = gp(bm, "next")
|
|
186
|
-
if !isNil(next)
|
|
187
|
-
|
|
189
|
+
if !isNil(next) {
|
|
190
|
+
if !PagingFeature.isLink(next.asString, foptStr(options, "next", "auto")) {
|
|
191
|
+
paging.entries["cursor"] = next
|
|
192
|
+
} else if isNil(gp(paging, "next")) {
|
|
193
|
+
paging.entries["next"] = next
|
|
194
|
+
}
|
|
188
195
|
}
|
|
189
196
|
let snakeCursor = gp(bm, "next_cursor")
|
|
190
197
|
if !isNil(snakeCursor) {
|
|
@@ -216,6 +223,16 @@ public final class PagingFeature: BaseFeature {
|
|
|
216
223
|
}
|
|
217
224
|
}
|
|
218
225
|
|
|
226
|
+
// A link to another origin is recorded, never followed, and ends the walk.
|
|
227
|
+
let base = ctx.spec?.base ?? gp(ctx.options, "base").asString ?? ""
|
|
228
|
+
if let link = gp(paging, "next").asString, let spec = ctx.spec {
|
|
229
|
+
paging.entries["next"] = .string(PagingFeature.resolve(link, spec.url))
|
|
230
|
+
}
|
|
231
|
+
if let link = gp(paging, "next").asString, PagingFeature.foreign(link, base) {
|
|
232
|
+
paging.entries["foreign"] = .string(link)
|
|
233
|
+
_ = paging.entries.removeValue(forKey: "next")
|
|
234
|
+
}
|
|
235
|
+
|
|
219
236
|
// Cursor presence only INFERS another page. When the server stated the
|
|
220
237
|
// answer outright - relay's `hasNextPage: false`, or a body `hasMore` -
|
|
221
238
|
// that wins: a final page normally carries both an end cursor and
|
|
@@ -227,6 +244,10 @@ public final class PagingFeature: BaseFeature {
|
|
|
227
244
|
paging.entries["hasMore"] = .bool(true)
|
|
228
245
|
}
|
|
229
246
|
|
|
247
|
+
if !isNil(gp(paging, "foreign")) && isNil(gp(paging, "cursor")) && isNil(gp(paging, "nextPage")) {
|
|
248
|
+
paging.entries["hasMore"] = .bool(false)
|
|
249
|
+
}
|
|
250
|
+
|
|
230
251
|
result.paging = paging
|
|
231
252
|
last = paging
|
|
232
253
|
|
|
@@ -239,6 +260,85 @@ public final class PagingFeature: BaseFeature {
|
|
|
239
260
|
}
|
|
240
261
|
}
|
|
241
262
|
|
|
263
|
+
private static let origin = try! NSRegularExpression(
|
|
264
|
+
pattern: "^[a-z][a-z0-9+.-]*://[^/?#]*", options: [.caseInsensitive])
|
|
265
|
+
|
|
266
|
+
private static func originOf(_ text: String) -> String {
|
|
267
|
+
let range = NSRange(text.startIndex..., in: text)
|
|
268
|
+
guard let m = origin.firstMatch(in: text, options: [], range: range),
|
|
269
|
+
let r = Range(m.range, in: text) else {
|
|
270
|
+
return ""
|
|
271
|
+
}
|
|
272
|
+
return String(text[r])
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// Under the `next` option's default, a URL or an absolute path is a link and
|
|
276
|
+
// anything else a cursor; `cursor` and `url` pin the reading.
|
|
277
|
+
static func isLink(_ next: String?, _ mode: String) -> Bool {
|
|
278
|
+
guard let next = next else { return false }
|
|
279
|
+
return mode == "url" || (mode != "cursor" && (originOf(next) != "" || next.hasPrefix("/")))
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
static func foreign(_ link: String, _ base: String) -> Bool {
|
|
283
|
+
let origin = originOf(link).lowercased()
|
|
284
|
+
return origin != "" && origin != originOf(base).lowercased()
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
private static let scheme = try! NSRegularExpression(
|
|
288
|
+
pattern: "^[a-z][a-z0-9+.-]*:", options: [.caseInsensitive])
|
|
289
|
+
|
|
290
|
+
// RFC 3986 reference resolution against the URL of the request that
|
|
291
|
+
// returned the link. A link on that URL's origin comes back as its path and
|
|
292
|
+
// query; an absolute link is left as the server wrote it.
|
|
293
|
+
static func resolve(_ link: String, _ url: String) -> String {
|
|
294
|
+
if url.isEmpty || nil != scheme.firstMatch(in: link, options: [], range: NSRange(link.startIndex..., in: link)) {
|
|
295
|
+
return link
|
|
296
|
+
}
|
|
297
|
+
let holder = "http://placeholder.invalid" + (url.hasPrefix("/") ? "" : "/")
|
|
298
|
+
guard let from = URL(string: originOf(url).isEmpty ? holder + url : url),
|
|
299
|
+
let to = URL(string: link, relativeTo: from)?.absoluteURL,
|
|
300
|
+
var parts = URLComponents(url: to, resolvingAgainstBaseURL: false) else {
|
|
301
|
+
return link
|
|
302
|
+
}
|
|
303
|
+
parts.fragment = nil
|
|
304
|
+
if to.scheme != from.scheme || to.host != from.host || to.port != from.port {
|
|
305
|
+
return parts.string ?? link
|
|
306
|
+
}
|
|
307
|
+
return parts.percentEncodedPath + (nil == parts.percentEncodedQuery ? "" : "?" + parts.percentEncodedQuery!)
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// The request goes to the link's path and query, on the SDK's own origin.
|
|
311
|
+
static func follow(_ spec: Spec, _ next: String) {
|
|
312
|
+
var rest = String(next.dropFirst(originOf(next).count))
|
|
313
|
+
if let hash = rest.firstIndex(of: "#") {
|
|
314
|
+
rest = String(rest[..<hash])
|
|
315
|
+
}
|
|
316
|
+
let parts = rest.split(separator: "?", maxSplits: 1, omittingEmptySubsequences: false)
|
|
317
|
+
let path = parts.isEmpty ? "" : String(parts[0])
|
|
318
|
+
let rawquery = parts.count > 1 ? String(parts[1]) : ""
|
|
319
|
+
|
|
320
|
+
let query = VMap()
|
|
321
|
+
for pair in rawquery.split(separator: "&") {
|
|
322
|
+
let kv = pair.split(separator: "=", maxSplits: 1, omittingEmptySubsequences: false)
|
|
323
|
+
let key = unescape(String(kv[0]))
|
|
324
|
+
query.entries[key] = .string(unescape(kv.count > 1 ? String(kv[1]) : ""))
|
|
325
|
+
}
|
|
326
|
+
for key in spec.authquery {
|
|
327
|
+
query.entries[key] = gp(spec.query, key)
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
spec.base = originOf(spec.base)
|
|
331
|
+
spec.prefix = ""
|
|
332
|
+
spec.path = path
|
|
333
|
+
spec.suffix = ""
|
|
334
|
+
spec.query = query
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
private static func unescape(_ text: String) -> String {
|
|
338
|
+
let spaced = text.replacingOccurrences(of: "+", with: " ")
|
|
339
|
+
return spaced.removingPercentEncoding ?? spaced
|
|
340
|
+
}
|
|
341
|
+
|
|
242
342
|
private func isList(_ ctx: Context) -> Bool {
|
|
243
343
|
let opname = ctx.op?.name ?? ""
|
|
244
344
|
let ops = foptStrList(options, "ops") ?? ["list"]
|