@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
|
@@ -83,12 +83,22 @@ pub const ProxyFeature = struct {
|
|
|
83
83
|
}
|
|
84
84
|
const no_proxy: []const []const u8 = np_list.toOwnedSlice(h.A()) catch &.{};
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
const util = ctx.util();
|
|
87
|
+
|
|
88
|
+
// A proxy URL may carry credentials as userinfo, from the option or
|
|
89
|
+
// the environment, and neither is under a sensitive key name.
|
|
90
|
+
for (userinfo_parts(url)) |part| {
|
|
91
|
+
util.clean_add(ctx, part);
|
|
92
|
+
util.clean_add(ctx, percent_decode(part));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// The tracked url is what a caller reads back, so it is cleaned; the
|
|
96
|
+
// wrapper routes with the raw one.
|
|
97
|
+
self.track.url = util.clean_str(ctx, url);
|
|
87
98
|
self.track.no_proxy = no_proxy;
|
|
88
99
|
|
|
89
|
-
const util = ctx.util();
|
|
90
100
|
const w = h.A().create(WrapCtx) catch unreachable;
|
|
91
|
-
w.* = .{ .inner = util.fetcher, .track = self.track };
|
|
101
|
+
w.* = .{ .inner = util.fetcher, .track = self.track, .url = url };
|
|
92
102
|
util.fetcher = .{ .ctx = @ptrCast(w), .call = wrapCall };
|
|
93
103
|
}
|
|
94
104
|
fn vdispatch(p: *anyopaque, name: []const u8, ctx: *Context) void {
|
|
@@ -113,14 +123,46 @@ pub const ProxyFeature = struct {
|
|
|
113
123
|
const WrapCtx = struct {
|
|
114
124
|
inner: Fetcher,
|
|
115
125
|
track: *ProxyTrack,
|
|
126
|
+
url: []const u8,
|
|
116
127
|
};
|
|
117
128
|
|
|
118
129
|
fn wrapCall(p: *anyopaque, ctx: *Context, url: []const u8, fetchdef: Value) err.E!Value {
|
|
119
130
|
const w: *WrapCtx = @ptrCast(@alignCast(p));
|
|
120
|
-
const routed = route(w.track, url, fetchdef);
|
|
131
|
+
const routed = route(w.url, w.track, url, fetchdef);
|
|
121
132
|
return w.inner.invoke(ctx, url, routed);
|
|
122
133
|
}
|
|
123
134
|
|
|
135
|
+
// The user and password of `scheme://user:pass@host`, raw as written.
|
|
136
|
+
fn userinfo_parts(url: []const u8) []const []const u8 {
|
|
137
|
+
var out: std.ArrayList([]const u8) = .empty;
|
|
138
|
+
const start = if (std.mem.indexOf(u8, url, "://")) |i| i + 3 else return &.{};
|
|
139
|
+
const rest = url[start..];
|
|
140
|
+
const at = std.mem.indexOfScalar(u8, rest, '@') orelse return &.{};
|
|
141
|
+
const userinfo = rest[0..at];
|
|
142
|
+
if (std.mem.indexOfScalar(u8, userinfo, '/') != null) return &.{};
|
|
143
|
+
var it = std.mem.splitScalar(u8, userinfo, ':');
|
|
144
|
+
while (it.next()) |part| {
|
|
145
|
+
if (part.len != 0) out.append(h.A(), part) catch {};
|
|
146
|
+
}
|
|
147
|
+
return out.toOwnedSlice(h.A()) catch &.{};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
fn percent_decode(s: []const u8) []const u8 {
|
|
151
|
+
var out: std.ArrayList(u8) = .empty;
|
|
152
|
+
var i: usize = 0;
|
|
153
|
+
while (i < s.len) : (i += 1) {
|
|
154
|
+
if (s[i] == '%' and i + 3 <= s.len) {
|
|
155
|
+
if (std.fmt.parseInt(u8, s[i + 1 .. i + 3], 16)) |byte| {
|
|
156
|
+
out.append(h.A(), byte) catch {};
|
|
157
|
+
i += 2;
|
|
158
|
+
continue;
|
|
159
|
+
} else |_| {}
|
|
160
|
+
}
|
|
161
|
+
out.append(h.A(), s[i]) catch {};
|
|
162
|
+
}
|
|
163
|
+
return out.toOwnedSlice(h.A()) catch s;
|
|
164
|
+
}
|
|
165
|
+
|
|
124
166
|
// Zig 0.16 has no free-standing environment lookup: the block the process was
|
|
125
167
|
// started with is owned by an Io implementation, and library code is expected
|
|
126
168
|
// to be handed one. The SDK's Io is the process-global singleton (core/mem.zig),
|
|
@@ -165,8 +207,7 @@ fn bypass(no_proxy: []const []const u8, url: []const u8) bool {
|
|
|
165
207
|
return false;
|
|
166
208
|
}
|
|
167
209
|
|
|
168
|
-
fn route(track: *ProxyTrack, url: []const u8, fetchdef: Value) Value {
|
|
169
|
-
const proxy_url = track.url;
|
|
210
|
+
fn route(proxy_url: []const u8, track: *ProxyTrack, url: []const u8, fetchdef: Value) Value {
|
|
170
211
|
const no_proxy = track.no_proxy;
|
|
171
212
|
|
|
172
213
|
if (proxy_url.len == 0 or bypass(no_proxy, url)) {
|
|
@@ -300,6 +300,10 @@ pub const SecretsFeature = struct {
|
|
|
300
300
|
var specs: std.ArrayList(sekreto.ProviderSpec) = .empty;
|
|
301
301
|
|
|
302
302
|
if (0 != explicit.len) {
|
|
303
|
+
// Every value this feature resolves or buys is a secret the SDK
|
|
304
|
+
// handles, and none arrives under an option key the intake
|
|
305
|
+
// registration saw.
|
|
306
|
+
util.clean_add(ctx, explicit);
|
|
303
307
|
const keyed = sekreto.envkey(alloc, st.secretname, "") catch
|
|
304
308
|
sekreto.Answer([]const u8){ .err = "secrets: out of memory" };
|
|
305
309
|
switch (keyed) {
|
|
@@ -572,6 +576,7 @@ fn resolve_once(st: *State, ctx: *Context) E!void {
|
|
|
572
576
|
.err => |message| return ctx.fail(ERRCODE, h.A().dupe(u8, message) catch message),
|
|
573
577
|
.ok => |v| v,
|
|
574
578
|
};
|
|
579
|
+
if (value) |v| ctx.util().clean_add(ctx, v);
|
|
575
580
|
|
|
576
581
|
if (st.exchange == null) {
|
|
577
582
|
// An UNCACHED miss after an earlier hit is a revocation: the chain
|
|
@@ -793,6 +798,8 @@ fn buy(st: *State, ctx: *Context) E![]const u8 {
|
|
|
793
798
|
) catch "secrets: token exchange returned no token");
|
|
794
799
|
}
|
|
795
800
|
|
|
801
|
+
ctx.util().clean_add(ctx, token);
|
|
802
|
+
|
|
796
803
|
st.cred = token;
|
|
797
804
|
return token;
|
|
798
805
|
}
|
|
@@ -72,12 +72,14 @@ pub const TelemetryFeature = struct {
|
|
|
72
72
|
h.setp(span, "durationMs", h.vnum(dur));
|
|
73
73
|
h.setp(span, "ok", h.vbool(ok));
|
|
74
74
|
|
|
75
|
+
const out = ctx.util().clean(ctx, span);
|
|
76
|
+
|
|
75
77
|
self.active_spans -= 1;
|
|
76
|
-
self.spans.append(h.A(),
|
|
78
|
+
self.spans.append(h.A(), out) catch {};
|
|
77
79
|
|
|
78
80
|
const exporter = h.getp(self.options, "exporter");
|
|
79
81
|
if (exporter == .function) {
|
|
80
|
-
_ = h.call_vfn(exporter,
|
|
82
|
+
_ = h.call_vfn(exporter, out);
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
|
|
@@ -697,7 +697,7 @@ test "feature debug: redacts and honours onentry max" {
|
|
|
697
697
|
try testing.expect(df.entries.items.len == 1);
|
|
698
698
|
try testing.expect(seen.len() == 2);
|
|
699
699
|
const hdrs = h.getp(seen.at(0), "headers");
|
|
700
|
-
try testing.expect(h.veq(h.getp(hdrs, "authorization"), h.vstr("
|
|
700
|
+
try testing.expect(h.veq(h.getp(hdrs, "authorization"), h.vstr("[redacted]")));
|
|
701
701
|
}
|
|
702
702
|
|
|
703
703
|
test "feature debug: captures failures" {
|
|
@@ -728,7 +728,7 @@ test "feature debug: injected clock and custom redact" {
|
|
|
728
728
|
.{ "x-ok", h.vstr("show") },
|
|
729
729
|
}) });
|
|
730
730
|
const hdrs = h.getp(df.entries.items[0], "headers");
|
|
731
|
-
try testing.expect(h.veq(h.getp(hdrs, "x-secret"), h.vstr("
|
|
731
|
+
try testing.expect(h.veq(h.getp(hdrs, "x-secret"), h.vstr("[redacted]")));
|
|
732
732
|
try testing.expect(h.veq(h.getp(hdrs, "x-ok"), h.vstr("show")));
|
|
733
733
|
}
|
|
734
734
|
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import Path from 'node:path'
|
|
2
|
+
|
|
3
|
+
import { createHash } from 'node:crypto'
|
|
4
|
+
|
|
5
|
+
import type { ActionContext } from '../types'
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
definitionFileName, definitionFolder, indexName,
|
|
9
|
+
} from '../helpers/definition'
|
|
10
|
+
|
|
11
|
+
import { KINDS } from './kind'
|
|
12
|
+
|
|
13
|
+
import type { Source } from './resolve'
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// What every add last wrote into `.sdk`, by fingerprint, and the version of
|
|
17
|
+
// the package each item came from. It is the only record that tells a copy
|
|
18
|
+
// the project changed from one its source has since moved past.
|
|
19
|
+
const COPIES = 'sdkgen-copies.json'
|
|
20
|
+
|
|
21
|
+
const ABOUT = 'Written by voxgig-sdkgen on every add: what it copied into ' +
|
|
22
|
+
'.sdk, so that doctor, generate and package update can tell an outdated ' +
|
|
23
|
+
'copy from a local edit. Commit it; do not edit it.'
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
type CopyItem = {
|
|
27
|
+
package?: string
|
|
28
|
+
version?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type CopyRecord = {
|
|
32
|
+
items: Record<string, CopyItem>
|
|
33
|
+
files: Record<string, string>
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
function copiesPath(folder: string): string {
|
|
38
|
+
return Path.join(folder, COPIES)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
function itemKey(kind: string, name: string): string {
|
|
43
|
+
return kind + '/' + name
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
// CRLF and LF copies of one file share a fingerprint, as doctor compares
|
|
48
|
+
// them. latin1 maps each byte to one character, so nothing else changes.
|
|
49
|
+
function fingerprint(content: any): string {
|
|
50
|
+
const bytes = Buffer.isBuffer(content) ? content : Buffer.from(String(content))
|
|
51
|
+
const lf = Buffer.from(bytes.toString('latin1').replace(/\r\n/g, '\n'), 'latin1')
|
|
52
|
+
return createHash('sha256').update(lf).digest('hex').slice(0, 16)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
// An unreadable record is treated as absent: every copy is then unrecorded,
|
|
57
|
+
// which is exactly the state of a project from before the record existed.
|
|
58
|
+
function readCopies(fs: any, folder: string): CopyRecord {
|
|
59
|
+
const empty: CopyRecord = { items: {}, files: {} }
|
|
60
|
+
const path = copiesPath(folder)
|
|
61
|
+
|
|
62
|
+
if (!fs.existsSync(path)) {
|
|
63
|
+
return empty
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
const read = JSON.parse(String(fs.readFileSync(path, 'utf8')))
|
|
68
|
+
return {
|
|
69
|
+
items: { ...(read?.items ?? {}) },
|
|
70
|
+
files: { ...(read?.files ?? {}) },
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch (err: any) {
|
|
74
|
+
return empty
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
function writeCopies(fs: any, folder: string, record: CopyRecord) {
|
|
80
|
+
const sorted = (obj: Record<string, any>) => Object.fromEntries(
|
|
81
|
+
Object.keys(obj).sort().map((key: string) => [key, obj[key]]))
|
|
82
|
+
|
|
83
|
+
fs.writeFileSync(copiesPath(folder), JSON.stringify({
|
|
84
|
+
about: ABOUT,
|
|
85
|
+
items: sorted(record.items),
|
|
86
|
+
files: sorted(record.files),
|
|
87
|
+
}, null, 2) + '\n')
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
function provenanceOf(source: Source): CopyItem {
|
|
92
|
+
return {
|
|
93
|
+
...(null == source.package ? {} : { package: source.package }),
|
|
94
|
+
...(null == source.version ? {} : { version: source.version }),
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
// The trees and definition files an add owns. An index is excluded: every
|
|
100
|
+
// add rewrites it and no source holds a copy to compare it with.
|
|
101
|
+
const TREE_ROOTS = Array.from(new Set(Object.values(KINDS)
|
|
102
|
+
.flatMap((kind: any) => (kind.trees ?? [])
|
|
103
|
+
.map((tree: any) => String(tree.path).split('{name}')[0]))))
|
|
104
|
+
|
|
105
|
+
function isCopy(rel: string): boolean {
|
|
106
|
+
if (TREE_ROOTS.some((root: string) => rel.startsWith(root))) {
|
|
107
|
+
return true
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const dir = Path.posix.dirname(rel)
|
|
111
|
+
const base = Path.posix.basename(rel)
|
|
112
|
+
|
|
113
|
+
return Object.keys(KINDS).some((kind: string) =>
|
|
114
|
+
dir === definitionFolder('', kind).split(Path.sep).join('/') &&
|
|
115
|
+
base !== indexName(kind) &&
|
|
116
|
+
base.endsWith(definitionFileName('')))
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
function relativeTo(folder: string, abs: string): string | undefined {
|
|
121
|
+
const rel = Path.relative(Path.resolve(folder), Path.resolve(abs))
|
|
122
|
+
.split(Path.sep).join('/')
|
|
123
|
+
|
|
124
|
+
return ('' === rel || rel.startsWith('../') || Path.isAbsolute(rel)) ?
|
|
125
|
+
undefined : rel
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
// Called by each add with what its own jostraca run wrote. A dry run writes
|
|
130
|
+
// nothing, so it records nothing.
|
|
131
|
+
function recordCopies(
|
|
132
|
+
actx: ActionContext, jres: any, kind: string, sources: Source[],
|
|
133
|
+
) {
|
|
134
|
+
if (true === actx.opts?.dryrun || null == jres?.files) {
|
|
135
|
+
return
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const fs = actx.fs()
|
|
139
|
+
const folder = actx.folder
|
|
140
|
+
const record = readCopies(fs, folder)
|
|
141
|
+
|
|
142
|
+
const files: string[] = [
|
|
143
|
+
...(jres.files.written ?? []), ...(jres.files.unchanged ?? []),
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
for (const abs of files) {
|
|
147
|
+
const rel = relativeTo(folder, abs)
|
|
148
|
+
|
|
149
|
+
if (null != rel && isCopy(rel) && fs.existsSync(abs)) {
|
|
150
|
+
record.files[rel] = fingerprint(fs.readFileSync(abs))
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
for (const source of sources) {
|
|
155
|
+
record.items[itemKey(kind, source.name)] = provenanceOf(source)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
pruneMissing(fs, folder, record)
|
|
159
|
+
writeCopies(fs, folder, record)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
// After a remove: the item goes, with every file entry nothing holds now.
|
|
164
|
+
function forgetCopies(actx: ActionContext, kind: string, name: string) {
|
|
165
|
+
const fs = actx.fs()
|
|
166
|
+
const folder = actx.folder
|
|
167
|
+
|
|
168
|
+
if (true === actx.opts?.dryrun || !fs.existsSync(copiesPath(folder))) {
|
|
169
|
+
return
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const record = readCopies(fs, folder)
|
|
173
|
+
delete record.items[itemKey(kind, name)]
|
|
174
|
+
pruneMissing(fs, folder, record)
|
|
175
|
+
writeCopies(fs, folder, record)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
function pruneMissing(fs: any, folder: string, record: CopyRecord) {
|
|
180
|
+
for (const rel of Object.keys(record.files)) {
|
|
181
|
+
if (!fs.existsSync(Path.join(folder, ...rel.split('/')))) {
|
|
182
|
+
delete record.files[rel]
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
// Was this project file left exactly as an add wrote it?
|
|
189
|
+
function untouched(
|
|
190
|
+
fs: any, folder: string, record: CopyRecord, rel: string,
|
|
191
|
+
): boolean | undefined {
|
|
192
|
+
const recorded = record.files[rel]
|
|
193
|
+
|
|
194
|
+
if (null == recorded) {
|
|
195
|
+
return undefined
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const abs = Path.join(folder, ...rel.split('/'))
|
|
199
|
+
|
|
200
|
+
return fs.existsSync(abs) && recorded === fingerprint(fs.readFileSync(abs))
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
export type {
|
|
205
|
+
CopyItem,
|
|
206
|
+
CopyRecord,
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export {
|
|
210
|
+
COPIES,
|
|
211
|
+
copiesPath,
|
|
212
|
+
itemKey,
|
|
213
|
+
fingerprint,
|
|
214
|
+
readCopies,
|
|
215
|
+
recordCopies,
|
|
216
|
+
forgetCopies,
|
|
217
|
+
untouched,
|
|
218
|
+
isCopy,
|
|
219
|
+
}
|