@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,31 +1,304 @@
|
|
|
1
1
|
|
|
2
|
-
const {
|
|
3
|
-
walk, size, pad, slice, clone
|
|
4
|
-
} = require('./StructUtility')
|
|
2
|
+
const { OPTSPEC } = require('../Schema')
|
|
5
3
|
|
|
6
|
-
|
|
4
|
+
|
|
5
|
+
// Everything that leaves the pipeline passes through clean: the error, the
|
|
6
|
+
// explain record, the serialised context, and whatever a feature emits.
|
|
7
|
+
// Two layers: every registered secret VALUE (and its encoded forms) is
|
|
8
|
+
// replaced wherever it appears in a string, and every value under a
|
|
9
|
+
// sensitive KEY name is masked whatever it holds. Inside the pipeline data
|
|
10
|
+
// stays raw, so a hook can still read the header it must add to.
|
|
11
|
+
|
|
12
|
+
const MAXDEPTH = 32
|
|
13
|
+
const CIRCULAR = '[circular]'
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
function normkey(key) {
|
|
17
|
+
return String(key).toLowerCase().replace(/[-_]/g, '')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
function splitkeys(keys) {
|
|
22
|
+
return String(null == keys ? '' : keys)
|
|
23
|
+
.split(/\s*,\s*/)
|
|
24
|
+
.map(normkey)
|
|
25
|
+
.filter((k) => '' !== k)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
// The comma-separated literal values a caller registers; a list is taken
|
|
30
|
+
// as-is for a caller that has one.
|
|
31
|
+
function splitvalues(values) {
|
|
32
|
+
if (Array.isArray(values)) {
|
|
33
|
+
return values.filter((v) => 'string' === typeof v)
|
|
34
|
+
}
|
|
35
|
+
return String(null == values ? '' : values)
|
|
36
|
+
.split(/\s*,\s*/)
|
|
37
|
+
.filter((v) => '' !== v)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
// The spec carries numbers as strings, so every target reads it alike.
|
|
42
|
+
function count(val, dflt) {
|
|
43
|
+
const n = Math.floor(Number(val))
|
|
44
|
+
return Number.isFinite(n) && 0 <= n ? n : dflt
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
// The derived block makeOptions builds; a context without options (makeError
|
|
49
|
+
// is reached with a bare one) falls back to the schema defaults, so nothing
|
|
50
|
+
// leaves raw for want of a constructor.
|
|
51
|
+
function cleanConfig(ctx) {
|
|
52
|
+
const derived = ctx?.options?.__derived__?.clean
|
|
53
|
+
if (null != derived) {
|
|
54
|
+
return derived
|
|
55
|
+
}
|
|
56
|
+
return makeCleanConfig(OPTSPEC?.clean)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
function makeCleanConfig(cleanopts) {
|
|
61
|
+
const opts = cleanopts || {}
|
|
62
|
+
return {
|
|
63
|
+
active: false !== opts.active,
|
|
64
|
+
keys: splitkeys(opts.keys),
|
|
65
|
+
values: [],
|
|
66
|
+
mask: 'string' === typeof opts.mask ? opts.mask : '[redacted]',
|
|
67
|
+
hint: count(opts.hint, 0),
|
|
68
|
+
min: Math.max(1, count(opts.min, 4)),
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
// The encoded forms a value travels in: Basic and Bearer both carry base64,
|
|
74
|
+
// a query credential is percent-encoded, and a JSON dump escapes it.
|
|
75
|
+
function forms(value) {
|
|
76
|
+
const out = [value]
|
|
77
|
+
const add = (s) => { if ('' !== s && !out.includes(s)) out.push(s) }
|
|
78
|
+
try { add(Buffer.from(value, 'utf8').toString('base64')) } catch (_e) { }
|
|
79
|
+
try { add(encodeURIComponent(value)) } catch (_e) { }
|
|
80
|
+
try { add(JSON.stringify(value).slice(1, -1)) } catch (_e) { }
|
|
81
|
+
return out
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
// Register a secret value. Idempotent; shorter than `min` is not a secret
|
|
86
|
+
// the SDK can mask without blanking ordinary text.
|
|
87
|
+
function cleanAdd(ctx, value) {
|
|
88
|
+
const cfg = cleanConfig(ctx)
|
|
89
|
+
if ('string' !== typeof value || value.length < cfg.min) {
|
|
90
|
+
return
|
|
91
|
+
}
|
|
92
|
+
let changed = false
|
|
93
|
+
for (const form of forms(value)) {
|
|
94
|
+
if (form.length >= cfg.min && !cfg.values.includes(form)) {
|
|
95
|
+
cfg.values.push(form)
|
|
96
|
+
changed = true
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (changed) {
|
|
100
|
+
cfg.values.sort((a, b) => b.length - a.length)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
function maskValue(cfg, value) {
|
|
106
|
+
if (0 < cfg.hint && value.length > 2 * cfg.hint) {
|
|
107
|
+
return cfg.mask + value.slice(-cfg.hint)
|
|
108
|
+
}
|
|
109
|
+
return cfg.mask
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
function cleanString(cfg, text) {
|
|
114
|
+
let out = text
|
|
115
|
+
for (const value of cfg.values) {
|
|
116
|
+
if (out.includes(value)) {
|
|
117
|
+
out = out.split(value).join(maskValue(cfg, value))
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return out
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
function sensitiveKey(cfg, key) {
|
|
125
|
+
if (null == key || 'number' === typeof key) {
|
|
126
|
+
return false
|
|
127
|
+
}
|
|
128
|
+
const nk = normkey(key)
|
|
129
|
+
for (const k of cfg.keys) {
|
|
130
|
+
if (nk.includes(k)) {
|
|
131
|
+
return true
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return false
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
// A plain-data copy of what is about to leave: toJSON is honoured (an entity
|
|
139
|
+
// serialises as its data, a context as its record), functions are dropped,
|
|
140
|
+
// cycles are cut, and no live object is shared with the copy - masking the
|
|
141
|
+
// copy must never mask the pipeline's own spec.
|
|
142
|
+
function snapshot(cfg, val, key, depth, seen) {
|
|
143
|
+
if (null == val) {
|
|
144
|
+
return val
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const t = typeof val
|
|
148
|
+
|
|
149
|
+
if ('string' === t) {
|
|
150
|
+
return sensitiveKey(cfg, key) ? maskValue(cfg, val) : cleanString(cfg, val)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if ('function' === t) {
|
|
154
|
+
return undefined
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if ('object' !== t) {
|
|
158
|
+
return sensitiveKey(cfg, key) ? cfg.mask : val
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (MAXDEPTH <= depth || seen.includes(val)) {
|
|
162
|
+
return CIRCULAR
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (sensitiveKey(cfg, key)) {
|
|
166
|
+
return cfg.mask
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
seen.push(val)
|
|
170
|
+
try {
|
|
171
|
+
if (Array.isArray(val)) {
|
|
172
|
+
const out = []
|
|
173
|
+
for (let i = 0; i < val.length; i++) {
|
|
174
|
+
out.push(snapshot(cfg, val[i], i, depth + 1, seen))
|
|
175
|
+
}
|
|
176
|
+
return out
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (val instanceof Error) {
|
|
180
|
+
const out = {
|
|
181
|
+
message: cleanString(cfg, String(val.message)),
|
|
182
|
+
stack: cleanString(cfg, String(val.stack || '')),
|
|
183
|
+
}
|
|
184
|
+
for (const k of Object.keys(val)) {
|
|
185
|
+
const v = snapshot(cfg, val[k], k, depth + 1, seen)
|
|
186
|
+
if (undefined !== v) out[k] = v
|
|
187
|
+
}
|
|
188
|
+
return out
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if ('function' === typeof val.toJSON) {
|
|
192
|
+
const json = val.toJSON()
|
|
193
|
+
return json === val ? plain(cfg, val, depth, seen) : snapshot(cfg, json, key, depth + 1, seen)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return plain(cfg, val, depth, seen)
|
|
197
|
+
}
|
|
198
|
+
finally {
|
|
199
|
+
seen.pop()
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
function plain(cfg, val, depth, seen) {
|
|
205
|
+
const out = {}
|
|
206
|
+
for (const k of Object.keys(val)) {
|
|
207
|
+
const v = snapshot(cfg, val[k], k, depth + 1, seen)
|
|
208
|
+
if (undefined !== v) out[cleanName(cfg, out, k)] = v
|
|
209
|
+
}
|
|
210
|
+
return out
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
// A registered value used as a property name is masked like any other
|
|
215
|
+
// string; names that mask alike take a counter, so none is lost.
|
|
216
|
+
function cleanName(cfg, out, key) {
|
|
217
|
+
const name = cleanString(cfg, key)
|
|
218
|
+
if (name === key || !Object.prototype.hasOwnProperty.call(out, name)) {
|
|
219
|
+
return name
|
|
220
|
+
}
|
|
221
|
+
let i = 1
|
|
222
|
+
while (Object.prototype.hasOwnProperty.call(out, name + '#' + i)) i++
|
|
223
|
+
return name + '#' + i
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
// Clean a value on its way out. A string is redacted; an Error is redacted
|
|
228
|
+
// IN PLACE (it is about to be thrown, and its identity matters to the
|
|
229
|
+
// caller); anything else comes back as a masked plain-data copy.
|
|
7
230
|
function clean(ctx, val) {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
231
|
+
const cfg = cleanConfig(ctx)
|
|
232
|
+
|
|
233
|
+
if (false === cfg.active) {
|
|
234
|
+
return val
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if ('string' === typeof val) {
|
|
238
|
+
return cleanString(cfg, val)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (val instanceof Error) {
|
|
242
|
+
val.message = cleanString(cfg, String(val.message))
|
|
243
|
+
if ('string' === typeof val.stack) {
|
|
244
|
+
val.stack = cleanString(cfg, val.stack)
|
|
245
|
+
}
|
|
246
|
+
for (const k of Object.keys(val)) {
|
|
247
|
+
let v = val[k]
|
|
248
|
+
if ('string' === typeof v) {
|
|
249
|
+
v = sensitiveKey(cfg, k) ? maskValue(cfg, v) : cleanString(cfg, v)
|
|
250
|
+
}
|
|
251
|
+
else if (null != v && 'object' === typeof v) {
|
|
252
|
+
v = snapshot(cfg, v, k, 1, [])
|
|
20
253
|
}
|
|
21
|
-
|
|
22
|
-
|
|
254
|
+
const name = cleanString(cfg, k)
|
|
255
|
+
if (name !== k) {
|
|
256
|
+
delete val[k]
|
|
257
|
+
}
|
|
258
|
+
val[name === k ? k : cleanName(cfg, val, k)] = v
|
|
259
|
+
}
|
|
260
|
+
return val
|
|
23
261
|
}
|
|
24
|
-
*/
|
|
25
262
|
|
|
26
|
-
return val
|
|
263
|
+
return snapshot(cfg, val, undefined, 0, [])
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
// Is this key name sensitive under the context's clean configuration?
|
|
268
|
+
function cleanKey(ctx, key) {
|
|
269
|
+
return sensitiveKey(cleanConfig(ctx), key)
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
// Every scalar under a sensitive name, at any depth and of any shape: a
|
|
274
|
+
// credential mistyped as an object or a number is still a credential, and
|
|
275
|
+
// the validation error that rejects it quotes it.
|
|
276
|
+
function cleanAddSensitive(ctx, val, under = false, depth = 0, seen = [], parent) {
|
|
277
|
+
if (null == val || MAXDEPTH <= depth) {
|
|
278
|
+
return
|
|
279
|
+
}
|
|
280
|
+
const t = typeof val
|
|
281
|
+
if ('string' === t || 'number' === t || 'bigint' === t) {
|
|
282
|
+
if (under) cleanAdd(ctx, String(val))
|
|
283
|
+
return
|
|
284
|
+
}
|
|
285
|
+
if ('object' !== t || seen.includes(val)) {
|
|
286
|
+
return
|
|
287
|
+
}
|
|
288
|
+
seen.push(val)
|
|
289
|
+
// The keys under `feature` name features, not fields: `secrets` is no secret.
|
|
290
|
+
const named = !(1 === depth && 'feature' === parent)
|
|
291
|
+
for (const k of Object.keys(val)) {
|
|
292
|
+
cleanAddSensitive(ctx, val[k], under || (named && cleanKey(ctx, k)), depth + 1, seen, k)
|
|
293
|
+
}
|
|
27
294
|
}
|
|
28
295
|
|
|
296
|
+
|
|
29
297
|
module.exports = {
|
|
30
|
-
clean
|
|
298
|
+
clean,
|
|
299
|
+
cleanAdd,
|
|
300
|
+
cleanAddSensitive,
|
|
301
|
+
cleanKey,
|
|
302
|
+
makeCleanConfig,
|
|
303
|
+
splitvalues,
|
|
31
304
|
}
|
|
@@ -3,12 +3,8 @@ const { clean } = require('./CleanUtility')
|
|
|
3
3
|
|
|
4
4
|
function done(ctx) {
|
|
5
5
|
const error = ctx.utility.makeError
|
|
6
|
-
const delprop = ctx.utility.struct.delprop
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
ctx.ctrl.explain = clean(ctx, ctx.ctrl.explain)
|
|
10
|
-
delprop(ctx.ctrl.explain.result, 'err')
|
|
11
|
-
}
|
|
7
|
+
cleanExplain(ctx)
|
|
12
8
|
|
|
13
9
|
if (ctx.result && ctx.result.ok) {
|
|
14
10
|
return ctx.result.resdata
|
|
@@ -17,6 +13,22 @@ function done(ctx) {
|
|
|
17
13
|
return error(ctx)
|
|
18
14
|
}
|
|
19
15
|
|
|
16
|
+
// In place: the caller may hold the record, and a stream copies only its ctrl.
|
|
17
|
+
function cleanExplain(ctx) {
|
|
18
|
+
const explain = ctx.ctrl.explain
|
|
19
|
+
if (null == explain || 'object' !== typeof explain) {
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
const cleaned = clean(ctx, explain)
|
|
23
|
+
if (cleaned !== explain) {
|
|
24
|
+
for (const k of Object.keys(explain)) delete explain[k]
|
|
25
|
+
Object.assign(explain, cleaned)
|
|
26
|
+
}
|
|
27
|
+
// With clean off, explain.result is the live result makeError reads.
|
|
28
|
+
if (null != explain.result) explain.result = ctx.utility.struct.delprop({ ...explain.result }, 'err')
|
|
29
|
+
}
|
|
30
|
+
|
|
20
31
|
module.exports = {
|
|
32
|
+
cleanExplain,
|
|
21
33
|
done
|
|
22
34
|
}
|
|
@@ -18,9 +18,25 @@ function makeError(ctx, err) {
|
|
|
18
18
|
err = undefined === err ? reserr : err
|
|
19
19
|
err = err || ctx.error('unknown', 'unknown error')
|
|
20
20
|
|
|
21
|
+
// A hook or fetcher may reject with a plain value; clean returns a masked
|
|
22
|
+
// copy of that rather than changing it, so the copy is what leaves.
|
|
23
|
+
if (!(err instanceof Error)) {
|
|
24
|
+
const copy = clean(ctx, err)
|
|
25
|
+
const text = 'string' === typeof copy ? copy : String(copy?.message ?? 'unknown error')
|
|
26
|
+
err = Object.assign(new Error(text), 'object' === typeof copy ? copy : {})
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
const errmsg = err.message || 'unknown error'
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
err.message = 'ProjectNameSDK: ' + op.name + ': ' + errmsg
|
|
31
|
+
|
|
32
|
+
// The context stays reachable for a debugger, but not for a serialiser:
|
|
33
|
+
// a transport error carries none, and a pipeline error's is enumerable
|
|
34
|
+
// only until here.
|
|
35
|
+
if (null != err.ctx) {
|
|
36
|
+
Object.defineProperty(err, 'ctx', { value: err.ctx, enumerable: false, writable: true })
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
clean(ctx, err)
|
|
24
40
|
|
|
25
41
|
if (result.err) {
|
|
26
42
|
delprop(result, 'err')
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
const { OPTSPEC } = require('../Schema')
|
|
3
3
|
|
|
4
|
+
const { clean, cleanAdd, cleanAddSensitive, makeCleanConfig, splitvalues } = require('./CleanUtility')
|
|
5
|
+
|
|
4
6
|
|
|
5
7
|
function makeOptions(ctx) {
|
|
6
8
|
const utility = ctx.utility
|
|
@@ -10,7 +12,6 @@ function makeOptions(ctx) {
|
|
|
10
12
|
const setprop = struct.setprop
|
|
11
13
|
const merge = struct.merge
|
|
12
14
|
const validate = struct.validate
|
|
13
|
-
const escre = struct.escre
|
|
14
15
|
|
|
15
16
|
// `auth: null` is the documented way to disable auth outright, and
|
|
16
17
|
// prepareAuth honours it before it ever reads the apikey. But it cannot
|
|
@@ -33,6 +34,21 @@ function makeOptions(ctx) {
|
|
|
33
34
|
delete opts.auth
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
// The secret registry exists BEFORE validation, fed from the raw input, so
|
|
38
|
+
// the constructor's own rejection of a mistyped credential is clean too.
|
|
39
|
+
let config = ctx.config || {}
|
|
40
|
+
let cfgopts = config.options || {}
|
|
41
|
+
|
|
42
|
+
// An absent block is left out, or merge would erase the defaults.
|
|
43
|
+
const layer = (b) => null != b && 'object' === typeof b && !Array.isArray(b) ? b : {}
|
|
44
|
+
const cleancfg = makeCleanConfig(merge([{}, OPTSPEC.clean,
|
|
45
|
+
struct.clone(layer(cfgopts.clean)), layer(opts.clean)]))
|
|
46
|
+
const cleanctx = { options: { __derived__: { clean: cleancfg } } }
|
|
47
|
+
cleanAddSensitive(cleanctx, settings(opts))
|
|
48
|
+
for (const raw of [...splitvalues(cfgopts.clean?.values), ...splitvalues(opts.clean?.values)]) {
|
|
49
|
+
cleanAdd(cleanctx, raw)
|
|
50
|
+
}
|
|
51
|
+
|
|
36
52
|
// Feature add-order. `options.feature` may be given as an ordered ARRAY of
|
|
37
53
|
// { name, active, ...opts } entries (the array position IS the order in
|
|
38
54
|
// which features are added), or as a { name: {opts} } map. Normalize an
|
|
@@ -57,8 +73,6 @@ function makeOptions(ctx) {
|
|
|
57
73
|
setprop(utility, key, val)
|
|
58
74
|
}
|
|
59
75
|
|
|
60
|
-
let config = ctx.config || {}
|
|
61
|
-
let cfgopts = config.options || {}
|
|
62
76
|
|
|
63
77
|
// THE OPTION SPEC IS GENERATED, NOT WRITTEN HERE.
|
|
64
78
|
//
|
|
@@ -80,7 +94,12 @@ function makeOptions(ctx) {
|
|
|
80
94
|
// contaminate every instance constructed after it.
|
|
81
95
|
opts = merge([{}, struct.clone(cfgopts), opts])
|
|
82
96
|
|
|
83
|
-
|
|
97
|
+
try {
|
|
98
|
+
opts = validate(opts, optspec)
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
throw clean(cleanctx, err)
|
|
102
|
+
}
|
|
84
103
|
|
|
85
104
|
// The platform fetch, supplied AFTER validate rather than as a spec
|
|
86
105
|
// default. `system.fetch` is declared `$ANY`, which passes a caller's own
|
|
@@ -147,24 +166,29 @@ function makeOptions(ctx) {
|
|
|
147
166
|
}
|
|
148
167
|
|
|
149
168
|
opts.__derived__ = {
|
|
150
|
-
clean:
|
|
151
|
-
keyre: undefined
|
|
152
|
-
},
|
|
169
|
+
clean: cleancfg,
|
|
153
170
|
featureorder,
|
|
154
171
|
}
|
|
155
172
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
.filter((s) => null != s && '' !== s)
|
|
159
|
-
.map((key) => escre(key)).join('|')
|
|
160
|
-
|
|
161
|
-
if ('' != keyre) {
|
|
162
|
-
opts.__derived__.clean.keyre = keyre
|
|
163
|
-
}
|
|
173
|
+
// Again over the merged result: the config's own defaults can carry one.
|
|
174
|
+
cleanAddSensitive({ options: opts }, settings(opts))
|
|
164
175
|
|
|
165
176
|
return opts
|
|
166
177
|
}
|
|
167
178
|
|
|
179
|
+
// Registration skips entity blocks: entity settings and seed records hold no credential.
|
|
180
|
+
function settings(opts) {
|
|
181
|
+
const noent = (b) => null != b && 'object' === typeof b && !Array.isArray(b)
|
|
182
|
+
? { ...b, entity: undefined } : b
|
|
183
|
+
const feature = Array.isArray(opts.feature) ? opts.feature.map(noent)
|
|
184
|
+
: null != opts.feature && 'object' === typeof opts.feature
|
|
185
|
+
? Object.fromEntries(Object.entries(opts.feature).map(([k, v]) => [k, noent(v)]))
|
|
186
|
+
: opts.feature
|
|
187
|
+
return { ...opts, clean: undefined, __derived__: undefined, entity: undefined,
|
|
188
|
+
test: noent(opts.test), feature }
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
|
|
168
192
|
module.exports = {
|
|
169
193
|
makeOptions
|
|
170
194
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
const { clean } = require('./CleanUtility')
|
|
4
|
-
const { done } = require('./DoneUtility')
|
|
3
|
+
const { clean, cleanAdd } = require('./CleanUtility')
|
|
4
|
+
const { cleanExplain, done } = require('./DoneUtility')
|
|
5
5
|
const { makeError } = require('./MakeErrorUtility')
|
|
6
6
|
const { featureAdd } = require('./FeatureAddUtility')
|
|
7
7
|
const { featureHook } = require('./FeatureHookUtility')
|
|
@@ -37,6 +37,8 @@ const { StructUtility } = require('./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 = {
|
|
82
82
|
struct,
|
|
83
|
+
// Features pass every record they emit through the SDK's own clean.
|
|
84
|
+
clean: stdutil.clean,
|
|
85
|
+
cleanAdd: stdutil.cleanAdd,
|
|
83
86
|
fetcher: server,
|
|
84
87
|
param: (ctx, name) => {
|
|
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.makeOptions({
|
|
97
|
+
utility, options: { feature: { test: { active: true } } }, config: {},
|
|
98
|
+
}).__derived__
|
|
99
|
+
|
|
91
100
|
const client = {
|
|
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
|
|
|
@@ -244,4 +244,23 @@ class Context(ctxmap: MutableMap<String, Any?>?, basectx: Context?) {
|
|
|
244
244
|
fun makeError(code: String, msg: String): SdkError {
|
|
245
245
|
return SdkError(code, msg, this)
|
|
246
246
|
}
|
|
247
|
+
|
|
248
|
+
// The serialised context leaves the pipeline (a logger, an error dump), so
|
|
249
|
+
// it is cleaned; the live fields stay raw for the pipeline's own use.
|
|
250
|
+
fun toMap(): Any? {
|
|
251
|
+
val record = linkedMapOf<String, Any?>()
|
|
252
|
+
record["id"] = this.id
|
|
253
|
+
record["op"] = this.op
|
|
254
|
+
record["spec"] = this.spec
|
|
255
|
+
record["entity"] = this.entity
|
|
256
|
+
record["result"] = this.result
|
|
257
|
+
record["response"] = this.response
|
|
258
|
+
record["meta"] = this.meta
|
|
259
|
+
val u = this.utility ?: return record
|
|
260
|
+
return u.clean(this, record)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
override fun toString(): String {
|
|
264
|
+
return "Context " + Struct.jsonify(this.toMap())
|
|
265
|
+
}
|
|
247
266
|
}
|
|
@@ -81,6 +81,11 @@ abstract class SdkClient(sdkopts: MutableMap<String, Any?>?) {
|
|
|
81
81
|
this.util.featureHook(this.rootctx, "PostConstruct")
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
// The options hold the credential; a printed client shows only its name.
|
|
85
|
+
override fun toString(): String {
|
|
86
|
+
return this.javaClass.simpleName + "(mode=" + this.mode + ")"
|
|
87
|
+
}
|
|
88
|
+
|
|
84
89
|
fun optionsMap(): MutableMap<String, Any?> {
|
|
85
90
|
val out = Struct.clone(this.options)
|
|
86
91
|
if (out is MutableMap<*, *>) {
|
|
@@ -262,12 +267,14 @@ abstract class SdkClient(sdkopts: MutableMap<String, Any?>?) {
|
|
|
262
267
|
|
|
263
268
|
val out = linkedMapOf<String, Any?>()
|
|
264
269
|
|
|
270
|
+
// A raw request returns its failure rather than passing it through
|
|
271
|
+
// makeError, so it is cleaned here.
|
|
265
272
|
val fetchdef: MutableMap<String, Any?>
|
|
266
273
|
try {
|
|
267
274
|
fetchdef = this.prepare(fetchargs)
|
|
268
275
|
} catch (err: RuntimeException) {
|
|
269
276
|
out["ok"] = false
|
|
270
|
-
out["err"] = err
|
|
277
|
+
out["err"] = utility.clean(ctx, err)
|
|
271
278
|
return out
|
|
272
279
|
}
|
|
273
280
|
|
|
@@ -277,7 +284,7 @@ abstract class SdkClient(sdkopts: MutableMap<String, Any?>?) {
|
|
|
277
284
|
fetched = utility.fetcher(ctx, if (url is String) url else "", fetchdef)
|
|
278
285
|
} catch (err: RuntimeException) {
|
|
279
286
|
out["ok"] = false
|
|
280
|
-
out["err"] = err
|
|
287
|
+
out["err"] = utility.clean(ctx, err)
|
|
281
288
|
return out
|
|
282
289
|
}
|
|
283
290
|
|
|
@@ -14,6 +14,7 @@ typealias FetcherFn = (Context, String, MutableMap<String, Any?>) -> Any?
|
|
|
14
14
|
class Utility private constructor(register: Boolean) {
|
|
15
15
|
|
|
16
16
|
lateinit var clean: (Context, Any?) -> Any?
|
|
17
|
+
lateinit var cleanAdd: (Context, Any?) -> Unit
|
|
17
18
|
lateinit var done: (Context) -> Any?
|
|
18
19
|
lateinit var makeError: (Context, RuntimeException?) -> Any?
|
|
19
20
|
lateinit var featureAdd: (Context, Feature) -> Unit
|
|
@@ -59,6 +60,7 @@ class Utility private constructor(register: Boolean) {
|
|
|
59
60
|
val u = Utility(false)
|
|
60
61
|
|
|
61
62
|
u.clean = this.clean
|
|
63
|
+
u.cleanAdd = this.cleanAdd
|
|
62
64
|
u.done = this.done
|
|
63
65
|
u.makeError = this.makeError
|
|
64
66
|
u.featureAdd = this.featureAdd
|
|
@@ -3,6 +3,7 @@ package KOTLINPACKAGE.feature
|
|
|
3
3
|
import java.util.function.Consumer
|
|
4
4
|
|
|
5
5
|
import KOTLINPACKAGE.core.Context
|
|
6
|
+
import KOTLINPACKAGE.core.Helpers
|
|
6
7
|
import KOTLINPACKAGE.core.SdkClient
|
|
7
8
|
|
|
8
9
|
// Audit trail. Emits a structured record for every operation — who (actor),
|
|
@@ -65,18 +66,19 @@ class AuditFeature : BaseFeature("audit", "0.0.1", true) {
|
|
|
65
66
|
val entity = ctx.op.entity
|
|
66
67
|
val opname = ctx.op.name
|
|
67
68
|
|
|
68
|
-
val
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
val raw = linkedMapOf<String, Any?>()
|
|
70
|
+
raw["seq"] = this.seq
|
|
71
|
+
raw["ts"] = FeatureOptions.foptNow(this.options).getAsLong()
|
|
72
|
+
raw["actor"] = actor
|
|
73
|
+
raw["entity"] = entity
|
|
74
|
+
raw["op"] = opname
|
|
75
|
+
raw["outcome"] = outcome
|
|
76
|
+
raw["correlationId"] = ctx.id
|
|
76
77
|
val result = ctx.result
|
|
77
78
|
if (result != null) {
|
|
78
|
-
|
|
79
|
+
raw["status"] = result.status
|
|
79
80
|
}
|
|
81
|
+
val record = Helpers.toMapAny(ctx.utility?.clean?.invoke(ctx, raw)) ?: raw
|
|
80
82
|
|
|
81
83
|
this.records.add(record)
|
|
82
84
|
val max = FeatureOptions.foptInt(this.options, "max", 1000)
|