@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,9 +1,10 @@
|
|
|
1
1
|
// Request/response capture for debugging. Records a bounded ring buffer of
|
|
2
2
|
// per-operation traces - method, URL, redacted headers, response status and
|
|
3
|
-
// timing - on the feature's entries.
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
3
|
+
// timing - on the feature's entries. Every entry passes through the SDK's
|
|
4
|
+
// clean utility (clean.keys and every registered secret value); the
|
|
5
|
+
// `redact` option ADDS header names on top of that. An optional `onEntry`
|
|
6
|
+
// callback receives each finished entry (e.g. to stream to a console).
|
|
7
|
+
// `max` caps the buffer (default 100).
|
|
7
8
|
|
|
8
9
|
import Foundation
|
|
9
10
|
|
|
@@ -16,11 +17,6 @@ public final class DebugFeature: BaseFeature {
|
|
|
16
17
|
|
|
17
18
|
private static let entryKey = "debug_entry"
|
|
18
19
|
|
|
19
|
-
private static let defaultRedact: [String] = [
|
|
20
|
-
"authorization", "cookie", "set-cookie", "api-key", "apikey",
|
|
21
|
-
"x-api-key", "idempotency-key",
|
|
22
|
-
]
|
|
23
|
-
|
|
24
20
|
public override init() {
|
|
25
21
|
super.init()
|
|
26
22
|
version = "0.0.1"
|
|
@@ -48,7 +44,7 @@ public final class DebugFeature: BaseFeature {
|
|
|
48
44
|
if let spec = ctx.spec {
|
|
49
45
|
entry.entries["method"] = .string(spec.method)
|
|
50
46
|
entry.entries["url"] = .string(spec.url != "" ? spec.url : spec.path)
|
|
51
|
-
entry.entries["headers"] = .map(redact(spec.headers))
|
|
47
|
+
entry.entries["headers"] = .map(redact(ctx, spec.headers))
|
|
52
48
|
}
|
|
53
49
|
ctx.out[DebugFeature.entryKey] = entry
|
|
54
50
|
}
|
|
@@ -83,10 +79,11 @@ public final class DebugFeature: BaseFeature {
|
|
|
83
79
|
|
|
84
80
|
private func finish(_ ctx: Context, _ ok: Bool) {
|
|
85
81
|
// Finish once per operation: the marker in ctx.out is consumed here.
|
|
86
|
-
guard let
|
|
82
|
+
guard let raw = ctx.out[DebugFeature.entryKey] as? VMap else {
|
|
87
83
|
return
|
|
88
84
|
}
|
|
89
85
|
ctx.out.removeValue(forKey: DebugFeature.entryKey)
|
|
86
|
+
var entry = raw
|
|
90
87
|
|
|
91
88
|
entry.entries["ok"] = .bool(ok && (ctx.result == nil || ctx.result!.ok))
|
|
92
89
|
let sv = gp(entry, "start")
|
|
@@ -100,6 +97,11 @@ public final class DebugFeature: BaseFeature {
|
|
|
100
97
|
entry.entries["status"] = .int(Int64(result.status))
|
|
101
98
|
}
|
|
102
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 = fclean(ctx, entry)
|
|
104
|
+
|
|
103
105
|
entries.append(entry)
|
|
104
106
|
let max = foptInt(options, "max", 100)
|
|
105
107
|
while entries.count > max {
|
|
@@ -111,16 +113,18 @@ public final class DebugFeature: BaseFeature {
|
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
|
|
114
|
-
|
|
116
|
+
// The core clean rules apply (clean.keys, every registered value); the
|
|
117
|
+
// feature's own `redact` list ADDS header names on top of them.
|
|
118
|
+
private func redact(_ ctx: Context, _ headers: VMap?) -> VMap {
|
|
115
119
|
let redacted = VMap()
|
|
116
120
|
guard let headers = headers else {
|
|
117
121
|
return redacted
|
|
118
122
|
}
|
|
119
|
-
let patterns = foptStrList(options, "redact") ??
|
|
123
|
+
let patterns = (foptStrList(options, "redact") ?? []).map { $0.lowercased() }
|
|
120
124
|
for (k, v) in headers.entries {
|
|
121
125
|
let masked = patterns.contains(k.lowercased())
|
|
122
|
-
redacted.entries[k] = masked ? .string("
|
|
126
|
+
redacted.entries[k] = masked ? .string("[redacted]") : v
|
|
123
127
|
}
|
|
124
|
-
return redacted
|
|
128
|
+
return fclean(ctx, redacted)
|
|
125
129
|
}
|
|
126
130
|
}
|
|
@@ -94,3 +94,19 @@ func fresHeader(_ res: Value, _ name: String) -> (String, Bool) {
|
|
|
94
94
|
func fparseInt(_ s: String, _ def: Int) -> Int {
|
|
95
95
|
Int(s.trimmingCharacters(in: .whitespaces)) ?? def
|
|
96
96
|
}
|
|
97
|
+
|
|
98
|
+
// fclean passes a record a feature is about to emit through the SDK's clean
|
|
99
|
+
// utility: every sink, buffer and logger receives the masked copy.
|
|
100
|
+
func fclean(_ ctx: Context, _ record: VMap) -> VMap {
|
|
101
|
+
guard let clean = ctx.utility?.clean, let out = clean(ctx, .map(record)).asMap else {
|
|
102
|
+
return record
|
|
103
|
+
}
|
|
104
|
+
return out
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
func fcleanStr(_ ctx: Context, _ text: String) -> String {
|
|
108
|
+
guard let clean = ctx.utility?.clean, let out = clean(ctx, .string(text)).asString else {
|
|
109
|
+
return text
|
|
110
|
+
}
|
|
111
|
+
return out
|
|
112
|
+
}
|
|
@@ -64,6 +64,9 @@ public final class LogFeature: BaseFeature {
|
|
|
64
64
|
if let op = ctx.op { attrs.entries["op"] = .string(op.name) }
|
|
65
65
|
if let spec = ctx.spec { attrs.entries["spec"] = .string(spec.method + " " + spec.path) }
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
// A log line leaves the pipeline, so it carries the cleaned record: a
|
|
68
|
+
// path can hold a query credential, and a logger serialises whatever it
|
|
69
|
+
// is handed.
|
|
70
|
+
logger(level, "hook", fclean(ctx, attrs))
|
|
68
71
|
}
|
|
69
72
|
}
|
|
@@ -13,6 +13,10 @@ public final class ProxyFeature: BaseFeature {
|
|
|
13
13
|
private var options: VMap?
|
|
14
14
|
private var noProxy: [String] = []
|
|
15
15
|
|
|
16
|
+
// The proxy target as configured, for routing; `url` below is the cleaned
|
|
17
|
+
// form, since a proxy URL may carry credentials as userinfo.
|
|
18
|
+
private var target = ""
|
|
19
|
+
|
|
16
20
|
// Activity tracking (mirrors the ts client._proxy record).
|
|
17
21
|
public var routed = 0
|
|
18
22
|
public var url = ""
|
|
@@ -36,12 +40,12 @@ public final class ProxyFeature: BaseFeature {
|
|
|
36
40
|
return
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
target = foptStr(options, "url", "")
|
|
40
44
|
var noProxyList = foptStrList(options, "noProxy")
|
|
41
45
|
|
|
42
46
|
if foptBool(options, "fromEnv", false) {
|
|
43
|
-
if
|
|
44
|
-
|
|
47
|
+
if target == "" {
|
|
48
|
+
target = firstEnv("HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy")
|
|
45
49
|
}
|
|
46
50
|
if noProxyList == nil {
|
|
47
51
|
let np = firstEnv("NO_PROXY", "no_proxy")
|
|
@@ -59,6 +63,17 @@ public final class ProxyFeature: BaseFeature {
|
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
|
|
66
|
+
// A proxy URL may carry credentials as userinfo, from the option or the
|
|
67
|
+
// environment, and neither is under a sensitive key name.
|
|
68
|
+
if target != "", let parsed = URLComponents(string: target) {
|
|
69
|
+
for part in [parsed.percentEncodedUser, parsed.percentEncodedPassword, parsed.user, parsed.password] {
|
|
70
|
+
if let p = part, p != "" {
|
|
71
|
+
ctx.utility!.cleanAdd(ctx, .string(p))
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
url = fcleanStr(ctx, target)
|
|
76
|
+
|
|
62
77
|
let inner = ctx.utility!.fetcher!
|
|
63
78
|
|
|
64
79
|
ctx.utility!.fetcher = { ctx2, url, fetchdef in
|
|
@@ -68,7 +83,7 @@ public final class ProxyFeature: BaseFeature {
|
|
|
68
83
|
}
|
|
69
84
|
|
|
70
85
|
private func route(_ requestUrl: String, _ fetchdef: VMap) -> VMap {
|
|
71
|
-
if
|
|
86
|
+
if target == "" || bypass(requestUrl) {
|
|
72
87
|
return fetchdef
|
|
73
88
|
}
|
|
74
89
|
|
|
@@ -76,7 +91,7 @@ public final class ProxyFeature: BaseFeature {
|
|
|
76
91
|
for (k, v) in fetchdef.entries {
|
|
77
92
|
routedDef.entries[k] = v
|
|
78
93
|
}
|
|
79
|
-
routedDef.entries["proxy"] = .string(
|
|
94
|
+
routedDef.entries["proxy"] = .string(target)
|
|
80
95
|
|
|
81
96
|
routed += 1
|
|
82
97
|
return routedDef
|
|
@@ -155,6 +155,15 @@ public final class SecretsFeature: BaseFeature {
|
|
|
155
155
|
return getcred()
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
// Every value this feature resolves or buys is a secret the SDK handles,
|
|
159
|
+
// and none arrives under an option key the intake registration saw.
|
|
160
|
+
private func register(_ value: String?) {
|
|
161
|
+
guard let v = value, let ctx = client?.getRootCtx(), let add = ctx.utility?.cleanAdd else {
|
|
162
|
+
return
|
|
163
|
+
}
|
|
164
|
+
add(ctx, .string(v))
|
|
165
|
+
}
|
|
166
|
+
|
|
158
167
|
// Sync by feature contract: build the chain, never look anything up here.
|
|
159
168
|
public override func initFeature(_ ctx: Context, _ options: VMap) {
|
|
160
169
|
client = ctx.client
|
|
@@ -221,6 +230,7 @@ public final class SecretsFeature: BaseFeature {
|
|
|
221
230
|
var chain: [Sekreto.ChainItem] = []
|
|
222
231
|
|
|
223
232
|
if "" != explicit {
|
|
233
|
+
register(explicit)
|
|
224
234
|
do {
|
|
225
235
|
let key = try envkey(secretname)
|
|
226
236
|
chain.append(.spec(ProviderSpec(
|
|
@@ -353,6 +363,7 @@ public final class SecretsFeature: BaseFeature {
|
|
|
353
363
|
// A provider ERROR throws out of here and fails the op (via the
|
|
354
364
|
// transport gate); only a MISS (nil) falls through.
|
|
355
365
|
let found = try s.tryget(secretname)
|
|
366
|
+
register(found)
|
|
356
367
|
|
|
357
368
|
if nil == exchange {
|
|
358
369
|
// An UNCACHED miss after an earlier hit is a revocation: the chain
|
|
@@ -646,6 +657,8 @@ public final class SecretsFeature: BaseFeature {
|
|
|
646
657
|
"secrets: token exchange returned no '" + x.response + "' field from " + url)
|
|
647
658
|
}
|
|
648
659
|
|
|
660
|
+
register(token)
|
|
661
|
+
|
|
649
662
|
return token
|
|
650
663
|
}
|
|
651
664
|
|
|
@@ -96,11 +96,13 @@ public final class TelemetryFeature: BaseFeature {
|
|
|
96
96
|
span.entries["durationMs"] = .int(dur)
|
|
97
97
|
span.entries["ok"] = .bool(ok)
|
|
98
98
|
|
|
99
|
+
let finished = fclean(ctx, span)
|
|
100
|
+
|
|
99
101
|
activeSpans -= 1
|
|
100
|
-
spans.append(
|
|
102
|
+
spans.append(finished)
|
|
101
103
|
|
|
102
104
|
if let exporter = gp(options, "exporter").asNative as? (VMap) -> Void {
|
|
103
|
-
exporter(
|
|
105
|
+
exporter(finished)
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
108
|
|
|
@@ -20,21 +20,31 @@ func makeErrorUtil(_ ctx: Context, _ err: Error?) throws -> Value {
|
|
|
20
20
|
if e == nil { e = ctx.makeError("unknown", "unknown error") }
|
|
21
21
|
|
|
22
22
|
let errmsg = errMessage(e!)
|
|
23
|
-
|
|
24
|
-
msg = cleanUtil(ctx, .string(msg)).asString ?? msg
|
|
23
|
+
let msg = "ProjectNameSDK: " + opname + ": " + errmsg
|
|
25
24
|
|
|
26
25
|
result.err = nil
|
|
27
26
|
|
|
28
27
|
let spec = ctx.spec
|
|
29
28
|
|
|
29
|
+
// The context stays reachable on the error for a debugger; the error type
|
|
30
|
+
// keeps it out of every printer and mirror.
|
|
31
|
+
let code = (e as? ProjectNameError)?.code ?? ""
|
|
32
|
+
let sdkErr = ProjectNameError(code, msg, ctx)
|
|
33
|
+
|
|
34
|
+
_ = cleanUtil(ctx, .nat(sdkErr))
|
|
35
|
+
|
|
36
|
+
// The HTTP status at the top level, so a consumer can branch on
|
|
37
|
+
// err.status instead of reaching into err.resultVal.
|
|
38
|
+
sdkErr.status = result.status
|
|
39
|
+
|
|
30
40
|
if let explain = ctx.ctrl.explain {
|
|
31
41
|
let em = VMap()
|
|
32
|
-
em.entries["
|
|
42
|
+
em.entries["code"] = .string(sdkErr.code)
|
|
43
|
+
em.entries["message"] = .string(sdkErr.message)
|
|
44
|
+
em.entries["status"] = .int(Int64(sdkErr.status))
|
|
33
45
|
explain.entries["err"] = .map(em)
|
|
34
46
|
}
|
|
35
47
|
|
|
36
|
-
let code = (e as? ProjectNameError)?.code ?? ""
|
|
37
|
-
let sdkErr = ProjectNameError(code, msg, ctx)
|
|
38
48
|
sdkErr.resultVal = cleanUtil(ctx, .nat(result))
|
|
39
49
|
sdkErr.specVal = spec == nil ? .noval : cleanUtil(ctx, .nat(spec!))
|
|
40
50
|
|
|
@@ -53,6 +53,31 @@ func makeOptionsUtil(_ ctx: Context) -> VMap {
|
|
|
53
53
|
opts.entries.removeValue(forKey: "auth")
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
let config = ctx.config ?? VMap()
|
|
57
|
+
let cfgopts = gp(config, "options").asMap ?? VMap()
|
|
58
|
+
|
|
59
|
+
// The secret registry exists BEFORE validation, fed from the raw input, so
|
|
60
|
+
// the constructor's own rejection of a mistyped credential is clean too.
|
|
61
|
+
// (Here validate never throws - the struct port collects its errors - so
|
|
62
|
+
// there is no rejection to clean; the registry is early for the same
|
|
63
|
+
// reason regardless.)
|
|
64
|
+
var cleanlayers: [Value] = [.map(VMap()), clone(gp(SdkSchema.optspec, "clean"))]
|
|
65
|
+
// Maps only: merge lets any other value replace the defaults outright.
|
|
66
|
+
for block in [gp(cfgopts, "clean"), opts.entries["clean"] ?? .noval] {
|
|
67
|
+
if let m = block.asMap {
|
|
68
|
+
cleanlayers.append(clone(.map(m)))
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
let cleancfg = makeCleanConfig(merge(.list(cleanlayers)))
|
|
72
|
+
let cleanctx = Context(
|
|
73
|
+
["options": vm(("__derived__", .map(vm(("clean", .nat(cleancfg))))))], nil)
|
|
74
|
+
cleanAddOptions(cleanctx, cleanOmit(opts, ["clean"]))
|
|
75
|
+
let cleanvalues = cleanSplitValues(gpath(cfgopts, "clean", "values"))
|
|
76
|
+
+ cleanSplitValues(gpath(opts, "clean", "values"))
|
|
77
|
+
for raw in cleanvalues {
|
|
78
|
+
cleanAddUtil(cleanctx, .string(raw))
|
|
79
|
+
}
|
|
80
|
+
|
|
56
81
|
// Feature add-order. options.feature may be given as an ordered LIST of
|
|
57
82
|
// { name, active, ...opts } entries (the list position IS the order in which
|
|
58
83
|
// features are added), or as a { name: {opts} } map. Normalize a list to a
|
|
@@ -73,9 +98,6 @@ func makeOptionsUtil(_ ctx: Context) -> VMap {
|
|
|
73
98
|
opts.entries["feature"] = .map(fmap)
|
|
74
99
|
}
|
|
75
100
|
|
|
76
|
-
let config = ctx.config ?? VMap()
|
|
77
|
-
let cfgopts = gp(config, "options").asMap ?? VMap()
|
|
78
|
-
|
|
79
101
|
// THE OPTION SPEC IS GENERATED, NOT WRITTEN HERE.
|
|
80
102
|
//
|
|
81
103
|
// Built from the model: `main.kit.optspec` for the standard options, plus
|
|
@@ -117,16 +139,6 @@ func makeOptionsUtil(_ ctx: Context) -> VMap {
|
|
|
117
139
|
}
|
|
118
140
|
}
|
|
119
141
|
|
|
120
|
-
// Derived clean config.
|
|
121
|
-
var cleanKeys = "key,token,id"
|
|
122
|
-
if let cks = gpath(result, "clean", "keys").asString { cleanKeys = cks }
|
|
123
|
-
|
|
124
|
-
let filtered = cleanKeys.split(separator: ",", omittingEmptySubsequences: false)
|
|
125
|
-
.map { $0.trimmingCharacters(in: .whitespaces) }
|
|
126
|
-
.filter { $0 != "" }
|
|
127
|
-
.map { escre(.string($0)) }
|
|
128
|
-
let keyre = filtered.joined(separator: "|")
|
|
129
|
-
|
|
130
142
|
// Resolve the feature add-order: an explicit list order (above) wins;
|
|
131
143
|
// otherwise order the map test-first, then the remaining names sorted, so
|
|
132
144
|
// the outcome is deterministic and `test` is always the base transport.
|
|
@@ -154,14 +166,41 @@ func makeOptionsUtil(_ ctx: Context) -> VMap {
|
|
|
154
166
|
}
|
|
155
167
|
|
|
156
168
|
let derived = VMap()
|
|
157
|
-
derived.entries["clean"] = .
|
|
158
|
-
if keyre != "" {
|
|
159
|
-
let cm = VMap()
|
|
160
|
-
cm.entries["keyre"] = .string(keyre)
|
|
161
|
-
derived.entries["clean"] = .map(cm)
|
|
162
|
-
}
|
|
169
|
+
derived.entries["clean"] = .nat(cleancfg)
|
|
163
170
|
derived.entries["featureorder"] = .list(VList(featureorder))
|
|
164
171
|
result.entries["__derived__"] = .map(derived)
|
|
165
172
|
|
|
173
|
+
// Again over the merged result: the config's own defaults can carry one.
|
|
174
|
+
cleanAddOptions(Context(["options": result], nil), cleanOmit(result, ["clean", "__derived__"]))
|
|
175
|
+
|
|
166
176
|
return result
|
|
167
177
|
}
|
|
178
|
+
|
|
179
|
+
// A feature's name is not a field name: only the sensitive names inside its
|
|
180
|
+
// settings count, so `secrets` does not make every setting a secret. Entity
|
|
181
|
+
// blocks hold entity settings and seeded records, never a credential.
|
|
182
|
+
private func cleanAddOptions(_ ctx: Context, _ opts: VMap) {
|
|
183
|
+
let top = cleanOmit(opts, ["feature", "entity"])
|
|
184
|
+
if let test = top.entries["test"] {
|
|
185
|
+
top.entries["test"] = cleanWithoutEntity(test)
|
|
186
|
+
}
|
|
187
|
+
cleanAddSensitiveUtil(ctx, .map(top))
|
|
188
|
+
let feature = opts.entries["feature"] ?? .noval
|
|
189
|
+
let settings: [Value] = feature.asMap?.entries.values ?? feature.asList?.items ?? [feature]
|
|
190
|
+
for fopts in settings {
|
|
191
|
+
cleanAddSensitiveUtil(ctx, cleanWithoutEntity(fopts))
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
private func cleanWithoutEntity(_ block: Value) -> Value {
|
|
196
|
+
guard let m = block.asMap else { return block }
|
|
197
|
+
return .map(cleanOmit(m, ["entity"]))
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
private func cleanOmit(_ src: VMap, _ names: [String]) -> VMap {
|
|
201
|
+
let out = VMap()
|
|
202
|
+
for (k, v) in src.entries where !names.contains(k) {
|
|
203
|
+
out.entries[k] = v
|
|
204
|
+
}
|
|
205
|
+
return out
|
|
206
|
+
}
|