@voxgig/sdkgen 4.32.1 → 4.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/voxgig-sdkgen +1 -1
- package/dist/action/copies.d.ts +21 -0
- package/dist/action/copies.js +146 -0
- package/dist/action/copies.js.map +1 -0
- package/dist/action/doctor.d.ts +15 -2
- package/dist/action/doctor.js +169 -23
- package/dist/action/doctor.js.map +1 -1
- package/dist/action/edition.js +6 -2
- package/dist/action/edition.js.map +1 -1
- package/dist/action/feature.js +6 -2
- package/dist/action/feature.js.map +1 -1
- package/dist/action/package.js +28 -10
- package/dist/action/package.js.map +1 -1
- package/dist/action/remove.js +2 -0
- package/dist/action/remove.js.map +1 -1
- package/dist/action/resolve.d.ts +1 -0
- package/dist/action/resolve.js +10 -2
- package/dist/action/resolve.js.map +1 -1
- package/dist/action/target.js +6 -2
- package/dist/action/target.js.map +1 -1
- package/dist/helpers/naming.js +1 -1
- package/dist/helpers/naming.js.map +1 -1
- package/dist/sdkgen.d.ts +2 -1
- package/dist/sdkgen.js +36 -3
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/model/sdkgen.aontu +7 -1
- package/package.json +1 -1
- package/project/.sdk/model/feature/debug.aontu +3 -1
- package/project/.sdk/src/cmp/c/PrepareAuth_c.ts +8 -28
- package/project/.sdk/src/cmp/c/TestClean_c.ts +774 -0
- package/project/.sdk/src/cmp/c/Test_c.ts +3 -0
- package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +16 -5
- package/project/.sdk/src/cmp/c/fragment/Main.fragment.c +1 -1
- package/project/.sdk/src/cmp/clojure/PrepareAuth_clojure.ts +3 -0
- package/project/.sdk/src/cmp/clojure/TestClean_clojure.ts +473 -0
- package/project/.sdk/src/cmp/clojure/Test_clojure.ts +6 -0
- package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +18 -8
- package/project/.sdk/src/cmp/cpp/PrepareAuth_cpp.ts +3 -0
- package/project/.sdk/src/cmp/cpp/TestClean_cpp.ts +782 -0
- package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +1 -1
- package/project/.sdk/src/cmp/cpp/Test_cpp.ts +2 -0
- package/project/.sdk/src/cmp/csharp/PrepareAuth_csharp.ts +3 -0
- package/project/.sdk/src/cmp/csharp/TestClean_csharp.ts +887 -0
- package/project/.sdk/src/cmp/csharp/Test_csharp.ts +2 -0
- package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +68 -4
- package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +8 -2
- package/project/.sdk/src/cmp/csharp/fragment/SdkError.fragment.cs +49 -0
- package/project/.sdk/src/cmp/elixir/PrepareAuth_elixir.ts +3 -0
- package/project/.sdk/src/cmp/elixir/Schema_elixir.ts +20 -10
- package/project/.sdk/src/cmp/elixir/TestClean_elixir.ts +666 -0
- package/project/.sdk/src/cmp/elixir/Test_elixir.ts +4 -0
- package/project/.sdk/src/cmp/elixir/fragment/Main.fragment.ex +1 -1
- package/project/.sdk/src/cmp/elixir/fragment/Pipeline.fragment.ex +14 -2
- package/project/.sdk/src/cmp/go/PrepareAuth_go.ts +3 -0
- package/project/.sdk/src/cmp/go/TestClean_go.ts +804 -0
- package/project/.sdk/src/cmp/go/Test_go.ts +3 -0
- package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +54 -4
- package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +27 -2
- package/project/.sdk/src/cmp/java/PrepareAuth_java.ts +3 -0
- package/project/.sdk/src/cmp/java/TestClean_java.ts +884 -0
- package/project/.sdk/src/cmp/java/Test_java.ts +2 -0
- package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +56 -11
- package/project/.sdk/src/cmp/java/fragment/SdkError.fragment.java +36 -3
- package/project/.sdk/src/cmp/js/PrepareAuth_js.ts +3 -0
- package/project/.sdk/src/cmp/js/TestClean_js.ts +458 -0
- package/project/.sdk/src/cmp/js/Test_js.ts +2 -0
- package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +5 -4
- package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +7 -1
- package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +7 -1
- package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +7 -1
- package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +7 -1
- package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +7 -1
- package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +11 -2
- package/project/.sdk/src/cmp/js/fragment/SdkError.fragment.js +17 -1
- package/project/.sdk/src/cmp/kotlin/Package_kotlin.ts +5 -0
- package/project/.sdk/src/cmp/kotlin/PrepareAuth_kotlin.ts +3 -0
- package/project/.sdk/src/cmp/kotlin/TestClean_kotlin.ts +654 -0
- package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +3 -0
- package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +44 -11
- package/project/.sdk/src/cmp/kotlin/fragment/SdkError.fragment.kt +31 -0
- package/project/.sdk/src/cmp/lua/PrepareAuth_lua.ts +3 -0
- package/project/.sdk/src/cmp/lua/TestClean_lua.ts +769 -0
- package/project/.sdk/src/cmp/lua/Test_lua.ts +3 -0
- package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +77 -1
- package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +49 -2
- package/project/.sdk/src/cmp/ocaml/Entity_ocaml.ts +3 -2
- package/project/.sdk/src/cmp/ocaml/PrepareAuth_ocaml.ts +4 -25
- package/project/.sdk/src/cmp/ocaml/TestClean_ocaml.ts +538 -0
- package/project/.sdk/src/cmp/ocaml/Test_ocaml.ts +5 -0
- package/project/.sdk/src/cmp/ocaml/fragment/RunOp.fragment.ml +16 -4
- package/project/.sdk/src/cmp/perl/PrepareAuth_perl.ts +3 -0
- package/project/.sdk/src/cmp/perl/TestClean_perl.ts +619 -0
- package/project/.sdk/src/cmp/perl/Test_perl.ts +3 -0
- package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +67 -5
- package/project/.sdk/src/cmp/perl/fragment/Main.fragment.pm +13 -1
- package/project/.sdk/src/cmp/php/PrepareAuth_php.ts +3 -0
- package/project/.sdk/src/cmp/php/TestClean_php.ts +809 -0
- package/project/.sdk/src/cmp/php/Test_php.ts +2 -0
- package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +96 -55
- package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +15 -2
- package/project/.sdk/src/cmp/py/PrepareAuth_py.ts +3 -0
- package/project/.sdk/src/cmp/py/TestClean_py.ts +549 -0
- package/project/.sdk/src/cmp/py/Test_py.ts +3 -0
- package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +83 -55
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +19 -3
- package/project/.sdk/src/cmp/rb/PrepareAuth_rb.ts +3 -0
- package/project/.sdk/src/cmp/rb/TestClean_rb.ts +535 -0
- package/project/.sdk/src/cmp/rb/Test_rb.ts +3 -0
- package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +108 -46
- package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +12 -1
- package/project/.sdk/src/cmp/rust/PrepareAuth_rust.ts +9 -45
- package/project/.sdk/src/cmp/rust/TestClean_rust.ts +881 -0
- package/project/.sdk/src/cmp/rust/Test_rust.ts +3 -0
- package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +14 -6
- package/project/.sdk/src/cmp/rust/fragment/Main.fragment.rs +17 -1
- package/project/.sdk/src/cmp/rust/fragment/SdkError.fragment.rs +34 -2
- package/project/.sdk/src/cmp/scala/PrepareAuth_scala.ts +3 -0
- package/project/.sdk/src/cmp/scala/TestClean_scala.ts +608 -0
- package/project/.sdk/src/cmp/scala/Test_scala.ts +3 -0
- package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +58 -6
- package/project/.sdk/src/cmp/swift/PrepareAuth_swift.ts +3 -0
- package/project/.sdk/src/cmp/swift/TestClean_swift.ts +671 -0
- package/project/.sdk/src/cmp/swift/Test_swift.ts +3 -0
- package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +10 -0
- package/project/.sdk/src/cmp/swift/fragment/Main.fragment.swift +16 -2
- package/project/.sdk/src/cmp/swift/fragment/SdkError.fragment.swift +47 -3
- package/project/.sdk/src/cmp/ts/PrepareAuth_ts.ts +3 -0
- package/project/.sdk/src/cmp/ts/TestClean_ts.ts +465 -0
- package/project/.sdk/src/cmp/ts/Test_ts.ts +2 -0
- package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +5 -4
- package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +7 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +7 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +7 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +7 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +7 -1
- package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +8 -2
- package/project/.sdk/src/cmp/ts/fragment/SdkError.fragment.ts +20 -2
- package/project/.sdk/src/cmp/zig/PrepareAuth_zig.ts +3 -0
- package/project/.sdk/src/cmp/zig/TestClean_zig.ts +791 -0
- package/project/.sdk/src/cmp/zig/Test_zig.ts +5 -0
- package/project/.sdk/src/cmp/zig/fragment/Build.fragment.zig +19 -0
- package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +14 -5
- package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +1 -1
- package/project/.sdk/tm/c/core/context.c +25 -0
- package/project/.sdk/tm/c/core/error.c +16 -0
- package/project/.sdk/tm/c/core/sdk.h +22 -0
- package/project/.sdk/tm/c/feature/audit.c +2 -0
- package/project/.sdk/tm/c/feature/cost.c +1 -0
- package/project/.sdk/tm/c/feature/debug.c +19 -29
- package/project/.sdk/tm/c/feature/log.c +21 -2
- package/project/.sdk/tm/c/feature/proxy.c +55 -3
- package/project/.sdk/tm/c/feature/secrets.c +7 -0
- package/project/.sdk/tm/c/feature/telemetry.c +2 -0
- package/project/.sdk/tm/c/tests/feature_test.c +2 -2
- package/project/.sdk/tm/c/utility/clean.c +530 -8
- package/project/.sdk/tm/c/utility/done.c +28 -12
- package/project/.sdk/tm/c/utility/make_error.c +4 -3
- package/project/.sdk/tm/c/utility/make_options.c +71 -45
- package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +15 -0
- package/project/.sdk/tm/clojure/src/sdk/client.clj +20 -4
- package/project/.sdk/tm/clojure/src/sdk/core.clj +319 -35
- package/project/.sdk/tm/clojure/src/sdk/features.clj +68 -30
- package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +4 -2
- package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +47 -20
- package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +4 -0
- package/project/.sdk/tm/cpp/core/types.hpp +93 -3
- package/project/.sdk/tm/cpp/feature/audit.hpp +1 -0
- package/project/.sdk/tm/cpp/feature/cost.hpp +1 -0
- package/project/.sdk/tm/cpp/feature/debug.hpp +20 -12
- package/project/.sdk/tm/cpp/feature/log.hpp +31 -9
- package/project/.sdk/tm/cpp/feature/proxy.hpp +52 -6
- package/project/.sdk/tm/cpp/feature/secrets.hpp +13 -0
- package/project/.sdk/tm/cpp/feature/telemetry.hpp +4 -2
- package/project/.sdk/tm/cpp/test/feature_test.cpp +2 -2
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +426 -51
- package/project/.sdk/tm/csharp/core/Context.cs +32 -0
- package/project/.sdk/tm/csharp/core/Utility.cs +2 -0
- package/project/.sdk/tm/csharp/feature/AuditFeature.cs +1 -0
- package/project/.sdk/tm/csharp/feature/CostFeature.cs +7 -5
- package/project/.sdk/tm/csharp/feature/DebugFeature.cs +19 -16
- package/project/.sdk/tm/csharp/feature/FeatureOptions.cs +16 -0
- package/project/.sdk/tm/csharp/feature/LogFeature.cs +4 -1
- package/project/.sdk/tm/csharp/feature/ProxyFeature.cs +26 -5
- package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +16 -0
- package/project/.sdk/tm/csharp/feature/TelemetryFeature.cs +4 -2
- package/project/.sdk/tm/csharp/test/FeatureTest.cs +2 -2
- package/project/.sdk/tm/csharp/utility/Clean.cs +440 -2
- package/project/.sdk/tm/csharp/utility/Done.cs +27 -11
- package/project/.sdk/tm/csharp/utility/MakeError.cs +19 -8
- package/project/.sdk/tm/csharp/utility/MakeOptions.cs +119 -29
- package/project/.sdk/tm/csharp/utility/MakeResponse.cs +21 -11
- package/project/.sdk/tm/csharp/utility/Register.cs +1 -0
- package/project/.sdk/tm/elixir/lib/projectname/context.ex +19 -0
- package/project/.sdk/tm/elixir/lib/projectname/entity_base.ex +22 -1
- package/project/.sdk/tm/elixir/lib/projectname/error.ex +24 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/audit.ex +2 -2
- package/project/.sdk/tm/elixir/lib/projectname/feature/cost.ex +2 -2
- package/project/.sdk/tm/elixir/lib/projectname/feature/debug.ex +13 -13
- package/project/.sdk/tm/elixir/lib/projectname/feature/log.ex +18 -5
- package/project/.sdk/tm/elixir/lib/projectname/feature/proxy.ex +19 -1
- package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +15 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/telemetry.ex +4 -2
- package/project/.sdk/tm/elixir/lib/projectname/feature.ex +22 -0
- package/project/.sdk/tm/elixir/lib/projectname/utility.ex +464 -41
- package/project/.sdk/tm/elixir/test/feature_test.exs +3 -2
- package/project/.sdk/tm/go/core/context.go +42 -0
- package/project/.sdk/tm/go/core/error.go +30 -10
- package/project/.sdk/tm/go/core/utility_type.go +2 -0
- package/project/.sdk/tm/go/feature/audit_feature.go +1 -0
- package/project/.sdk/tm/go/feature/base_feature.go +12 -0
- package/project/.sdk/tm/go/feature/cost_feature.go +2 -2
- package/project/.sdk/tm/go/feature/debug_feature.go +14 -12
- package/project/.sdk/tm/go/feature/log_feature.go +13 -8
- package/project/.sdk/tm/go/feature/proxy_feature.go +26 -6
- package/project/.sdk/tm/go/feature/secrets_feature.go +19 -0
- package/project/.sdk/tm/go/feature/telemetry_feature.go +4 -2
- package/project/.sdk/tm/go/test/feature_test.go +2 -2
- package/project/.sdk/tm/go/utility/clean.go +585 -2
- package/project/.sdk/tm/go/utility/done.go +29 -9
- package/project/.sdk/tm/go/utility/make_error.go +51 -16
- package/project/.sdk/tm/go/utility/make_options.go +77 -36
- package/project/.sdk/tm/go/utility/register.go +12 -0
- package/project/.sdk/tm/java/core/Context.java +29 -0
- package/project/.sdk/tm/java/core/SdkClient.java +4 -2
- package/project/.sdk/tm/java/core/Utility.java +7 -0
- package/project/.sdk/tm/java/feature/AuditFeature.java +6 -0
- package/project/.sdk/tm/java/feature/CostFeature.java +5 -0
- package/project/.sdk/tm/java/feature/DebugFeature.java +25 -14
- package/project/.sdk/tm/java/feature/LogFeature.java +11 -4
- package/project/.sdk/tm/java/feature/ProxyFeature.java +41 -6
- package/project/.sdk/tm/java/feature/SecretsFeature.java +18 -0
- package/project/.sdk/tm/java/feature/TelemetryFeature.java +8 -2
- package/project/.sdk/tm/java/test/FeatureTest.java +2 -2
- package/project/.sdk/tm/java/utility/Clean.java +519 -1
- package/project/.sdk/tm/java/utility/Done.java +1 -1
- package/project/.sdk/tm/java/utility/MakeError.java +5 -1
- package/project/.sdk/tm/java/utility/MakeOptions.java +55 -31
- package/project/.sdk/tm/java/utility/Register.java +4 -0
- package/project/.sdk/tm/js/src/Context.js +5 -1
- package/project/.sdk/tm/js/src/feature/audit/AuditFeature.js +2 -2
- package/project/.sdk/tm/js/src/feature/cost/CostFeature.js +2 -2
- package/project/.sdk/tm/js/src/feature/debug/DebugFeature.js +13 -7
- package/project/.sdk/tm/js/src/feature/log/LogFeature.js +9 -5
- package/project/.sdk/tm/js/src/feature/proxy/ProxyFeature.js +19 -1
- package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +14 -0
- package/project/.sdk/tm/js/src/feature/telemetry/TelemetryFeature.js +4 -2
- package/project/.sdk/tm/js/src/utility/CleanUtility.js +294 -21
- package/project/.sdk/tm/js/src/utility/DoneUtility.js +17 -5
- package/project/.sdk/tm/js/src/utility/MakeErrorUtility.js +18 -2
- package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +39 -15
- package/project/.sdk/tm/js/src/utility/Utility.js +4 -2
- package/project/.sdk/tm/js/test/feature/harness.js +11 -1
- package/project/.sdk/tm/js/test/feature.test.js +9 -2
- package/project/.sdk/tm/kotlin/core/Context.kt +19 -0
- package/project/.sdk/tm/kotlin/core/SdkClient.kt +9 -2
- package/project/.sdk/tm/kotlin/core/Utility.kt +2 -0
- package/project/.sdk/tm/kotlin/feature/AuditFeature.kt +11 -9
- package/project/.sdk/tm/kotlin/feature/CostFeature.kt +8 -5
- package/project/.sdk/tm/kotlin/feature/DebugFeature.kt +15 -22
- package/project/.sdk/tm/kotlin/feature/LogFeature.kt +8 -4
- package/project/.sdk/tm/kotlin/feature/ProxyFeature.kt +26 -2
- package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +11 -0
- package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +4 -2
- package/project/.sdk/tm/kotlin/test/FeatureTest.kt +2 -2
- package/project/.sdk/tm/kotlin/utility/CoreUtil.kt +447 -11
- package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +38 -31
- package/project/.sdk/tm/kotlin/utility/Register.kt +1 -0
- package/project/.sdk/tm/lua/core/context.lua +43 -0
- package/project/.sdk/tm/lua/core/error.lua +36 -1
- package/project/.sdk/tm/lua/core/utility_type.lua +4 -0
- package/project/.sdk/tm/lua/feature/audit_feature.lua +2 -2
- package/project/.sdk/tm/lua/feature/cost_feature.lua +2 -2
- package/project/.sdk/tm/lua/feature/debug_feature.lua +21 -17
- package/project/.sdk/tm/lua/feature/log_feature.lua +2 -1
- package/project/.sdk/tm/lua/feature/proxy_feature.lua +23 -1
- package/project/.sdk/tm/lua/feature/secrets_feature.lua +18 -0
- package/project/.sdk/tm/lua/feature/telemetry_feature.lua +4 -2
- package/project/.sdk/tm/lua/test/feature/secrets/secrets_feature_test.lua +3 -2
- package/project/.sdk/tm/lua/test/feature_test.lua +10 -3
- package/project/.sdk/tm/lua/utility/clean.lua +426 -2
- package/project/.sdk/tm/lua/utility/clean_explain.lua +34 -0
- package/project/.sdk/tm/lua/utility/done.lua +1 -7
- package/project/.sdk/tm/lua/utility/make_error.lua +3 -1
- package/project/.sdk/tm/lua/utility/make_options.lua +76 -30
- package/project/.sdk/tm/lua/utility/register.lua +4 -1
- package/project/.sdk/tm/ocaml/Makefile +5 -1
- package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +12 -1
- package/project/.sdk/tm/ocaml/sdk_features.ml +78 -18
- package/project/.sdk/tm/ocaml/sdk_helpers.ml +27 -0
- package/project/.sdk/tm/ocaml/sdk_runtime.ml +304 -26
- package/project/.sdk/tm/ocaml/sdk_types.ml +1 -0
- package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +3 -1
- package/project/.sdk/tm/ocaml/test/t_feature.ml +2 -2
- package/project/.sdk/tm/perl/core/context.pm +27 -0
- package/project/.sdk/tm/perl/core/error.pm +52 -5
- package/project/.sdk/tm/perl/feature/audit_feature.pm +2 -2
- package/project/.sdk/tm/perl/feature/cost_feature.pm +2 -2
- package/project/.sdk/tm/perl/feature/debug_feature.pm +17 -13
- package/project/.sdk/tm/perl/feature/log_feature.pm +3 -1
- package/project/.sdk/tm/perl/feature/proxy_feature.pm +21 -1
- package/project/.sdk/tm/perl/feature/secrets_feature.pm +20 -1
- package/project/.sdk/tm/perl/feature/telemetry_feature.pm +4 -2
- package/project/.sdk/tm/perl/t/feature.t +4 -2
- package/project/.sdk/tm/perl/utility/clean.pm +345 -1
- package/project/.sdk/tm/perl/utility/done.pm +24 -6
- package/project/.sdk/tm/perl/utility/make_error.pm +17 -4
- package/project/.sdk/tm/perl/utility/make_options.pm +33 -14
- package/project/.sdk/tm/php/core/Context.php +24 -1
- package/project/.sdk/tm/php/core/Error.php +34 -3
- package/project/.sdk/tm/php/core/UtilityType.php +4 -0
- package/project/.sdk/tm/php/feature/AuditFeature.php +2 -2
- package/project/.sdk/tm/php/feature/CostFeature.php +2 -2
- package/project/.sdk/tm/php/feature/DebugFeature.php +18 -9
- package/project/.sdk/tm/php/feature/LogFeature.php +5 -2
- package/project/.sdk/tm/php/feature/ProxyFeature.php +20 -1
- package/project/.sdk/tm/php/feature/SecretsFeature.php +18 -0
- package/project/.sdk/tm/php/feature/TelemetryFeature.php +4 -2
- package/project/.sdk/tm/php/test/FeatureTest.php +2 -2
- package/project/.sdk/tm/php/utility/Clean.php +438 -2
- package/project/.sdk/tm/php/utility/Done.php +14 -7
- package/project/.sdk/tm/php/utility/MakeError.php +9 -7
- package/project/.sdk/tm/php/utility/MakeOptions.php +62 -38
- package/project/.sdk/tm/php/utility/Register.php +2 -0
- package/project/.sdk/tm/py/pkg/core/context.py +17 -0
- package/project/.sdk/tm/py/pkg/core/error.py +42 -1
- package/project/.sdk/tm/py/pkg/core/utility_type.py +4 -0
- package/project/.sdk/tm/py/pkg/feature/audit_feature.py +2 -2
- package/project/.sdk/tm/py/pkg/feature/cost_feature.py +2 -2
- package/project/.sdk/tm/py/pkg/feature/debug_feature.py +17 -12
- package/project/.sdk/tm/py/pkg/feature/log_feature.py +2 -1
- package/project/.sdk/tm/py/pkg/feature/proxy_feature.py +18 -1
- package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +12 -0
- package/project/.sdk/tm/py/pkg/feature/telemetry_feature.py +4 -2
- package/project/.sdk/tm/py/pkg/utility/clean.py +311 -1
- package/project/.sdk/tm/py/pkg/utility/done.py +18 -5
- package/project/.sdk/tm/py/pkg/utility/make_error.py +9 -6
- package/project/.sdk/tm/py/pkg/utility/make_options.py +64 -25
- package/project/.sdk/tm/py/pkg/utility/make_response.py +19 -13
- package/project/.sdk/tm/py/pkg/utility/register.py +4 -2
- package/project/.sdk/tm/py/test/feature_harness.py +4 -0
- package/project/.sdk/tm/py/test/test_feature.py +2 -2
- package/project/.sdk/tm/py/test/test_primary_utility.py +1 -0
- package/project/.sdk/tm/rb/core/context.rb +28 -0
- package/project/.sdk/tm/rb/core/error.rb +30 -0
- package/project/.sdk/tm/rb/core/utility_type.rb +1 -1
- package/project/.sdk/tm/rb/feature/audit_feature.rb +2 -2
- package/project/.sdk/tm/rb/feature/cost_feature.rb +2 -2
- package/project/.sdk/tm/rb/feature/debug_feature.rb +15 -12
- package/project/.sdk/tm/rb/feature/log_feature.rb +3 -1
- package/project/.sdk/tm/rb/feature/proxy_feature.rb +25 -1
- package/project/.sdk/tm/rb/feature/secrets_feature.rb +17 -0
- package/project/.sdk/tm/rb/feature/telemetry_feature.rb +4 -2
- package/project/.sdk/tm/rb/test/feature_test.rb +4 -2
- package/project/.sdk/tm/rb/utility/clean.rb +312 -1
- package/project/.sdk/tm/rb/utility/done.rb +15 -5
- package/project/.sdk/tm/rb/utility/make_error.rb +13 -4
- package/project/.sdk/tm/rb/utility/make_options.rb +31 -12
- package/project/.sdk/tm/rb/utility/register.rb +2 -0
- package/project/.sdk/tm/rust/core/context.rs +55 -0
- package/project/.sdk/tm/rust/core/utility_type.rs +17 -0
- package/project/.sdk/tm/rust/feature/audit.rs +2 -0
- package/project/.sdk/tm/rust/feature/cost.rs +3 -2
- package/project/.sdk/tm/rust/feature/debug.rs +16 -16
- package/project/.sdk/tm/rust/feature/log.rs +42 -7
- package/project/.sdk/tm/rust/feature/proxy.rs +48 -2
- package/project/.sdk/tm/rust/feature/secrets.rs +12 -0
- package/project/.sdk/tm/rust/feature/telemetry.rs +2 -0
- package/project/.sdk/tm/rust/tests/feature_test.rs +2 -2
- package/project/.sdk/tm/rust/utility/clean.rs +446 -5
- package/project/.sdk/tm/rust/utility/done.rs +22 -12
- package/project/.sdk/tm/rust/utility/make_error.rs +4 -1
- package/project/.sdk/tm/rust/utility/make_options.rs +73 -19
- package/project/.sdk/tm/scala/Makefile +3 -1
- package/project/.sdk/tm/scala/core/Context.scala +16 -0
- package/project/.sdk/tm/scala/core/SdkClient.scala +14 -4
- package/project/.sdk/tm/scala/core/SdkError.scala +28 -0
- package/project/.sdk/tm/scala/core/Types.scala +3 -0
- package/project/.sdk/tm/scala/core/Utility.scala +2 -0
- package/project/.sdk/tm/scala/feature/AuditFeature.scala +16 -10
- package/project/.sdk/tm/scala/feature/CostFeature.scala +10 -5
- package/project/.sdk/tm/scala/feature/DebugFeature.scala +24 -21
- package/project/.sdk/tm/scala/feature/LogFeature.scala +9 -4
- package/project/.sdk/tm/scala/feature/ProxyFeature.scala +23 -2
- package/project/.sdk/tm/scala/feature/SecretsFeature.scala +14 -0
- package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +9 -2
- package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +2 -2
- package/project/.sdk/tm/scala/utility/Make.scala +63 -20
- package/project/.sdk/tm/scala/utility/Misc.scala +358 -5
- package/project/.sdk/tm/scala/utility/Register.scala +1 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +29 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Utility.swift +2 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +10 -9
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/CostFeature.swift +7 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/DebugFeature.swift +19 -15
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/FeatureOptions.swift +16 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/LogFeature.swift +4 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/ProxyFeature.swift +20 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/SecretsFeature.swift +13 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +4 -2
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeError.swift +15 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +58 -19
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Register.swift +1 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +391 -4
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +2 -2
- package/project/.sdk/tm/ts/src/Context.ts +5 -1
- package/project/.sdk/tm/ts/src/feature/audit/AuditFeature.ts +2 -2
- package/project/.sdk/tm/ts/src/feature/cost/CostFeature.ts +2 -2
- package/project/.sdk/tm/ts/src/feature/debug/DebugFeature.ts +13 -7
- package/project/.sdk/tm/ts/src/feature/log/LogFeature.ts +9 -5
- package/project/.sdk/tm/ts/src/feature/proxy/ProxyFeature.ts +19 -1
- package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +12 -0
- package/project/.sdk/tm/ts/src/feature/telemetry/TelemetryFeature.ts +4 -2
- package/project/.sdk/tm/ts/src/utility/CleanUtility.ts +287 -9
- package/project/.sdk/tm/ts/src/utility/DoneUtility.ts +18 -5
- package/project/.sdk/tm/ts/src/utility/MakeErrorUtility.ts +18 -8
- package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +38 -16
- package/project/.sdk/tm/ts/src/utility/Utility.ts +4 -2
- package/project/.sdk/tm/ts/test/feature/harness.ts +11 -1
- package/project/.sdk/tm/ts/test/feature.test.ts +9 -2
- package/project/.sdk/tm/zig/core/context.zig +34 -0
- package/project/.sdk/tm/zig/core/error.zig +22 -1
- package/project/.sdk/tm/zig/core/utility.zig +403 -39
- package/project/.sdk/tm/zig/feature/audit.zig +4 -2
- package/project/.sdk/tm/zig/feature/cost.zig +3 -2
- package/project/.sdk/tm/zig/feature/debug.zig +20 -25
- package/project/.sdk/tm/zig/feature/log.zig +3 -1
- package/project/.sdk/tm/zig/feature/proxy.zig +47 -6
- package/project/.sdk/tm/zig/feature/secrets.zig +7 -0
- package/project/.sdk/tm/zig/feature/telemetry.zig +4 -2
- package/project/.sdk/tm/zig/test/feature_test.zig +2 -2
- package/project/sdkgen-package.json +1 -1
- package/src/action/copies.ts +219 -0
- package/src/action/doctor.ts +247 -21
- package/src/action/edition.ts +10 -2
- package/src/action/feature.ts +11 -2
- package/src/action/package.ts +31 -10
- package/src/action/remove.ts +4 -0
- package/src/action/resolve.ts +16 -3
- package/src/action/target.ts +10 -2
- package/src/helpers/naming.ts +1 -1
- package/src/sdkgen.ts +45 -5
|
@@ -1,7 +1,431 @@
|
|
|
1
1
|
-- ProjectName SDK utility: clean
|
|
2
|
+
--
|
|
3
|
+
-- Everything that leaves the pipeline passes through clean; inside it data
|
|
4
|
+
-- stays raw, so a hook can still read the header it must add to. The lua
|
|
5
|
+
-- port of tm/ts/src/utility/CleanUtility.ts.
|
|
2
6
|
|
|
7
|
+
local json = require("dkjson")
|
|
8
|
+
|
|
9
|
+
local MAXDEPTH = 32
|
|
10
|
+
local CIRCULAR = "[circular]"
|
|
11
|
+
|
|
12
|
+
-- The schema's own default, for a context that reaches clean before any
|
|
13
|
+
-- options exist (the raw template tree has no generated schema to read).
|
|
14
|
+
local DEFAULT_KEYS = "key,secret,token,password,passwd,authorization,cookie,credential,signature"
|
|
15
|
+
|
|
16
|
+
local B64_ALPHABET =
|
|
17
|
+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
local function base64(text)
|
|
21
|
+
local out = {}
|
|
22
|
+
local size = #text
|
|
23
|
+
local index = 1
|
|
24
|
+
|
|
25
|
+
while index <= size do
|
|
26
|
+
local rest = size - index + 1
|
|
27
|
+
local a = string.byte(text, index)
|
|
28
|
+
local b = string.byte(text, index + 1) or 0
|
|
29
|
+
local c = string.byte(text, index + 2) or 0
|
|
30
|
+
local word = (a << 16) | (b << 8) | c
|
|
31
|
+
|
|
32
|
+
local chunk = {}
|
|
33
|
+
for shift = 18, 0, -6 do
|
|
34
|
+
local at = (word >> shift) & 0x3f
|
|
35
|
+
chunk[#chunk + 1] = string.sub(B64_ALPHABET, at + 1, at + 1)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
if rest == 1 then
|
|
39
|
+
chunk[3] = "="
|
|
40
|
+
chunk[4] = "="
|
|
41
|
+
elseif rest == 2 then
|
|
42
|
+
chunk[4] = "="
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
out[#out + 1] = table.concat(chunk)
|
|
46
|
+
index = index + 3
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
return table.concat(out)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
-- encodeURIComponent: everything but the RFC 3986 unreserved set and !*'().
|
|
54
|
+
local function percent_encode(text)
|
|
55
|
+
return (string.gsub(text, "[^%w%-_%.~!%*'%(%)]", function(c)
|
|
56
|
+
return string.format("%%%02X", string.byte(c))
|
|
57
|
+
end))
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
local function json_escape(text)
|
|
62
|
+
local ok, encoded = pcall(json.encode, text)
|
|
63
|
+
if ok and type(encoded) == "string" and #encoded >= 2 then
|
|
64
|
+
return string.sub(encoded, 2, -2)
|
|
65
|
+
end
|
|
66
|
+
return text
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
local function trim(s)
|
|
71
|
+
return (string.match(s, "^%s*(.-)%s*$"))
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
local function normkey(key)
|
|
76
|
+
return (string.gsub(string.lower(tostring(key)), "[-_]", ""))
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
local function splitkeys(keys)
|
|
81
|
+
local out = {}
|
|
82
|
+
if keys == nil then
|
|
83
|
+
return out
|
|
84
|
+
end
|
|
85
|
+
for part in string.gmatch(tostring(keys), "[^,]+") do
|
|
86
|
+
local k = normkey(trim(part))
|
|
87
|
+
if k ~= "" then
|
|
88
|
+
out[#out + 1] = k
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
return out
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
local function splitvalues(values)
|
|
96
|
+
local out = {}
|
|
97
|
+
if type(values) == "table" then
|
|
98
|
+
for _, v in ipairs(values) do
|
|
99
|
+
if type(v) == "string" then
|
|
100
|
+
out[#out + 1] = v
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
return out
|
|
104
|
+
end
|
|
105
|
+
if values == nil then
|
|
106
|
+
return out
|
|
107
|
+
end
|
|
108
|
+
for part in string.gmatch(tostring(values), "[^,]+") do
|
|
109
|
+
local v = trim(part)
|
|
110
|
+
if v ~= "" then
|
|
111
|
+
out[#out + 1] = v
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
return out
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
local function count(val, dflt)
|
|
119
|
+
local n = tonumber(val)
|
|
120
|
+
if n == nil or n < 0 then
|
|
121
|
+
return dflt
|
|
122
|
+
end
|
|
123
|
+
return math.floor(n)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
local function make_clean_config(cleanopts)
|
|
128
|
+
local opts = type(cleanopts) == "table" and cleanopts or {}
|
|
129
|
+
return {
|
|
130
|
+
active = opts.active ~= false,
|
|
131
|
+
keys = splitkeys(opts.keys == nil and DEFAULT_KEYS or opts.keys),
|
|
132
|
+
values = {},
|
|
133
|
+
mask = type(opts.mask) == "string" and opts.mask or "[redacted]",
|
|
134
|
+
hint = count(opts.hint, 0),
|
|
135
|
+
min = math.max(1, count(opts.min, 4)),
|
|
136
|
+
}
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
-- A context without options (make_error accepts a bare one) still masks by
|
|
141
|
+
-- the schema defaults.
|
|
142
|
+
local function clean_config(ctx)
|
|
143
|
+
if type(ctx) == "table" and type(ctx.options) == "table" then
|
|
144
|
+
local derived = ctx.options["__derived__"]
|
|
145
|
+
if type(derived) == "table" and type(derived.clean) == "table"
|
|
146
|
+
and type(derived.clean.values) == "table"
|
|
147
|
+
then
|
|
148
|
+
return derived.clean
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
local ok, schema = pcall(require, "schema")
|
|
153
|
+
local spec = nil
|
|
154
|
+
if ok and type(schema) == "table" and type(schema.OPTSPEC) == "table" then
|
|
155
|
+
spec = schema.OPTSPEC.clean
|
|
156
|
+
end
|
|
157
|
+
return make_clean_config(spec)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
local function contains(list, value)
|
|
162
|
+
for _, v in ipairs(list) do
|
|
163
|
+
if v == value then
|
|
164
|
+
return true
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
return false
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
-- The encoded forms a value travels in.
|
|
172
|
+
local function forms(value)
|
|
173
|
+
local out = { value }
|
|
174
|
+
for _, form in ipairs({ base64(value), percent_encode(value), json_escape(value) }) do
|
|
175
|
+
if form ~= "" and not contains(out, form) then
|
|
176
|
+
out[#out + 1] = form
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
return out
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
local function clean_add_util(ctx, value)
|
|
184
|
+
local cfg = clean_config(ctx)
|
|
185
|
+
if type(value) ~= "string" or #value < cfg.min then
|
|
186
|
+
return
|
|
187
|
+
end
|
|
188
|
+
local changed = false
|
|
189
|
+
for _, form in ipairs(forms(value)) do
|
|
190
|
+
if #form >= cfg.min and not contains(cfg.values, form) then
|
|
191
|
+
cfg.values[#cfg.values + 1] = form
|
|
192
|
+
changed = true
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
if changed then
|
|
196
|
+
table.sort(cfg.values, function(a, b) return #a > #b end)
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
local function mask_value(cfg, value)
|
|
202
|
+
if 0 < cfg.hint and #value > 2 * cfg.hint then
|
|
203
|
+
return cfg.mask .. string.sub(value, -cfg.hint)
|
|
204
|
+
end
|
|
205
|
+
return cfg.mask
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
local function replace_all(text, needle, repl)
|
|
210
|
+
local out = {}
|
|
211
|
+
local start = 1
|
|
212
|
+
while true do
|
|
213
|
+
local i, j = string.find(text, needle, start, true)
|
|
214
|
+
if i == nil then
|
|
215
|
+
break
|
|
216
|
+
end
|
|
217
|
+
out[#out + 1] = string.sub(text, start, i - 1)
|
|
218
|
+
out[#out + 1] = repl
|
|
219
|
+
start = j + 1
|
|
220
|
+
end
|
|
221
|
+
out[#out + 1] = string.sub(text, start)
|
|
222
|
+
return table.concat(out)
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
local function clean_string(cfg, text)
|
|
227
|
+
local out = text
|
|
228
|
+
for _, value in ipairs(cfg.values) do
|
|
229
|
+
if string.find(out, value, 1, true) ~= nil then
|
|
230
|
+
out = replace_all(out, value, mask_value(cfg, value))
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
return out
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
local function sensitive_key(cfg, key)
|
|
238
|
+
if key == nil or type(key) == "number" then
|
|
239
|
+
return false
|
|
240
|
+
end
|
|
241
|
+
local nk = normkey(key)
|
|
242
|
+
for _, k in ipairs(cfg.keys) do
|
|
243
|
+
if string.find(nk, k, 1, true) ~= nil then
|
|
244
|
+
return true
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
return false
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
-- Table keys in a stable order: pairs has none, and the collision counter
|
|
252
|
+
-- below must not depend on it.
|
|
253
|
+
local function sorted_keys(tbl)
|
|
254
|
+
local keys = {}
|
|
255
|
+
for k in pairs(tbl) do
|
|
256
|
+
keys[#keys + 1] = k
|
|
257
|
+
end
|
|
258
|
+
table.sort(keys, function(a, b)
|
|
259
|
+
local ta, tb = type(a), type(b)
|
|
260
|
+
if ta ~= tb then
|
|
261
|
+
return ta < tb
|
|
262
|
+
end
|
|
263
|
+
if ta == "number" or ta == "string" then
|
|
264
|
+
return a < b
|
|
265
|
+
end
|
|
266
|
+
return tostring(a) < tostring(b)
|
|
267
|
+
end)
|
|
268
|
+
return keys
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
-- A registered value used as a property name is masked like any other
|
|
273
|
+
-- string; names that mask alike take a counter, so none is lost.
|
|
274
|
+
local function clean_name(cfg, out, key)
|
|
275
|
+
if type(key) ~= "string" then
|
|
276
|
+
return key
|
|
277
|
+
end
|
|
278
|
+
local name = clean_string(cfg, key)
|
|
279
|
+
if name == key or out[name] == nil then
|
|
280
|
+
return name
|
|
281
|
+
end
|
|
282
|
+
local i = 1
|
|
283
|
+
while out[name .. "#" .. i] ~= nil do
|
|
284
|
+
i = i + 1
|
|
285
|
+
end
|
|
286
|
+
return name .. "#" .. i
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
-- A masked plain-data copy: an object's own record (to_record) honoured,
|
|
291
|
+
-- functions dropped, cycles cut, and nothing shared with the live value,
|
|
292
|
+
-- whose spec must stay raw.
|
|
293
|
+
local function snapshot(cfg, val, key, depth, seen)
|
|
294
|
+
local t = type(val)
|
|
295
|
+
|
|
296
|
+
if val == nil then
|
|
297
|
+
return nil
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
if t == "string" then
|
|
301
|
+
if sensitive_key(cfg, key) then
|
|
302
|
+
return mask_value(cfg, val)
|
|
303
|
+
end
|
|
304
|
+
return clean_string(cfg, val)
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
if t == "function" or t == "thread" or t == "userdata" then
|
|
308
|
+
return nil
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
if t ~= "table" then
|
|
312
|
+
if sensitive_key(cfg, key) then
|
|
313
|
+
return cfg.mask
|
|
314
|
+
end
|
|
315
|
+
return val
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
if MAXDEPTH <= depth or seen[val] then
|
|
319
|
+
return CIRCULAR
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
if sensitive_key(cfg, key) then
|
|
323
|
+
return cfg.mask
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
seen[val] = true
|
|
327
|
+
|
|
328
|
+
local mt = getmetatable(val)
|
|
329
|
+
if mt ~= nil and type(mt.to_record) == "function" then
|
|
330
|
+
local record = mt.to_record(val)
|
|
331
|
+
if type(record) == "table" and record ~= val then
|
|
332
|
+
local out = snapshot(cfg, record, key, depth + 1, seen)
|
|
333
|
+
seen[val] = nil
|
|
334
|
+
return out
|
|
335
|
+
end
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
local out = {}
|
|
339
|
+
for _, k in ipairs(sorted_keys(val)) do
|
|
340
|
+
local cv = snapshot(cfg, val[k], k, depth + 1, seen)
|
|
341
|
+
if cv ~= nil then
|
|
342
|
+
out[clean_name(cfg, out, k)] = cv
|
|
343
|
+
end
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
seen[val] = nil
|
|
347
|
+
return out
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
-- An SDK error is cleaned in place, since it is about to be returned.
|
|
3
352
|
local function clean_util(ctx, val)
|
|
4
|
-
|
|
353
|
+
local cfg = clean_config(ctx)
|
|
354
|
+
|
|
355
|
+
if cfg.active == false then
|
|
356
|
+
return val
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
if type(val) == "string" then
|
|
360
|
+
return clean_string(cfg, val)
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
if type(val) == "table" and val.is_sdk_error == true then
|
|
364
|
+
for _, k in ipairs(sorted_keys(val)) do
|
|
365
|
+
local v = val[k]
|
|
366
|
+
if type(v) == "string" then
|
|
367
|
+
if k ~= "msg" and sensitive_key(cfg, k) then
|
|
368
|
+
v = mask_value(cfg, v)
|
|
369
|
+
else
|
|
370
|
+
v = clean_string(cfg, v)
|
|
371
|
+
end
|
|
372
|
+
elseif type(v) == "table" then
|
|
373
|
+
v = snapshot(cfg, v, k, 1, {})
|
|
374
|
+
end
|
|
375
|
+
local name = clean_name(cfg, {}, k)
|
|
376
|
+
if name ~= k then
|
|
377
|
+
val[k] = nil
|
|
378
|
+
name = clean_name(cfg, val, k)
|
|
379
|
+
end
|
|
380
|
+
val[name] = v
|
|
381
|
+
end
|
|
382
|
+
return val
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
return snapshot(cfg, val, nil, 0, {})
|
|
5
386
|
end
|
|
6
387
|
|
|
7
|
-
|
|
388
|
+
|
|
389
|
+
local function clean_key_util(ctx, key)
|
|
390
|
+
return sensitive_key(clean_config(ctx), key)
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
-- Every scalar under a sensitive name, at any depth and of any shape: a
|
|
395
|
+
-- credential mistyped as a table or a number is still a credential, and
|
|
396
|
+
-- the validation error that rejects it quotes it.
|
|
397
|
+
local function clean_add_sensitive_util(ctx, val, under, depth, seen)
|
|
398
|
+
depth = depth or 0
|
|
399
|
+
seen = seen or {}
|
|
400
|
+
local t = type(val)
|
|
401
|
+
if val == nil or MAXDEPTH <= depth then
|
|
402
|
+
return
|
|
403
|
+
end
|
|
404
|
+
if t == "string" or t == "number" then
|
|
405
|
+
if under then
|
|
406
|
+
local text = tostring(val)
|
|
407
|
+
if math.type(val) == "float" and val == math.floor(val) then
|
|
408
|
+
text = string.format("%d", val)
|
|
409
|
+
end
|
|
410
|
+
clean_add_util(ctx, text)
|
|
411
|
+
end
|
|
412
|
+
return
|
|
413
|
+
end
|
|
414
|
+
if t ~= "table" or seen[val] then
|
|
415
|
+
return
|
|
416
|
+
end
|
|
417
|
+
seen[val] = true
|
|
418
|
+
for k, v in pairs(val) do
|
|
419
|
+
clean_add_sensitive_util(ctx, v, under or clean_key_util(ctx, k), depth + 1, seen)
|
|
420
|
+
end
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
return {
|
|
425
|
+
clean = clean_util,
|
|
426
|
+
clean_add = clean_add_util,
|
|
427
|
+
clean_add_sensitive = clean_add_sensitive_util,
|
|
428
|
+
clean_key = clean_key_util,
|
|
429
|
+
make_clean_config = make_clean_config,
|
|
430
|
+
splitvalues = splitvalues,
|
|
431
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
-- ProjectName SDK utility: clean_explain
|
|
2
|
+
|
|
3
|
+
-- In place: the caller may hold the record, and a stream copies only its
|
|
4
|
+
-- ctrl. With clean off explain.result is the live result make_error reads,
|
|
5
|
+
-- so err is pruned from a copy of it.
|
|
6
|
+
local function clean_explain_util(ctx)
|
|
7
|
+
local explain = ctx.ctrl.explain
|
|
8
|
+
if type(explain) ~= "table" then
|
|
9
|
+
return
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
local cleaned = ctx.utility.clean(ctx, explain)
|
|
13
|
+
if type(cleaned) == "table" and cleaned ~= explain then
|
|
14
|
+
for k in pairs(explain) do
|
|
15
|
+
explain[k] = nil
|
|
16
|
+
end
|
|
17
|
+
for k, v in pairs(cleaned) do
|
|
18
|
+
explain[k] = v
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
local result = explain["result"]
|
|
23
|
+
if type(result) == "table" then
|
|
24
|
+
local pruned = {}
|
|
25
|
+
for k, v in pairs(result) do
|
|
26
|
+
if k ~= "err" then
|
|
27
|
+
pruned[k] = v
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
explain["result"] = pruned
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
return clean_explain_util
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
-- ProjectName SDK utility: done
|
|
2
2
|
|
|
3
3
|
local function done_util(ctx)
|
|
4
|
-
|
|
5
|
-
ctx.ctrl.explain = ctx.utility.clean(ctx, ctx.ctrl.explain)
|
|
6
|
-
local explain_result = ctx.ctrl.explain["result"]
|
|
7
|
-
if type(explain_result) == "table" then
|
|
8
|
-
explain_result["err"] = nil
|
|
9
|
-
end
|
|
10
|
-
end
|
|
4
|
+
ctx.utility.clean_explain(ctx)
|
|
11
5
|
|
|
12
6
|
if ctx.result ~= nil and ctx.result.ok then
|
|
13
7
|
return ctx.result.resdata, nil
|
|
@@ -49,6 +49,7 @@ local function make_error_util(ctx, err)
|
|
|
49
49
|
|
|
50
50
|
local spec = ctx.spec
|
|
51
51
|
|
|
52
|
+
ctx.utility.clean_explain(ctx)
|
|
52
53
|
if ctx.ctrl.explain ~= nil then
|
|
53
54
|
ctx.ctrl.explain["err"] = { message = msg }
|
|
54
55
|
end
|
|
@@ -61,8 +62,9 @@ local function make_error_util(ctx, err)
|
|
|
61
62
|
-- `err.status` instead of reaching into `err.result`.
|
|
62
63
|
sdk_err.status = result.status or -1
|
|
63
64
|
|
|
65
|
+
-- A hook's own error supplies the code as well as the message.
|
|
64
66
|
if type(err) == "table" and getmetatable(err) == ProjectNameError then
|
|
65
|
-
sdk_err.code = err.code
|
|
67
|
+
sdk_err.code = ctx.utility.clean(ctx, err.code)
|
|
66
68
|
end
|
|
67
69
|
|
|
68
70
|
ctx.ctrl.err = sdk_err
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
local vs = require("utility.struct.struct")
|
|
4
4
|
local schema = require("schema")
|
|
5
|
+
local cleanmod = require("utility.clean")
|
|
5
6
|
|
|
6
7
|
-- See the call site in make_options for why this exists.
|
|
7
8
|
local function densify_lists(v, seen)
|
|
@@ -48,6 +49,43 @@ local function densify_lists(v, seen)
|
|
|
48
49
|
return v
|
|
49
50
|
end
|
|
50
51
|
|
|
52
|
+
local function noentity(settings)
|
|
53
|
+
if type(settings) ~= "table" then
|
|
54
|
+
return settings
|
|
55
|
+
end
|
|
56
|
+
local out = {}
|
|
57
|
+
for k, v in pairs(settings) do
|
|
58
|
+
if k ~= "entity" then
|
|
59
|
+
out[k] = v
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
return out
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
-- The options to scan for secrets. The feature map is keyed by feature
|
|
66
|
+
-- names, not field names, so it is scanned as a list: `secrets` must not
|
|
67
|
+
-- make every setting of that feature a secret. Entity blocks hold entity
|
|
68
|
+
-- settings and seeded records, never a credential, so none is scanned. The
|
|
69
|
+
-- raw scan still sees the feature list form, whose entries each carry `name`.
|
|
70
|
+
local function secret_scan(opts, omit)
|
|
71
|
+
local out = {}
|
|
72
|
+
for k, v in pairs(opts) do
|
|
73
|
+
if not omit[k] and k ~= "entity" then
|
|
74
|
+
if k == "feature" and type(v) == "table" then
|
|
75
|
+
local list = {}
|
|
76
|
+
for _, fopts in pairs(v) do
|
|
77
|
+
list[#list + 1] = noentity(fopts)
|
|
78
|
+
end
|
|
79
|
+
v = list
|
|
80
|
+
elseif k == "test" then
|
|
81
|
+
v = noentity(v)
|
|
82
|
+
end
|
|
83
|
+
out[k] = v
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
return out
|
|
87
|
+
end
|
|
88
|
+
|
|
51
89
|
local function copy_data(v)
|
|
52
90
|
if type(v) ~= 'table' then
|
|
53
91
|
return v
|
|
@@ -121,6 +159,32 @@ local function make_options_util(ctx)
|
|
|
121
159
|
opts = {}
|
|
122
160
|
end
|
|
123
161
|
|
|
162
|
+
local config = ctx.config or {}
|
|
163
|
+
local cfgopts = {}
|
|
164
|
+
local co = config["options"]
|
|
165
|
+
if type(co) == "table" then
|
|
166
|
+
cfgopts = co
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
-- The secret registry exists BEFORE validation, fed from the raw input, so
|
|
170
|
+
-- the constructor's own rejection of a mistyped credential is clean too.
|
|
171
|
+
local specclean = type(schema.OPTSPEC) == "table" and schema.OPTSPEC.clean or nil
|
|
172
|
+
local cfgclean = type(cfgopts.clean) == "table" and cfgopts.clean or {}
|
|
173
|
+
local rawclean = type(opts.clean) == "table" and opts.clean or {}
|
|
174
|
+
local cleancfg = cleanmod.make_clean_config(vs.merge({
|
|
175
|
+
{},
|
|
176
|
+
type(specclean) == "table" and vs.clone(specclean) or {},
|
|
177
|
+
vs.clone(cfgclean),
|
|
178
|
+
vs.clone(rawclean),
|
|
179
|
+
}))
|
|
180
|
+
local cleanctx = { options = { __derived__ = { clean = cleancfg } } }
|
|
181
|
+
cleanmod.clean_add_sensitive(cleanctx, secret_scan(opts, { clean = true, extend = true }))
|
|
182
|
+
for _, block in ipairs({ cfgclean, rawclean }) do
|
|
183
|
+
for _, raw in ipairs(cleanmod.splitvalues(block.values)) do
|
|
184
|
+
cleanmod.clean_add(cleanctx, raw)
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
124
188
|
-- Feature add-order. options.feature may be given as an ordered LIST of
|
|
125
189
|
-- { name = ..., active = ..., ... } entries (the list position IS the order
|
|
126
190
|
-- in which features are added), or as a { name = {opts} } map. Normalize a
|
|
@@ -146,13 +210,6 @@ local function make_options_util(ctx)
|
|
|
146
210
|
opts.feature = fmap
|
|
147
211
|
end
|
|
148
212
|
|
|
149
|
-
local config = ctx.config or {}
|
|
150
|
-
local cfgopts = {}
|
|
151
|
-
local co = config["options"]
|
|
152
|
-
if type(co) == "table" then
|
|
153
|
-
cfgopts = co
|
|
154
|
-
end
|
|
155
|
-
|
|
156
213
|
-- THE OPTION SPEC IS GENERATED, NOT WRITTEN HERE.
|
|
157
214
|
--
|
|
158
215
|
-- `schema.OPTSPEC` is built from the model: `main.kit.optspec` for
|
|
@@ -215,7 +272,10 @@ local function make_options_util(ctx)
|
|
|
215
272
|
-- feature reading it refuses it by its own rule, with its own message.
|
|
216
273
|
merged = densify_lists(merged)
|
|
217
274
|
|
|
218
|
-
local validated = vs.validate
|
|
275
|
+
local vok, validated = pcall(vs.validate, merged, optspec)
|
|
276
|
+
if not vok then
|
|
277
|
+
error(cleanmod.clean(cleanctx, validated), 0)
|
|
278
|
+
end
|
|
219
279
|
if type(validated) ~= "table" then
|
|
220
280
|
validated = {}
|
|
221
281
|
end
|
|
@@ -282,22 +342,6 @@ local function make_options_util(ctx)
|
|
|
282
342
|
opts["extend"] = extend
|
|
283
343
|
end
|
|
284
344
|
|
|
285
|
-
-- Derived clean config.
|
|
286
|
-
local clean_keys = "key,token,id"
|
|
287
|
-
local ck = vs.getpath(opts, "clean.keys")
|
|
288
|
-
if type(ck) == "string" then
|
|
289
|
-
clean_keys = ck
|
|
290
|
-
end
|
|
291
|
-
|
|
292
|
-
local parts = {}
|
|
293
|
-
for part in string.gmatch(clean_keys, "[^,]+") do
|
|
294
|
-
local trimmed = part:match("^%s*(.-)%s*$")
|
|
295
|
-
if trimmed ~= "" then
|
|
296
|
-
table.insert(parts, vs.escre(trimmed))
|
|
297
|
-
end
|
|
298
|
-
end
|
|
299
|
-
local keyre = table.concat(parts, "|")
|
|
300
|
-
|
|
301
345
|
-- Resolve the feature add-order: an explicit list order (above) wins;
|
|
302
346
|
-- otherwise order the map test-first, then the remaining names sorted, so
|
|
303
347
|
-- the outcome is deterministic and `test` is always the base transport.
|
|
@@ -354,12 +398,14 @@ local function make_options_util(ctx)
|
|
|
354
398
|
end
|
|
355
399
|
end
|
|
356
400
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
401
|
+
-- Again over the merged result: the config's own defaults can carry one.
|
|
402
|
+
cleanmod.clean_add_sensitive(cleanctx,
|
|
403
|
+
secret_scan(opts, { clean = true, extend = true, __derived__ = true }))
|
|
404
|
+
|
|
405
|
+
opts["__derived__"] = {
|
|
406
|
+
clean = cleancfg,
|
|
407
|
+
featureorder = featureorder,
|
|
408
|
+
}
|
|
363
409
|
|
|
364
410
|
return opts
|
|
365
411
|
end
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
local Utility = require("core.utility_type")
|
|
4
4
|
|
|
5
5
|
local clean = require("utility.clean")
|
|
6
|
+
local clean_explain = require("utility.clean_explain")
|
|
6
7
|
local done = require("utility.done")
|
|
7
8
|
local make_error = require("utility.make_error")
|
|
8
9
|
local feature_add = require("utility.feature_add")
|
|
@@ -35,7 +36,9 @@ local transform_response = require("utility.transform_response")
|
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
local function register_all(u)
|
|
38
|
-
u.clean = clean
|
|
39
|
+
u.clean = clean.clean
|
|
40
|
+
u.clean_add = clean.clean_add
|
|
41
|
+
u.clean_explain = clean_explain
|
|
39
42
|
u.done = done
|
|
40
43
|
u.make_error = make_error
|
|
41
44
|
u.feature_add = feature_add
|
|
@@ -87,6 +87,10 @@ SDK = $(RUNTIME) sdk_config.ml $(ENTITIES) sdk_client.ml sdk_error.ml
|
|
|
87
87
|
|
|
88
88
|
ENTITY_TESTS = $(sort $(wildcard test/*_entity_test.ml) $(wildcard test/*_direct_test.ml))
|
|
89
89
|
|
|
90
|
+
# The canary sweep (generated: test/clean_test.ml), which prints the
|
|
91
|
+
# `clean: swept N surface(s), M leak(s)` line sdkgen's lane reads.
|
|
92
|
+
CLEAN_TESTS = $(sort $(wildcard test/clean_test.ml))
|
|
93
|
+
|
|
90
94
|
# Doc-example structural gate (present only when the readme phase generated it).
|
|
91
95
|
# Wildcard so an absent file is simply skipped, never a missing-target error.
|
|
92
96
|
DOC_TESTS = $(sort $(wildcard test/readme_examples_test.ml))
|
|
@@ -96,7 +100,7 @@ DOC_TESTS = $(sort $(wildcard test/readme_examples_test.ml))
|
|
|
96
100
|
SDK_TEST = $(RUNTIME) sdk_config.ml $(ENTITIES) sdk_client.ml sdk_error.ml \
|
|
97
101
|
test/testutil.ml test/harness.ml \
|
|
98
102
|
test/t_pipeline.ml test/t_feature.ml test/custom_utility.ml \
|
|
99
|
-
$(ENTITY_TESTS) $(DOC_TESTS) $(FEATURE_TESTS) test/t_main.ml
|
|
103
|
+
$(ENTITY_TESTS) $(CLEAN_TESTS) $(DOC_TESTS) $(FEATURE_TESTS) test/t_main.ml
|
|
100
104
|
|
|
101
105
|
# The struct corpus needs only the struct library and the corpus engine —
|
|
102
106
|
# omni carries its own JSON reader and regex engine, so nothing of the SDK
|