@voxgig/sdkgen 4.32.0 → 4.33.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/helpers/naming.js +1 -1
- package/dist/helpers/naming.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/Response.js +14 -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/js/test/utility/PrimaryUtility.test.js +25 -0
- 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/Response.ts +14 -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/ts/test/utility/PrimaryUtility.test.ts +25 -0
- 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/helpers/naming.ts +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// ProjectName SDK utility: makeOptions - merge, validate and derive the
|
|
2
2
|
// client options.
|
|
3
3
|
|
|
4
|
+
using System.Collections;
|
|
4
5
|
using System.Text.RegularExpressions;
|
|
5
6
|
|
|
6
7
|
using Voxgig.Struct;
|
|
@@ -134,6 +135,40 @@ public static partial class SdkUtility
|
|
|
134
135
|
opts.Remove("auth");
|
|
135
136
|
}
|
|
136
137
|
|
|
138
|
+
var config = ctx.Config ?? new Dictionary<string, object?>();
|
|
139
|
+
var cfgopts = config.TryGetValue("options", out var co) &&
|
|
140
|
+
co is Dictionary<string, object?> cm
|
|
141
|
+
? cm : new Dictionary<string, object?>();
|
|
142
|
+
|
|
143
|
+
// The secret registry exists BEFORE validation, fed from the raw
|
|
144
|
+
// input, so the constructor's own rejection of a mistyped credential
|
|
145
|
+
// is clean too.
|
|
146
|
+
var cleanlayers = new List<object?>
|
|
147
|
+
{
|
|
148
|
+
new Dictionary<string, object?>(),
|
|
149
|
+
StructUtils.Clone(StructUtils.GetProp(SdkSchema.Optspec, "clean")),
|
|
150
|
+
StructUtils.Clone(StructUtils.GetProp(cfgopts, "clean")) ?? new Dictionary<string, object?>(),
|
|
151
|
+
};
|
|
152
|
+
if (opts.TryGetValue("clean", out var cleanraw) && cleanraw != null)
|
|
153
|
+
{
|
|
154
|
+
cleanlayers.Add(cleanraw);
|
|
155
|
+
}
|
|
156
|
+
var cleancfg = MakeCleanConfig(StructUtils.Merge(cleanlayers));
|
|
157
|
+
var cleanctx = new Context(new Dictionary<string, object?>
|
|
158
|
+
{
|
|
159
|
+
["options"] = new Dictionary<string, object?>
|
|
160
|
+
{
|
|
161
|
+
["__derived__"] = new Dictionary<string, object?> { ["clean"] = cleancfg },
|
|
162
|
+
},
|
|
163
|
+
}, null);
|
|
164
|
+
CleanAddOptions(cleanctx, opts, "clean");
|
|
165
|
+
foreach (var raw in CleanSplitValues(
|
|
166
|
+
StructUtils.GetPath(cfgopts, StructUtils.Jt("clean", "values")))
|
|
167
|
+
.Concat(CleanSplitValues(StructUtils.GetPath(opts, StructUtils.Jt("clean", "values")))))
|
|
168
|
+
{
|
|
169
|
+
CleanAddUtil(cleanctx, raw);
|
|
170
|
+
}
|
|
171
|
+
|
|
137
172
|
// Feature add-order. options.feature may be given as an ordered LIST of
|
|
138
173
|
// { name, active, ...opts } entries (the list position IS the order in
|
|
139
174
|
// which features are added), or as a { name: {opts} } map. Normalize a
|
|
@@ -159,11 +194,6 @@ public static partial class SdkUtility
|
|
|
159
194
|
opts["feature"] = fmap;
|
|
160
195
|
}
|
|
161
196
|
|
|
162
|
-
var config = ctx.Config ?? new Dictionary<string, object?>();
|
|
163
|
-
var cfgopts = config.TryGetValue("options", out var co) &&
|
|
164
|
-
co is Dictionary<string, object?> cm
|
|
165
|
-
? cm : new Dictionary<string, object?>();
|
|
166
|
-
|
|
167
197
|
// THE OPTION SPEC IS GENERATED, NOT WRITTEN HERE.
|
|
168
198
|
//
|
|
169
199
|
// Built from the model: `main.kit.optspec` for the standard options,
|
|
@@ -192,7 +222,24 @@ public static partial class SdkUtility
|
|
|
192
222
|
StructUtils.Clone(cfgopts),
|
|
193
223
|
opts,
|
|
194
224
|
});
|
|
195
|
-
|
|
225
|
+
object? validated;
|
|
226
|
+
try
|
|
227
|
+
{
|
|
228
|
+
validated = StructUtils.Validate(merged, optspec);
|
|
229
|
+
}
|
|
230
|
+
catch (Exception verr)
|
|
231
|
+
{
|
|
232
|
+
// The struct port's message quotes the offending value, which is
|
|
233
|
+
// the credential when that is what was mistyped. Exception's
|
|
234
|
+
// message is read-only, so a changed message travels as the SDK's
|
|
235
|
+
// own error; an unchanged one is the original, rethrown.
|
|
236
|
+
var cleaned = CleanUtil(cleanctx, verr.Message) as string ?? verr.Message;
|
|
237
|
+
if (cleaned == verr.Message)
|
|
238
|
+
{
|
|
239
|
+
throw;
|
|
240
|
+
}
|
|
241
|
+
throw new ProjectNameError("options_invalid", cleaned, null);
|
|
242
|
+
}
|
|
196
243
|
opts = validated as Dictionary<string, object?> ?? new Dictionary<string, object?>();
|
|
197
244
|
|
|
198
245
|
// Restore the suppression the optspec default would otherwise erase.
|
|
@@ -263,20 +310,6 @@ public static partial class SdkUtility
|
|
|
263
310
|
}
|
|
264
311
|
}
|
|
265
312
|
|
|
266
|
-
// Derived clean config.
|
|
267
|
-
var cleanKeys = "key,token,id";
|
|
268
|
-
if (StructUtils.GetPath(opts, StructUtils.Jt("clean", "keys")) is string cks)
|
|
269
|
-
{
|
|
270
|
-
cleanKeys = cks;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
var filtered = cleanKeys.Split(',')
|
|
274
|
-
.Select(p => p.Trim())
|
|
275
|
-
.Where(p => p != "")
|
|
276
|
-
.Select(StructUtils.EscRe)
|
|
277
|
-
.ToList();
|
|
278
|
-
var keyre = string.Join("|", filtered);
|
|
279
|
-
|
|
280
313
|
// Resolve the feature add-order: an explicit list order (above) wins;
|
|
281
314
|
// otherwise order the map test-first, then the remaining names sorted,
|
|
282
315
|
// so the outcome is deterministic and `test` is always the base
|
|
@@ -319,20 +352,77 @@ public static partial class SdkUtility
|
|
|
319
352
|
}
|
|
320
353
|
}
|
|
321
354
|
|
|
322
|
-
|
|
355
|
+
opts["__derived__"] = new Dictionary<string, object?>
|
|
323
356
|
{
|
|
324
|
-
["clean"] =
|
|
357
|
+
["clean"] = cleancfg,
|
|
358
|
+
["featureorder"] = featureorder,
|
|
325
359
|
};
|
|
326
|
-
|
|
360
|
+
|
|
361
|
+
// Again over the merged result: the config's own defaults can carry one.
|
|
362
|
+
CleanAddOptions(cleanctx, opts, "clean", "__derived__");
|
|
363
|
+
|
|
364
|
+
return opts;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// A feature's name is not a field name: a feature called `secrets` does
|
|
368
|
+
// not make every one of its options a secret. Entity blocks (entity
|
|
369
|
+
// settings, seeded records) hold no credential.
|
|
370
|
+
private static void CleanAddOptions(Context cleanctx, Dictionary<string, object?> opts,
|
|
371
|
+
params string[] omit)
|
|
372
|
+
{
|
|
373
|
+
var top = CleanOmit(opts, omit.Append("feature").Append("entity").ToArray());
|
|
374
|
+
if (top.ContainsKey("test"))
|
|
375
|
+
{
|
|
376
|
+
top["test"] = CleanNoEntity(top["test"]);
|
|
377
|
+
}
|
|
378
|
+
CleanAddSensitive(cleanctx, top);
|
|
379
|
+
var feature = opts.GetValueOrDefault("feature");
|
|
380
|
+
if (feature is IDictionary fmap)
|
|
381
|
+
{
|
|
382
|
+
foreach (DictionaryEntry kv in fmap)
|
|
383
|
+
{
|
|
384
|
+
CleanAddSensitive(cleanctx, CleanNoEntity(kv.Value));
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
else if (feature is IList flist)
|
|
388
|
+
{
|
|
389
|
+
foreach (var entry in flist)
|
|
390
|
+
{
|
|
391
|
+
CleanAddSensitive(cleanctx, CleanNoEntity(entry));
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
else
|
|
395
|
+
{
|
|
396
|
+
CleanAddSensitive(cleanctx, feature);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
private static object? CleanNoEntity(object? block)
|
|
401
|
+
{
|
|
402
|
+
if (block is not IDictionary dict)
|
|
327
403
|
{
|
|
328
|
-
|
|
404
|
+
return block;
|
|
405
|
+
}
|
|
406
|
+
var out_ = new Dictionary<string, object?>();
|
|
407
|
+
foreach (DictionaryEntry kv in dict)
|
|
408
|
+
{
|
|
409
|
+
var key = Convert.ToString(kv.Key) ?? "";
|
|
410
|
+
if (key != "entity")
|
|
329
411
|
{
|
|
330
|
-
[
|
|
331
|
-
}
|
|
412
|
+
out_[key] = kv.Value;
|
|
413
|
+
}
|
|
332
414
|
}
|
|
333
|
-
|
|
334
|
-
|
|
415
|
+
return out_;
|
|
416
|
+
}
|
|
335
417
|
|
|
336
|
-
|
|
418
|
+
private static Dictionary<string, object?> CleanOmit(Dictionary<string, object?> opts,
|
|
419
|
+
params string[] keys)
|
|
420
|
+
{
|
|
421
|
+
var out_ = new Dictionary<string, object?>(opts);
|
|
422
|
+
foreach (var key in keys)
|
|
423
|
+
{
|
|
424
|
+
out_.Remove(key);
|
|
425
|
+
}
|
|
426
|
+
return out_;
|
|
337
427
|
}
|
|
338
428
|
}
|
|
@@ -35,21 +35,31 @@ public static partial class SdkUtility
|
|
|
35
35
|
|
|
36
36
|
spec.Step = "response";
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
// A shaping failure (a body that is not JSON) is the operation's
|
|
39
|
+
// result, as in ts: carried on result.Err so the pipeline still
|
|
40
|
+
// reaches Done, which is what cleans the explain record.
|
|
41
|
+
try
|
|
42
|
+
{
|
|
43
|
+
utility.ResultBasic(ctx);
|
|
44
|
+
utility.ResultHeaders(ctx);
|
|
45
|
+
utility.ResultBody(ctx);
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
// GraphQL reports failures as a top-level `errors` array under HTTP
|
|
48
|
+
// 200, so ResultBasic's status check never sees them. Lift them
|
|
49
|
+
// here, before the response transform tries to unwrap data that is
|
|
50
|
+
// not there.
|
|
51
|
+
utility.GraphqlErrors(ctx);
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
utility.TransformResponse(ctx);
|
|
49
54
|
|
|
50
|
-
|
|
55
|
+
if (result.Err == null)
|
|
56
|
+
{
|
|
57
|
+
result.Ok = true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch (Exception err)
|
|
51
61
|
{
|
|
52
|
-
result.
|
|
62
|
+
result.Err = err;
|
|
53
63
|
}
|
|
54
64
|
|
|
55
65
|
if (ctx.Ctrl.Explain != null)
|
|
@@ -21,6 +21,25 @@ defmodule ProjectName.Context do
|
|
|
21
21
|
|
|
22
22
|
def make_error(ctx, code, msg), do: Error.new(code, msg, ctx)
|
|
23
23
|
|
|
24
|
+
# The serialised context leaves the pipeline (a logger, an error dump), so
|
|
25
|
+
# it is the cleaned record; the live fields stay raw for the pipeline's use.
|
|
26
|
+
# A context node itself inspects as a handle, so this is the SDK's own
|
|
27
|
+
# serialisation of one.
|
|
28
|
+
def to_data(ctx) do
|
|
29
|
+
record =
|
|
30
|
+
S.jm([
|
|
31
|
+
"id", S.getprop(ctx, "id"),
|
|
32
|
+
"op", S.getprop(ctx, "op"),
|
|
33
|
+
"spec", S.getprop(ctx, "spec"),
|
|
34
|
+
"entity", entity_name(S.getprop(ctx, "entity")),
|
|
35
|
+
"result", S.getprop(ctx, "result"),
|
|
36
|
+
"response", S.getprop(ctx, "response"),
|
|
37
|
+
"meta", S.getprop(ctx, "meta")
|
|
38
|
+
])
|
|
39
|
+
|
|
40
|
+
ProjectName.Feature.clean(ctx, record)
|
|
41
|
+
end
|
|
42
|
+
|
|
24
43
|
def new(ctxmap \\ nil, basectx \\ nil) do
|
|
25
44
|
cm = if S.ismap(ctxmap), do: ctxmap, else: nil
|
|
26
45
|
gp = fn k -> H.get_ctx_prop(cm, k) end
|
|
@@ -153,7 +153,7 @@ defmodule ProjectName.EntityBase do
|
|
|
153
153
|
# materialised items so stream always yields.
|
|
154
154
|
items =
|
|
155
155
|
if S.isfunc(stream_fn) do
|
|
156
|
-
stream_fn
|
|
156
|
+
cleaned(ctx, stream_fn)
|
|
157
157
|
else
|
|
158
158
|
rd = if result != nil, do: S.getprop(result, "resdata"), else: nil
|
|
159
159
|
|
|
@@ -167,6 +167,27 @@ defmodule ProjectName.EntityBase do
|
|
|
167
167
|
items
|
|
168
168
|
|> Stream.take_while(fn _ -> not (S.isfunc(signal) and signal.() == true) end)
|
|
169
169
|
|> Stream.map(&stream_unwrap/1)
|
|
170
|
+
|> guarded(ctx)
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# The caller iterates after run_op has returned, so what the stream raises
|
|
174
|
+
# is cleaned here, as run_op's rescue would clean it. The caller's own
|
|
175
|
+
# reducer runs inside the reduce, so what it raises is cleaned too.
|
|
176
|
+
defp cleaned(ctx, step) do
|
|
177
|
+
step.()
|
|
178
|
+
rescue
|
|
179
|
+
e -> reraise(Utility.clean_exception(ctx, e), __STACKTRACE__)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
defp guarded(enum, ctx) do
|
|
183
|
+
fn acc, fun -> reduce_step(ctx, fn -> Enumerable.reduce(enum, acc, fun) end) end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
defp reduce_step(ctx, step) do
|
|
187
|
+
case cleaned(ctx, step) do
|
|
188
|
+
{:suspended, acc, cont} -> {:suspended, acc, fn a -> reduce_step(ctx, fn -> cont.(a) end) end}
|
|
189
|
+
done -> done
|
|
190
|
+
end
|
|
170
191
|
end
|
|
171
192
|
|
|
172
193
|
# Unwrap an entity node to its bare record; recurse into chunk lists.
|
|
@@ -13,4 +13,28 @@ defmodule ProjectName.Error do
|
|
|
13
13
|
def new(code \\ "", msg \\ "", ctx \\ nil) do
|
|
14
14
|
%__MODULE__{code: code, msg: msg, sdk: "ProjectName", ctx: ctx}
|
|
15
15
|
end
|
|
16
|
+
|
|
17
|
+
# The HTTP status, promoted so a caller can branch without reaching into
|
|
18
|
+
# the result's shape; -1 when there was no response.
|
|
19
|
+
def status(%__MODULE__{result: result}) do
|
|
20
|
+
s = if Voxgig.Struct.ismap(result), do: Voxgig.Struct.getprop(result, "status"), else: nil
|
|
21
|
+
if is_number(s), do: trunc(s), else: -1
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def not_found?(%__MODULE__{} = e), do: 404 == status(e)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# The context holds the live spec and options, and an error is what gets
|
|
28
|
+
# logged: the printed form carries what make_error attached, which is already
|
|
29
|
+
# cleaned, and never the context. A struct node prints as its JSON, since a
|
|
30
|
+
# bare handle says nothing.
|
|
31
|
+
defimpl Inspect, for: ProjectName.Error do
|
|
32
|
+
import Inspect.Algebra
|
|
33
|
+
alias Voxgig.Struct, as: S
|
|
34
|
+
|
|
35
|
+
def inspect(e, opts) do
|
|
36
|
+
show = fn v -> if S.isnode(v), do: S.jsonify(v, S.jm(["indent", 0])), else: v end
|
|
37
|
+
fields = [code: e.code, msg: e.msg, sdk: e.sdk, result: show.(e.result), spec: show.(e.spec)]
|
|
38
|
+
concat(["#ProjectName.Error<", to_doc(fields, opts), ">"])
|
|
39
|
+
end
|
|
16
40
|
end
|
|
@@ -76,7 +76,7 @@ defmodule ProjectName.Feature.Audit do
|
|
|
76
76
|
status = if result != nil, do: S.getprop(result, "status"), else: nil
|
|
77
77
|
|
|
78
78
|
record =
|
|
79
|
-
S.jm([
|
|
79
|
+
Feature.clean(ctx, S.jm([
|
|
80
80
|
"seq", seq,
|
|
81
81
|
"ts", Feature.now(f),
|
|
82
82
|
"actor", actor,
|
|
@@ -85,7 +85,7 @@ defmodule ProjectName.Feature.Audit do
|
|
|
85
85
|
"outcome", outcome,
|
|
86
86
|
"status", status,
|
|
87
87
|
"correlationId", S.getprop(ctx, "id")
|
|
88
|
-
])
|
|
88
|
+
]))
|
|
89
89
|
|
|
90
90
|
client = S.getprop(f, "client")
|
|
91
91
|
records = S.getprop(S.getprop(client, "_audit"), "records")
|
|
@@ -261,7 +261,7 @@ defmodule ProjectName.Feature.Cost do
|
|
|
261
261
|
S.setprop(f, "seq", seq)
|
|
262
262
|
|
|
263
263
|
record =
|
|
264
|
-
S.jm([
|
|
264
|
+
Feature.clean(ctx, S.jm([
|
|
265
265
|
"seq", seq,
|
|
266
266
|
"entity", entity,
|
|
267
267
|
"op", opname,
|
|
@@ -270,7 +270,7 @@ defmodule ProjectName.Feature.Cost do
|
|
|
270
270
|
"currency", S.getprop(cost, "currency"),
|
|
271
271
|
"source", source,
|
|
272
272
|
"attempts", S.getprop(pending, "attempts")
|
|
273
|
-
])
|
|
273
|
+
]))
|
|
274
274
|
|
|
275
275
|
S.setprop(cost, "last", record)
|
|
276
276
|
|
|
@@ -54,7 +54,7 @@ defmodule ProjectName.Feature.Debug do
|
|
|
54
54
|
"method", if(spec != nil, do: S.getprop(spec, "method"), else: nil),
|
|
55
55
|
"url",
|
|
56
56
|
if(spec != nil, do: H.or_(S.getprop(spec, "url"), S.getprop(spec, "path")), else: nil),
|
|
57
|
-
"headers", redact(f, if(spec != nil, do: S.getprop(spec, "headers"), else: nil)),
|
|
57
|
+
"headers", redact(f, ctx, if(spec != nil, do: S.getprop(spec, "headers"), else: nil)),
|
|
58
58
|
"start", F.now(f),
|
|
59
59
|
"status", nil,
|
|
60
60
|
"ok", nil,
|
|
@@ -137,6 +137,11 @@ defmodule ProjectName.Feature.Debug do
|
|
|
137
137
|
S.setprop(entry, "status", S.getprop(result, "status"))
|
|
138
138
|
end
|
|
139
139
|
|
|
140
|
+
# The whole entry leaves through the buffer and the callback: the url
|
|
141
|
+
# and the error message can carry a query credential the header mask
|
|
142
|
+
# never saw.
|
|
143
|
+
entry = F.clean(ctx, entry)
|
|
144
|
+
|
|
140
145
|
client = S.getprop(f, "client")
|
|
141
146
|
buf = S.getprop(S.getprop(client, "_debug"), "entries")
|
|
142
147
|
F.list_push(buf, entry)
|
|
@@ -158,32 +163,27 @@ defmodule ProjectName.Feature.Debug do
|
|
|
158
163
|
end
|
|
159
164
|
end
|
|
160
165
|
|
|
161
|
-
|
|
166
|
+
# The core clean rules apply (clean.keys, every registered value); the
|
|
167
|
+
# feature's own `redact` list ADDS header names on top of them.
|
|
168
|
+
defp redact(f, ctx, headers) do
|
|
162
169
|
if headers == nil do
|
|
163
170
|
S.jm([])
|
|
164
171
|
else
|
|
165
172
|
patterns =
|
|
166
|
-
opt_list(S.getprop(F.opts(f), "redact"), [
|
|
167
|
-
|
|
168
|
-
"cookie",
|
|
169
|
-
"set-cookie",
|
|
170
|
-
"api-key",
|
|
171
|
-
"apikey",
|
|
172
|
-
"x-api-key",
|
|
173
|
-
"idempotency-key"
|
|
174
|
-
])
|
|
173
|
+
opt_list(S.getprop(F.opts(f), "redact"), [])
|
|
174
|
+
|> Enum.map(fn p -> String.downcase(to_string(p)) end)
|
|
175
175
|
|
|
176
176
|
out = S.jm([])
|
|
177
177
|
|
|
178
178
|
Enum.each(H.entries(headers), fn {k, v} ->
|
|
179
179
|
if String.downcase(to_string(k)) in patterns do
|
|
180
|
-
S.setprop(out, k, "
|
|
180
|
+
S.setprop(out, k, "[redacted]")
|
|
181
181
|
else
|
|
182
182
|
S.setprop(out, k, v)
|
|
183
183
|
end
|
|
184
184
|
end)
|
|
185
185
|
|
|
186
|
-
out
|
|
186
|
+
F.clean(ctx, out)
|
|
187
187
|
end
|
|
188
188
|
end
|
|
189
189
|
|
|
@@ -28,11 +28,13 @@ defmodule ProjectName.Feature.Log do
|
|
|
28
28
|
logger = S.getprop(F.opts(f), "logger")
|
|
29
29
|
|
|
30
30
|
logger =
|
|
31
|
-
if S.ismap(logger) do
|
|
31
|
+
if S.ismap(logger) or S.isfunc(logger) do
|
|
32
32
|
logger
|
|
33
33
|
else
|
|
34
34
|
mk = fn level ->
|
|
35
|
-
fn
|
|
35
|
+
fn record ->
|
|
36
|
+
IO.write(:stderr, "[" <> level <> "] " <> S.jsonify(record, S.jm(["indent", 0])) <> "\n")
|
|
37
|
+
end
|
|
36
38
|
end
|
|
37
39
|
|
|
38
40
|
S.jm(["info", mk.("INFO"), "debug", mk.("DEBUG"), "warn", mk.("WARN"), "error", mk.("ERROR")])
|
|
@@ -44,6 +46,9 @@ defmodule ProjectName.Feature.Log do
|
|
|
44
46
|
nil
|
|
45
47
|
end
|
|
46
48
|
|
|
49
|
+
# A log line leaves the pipeline, so it carries the cleaned record: the
|
|
50
|
+
# spec after auth holds the credential, and a logger serialises whatever it
|
|
51
|
+
# is handed. `logger` is a fn of the record, or a map with an "info" fn.
|
|
47
52
|
defp loghook(f, hook, ctx) do
|
|
48
53
|
if F.active?(f) do
|
|
49
54
|
logger = S.getprop(f, "logger")
|
|
@@ -51,9 +56,17 @@ defmodule ProjectName.Feature.Log do
|
|
|
51
56
|
if logger != nil do
|
|
52
57
|
op = S.getprop(ctx, "op")
|
|
53
58
|
opname = if op != nil, do: S.getprop(op, "name"), else: ""
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
|
|
60
|
+
record =
|
|
61
|
+
F.clean(ctx, S.jm([
|
|
62
|
+
"hook", hook,
|
|
63
|
+
"op", opname,
|
|
64
|
+
"spec", S.getprop(ctx, "spec"),
|
|
65
|
+
"ctx", ProjectName.Context.to_data(ctx)
|
|
66
|
+
]))
|
|
67
|
+
|
|
68
|
+
log_fn = if S.isfunc(logger), do: logger, else: S.getprop(logger, "info")
|
|
69
|
+
if S.isfunc(log_fn), do: log_fn.(record)
|
|
57
70
|
end
|
|
58
71
|
end
|
|
59
72
|
|
|
@@ -52,7 +52,25 @@ defmodule ProjectName.Feature.Proxy do
|
|
|
52
52
|
|
|
53
53
|
np_list = Enum.filter(np_list, fn s -> s != nil and s != "" end)
|
|
54
54
|
|
|
55
|
+
# A proxy URL may carry credentials as userinfo, from the option or
|
|
56
|
+
# the environment, and neither is under a sensitive key name.
|
|
57
|
+
if is_binary(url) do
|
|
58
|
+
case URI.parse(url).userinfo do
|
|
59
|
+
nil ->
|
|
60
|
+
nil
|
|
61
|
+
|
|
62
|
+
ui ->
|
|
63
|
+
Enum.each(String.split(ui, ":", parts: 2), fn part ->
|
|
64
|
+
if part != "" do
|
|
65
|
+
F.clean_add(ctx, part)
|
|
66
|
+
F.clean_add(ctx, URI.decode(part))
|
|
67
|
+
end
|
|
68
|
+
end)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
55
72
|
S.setprop(f, "url", url)
|
|
73
|
+
S.setprop(f, "clean_url", if(is_binary(url), do: F.clean(ctx, url), else: url))
|
|
56
74
|
S.setprop(f, "no_proxy", S.jt(np_list))
|
|
57
75
|
|
|
58
76
|
utility = S.getprop(ctx, "utility")
|
|
@@ -112,7 +130,7 @@ defmodule ProjectName.Feature.Proxy do
|
|
|
112
130
|
|
|
113
131
|
defp track(f) do
|
|
114
132
|
client = S.getprop(f, "client")
|
|
115
|
-
track = F.track_node(client, "_proxy", S.jm(["routed", 0, "url", S.getprop(f, "
|
|
133
|
+
track = F.track_node(client, "_proxy", S.jm(["routed", 0, "url", S.getprop(f, "clean_url")]))
|
|
116
134
|
S.setprop(track, "routed", S.getprop(track, "routed") + 1)
|
|
117
135
|
end
|
|
118
136
|
|
|
@@ -229,6 +229,8 @@ defmodule ProjectName.Feature.Secrets do
|
|
|
229
229
|
if xopts == nil, do: nil, else: S.getprop(xopts, "refresh")
|
|
230
230
|
end
|
|
231
231
|
|
|
232
|
+
register(f, explicit)
|
|
233
|
+
|
|
232
234
|
first =
|
|
233
235
|
if is_binary(explicit) and explicit != "" do
|
|
234
236
|
[%Sekreto.ProviderSpec{
|
|
@@ -431,7 +433,18 @@ defmodule ProjectName.Feature.Secrets do
|
|
|
431
433
|
end
|
|
432
434
|
end
|
|
433
435
|
|
|
436
|
+
# Every value the chain resolves and every token bought can leave through
|
|
437
|
+
# the SDK's diagnostics, so each is registered with the clean utility the
|
|
438
|
+
# moment this feature sees it.
|
|
439
|
+
defp register(f, v) do
|
|
440
|
+
client = S.getprop(f, "client")
|
|
441
|
+
ctx = if client != nil, do: S.getprop(client, "_rootctx"), else: nil
|
|
442
|
+
if is_binary(v) and ctx != nil, do: F.clean_add(ctx, v)
|
|
443
|
+
nil
|
|
444
|
+
end
|
|
445
|
+
|
|
434
446
|
defp settle(f, found) do
|
|
447
|
+
register(f, found)
|
|
435
448
|
x = S.getprop(f, "_exchange")
|
|
436
449
|
|
|
437
450
|
if x == nil do
|
|
@@ -637,11 +650,13 @@ defmodule ProjectName.Feature.Secrets do
|
|
|
637
650
|
if S.getprop(client, "mode") != "live" do
|
|
638
651
|
token = "test-" <> x.response
|
|
639
652
|
S.setprop(f, "_cred", token)
|
|
653
|
+
register(f, token)
|
|
640
654
|
{:ok, token}
|
|
641
655
|
else
|
|
642
656
|
case buy_once(f, x) do
|
|
643
657
|
{:ok, token} ->
|
|
644
658
|
S.setprop(f, "_cred", token)
|
|
659
|
+
register(f, token)
|
|
645
660
|
{:ok, token}
|
|
646
661
|
|
|
647
662
|
other ->
|
|
@@ -132,15 +132,17 @@ defmodule ProjectName.Feature.Telemetry do
|
|
|
132
132
|
S.setprop(span, "durationMs", max(0, fin - S.getprop(span, "start")))
|
|
133
133
|
S.setprop(span, "ok", ok)
|
|
134
134
|
|
|
135
|
+
out = F.clean(ctx, span)
|
|
136
|
+
|
|
135
137
|
telemetry = S.getprop(S.getprop(f, "client"), "_telemetry")
|
|
136
138
|
S.setprop(telemetry, "active", S.getprop(telemetry, "active") - 1)
|
|
137
|
-
F.list_push(S.getprop(telemetry, "spans"),
|
|
139
|
+
F.list_push(S.getprop(telemetry, "spans"), out)
|
|
138
140
|
|
|
139
141
|
exporter = S.getprop(F.opts(f), "exporter")
|
|
140
142
|
|
|
141
143
|
if S.isfunc(exporter) do
|
|
142
144
|
try do
|
|
143
|
-
exporter.(
|
|
145
|
+
exporter.(out)
|
|
144
146
|
rescue
|
|
145
147
|
_ -> nil
|
|
146
148
|
end
|
|
@@ -42,6 +42,28 @@ defmodule ProjectName.Feature do
|
|
|
42
42
|
|
|
43
43
|
def active?(f), do: S.getprop(f, "active") == true
|
|
44
44
|
|
|
45
|
+
# The utility's clean, or the shipped one when a caller-built utility (the
|
|
46
|
+
# test harness) carries no such member. What a feature emits, it cleans.
|
|
47
|
+
def clean(ctx, v) do
|
|
48
|
+
case util_member(ctx, "clean") do
|
|
49
|
+
nil -> ProjectName.Utility.clean_impl(ctx, v)
|
|
50
|
+
f -> f.(ctx, v)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def clean_add(ctx, v) do
|
|
55
|
+
case util_member(ctx, "clean_add") do
|
|
56
|
+
nil -> ProjectName.Utility.clean_add_impl(ctx, v)
|
|
57
|
+
f -> f.(ctx, v)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
defp util_member(ctx, name) do
|
|
62
|
+
u = if S.ismap(ctx), do: S.getprop(ctx, "utility"), else: nil
|
|
63
|
+
f = if S.ismap(u), do: S.getprop(u, name), else: nil
|
|
64
|
+
if S.isfunc(f), do: f, else: nil
|
|
65
|
+
end
|
|
66
|
+
|
|
45
67
|
# Injectable clock (ms) — options.now() when a function, else wall clock.
|
|
46
68
|
def now(f) do
|
|
47
69
|
n = S.getprop(opts(f), "now")
|