@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
|
@@ -46,20 +46,23 @@ def make_error_util(ctx, err):
|
|
|
46
46
|
|
|
47
47
|
spec = ctx.spec
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
sdk_err = ProjectNameError(
|
|
50
|
+
err.code if isinstance(err, ProjectNameError) else "", msg, ctx)
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
# The context stays reachable for a debugger (a slot on the error), and
|
|
53
|
+
# the error itself is cleaned in place; result and spec are cleaned
|
|
54
|
+
# COPIES, so masking them cannot mask the pipeline's own objects.
|
|
55
|
+
ctx.utility.clean(ctx, sdk_err)
|
|
53
56
|
sdk_err.result = ctx.utility.clean(ctx, result)
|
|
54
57
|
sdk_err.spec = ctx.utility.clean(ctx, spec)
|
|
55
58
|
|
|
59
|
+
if ctx.ctrl.explain is not None:
|
|
60
|
+
ctx.ctrl.explain["err"] = {"message": msg}
|
|
61
|
+
|
|
56
62
|
# Promote the HTTP status to the top level, so a consumer can branch on
|
|
57
63
|
# `err.status` / `err.not_found` instead of reaching into `err.result`.
|
|
58
64
|
sdk_err.status = -1 if result.status is None else result.status
|
|
59
65
|
|
|
60
|
-
if isinstance(err, ProjectNameError):
|
|
61
|
-
sdk_err.code = err.code
|
|
62
|
-
|
|
63
66
|
ctx.ctrl.err = sdk_err
|
|
64
67
|
|
|
65
68
|
# Fire PreUnexpected so observability features (metrics, telemetry, audit,
|
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from projectname_sdk.utility.voxgig_struct import voxgig_struct as vs
|
|
5
5
|
from projectname_sdk.schema import OPTSPEC
|
|
6
|
+
from projectname_sdk.utility.clean import (
|
|
7
|
+
clean_util, clean_add_util, clean_add_sensitive, make_clean_config, split_values)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# A context carrying only the derived clean block, for the registry that
|
|
11
|
+
# exists before the real options do.
|
|
12
|
+
class _CleanCtx:
|
|
13
|
+
def __init__(self, cleancfg):
|
|
14
|
+
self.options = {"__derived__": {"clean": cleancfg}}
|
|
6
15
|
|
|
7
16
|
|
|
8
17
|
|
|
@@ -83,6 +92,24 @@ def make_options_util(ctx):
|
|
|
83
92
|
if not isinstance(opts, dict):
|
|
84
93
|
opts = {}
|
|
85
94
|
|
|
95
|
+
config = ctx.config or {}
|
|
96
|
+
cfgopts = {}
|
|
97
|
+
co = config.get("options") if isinstance(config, dict) else None
|
|
98
|
+
if isinstance(co, dict):
|
|
99
|
+
cfgopts = co
|
|
100
|
+
|
|
101
|
+
# The secret registry exists BEFORE validation, fed from the raw input,
|
|
102
|
+
# so the constructor's own rejection of a mistyped credential is clean
|
|
103
|
+
# too.
|
|
104
|
+
cfgclean = cfgopts.get("clean") if isinstance(cfgopts.get("clean"), dict) else {}
|
|
105
|
+
rawclean = opts.get("clean") if isinstance(opts.get("clean"), dict) else {}
|
|
106
|
+
cleancfg = make_clean_config(vs.merge([
|
|
107
|
+
{}, vs.clone(OPTSPEC.get("clean")), vs.clone(cfgclean), rawclean]))
|
|
108
|
+
cleanctx = _CleanCtx(cleancfg)
|
|
109
|
+
_clean_add_options(cleanctx, {k: v for k, v in opts.items() if k != "clean"})
|
|
110
|
+
for raw in split_values(cfgclean.get("values")) + split_values(rawclean.get("values")):
|
|
111
|
+
clean_add_util(cleanctx, raw)
|
|
112
|
+
|
|
86
113
|
if authsuppressed:
|
|
87
114
|
opts.pop("auth", None)
|
|
88
115
|
|
|
@@ -106,12 +133,6 @@ def make_options_util(ctx):
|
|
|
106
133
|
featureorder.append(name)
|
|
107
134
|
opts["feature"] = fmap
|
|
108
135
|
|
|
109
|
-
config = ctx.config or {}
|
|
110
|
-
cfgopts = {}
|
|
111
|
-
co = config.get("options") if isinstance(config, dict) else None
|
|
112
|
-
if isinstance(co, dict):
|
|
113
|
-
cfgopts = co
|
|
114
|
-
|
|
115
136
|
# THE OPTION SPEC IS GENERATED, NOT WRITTEN HERE.
|
|
116
137
|
#
|
|
117
138
|
# `schema.OPTSPEC` is built from the model: `main.kit.optspec` for the
|
|
@@ -134,7 +155,12 @@ def make_options_util(ctx):
|
|
|
134
155
|
# nested dicts as merge TARGETS — one instance's options (server, headers,
|
|
135
156
|
# ...) would contaminate every instance constructed after it.
|
|
136
157
|
merged = vs.merge([{}, vs.clone(cfgopts), opts])
|
|
137
|
-
|
|
158
|
+
try:
|
|
159
|
+
validated = vs.validate(merged, optspec)
|
|
160
|
+
except Exception as err:
|
|
161
|
+
# The message quotes the offending value.
|
|
162
|
+
clean_util(cleanctx, err)
|
|
163
|
+
raise
|
|
138
164
|
if not isinstance(validated, dict):
|
|
139
165
|
validated = {}
|
|
140
166
|
opts = validated
|
|
@@ -185,19 +211,6 @@ def make_options_util(ctx):
|
|
|
185
211
|
else:
|
|
186
212
|
opts["system"] = {"fetch": sys_fetch}
|
|
187
213
|
|
|
188
|
-
# Derived clean config.
|
|
189
|
-
clean_keys = "key,token,id"
|
|
190
|
-
ck = vs.getpath(opts, "clean.keys")
|
|
191
|
-
if isinstance(ck, str):
|
|
192
|
-
clean_keys = ck
|
|
193
|
-
|
|
194
|
-
parts = []
|
|
195
|
-
for part in clean_keys.split(","):
|
|
196
|
-
trimmed = part.strip()
|
|
197
|
-
if trimmed != "":
|
|
198
|
-
parts.append(vs.escre(trimmed))
|
|
199
|
-
keyre = "|".join(parts)
|
|
200
|
-
|
|
201
214
|
# Resolve the feature add-order: an explicit list order (above) wins;
|
|
202
215
|
# otherwise order the map test-first, then the remaining names sorted, so
|
|
203
216
|
# the outcome is deterministic and `test` is always the base transport.
|
|
@@ -219,10 +232,36 @@ def make_options_util(ctx):
|
|
|
219
232
|
at = featureorder.index("test") + 1 if "test" in featureorder else 0
|
|
220
233
|
featureorder.insert(at, "station")
|
|
221
234
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
235
|
+
# The clean block stays MUTABLE: features register what they resolve
|
|
236
|
+
# after construction.
|
|
237
|
+
opts["__derived__"] = {
|
|
238
|
+
"clean": cleancfg,
|
|
239
|
+
"featureorder": featureorder,
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
# Again over the merged result: the config's own defaults can carry one.
|
|
243
|
+
_clean_add_options(cleanctx, {
|
|
244
|
+
k: v for k, v in opts.items() if k not in ("clean", "__derived__")})
|
|
227
245
|
|
|
228
246
|
return opts
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
# A feature's name is not a field name: only the sensitive names inside its
|
|
250
|
+
# settings count, so `secrets` does not make every setting a secret. Entity
|
|
251
|
+
# blocks (per-entity settings, seeded records) hold no credential.
|
|
252
|
+
def _clean_add_options(cleanctx, opts):
|
|
253
|
+
top = {k: v for k, v in opts.items() if k not in ("feature", "entity")}
|
|
254
|
+
if "test" in top:
|
|
255
|
+
top["test"] = _no_entity(top["test"])
|
|
256
|
+
clean_add_sensitive(cleanctx, top)
|
|
257
|
+
feature = opts.get("feature")
|
|
258
|
+
blocks = feature.values() if isinstance(feature, dict) else (
|
|
259
|
+
feature if isinstance(feature, list) else [feature])
|
|
260
|
+
for fopts in blocks:
|
|
261
|
+
clean_add_sensitive(cleanctx, _no_entity(fopts))
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def _no_entity(block):
|
|
265
|
+
if isinstance(block, dict):
|
|
266
|
+
return {k: v for k, v in block.items() if k != "entity"}
|
|
267
|
+
return block
|
|
@@ -26,19 +26,25 @@ def make_response_util(ctx):
|
|
|
26
26
|
|
|
27
27
|
spec.step = "response"
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
# A body that is not what it claims (a `json` thunk that raises) is a
|
|
30
|
+
# failed result, not a raw exception out of the pipeline - as in ts.
|
|
31
|
+
try:
|
|
32
|
+
utility.result_basic(ctx)
|
|
33
|
+
utility.result_headers(ctx)
|
|
34
|
+
utility.result_body(ctx)
|
|
35
|
+
|
|
36
|
+
# GraphQL reports failures as a top-level `errors` array under HTTP
|
|
37
|
+
# 200, so result_basic's status check never sees them. Lift them
|
|
38
|
+
# here, before the response transform tries to unwrap data that is
|
|
39
|
+
# not there.
|
|
40
|
+
utility.graphql_errors(ctx)
|
|
41
|
+
|
|
42
|
+
utility.transform_response(ctx)
|
|
43
|
+
|
|
44
|
+
if result.err is None:
|
|
45
|
+
result.ok = True
|
|
46
|
+
except Exception as err:
|
|
47
|
+
result.err = err
|
|
42
48
|
|
|
43
49
|
if ctx.ctrl.explain is not None:
|
|
44
50
|
ctx.ctrl.explain["result"] = result
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
from projectname_sdk.core.utility_type import ProjectNameUtility
|
|
4
4
|
|
|
5
|
-
from projectname_sdk.utility.clean import clean_util
|
|
6
|
-
from projectname_sdk.utility.done import done_util
|
|
5
|
+
from projectname_sdk.utility.clean import clean_util, clean_add_util
|
|
6
|
+
from projectname_sdk.utility.done import done_util, clean_explain_util
|
|
7
7
|
from projectname_sdk.utility.make_error import make_error_util
|
|
8
8
|
from projectname_sdk.utility.feature_add import feature_add_util
|
|
9
9
|
from projectname_sdk.utility.feature_hook import feature_hook_util
|
|
@@ -36,6 +36,8 @@ from projectname_sdk.utility.transform_response import transform_response_util
|
|
|
36
36
|
|
|
37
37
|
def register_all(u):
|
|
38
38
|
u.clean = clean_util
|
|
39
|
+
u.clean_add = clean_add_util
|
|
40
|
+
u.clean_explain = clean_explain_util
|
|
39
41
|
u.done = done_util
|
|
40
42
|
u.make_error = make_error_util
|
|
41
43
|
u.feature_add = feature_add_util
|
|
@@ -20,6 +20,7 @@ from projectname_sdk.core.control import ProjectNameControl
|
|
|
20
20
|
from projectname_sdk.core.error import ProjectNameError
|
|
21
21
|
from projectname_sdk.core.result import ProjectNameResult
|
|
22
22
|
from projectname_sdk.core.spec import ProjectNameSpec
|
|
23
|
+
from projectname_sdk.utility.clean import clean_util, clean_add_util
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
# True when this SDK was generated with the named feature.
|
|
@@ -115,6 +116,9 @@ def build_url(spec):
|
|
|
115
116
|
class _Utility:
|
|
116
117
|
def __init__(self, fetcher):
|
|
117
118
|
self.fetcher = fetcher
|
|
119
|
+
# The real ones: every feature record leaves through clean.
|
|
120
|
+
self.clean = clean_util
|
|
121
|
+
self.clean_add = clean_add_util
|
|
118
122
|
|
|
119
123
|
def param(ctx, name):
|
|
120
124
|
params = ctx.spec.params if ctx.spec is not None else {}
|
|
@@ -572,7 +572,7 @@ class TestDebugFeature:
|
|
|
572
572
|
entries = h.client._debug["entries"]
|
|
573
573
|
assert len(entries) == 1 # ring buffer capped at max
|
|
574
574
|
assert len(seen) == 2
|
|
575
|
-
assert seen[0]["headers"]["authorization"] == "
|
|
575
|
+
assert seen[0]["headers"]["authorization"] == "[redacted]"
|
|
576
576
|
|
|
577
577
|
# Drives netsim as the simulated network: runnable only when this
|
|
578
578
|
# SDK was generated with it (the harness skips absent features).
|
|
@@ -593,7 +593,7 @@ class TestDebugFeature:
|
|
|
593
593
|
"redact": ["x-secret"]}}])
|
|
594
594
|
h.op(op="load", headers={"x-secret": "hide", "x-ok": "show"})
|
|
595
595
|
entry = h.client._debug["entries"][0]
|
|
596
|
-
assert entry["headers"]["x-secret"] == "
|
|
596
|
+
assert entry["headers"]["x-secret"] == "[redacted]"
|
|
597
597
|
assert entry["headers"]["x-ok"] == "show"
|
|
598
598
|
assert entry["durationMs"] == 0
|
|
599
599
|
|
|
@@ -186,6 +186,7 @@ class TestPrimaryUtility:
|
|
|
186
186
|
utility = client._utility
|
|
187
187
|
|
|
188
188
|
assert utility.clean is not None
|
|
189
|
+
assert utility.clean_add is not None
|
|
189
190
|
assert utility.done is not None
|
|
190
191
|
assert utility.make_error is not None
|
|
191
192
|
assert utility.feature_add is not None
|
|
@@ -109,4 +109,32 @@ class ProjectNameContext
|
|
|
109
109
|
def make_error(code, msg)
|
|
110
110
|
ProjectNameError.new(code, msg, self)
|
|
111
111
|
end
|
|
112
|
+
|
|
113
|
+
# The serialised context leaves the pipeline (a logger, an error dump), so
|
|
114
|
+
# it is cleaned; the live fields stay raw for the pipeline's own use.
|
|
115
|
+
def to_h
|
|
116
|
+
record = {
|
|
117
|
+
"id" => @id,
|
|
118
|
+
"op" => @op,
|
|
119
|
+
"spec" => @spec,
|
|
120
|
+
"entity" => @entity,
|
|
121
|
+
"result" => @result,
|
|
122
|
+
"response" => @response,
|
|
123
|
+
"meta" => @meta,
|
|
124
|
+
}
|
|
125
|
+
clean = @utility.respond_to?(:clean) ? @utility.clean : nil
|
|
126
|
+
clean.respond_to?(:call) ? clean.call(self, record) : record
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def to_json(*args)
|
|
130
|
+
to_h.to_json(*args)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def to_s
|
|
134
|
+
"Context " + VoxgigStruct.jsonify(to_h)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def inspect
|
|
138
|
+
to_s
|
|
139
|
+
end
|
|
112
140
|
end
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# ProjectName SDK error
|
|
2
2
|
|
|
3
|
+
require 'json'
|
|
4
|
+
|
|
3
5
|
class ProjectNameError < StandardError
|
|
4
6
|
attr_accessor :is_sdk_error, :sdk, :code, :msg, :ctx, :result, :spec, :status
|
|
5
7
|
|
|
@@ -9,6 +11,9 @@ class ProjectNameError < StandardError
|
|
|
9
11
|
@sdk = "ProjectName"
|
|
10
12
|
@code = code
|
|
11
13
|
@msg = msg
|
|
14
|
+
# Reachable for a debugger, absent from every serialiser below: the
|
|
15
|
+
# context holds the live spec and options, and an error is what gets
|
|
16
|
+
# logged.
|
|
12
17
|
@ctx = ctx
|
|
13
18
|
@result = nil
|
|
14
19
|
@spec = nil
|
|
@@ -26,4 +31,29 @@ class ProjectNameError < StandardError
|
|
|
26
31
|
def to_s
|
|
27
32
|
@msg
|
|
28
33
|
end
|
|
34
|
+
|
|
35
|
+
def inspect
|
|
36
|
+
"#<#{self.class.name} #{@code.inspect} #{@status}: #{@msg}>"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# What make_error attached is already cleaned; the context is not part of
|
|
40
|
+
# the record.
|
|
41
|
+
def to_h
|
|
42
|
+
{
|
|
43
|
+
"sdk" => @sdk,
|
|
44
|
+
"code" => @code,
|
|
45
|
+
"message" => @msg,
|
|
46
|
+
"status" => @status,
|
|
47
|
+
"result" => @result,
|
|
48
|
+
"spec" => @spec,
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def as_json(*)
|
|
53
|
+
to_h
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def to_json(*args)
|
|
57
|
+
to_h.to_json(*args)
|
|
58
|
+
end
|
|
29
59
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# ProjectName SDK utility type
|
|
2
2
|
|
|
3
3
|
class ProjectNameUtility
|
|
4
|
-
attr_accessor :clean, :done, :make_error, :feature_add, :feature_hook,
|
|
4
|
+
attr_accessor :clean, :clean_add, :clean_explain, :done, :make_error, :feature_add, :feature_hook,
|
|
5
5
|
:feature_init, :fetcher, :make_fetch_def, :make_context,
|
|
6
6
|
:make_options, :make_request, :make_response, :make_result,
|
|
7
7
|
:make_point, :make_spec, :make_url, :param, :prepare_auth,
|
|
@@ -58,7 +58,7 @@ class ProjectNameAuditFeature < ProjectNameBaseFeature
|
|
|
58
58
|
@seen[ctx] = true
|
|
59
59
|
@seq += 1
|
|
60
60
|
|
|
61
|
-
record = {
|
|
61
|
+
record = ctx.utility.clean.call(ctx, {
|
|
62
62
|
"seq" => @seq,
|
|
63
63
|
"ts" => _now,
|
|
64
64
|
"actor" => _actor(ctx),
|
|
@@ -67,7 +67,7 @@ class ProjectNameAuditFeature < ProjectNameBaseFeature
|
|
|
67
67
|
"outcome" => outcome,
|
|
68
68
|
"status" => ctx.result ? ctx.result.status : nil,
|
|
69
69
|
"correlationId" => ctx.id,
|
|
70
|
-
}
|
|
70
|
+
})
|
|
71
71
|
|
|
72
72
|
track = @client.instance_variable_get(:@_audit)
|
|
73
73
|
if track.nil?
|
|
@@ -237,7 +237,7 @@ class ProjectNameCostFeature < ProjectNameBaseFeature
|
|
|
237
237
|
_bump(cost["actors"], actor, amount)
|
|
238
238
|
|
|
239
239
|
@seq += 1
|
|
240
|
-
record = {
|
|
240
|
+
record = ctx.utility.clean.call(ctx, {
|
|
241
241
|
"seq" => @seq,
|
|
242
242
|
"entity" => entity,
|
|
243
243
|
"op" => opname,
|
|
@@ -246,7 +246,7 @@ class ProjectNameCostFeature < ProjectNameBaseFeature
|
|
|
246
246
|
"currency" => cost["currency"],
|
|
247
247
|
"source" => source,
|
|
248
248
|
"attempts" => entry["attempts"],
|
|
249
|
-
}
|
|
249
|
+
})
|
|
250
250
|
cost["last"] = record
|
|
251
251
|
|
|
252
252
|
sink = @options["sink"]
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
#
|
|
3
3
|
# Request/response capture for debugging. Records a bounded ring buffer of
|
|
4
4
|
# per-operation traces - method, URL, redacted headers, response status and
|
|
5
|
-
# timing.
|
|
6
|
-
#
|
|
5
|
+
# timing. The SDK's own clean rules (clean.keys and every registered secret
|
|
6
|
+
# value) apply to the whole entry, and the "redact" option ADDS header names
|
|
7
|
+
# on top of them. An optional
|
|
7
8
|
# "on_entry" callback receives each finished entry (e.g. to stream to a
|
|
8
9
|
# console). "max" caps the buffer (default 100). The clock is injectable
|
|
9
10
|
# ("now", ms) for deterministic tests.
|
|
@@ -11,11 +12,6 @@
|
|
|
11
12
|
require_relative 'base_feature'
|
|
12
13
|
|
|
13
14
|
class ProjectNameDebugFeature < ProjectNameBaseFeature
|
|
14
|
-
REDACT_DEFAULT = [
|
|
15
|
-
"authorization", "cookie", "set-cookie", "api-key", "apikey",
|
|
16
|
-
"x-api-key", "idempotency-key",
|
|
17
|
-
].freeze
|
|
18
|
-
|
|
19
15
|
def initialize
|
|
20
16
|
super
|
|
21
17
|
@version = "0.0.1"
|
|
@@ -55,7 +51,7 @@ class ProjectNameDebugFeature < ProjectNameBaseFeature
|
|
|
55
51
|
"op" => "#{ctx.op ? ctx.op.entity : '_'}.#{ctx.op ? ctx.op.name : '_'}",
|
|
56
52
|
"method" => method,
|
|
57
53
|
"url" => url,
|
|
58
|
-
"headers" => _redact(headers),
|
|
54
|
+
"headers" => _redact(ctx, headers),
|
|
59
55
|
"start" => _now,
|
|
60
56
|
"status" => nil,
|
|
61
57
|
"ok" => nil,
|
|
@@ -101,6 +97,11 @@ class ProjectNameDebugFeature < ProjectNameBaseFeature
|
|
|
101
97
|
entry["status"] = ctx.result.status
|
|
102
98
|
end
|
|
103
99
|
|
|
100
|
+
# The whole entry leaves through the buffer and the callback: the url
|
|
101
|
+
# and the error message can carry a query credential the header mask
|
|
102
|
+
# above never saw.
|
|
103
|
+
entry = ctx.utility.clean.call(ctx, entry)
|
|
104
|
+
|
|
104
105
|
track = @client.instance_variable_get(:@_debug)
|
|
105
106
|
if track.nil?
|
|
106
107
|
track = { "entries" => [] }
|
|
@@ -120,14 +121,16 @@ class ProjectNameDebugFeature < ProjectNameBaseFeature
|
|
|
120
121
|
end
|
|
121
122
|
end
|
|
122
123
|
|
|
123
|
-
|
|
124
|
+
# The core clean rules apply (clean.keys, every registered value); the
|
|
125
|
+
# feature's own `redact` list ADDS header names on top of them.
|
|
126
|
+
def _redact(ctx, headers)
|
|
124
127
|
return {} if headers.nil?
|
|
125
|
-
patterns = @options["redact"] ||
|
|
128
|
+
patterns = (@options["redact"] || []).map { |n| n.to_s.downcase }
|
|
126
129
|
out = {}
|
|
127
130
|
headers.each do |k, v|
|
|
128
|
-
out[k] = patterns.include?(k.to_s.downcase) ? "
|
|
131
|
+
out[k] = patterns.include?(k.to_s.downcase) ? "[redacted]" : v
|
|
129
132
|
end
|
|
130
|
-
out
|
|
133
|
+
ctx.utility.clean.call(ctx, out)
|
|
131
134
|
end
|
|
132
135
|
|
|
133
136
|
def _now
|
|
@@ -27,10 +27,12 @@ class ProjectNameLogFeature < ProjectNameBaseFeature
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
# A log line leaves the pipeline, so it is cleaned before the logger sees
|
|
31
|
+
# it, as every emitted record is.
|
|
30
32
|
def _loghook(hook, ctx, level = "info")
|
|
31
33
|
return unless @logger
|
|
32
34
|
opname = ctx.op ? ctx.op.name : ""
|
|
33
|
-
msg = "hook=#{hook} op=#{opname}"
|
|
35
|
+
msg = ctx.utility.clean.call(ctx, "hook=#{hook} op=#{opname}")
|
|
34
36
|
if @logger.respond_to?(:puts)
|
|
35
37
|
@logger.puts("[#{level.upcase}] #{msg}")
|
|
36
38
|
end
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
# fetchdef["proxy"] for the transport to honour. Hosts matching "noProxy"
|
|
10
10
|
# (exact or suffix) bypass the proxy.
|
|
11
11
|
|
|
12
|
+
require 'uri'
|
|
13
|
+
|
|
12
14
|
require_relative 'base_feature'
|
|
13
15
|
|
|
14
16
|
class ProjectNameProxyFeature < ProjectNameBaseFeature
|
|
@@ -22,6 +24,7 @@ class ProjectNameProxyFeature < ProjectNameBaseFeature
|
|
|
22
24
|
@options = {}
|
|
23
25
|
@url = nil
|
|
24
26
|
@no_proxy = []
|
|
27
|
+
@ctx = nil
|
|
25
28
|
end
|
|
26
29
|
|
|
27
30
|
def init(ctx, options)
|
|
@@ -43,6 +46,26 @@ class ProjectNameProxyFeature < ProjectNameBaseFeature
|
|
|
43
46
|
@no_proxy = (no_proxy.is_a?(String) ? no_proxy.split(/\s*,\s*/) : (no_proxy || []))
|
|
44
47
|
.reject { |s| s.nil? || s == "" }
|
|
45
48
|
|
|
49
|
+
# A proxy URL may carry credentials as userinfo, from the option or the
|
|
50
|
+
# environment, and neither is under a sensitive key name.
|
|
51
|
+
@ctx = ctx
|
|
52
|
+
if @url.is_a?(String)
|
|
53
|
+
begin
|
|
54
|
+
parsed = URI.parse(@url)
|
|
55
|
+
[parsed.user, parsed.password].each do |part|
|
|
56
|
+
next if part.nil? || part.empty?
|
|
57
|
+
ctx.utility.clean_add.call(ctx, part)
|
|
58
|
+
begin
|
|
59
|
+
ctx.utility.clean_add.call(ctx, URI.decode_www_form_component(part))
|
|
60
|
+
rescue StandardError
|
|
61
|
+
nil
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
rescue StandardError
|
|
65
|
+
nil
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
46
69
|
feature = self
|
|
47
70
|
utility = ctx.utility
|
|
48
71
|
inner = utility.fetcher
|
|
@@ -85,7 +108,8 @@ class ProjectNameProxyFeature < ProjectNameBaseFeature
|
|
|
85
108
|
def _track(url)
|
|
86
109
|
track = @client.instance_variable_get(:@_proxy)
|
|
87
110
|
if track.nil?
|
|
88
|
-
|
|
111
|
+
ctx = @ctx
|
|
112
|
+
track = { "routed" => 0, "url" => ctx.nil? ? @url : ctx.utility.clean.call(ctx, @url) }
|
|
89
113
|
@client.instance_variable_set(:@_proxy, track)
|
|
90
114
|
end
|
|
91
115
|
track["routed"] += 1
|
|
@@ -86,6 +86,9 @@ class ProjectNameSecretsFeature < ProjectNameBaseFeature
|
|
|
86
86
|
@lastset = nil
|
|
87
87
|
@resolved = false
|
|
88
88
|
|
|
89
|
+
# The root context, for registering what this feature resolves.
|
|
90
|
+
@ctx = nil
|
|
91
|
+
|
|
89
92
|
@statelock = Mutex.new
|
|
90
93
|
@resolvelock = Mutex.new
|
|
91
94
|
@buylock = Mutex.new
|
|
@@ -94,6 +97,7 @@ class ProjectNameSecretsFeature < ProjectNameBaseFeature
|
|
|
94
97
|
# Sync by feature contract: build the chain, never look anything up here.
|
|
95
98
|
def init(ctx, options)
|
|
96
99
|
@client = ctx.client
|
|
100
|
+
@ctx = ctx
|
|
97
101
|
@options = options.is_a?(Hash) ? options : {}
|
|
98
102
|
@liveopts = ctx.options.is_a?(Hash) ? ctx.options : {}
|
|
99
103
|
@active = @options["active"] == true
|
|
@@ -140,6 +144,7 @@ class ProjectNameSecretsFeature < ProjectNameBaseFeature
|
|
|
140
144
|
specs = []
|
|
141
145
|
|
|
142
146
|
if explicit.is_a?(String) && !explicit.empty?
|
|
147
|
+
_register(explicit)
|
|
143
148
|
specs << {
|
|
144
149
|
"kind" => "memory",
|
|
145
150
|
"name" => "options",
|
|
@@ -256,6 +261,15 @@ class ProjectNameSecretsFeature < ProjectNameBaseFeature
|
|
|
256
261
|
|
|
257
262
|
private
|
|
258
263
|
|
|
264
|
+
# Every value this feature resolves or buys is a secret the SDK handles,
|
|
265
|
+
# and none arrives under an option key the intake registration saw.
|
|
266
|
+
def _register(value)
|
|
267
|
+
ctx = @ctx
|
|
268
|
+
return if ctx.nil? || ctx.utility.nil? || !ctx.utility.respond_to?(:clean_add)
|
|
269
|
+
add = ctx.utility.clean_add
|
|
270
|
+
add.call(ctx, value) if add.respond_to?(:call)
|
|
271
|
+
end
|
|
272
|
+
|
|
259
273
|
# Resolve once, answering whether a credential came out of it. That
|
|
260
274
|
# boolean is the whole of what resolve needs to tell a cacheable HIT from
|
|
261
275
|
# a miss it must not keep.
|
|
@@ -266,6 +280,7 @@ class ProjectNameSecretsFeature < ProjectNameBaseFeature
|
|
|
266
280
|
# "a store could not answer" - only the miss falls through.
|
|
267
281
|
found = @sekreto.try(@secretname)
|
|
268
282
|
found = nil unless found.is_a?(String)
|
|
283
|
+
_register(found)
|
|
269
284
|
|
|
270
285
|
if @exchange.nil?
|
|
271
286
|
# An UNCACHED miss after an earlier hit is a revocation: the chain
|
|
@@ -469,6 +484,8 @@ class ProjectNameSecretsFeature < ProjectNameBaseFeature
|
|
|
469
484
|
"secrets: token exchange returned no '#{x['response']}' field from #{url}"
|
|
470
485
|
end
|
|
471
486
|
|
|
487
|
+
_register(token)
|
|
488
|
+
|
|
472
489
|
token
|
|
473
490
|
end
|
|
474
491
|
|
|
@@ -86,16 +86,18 @@ class ProjectNameTelemetryFeature < ProjectNameBaseFeature
|
|
|
86
86
|
span["durationMs"] = [0, span["end"] - span["start"]].max
|
|
87
87
|
span["ok"] = ok
|
|
88
88
|
|
|
89
|
+
out = ctx.utility.clean.call(ctx, span)
|
|
90
|
+
|
|
89
91
|
t = _telemetry
|
|
90
92
|
unless t.nil?
|
|
91
93
|
t["active"] -= 1
|
|
92
|
-
t["spans"] <<
|
|
94
|
+
t["spans"] << out
|
|
93
95
|
end
|
|
94
96
|
|
|
95
97
|
exporter = @options["exporter"]
|
|
96
98
|
if exporter.is_a?(Proc)
|
|
97
99
|
begin
|
|
98
|
-
exporter.call(
|
|
100
|
+
exporter.call(out)
|
|
99
101
|
rescue StandardError
|
|
100
102
|
end
|
|
101
103
|
end
|
|
@@ -763,7 +763,9 @@ class FeatureTest < Minitest::Test
|
|
|
763
763
|
entries = h.track(:@_debug)["entries"]
|
|
764
764
|
assert_equal 1, entries.length # ring buffer capped at max
|
|
765
765
|
assert_equal 2, seen.length
|
|
766
|
-
|
|
766
|
+
# Masked by the SDK's own clean rule (authorization is a clean.keys
|
|
767
|
+
# name), which the feature's redact list now sits on top of.
|
|
768
|
+
assert_equal "[redacted]", seen[0]["headers"]["authorization"]
|
|
767
769
|
end
|
|
768
770
|
|
|
769
771
|
def test_debug_captures_failures
|
|
@@ -784,7 +786,7 @@ class FeatureTest < Minitest::Test
|
|
|
784
786
|
h = harness([fspec("debug", "now" => -> { 7 }, "redact" => ["x-secret"])])
|
|
785
787
|
h.op(headers: { "x-secret" => "hide", "x-ok" => "show" })
|
|
786
788
|
entry = h.track(:@_debug)["entries"][0]
|
|
787
|
-
assert_equal "
|
|
789
|
+
assert_equal "[redacted]", entry["headers"]["x-secret"]
|
|
788
790
|
assert_equal "show", entry["headers"]["x-ok"]
|
|
789
791
|
end
|
|
790
792
|
|