@voxgig/sdkgen 4.32.1 → 4.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/voxgig-sdkgen +1 -1
- package/dist/action/copies.d.ts +21 -0
- package/dist/action/copies.js +146 -0
- package/dist/action/copies.js.map +1 -0
- package/dist/action/doctor.d.ts +15 -2
- package/dist/action/doctor.js +169 -23
- package/dist/action/doctor.js.map +1 -1
- package/dist/action/edition.js +6 -2
- package/dist/action/edition.js.map +1 -1
- package/dist/action/feature.js +6 -2
- package/dist/action/feature.js.map +1 -1
- package/dist/action/package.js +28 -10
- package/dist/action/package.js.map +1 -1
- package/dist/action/remove.js +2 -0
- package/dist/action/remove.js.map +1 -1
- package/dist/action/resolve.d.ts +1 -0
- package/dist/action/resolve.js +10 -2
- package/dist/action/resolve.js.map +1 -1
- package/dist/action/target.js +6 -2
- package/dist/action/target.js.map +1 -1
- package/dist/helpers/naming.js +1 -1
- package/dist/helpers/naming.js.map +1 -1
- package/dist/sdkgen.d.ts +2 -1
- package/dist/sdkgen.js +36 -3
- package/dist/sdkgen.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/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/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/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/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/action/copies.ts +219 -0
- package/src/action/doctor.ts +247 -21
- package/src/action/edition.ts +10 -2
- package/src/action/feature.ts +11 -2
- package/src/action/package.ts +31 -10
- package/src/action/remove.ts +4 -0
- package/src/action/resolve.ts +16 -3
- package/src/action/target.ts +10 -2
- package/src/helpers/naming.ts +1 -1
- package/src/sdkgen.ts +45 -5
|
@@ -134,13 +134,19 @@
|
|
|
134
134
|
;; error map under ::sdk-error.
|
|
135
135
|
;; ---------------------------------------------------------------------------
|
|
136
136
|
|
|
137
|
+
;; The context rides in the map's METADATA, not as a key: the error is data
|
|
138
|
+
;; and `pr-str`/`ex-data` print every key, and the context holds the live
|
|
139
|
+
;; spec and options. Reachable through `err-ctx` for a debugger, invisible to
|
|
140
|
+
;; every printer.
|
|
137
141
|
(defn make-error-obj
|
|
138
142
|
([code msg] (make-error-obj code msg nil))
|
|
139
143
|
([code msg ctx]
|
|
140
|
-
{:sdk-error true :sdk SDK-NAME :code (or code "") :msg (or msg "")
|
|
141
|
-
|
|
144
|
+
(with-meta {:sdk-error true :sdk SDK-NAME :code (or code "") :msg (or msg "")
|
|
145
|
+
:result nil :spec nil}
|
|
146
|
+
{:ctx ctx})))
|
|
142
147
|
|
|
143
148
|
(defn sdk-error? [x] (and (map? x) (true? (:sdk-error x))))
|
|
149
|
+
(defn err-ctx [e] (when (sdk-error? e) (:ctx (meta e))))
|
|
144
150
|
(defn err-msg [e]
|
|
145
151
|
(cond
|
|
146
152
|
(sdk-error? e) (:msg e)
|
|
@@ -332,6 +338,9 @@
|
|
|
332
338
|
result (let [r (cprop "result")] (if (some? r) r (bget :result)))
|
|
333
339
|
response (let [r (cprop "response")] (if (some? r) r (bget :response)))
|
|
334
340
|
opname (or (cprop "opname") "")
|
|
341
|
+
;; `:type` metadata routes print-method to the cleaned record (see
|
|
342
|
+
;; ctx->data): a bare atom prints its whole value, spec and options
|
|
343
|
+
;; included.
|
|
335
344
|
ctx (atom {:id (str "C" (+ 10000000 (rand-int 89999999)))
|
|
336
345
|
:out (atom (vs/jm))
|
|
337
346
|
:client client :utility utility :ctrl ctrl :meta meta
|
|
@@ -340,7 +349,8 @@
|
|
|
340
349
|
:data (dmap "data") :reqdata (dmap "reqdata")
|
|
341
350
|
:match (dmap "match") :reqmatch (dmap "reqmatch")
|
|
342
351
|
:point point :spec spec :result result :response response
|
|
343
|
-
:op nil}
|
|
352
|
+
:op nil}
|
|
353
|
+
:meta {:type ::context})]
|
|
344
354
|
(oset! ctx :op (resolve-op ctx opname))
|
|
345
355
|
ctx))
|
|
346
356
|
|
|
@@ -430,7 +440,247 @@
|
|
|
430
440
|
|
|
431
441
|
(def METHOD-MAP {"create" "POST" "update" "PUT" "load" "GET" "list" "GET" "remove" "DELETE" "patch" "PATCH"})
|
|
432
442
|
|
|
433
|
-
|
|
443
|
+
;; ---------------------------------------------------------------------------
|
|
444
|
+
;; clean. Everything that leaves the pipeline passes through it; inside, data
|
|
445
|
+
;; stays raw so a hook can still read the header it must add to. See
|
|
446
|
+
;; docs/explanation/secret-redaction.md.
|
|
447
|
+
;; ---------------------------------------------------------------------------
|
|
448
|
+
|
|
449
|
+
(def ^:private CLEAN-MAXDEPTH 32)
|
|
450
|
+
(def ^:private CLEAN-CIRCULAR "[circular]")
|
|
451
|
+
(def ^:private DROP (Object.))
|
|
452
|
+
|
|
453
|
+
(defn- keyname [k] (cond (nil? k) "" (keyword? k) (name k) :else (str k)))
|
|
454
|
+
|
|
455
|
+
(defn- normkey [k] (str/replace (str/lower-case (keyname k)) #"[-_]" ""))
|
|
456
|
+
|
|
457
|
+
(defn- splitkeys [keys]
|
|
458
|
+
(->> (str/split (str (or keys "")) #"\s*,\s*") (map normkey) (remove empty?) vec))
|
|
459
|
+
|
|
460
|
+
(defn splitvalues [values]
|
|
461
|
+
(if (or (vs/islist values) (sequential? values))
|
|
462
|
+
(filterv string? (vec values))
|
|
463
|
+
(->> (str/split (str (or values "")) #"\s*,\s*") (remove empty?) vec)))
|
|
464
|
+
|
|
465
|
+
(defn- count-opt [v dflt]
|
|
466
|
+
(let [n (try (long (Math/floor (Double/parseDouble (str v)))) (catch Exception _ nil))]
|
|
467
|
+
(if (and n (<= 0 n)) n dflt)))
|
|
468
|
+
|
|
469
|
+
;; The derived clean block: a struct map so it lives in options.__derived__
|
|
470
|
+
;; and its `values` list stays MUTABLE after make-options - features register
|
|
471
|
+
;; what they resolve later.
|
|
472
|
+
(defn make-clean-config [cleanopts]
|
|
473
|
+
(let [o (fn [k] (mget cleanopts k))
|
|
474
|
+
keys (vs/jt)]
|
|
475
|
+
(doseq [k (splitkeys (o "keys"))] (.add ^java.util.List keys k))
|
|
476
|
+
(vs/jm "active" (not= false (o "active"))
|
|
477
|
+
"keys" keys
|
|
478
|
+
"values" (vs/jt)
|
|
479
|
+
"mask" (let [m (o "mask")] (if (string? m) m "[redacted]"))
|
|
480
|
+
"hint" (count-opt (o "hint") 0)
|
|
481
|
+
"min" (max 1 (count-opt (o "min") 4)))))
|
|
482
|
+
|
|
483
|
+
;; A context without options (make-error accepts a bare one) still masks by
|
|
484
|
+
;; the schema defaults.
|
|
485
|
+
(defn- clean-config [ctx]
|
|
486
|
+
(let [options (when (instance? clojure.lang.IDeref ctx) (oget ctx :options))
|
|
487
|
+
derived (when (vs/ismap options) (vs/getpath options "__derived__.clean"))]
|
|
488
|
+
(if (vs/ismap derived) derived (make-clean-config (vs/getprop @optspec-parsed "clean")))))
|
|
489
|
+
|
|
490
|
+
;; The encoded forms a value travels in.
|
|
491
|
+
(defn- clean-forms [^String value]
|
|
492
|
+
(let [out (java.util.ArrayList.)
|
|
493
|
+
add (fn [s] (when (and (string? s) (not= "" s) (not (.contains out s))) (.add out s)))]
|
|
494
|
+
(add value)
|
|
495
|
+
(try (add (.encodeToString (java.util.Base64/getEncoder) (.getBytes value "UTF-8"))) (catch Throwable _ nil))
|
|
496
|
+
(try (add (vs/escurl value)) (catch Throwable _ nil))
|
|
497
|
+
(try (let [j (vs/jsonify value)] (add (subs j 1 (dec (count j))))) (catch Throwable _ nil))
|
|
498
|
+
(vec out)))
|
|
499
|
+
|
|
500
|
+
(defn u-clean-add [ctx value]
|
|
501
|
+
(let [cfg (clean-config ctx)
|
|
502
|
+
minlen (long (or (mget cfg "min") 4))
|
|
503
|
+
values (mget cfg "values")]
|
|
504
|
+
(when (and (string? value) (>= (count value) minlen) (instance? java.util.List values))
|
|
505
|
+
(let [changed (atom false)]
|
|
506
|
+
(doseq [form (clean-forms value)]
|
|
507
|
+
(when (and (>= (count form) minlen) (not (.contains ^java.util.List values form)))
|
|
508
|
+
(.add ^java.util.List values form)
|
|
509
|
+
(reset! changed true)))
|
|
510
|
+
;; Longest first, so a value is never masked by a substring of itself.
|
|
511
|
+
(when @changed
|
|
512
|
+
(let [sorted (sort-by (fn [^String s] (- (count s))) (vec values))]
|
|
513
|
+
(.clear ^java.util.List values)
|
|
514
|
+
(doseq [s sorted] (.add ^java.util.List values s))))))
|
|
515
|
+
nil))
|
|
516
|
+
|
|
517
|
+
(defn- mask-value [cfg ^String value]
|
|
518
|
+
(let [hint (long (or (mget cfg "hint") 0))
|
|
519
|
+
mask (str (mget cfg "mask"))]
|
|
520
|
+
(if (and (pos? hint) (> (count value) (* 2 hint)))
|
|
521
|
+
(str mask (subs value (- (count value) hint)))
|
|
522
|
+
mask)))
|
|
523
|
+
|
|
524
|
+
(defn- clean-string [cfg ^String text]
|
|
525
|
+
(reduce (fn [^String out ^String value]
|
|
526
|
+
(if (.contains out value) (str/replace out value (mask-value cfg value)) out))
|
|
527
|
+
text
|
|
528
|
+
(vec (or (mget cfg "values") []))))
|
|
529
|
+
|
|
530
|
+
(defn- sensitive-key? [cfg key]
|
|
531
|
+
(if (or (nil? key) (number? key))
|
|
532
|
+
false
|
|
533
|
+
(let [^String nk (normkey key)]
|
|
534
|
+
(boolean (some (fn [^String k] (.contains nk k)) (vec (or (mget cfg "keys") [])))))))
|
|
535
|
+
|
|
536
|
+
(defn- number-text [n]
|
|
537
|
+
(if (and (float? n) (== (double n) (Math/floor (double n))) (< (Math/abs (double n)) 9.0E15))
|
|
538
|
+
(str (long n))
|
|
539
|
+
(str n)))
|
|
540
|
+
|
|
541
|
+
;; Every scalar under a sensitive name, at any depth and of any shape: a
|
|
542
|
+
;; credential mistyped as a map or a number is still a credential, and the
|
|
543
|
+
;; validation error that rejects it quotes it.
|
|
544
|
+
(defn u-clean-add-sensitive
|
|
545
|
+
([ctx val] (u-clean-add-sensitive ctx (clean-config ctx) val false 0 []))
|
|
546
|
+
([ctx cfg val under depth seen]
|
|
547
|
+
(cond
|
|
548
|
+
(or (nil? val) (<= CLEAN-MAXDEPTH depth)) nil
|
|
549
|
+
(string? val) (when under (u-clean-add ctx val))
|
|
550
|
+
(number? val) (when under (u-clean-add ctx (number-text val)))
|
|
551
|
+
(some #(identical? % val) seen) nil
|
|
552
|
+
(instance? java.util.Map val)
|
|
553
|
+
(let [seen (conj seen val)]
|
|
554
|
+
(doseq [^java.util.Map$Entry e (vec (.entrySet ^java.util.Map val))]
|
|
555
|
+
(u-clean-add-sensitive ctx cfg (.getValue e)
|
|
556
|
+
(or under (sensitive-key? cfg (.getKey e))) (inc depth) seen)))
|
|
557
|
+
(or (instance? java.util.Collection val) (sequential? val))
|
|
558
|
+
(let [seen (conj seen val)]
|
|
559
|
+
(doseq [v (seq val)]
|
|
560
|
+
(u-clean-add-sensitive ctx cfg v under (inc depth) seen)))
|
|
561
|
+
:else nil)))
|
|
562
|
+
|
|
563
|
+
(defn- entity-instance? [v]
|
|
564
|
+
(and (map? v) (instance? clojure.lang.IAtom (:_data v)) (fn? (:get-name v))))
|
|
565
|
+
|
|
566
|
+
;; A registered value used as a property name is masked like any other
|
|
567
|
+
;; string; names that mask alike take a counter, so none is lost.
|
|
568
|
+
(defn- clean-name [cfg has? k]
|
|
569
|
+
(let [key (keyname k)
|
|
570
|
+
n (clean-string cfg key)]
|
|
571
|
+
(if (or (= n key) (not (has? n)))
|
|
572
|
+
n
|
|
573
|
+
(loop [i 1]
|
|
574
|
+
(let [c (str n "#" i)]
|
|
575
|
+
(if (has? c) (recur (inc i)) c))))))
|
|
576
|
+
|
|
577
|
+
;; A masked plain-data COPY (string-keyed struct nodes): an entity serialises
|
|
578
|
+
;; as its record, an atom-object as its map, functions are dropped, cycles
|
|
579
|
+
;; cut, and nothing is shared with the live value, whose spec must stay raw.
|
|
580
|
+
(defn- clean-snapshot [cfg val key depth seen]
|
|
581
|
+
(cond
|
|
582
|
+
(nil? val) nil
|
|
583
|
+
(string? val) (if (sensitive-key? cfg key) (mask-value cfg val) (clean-string cfg val))
|
|
584
|
+
(fn? val) DROP
|
|
585
|
+
(or (number? val) (boolean? val) (keyword? val) (symbol? val) (char? val))
|
|
586
|
+
(if (sensitive-key? cfg key) (mget cfg "mask") val)
|
|
587
|
+
(or (<= CLEAN-MAXDEPTH depth) (some #(identical? % val) seen)) CLEAN-CIRCULAR
|
|
588
|
+
(sensitive-key? cfg key) (mget cfg "mask")
|
|
589
|
+
:else
|
|
590
|
+
(let [seen (conj seen val)]
|
|
591
|
+
(cond
|
|
592
|
+
(entity-instance? val) (clean-snapshot cfg (deref (:_data val)) key (inc depth) seen)
|
|
593
|
+
(instance? clojure.lang.IAtom val) (clean-snapshot cfg (deref val) key (inc depth) seen)
|
|
594
|
+
(instance? Throwable val)
|
|
595
|
+
(let [out (vs/jm "message" (clean-string cfg (str (.getMessage ^Throwable val))))]
|
|
596
|
+
(when (instance? clojure.lang.IExceptionInfo val)
|
|
597
|
+
(let [d (clean-snapshot cfg (ex-data val) "data" (inc depth) seen)]
|
|
598
|
+
(when-not (identical? DROP d) (.put ^java.util.Map out "data" d))))
|
|
599
|
+
out)
|
|
600
|
+
(instance? java.util.Map val)
|
|
601
|
+
(let [out (vs/jm)]
|
|
602
|
+
(doseq [^java.util.Map$Entry e (.entrySet ^java.util.Map val)]
|
|
603
|
+
(let [k (.getKey e)
|
|
604
|
+
v (clean-snapshot cfg (.getValue e) k (inc depth) seen)]
|
|
605
|
+
(when-not (identical? DROP v)
|
|
606
|
+
(.put ^java.util.Map out
|
|
607
|
+
(clean-name cfg #(.containsKey ^java.util.Map out %) k) v))))
|
|
608
|
+
out)
|
|
609
|
+
(or (instance? java.util.Collection val) (sequential? val))
|
|
610
|
+
(let [out (vs/jt)]
|
|
611
|
+
(doseq [[i v] (map-indexed vector (seq val))]
|
|
612
|
+
(let [c (clean-snapshot cfg v i (inc depth) seen)]
|
|
613
|
+
(.add ^java.util.List out (if (identical? DROP c) nil c))))
|
|
614
|
+
out)
|
|
615
|
+
:else (clean-string cfg (str val))))))
|
|
616
|
+
|
|
617
|
+
;; An error map is immutable, so "in place" is a cleaned copy carrying the
|
|
618
|
+
;; same metadata (the context stays reachable through err-ctx).
|
|
619
|
+
(defn- clean-error [cfg err]
|
|
620
|
+
(with-meta
|
|
621
|
+
(reduce (fn [out [k v]]
|
|
622
|
+
(let [c (clean-snapshot cfg v k 1 [])
|
|
623
|
+
n (clean-name cfg #(contains? out %) k)]
|
|
624
|
+
(assoc out (if (= n (keyname k)) k n) (if (identical? DROP c) nil c))))
|
|
625
|
+
{} err)
|
|
626
|
+
(meta err)))
|
|
627
|
+
|
|
628
|
+
(defn u-clean [ctx val]
|
|
629
|
+
(let [cfg (clean-config ctx)]
|
|
630
|
+
(cond
|
|
631
|
+
(= false (mget cfg "active")) val
|
|
632
|
+
(string? val) (clean-string cfg val)
|
|
633
|
+
(sdk-error? val) (clean-error cfg val)
|
|
634
|
+
:else (let [out (clean-snapshot cfg val nil 0 [])] (if (identical? DROP out) nil out)))))
|
|
635
|
+
|
|
636
|
+
;; A Throwable is immutable, so one that never passed through make-error (a
|
|
637
|
+
;; hook's, a fetcher's) leaves as a cleaned copy with the original's trace.
|
|
638
|
+
;; One carrying the SDK error keeps it, cleaned, under the same key.
|
|
639
|
+
(defn clean-throwable [ctx ^Throwable t]
|
|
640
|
+
(let [cfg (clean-config ctx)]
|
|
641
|
+
(if (= false (mget cfg "active"))
|
|
642
|
+
t
|
|
643
|
+
(let [sdkerr (ex->sdk t)
|
|
644
|
+
out (if (sdk-error? sdkerr)
|
|
645
|
+
(let [e (clean-error cfg sdkerr)]
|
|
646
|
+
(ex-info (err-msg e) {::sdk-error e}))
|
|
647
|
+
(let [data (when (instance? clojure.lang.IExceptionInfo t)
|
|
648
|
+
(clean-snapshot cfg (ex-data t) nil 0 []))]
|
|
649
|
+
(ex-info (clean-string cfg (str (.getMessage t)))
|
|
650
|
+
(if (instance? java.util.Map data) (into {} data) {}))))]
|
|
651
|
+
(.setStackTrace ^Throwable out (.getStackTrace t))
|
|
652
|
+
out))))
|
|
653
|
+
|
|
654
|
+
;; The error as string-keyed data: jsonify reads a java.util.Map's keys as
|
|
655
|
+
;; strings, so a keyword-keyed map would serialise as nulls.
|
|
656
|
+
(defn err->data [e]
|
|
657
|
+
(when (sdk-error? e)
|
|
658
|
+
(u-clean (err-ctx e) (into {} (map (fn [[k v]] [(keyname k) v]) e)))))
|
|
659
|
+
|
|
660
|
+
;; The serialised context leaves the pipeline (a logger, an error dump), so
|
|
661
|
+
;; it is the cleaned record; the live fields stay raw for the pipeline's use.
|
|
662
|
+
(defn ctx->data [ctx]
|
|
663
|
+
(let [m (deref ctx)
|
|
664
|
+
u (:utility m)
|
|
665
|
+
clean (or (when (instance? clojure.lang.IDeref u) (:clean (deref u))) u-clean)
|
|
666
|
+
entity (:entity m)]
|
|
667
|
+
(clean ctx (vs/jm "id" (:id m) "op" (:op m) "spec" (:spec m)
|
|
668
|
+
"entity" (when (map? entity) (entity-get-name entity))
|
|
669
|
+
"result" (:result m) "response" (:response m) "meta" (:meta m)))))
|
|
670
|
+
|
|
671
|
+
(defmethod print-method ::context [ctx ^java.io.Writer w]
|
|
672
|
+
(.write w (str "#sdk/context " (vs/jsonify (ctx->data ctx) (vs/jm "indent" 0)))))
|
|
673
|
+
|
|
674
|
+
;; The explain map is the CALLER's, so it is cleaned in place: what they hold
|
|
675
|
+
;; after the call is the cleaned record. With clean off its result is the live
|
|
676
|
+
;; result atom, which the prune leaves alone.
|
|
677
|
+
(defn clean-explain! [ctx]
|
|
678
|
+
(when-let [ex (oget (oget ctx :ctrl) :explain)]
|
|
679
|
+
(let [cleaned (ucall ctx :clean ex)]
|
|
680
|
+
(when (and (vs/ismap ex) (vs/ismap cleaned) (not (identical? cleaned ex)))
|
|
681
|
+
(.clear ^java.util.Map ex)
|
|
682
|
+
(.putAll ^java.util.Map ex ^java.util.Map cleaned))
|
|
683
|
+
(let [er (mget ex "result")] (when (vs/ismap er) (vs/delprop er "err"))))))
|
|
434
684
|
|
|
435
685
|
;; The API definition is authoritative: a POST-only or PATCH-based API
|
|
436
686
|
;; exposes `update` as POST or PATCH, not the PUT the op name implies.
|
|
@@ -978,16 +1228,22 @@
|
|
|
978
1228
|
:else
|
|
979
1229
|
(do
|
|
980
1230
|
(oset! spec :step "response")
|
|
981
|
-
(
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1231
|
+
;; A body reader that throws (a non-JSON body) fails the result,
|
|
1232
|
+
;; as in ts; it must not escape the pipeline with the raw spec
|
|
1233
|
+
;; still on the explain record.
|
|
1234
|
+
(try
|
|
1235
|
+
(ucall ctx :result-basic)
|
|
1236
|
+
(ucall ctx :result-headers)
|
|
1237
|
+
(ucall ctx :result-body)
|
|
1238
|
+
;; GraphQL reports failures as a top-level `errors` array under
|
|
1239
|
+
;; HTTP 200, so result-basic's status check never sees them. Lift
|
|
1240
|
+
;; them here, before the response transform tries to unwrap data
|
|
1241
|
+
;; that is not there.
|
|
1242
|
+
(ucall ctx :graphql-errors)
|
|
1243
|
+
(ucall ctx :transform-response)
|
|
1244
|
+
(when (nil? (oget result :err)) (oset! result :ok true))
|
|
1245
|
+
(catch Throwable e
|
|
1246
|
+
(oset! result :err e)))
|
|
991
1247
|
(when-let [ex (oget (oget ctx :ctrl) :explain)] (.put ^java.util.Map ex "result" result))
|
|
992
1248
|
[response nil])))))
|
|
993
1249
|
|
|
@@ -1028,11 +1284,13 @@
|
|
|
1028
1284
|
msg (ucall ctx :clean msg0)
|
|
1029
1285
|
spec (oget ctx :spec)]
|
|
1030
1286
|
(oset! result :err nil)
|
|
1287
|
+
(clean-explain! ctx)
|
|
1031
1288
|
(when-let [ex (oget (oget ctx :ctrl) :explain)] (.put ^java.util.Map ex "err" (vs/jm "message" msg)))
|
|
1032
|
-
|
|
1289
|
+
;; Cleaned COPIES of the result and spec, never the live objects.
|
|
1290
|
+
(let [code (when (sdk-error? err) (ucall ctx :clean (:code err)))
|
|
1291
|
+
sdk-err (assoc (make-error-obj code msg ctx)
|
|
1033
1292
|
:result (ucall ctx :clean result)
|
|
1034
|
-
:spec (ucall ctx :clean spec)
|
|
1035
|
-
:code (if (sdk-error? err) (:code err) ""))]
|
|
1293
|
+
:spec (ucall ctx :clean spec))]
|
|
1036
1294
|
(oset! (oget ctx :ctrl) :err sdk-err)
|
|
1037
1295
|
;; Fire PreUnexpected so observability features (metrics, telemetry,
|
|
1038
1296
|
;; audit, debug) close/record error paths that never reach PreDone
|
|
@@ -1046,15 +1304,11 @@
|
|
|
1046
1304
|
(sdk-throw sdk-err))))))
|
|
1047
1305
|
|
|
1048
1306
|
(defn u-done [ctx]
|
|
1049
|
-
(
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
(let [result (oget ctx :result)]
|
|
1055
|
-
(if (and result (oget result :ok))
|
|
1056
|
-
(oget result :resdata)
|
|
1057
|
-
(ucall ctx :make-error nil)))))
|
|
1307
|
+
(clean-explain! ctx)
|
|
1308
|
+
(let [result (oget ctx :result)]
|
|
1309
|
+
(if (and result (oget result :ok))
|
|
1310
|
+
(oget result :resdata)
|
|
1311
|
+
(ucall ctx :make-error nil))))
|
|
1058
1312
|
|
|
1059
1313
|
;; Public camelCase option key -> the kebab-case keyword naming a utility
|
|
1060
1314
|
;; member, or nil when the key is not a public name.
|
|
@@ -1073,6 +1327,19 @@
|
|
|
1073
1327
|
(fn [[_ c]]
|
|
1074
1328
|
(clojure.core/str "-" (str/lower-case c))))))))
|
|
1075
1329
|
|
|
1330
|
+
;; A feature's name is not a field name: only the sensitive names inside its
|
|
1331
|
+
;; settings count, so `secrets` does not make every setting a secret. Entity
|
|
1332
|
+
;; blocks hold entity settings and seeded records, never a credential.
|
|
1333
|
+
(defn- clean-add-options [ctx opts]
|
|
1334
|
+
(let [noent #(omit-keys % ["entity"])
|
|
1335
|
+
top (dissoc (into {} opts) "feature" "entity")
|
|
1336
|
+
feature (vs/getprop opts "feature")]
|
|
1337
|
+
(u-clean-add-sensitive ctx (cond-> top (contains? top "test") (update "test" noent)))
|
|
1338
|
+
(doseq [fopts (cond (vs/ismap feature) (map #(vs/getprop feature %) (vs/keysof feature))
|
|
1339
|
+
(vs/islist feature) (vec feature)
|
|
1340
|
+
:else [feature])]
|
|
1341
|
+
(u-clean-add-sensitive ctx (noent fopts)))))
|
|
1342
|
+
|
|
1076
1343
|
(defn u-make-options [ctx]
|
|
1077
1344
|
(let [options (or (oget ctx :options) (vs/jm))
|
|
1078
1345
|
custom-utils (vs/getprop options "utility")]
|
|
@@ -1137,9 +1404,28 @@
|
|
|
1137
1404
|
;; one of twenty hand-maintained copies of a schema nothing
|
|
1138
1405
|
;; cross-checked — so add it to the model instead.
|
|
1139
1406
|
optspec @optspec-parsed
|
|
1407
|
+
;; The secret registry exists BEFORE validation, fed from the raw
|
|
1408
|
+
;; input, so the constructor's own rejection of a mistyped
|
|
1409
|
+
;; credential is clean too. A shallow merge over the schema
|
|
1410
|
+
;; defaults: the clean block is flat.
|
|
1411
|
+
cleancfg (make-clean-config
|
|
1412
|
+
(let [out (vs/jm)]
|
|
1413
|
+
(doseq [src [(vs/getprop optspec "clean") (vs/getprop cfgopts "clean")
|
|
1414
|
+
(vs/getprop opts0 "clean")]]
|
|
1415
|
+
(when (vs/ismap src)
|
|
1416
|
+
(doseq [k (vs/keysof src)] (.put ^java.util.Map out k (vs/getprop src k)))))
|
|
1417
|
+
out))
|
|
1418
|
+
cleanctx (atom {:options (vs/jm "__derived__" (vs/jm "clean" cleancfg))})
|
|
1419
|
+
_ (clean-add-options cleanctx (omit-keys opts0 ["clean"]))
|
|
1420
|
+
_ (doseq [raw (concat (splitvalues (vs/getpath cfgopts "clean.values"))
|
|
1421
|
+
(splitvalues (vs/getpath opts0 "clean.values")))]
|
|
1422
|
+
(u-clean-add cleanctx raw))
|
|
1140
1423
|
sys-fetch (vs/getpath opts0 "system.fetch")
|
|
1141
|
-
|
|
1142
|
-
|
|
1424
|
+
;; Cloned: merge writes through the nested maps of what it reads.
|
|
1425
|
+
merged (vs/merge (vs/jt (vs/jm) (vs/clone cfgopts) opts0))
|
|
1426
|
+
validated (try (vs/validate merged optspec)
|
|
1427
|
+
(catch RuntimeException e
|
|
1428
|
+
(throw (RuntimeException. ^String (u-clean cleanctx (str (.getMessage e)))))))
|
|
1143
1429
|
opts (if (vs/ismap validated) validated (vs/jm))
|
|
1144
1430
|
;; Restore the suppression the optspec default would otherwise erase.
|
|
1145
1431
|
_ (when auth-suppressed (.put ^java.util.Map opts "auth" nil))
|
|
@@ -1179,10 +1465,7 @@
|
|
|
1179
1465
|
(when sys-fetch
|
|
1180
1466
|
(when (not (vs/ismap (vs/getprop opts "system"))) (.put ^java.util.Map opts "system" (vs/jm)))
|
|
1181
1467
|
(.put ^java.util.Map (vs/getprop opts "system") "fetch" sys-fetch))
|
|
1182
|
-
(let [
|
|
1183
|
-
parts (->> (str/split clean-keys #",") (map str/trim) (remove empty?) (map vs/escre))
|
|
1184
|
-
keyre (str/join "|" parts)
|
|
1185
|
-
;; Resolve the feature add-order: an explicit array order (above)
|
|
1468
|
+
(let [;; Resolve the feature add-order: an explicit array order (above)
|
|
1186
1469
|
;; wins; otherwise order the map test-first, then the remaining
|
|
1187
1470
|
;; names sorted, so the outcome is deterministic and `test` is
|
|
1188
1471
|
;; always the base transport.
|
|
@@ -1195,9 +1478,10 @@
|
|
|
1195
1478
|
(when (some #(= % "test") names) (.add ^java.util.List order "test"))
|
|
1196
1479
|
(doseq [n names] (when (not= n "test") (.add ^java.util.List order n)))
|
|
1197
1480
|
order))
|
|
1198
|
-
derived (vs/jm "clean"
|
|
1199
|
-
"featureorder" feature-order)]
|
|
1481
|
+
derived (vs/jm "clean" cleancfg "featureorder" feature-order)]
|
|
1200
1482
|
(.put ^java.util.Map opts "__derived__" derived)
|
|
1483
|
+
;; Again over the merged result: the config's own defaults can carry one.
|
|
1484
|
+
(clean-add-options (atom {:options opts}) (omit-keys opts ["clean" "__derived__"]))
|
|
1201
1485
|
opts))))
|
|
1202
1486
|
|
|
1203
1487
|
;; ---------------------------------------------------------------------------
|
|
@@ -1258,7 +1542,7 @@
|
|
|
1258
1542
|
;; ---------------------------------------------------------------------------
|
|
1259
1543
|
|
|
1260
1544
|
(defn base-utility-map []
|
|
1261
|
-
{:clean u-clean :done u-done :make-error u-make-error
|
|
1545
|
+
{:clean u-clean :clean-add u-clean-add :done u-done :make-error u-make-error
|
|
1262
1546
|
:feature-add feature-add :feature-hook feature-hook :feature-init feature-init
|
|
1263
1547
|
:fetcher u-fetcher :make-fetch-def u-make-fetch-def :make-context (fn [cm bc] (make-context cm bc))
|
|
1264
1548
|
:make-options u-make-options :make-request u-make-request :make-response u-make-response
|
|
@@ -69,11 +69,24 @@
|
|
|
69
69
|
|
|
70
70
|
(defn log-feature []
|
|
71
71
|
(let [fa (new-feature "log" true "0.0.1")
|
|
72
|
+
;; A log line leaves the pipeline, so it carries the cleaned record:
|
|
73
|
+
;; the spec after auth holds the credential, and a logger serialises
|
|
74
|
+
;; whatever it is handed. `logger` is a fn of the record, a map with
|
|
75
|
+
;; an "info" fn, or anything else for the stderr default.
|
|
72
76
|
loghook (fn [ctx hook]
|
|
73
|
-
(when (:logger @fa)
|
|
74
|
-
(let [opname (if (core/oget ctx :op) (core/op-name (core/oget ctx :op)) "")
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
(when-let [logger (:logger @fa)]
|
|
78
|
+
(let [opname (if (core/oget ctx :op) (core/op-name (core/oget ctx :op)) "")
|
|
79
|
+
record (core/ucall ctx :clean
|
|
80
|
+
(vs/jm "hook" hook "op" opname
|
|
81
|
+
"spec" (core/oget ctx :spec)
|
|
82
|
+
"ctx" (core/ctx->data ctx)))]
|
|
83
|
+
(cond
|
|
84
|
+
(fn? logger) (logger record)
|
|
85
|
+
(and (vs/ismap logger) (fn? (mget logger "info"))) ((mget logger "info") record)
|
|
86
|
+
:else
|
|
87
|
+
(binding [*out* *err*]
|
|
88
|
+
(println (str "[INFO] hook=" hook " op=" opname " "
|
|
89
|
+
(vs/jsonify record (vs/jm "indent" 0)))))))))]
|
|
77
90
|
(swap! fa assoc
|
|
78
91
|
"init" (fn [ctx options]
|
|
79
92
|
(swap! fa assoc :client (core/oget ctx :client) :options options
|
|
@@ -779,10 +792,13 @@
|
|
|
779
792
|
(bump-bucket! (mget rec "ops") (str entity "." opname) amount)
|
|
780
793
|
(bump-bucket! (mget rec "actors") (str actor) amount)
|
|
781
794
|
(swap! fa update :seq (fnil inc 0))
|
|
782
|
-
(
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
795
|
+
(let [last (core/ucall ctx :clean
|
|
796
|
+
(vs/jm "seq" (:seq @fa) "entity" entity "op" opname "actor" (str actor)
|
|
797
|
+
"amount" amount "currency" (mget rec "currency")
|
|
798
|
+
"source" source "attempts" (mget p "attempts")))]
|
|
799
|
+
(.put ^java.util.Map rec "last" last)
|
|
800
|
+
(let [sink (opt fa "sink")]
|
|
801
|
+
(when (fn? sink) (try (sink last) (catch Throwable _ nil)))))))
|
|
786
802
|
finish! (fn [ctx done]
|
|
787
803
|
(when (active? fa)
|
|
788
804
|
(let [id (core/oget ctx :id) p (get (:pending @fa) id)]
|
|
@@ -910,9 +926,22 @@
|
|
|
910
926
|
(let [made (agent (:url @fa) url)]
|
|
911
927
|
(.put ^java.util.Map out "dispatcher" made)
|
|
912
928
|
(.put ^java.util.Map out "agent" made))))
|
|
913
|
-
(let [t (track-ensure! fa "_proxy" (vs/jm "routed" 0 "url" (:url @fa)))]
|
|
929
|
+
(let [t (track-ensure! fa "_proxy" (vs/jm "routed" 0 "url" (:clean-url @fa)))]
|
|
914
930
|
(.put ^java.util.Map t "routed" (inc (long (mget t "routed")))))
|
|
915
|
-
out)))
|
|
931
|
+
out)))
|
|
932
|
+
;; A proxy URL may carry credentials as userinfo, from the option or
|
|
933
|
+
;; the environment, and neither is under a sensitive key name.
|
|
934
|
+
register-userinfo! (fn [ctx url]
|
|
935
|
+
(when (string? url)
|
|
936
|
+
(try
|
|
937
|
+
(let [ui (.getRawUserInfo (java.net.URI. ^String url))]
|
|
938
|
+
(when (and ui (seq ui))
|
|
939
|
+
(doseq [part (str/split ui #":" 2)]
|
|
940
|
+
(when (seq part)
|
|
941
|
+
(core/ucall ctx :clean-add part)
|
|
942
|
+
(try (core/ucall ctx :clean-add (java.net.URLDecoder/decode ^String part "UTF-8"))
|
|
943
|
+
(catch Throwable _ nil))))))
|
|
944
|
+
(catch Throwable _ nil))))]
|
|
916
945
|
(swap! fa assoc
|
|
917
946
|
"init" (fn [ctx options]
|
|
918
947
|
(swap! fa assoc :client (core/oget ctx :client)
|
|
@@ -928,7 +957,9 @@
|
|
|
928
957
|
(vs/islist no-proxy1) (vec no-proxy1)
|
|
929
958
|
:else [])
|
|
930
959
|
(remove (fn [s] (or (nil? s) (= s "")))))]
|
|
931
|
-
(
|
|
960
|
+
(register-userinfo! ctx url)
|
|
961
|
+
(swap! fa assoc :url url :no-proxy (vec no-proxy)
|
|
962
|
+
:clean-url (if (string? url) (core/ucall ctx :clean url) url)))
|
|
932
963
|
(wrap-fetcher! ctx (fn [fctx url fd inner] (inner fctx url (route url fd)))))))
|
|
933
964
|
fa))
|
|
934
965
|
|
|
@@ -954,11 +985,12 @@
|
|
|
954
985
|
(.put ^java.util.Map span "end" (now-ms fa))
|
|
955
986
|
(.put ^java.util.Map span "durationMs" (max 0 (- (mget span "end") (mget span "start"))))
|
|
956
987
|
(.put ^java.util.Map span "ok" ok)
|
|
957
|
-
(
|
|
958
|
-
(
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
(
|
|
988
|
+
(let [out (core/ucall ctx :clean span)]
|
|
989
|
+
(when-let [t (telem)]
|
|
990
|
+
(.put ^java.util.Map t "active" (dec (long (mget t "active"))))
|
|
991
|
+
(.add ^java.util.List (mget t "spans") out))
|
|
992
|
+
(let [exporter (opt fa "exporter")]
|
|
993
|
+
(when (fn? exporter) (try (exporter out) (catch Throwable _ nil))))))))]
|
|
962
994
|
(swap! fa assoc :spans {} :seq 0)
|
|
963
995
|
(swap! fa assoc
|
|
964
996
|
"init" (fn [ctx options]
|
|
@@ -1043,19 +1075,18 @@
|
|
|
1043
1075
|
;; debug
|
|
1044
1076
|
;; ---------------------------------------------------------------------------
|
|
1045
1077
|
|
|
1046
|
-
(def REDACT-DEFAULT ["authorization" "cookie" "set-cookie" "api-key" "apikey" "x-api-key" "idempotency-key"])
|
|
1047
|
-
|
|
1048
1078
|
(defn debug-feature []
|
|
1049
1079
|
(let [fa (new-feature "debug" false "0.0.1")
|
|
1050
|
-
|
|
1080
|
+
;; The core clean rules apply (clean.keys, every registered value);
|
|
1081
|
+
;; the feature's own `redact` list ADDS header names on top of them.
|
|
1082
|
+
redact (fn [ctx headers]
|
|
1051
1083
|
(if (nil? headers) (vs/jm)
|
|
1052
|
-
(let [
|
|
1053
|
-
pset (into #{} (map str (vec patterns)))
|
|
1084
|
+
(let [pset (into #{} (map (fn [p] (str/lower-case (str p))) (vec (or (opt fa "redact") []))))
|
|
1054
1085
|
out (vs/jm)]
|
|
1055
1086
|
(doseq [item (or (vs/items headers) [])]
|
|
1056
1087
|
(let [k (vs/getprop item 0) v (vs/getprop item 1)]
|
|
1057
|
-
(.put ^java.util.Map out k (if (contains? pset (str/lower-case (str k))) "
|
|
1058
|
-
out)))
|
|
1088
|
+
(.put ^java.util.Map out k (if (contains? pset (str/lower-case (str k))) "[redacted]" v))))
|
|
1089
|
+
(core/ucall ctx :clean out))))
|
|
1059
1090
|
finish (fn [ctx ok]
|
|
1060
1091
|
(let [entry (get (:entries @fa) ctx)]
|
|
1061
1092
|
(when entry
|
|
@@ -1065,12 +1096,18 @@
|
|
|
1065
1096
|
(.put ^java.util.Map entry "durationMs" (max 0 (- (now-ms fa) (mget entry "start"))))
|
|
1066
1097
|
(when (and (nil? (mget entry "status")) result)
|
|
1067
1098
|
(.put ^java.util.Map entry "status" (core/oget result :status)))
|
|
1068
|
-
|
|
1099
|
+
;; The whole entry leaves through the buffer and the
|
|
1100
|
+
;; callback: the url and the error message can carry a
|
|
1101
|
+
;; query credential the header mask above never saw.
|
|
1102
|
+
(let [entry (core/ucall ctx :clean entry)
|
|
1103
|
+
track (track-ensure! fa "_debug" (vs/jm "entries" (vs/jt)))
|
|
1069
1104
|
buf (mget track "entries")
|
|
1070
1105
|
max (opt fa "max" 100)]
|
|
1071
1106
|
(.add ^java.util.List buf entry)
|
|
1072
1107
|
(while (> (.size ^java.util.List buf) max) (.remove ^java.util.List buf 0))
|
|
1073
|
-
|
|
1108
|
+
;; `onEntry` is the option spec's spelling; the
|
|
1109
|
+
;; older `on_entry` is kept for callers that used it.
|
|
1110
|
+
(let [on-entry (or (opt fa "onEntry") (opt fa "on_entry"))]
|
|
1074
1111
|
(when (fn? on-entry) (try (on-entry entry) (catch Throwable _ nil)))))))))]
|
|
1075
1112
|
(swap! fa assoc :entries {})
|
|
1076
1113
|
(swap! fa assoc
|
|
@@ -1088,7 +1125,7 @@
|
|
|
1088
1125
|
method (when spec (core/oget spec :method))
|
|
1089
1126
|
headers (when spec (core/oget spec :headers))
|
|
1090
1127
|
entry (vs/jm "op" (str (if op (core/op-entity op) "_") "." (if op (core/op-name op) "_"))
|
|
1091
|
-
"method" method "url" url "headers" (redact headers) "start" (now-ms fa)
|
|
1128
|
+
"method" method "url" url "headers" (redact ctx headers) "start" (now-ms fa)
|
|
1092
1129
|
"status" nil "ok" nil "durationMs" nil "error" nil)]
|
|
1093
1130
|
(swap! fa update :entries assoc ctx entry))))
|
|
1094
1131
|
"PreResponse"
|
|
@@ -1125,10 +1162,11 @@
|
|
|
1125
1162
|
(swap! fa update :seq inc)
|
|
1126
1163
|
(let [op (core/oget ctx :op)
|
|
1127
1164
|
result (core/oget ctx :result)
|
|
1128
|
-
record (
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1165
|
+
record (core/ucall ctx :clean
|
|
1166
|
+
(vs/jm "seq" (:seq @fa) "ts" (now-ms fa) "actor" (actor ctx)
|
|
1167
|
+
"entity" (if op (core/op-entity op) "_") "op" (if op (core/op-name op) "_")
|
|
1168
|
+
"outcome" outcome "status" (when result (core/oget result :status))
|
|
1169
|
+
"correlationId" (core/oget ctx :id)))
|
|
1132
1170
|
track (track-ensure! fa "_audit" (vs/jm "records" (vs/jt)))
|
|
1133
1171
|
recs (mget track "records")
|
|
1134
1172
|
max (opt fa "max" 1000)]
|
|
@@ -435,7 +435,9 @@
|
|
|
435
435
|
(let [entries (mget (h-track h "_debug") "entries")]
|
|
436
436
|
(t/is-eq (vs/size entries) 1 "capped")
|
|
437
437
|
(t/is-eq (count @seen) 2 "2 seen")
|
|
438
|
-
|
|
438
|
+
;; Masked by the core clean rule (clean.keys), not a
|
|
439
|
+
;; feature list of its own.
|
|
440
|
+
(t/is-eq (mget (mget (nth @seen 0) "headers") "authorization") "[redacted]" "redacted")))))
|
|
439
441
|
(check "debug-captures-failures" "debug"
|
|
440
442
|
(fn [] (when (feature-present? "netsim")
|
|
441
443
|
(let [h (make-harness [(fspec "netsim" "failTimes" 1 "failStatus" 500) (fspec "debug")])]
|
|
@@ -447,7 +449,7 @@
|
|
|
447
449
|
(fn [] (let [h (make-harness [(fspec "debug" "now" (fn [] 7) "redact" (vs/jt "x-secret"))])]
|
|
448
450
|
(h-op h :headers (vs/jm "x-secret" "hide" "x-ok" "show"))
|
|
449
451
|
(let [entry (vs/getelem (mget (h-track h "_debug") "entries") 0)]
|
|
450
|
-
(t/is-eq (mget (mget entry "headers") "x-secret") "
|
|
452
|
+
(t/is-eq (mget (mget entry "headers") "x-secret") "[redacted]" "redacted")
|
|
451
453
|
(t/is-eq (mget (mget entry "headers") "x-ok") "show" "shown")))))
|
|
452
454
|
|
|
453
455
|
;; ---- audit ----
|