@voxgig/sdkgen 4.51.0 → 4.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/voxgig-sdkgen +1 -1
- package/dist/cmp/ReadmeExplanation.js +5 -2
- package/dist/cmp/ReadmeExplanation.js.map +1 -1
- package/dist/cmp/ReadmeFeatures.js +20 -6
- package/dist/cmp/ReadmeFeatures.js.map +1 -1
- package/dist/helpers/optspec.js +2 -2
- package/dist/helpers/optspec.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/model/sdkgen.aontu +1 -1
- package/package.json +1 -1
- package/project/.sdk/model/feature/audit.aontu +1 -1
- package/project/.sdk/model/feature/cache.aontu +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/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/fragment/Entity.fragment.clj +18 -1
- package/project/.sdk/src/cmp/cpp/TestClean_cpp.ts +2 -1
- package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +30 -2
- package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +31 -12
- package/project/.sdk/src/cmp/elixir/TestClean_elixir.ts +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/fragment/Entity.fragment.go +42 -2
- package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +42 -14
- package/project/.sdk/src/cmp/java/TestClean_java.ts +9 -4
- package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +21 -0
- package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +13 -8
- package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +26 -2
- package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/EntityPatchOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +12 -5
- package/project/.sdk/src/cmp/kotlin/TestClean_kotlin.ts +9 -4
- package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +19 -0
- package/project/.sdk/src/cmp/lua/TestClean_lua.ts +2 -1
- package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +42 -5
- package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +44 -10
- package/project/.sdk/src/cmp/lua/utility_lua.ts +2 -1
- package/project/.sdk/src/cmp/ocaml/TestClean_ocaml.ts +2 -1
- package/project/.sdk/src/cmp/ocaml/fragment/RunOp.fragment.ml +36 -21
- package/project/.sdk/src/cmp/perl/TestClean_perl.ts +1 -1
- 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/fragment/Entity.fragment.php +33 -4
- package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +13 -6
- package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +25 -2
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +26 -12
- package/project/.sdk/src/cmp/rb/TestClean_rb.ts +1 -1
- package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +23 -2
- package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +27 -11
- package/project/.sdk/src/cmp/rust/TestClean_rust.ts +14 -17
- package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +22 -2
- 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/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/ReadmeHowto_ts.ts +13 -8
- package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +26 -2
- package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityPatchOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +12 -5
- package/project/.sdk/src/cmp/zig/TestClean_zig.ts +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/tm/c/feature/metrics.c +7 -0
- package/project/.sdk/tm/c/feature/paging.c +231 -2
- package/project/.sdk/tm/c/feature/ratelimit.c +5 -9
- package/project/.sdk/tm/c/feature/retry.c +51 -4
- package/project/.sdk/tm/c/feature/streaming.c +2 -1
- package/project/.sdk/tm/c/feature/telemetry.c +19 -18
- package/project/.sdk/tm/c/feature/test.c +78 -54
- package/project/.sdk/tm/c/tests/feature_test.c +184 -0
- package/project/.sdk/tm/c/tests/primary_utility_test.c +2 -0
- package/project/.sdk/tm/c/utility/make_options.c +80 -9
- package/project/.sdk/tm/clojure/src/sdk/core.clj +31 -11
- package/project/.sdk/tm/clojure/src/sdk/features.clj +198 -70
- package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +70 -1
- package/project/.sdk/tm/cpp/core/types.hpp +137 -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/paging.hpp +160 -2
- package/project/.sdk/tm/cpp/feature/ratelimit.hpp +18 -14
- package/project/.sdk/tm/cpp/feature/retry.hpp +46 -5
- package/project/.sdk/tm/cpp/feature/streaming.hpp +2 -1
- package/project/.sdk/tm/cpp/feature/telemetry.hpp +17 -10
- package/project/.sdk/tm/cpp/feature/test.hpp +63 -53
- package/project/.sdk/tm/cpp/test/feature_test.cpp +137 -0
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +35 -5
- package/project/.sdk/tm/csharp/feature/AuditFeature.cs +8 -1
- package/project/.sdk/tm/csharp/feature/MetricsFeature.cs +23 -0
- package/project/.sdk/tm/csharp/feature/PagingFeature.cs +130 -3
- package/project/.sdk/tm/csharp/feature/RatelimitFeature.cs +26 -19
- package/project/.sdk/tm/csharp/feature/RetryFeature.cs +41 -7
- package/project/.sdk/tm/csharp/feature/StreamingFeature.cs +2 -1
- package/project/.sdk/tm/csharp/feature/TelemetryFeature.cs +11 -9
- package/project/.sdk/tm/csharp/feature/TestFeature.cs +55 -67
- package/project/.sdk/tm/csharp/test/FeatureTest.cs +162 -0
- package/project/.sdk/tm/csharp/utility/MakeOptions.cs +89 -12
- package/project/.sdk/tm/elixir/lib/projectname/feature/metrics.ex +13 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/paging.ex +110 -5
- package/project/.sdk/tm/elixir/lib/projectname/feature/ratelimit.ex +6 -12
- package/project/.sdk/tm/elixir/lib/projectname/feature/retry.ex +33 -9
- package/project/.sdk/tm/elixir/lib/projectname/feature/streaming.ex +2 -1
- package/project/.sdk/tm/elixir/lib/projectname/feature/telemetry.ex +7 -7
- package/project/.sdk/tm/elixir/lib/projectname/feature/test.ex +52 -48
- package/project/.sdk/tm/elixir/lib/projectname/utility.ex +59 -35
- package/project/.sdk/tm/elixir/test/feature_test.exs +137 -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/metrics_feature.go +14 -0
- package/project/.sdk/tm/go/feature/paging_feature.go +108 -2
- package/project/.sdk/tm/go/feature/ratelimit_feature.go +19 -17
- package/project/.sdk/tm/go/feature/retry_feature.go +81 -9
- package/project/.sdk/tm/go/feature/streaming_feature.go +2 -1
- package/project/.sdk/tm/go/feature/telemetry_feature.go +18 -11
- package/project/.sdk/tm/go/feature/test_feature.go +65 -55
- package/project/.sdk/tm/go/test/feature_corpus_test.go +209 -28
- package/project/.sdk/tm/go/test/feature_test.go +32 -0
- package/project/.sdk/tm/go/utility/make_options.go +111 -6
- 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/MetricsFeature.java +31 -0
- package/project/.sdk/tm/java/feature/PagingFeature.java +156 -2
- package/project/.sdk/tm/java/feature/RatelimitFeature.java +15 -13
- package/project/.sdk/tm/java/feature/RetryFeature.java +33 -6
- package/project/.sdk/tm/java/feature/StreamingFeature.java +2 -1
- package/project/.sdk/tm/java/feature/TelemetryFeature.java +17 -9
- package/project/.sdk/tm/java/feature/TestFeature.java +50 -63
- package/project/.sdk/tm/java/test/FeatureCorpusTest.java +170 -17
- package/project/.sdk/tm/java/utility/MakeOptions.java +128 -14
- 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/MakeOptionsUtility.js +55 -6
- package/project/.sdk/tm/js/test/feature/Corpus.test.js +95 -25
- package/project/.sdk/tm/js/test/feature.test.js +14 -1
- 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/MetricsFeature.kt +22 -0
- package/project/.sdk/tm/kotlin/feature/PagingFeature.kt +125 -2
- package/project/.sdk/tm/kotlin/feature/RatelimitFeature.kt +16 -13
- package/project/.sdk/tm/kotlin/feature/RetryFeature.kt +36 -14
- package/project/.sdk/tm/kotlin/feature/StreamingFeature.kt +4 -0
- package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +12 -10
- package/project/.sdk/tm/kotlin/feature/TestFeature.kt +45 -48
- package/project/.sdk/tm/kotlin/test/FeatureTest.kt +114 -0
- package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +83 -14
- package/project/.sdk/tm/lua/feature/debug_feature.lua +2 -3
- package/project/.sdk/tm/lua/feature/metrics_feature.lua +5 -0
- package/project/.sdk/tm/lua/feature/paging_feature.lua +143 -2
- package/project/.sdk/tm/lua/feature/ratelimit_feature.lua +5 -9
- package/project/.sdk/tm/lua/feature/retry_feature.lua +43 -5
- package/project/.sdk/tm/lua/feature/streaming_feature.lua +2 -1
- package/project/.sdk/tm/lua/feature/telemetry_feature.lua +18 -7
- package/project/.sdk/tm/lua/feature/test_feature.lua +60 -62
- package/project/.sdk/tm/lua/test/feature_test.lua +100 -3
- package/project/.sdk/tm/lua/utility/make_options.lua +55 -13
- package/project/.sdk/tm/ocaml/sdk_features.ml +286 -60
- package/project/.sdk/tm/ocaml/sdk_runtime.ml +34 -11
- package/project/.sdk/tm/ocaml/test/t_feature.ml +72 -1
- package/project/.sdk/tm/perl/feature/debug_feature.pm +2 -2
- package/project/.sdk/tm/perl/feature/metrics_feature.pm +5 -0
- package/project/.sdk/tm/perl/feature/paging_feature.pm +139 -2
- package/project/.sdk/tm/perl/feature/ratelimit_feature.pm +5 -11
- package/project/.sdk/tm/perl/feature/retry_feature.pm +22 -4
- package/project/.sdk/tm/perl/feature/streaming_feature.pm +2 -0
- package/project/.sdk/tm/perl/feature/telemetry_feature.pm +17 -8
- package/project/.sdk/tm/perl/feature/test_feature.pm +45 -50
- package/project/.sdk/tm/perl/t/feature.t +2 -2
- package/project/.sdk/tm/perl/t/feature_corpus.t +126 -23
- package/project/.sdk/tm/perl/utility/make_options.pm +33 -10
- package/project/.sdk/tm/php/feature/MetricsFeature.php +8 -0
- package/project/.sdk/tm/php/feature/PagingFeature.php +128 -1
- package/project/.sdk/tm/php/feature/RatelimitFeature.php +5 -9
- package/project/.sdk/tm/php/feature/RetryFeature.php +27 -3
- package/project/.sdk/tm/php/feature/StreamingFeature.php +2 -1
- package/project/.sdk/tm/php/feature/TelemetryFeature.php +10 -7
- package/project/.sdk/tm/php/feature/TestFeature.php +55 -47
- package/project/.sdk/tm/php/test/FeatureCorpusTest.php +151 -16
- package/project/.sdk/tm/php/utility/MakeOptions.php +40 -13
- package/project/.sdk/tm/py/pkg/feature/metrics_feature.py +7 -0
- package/project/.sdk/tm/py/pkg/feature/paging_feature.py +86 -1
- package/project/.sdk/tm/py/pkg/feature/ratelimit_feature.py +13 -16
- package/project/.sdk/tm/py/pkg/feature/retry_feature.py +31 -6
- package/project/.sdk/tm/py/pkg/feature/streaming_feature.py +2 -1
- package/project/.sdk/tm/py/pkg/feature/telemetry_feature.py +10 -6
- package/project/.sdk/tm/py/pkg/feature/test_feature.py +56 -53
- package/project/.sdk/tm/py/pkg/utility/make_options.py +68 -20
- package/project/.sdk/tm/py/test/test_feature.py +11 -1
- package/project/.sdk/tm/py/test/test_feature_corpus.py +111 -16
- 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/feature/debug_feature.rb +2 -2
- package/project/.sdk/tm/rb/feature/metrics_feature.rb +8 -0
- package/project/.sdk/tm/rb/feature/paging_feature.rb +87 -1
- package/project/.sdk/tm/rb/feature/ratelimit_feature.rb +12 -16
- package/project/.sdk/tm/rb/feature/retry_feature.rb +19 -3
- package/project/.sdk/tm/rb/feature/streaming_feature.rb +2 -1
- package/project/.sdk/tm/rb/feature/telemetry_feature.rb +11 -6
- package/project/.sdk/tm/rb/feature/test_feature.rb +42 -49
- package/project/.sdk/tm/rb/test/feature_corpus_test.rb +108 -24
- package/project/.sdk/tm/rb/test/feature_test.rb +1 -1
- package/project/.sdk/tm/rb/utility/make_options.rb +32 -11
- 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/paging.rs +189 -3
- package/project/.sdk/tm/rust/feature/ratelimit.rs +5 -10
- package/project/.sdk/tm/rust/feature/retry.rs +59 -6
- package/project/.sdk/tm/rust/feature/streaming.rs +3 -2
- package/project/.sdk/tm/rust/feature/support.rs +4 -0
- package/project/.sdk/tm/rust/feature/telemetry.rs +22 -11
- package/project/.sdk/tm/rust/feature/test.rs +63 -57
- package/project/.sdk/tm/rust/tests/feature_test.rs +174 -0
- package/project/.sdk/tm/rust/tests/primary_utility_test.rs +1 -0
- package/project/.sdk/tm/rust/utility/make_options.rs +122 -27
- 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/MetricsFeature.scala +31 -1
- package/project/.sdk/tm/scala/feature/PagingFeature.scala +122 -2
- package/project/.sdk/tm/scala/feature/RatelimitFeature.scala +14 -11
- package/project/.sdk/tm/scala/feature/RetryFeature.scala +29 -7
- package/project/.sdk/tm/scala/feature/StreamingFeature.scala +2 -1
- package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +12 -10
- package/project/.sdk/tm/scala/feature/TestFeature.scala +44 -44
- package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +41 -0
- package/project/.sdk/tm/scala/utility/Make.scala +96 -13
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +3 -2
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/MetricsFeature.swift +20 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/PagingFeature.swift +102 -2
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RatelimitFeature.swift +19 -13
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RetryFeature.swift +40 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/StreamingFeature.swift +2 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +11 -9
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TestFeature.swift +55 -49
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +51 -13
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +111 -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/MakeOptionsUtility.ts +57 -6
- package/project/.sdk/tm/ts/test/feature/Corpus.test.ts +95 -25
- package/project/.sdk/tm/ts/test/feature.test.ts +14 -1
- package/project/.sdk/tm/zig/core/utility.zig +107 -8
- package/project/.sdk/tm/zig/feature/metrics.zig +19 -0
- package/project/.sdk/tm/zig/feature/paging.zig +172 -4
- package/project/.sdk/tm/zig/feature/ratelimit.zig +5 -11
- package/project/.sdk/tm/zig/feature/retry.zig +41 -3
- package/project/.sdk/tm/zig/feature/streaming.zig +2 -0
- package/project/.sdk/tm/zig/feature/telemetry.zig +15 -9
- package/project/.sdk/tm/zig/feature/test.zig +56 -40
- package/project/.sdk/tm/zig/test/feature_test.zig +109 -0
- package/project/.sdk/tm/zig/test/primary_utility_test.zig +2 -0
- package/project/sdkgen-package.json +1 -1
- package/src/cmp/ReadmeExplanation.ts +5 -2
- package/src/cmp/ReadmeFeatures.ts +21 -6
- package/src/helpers/optspec.ts +2 -2
|
@@ -103,22 +103,8 @@ class ProjectNameTestFeature < ProjectNameBaseFeature
|
|
|
103
103
|
entmap = VoxgigStruct.getprop(entity, op.entity)
|
|
104
104
|
entmap = {} unless entmap.is_a?(Hash)
|
|
105
105
|
|
|
106
|
-
# For single-entity ops (load, remove) with an empty explicit match, fall
|
|
107
|
-
# back to the id the entity client already knows from a prior create/load
|
|
108
|
-
# (in fctx.match / fctx.data). Mirrors the TS mock where param() resolves
|
|
109
|
-
# the id from that accumulated state.
|
|
110
|
-
resolve_match = lambda do |explicit|
|
|
111
|
-
return explicit if explicit.is_a?(Hash) && !explicit.empty?
|
|
112
|
-
[fctx.match, fctx.data].each do |src|
|
|
113
|
-
next if src.nil?
|
|
114
|
-
v = VoxgigStruct.getprop(src, "id")
|
|
115
|
-
return { "id" => v } if !v.nil? && v != "__UNDEFINED__"
|
|
116
|
-
end
|
|
117
|
-
{}
|
|
118
|
-
end
|
|
119
|
-
|
|
120
106
|
if op.name == "load"
|
|
121
|
-
args = test_self.build_args(fctx, op,
|
|
107
|
+
args = test_self.build_args(fctx, op, fctx.reqmatch)
|
|
122
108
|
found = VoxgigStruct.select(entmap, args)
|
|
123
109
|
ent = VoxgigStruct.getelem(found, 0)
|
|
124
110
|
return respond.call(404, nil, { "statusText" => "Not found" }) unless ent
|
|
@@ -137,24 +123,7 @@ class ProjectNameTestFeature < ProjectNameBaseFeature
|
|
|
137
123
|
respond.call(200, out, nil)
|
|
138
124
|
|
|
139
125
|
elsif op.name == "update" || op.name == "patch"
|
|
140
|
-
|
|
141
|
-
# contains the new field values, which would otherwise cause select
|
|
142
|
-
# to filter out the entity we want to update. When reqdata has no id,
|
|
143
|
-
# fall back to the id the entity client carries from a prior
|
|
144
|
-
# create/load (in fctx.match / fctx.data), mirroring the TS mock
|
|
145
|
-
# where param(ctx,'id') resolves from accumulated state.
|
|
146
|
-
update_match = {}
|
|
147
|
-
if fctx.reqdata.is_a?(Hash)
|
|
148
|
-
update_match["id"] = fctx.reqdata["id"] if fctx.reqdata.key?("id")
|
|
149
|
-
if op.alias_map
|
|
150
|
-
alias_id = VoxgigStruct.getprop(op.alias_map, "id")
|
|
151
|
-
if alias_id && fctx.reqdata.key?(alias_id)
|
|
152
|
-
update_match[alias_id] = fctx.reqdata[alias_id]
|
|
153
|
-
end
|
|
154
|
-
end
|
|
155
|
-
end
|
|
156
|
-
update_match = resolve_match.call({}) if update_match.empty?
|
|
157
|
-
args = test_self.build_args(fctx, op, update_match)
|
|
126
|
+
args = test_self.build_args(fctx, op, ProjectNameTestFeature.record(fctx.reqdata))
|
|
158
127
|
found = VoxgigStruct.select(entmap, args)
|
|
159
128
|
ent = VoxgigStruct.getelem(found, 0)
|
|
160
129
|
# update miss: 404, never another record
|
|
@@ -167,7 +136,7 @@ class ProjectNameTestFeature < ProjectNameBaseFeature
|
|
|
167
136
|
respond.call(200, out, nil)
|
|
168
137
|
|
|
169
138
|
elsif op.name == "remove"
|
|
170
|
-
args = test_self.build_args(fctx, op,
|
|
139
|
+
args = test_self.build_args(fctx, op, fctx.reqmatch)
|
|
171
140
|
found = VoxgigStruct.select(entmap, args)
|
|
172
141
|
ent = VoxgigStruct.getelem(found, 0)
|
|
173
142
|
# Remove only the first matched entity. If nothing matches,
|
|
@@ -307,30 +276,54 @@ class ProjectNameTestFeature < ProjectNameBaseFeature
|
|
|
307
276
|
qand = []
|
|
308
277
|
q = { "`$AND`" => qand }
|
|
309
278
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
keys.each do |key|
|
|
314
|
-
is_id = (key == "id")
|
|
315
|
-
selected = VoxgigStruct.select(reqd, key)
|
|
316
|
-
is_reqd = !VoxgigStruct.isempty(selected)
|
|
279
|
+
ename = ctx.entity.get_name
|
|
280
|
+
idfrom = VoxgigStruct.getpath(ctx.config, "entity.#{ename}.id.from")
|
|
281
|
+
idfrom = {} unless idfrom.is_a?(Hash)
|
|
317
282
|
|
|
318
|
-
|
|
319
|
-
v = ctx.utility.param.call(ctx, key)
|
|
320
|
-
ka = op.alias_map ? VoxgigStruct.getprop(op.alias_map, key) : nil
|
|
283
|
+
names = args ? (VoxgigStruct.keysof(args) || []).dup : []
|
|
321
284
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
285
|
+
# With no id in the call, the entity's held id (or composite parts) stands in.
|
|
286
|
+
if VoxgigStruct.getprop(args, "id").nil?
|
|
287
|
+
parts = VoxgigStruct.getpath(ctx.config, "entity.#{ename}.id.parts")
|
|
288
|
+
parts = (opname == "list" ? [] : ["id"]) unless parts.is_a?(Array)
|
|
289
|
+
parts.each do |part|
|
|
290
|
+
pname = part.to_s
|
|
291
|
+
if !names.include?(pname) && (held?(ctx.match, pname) || held?(ctx.data, pname))
|
|
292
|
+
names << pname
|
|
327
293
|
end
|
|
328
294
|
end
|
|
329
295
|
end
|
|
330
296
|
|
|
297
|
+
names.each do |key|
|
|
298
|
+
is_id = (key == "id")
|
|
299
|
+
selected = VoxgigStruct.select(reqd, key)
|
|
300
|
+
is_reqd = !VoxgigStruct.isempty(selected)
|
|
301
|
+
|
|
302
|
+
if is_id || is_reqd
|
|
303
|
+
v = ctx.utility.param.call(ctx, key)
|
|
304
|
+
ka = op.alias_map ? VoxgigStruct.getprop(op.alias_map, key) : nil
|
|
305
|
+
|
|
306
|
+
qor = [{ key => v }]
|
|
307
|
+
qor << { ka => v } if ka.is_a?(String)
|
|
308
|
+
|
|
309
|
+
# An alternative, never a replacement: a seed keeping the parameter
|
|
310
|
+
# flat is still found.
|
|
311
|
+
kf = idfrom[key]
|
|
312
|
+
qor << kf.split(".").reverse.reduce(v) { |acc, k| { k => acc } } if kf.is_a?(String) && kf != key
|
|
313
|
+
|
|
314
|
+
qand << { "`$OR`" => qor }
|
|
315
|
+
end
|
|
316
|
+
end
|
|
317
|
+
|
|
331
318
|
q["`$AND`"] = qand
|
|
332
319
|
ctx.ctrl.explain["test"] = { "query" => q } if ctx.ctrl.explain
|
|
333
320
|
|
|
334
321
|
q
|
|
335
322
|
end
|
|
323
|
+
|
|
324
|
+
def held?(src, key)
|
|
325
|
+
return false if src.nil?
|
|
326
|
+
v = VoxgigStruct.getprop(src, key)
|
|
327
|
+
!v.nil? && v != "__UNDEFINED__"
|
|
328
|
+
end
|
|
336
329
|
end
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
require "minitest/autorun"
|
|
17
17
|
require "json"
|
|
18
|
+
require "uri"
|
|
18
19
|
require_relative "../ProjectName_sdk"
|
|
19
20
|
|
|
20
21
|
class FeatureCorpusTest < Minitest::Test
|
|
@@ -39,14 +40,21 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
39
40
|
# Returns the shape the real fetcher returns: a [response, err] PAIR, with
|
|
40
41
|
# the parsed body behind a `json` lambda and `body` as the raw string. A
|
|
41
42
|
# script that only set `body` would look like an empty result, which reads
|
|
42
|
-
# as a feature defect rather than a mis-shaped script.
|
|
43
|
-
|
|
43
|
+
# as a feature defect rather than a mis-shaped script. Each URL it is sent
|
|
44
|
+
# is kept in `sent`, and when it arrived in `times`; a `cut` response is one
|
|
45
|
+
# whose body stops before its end.
|
|
46
|
+
def scripted_fetcher(res, sent = [], times = [])
|
|
44
47
|
n = -1
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
lock = Mutex.new
|
|
49
|
+
lambda do |_ctx, fullurl, _fetchdef|
|
|
50
|
+
at = lock.synchronize do
|
|
51
|
+
sent << fullurl
|
|
52
|
+
times << Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
|
|
53
|
+
n += 1
|
|
54
|
+
end
|
|
47
55
|
spec = {}
|
|
48
56
|
if res.is_a?(Array) && !res.empty?
|
|
49
|
-
i =
|
|
57
|
+
i = at >= res.length ? res.length - 1 : at
|
|
50
58
|
spec = res[i] || {}
|
|
51
59
|
end
|
|
52
60
|
|
|
@@ -55,6 +63,18 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
55
63
|
status = spec["status"].nil? ? 200 : spec["status"].to_i
|
|
56
64
|
body = spec["body"].nil? ? {} : spec["body"]
|
|
57
65
|
|
|
66
|
+
if spec["cut"] == true
|
|
67
|
+
raw = JSON.generate(body)
|
|
68
|
+
return [{
|
|
69
|
+
"status" => status,
|
|
70
|
+
"statusText" => status < 400 ? "OK" : "ERR",
|
|
71
|
+
"headers" => (spec["headers"] || {}).dup,
|
|
72
|
+
"json" => -> { nil },
|
|
73
|
+
"body" => raw[0, raw.length / 2],
|
|
74
|
+
"unreadable" => true,
|
|
75
|
+
}, nil]
|
|
76
|
+
end
|
|
77
|
+
|
|
58
78
|
[{
|
|
59
79
|
"status" => status,
|
|
60
80
|
"statusText" => status < 400 ? "OK" : "ERR",
|
|
@@ -70,7 +90,7 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
70
90
|
# ProjectNameSDK.new, not ProjectNameSDK.test: the `test` feature is
|
|
71
91
|
# transport: 'base' and REPLACES the transport, so a client in test mode
|
|
72
92
|
# would shadow the script.
|
|
73
|
-
def build_client(kase)
|
|
93
|
+
def build_client(kase, sent = [], times = [])
|
|
74
94
|
# "test" here is the OPTION, not the `test` FEATURE. It says "this
|
|
75
95
|
# client is not live", which is what makes a REQUIRED OpenAPI server
|
|
76
96
|
# variable resolve to a deterministic test-<name> rather than raise at
|
|
@@ -78,7 +98,7 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
78
98
|
# scripted fetcher still stands.
|
|
79
99
|
opts = {
|
|
80
100
|
"test" => { "active" => true },
|
|
81
|
-
"utility" => { "fetcher" => scripted_fetcher(kase["res"]) },
|
|
101
|
+
"utility" => { "fetcher" => scripted_fetcher(kase["res"], sent, times) },
|
|
82
102
|
}
|
|
83
103
|
opts["feature"] = kase["feature"] unless kase["feature"].nil?
|
|
84
104
|
ProjectNameSDK.new(opts)
|
|
@@ -185,10 +205,40 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
185
205
|
nil
|
|
186
206
|
end
|
|
187
207
|
|
|
208
|
+
# Read one operation through the entity's stream; how many it yields.
|
|
209
|
+
def stream_call(client, op, ctrl, args = nil)
|
|
210
|
+
client.public_send(op["accessor"]).stream(op["op"], (args || {}).dup, { "ctrl" => ctrl }).count
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Each request a case expects, in order: its path, and its whole query. A
|
|
214
|
+
# path is compared without its leading slash, which an SDK with no base
|
|
215
|
+
# omits.
|
|
216
|
+
def check_sent(sent, expect, label)
|
|
217
|
+
assert_equal expect.length, sent.length, "#{label}: requests sent: #{sent.join(' | ')}"
|
|
218
|
+
expect.each_with_index do |want, i|
|
|
219
|
+
url = URI.parse(sent[i])
|
|
220
|
+
unless want["path"].nil?
|
|
221
|
+
assert_equal want["path"].sub(%r{\A/+}, ""), url.path.to_s.sub(%r{\A/+}, ""),
|
|
222
|
+
"#{label}: request #{i} path"
|
|
223
|
+
end
|
|
224
|
+
unless want["query"].nil?
|
|
225
|
+
query = URI.decode_www_form(url.query || "").to_h
|
|
226
|
+
assert_equal want["query"], query, "#{label}: request #{i} query"
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
|
|
188
231
|
# One step: it may wait before its call, may add request headers for its
|
|
189
|
-
# call, and may pass `args` as the operation's first argument.
|
|
232
|
+
# call, and may pass `args` as the operation's first argument. A `stream`
|
|
233
|
+
# step reads the operation through stream, and `items` is how many it
|
|
234
|
+
# yields.
|
|
190
235
|
def step_call(client, op, step, ctrl)
|
|
191
236
|
sleep(step["wait"] / 1000.0) unless step["wait"].nil?
|
|
237
|
+
if step["stream"] == true
|
|
238
|
+
items = stream_call(client, op, ctrl, step["args"])
|
|
239
|
+
assert_equal step["items"], items, "#{op['key']}: items streamed" unless step["items"].nil?
|
|
240
|
+
return items
|
|
241
|
+
end
|
|
192
242
|
return invoke(client, op, ctrl, step["args"]) if step["headers"].nil?
|
|
193
243
|
options = client.options
|
|
194
244
|
had = options.key?("headers")
|
|
@@ -205,6 +255,24 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
205
255
|
end
|
|
206
256
|
end
|
|
207
257
|
|
|
258
|
+
# Runs a step once, or with `together: N` as N overlapping calls, and
|
|
259
|
+
# returns each call's error or nil.
|
|
260
|
+
def calls(client, op, step, ctrl)
|
|
261
|
+
Array.new((step["together"] || 1).to_i) do
|
|
262
|
+
Thread.new do
|
|
263
|
+
step_call(client, op, step, ctrl)
|
|
264
|
+
nil
|
|
265
|
+
rescue StandardError => e
|
|
266
|
+
e
|
|
267
|
+
end
|
|
268
|
+
end.map(&:value)
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# The most requests seen in any window of `ms`.
|
|
272
|
+
def busiest(sent, ms)
|
|
273
|
+
sent.map { |from| sent.count { |t| from <= t && t < from + ms } }.max || 0
|
|
274
|
+
end
|
|
275
|
+
|
|
208
276
|
# Replace #OPn throughout a case, keys included.
|
|
209
277
|
def resolve(node, tokens)
|
|
210
278
|
case node
|
|
@@ -246,6 +314,13 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
246
314
|
return
|
|
247
315
|
end
|
|
248
316
|
|
|
317
|
+
if expect.is_a?(Array)
|
|
318
|
+
assert actual.is_a?(Array) && actual.length == expect.length,
|
|
319
|
+
"#{path}: want #{expect.length} item(s), got #{actual.inspect}"
|
|
320
|
+
expect.each_with_index { |want, i| subset(actual[i], want, "#{path}[#{i}]") }
|
|
321
|
+
return
|
|
322
|
+
end
|
|
323
|
+
|
|
249
324
|
if expect.is_a?(Numeric)
|
|
250
325
|
assert actual.is_a?(Numeric), "#{path}: expected a number, got #{actual.inspect}"
|
|
251
326
|
# Money is float arithmetic; compare with a tolerance far below any
|
|
@@ -392,32 +467,41 @@ class FeatureCorpusTest < Minitest::Test
|
|
|
392
467
|
|
|
393
468
|
# Every failing case is reported, not only the first.
|
|
394
469
|
begin
|
|
395
|
-
|
|
470
|
+
sent = []
|
|
471
|
+
times = []
|
|
472
|
+
client = build_client(kase, sent, times)
|
|
396
473
|
|
|
474
|
+
# A case-level ctrl is one control object every step shares.
|
|
475
|
+
shared = kase["ctrl"]
|
|
397
476
|
(kase["op"] || []).each do |step|
|
|
398
477
|
op = by_key[step["op"]]
|
|
399
478
|
refute_nil op, "#{label}: no operation #{step['op']}"
|
|
400
|
-
ctrl = step["ctrl"] || {}
|
|
479
|
+
ctrl = step["ctrl"] || shared || {}
|
|
401
480
|
wanterr = step["err"]
|
|
402
481
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
raise
|
|
408
|
-
rescue StandardError => e
|
|
409
|
-
refute_nil wanterr, "#{label}: #{step['op']} failed unexpectedly: #{e}"
|
|
410
|
-
if wanterr.is_a?(String)
|
|
411
|
-
# The CODE, not the message: make_error prefixes and humanises
|
|
412
|
-
# the text, so matching it would pass on any error that
|
|
413
|
-
# happened to mention the word.
|
|
414
|
-
code = e.respond_to?(:code) ? e.code : nil
|
|
415
|
-
assert_equal wanterr, code,
|
|
416
|
-
"#{label}: wrong error code (#{e})"
|
|
482
|
+
calls(client, op, step, ctrl).each do |e|
|
|
483
|
+
if e.nil?
|
|
484
|
+
assert_nil wanterr, "#{label}: #{step['op']} was expected to fail, and did not"
|
|
485
|
+
next
|
|
417
486
|
end
|
|
487
|
+
refute_nil wanterr, "#{label}: #{step['op']} failed unexpectedly: #{e}"
|
|
488
|
+
next unless wanterr.is_a?(String)
|
|
489
|
+
# The CODE, not the message: make_error prefixes and humanises
|
|
490
|
+
# the text, so matching it would pass on any error that
|
|
491
|
+
# happened to mention the word.
|
|
492
|
+
code = e.respond_to?(:code) ? e.code : nil
|
|
493
|
+
assert_equal wanterr, code, "#{label}: wrong error code (#{e})"
|
|
418
494
|
end
|
|
419
495
|
end
|
|
420
496
|
|
|
497
|
+
pace = kase["pace"]
|
|
498
|
+
unless pace.nil?
|
|
499
|
+
most = busiest(times, pace["ms"])
|
|
500
|
+
assert most <= pace["max"],
|
|
501
|
+
"#{label}: #{most} requests within #{pace['ms']} ms, want at most #{pace['max']}"
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
check_sent(sent, kase["sent"], label) unless kase["sent"].nil?
|
|
421
505
|
subset(record(client, name), kase["out"], "#{label}: _#{name}")
|
|
422
506
|
rescue Minitest::Assertion, StandardError => e
|
|
423
507
|
failed << (e.message.start_with?(label) ? e.message : "#{label}: #{e.message}")
|
|
@@ -829,7 +829,7 @@ class FeatureTest < Minitest::Test
|
|
|
829
829
|
def test_debug_captures_a_redacted_trace_and_honours_on_entry_and_max
|
|
830
830
|
skip_unless_feature("debug")
|
|
831
831
|
seen = []
|
|
832
|
-
h = harness([fspec("debug", "max" => 1, "
|
|
832
|
+
h = harness([fspec("debug", "max" => 1, "onEntry" => ->(e) { seen << e })])
|
|
833
833
|
h.op(headers: { "authorization" => "Bearer secret" })
|
|
834
834
|
h.op(opname: "list")
|
|
835
835
|
entries = h.track(:@_debug)["entries"]
|
|
@@ -3,6 +3,22 @@ require_relative 'struct/voxgig_struct'
|
|
|
3
3
|
require_relative '../schema'
|
|
4
4
|
require_relative 'clean'
|
|
5
5
|
module ProjectNameUtilities
|
|
6
|
+
# The model's options for a feature sit beneath the caller's, key by key: a
|
|
7
|
+
# key the caller sets replaces the default whole, so a list is never merged.
|
|
8
|
+
def self.feature_defaults(cfgfeature, feature)
|
|
9
|
+
return nil unless feature.nil? || feature.is_a?(Hash)
|
|
10
|
+
out = (feature || {}).dup
|
|
11
|
+
(cfgfeature.is_a?(Hash) ? cfgfeature : {}).each do |name, fdef|
|
|
12
|
+
dflt = fdef.is_a?(Hash) ? fdef["options"] : nil
|
|
13
|
+
given = out[name]
|
|
14
|
+
next unless dflt.is_a?(Hash)
|
|
15
|
+
next if given.nil? && dflt["active"] != true
|
|
16
|
+
next unless given.nil? || given.is_a?(Hash)
|
|
17
|
+
out[name] = VoxgigStruct.clone(dflt).merge(given || {})
|
|
18
|
+
end
|
|
19
|
+
out
|
|
20
|
+
end
|
|
21
|
+
|
|
6
22
|
MakeOptions = ->(ctx) {
|
|
7
23
|
options = ctx.options || {}
|
|
8
24
|
options = {} unless options.is_a?(Hash)
|
|
@@ -96,6 +112,9 @@ module ProjectNameUtilities
|
|
|
96
112
|
opts["feature"] = fmap
|
|
97
113
|
end
|
|
98
114
|
|
|
115
|
+
fdefaults = ProjectNameUtilities.feature_defaults(config["feature"], opts["feature"])
|
|
116
|
+
opts["feature"] = fdefaults unless fdefaults.nil?
|
|
117
|
+
|
|
99
118
|
# THE OPTION SPEC IS GENERATED, NOT WRITTEN HERE.
|
|
100
119
|
#
|
|
101
120
|
# `ProjectNameSchema::OPTSPEC` is built from the model:
|
|
@@ -166,16 +185,17 @@ module ProjectNameUtilities
|
|
|
166
185
|
opts["system"]["fetch"] = sys_fetch
|
|
167
186
|
end
|
|
168
187
|
|
|
169
|
-
# Resolve the feature add-order: an explicit array order (above) wins
|
|
170
|
-
#
|
|
171
|
-
#
|
|
172
|
-
|
|
188
|
+
# Resolve the feature add-order: an explicit array order (above) wins, and
|
|
189
|
+
# the names it leaves out follow it test-first, then sorted, so the outcome
|
|
190
|
+
# is deterministic and `test` is the base transport of a map.
|
|
191
|
+
begin
|
|
173
192
|
fmap = opts["feature"]
|
|
174
|
-
names = fmap.is_a?(Hash) ?
|
|
193
|
+
names = fmap.is_a?(Hash) ?
|
|
194
|
+
fmap.keys.select { |k| k.is_a?(String) && !featureorder.include?(k) }.sort : []
|
|
175
195
|
if names.include?("test")
|
|
176
|
-
|
|
196
|
+
rest = ["test"] + names.reject { |n| n == "test" }
|
|
177
197
|
else
|
|
178
|
-
|
|
198
|
+
rest = names
|
|
179
199
|
end
|
|
180
200
|
# Station special case, mirroring test's: its transport wrap must
|
|
181
201
|
# sit immediately outside the base transport (inside every other
|
|
@@ -183,12 +203,13 @@ module ProjectNameUtilities
|
|
|
183
203
|
# test - or first, when no test entry exists. Without this the
|
|
184
204
|
# sorted default would init station last and wrap OUTSIDE the
|
|
185
205
|
# recording features, turning its wire-truth events into fiction.
|
|
186
|
-
si =
|
|
206
|
+
si = rest.index("station")
|
|
187
207
|
unless si.nil?
|
|
188
|
-
|
|
189
|
-
ti =
|
|
190
|
-
|
|
208
|
+
rest.delete_at(si)
|
|
209
|
+
ti = rest.index("test")
|
|
210
|
+
rest.insert(ti.nil? ? 0 : ti + 1, "station")
|
|
191
211
|
end
|
|
212
|
+
featureorder += rest
|
|
192
213
|
end
|
|
193
214
|
|
|
194
215
|
# Again over the merged result: the config's own defaults can carry one.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
use std::rc::Rc;
|
|
3
3
|
|
|
4
4
|
use crate::core::context::Context;
|
|
5
|
-
use crate::core::helpers::{
|
|
5
|
+
use crate::core::helpers::{getp, setp};
|
|
6
6
|
use crate::core::types::{Feature, OutVal};
|
|
7
7
|
use crate::feature::support::*;
|
|
8
8
|
use crate::utility::voxgigstruct::Value;
|
|
@@ -90,7 +90,7 @@ impl AuditFeature {
|
|
|
90
90
|
|
|
91
91
|
let sink = getp(&self.options, "sink");
|
|
92
92
|
if let Value::Func(_) = sink {
|
|
93
|
-
|
|
93
|
+
call_sink(&sink, &record);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
@@ -3,7 +3,7 @@ use std::collections::HashMap;
|
|
|
3
3
|
use std::rc::Rc;
|
|
4
4
|
|
|
5
5
|
use crate::core::context::Context;
|
|
6
|
-
use crate::core::helpers::to_int;
|
|
6
|
+
use crate::core::helpers::{getp, jo, setp, to_int};
|
|
7
7
|
use crate::core::types::{Feature, OutVal};
|
|
8
8
|
use crate::feature::support::*;
|
|
9
9
|
use crate::utility::voxgigstruct::Value;
|
|
@@ -19,6 +19,18 @@ pub struct MetricsBucket {
|
|
|
19
19
|
pub max_ms: i64,
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
impl MetricsBucket {
|
|
23
|
+
fn record(&self) -> Value {
|
|
24
|
+
jo(vec![
|
|
25
|
+
("count", Value::Num(self.count as f64)),
|
|
26
|
+
("ok", Value::Num(self.ok as f64)),
|
|
27
|
+
("err", Value::Num(self.err as f64)),
|
|
28
|
+
("totalMs", Value::Num(self.total_ms as f64)),
|
|
29
|
+
("maxMs", Value::Num(self.max_ms as f64)),
|
|
30
|
+
])
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
22
34
|
pub struct MetricsFeature {
|
|
23
35
|
pub name: String,
|
|
24
36
|
pub active: bool,
|
|
@@ -66,6 +78,17 @@ impl MetricsFeature {
|
|
|
66
78
|
|
|
67
79
|
bump(&mut self.total, ok, dur);
|
|
68
80
|
bump(self.ops.entry(key).or_default(), ok, dur);
|
|
81
|
+
|
|
82
|
+
let sink = getp(&self.options, "sink");
|
|
83
|
+
if let Value::Func(_) = sink {
|
|
84
|
+
let ops = jo(vec![]);
|
|
85
|
+
for (k, b) in self.ops.iter() {
|
|
86
|
+
setp(&ops, k, b.record());
|
|
87
|
+
}
|
|
88
|
+
let counters = jo(vec![("total", self.total.record()), ("ops", ops)]);
|
|
89
|
+
// A sink's panic never changes the operation's outcome.
|
|
90
|
+
call_sink(&sink, &ctx.util().clean(ctx, &counters));
|
|
91
|
+
}
|
|
69
92
|
}
|
|
70
93
|
}
|
|
71
94
|
|