@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
|
@@ -118,14 +118,401 @@ func transformResponseUtil(_ ctx: Context) -> Value {
|
|
|
118
118
|
return resdata
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
// MARK: - clean
|
|
122
|
+
|
|
123
|
+
// Everything that leaves the pipeline passes through clean; inside it data
|
|
124
|
+
// stays raw, so a hook can still read the header it must add to. See
|
|
125
|
+
// docs/explanation/secret-redaction.md.
|
|
126
|
+
|
|
127
|
+
// The derived clean block, MUTABLE after makeOptions since features register
|
|
128
|
+
// values later. Carried as a native object under options.__derived__.clean,
|
|
129
|
+
// which JSON.stringify prints as "<function>" rather than as the registry.
|
|
130
|
+
// Nested in Utility, whose registry it is, so no entity type can collide
|
|
131
|
+
// with it.
|
|
132
|
+
extension Utility {
|
|
133
|
+
public final class CleanConfig {
|
|
134
|
+
public var active = true
|
|
135
|
+
public var keys: [String] = []
|
|
136
|
+
public var values: [String] = []
|
|
137
|
+
public var mask = "[redacted]"
|
|
138
|
+
public var hint = 0
|
|
139
|
+
public var min = 4
|
|
140
|
+
public init() {}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
private let cleanMaxDepth = 32
|
|
145
|
+
private let cleanCircular = "[circular]"
|
|
146
|
+
|
|
147
|
+
// encodeURIComponent's unreserved set.
|
|
148
|
+
private let cleanUnreserved = CharacterSet(
|
|
149
|
+
charactersIn: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.!~*'()")
|
|
150
|
+
|
|
151
|
+
private func cleanNormKey(_ key: String) -> String {
|
|
152
|
+
return key.lowercased()
|
|
153
|
+
.replacingOccurrences(of: "-", with: "")
|
|
154
|
+
.replacingOccurrences(of: "_", with: "")
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
private func cleanSplit(_ v: Value) -> [String] {
|
|
158
|
+
let text = v.asString ?? (isNil(v) ? "" : stringify(v))
|
|
159
|
+
return text.split(separator: ",", omittingEmptySubsequences: false)
|
|
160
|
+
.map { $0.trimmingCharacters(in: .whitespaces) }
|
|
161
|
+
.filter { $0 != "" }
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
func cleanSplitValues(_ v: Value) -> [String] {
|
|
165
|
+
if let l = v.asList {
|
|
166
|
+
return l.items.compactMap { $0.asString }
|
|
167
|
+
}
|
|
168
|
+
return cleanSplit(v)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
private func cleanCount(_ v: Value, _ dflt: Int) -> Int {
|
|
172
|
+
var n: Double
|
|
173
|
+
switch v {
|
|
174
|
+
case .int(let i): n = Double(i)
|
|
175
|
+
case .double(let d): n = d
|
|
176
|
+
case .string(let s):
|
|
177
|
+
guard let d = Double(s.trimmingCharacters(in: .whitespaces)) else { return dflt }
|
|
178
|
+
n = d
|
|
179
|
+
default: return dflt
|
|
180
|
+
}
|
|
181
|
+
n = n.rounded(.down)
|
|
182
|
+
return n.isFinite && 0 <= n ? Int(n) : dflt
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
func makeCleanConfig(_ cleanopts: Value) -> Utility.CleanConfig {
|
|
186
|
+
let opts = cleanopts.asMap ?? VMap()
|
|
187
|
+
let cfg = Utility.CleanConfig()
|
|
188
|
+
cfg.active = gp(opts, "active") != .bool(false)
|
|
189
|
+
cfg.keys = cleanSplit(gp(opts, "keys")).map(cleanNormKey)
|
|
190
|
+
cfg.values = []
|
|
191
|
+
cfg.mask = gp(opts, "mask").asString ?? "[redacted]"
|
|
192
|
+
cfg.hint = cleanCount(gp(opts, "hint"), 0)
|
|
193
|
+
cfg.min = max(1, cleanCount(gp(opts, "min"), 4))
|
|
194
|
+
return cfg
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// A context without options (makeError accepts a bare one) still masks by
|
|
198
|
+
// the schema defaults.
|
|
199
|
+
func cleanConfigOf(_ ctx: Context) -> Utility.CleanConfig {
|
|
200
|
+
if let cfg = gpath(ctx.options, "__derived__", "clean").asNative as? Utility.CleanConfig {
|
|
201
|
+
return cfg
|
|
202
|
+
}
|
|
203
|
+
return makeCleanConfig(gp(SdkSchema.optspec, "clean"))
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// The encoded forms a value travels in.
|
|
207
|
+
private func cleanForms(_ value: String) -> [String] {
|
|
208
|
+
var out = [value]
|
|
209
|
+
func add(_ s: String) {
|
|
210
|
+
if s != "" && !out.contains(s) { out.append(s) }
|
|
211
|
+
}
|
|
212
|
+
add(Data(value.utf8).base64EncodedString())
|
|
213
|
+
add(value.addingPercentEncoding(withAllowedCharacters: cleanUnreserved) ?? "")
|
|
214
|
+
add(String(JSON.quoted(value).dropFirst().dropLast()))
|
|
215
|
+
return out
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
func cleanAddUtil(_ ctx: Context, _ value: Value) {
|
|
219
|
+
let cfg = cleanConfigOf(ctx)
|
|
220
|
+
guard let s = value.asString, s.count >= cfg.min else { return }
|
|
221
|
+
var changed = false
|
|
222
|
+
for form in cleanForms(s) {
|
|
223
|
+
if form.count >= cfg.min && !cfg.values.contains(form) {
|
|
224
|
+
cfg.values.append(form)
|
|
225
|
+
changed = true
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if changed {
|
|
229
|
+
cfg.values.sort { $0.count > $1.count }
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Every scalar under a sensitive name, at any depth and of any shape: a
|
|
234
|
+
// credential mistyped as a map or a number is still a credential.
|
|
235
|
+
func cleanAddSensitiveUtil(_ ctx: Context, _ val: Value) {
|
|
236
|
+
var seen: [ObjectIdentifier] = []
|
|
237
|
+
cleanAddSensitiveAt(ctx, val, false, 0, &seen)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
private func cleanAddSensitiveAt(
|
|
241
|
+
_ ctx: Context, _ val: Value, _ under: Bool, _ depth: Int, _ seen: inout [ObjectIdentifier]
|
|
242
|
+
) {
|
|
243
|
+
if cleanMaxDepth <= depth { return }
|
|
244
|
+
switch val {
|
|
245
|
+
case .string(let s):
|
|
246
|
+
if under { cleanAddUtil(ctx, .string(s)) }
|
|
247
|
+
case .int(let i):
|
|
248
|
+
if under { cleanAddUtil(ctx, .string(String(i))) }
|
|
249
|
+
case .double(let d):
|
|
250
|
+
if under { cleanAddUtil(ctx, .string(cleanNumberText(d))) }
|
|
251
|
+
case .list(let l):
|
|
252
|
+
if seen.contains(ObjectIdentifier(l)) { return }
|
|
253
|
+
seen.append(ObjectIdentifier(l))
|
|
254
|
+
for item in l.items {
|
|
255
|
+
cleanAddSensitiveAt(ctx, item, under, depth + 1, &seen)
|
|
256
|
+
}
|
|
257
|
+
case .map(let m):
|
|
258
|
+
if seen.contains(ObjectIdentifier(m)) { return }
|
|
259
|
+
seen.append(ObjectIdentifier(m))
|
|
260
|
+
for (k, item) in m.entries {
|
|
261
|
+
cleanAddSensitiveAt(ctx, item, under || cleanKeyUtil(ctx, k), depth + 1, &seen)
|
|
262
|
+
}
|
|
263
|
+
default:
|
|
264
|
+
return
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// A number's decimal text as JavaScript's String() writes it, for whole values.
|
|
269
|
+
private func cleanNumberText(_ d: Double) -> String {
|
|
270
|
+
if d.rounded() == d && abs(d) < 9.0e15 {
|
|
271
|
+
return String(Int64(d))
|
|
272
|
+
}
|
|
273
|
+
return String(d)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
private func cleanMaskValue(_ cfg: Utility.CleanConfig, _ value: String) -> String {
|
|
277
|
+
if 0 < cfg.hint && value.count > 2 * cfg.hint {
|
|
278
|
+
return cfg.mask + String(value.suffix(cfg.hint))
|
|
279
|
+
}
|
|
280
|
+
return cfg.mask
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
private func cleanString(_ cfg: Utility.CleanConfig, _ text: String) -> String {
|
|
284
|
+
var out = text
|
|
285
|
+
for value in cfg.values where out.contains(value) {
|
|
286
|
+
out = out.replacingOccurrences(of: value, with: cleanMaskValue(cfg, value))
|
|
287
|
+
}
|
|
288
|
+
return out
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
private func cleanSensitiveKey(_ cfg: Utility.CleanConfig, _ key: String?) -> Bool {
|
|
292
|
+
guard let key = key else { return false }
|
|
293
|
+
let nk = cleanNormKey(key)
|
|
294
|
+
return cfg.keys.contains { nk.contains($0) }
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// A masked plain-data copy: closures dropped, cycles cut, and nothing shared
|
|
298
|
+
// with the live value, whose spec must stay raw. A typed pipeline product
|
|
299
|
+
// carried as a native (a Spec, a Result, a feature record) reads through its
|
|
300
|
+
// stored properties, the way `dump` would; the context reads through its
|
|
301
|
+
// own record so its client, options and config never enter.
|
|
302
|
+
private func cleanSnapshot(
|
|
303
|
+
_ cfg: Utility.CleanConfig, _ val: Value, _ key: String?, _ depth: Int,
|
|
304
|
+
_ seen: inout [ObjectIdentifier]
|
|
305
|
+
) -> Value {
|
|
306
|
+
switch val {
|
|
307
|
+
case .noval, .null, .sentinel:
|
|
308
|
+
return val
|
|
309
|
+
case .string(let s):
|
|
310
|
+
return .string(cleanSensitiveKey(cfg, key) ? cleanMaskValue(cfg, s) : cleanString(cfg, s))
|
|
311
|
+
case .function:
|
|
312
|
+
return .noval
|
|
313
|
+
case .bool, .int, .double:
|
|
314
|
+
return cleanSensitiveKey(cfg, key) ? .string(cfg.mask) : val
|
|
315
|
+
case .native(let ref):
|
|
316
|
+
if cleanMaxDepth <= depth || seen.contains(ObjectIdentifier(ref)) {
|
|
317
|
+
return .string(cleanCircular)
|
|
318
|
+
}
|
|
319
|
+
if cleanSensitiveKey(cfg, key) {
|
|
320
|
+
return .string(cfg.mask)
|
|
321
|
+
}
|
|
322
|
+
seen.append(ObjectIdentifier(ref))
|
|
323
|
+
defer { seen.removeLast() }
|
|
324
|
+
return cleanNative(cfg, ref.value, key, depth, &seen)
|
|
325
|
+
case .list(let l):
|
|
326
|
+
if cleanMaxDepth <= depth || seen.contains(ObjectIdentifier(l)) {
|
|
327
|
+
return .string(cleanCircular)
|
|
328
|
+
}
|
|
329
|
+
if cleanSensitiveKey(cfg, key) {
|
|
330
|
+
return .string(cfg.mask)
|
|
331
|
+
}
|
|
332
|
+
seen.append(ObjectIdentifier(l))
|
|
333
|
+
defer { seen.removeLast() }
|
|
334
|
+
let out = VList()
|
|
335
|
+
for item in l.items {
|
|
336
|
+
out.items.append(cleanSnapshot(cfg, item, nil, depth + 1, &seen))
|
|
337
|
+
}
|
|
338
|
+
return .list(out)
|
|
339
|
+
case .map(let m):
|
|
340
|
+
if cleanMaxDepth <= depth || seen.contains(ObjectIdentifier(m)) {
|
|
341
|
+
return .string(cleanCircular)
|
|
342
|
+
}
|
|
343
|
+
if cleanSensitiveKey(cfg, key) {
|
|
344
|
+
return .string(cfg.mask)
|
|
345
|
+
}
|
|
346
|
+
seen.append(ObjectIdentifier(m))
|
|
347
|
+
defer { seen.removeLast() }
|
|
348
|
+
let out = VMap()
|
|
349
|
+
for (k, item) in m.entries {
|
|
350
|
+
let v = cleanSnapshot(cfg, item, k, depth + 1, &seen)
|
|
351
|
+
if !v.isNoval { out.entries[cleanName(cfg, out, k)] = v }
|
|
352
|
+
}
|
|
353
|
+
return .map(out)
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// A registered value used as a property name is masked like any other
|
|
358
|
+
// string; names that mask alike take a counter, so none is lost.
|
|
359
|
+
private func cleanName(_ cfg: Utility.CleanConfig, _ out: VMap, _ key: String) -> String {
|
|
360
|
+
let name = cleanString(cfg, key)
|
|
361
|
+
if name == key || out.entries[name] == nil {
|
|
362
|
+
return name
|
|
363
|
+
}
|
|
364
|
+
var i = 1
|
|
365
|
+
while out.entries[name + "#" + String(i)] != nil { i += 1 }
|
|
366
|
+
return name + "#" + String(i)
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
private func cleanErrorRecord(
|
|
370
|
+
_ cfg: Utility.CleanConfig, _ err: Error, _ depth: Int, _ seen: inout [ObjectIdentifier]
|
|
371
|
+
) -> Value {
|
|
372
|
+
let out = VMap()
|
|
373
|
+
out.entries["message"] = .string(cleanString(cfg, errMessage(err)))
|
|
374
|
+
if let se = err as? ProjectNameError {
|
|
375
|
+
out.entries["sdk"] = .string(se.sdk)
|
|
376
|
+
out.entries["code"] = .string(cleanString(cfg, se.code))
|
|
377
|
+
out.entries["status"] = .int(Int64(se.status))
|
|
378
|
+
out.entries["result"] = cleanSnapshot(cfg, se.resultVal, "result", depth + 1, &seen)
|
|
379
|
+
out.entries["spec"] = cleanSnapshot(cfg, se.specVal, "spec", depth + 1, &seen)
|
|
380
|
+
}
|
|
381
|
+
return .map(out)
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// A native the loose model carries. The pipeline's own products are read
|
|
385
|
+
// through their stored properties; anything else (a closure, a foreign
|
|
386
|
+
// object) is dropped, as a function is.
|
|
387
|
+
private func cleanNative(
|
|
388
|
+
_ cfg: Utility.CleanConfig, _ any: Any, _ key: String?, _ depth: Int,
|
|
389
|
+
_ seen: inout [ObjectIdentifier]
|
|
390
|
+
) -> Value {
|
|
391
|
+
if let v = any as? Value {
|
|
392
|
+
return cleanSnapshot(cfg, v, key, depth, &seen)
|
|
393
|
+
}
|
|
394
|
+
if let m = any as? VMap {
|
|
395
|
+
return cleanSnapshot(cfg, .map(m), key, depth, &seen)
|
|
396
|
+
}
|
|
397
|
+
if let l = any as? VList {
|
|
398
|
+
return cleanSnapshot(cfg, .list(l), key, depth, &seen)
|
|
399
|
+
}
|
|
400
|
+
if let s = any as? String {
|
|
401
|
+
return cleanSnapshot(cfg, .string(s), key, depth, &seen)
|
|
402
|
+
}
|
|
403
|
+
if let b = any as? Bool {
|
|
404
|
+
return cleanSnapshot(cfg, .bool(b), key, depth, &seen)
|
|
405
|
+
}
|
|
406
|
+
if let i = any as? Int {
|
|
407
|
+
return cleanSnapshot(cfg, .int(Int64(i)), key, depth, &seen)
|
|
408
|
+
}
|
|
409
|
+
if let i = any as? Int64 {
|
|
410
|
+
return cleanSnapshot(cfg, .int(i), key, depth, &seen)
|
|
411
|
+
}
|
|
412
|
+
if let d = any as? Double {
|
|
413
|
+
return cleanSnapshot(cfg, .double(d), key, depth, &seen)
|
|
414
|
+
}
|
|
415
|
+
if let err = any as? Error {
|
|
416
|
+
return cleanErrorRecord(cfg, err, depth, &seen)
|
|
417
|
+
}
|
|
418
|
+
if let ctx = any as? Context {
|
|
419
|
+
return cleanSnapshot(cfg, .map(ctx.rawRecord()), key, depth, &seen)
|
|
420
|
+
}
|
|
421
|
+
if let ent = any as? Entity {
|
|
422
|
+
return .string(ent.getName())
|
|
423
|
+
}
|
|
424
|
+
if any is ProjectNameSDK {
|
|
425
|
+
return .noval
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
let mirror = Mirror(reflecting: any)
|
|
429
|
+
if mirror.displayStyle == .optional {
|
|
430
|
+
guard let inner = mirror.children.first?.value else { return .null }
|
|
431
|
+
return cleanNative(cfg, inner, key, depth, &seen)
|
|
432
|
+
}
|
|
433
|
+
if mirror.displayStyle == .collection || mirror.displayStyle == .set {
|
|
434
|
+
let out = VList()
|
|
435
|
+
for child in mirror.children {
|
|
436
|
+
let v = cleanNative(cfg, child.value, nil, depth + 1, &seen)
|
|
437
|
+
out.items.append(v)
|
|
438
|
+
}
|
|
439
|
+
return .list(out)
|
|
440
|
+
}
|
|
441
|
+
if mirror.displayStyle == .dictionary {
|
|
442
|
+
// Sorted, so colliding masked names number the same way every run.
|
|
443
|
+
var pairs: [(String, Any)] = []
|
|
444
|
+
for child in mirror.children {
|
|
445
|
+
let pair = Mirror(reflecting: child.value).children.map { $0.value }
|
|
446
|
+
guard 2 == pair.count else { continue }
|
|
447
|
+
pairs.append((String(describing: pair[0]), pair[1]))
|
|
448
|
+
}
|
|
449
|
+
let out = VMap()
|
|
450
|
+
for (k, item) in pairs.sorted(by: { $0.0 < $1.0 }) {
|
|
451
|
+
let v = cleanNative(cfg, item, k, depth + 1, &seen)
|
|
452
|
+
if !v.isNoval { out.entries[cleanName(cfg, out, k)] = v }
|
|
453
|
+
}
|
|
454
|
+
return .map(out)
|
|
455
|
+
}
|
|
456
|
+
if mirror.displayStyle == .class || mirror.displayStyle == .struct {
|
|
457
|
+
let out = VMap()
|
|
458
|
+
for child in mirror.children {
|
|
459
|
+
guard let label = child.label else { continue }
|
|
460
|
+
let v = cleanNative(cfg, child.value, label, depth + 1, &seen)
|
|
461
|
+
if !v.isNoval { out.entries[label] = v }
|
|
462
|
+
}
|
|
463
|
+
return .map(out)
|
|
464
|
+
}
|
|
465
|
+
return .noval
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// The SDK's own error is cleaned in place, since it is about to be thrown.
|
|
121
469
|
func cleanUtil(_ ctx: Context, _ val: Value) -> Value {
|
|
122
|
-
|
|
470
|
+
let cfg = cleanConfigOf(ctx)
|
|
471
|
+
|
|
472
|
+
if !cfg.active {
|
|
473
|
+
return val
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
if let s = val.asString {
|
|
477
|
+
return .string(cleanString(cfg, s))
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
if let err = val.asNative as? ProjectNameError {
|
|
481
|
+
var seen: [ObjectIdentifier] = []
|
|
482
|
+
err.message = cleanString(cfg, err.message)
|
|
483
|
+
err.code = cleanString(cfg, err.code)
|
|
484
|
+
if !isNil(err.resultVal) {
|
|
485
|
+
err.resultVal = cleanSnapshot(cfg, err.resultVal, "result", 1, &seen)
|
|
486
|
+
}
|
|
487
|
+
if !isNil(err.specVal) {
|
|
488
|
+
err.specVal = cleanSnapshot(cfg, err.specVal, "spec", 1, &seen)
|
|
489
|
+
}
|
|
490
|
+
return val
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
if val.asNative is Error {
|
|
494
|
+
return val
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
var seen: [ObjectIdentifier] = []
|
|
498
|
+
return cleanSnapshot(cfg, val, nil, 0, &seen)
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
func cleanKeyUtil(_ ctx: Context, _ key: String) -> Bool {
|
|
502
|
+
return cleanSensitiveKey(cleanConfigOf(ctx), key)
|
|
123
503
|
}
|
|
124
504
|
|
|
125
505
|
func doneUtil(_ ctx: Context) throws -> Value {
|
|
126
|
-
if let explain = ctx.ctrl.explain
|
|
127
|
-
|
|
128
|
-
|
|
506
|
+
if let explain = ctx.ctrl.explain {
|
|
507
|
+
// Refilled in place: the caller holds this very map (the Context took it
|
|
508
|
+
// out of the ctrl map), so a replacement would leave them reading the
|
|
509
|
+
// raw one.
|
|
510
|
+
if let cleaned = cleanUtil(ctx, .map(explain)).asMap, cleaned !== explain {
|
|
511
|
+
explain.entries = cleaned.entries
|
|
512
|
+
}
|
|
513
|
+
if let rm = explain.entries["result"]?.asMap {
|
|
514
|
+
rm.entries.removeValue(forKey: "err")
|
|
515
|
+
}
|
|
129
516
|
}
|
|
130
517
|
|
|
131
518
|
if let result = ctx.result, result.ok {
|
|
@@ -757,7 +757,7 @@ final class FeatureDebugTest: XCTestCase {
|
|
|
757
757
|
XCTAssertEqual(f.entries.count, 1)
|
|
758
758
|
XCTAssertEqual(seen.count, 2)
|
|
759
759
|
let headers = seen[0].entries["headers"]?.asMap
|
|
760
|
-
XCTAssertEqual(headers?.entries["authorization"], .string("
|
|
760
|
+
XCTAssertEqual(headers?.entries["authorization"], .string("[redacted]"))
|
|
761
761
|
}
|
|
762
762
|
|
|
763
763
|
func testCapturesFailures() {
|
|
@@ -777,7 +777,7 @@ final class FeatureDebugTest: XCTestCase {
|
|
|
777
777
|
let h = Fh.make(nil, (f, vm(("now", .nat(clock.now)), ("redact", .list([.string("x-secret")])))))
|
|
778
778
|
_ = h.op(FhOpSpec(op: "load", headers: vm(("x-secret", .string("hide")), ("x-ok", .string("show")))))
|
|
779
779
|
let headers = f.entries[0].entries["headers"]?.asMap
|
|
780
|
-
XCTAssertEqual(headers?.entries["x-secret"], .string("
|
|
780
|
+
XCTAssertEqual(headers?.entries["x-secret"], .string("[redacted]"))
|
|
781
781
|
XCTAssertEqual(headers?.entries["x-ok"], .string("show"))
|
|
782
782
|
}
|
|
783
783
|
|
|
@@ -121,8 +121,10 @@ class Context {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
|
|
124
|
+
// The serialised context leaves the pipeline (a logger, an error dump), so
|
|
125
|
+
// it is cleaned; the live fields stay raw for the pipeline's own use.
|
|
124
126
|
toJSON() {
|
|
125
|
-
|
|
127
|
+
const record = {
|
|
126
128
|
id: this.id,
|
|
127
129
|
op: this.op,
|
|
128
130
|
spec: this.spec,
|
|
@@ -131,6 +133,8 @@ class Context {
|
|
|
131
133
|
response: this.response,
|
|
132
134
|
meta: this.meta,
|
|
133
135
|
}
|
|
136
|
+
const clean = (this as any).utility?.clean
|
|
137
|
+
return 'function' === typeof clean ? clean(this, record) : record
|
|
134
138
|
}
|
|
135
139
|
|
|
136
140
|
toString() {
|
|
@@ -14,13 +14,26 @@ class Response {
|
|
|
14
14
|
this.status = getprop(resmap, 'status', -1)
|
|
15
15
|
this.statusText = getprop(resmap, 'statusText', '')
|
|
16
16
|
this.headers = getprop(resmap, 'headers')
|
|
17
|
-
this.json =
|
|
17
|
+
this.json = readJson(resmap)
|
|
18
18
|
this.body = getprop(resmap, 'body')
|
|
19
19
|
this.err = getprop(resmap, 'err')
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
|
|
24
|
+
// An empty body, such as the one an accepted delete answers with, is no
|
|
25
|
+
// body: parsing it as JSON would throw after the call has succeeded.
|
|
26
|
+
function readJson(resmap: Record<string, any>): Function {
|
|
27
|
+
if ('function' === typeof resmap.text) {
|
|
28
|
+
return async () => {
|
|
29
|
+
const text = await resmap.text()
|
|
30
|
+
return '' === text.trim() ? undefined : JSON.parse(text)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return resmap.json ? resmap.json.bind(resmap) : async () => undefined
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
24
37
|
export {
|
|
25
38
|
Response,
|
|
26
39
|
}
|
|
@@ -50,7 +50,7 @@ class AuditFeature extends BaseFeature {
|
|
|
50
50
|
}
|
|
51
51
|
this._seen.add(ctx)
|
|
52
52
|
this._seq++
|
|
53
|
-
const record = {
|
|
53
|
+
const record = ctx.utility.clean(ctx, {
|
|
54
54
|
seq: this._seq,
|
|
55
55
|
ts: this._now(),
|
|
56
56
|
actor: (ctx.ctrl && ctx.ctrl.actor) || this._options.actor || 'anonymous',
|
|
@@ -59,7 +59,7 @@ class AuditFeature extends BaseFeature {
|
|
|
59
59
|
outcome,
|
|
60
60
|
status: ctx.result && ctx.result.status,
|
|
61
61
|
correlationId: ctx.id,
|
|
62
|
-
}
|
|
62
|
+
})
|
|
63
63
|
|
|
64
64
|
const client: any = this._client
|
|
65
65
|
const recs = client._audit.records
|
|
@@ -208,7 +208,7 @@ class CostFeature extends BaseFeature {
|
|
|
208
208
|
this._bump(cost.actors, actor, amount)
|
|
209
209
|
|
|
210
210
|
this._seq++
|
|
211
|
-
const record = {
|
|
211
|
+
const record = ctx.utility.clean(ctx, {
|
|
212
212
|
seq: this._seq,
|
|
213
213
|
entity,
|
|
214
214
|
op: opname,
|
|
@@ -217,7 +217,7 @@ class CostFeature extends BaseFeature {
|
|
|
217
217
|
currency: cost.currency,
|
|
218
218
|
source,
|
|
219
219
|
attempts: pending.attempts,
|
|
220
|
-
}
|
|
220
|
+
})
|
|
221
221
|
cost.last = record
|
|
222
222
|
|
|
223
223
|
const sink = this._options.sink
|
|
@@ -34,7 +34,7 @@ class DebugFeature extends BaseFeature {
|
|
|
34
34
|
op: ((ctx.op && ctx.op.entity) || '_') + '.' + ((ctx.op && ctx.op.name) || '_'),
|
|
35
35
|
method: spec.method,
|
|
36
36
|
url: spec.url || spec.path,
|
|
37
|
-
headers: this._redact(spec.headers),
|
|
37
|
+
headers: this._redact(ctx, spec.headers),
|
|
38
38
|
start: this._now(),
|
|
39
39
|
status: undefined as any,
|
|
40
40
|
ok: undefined as any,
|
|
@@ -73,7 +73,7 @@ class DebugFeature extends BaseFeature {
|
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
_finish(this: any, ctx: any, ok: boolean) {
|
|
76
|
-
|
|
76
|
+
let entry = this._entries.get(ctx)
|
|
77
77
|
if (null == entry) {
|
|
78
78
|
return
|
|
79
79
|
}
|
|
@@ -84,6 +84,11 @@ class DebugFeature extends BaseFeature {
|
|
|
84
84
|
entry.status = ctx.result.status
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
// The whole entry leaves through the buffer and the callback: the url
|
|
88
|
+
// and the error message can carry a query credential the header mask
|
|
89
|
+
// above never saw.
|
|
90
|
+
entry = ctx.utility.clean(ctx, entry)
|
|
91
|
+
|
|
87
92
|
const client: any = this._client
|
|
88
93
|
const buf = client._debug.entries
|
|
89
94
|
buf.push(entry)
|
|
@@ -99,17 +104,18 @@ class DebugFeature extends BaseFeature {
|
|
|
99
104
|
}
|
|
100
105
|
|
|
101
106
|
|
|
102
|
-
|
|
107
|
+
// The core clean rules apply (clean.keys, every registered value); the
|
|
108
|
+
// feature's own `redact` list ADDS header names on top of them.
|
|
109
|
+
_redact(this: any, ctx: any, headers: any): any {
|
|
103
110
|
if (null == headers) {
|
|
104
111
|
return {}
|
|
105
112
|
}
|
|
106
|
-
const patterns = this._options.redact ||
|
|
107
|
-
['authorization', 'cookie', 'set-cookie', 'api-key', 'apikey', 'x-api-key', 'idempotency-key']
|
|
113
|
+
const patterns = (this._options.redact || []).map((n: any) => String(n).toLowerCase())
|
|
108
114
|
const out: any = {}
|
|
109
115
|
for (const k of Object.keys(headers)) {
|
|
110
|
-
out[k] = patterns.indexOf(k.toLowerCase()) >= 0 ? '
|
|
116
|
+
out[k] = patterns.indexOf(k.toLowerCase()) >= 0 ? '[redacted]' : headers[k]
|
|
111
117
|
}
|
|
112
|
-
return out
|
|
118
|
+
return ctx.utility.clean(ctx, out)
|
|
113
119
|
}
|
|
114
120
|
|
|
115
121
|
|
|
@@ -37,9 +37,9 @@ class LogFeature extends BaseFeature {
|
|
|
37
37
|
let level = this._options.level || 'info'
|
|
38
38
|
|
|
39
39
|
logger = Pino({ name: 'log', level }, pretty)
|
|
40
|
-
|
|
41
|
-
this._logger = logger
|
|
42
40
|
}
|
|
41
|
+
|
|
42
|
+
this._logger = logger
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -85,15 +85,19 @@ class LogFeature extends BaseFeature {
|
|
|
85
85
|
this._loghook('PreResult', ctx)
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
// A log line leaves the pipeline, so it carries the cleaned record: the
|
|
89
|
+
// spec after auth holds the credential, and a logger serialises whatever
|
|
90
|
+
// it is handed.
|
|
88
91
|
_loghook(this: any, hook: any, ctx: any, level: any) {
|
|
89
92
|
level = level || 'info'
|
|
90
93
|
if (this._logger) {
|
|
91
|
-
|
|
94
|
+
const clean = ctx.utility.clean
|
|
95
|
+
this._logger[level](clean(ctx, {
|
|
92
96
|
hook,
|
|
93
97
|
op: ctx.op,
|
|
94
98
|
spec: ctx.spec,
|
|
95
|
-
ctx
|
|
96
|
-
})
|
|
99
|
+
ctx: 'function' === typeof ctx.toJSON ? ctx.toJSON() : ctx,
|
|
100
|
+
}))
|
|
97
101
|
}
|
|
98
102
|
}
|
|
99
103
|
}
|
|
@@ -14,6 +14,7 @@ class ProxyFeature extends BaseFeature {
|
|
|
14
14
|
_options: any = {}
|
|
15
15
|
_url?: string
|
|
16
16
|
_noProxy: string[] = []
|
|
17
|
+
_ctx?: Context
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
init(ctx: Context, options: FeatureOptions): void | Promise<any> {
|
|
@@ -37,6 +38,22 @@ class ProxyFeature extends BaseFeature {
|
|
|
37
38
|
this._noProxy = ('string' === typeof noProxy ? noProxy.split(/\s*,\s*/) : (noProxy || []))
|
|
38
39
|
.filter((s: string) => null != s && '' !== s)
|
|
39
40
|
|
|
41
|
+
// A proxy URL may carry credentials as userinfo, from the option or the
|
|
42
|
+
// environment, and neither is under a sensitive key name.
|
|
43
|
+
this._ctx = ctx
|
|
44
|
+
if ('string' === typeof this._url) {
|
|
45
|
+
try {
|
|
46
|
+
const parsed = new URL(this._url)
|
|
47
|
+
for (const part of [parsed.username, parsed.password]) {
|
|
48
|
+
if ('' !== part) {
|
|
49
|
+
ctx.utility.cleanAdd(ctx, part)
|
|
50
|
+
try { ctx.utility.cleanAdd(ctx, decodeURIComponent(part)) } catch (_e) { }
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (_e) { }
|
|
55
|
+
}
|
|
56
|
+
|
|
40
57
|
const self = this
|
|
41
58
|
const utility = ctx.utility
|
|
42
59
|
const inner = utility.fetcher
|
|
@@ -92,7 +109,8 @@ class ProxyFeature extends BaseFeature {
|
|
|
92
109
|
_track(this: any, url: string) {
|
|
93
110
|
const client: any = this._client
|
|
94
111
|
if (null == client._proxy) {
|
|
95
|
-
|
|
112
|
+
const ctx = this._ctx
|
|
113
|
+
client._proxy = { routed: 0, url: null == ctx ? this._url : ctx.utility.clean(ctx, this._url) }
|
|
96
114
|
}
|
|
97
115
|
client._proxy.routed++
|
|
98
116
|
}
|
|
@@ -50,6 +50,7 @@ class SecretsFeature extends BaseFeature {
|
|
|
50
50
|
(null == xopts ? undefined : xopts.refresh)
|
|
51
51
|
|
|
52
52
|
if ('string' === typeof explicit && '' !== explicit) {
|
|
53
|
+
this._register(explicit)
|
|
53
54
|
providers.push({
|
|
54
55
|
kind: 'memory',
|
|
55
56
|
name: 'options',
|
|
@@ -88,6 +89,14 @@ class SecretsFeature extends BaseFeature {
|
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
|
|
92
|
+
_register(value: any): void {
|
|
93
|
+
const ctx = this._client._rootctx
|
|
94
|
+
if (null != ctx && null != ctx.utility && 'function' === typeof ctx.utility.cleanAdd) {
|
|
95
|
+
ctx.utility.cleanAdd(ctx, value)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
91
100
|
PreSpec(_ctx: Context) {
|
|
92
101
|
return this.resolve()
|
|
93
102
|
}
|
|
@@ -123,6 +132,7 @@ class SecretsFeature extends BaseFeature {
|
|
|
123
132
|
}
|
|
124
133
|
|
|
125
134
|
const found = await this._sekreto.try(this._secretname)
|
|
135
|
+
this._register(found)
|
|
126
136
|
|
|
127
137
|
if (null == this._exchange) {
|
|
128
138
|
if (undefined !== found) {
|
|
@@ -225,6 +235,8 @@ class SecretsFeature extends BaseFeature {
|
|
|
225
235
|
"secrets: token exchange returned no '" + x.response + "' field from " + url)
|
|
226
236
|
}
|
|
227
237
|
|
|
238
|
+
this._register(token)
|
|
239
|
+
|
|
228
240
|
return token
|
|
229
241
|
}
|
|
230
242
|
|