@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
|
@@ -1,24 +1,302 @@
|
|
|
1
1
|
|
|
2
2
|
import { Context } from '../types'
|
|
3
|
+
import { OPTSPEC } from '../Schema'
|
|
3
4
|
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
// Everything that leaves the pipeline passes through clean; inside it data
|
|
7
|
+
// stays raw, so a hook can still read the header it must add to. See
|
|
8
|
+
// docs/explanation/secret-redaction.md.
|
|
8
9
|
|
|
10
|
+
const MAXDEPTH = 32
|
|
11
|
+
const CIRCULAR = '[circular]'
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
|
|
14
|
+
type CleanConfig = {
|
|
15
|
+
active: boolean
|
|
16
|
+
keys: string[]
|
|
17
|
+
values: string[]
|
|
18
|
+
mask: string
|
|
19
|
+
hint: number
|
|
20
|
+
min: number
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
function normkey(key: any): string {
|
|
25
|
+
return String(key).toLowerCase().replace(/[-_]/g, '')
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
function splitkeys(keys: any): string[] {
|
|
30
|
+
return String(null == keys ? '' : keys)
|
|
31
|
+
.split(/\s*,\s*/)
|
|
32
|
+
.map(normkey)
|
|
33
|
+
.filter((k: string) => '' !== k)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
function splitvalues(values: any): string[] {
|
|
38
|
+
if (Array.isArray(values)) {
|
|
39
|
+
return values.filter((v: any) => 'string' === typeof v)
|
|
40
|
+
}
|
|
41
|
+
return String(null == values ? '' : values)
|
|
42
|
+
.split(/\s*,\s*/)
|
|
43
|
+
.filter((v: string) => '' !== v)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
function count(val: any, dflt: number): number {
|
|
48
|
+
const n = Math.floor(Number(val))
|
|
49
|
+
return Number.isFinite(n) && 0 <= n ? n : dflt
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
// A context without options (makeError accepts a bare one) still masks by
|
|
54
|
+
// the schema defaults.
|
|
55
|
+
function cleanConfig(ctx: any): CleanConfig {
|
|
56
|
+
const derived = ctx?.options?.__derived__?.clean
|
|
57
|
+
if (null != derived) {
|
|
58
|
+
return derived
|
|
59
|
+
}
|
|
60
|
+
return makeCleanConfig((OPTSPEC as any)?.clean)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
function makeCleanConfig(cleanopts: any): CleanConfig {
|
|
65
|
+
const opts = cleanopts || {}
|
|
66
|
+
return {
|
|
67
|
+
active: false !== opts.active,
|
|
68
|
+
keys: splitkeys(opts.keys),
|
|
69
|
+
values: [],
|
|
70
|
+
mask: 'string' === typeof opts.mask ? opts.mask : '[redacted]',
|
|
71
|
+
hint: count(opts.hint, 0),
|
|
72
|
+
min: Math.max(1, count(opts.min, 4)),
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
// The encoded forms a value travels in.
|
|
78
|
+
function forms(value: string): string[] {
|
|
79
|
+
const out = [value]
|
|
80
|
+
const add = (s: string) => { if ('' !== s && !out.includes(s)) out.push(s) }
|
|
81
|
+
try { add(Buffer.from(value, 'utf8').toString('base64')) } catch (_e) { }
|
|
82
|
+
try { add(encodeURIComponent(value)) } catch (_e) { }
|
|
83
|
+
try { add(JSON.stringify(value).slice(1, -1)) } catch (_e) { }
|
|
84
|
+
return out
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
function cleanAdd(ctx: Context, value: any): void {
|
|
89
|
+
const cfg = cleanConfig(ctx)
|
|
90
|
+
if ('string' !== typeof value || value.length < cfg.min) {
|
|
91
|
+
return
|
|
92
|
+
}
|
|
93
|
+
let changed = false
|
|
94
|
+
for (const form of forms(value)) {
|
|
95
|
+
if (form.length >= cfg.min && !cfg.values.includes(form)) {
|
|
96
|
+
cfg.values.push(form)
|
|
97
|
+
changed = true
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (changed) {
|
|
101
|
+
cfg.values.sort((a, b) => b.length - a.length)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
function maskValue(cfg: CleanConfig, value: string): string {
|
|
107
|
+
if (0 < cfg.hint && value.length > 2 * cfg.hint) {
|
|
108
|
+
return cfg.mask + value.slice(-cfg.hint)
|
|
109
|
+
}
|
|
110
|
+
return cfg.mask
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
function cleanString(cfg: CleanConfig, text: string): string {
|
|
115
|
+
let out = text
|
|
116
|
+
for (const value of cfg.values) {
|
|
117
|
+
if (out.includes(value)) {
|
|
118
|
+
out = out.split(value).join(maskValue(cfg, value))
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return out
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
function sensitiveKey(cfg: CleanConfig, key: any): boolean {
|
|
126
|
+
if (null == key || 'number' === typeof key) {
|
|
127
|
+
return false
|
|
128
|
+
}
|
|
129
|
+
const nk = normkey(key)
|
|
130
|
+
for (const k of cfg.keys) {
|
|
131
|
+
if (nk.includes(k)) {
|
|
132
|
+
return true
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return false
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
// A masked plain-data copy: toJSON honoured, functions dropped, cycles cut,
|
|
140
|
+
// and nothing shared with the live value, whose spec must stay raw.
|
|
141
|
+
function snapshot(cfg: CleanConfig, val: any, key: any, depth: number, seen: any[]): any {
|
|
142
|
+
if (null == val) {
|
|
143
|
+
return val
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const t = typeof val
|
|
147
|
+
|
|
148
|
+
if ('string' === t) {
|
|
149
|
+
return sensitiveKey(cfg, key) ? maskValue(cfg, val) : cleanString(cfg, val)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if ('function' === t) {
|
|
153
|
+
return undefined
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if ('object' !== t) {
|
|
157
|
+
return sensitiveKey(cfg, key) ? cfg.mask : val
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (MAXDEPTH <= depth || seen.includes(val)) {
|
|
161
|
+
return CIRCULAR
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (sensitiveKey(cfg, key)) {
|
|
165
|
+
return cfg.mask
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
seen.push(val)
|
|
169
|
+
try {
|
|
170
|
+
if (Array.isArray(val)) {
|
|
171
|
+
const out: any[] = []
|
|
172
|
+
for (let i = 0; i < val.length; i++) {
|
|
173
|
+
out.push(snapshot(cfg, val[i], i, depth + 1, seen))
|
|
174
|
+
}
|
|
175
|
+
return out
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (val instanceof Error) {
|
|
179
|
+
const out: any = {
|
|
180
|
+
message: cleanString(cfg, String(val.message)),
|
|
181
|
+
stack: cleanString(cfg, String(val.stack || '')),
|
|
182
|
+
}
|
|
183
|
+
for (const k of Object.keys(val)) {
|
|
184
|
+
const v = snapshot(cfg, (val as any)[k], k, depth + 1, seen)
|
|
185
|
+
if (undefined !== v) out[k] = v
|
|
186
|
+
}
|
|
187
|
+
return out
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if ('function' === typeof (val as any).toJSON) {
|
|
191
|
+
const json = (val as any).toJSON()
|
|
192
|
+
return json === val ? plain(cfg, val, depth, seen) : snapshot(cfg, json, key, depth + 1, seen)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return plain(cfg, val, depth, seen)
|
|
196
|
+
}
|
|
197
|
+
finally {
|
|
198
|
+
seen.pop()
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
function plain(cfg: CleanConfig, val: any, depth: number, seen: any[]): any {
|
|
204
|
+
const out: any = {}
|
|
205
|
+
for (const k of Object.keys(val)) {
|
|
206
|
+
const v = snapshot(cfg, val[k], k, depth + 1, seen)
|
|
207
|
+
if (undefined !== v) out[cleanName(cfg, out, k)] = v
|
|
208
|
+
}
|
|
209
|
+
return out
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
// A registered value used as a property name is masked like any other
|
|
214
|
+
// string; names that mask alike take a counter, so none is lost.
|
|
215
|
+
function cleanName(cfg: CleanConfig, out: any, key: string): string {
|
|
216
|
+
const name = cleanString(cfg, key)
|
|
217
|
+
if (name === key || !Object.prototype.hasOwnProperty.call(out, name)) {
|
|
218
|
+
return name
|
|
219
|
+
}
|
|
220
|
+
let i = 1
|
|
221
|
+
while (Object.prototype.hasOwnProperty.call(out, name + '#' + i)) i++
|
|
222
|
+
return name + '#' + i
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
// An Error is cleaned in place, since it is about to be thrown.
|
|
11
227
|
function clean(ctx: Context, val: any) {
|
|
12
|
-
const
|
|
228
|
+
const cfg = cleanConfig(ctx)
|
|
13
229
|
|
|
14
|
-
|
|
15
|
-
|
|
230
|
+
if (false === cfg.active) {
|
|
231
|
+
return val
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if ('string' === typeof val) {
|
|
235
|
+
return cleanString(cfg, val)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (val instanceof Error) {
|
|
239
|
+
val.message = cleanString(cfg, String(val.message))
|
|
240
|
+
if ('string' === typeof val.stack) {
|
|
241
|
+
val.stack = cleanString(cfg, val.stack)
|
|
242
|
+
}
|
|
243
|
+
for (const k of Object.keys(val)) {
|
|
244
|
+
let v = (val as any)[k]
|
|
245
|
+
if ('string' === typeof v) {
|
|
246
|
+
v = sensitiveKey(cfg, k) ? maskValue(cfg, v) : cleanString(cfg, v)
|
|
247
|
+
}
|
|
248
|
+
else if (null != v && 'object' === typeof v) {
|
|
249
|
+
v = snapshot(cfg, v, k, 1, [])
|
|
250
|
+
}
|
|
251
|
+
const name = cleanString(cfg, k)
|
|
252
|
+
if (name !== k) {
|
|
253
|
+
delete (val as any)[k]
|
|
254
|
+
}
|
|
255
|
+
(val as any)[name === k ? k : cleanName(cfg, val, k)] = v
|
|
256
|
+
}
|
|
257
|
+
return val
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return snapshot(cfg, val, undefined, 0, [])
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
function cleanKey(ctx: Context, key: any): boolean {
|
|
265
|
+
return sensitiveKey(cleanConfig(ctx), key)
|
|
266
|
+
}
|
|
16
267
|
|
|
17
268
|
|
|
18
|
-
|
|
269
|
+
// Every scalar under a sensitive name, at any depth and of any shape: a
|
|
270
|
+
// credential mistyped as an object or a number is still a credential, and
|
|
271
|
+
// the validation error that rejects it quotes it.
|
|
272
|
+
function cleanAddSensitive(
|
|
273
|
+
ctx: Context, val: any, under = false, depth = 0, seen: any[] = [], parent?: string
|
|
274
|
+
): void {
|
|
275
|
+
if (null == val || MAXDEPTH <= depth) {
|
|
276
|
+
return
|
|
277
|
+
}
|
|
278
|
+
const t = typeof val
|
|
279
|
+
if ('string' === t || 'number' === t || 'bigint' === t) {
|
|
280
|
+
if (under) cleanAdd(ctx, String(val))
|
|
281
|
+
return
|
|
282
|
+
}
|
|
283
|
+
if ('object' !== t || seen.includes(val)) {
|
|
284
|
+
return
|
|
285
|
+
}
|
|
286
|
+
seen.push(val)
|
|
287
|
+
// The keys under `feature` name features, not fields: `secrets` is no secret.
|
|
288
|
+
const named = !(1 === depth && 'feature' === parent)
|
|
289
|
+
for (const k of Object.keys(val)) {
|
|
290
|
+
cleanAddSensitive(ctx, val[k], under || (named && cleanKey(ctx, k)), depth + 1, seen, k)
|
|
291
|
+
}
|
|
19
292
|
}
|
|
20
293
|
|
|
21
294
|
|
|
22
295
|
export {
|
|
23
|
-
clean
|
|
296
|
+
clean,
|
|
297
|
+
cleanAdd,
|
|
298
|
+
cleanAddSensitive,
|
|
299
|
+
cleanKey,
|
|
300
|
+
makeCleanConfig,
|
|
301
|
+
splitvalues,
|
|
24
302
|
}
|
|
@@ -7,12 +7,8 @@ import { clean } from './CleanUtility'
|
|
|
7
7
|
|
|
8
8
|
function done(ctx: Context) {
|
|
9
9
|
const error = ctx.utility.makeError
|
|
10
|
-
const delprop = ctx.utility.struct.delprop
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
ctx.ctrl.explain = clean(ctx, ctx.ctrl.explain)
|
|
14
|
-
delprop(ctx.ctrl.explain.result, 'err')
|
|
15
|
-
}
|
|
11
|
+
cleanExplain(ctx)
|
|
16
12
|
|
|
17
13
|
if (ctx.result && ctx.result.ok) {
|
|
18
14
|
return ctx.result.resdata
|
|
@@ -22,6 +18,23 @@ function done(ctx: Context) {
|
|
|
22
18
|
}
|
|
23
19
|
|
|
24
20
|
|
|
21
|
+
// In place: the caller may hold the record, and a stream copies only its ctrl.
|
|
22
|
+
function cleanExplain(ctx: Context) {
|
|
23
|
+
const explain = ctx.ctrl.explain
|
|
24
|
+
if (null == explain || 'object' !== typeof explain) {
|
|
25
|
+
return
|
|
26
|
+
}
|
|
27
|
+
const cleaned = clean(ctx, explain)
|
|
28
|
+
if (cleaned !== explain) {
|
|
29
|
+
for (const k of Object.keys(explain)) delete explain[k]
|
|
30
|
+
Object.assign(explain, cleaned)
|
|
31
|
+
}
|
|
32
|
+
// With clean off, explain.result is the live result makeError reads.
|
|
33
|
+
if (null != explain.result) explain.result = ctx.utility.struct.delprop({ ...explain.result }, 'err')
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
25
37
|
export {
|
|
38
|
+
cleanExplain,
|
|
26
39
|
done
|
|
27
40
|
}
|
|
@@ -22,9 +22,23 @@ function makeError(ctx: Context, err?: any) {
|
|
|
22
22
|
err = undefined === err ? reserr : err
|
|
23
23
|
err = err || ctx.error('unknown', 'unknown error')
|
|
24
24
|
|
|
25
|
+
// A hook or fetcher may reject with a plain value; clean returns a masked
|
|
26
|
+
// copy of that rather than changing it, so the copy is what leaves.
|
|
27
|
+
if (!(err instanceof Error)) {
|
|
28
|
+
const copy = clean(ctx, err)
|
|
29
|
+
const text = 'string' === typeof copy ? copy : String(copy?.message ?? 'unknown error')
|
|
30
|
+
err = Object.assign(new Error(text), 'object' === typeof copy ? copy : {})
|
|
31
|
+
}
|
|
32
|
+
|
|
25
33
|
const errmsg = err.message || 'unknown error'
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
err.message = 'ProjectNameSDK: ' + op.name + ': ' + errmsg
|
|
35
|
+
|
|
36
|
+
// Reachable for a debugger, invisible to a serialiser.
|
|
37
|
+
if (null != err.ctx) {
|
|
38
|
+
Object.defineProperty(err, 'ctx', { value: err.ctx, enumerable: false, writable: true })
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
clean(ctx, err)
|
|
28
42
|
|
|
29
43
|
if (result.err) {
|
|
30
44
|
delprop(result, 'err')
|
|
@@ -43,16 +57,12 @@ function makeError(ctx: Context, err?: any) {
|
|
|
43
57
|
err.result = clean(ctx, result)
|
|
44
58
|
err.spec = clean(ctx, spec)
|
|
45
59
|
|
|
46
|
-
//
|
|
47
|
-
// `err.status` / `err.notFound` instead of reaching into `err.result`.
|
|
60
|
+
// So a consumer branches on `err.status`, not on the shape of `err.result`.
|
|
48
61
|
err.status = null == result.status ? -1 : result.status
|
|
49
62
|
|
|
50
63
|
ctx.ctrl.err = err
|
|
51
64
|
|
|
52
|
-
//
|
|
53
|
-
// debug) close/record error paths that never reach PreDone (e.g. a PrePoint
|
|
54
|
-
// rbac short-circuit). Fires after ctx.ctrl.err is set so hooks can read the
|
|
55
|
-
// error; features guard against double-recording when PreDone already fired.
|
|
65
|
+
// Closes error paths that never reach PreDone (e.g. an rbac short-circuit).
|
|
56
66
|
if (null != ctx.client && null != ctx.utility &&
|
|
57
67
|
'function' === typeof ctx.utility.featureHook) {
|
|
58
68
|
ctx.utility.featureHook(ctx, 'PreUnexpected')
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { Context } from '../types'
|
|
3
3
|
import { OPTSPEC } from '../Schema'
|
|
4
4
|
|
|
5
|
+
import { clean, cleanAdd, cleanAddSensitive, makeCleanConfig, splitvalues } from './CleanUtility'
|
|
6
|
+
|
|
5
7
|
|
|
6
8
|
function makeOptions(ctx: Context) {
|
|
7
9
|
const utility = ctx.utility
|
|
@@ -11,12 +13,25 @@ function makeOptions(ctx: Context) {
|
|
|
11
13
|
const setprop = struct.setprop
|
|
12
14
|
const merge = struct.merge
|
|
13
15
|
const validate = struct.validate
|
|
14
|
-
const escre = struct.escre
|
|
15
16
|
|
|
16
17
|
let opts = { ...(options || {}) }
|
|
17
18
|
|
|
18
19
|
const authSuppressed = null === (options || {}).auth
|
|
19
20
|
|
|
21
|
+
let config = ctx.config || {}
|
|
22
|
+
let cfgopts = config.options || {}
|
|
23
|
+
|
|
24
|
+
// The registry exists BEFORE validation, so rejecting a mistyped credential
|
|
25
|
+
// is clean too. An absent block is left out, or merge would erase the defaults.
|
|
26
|
+
const layer = (b: any) => null != b && 'object' === typeof b && !Array.isArray(b) ? b : {}
|
|
27
|
+
const cleancfg = makeCleanConfig(merge([{}, (OPTSPEC as any).clean,
|
|
28
|
+
struct.clone(layer(cfgopts.clean)), layer(opts.clean)]))
|
|
29
|
+
const cleanctx: any = { options: { __derived__: { clean: cleancfg } } }
|
|
30
|
+
cleanAddSensitive(cleanctx, settings(opts))
|
|
31
|
+
for (const raw of [...splitvalues(cfgopts.clean?.values), ...splitvalues(opts.clean?.values)]) {
|
|
32
|
+
cleanAdd(cleanctx, raw)
|
|
33
|
+
}
|
|
34
|
+
|
|
20
35
|
let featureorder: string[] = []
|
|
21
36
|
if (Array.isArray(opts.feature)) {
|
|
22
37
|
const fmap: any = {}
|
|
@@ -35,9 +50,6 @@ function makeOptions(ctx: Context) {
|
|
|
35
50
|
setprop(utility, key, val)
|
|
36
51
|
}
|
|
37
52
|
|
|
38
|
-
let config = ctx.config || {}
|
|
39
|
-
let cfgopts = config.options || {}
|
|
40
|
-
|
|
41
53
|
const optspec = OPTSPEC
|
|
42
54
|
|
|
43
55
|
// Clone the config side before merging: `config` is a module-level
|
|
@@ -46,7 +58,12 @@ function makeOptions(ctx: Context) {
|
|
|
46
58
|
// contaminate every instance constructed after it.
|
|
47
59
|
opts = merge([{}, struct.clone(cfgopts), opts])
|
|
48
60
|
|
|
49
|
-
|
|
61
|
+
try {
|
|
62
|
+
opts = validate(opts, optspec)
|
|
63
|
+
}
|
|
64
|
+
catch (err: any) {
|
|
65
|
+
throw clean(cleanctx, err)
|
|
66
|
+
}
|
|
50
67
|
|
|
51
68
|
opts.system = opts.system || {}
|
|
52
69
|
if (null == opts.system.fetch) {
|
|
@@ -96,25 +113,30 @@ function makeOptions(ctx: Context) {
|
|
|
96
113
|
}
|
|
97
114
|
|
|
98
115
|
opts.__derived__ = {
|
|
99
|
-
clean:
|
|
100
|
-
keyre: undefined
|
|
101
|
-
},
|
|
116
|
+
clean: cleancfg,
|
|
102
117
|
featureorder,
|
|
103
118
|
}
|
|
104
119
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
.filter((s: string) => null != s && '' !== s)
|
|
108
|
-
.map((key: string) => escre(key)).join('|')
|
|
109
|
-
|
|
110
|
-
if ('' != keyre) {
|
|
111
|
-
opts.__derived__.clean.keyre = keyre
|
|
112
|
-
}
|
|
120
|
+
// Again over the merged result: the config's own defaults can carry one.
|
|
121
|
+
cleanAddSensitive({ options: opts } as any, settings(opts))
|
|
113
122
|
|
|
114
123
|
return opts
|
|
115
124
|
}
|
|
116
125
|
|
|
117
126
|
|
|
127
|
+
// Registration skips entity blocks: entity settings and seed records hold no credential.
|
|
128
|
+
function settings(opts: any): any {
|
|
129
|
+
const noent = (b: any) => null != b && 'object' === typeof b && !Array.isArray(b)
|
|
130
|
+
? { ...b, entity: undefined } : b
|
|
131
|
+
const feature = Array.isArray(opts.feature) ? opts.feature.map(noent)
|
|
132
|
+
: null != opts.feature && 'object' === typeof opts.feature
|
|
133
|
+
? Object.fromEntries(Object.entries(opts.feature).map(([k, v]) => [k, noent(v)]))
|
|
134
|
+
: opts.feature
|
|
135
|
+
return { ...opts, clean: undefined, __derived__: undefined, entity: undefined,
|
|
136
|
+
test: noent(opts.test), feature }
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
118
140
|
export {
|
|
119
141
|
makeOptions
|
|
120
142
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import { clean } from './CleanUtility'
|
|
4
|
-
import { done } from './DoneUtility'
|
|
3
|
+
import { clean, cleanAdd } from './CleanUtility'
|
|
4
|
+
import { cleanExplain, done } from './DoneUtility'
|
|
5
5
|
import { makeError } from './MakeErrorUtility'
|
|
6
6
|
import { featureAdd } from './FeatureAddUtility'
|
|
7
7
|
import { featureHook } from './FeatureHookUtility'
|
|
@@ -37,6 +37,8 @@ import { StructUtility } from './StructUtility'
|
|
|
37
37
|
class Utility {
|
|
38
38
|
|
|
39
39
|
clean = clean
|
|
40
|
+
cleanAdd = cleanAdd
|
|
41
|
+
cleanExplain = cleanExplain
|
|
40
42
|
done = done
|
|
41
43
|
makeError = makeError
|
|
42
44
|
featureAdd = featureAdd
|
|
@@ -80,6 +80,9 @@ function makeClient(spec: {
|
|
|
80
80
|
|
|
81
81
|
const utility: any = {
|
|
82
82
|
struct,
|
|
83
|
+
// Features pass every record they emit through the SDK's own clean.
|
|
84
|
+
clean: (stdutil as any).clean,
|
|
85
|
+
cleanAdd: (stdutil as any).cleanAdd,
|
|
83
86
|
fetcher: server,
|
|
84
87
|
param: (ctx: any, name: string) => {
|
|
85
88
|
const p = (ctx.spec && ctx.spec.params) || {}
|
|
@@ -88,10 +91,16 @@ function makeClient(spec: {
|
|
|
88
91
|
},
|
|
89
92
|
}
|
|
90
93
|
|
|
94
|
+
// One clean registry per client, as makeOptions gives a real one, so a value
|
|
95
|
+
// a feature registers with cleanAdd is masked by every clean after it.
|
|
96
|
+
const derived = (stdutil as any).makeOptions({
|
|
97
|
+
utility, options: { feature: { test: { active: true } } }, config: {},
|
|
98
|
+
}).__derived__
|
|
99
|
+
|
|
91
100
|
const client: any = {
|
|
92
101
|
_mode: spec.mode || 'test',
|
|
93
102
|
_features: [],
|
|
94
|
-
_options: { base, headers: spec.headers || {}, feature: {} },
|
|
103
|
+
_options: { base, headers: spec.headers || {}, feature: {}, __derived__: derived },
|
|
95
104
|
options() { return this._options },
|
|
96
105
|
utility() { return utility },
|
|
97
106
|
}
|
|
@@ -111,6 +120,7 @@ function makeClient(spec: {
|
|
|
111
120
|
id: 'C' + idseq,
|
|
112
121
|
client,
|
|
113
122
|
utility,
|
|
123
|
+
options: client._options,
|
|
114
124
|
out: {},
|
|
115
125
|
ctrl: over.ctrl || {},
|
|
116
126
|
meta: {},
|
|
@@ -384,7 +384,7 @@ describe('feature', () => {
|
|
|
384
384
|
const entries = h.client._debug.entries
|
|
385
385
|
strictEqual(entries.length, 1) // ring buffer capped at max
|
|
386
386
|
strictEqual(seen.length, 2)
|
|
387
|
-
strictEqual(seen[0].headers.authorization, '
|
|
387
|
+
strictEqual(seen[0].headers.authorization, '[redacted]')
|
|
388
388
|
})
|
|
389
389
|
|
|
390
390
|
test('captures failures', { skip: skipWithout('netsim') }, async () => {
|
|
@@ -518,6 +518,13 @@ describe('feature', () => {
|
|
|
518
518
|
await h.op({ op: 'load' })
|
|
519
519
|
strictEqual(rec.calls[0].fetchdef.proxy, undefined)
|
|
520
520
|
})
|
|
521
|
+
|
|
522
|
+
test('masks the credentials in the URL it reports', async () => {
|
|
523
|
+
const h = makeClient({ features: [{ name: 'proxy', options: { url: 'http://pxuser:pxs3cret@proxy:8080' } }] })
|
|
524
|
+
await h.op({ op: 'load' })
|
|
525
|
+
strictEqual(h.client._proxy.url.includes('pxs3cret'), false)
|
|
526
|
+
strictEqual(h.client._proxy.url.includes('pxuser'), false)
|
|
527
|
+
})
|
|
521
528
|
})
|
|
522
529
|
|
|
523
530
|
|
|
@@ -763,7 +770,7 @@ describe('feature', () => {
|
|
|
763
770
|
const h = makeClient({ features: [{ name: 'debug', options: { now: () => 7, redact: ['x-secret'] } }] })
|
|
764
771
|
await h.op({ op: 'load', headers: { 'x-secret': 'hide', 'x-ok': 'show' } })
|
|
765
772
|
const e = h.client._debug.entries[0]
|
|
766
|
-
strictEqual(e.headers['x-secret'], '
|
|
773
|
+
strictEqual(e.headers['x-secret'], '[redacted]')
|
|
767
774
|
strictEqual(e.headers['x-ok'], 'show')
|
|
768
775
|
})
|
|
769
776
|
|
|
@@ -238,6 +238,40 @@ pub const Context = struct {
|
|
|
238
238
|
return self.utility orelse unreachable;
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
+
// The record a logger or an error dump sees, cleaned; the live fields
|
|
242
|
+
// stay raw for the pipeline's own use.
|
|
243
|
+
pub fn to_value(self: *Context) Value {
|
|
244
|
+
const record = h.omap();
|
|
245
|
+
h.setp(record, "id", h.vstr(self.id));
|
|
246
|
+
h.setp(record, "op", h.jo(&.{
|
|
247
|
+
.{ "entity", h.vstr(self.op.entity) },
|
|
248
|
+
.{ "name", h.vstr(self.op.name) },
|
|
249
|
+
.{ "input", h.vstr(self.op.input) },
|
|
250
|
+
}));
|
|
251
|
+
if (self.spec) |sp| h.setp(record, "spec", sp.to_value());
|
|
252
|
+
if (self.entity) |e| h.setp(record, "entity", h.vstr(e.get_name()));
|
|
253
|
+
if (self.result) |r| h.setp(record, "result", r.to_value());
|
|
254
|
+
if (self.response) |rp| {
|
|
255
|
+
h.setp(record, "response", h.jo(&.{
|
|
256
|
+
.{ "status", h.vnum(rp.status) },
|
|
257
|
+
.{ "statusText", h.vstr(rp.status_text) },
|
|
258
|
+
.{ "headers", rp.headers },
|
|
259
|
+
.{ "body", rp.body },
|
|
260
|
+
}));
|
|
261
|
+
}
|
|
262
|
+
h.setp(record, "meta", self.meta);
|
|
263
|
+
return utility_mod.clean_util(self, record);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
pub fn to_json(self: *Context) []const u8 {
|
|
267
|
+
return h.jsonify_compact(self.to_value());
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
pub fn format(self: *const Context, writer: *std.Io.Writer) std.Io.Writer.Error!void {
|
|
271
|
+
try writer.writeAll("Context ");
|
|
272
|
+
try writer.writeAll(@constCast(self).to_json());
|
|
273
|
+
}
|
|
274
|
+
|
|
241
275
|
// --- ctx.out staging helpers ---
|
|
242
276
|
|
|
243
277
|
pub fn out_get(self: *Context, key: []const u8) ?OutVal {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// with the rich error object stashed on the context's pending_err, then read
|
|
4
4
|
// back by makeError. This templated file only needs the project name.
|
|
5
5
|
|
|
6
|
+
const std = @import("std");
|
|
6
7
|
const vs = @import("voxgig-struct");
|
|
7
8
|
const mem = @import("mem.zig");
|
|
8
9
|
const Value = vs.JsonValue;
|
|
@@ -11,7 +12,8 @@ pub const ProjectNameError = struct {
|
|
|
11
12
|
sdk: []const u8 = "ProjectName",
|
|
12
13
|
code: []const u8,
|
|
13
14
|
msg: []const u8,
|
|
14
|
-
// Cleaned snapshots attached by makeError (null until then).
|
|
15
|
+
// Cleaned snapshots attached by makeError (null until then). The context
|
|
16
|
+
// is not on the error at all, so what prints is what makeError cleaned.
|
|
15
17
|
result: Value = .{ .null = {} },
|
|
16
18
|
spec: Value = .{ .null = {} },
|
|
17
19
|
|
|
@@ -22,6 +24,25 @@ pub const ProjectNameError = struct {
|
|
|
22
24
|
e.* = .{ .sdk = "ProjectName", .code = code, .msg = msg };
|
|
23
25
|
return e;
|
|
24
26
|
}
|
|
27
|
+
|
|
28
|
+
pub fn to_json(self: *const ProjectNameError) []const u8 {
|
|
29
|
+
const out = Value.makeMap(mem.a()) catch return "{}";
|
|
30
|
+
out.object.put("sdk", .{ .string = self.sdk }) catch {};
|
|
31
|
+
out.object.put("code", .{ .string = self.code }) catch {};
|
|
32
|
+
out.object.put("msg", .{ .string = self.msg }) catch {};
|
|
33
|
+
out.object.put("result", self.result) catch {};
|
|
34
|
+
out.object.put("spec", self.spec) catch {};
|
|
35
|
+
return vs.jsonifyCompact(mem.a(), out) catch "{}";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
pub fn to_string(self: *const ProjectNameError) []const u8 {
|
|
39
|
+
const spec = vs.jsonifyCompact(mem.a(), self.spec) catch "null";
|
|
40
|
+
return std.fmt.allocPrint(mem.a(), "{s} [{s}] spec={s}", .{ self.msg, self.code, spec }) catch self.msg;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
pub fn format(self: *const ProjectNameError, writer: *std.Io.Writer) std.Io.Writer.Error!void {
|
|
44
|
+
try writer.writeAll(self.to_string());
|
|
45
|
+
}
|
|
25
46
|
};
|
|
26
47
|
|
|
27
48
|
// The pipeline error set. The payload travels via ctx.pending_err.
|