@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
|
@@ -7,18 +7,7 @@ use crate::utility::voxgigstruct as vs;
|
|
|
7
7
|
use crate::utility::voxgigstruct::Value;
|
|
8
8
|
|
|
9
9
|
pub fn done_util(ctx: &Rc<Context>) -> Result<Value, ProjectNameError> {
|
|
10
|
-
|
|
11
|
-
let ctrl = ctx.ctrl.borrow().clone();
|
|
12
|
-
let mut c = ctrl.borrow_mut();
|
|
13
|
-
if c.has_explain() {
|
|
14
|
-
let explain = crate::utility::clean::clean_util(ctx, &c.explain);
|
|
15
|
-
if let Value::Map(_) = getp(&explain, "result") {
|
|
16
|
-
let rm = to_map(&getp(&explain, "result"));
|
|
17
|
-
vs::del_prop(rm, &Value::str("err"));
|
|
18
|
-
}
|
|
19
|
-
c.explain = explain;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
10
|
+
clean_explain_util(ctx);
|
|
22
11
|
|
|
23
12
|
let result = ctx.result.borrow().clone();
|
|
24
13
|
if let Some(res) = result {
|
|
@@ -29,3 +18,24 @@ pub fn done_util(ctx: &Rc<Context>) -> Result<Value, ProjectNameError> {
|
|
|
29
18
|
|
|
30
19
|
crate::utility::make_error::make_error_util(ctx, None)
|
|
31
20
|
}
|
|
21
|
+
|
|
22
|
+
/// Clean the explain record in place. It is the caller's own map (Control
|
|
23
|
+
/// copies the Rc), so its entries are replaced by the cleaned copy's; with
|
|
24
|
+
/// clean off the cleaned record is that map, already current.
|
|
25
|
+
pub fn clean_explain_util(ctx: &Rc<Context>) {
|
|
26
|
+
let ctrl = ctx.ctrl.borrow().clone();
|
|
27
|
+
let explain = ctrl.borrow().explain.clone();
|
|
28
|
+
let Value::Map(orig) = &explain else {
|
|
29
|
+
return;
|
|
30
|
+
};
|
|
31
|
+
if let Value::Map(cleaned) = crate::utility::clean::clean_util(ctx, &explain) {
|
|
32
|
+
if !Rc::ptr_eq(orig, &cleaned) {
|
|
33
|
+
let entries = cleaned.borrow().clone();
|
|
34
|
+
*orig.borrow_mut() = entries;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// explain.result is a to_value snapshot, never the live result.
|
|
38
|
+
if let Value::Map(_) = getp(&explain, "result") {
|
|
39
|
+
vs::del_prop(to_map(&getp(&explain, "result")), &Value::str("err"));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -46,6 +46,8 @@ pub fn make_error_util(
|
|
|
46
46
|
None => Value::Noval,
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
+
crate::utility::done::clean_explain_util(ctx);
|
|
50
|
+
|
|
49
51
|
let ctrl = ctx.ctrl.borrow().clone();
|
|
50
52
|
{
|
|
51
53
|
let c = ctrl.borrow();
|
|
@@ -59,7 +61,8 @@ pub fn make_error_util(
|
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
let mut sdk_err = ProjectNameError::new("", &msg);
|
|
62
|
-
|
|
64
|
+
// A hook's own error supplies the code as well as the message.
|
|
65
|
+
sdk_err.code = crate::utility::clean::clean_str(ctx, &err.code);
|
|
63
66
|
sdk_err.result = crate::utility::clean::clean_util(ctx, &result.borrow().to_value());
|
|
64
67
|
sdk_err.spec = crate::utility::clean::clean_util(ctx, &spec_val);
|
|
65
68
|
|
|
@@ -2,6 +2,7 @@ use std::rc::Rc;
|
|
|
2
2
|
|
|
3
3
|
use crate::core::context::Context;
|
|
4
4
|
use crate::core::helpers::{get_str, getp, getpath, ja, jo, setp, to_map};
|
|
5
|
+
use crate::utility::clean;
|
|
5
6
|
use crate::utility::voxgigstruct as vs;
|
|
6
7
|
use crate::utility::voxgigstruct::Value;
|
|
7
8
|
|
|
@@ -58,6 +59,26 @@ pub fn make_options_util(ctx: &Rc<Context>) -> Value {
|
|
|
58
59
|
|
|
59
60
|
let optspec = crate::core::schema::optspec();
|
|
60
61
|
|
|
62
|
+
// The secret registry exists BEFORE validation, fed from the raw input.
|
|
63
|
+
// Its block is Rc-shared: what is registered into `cleanopts` here is
|
|
64
|
+
// what `opts.__derived__.clean` carries out below.
|
|
65
|
+
let cleancfg = clean::make_clean_config(&vs::merge(
|
|
66
|
+
&ja(vec![
|
|
67
|
+
Value::empty_map(),
|
|
68
|
+
vs::clone(&getp(&optspec, "clean")),
|
|
69
|
+
clean_block(&cfgopts),
|
|
70
|
+
clean_block(&opts),
|
|
71
|
+
]),
|
|
72
|
+
None,
|
|
73
|
+
));
|
|
74
|
+
let cleanopts = jo(vec![("__derived__", jo(vec![("clean", cleancfg.clone())]))]);
|
|
75
|
+
clean::clean_add_sensitive_opts(&cleanopts, &without(&opts, &["clean"]));
|
|
76
|
+
for src in [&cfgopts, &opts] {
|
|
77
|
+
for value in clean::splitvalues(&getpath(&["clean", "values"], src)) {
|
|
78
|
+
clean::clean_add_opts(&cleanopts, &value);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
61
82
|
// Preserve system.fetch before merge/validate (validation strips it).
|
|
62
83
|
let sys_fetch = getpath(&["system", "fetch"], &opts);
|
|
63
84
|
|
|
@@ -145,19 +166,6 @@ pub fn make_options_util(ctx: &Rc<Context>) -> Value {
|
|
|
145
166
|
}
|
|
146
167
|
}
|
|
147
168
|
|
|
148
|
-
let clean_keys = match getpath(&["clean", "keys"], &opts) {
|
|
149
|
-
Value::Str(s) => s,
|
|
150
|
-
_ => "key,token,id".to_string(),
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
let filtered: Vec<String> = clean_keys
|
|
154
|
-
.split(',')
|
|
155
|
-
.map(|p| p.trim())
|
|
156
|
-
.filter(|p| !p.is_empty())
|
|
157
|
-
.map(|p| vs::esc_re(&Value::str(p)))
|
|
158
|
-
.collect();
|
|
159
|
-
let keyre = filtered.join("|");
|
|
160
|
-
|
|
161
169
|
// Resolve the feature add-order: an explicit List order (above) wins;
|
|
162
170
|
// otherwise order the map test-first, then the remaining names sorted, so
|
|
163
171
|
// the outcome is deterministic and `test` is always the base transport.
|
|
@@ -188,20 +196,66 @@ pub fn make_options_util(ctx: &Rc<Context>) -> Value {
|
|
|
188
196
|
let order_list =
|
|
189
197
|
Value::list(feature_order.into_iter().map(|n| Value::str(n)).collect());
|
|
190
198
|
|
|
191
|
-
let derived_clean = if keyre.is_empty() {
|
|
192
|
-
Value::empty_map()
|
|
193
|
-
} else {
|
|
194
|
-
jo(vec![("keyre", Value::str(keyre))])
|
|
195
|
-
};
|
|
196
199
|
setp(
|
|
197
200
|
&opts,
|
|
198
201
|
"__derived__",
|
|
199
|
-
jo(vec![("clean",
|
|
202
|
+
jo(vec![("clean", cleancfg), ("featureorder", order_list)]),
|
|
200
203
|
);
|
|
201
204
|
|
|
205
|
+
// Again over the merged result: the config's own defaults can carry one.
|
|
206
|
+
clean::clean_add_sensitive_opts(&opts, &without(&opts, &["clean", "__derived__"]));
|
|
207
|
+
|
|
202
208
|
opts
|
|
203
209
|
}
|
|
204
210
|
|
|
211
|
+
// A copy of the clean block, or an empty one: merge lets a missing value
|
|
212
|
+
// replace everything merged before it, schema defaults included.
|
|
213
|
+
fn clean_block(opts: &Value) -> Value {
|
|
214
|
+
match getp(opts, "clean") {
|
|
215
|
+
Value::Map(_) => vs::clone(&getp(opts, "clean")),
|
|
216
|
+
_ => Value::empty_map(),
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// The options to scan for secrets. The feature map is keyed by feature
|
|
221
|
+
// names, not field names, so it is scanned as a list: `secrets` must not
|
|
222
|
+
// make every setting of that feature a secret. Entity blocks hold entity
|
|
223
|
+
// settings and seeded records, never a credential, so none is scanned.
|
|
224
|
+
fn without(val: &Value, keys: &[&str]) -> Value {
|
|
225
|
+
let out = Value::empty_map();
|
|
226
|
+
if let Value::Map(m) = val {
|
|
227
|
+
for (k, v) in m.borrow().iter() {
|
|
228
|
+
if "entity" == k.as_str() || keys.contains(&k.as_str()) {
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
let v = match (k.as_str(), v) {
|
|
232
|
+
("feature", Value::Map(fm)) => {
|
|
233
|
+
Value::list(fm.borrow().iter().map(|(_, fv)| noentity(fv)).collect())
|
|
234
|
+
}
|
|
235
|
+
("test", _) => noentity(v),
|
|
236
|
+
_ => v.clone(),
|
|
237
|
+
};
|
|
238
|
+
setp(&out, k, v);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
out
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
fn noentity(val: &Value) -> Value {
|
|
245
|
+
match val {
|
|
246
|
+
Value::Map(m) => {
|
|
247
|
+
let out = Value::empty_map();
|
|
248
|
+
for (k, v) in m.borrow().iter() {
|
|
249
|
+
if "entity" != k.as_str() {
|
|
250
|
+
setp(&out, k, v.clone());
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
out
|
|
254
|
+
}
|
|
255
|
+
_ => val.clone(),
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
205
259
|
/// Read a string option (helper shared by prepare utilities).
|
|
206
260
|
pub fn opt_str(options: &Value, key: &str) -> String {
|
|
207
261
|
get_str(options, key).unwrap_or_default()
|
|
@@ -15,11 +15,13 @@ build:
|
|
|
15
15
|
#
|
|
16
16
|
# Main classes are NAMED here rather than globbed, so a per-feature suite has
|
|
17
17
|
# to be listed. SecretsTestMain drives the feature through the `extend` seam
|
|
18
|
-
# and so runs in every scala SDK, model-activated or not.
|
|
18
|
+
# and so runs in every scala SDK, model-activated or not. SdkCleanTestMain is
|
|
19
|
+
# the canary sweep: no credential leaves the SDK in any form.
|
|
19
20
|
test:
|
|
20
21
|
scala-cli run . --main-class OmniSmoke
|
|
21
22
|
scala-cli run . --main-class SdkTestMain
|
|
22
23
|
scala-cli run . --main-class SdkEntityTestMain
|
|
24
|
+
scala-cli run . --main-class SdkCleanTestMain
|
|
23
25
|
scala-cli run . --main-class SecretsTestMain
|
|
24
26
|
scala-cli run . --main-class Runner -- ../.sdk/test/test.json
|
|
25
27
|
scala-cli run . --main-class PrimaryCorpusMain -- ../.sdk/test/test.json
|
|
@@ -158,4 +158,20 @@ class Context(ctxmap: JMap[String, Object], basectx: Context) {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
def makeError(code: String, msg: String): SdkError = new SdkError(code, msg, this)
|
|
161
|
+
|
|
162
|
+
// The serialised context leaves the pipeline (a logger, an error dump), so
|
|
163
|
+
// it is cleaned; the live fields stay raw for the pipeline's own use.
|
|
164
|
+
def toMap(): Object = {
|
|
165
|
+
val record = new LinkedHashMap[String, Object]()
|
|
166
|
+
record.put("id", id)
|
|
167
|
+
record.put("op", op)
|
|
168
|
+
record.put("spec", spec)
|
|
169
|
+
record.put("entity", entity)
|
|
170
|
+
record.put("result", result)
|
|
171
|
+
record.put("response", response)
|
|
172
|
+
record.put("meta", meta)
|
|
173
|
+
if (utility == null || utility.clean == null) record else utility.clean(this, record)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
override def toString: String = "Context " + Struct.jsonify(toMap())
|
|
161
177
|
}
|
|
@@ -2,6 +2,7 @@ package SCALAPACKAGE.core
|
|
|
2
2
|
|
|
3
3
|
import java.util.{ArrayList, LinkedHashMap, List => JList, Map => JMap}
|
|
4
4
|
import java.util.function.Supplier
|
|
5
|
+
import scala.util.control.NonFatal
|
|
5
6
|
import SCALAPACKAGE.utility.struct.Struct
|
|
6
7
|
|
|
7
8
|
// Shared client runtime for the ProjectName SDK. The generated
|
|
@@ -76,6 +77,9 @@ abstract class SdkClient(options0: JMap[String, Object]) {
|
|
|
76
77
|
this.utility.featureHook(this.rootctx, "PostConstruct")
|
|
77
78
|
}
|
|
78
79
|
|
|
80
|
+
// The options hold the credential; a printed client shows only its name.
|
|
81
|
+
override def toString: String = this.getClass.getSimpleName + "(mode=" + this.mode + ")"
|
|
82
|
+
|
|
79
83
|
def optionsMap(): JMap[String, Object] = Struct.clone(this.options) match {
|
|
80
84
|
case m: JMap[_, _] => m.asInstanceOf[JMap[String, Object]]
|
|
81
85
|
case _ => new LinkedHashMap[String, Object]()
|
|
@@ -241,15 +245,15 @@ abstract class SdkClient(options0: JMap[String, Object]) {
|
|
|
241
245
|
|
|
242
246
|
val fetchdef =
|
|
243
247
|
try this.prepare(fetchargs)
|
|
244
|
-
catch { case err
|
|
245
|
-
out.put("ok", java.lang.Boolean.FALSE); out.put("err", err); return out
|
|
248
|
+
catch { case NonFatal(err) =>
|
|
249
|
+
out.put("ok", java.lang.Boolean.FALSE); out.put("err", cleanErr(ctx, err)); return out
|
|
246
250
|
}
|
|
247
251
|
|
|
248
252
|
val url = fetchdef.get("url")
|
|
249
253
|
val fetched =
|
|
250
254
|
try utility.fetcher(ctx, url match { case s: String => s; case _ => "" }, fetchdef)
|
|
251
|
-
catch { case err
|
|
252
|
-
out.put("ok", java.lang.Boolean.FALSE); out.put("err", err); return out
|
|
255
|
+
catch { case NonFatal(err) =>
|
|
256
|
+
out.put("ok", java.lang.Boolean.FALSE); out.put("err", cleanErr(ctx, err)); return out
|
|
253
257
|
}
|
|
254
258
|
|
|
255
259
|
if (fetched == null) {
|
|
@@ -292,6 +296,12 @@ abstract class SdkClient(options0: JMap[String, Object]) {
|
|
|
292
296
|
out
|
|
293
297
|
}
|
|
294
298
|
}
|
|
299
|
+
|
|
300
|
+
// A raw request returns its error rather than passing it through makeError.
|
|
301
|
+
private def cleanErr(ctx: Context, err: Throwable): Object = this.utility.clean(ctx, err) match {
|
|
302
|
+
case t: Throwable => t
|
|
303
|
+
case _ => err
|
|
304
|
+
}
|
|
295
305
|
}
|
|
296
306
|
|
|
297
307
|
object SdkClient {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
package SCALAPACKAGE.core
|
|
2
2
|
|
|
3
|
+
import java.util.{LinkedHashMap, Map => JMap}
|
|
4
|
+
import SCALAPACKAGE.utility.struct.Struct
|
|
5
|
+
|
|
3
6
|
// ProjectName SDK error. Carries the SDK error code, the operation context,
|
|
4
7
|
// and cleaned copies of the result and spec at failure time.
|
|
5
8
|
class SdkError(code0: String, msg0: String, ctx0: Context) extends RuntimeException(msg0) {
|
|
@@ -7,9 +10,34 @@ class SdkError(code0: String, msg0: String, ctx0: Context) extends RuntimeExcept
|
|
|
7
10
|
val sdk: String = "ProjectName"
|
|
8
11
|
var code: String = if (code0 == null) "" else code0
|
|
9
12
|
var msg: String = msg0
|
|
13
|
+
|
|
14
|
+
// The HTTP status when there was a response, -1 otherwise.
|
|
15
|
+
var status: Int = -1
|
|
16
|
+
|
|
17
|
+
// Reachable for a debugger, out of every serialisation: the context holds
|
|
18
|
+
// the live spec and options, and an error is what gets logged.
|
|
10
19
|
@transient var ctx: Context = ctx0
|
|
11
20
|
@transient var result: Object = null
|
|
12
21
|
@transient var spec: Object = null
|
|
13
22
|
|
|
23
|
+
def notFound: Boolean = 404 == this.status
|
|
24
|
+
|
|
14
25
|
override def getMessage: String = this.msg
|
|
26
|
+
|
|
27
|
+
// What makeError attached is already cleaned; the context is not part of
|
|
28
|
+
// the record.
|
|
29
|
+
def toMap(): JMap[String, Object] = {
|
|
30
|
+
val out = new LinkedHashMap[String, Object]()
|
|
31
|
+
out.put("sdk", this.sdk)
|
|
32
|
+
out.put("code", this.code)
|
|
33
|
+
out.put("message", this.msg)
|
|
34
|
+
out.put("status", java.lang.Integer.valueOf(this.status))
|
|
35
|
+
out.put("result", this.result)
|
|
36
|
+
out.put("spec", this.spec)
|
|
37
|
+
out
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
def toJson(): String = Struct.jsonify(this.toMap())
|
|
41
|
+
|
|
42
|
+
override def toString: String = "ProjectNameError " + this.toJson()
|
|
15
43
|
}
|
|
@@ -15,6 +15,9 @@ type FetcherFn = (Context, String, JMap[String, Object]) => Object
|
|
|
15
15
|
// clean(ctx, val) -> val
|
|
16
16
|
type CleanFn = (Context, Object) => Object
|
|
17
17
|
|
|
18
|
+
// cleanAdd(ctx, value): registers a secret the SDK handles
|
|
19
|
+
type CleanAddFn = (Context, Object) => Unit
|
|
20
|
+
|
|
18
21
|
// makeError(ctx, err) -> value (throws, or returns fallback)
|
|
19
22
|
type MakeErrorFn = (Context, RuntimeException) => Object
|
|
20
23
|
|
|
@@ -8,6 +8,7 @@ import java.util.{LinkedHashMap, Map => JMap}
|
|
|
8
8
|
class Utility private (noregister: Boolean) {
|
|
9
9
|
|
|
10
10
|
var clean: CleanFn = null
|
|
11
|
+
var cleanAdd: CleanAddFn = null
|
|
11
12
|
var done: CtxFn[Object] = null
|
|
12
13
|
var makeError: MakeErrorFn = null
|
|
13
14
|
var featureAdd: FeatureFn = null
|
|
@@ -53,6 +54,7 @@ class Utility private (noregister: Boolean) {
|
|
|
53
54
|
def copy(): Utility = {
|
|
54
55
|
val u = new Utility(true)
|
|
55
56
|
u.clean = this.clean
|
|
57
|
+
u.cleanAdd = this.cleanAdd
|
|
56
58
|
u.done = this.done
|
|
57
59
|
u.makeError = this.makeError
|
|
58
60
|
u.featureAdd = this.featureAdd
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
package SCALAPACKAGE.feature
|
|
2
2
|
|
|
3
3
|
import java.util.{ArrayList, LinkedHashMap, List => JList, Map => JMap}
|
|
4
|
-
import SCALAPACKAGE.core.{Context, SdkClient}
|
|
4
|
+
import SCALAPACKAGE.core.{Context, Helpers, SdkClient}
|
|
5
5
|
|
|
6
6
|
// Audit trail. Emits a structured record for every operation — who (actor),
|
|
7
7
|
// what (entity + op), the outcome, and a correlation id — suitable for
|
|
@@ -74,17 +74,23 @@ class AuditFeature extends BaseFeature("audit", "0.0.1", true) {
|
|
|
74
74
|
opname = ctx.op.name
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
val
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
val raw = new LinkedHashMap[String, Object]()
|
|
78
|
+
raw.put("seq", java.lang.Integer.valueOf(this.seq))
|
|
79
|
+
raw.put("ts", java.lang.Long.valueOf(FeatureOptions.foptNow(this.options).getAsLong()))
|
|
80
|
+
raw.put("actor", actor)
|
|
81
|
+
raw.put("entity", entity)
|
|
82
|
+
raw.put("op", opname)
|
|
83
|
+
raw.put("outcome", outcome)
|
|
84
|
+
raw.put("correlationId", ctx.id)
|
|
85
85
|
if (ctx.result != null) {
|
|
86
|
-
|
|
86
|
+
raw.put("status", java.lang.Integer.valueOf(ctx.result.status))
|
|
87
87
|
}
|
|
88
|
+
val record =
|
|
89
|
+
if (ctx.utility == null || ctx.utility.clean == null) raw
|
|
90
|
+
else {
|
|
91
|
+
val out = Helpers.toMapAny(ctx.utility.clean(ctx, raw))
|
|
92
|
+
if (out == null) raw else out
|
|
93
|
+
}
|
|
88
94
|
|
|
89
95
|
this.records.add(record)
|
|
90
96
|
val max = FeatureOptions.foptInt(this.options, "max", 1000)
|
|
@@ -266,15 +266,20 @@ class CostFeature extends BaseFeature("cost", "0.0.1", true) {
|
|
|
266
266
|
bump(this.ops, entity + "." + opname, amount)
|
|
267
267
|
bump(this.actors, actor, amount)
|
|
268
268
|
|
|
269
|
+
// The record leaves through `last` and the sink, so its text is cleaned.
|
|
270
|
+
def cs(s: String): String =
|
|
271
|
+
if (ctx.utility == null || ctx.utility.clean == null) s
|
|
272
|
+
else String.valueOf(ctx.utility.clean(ctx, s))
|
|
273
|
+
|
|
269
274
|
this.seq += 1
|
|
270
275
|
val record = new CostRecord()
|
|
271
276
|
record.seq = this.seq
|
|
272
|
-
record.entity = entity
|
|
273
|
-
record.op = opname
|
|
274
|
-
record.actor = actor
|
|
277
|
+
record.entity = cs(entity)
|
|
278
|
+
record.op = cs(opname)
|
|
279
|
+
record.actor = cs(actor)
|
|
275
280
|
record.amount = amount
|
|
276
|
-
record.currency = this.currency
|
|
277
|
-
record.source = source
|
|
281
|
+
record.currency = cs(this.currency)
|
|
282
|
+
record.source = cs(source)
|
|
278
283
|
record.attempts = pending.attempts
|
|
279
284
|
this.last = record
|
|
280
285
|
|
|
@@ -19,10 +19,6 @@ class DebugFeature extends BaseFeature("debug", "0.0.1", true) {
|
|
|
19
19
|
|
|
20
20
|
private val DEBUG_ENTRY_KEY = "debug_entry"
|
|
21
21
|
|
|
22
|
-
private val DEFAULT_REDACT: JList[String] = java.util.List.of(
|
|
23
|
-
"authorization", "cookie", "set-cookie", "api-key", "apikey",
|
|
24
|
-
"x-api-key", "idempotency-key")
|
|
25
|
-
|
|
26
22
|
override def init(ctx: Context, options: JMap[String, Object]): Unit = {
|
|
27
23
|
this.client = ctx.client
|
|
28
24
|
this.options = options
|
|
@@ -51,7 +47,7 @@ class DebugFeature extends BaseFeature("debug", "0.0.1", true) {
|
|
|
51
47
|
} else {
|
|
52
48
|
entry.put("url", ctx.spec.path)
|
|
53
49
|
}
|
|
54
|
-
entry.put("headers", redact(ctx.spec.headers))
|
|
50
|
+
entry.put("headers", redact(ctx, ctx.spec.headers))
|
|
55
51
|
}
|
|
56
52
|
ctx.out.put(DEBUG_ENTRY_KEY, entry)
|
|
57
53
|
}
|
|
@@ -88,7 +84,7 @@ class DebugFeature extends BaseFeature("debug", "0.0.1", true) {
|
|
|
88
84
|
|
|
89
85
|
private def finish(ctx: Context, ok: Boolean): Unit = {
|
|
90
86
|
// Finish once per operation: the marker in ctx.out is consumed here.
|
|
91
|
-
|
|
87
|
+
var entry = Helpers.toMapAny(ctx.out.get(DEBUG_ENTRY_KEY))
|
|
92
88
|
if (entry == null) {
|
|
93
89
|
return
|
|
94
90
|
}
|
|
@@ -105,6 +101,11 @@ class DebugFeature extends BaseFeature("debug", "0.0.1", true) {
|
|
|
105
101
|
entry.put("status", java.lang.Integer.valueOf(ctx.result.status))
|
|
106
102
|
}
|
|
107
103
|
|
|
104
|
+
// The whole entry leaves through the buffer and the callback: the url
|
|
105
|
+
// and the error message can carry a query credential the header mask
|
|
106
|
+
// above never saw.
|
|
107
|
+
entry = cleaned(ctx, entry)
|
|
108
|
+
|
|
108
109
|
this.entries.add(entry)
|
|
109
110
|
val max = FeatureOptions.foptInt(this.options, "max", 100)
|
|
110
111
|
while (this.entries.size() > max) {
|
|
@@ -118,32 +119,34 @@ class DebugFeature extends BaseFeature("debug", "0.0.1", true) {
|
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
private def
|
|
122
|
+
private def cleaned(ctx: Context, m: JMap[String, Object]): JMap[String, Object] = {
|
|
123
|
+
if (ctx.utility == null || ctx.utility.clean == null) return m
|
|
124
|
+
val out = Helpers.toMapAny(ctx.utility.clean(ctx, m))
|
|
125
|
+
if (out == null) m else out
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// The core clean rules apply (clean.keys, every registered value); the
|
|
129
|
+
// feature's own `redact` list ADDS header names on top of them.
|
|
130
|
+
private def redact(ctx: Context, headers: JMap[String, Object]): JMap[String, Object] = {
|
|
122
131
|
val out = new LinkedHashMap[String, Object]()
|
|
123
132
|
if (headers == null) {
|
|
124
133
|
return out
|
|
125
134
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
135
|
+
val patterns = new ArrayList[String]()
|
|
136
|
+
val listed = FeatureOptions.foptStrList(this.options, "redact")
|
|
137
|
+
if (listed != null) {
|
|
138
|
+
val pit = listed.iterator()
|
|
139
|
+
while (pit.hasNext) patterns.add(pit.next().toLowerCase())
|
|
129
140
|
}
|
|
130
141
|
val it = headers.entrySet().iterator()
|
|
131
142
|
while (it.hasNext) {
|
|
132
143
|
val h = it.next()
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
while (!masked && pit.hasNext) {
|
|
136
|
-
val p = pit.next()
|
|
137
|
-
if (h.getKey.toLowerCase().equals(p)) {
|
|
138
|
-
masked = true
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (masked) {
|
|
142
|
-
out.put(h.getKey, "<redacted>")
|
|
144
|
+
if (patterns.contains(h.getKey.toLowerCase())) {
|
|
145
|
+
out.put(h.getKey, "[redacted]")
|
|
143
146
|
} else {
|
|
144
147
|
out.put(h.getKey, h.getValue)
|
|
145
148
|
}
|
|
146
149
|
}
|
|
147
|
-
out
|
|
150
|
+
cleaned(ctx, out)
|
|
148
151
|
}
|
|
149
152
|
}
|
|
@@ -54,11 +54,16 @@ class LogFeature extends BaseFeature("log", "0.0.1", true) {
|
|
|
54
54
|
if (ctx.op != null) msg.append(" op=").append(ctx.op.name)
|
|
55
55
|
if (ctx.spec != null) msg.append(" spec=").append(ctx.spec.method).append(" ").append(ctx.spec.path)
|
|
56
56
|
|
|
57
|
+
// A log line leaves the pipeline, so it carries the cleaned text.
|
|
58
|
+
val line =
|
|
59
|
+
if (ctx.utility == null || ctx.utility.clean == null) msg.toString
|
|
60
|
+
else String.valueOf(ctx.utility.clean(ctx, msg.toString))
|
|
61
|
+
|
|
57
62
|
level match {
|
|
58
|
-
case "debug" => this.logger.fine(
|
|
59
|
-
case "warn" => this.logger.warning(
|
|
60
|
-
case "error" => this.logger.severe(
|
|
61
|
-
case _ => this.logger.info(
|
|
63
|
+
case "debug" => this.logger.fine(line)
|
|
64
|
+
case "warn" => this.logger.warning(line)
|
|
65
|
+
case "error" => this.logger.severe(line)
|
|
66
|
+
case _ => this.logger.info(line)
|
|
62
67
|
}
|
|
63
68
|
}
|
|
64
69
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package SCALAPACKAGE.feature
|
|
2
2
|
|
|
3
3
|
import java.util.{ArrayList, LinkedHashMap, List => JList, Map => JMap}
|
|
4
|
+
import java.net.URI
|
|
4
5
|
import java.util.regex.{Matcher, Pattern}
|
|
5
6
|
import SCALAPACKAGE.core.{Context, FetcherFn, SdkClient}
|
|
6
7
|
|
|
@@ -21,6 +22,8 @@ class ProxyFeature extends BaseFeature("proxy", "0.0.1", true) {
|
|
|
21
22
|
var routed: Int = 0
|
|
22
23
|
var url: String = ""
|
|
23
24
|
|
|
25
|
+
private var target: String = ""
|
|
26
|
+
|
|
24
27
|
private val HOST_RE: Pattern =
|
|
25
28
|
Pattern.compile("^[a-z]+://([^/:]+)", Pattern.CASE_INSENSITIVE)
|
|
26
29
|
|
|
@@ -59,18 +62,36 @@ class ProxyFeature extends BaseFeature("proxy", "0.0.1", true) {
|
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
64
|
|
|
65
|
+
// A proxy URL may carry credentials as userinfo, from the option or the
|
|
66
|
+
// environment, and neither is under a sensitive key name. The transport
|
|
67
|
+
// is handed the raw target; the activity record shows the cleaned one.
|
|
68
|
+
this.target = this.url
|
|
69
|
+
if (!"".equals(this.url) && ctx.utility != null) {
|
|
70
|
+
try {
|
|
71
|
+
val parsed = new URI(this.url)
|
|
72
|
+
for (info <- List(parsed.getRawUserInfo, parsed.getUserInfo)) {
|
|
73
|
+
if (info != null && !"".equals(info)) {
|
|
74
|
+
for (part <- info.split(":", 2)) {
|
|
75
|
+
if (!"".equals(part)) ctx.utility.cleanAdd(ctx, part)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
} catch { case _: RuntimeException => }
|
|
80
|
+
this.url = String.valueOf(ctx.utility.clean(ctx, this.url))
|
|
81
|
+
}
|
|
82
|
+
|
|
62
83
|
val inner: FetcherFn = ctx.utility.fetcher
|
|
63
84
|
|
|
64
85
|
ctx.utility.fetcher = (ctx2, u, fetchdef) => inner(ctx2, u, route(u, fetchdef))
|
|
65
86
|
}
|
|
66
87
|
|
|
67
88
|
private def route(u: String, fetchdef: JMap[String, Object]): JMap[String, Object] = {
|
|
68
|
-
if ("".equals(this.
|
|
89
|
+
if ("".equals(this.target) || bypass(u)) {
|
|
69
90
|
return fetchdef
|
|
70
91
|
}
|
|
71
92
|
|
|
72
93
|
val out = new LinkedHashMap[String, Object](fetchdef)
|
|
73
|
-
out.put("proxy", this.
|
|
94
|
+
out.put("proxy", this.target)
|
|
74
95
|
|
|
75
96
|
this.routed += 1
|
|
76
97
|
out
|
|
@@ -64,6 +64,16 @@ class SecretsFeature extends BaseFeature("secrets", "0.1.0", true) {
|
|
|
64
64
|
|
|
65
65
|
private var client: SdkClient = null
|
|
66
66
|
|
|
67
|
+
// Every value this feature resolves or buys is a secret the SDK handles,
|
|
68
|
+
// and none arrives under an option key the intake registration saw.
|
|
69
|
+
private def register(value: Object): Unit = {
|
|
70
|
+
if (this.client == null) return
|
|
71
|
+
val ctx = this.client.getRootCtx()
|
|
72
|
+
if (ctx != null && ctx.utility != null && ctx.utility.cleanAdd != null) {
|
|
73
|
+
ctx.utility.cleanAdd(ctx, value)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
67
77
|
// The LIVE options map (root ctx options). READ ONLY: this feature never
|
|
68
78
|
// writes it - see the class note.
|
|
69
79
|
private var liveopts: JMap[String, Object] = null
|
|
@@ -171,6 +181,7 @@ class SecretsFeature extends BaseFeature("secrets", "0.1.0", true) {
|
|
|
171
181
|
val entries = ListBuffer.empty[Any]
|
|
172
182
|
|
|
173
183
|
if ("" != explicit) {
|
|
184
|
+
register(explicit)
|
|
174
185
|
try
|
|
175
186
|
entries += ProviderSpec(
|
|
176
187
|
kind = "memory",
|
|
@@ -291,6 +302,7 @@ class SecretsFeature extends BaseFeature("secrets", "0.1.0", true) {
|
|
|
291
302
|
// tryget returns None for a MISS and RAISES for an ERROR. That is the
|
|
292
303
|
// whole miss-vs-error rule, and it is sekreto's, not this feature's.
|
|
293
304
|
val found = this.sek.tryget(this.secretname)
|
|
305
|
+
register(found.orNull)
|
|
294
306
|
|
|
295
307
|
if (!this.xactive) {
|
|
296
308
|
// An UNCACHED miss after an earlier hit is a revocation: the chain now
|
|
@@ -439,6 +451,7 @@ class SecretsFeature extends BaseFeature("secrets", "0.1.0", true) {
|
|
|
439
451
|
// required server variable, for the same reason.
|
|
440
452
|
if ("live" != this.client.mode) {
|
|
441
453
|
this.cred = "test-" + this.xresponse
|
|
454
|
+
register(this.cred)
|
|
442
455
|
return this.cred
|
|
443
456
|
}
|
|
444
457
|
|
|
@@ -503,6 +516,7 @@ class SecretsFeature extends BaseFeature("secrets", "0.1.0", true) {
|
|
|
503
516
|
"' field from " + url)
|
|
504
517
|
}
|
|
505
518
|
|
|
519
|
+
register(token)
|
|
506
520
|
this.cred = token
|
|
507
521
|
token
|
|
508
522
|
}
|
|
@@ -101,12 +101,19 @@ class TelemetryFeature extends BaseFeature("telemetry", "0.0.1", true) {
|
|
|
101
101
|
span.put("durationMs", java.lang.Long.valueOf(dur))
|
|
102
102
|
span.put("ok", java.lang.Boolean.valueOf(ok))
|
|
103
103
|
|
|
104
|
+
val out =
|
|
105
|
+
if (ctx.utility == null || ctx.utility.clean == null) span
|
|
106
|
+
else {
|
|
107
|
+
val c = Helpers.toMapAny(ctx.utility.clean(ctx, span))
|
|
108
|
+
if (c == null) span else c
|
|
109
|
+
}
|
|
110
|
+
|
|
104
111
|
this.activeSpans -= 1
|
|
105
|
-
this.spans.add(
|
|
112
|
+
this.spans.add(out)
|
|
106
113
|
|
|
107
114
|
this.options.get("exporter") match {
|
|
108
115
|
case c: java.util.function.Consumer[_] =>
|
|
109
|
-
c.asInstanceOf[java.util.function.Consumer[JMap[String, Object]]].accept(
|
|
116
|
+
c.asInstanceOf[java.util.function.Consumer[JMap[String, Object]]].accept(out)
|
|
110
117
|
case _ =>
|
|
111
118
|
}
|
|
112
119
|
}
|