@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
package/bin/voxgig-sdkgen
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ActionContext } from '../types';
|
|
2
|
+
import type { Source } from './resolve';
|
|
3
|
+
declare const COPIES = "sdkgen-copies.json";
|
|
4
|
+
type CopyItem = {
|
|
5
|
+
package?: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
};
|
|
8
|
+
type CopyRecord = {
|
|
9
|
+
items: Record<string, CopyItem>;
|
|
10
|
+
files: Record<string, string>;
|
|
11
|
+
};
|
|
12
|
+
declare function copiesPath(folder: string): string;
|
|
13
|
+
declare function itemKey(kind: string, name: string): string;
|
|
14
|
+
declare function fingerprint(content: any): string;
|
|
15
|
+
declare function readCopies(fs: any, folder: string): CopyRecord;
|
|
16
|
+
declare function isCopy(rel: string): boolean;
|
|
17
|
+
declare function recordCopies(actx: ActionContext, jres: any, kind: string, sources: Source[]): void;
|
|
18
|
+
declare function forgetCopies(actx: ActionContext, kind: string, name: string): void;
|
|
19
|
+
declare function untouched(fs: any, folder: string, record: CopyRecord, rel: string): boolean | undefined;
|
|
20
|
+
export type { CopyItem, CopyRecord, };
|
|
21
|
+
export { COPIES, copiesPath, itemKey, fingerprint, readCopies, recordCopies, forgetCopies, untouched, isCopy, };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.COPIES = void 0;
|
|
7
|
+
exports.copiesPath = copiesPath;
|
|
8
|
+
exports.itemKey = itemKey;
|
|
9
|
+
exports.fingerprint = fingerprint;
|
|
10
|
+
exports.readCopies = readCopies;
|
|
11
|
+
exports.recordCopies = recordCopies;
|
|
12
|
+
exports.forgetCopies = forgetCopies;
|
|
13
|
+
exports.untouched = untouched;
|
|
14
|
+
exports.isCopy = isCopy;
|
|
15
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
16
|
+
const node_crypto_1 = require("node:crypto");
|
|
17
|
+
const definition_1 = require("../helpers/definition");
|
|
18
|
+
const kind_1 = require("./kind");
|
|
19
|
+
// What every add last wrote into `.sdk`, by fingerprint, and the version of
|
|
20
|
+
// the package each item came from. It is the only record that tells a copy
|
|
21
|
+
// the project changed from one its source has since moved past.
|
|
22
|
+
const COPIES = 'sdkgen-copies.json';
|
|
23
|
+
exports.COPIES = COPIES;
|
|
24
|
+
const ABOUT = 'Written by voxgig-sdkgen on every add: what it copied into ' +
|
|
25
|
+
'.sdk, so that doctor, generate and package update can tell an outdated ' +
|
|
26
|
+
'copy from a local edit. Commit it; do not edit it.';
|
|
27
|
+
function copiesPath(folder) {
|
|
28
|
+
return node_path_1.default.join(folder, COPIES);
|
|
29
|
+
}
|
|
30
|
+
function itemKey(kind, name) {
|
|
31
|
+
return kind + '/' + name;
|
|
32
|
+
}
|
|
33
|
+
// CRLF and LF copies of one file share a fingerprint, as doctor compares
|
|
34
|
+
// them. latin1 maps each byte to one character, so nothing else changes.
|
|
35
|
+
function fingerprint(content) {
|
|
36
|
+
const bytes = Buffer.isBuffer(content) ? content : Buffer.from(String(content));
|
|
37
|
+
const lf = Buffer.from(bytes.toString('latin1').replace(/\r\n/g, '\n'), 'latin1');
|
|
38
|
+
return (0, node_crypto_1.createHash)('sha256').update(lf).digest('hex').slice(0, 16);
|
|
39
|
+
}
|
|
40
|
+
// An unreadable record is treated as absent: every copy is then unrecorded,
|
|
41
|
+
// which is exactly the state of a project from before the record existed.
|
|
42
|
+
function readCopies(fs, folder) {
|
|
43
|
+
const empty = { items: {}, files: {} };
|
|
44
|
+
const path = copiesPath(folder);
|
|
45
|
+
if (!fs.existsSync(path)) {
|
|
46
|
+
return empty;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const read = JSON.parse(String(fs.readFileSync(path, 'utf8')));
|
|
50
|
+
return {
|
|
51
|
+
items: { ...(read?.items ?? {}) },
|
|
52
|
+
files: { ...(read?.files ?? {}) },
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
return empty;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function writeCopies(fs, folder, record) {
|
|
60
|
+
const sorted = (obj) => Object.fromEntries(Object.keys(obj).sort().map((key) => [key, obj[key]]));
|
|
61
|
+
fs.writeFileSync(copiesPath(folder), JSON.stringify({
|
|
62
|
+
about: ABOUT,
|
|
63
|
+
items: sorted(record.items),
|
|
64
|
+
files: sorted(record.files),
|
|
65
|
+
}, null, 2) + '\n');
|
|
66
|
+
}
|
|
67
|
+
function provenanceOf(source) {
|
|
68
|
+
return {
|
|
69
|
+
...(null == source.package ? {} : { package: source.package }),
|
|
70
|
+
...(null == source.version ? {} : { version: source.version }),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
// The trees and definition files an add owns. An index is excluded: every
|
|
74
|
+
// add rewrites it and no source holds a copy to compare it with.
|
|
75
|
+
const TREE_ROOTS = Array.from(new Set(Object.values(kind_1.KINDS)
|
|
76
|
+
.flatMap((kind) => (kind.trees ?? [])
|
|
77
|
+
.map((tree) => String(tree.path).split('{name}')[0]))));
|
|
78
|
+
function isCopy(rel) {
|
|
79
|
+
if (TREE_ROOTS.some((root) => rel.startsWith(root))) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
const dir = node_path_1.default.posix.dirname(rel);
|
|
83
|
+
const base = node_path_1.default.posix.basename(rel);
|
|
84
|
+
return Object.keys(kind_1.KINDS).some((kind) => dir === (0, definition_1.definitionFolder)('', kind).split(node_path_1.default.sep).join('/') &&
|
|
85
|
+
base !== (0, definition_1.indexName)(kind) &&
|
|
86
|
+
base.endsWith((0, definition_1.definitionFileName)('')));
|
|
87
|
+
}
|
|
88
|
+
function relativeTo(folder, abs) {
|
|
89
|
+
const rel = node_path_1.default.relative(node_path_1.default.resolve(folder), node_path_1.default.resolve(abs))
|
|
90
|
+
.split(node_path_1.default.sep).join('/');
|
|
91
|
+
return ('' === rel || rel.startsWith('../') || node_path_1.default.isAbsolute(rel)) ?
|
|
92
|
+
undefined : rel;
|
|
93
|
+
}
|
|
94
|
+
// Called by each add with what its own jostraca run wrote. A dry run writes
|
|
95
|
+
// nothing, so it records nothing.
|
|
96
|
+
function recordCopies(actx, jres, kind, sources) {
|
|
97
|
+
if (true === actx.opts?.dryrun || null == jres?.files) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const fs = actx.fs();
|
|
101
|
+
const folder = actx.folder;
|
|
102
|
+
const record = readCopies(fs, folder);
|
|
103
|
+
const files = [
|
|
104
|
+
...(jres.files.written ?? []), ...(jres.files.unchanged ?? []),
|
|
105
|
+
];
|
|
106
|
+
for (const abs of files) {
|
|
107
|
+
const rel = relativeTo(folder, abs);
|
|
108
|
+
if (null != rel && isCopy(rel) && fs.existsSync(abs)) {
|
|
109
|
+
record.files[rel] = fingerprint(fs.readFileSync(abs));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
for (const source of sources) {
|
|
113
|
+
record.items[itemKey(kind, source.name)] = provenanceOf(source);
|
|
114
|
+
}
|
|
115
|
+
pruneMissing(fs, folder, record);
|
|
116
|
+
writeCopies(fs, folder, record);
|
|
117
|
+
}
|
|
118
|
+
// After a remove: the item goes, with every file entry nothing holds now.
|
|
119
|
+
function forgetCopies(actx, kind, name) {
|
|
120
|
+
const fs = actx.fs();
|
|
121
|
+
const folder = actx.folder;
|
|
122
|
+
if (true === actx.opts?.dryrun || !fs.existsSync(copiesPath(folder))) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const record = readCopies(fs, folder);
|
|
126
|
+
delete record.items[itemKey(kind, name)];
|
|
127
|
+
pruneMissing(fs, folder, record);
|
|
128
|
+
writeCopies(fs, folder, record);
|
|
129
|
+
}
|
|
130
|
+
function pruneMissing(fs, folder, record) {
|
|
131
|
+
for (const rel of Object.keys(record.files)) {
|
|
132
|
+
if (!fs.existsSync(node_path_1.default.join(folder, ...rel.split('/')))) {
|
|
133
|
+
delete record.files[rel];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// Was this project file left exactly as an add wrote it?
|
|
138
|
+
function untouched(fs, folder, record, rel) {
|
|
139
|
+
const recorded = record.files[rel];
|
|
140
|
+
if (null == recorded) {
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
const abs = node_path_1.default.join(folder, ...rel.split('/'));
|
|
144
|
+
return fs.existsSync(abs) && recorded === fingerprint(fs.readFileSync(abs));
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=copies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copies.js","sourceRoot":"","sources":["../../src/action/copies.ts"],"names":[],"mappings":";;;;;;QAkNE,UAAU;QACV,OAAO;QACP,WAAW;QACX,UAAU;QACV,YAAY;QACZ,YAAY;QACZ,SAAS;QACT,MAAM;AAzNR,0DAA4B;AAE5B,6CAAwC;AAIxC,sDAE8B;AAE9B,iCAA8B;AAK9B,4EAA4E;AAC5E,2EAA2E;AAC3E,gEAAgE;AAChE,MAAM,MAAM,GAAG,oBAAoB,CAAA;QA+LjC,MAAM;AA7LR,MAAM,K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C,EAAE,CAAC;YACzD,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAC1B,CAAC;IACH,CAAC;AACH,CAAC;AAGD,yDAAyD;AACzD,SAAS,SAAS,CAChB,EAAO,EAAE,MAAc,EAAE,MAAkB,EAAE,GAAW;IAExD,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAElC,IAAI,IAAI,IAAI,QAAQ,EAAE,CAAC;QACrB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,GAAG,GAAG,mBAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;IAEhD,OAAO,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,QAAQ,KAAK,WAAW,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAA;AAC7E,CAAC"}
|
package/dist/action/doctor.d.ts
CHANGED
|
@@ -10,10 +10,23 @@ type DoctorReport = {
|
|
|
10
10
|
orphanModel: string[];
|
|
11
11
|
resyncPending: string[];
|
|
12
12
|
aliasedDiff: string[];
|
|
13
|
+
outdated: string[];
|
|
14
|
+
unrecorded: string[];
|
|
15
|
+
byItem: Record<string, ItemDrift>;
|
|
13
16
|
ok: boolean;
|
|
14
17
|
};
|
|
18
|
+
type ItemDrift = {
|
|
19
|
+
package?: string;
|
|
20
|
+
from?: string;
|
|
21
|
+
to?: string;
|
|
22
|
+
outdated: number;
|
|
23
|
+
changed: number;
|
|
24
|
+
};
|
|
15
25
|
declare function action_doctor(args: string[], actx: ActionContext): Promise<ActionResult>;
|
|
16
26
|
type DoctorScope = (kind: string, name: string) => boolean;
|
|
17
27
|
declare function doctor(actx: ActionContext, scope?: DoctorScope, selected?: string[]): Promise<ActionResult>;
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
declare function refreshCommand(item: string, pkg?: string): string;
|
|
29
|
+
declare function copyCheck(actx: ActionContext): Promise<string[]>;
|
|
30
|
+
declare function copyWarnings(report: DoctorReport): string[];
|
|
31
|
+
export type { DoctorReport, DoctorScope, ItemDrift, };
|
|
32
|
+
export { action_doctor, doctor, copyCheck, copyWarnings, refreshCommand, };
|
package/dist/action/doctor.js
CHANGED
|
@@ -5,6 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.action_doctor = action_doctor;
|
|
7
7
|
exports.doctor = doctor;
|
|
8
|
+
exports.copyCheck = copyCheck;
|
|
9
|
+
exports.copyWarnings = copyWarnings;
|
|
10
|
+
exports.refreshCommand = refreshCommand;
|
|
8
11
|
const kindCollection_1 = require("../helpers/kindCollection");
|
|
9
12
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
13
|
const jostraca_1 = require("jostraca");
|
|
@@ -17,6 +20,7 @@ const resolve_1 = require("./resolve");
|
|
|
17
20
|
const definition_1 = require("../helpers/definition");
|
|
18
21
|
const featureSource_1 = require("../helpers/featureSource");
|
|
19
22
|
const junk_1 = require("../helpers/junk");
|
|
23
|
+
const copies_1 = require("./copies");
|
|
20
24
|
const IGNORED_RE = /(~|-jostraca-off)$/;
|
|
21
25
|
function ignoredEntry(name) {
|
|
22
26
|
return IGNORED_RE.test(name) || (0, junk_1.isJunk)(name);
|
|
@@ -134,8 +138,10 @@ async function doctor(actx, scope, selected) {
|
|
|
134
138
|
const report = {
|
|
135
139
|
forked: [], edited: [], stale: [], missing: [], additive: [],
|
|
136
140
|
superseded: [], unwired: [], orphanModel: [],
|
|
137
|
-
resyncPending: [], aliasedDiff: [],
|
|
141
|
+
resyncPending: [], aliasedDiff: [],
|
|
142
|
+
outdated: [], unrecorded: [], byItem: {}, ok: true,
|
|
138
143
|
};
|
|
144
|
+
const copies = (0, copies_1.readCopies)(fs, root);
|
|
139
145
|
report.superseded = supersededFiles(actx);
|
|
140
146
|
report.orphanModel = orphanModelFiles(actx);
|
|
141
147
|
const kinds = Object.keys(kind_1.KINDS).sort();
|
|
@@ -162,20 +168,21 @@ async function doctor(actx, scope, selected) {
|
|
|
162
168
|
if (null == source) {
|
|
163
169
|
continue;
|
|
164
170
|
}
|
|
171
|
+
const found = noteDrift(actx, report, copies, kind, source);
|
|
165
172
|
if ('target' === kind) {
|
|
166
|
-
checkTarget(actx, source, report, selected);
|
|
173
|
+
checkTarget(actx, source, report, found, selected);
|
|
167
174
|
}
|
|
168
175
|
if ('edition' === kind) {
|
|
169
|
-
checkEdition(actx, source, report);
|
|
176
|
+
checkEdition(actx, source, report, found);
|
|
170
177
|
}
|
|
171
178
|
// Only an ACTIVE feature has source copied out; an inactive one's
|
|
172
179
|
// leftovers are stale. `selected` overrides that for the caller's own.
|
|
173
180
|
if ('feature' === kind &&
|
|
174
181
|
(false !== model?.main?.[types_1.KIT]?.feature?.[name]?.active ||
|
|
175
182
|
true === selected?.includes(name))) {
|
|
176
|
-
checkFeatureSource(actx, source, targets,
|
|
183
|
+
checkFeatureSource(actx, source, targets, found);
|
|
177
184
|
}
|
|
178
|
-
checkItemModel(actx, kind, source, report);
|
|
185
|
+
checkItemModel(actx, kind, source, report, found);
|
|
179
186
|
}
|
|
180
187
|
}
|
|
181
188
|
if (null == scope) {
|
|
@@ -188,7 +195,7 @@ async function doctor(actx, scope, selected) {
|
|
|
188
195
|
// authoritative either way.
|
|
189
196
|
report.ok = 0 === report.forked.length + report.edited.length +
|
|
190
197
|
report.stale.length + report.missing.length + report.superseded.length +
|
|
191
|
-
report.orphanModel.length;
|
|
198
|
+
report.orphanModel.length + report.outdated.length;
|
|
192
199
|
for (const [kind, note] of [
|
|
193
200
|
['forked', 'FORKED (will be reverted by `target add`)'],
|
|
194
201
|
['edited', 'EDITED template master'],
|
|
@@ -200,11 +207,22 @@ async function doctor(actx, scope, selected) {
|
|
|
200
207
|
['orphanModel', 'ORPHAN MODEL FILE (on disk, included by nothing, read by nobody)'],
|
|
201
208
|
['resyncPending', 'RESYNC PENDING (predates provenance; `target add` updates it)'],
|
|
202
209
|
['aliasedDiff', 'aliased model differs from its origin (project-owned, not drift)'],
|
|
210
|
+
['outdated', 'OUTDATED (unchanged since it was copied, but its source has moved on)'],
|
|
203
211
|
]) {
|
|
204
212
|
for (const file of report[kind]) {
|
|
205
213
|
log.info({ point: 'doctor-finding', kind, file, note: note + ': ' + file });
|
|
206
214
|
}
|
|
207
215
|
}
|
|
216
|
+
for (const item of Object.keys(report.byItem).sort()) {
|
|
217
|
+
const drift = report.byItem[item];
|
|
218
|
+
if (0 < drift.outdated) {
|
|
219
|
+
log.info({
|
|
220
|
+
point: 'doctor-outdated', item, ...drift,
|
|
221
|
+
note: outdatedNote(item, drift) + ' - `voxgig-sdkgen ' +
|
|
222
|
+
refreshCommand(item, drift.package) + '` refreshes them'
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
208
226
|
log.info({
|
|
209
227
|
point: 'doctor-end',
|
|
210
228
|
ok: report.ok,
|
|
@@ -218,11 +236,13 @@ async function doctor(actx, scope, selected) {
|
|
|
218
236
|
orphanModel: report.orphanModel.length,
|
|
219
237
|
resyncPending: report.resyncPending.length,
|
|
220
238
|
aliasedDiff: report.aliasedDiff.length,
|
|
239
|
+
outdated: report.outdated.length,
|
|
221
240
|
note: report.ok ?
|
|
222
241
|
('.sdk matches the scaffold (' + report.additive.length + ' additive)') :
|
|
223
242
|
('.sdk has drifted: ' + report.forked.length + ' forked, ' +
|
|
224
243
|
report.edited.length + ' edited, ' + report.stale.length + ' stale, ' +
|
|
225
|
-
report.missing.length + ' missing'
|
|
244
|
+
report.missing.length + ' missing, ' + report.outdated.length +
|
|
245
|
+
' outdated')
|
|
226
246
|
});
|
|
227
247
|
return { report };
|
|
228
248
|
}
|
|
@@ -266,7 +286,7 @@ function resolveDeclared(kind, name, actx) {
|
|
|
266
286
|
return undefined;
|
|
267
287
|
}
|
|
268
288
|
}
|
|
269
|
-
function checkTarget(actx, resolved, report, selected) {
|
|
289
|
+
function checkTarget(actx, resolved, report, found, selected) {
|
|
270
290
|
const tname = resolved.name;
|
|
271
291
|
const tfolder = resolved.folder;
|
|
272
292
|
const torigname = resolved.origname;
|
|
@@ -309,13 +329,13 @@ function checkTarget(actx, resolved, report, selected) {
|
|
|
309
329
|
// different trim from the one `target add` applied and report correctly
|
|
310
330
|
// trimmed files as missing.
|
|
311
331
|
const excludes = (0, target_1.trimFeatures)({ log: quietLog(actx.log), fs: () => fs, folder: root, model }, tfolder, torigname, tname, features);
|
|
312
|
-
compareTrees(actx, report, trees, {
|
|
332
|
+
compareTrees(actx, report, found, trees, {
|
|
313
333
|
excludes,
|
|
314
334
|
foreign: (kind) => 'edited' === kind ?
|
|
315
335
|
foreignFeatureSource(actx, resolved) : [],
|
|
316
336
|
});
|
|
317
337
|
}
|
|
318
|
-
function compareTrees(actx, report, trees, opts) {
|
|
338
|
+
function compareTrees(actx, report, found, trees, opts) {
|
|
319
339
|
const fs = actx.fs();
|
|
320
340
|
const model = actx.model;
|
|
321
341
|
const root = actx.folder;
|
|
@@ -342,7 +362,7 @@ function compareTrees(actx, report, trees, opts) {
|
|
|
342
362
|
const actualSet = new Set(actual);
|
|
343
363
|
for (const rel of expected) {
|
|
344
364
|
if (!actualSet.has(rel)) {
|
|
345
|
-
|
|
365
|
+
found('missing', label + rel);
|
|
346
366
|
continue;
|
|
347
367
|
}
|
|
348
368
|
// A foreign feature's file is EXPECTED here (so it is not stale) but
|
|
@@ -355,7 +375,7 @@ function compareTrees(actx, report, trees, opts) {
|
|
|
355
375
|
}
|
|
356
376
|
const from = landed.get(rel);
|
|
357
377
|
if (differs(fs, from, node_path_1.default.join(tree.project, rel), model, tree.replace, undefined, tree.rewrite)) {
|
|
358
|
-
|
|
378
|
+
found(tree.kind, label + rel);
|
|
359
379
|
}
|
|
360
380
|
}
|
|
361
381
|
for (const rel of actual) {
|
|
@@ -371,12 +391,12 @@ function compareTrees(actx, report, trees, opts) {
|
|
|
371
391
|
report.additive.push(label + rel);
|
|
372
392
|
}
|
|
373
393
|
else {
|
|
374
|
-
|
|
394
|
+
found('stale', label + rel);
|
|
375
395
|
}
|
|
376
396
|
}
|
|
377
397
|
}
|
|
378
398
|
}
|
|
379
|
-
function checkEdition(actx, resolved, report) {
|
|
399
|
+
function checkEdition(actx, resolved, report, found) {
|
|
380
400
|
const fs = actx.fs();
|
|
381
401
|
const root = actx.folder;
|
|
382
402
|
const name = resolved.name;
|
|
@@ -401,7 +421,7 @@ function checkEdition(actx, resolved, report) {
|
|
|
401
421
|
(src) => (0, target_1.aliasCmpText)(src, origname, name) : undefined,
|
|
402
422
|
}];
|
|
403
423
|
});
|
|
404
|
-
compareTrees(actx, report, trees);
|
|
424
|
+
compareTrees(actx, report, found, trees);
|
|
405
425
|
}
|
|
406
426
|
function foreignFeatureSource(actx, target) {
|
|
407
427
|
const out = new Map();
|
|
@@ -445,7 +465,7 @@ function overlayFiles(actx, feature, target) {
|
|
|
445
465
|
}
|
|
446
466
|
return out;
|
|
447
467
|
}
|
|
448
|
-
function checkFeatureSource(actx, feature, targets,
|
|
468
|
+
function checkFeatureSource(actx, feature, targets, found) {
|
|
449
469
|
const fs = actx.fs();
|
|
450
470
|
const root = actx.folder;
|
|
451
471
|
const model = actx.model;
|
|
@@ -454,18 +474,18 @@ function checkFeatureSource(actx, feature, targets, report) {
|
|
|
454
474
|
const project = node_path_1.default.join(root, 'tm', tname, rel);
|
|
455
475
|
const label = 'tm/' + tname + '/' + rel;
|
|
456
476
|
if (!fs.existsSync(project)) {
|
|
457
|
-
|
|
477
|
+
found('missing', label);
|
|
458
478
|
continue;
|
|
459
479
|
}
|
|
460
480
|
// The same map `feature add` copies with — see helpers/stdrep. A
|
|
461
481
|
// different one here would report every substituted file as edited.
|
|
462
482
|
if (differs(fs, from, project, model, (0, stdrep_1.templateReplacements)(model, tname))) {
|
|
463
|
-
|
|
483
|
+
found('edited', label);
|
|
464
484
|
}
|
|
465
485
|
}
|
|
466
486
|
}
|
|
467
487
|
}
|
|
468
|
-
function checkItemModel(actx, kind, source, report) {
|
|
488
|
+
function checkItemModel(actx, kind, source, report, found) {
|
|
469
489
|
const name = source.name;
|
|
470
490
|
const origname = source.origname;
|
|
471
491
|
const base = source.base;
|
|
@@ -478,7 +498,7 @@ function checkItemModel(actx, kind, source, report) {
|
|
|
478
498
|
const project = (0, definition_1.definitionPath)(actx.folder, kind, name);
|
|
479
499
|
const label = 'model/' + kind + '/' + node_path_1.default.basename(project);
|
|
480
500
|
if (!fs.existsSync(project)) {
|
|
481
|
-
|
|
501
|
+
found('missing', label);
|
|
482
502
|
return;
|
|
483
503
|
}
|
|
484
504
|
const provenance = (0, stdrep_1.provenanceReplace)({ base, origname, name, package: source.package });
|
|
@@ -494,7 +514,70 @@ function checkItemModel(actx, kind, source, report) {
|
|
|
494
514
|
report.resyncPending.push(label);
|
|
495
515
|
return;
|
|
496
516
|
}
|
|
497
|
-
|
|
517
|
+
found('forked', label);
|
|
518
|
+
}
|
|
519
|
+
// Files every finding through one place: a forked or edited copy the record
|
|
520
|
+
// shows untouched is outdated instead, and every item keeps a tally.
|
|
521
|
+
function noteDrift(actx, report, copies, kind, source) {
|
|
522
|
+
const fs = actx.fs();
|
|
523
|
+
const item = (0, copies_1.itemKey)(kind, source.name);
|
|
524
|
+
const copied = copies.items[item];
|
|
525
|
+
return (category, label) => {
|
|
526
|
+
let into = category;
|
|
527
|
+
if ('forked' === category || 'edited' === category) {
|
|
528
|
+
const same = (0, copies_1.untouched)(fs, actx.folder, copies, label);
|
|
529
|
+
if (true === same) {
|
|
530
|
+
into = 'outdated';
|
|
531
|
+
}
|
|
532
|
+
else if (undefined === same) {
|
|
533
|
+
report.unrecorded.push(label);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
report[into].push(label);
|
|
537
|
+
const drift = report.byItem[item] = report.byItem[item] ?? {
|
|
538
|
+
...pkgOf(source.package ?? copied?.package),
|
|
539
|
+
...(null == copied?.version ? {} : { from: copied.version }),
|
|
540
|
+
...(null == source.version ? {} : { to: source.version }),
|
|
541
|
+
outdated: 0,
|
|
542
|
+
changed: 0,
|
|
543
|
+
};
|
|
544
|
+
if ('outdated' === into) {
|
|
545
|
+
drift.outdated++;
|
|
546
|
+
}
|
|
547
|
+
else {
|
|
548
|
+
drift.changed++;
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
function pkgOf(name) {
|
|
553
|
+
return null == name ? {} : { package: name };
|
|
554
|
+
}
|
|
555
|
+
// The command that brings an item's copies up to the installed source. The
|
|
556
|
+
// package form checks first and refuses to overwrite a local edit.
|
|
557
|
+
function refreshCommand(item, pkg) {
|
|
558
|
+
if (null != pkg) {
|
|
559
|
+
return 'package update ' + pkg + ' --no-fetch';
|
|
560
|
+
}
|
|
561
|
+
const [kind, ...name] = item.split('/');
|
|
562
|
+
return kind + ' add ' + name.join('/');
|
|
563
|
+
}
|
|
564
|
+
function outdatedNote(item, drift) {
|
|
565
|
+
return item.replace('/', ' ') + ': ' + drift.outdated +
|
|
566
|
+
' file(s) are unchanged copies' + sinceCopied(drift.package, [drift]);
|
|
567
|
+
}
|
|
568
|
+
// Names both versions only when they differ: a source that changed under the
|
|
569
|
+
// same version (a linked checkout, say) is still a source that moved on.
|
|
570
|
+
function sinceCopied(pkg, drift) {
|
|
571
|
+
const froms = Array.from(new Set(drift.map((d) => d.from)));
|
|
572
|
+
const to = drift[0].to;
|
|
573
|
+
const from = 1 === froms.length ? froms[0] : undefined;
|
|
574
|
+
const name = pkg ?? 'their source';
|
|
575
|
+
if (null != from && null != to && from !== to) {
|
|
576
|
+
return ' from ' + name + ' ' + from + ', but ' + name + ' ' + to +
|
|
577
|
+
' is installed';
|
|
578
|
+
}
|
|
579
|
+
return ', but ' + name + (null == to ? '' : ' ' + to) +
|
|
580
|
+
' has changed since they were copied';
|
|
498
581
|
}
|
|
499
582
|
function stampOnly(fs, scaffoldPath, projectPath, model, provenance, rewrite) {
|
|
500
583
|
const { expected, actual } = renderPair(fs, scaffoldPath, projectPath, model, provenance, rewrite);
|
|
@@ -573,15 +656,78 @@ function differs(fs, scaffoldPath, projectPath, model, replace, ignore, rewrite)
|
|
|
573
656
|
function renderPair(fs, scaffoldPath, projectPath, model, replace, rewrite) {
|
|
574
657
|
const rawsrc = fs.readFileSync(scaffoldPath, 'utf8');
|
|
575
658
|
const src = null == rewrite ? rawsrc : rewrite(rawsrc);
|
|
659
|
+
// git may rewrite line endings on checkout (core.autocrlf).
|
|
576
660
|
return {
|
|
577
|
-
expected: (0, jostraca_1.template)(src, model, { replace }),
|
|
578
|
-
actual: fs.readFileSync(projectPath, 'utf8'),
|
|
661
|
+
expected: lfEndings((0, jostraca_1.template)(src, model, { replace })),
|
|
662
|
+
actual: lfEndings(fs.readFileSync(projectPath, 'utf8')),
|
|
579
663
|
};
|
|
580
664
|
}
|
|
665
|
+
function lfEndings(text) {
|
|
666
|
+
return text.replace(/\r\n/g, '\n');
|
|
667
|
+
}
|
|
581
668
|
function quietLog(log) {
|
|
582
669
|
const noop = () => { };
|
|
583
670
|
const quiet = { info: noop, debug: noop, warn: log.warn.bind(log), error: noop, trace: noop, fatal: noop };
|
|
584
671
|
quiet.child = () => quiet;
|
|
585
672
|
return quiet;
|
|
586
673
|
}
|
|
674
|
+
function silentLog() {
|
|
675
|
+
const noop = () => { };
|
|
676
|
+
const silent = { info: noop, debug: noop, warn: noop, error: noop, trace: noop, fatal: noop };
|
|
677
|
+
silent.child = () => silent;
|
|
678
|
+
return silent;
|
|
679
|
+
}
|
|
680
|
+
// What `generate` checks before it reads the copies: the active items only,
|
|
681
|
+
// and a warning per refresh command rather than a failure, since a
|
|
682
|
+
// difference may be a deliberate edit.
|
|
683
|
+
async function copyCheck(actx) {
|
|
684
|
+
const active = (kind, name) => false !== (0, kindCollection_1.kindCollection)(actx.model, kind)?.[name]?.active;
|
|
685
|
+
const res = await doctor({ ...actx, log: silentLog() }, active);
|
|
686
|
+
return copyWarnings(res.report);
|
|
687
|
+
}
|
|
688
|
+
function copyWarnings(report) {
|
|
689
|
+
const groups = new Map();
|
|
690
|
+
const add = (key, item, files, drift) => {
|
|
691
|
+
const group = groups.get(key) ?? { items: [], files: 0, drift: [] };
|
|
692
|
+
group.items.push(item.replace('/', ' '));
|
|
693
|
+
group.files += files;
|
|
694
|
+
group.drift.push(drift);
|
|
695
|
+
groups.set(key, group);
|
|
696
|
+
};
|
|
697
|
+
for (const item of Object.keys(report.byItem).sort()) {
|
|
698
|
+
const drift = report.byItem[item];
|
|
699
|
+
const command = refreshCommand(item, drift.package);
|
|
700
|
+
if (0 < drift.outdated) {
|
|
701
|
+
add('outdated\n' + command, item, drift.outdated, drift);
|
|
702
|
+
}
|
|
703
|
+
if (0 < drift.changed) {
|
|
704
|
+
add('changed\n' + command, item, drift.changed, drift);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
const lines = [];
|
|
708
|
+
for (const [key, group] of groups) {
|
|
709
|
+
const [what, command] = key.split('\n');
|
|
710
|
+
const pkg = group.drift[0].package;
|
|
711
|
+
const to = group.drift[0].to;
|
|
712
|
+
const installed = null == pkg ? 'their source' :
|
|
713
|
+
(pkg + (null == to ? '' : ' ' + to));
|
|
714
|
+
const refresh = '`npx voxgig-sdkgen ' + command + '`';
|
|
715
|
+
if ('outdated' === what) {
|
|
716
|
+
lines.push(group.items.join(', ') + ': ' + group.files +
|
|
717
|
+
' file(s) in .sdk are unchanged copies' +
|
|
718
|
+
sinceCopied(pkg, group.drift) + ', so this run generates from ' +
|
|
719
|
+
'older templates. Run ' + refresh + ' to refresh them.');
|
|
720
|
+
}
|
|
721
|
+
else {
|
|
722
|
+
lines.push(group.items.join(', ') + ': ' + group.files +
|
|
723
|
+
' file(s) in .sdk differ from what ' + installed + ' installs: ' +
|
|
724
|
+
'changed in this project, or copied before sdkgen recorded its ' +
|
|
725
|
+
'copies. `npx voxgig-sdkgen doctor` lists them; ' + refresh +
|
|
726
|
+
' refreshes them' +
|
|
727
|
+
(null == pkg ? ', discarding any local edit.' :
|
|
728
|
+
', and refuses before it overwrites a local edit.'));
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
return lines;
|
|
732
|
+
}
|
|
587
733
|
//# sourceMappingURL=doctor.js.map
|