@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
|
@@ -113,6 +113,23 @@ func makePointUtil(_ ctx: Context) throws -> VMap? {
|
|
|
113
113
|
// the chosen point's $action and would wave the request through
|
|
114
114
|
// whenever the fallback lands on the action point itself.
|
|
115
115
|
let unmatchedAction = gp(reqselector, "$action")
|
|
116
|
+
let acting = isNil(unmatchedAction) ? [] :
|
|
117
|
+
op.points.filter { unmatchedAction == gp(gp($0, "select"), "$action") }
|
|
118
|
+
if !acting.isEmpty {
|
|
119
|
+
var missing: [String] = []
|
|
120
|
+
for cand in acting {
|
|
121
|
+
for ek in gp(gp(cand, "select"), "exist").asList?.items ?? [] {
|
|
122
|
+
let key = ek.asString ?? stringify(ek)
|
|
123
|
+
if isNil(getprop(.map(reqselector), .string(key))) &&
|
|
124
|
+
isNil(getprop(.map(selector), .string(key))) && !missing.contains(key) {
|
|
125
|
+
missing.append(key)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
throw ctx.makeError("point_no_match",
|
|
130
|
+
"Operation \"\(op.name)\" action \"\(stringify(unmatchedAction))\" has no endpoint " +
|
|
131
|
+
"whose required fields are all given (missing: \(missing.joined(separator: ", "))).")
|
|
132
|
+
}
|
|
116
133
|
if !isNil(unmatchedAction) {
|
|
117
134
|
throw ctx.makeError("point_action_invalid",
|
|
118
135
|
"Operation \"\(op.name)\" action \"\(stringify(unmatchedAction))\" is not valid.")
|
|
@@ -223,6 +240,20 @@ func makeSpecUtil(_ ctx: Context) throws -> Spec {
|
|
|
223
240
|
ctx.spec!.query = utility.prepareQuery(ctx)
|
|
224
241
|
ctx.spec!.headers = utility.prepareHeaders(ctx)
|
|
225
242
|
|
|
243
|
+
// A call's accept names one declared response type, and wins over the client's.
|
|
244
|
+
if let want = ctx.ctrl.accept {
|
|
245
|
+
guard let accept = chosenMedia(ctx.point, want) else {
|
|
246
|
+
let declared = declaredMedia(ctx.point).joined(separator: ", ")
|
|
247
|
+
throw ctx.makeError("spec_accept_undeclared",
|
|
248
|
+
"Accept \"\(want)\" is not a response type operation \"\(ctx.op?.name ?? "")\" declares " +
|
|
249
|
+
"(declared: \(declared.isEmpty ? "none" : declared)).")
|
|
250
|
+
}
|
|
251
|
+
for key in ctx.spec!.headers.entries.keys where "accept" == key.lowercased() {
|
|
252
|
+
ctx.spec!.headers.entries[key] = nil
|
|
253
|
+
}
|
|
254
|
+
ctx.spec!.headers.entries["accept"] = .string(accept)
|
|
255
|
+
}
|
|
256
|
+
|
|
226
257
|
if "graphql" == gp(ctx.point, "kind").asString {
|
|
227
258
|
// GraphQL addresses one endpoint: no path parts, no query string, and
|
|
228
259
|
// the body carries the operation. prepareBody is skipped deliberately —
|
|
@@ -339,6 +370,9 @@ func makeFetchDefUtil(_ ctx: Context) throws -> VMap {
|
|
|
339
370
|
fetchdef.entries["url"] = .string(url)
|
|
340
371
|
fetchdef.entries["method"] = .string(spec.method)
|
|
341
372
|
fetchdef.entries["headers"] = .map(spec.headers)
|
|
373
|
+
if let signal = ctx.ctrl.signal {
|
|
374
|
+
fetchdef.entries["signal"] = .nat(signal)
|
|
375
|
+
}
|
|
342
376
|
|
|
343
377
|
if !isNil(spec.body) {
|
|
344
378
|
fetchdef.entries["body"] = requestBody(ctx.point, spec.body)
|
|
@@ -381,12 +415,19 @@ func makeRequestUtil(_ ctx: Context) throws -> Response {
|
|
|
381
415
|
var fetched: Value = .noval
|
|
382
416
|
var fetchErr: Error? = nil
|
|
383
417
|
do {
|
|
418
|
+
if ctx.ctrl.cancelled {
|
|
419
|
+
throw ctx.makeError("request_aborted", "request aborted")
|
|
420
|
+
}
|
|
384
421
|
fetched = try utility.fetcher(ctx, url, fetchdef)
|
|
385
422
|
} catch {
|
|
386
423
|
fetchErr = error
|
|
387
424
|
}
|
|
388
425
|
|
|
389
|
-
|
|
426
|
+
// A request that failed once its signal cancelled failed because of it,
|
|
427
|
+
// whatever the transport threw for it.
|
|
428
|
+
if fetchErr != nil && ctx.ctrl.cancelled {
|
|
429
|
+
response.err = ctx.makeError("request_aborted", "request aborted")
|
|
430
|
+
} else if let fe = fetchErr {
|
|
390
431
|
response.err = fe
|
|
391
432
|
} else if isNil(fetched) {
|
|
392
433
|
let m = VMap()
|
|
@@ -97,6 +97,10 @@ func makeOptionsUtil(_ ctx: Context) -> VMap {
|
|
|
97
97
|
opts.entries["feature"] = .map(fmap)
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
if let fdefaults = featureDefaults(gp(config, "feature"), opts.entries["feature"] ?? .noval) {
|
|
101
|
+
opts.entries["feature"] = .map(fdefaults)
|
|
102
|
+
}
|
|
103
|
+
|
|
100
104
|
// THE OPTION SPEC IS GENERATED, NOT WRITTEN HERE.
|
|
101
105
|
//
|
|
102
106
|
// Built from the model: `main.kit.optspec` for the standard options, plus
|
|
@@ -119,7 +123,16 @@ func makeOptionsUtil(_ ctx: Context) -> VMap {
|
|
|
119
123
|
// so without this one client's options (headers, server, ...) are written
|
|
120
124
|
// into the shared config and inherited by every client built afterwards.
|
|
121
125
|
let merged = merge(.list([.map(VMap()), clone(.map(cfgopts)), .map(opts)]))
|
|
122
|
-
let
|
|
126
|
+
let vinj = Injection(val: .noval, parent: .noval)
|
|
127
|
+
vinj.errs = VList()
|
|
128
|
+
let validated = (try? validate(merged, optspec, vinj)) ?? .noval
|
|
129
|
+
if !vinj.errs.items.isEmpty {
|
|
130
|
+
let verrs = vinj.errs
|
|
131
|
+
// The initializer cannot throw, so a construction error traps, as zig's panics.
|
|
132
|
+
let text = verrs.items.map { $0.asString ?? stringify($0) }.joined(separator: " | ")
|
|
133
|
+
fatalError(errMessage(ProjectNameError("options_invalid",
|
|
134
|
+
cleanUtil(cleanctx, .string("invalid options: " + text)).asString ?? "invalid options", nil)))
|
|
135
|
+
}
|
|
123
136
|
let result = validated.asMap ?? VMap()
|
|
124
137
|
|
|
125
138
|
// Restore the suppression the optspec default would otherwise erase.
|
|
@@ -148,17 +161,19 @@ func makeOptionsUtil(_ ctx: Context) -> VMap {
|
|
|
148
161
|
}
|
|
149
162
|
}
|
|
150
163
|
|
|
151
|
-
// Resolve the feature add-order: an explicit list order (above) wins
|
|
152
|
-
//
|
|
153
|
-
//
|
|
154
|
-
|
|
164
|
+
// Resolve the feature add-order: an explicit list order (above) wins, and
|
|
165
|
+
// the names it leaves out follow it test-first, then sorted, so the outcome
|
|
166
|
+
// is deterministic and `test` is the base transport of a map.
|
|
167
|
+
do {
|
|
155
168
|
let fmap = gp(result, "feature").asMap ?? VMap()
|
|
156
|
-
let
|
|
169
|
+
let given = Set(featureorder.compactMap { $0.asString })
|
|
170
|
+
let names = fmap.entries.keys.filter { !given.contains($0) }.sorted()
|
|
171
|
+
var rest: [Value] = []
|
|
157
172
|
if names.contains("test") {
|
|
158
|
-
|
|
159
|
-
for n in names where n != "test" {
|
|
173
|
+
rest.append(.string("test"))
|
|
174
|
+
for n in names where n != "test" { rest.append(.string(n)) }
|
|
160
175
|
} else {
|
|
161
|
-
for n in names {
|
|
176
|
+
for n in names { rest.append(.string(n)) }
|
|
162
177
|
}
|
|
163
178
|
|
|
164
179
|
// Station special case, mirroring test's: its transport wrap must
|
|
@@ -167,11 +182,12 @@ func makeOptionsUtil(_ ctx: Context) -> VMap {
|
|
|
167
182
|
// test - or first, when no test entry exists. Without this the
|
|
168
183
|
// sorted default would init station last and wrap OUTSIDE the
|
|
169
184
|
// recording features, turning its wire-truth events into fiction.
|
|
170
|
-
if let si =
|
|
171
|
-
|
|
172
|
-
let ti =
|
|
173
|
-
|
|
185
|
+
if let si = rest.firstIndex(where: { $0.asString == "station" }) {
|
|
186
|
+
rest.remove(at: si)
|
|
187
|
+
let ti = rest.firstIndex(where: { $0.asString == "test" })
|
|
188
|
+
rest.insert(.string("station"), at: (ti ?? -1) + 1)
|
|
174
189
|
}
|
|
190
|
+
featureorder.append(contentsOf: rest)
|
|
175
191
|
}
|
|
176
192
|
|
|
177
193
|
let derived = VMap()
|
|
@@ -187,6 +203,28 @@ func makeOptionsUtil(_ ctx: Context) -> VMap {
|
|
|
187
203
|
return result
|
|
188
204
|
}
|
|
189
205
|
|
|
206
|
+
// The model's options for a feature sit beneath the caller's, key by key: a
|
|
207
|
+
// key the caller sets replaces the default whole, so a list is never merged.
|
|
208
|
+
private func featureDefaults(_ cfgfeature: Value, _ feature: Value) -> VMap? {
|
|
209
|
+
if !isNil(feature) && feature.asMap == nil {
|
|
210
|
+
return nil
|
|
211
|
+
}
|
|
212
|
+
let out = VMap()
|
|
213
|
+
for (k, v) in feature.asMap?.entries ?? [:] { out.entries[k] = v }
|
|
214
|
+
for (name, fdef) in cfgfeature.asMap?.entries ?? [:] {
|
|
215
|
+
guard let dflt = gp(fdef, "options").asMap else { continue }
|
|
216
|
+
let given = out.entries[name] ?? .noval
|
|
217
|
+
if (isNil(given) && gp(.map(dflt), "active") != .bool(true)) ||
|
|
218
|
+
(!isNil(given) && given.asMap == nil) {
|
|
219
|
+
continue
|
|
220
|
+
}
|
|
221
|
+
let merged = clone(.map(dflt)).asMap ?? VMap()
|
|
222
|
+
for (k, v) in given.asMap?.entries ?? [:] { merged.entries[k] = v }
|
|
223
|
+
out.entries[name] = .map(merged)
|
|
224
|
+
}
|
|
225
|
+
return out
|
|
226
|
+
}
|
|
227
|
+
|
|
190
228
|
// A templated base URL takes each {name} from options.server. An empty value
|
|
191
229
|
// cannot make a working URL, so it is an error, except in test mode, where it
|
|
192
230
|
// becomes test-<name>.
|
|
@@ -16,6 +16,23 @@ func isJsonMedia(_ v: Value) -> Bool {
|
|
|
16
16
|
|
|
17
17
|
// The declared JSON type alone, else every declared type in the model's
|
|
18
18
|
// order; nil when no success response declares a body.
|
|
19
|
+
// Every response type a point declares, in model order.
|
|
20
|
+
func declaredMedia(_ point: VMap?) -> [String] {
|
|
21
|
+
let res = gp(point, "response")
|
|
22
|
+
var types: [String] = []
|
|
23
|
+
if let media = gp(res, "media").asString, media != "" { types.append(media) }
|
|
24
|
+
for alt in gp(res, "alternatives").asList?.items ?? [] {
|
|
25
|
+
if let m = gp(alt, "media").asString, m != "" { types.append(m) }
|
|
26
|
+
}
|
|
27
|
+
return types
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// The declared type a call names with ctrl.accept, in its declared spelling.
|
|
31
|
+
func chosenMedia(_ point: VMap?, _ accept: String) -> String? {
|
|
32
|
+
let want = accept.trimmingCharacters(in: .whitespaces).lowercased()
|
|
33
|
+
return declaredMedia(point).first { want == $0.lowercased() }
|
|
34
|
+
}
|
|
35
|
+
|
|
19
36
|
func acceptOf(_ point: VMap?) -> String? {
|
|
20
37
|
let res = gp(point, "response")
|
|
21
38
|
guard let media = gp(res, "media").asString, media != "" else { return nil }
|
|
@@ -34,6 +34,7 @@ func resultBodyUtil(_ ctx: Context) -> Result {
|
|
|
34
34
|
if let jf = response?.jsonFunc, let resp = response, !isNil(resp.body) {
|
|
35
35
|
result.body = jf()
|
|
36
36
|
}
|
|
37
|
+
if let text = response?.body.asString { result.text = text }
|
|
37
38
|
if let resp = response, resp.unreadable {
|
|
38
39
|
let sent: Value = ctx.spec == nil ? .noval : .map(ctx.spec!.headers)
|
|
39
40
|
result.err = Response.unreadableBody(
|
|
@@ -362,7 +363,7 @@ private func cleanBinaryBodiesOf(
|
|
|
362
363
|
let type = Response.headerValue(response.headers, "content-type")
|
|
363
364
|
if Response.isBinary(ctx.point, type) {
|
|
364
365
|
bodies.append(Utility.CleanBinaryBody(
|
|
365
|
-
live: known([response.body]), media: type.isEmpty ? nil : type, sized: false))
|
|
366
|
+
live: known([response.body, ctx.result?.text.map { Value.string($0) } ?? .noval]), media: type.isEmpty ? nil : type, sized: false))
|
|
366
367
|
}
|
|
367
368
|
}
|
|
368
369
|
|
|
@@ -122,6 +122,7 @@ final class FhHarness {
|
|
|
122
122
|
fetchdef.entries["method"] = .string(ctx.spec!.method)
|
|
123
123
|
fetchdef.entries["headers"] = .map(ctx.spec!.headers)
|
|
124
124
|
if !isNil(ctx.spec!.body) { fetchdef.entries["body"] = ctx.spec!.body }
|
|
125
|
+
if let signal = ctx.ctrl.signal { fetchdef.entries["signal"] = .nat(signal) }
|
|
125
126
|
|
|
126
127
|
var response: Value = .noval
|
|
127
128
|
var fetchErr: Error?
|
|
@@ -516,6 +517,59 @@ final class FeatureRatelimitTest: XCTestCase {
|
|
|
516
517
|
}
|
|
517
518
|
}
|
|
518
519
|
|
|
520
|
+
// --- cancel ------------------------------------------------------------------
|
|
521
|
+
|
|
522
|
+
// A cancelled signal ends each wait at once, and the call fails as
|
|
523
|
+
// request_aborted.
|
|
524
|
+
final class FeatureCancelTest: XCTestCase {
|
|
525
|
+
private func cancelling(_ ms: Double) -> VMap {
|
|
526
|
+
let at = Date().addingTimeInterval(ms / 1000.0)
|
|
527
|
+
return vm(("signal", .nat({ Date() >= at } as () -> Bool)))
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
private func aborted(_ res: FhOpResult, _ started: Date) {
|
|
531
|
+
XCTAssertFalse(res.ok, "a cancelled call succeeded")
|
|
532
|
+
XCTAssertEqual(Fh.errCode(res.err), "request_aborted")
|
|
533
|
+
XCTAssertLessThan(Date().timeIntervalSince(started), 5.0)
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
func testCancelEndsTheRetryBackoff() {
|
|
537
|
+
if Fh.skipWithout("retry") { return }
|
|
538
|
+
let rec = FhRecorder()
|
|
539
|
+
rec.reply = { _, _ in Fh.response(503, .noval, nil) }
|
|
540
|
+
let h = Fh.make(rec.fetch, (RetryFeature(), vm(("retries", .int(3)), ("minDelay", .int(20000)),
|
|
541
|
+
("maxDelay", .int(20000)), ("jitter", .bool(false)))))
|
|
542
|
+
let started = Date()
|
|
543
|
+
aborted(h.op(FhOpSpec(op: "load", ctrl: cancelling(50))), started)
|
|
544
|
+
XCTAssertEqual(rec.calls.count, 1)
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
func testCancelEndsTheNetsimLatency() {
|
|
548
|
+
if Fh.skipWithout("netsim") { return }
|
|
549
|
+
let h = Fh.make(nil, (NetsimFeature(), vm(("latency", .int(20000)))))
|
|
550
|
+
let started = Date()
|
|
551
|
+
aborted(h.op(FhOpSpec(op: "load", ctrl: cancelling(50))), started)
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
func testCancelEndsTheRatelimitWait() {
|
|
555
|
+
if Fh.skipWithout("ratelimit") { return }
|
|
556
|
+
let h = Fh.make(nil, (RatelimitFeature(), vm(("rate", .double(0.05)), ("burst", .int(1)))))
|
|
557
|
+
XCTAssertTrue(h.op(FhOpSpec(op: "load")).ok)
|
|
558
|
+
let started = Date()
|
|
559
|
+
aborted(h.op(FhOpSpec(op: "load", ctrl: cancelling(50))), started)
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
func testCancelEndsTheTimeoutWait() {
|
|
563
|
+
if Fh.skipWithout("timeout") { return }
|
|
564
|
+
let rec = FhRecorder()
|
|
565
|
+
rec.reply = { _, _ in Thread.sleep(forTimeInterval: 3); return Fh.response(200, .noval, nil) }
|
|
566
|
+
let h = Fh.make(rec.fetch, (TimeoutFeature(), vm(("ms", .int(20000)))))
|
|
567
|
+
let started = Date()
|
|
568
|
+
aborted(h.op(FhOpSpec(op: "load", ctrl: cancelling(50))), started)
|
|
569
|
+
XCTAssertLessThan(Date().timeIntervalSince(started), 2.0)
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
519
573
|
// --- cache -------------------------------------------------------------------
|
|
520
574
|
|
|
521
575
|
final class FeatureCacheTest: XCTestCase {
|
|
@@ -1048,6 +1102,96 @@ final class FeaturePagingTest: XCTestCase {
|
|
|
1048
1102
|
XCTAssertEqual(res.result!.paging!.entries["hasMore"], .bool(true))
|
|
1049
1103
|
}
|
|
1050
1104
|
|
|
1105
|
+
// The documented hasMore loop, one request per page.
|
|
1106
|
+
private func walk(_ reply: @escaping (Int) -> Value, _ options: VMap? = nil) -> ([String], VMap) {
|
|
1107
|
+
let rec = FhRecorder()
|
|
1108
|
+
rec.reply = { n, _ in reply(n) }
|
|
1109
|
+
let h = Fh.make(rec.fetch, (PagingFeature(), options))
|
|
1110
|
+
let paging = VMap()
|
|
1111
|
+
let ctrl = vm(("paging", .map(paging)))
|
|
1112
|
+
_ = h.op(FhOpSpec(op: "list", path: "/w", ctrl: ctrl))
|
|
1113
|
+
while paging.entries["hasMore"] == .bool(true) && rec.calls.count < 4 {
|
|
1114
|
+
_ = h.op(FhOpSpec(op: "list", path: "/w", ctrl: ctrl))
|
|
1115
|
+
}
|
|
1116
|
+
return ((0..<rec.calls.count).map { rec.url($0) }, paging)
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
func testBodyNextIsSentAsTheCursor() {
|
|
1120
|
+
if Fh.skipWithout("paging") { return }
|
|
1121
|
+
let pages: [Value] = [.string("c3"), .string("c6"), .null]
|
|
1122
|
+
let (urls, paging) = walk { n in Fh.response(200, mapv(("next", pages[n - 1])), nil) }
|
|
1123
|
+
XCTAssertEqual(urls, [
|
|
1124
|
+
"http://api.test/w?page=1", "http://api.test/w?cursor=c3", "http://api.test/w?cursor=c6",
|
|
1125
|
+
])
|
|
1126
|
+
XCTAssertEqual(paging.entries["hasMore"], .bool(false))
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
func testBodyNextUrlIsTheNextRequest() {
|
|
1130
|
+
if Fh.skipWithout("paging") { return }
|
|
1131
|
+
let pages: [Value] = [
|
|
1132
|
+
.string("http://api.test/v2/w?cursor=c%2F3&limit=3"), .string("/v2/w?cursor=c6"), .null,
|
|
1133
|
+
]
|
|
1134
|
+
let (urls, paging) = walk { n in Fh.response(200, mapv(("next", pages[n - 1])), nil) }
|
|
1135
|
+
XCTAssertEqual(urls, [
|
|
1136
|
+
"http://api.test/w?page=1", "http://api.test/v2/w?cursor=c%2F3&limit=3",
|
|
1137
|
+
"http://api.test/v2/w?cursor=c6",
|
|
1138
|
+
])
|
|
1139
|
+
XCTAssertEqual(paging.entries["hasMore"], .bool(false))
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
func testLinkNextUrlIsTheNextRequest() {
|
|
1143
|
+
if Fh.skipWithout("paging") { return }
|
|
1144
|
+
let links = ["<http://api.test/w?after=b3>; rel=\"next\"", "</w?after=b6>; rel=\"next\""]
|
|
1145
|
+
let (urls, paging) = walk { n in
|
|
1146
|
+
Fh.response(200, .list([]), n <= links.count ? vm(("link", .string(links[n - 1]))) : nil)
|
|
1147
|
+
}
|
|
1148
|
+
XCTAssertEqual(urls, [
|
|
1149
|
+
"http://api.test/w?page=1", "http://api.test/w?after=b3", "http://api.test/w?after=b6",
|
|
1150
|
+
])
|
|
1151
|
+
XCTAssertEqual(paging.entries["hasMore"], .bool(false))
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
func testQueryOnlyLinkKeepsThePath() {
|
|
1155
|
+
if Fh.skipWithout("paging") { return }
|
|
1156
|
+
let links = ["</v1/items?page=2>; rel=\"next\"", "<?page=3>; rel=\"next\""]
|
|
1157
|
+
let (urls, _) = walk { n in
|
|
1158
|
+
Fh.response(200, .list([]), n <= links.count ? vm(("link", .string(links[n - 1]))) : nil)
|
|
1159
|
+
}
|
|
1160
|
+
XCTAssertEqual(urls, [
|
|
1161
|
+
"http://api.test/w?page=1", "http://api.test/v1/items?page=2", "http://api.test/v1/items?page=3",
|
|
1162
|
+
])
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
func testPathRelativeLinkResolvesAgainstTheRequest() {
|
|
1166
|
+
if Fh.skipWithout("paging") { return }
|
|
1167
|
+
let links = ["</v1/items?page=2>; rel=\"next\"", "<more?page=3>; rel=\"next\""]
|
|
1168
|
+
let (urls, _) = walk { n in
|
|
1169
|
+
Fh.response(200, .list([]), n <= links.count ? vm(("link", .string(links[n - 1]))) : nil)
|
|
1170
|
+
}
|
|
1171
|
+
XCTAssertEqual(urls, [
|
|
1172
|
+
"http://api.test/w?page=1", "http://api.test/v1/items?page=2", "http://api.test/v1/more?page=3",
|
|
1173
|
+
])
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
func testForeignLinkEndsTheWalk() {
|
|
1177
|
+
if Fh.skipWithout("paging") { return }
|
|
1178
|
+
let (urls, paging) = walk { _ in
|
|
1179
|
+
Fh.response(200, .list([]), vm(("link", .string("<https://elsewhere.test/w?after=b3>; rel=\"next\""))))
|
|
1180
|
+
}
|
|
1181
|
+
XCTAssertEqual(urls, ["http://api.test/w?page=1"])
|
|
1182
|
+
XCTAssertEqual(paging.entries["hasMore"], .bool(false))
|
|
1183
|
+
XCTAssertEqual(paging.entries["foreign"], .string("https://elsewhere.test/w?after=b3"))
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
func testCursorModeSendsASlashCursor() {
|
|
1187
|
+
if Fh.skipWithout("paging") { return }
|
|
1188
|
+
let pages: [Value] = [.string("/c3"), .null]
|
|
1189
|
+
let (urls, paging) = walk({ n in Fh.response(200, mapv(("next", pages[n - 1])), nil) },
|
|
1190
|
+
vm(("next", .string("cursor"))))
|
|
1191
|
+
XCTAssertEqual(urls, ["http://api.test/w?page=1", "http://api.test/w?cursor=%2Fc3"])
|
|
1192
|
+
XCTAssertEqual(paging.entries["hasMore"], .bool(false))
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1051
1195
|
func testNonListNotPaged() {
|
|
1052
1196
|
if Fh.skipWithout("paging") { return }
|
|
1053
1197
|
let rec = FhRecorder()
|
|
@@ -1094,6 +1238,27 @@ final class FeatureStreamingTest: XCTestCase {
|
|
|
1094
1238
|
XCTAssertTrue(SdkRunner.deepEqual(.list(batches), want))
|
|
1095
1239
|
}
|
|
1096
1240
|
|
|
1241
|
+
func testFailedResultIsNotStreamed() {
|
|
1242
|
+
if Fh.skipWithout("streaming") { return }
|
|
1243
|
+
let rec = FhRecorder()
|
|
1244
|
+
rec.reply = { _, _ in Fh.response(503, .list([]), nil) }
|
|
1245
|
+
let f = StreamingFeature()
|
|
1246
|
+
let h = Fh.make(rec.fetch, (f, nil))
|
|
1247
|
+
let res = h.op(FhOpSpec(op: "list", path: "/w"))
|
|
1248
|
+
XCTAssertFalse(res.ok)
|
|
1249
|
+
XCTAssertFalse(res.result!.streaming || res.result!.stream != nil, "a failed result must keep no stream")
|
|
1250
|
+
XCTAssertEqual(f.opened, 0)
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
func testEmptyListStreamsNothing() {
|
|
1254
|
+
if Fh.skipWithout("streaming") { return }
|
|
1255
|
+
let rec = FhRecorder()
|
|
1256
|
+
rec.reply = { _, _ in Fh.response(200, .list([]), nil) }
|
|
1257
|
+
let h = Fh.make(rec.fetch, (StreamingFeature(), nil))
|
|
1258
|
+
let res = h.op(FhOpSpec(op: "list", path: "/w"))
|
|
1259
|
+
XCTAssertEqual(res.result!.stream!().count, 0)
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1097
1262
|
func testNonListNotStreamed() {
|
|
1098
1263
|
if Fh.skipWithout("streaming") { return }
|
|
1099
1264
|
let h = Fh.make(nil, (StreamingFeature(), nil))
|
|
@@ -6,6 +6,8 @@ class Control {
|
|
|
6
6
|
throw?: boolean
|
|
7
7
|
err?: any
|
|
8
8
|
explain?: any
|
|
9
|
+
// One of the point's declared response types, sent as Accept.
|
|
10
|
+
accept?: string
|
|
9
11
|
// Cancels the request in flight, which ts and js alone do so far.
|
|
10
12
|
signal?: AbortSignal
|
|
11
13
|
|
|
@@ -13,6 +15,7 @@ class Control {
|
|
|
13
15
|
this.throw = getprop(ctrlmap, 'throw')
|
|
14
16
|
this.err = getprop(ctrlmap, 'err')
|
|
15
17
|
this.explain = getprop(ctrlmap, 'explain')
|
|
18
|
+
this.accept = getprop(ctrlmap, 'accept')
|
|
16
19
|
this.signal = getprop(ctrlmap, 'signal')
|
|
17
20
|
}
|
|
18
21
|
}
|
|
@@ -7,6 +7,8 @@ class Response {
|
|
|
7
7
|
statusText: string
|
|
8
8
|
headers: any
|
|
9
9
|
json: Function
|
|
10
|
+
// The body as the transport read it, once; undefined where it offers no text.
|
|
11
|
+
text: () => Promise<string | undefined>
|
|
10
12
|
err?: Error
|
|
11
13
|
body?: any
|
|
12
14
|
|
|
@@ -14,19 +16,29 @@ class Response {
|
|
|
14
16
|
this.status = getprop(resmap, 'status', -1)
|
|
15
17
|
this.statusText = getprop(resmap, 'statusText', '')
|
|
16
18
|
this.headers = getprop(resmap, 'headers')
|
|
17
|
-
this.
|
|
19
|
+
this.text = readText(resmap)
|
|
20
|
+
this.json = readJson(resmap, this.text)
|
|
18
21
|
this.body = getprop(resmap, 'body')
|
|
19
22
|
this.err = getprop(resmap, 'err')
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
+
function readText(resmap: Record<string, any>): () => Promise<string | undefined> {
|
|
28
|
+
let read: Promise<string | undefined> | undefined
|
|
29
|
+
return 'function' === typeof resmap.text ?
|
|
30
|
+
() => read = read ?? Promise.resolve(resmap.text()) :
|
|
31
|
+
async () => undefined
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
// Parsed from the text, so the body is read once. An empty body, such as the
|
|
36
|
+
// one an accepted delete answers with, is no body: parsing it as JSON would
|
|
37
|
+
// throw after the call has succeeded.
|
|
38
|
+
function readJson(resmap: Record<string, any>, readtext: () => Promise<string | undefined>): Function {
|
|
27
39
|
if ('function' === typeof resmap.text) {
|
|
28
40
|
return async () => {
|
|
29
|
-
const text = await
|
|
41
|
+
const text = String(await readtext())
|
|
30
42
|
if ('' === text.trim()) {
|
|
31
43
|
return undefined
|
|
32
44
|
}
|
|
@@ -8,6 +8,8 @@ class Result {
|
|
|
8
8
|
statusText: string
|
|
9
9
|
headers: Record<string, string>
|
|
10
10
|
body?: any
|
|
11
|
+
// The body verbatim, where the transport read it as text.
|
|
12
|
+
text?: string
|
|
11
13
|
err?: any
|
|
12
14
|
resdata?: any
|
|
13
15
|
resmatch?: any
|
|
@@ -18,6 +20,7 @@ class Result {
|
|
|
18
20
|
this.statusText = getprop(resmap, 'statusText', '')
|
|
19
21
|
this.headers = getprop(resmap, 'headers', {})
|
|
20
22
|
this.body = getprop(resmap, 'body')
|
|
23
|
+
this.text = getprop(resmap, 'text')
|
|
21
24
|
this.err = getprop(resmap, 'err')
|
|
22
25
|
this.resdata = getprop(resmap, 'resdata')
|
|
23
26
|
this.resmatch = getprop(resmap, 'resmatch')
|
|
@@ -70,6 +70,11 @@ class MetricsFeature extends BaseFeature {
|
|
|
70
70
|
|
|
71
71
|
this._bump(m.total, ok, dur)
|
|
72
72
|
this._bump(op, ok, dur)
|
|
73
|
+
|
|
74
|
+
const sink = this._options.sink
|
|
75
|
+
if ('function' === typeof sink) {
|
|
76
|
+
try { sink(ctx.utility.clean(ctx, m)) } catch (_e) { }
|
|
77
|
+
}
|
|
73
78
|
}
|
|
74
79
|
|
|
75
80
|
|
|
@@ -50,6 +50,9 @@ class PagingFeature extends BaseFeature {
|
|
|
50
50
|
if (null != paging.cursor) {
|
|
51
51
|
spec.query[cursorParam] = paging.cursor
|
|
52
52
|
}
|
|
53
|
+
else if ('string' === typeof paging.next && !this._foreign(paging.next, spec.base)) {
|
|
54
|
+
this._follow(spec, paging.next)
|
|
55
|
+
}
|
|
53
56
|
else if (null == spec.query[pageParam]) {
|
|
54
57
|
// A record written back by PreResult holds the page just fetched as
|
|
55
58
|
// `page` and the one to fetch as `nextPage`, so nextPage wins.
|
|
@@ -85,6 +88,7 @@ class PagingFeature extends BaseFeature {
|
|
|
85
88
|
nextPage: this._num(this._header(headers, 'x-next-page')),
|
|
86
89
|
next: undefined,
|
|
87
90
|
cursor: undefined,
|
|
91
|
+
foreign: undefined,
|
|
88
92
|
hasMore: false,
|
|
89
93
|
}
|
|
90
94
|
|
|
@@ -120,7 +124,10 @@ class PagingFeature extends BaseFeature {
|
|
|
120
124
|
}
|
|
121
125
|
|
|
122
126
|
if (body && 'object' === typeof body) {
|
|
123
|
-
if (null != body.next) {
|
|
127
|
+
if (null != body.next) {
|
|
128
|
+
if (this._isLink(body.next)) { paging.next = paging.next || body.next }
|
|
129
|
+
else { paging.cursor = body.next }
|
|
130
|
+
}
|
|
124
131
|
if (null != body.next_cursor) { paging.cursor = body.next_cursor }
|
|
125
132
|
if (null != body.cursor) { paging.cursor = body.cursor }
|
|
126
133
|
if (null != body.nextCursor) { paging.cursor = body.nextCursor }
|
|
@@ -138,6 +145,16 @@ class PagingFeature extends BaseFeature {
|
|
|
138
145
|
}
|
|
139
146
|
}
|
|
140
147
|
|
|
148
|
+
// A link to another origin is recorded, never followed, and ends the walk.
|
|
149
|
+
const base = null == ctx.spec ? ctx.options?.base : ctx.spec.base
|
|
150
|
+
if (null != paging.next) {
|
|
151
|
+
paging.next = this._resolve(paging.next, ctx.spec?.url)
|
|
152
|
+
}
|
|
153
|
+
if (null != paging.next && this._foreign(paging.next, base)) {
|
|
154
|
+
paging.foreign = paging.next
|
|
155
|
+
paging.next = undefined
|
|
156
|
+
}
|
|
157
|
+
|
|
141
158
|
// Cursor presence only INFERS another page. When the server stated the
|
|
142
159
|
// answer outright — relay's `hasNextPage: false`, or a body `hasMore` —
|
|
143
160
|
// that wins: a final page normally carries both an end cursor and
|
|
@@ -148,6 +165,10 @@ class PagingFeature extends BaseFeature {
|
|
|
148
165
|
null != paging.next || null != paging.cursor || null != paging.nextPage
|
|
149
166
|
}
|
|
150
167
|
|
|
168
|
+
if (null != paging.foreign && null == paging.cursor && null == paging.nextPage) {
|
|
169
|
+
paging.hasMore = false
|
|
170
|
+
}
|
|
171
|
+
|
|
151
172
|
result.paging = paging
|
|
152
173
|
|
|
153
174
|
if (null != ctx.ctrl) {
|
|
@@ -191,6 +212,83 @@ class PagingFeature extends BaseFeature {
|
|
|
191
212
|
}
|
|
192
213
|
}
|
|
193
214
|
|
|
215
|
+
// Under the `next` option's default, a URL or an absolute path is a link and
|
|
216
|
+
// anything else a cursor; `cursor` and `url` pin the reading.
|
|
217
|
+
_isLink(this: any, next: any): boolean {
|
|
218
|
+
if ('string' !== typeof next) { return false }
|
|
219
|
+
const mode = this._options.next || 'auto'
|
|
220
|
+
return 'url' === mode ||
|
|
221
|
+
('cursor' !== mode && ('' !== this._origin(next) || next.startsWith('/')))
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
_origin(this: any, text: any): string {
|
|
226
|
+
const m = /^[a-z][a-z0-9+.-]*:\/\/[^/?#]*/i.exec('string' === typeof text ? text : '')
|
|
227
|
+
return null == m ? '' : m[0].toLowerCase()
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
_foreign(this: any, link: any, base: any): boolean {
|
|
232
|
+
const origin = this._origin(link)
|
|
233
|
+
return '' !== origin && origin !== this._origin(base)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
// RFC 3986 reference resolution against the URL of the request that
|
|
238
|
+
// returned the link. A link on that URL's origin comes back as its path and
|
|
239
|
+
// query; an absolute link is left as the server wrote it.
|
|
240
|
+
_resolve(this: any, link: string, url: any): string {
|
|
241
|
+
if ('string' !== typeof url || '' === url || /^[a-z][a-z0-9+.-]*:/i.test(link)) {
|
|
242
|
+
return link
|
|
243
|
+
}
|
|
244
|
+
const bare = '' === this._origin(url)
|
|
245
|
+
const holder = 'http://placeholder.invalid'
|
|
246
|
+
try {
|
|
247
|
+
const from = new URL(bare ? holder + (url.startsWith('/') ? '' : '/') + url : url)
|
|
248
|
+
const out = new URL(link, from)
|
|
249
|
+
return out.origin === from.origin ? out.pathname + out.search : out.href
|
|
250
|
+
}
|
|
251
|
+
catch (_e) {
|
|
252
|
+
return link
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
// The request goes to the link's path and query, on the SDK's own origin.
|
|
258
|
+
_follow(this: any, spec: any, next: string) {
|
|
259
|
+
const link = /^(?:[a-z][a-z0-9+.-]*:\/\/[^/?#]*)?([^?#]*)(?:\?([^#]*))?/i.exec(next) as any
|
|
260
|
+
const origin = /^[a-z][a-z0-9+.-]*:\/\/[^/?#]*/i.exec(String(spec.base || ''))
|
|
261
|
+
|
|
262
|
+
const query: Record<string, any> = {}
|
|
263
|
+
for (const pair of (link[2] || '').split('&')) {
|
|
264
|
+
if ('' === pair) { continue }
|
|
265
|
+
const at = pair.indexOf('=')
|
|
266
|
+
const key = at < 0 ? pair : pair.slice(0, at)
|
|
267
|
+
const val = at < 0 ? '' : pair.slice(at + 1)
|
|
268
|
+
query[this._unescape(key)] = this._unescape(val)
|
|
269
|
+
}
|
|
270
|
+
for (const key of (spec.authquery || [])) {
|
|
271
|
+
query[key] = spec.query[key]
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
spec.base = null == origin ? '' : origin[0]
|
|
275
|
+
spec.prefix = ''
|
|
276
|
+
spec.path = link[1]
|
|
277
|
+
spec.suffix = ''
|
|
278
|
+
spec.query = query
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
_unescape(this: any, text: string): string {
|
|
283
|
+
try {
|
|
284
|
+
return decodeURIComponent(text.replace(/\+/g, ' '))
|
|
285
|
+
}
|
|
286
|
+
catch (err) {
|
|
287
|
+
return text
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
|
|
194
292
|
_isList(this: any, ctx: any): boolean {
|
|
195
293
|
const ops = this._options.ops || ['list']
|
|
196
294
|
return ops.indexOf(ctx.op && ctx.op.name) >= 0
|
|
@@ -44,24 +44,20 @@ class RatelimitFeature extends BaseFeature {
|
|
|
44
44
|
const rate = this._options.rate || 5
|
|
45
45
|
const burst = null == this._options.burst ? rate : this._options.burst
|
|
46
46
|
|
|
47
|
-
// Refill
|
|
47
|
+
// Refill, then reserve this call's token before any wait: a negative
|
|
48
|
+
// count is the calls already queued, so overlapping calls pace in turn.
|
|
48
49
|
const now = this._now()
|
|
49
50
|
const elapsed = now - this._last
|
|
50
51
|
this._last = now
|
|
51
|
-
this._tokens = Math.min(burst, this._tokens + (elapsed / 1000) * rate)
|
|
52
|
+
this._tokens = Math.min(burst, this._tokens + (elapsed / 1000) * rate) - 1
|
|
52
53
|
|
|
53
|
-
if (this._tokens >=
|
|
54
|
-
this._tokens -= 1
|
|
54
|
+
if (this._tokens >= 0) {
|
|
55
55
|
return
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
const needed = 1 - this._tokens
|
|
60
|
-
const waitMs = Math.ceil((needed / rate) * 1000)
|
|
58
|
+
const waitMs = Math.ceil((-this._tokens / rate) * 1000)
|
|
61
59
|
this._track(ctx, waitMs)
|
|
62
60
|
await this._sleep(waitMs, signal)
|
|
63
|
-
this._last = this._now()
|
|
64
|
-
this._tokens = 0
|
|
65
61
|
}
|
|
66
62
|
|
|
67
63
|
|