@voxgig/sdkgen 4.8.1 → 4.8.3
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/doctor.d.ts +1 -0
- package/dist/action/doctor.js +50 -2
- package/dist/action/doctor.js.map +1 -1
- package/dist/helpers/naming.js +4 -2
- package/dist/helpers/naming.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/model/sdkgen.aon +21 -0
- package/package.json +2 -2
- package/project/.sdk/model/feature/secrets.aon +120 -18
- package/project/.sdk/model/target/c.aon +10 -0
- package/project/.sdk/model/target/clojure.aon +13 -0
- package/project/.sdk/model/target/cpp.aon +10 -0
- package/project/.sdk/model/target/csharp.aon +9 -0
- package/project/.sdk/model/target/dart.aon +10 -0
- package/project/.sdk/model/target/elixir.aon +9 -0
- package/project/.sdk/model/target/go.aon +13 -0
- package/project/.sdk/model/target/java.aon +9 -0
- package/project/.sdk/model/target/js.aon +7 -0
- package/project/.sdk/model/target/kotlin.aon +9 -0
- package/project/.sdk/model/target/lean.aon +17 -0
- package/project/.sdk/model/target/lua.aon +8 -0
- package/project/.sdk/model/target/ocaml.aon +9 -0
- package/project/.sdk/model/target/perl.aon +8 -0
- package/project/.sdk/model/target/php.aon +8 -0
- package/project/.sdk/model/target/py.aon +13 -0
- package/project/.sdk/model/target/rb.aon +8 -0
- package/project/.sdk/model/target/rust.aon +10 -0
- package/project/.sdk/model/target/scala.aon +21 -2
- package/project/.sdk/model/target/swift.aon +18 -0
- package/project/.sdk/model/target/ts.aon +13 -0
- package/project/.sdk/src/cmp/clojure/Package_clojure.ts +9 -2
- package/project/.sdk/src/cmp/cpp/Gitignore_cpp.ts +3 -0
- package/project/.sdk/src/cmp/dart/Test_dart.ts +2 -0
- package/project/.sdk/src/cmp/elixir/Package_elixir.ts +4 -1
- package/project/.sdk/src/cmp/go/Config_go.ts +59 -2
- package/project/.sdk/src/cmp/go/Main_go.ts +8 -2
- package/project/.sdk/src/cmp/java/Test_java.ts +6 -5
- package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +6 -5
- package/project/.sdk/src/cmp/lean/Package_lean.ts +23 -0
- package/project/.sdk/src/cmp/lean/ReadmeInstall_lean.ts +1 -0
- package/project/.sdk/src/cmp/lean/ReadmeTopTest_lean.ts +1 -0
- package/project/.sdk/src/cmp/ocaml/Gitignore_ocaml.ts +1 -0
- package/project/.sdk/src/cmp/ocaml/Main_ocaml.ts +7 -3
- package/project/.sdk/src/cmp/py/Config_py.ts +82 -1
- package/project/.sdk/src/cmp/py/Main_py.ts +44 -0
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +2 -0
- package/project/.sdk/src/cmp/swift/Main_swift.ts +10 -0
- package/project/.sdk/src/cmp/swift/Package_swift.ts +13 -1
- package/project/.sdk/src/cmp/ts/Config_ts.ts +42 -17
- package/project/.sdk/src/cmp/ts/fragment/Config.data.fragment.ts +13 -1
- package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +13 -1
- package/project/.sdk/tm/c/Makefile +38 -3
- package/project/.sdk/tm/c/tests/omni_resolver.h +361 -0
- package/project/.sdk/tm/c/tests/omni_smoke_test.c +237 -0
- package/project/.sdk/tm/c/tests/primary_corpus_test.c +205 -284
- package/project/.sdk/tm/c/tests/struct_corpus_test.c +292 -212
- package/project/.sdk/tm/c/tests/vendor/omni/json.c +811 -0
- package/project/.sdk/tm/c/tests/vendor/omni/omni.h +240 -0
- package/project/.sdk/tm/c/tests/vendor/omni/runner.c +940 -0
- package/project/.sdk/tm/c/tests/vendor/omni/util.c +351 -0
- package/project/.sdk/tm/c/utility/struct/utility.c +7 -2
- package/project/.sdk/tm/clojure/test/sdk/test/omni.clj +401 -0
- package/project/.sdk/tm/clojure/test/sdk/test/omni_smoke.clj +81 -0
- package/project/.sdk/tm/clojure/test/sdk/test/primary.clj +92 -58
- package/project/.sdk/tm/clojure/test/sdk/test/struct_corpus.clj +122 -149
- package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +8 -3
- package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/json.clj +145 -0
- package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/runner.clj +445 -0
- package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/util.clj +145 -0
- package/project/.sdk/tm/cpp/Makefile +5 -1
- package/project/.sdk/tm/cpp/test/omni_resolver.hpp +473 -0
- package/project/.sdk/tm/cpp/test/omni_smoke_test.cpp +209 -0
- package/project/.sdk/tm/cpp/test/primary_utility_test.cpp +243 -184
- package/project/.sdk/tm/cpp/test/runner_support.hpp +68 -181
- package/project/.sdk/tm/cpp/test/struct_corpus_test.cpp +183 -56
- package/project/.sdk/tm/cpp/test/vendor/omni/json.hpp +406 -0
- package/project/.sdk/tm/cpp/test/vendor/omni/omni.hpp +751 -0
- package/project/.sdk/tm/cpp/test/vendor/omni/util.hpp +256 -0
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +7 -1
- package/project/.sdk/tm/csharp/test/OmniResolver.cs +491 -0
- package/project/.sdk/tm/csharp/test/OmniSmokeTest.cs +106 -0
- package/project/.sdk/tm/csharp/test/PrimaryUtilityTest.cs +299 -316
- package/project/.sdk/tm/csharp/test/Runner.cs +104 -269
- package/project/.sdk/tm/csharp/test/StructUtilityTest.cs +535 -724
- package/project/.sdk/tm/csharp/test/vendor/omni/Runner.cs +864 -0
- package/project/.sdk/tm/csharp/test/vendor/omni/Util.cs +347 -0
- package/project/.sdk/tm/csharp/utility/MakeSpec.cs +3 -1
- package/project/.sdk/tm/csharp/utility/PrepareMethod.cs +6 -1
- package/project/.sdk/tm/csharp/utility/struct/Struct.cs +21 -5
- package/project/.sdk/tm/dart/test/omni.dart +520 -0
- package/project/.sdk/tm/dart/test/omni_smoke_test.dart +143 -0
- package/project/.sdk/tm/dart/test/primary_test.dart +86 -28
- package/project/.sdk/tm/dart/test/struct_test.dart +438 -11
- package/project/.sdk/tm/dart/test/vendor/omni/omni.dart +7 -0
- package/project/.sdk/tm/dart/test/vendor/omni/runner.dart +653 -0
- package/project/.sdk/tm/dart/test/vendor/omni/util.dart +232 -0
- package/project/.sdk/tm/elixir/Makefile +11 -3
- package/project/.sdk/tm/elixir/test/omni_smoke_test.exs +117 -0
- package/project/.sdk/tm/elixir/test/primary_utility_test.exs +341 -16
- package/project/.sdk/tm/elixir/test/struct_corpus_test.exs +554 -9
- package/project/.sdk/tm/elixir/test/support/omni.ex +377 -0
- package/project/.sdk/tm/elixir/test/vendor/omni/json.ex +122 -0
- package/project/.sdk/tm/elixir/test/vendor/omni/runner.ex +623 -0
- package/project/.sdk/tm/elixir/test/vendor/omni/util.ex +187 -0
- package/project/.sdk/tm/go/core/context.go +32 -16
- package/project/.sdk/tm/go/feature/secrets/plugin/capability.go +261 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/catalog.go +78 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/config.go +652 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/depend.go +250 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/env.go +194 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/export.go +80 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/graph.go +238 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/host.go +1575 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/order.go +248 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/point.go +184 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/ref.go +123 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/resolve.go +79 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/types.go +296 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/util.go +87 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/version.go +161 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/aws/aws.go +292 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/aws/sigv4.go +201 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/azuresecrets/azuresecrets.go +187 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/boru/boru.go +184 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/doppler/doppler.go +114 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/gcpsecrets/gcpsecrets.go +156 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/hashicorp/hashicorp.go +209 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/httpjson/httpjson.go +241 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/infisical/infisical.go +151 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/onepassword/onepassword.go +152 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/secretspec/secretspec.go +143 -0
- package/project/.sdk/tm/go/feature/secrets/sekreto/addr.go +120 -0
- package/project/.sdk/tm/go/feature/secrets/sekreto/providers.go +439 -0
- package/project/.sdk/tm/go/feature/secrets/sekreto/sekreto.go +685 -0
- package/project/.sdk/tm/go/feature/secrets_feature.go +675 -0
- package/project/.sdk/tm/go/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/go/test/feature/secrets/secrets_feature_test.go +799 -0
- package/project/.sdk/tm/go/test/omni/omni.go +897 -0
- package/project/.sdk/tm/go/test/omni/util.go +360 -0
- package/project/.sdk/tm/go/test/omniresolver_test.go +748 -0
- package/project/.sdk/tm/go/test/omnismoke_test.go +112 -0
- package/project/.sdk/tm/go/test/primary_utility_test.go +123 -191
- package/project/.sdk/tm/go/test/struct_utility_test.go +323 -16
- package/project/.sdk/tm/go/test/testsupport_test.go +294 -0
- package/project/.sdk/tm/go/utility/make_options.go +8 -1
- package/project/.sdk/tm/go/utility/prepare_method.go +5 -1
- package/project/.sdk/tm/go/utility/struct/voxgigstruct.go +2 -2
- package/project/.sdk/tm/java/test/OmniResolver.java +355 -0
- package/project/.sdk/tm/java/test/OmniSmokeTest.java +99 -0
- package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +254 -280
- package/project/.sdk/tm/java/test/RunnerSupport.java +9 -194
- package/project/.sdk/tm/java/test/StructCorpusTest.java +119 -42
- package/project/.sdk/tm/java/test/vendor/omni/Json.java +287 -0
- package/project/.sdk/tm/java/test/vendor/omni/Runner.java +851 -0
- package/project/.sdk/tm/java/test/vendor/omni/Util.java +322 -0
- package/project/.sdk/tm/java/utility/MakeSpec.java +3 -1
- package/project/.sdk/tm/java/utility/PrepareMethod.java +5 -5
- package/project/.sdk/tm/java/utility/struct/Struct.java +17 -4
- package/project/.sdk/tm/js/src/utility/StructUtility.js +3 -3
- package/project/.sdk/tm/js/test/omni.js +251 -0
- package/project/.sdk/tm/js/test/omni.test.js +105 -0
- package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +6 -2
- package/project/.sdk/tm/js/test/utility/StructUtility.test.js +27 -2
- package/project/.sdk/tm/js/test/vendor/omni/index.js +77 -0
- package/project/.sdk/tm/js/test/vendor/omni/runner.js +613 -0
- package/project/.sdk/tm/js/test/vendor/omni/util.js +212 -0
- package/project/.sdk/tm/kotlin/core/Utility.kt +1 -1
- package/project/.sdk/tm/kotlin/test/OmniResolver.kt +343 -0
- package/project/.sdk/tm/kotlin/test/OmniSmokeTest.kt +100 -0
- package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +244 -262
- package/project/.sdk/tm/kotlin/test/RunnerSupport.kt +9 -178
- package/project/.sdk/tm/kotlin/test/StructCorpusTest.kt +121 -32
- package/project/.sdk/tm/kotlin/test/vendor/omni/Json.kt +264 -0
- package/project/.sdk/tm/kotlin/test/vendor/omni/Runner.kt +615 -0
- package/project/.sdk/tm/kotlin/test/vendor/omni/Util.kt +139 -0
- package/project/.sdk/tm/kotlin/utility/MakeSpecUrl.kt +6 -3
- package/project/.sdk/tm/kotlin/utility/Prepare.kt +6 -6
- package/project/.sdk/tm/kotlin/utility/struct/Struct.kt +18 -2
- package/project/.sdk/tm/lean/Makefile +12 -5
- package/project/.sdk/tm/lean/src/SdkUtility.lean +14 -1
- package/project/.sdk/tm/lean/test/OmniResolver.lean +358 -0
- package/project/.sdk/tm/lean/test/OmniSmoke.lean +174 -0
- package/project/.sdk/tm/lean/test/StructCorpus.lean +245 -574
- package/project/.sdk/tm/lean/test/TPrimaryUtility.lean +155 -291
- package/project/.sdk/tm/lean/test/vendor/omni/Omni.lean +997 -0
- package/project/.sdk/tm/lua/test/omni.lua +456 -0
- package/project/.sdk/tm/lua/test/omni_smoke_test.lua +103 -0
- package/project/.sdk/tm/lua/test/primary_utility_test.lua +250 -509
- package/project/.sdk/tm/lua/test/struct_utility_test.lua +161 -70
- package/project/.sdk/tm/lua/test/vendor/omni/json.lua +268 -0
- package/project/.sdk/tm/lua/test/vendor/omni/regex.lua +385 -0
- package/project/.sdk/tm/lua/test/vendor/omni/runner.lua +641 -0
- package/project/.sdk/tm/lua/test/vendor/omni/util.lua +282 -0
- package/project/.sdk/tm/lua/utility/prepare_method.lua +5 -1
- package/project/.sdk/tm/lua/utility/struct/regex.lua +663 -0
- package/project/.sdk/tm/lua/utility/struct/struct.lua +660 -420
- package/project/.sdk/tm/ocaml/Makefile +37 -12
- package/project/.sdk/tm/ocaml/test/omni_resolver.ml +284 -0
- package/project/.sdk/tm/ocaml/test/omni_smoke_test.ml +169 -0
- package/project/.sdk/tm/ocaml/test/primary_utility_test.ml +84 -100
- package/project/.sdk/tm/ocaml/test/struct_corpus.ml +225 -201
- package/project/.sdk/tm/ocaml/test/vendor/omni/omni.ml +1157 -0
- package/project/.sdk/tm/perl/lib/Voxgig/Struct.pm +88 -12
- package/project/.sdk/tm/perl/t/omni.pm +647 -0
- package/project/.sdk/tm/perl/t/omni_smoke.t +87 -0
- package/project/.sdk/tm/perl/t/primary_utility.t +189 -487
- package/project/.sdk/tm/perl/t/struct_utility.t +455 -389
- package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni/Runner.pm +649 -0
- package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni/Util.pm +253 -0
- package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni.pm +24 -0
- package/project/.sdk/tm/perl/utility/prepare_method.pm +7 -2
- package/project/.sdk/tm/php/test/Omni.php +691 -0
- package/project/.sdk/tm/php/test/OmniSmokeTest.php +93 -0
- package/project/.sdk/tm/php/test/PrimaryUtilityTest.php +210 -571
- package/project/.sdk/tm/php/test/StructUtilityTest.php +320 -342
- package/project/.sdk/tm/php/test/vendor/omni/Runner.php +644 -0
- package/project/.sdk/tm/php/test/vendor/omni/Util.php +283 -0
- package/project/.sdk/tm/php/utility/MakeSpec.php +10 -3
- package/project/.sdk/tm/php/utility/PrepareBody.php +7 -1
- package/project/.sdk/tm/php/utility/PrepareMethod.php +6 -2
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/__init__.py +36 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/capability.py +141 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/catalog.py +50 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/config.py +333 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/depend.py +198 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/env.py +147 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/export.py +52 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/graph.py +139 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/host.py +1053 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/order.py +171 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/point.py +95 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/ref.py +116 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/resolve.py +59 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/types.py +87 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/version.py +112 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/__init__.py +74 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/addr.py +116 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/aws.py +192 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/azuresecrets.py +120 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/boru.py +140 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/doppler.py +62 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/gcpsecrets.py +101 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/hashicorp.py +152 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/httpjson.py +115 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/infisical.py +92 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/onepassword.py +101 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/secretspec.py +119 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/sigv4.py +125 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/providers.py +211 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/sekreto.py +455 -0
- package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +467 -0
- package/project/.sdk/tm/py/pkg/utility/prepare_method.py +5 -1
- package/project/.sdk/tm/py/pkg/utility/voxgig_struct/__init__.py +0 -2
- package/project/.sdk/tm/py/pkg/utility/voxgig_struct/voxgig_struct.py +780 -529
- package/project/.sdk/tm/py/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/py/test/feature/__init__.py +0 -0
- package/project/.sdk/tm/py/test/feature/secrets/__init__.py +0 -0
- package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +337 -0
- package/project/.sdk/tm/py/test/omni.py +415 -0
- package/project/.sdk/tm/py/test/test_omni_smoke.py +74 -0
- package/project/.sdk/tm/py/test/test_primary_utility.py +144 -668
- package/project/.sdk/tm/py/test/test_struct_utility.py +74 -27
- package/project/.sdk/tm/py/test/voxgig_omni/__init__.py +62 -0
- package/project/.sdk/tm/py/test/voxgig_omni/runner.py +566 -0
- package/project/.sdk/tm/py/test/voxgig_omni/util.py +237 -0
- package/project/.sdk/tm/rb/test/omni.rb +505 -0
- package/project/.sdk/tm/rb/test/omni_smoke_test.rb +72 -0
- package/project/.sdk/tm/rb/test/primary_utility_test.rb +174 -560
- package/project/.sdk/tm/rb/test/struct_utility_test.rb +13 -7
- package/project/.sdk/tm/rb/test/vendor/omni/runner.rb +493 -0
- package/project/.sdk/tm/rb/test/vendor/omni/util.rb +199 -0
- package/project/.sdk/tm/rb/test/vendor/omni/voxgig_omni.rb +15 -0
- package/project/.sdk/tm/rb/utility/prepare_method.rb +5 -1
- package/project/.sdk/tm/rust/tests/common/mod.rs +19 -242
- package/project/.sdk/tm/rust/tests/omni_resolver/mod.rs +888 -0
- package/project/.sdk/tm/rust/tests/omni_smoke_test.rs +286 -0
- package/project/.sdk/tm/rust/tests/primary_utility_test.rs +318 -312
- package/project/.sdk/tm/rust/tests/struct_utility_test.rs +66 -28
- package/project/.sdk/tm/rust/tests/vendor/omni/json.rs +412 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/mod.rs +38 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/regex.rs +392 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/runner.rs +1001 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/util.rs +161 -0
- package/project/.sdk/tm/rust/utility/prepare_method.rs +5 -1
- package/project/.sdk/tm/scala/Makefile +16 -6
- package/project/.sdk/tm/scala/sdktest/OmniResolver.scala +497 -0
- package/project/.sdk/tm/scala/sdktest/OmniSmoke.scala +192 -0
- package/project/.sdk/tm/scala/sdktest/PrimaryCorpus.scala +47 -19
- package/project/.sdk/tm/scala/sdktest/StructCorpus.scala +0 -0
- package/project/.sdk/tm/scala/sdktest/vendor/omni/Json.scala +229 -0
- package/project/.sdk/tm/scala/sdktest/vendor/omni/Runner.scala +552 -0
- package/project/.sdk/tm/scala/sdktest/vendor/omni/Util.scala +104 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Constants.swift +10 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Inject.swift +28 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Injection.swift +5 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Minor.swift +4 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Validate.swift +15 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Prepare.swift +6 -1
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/OmniResolver.swift +474 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/OmniSmokeTest.swift +107 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PrimaryUtilityTest.swift +141 -178
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/Runner.swift +17 -113
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/StructUtilityTest.swift +295 -446
- package/project/.sdk/tm/swift/Tests/vendor/omni/Json.swift +364 -0
- package/project/.sdk/tm/swift/Tests/vendor/omni/Runner.swift +730 -0
- package/project/.sdk/tm/swift/Tests/vendor/omni/Util.swift +162 -0
- package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +7 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Capability.ts +148 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Catalog.ts +55 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Config.ts +344 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Depend.ts +205 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Env.ts +138 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Export.ts +46 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/FeatureHost.ts +349 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Graph.ts +181 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Host.ts +1132 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Order.ts +177 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Point.ts +119 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Ref.ts +102 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Resolve.ts +61 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Types.ts +112 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Version.ts +100 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/index.ts +37 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/Sekreto.ts +163 -30
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/index.ts +27 -22
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/aws.ts +26 -36
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/azuresecrets.ts +19 -21
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/boru.ts +36 -17
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/doppler.ts +14 -21
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/gcpsecrets.ts +27 -27
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/hashicorp.ts +25 -39
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/httpjson.ts +99 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/infisical.ts +14 -16
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/onepassword.ts +15 -22
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/secretspec.ts +98 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{Sigv4.ts → plugins/sigv4.ts} +7 -6
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/addr.ts +97 -23
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/builtin.ts +37 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/dotenv.ts +4 -17
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/env.ts +4 -16
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/file.ts +11 -25
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/memory.ts +6 -23
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/support.ts +106 -39
- package/project/.sdk/tm/ts/src/utility/StructUtility.ts +3 -3
- package/project/.sdk/tm/ts/test/omni.ts +104 -32
- package/project/.sdk/tm/ts/test/utility/StructUtility.test.ts +27 -0
- package/project/.sdk/tm/ts/test/vendor/omni/Runner.ts +32 -5
- package/project/.sdk/tm/ts/test/vendor/omni/Util.ts +2 -2
- package/project/.sdk/tm/ts/test/vendor/omni/index.ts +2 -2
- package/project/.sdk/tm/zig/test/primary_utility_test.zig +1 -1
- package/project/.sdk/tm/zig/test/struct_runner.zig +5 -4
- package/project/sdkgen-package.json +1 -1
- package/src/action/doctor.ts +66 -2
- package/src/helpers/naming.ts +4 -2
- package/project/.sdk/tm/c/tests/runner.h +0 -274
- package/project/.sdk/tm/cpp/test/struct_runner.hpp +0 -314
- package/project/.sdk/tm/csharp/test/StructRunner.cs +0 -276
- package/project/.sdk/tm/dart/test/runner.dart +0 -406
- package/project/.sdk/tm/dart/test/struct_corpus.dart +0 -531
- package/project/.sdk/tm/elixir/test/support/struct_corpus.ex +0 -1088
- package/project/.sdk/tm/go/test/runner_test.go +0 -629
- package/project/.sdk/tm/go/test/struct_runner_test.go +0 -1094
- package/project/.sdk/tm/java/test/StructRunner.java +0 -281
- package/project/.sdk/tm/js/test/runner.js +0 -387
- package/project/.sdk/tm/kotlin/test/StructRunner.kt +0 -177
- package/project/.sdk/tm/lua/test/struct_runner.lua +0 -602
- package/project/.sdk/tm/ocaml/test/corpus_runner.ml +0 -185
- package/project/.sdk/tm/perl/t/struct_runner.pm +0 -275
- package/project/.sdk/tm/php/test/StructRunner.php +0 -275
- package/project/.sdk/tm/py/test/struct_runner.py +0 -411
- package/project/.sdk/tm/rb/test/struct_runner.rb +0 -309
- package/project/.sdk/tm/rust/tests/struct_runner/mod.rs +0 -424
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/Registry.ts +0 -90
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/http.ts +0 -66
- package/project/.sdk/tm/ts/test/vendor/omni/compat.ts +0 -188
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// VENDORED: @voxgig/plugin 0.1.6 (typescript/src/Order.ts)
|
|
2
|
+
// Source: https://github.com/voxgig/plugin @ 8d8968afc0a2008fbd795b41ab166307d989f02a [tag: sdk-20260904-1610-0]
|
|
3
|
+
// License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
|
|
4
|
+
/* Ordering (§7) — one rule, one place.
|
|
5
|
+
*
|
|
6
|
+
* sdkgen grew two special cases in `makeOptions` (`test`, then
|
|
7
|
+
* `station`) and the third was not far off. This sort is the whole
|
|
8
|
+
* replacement, and the tiers are in this order for a reason:
|
|
9
|
+
*
|
|
10
|
+
* 1 constraints before/after edges, by ref or by name
|
|
11
|
+
* 2 bands integer, lower first, default 0
|
|
12
|
+
* 3 declaration ties break by `pos`
|
|
13
|
+
*
|
|
14
|
+
* CONSTRAINTS BEAT BANDS precisely so the correct tool wins when both
|
|
15
|
+
* are present. A band expresses a genuine cross-cutting layer; a
|
|
16
|
+
* constraint expresses a relationship between two specific things; and
|
|
17
|
+
* a band chosen by trial and error to fix an ordering bug is a bug
|
|
18
|
+
* wearing a number. */
|
|
19
|
+
|
|
20
|
+
import { OrderBlock, OrderRef, OrderSpec, fail } from './Types'
|
|
21
|
+
import { parseref } from './Ref'
|
|
22
|
+
|
|
23
|
+
export type Binding = {
|
|
24
|
+
ref: string
|
|
25
|
+
pos: number
|
|
26
|
+
order?: OrderBlock
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Where a host has pinned a binding. Positional, not ordinal: §6.2
|
|
30
|
+
* composes b1(b2(b3(base))) with the FIRST binding OUTERMOST, so
|
|
31
|
+
* `first` and `innermost` are opposites, and a pin spelled in sort
|
|
32
|
+
* terms would be read backwards by exactly the people it protects. */
|
|
33
|
+
export type Pin = { [name: string]: 'outermost' | 'innermost' | 'first' | 'last' }
|
|
34
|
+
|
|
35
|
+
export function resolveorder(bindings: Binding[], pin?: Pin): string[] {
|
|
36
|
+
const nodes = bindings.slice()
|
|
37
|
+
const byref: { [ref: string]: Binding } = {}
|
|
38
|
+
for (const b of nodes) byref[b.ref] = b
|
|
39
|
+
|
|
40
|
+
// Constraints are edges. A constraint naming an ABSENT binding is
|
|
41
|
+
// satisfied VACUOUSLY (§7) — a plugin ordered `after: 'test'` must
|
|
42
|
+
// load in a host with no test plugin. That is sdkgen's __after__
|
|
43
|
+
// behaviour, kept.
|
|
44
|
+
const edges: { [from: string]: string[] } = {}
|
|
45
|
+
for (const b of nodes) edges[b.ref] = []
|
|
46
|
+
|
|
47
|
+
for (const b of nodes) {
|
|
48
|
+
const o = b.order || {}
|
|
49
|
+
// An empty list declares no constraint, so it must not be treated as one.
|
|
50
|
+
if (declared(o.after)) for (const t of targets(o.after!, nodes)) edges[t].push(b.ref)
|
|
51
|
+
if (declared(o.before)) for (const t of targets(o.before!, nodes)) edges[b.ref].push(t)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Stable topological sort. Among ready nodes, band first (lower runs
|
|
55
|
+
// first), then `pos` — the position the DOCUMENT visibly states, not
|
|
56
|
+
// the order instances happened to load and not the incarnation `seq`.
|
|
57
|
+
const indeg: { [ref: string]: number } = {}
|
|
58
|
+
for (const b of nodes) indeg[b.ref] = 0
|
|
59
|
+
for (const from of Object.keys(edges)) {
|
|
60
|
+
for (const to of edges[from]) indeg[to] = (indeg[to] || 0) + 1
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const out: string[] = []
|
|
64
|
+
const ready = nodes.filter((b) => 0 === indeg[b.ref])
|
|
65
|
+
|
|
66
|
+
while (0 < ready.length) {
|
|
67
|
+
ready.sort(rank)
|
|
68
|
+
const next = ready.shift() as Binding
|
|
69
|
+
out.push(next.ref)
|
|
70
|
+
for (const to of edges[next.ref]) {
|
|
71
|
+
indeg[to] -= 1
|
|
72
|
+
if (0 === indeg[to]) ready.push(byref[to])
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (out.length !== nodes.length) {
|
|
77
|
+
const stuck = nodes.filter((b) => -1 === out.indexOf(b.ref)).map((b) => b.ref)
|
|
78
|
+
fail('plugin_order_cycle',
|
|
79
|
+
'before/after constraints cycle: ' + stuck.join(' -> '), { cycle: stuck })
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return applypin(out, edges, pin)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function rank(a: Binding, b: Binding): number {
|
|
86
|
+
const ab = band(a), bb = band(b)
|
|
87
|
+
if (ab !== bb) return ab - bb
|
|
88
|
+
return a.pos - b.pos
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function band(b: Binding): number {
|
|
92
|
+
const o = b.order || {}
|
|
93
|
+
return 'number' === typeof o.band ? o.band : 0
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Was a constraint actually declared? An ABSENT one and an EMPTY LIST
|
|
97
|
+
* are both "no constraint"; only a non-empty spelling is an edge. */
|
|
98
|
+
function declared(spec?: OrderSpec): spec is OrderRef {
|
|
99
|
+
return Array.isArray(spec) ? 0 < spec.length : null != spec && '' !== spec
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Matching is by REF, or by NAME across all of that definition's
|
|
103
|
+
* instances (§7) — which is the whole reason the two spellings exist. */
|
|
104
|
+
function targets(spec: OrderRef, nodes: Binding[]): string[] {
|
|
105
|
+
const hit: string[] = []
|
|
106
|
+
// One spelling or a list of them; a list fans out to the union of what
|
|
107
|
+
// each names, so `after: ['a', 'b']` means after BOTH.
|
|
108
|
+
const specs = Array.isArray(spec) ? spec : [spec]
|
|
109
|
+
for (const one of specs) {
|
|
110
|
+
for (const b of nodes) {
|
|
111
|
+
if (hit.includes(b.ref)) continue
|
|
112
|
+
if (b.ref === one) { hit.push(b.ref); continue }
|
|
113
|
+
if (parseref(b.ref).name === one) hit.push(b.ref)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return hit
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** A PIN IS NOT A CONSTRAINT (§7).
|
|
120
|
+
*
|
|
121
|
+
* Constraints and bands are negotiable by definition — they are what
|
|
122
|
+
* plugins and documents say they want, and the sort's job is to satisfy
|
|
123
|
+
* them all. A pin is the host stating a structural invariant of its own
|
|
124
|
+
* architecture, which is a different kind of claim and must not lose a
|
|
125
|
+
* tie to a document.
|
|
126
|
+
*
|
|
127
|
+
* So a pin PLACES the binding at the named end, and an ordering that
|
|
128
|
+
* would move it away is `plugin_order_pinned` — rejected, not honoured
|
|
129
|
+
* into a broken wrap. Station's transport adapter must sit immediately
|
|
130
|
+
* outside the base transport; an `order` list that moves it has to be
|
|
131
|
+
* an error rather than a preference. */
|
|
132
|
+
function applypin(order: string[], edges: { [from: string]: string[] }, pin?: Pin): string[] {
|
|
133
|
+
if (null == pin) return order
|
|
134
|
+
let out = order.slice()
|
|
135
|
+
|
|
136
|
+
// SORTED, not insertion order. A pin map is data — it can arrive from
|
|
137
|
+
// a host's own construction options in any order, and two names pinned
|
|
138
|
+
// to the same end are order-sensitive (`{b:'first', a:'first'}` and
|
|
139
|
+
// `{a:'first', b:'first'}` give different results). JavaScript's
|
|
140
|
+
// `Object.keys` is insertion order and a Go map has none at all, so
|
|
141
|
+
// leaving it unstated made the same declaration mean different things
|
|
142
|
+
// in different ports. Sorted is the one order every language agrees
|
|
143
|
+
// on, and `order/pin#two-names` pins it.
|
|
144
|
+
for (const name of Object.keys(pin).sort()) {
|
|
145
|
+
const want = pin[name]
|
|
146
|
+
const idx = out.findIndex((r) => parseref(r).name === name)
|
|
147
|
+
if (-1 === idx) continue
|
|
148
|
+
|
|
149
|
+
// `first`/`outermost` is index 0; `last`/`innermost` is the end.
|
|
150
|
+
// §6.2 makes the first chain binding outermost, which is why the
|
|
151
|
+
// vocabulary is positional and why the two spellings pair this way.
|
|
152
|
+
const wantfirst = 'first' === want || 'outermost' === want
|
|
153
|
+
const ref = out[idx]
|
|
154
|
+
out.splice(idx, 1)
|
|
155
|
+
if (wantfirst) out.unshift(ref)
|
|
156
|
+
else out.push(ref)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Now check that the placement did not break a constraint. This is
|
|
160
|
+
// the half that makes a pin a rejection rather than an override: the
|
|
161
|
+
// host wins on position, but it does not get to silently discard a
|
|
162
|
+
// relationship a plugin declared.
|
|
163
|
+
const at: { [ref: string]: number } = {}
|
|
164
|
+
out.forEach((r, i) => { at[r] = i })
|
|
165
|
+
for (const from of Object.keys(edges)) {
|
|
166
|
+
for (const to of edges[from]) {
|
|
167
|
+
if (at[from] > at[to]) {
|
|
168
|
+
fail('plugin_order_pinned',
|
|
169
|
+
'a pin would move a binding an ordering constrains: ' +
|
|
170
|
+
from + ' must precede ' + to,
|
|
171
|
+
{ before: from, after: to })
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return out
|
|
177
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// VENDORED: @voxgig/plugin 0.1.6 (typescript/src/Point.ts)
|
|
2
|
+
// Source: https://github.com/voxgig/plugin @ 8d8968afc0a2008fbd795b41ab166307d989f02a [tag: sdk-20260904-1610-0]
|
|
3
|
+
// License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
|
|
4
|
+
/* Extension points (§6). Three kinds, chosen because they are what the
|
|
5
|
+
* two existing systems actually needed, and no more.
|
|
6
|
+
*
|
|
7
|
+
* A PLUGIN NEVER MUTATES THE HOST. That inversion is what makes
|
|
8
|
+
* deactivation possible: sdkgen's `utility.fetcher = wrapped` is not
|
|
9
|
+
* undoable, but "this instance holds slot 3 of the request chain" is
|
|
10
|
+
* undoable in O(1). OSGi named it the whiteboard pattern in 2004, in a
|
|
11
|
+
* paper called *Listeners Considered Harmful*, and for exactly this
|
|
12
|
+
* reason. */
|
|
13
|
+
|
|
14
|
+
import { fail } from './Types'
|
|
15
|
+
|
|
16
|
+
export type Kind = 'hook' | 'chain' | 'provider'
|
|
17
|
+
|
|
18
|
+
/** §6.1: "fan-out" is not one answer but four. In a language with
|
|
19
|
+
* asynchrony, "call every binding" hides a decision — start them all
|
|
20
|
+
* and wait, await each in turn, or do not wait — and a design that
|
|
21
|
+
* leaves it unsaid gets four different answers from four ports, in the
|
|
22
|
+
* concurrency behaviour of production code no corpus entry happens to
|
|
23
|
+
* cover. */
|
|
24
|
+
export type Mode = 'emit' | 'parallel' | 'serial' | 'bail'
|
|
25
|
+
|
|
26
|
+
export type Spec = {
|
|
27
|
+
kind?: Kind
|
|
28
|
+
mode?: Mode
|
|
29
|
+
/** `chain` only: the host owns the base, and a plugin cannot replace
|
|
30
|
+
* it (§6.2). One that wants to SUBSTITUTE rather than wrap binds
|
|
31
|
+
* innermost and simply does not call `next`. */
|
|
32
|
+
base?: (...args: any[]) => any
|
|
33
|
+
/** `provider` only: a second binding is an error rather than a
|
|
34
|
+
* shadow. */
|
|
35
|
+
exclusive?: boolean
|
|
36
|
+
/** `provider` only: the host's fallback. */
|
|
37
|
+
default?: any
|
|
38
|
+
pin?: { [name: string]: 'outermost' | 'innermost' | 'first' | 'last' }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type Bound = {
|
|
42
|
+
ref: string
|
|
43
|
+
point: string
|
|
44
|
+
fn: any
|
|
45
|
+
/** `provider` ranks by HIGHEST band, unlike hook and chain which run
|
|
46
|
+
* lowest first. Kept as declared so the two rules stay visibly
|
|
47
|
+
* different rather than one being derived from the other by a reader
|
|
48
|
+
* who then gets it backwards. */
|
|
49
|
+
band: number
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Fan-out. Return values are ignored except in `bail`. */
|
|
53
|
+
export function emit(bindings: Bound[], mode: Mode, arg: any): any {
|
|
54
|
+
if ('bail' === mode) {
|
|
55
|
+
// Stops at the first binding that RETURNS A VALUE — the
|
|
56
|
+
// "handled, stop" case. A NULL DECLINES, and so does `undefined`.
|
|
57
|
+
//
|
|
58
|
+
// JavaScript can tell the two apart and almost nothing else in the
|
|
59
|
+
// target set can — Go, Python, Ruby, PHP, Lua, Java and C# each have
|
|
60
|
+
// exactly one way to say nothing. Making the distinction
|
|
61
|
+
// load-bearing would cost every one of them a wrapper type carried
|
|
62
|
+
// through the whole dispatch path, to express a difference their
|
|
63
|
+
// plugin authors cannot write. §18's budget settles it (§6.1).
|
|
64
|
+
for (const b of bindings) {
|
|
65
|
+
const v = b.fn(arg)
|
|
66
|
+
if (null != v) return v
|
|
67
|
+
}
|
|
68
|
+
return undefined
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const errors: any[] = []
|
|
72
|
+
for (const b of bindings) {
|
|
73
|
+
try { b.fn(arg) }
|
|
74
|
+
catch (err) {
|
|
75
|
+
// `emit` raises synchronously; the collecting modes gather.
|
|
76
|
+
if ('emit' === mode) throw err
|
|
77
|
+
errors.push(err)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return 'emit' === mode ? undefined : errors
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Composition: b1(b2(b3(base))), FIRST BINDING OUTERMOST (§6.2).
|
|
84
|
+
*
|
|
85
|
+
* Recomputed by the host whenever the live set changes, and cached
|
|
86
|
+
* between changes. Plugins receive `next` as an argument; they never
|
|
87
|
+
* see or store the previous value of anything. A plugin that stashes
|
|
88
|
+
* `next` and calls it after deactivation is a bug the host cannot
|
|
89
|
+
* prevent, and this says so rather than pretending otherwise. */
|
|
90
|
+
export function compose(bindings: Bound[], base: (...args: any[]) => any): (...args: any[]) => any {
|
|
91
|
+
let next = base
|
|
92
|
+
for (let i = bindings.length - 1; 0 <= i; i--) {
|
|
93
|
+
const fn = bindings[i].fn
|
|
94
|
+
const inner = next
|
|
95
|
+
next = (...args: any[]) => fn(inner, ...args)
|
|
96
|
+
}
|
|
97
|
+
return next
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** At most one live implementation (§6.3). The winner is the highest
|
|
101
|
+
* band, ties broken by ref sort, and THE LOSERS ARE VISIBLE rather than
|
|
102
|
+
* silently ignored. */
|
|
103
|
+
export function provider(bindings: Bound[], spec: Spec): { winner?: Bound, shadowed: string[] } {
|
|
104
|
+
if (0 === bindings.length) return { shadowed: [] }
|
|
105
|
+
|
|
106
|
+
if (spec.exclusive && 1 < bindings.length) {
|
|
107
|
+
const refs = bindings.map((b) => b.ref).sort()
|
|
108
|
+
fail('plugin_point_exclusive',
|
|
109
|
+
'point is exclusive and has ' + bindings.length + ' bindings: ' + refs.join(', '),
|
|
110
|
+
{ refs })
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const ranked = bindings.slice().sort((a, b) => {
|
|
114
|
+
if (a.band !== b.band) return b.band - a.band // HIGHEST band wins
|
|
115
|
+
return a.ref < b.ref ? -1 : a.ref > b.ref ? 1 : 0
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
return { winner: ranked[0], shadowed: ranked.slice(1).map((b) => b.ref) }
|
|
119
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// VENDORED: @voxgig/plugin 0.1.6 (typescript/src/Ref.ts)
|
|
2
|
+
// Source: https://github.com/voxgig/plugin @ 8d8968afc0a2008fbd795b41ab166307d989f02a [tag: sdk-20260904-1610-0]
|
|
3
|
+
// License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
|
|
4
|
+
/* Identity: name+tag, written `name$tag` (§4).
|
|
5
|
+
*
|
|
6
|
+
* The four pure functions, and the whole of what `ref` pins. They are
|
|
7
|
+
* the first thing a new port implements and the first corpus section it
|
|
8
|
+
* passes. */
|
|
9
|
+
|
|
10
|
+
import { Ref, fail } from './Types'
|
|
11
|
+
|
|
12
|
+
/** §4: `^[a-zA-Z@][a-zA-Z0-9.~_\-/]*$`, max 1024. */
|
|
13
|
+
const NAME_RE = /^[a-zA-Z@][a-zA-Z0-9.~_\-\/]*$/
|
|
14
|
+
/** §4: `^[a-zA-Z0-9.~_-]+$`, max 1024, or empty.
|
|
15
|
+
*
|
|
16
|
+
* The asymmetry with a name is deliberate: a tag MAY start with a digit
|
|
17
|
+
* because auto-tagging assigns integer tags (`stripe$1`), and a tag
|
|
18
|
+
* admits neither `@` nor `/` because a name is a package specifier and
|
|
19
|
+
* a tag is not. */
|
|
20
|
+
const TAG_RE = /^[a-zA-Z0-9.~_-]+$/
|
|
21
|
+
|
|
22
|
+
const MAX = 1024
|
|
23
|
+
|
|
24
|
+
export function checkname(name: string): boolean {
|
|
25
|
+
if ('string' !== typeof name) return false
|
|
26
|
+
if (0 === name.length || MAX < name.length) return false
|
|
27
|
+
return NAME_RE.test(name)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function checktag(tag: string): boolean {
|
|
31
|
+
if ('string' !== typeof tag) return false
|
|
32
|
+
// The empty tag is an ordinary tag (§4 rule 2). The single-instance
|
|
33
|
+
// case writes no tag and never learns tags exist.
|
|
34
|
+
if (0 === tag.length) return true
|
|
35
|
+
if (MAX < tag.length) return false
|
|
36
|
+
return TAG_RE.test(tag)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** `name$tag` -> the pair. Canonicalizing: `stripe$` and `stripe` both
|
|
40
|
+
* give tag ''. */
|
|
41
|
+
export function parseref(str: string): Ref {
|
|
42
|
+
if ('string' !== typeof str) {
|
|
43
|
+
fail('plugin_bad_name', 'ref must be a string')
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Split on the FIRST `$`. Nothing in the grammar decides this — `$` is
|
|
47
|
+
// in neither character class — so the corpus is the arbiter (§4 rule
|
|
48
|
+
// 5), and it picks the split that blames the part actually at fault:
|
|
49
|
+
// `a$b$c` is a good name with a bad tag, not the reverse.
|
|
50
|
+
const cut = str.indexOf('$')
|
|
51
|
+
const name = -1 === cut ? str : str.substring(0, cut)
|
|
52
|
+
const tag = -1 === cut ? '' : str.substring(cut + 1)
|
|
53
|
+
|
|
54
|
+
if (!checkname(name)) {
|
|
55
|
+
fail('plugin_bad_name', 'invalid plugin name: ' + name, { name })
|
|
56
|
+
}
|
|
57
|
+
if (!checktag(tag)) {
|
|
58
|
+
fail('plugin_bad_tag', 'invalid plugin tag: ' + tag, { name, tag })
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return { name, tag }
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** The pair -> `name$tag`. An empty tag NEVER writes the separator,
|
|
65
|
+
* which is the half of canonicalization formatref owns: parse tolerates
|
|
66
|
+
* `stripe$`, format never produces it, so a round trip is idempotent. */
|
|
67
|
+
export function formatref(name: string, tag?: string): string {
|
|
68
|
+
const t = null == tag ? '' : tag
|
|
69
|
+
if (!checkname(name)) {
|
|
70
|
+
fail('plugin_bad_name', 'invalid plugin name: ' + name, { name })
|
|
71
|
+
}
|
|
72
|
+
if (!checktag(t)) {
|
|
73
|
+
fail('plugin_bad_tag', 'invalid plugin tag: ' + t, { name, tag: t })
|
|
74
|
+
}
|
|
75
|
+
return '' === t ? name : name + '$' + t
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** The canonical spelling of a ref. §4 rule 5: ports must canonicalize
|
|
79
|
+
* before comparison. */
|
|
80
|
+
export function canonref(str: string): string {
|
|
81
|
+
const r = parseref(str)
|
|
82
|
+
return formatref(r.name, r.tag)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** The canonical ref this string denotes, or `undefined` if it denotes
|
|
86
|
+
* none — the TOLERANT half of `canonref`, and the one a requirement
|
|
87
|
+
* name needs.
|
|
88
|
+
*
|
|
89
|
+
* A REQUIREMENT NAME IS A CAPABILITY NAME FIRST (§11.1), and capability
|
|
90
|
+
* names are free-form: the design puts no grammar on them, so `2fa` and
|
|
91
|
+
* `my cap` are perfectly good ones and neither is a well-formed ref.
|
|
92
|
+
* `canonref` RAISES on those, so asking it "is this a ref?" made a legal
|
|
93
|
+
* document kill the host at the first requirement whose name no ref
|
|
94
|
+
* could have. Answering `undefined` is the whole difference. */
|
|
95
|
+
export function tryref(str: string): string | undefined {
|
|
96
|
+
if ('string' !== typeof str) return undefined
|
|
97
|
+
const cut = str.indexOf('$')
|
|
98
|
+
const name = -1 === cut ? str : str.substring(0, cut)
|
|
99
|
+
const tag = -1 === cut ? '' : str.substring(cut + 1)
|
|
100
|
+
if (!checkname(name) || !checktag(tag)) return undefined
|
|
101
|
+
return '' === tag ? name : name + '$' + tag
|
|
102
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// VENDORED: @voxgig/plugin 0.1.6 (typescript/src/Resolve.ts)
|
|
2
|
+
// Source: https://github.com/voxgig/plugin @ 8d8968afc0a2008fbd795b41ab166307d989f02a [tag: sdk-20260904-1610-0]
|
|
3
|
+
// License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
|
|
4
|
+
/* Dynamic resolution (§10.2) — name to candidate module ids.
|
|
5
|
+
*
|
|
6
|
+
* PURE. It returns the ids a host WOULD try, in order; it does not load
|
|
7
|
+
* anything. That separation is what lets the corpus pin resolution in
|
|
8
|
+
* every language including those with no dynamic loading at all, and it
|
|
9
|
+
* is why §15.4 puts real module loading in per-port integration tests
|
|
10
|
+
* rather than here.
|
|
11
|
+
*
|
|
12
|
+
* The corpus `resolve` section arrives with P2. */
|
|
13
|
+
|
|
14
|
+
export type Source =
|
|
15
|
+
| { kind: 'module', prefix?: string[] }
|
|
16
|
+
| { kind: 'path', dir: string }
|
|
17
|
+
|
|
18
|
+
export function resolvecandidates(name: string, sources?: Source[]): string[] {
|
|
19
|
+
const out: string[] = []
|
|
20
|
+
|
|
21
|
+
// A SCOPED NAME RESOLVES VERBATIM ONLY (§10.2). `@acme/thing` is
|
|
22
|
+
// already a package id; prefixing it produces
|
|
23
|
+
// `@voxgig/plugin-@acme/thing`, which is not a thing that can exist.
|
|
24
|
+
if (name.startsWith('@')) return [name]
|
|
25
|
+
|
|
26
|
+
const list = sources && 0 < sources.length ? sources : DEFAULT_SOURCES
|
|
27
|
+
|
|
28
|
+
for (const src of list) {
|
|
29
|
+
if ('module' === src.kind) {
|
|
30
|
+
const prefixes = src.prefix && 0 < src.prefix.length ? src.prefix : ['']
|
|
31
|
+
for (const p of prefixes) {
|
|
32
|
+
const id = p + name
|
|
33
|
+
if (-1 === out.indexOf(id)) out.push(id)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else if ('path' === src.kind) {
|
|
37
|
+
const id = src.dir.replace(/\/+$/, '') + '/' + name
|
|
38
|
+
if (-1 === out.indexOf(id)) out.push(id)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return out
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const DEFAULT_SOURCES: Source[] = [
|
|
46
|
+
{ kind: 'module', prefix: ['@voxgig/plugin-', 'voxgig-plugin-', 'plugin-', ''] },
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
/** A MODULE PATH IS NOT A NAME (§10.2). The ref grammar starts a name
|
|
50
|
+
* with a letter or `@`, so `./local/thing` is not a ref and never
|
|
51
|
+
* reaches candidate generation — seneca allows a path where a plugin
|
|
52
|
+
* name goes, and this design deliberately does not, because a ref is an
|
|
53
|
+
* ADDRESS WITHIN A HOST and a path is a LOCATION ON A DISK.
|
|
54
|
+
*
|
|
55
|
+
* Loading from an explicit location is a separate field that bypasses
|
|
56
|
+
* candidate generation entirely: `from` is passed to the resolver
|
|
57
|
+
* verbatim, and a resolver that cannot honour a location raises
|
|
58
|
+
* plugin_resolve_failed. */
|
|
59
|
+
export function resolvefrom(from: string): string[] {
|
|
60
|
+
return [from]
|
|
61
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// VENDORED: @voxgig/plugin 0.1.6 (typescript/src/Types.ts)
|
|
2
|
+
// Source: https://github.com/voxgig/plugin @ 8d8968afc0a2008fbd795b41ab166307d989f02a [tag: sdk-20260904-1610-0]
|
|
3
|
+
// License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
|
|
4
|
+
/* Shared types. Deliberately small: the design's §19 budget says the
|
|
5
|
+
* library owns naming, configuration, lifecycle, ordering, binding and
|
|
6
|
+
* teardown, and nothing else. */
|
|
7
|
+
|
|
8
|
+
/** The two halves of an identity (§4). `tag` is '' when absent — never
|
|
9
|
+
* null and never missing, because a port returning three shapes for two
|
|
10
|
+
* states makes every downstream comparison a special case. */
|
|
11
|
+
export type Ref = { name: string, tag: string }
|
|
12
|
+
|
|
13
|
+
/** §5.1's seven statuses, and no more. A port that adds an eighth is
|
|
14
|
+
* diverging. `loading` and `closing` are observable only from inside a
|
|
15
|
+
* callback or from another thread. */
|
|
16
|
+
export type Status =
|
|
17
|
+
'declared' | 'loaded' | 'pending' | 'live' | 'failed' | 'loading' | 'closing'
|
|
18
|
+
|
|
19
|
+
/** A normalized instance entry. Option data is NOT merged here — see
|
|
20
|
+
* `optionlayers`. */
|
|
21
|
+
export type Instance = {
|
|
22
|
+
pos: number
|
|
23
|
+
active: boolean
|
|
24
|
+
start: 'eager' | 'lazy'
|
|
25
|
+
order?: OrderBlock
|
|
26
|
+
/** Levels 3-6 that are present, IN LADDER ORDER (§9.3).
|
|
27
|
+
*
|
|
28
|
+
* Normalization does not merge these, and cannot: §9.4 makes merge
|
|
29
|
+
* behaviour a property of the definition's option shape, which
|
|
30
|
+
* normalization has never seen. Flattening them here would make
|
|
31
|
+
* `$MERGE: append` unimplementable at load time, because the layers
|
|
32
|
+
* it must concatenate would already be collapsed. */
|
|
33
|
+
optionlayers: any[]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** §4.4 of DOCS.md — `band` rather than a nested `order`, because
|
|
37
|
+
* `order.order` needs explaining every time it is read. */
|
|
38
|
+
/** `before`/`after` accept ONE spelling or a LIST of them. The list form
|
|
39
|
+
* is not decoration: a host may need a binding after two unrelated others,
|
|
40
|
+
* and station's per-feature `order` has carried string lists since Stage 3b.
|
|
41
|
+
* Plugin typed this as a bare string and matched with `===`, so a list was
|
|
42
|
+
* SILENTLY DROPPED - the sort came out exactly as if no constraint had been
|
|
43
|
+
* declared, with nothing raised. */
|
|
44
|
+
export type OrderRef = string | string[]
|
|
45
|
+
|
|
46
|
+
/** What a NORMALIZED block may hold, which is wider than what constrains
|
|
47
|
+
* anything. Normalization is a carrier, not an interpreter (§9.1): the
|
|
48
|
+
* block comes back exactly as authored, so a value written `null` is still
|
|
49
|
+
* `null` here, and `config/normorder#null-survives` pins that. Typing it
|
|
50
|
+
* as `OrderRef | undefined` told callers a runtime null was impossible
|
|
51
|
+
* while `Config.ts` assigned one straight through `any`. `declared()` is
|
|
52
|
+
* the gate that turns a spec into a constraint; nothing else may assume
|
|
53
|
+
* one. */
|
|
54
|
+
export type OrderSpec = OrderRef | null
|
|
55
|
+
|
|
56
|
+
export type OrderBlock = { before?: OrderSpec, after?: OrderSpec, band?: number }
|
|
57
|
+
|
|
58
|
+
export type Normalized = {
|
|
59
|
+
instance: { [ref: string]: Instance }
|
|
60
|
+
order: string[]
|
|
61
|
+
default: { [name: string]: any }
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** §12's detail fields, IN THIS FIXED ORDER.
|
|
65
|
+
*
|
|
66
|
+
* The order is part of the contract, not a formatting preference. An
|
|
67
|
+
* earlier draft named six fields while other sections promised
|
|
68
|
+
* diagnostics that had nowhere to go, which would have left each port
|
|
69
|
+
* inventing its own order and breaking message parity. */
|
|
70
|
+
export const DETAIL_ORDER = [
|
|
71
|
+
'host', 'ref', 'name', 'tag', 'point', 'key', 'capability',
|
|
72
|
+
'range', 'version', 'match', 'candidates', 'cycle', 'holders',
|
|
73
|
+
'refs', 'path', 'cause',
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
/** `plugin/<code>: <text> [<key>=<value> …]`
|
|
77
|
+
*
|
|
78
|
+
* Values render as COMPACT JSON, so a value containing a space or a
|
|
79
|
+
* bracket cannot break the parse, and a list renders as a JSON array.
|
|
80
|
+
* The bracket is absent entirely when no field applies. */
|
|
81
|
+
export function formaterror(code: string, text: string, details?: { [k: string]: any }): string {
|
|
82
|
+
const d = details || {}
|
|
83
|
+
const parts: string[] = []
|
|
84
|
+
for (const k of DETAIL_ORDER) {
|
|
85
|
+
if (undefined === d[k]) continue
|
|
86
|
+
parts.push(k + '=' + JSON.stringify(d[k]))
|
|
87
|
+
}
|
|
88
|
+
const tail = 0 === parts.length ? '' : ' [' + parts.join(' ') + ']'
|
|
89
|
+
return 'plugin/' + code + ': ' + text + tail
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Every error carries a §12 code. Ports compare by CODE and never by
|
|
93
|
+
* message: wording is a port's own business, and pinning the words
|
|
94
|
+
* would make every translation a corpus change. The FORMAT, however, is
|
|
95
|
+
* pinned — a parseable message is what makes a log searchable across
|
|
96
|
+
* twenty languages. */
|
|
97
|
+
export class PluginError extends Error {
|
|
98
|
+
code: string
|
|
99
|
+
text: string
|
|
100
|
+
details: { [k: string]: any }
|
|
101
|
+
constructor(code: string, text: string, details?: { [k: string]: any }) {
|
|
102
|
+
super(formaterror(code, text, details))
|
|
103
|
+
this.name = 'PluginError'
|
|
104
|
+
this.code = code
|
|
105
|
+
this.text = text
|
|
106
|
+
this.details = details || {}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function fail(code: string, text: string, details?: any): never {
|
|
111
|
+
throw new PluginError(code, text, details)
|
|
112
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// VENDORED: @voxgig/plugin 0.1.6 (typescript/src/Version.ts)
|
|
2
|
+
// Source: https://github.com/voxgig/plugin @ 8d8968afc0a2008fbd795b41ab166307d989f02a [tag: sdk-20260904-1610-0]
|
|
3
|
+
// License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
|
|
4
|
+
/* Versions and ranges (§11.2).
|
|
5
|
+
*
|
|
6
|
+
* TWO FIELDS AND ONE PREDICATE. A capability declares `version`, a
|
|
7
|
+
* concrete version. A requirement declares `range`. A requirement is
|
|
8
|
+
* satisfied when the names match, the `match` passes, and:
|
|
9
|
+
*
|
|
10
|
+
* the provider's `version` falls inside the requirement's `range`.
|
|
11
|
+
*
|
|
12
|
+
* That is the whole rule. There is no third field and no second
|
|
13
|
+
* comparison — an earlier draft added a provider-side `compat` range,
|
|
14
|
+
* which left three values and no statement of how they combine, and
|
|
15
|
+
* three defensible readings of one declaration is worse than the
|
|
16
|
+
* ambiguity it was introduced to fix. */
|
|
17
|
+
|
|
18
|
+
import { fail } from './Types'
|
|
19
|
+
|
|
20
|
+
export type Range = { lo: number[], hi: number[] }
|
|
21
|
+
|
|
22
|
+
const VERSION_RE = /^(\d+)(?:\.(\d+))?(?:\.(\d+))?$/
|
|
23
|
+
|
|
24
|
+
/** A COMPONENT IS BOUNDED, like a ref is (§4's 1024).
|
|
25
|
+
*
|
|
26
|
+
* The grammar admits an unbounded digit sequence, and every language
|
|
27
|
+
* then disagrees about what happens past its integer range: JavaScript
|
|
28
|
+
* silently loses precision, Go's `Atoi` errors (and a port ignoring that
|
|
29
|
+
* gets 0), C overflows, Python is exact. `satisfies("0",
|
|
30
|
+
* "9223372036854775808")` was false in the canonical and true in go —
|
|
31
|
+
* from the same corpus.
|
|
32
|
+
*
|
|
33
|
+
* 2^31-1 because every port has a signed 32-bit integer, and no real
|
|
34
|
+
* version has ever needed more. Stated rather than left to arithmetic
|
|
35
|
+
* nobody agrees on. Found by review of the go port. */
|
|
36
|
+
const COMPONENT_MAX = 2147483647
|
|
37
|
+
|
|
38
|
+
/** Two forms and no more (§11.2):
|
|
39
|
+
*
|
|
40
|
+
* '2.1' >= 2.1.0 and < 3.0.0
|
|
41
|
+
* '~2.1' >= 2.1.0 and < 2.2.0
|
|
42
|
+
*/
|
|
43
|
+
export function parserange(range: string): Range {
|
|
44
|
+
if ('string' !== typeof range || 0 === range.length) {
|
|
45
|
+
fail('plugin_bad_range', 'invalid range: ' + range, { range })
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const tilde = range.startsWith('~')
|
|
49
|
+
const body = tilde ? range.substring(1) : range
|
|
50
|
+
const m = VERSION_RE.exec(body)
|
|
51
|
+
if (!m) fail('plugin_bad_range', 'invalid range: ' + range, { range })
|
|
52
|
+
|
|
53
|
+
const major = component(m[1], range, 'range')
|
|
54
|
+
const minor = undefined === m[2] ? 0 : component(m[2], range, 'range')
|
|
55
|
+
const patch = undefined === m[3] ? 0 : component(m[3], range, 'range')
|
|
56
|
+
|
|
57
|
+
const lo = [major, minor, patch]
|
|
58
|
+
const hi = tilde ? [major, minor + 1, 0] : [major + 1, 0, 0]
|
|
59
|
+
return { lo, hi }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function parseversion(version: string): number[] {
|
|
63
|
+
if ('string' !== typeof version) {
|
|
64
|
+
fail('plugin_bad_range', 'invalid version: ' + version, { version })
|
|
65
|
+
}
|
|
66
|
+
const m = VERSION_RE.exec(version)
|
|
67
|
+
if (!m) fail('plugin_bad_range', 'invalid version: ' + version, { version })
|
|
68
|
+
return [
|
|
69
|
+
component(m[1], version, 'version'),
|
|
70
|
+
undefined === m[2] ? 0 : component(m[2], version, 'version'),
|
|
71
|
+
undefined === m[3] ? 0 : component(m[3], version, 'version'),
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** One component, bounded. `plugin_bad_range` either way — the same code
|
|
76
|
+
* the rest of the grammar's failures use, because "this is not a version
|
|
77
|
+
* I can compare" is one fact however it went wrong. */
|
|
78
|
+
function component(digits: string, whole: string, field: string): number {
|
|
79
|
+
const n = Number(digits)
|
|
80
|
+
if (!Number.isInteger(n) || COMPONENT_MAX < n) {
|
|
81
|
+
fail('plugin_bad_range',
|
|
82
|
+
'version component out of range in ' + whole + ': ' + digits,
|
|
83
|
+
{ [field]: whole })
|
|
84
|
+
}
|
|
85
|
+
return n
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** The one satisfaction predicate: lo <= version < hi. */
|
|
89
|
+
export function satisfies(version: string, range: string): boolean {
|
|
90
|
+
const v = parseversion(version)
|
|
91
|
+
const r = parserange(range)
|
|
92
|
+
return 0 <= cmp(v, r.lo) && 0 > cmp(v, r.hi)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function cmp(a: number[], b: number[]): number {
|
|
96
|
+
for (let i = 0; i < 3; i++) {
|
|
97
|
+
if (a[i] !== b[i]) return a[i] < b[i] ? -1 : 1
|
|
98
|
+
}
|
|
99
|
+
return 0
|
|
100
|
+
}
|