@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
|
@@ -134,9 +134,14 @@ class EntyClass
|
|
|
134
134
|
yielder << item
|
|
135
135
|
inblock = false
|
|
136
136
|
end
|
|
137
|
+
predone = false
|
|
137
138
|
begin
|
|
138
139
|
catch(:stream_stop) do
|
|
139
140
|
failed = _stream_steps(ctx)
|
|
141
|
+
if failed.nil?
|
|
142
|
+
predone = true
|
|
143
|
+
utility.feature_hook.call(ctx, "PreDone")
|
|
144
|
+
end
|
|
140
145
|
result = ctx.result
|
|
141
146
|
|
|
142
147
|
# Inbound: prefer the streaming feature's incremental Enumerator;
|
|
@@ -173,11 +178,13 @@ class EntyClass
|
|
|
173
178
|
|
|
174
179
|
e = _unexpected(ctx, operr)
|
|
175
180
|
raise e, cause: nil unless e.nil?
|
|
181
|
+
ensure
|
|
182
|
+
_late_done(ctx) unless predone
|
|
176
183
|
end
|
|
177
184
|
end
|
|
178
185
|
end
|
|
179
186
|
|
|
180
|
-
# The steps
|
|
187
|
+
# The steps before PreDone, with their hooks; the first that fails hands
|
|
181
188
|
# back its error.
|
|
182
189
|
private def _stream_steps(ctx)
|
|
183
190
|
utility = @_utility
|
|
@@ -207,7 +214,6 @@ class EntyClass
|
|
|
207
214
|
ctx.out["result"] = result
|
|
208
215
|
return err if err
|
|
209
216
|
|
|
210
|
-
utility.feature_hook.call(ctx, "PreDone")
|
|
211
217
|
nil
|
|
212
218
|
end
|
|
213
219
|
|
|
@@ -227,6 +233,7 @@ class EntyClass
|
|
|
227
233
|
|
|
228
234
|
def _run_op(ctx, &post_done)
|
|
229
235
|
utility = @_utility
|
|
236
|
+
predone = false
|
|
230
237
|
|
|
231
238
|
begin
|
|
232
239
|
# #PrePoint-Hook
|
|
@@ -259,6 +266,7 @@ class EntyClass
|
|
|
259
266
|
ctx.out["result"] = result
|
|
260
267
|
return utility.make_error.call(ctx, err) if err
|
|
261
268
|
|
|
269
|
+
predone = true
|
|
262
270
|
# #PreDone-Hook
|
|
263
271
|
|
|
264
272
|
post_done.call
|
|
@@ -299,9 +307,22 @@ class EntyClass
|
|
|
299
307
|
# Not a cause: the raw error would print beneath the cleaned one.
|
|
300
308
|
raise e, cause: nil unless e.nil?
|
|
301
309
|
nil
|
|
310
|
+
ensure
|
|
311
|
+
# A refusal, a failed step or a raise left before PreDone.
|
|
312
|
+
_late_done(ctx) unless predone
|
|
302
313
|
end
|
|
303
314
|
end
|
|
304
315
|
|
|
316
|
+
# PreDone on an exit that left before it. What the hook raises leaves
|
|
317
|
+
# cleaned, in place of the error already on its way out.
|
|
318
|
+
def _late_done(ctx)
|
|
319
|
+
@_utility.feature_hook.call(ctx, "PreDone")
|
|
320
|
+
rescue StandardError => hookerr
|
|
321
|
+
ctx.ctrl.err = hookerr
|
|
322
|
+
e = _unexpected(ctx, hookerr)
|
|
323
|
+
raise e, cause: nil unless e.nil?
|
|
324
|
+
end
|
|
325
|
+
|
|
305
326
|
# An exception the pipeline did not build still leaves through the
|
|
306
327
|
# caller: it is cleaned, and so is the explain record it interrupted.
|
|
307
328
|
# Answers nil when throwing is disabled, as the pipeline's own errors do.
|
|
@@ -52,26 +52,42 @@ class ProjectNameSDK
|
|
|
52
52
|
# declares `transport: 'wrap'` wrap whatever is current, so `test`
|
|
53
53
|
# must be added before them to sit at the base of the chain.
|
|
54
54
|
feature_opts = ProjectNameHelpers.to_map(VoxgigStruct.getprop(@options, "feature"))
|
|
55
|
+
active = lambda do |fname|
|
|
56
|
+
fopts = feature_opts && ProjectNameHelpers.to_map(feature_opts[fname])
|
|
57
|
+
!fopts.nil? && fopts["active"] == true
|
|
58
|
+
end
|
|
59
|
+
extend_val = VoxgigStruct.getprop(@options, "extend")
|
|
60
|
+
extend_list = (extend_val.is_a?(Array) ? extend_val : []).select { |f| f.respond_to?(:get_name) }
|
|
61
|
+
placed = []
|
|
55
62
|
if feature_opts
|
|
56
63
|
featureorder = VoxgigStruct.getpath(@options, "__derived__.featureorder")
|
|
57
64
|
if featureorder.is_a?(Array)
|
|
58
65
|
featureorder.each do |fname|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
next unless active.call(fname)
|
|
67
|
+
gen = ProjectNameFeatures.make_feature(fname)
|
|
68
|
+
# An active name with no generated class is legal when an
|
|
69
|
+
# extend-supplied instance carries that name (station's adopt
|
|
70
|
+
# path): the instance takes the slot the order gives its name.
|
|
71
|
+
carried = gen.get_name == fname ? nil : extend_list.find { |f| f.get_name == fname }
|
|
72
|
+
if carried
|
|
73
|
+
placed << carried
|
|
74
|
+
utility.feature_add.call(@_rootctx, carried)
|
|
75
|
+
else
|
|
76
|
+
utility.feature_add.call(@_rootctx, gen)
|
|
62
77
|
end
|
|
63
78
|
end
|
|
64
79
|
end
|
|
65
80
|
end
|
|
66
81
|
|
|
67
|
-
#
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
82
|
+
# An extend feature is active by its option, else by its own flag.
|
|
83
|
+
ext_active = lambda do |f|
|
|
84
|
+
fopts = feature_opts && ProjectNameHelpers.to_map(feature_opts[f.get_name])
|
|
85
|
+
next fopts["active"] == true if fopts && !fopts["active"].nil?
|
|
86
|
+
f.respond_to?(:get_active) && f.get_active == true
|
|
87
|
+
end
|
|
88
|
+
extend_list.each do |f|
|
|
89
|
+
next if placed.any? { |p| p.equal?(f) } || !ext_active.call(f)
|
|
90
|
+
utility.feature_add.call(@_rootctx, f)
|
|
75
91
|
end
|
|
76
92
|
|
|
77
93
|
# Initialize features.
|
|
@@ -788,24 +788,18 @@ fn clean_no_credential_leaves_the_sdk_in_any_form() {
|
|
|
788
788
|
Some(jo(vec![("name", Value::str("zzcred"))])));
|
|
789
789
|
drive(&renamed, &target, Value::Noval, &sinks);
|
|
790
790
|
|
|
791
|
-
// A credential mistyped as a map
|
|
792
|
-
//
|
|
793
|
-
|
|
794
|
-
// string quoting the value, cleaned the way a validation message is.
|
|
795
|
-
let mistyped = construct(jo(vec![
|
|
791
|
+
// A credential mistyped as a map is rejected by validation, whose message
|
|
792
|
+
// quotes the value it rejected.
|
|
793
|
+
match ${Name}SDK::new(offline(jo(vec![
|
|
796
794
|
("apikey", jo(vec![("value", Value::str(CANARY_APIKEY))])),
|
|
797
795
|
("clean", jo(vec![("values", Value::str(CANARY_VALUE))])),
|
|
798
|
-
]))
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
&mistyped.get_root_ctx(),
|
|
806
|
-
&format!("apikey: expected string, got {{\\"value\\":\\"{}\\"}}", CANARY_APIKEY),
|
|
807
|
-
),
|
|
808
|
-
);
|
|
796
|
+
]))) {
|
|
797
|
+
Ok(_) => panic!("a credential mistyped as a map should be rejected"),
|
|
798
|
+
Err(err) => {
|
|
799
|
+
push(&sinks, "rejected:msg", err.msg.clone());
|
|
800
|
+
push(&sinks, "rejected:display", format!("{}", err));
|
|
801
|
+
}
|
|
802
|
+
}
|
|
809
803
|
|
|
810
804
|
// An error a feature hook raises, quoting the request, with explain on.
|
|
811
805
|
let hooked = make_sdk(
|
|
@@ -1026,7 +1020,10 @@ fn clean_reads_a_feature_name_as_a_name() {
|
|
|
1026
1020
|
jo(vec![
|
|
1027
1021
|
("active", Value::Bool(false)),
|
|
1028
1022
|
("name", Value::str("ZZNAME-feat123")),
|
|
1029
|
-
("
|
|
1023
|
+
("providers", Value::list(vec![jo(vec![
|
|
1024
|
+
("name", Value::str("static")),
|
|
1025
|
+
("token", Value::str("ZZTOKEN-feat456")),
|
|
1026
|
+
])])),
|
|
1030
1027
|
]),
|
|
1031
1028
|
),
|
|
1032
1029
|
(
|
|
@@ -82,6 +82,21 @@ impl EntyClass {
|
|
|
82
82
|
&self,
|
|
83
83
|
ctx: &Rc<Context>,
|
|
84
84
|
post_done: &dyn Fn(&Rc<Context>),
|
|
85
|
+
) -> Result<Value, ProjectNameError> {
|
|
86
|
+
let predone = std::cell::Cell::new(false);
|
|
87
|
+
let out = self.run_steps(ctx, post_done, &predone);
|
|
88
|
+
// A refusal or a failed step left before PreDone.
|
|
89
|
+
if !predone.get() {
|
|
90
|
+
self.utility.feature_hook(ctx, "PreDone");
|
|
91
|
+
}
|
|
92
|
+
out
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
fn run_steps(
|
|
96
|
+
&self,
|
|
97
|
+
ctx: &Rc<Context>,
|
|
98
|
+
post_done: &dyn Fn(&Rc<Context>),
|
|
99
|
+
predone: &std::cell::Cell<bool>,
|
|
85
100
|
) -> Result<Value, ProjectNameError> {
|
|
86
101
|
let utility = &self.utility;
|
|
87
102
|
|
|
@@ -125,6 +140,7 @@ impl EntyClass {
|
|
|
125
140
|
};
|
|
126
141
|
ctx.out_set("result", crate::core::types::OutVal::Result(result));
|
|
127
142
|
|
|
143
|
+
predone.set(true);
|
|
128
144
|
// #PreDone-Hook
|
|
129
145
|
|
|
130
146
|
post_done(ctx);
|
|
@@ -172,8 +188,12 @@ impl EntyClass {
|
|
|
172
188
|
);
|
|
173
189
|
|
|
174
190
|
// Run the same pipeline as run_op. A failed step leaves through
|
|
175
|
-
// make_error, as an operation's does.
|
|
176
|
-
let fail = |e: ProjectNameError|
|
|
191
|
+
// make_error, then PreDone, as an operation's does.
|
|
192
|
+
let fail = |e: ProjectNameError| {
|
|
193
|
+
let out = self.utility.make_error(&ctx, Some(e)).map(stream_items);
|
|
194
|
+
self.utility.feature_hook(&ctx, "PreDone");
|
|
195
|
+
out
|
|
196
|
+
};
|
|
177
197
|
self.utility.feature_hook(&ctx, "PrePoint");
|
|
178
198
|
let point = match self.utility.make_point(&ctx) {
|
|
179
199
|
Ok(p) => p,
|
|
@@ -570,17 +570,17 @@ object SdkCleanTestMain {
|
|
|
570
570
|
// out whichever name prepareAuth placed.
|
|
571
571
|
drive(makeSdk(SCENARIOS.head, sinks, null, auth = om("name" -> "zzcred")), target, null, sinks)
|
|
572
572
|
|
|
573
|
-
// A credential mistyped as a map
|
|
574
|
-
//
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
573
|
+
// A credential mistyped as a map is rejected by validation, whose message
|
|
574
|
+
// quotes the value it rejected.
|
|
575
|
+
val rejected =
|
|
576
|
+
try {
|
|
577
|
+
new ${SDK}(offline(om("apikey" -> om("value" -> CANARY_APIKEY),
|
|
578
|
+
"clean" -> om("values" -> CANARY_VALUE))))
|
|
579
|
+
null
|
|
580
|
+
}
|
|
581
|
+
catch { case e: RuntimeException => e }
|
|
582
|
+
rep.check("clean.mistyped", rejected != null, "a credential mistyped as a map should be rejected")
|
|
583
|
+
if (rejected != null) collect(sinks, "rejected", rejected)
|
|
584
584
|
|
|
585
585
|
// An exception a feature hook throws, quoting the request, skips makeError.
|
|
586
586
|
for (unexpected <- List(false, true)) {
|
|
@@ -74,6 +74,7 @@ abstract class EntityBase(name0: String, client0: SdkClient, entopts0: JMap[Stri
|
|
|
74
74
|
|
|
75
75
|
protected def runOp(ctx: Context, postDone: () => Unit): Object = {
|
|
76
76
|
val utility = this.utility
|
|
77
|
+
var predone = false
|
|
77
78
|
|
|
78
79
|
try {
|
|
79
80
|
// #PrePoint-Hook
|
|
@@ -101,6 +102,7 @@ abstract class EntityBase(name0: String, client0: SdkClient, entopts0: JMap[Stri
|
|
|
101
102
|
val result = utility.makeResult(ctx)
|
|
102
103
|
ctx.out.put("result", result)
|
|
103
104
|
|
|
105
|
+
predone = true
|
|
104
106
|
// #PreDone-Hook
|
|
105
107
|
|
|
106
108
|
postDone()
|
|
@@ -124,9 +126,21 @@ abstract class EntityBase(name0: String, client0: SdkClient, entopts0: JMap[Stri
|
|
|
124
126
|
else out
|
|
125
127
|
} catch {
|
|
126
128
|
case NonFatal(err) => unexpected(ctx, err)
|
|
129
|
+
} finally {
|
|
130
|
+
// A refusal, a failed step or a throw left before PreDone.
|
|
131
|
+
if (!predone) lateDone(ctx)
|
|
127
132
|
}
|
|
128
133
|
}
|
|
129
134
|
|
|
135
|
+
// PreDone on an exit that left before it. What the hook throws leaves
|
|
136
|
+
// cleaned, in place of the error already on its way out.
|
|
137
|
+
private def lateDone(ctx: Context): Unit =
|
|
138
|
+
try this.utility.featureHook(ctx, "PreDone")
|
|
139
|
+
catch {
|
|
140
|
+
case NonFatal(err) if !(java.lang.Boolean.FALSE == ctx.ctrl.throwing) => throw cleanError(ctx, err)
|
|
141
|
+
case NonFatal(_) => ()
|
|
142
|
+
}
|
|
143
|
+
|
|
130
144
|
// The catch path. makeError fires PreUnexpected; an error a hook throws
|
|
131
145
|
// there escapes it, even under throw false, so it is cleaned here.
|
|
132
146
|
private def unexpected(ctx: Context, err: Throwable): Object = {
|
|
@@ -625,13 +625,14 @@ ${candidateLines}
|
|
|
625
625
|
${Name}CleanTest.makeSdk(${Name}CleanTest.scenarios[0], box, auth: vm(("name", .string("zzcred")))),
|
|
626
626
|
target, VMap(), box)
|
|
627
627
|
|
|
628
|
-
// A credential mistyped as a map
|
|
629
|
-
//
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
628
|
+
// A credential mistyped as a map traps at construction, so the refusal
|
|
629
|
+
// that trap carries is cleaned here as makeOptions cleans it.
|
|
630
|
+
let quotectx = Context(["options": vm(("apikey", .string(canaryApikey)),
|
|
631
|
+
("clean", .map(vm(("values", .string(canaryValue))))))], nil)
|
|
632
|
+
quotectx.options = makeOptionsUtil(quotectx)
|
|
633
|
+
let refusal = cleanUtil(quotectx, .string("invalid options: Expected field apikey to be string, " +
|
|
634
|
+
"but found map: {\\"value\\":\\"" + canaryApikey + "\\",\\"note\\":\\"" + canaryValue + "\\"}"))
|
|
635
|
+
box.sinks.append(Sink(name: "rejected", text: refusal.asString ?? ""))
|
|
635
636
|
|
|
636
637
|
// An error a feature hook raises, quoting the request, skips makeError.
|
|
637
638
|
// A swift hook cannot throw, so no variant fails from PreUnexpected.
|
|
@@ -676,9 +677,8 @@ ${candidateLines}
|
|
|
676
677
|
("err", .nat(${Name}Error("denied_" + canaryValue, "coded failure", nil))))))
|
|
677
678
|
box.sinks += ${Name}CleanTest.formsOf("coded-nested", nested)
|
|
678
679
|
|
|
679
|
-
// With no clean option at all, or
|
|
680
|
-
|
|
681
|
-
for clean in [Value.noval, Value.bool(true)] {
|
|
680
|
+
// With no clean option at all, or a null one, the schema defaults still apply.
|
|
681
|
+
for clean in [Value.noval, Value.null] {
|
|
682
682
|
let fetch404: FetcherFunc = { _, url, fetchdef in
|
|
683
683
|
try ${Name}CleanTest.scenarios[1].respond(url, fetchdef)
|
|
684
684
|
}
|
|
@@ -687,7 +687,7 @@ ${candidateLines}
|
|
|
687
687
|
bareopts.entries["secret"] = .string(canarySecret)
|
|
688
688
|
bareopts.entries["headers"] = .map(vm(("X-Custom-Token", .string(canaryHeader))))
|
|
689
689
|
bareopts.entries["utility"] = .map(vm(("fetcher", .nat(fetch404))))
|
|
690
|
-
if !
|
|
690
|
+
if !clean.isNoval {
|
|
691
691
|
bareopts.entries["clean"] = clean
|
|
692
692
|
}
|
|
693
693
|
let bareerr = ${Name}CleanTest.drive(
|
|
@@ -103,6 +103,14 @@ open class ProjectNameEntityBase: Entity {
|
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
func runOp(_ ctx: Context, _ postDone: () -> Void) throws -> Value {
|
|
106
|
+
var predone = false
|
|
107
|
+
// A refusal or a failed step left before PreDone.
|
|
108
|
+
defer {
|
|
109
|
+
if !predone {
|
|
110
|
+
utility.featureHook(ctx, "PreDone")
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
106
114
|
// #PrePoint-Hook
|
|
107
115
|
|
|
108
116
|
do {
|
|
@@ -148,6 +156,7 @@ open class ProjectNameEntityBase: Entity {
|
|
|
148
156
|
return try utility.makeError(ctx, error)
|
|
149
157
|
}
|
|
150
158
|
|
|
159
|
+
predone = true
|
|
151
160
|
// #PreDone-Hook
|
|
152
161
|
|
|
153
162
|
postDone()
|
|
@@ -54,23 +54,37 @@ public final class ProjectNameSDK {
|
|
|
54
54
|
// declares `transport: 'wrap'` wrap whatever is current, so `test`
|
|
55
55
|
// must be added before them to sit at the base of the chain.
|
|
56
56
|
let featureOpts = gp(options, "feature").asMap ?? ProjectNameSdk.VMap()
|
|
57
|
+
func active(_ fname: String) -> Bool {
|
|
58
|
+
gp(featureOpts, fname).asMap?.entries["active"]?.asBool == true
|
|
59
|
+
}
|
|
60
|
+
let extend: [BaseFeature] = (gp(options, "extend").asList?.items ?? [])
|
|
61
|
+
.compactMap { $0.asNative as? BaseFeature }
|
|
62
|
+
var placed: [BaseFeature] = []
|
|
57
63
|
if let featureOrder = gpath(options, "__derived__", "featureorder").asList {
|
|
58
64
|
for fnameVal in featureOrder.items {
|
|
59
65
|
let fname = fnameVal.asString ?? ""
|
|
60
|
-
if fname
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
if fname == "" || !active(fname) {
|
|
67
|
+
continue
|
|
68
|
+
}
|
|
69
|
+
let gen = SdkConfig.makeFeature(fname)
|
|
70
|
+
// An active name with no generated class is legal when an
|
|
71
|
+
// extend-supplied instance carries that name (station's adopt
|
|
72
|
+
// path): the instance takes the slot the order gives its name.
|
|
73
|
+
if gen.getName() != fname, let carried = extend.first(where: { $0.getName() == fname }) {
|
|
74
|
+
placed.append(carried)
|
|
75
|
+
utility.featureAdd(rootctx, carried)
|
|
76
|
+
} else {
|
|
77
|
+
utility.featureAdd(rootctx, gen)
|
|
63
78
|
}
|
|
64
79
|
}
|
|
65
80
|
}
|
|
66
81
|
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
82
|
+
// An extend feature is active by its option, else by its own flag.
|
|
83
|
+
func extActive(_ feat: BaseFeature) -> Bool {
|
|
84
|
+
gp(featureOpts, feat.getName()).asMap?.entries["active"]?.asBool ?? feat.getActive()
|
|
85
|
+
}
|
|
86
|
+
for feat in extend where !placed.contains(where: { $0 === feat }) && extActive(feat) {
|
|
87
|
+
utility.featureAdd(rootctx, feat)
|
|
74
88
|
}
|
|
75
89
|
|
|
76
90
|
// Initialize features.
|
|
@@ -170,21 +170,26 @@ const testClient = client.tester()
|
|
|
170
170
|
|
|
171
171
|
${stateSection}### Add custom middleware
|
|
172
172
|
|
|
173
|
-
Pass features via the \`extend\` option
|
|
173
|
+
Pass features via the \`extend\` option. A feature is an object with a
|
|
174
|
+
\`name\`, an \`init\` method, and a method named after each pipeline stage it
|
|
175
|
+
hooks. It is installed, and its hooks fire, only while it is active:
|
|
176
|
+
\`feature.<name>.active\` decides, and where the options do not set it, the
|
|
177
|
+
object's own \`active\` flag does:
|
|
174
178
|
|
|
175
179
|
\`\`\`ts
|
|
176
180
|
const logger = {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
name: 'logger',
|
|
182
|
+
init() {},
|
|
183
|
+
PreRequest(ctx: any) {
|
|
184
|
+
console.log('Requesting:', ctx.spec.method, ctx.spec.path)
|
|
185
|
+
},
|
|
186
|
+
PreResponse(ctx: any) {
|
|
187
|
+
console.log('Status:', ctx.out.request?.status)
|
|
184
188
|
},
|
|
185
189
|
}
|
|
186
190
|
|
|
187
191
|
const client = new ${model.const.Name}SDK({${apikeyExtendField}
|
|
192
|
+
feature: { logger: { active: true } },
|
|
188
193
|
extend: [logger],
|
|
189
194
|
})
|
|
190
195
|
\`\`\`
|
|
@@ -131,8 +131,15 @@ class ProjectNameEntityBase<D = any> {
|
|
|
131
131
|
...(args || {}),
|
|
132
132
|
}, this._entctx)
|
|
133
133
|
|
|
134
|
+
let predone = false
|
|
135
|
+
|
|
134
136
|
try {
|
|
135
137
|
const failed = await this._streamSteps(ctx)
|
|
138
|
+
if (null == failed) {
|
|
139
|
+
predone = true
|
|
140
|
+
const fres = featureHook(ctx, 'PreDone')
|
|
141
|
+
if (fres instanceof Promise) { await fres }
|
|
142
|
+
}
|
|
136
143
|
const result: any = ctx.result
|
|
137
144
|
|
|
138
145
|
// Inbound: prefer the streaming feature's incremental iterator; else
|
|
@@ -171,10 +178,15 @@ class ProjectNameEntityBase<D = any> {
|
|
|
171
178
|
const e = this._unexpected(ctx, err)
|
|
172
179
|
if (e && true !== signal?.aborted) { throw e }
|
|
173
180
|
}
|
|
181
|
+
finally {
|
|
182
|
+
if (!predone) {
|
|
183
|
+
await this._lateDone(ctx)
|
|
184
|
+
}
|
|
185
|
+
}
|
|
174
186
|
}
|
|
175
187
|
|
|
176
188
|
|
|
177
|
-
// The steps
|
|
189
|
+
// The steps before PreDone, with their hooks; the first that fails
|
|
178
190
|
// hands back its error.
|
|
179
191
|
async _streamSteps(this: any, ctx: Context): Promise<Error | undefined> {
|
|
180
192
|
const {
|
|
@@ -197,8 +209,20 @@ class ProjectNameEntityBase<D = any> {
|
|
|
197
209
|
|
|
198
210
|
fres = featureHook(ctx, 'PreResult'); if (fres instanceof Promise) { await fres }
|
|
199
211
|
ctx.out.result = await makeResult(ctx); if (ctx.out.result instanceof Error) { return ctx.out.result }
|
|
212
|
+
}
|
|
213
|
+
|
|
200
214
|
|
|
201
|
-
|
|
215
|
+
// PreDone on an exit that left before it. What the hook throws leaves
|
|
216
|
+
// cleaned, in place of the error already on its way out.
|
|
217
|
+
async _lateDone(this: any, ctx: Context) {
|
|
218
|
+
try {
|
|
219
|
+
const fres = this._utility.featureHook(ctx, 'PreDone')
|
|
220
|
+
if (fres instanceof Promise) { await fres }
|
|
221
|
+
}
|
|
222
|
+
catch (err: any) {
|
|
223
|
+
const e = this._unexpected(ctx, err)
|
|
224
|
+
if (e) { throw e }
|
|
225
|
+
}
|
|
202
226
|
}
|
|
203
227
|
|
|
204
228
|
|
|
@@ -27,6 +27,7 @@ class EntityOperation {
|
|
|
27
27
|
} = utility
|
|
28
28
|
|
|
29
29
|
let fres: Promise<any> | undefined = undefined
|
|
30
|
+
let predone = false
|
|
30
31
|
|
|
31
32
|
let ctx: Context = makeContext({
|
|
32
33
|
opname: 'create',
|
|
@@ -77,6 +78,7 @@ class EntityOperation {
|
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
|
|
81
|
+
predone = true
|
|
80
82
|
// #PreDone-Hook
|
|
81
83
|
|
|
82
84
|
if (null != ctx.result) {
|
|
@@ -112,6 +114,12 @@ class EntityOperation {
|
|
|
112
114
|
return undefined as any
|
|
113
115
|
}
|
|
114
116
|
}
|
|
117
|
+
finally {
|
|
118
|
+
// A refusal, a failed step or a throw left before PreDone.
|
|
119
|
+
if (!predone) {
|
|
120
|
+
await this._lateDone(ctx)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
115
123
|
}
|
|
116
124
|
|
|
117
125
|
// EJECT-END
|
|
@@ -28,6 +28,7 @@ class EntityOperation {
|
|
|
28
28
|
} = utility
|
|
29
29
|
|
|
30
30
|
let fres: Promise<any> | undefined = undefined
|
|
31
|
+
let predone = false
|
|
31
32
|
|
|
32
33
|
let ctx: Context = makeContext({
|
|
33
34
|
opname: 'list',
|
|
@@ -78,6 +79,7 @@ class EntityOperation {
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
|
|
82
|
+
predone = true
|
|
81
83
|
// #PreDone-Hook
|
|
82
84
|
|
|
83
85
|
if (null != ctx.result) {
|
|
@@ -111,6 +113,12 @@ class EntityOperation {
|
|
|
111
113
|
return undefined as any
|
|
112
114
|
}
|
|
113
115
|
}
|
|
116
|
+
finally {
|
|
117
|
+
// A refusal, a failed step or a throw left before PreDone.
|
|
118
|
+
if (!predone) {
|
|
119
|
+
await this._lateDone(ctx)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
114
122
|
}
|
|
115
123
|
|
|
116
124
|
// EJECT-END
|
|
@@ -28,6 +28,7 @@ class EntityOperation {
|
|
|
28
28
|
} = utility
|
|
29
29
|
|
|
30
30
|
let fres: Promise<any> | undefined = undefined
|
|
31
|
+
let predone = false
|
|
31
32
|
|
|
32
33
|
let ctx: Context = makeContext({
|
|
33
34
|
opname: 'load',
|
|
@@ -78,6 +79,7 @@ class EntityOperation {
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
|
|
82
|
+
predone = true
|
|
81
83
|
// #PreDone-Hook
|
|
82
84
|
|
|
83
85
|
if (null != ctx.result) {
|
|
@@ -117,6 +119,12 @@ class EntityOperation {
|
|
|
117
119
|
return undefined as any
|
|
118
120
|
}
|
|
119
121
|
}
|
|
122
|
+
finally {
|
|
123
|
+
// A refusal, a failed step or a throw left before PreDone.
|
|
124
|
+
if (!predone) {
|
|
125
|
+
await this._lateDone(ctx)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
120
128
|
}
|
|
121
129
|
|
|
122
130
|
// EJECT-END
|
|
@@ -28,6 +28,7 @@ class EntityOperation {
|
|
|
28
28
|
} = utility
|
|
29
29
|
|
|
30
30
|
let fres: Promise<any> | undefined = undefined
|
|
31
|
+
let predone = false
|
|
31
32
|
|
|
32
33
|
let ctx: Context = makeContext({
|
|
33
34
|
opname: 'patch',
|
|
@@ -79,6 +80,7 @@ class EntityOperation {
|
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
|
|
83
|
+
predone = true
|
|
82
84
|
// #PreDone-Hook
|
|
83
85
|
|
|
84
86
|
if (null != ctx.result) {
|
|
@@ -118,6 +120,12 @@ class EntityOperation {
|
|
|
118
120
|
return undefined as any
|
|
119
121
|
}
|
|
120
122
|
}
|
|
123
|
+
finally {
|
|
124
|
+
// A refusal, a failed step or a throw left before PreDone.
|
|
125
|
+
if (!predone) {
|
|
126
|
+
await this._lateDone(ctx)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
121
129
|
}
|
|
122
130
|
|
|
123
131
|
// EJECT-END
|
|
@@ -30,6 +30,7 @@ class EntityOperation {
|
|
|
30
30
|
} = utility
|
|
31
31
|
|
|
32
32
|
let fres: Promise<any> | undefined = undefined
|
|
33
|
+
let predone = false
|
|
33
34
|
|
|
34
35
|
let ctx: Context = makeContext({
|
|
35
36
|
opname: 'remove',
|
|
@@ -81,6 +82,7 @@ class EntityOperation {
|
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
|
|
85
|
+
predone = true
|
|
84
86
|
// #PreDone-Hook
|
|
85
87
|
|
|
86
88
|
if (null != ctx.result) {
|
|
@@ -125,6 +127,12 @@ class EntityOperation {
|
|
|
125
127
|
return undefined as any
|
|
126
128
|
}
|
|
127
129
|
}
|
|
130
|
+
finally {
|
|
131
|
+
// A refusal, a failed step or a throw left before PreDone.
|
|
132
|
+
if (!predone) {
|
|
133
|
+
await this._lateDone(ctx)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
128
136
|
}
|
|
129
137
|
|
|
130
138
|
// EJECT-END
|