@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
|
@@ -31,6 +31,7 @@ defmodule ProjectName.Utility do
|
|
|
31
31
|
|
|
32
32
|
reg = [
|
|
33
33
|
{"clean", &clean_impl/2},
|
|
34
|
+
{"clean_add", &clean_add_impl/2},
|
|
34
35
|
{"done", &done_impl/1},
|
|
35
36
|
{"make_error", &make_error_impl/2},
|
|
36
37
|
{"feature_add", &feature_add_impl/2},
|
|
@@ -87,6 +88,7 @@ defmodule ProjectName.Utility do
|
|
|
87
88
|
def fetcher(ctx, url, fetchdef), do: u(ctx, "fetcher").(ctx, url, fetchdef)
|
|
88
89
|
def param(ctx, pd), do: u(ctx, "param").(ctx, pd)
|
|
89
90
|
def clean(ctx, v), do: u(ctx, "clean").(ctx, v)
|
|
91
|
+
def clean_add(ctx, v), do: u(ctx, "clean_add").(ctx, v)
|
|
90
92
|
def prepare_auth(ctx), do: u(ctx, "prepare_auth").(ctx)
|
|
91
93
|
def prepare_body(ctx), do: u(ctx, "prepare_body").(ctx)
|
|
92
94
|
def prepare_headers(ctx), do: u(ctx, "prepare_headers").(ctx)
|
|
@@ -111,9 +113,369 @@ defmodule ProjectName.Utility do
|
|
|
111
113
|
|
|
112
114
|
defp strv(v), do: if(is_binary(v), do: v, else: "")
|
|
113
115
|
|
|
114
|
-
# ---- clean
|
|
116
|
+
# ---- clean ---------------------------------------------------------------
|
|
117
|
+
#
|
|
118
|
+
# Everything that leaves the pipeline passes through clean; inside it data
|
|
119
|
+
# stays raw, so a hook can still read the header it must add to. See
|
|
120
|
+
# docs/explanation/secret-redaction.md.
|
|
121
|
+
|
|
122
|
+
@clean_maxdepth 32
|
|
123
|
+
@clean_circular "[circular]"
|
|
124
|
+
|
|
125
|
+
defp strof(v) do
|
|
126
|
+
cond do
|
|
127
|
+
is_binary(v) -> v
|
|
128
|
+
is_number(v) -> to_string(v)
|
|
129
|
+
is_atom(v) and v != nil -> to_string(v)
|
|
130
|
+
true -> ""
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
defp numof(v, _d) when is_number(v), do: trunc(v)
|
|
135
|
+
defp numof(_v, d), do: d
|
|
136
|
+
|
|
137
|
+
defp normkey(k), do: k |> strof() |> String.downcase() |> String.replace(~r/[-_]/, "")
|
|
138
|
+
|
|
139
|
+
defp splitkeys(keys) do
|
|
140
|
+
strof(keys)
|
|
141
|
+
|> String.split(~r/\s*,\s*/)
|
|
142
|
+
|> Enum.map(&normkey/1)
|
|
143
|
+
|> Enum.reject(&(&1 == ""))
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def splitvalues(values) do
|
|
147
|
+
cond do
|
|
148
|
+
S.islist(values) -> list_values(values) |> Enum.filter(&is_binary/1)
|
|
149
|
+
is_list(values) -> Enum.filter(values, &is_binary/1)
|
|
150
|
+
true -> strof(values) |> String.split(~r/\s*,\s*/) |> Enum.reject(&(&1 == ""))
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
defp list_values(node) do
|
|
155
|
+
if S.islist(node), do: Enum.map(H.entries(node), &elem(&1, 1)), else: []
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
defp count_opt(v, dflt) do
|
|
159
|
+
case Float.parse(strof(v)) do
|
|
160
|
+
{n, ""} when n >= 0 -> trunc(Float.floor(n))
|
|
161
|
+
_ -> dflt
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# The derived clean block: a struct node so it lives in options.__derived__
|
|
166
|
+
# and its `values` stays MUTABLE after make_options - features register
|
|
167
|
+
# what they resolve later.
|
|
168
|
+
def make_clean_config(cleanopts) do
|
|
169
|
+
o = fn k -> if S.ismap(cleanopts), do: S.getprop(cleanopts, k), else: nil end
|
|
170
|
+
mask = o.("mask")
|
|
171
|
+
|
|
172
|
+
S.jm([
|
|
173
|
+
"active", o.("active") != false,
|
|
174
|
+
"keys", S.jt(splitkeys(o.("keys"))),
|
|
175
|
+
"values", S.jt([]),
|
|
176
|
+
"mask", if(is_binary(mask), do: mask, else: "[redacted]"),
|
|
177
|
+
"hint", count_opt(o.("hint"), 0),
|
|
178
|
+
"min", max(1, count_opt(o.("min"), 4))
|
|
179
|
+
])
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# A context without options (make_error accepts a bare one) still masks by
|
|
183
|
+
# the schema defaults.
|
|
184
|
+
defp clean_config(ctx) do
|
|
185
|
+
options = if S.ismap(ctx), do: S.getprop(ctx, "options"), else: nil
|
|
186
|
+
derived = if S.ismap(options), do: S.getpath(options, "__derived__.clean"), else: nil
|
|
187
|
+
|
|
188
|
+
if S.ismap(derived) do
|
|
189
|
+
derived
|
|
190
|
+
else
|
|
191
|
+
make_clean_config(S.getprop(ProjectName.Schema.optspec(), "clean"))
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# The encoded forms a value travels in.
|
|
196
|
+
defp clean_forms(value) do
|
|
197
|
+
j = S.jsonify(value)
|
|
198
|
+
|
|
199
|
+
[value, Base.encode64(value), S.escurl(value), String.slice(j, 1, String.length(j) - 2)]
|
|
200
|
+
|> Enum.reject(&(&1 == ""))
|
|
201
|
+
|> Enum.uniq()
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
def clean_add_impl(ctx, value) do
|
|
205
|
+
cfg = clean_config(ctx)
|
|
206
|
+
minlen = numof(S.getprop(cfg, "min"), 4)
|
|
207
|
+
values = S.getprop(cfg, "values")
|
|
208
|
+
|
|
209
|
+
if is_binary(value) and String.length(value) >= minlen and S.islist(values) do
|
|
210
|
+
have = list_values(values)
|
|
211
|
+
|
|
212
|
+
add =
|
|
213
|
+
clean_forms(value)
|
|
214
|
+
|> Enum.filter(fn f -> String.length(f) >= minlen and f not in have end)
|
|
215
|
+
|
|
216
|
+
# Longest first, so a value is never masked by a substring of itself.
|
|
217
|
+
if add != [] do
|
|
218
|
+
S.setprop(cfg, "values", S.jt(Enum.sort_by(have ++ add, &(-String.length(&1)))))
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
nil
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
defp mask_value(cfg, value) do
|
|
226
|
+
hint = numof(S.getprop(cfg, "hint"), 0)
|
|
227
|
+
mask = strof(S.getprop(cfg, "mask"))
|
|
228
|
+
|
|
229
|
+
if hint > 0 and String.length(value) > 2 * hint do
|
|
230
|
+
mask <> String.slice(value, -hint, hint)
|
|
231
|
+
else
|
|
232
|
+
mask
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
defp clean_string(cfg, text) do
|
|
237
|
+
Enum.reduce(list_values(S.getprop(cfg, "values")), text, fn value, out ->
|
|
238
|
+
if is_binary(value) and String.contains?(out, value) do
|
|
239
|
+
String.replace(out, value, mask_value(cfg, value))
|
|
240
|
+
else
|
|
241
|
+
out
|
|
242
|
+
end
|
|
243
|
+
end)
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
defp sensitive_key?(cfg, key) do
|
|
247
|
+
if key == nil or is_number(key) do
|
|
248
|
+
false
|
|
249
|
+
else
|
|
250
|
+
nk = normkey(key)
|
|
251
|
+
Enum.any?(list_values(S.getprop(cfg, "keys")), fn k -> is_binary(k) and String.contains?(nk, k) end)
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# Every scalar under a sensitive name, at any depth and of any shape: a
|
|
256
|
+
# credential mistyped as a map or a number is still a credential, and the
|
|
257
|
+
# validation error that rejects it quotes it.
|
|
258
|
+
def clean_add_sensitive(ctx, val) do
|
|
259
|
+
clean_add_sensitive_at(ctx, clean_config(ctx), val, false, 0, [])
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
defp clean_add_sensitive_at(ctx, cfg, val, under, depth, seen) do
|
|
263
|
+
cond do
|
|
264
|
+
val == nil or depth >= @clean_maxdepth ->
|
|
265
|
+
nil
|
|
266
|
+
|
|
267
|
+
is_binary(val) ->
|
|
268
|
+
if under, do: clean_add_impl(ctx, val)
|
|
115
269
|
|
|
116
|
-
|
|
270
|
+
is_number(val) ->
|
|
271
|
+
if under, do: clean_add_impl(ctx, number_text(val))
|
|
272
|
+
|
|
273
|
+
val in seen ->
|
|
274
|
+
nil
|
|
275
|
+
|
|
276
|
+
S.ismap(val) or S.islist(val) ->
|
|
277
|
+
Enum.each(H.entries(val), fn {k, v} ->
|
|
278
|
+
clean_add_sensitive_at(ctx, cfg, v, under or sensitive_key?(cfg, k), depth + 1, [val | seen])
|
|
279
|
+
end)
|
|
280
|
+
|
|
281
|
+
is_map(val) and not is_struct(val) ->
|
|
282
|
+
Enum.each(val, fn {k, v} ->
|
|
283
|
+
clean_add_sensitive_at(ctx, cfg, v, under or sensitive_key?(cfg, k), depth + 1, [val | seen])
|
|
284
|
+
end)
|
|
285
|
+
|
|
286
|
+
is_list(val) ->
|
|
287
|
+
Enum.each(val, fn v -> clean_add_sensitive_at(ctx, cfg, v, under, depth + 1, [val | seen]) end)
|
|
288
|
+
|
|
289
|
+
true ->
|
|
290
|
+
nil
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
nil
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
defp number_text(n) when is_float(n) and abs(n) < 9.0e15 and n == trunc(n),
|
|
297
|
+
do: Integer.to_string(trunc(n))
|
|
298
|
+
|
|
299
|
+
defp number_text(n), do: to_string(n)
|
|
300
|
+
|
|
301
|
+
# A registered value used as a property name is masked like any other
|
|
302
|
+
# string; names that mask alike take a counter, so none is lost.
|
|
303
|
+
defp clean_name(cfg, out, key) do
|
|
304
|
+
key = strof(key)
|
|
305
|
+
name = clean_string(cfg, key)
|
|
306
|
+
taken = S.keysof(out)
|
|
307
|
+
|
|
308
|
+
if name == key or name not in taken do
|
|
309
|
+
name
|
|
310
|
+
else
|
|
311
|
+
i = Enum.find(Stream.iterate(1, &(&1 + 1)), fn i -> (name <> "#" <> Integer.to_string(i)) not in taken end)
|
|
312
|
+
name <> "#" <> Integer.to_string(i)
|
|
313
|
+
end
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
# A masked plain-data COPY: functions dropped, cycles cut, an SDK error as
|
|
317
|
+
# its code and message, and nothing shared with the live value, whose spec
|
|
318
|
+
# must stay raw.
|
|
319
|
+
defp clean_snapshot(cfg, val, key, depth, seen) do
|
|
320
|
+
cond do
|
|
321
|
+
val == nil ->
|
|
322
|
+
nil
|
|
323
|
+
|
|
324
|
+
is_binary(val) ->
|
|
325
|
+
if sensitive_key?(cfg, key), do: mask_value(cfg, val), else: clean_string(cfg, val)
|
|
326
|
+
|
|
327
|
+
is_function(val) ->
|
|
328
|
+
:__drop__
|
|
329
|
+
|
|
330
|
+
is_number(val) or is_boolean(val) or is_atom(val) ->
|
|
331
|
+
if sensitive_key?(cfg, key), do: S.getprop(cfg, "mask"), else: val
|
|
332
|
+
|
|
333
|
+
depth >= @clean_maxdepth or val in seen ->
|
|
334
|
+
@clean_circular
|
|
335
|
+
|
|
336
|
+
sensitive_key?(cfg, key) ->
|
|
337
|
+
S.getprop(cfg, "mask")
|
|
338
|
+
|
|
339
|
+
S.ismap(val) ->
|
|
340
|
+
out = S.jm([])
|
|
341
|
+
|
|
342
|
+
Enum.each(H.entries(val), fn {k, v} ->
|
|
343
|
+
c = clean_snapshot(cfg, v, k, depth + 1, [val | seen])
|
|
344
|
+
if c != :__drop__, do: S.setprop(out, clean_name(cfg, out, k), c)
|
|
345
|
+
end)
|
|
346
|
+
|
|
347
|
+
out
|
|
348
|
+
|
|
349
|
+
S.islist(val) ->
|
|
350
|
+
out = S.jt([])
|
|
351
|
+
|
|
352
|
+
Enum.each(H.entries(val), fn {i, v} ->
|
|
353
|
+
c = clean_snapshot(cfg, v, i, depth + 1, [val | seen])
|
|
354
|
+
S.setprop(out, S.size(out), if(c == :__drop__, do: nil, else: c))
|
|
355
|
+
end)
|
|
356
|
+
|
|
357
|
+
out
|
|
358
|
+
|
|
359
|
+
match?(%ProjectName.Error{}, val) ->
|
|
360
|
+
S.jm(["code", clean_code(cfg, val.code), "message", clean_string(cfg, strof(val.msg))])
|
|
361
|
+
|
|
362
|
+
is_exception(val) ->
|
|
363
|
+
S.jm(["message", clean_string(cfg, Exception.message(val))])
|
|
364
|
+
|
|
365
|
+
is_struct(val) ->
|
|
366
|
+
clean_snapshot(cfg, Map.from_struct(val), key, depth, seen)
|
|
367
|
+
|
|
368
|
+
is_map(val) ->
|
|
369
|
+
out = S.jm([])
|
|
370
|
+
|
|
371
|
+
# Sorted, so colliding masked names number the same way every run.
|
|
372
|
+
Enum.each(Enum.sort_by(val, fn {k, _} -> strof(k) end), fn {k, v} ->
|
|
373
|
+
c = clean_snapshot(cfg, v, k, depth + 1, [val | seen])
|
|
374
|
+
if c != :__drop__, do: S.setprop(out, clean_name(cfg, out, k), c)
|
|
375
|
+
end)
|
|
376
|
+
|
|
377
|
+
out
|
|
378
|
+
|
|
379
|
+
is_list(val) or is_tuple(val) ->
|
|
380
|
+
items = if is_tuple(val), do: Tuple.to_list(val), else: val
|
|
381
|
+
out = S.jt([])
|
|
382
|
+
|
|
383
|
+
Enum.each(items, fn v ->
|
|
384
|
+
c = clean_snapshot(cfg, v, nil, depth + 1, [val | seen])
|
|
385
|
+
S.setprop(out, S.size(out), if(c == :__drop__, do: nil, else: c))
|
|
386
|
+
end)
|
|
387
|
+
|
|
388
|
+
out
|
|
389
|
+
|
|
390
|
+
true ->
|
|
391
|
+
clean_string(cfg, inspect(val))
|
|
392
|
+
end
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
defp clean_field(cfg, v, key) do
|
|
396
|
+
case clean_snapshot(cfg, v, key, 1, []) do
|
|
397
|
+
:__drop__ -> nil
|
|
398
|
+
c -> c
|
|
399
|
+
end
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
defp clean_code(cfg, code), do: if(is_binary(code), do: clean_string(cfg, code), else: code)
|
|
403
|
+
|
|
404
|
+
# The error is a struct, so "in place" is a copy carrying the same ctx.
|
|
405
|
+
defp clean_error(cfg, err) do
|
|
406
|
+
%{
|
|
407
|
+
err
|
|
408
|
+
| code: clean_code(cfg, err.code),
|
|
409
|
+
msg: clean_string(cfg, strof(err.msg)),
|
|
410
|
+
result: clean_field(cfg, err.result, "result"),
|
|
411
|
+
spec: clean_field(cfg, err.spec, "spec")
|
|
412
|
+
}
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
def clean_impl(ctx, val) do
|
|
416
|
+
cfg = clean_config(ctx)
|
|
417
|
+
|
|
418
|
+
cond do
|
|
419
|
+
S.getprop(cfg, "active") == false -> val
|
|
420
|
+
is_binary(val) -> clean_string(cfg, val)
|
|
421
|
+
match?(%ProjectName.Error{}, val) -> clean_error(cfg, val)
|
|
422
|
+
true -> clean_field(cfg, val, nil)
|
|
423
|
+
end
|
|
424
|
+
end
|
|
425
|
+
|
|
426
|
+
# An exception is immutable, so one that never passed through make_error (a
|
|
427
|
+
# hook's, a fetcher's) leaves as a copy with its string fields cleaned; one
|
|
428
|
+
# whose message still quotes a secret, from a field of another type, leaves
|
|
429
|
+
# as a RuntimeError carrying the cleaned message.
|
|
430
|
+
def clean_exception(ctx, e) do
|
|
431
|
+
cfg = clean_config(ctx)
|
|
432
|
+
|
|
433
|
+
cond do
|
|
434
|
+
S.getprop(cfg, "active") == false -> e
|
|
435
|
+
match?(%ProjectName.Error{}, e) -> clean_error(cfg, e)
|
|
436
|
+
true -> clean_foreign_exception(cfg, e)
|
|
437
|
+
end
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
defp clean_foreign_exception(cfg, e) do
|
|
441
|
+
copy =
|
|
442
|
+
Enum.reduce(Map.from_struct(e), e, fn
|
|
443
|
+
{k, v}, acc when is_binary(v) ->
|
|
444
|
+
Map.put(acc, k, if(sensitive_key?(cfg, k), do: mask_value(cfg, v), else: clean_string(cfg, v)))
|
|
445
|
+
|
|
446
|
+
_, acc ->
|
|
447
|
+
acc
|
|
448
|
+
end)
|
|
449
|
+
|
|
450
|
+
text = Exception.message(copy)
|
|
451
|
+
cleaned = clean_string(cfg, text)
|
|
452
|
+
if cleaned == text, do: copy, else: RuntimeError.exception(cleaned)
|
|
453
|
+
end
|
|
454
|
+
|
|
455
|
+
# The explain map is the CALLER's node, so it is cleaned in place: what
|
|
456
|
+
# they hold after the call is the cleaned record. With clean off,
|
|
457
|
+
# explain.result is the live result make_error reads, so err is pruned
|
|
458
|
+
# from a copy.
|
|
459
|
+
def clean_explain(ctx) do
|
|
460
|
+
ctrl = S.getprop(ctx, "ctrl")
|
|
461
|
+
explain = if ctrl != nil, do: S.getprop(ctrl, "explain"), else: nil
|
|
462
|
+
|
|
463
|
+
if S.ismap(explain) do
|
|
464
|
+
cleaned = clean(ctx, explain)
|
|
465
|
+
|
|
466
|
+
if S.ismap(cleaned) and cleaned != explain do
|
|
467
|
+
Enum.each(S.keysof(explain), fn k -> S.delprop(explain, k) end)
|
|
468
|
+
Enum.each(H.entries(cleaned), fn {k, v} -> S.setprop(explain, k, v) end)
|
|
469
|
+
end
|
|
470
|
+
|
|
471
|
+
er = S.getprop(explain, "result")
|
|
472
|
+
if S.ismap(er), do: S.setprop(explain, "result", without(er, "err"))
|
|
473
|
+
end
|
|
474
|
+
|
|
475
|
+
nil
|
|
476
|
+
end
|
|
477
|
+
|
|
478
|
+
# ---- features ------------------------------------------------------------
|
|
117
479
|
|
|
118
480
|
def feature_hook_impl(ctx, name) do
|
|
119
481
|
client = S.getprop(ctx, "client")
|
|
@@ -315,6 +677,25 @@ defmodule ProjectName.Utility do
|
|
|
315
677
|
# instead and every ported target validates it.
|
|
316
678
|
optspec = ProjectName.Schema.optspec()
|
|
317
679
|
|
|
680
|
+
# The secret registry exists BEFORE validation, fed from the raw input,
|
|
681
|
+
# so the constructor's own rejection of a mistyped credential is clean
|
|
682
|
+
# too. A shallow merge over the schema defaults: the clean block is flat.
|
|
683
|
+
cleanraw = S.jm([])
|
|
684
|
+
blocks = [S.getprop(optspec, "clean"), S.getprop(cfgopts, "clean"), S.getprop(opts0, "clean")]
|
|
685
|
+
|
|
686
|
+
Enum.each(blocks, fn src ->
|
|
687
|
+
if S.ismap(src), do: Enum.each(H.entries(src), fn {k, v} -> S.setprop(cleanraw, k, v) end)
|
|
688
|
+
end)
|
|
689
|
+
|
|
690
|
+
cleancfg = make_clean_config(cleanraw)
|
|
691
|
+
cleanctx = S.jm(["options", S.jm(["__derived__", S.jm(["clean", cleancfg])])])
|
|
692
|
+
|
|
693
|
+
clean_add_sensitive(cleanctx, secret_scan(opts0, ["clean"]))
|
|
694
|
+
|
|
695
|
+
Enum.each([cfgopts, opts0], fn src ->
|
|
696
|
+
Enum.each(splitvalues(S.getpath(src, "clean.values")), fn raw -> clean_add_impl(cleanctx, raw) end)
|
|
697
|
+
end)
|
|
698
|
+
|
|
318
699
|
sys_fetch = S.getpath(opts0, "system.fetch")
|
|
319
700
|
|
|
320
701
|
# CLONE the config side: `config` is a process-wide singleton
|
|
@@ -323,7 +704,16 @@ defmodule ProjectName.Utility do
|
|
|
323
704
|
# ...) are written into the shared config and inherited by every client
|
|
324
705
|
# constructed afterwards.
|
|
325
706
|
merged = S.merge(S.jt([S.jm([]), S.clone(cfgopts), opts0]))
|
|
326
|
-
|
|
707
|
+
|
|
708
|
+
validated =
|
|
709
|
+
try do
|
|
710
|
+
S.validate(merged, optspec)
|
|
711
|
+
rescue
|
|
712
|
+
e in Voxgig.Struct.Error ->
|
|
713
|
+
reraise %Voxgig.Struct.Error{message: clean_impl(cleanctx, Exception.message(e))},
|
|
714
|
+
__STACKTRACE__
|
|
715
|
+
end
|
|
716
|
+
|
|
327
717
|
opts = if S.ismap(validated), do: validated, else: S.jm([])
|
|
328
718
|
|
|
329
719
|
# Restore the suppression the optspec default would otherwise erase.
|
|
@@ -383,17 +773,6 @@ defmodule ProjectName.Utility do
|
|
|
383
773
|
end
|
|
384
774
|
end
|
|
385
775
|
|
|
386
|
-
ck = S.getpath(opts, "clean.keys")
|
|
387
|
-
clean_keys = if is_binary(ck), do: ck, else: "key,token,id"
|
|
388
|
-
|
|
389
|
-
keyre =
|
|
390
|
-
clean_keys
|
|
391
|
-
|> String.split(",")
|
|
392
|
-
|> Enum.map(&String.trim/1)
|
|
393
|
-
|> Enum.reject(&(&1 == ""))
|
|
394
|
-
|> Enum.map(&S.escre/1)
|
|
395
|
-
|> Enum.join("|")
|
|
396
|
-
|
|
397
776
|
# Resolve the feature add-order: an explicit list order (above) wins;
|
|
398
777
|
# otherwise order the map test-first, then the remaining names sorted, so
|
|
399
778
|
# the outcome is deterministic and `test` is always the base transport.
|
|
@@ -435,14 +814,51 @@ defmodule ProjectName.Utility do
|
|
|
435
814
|
list
|
|
436
815
|
end
|
|
437
816
|
|
|
438
|
-
derived = S.jm(["clean", S.
|
|
439
|
-
if keyre != "", do: S.setprop(derived, "clean", S.jm(["keyre", keyre]))
|
|
440
|
-
S.setprop(derived, "featureorder", S.jt(feature_order))
|
|
817
|
+
derived = S.jm(["clean", cleancfg, "featureorder", S.jt(feature_order)])
|
|
441
818
|
S.setprop(opts, "__derived__", derived)
|
|
442
819
|
|
|
820
|
+
# Again over the merged result: the config's own defaults can carry one.
|
|
821
|
+
clean_add_sensitive(S.jm(["options", opts]), secret_scan(opts, ["clean", "__derived__"]))
|
|
822
|
+
|
|
443
823
|
opts
|
|
444
824
|
end
|
|
445
825
|
|
|
826
|
+
# The options to scan for secrets. The feature map is keyed by feature
|
|
827
|
+
# names, not field names, so it is scanned as a list: `secrets` must not
|
|
828
|
+
# make every setting of that feature a secret. Entity blocks hold entity
|
|
829
|
+
# settings and seeded records, never a credential, so they are skipped.
|
|
830
|
+
defp secret_scan(opts, names) do
|
|
831
|
+
out = S.jm([])
|
|
832
|
+
|
|
833
|
+
Enum.each(H.entries(opts), fn {k, v} ->
|
|
834
|
+
cond do
|
|
835
|
+
k in names or k == "entity" ->
|
|
836
|
+
nil
|
|
837
|
+
|
|
838
|
+
k == "feature" and (S.ismap(v) or S.islist(v)) ->
|
|
839
|
+
S.setprop(out, k, S.jt(Enum.map(H.entries(v), fn {_, f} -> without(f, "entity") end)))
|
|
840
|
+
|
|
841
|
+
k == "test" ->
|
|
842
|
+
S.setprop(out, k, without(v, "entity"))
|
|
843
|
+
|
|
844
|
+
true ->
|
|
845
|
+
S.setprop(out, k, v)
|
|
846
|
+
end
|
|
847
|
+
end)
|
|
848
|
+
|
|
849
|
+
out
|
|
850
|
+
end
|
|
851
|
+
|
|
852
|
+
defp without(node, key) do
|
|
853
|
+
if S.ismap(node) do
|
|
854
|
+
out = S.jm([])
|
|
855
|
+
Enum.each(H.entries(node), fn {k, v} -> if k != key, do: S.setprop(out, k, v) end)
|
|
856
|
+
out
|
|
857
|
+
else
|
|
858
|
+
node
|
|
859
|
+
end
|
|
860
|
+
end
|
|
861
|
+
|
|
446
862
|
# ---- make_point ----------------------------------------------------------
|
|
447
863
|
|
|
448
864
|
def make_point_impl(ctx) do
|
|
@@ -781,19 +1197,26 @@ defmodule ProjectName.Utility do
|
|
|
781
1197
|
true ->
|
|
782
1198
|
S.setprop(spec, "step", "response")
|
|
783
1199
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
1200
|
+
# A body reader that raises (a non-JSON body) fails the result, as
|
|
1201
|
+
# in ts; it must not escape the pipeline with the raw spec still on
|
|
1202
|
+
# the explain record.
|
|
1203
|
+
try do
|
|
1204
|
+
result_basic(ctx)
|
|
1205
|
+
result_headers(ctx)
|
|
1206
|
+
result_body(ctx)
|
|
1207
|
+
|
|
1208
|
+
# GraphQL reports failures as a top-level `errors` array under
|
|
1209
|
+
# HTTP 200, so result_basic's status check never sees them. Lift
|
|
1210
|
+
# them here, before the response transform tries to unwrap data
|
|
1211
|
+
# that is not there.
|
|
1212
|
+
graphql_errors(ctx)
|
|
1213
|
+
|
|
1214
|
+
transform_response(ctx)
|
|
1215
|
+
|
|
1216
|
+
if S.getprop(result, "err") == nil, do: S.setprop(result, "ok", true)
|
|
1217
|
+
rescue
|
|
1218
|
+
e -> S.setprop(result, "err", e)
|
|
1219
|
+
end
|
|
797
1220
|
|
|
798
1221
|
ctrl = S.getprop(ctx, "ctrl")
|
|
799
1222
|
explain = S.getprop(ctrl, "explain")
|
|
@@ -865,16 +1288,7 @@ defmodule ProjectName.Utility do
|
|
|
865
1288
|
# ---- done ----------------------------------------------------------------
|
|
866
1289
|
|
|
867
1290
|
def done_impl(ctx) do
|
|
868
|
-
|
|
869
|
-
explain = S.getprop(ctrl, "explain")
|
|
870
|
-
|
|
871
|
-
if explain != nil do
|
|
872
|
-
S.setprop(ctrl, "explain", clean(ctx, explain))
|
|
873
|
-
ex = S.getprop(ctrl, "explain")
|
|
874
|
-
er = if S.ismap(ex), do: S.getprop(ex, "result")
|
|
875
|
-
if S.ismap(er), do: S.delprop(er, "err")
|
|
876
|
-
end
|
|
877
|
-
|
|
1291
|
+
clean_explain(ctx)
|
|
878
1292
|
result = S.getprop(ctx, "result")
|
|
879
1293
|
|
|
880
1294
|
if result != nil and S.getprop(result, "ok") == true do
|
|
@@ -923,10 +1337,13 @@ defmodule ProjectName.Utility do
|
|
|
923
1337
|
S.setprop(result, "err", nil)
|
|
924
1338
|
spec = S.getprop(ctx, "spec")
|
|
925
1339
|
|
|
1340
|
+
clean_explain(ctx)
|
|
926
1341
|
ctrl = S.getprop(ctx, "ctrl")
|
|
927
1342
|
explain = S.getprop(ctrl, "explain")
|
|
928
1343
|
if explain != nil, do: S.setprop(explain, "err", S.jm(["message", msg]))
|
|
929
1344
|
|
|
1345
|
+
# Cleaned COPIES of the result and spec, never the live nodes; the ctx
|
|
1346
|
+
# stays on the struct for a debugger and out of its Inspect form.
|
|
930
1347
|
sdk_err = %ProjectName.Error{
|
|
931
1348
|
code: "",
|
|
932
1349
|
msg: msg,
|
|
@@ -936,7 +1353,13 @@ defmodule ProjectName.Utility do
|
|
|
936
1353
|
spec: clean(ctx, spec)
|
|
937
1354
|
}
|
|
938
1355
|
|
|
939
|
-
|
|
1356
|
+
# A hook's own error supplies the code as well as the message.
|
|
1357
|
+
sdk_err =
|
|
1358
|
+
if match?(%ProjectName.Error{}, err) do
|
|
1359
|
+
%{sdk_err | code: if(is_binary(err.code), do: clean(ctx, err.code), else: err.code)}
|
|
1360
|
+
else
|
|
1361
|
+
sdk_err
|
|
1362
|
+
end
|
|
940
1363
|
|
|
941
1364
|
S.setprop(ctrl, "err", sdk_err)
|
|
942
1365
|
|
|
@@ -615,7 +615,8 @@ defmodule ProjectName.FeatureTest do
|
|
|
615
615
|
entries = S.getprop(track(h, "_debug"), "entries")
|
|
616
616
|
assert S.size(entries) == 1
|
|
617
617
|
assert S.size(seen) == 2
|
|
618
|
-
|
|
618
|
+
# Masked by the core clean rule (clean.keys), not a feature list of its own.
|
|
619
|
+
assert S.getprop(S.getprop(S.getelem(seen, 0), "headers"), "authorization") == "[redacted]"
|
|
619
620
|
end
|
|
620
621
|
end
|
|
621
622
|
|
|
@@ -640,7 +641,7 @@ defmodule ProjectName.FeatureTest do
|
|
|
640
641
|
FH.op(h, %{headers: S.jm(["x-secret", "hide", "x-ok", "show"])})
|
|
641
642
|
entry = S.getelem(S.getprop(track(h, "_debug"), "entries"), 0)
|
|
642
643
|
hdrs = S.getprop(entry, "headers")
|
|
643
|
-
assert S.getprop(hdrs, "x-secret") == "
|
|
644
|
+
assert S.getprop(hdrs, "x-secret") == "[redacted]"
|
|
644
645
|
assert S.getprop(hdrs, "x-ok") == "show"
|
|
645
646
|
end
|
|
646
647
|
end
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
package core
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
+
"encoding/json"
|
|
5
|
+
"fmt"
|
|
4
6
|
"math/rand"
|
|
5
7
|
"strconv"
|
|
6
8
|
"sync"
|
|
@@ -287,3 +289,43 @@ func (ctx *Context) resolveOp(opname string) *Operation {
|
|
|
287
289
|
func (ctx *Context) MakeError(code string, msg string) *ProjectNameError {
|
|
288
290
|
return NewProjectNameError(code, msg, ctx)
|
|
289
291
|
}
|
|
292
|
+
|
|
293
|
+
// The record a context serialises as; the options and the client stay out.
|
|
294
|
+
func (ctx *Context) Record() map[string]any {
|
|
295
|
+
return map[string]any{
|
|
296
|
+
"id": ctx.Id,
|
|
297
|
+
"op": ctx.Op,
|
|
298
|
+
"spec": ctx.Spec,
|
|
299
|
+
"entity": ctx.Entity,
|
|
300
|
+
"result": ctx.Result,
|
|
301
|
+
"response": ctx.Response,
|
|
302
|
+
"meta": ctx.Meta,
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// The serialised context leaves the pipeline (a logger, an error dump), so
|
|
307
|
+
// it is cleaned; the live fields stay raw for the pipeline's own use. Value
|
|
308
|
+
// receivers, so a dereferenced context prints the same way.
|
|
309
|
+
func (ctx Context) cleaned() any {
|
|
310
|
+
record := ctx.Record()
|
|
311
|
+
if ctx.Utility != nil && ctx.Utility.Clean != nil {
|
|
312
|
+
return ctx.Utility.Clean(&ctx, record)
|
|
313
|
+
}
|
|
314
|
+
return record
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
func (ctx Context) MarshalJSON() ([]byte, error) {
|
|
318
|
+
return json.Marshal(ctx.cleaned())
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
func (ctx Context) String() string {
|
|
322
|
+
cleaned := ctx.cleaned()
|
|
323
|
+
if raw, err := json.Marshal(cleaned); err == nil {
|
|
324
|
+
return "Context " + string(raw)
|
|
325
|
+
}
|
|
326
|
+
return "Context " + fmt.Sprintf("%v", cleaned)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
func (ctx Context) GoString() string {
|
|
330
|
+
return ctx.String()
|
|
331
|
+
}
|