@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
|
@@ -165,8 +165,14 @@ function EntyClass:stream(action, args, callopts)
|
|
|
165
165
|
return false
|
|
166
166
|
end
|
|
167
167
|
|
|
168
|
+
local predone = false
|
|
169
|
+
|
|
168
170
|
local co = coroutine.create(function()
|
|
169
171
|
local failed = self:_stream_steps(ctx)
|
|
172
|
+
if failed == nil then
|
|
173
|
+
predone = true
|
|
174
|
+
utility.feature_hook(ctx, "PreDone")
|
|
175
|
+
end
|
|
170
176
|
local result = ctx.result
|
|
171
177
|
|
|
172
178
|
-- Inbound: prefer the streaming feature's incremental iterator; else fall
|
|
@@ -223,6 +229,10 @@ function EntyClass:stream(action, args, callopts)
|
|
|
223
229
|
if ok then
|
|
224
230
|
if coroutine.status(co) == "dead" then
|
|
225
231
|
utility.clean_explain(ctx)
|
|
232
|
+
if not predone then
|
|
233
|
+
predone = true
|
|
234
|
+
item = self:_late_done(ctx) or item
|
|
235
|
+
end
|
|
226
236
|
if item ~= nil then
|
|
227
237
|
error(item, 0)
|
|
228
238
|
end
|
|
@@ -239,6 +249,10 @@ function EntyClass:stream(action, args, callopts)
|
|
|
239
249
|
item = hookerr
|
|
240
250
|
end
|
|
241
251
|
local err = self:_unexpected(ctx, item)
|
|
252
|
+
if not predone then
|
|
253
|
+
predone = true
|
|
254
|
+
err = self:_late_done(ctx) or err
|
|
255
|
+
end
|
|
242
256
|
if err ~= nil then
|
|
243
257
|
error(err, 0)
|
|
244
258
|
end
|
|
@@ -247,7 +261,7 @@ function EntyClass:stream(action, args, callopts)
|
|
|
247
261
|
end
|
|
248
262
|
|
|
249
263
|
|
|
250
|
-
-- The steps
|
|
264
|
+
-- The steps before PreDone, with their hooks; the first that fails hands
|
|
251
265
|
-- back its error.
|
|
252
266
|
function EntyClass:_stream_steps(ctx)
|
|
253
267
|
local utility = self._utility
|
|
@@ -291,7 +305,6 @@ function EntyClass:_stream_steps(ctx)
|
|
|
291
305
|
return err
|
|
292
306
|
end
|
|
293
307
|
|
|
294
|
-
utility.feature_hook(ctx, "PreDone")
|
|
295
308
|
return nil
|
|
296
309
|
end
|
|
297
310
|
|
|
@@ -313,8 +326,16 @@ end
|
|
|
313
326
|
-- leaves cleaned, and so does the explain record it interrupted.
|
|
314
327
|
function EntyClass:_run_op(ctx, post_done)
|
|
315
328
|
local utility = self._utility
|
|
316
|
-
local
|
|
329
|
+
local state = { predone = false }
|
|
330
|
+
local ok, out, err = pcall(self._run_steps, self, ctx, post_done, state)
|
|
317
331
|
if ok then
|
|
332
|
+
-- A refusal or a failed step left before PreDone.
|
|
333
|
+
if not state.predone then
|
|
334
|
+
local lerr = self:_late_done(ctx)
|
|
335
|
+
if lerr ~= nil then
|
|
336
|
+
return nil, lerr
|
|
337
|
+
end
|
|
338
|
+
end
|
|
318
339
|
return out, err
|
|
319
340
|
end
|
|
320
341
|
|
|
@@ -328,7 +349,22 @@ function EntyClass:_run_op(ctx, post_done)
|
|
|
328
349
|
if not hookok then
|
|
329
350
|
out = hookerr
|
|
330
351
|
end
|
|
331
|
-
|
|
352
|
+
local uerr = self:_unexpected(ctx, out)
|
|
353
|
+
if not state.predone then
|
|
354
|
+
uerr = self:_late_done(ctx) or uerr
|
|
355
|
+
end
|
|
356
|
+
return nil, uerr
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
-- PreDone on an exit that left before it. What the hook raises is the
|
|
361
|
+
-- error, cleaned, in place of the one already on its way out.
|
|
362
|
+
function EntyClass:_late_done(ctx)
|
|
363
|
+
local ok, hookerr = pcall(self._utility.feature_hook, ctx, "PreDone")
|
|
364
|
+
if ok then
|
|
365
|
+
return nil
|
|
366
|
+
end
|
|
367
|
+
return self:_unexpected(ctx, hookerr)
|
|
332
368
|
end
|
|
333
369
|
|
|
334
370
|
|
|
@@ -353,7 +389,7 @@ function EntyClass:_unexpected(ctx, raised)
|
|
|
353
389
|
end
|
|
354
390
|
|
|
355
391
|
|
|
356
|
-
function EntyClass:_run_steps(ctx, post_done)
|
|
392
|
+
function EntyClass:_run_steps(ctx, post_done, state)
|
|
357
393
|
local utility = self._utility
|
|
358
394
|
|
|
359
395
|
-- #PrePoint-Hook
|
|
@@ -400,6 +436,7 @@ function EntyClass:_run_steps(ctx, post_done)
|
|
|
400
436
|
return utility.make_error(ctx, err)
|
|
401
437
|
end
|
|
402
438
|
|
|
439
|
+
state.predone = true
|
|
403
440
|
-- #PreDone-Hook
|
|
404
441
|
|
|
405
442
|
post_done()
|
|
@@ -111,25 +111,59 @@ function ProjectNameSDK.new(options)
|
|
|
111
111
|
-- declares `transport: 'wrap'` wrap whatever is current, so `test`
|
|
112
112
|
-- must be added before them to sit at the base of the chain.
|
|
113
113
|
local feature_opts = helpers.to_map(vs.getprop(self.options, "feature"))
|
|
114
|
+
local function active(fname)
|
|
115
|
+
local fopts = feature_opts ~= nil and helpers.to_map(feature_opts[fname]) or nil
|
|
116
|
+
return fopts ~= nil and fopts["active"] == true
|
|
117
|
+
end
|
|
118
|
+
local extend = {}
|
|
119
|
+
local given = vs.getprop(self.options, "extend")
|
|
120
|
+
if type(given) == "table" then
|
|
121
|
+
for _, f in ipairs(given) do
|
|
122
|
+
if type(f) == "table" and type(f.get_name) == "function" then
|
|
123
|
+
table.insert(extend, f)
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
local placed = {}
|
|
114
128
|
if feature_opts ~= nil then
|
|
115
129
|
local featureorder = vs.getpath(self.options, "__derived__.featureorder")
|
|
116
130
|
if type(featureorder) == "table" then
|
|
117
131
|
for _, fname in ipairs(featureorder) do
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
132
|
+
if active(fname) then
|
|
133
|
+
-- An active name with no generated class is legal when an
|
|
134
|
+
-- extend-supplied instance carries that name (station's adopt
|
|
135
|
+
-- path): the instance takes the slot the order gives its name.
|
|
136
|
+
local carried = nil
|
|
137
|
+
if features_factory[fname] == nil then
|
|
138
|
+
for _, f in ipairs(extend) do
|
|
139
|
+
if f:get_name() == fname then
|
|
140
|
+
carried = f
|
|
141
|
+
break
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
if carried ~= nil then
|
|
146
|
+
placed[carried] = true
|
|
147
|
+
utility.feature_add(self._rootctx, carried)
|
|
148
|
+
else
|
|
149
|
+
utility.feature_add(self._rootctx, _make_feature(fname))
|
|
150
|
+
end
|
|
121
151
|
end
|
|
122
152
|
end
|
|
123
153
|
end
|
|
124
154
|
end
|
|
125
155
|
|
|
126
|
-
--
|
|
127
|
-
local
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
156
|
+
-- An extend feature is active by its option, else by its own flag.
|
|
157
|
+
local function ext_active(f)
|
|
158
|
+
local fopts = feature_opts ~= nil and helpers.to_map(feature_opts[f:get_name()]) or nil
|
|
159
|
+
if fopts ~= nil and fopts["active"] ~= nil then
|
|
160
|
+
return fopts["active"] == true
|
|
161
|
+
end
|
|
162
|
+
return f.active == true
|
|
163
|
+
end
|
|
164
|
+
for _, f in ipairs(extend) do
|
|
165
|
+
if not placed[f] and ext_active(f) then
|
|
166
|
+
utility.feature_add(self._rootctx, f)
|
|
133
167
|
end
|
|
134
168
|
end
|
|
135
169
|
|
|
@@ -21,8 +21,9 @@ function formatLuaTable(obj: any, indent: number = 0): string {
|
|
|
21
21
|
const padInner = ' '.repeat(indent + 1)
|
|
22
22
|
|
|
23
23
|
if (Array.isArray(obj)) {
|
|
24
|
+
// A bare {} reads as a map; the struct port's marker keeps an empty list a list.
|
|
24
25
|
if (obj.length === 0) {
|
|
25
|
-
return '{}'
|
|
26
|
+
return 'setmetatable({}, { __jsontype = "array" })'
|
|
26
27
|
}
|
|
27
28
|
const items = obj.map(v => padInner + formatLuaValue(v, indent + 1)).join(',\n')
|
|
28
29
|
return `{\n${items},\n${pad}}`
|
|
@@ -592,7 +592,8 @@ let () =
|
|
|
592
592
|
("apikey", Str (canary_of "apikey"));
|
|
593
593
|
("feature", jo [
|
|
594
594
|
("secrets", jo [("active", Bool false); ("name", Str "ZZNAME-feat123");
|
|
595
|
-
("
|
|
595
|
+
("providers", ja [jo [("name", Str "static");
|
|
596
|
+
("token", Str "ZZTOKEN-feat456")]])]);
|
|
596
597
|
("rbac", jo [("active", Bool false);
|
|
597
598
|
("rules", jo [("zztoken.load", Str "PLAINRULE-k7j5h3g1")])]);
|
|
598
599
|
("test", jo [("active", Bool false); ("entity", seeded)])]);
|
|
@@ -22,26 +22,41 @@ let unexpected (ctx : ctx) (e : exn) : value =
|
|
|
22
22
|
* returns resdata when throw is disabled, or raises). *)
|
|
23
23
|
let run_op (ctx : ctx) (post_done : unit -> unit) : value =
|
|
24
24
|
let utility = cu ctx in
|
|
25
|
+
let predone = ref false in
|
|
25
26
|
let bail (err : sdk_error option) = raise (Op_return (utility.u_make_error ctx err)) in
|
|
26
|
-
|
|
27
|
+
(* A refusal, a failed step or a raise left before PreDone. What the late
|
|
28
|
+
* hook raises leaves cleaned, in place of the error on its way out. *)
|
|
29
|
+
let late () =
|
|
30
|
+
if not !predone then begin
|
|
31
|
+
predone := true;
|
|
32
|
+
(try feature_hook ctx "PreDone"
|
|
33
|
+
with hookerr ->
|
|
34
|
+
if ctx.c_ctrl.ctrl_throw <> Some false then raise (clean_exn ctx hookerr))
|
|
35
|
+
end in
|
|
36
|
+
match
|
|
27
37
|
(try
|
|
28
|
-
(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
(try
|
|
39
|
+
(* #PrePoint-Hook *)
|
|
40
|
+
let point = (match utility.u_make_point ctx with (p, None) -> p | (_, e) -> bail e) in
|
|
41
|
+
Hashtbl.replace ctx.c_out "point" (OPoint point);
|
|
42
|
+
(* #PreSpec-Hook *)
|
|
43
|
+
let spec = (match utility.u_make_spec ctx with (Some s, None) -> s | (_, e) -> bail e) in
|
|
44
|
+
Hashtbl.replace ctx.c_out "spec" (OSpec spec);
|
|
45
|
+
(* #PreRequest-Hook *)
|
|
46
|
+
let resp = (match utility.u_make_request ctx with (Some r, None) -> r | (_, e) -> bail e) in
|
|
47
|
+
Hashtbl.replace ctx.c_out "request" (OResponse resp);
|
|
48
|
+
(* #PreResponse-Hook *)
|
|
49
|
+
let resp2 = (match utility.u_make_response ctx with (Some r, None) -> r | (_, e) -> bail e) in
|
|
50
|
+
Hashtbl.replace ctx.c_out "response" (OResponse resp2);
|
|
51
|
+
(* #PreResult-Hook *)
|
|
52
|
+
let result = (match utility.u_make_result ctx with (Some r, None) -> r | (_, e) -> bail e) in
|
|
53
|
+
Hashtbl.replace ctx.c_out "result" (OResult result);
|
|
54
|
+
predone := true;
|
|
55
|
+
(* #PreDone-Hook *)
|
|
56
|
+
post_done ();
|
|
57
|
+
utility.u_done ctx
|
|
58
|
+
with Op_return v -> v)
|
|
59
|
+
with e -> unexpected ctx e)
|
|
60
|
+
with
|
|
61
|
+
| v -> late (); v
|
|
62
|
+
| exception e -> late (); raise e
|
|
@@ -484,7 +484,7 @@ sub make_sdk {
|
|
|
484
484
|
$feature{log} = { 'active' => 1,
|
|
485
485
|
'logger' => sub { push @$sinks, { 'name' => 'log', 'text' => "$_[0]" }; return } }
|
|
486
486
|
if has_feature('log');
|
|
487
|
-
$feature{debug} = { 'active' => 1, '
|
|
487
|
+
$feature{debug} = { 'active' => 1, 'onEntry' => $capture->('debug') } if has_feature('debug');
|
|
488
488
|
$feature{audit} = { 'active' => 1, 'sink' => $capture->('audit') } if has_feature('audit');
|
|
489
489
|
$feature{telemetry} = { 'active' => 1, 'exporter' => $capture->('telemetry') }
|
|
490
490
|
if has_feature('telemetry');
|
|
@@ -229,6 +229,7 @@ sub stream {
|
|
|
229
229
|
sub _run_op {
|
|
230
230
|
my ($self, $ctx, $post_done) = @_;
|
|
231
231
|
my $utility = $self->{_utility};
|
|
232
|
+
my $predone = 0;
|
|
232
233
|
|
|
233
234
|
my $out = eval {
|
|
234
235
|
# #PrePoint-Hook
|
|
@@ -261,6 +262,7 @@ sub _run_op {
|
|
|
261
262
|
$ctx->{out}{result} = $result;
|
|
262
263
|
return $utility->{make_error}->($ctx, $result_err) if $result_err;
|
|
263
264
|
|
|
265
|
+
$predone = 1;
|
|
264
266
|
# #PreDone-Hook
|
|
265
267
|
|
|
266
268
|
$post_done->();
|
|
@@ -302,12 +304,31 @@ sub _run_op {
|
|
|
302
304
|
}
|
|
303
305
|
|
|
304
306
|
my $e = $self->_unexpected($ctx, $operr);
|
|
307
|
+
# A refusal, a failed step or a die left before PreDone.
|
|
308
|
+
$self->_late_done($ctx) unless $predone;
|
|
305
309
|
die $e if defined $e;
|
|
306
310
|
return undef;
|
|
307
311
|
}
|
|
312
|
+
$self->_late_done($ctx) unless $predone;
|
|
308
313
|
return $out;
|
|
309
314
|
}
|
|
310
315
|
|
|
316
|
+
# PreDone on an exit that left before it. What the hook dies with leaves
|
|
317
|
+
# cleaned, in place of the error already on its way out.
|
|
318
|
+
sub _late_done {
|
|
319
|
+
my ($self, $ctx) = @_;
|
|
320
|
+
my $fired = eval {
|
|
321
|
+
$self->{_utility}{feature_hook}->($ctx, 'PreDone');
|
|
322
|
+
1;
|
|
323
|
+
};
|
|
324
|
+
return if $fired;
|
|
325
|
+
my $hookerr = $@;
|
|
326
|
+
$ctx->{ctrl}{err} = $hookerr;
|
|
327
|
+
my $e = $self->_unexpected($ctx, $hookerr);
|
|
328
|
+
die $e if defined $e;
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
|
|
311
332
|
# An exception the pipeline did not build still leaves through the
|
|
312
333
|
# caller: it is cleaned, and so is the explain record it interrupted.
|
|
313
334
|
# Answers undef when throwing is disabled, as the pipeline's own errors do.
|
|
@@ -72,22 +72,41 @@ sub new {
|
|
|
72
72
|
my $featureorder = ProjectNameHelpers::gpath(
|
|
73
73
|
$self->{options}, '__derived__.featureorder');
|
|
74
74
|
$featureorder = [] unless Voxgig::Struct::islist($featureorder);
|
|
75
|
+
my $extend = ProjectNameHelpers::gp($self->{options}, 'extend');
|
|
76
|
+
my @extend = grep { Scalar::Util::blessed($_) && $_->can('get_name') }
|
|
77
|
+
(Voxgig::Struct::islist($extend) ? @$extend : ());
|
|
78
|
+
my $active = sub {
|
|
79
|
+
my $fopts = ProjectNameHelpers::to_map($feature_opts->{ $_[0] });
|
|
80
|
+
return $fopts && ProjectNameHelpers::is_true($fopts->{active});
|
|
81
|
+
};
|
|
82
|
+
my %placed;
|
|
75
83
|
for my $fname (@$featureorder) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
next unless $active->($fname);
|
|
85
|
+
my $gen = ProjectNameFeatures::make_feature($fname);
|
|
86
|
+
# An active name with no generated class is legal when an
|
|
87
|
+
# extend-supplied instance carries that name (station's adopt path):
|
|
88
|
+
# the instance takes the slot the order gives its name.
|
|
89
|
+
my ($carried) = $gen->get_name eq $fname ? () :
|
|
90
|
+
grep { $_->get_name eq $fname } @extend;
|
|
91
|
+
if ($carried) {
|
|
92
|
+
$placed{ Scalar::Util::refaddr($carried) } = 1;
|
|
93
|
+
$utility->{feature_add}->($self->{_rootctx}, $carried);
|
|
94
|
+
next;
|
|
80
95
|
}
|
|
96
|
+
$utility->{feature_add}->($self->{_rootctx}, $gen);
|
|
81
97
|
}
|
|
82
98
|
|
|
83
|
-
#
|
|
84
|
-
my $
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
99
|
+
# An extend feature is active by its option, else by its own flag.
|
|
100
|
+
my $ext_active = sub {
|
|
101
|
+
my ($f) = @_;
|
|
102
|
+
my $fopts = ProjectNameHelpers::to_map($feature_opts->{ $f->get_name });
|
|
103
|
+
return ProjectNameHelpers::is_true($fopts->{active})
|
|
104
|
+
if $fopts && defined $fopts->{active};
|
|
105
|
+
return $f->can('get_active') && ProjectNameHelpers::is_true($f->get_active);
|
|
106
|
+
};
|
|
107
|
+
for my $f (@extend) {
|
|
108
|
+
next if $placed{ Scalar::Util::refaddr($f) } || !$ext_active->($f);
|
|
109
|
+
$utility->{feature_add}->($self->{_rootctx}, $f);
|
|
91
110
|
}
|
|
92
111
|
|
|
93
112
|
# Initialize features.
|
|
@@ -181,8 +181,13 @@ class EntyClass
|
|
|
181
181
|
|
|
182
182
|
// The pipeline runs as the caller iterates, so its errors leave
|
|
183
183
|
// through the same catch path as an operation's.
|
|
184
|
+
$predone = false;
|
|
184
185
|
try {
|
|
185
186
|
$failed = $this->_stream_steps($ctx);
|
|
187
|
+
if ($failed === null) {
|
|
188
|
+
$predone = true;
|
|
189
|
+
($utility->feature_hook)($ctx, "PreDone");
|
|
190
|
+
}
|
|
186
191
|
$result = $ctx->result;
|
|
187
192
|
|
|
188
193
|
// Inbound: prefer the streaming feature's incremental generator;
|
|
@@ -231,10 +236,14 @@ class EntyClass
|
|
|
231
236
|
if ($err !== null) {
|
|
232
237
|
throw $err;
|
|
233
238
|
}
|
|
239
|
+
} finally {
|
|
240
|
+
if (!$predone) {
|
|
241
|
+
$this->_late_done($ctx);
|
|
242
|
+
}
|
|
234
243
|
}
|
|
235
244
|
}
|
|
236
245
|
|
|
237
|
-
// The steps
|
|
246
|
+
// The steps before PreDone, with their hooks; the first that fails
|
|
238
247
|
// hands back its error.
|
|
239
248
|
private function _stream_steps($ctx): mixed
|
|
240
249
|
{
|
|
@@ -275,7 +284,6 @@ class EntyClass
|
|
|
275
284
|
return $err;
|
|
276
285
|
}
|
|
277
286
|
|
|
278
|
-
($utility->feature_hook)($ctx, "PreDone");
|
|
279
287
|
return null;
|
|
280
288
|
}
|
|
281
289
|
|
|
@@ -294,9 +302,10 @@ class EntyClass
|
|
|
294
302
|
private function _run_op($ctx, callable $post_done): mixed
|
|
295
303
|
{
|
|
296
304
|
$utility = $this->_utility;
|
|
305
|
+
$predone = false;
|
|
297
306
|
|
|
298
307
|
try {
|
|
299
|
-
return $this->_run_steps($ctx, $post_done);
|
|
308
|
+
return $this->_run_steps($ctx, $post_done, $predone);
|
|
300
309
|
} catch (\Throwable $err) {
|
|
301
310
|
// What a hook throws here must not escape the cleaning below.
|
|
302
311
|
try {
|
|
@@ -312,6 +321,25 @@ class EntyClass
|
|
|
312
321
|
throw $err;
|
|
313
322
|
}
|
|
314
323
|
return null;
|
|
324
|
+
} finally {
|
|
325
|
+
// A refusal, a failed step or a throw left before PreDone.
|
|
326
|
+
if (!$predone) {
|
|
327
|
+
$this->_late_done($ctx);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// PreDone on an exit that left before it. What the hook throws leaves
|
|
333
|
+
// cleaned, in place of the error already on its way out.
|
|
334
|
+
private function _late_done($ctx): void
|
|
335
|
+
{
|
|
336
|
+
try {
|
|
337
|
+
($this->_utility->feature_hook)($ctx, "PreDone");
|
|
338
|
+
} catch (\Throwable $hookerr) {
|
|
339
|
+
$err = $this->_unexpected($ctx, $hookerr);
|
|
340
|
+
if ($err !== null) {
|
|
341
|
+
throw $err;
|
|
342
|
+
}
|
|
315
343
|
}
|
|
316
344
|
}
|
|
317
345
|
|
|
@@ -325,7 +353,7 @@ class EntyClass
|
|
|
325
353
|
return $ctx->ctrl->throw_err === false ? null : $cleaned;
|
|
326
354
|
}
|
|
327
355
|
|
|
328
|
-
private function _run_steps($ctx, callable $post_done): mixed
|
|
356
|
+
private function _run_steps($ctx, callable $post_done, bool &$predone): mixed
|
|
329
357
|
{
|
|
330
358
|
$utility = $this->_utility;
|
|
331
359
|
|
|
@@ -369,6 +397,7 @@ class EntyClass
|
|
|
369
397
|
return ($utility->make_error)($ctx, $err);
|
|
370
398
|
}
|
|
371
399
|
|
|
400
|
+
$predone = true;
|
|
372
401
|
// #PreDone-Hook
|
|
373
402
|
|
|
374
403
|
$post_done();
|
|
@@ -70,6 +70,7 @@ class ProjectNameSDK implements \JsonSerializable
|
|
|
70
70
|
// whose model declares `transport: 'wrap'` wrap whatever is
|
|
71
71
|
// current, so `test` must be added before them to sit at the base.
|
|
72
72
|
$feature_opts = ProjectNameHelpers::to_map(Struct::getprop($this->options, "feature"));
|
|
73
|
+
$placed = [];
|
|
73
74
|
if ($feature_opts) {
|
|
74
75
|
$featureorder = Struct::getpath($this->options, "__derived__.featureorder");
|
|
75
76
|
if (is_array($featureorder)) {
|
|
@@ -78,14 +79,14 @@ class ProjectNameSDK implements \JsonSerializable
|
|
|
78
79
|
if ($fopts && isset($fopts["active"]) && $fopts["active"] === true) {
|
|
79
80
|
// An active name with no generated feature class is
|
|
80
81
|
// legal when an extend-supplied instance carries that
|
|
81
|
-
// name (station's adopt path): the instance
|
|
82
|
-
//
|
|
83
|
-
// skip it here rather than add a BaseFeature stray
|
|
84
|
-
// that would silently shift feature positions.
|
|
82
|
+
// name (station's adopt path): the instance takes the
|
|
83
|
+
// slot the order gives its name.
|
|
85
84
|
if (!ProjectNameFeatures::has_feature($fname)) {
|
|
86
85
|
foreach ($extend_val as $ef) {
|
|
87
86
|
if (is_object($ef) && method_exists($ef, 'get_name')
|
|
88
87
|
&& $fname === $ef->get_name()) {
|
|
88
|
+
$placed[] = $ef;
|
|
89
|
+
($utility->feature_add)($this->_rootctx, $ef);
|
|
89
90
|
continue 2;
|
|
90
91
|
}
|
|
91
92
|
}
|
|
@@ -96,9 +97,15 @@ class ProjectNameSDK implements \JsonSerializable
|
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
//
|
|
100
|
+
// An extend feature is active by its option, else by its own flag.
|
|
100
101
|
foreach ($extend_val as $f) {
|
|
101
|
-
if (is_object($f)
|
|
102
|
+
if (!is_object($f) || !method_exists($f, 'get_name') || in_array($f, $placed, true)) {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
$fopts = ProjectNameHelpers::to_map($feature_opts[$f->get_name()] ?? null);
|
|
106
|
+
$fa = $fopts ? ($fopts["active"] ?? null) : null;
|
|
107
|
+
$own = method_exists($f, 'get_active') ? $f->get_active() : ($f->active ?? null);
|
|
108
|
+
if (true === $fa || (null === $fa && true === $own)) {
|
|
102
109
|
($utility->feature_add)($this->_rootctx, $f);
|
|
103
110
|
}
|
|
104
111
|
}
|
|
@@ -108,10 +108,15 @@ class EntyClass:
|
|
|
108
108
|
return bool(signal())
|
|
109
109
|
return bool(getattr(signal, "aborted", False))
|
|
110
110
|
|
|
111
|
+
predone = False
|
|
112
|
+
|
|
111
113
|
# The pipeline runs as the caller iterates, so its errors leave
|
|
112
114
|
# through the same catch path as an operation's.
|
|
113
115
|
try:
|
|
114
116
|
failed = self._stream_steps(ctx)
|
|
117
|
+
if failed is None:
|
|
118
|
+
predone = True
|
|
119
|
+
utility.feature_hook(ctx, "PreDone")
|
|
115
120
|
result = ctx.result
|
|
116
121
|
|
|
117
122
|
# Inbound: prefer the streaming feature's incremental generator;
|
|
@@ -148,8 +153,11 @@ class EntyClass:
|
|
|
148
153
|
err = hookerr
|
|
149
154
|
if self._unexpected(ctx, err) is not None:
|
|
150
155
|
raise err from None
|
|
156
|
+
finally:
|
|
157
|
+
if not predone:
|
|
158
|
+
self._late_done(ctx)
|
|
151
159
|
|
|
152
|
-
# The steps
|
|
160
|
+
# The steps before PreDone, with their hooks; the first that fails
|
|
153
161
|
# hands back its error.
|
|
154
162
|
def _stream_steps(self, ctx):
|
|
155
163
|
utility = self._utility
|
|
@@ -184,7 +192,6 @@ class EntyClass:
|
|
|
184
192
|
if err is not None:
|
|
185
193
|
return err
|
|
186
194
|
|
|
187
|
-
utility.feature_hook(ctx, "PreDone")
|
|
188
195
|
return None
|
|
189
196
|
|
|
190
197
|
# #LoadOp
|
|
@@ -201,6 +208,7 @@ class EntyClass:
|
|
|
201
208
|
|
|
202
209
|
def _run_op(self, ctx, post_done):
|
|
203
210
|
utility = self._utility
|
|
211
|
+
predone = False
|
|
204
212
|
|
|
205
213
|
try:
|
|
206
214
|
# #PrePoint-Hook
|
|
@@ -238,6 +246,7 @@ class EntyClass:
|
|
|
238
246
|
if err is not None:
|
|
239
247
|
return utility.make_error(ctx, err)
|
|
240
248
|
|
|
249
|
+
predone = True
|
|
241
250
|
# #PreDone-Hook
|
|
242
251
|
|
|
243
252
|
post_done()
|
|
@@ -273,6 +282,20 @@ class EntyClass:
|
|
|
273
282
|
return None
|
|
274
283
|
raise err from None
|
|
275
284
|
|
|
285
|
+
finally:
|
|
286
|
+
# A refusal, a failed step or a raise left before PreDone.
|
|
287
|
+
if not predone:
|
|
288
|
+
self._late_done(ctx)
|
|
289
|
+
|
|
290
|
+
# PreDone on an exit that left before it. What the hook raises leaves
|
|
291
|
+
# cleaned, in place of the error already on its way out.
|
|
292
|
+
def _late_done(self, ctx):
|
|
293
|
+
try:
|
|
294
|
+
self._utility.feature_hook(ctx, "PreDone")
|
|
295
|
+
except Exception as err:
|
|
296
|
+
if self._unexpected(ctx, err) is not None:
|
|
297
|
+
raise err from None
|
|
298
|
+
|
|
276
299
|
# An error a hook raised never passed through make_error: it is cleaned,
|
|
277
300
|
# and so is the explain record it interrupted. None when the caller
|
|
278
301
|
# switched throwing off.
|
|
@@ -60,28 +60,42 @@ class ProjectNameSDK:
|
|
|
60
60
|
extend = options.get("extend") if isinstance(options, dict) else None
|
|
61
61
|
if not isinstance(extend, list):
|
|
62
62
|
extend = []
|
|
63
|
+
def fname_of(f):
|
|
64
|
+
return f.get("name") if isinstance(f, dict) else getattr(f, "name", None)
|
|
65
|
+
|
|
66
|
+
def is_active(fname):
|
|
67
|
+
fopts = helpers.to_map((feature_opts or {}).get(fname))
|
|
68
|
+
return fopts is not None and fopts.get("active") is True
|
|
69
|
+
|
|
70
|
+
placed = []
|
|
63
71
|
if feature_opts is not None:
|
|
64
72
|
featureorder = vs.getpath(self.options, "__derived__.featureorder")
|
|
65
73
|
if isinstance(featureorder, list):
|
|
66
74
|
for fname in featureorder:
|
|
67
|
-
|
|
68
|
-
if fopts is not None and fopts.get("active") is True:
|
|
75
|
+
if is_active(fname):
|
|
69
76
|
# An active name with no generated feature class is
|
|
70
77
|
# legal when an extend-supplied instance carries that
|
|
71
|
-
# name (station's adopt path): the instance
|
|
72
|
-
#
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
for f in extend
|
|
79
|
-
):
|
|
78
|
+
# name (station's adopt path): the instance takes the
|
|
79
|
+
# slot the order gives its name.
|
|
80
|
+
carried = None if _has_feature(fname) else next(
|
|
81
|
+
(f for f in extend if fname == fname_of(f)), None)
|
|
82
|
+
if carried is not None:
|
|
83
|
+
placed.append(carried)
|
|
84
|
+
utility.feature_add(self._rootctx, carried)
|
|
80
85
|
continue
|
|
81
86
|
utility.feature_add(self._rootctx, _make_feature(fname))
|
|
82
87
|
|
|
83
|
-
#
|
|
88
|
+
# An extend feature is active by its option, else by its own flag.
|
|
89
|
+
def ext_active(f):
|
|
90
|
+
fopts = helpers.to_map((feature_opts or {}).get(fname_of(f)))
|
|
91
|
+
if fopts is not None and fopts.get("active") is not None:
|
|
92
|
+
return fopts.get("active") is True
|
|
93
|
+
own = f.get("active") if isinstance(f, dict) else getattr(f, "active", None)
|
|
94
|
+
return own is True
|
|
95
|
+
|
|
84
96
|
for f in extend:
|
|
97
|
+
if any(f is p for p in placed) or not ext_active(f):
|
|
98
|
+
continue
|
|
85
99
|
if isinstance(f, dict) or (hasattr(f, "get_name") and callable(f.get_name)):
|
|
86
100
|
utility.feature_add(self._rootctx, f)
|
|
87
101
|
|
|
@@ -320,7 +320,7 @@ class ${Name}CleanTest < Minitest::Test
|
|
|
320
320
|
capture = ->(name) { ->(rec) { sinks.concat(Sweep.forms(name, rec)) } }
|
|
321
321
|
feature = {}
|
|
322
322
|
feature["log"] = { "active" => true, "logger" => CaptureLogger.new(sinks) } if has_feature?("log")
|
|
323
|
-
feature["debug"] = { "active" => true, "
|
|
323
|
+
feature["debug"] = { "active" => true, "onEntry" => capture.call("debug") } if has_feature?("debug")
|
|
324
324
|
feature["audit"] = { "active" => true, "sink" => capture.call("audit") } if has_feature?("audit")
|
|
325
325
|
feature["telemetry"] = { "active" => true, "exporter" => capture.call("telemetry") } if has_feature?("telemetry")
|
|
326
326
|
feature["cost"] = { "active" => true, "sink" => capture.call("cost") } if has_feature?("cost")
|