@voxgig/sdkgen 4.32.0 → 4.33.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/helpers/naming.js +1 -1
- package/dist/helpers/naming.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/model/sdkgen.aontu +7 -1
- package/package.json +1 -1
- package/project/.sdk/model/feature/debug.aontu +3 -1
- package/project/.sdk/src/cmp/c/PrepareAuth_c.ts +8 -28
- package/project/.sdk/src/cmp/c/TestClean_c.ts +774 -0
- package/project/.sdk/src/cmp/c/Test_c.ts +3 -0
- package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +16 -5
- package/project/.sdk/src/cmp/c/fragment/Main.fragment.c +1 -1
- package/project/.sdk/src/cmp/clojure/PrepareAuth_clojure.ts +3 -0
- package/project/.sdk/src/cmp/clojure/TestClean_clojure.ts +473 -0
- package/project/.sdk/src/cmp/clojure/Test_clojure.ts +6 -0
- package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +18 -8
- package/project/.sdk/src/cmp/cpp/PrepareAuth_cpp.ts +3 -0
- package/project/.sdk/src/cmp/cpp/TestClean_cpp.ts +782 -0
- package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +1 -1
- package/project/.sdk/src/cmp/cpp/Test_cpp.ts +2 -0
- package/project/.sdk/src/cmp/csharp/PrepareAuth_csharp.ts +3 -0
- package/project/.sdk/src/cmp/csharp/TestClean_csharp.ts +887 -0
- package/project/.sdk/src/cmp/csharp/Test_csharp.ts +2 -0
- package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +68 -4
- package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +8 -2
- package/project/.sdk/src/cmp/csharp/fragment/SdkError.fragment.cs +49 -0
- package/project/.sdk/src/cmp/elixir/PrepareAuth_elixir.ts +3 -0
- package/project/.sdk/src/cmp/elixir/Schema_elixir.ts +20 -10
- package/project/.sdk/src/cmp/elixir/TestClean_elixir.ts +666 -0
- package/project/.sdk/src/cmp/elixir/Test_elixir.ts +4 -0
- package/project/.sdk/src/cmp/elixir/fragment/Main.fragment.ex +1 -1
- package/project/.sdk/src/cmp/elixir/fragment/Pipeline.fragment.ex +14 -2
- package/project/.sdk/src/cmp/go/PrepareAuth_go.ts +3 -0
- package/project/.sdk/src/cmp/go/TestClean_go.ts +804 -0
- package/project/.sdk/src/cmp/go/Test_go.ts +3 -0
- package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +54 -4
- package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +27 -2
- package/project/.sdk/src/cmp/java/PrepareAuth_java.ts +3 -0
- package/project/.sdk/src/cmp/java/TestClean_java.ts +884 -0
- package/project/.sdk/src/cmp/java/Test_java.ts +2 -0
- package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +56 -11
- package/project/.sdk/src/cmp/java/fragment/SdkError.fragment.java +36 -3
- package/project/.sdk/src/cmp/js/PrepareAuth_js.ts +3 -0
- package/project/.sdk/src/cmp/js/TestClean_js.ts +458 -0
- package/project/.sdk/src/cmp/js/Test_js.ts +2 -0
- package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +5 -4
- package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +7 -1
- package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +7 -1
- package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +7 -1
- package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +7 -1
- package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +7 -1
- package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +11 -2
- package/project/.sdk/src/cmp/js/fragment/SdkError.fragment.js +17 -1
- package/project/.sdk/src/cmp/kotlin/Package_kotlin.ts +5 -0
- package/project/.sdk/src/cmp/kotlin/PrepareAuth_kotlin.ts +3 -0
- package/project/.sdk/src/cmp/kotlin/TestClean_kotlin.ts +654 -0
- package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +3 -0
- package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +44 -11
- package/project/.sdk/src/cmp/kotlin/fragment/SdkError.fragment.kt +31 -0
- package/project/.sdk/src/cmp/lua/PrepareAuth_lua.ts +3 -0
- package/project/.sdk/src/cmp/lua/TestClean_lua.ts +769 -0
- package/project/.sdk/src/cmp/lua/Test_lua.ts +3 -0
- package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +77 -1
- package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +49 -2
- package/project/.sdk/src/cmp/ocaml/Entity_ocaml.ts +3 -2
- package/project/.sdk/src/cmp/ocaml/PrepareAuth_ocaml.ts +4 -25
- package/project/.sdk/src/cmp/ocaml/TestClean_ocaml.ts +538 -0
- package/project/.sdk/src/cmp/ocaml/Test_ocaml.ts +5 -0
- package/project/.sdk/src/cmp/ocaml/fragment/RunOp.fragment.ml +16 -4
- package/project/.sdk/src/cmp/perl/PrepareAuth_perl.ts +3 -0
- package/project/.sdk/src/cmp/perl/TestClean_perl.ts +619 -0
- package/project/.sdk/src/cmp/perl/Test_perl.ts +3 -0
- package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +67 -5
- package/project/.sdk/src/cmp/perl/fragment/Main.fragment.pm +13 -1
- package/project/.sdk/src/cmp/php/PrepareAuth_php.ts +3 -0
- package/project/.sdk/src/cmp/php/TestClean_php.ts +809 -0
- package/project/.sdk/src/cmp/php/Test_php.ts +2 -0
- package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +96 -55
- package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +15 -2
- package/project/.sdk/src/cmp/py/PrepareAuth_py.ts +3 -0
- package/project/.sdk/src/cmp/py/TestClean_py.ts +549 -0
- package/project/.sdk/src/cmp/py/Test_py.ts +3 -0
- package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +83 -55
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +19 -3
- package/project/.sdk/src/cmp/rb/PrepareAuth_rb.ts +3 -0
- package/project/.sdk/src/cmp/rb/TestClean_rb.ts +535 -0
- package/project/.sdk/src/cmp/rb/Test_rb.ts +3 -0
- package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +108 -46
- package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +12 -1
- package/project/.sdk/src/cmp/rust/PrepareAuth_rust.ts +9 -45
- package/project/.sdk/src/cmp/rust/TestClean_rust.ts +881 -0
- package/project/.sdk/src/cmp/rust/Test_rust.ts +3 -0
- package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +14 -6
- package/project/.sdk/src/cmp/rust/fragment/Main.fragment.rs +17 -1
- package/project/.sdk/src/cmp/rust/fragment/SdkError.fragment.rs +34 -2
- package/project/.sdk/src/cmp/scala/PrepareAuth_scala.ts +3 -0
- package/project/.sdk/src/cmp/scala/TestClean_scala.ts +608 -0
- package/project/.sdk/src/cmp/scala/Test_scala.ts +3 -0
- package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +58 -6
- package/project/.sdk/src/cmp/swift/PrepareAuth_swift.ts +3 -0
- package/project/.sdk/src/cmp/swift/TestClean_swift.ts +671 -0
- package/project/.sdk/src/cmp/swift/Test_swift.ts +3 -0
- package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +10 -0
- package/project/.sdk/src/cmp/swift/fragment/Main.fragment.swift +16 -2
- package/project/.sdk/src/cmp/swift/fragment/SdkError.fragment.swift +47 -3
- package/project/.sdk/src/cmp/ts/PrepareAuth_ts.ts +3 -0
- package/project/.sdk/src/cmp/ts/TestClean_ts.ts +465 -0
- package/project/.sdk/src/cmp/ts/Test_ts.ts +2 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +5 -4
- package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +7 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +7 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +7 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +7 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +7 -1
- package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +8 -2
- package/project/.sdk/src/cmp/ts/fragment/SdkError.fragment.ts +20 -2
- package/project/.sdk/src/cmp/zig/PrepareAuth_zig.ts +3 -0
- package/project/.sdk/src/cmp/zig/TestClean_zig.ts +791 -0
- package/project/.sdk/src/cmp/zig/Test_zig.ts +5 -0
- package/project/.sdk/src/cmp/zig/fragment/Build.fragment.zig +19 -0
- package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +14 -5
- package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +1 -1
- package/project/.sdk/tm/c/core/context.c +25 -0
- package/project/.sdk/tm/c/core/error.c +16 -0
- package/project/.sdk/tm/c/core/sdk.h +22 -0
- package/project/.sdk/tm/c/feature/audit.c +2 -0
- package/project/.sdk/tm/c/feature/cost.c +1 -0
- package/project/.sdk/tm/c/feature/debug.c +19 -29
- package/project/.sdk/tm/c/feature/log.c +21 -2
- package/project/.sdk/tm/c/feature/proxy.c +55 -3
- package/project/.sdk/tm/c/feature/secrets.c +7 -0
- package/project/.sdk/tm/c/feature/telemetry.c +2 -0
- package/project/.sdk/tm/c/tests/feature_test.c +2 -2
- package/project/.sdk/tm/c/utility/clean.c +530 -8
- package/project/.sdk/tm/c/utility/done.c +28 -12
- package/project/.sdk/tm/c/utility/make_error.c +4 -3
- package/project/.sdk/tm/c/utility/make_options.c +71 -45
- package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +15 -0
- package/project/.sdk/tm/clojure/src/sdk/client.clj +20 -4
- package/project/.sdk/tm/clojure/src/sdk/core.clj +319 -35
- package/project/.sdk/tm/clojure/src/sdk/features.clj +68 -30
- package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +4 -2
- package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +47 -20
- package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +4 -0
- package/project/.sdk/tm/cpp/core/types.hpp +93 -3
- package/project/.sdk/tm/cpp/feature/audit.hpp +1 -0
- package/project/.sdk/tm/cpp/feature/cost.hpp +1 -0
- package/project/.sdk/tm/cpp/feature/debug.hpp +20 -12
- package/project/.sdk/tm/cpp/feature/log.hpp +31 -9
- package/project/.sdk/tm/cpp/feature/proxy.hpp +52 -6
- package/project/.sdk/tm/cpp/feature/secrets.hpp +13 -0
- package/project/.sdk/tm/cpp/feature/telemetry.hpp +4 -2
- package/project/.sdk/tm/cpp/test/feature_test.cpp +2 -2
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +426 -51
- package/project/.sdk/tm/csharp/core/Context.cs +32 -0
- package/project/.sdk/tm/csharp/core/Utility.cs +2 -0
- package/project/.sdk/tm/csharp/feature/AuditFeature.cs +1 -0
- package/project/.sdk/tm/csharp/feature/CostFeature.cs +7 -5
- package/project/.sdk/tm/csharp/feature/DebugFeature.cs +19 -16
- package/project/.sdk/tm/csharp/feature/FeatureOptions.cs +16 -0
- package/project/.sdk/tm/csharp/feature/LogFeature.cs +4 -1
- package/project/.sdk/tm/csharp/feature/ProxyFeature.cs +26 -5
- package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +16 -0
- package/project/.sdk/tm/csharp/feature/TelemetryFeature.cs +4 -2
- package/project/.sdk/tm/csharp/test/FeatureTest.cs +2 -2
- package/project/.sdk/tm/csharp/utility/Clean.cs +440 -2
- package/project/.sdk/tm/csharp/utility/Done.cs +27 -11
- package/project/.sdk/tm/csharp/utility/MakeError.cs +19 -8
- package/project/.sdk/tm/csharp/utility/MakeOptions.cs +119 -29
- package/project/.sdk/tm/csharp/utility/MakeResponse.cs +21 -11
- package/project/.sdk/tm/csharp/utility/Register.cs +1 -0
- package/project/.sdk/tm/elixir/lib/projectname/context.ex +19 -0
- package/project/.sdk/tm/elixir/lib/projectname/entity_base.ex +22 -1
- package/project/.sdk/tm/elixir/lib/projectname/error.ex +24 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/audit.ex +2 -2
- package/project/.sdk/tm/elixir/lib/projectname/feature/cost.ex +2 -2
- package/project/.sdk/tm/elixir/lib/projectname/feature/debug.ex +13 -13
- package/project/.sdk/tm/elixir/lib/projectname/feature/log.ex +18 -5
- package/project/.sdk/tm/elixir/lib/projectname/feature/proxy.ex +19 -1
- package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +15 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/telemetry.ex +4 -2
- package/project/.sdk/tm/elixir/lib/projectname/feature.ex +22 -0
- package/project/.sdk/tm/elixir/lib/projectname/utility.ex +464 -41
- package/project/.sdk/tm/elixir/test/feature_test.exs +3 -2
- package/project/.sdk/tm/go/core/context.go +42 -0
- package/project/.sdk/tm/go/core/error.go +30 -10
- package/project/.sdk/tm/go/core/utility_type.go +2 -0
- package/project/.sdk/tm/go/feature/audit_feature.go +1 -0
- package/project/.sdk/tm/go/feature/base_feature.go +12 -0
- package/project/.sdk/tm/go/feature/cost_feature.go +2 -2
- package/project/.sdk/tm/go/feature/debug_feature.go +14 -12
- package/project/.sdk/tm/go/feature/log_feature.go +13 -8
- package/project/.sdk/tm/go/feature/proxy_feature.go +26 -6
- package/project/.sdk/tm/go/feature/secrets_feature.go +19 -0
- package/project/.sdk/tm/go/feature/telemetry_feature.go +4 -2
- package/project/.sdk/tm/go/test/feature_test.go +2 -2
- package/project/.sdk/tm/go/utility/clean.go +585 -2
- package/project/.sdk/tm/go/utility/done.go +29 -9
- package/project/.sdk/tm/go/utility/make_error.go +51 -16
- package/project/.sdk/tm/go/utility/make_options.go +77 -36
- package/project/.sdk/tm/go/utility/register.go +12 -0
- package/project/.sdk/tm/java/core/Context.java +29 -0
- package/project/.sdk/tm/java/core/SdkClient.java +4 -2
- package/project/.sdk/tm/java/core/Utility.java +7 -0
- package/project/.sdk/tm/java/feature/AuditFeature.java +6 -0
- package/project/.sdk/tm/java/feature/CostFeature.java +5 -0
- package/project/.sdk/tm/java/feature/DebugFeature.java +25 -14
- package/project/.sdk/tm/java/feature/LogFeature.java +11 -4
- package/project/.sdk/tm/java/feature/ProxyFeature.java +41 -6
- package/project/.sdk/tm/java/feature/SecretsFeature.java +18 -0
- package/project/.sdk/tm/java/feature/TelemetryFeature.java +8 -2
- package/project/.sdk/tm/java/test/FeatureTest.java +2 -2
- package/project/.sdk/tm/java/utility/Clean.java +519 -1
- package/project/.sdk/tm/java/utility/Done.java +1 -1
- package/project/.sdk/tm/java/utility/MakeError.java +5 -1
- package/project/.sdk/tm/java/utility/MakeOptions.java +55 -31
- package/project/.sdk/tm/java/utility/Register.java +4 -0
- package/project/.sdk/tm/js/src/Context.js +5 -1
- package/project/.sdk/tm/js/src/Response.js +14 -1
- package/project/.sdk/tm/js/src/feature/audit/AuditFeature.js +2 -2
- package/project/.sdk/tm/js/src/feature/cost/CostFeature.js +2 -2
- package/project/.sdk/tm/js/src/feature/debug/DebugFeature.js +13 -7
- package/project/.sdk/tm/js/src/feature/log/LogFeature.js +9 -5
- package/project/.sdk/tm/js/src/feature/proxy/ProxyFeature.js +19 -1
- package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +14 -0
- package/project/.sdk/tm/js/src/feature/telemetry/TelemetryFeature.js +4 -2
- package/project/.sdk/tm/js/src/utility/CleanUtility.js +294 -21
- package/project/.sdk/tm/js/src/utility/DoneUtility.js +17 -5
- package/project/.sdk/tm/js/src/utility/MakeErrorUtility.js +18 -2
- package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +39 -15
- package/project/.sdk/tm/js/src/utility/Utility.js +4 -2
- package/project/.sdk/tm/js/test/feature/harness.js +11 -1
- package/project/.sdk/tm/js/test/feature.test.js +9 -2
- package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +25 -0
- package/project/.sdk/tm/kotlin/core/Context.kt +19 -0
- package/project/.sdk/tm/kotlin/core/SdkClient.kt +9 -2
- package/project/.sdk/tm/kotlin/core/Utility.kt +2 -0
- package/project/.sdk/tm/kotlin/feature/AuditFeature.kt +11 -9
- package/project/.sdk/tm/kotlin/feature/CostFeature.kt +8 -5
- package/project/.sdk/tm/kotlin/feature/DebugFeature.kt +15 -22
- package/project/.sdk/tm/kotlin/feature/LogFeature.kt +8 -4
- package/project/.sdk/tm/kotlin/feature/ProxyFeature.kt +26 -2
- package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +11 -0
- package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +4 -2
- package/project/.sdk/tm/kotlin/test/FeatureTest.kt +2 -2
- package/project/.sdk/tm/kotlin/utility/CoreUtil.kt +447 -11
- package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +38 -31
- package/project/.sdk/tm/kotlin/utility/Register.kt +1 -0
- package/project/.sdk/tm/lua/core/context.lua +43 -0
- package/project/.sdk/tm/lua/core/error.lua +36 -1
- package/project/.sdk/tm/lua/core/utility_type.lua +4 -0
- package/project/.sdk/tm/lua/feature/audit_feature.lua +2 -2
- package/project/.sdk/tm/lua/feature/cost_feature.lua +2 -2
- package/project/.sdk/tm/lua/feature/debug_feature.lua +21 -17
- package/project/.sdk/tm/lua/feature/log_feature.lua +2 -1
- package/project/.sdk/tm/lua/feature/proxy_feature.lua +23 -1
- package/project/.sdk/tm/lua/feature/secrets_feature.lua +18 -0
- package/project/.sdk/tm/lua/feature/telemetry_feature.lua +4 -2
- package/project/.sdk/tm/lua/test/feature/secrets/secrets_feature_test.lua +3 -2
- package/project/.sdk/tm/lua/test/feature_test.lua +10 -3
- package/project/.sdk/tm/lua/utility/clean.lua +426 -2
- package/project/.sdk/tm/lua/utility/clean_explain.lua +34 -0
- package/project/.sdk/tm/lua/utility/done.lua +1 -7
- package/project/.sdk/tm/lua/utility/make_error.lua +3 -1
- package/project/.sdk/tm/lua/utility/make_options.lua +76 -30
- package/project/.sdk/tm/lua/utility/register.lua +4 -1
- package/project/.sdk/tm/ocaml/Makefile +5 -1
- package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +12 -1
- package/project/.sdk/tm/ocaml/sdk_features.ml +78 -18
- package/project/.sdk/tm/ocaml/sdk_helpers.ml +27 -0
- package/project/.sdk/tm/ocaml/sdk_runtime.ml +304 -26
- package/project/.sdk/tm/ocaml/sdk_types.ml +1 -0
- package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +3 -1
- package/project/.sdk/tm/ocaml/test/t_feature.ml +2 -2
- package/project/.sdk/tm/perl/core/context.pm +27 -0
- package/project/.sdk/tm/perl/core/error.pm +52 -5
- package/project/.sdk/tm/perl/feature/audit_feature.pm +2 -2
- package/project/.sdk/tm/perl/feature/cost_feature.pm +2 -2
- package/project/.sdk/tm/perl/feature/debug_feature.pm +17 -13
- package/project/.sdk/tm/perl/feature/log_feature.pm +3 -1
- package/project/.sdk/tm/perl/feature/proxy_feature.pm +21 -1
- package/project/.sdk/tm/perl/feature/secrets_feature.pm +20 -1
- package/project/.sdk/tm/perl/feature/telemetry_feature.pm +4 -2
- package/project/.sdk/tm/perl/t/feature.t +4 -2
- package/project/.sdk/tm/perl/utility/clean.pm +345 -1
- package/project/.sdk/tm/perl/utility/done.pm +24 -6
- package/project/.sdk/tm/perl/utility/make_error.pm +17 -4
- package/project/.sdk/tm/perl/utility/make_options.pm +33 -14
- package/project/.sdk/tm/php/core/Context.php +24 -1
- package/project/.sdk/tm/php/core/Error.php +34 -3
- package/project/.sdk/tm/php/core/UtilityType.php +4 -0
- package/project/.sdk/tm/php/feature/AuditFeature.php +2 -2
- package/project/.sdk/tm/php/feature/CostFeature.php +2 -2
- package/project/.sdk/tm/php/feature/DebugFeature.php +18 -9
- package/project/.sdk/tm/php/feature/LogFeature.php +5 -2
- package/project/.sdk/tm/php/feature/ProxyFeature.php +20 -1
- package/project/.sdk/tm/php/feature/SecretsFeature.php +18 -0
- package/project/.sdk/tm/php/feature/TelemetryFeature.php +4 -2
- package/project/.sdk/tm/php/test/FeatureTest.php +2 -2
- package/project/.sdk/tm/php/utility/Clean.php +438 -2
- package/project/.sdk/tm/php/utility/Done.php +14 -7
- package/project/.sdk/tm/php/utility/MakeError.php +9 -7
- package/project/.sdk/tm/php/utility/MakeOptions.php +62 -38
- package/project/.sdk/tm/php/utility/Register.php +2 -0
- package/project/.sdk/tm/py/pkg/core/context.py +17 -0
- package/project/.sdk/tm/py/pkg/core/error.py +42 -1
- package/project/.sdk/tm/py/pkg/core/utility_type.py +4 -0
- package/project/.sdk/tm/py/pkg/feature/audit_feature.py +2 -2
- package/project/.sdk/tm/py/pkg/feature/cost_feature.py +2 -2
- package/project/.sdk/tm/py/pkg/feature/debug_feature.py +17 -12
- package/project/.sdk/tm/py/pkg/feature/log_feature.py +2 -1
- package/project/.sdk/tm/py/pkg/feature/proxy_feature.py +18 -1
- package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +12 -0
- package/project/.sdk/tm/py/pkg/feature/telemetry_feature.py +4 -2
- package/project/.sdk/tm/py/pkg/utility/clean.py +311 -1
- package/project/.sdk/tm/py/pkg/utility/done.py +18 -5
- package/project/.sdk/tm/py/pkg/utility/make_error.py +9 -6
- package/project/.sdk/tm/py/pkg/utility/make_options.py +64 -25
- package/project/.sdk/tm/py/pkg/utility/make_response.py +19 -13
- package/project/.sdk/tm/py/pkg/utility/register.py +4 -2
- package/project/.sdk/tm/py/test/feature_harness.py +4 -0
- package/project/.sdk/tm/py/test/test_feature.py +2 -2
- package/project/.sdk/tm/py/test/test_primary_utility.py +1 -0
- package/project/.sdk/tm/rb/core/context.rb +28 -0
- package/project/.sdk/tm/rb/core/error.rb +30 -0
- package/project/.sdk/tm/rb/core/utility_type.rb +1 -1
- package/project/.sdk/tm/rb/feature/audit_feature.rb +2 -2
- package/project/.sdk/tm/rb/feature/cost_feature.rb +2 -2
- package/project/.sdk/tm/rb/feature/debug_feature.rb +15 -12
- package/project/.sdk/tm/rb/feature/log_feature.rb +3 -1
- package/project/.sdk/tm/rb/feature/proxy_feature.rb +25 -1
- package/project/.sdk/tm/rb/feature/secrets_feature.rb +17 -0
- package/project/.sdk/tm/rb/feature/telemetry_feature.rb +4 -2
- package/project/.sdk/tm/rb/test/feature_test.rb +4 -2
- package/project/.sdk/tm/rb/utility/clean.rb +312 -1
- package/project/.sdk/tm/rb/utility/done.rb +15 -5
- package/project/.sdk/tm/rb/utility/make_error.rb +13 -4
- package/project/.sdk/tm/rb/utility/make_options.rb +31 -12
- package/project/.sdk/tm/rb/utility/register.rb +2 -0
- package/project/.sdk/tm/rust/core/context.rs +55 -0
- package/project/.sdk/tm/rust/core/utility_type.rs +17 -0
- package/project/.sdk/tm/rust/feature/audit.rs +2 -0
- package/project/.sdk/tm/rust/feature/cost.rs +3 -2
- package/project/.sdk/tm/rust/feature/debug.rs +16 -16
- package/project/.sdk/tm/rust/feature/log.rs +42 -7
- package/project/.sdk/tm/rust/feature/proxy.rs +48 -2
- package/project/.sdk/tm/rust/feature/secrets.rs +12 -0
- package/project/.sdk/tm/rust/feature/telemetry.rs +2 -0
- package/project/.sdk/tm/rust/tests/feature_test.rs +2 -2
- package/project/.sdk/tm/rust/utility/clean.rs +446 -5
- package/project/.sdk/tm/rust/utility/done.rs +22 -12
- package/project/.sdk/tm/rust/utility/make_error.rs +4 -1
- package/project/.sdk/tm/rust/utility/make_options.rs +73 -19
- package/project/.sdk/tm/scala/Makefile +3 -1
- package/project/.sdk/tm/scala/core/Context.scala +16 -0
- package/project/.sdk/tm/scala/core/SdkClient.scala +14 -4
- package/project/.sdk/tm/scala/core/SdkError.scala +28 -0
- package/project/.sdk/tm/scala/core/Types.scala +3 -0
- package/project/.sdk/tm/scala/core/Utility.scala +2 -0
- package/project/.sdk/tm/scala/feature/AuditFeature.scala +16 -10
- package/project/.sdk/tm/scala/feature/CostFeature.scala +10 -5
- package/project/.sdk/tm/scala/feature/DebugFeature.scala +24 -21
- package/project/.sdk/tm/scala/feature/LogFeature.scala +9 -4
- package/project/.sdk/tm/scala/feature/ProxyFeature.scala +23 -2
- package/project/.sdk/tm/scala/feature/SecretsFeature.scala +14 -0
- package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +9 -2
- package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +2 -2
- package/project/.sdk/tm/scala/utility/Make.scala +63 -20
- package/project/.sdk/tm/scala/utility/Misc.scala +358 -5
- package/project/.sdk/tm/scala/utility/Register.scala +1 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +29 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Utility.swift +2 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +10 -9
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/CostFeature.swift +7 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/DebugFeature.swift +19 -15
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/FeatureOptions.swift +16 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/LogFeature.swift +4 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/ProxyFeature.swift +20 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/SecretsFeature.swift +13 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +4 -2
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeError.swift +15 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +58 -19
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Register.swift +1 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +391 -4
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +2 -2
- package/project/.sdk/tm/ts/src/Context.ts +5 -1
- package/project/.sdk/tm/ts/src/Response.ts +14 -1
- package/project/.sdk/tm/ts/src/feature/audit/AuditFeature.ts +2 -2
- package/project/.sdk/tm/ts/src/feature/cost/CostFeature.ts +2 -2
- package/project/.sdk/tm/ts/src/feature/debug/DebugFeature.ts +13 -7
- package/project/.sdk/tm/ts/src/feature/log/LogFeature.ts +9 -5
- package/project/.sdk/tm/ts/src/feature/proxy/ProxyFeature.ts +19 -1
- package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +12 -0
- package/project/.sdk/tm/ts/src/feature/telemetry/TelemetryFeature.ts +4 -2
- package/project/.sdk/tm/ts/src/utility/CleanUtility.ts +287 -9
- package/project/.sdk/tm/ts/src/utility/DoneUtility.ts +18 -5
- package/project/.sdk/tm/ts/src/utility/MakeErrorUtility.ts +18 -8
- package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +38 -16
- package/project/.sdk/tm/ts/src/utility/Utility.ts +4 -2
- package/project/.sdk/tm/ts/test/feature/harness.ts +11 -1
- package/project/.sdk/tm/ts/test/feature.test.ts +9 -2
- package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +25 -0
- package/project/.sdk/tm/zig/core/context.zig +34 -0
- package/project/.sdk/tm/zig/core/error.zig +22 -1
- package/project/.sdk/tm/zig/core/utility.zig +403 -39
- package/project/.sdk/tm/zig/feature/audit.zig +4 -2
- package/project/.sdk/tm/zig/feature/cost.zig +3 -2
- package/project/.sdk/tm/zig/feature/debug.zig +20 -25
- package/project/.sdk/tm/zig/feature/log.zig +3 -1
- package/project/.sdk/tm/zig/feature/proxy.zig +47 -6
- package/project/.sdk/tm/zig/feature/secrets.zig +7 -0
- package/project/.sdk/tm/zig/feature/telemetry.zig +4 -2
- package/project/.sdk/tm/zig/test/feature_test.zig +2 -2
- package/project/sdkgen-package.json +1 -1
- package/src/helpers/naming.ts +1 -1
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
package utility
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
|
|
6
|
+
"GOMODULE/core"
|
|
7
|
+
)
|
|
4
8
|
|
|
5
9
|
func makeErrorUtil(ctx *core.Context, err error) (any, error) {
|
|
6
10
|
if ctx == nil {
|
|
@@ -40,23 +44,29 @@ func makeErrorUtil(ctx *core.Context, err error) (any, error) {
|
|
|
40
44
|
|
|
41
45
|
spec := ctx.Spec
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"message": msg,
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
47
|
+
// The context stays reachable on the error for a debugger; its result and
|
|
48
|
+
// spec are masked copies, so masking them never masks the pipeline's own.
|
|
49
49
|
sdkErr := &core.ProjectNameError{
|
|
50
50
|
IsProjectNameError: true,
|
|
51
|
-
Sdk:
|
|
52
|
-
Code:
|
|
53
|
-
Msg:
|
|
54
|
-
Ctx:
|
|
55
|
-
Result:
|
|
56
|
-
Spec:
|
|
51
|
+
Sdk: "ProjectName",
|
|
52
|
+
Code: "",
|
|
53
|
+
Msg: msg,
|
|
54
|
+
Ctx: ctx,
|
|
55
|
+
Result: cleanUtil(ctx, result),
|
|
56
|
+
Spec: cleanUtil(ctx, spec),
|
|
57
57
|
}
|
|
58
58
|
if se, ok := err.(*core.ProjectNameError); ok {
|
|
59
|
-
sdkErr.Code = se.Code
|
|
59
|
+
sdkErr.Code = cleanUtil(ctx, se.Code).(string)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if ctx.Ctrl.Explain != nil {
|
|
63
|
+
ctx.Ctrl.Explain["err"] = map[string]any{
|
|
64
|
+
"message": msg,
|
|
65
|
+
"code": sdkErr.Code,
|
|
66
|
+
}
|
|
67
|
+
// A failure before done() (makeSpec after prepareAuth, say) leaves the
|
|
68
|
+
// explain record raw otherwise; ts reaches done() on every such path.
|
|
69
|
+
cleanExplain(ctx)
|
|
60
70
|
}
|
|
61
71
|
|
|
62
72
|
ctx.Ctrl.Err = sdkErr
|
|
@@ -65,13 +75,38 @@ func makeErrorUtil(ctx *core.Context, err error) (any, error) {
|
|
|
65
75
|
// debug) close/record error paths that never reach PreDone (e.g. a PrePoint
|
|
66
76
|
// rbac short-circuit). Fires after ctx.Ctrl.Err is set so hooks can read the
|
|
67
77
|
// error; features guard against double-recording when PreDone already fired.
|
|
78
|
+
var out error = sdkErr
|
|
68
79
|
if ctx.Utility != nil && ctx.Utility.FeatureHook != nil {
|
|
69
|
-
|
|
80
|
+
// A hook that panics here would leave raw, after the cleaning above:
|
|
81
|
+
// its error replaces the SDK error, cleaned, as ts's catch path does.
|
|
82
|
+
if herr := preUnexpected(ctx); herr != nil {
|
|
83
|
+
if cerr, ok := cleanUtil(ctx, herr).(error); ok {
|
|
84
|
+
herr = cerr
|
|
85
|
+
}
|
|
86
|
+
ctx.Ctrl.Err = herr
|
|
87
|
+
if ctx.Ctrl.Explain != nil {
|
|
88
|
+
ctx.Ctrl.Explain["unexpected"] = map[string]any{"message": herr.Error()}
|
|
89
|
+
}
|
|
90
|
+
out = herr
|
|
91
|
+
}
|
|
70
92
|
}
|
|
71
93
|
|
|
72
94
|
if ctx.Ctrl.Throw != nil && *ctx.Ctrl.Throw == false {
|
|
73
95
|
return result.Resdata, nil
|
|
74
96
|
}
|
|
75
97
|
|
|
76
|
-
return nil,
|
|
98
|
+
return nil, out
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
func preUnexpected(ctx *core.Context) (herr error) {
|
|
102
|
+
defer func() {
|
|
103
|
+
if r := recover(); r != nil {
|
|
104
|
+
var ok bool
|
|
105
|
+
if herr, ok = r.(error); !ok {
|
|
106
|
+
herr = fmt.Errorf("%v", r)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}()
|
|
110
|
+
ctx.Utility.FeatureHook(ctx, "PreUnexpected")
|
|
111
|
+
return nil
|
|
77
112
|
}
|
|
@@ -67,6 +67,36 @@ func makeOptionsUtil(ctx *core.Context) map[string]any {
|
|
|
67
67
|
|
|
68
68
|
opts := vs.Clone(options).(map[string]any)
|
|
69
69
|
|
|
70
|
+
config := ctx.Config
|
|
71
|
+
if config == nil {
|
|
72
|
+
config = map[string]any{}
|
|
73
|
+
}
|
|
74
|
+
cfgopts := map[string]any{}
|
|
75
|
+
if co, ok := config["options"]; ok && co != nil {
|
|
76
|
+
if cm, ok := co.(map[string]any); ok {
|
|
77
|
+
cfgopts = cm
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// The secret registry exists BEFORE validation, fed from the raw input, so
|
|
82
|
+
// the constructor's own rejection of a mistyped credential is clean too.
|
|
83
|
+
cleanraw := map[string]any{}
|
|
84
|
+
for _, layer := range []any{core.OPTSPEC["clean"], cfgopts["clean"], opts["clean"]} {
|
|
85
|
+
for k, v := range core.ToMapAny(layer) {
|
|
86
|
+
cleanraw[k] = v
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
cleancfg := makeCleanConfig(cleanraw)
|
|
90
|
+
cleanctx := &core.Context{Options: map[string]any{
|
|
91
|
+
"__derived__": map[string]any{"clean": cleancfg},
|
|
92
|
+
}}
|
|
93
|
+
cleanAddOptions(cleanctx, cleanOmit(opts, "clean"))
|
|
94
|
+
for _, block := range []map[string]any{cfgopts, opts} {
|
|
95
|
+
for _, s := range cleanSplit(vs.GetPath(block, []any{"clean", "values"})) {
|
|
96
|
+
cleancfg.add(s)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
70
100
|
var featureorder []any
|
|
71
101
|
if farr, ok := opts["feature"].([]any); ok {
|
|
72
102
|
fmap := map[string]any{}
|
|
@@ -91,17 +121,6 @@ func makeOptionsUtil(ctx *core.Context) map[string]any {
|
|
|
91
121
|
opts["feature"] = fmap
|
|
92
122
|
}
|
|
93
123
|
|
|
94
|
-
config := ctx.Config
|
|
95
|
-
if config == nil {
|
|
96
|
-
config = map[string]any{}
|
|
97
|
-
}
|
|
98
|
-
cfgopts := map[string]any{}
|
|
99
|
-
if co, ok := config["options"]; ok && co != nil {
|
|
100
|
-
if cm, ok := co.(map[string]any); ok {
|
|
101
|
-
cfgopts = cm
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
124
|
optspec := core.OPTSPEC
|
|
106
125
|
|
|
107
126
|
// Preserve system.fetch before merge/validate.
|
|
@@ -169,24 +188,6 @@ func makeOptionsUtil(ctx *core.Context) map[string]any {
|
|
|
169
188
|
}
|
|
170
189
|
}
|
|
171
190
|
|
|
172
|
-
// Derived clean config.
|
|
173
|
-
cleanKeys := "key,token,id"
|
|
174
|
-
if ck := vs.GetPath(opts, []any{"clean", "keys"}); ck != nil {
|
|
175
|
-
if cks, ok := ck.(string); ok {
|
|
176
|
-
cleanKeys = cks
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
parts := strings.Split(cleanKeys, ",")
|
|
181
|
-
var filtered []string
|
|
182
|
-
for _, p := range parts {
|
|
183
|
-
p = strings.TrimSpace(p)
|
|
184
|
-
if p != "" {
|
|
185
|
-
filtered = append(filtered, vs.EscRe(p))
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
keyre := strings.Join(filtered, "|")
|
|
189
|
-
|
|
190
191
|
// Resolve the feature add-order: an explicit array order (above) wins;
|
|
191
192
|
// otherwise order the map test-first, then the remaining names sorted, so
|
|
192
193
|
// the outcome is deterministic and `test` is always the base transport.
|
|
@@ -238,14 +239,54 @@ func makeOptionsUtil(ctx *core.Context) map[string]any {
|
|
|
238
239
|
}
|
|
239
240
|
}
|
|
240
241
|
|
|
241
|
-
|
|
242
|
-
"clean":
|
|
243
|
-
|
|
244
|
-
if keyre != "" {
|
|
245
|
-
derived["clean"] = map[string]any{"keyre": keyre}
|
|
242
|
+
opts["__derived__"] = map[string]any{
|
|
243
|
+
"clean": cleancfg,
|
|
244
|
+
"featureorder": featureorder,
|
|
246
245
|
}
|
|
247
|
-
|
|
248
|
-
|
|
246
|
+
|
|
247
|
+
// Again over the merged result: the config's own defaults can carry one.
|
|
248
|
+
cleanAddOptions(cleanctx, cleanOmit(opts, "clean", "__derived__"))
|
|
249
249
|
|
|
250
250
|
return opts
|
|
251
251
|
}
|
|
252
|
+
|
|
253
|
+
// A feature's name is not a field name: only the sensitive names inside its
|
|
254
|
+
// settings count, so `secrets` does not make every setting a secret. Entity
|
|
255
|
+
// blocks (per-entity settings, seeded records) hold no credential.
|
|
256
|
+
func cleanAddOptions(ctx *core.Context, opts map[string]any) {
|
|
257
|
+
top := cleanOmit(opts, "feature", "entity")
|
|
258
|
+
if test, ok := top["test"]; ok {
|
|
259
|
+
top["test"] = cleanNoEntity(test)
|
|
260
|
+
}
|
|
261
|
+
cleanAddSensitive(ctx, top)
|
|
262
|
+
switch feature := opts["feature"].(type) {
|
|
263
|
+
case map[string]any:
|
|
264
|
+
for _, fopts := range feature {
|
|
265
|
+
cleanAddSensitive(ctx, cleanNoEntity(fopts))
|
|
266
|
+
}
|
|
267
|
+
case []any:
|
|
268
|
+
for _, entry := range feature {
|
|
269
|
+
cleanAddSensitive(ctx, cleanNoEntity(entry))
|
|
270
|
+
}
|
|
271
|
+
default:
|
|
272
|
+
cleanAddSensitive(ctx, feature)
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
func cleanNoEntity(block any) any {
|
|
277
|
+
if m, ok := block.(map[string]any); ok {
|
|
278
|
+
return cleanOmit(m, "entity")
|
|
279
|
+
}
|
|
280
|
+
return block
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
func cleanOmit(m map[string]any, keys ...string) map[string]any {
|
|
284
|
+
out := make(map[string]any, len(m))
|
|
285
|
+
for k, v := range m {
|
|
286
|
+
out[k] = v
|
|
287
|
+
}
|
|
288
|
+
for _, k := range keys {
|
|
289
|
+
delete(out, k)
|
|
290
|
+
}
|
|
291
|
+
return out
|
|
292
|
+
}
|
|
@@ -8,6 +8,8 @@ func init() {
|
|
|
8
8
|
|
|
9
9
|
func registerAll(u *core.Utility) {
|
|
10
10
|
u.Clean = cleanUtil
|
|
11
|
+
u.CleanAdd = cleanAddUtil
|
|
12
|
+
u.CleanExplain = cleanExplain
|
|
11
13
|
u.Done = doneUtil
|
|
12
14
|
u.MakeError = makeErrorUtil
|
|
13
15
|
u.FeatureAdd = featureAddUtil
|
|
@@ -47,6 +49,16 @@ func overrideUtil(u *core.Utility, key string, val any) bool {
|
|
|
47
49
|
u.Clean = fn
|
|
48
50
|
return true
|
|
49
51
|
}
|
|
52
|
+
case "cleanAdd":
|
|
53
|
+
if fn, ok := val.(func(ctx *core.Context, val any)); ok {
|
|
54
|
+
u.CleanAdd = fn
|
|
55
|
+
return true
|
|
56
|
+
}
|
|
57
|
+
case "cleanExplain":
|
|
58
|
+
if fn, ok := val.(func(ctx *core.Context)); ok {
|
|
59
|
+
u.CleanExplain = fn
|
|
60
|
+
return true
|
|
61
|
+
}
|
|
50
62
|
case "done":
|
|
51
63
|
if fn, ok := val.(func(ctx *core.Context) (any, error)); ok {
|
|
52
64
|
u.Done = fn
|
|
@@ -267,4 +267,33 @@ public class Context {
|
|
|
267
267
|
public SdkError makeError(String code, String msg) {
|
|
268
268
|
return new SdkError(code, msg, this);
|
|
269
269
|
}
|
|
270
|
+
|
|
271
|
+
/** The raw record a serialiser reads; the live fields stay raw for the pipeline. */
|
|
272
|
+
public Map<String, Object> record() {
|
|
273
|
+
Map<String, Object> record = new LinkedHashMap<>();
|
|
274
|
+
record.put("id", this.id);
|
|
275
|
+
record.put("op", this.op);
|
|
276
|
+
record.put("spec", this.spec);
|
|
277
|
+
record.put("entity", this.entity);
|
|
278
|
+
record.put("result", this.result);
|
|
279
|
+
record.put("response", this.response);
|
|
280
|
+
record.put("meta", this.meta);
|
|
281
|
+
return record;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// The serialised context leaves the pipeline (a logger, an error dump), so
|
|
285
|
+
// it is cleaned.
|
|
286
|
+
public Map<String, Object> toMap() {
|
|
287
|
+
Map<String, Object> record = record();
|
|
288
|
+
if (this.utility == null || this.utility.clean == null) {
|
|
289
|
+
return record;
|
|
290
|
+
}
|
|
291
|
+
Map<String, Object> cleaned = Helpers.toMapAny(this.utility.clean.apply(this, record));
|
|
292
|
+
return cleaned == null ? record : cleaned;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
@Override
|
|
296
|
+
public String toString() {
|
|
297
|
+
return "Context " + Struct.jsonify(toMap());
|
|
298
|
+
}
|
|
270
299
|
}
|
|
@@ -290,13 +290,15 @@ public abstract class SdkClient {
|
|
|
290
290
|
|
|
291
291
|
Map<String, Object> out = new LinkedHashMap<>();
|
|
292
292
|
|
|
293
|
+
// A raw request returns its failure rather than passing it through
|
|
294
|
+
// makeError, so it is cleaned here.
|
|
293
295
|
Map<String, Object> fetchdef;
|
|
294
296
|
try {
|
|
295
297
|
fetchdef = this.prepare(fetchargs);
|
|
296
298
|
}
|
|
297
299
|
catch (RuntimeException err) {
|
|
298
300
|
out.put("ok", false);
|
|
299
|
-
out.put("err", err);
|
|
301
|
+
out.put("err", utility.clean.apply(ctx, err));
|
|
300
302
|
return out;
|
|
301
303
|
}
|
|
302
304
|
|
|
@@ -308,7 +310,7 @@ public abstract class SdkClient {
|
|
|
308
310
|
}
|
|
309
311
|
catch (RuntimeException err) {
|
|
310
312
|
out.put("ok", false);
|
|
311
|
-
out.put("err", err);
|
|
313
|
+
out.put("err", utility.clean.apply(ctx, err));
|
|
312
314
|
return out;
|
|
313
315
|
}
|
|
314
316
|
|
|
@@ -20,6 +20,11 @@ public class Utility {
|
|
|
20
20
|
Object apply(Context ctx, Object val);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
@FunctionalInterface
|
|
24
|
+
public interface CleanAddFn {
|
|
25
|
+
void apply(Context ctx, Object value);
|
|
26
|
+
}
|
|
27
|
+
|
|
23
28
|
@FunctionalInterface
|
|
24
29
|
public interface MakeErrorFn {
|
|
25
30
|
Object apply(Context ctx, RuntimeException err);
|
|
@@ -51,6 +56,7 @@ public class Utility {
|
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
public CleanFn clean;
|
|
59
|
+
public CleanAddFn cleanAdd;
|
|
54
60
|
public CtxFn<Object> done;
|
|
55
61
|
public MakeErrorFn makeError;
|
|
56
62
|
public FeatureFn featureAdd;
|
|
@@ -94,6 +100,7 @@ public class Utility {
|
|
|
94
100
|
Utility u = new Utility(true);
|
|
95
101
|
|
|
96
102
|
u.clean = this.clean;
|
|
103
|
+
u.cleanAdd = this.cleanAdd;
|
|
97
104
|
u.done = this.done;
|
|
98
105
|
u.makeError = this.makeError;
|
|
99
106
|
u.featureAdd = this.featureAdd;
|
|
@@ -7,6 +7,7 @@ import java.util.Map;
|
|
|
7
7
|
import java.util.function.Consumer;
|
|
8
8
|
|
|
9
9
|
import JAVAPACKAGE.core.Context;
|
|
10
|
+
import JAVAPACKAGE.core.Helpers;
|
|
10
11
|
import JAVAPACKAGE.core.SdkClient;
|
|
11
12
|
|
|
12
13
|
// Audit trail. Emits a structured record for every operation — who (actor),
|
|
@@ -100,6 +101,11 @@ public class AuditFeature extends BaseFeature {
|
|
|
100
101
|
record.put("status", ctx.result.status);
|
|
101
102
|
}
|
|
102
103
|
|
|
104
|
+
if (ctx.utility != null && ctx.utility.clean != null) {
|
|
105
|
+
Map<String, Object> cleaned = Helpers.toMapAny(ctx.utility.clean.apply(ctx, record));
|
|
106
|
+
record = cleaned == null ? record : cleaned;
|
|
107
|
+
}
|
|
108
|
+
|
|
103
109
|
this.records.add(record);
|
|
104
110
|
int max = FeatureOptions.foptInt(this.options, "max", 1000);
|
|
105
111
|
while (this.records.size() > max) {
|
|
@@ -7,6 +7,7 @@ import java.util.Map;
|
|
|
7
7
|
import java.util.function.Consumer;
|
|
8
8
|
|
|
9
9
|
import JAVAPACKAGE.core.Context;
|
|
10
|
+
import JAVAPACKAGE.core.Helpers;
|
|
10
11
|
import JAVAPACKAGE.core.SdkClient;
|
|
11
12
|
import JAVAPACKAGE.core.Utility;
|
|
12
13
|
import JAVAPACKAGE.utility.struct.Struct;
|
|
@@ -299,6 +300,10 @@ public class CostFeature extends BaseFeature {
|
|
|
299
300
|
record.put("currency", this.currency);
|
|
300
301
|
record.put("source", source);
|
|
301
302
|
record.put("attempts", pending.attempts);
|
|
303
|
+
if (ctx.utility != null && ctx.utility.clean != null) {
|
|
304
|
+
Map<String, Object> cleaned = Helpers.toMapAny(ctx.utility.clean.apply(ctx, record));
|
|
305
|
+
record = cleaned == null ? record : cleaned;
|
|
306
|
+
}
|
|
302
307
|
this.last = record;
|
|
303
308
|
|
|
304
309
|
if (this.options.get("sink") instanceof Consumer) {
|
|
@@ -12,10 +12,10 @@ import JAVAPACKAGE.core.SdkClient;
|
|
|
12
12
|
|
|
13
13
|
// Request/response capture for debugging. Records a bounded ring buffer of
|
|
14
14
|
// per-operation traces — method, URL, redacted headers, response status and
|
|
15
|
-
// timing — on the feature's entries.
|
|
16
|
-
// `redact
|
|
17
|
-
//
|
|
18
|
-
//
|
|
15
|
+
// timing — on the feature's entries. The SDK's own clean rules apply to the
|
|
16
|
+
// whole entry; header names in `redact` are masked on top of them. An
|
|
17
|
+
// optional `onEntry` callback receives each finished entry (e.g. to stream
|
|
18
|
+
// to a console). `max` caps the buffer (default 100).
|
|
19
19
|
@SuppressWarnings({"unchecked"})
|
|
20
20
|
public class DebugFeature extends BaseFeature {
|
|
21
21
|
|
|
@@ -27,10 +27,6 @@ public class DebugFeature extends BaseFeature {
|
|
|
27
27
|
|
|
28
28
|
private static final String DEBUG_ENTRY_KEY = "debug_entry";
|
|
29
29
|
|
|
30
|
-
private static final List<String> DEFAULT_REDACT = List.of(
|
|
31
|
-
"authorization", "cookie", "set-cookie", "api-key", "apikey",
|
|
32
|
-
"x-api-key", "idempotency-key");
|
|
33
|
-
|
|
34
30
|
public DebugFeature() {
|
|
35
31
|
super("debug", "0.0.1", true);
|
|
36
32
|
}
|
|
@@ -66,7 +62,7 @@ public class DebugFeature extends BaseFeature {
|
|
|
66
62
|
else {
|
|
67
63
|
entry.put("url", ctx.spec.path);
|
|
68
64
|
}
|
|
69
|
-
entry.put("headers", redact(ctx.spec.headers));
|
|
65
|
+
entry.put("headers", redact(ctx, ctx.spec.headers));
|
|
70
66
|
}
|
|
71
67
|
ctx.out.put(DEBUG_ENTRY_KEY, entry);
|
|
72
68
|
}
|
|
@@ -123,6 +119,11 @@ public class DebugFeature extends BaseFeature {
|
|
|
123
119
|
entry.put("status", ctx.result.status);
|
|
124
120
|
}
|
|
125
121
|
|
|
122
|
+
// The whole entry leaves through the buffer and the callback: the url
|
|
123
|
+
// and the error message can carry a query credential the header mask
|
|
124
|
+
// above never saw.
|
|
125
|
+
entry = clean(ctx, entry);
|
|
126
|
+
|
|
126
127
|
this.entries.add(entry);
|
|
127
128
|
int max = FeatureOptions.foptInt(this.options, "max", 100);
|
|
128
129
|
while (this.entries.size() > max) {
|
|
@@ -134,30 +135,40 @@ public class DebugFeature extends BaseFeature {
|
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
|
|
137
|
-
|
|
138
|
+
// The core clean rules apply (clean.keys, every registered value); the
|
|
139
|
+
// feature's own `redact` list ADDS header names on top of them.
|
|
140
|
+
private Map<String, Object> redact(Context ctx, Map<String, Object> headers) {
|
|
138
141
|
Map<String, Object> out = new LinkedHashMap<>();
|
|
139
142
|
if (headers == null) {
|
|
140
143
|
return out;
|
|
141
144
|
}
|
|
142
145
|
List<String> patterns = FeatureOptions.foptStrList(this.options, "redact");
|
|
143
146
|
if (patterns == null) {
|
|
144
|
-
patterns =
|
|
147
|
+
patterns = List.of();
|
|
145
148
|
}
|
|
146
149
|
for (Map.Entry<String, Object> h : headers.entrySet()) {
|
|
147
150
|
boolean masked = false;
|
|
148
151
|
for (String p : patterns) {
|
|
149
|
-
if (h.getKey().toLowerCase().equals(p)) {
|
|
152
|
+
if (h.getKey().toLowerCase().equals(p.toLowerCase())) {
|
|
150
153
|
masked = true;
|
|
151
154
|
break;
|
|
152
155
|
}
|
|
153
156
|
}
|
|
154
157
|
if (masked) {
|
|
155
|
-
out.put(h.getKey(), "
|
|
158
|
+
out.put(h.getKey(), "[redacted]");
|
|
156
159
|
}
|
|
157
160
|
else {
|
|
158
161
|
out.put(h.getKey(), h.getValue());
|
|
159
162
|
}
|
|
160
163
|
}
|
|
161
|
-
return out;
|
|
164
|
+
return clean(ctx, out);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
private static Map<String, Object> clean(Context ctx, Map<String, Object> record) {
|
|
168
|
+
if (ctx.utility == null || ctx.utility.clean == null) {
|
|
169
|
+
return record;
|
|
170
|
+
}
|
|
171
|
+
Map<String, Object> out = Helpers.toMapAny(ctx.utility.clean.apply(ctx, record));
|
|
172
|
+
return out == null ? record : out;
|
|
162
173
|
}
|
|
163
174
|
}
|
|
@@ -125,18 +125,25 @@ public class LogFeature extends BaseFeature {
|
|
|
125
125
|
msg.append(" spec=").append(ctx.spec.method).append(" ").append(ctx.spec.path);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
// A log line leaves the pipeline, so it is cleaned like every other
|
|
129
|
+
// emission, even though it carries no header or url today.
|
|
130
|
+
String line = msg.toString();
|
|
131
|
+
if (ctx.utility != null && ctx.utility.clean != null) {
|
|
132
|
+
line = String.valueOf(ctx.utility.clean.apply(ctx, line));
|
|
133
|
+
}
|
|
134
|
+
|
|
128
135
|
switch (level) {
|
|
129
136
|
case "debug":
|
|
130
|
-
this.logger.fine(
|
|
137
|
+
this.logger.fine(line);
|
|
131
138
|
break;
|
|
132
139
|
case "warn":
|
|
133
|
-
this.logger.warning(
|
|
140
|
+
this.logger.warning(line);
|
|
134
141
|
break;
|
|
135
142
|
case "error":
|
|
136
|
-
this.logger.severe(
|
|
143
|
+
this.logger.severe(line);
|
|
137
144
|
break;
|
|
138
145
|
default:
|
|
139
|
-
this.logger.info(
|
|
146
|
+
this.logger.info(line);
|
|
140
147
|
break;
|
|
141
148
|
}
|
|
142
149
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
package JAVAPACKAGE.feature;
|
|
2
2
|
|
|
3
|
+
import java.net.URI;
|
|
4
|
+
import java.net.URISyntaxException;
|
|
5
|
+
import java.net.URLDecoder;
|
|
6
|
+
import java.nio.charset.StandardCharsets;
|
|
3
7
|
import java.util.ArrayList;
|
|
4
8
|
import java.util.LinkedHashMap;
|
|
5
9
|
import java.util.List;
|
|
@@ -25,7 +29,12 @@ public class ProxyFeature extends BaseFeature {
|
|
|
25
29
|
private Map<String, Object> options;
|
|
26
30
|
private List<String> noProxy = new ArrayList<>();
|
|
27
31
|
|
|
28
|
-
//
|
|
32
|
+
// The proxy the transport is told to route through, raw: it may carry
|
|
33
|
+
// credentials as userinfo.
|
|
34
|
+
private String target = "";
|
|
35
|
+
|
|
36
|
+
// Activity tracking (mirrors the ts client._proxy record). `url` is the
|
|
37
|
+
// cleaned form of the target, since the record is what a caller prints.
|
|
29
38
|
public int routed = 0;
|
|
30
39
|
public String url = "";
|
|
31
40
|
|
|
@@ -46,12 +55,12 @@ public class ProxyFeature extends BaseFeature {
|
|
|
46
55
|
return;
|
|
47
56
|
}
|
|
48
57
|
|
|
49
|
-
this.
|
|
58
|
+
this.target = FeatureOptions.foptStr(this.options, "url", "");
|
|
50
59
|
List<String> noProxyRaw = FeatureOptions.foptStrList(this.options, "noProxy");
|
|
51
60
|
|
|
52
61
|
if (FeatureOptions.foptBool(this.options, "fromEnv", false)) {
|
|
53
|
-
if ("".equals(this.
|
|
54
|
-
this.
|
|
62
|
+
if ("".equals(this.target)) {
|
|
63
|
+
this.target = firstEnv("HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy");
|
|
55
64
|
}
|
|
56
65
|
if (noProxyRaw == null) {
|
|
57
66
|
String np = firstEnv("NO_PROXY", "no_proxy");
|
|
@@ -71,6 +80,32 @@ public class ProxyFeature extends BaseFeature {
|
|
|
71
80
|
}
|
|
72
81
|
}
|
|
73
82
|
|
|
83
|
+
// A proxy URL may carry credentials as userinfo, from the option or the
|
|
84
|
+
// environment, and neither is under a sensitive key name.
|
|
85
|
+
if (!"".equals(this.target) && ctx.utility != null && ctx.utility.cleanAdd != null) {
|
|
86
|
+
try {
|
|
87
|
+
String userinfo = new URI(this.target).getRawUserInfo();
|
|
88
|
+
if (userinfo != null) {
|
|
89
|
+
int colon = userinfo.indexOf(':');
|
|
90
|
+
String[] parts = colon < 0
|
|
91
|
+
? new String[] {userinfo}
|
|
92
|
+
: new String[] {userinfo.substring(0, colon), userinfo.substring(colon + 1)};
|
|
93
|
+
for (String part : parts) {
|
|
94
|
+
if (!"".equals(part)) {
|
|
95
|
+
ctx.utility.cleanAdd.apply(ctx, part);
|
|
96
|
+
ctx.utility.cleanAdd.apply(ctx, URLDecoder.decode(part, StandardCharsets.UTF_8));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (URISyntaxException | RuntimeException e) {
|
|
102
|
+
// An unparseable target routes nothing (see route), so there is
|
|
103
|
+
// nothing to register.
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
this.url = ctx.utility != null && ctx.utility.clean != null
|
|
107
|
+
? String.valueOf(ctx.utility.clean.apply(ctx, this.target)) : this.target;
|
|
108
|
+
|
|
74
109
|
final Utility.FetcherFn inner = ctx.utility.fetcher;
|
|
75
110
|
|
|
76
111
|
ctx.utility.fetcher = (ctx2, u, fetchdef) ->
|
|
@@ -78,12 +113,12 @@ public class ProxyFeature extends BaseFeature {
|
|
|
78
113
|
}
|
|
79
114
|
|
|
80
115
|
private Map<String, Object> route(String u, Map<String, Object> fetchdef) {
|
|
81
|
-
if ("".equals(this.
|
|
116
|
+
if ("".equals(this.target) || bypass(u)) {
|
|
82
117
|
return fetchdef;
|
|
83
118
|
}
|
|
84
119
|
|
|
85
120
|
Map<String, Object> out = new LinkedHashMap<>(fetchdef);
|
|
86
|
-
out.put("proxy", this.
|
|
121
|
+
out.put("proxy", this.target);
|
|
87
122
|
|
|
88
123
|
this.routed++;
|
|
89
124
|
return out;
|
|
@@ -88,6 +88,10 @@ public class SecretsFeature extends BaseFeature {
|
|
|
88
88
|
private boolean cache = true;
|
|
89
89
|
private Sekreto sek;
|
|
90
90
|
|
|
91
|
+
// The context init was given: the registry every resolved value is added
|
|
92
|
+
// to lives on its options.
|
|
93
|
+
private Context rootctx;
|
|
94
|
+
|
|
91
95
|
// Exchange state: null config when off; the refresh credential the chain
|
|
92
96
|
// resolved; the single in-flight purchase.
|
|
93
97
|
private SecretsExchange exchange;
|
|
@@ -145,6 +149,7 @@ public class SecretsFeature extends BaseFeature {
|
|
|
145
149
|
@Override
|
|
146
150
|
public void init(Context ctx, Map<String, Object> options) {
|
|
147
151
|
this.client = ctx.client;
|
|
152
|
+
this.rootctx = ctx;
|
|
148
153
|
this.liveopts = ctx.options == null ? new LinkedHashMap<>() : ctx.options;
|
|
149
154
|
this.active = true;
|
|
150
155
|
|
|
@@ -194,6 +199,7 @@ public class SecretsFeature extends BaseFeature {
|
|
|
194
199
|
List<Object> specs = new ArrayList<>();
|
|
195
200
|
|
|
196
201
|
if (!"".equals(explicit)) {
|
|
202
|
+
register(explicit);
|
|
197
203
|
String key = null;
|
|
198
204
|
try {
|
|
199
205
|
key = Sekreto.envkey(this.secretname, null);
|
|
@@ -393,6 +399,7 @@ public class SecretsFeature extends BaseFeature {
|
|
|
393
399
|
// tryget: null is a MISS (the chain had nothing), an exception is an
|
|
394
400
|
// ERROR and propagates to the gate above.
|
|
395
401
|
String found = this.sek.tryget(this.secretname);
|
|
402
|
+
register(found);
|
|
396
403
|
|
|
397
404
|
if (this.exchange == null) {
|
|
398
405
|
synchronized (this.lock) {
|
|
@@ -570,6 +577,7 @@ public class SecretsFeature extends BaseFeature {
|
|
|
570
577
|
// required server variable, for the same reason.
|
|
571
578
|
if (!"live".equals(this.client.mode)) {
|
|
572
579
|
String token = "test-" + this.exchange.response;
|
|
580
|
+
register(token);
|
|
573
581
|
synchronized (this.lock) {
|
|
574
582
|
this.cred = token;
|
|
575
583
|
}
|
|
@@ -602,6 +610,7 @@ public class SecretsFeature extends BaseFeature {
|
|
|
602
610
|
RuntimeException err = null;
|
|
603
611
|
try {
|
|
604
612
|
token = buyonce();
|
|
613
|
+
register(token);
|
|
605
614
|
}
|
|
606
615
|
catch (RuntimeException e) {
|
|
607
616
|
err = e;
|
|
@@ -625,6 +634,15 @@ public class SecretsFeature extends BaseFeature {
|
|
|
625
634
|
return token;
|
|
626
635
|
}
|
|
627
636
|
|
|
637
|
+
// Every value this feature resolves or buys is a secret the SDK handles,
|
|
638
|
+
// and none arrives under an option key the intake registration saw.
|
|
639
|
+
private void register(String value) {
|
|
640
|
+
Context ctx = this.rootctx;
|
|
641
|
+
if (value != null && ctx != null && ctx.utility != null && ctx.utility.cleanAdd != null) {
|
|
642
|
+
ctx.utility.cleanAdd.apply(ctx, value);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
628
646
|
private String buyonce() {
|
|
629
647
|
SecretsExchange x = this.exchange;
|
|
630
648
|
|
|
@@ -122,11 +122,17 @@ public class TelemetryFeature extends BaseFeature {
|
|
|
122
122
|
span.put("durationMs", dur);
|
|
123
123
|
span.put("ok", ok);
|
|
124
124
|
|
|
125
|
+
Map<String, Object> out = span;
|
|
126
|
+
if (ctx.utility != null && ctx.utility.clean != null) {
|
|
127
|
+
Map<String, Object> cleaned = Helpers.toMapAny(ctx.utility.clean.apply(ctx, span));
|
|
128
|
+
out = cleaned == null ? span : cleaned;
|
|
129
|
+
}
|
|
130
|
+
|
|
125
131
|
this.activeSpans--;
|
|
126
|
-
this.spans.add(
|
|
132
|
+
this.spans.add(out);
|
|
127
133
|
|
|
128
134
|
if (this.options.get("exporter") instanceof Consumer) {
|
|
129
|
-
((Consumer<Map<String, Object>>) this.options.get("exporter")).accept(
|
|
135
|
+
((Consumer<Map<String, Object>>) this.options.get("exporter")).accept(out);
|
|
130
136
|
}
|
|
131
137
|
}
|
|
132
138
|
|