@voxgig/sdkgen 4.10.0 → 4.11.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/package.json +1 -1
- package/project/.sdk/model/feature/secrets.aon +330 -0
- package/project/.sdk/model/target/c.aon +15 -2
- package/project/.sdk/model/target/cpp.aon +18 -0
- package/project/.sdk/model/target/lua.aon +17 -0
- package/project/.sdk/model/target/ocaml.aon +48 -5
- package/project/.sdk/model/target/zig.aon +30 -4
- package/project/.sdk/src/cmp/c/Config_c.ts +338 -1
- package/project/.sdk/src/cmp/c/Main_c.ts +57 -2
- package/project/.sdk/src/cmp/c/Package_c.ts +12 -2
- package/project/.sdk/src/cmp/cpp/Config_cpp.ts +324 -2
- package/project/.sdk/src/cmp/cpp/Gitignore_cpp.ts +2 -0
- package/project/.sdk/src/cmp/cpp/Main_cpp.ts +62 -4
- package/project/.sdk/src/cmp/cpp/Package_cpp.ts +10 -0
- package/project/.sdk/src/cmp/lua/Config_lua.ts +88 -0
- package/project/.sdk/src/cmp/lua/Gitignore_lua.ts +4 -0
- package/project/.sdk/src/cmp/lua/Main_lua.ts +93 -3
- package/project/.sdk/src/cmp/lua/Package_lua.ts +60 -0
- package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +10 -0
- package/project/.sdk/src/cmp/ocaml/Config_ocaml.ts +183 -5
- package/project/.sdk/src/cmp/ocaml/Main_ocaml.ts +160 -3
- package/project/.sdk/src/cmp/ocaml/Package_ocaml.ts +25 -1
- package/project/.sdk/src/cmp/zig/Config_zig.ts +130 -9
- package/project/.sdk/src/cmp/zig/Main_zig.ts +208 -4
- package/project/.sdk/{tm/zig/build.zig → src/cmp/zig/fragment/Build.fragment.zig} +7 -0
- package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +25 -0
- package/project/.sdk/{tm/zig/root.zig → src/cmp/zig/fragment/Root.fragment.zig} +9 -0
- package/project/.sdk/tm/c/Makefile +58 -9
- package/project/.sdk/tm/c/core/sdk.h +10 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/capability.c +133 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/capability.h +39 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/catalog.c +83 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/catalog.h +48 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/config.c +413 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/config.h +24 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/depend.c +264 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/depend.h +29 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/env.c +220 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/env.h +19 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/export.c +97 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/export.h +19 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/graph.c +237 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/graph.h +17 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/host.c +1494 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/host.h +135 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/order.c +288 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/order.h +18 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/point.c +141 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/point.h +80 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/ref.c +170 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/ref.h +52 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/resolve.c +98 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/resolve.h +18 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/types.c +150 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/types.h +104 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/value.c +649 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/value.h +135 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/version.c +151 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/version.h +34 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/aws.c +281 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/azuresecrets.c +207 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/boru.c +164 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/clock.c +75 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/doppler.c +141 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/encode.c +144 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/gcpsecrets.c +177 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/hashicorp.c +239 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/httpjson.c +599 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/infisical.c +165 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/onepassword.c +194 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/proc.c +233 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/secretspec.c +125 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/sekretoplugins.h +125 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/sha256.c +270 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/sigv4.c +382 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/support.h +153 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/tls.c +420 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/internal.h +86 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/json.c +721 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/providers.c +813 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/sekreto.c +944 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/sekreto.h +490 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/util.c +442 -0
- package/project/.sdk/tm/c/feature/secrets.c +797 -0
- package/project/.sdk/tm/c/feature/secrets.h +46 -0
- package/project/.sdk/tm/c/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/c/tests/feature/secrets/secrets_test.c +802 -0
- package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +38 -11
- package/project/.sdk/tm/clojure/test/sdk/test/feature/secrets.clj +40 -6
- package/project/.sdk/tm/cpp/Makefile +48 -4
- package/project/.sdk/tm/cpp/feature/secrets/plugin/capability.cpp +121 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/capability.hpp +41 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/catalog.cpp +60 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/catalog.hpp +66 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/config.cpp +376 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/config.hpp +29 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/depend.cpp +230 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/depend.hpp +31 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/env.cpp +205 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/env.hpp +25 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/export.cpp +84 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/export.hpp +24 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/graph.cpp +222 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/graph.hpp +21 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/host.cpp +1200 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/host.hpp +250 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/order.cpp +250 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/order.hpp +22 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/point.cpp +110 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/point.hpp +79 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/ref.cpp +136 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/ref.hpp +60 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/resolve.cpp +82 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/resolve.hpp +25 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/types.cpp +90 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/types.hpp +65 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/value.cpp +491 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/value.hpp +120 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/version.cpp +143 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/version.hpp +36 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Aws.cpp +248 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Aws.hpp +30 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Azuresecrets.cpp +149 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Azuresecrets.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Boru.cpp +117 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Boru.hpp +27 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Crypto.cpp +180 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Crypto.hpp +52 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Doppler.cpp +87 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Doppler.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Gcpsecrets.cpp +121 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Gcpsecrets.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Hashicorp.cpp +153 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Hashicorp.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Httpjson.cpp +666 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Httpjson.hpp +160 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Infisical.cpp +123 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Infisical.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Onepassword.cpp +125 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Onepassword.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Proc.cpp +223 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Proc.hpp +47 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Secretspec.cpp +104 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Secretspec.hpp +27 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Sigv4.cpp +242 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Sigv4.hpp +58 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Tls.cpp +260 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Tls.hpp +47 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Json.cpp +476 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Json.hpp +89 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Provider.cpp +312 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Provider.hpp +263 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Providers.cpp +354 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Providers.hpp +111 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Sekreto.cpp +613 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Sekreto.hpp +227 -0
- package/project/.sdk/tm/cpp/feature/secrets.hpp +745 -0
- package/project/.sdk/tm/cpp/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/test/feature/secrets/secrets_test.cpp +808 -0
- package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +34 -8
- package/project/.sdk/tm/csharp/test/feature/secrets/SecretsFeatureTest.cs +85 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +17 -2
- package/project/.sdk/tm/elixir/test/feature/secrets/secrets_test.exs +41 -0
- package/project/.sdk/tm/go/feature/secrets_feature.go +32 -10
- package/project/.sdk/tm/go/test/feature/secrets/secrets_feature_test.go +116 -0
- package/project/.sdk/tm/java/feature/SecretsFeature.java +33 -8
- package/project/.sdk/tm/java/test/feature/secrets/SecretsFeatureTest.java +64 -0
- package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +34 -11
- package/project/.sdk/tm/js/test/feature/secrets/Secrets.test.js +73 -0
- package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +32 -7
- package/project/.sdk/tm/kotlin/test/feature/secrets/SecretsTest.kt +69 -0
- package/project/.sdk/tm/lua/Makefile +15 -4
- package/project/.sdk/tm/lua/feature/secrets/native/sekretonet.c +806 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/capability.lua +135 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/catalog.lua +63 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/config.lua +361 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/depend.lua +232 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/env.lua +168 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/export.lua +66 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/graph.lua +194 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/host.lua +1190 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/json.lua +169 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/order.lua +207 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/point.lua +106 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/ref.lua +115 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/resolve.lua +78 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/types.lua +275 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/version.lua +131 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin.lua +76 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/addr.lua +124 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/err.lua +47 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/name.lua +315 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/aws.lua +228 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/azuresecrets.lua +137 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/boru.lua +124 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/crypto.lua +212 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/doppler.lua +89 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/gcpsecrets.lua +129 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/hashicorp.lua +154 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/httpjson.lua +248 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/infisical.lua +113 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/json.lua +449 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/net.lua +198 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/onepassword.lua +126 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/secretspec.lua +93 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/sigv4.lua +269 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/support.lua +146 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/providers.lua +346 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto.lua +479 -0
- package/project/.sdk/tm/lua/feature/secrets_feature.lua +690 -0
- package/project/.sdk/tm/lua/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/lua/test/extend_test.lua +105 -0
- package/project/.sdk/tm/lua/test/feature/secrets/secrets_feature_test.lua +862 -0
- package/project/.sdk/tm/ocaml/Makefile +52 -8
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/capability.ml +106 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/catalog.ml +43 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/config.ml +349 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/defs.ml +143 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/depend.ml +217 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/env.ml +197 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/export.ml +89 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/graph.ml +227 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/host.ml +1112 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/order.ml +202 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/point.ml +138 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/ref.ml +126 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/resolve.ml +62 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/types.ml +97 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/value.ml +387 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/version.ml +139 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/aws.ml +171 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/azuresecrets.ml +116 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/boru.ml +95 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/crypto.ml +149 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/doppler.ml +61 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/gcpsecrets.ml +93 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/hashicorp.ml +120 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/http.ml +421 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/httpjson.ml +66 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/infisical.ml +85 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/onepassword.ml +112 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/runcmd.ml +97 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/secretspec.ml +68 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/sigv4.ml +259 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/tls.ml +44 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/tls_stubs.c +358 -0
- package/project/.sdk/tm/ocaml/feature/secrets/sekreto/json.ml +376 -0
- package/project/.sdk/tm/ocaml/feature/secrets/sekreto/provider.ml +647 -0
- package/project/.sdk/tm/ocaml/feature/secrets/sekreto/secret.ml +299 -0
- package/project/.sdk/tm/ocaml/feature/secrets/sekreto/sekreto.ml +347 -0
- package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +453 -0
- package/project/.sdk/tm/ocaml/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +670 -0
- package/project/.sdk/tm/perl/feature/secrets_feature.pm +33 -12
- package/project/.sdk/tm/perl/t/feature/secrets/secrets.t +47 -0
- package/project/.sdk/tm/php/feature/SecretsFeature.php +30 -6
- package/project/.sdk/tm/php/test/feature/secrets/SecretsTest.php +98 -0
- package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +28 -6
- package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +114 -0
- package/project/.sdk/tm/rb/feature/secrets_feature.rb +28 -6
- package/project/.sdk/tm/rb/test/feature/secrets/secrets_feature_test.rb +93 -0
- package/project/.sdk/tm/rust/feature/secrets.rs +33 -10
- package/project/.sdk/tm/rust/tests/feature/secrets/main.rs +96 -0
- package/project/.sdk/tm/scala/feature/SecretsFeature.scala +29 -7
- package/project/.sdk/tm/scala/sdktest/feature/secrets/SecretsTestMain.scala +71 -0
- package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +35 -12
- package/project/.sdk/tm/ts/test/feature/secrets/Secrets.test.ts +73 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/capability.zig +137 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/catalog.zig +90 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/config.zig +346 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/depend.zig +244 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/env.zig +201 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/export.zig +83 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/graph.zig +212 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/host.zig +1224 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/inst.zig +126 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/order.zig +228 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/plugin.zig +34 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/point.zig +166 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/ref.zig +147 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/resolve.zig +74 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/types.zig +140 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/value.zig +662 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/version.zig +139 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/aws.zig +294 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/azuresecrets.zig +222 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/boru.zig +188 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/doppler.zig +135 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/gcpsecrets.zig +170 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/hashicorp.zig +242 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/httpjson.zig +535 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/infisical.zig +167 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/onepassword.zig +202 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/secretspec.zig +160 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/sigv4.zig +336 -0
- package/project/.sdk/tm/zig/feature/secrets/sekreto/addr.zig +148 -0
- package/project/.sdk/tm/zig/feature/secrets/sekreto/builtins.zig +259 -0
- package/project/.sdk/tm/zig/feature/secrets/sekreto/provider.zig +440 -0
- package/project/.sdk/tm/zig/feature/secrets/sekreto/sekreto.zig +944 -0
- package/project/.sdk/tm/zig/feature/secrets.zig +854 -0
- package/project/.sdk/tm/zig/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/zig/test/feature/secrets/secrets_test.zig +891 -0
- package/project/sdkgen-package.json +1 -1
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
// VENDORED: @voxgig/plugin sdk-20260908-1556-0 (cpp/src/value.cpp)
|
|
2
|
+
// Source: https://github.com/voxgig/plugin @ 48392f5e2b6d1434ee9b1a4a9a11f4480aaeb46a [tag: sdk-20260908-1556-0]
|
|
3
|
+
// License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
|
|
4
|
+
/* The dynamic value, and the JSON reader. See value.hpp. */
|
|
5
|
+
|
|
6
|
+
#include "value.hpp"
|
|
7
|
+
|
|
8
|
+
#include <algorithm>
|
|
9
|
+
#include <cmath>
|
|
10
|
+
#include <cstdio>
|
|
11
|
+
#include <cstdlib>
|
|
12
|
+
|
|
13
|
+
namespace plugin {
|
|
14
|
+
|
|
15
|
+
V vnull() {
|
|
16
|
+
auto v = std::make_shared<Value>();
|
|
17
|
+
v->kind = Kind::Null;
|
|
18
|
+
return v;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
V vbool(bool b) {
|
|
22
|
+
auto v = std::make_shared<Value>();
|
|
23
|
+
v->kind = Kind::Bool;
|
|
24
|
+
v->boolean = b;
|
|
25
|
+
return v;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
V vnum(double n) {
|
|
29
|
+
auto v = std::make_shared<Value>();
|
|
30
|
+
v->kind = Kind::Num;
|
|
31
|
+
v->num = n;
|
|
32
|
+
return v;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
V vstr(const std::string& s) {
|
|
36
|
+
auto v = std::make_shared<Value>();
|
|
37
|
+
v->kind = Kind::Str;
|
|
38
|
+
v->str = s;
|
|
39
|
+
return v;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
V vlist() {
|
|
43
|
+
auto v = std::make_shared<Value>();
|
|
44
|
+
v->kind = Kind::List;
|
|
45
|
+
return v;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
V vmap() {
|
|
49
|
+
auto v = std::make_shared<Value>();
|
|
50
|
+
v->kind = Kind::Map;
|
|
51
|
+
return v;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* A nullptr is "nothing", and nothing is null-shaped for every question
|
|
55
|
+
* a caller can ask about a kind. Only `has` tells the two apart. */
|
|
56
|
+
bool isnull(const V& v) { return !v || Kind::Null == v->kind; }
|
|
57
|
+
bool isbool(const V& v) { return v && Kind::Bool == v->kind; }
|
|
58
|
+
bool isnum(const V& v) { return v && Kind::Num == v->kind; }
|
|
59
|
+
bool isstr(const V& v) { return v && Kind::Str == v->kind; }
|
|
60
|
+
bool islist(const V& v) { return v && Kind::List == v->kind; }
|
|
61
|
+
bool ismap(const V& v) { return v && Kind::Map == v->kind; }
|
|
62
|
+
|
|
63
|
+
V get(const V& m, const std::string& key) {
|
|
64
|
+
if (!ismap(m)) return vnull();
|
|
65
|
+
for (const auto& e : m->entries) {
|
|
66
|
+
if (e.first == key) return e.second ? e.second : vnull();
|
|
67
|
+
}
|
|
68
|
+
return vnull();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
bool has(const V& m, const std::string& key) {
|
|
72
|
+
if (!ismap(m)) return false;
|
|
73
|
+
for (const auto& e : m->entries) {
|
|
74
|
+
if (e.first == key) return true;
|
|
75
|
+
}
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
void set(const V& m, const std::string& key, const V& val) {
|
|
80
|
+
if (!ismap(m)) return;
|
|
81
|
+
for (auto& e : m->entries) {
|
|
82
|
+
if (e.first == key) { e.second = val ? val : vnull(); return; }
|
|
83
|
+
}
|
|
84
|
+
m->entries.emplace_back(key, val ? val : vnull());
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
void del(const V& m, const std::string& key) {
|
|
88
|
+
if (!ismap(m)) return;
|
|
89
|
+
for (size_t i = 0; i < m->entries.size(); i++) {
|
|
90
|
+
if (m->entries[i].first == key) {
|
|
91
|
+
m->entries.erase(m->entries.begin() + static_cast<long>(i));
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
V at(const V& l, size_t i) {
|
|
98
|
+
if (!islist(l) || i >= l->items.size()) return vnull();
|
|
99
|
+
return l->items[i] ? l->items[i] : vnull();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
void push(const V& l, const V& item) {
|
|
103
|
+
if (!islist(l)) return;
|
|
104
|
+
l->items.push_back(item ? item : vnull());
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
size_t len(const V& v) {
|
|
108
|
+
if (!v) return 0;
|
|
109
|
+
if (Kind::List == v->kind) return v->items.size();
|
|
110
|
+
if (Kind::Map == v->kind) return v->entries.size();
|
|
111
|
+
return 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
std::string asstr(const V& v) { return isstr(v) ? v->str : std::string(); }
|
|
115
|
+
double asnum(const V& v) { return isnum(v) ? v->num : 0.0; }
|
|
116
|
+
bool asbool(const V& v) { return isbool(v) && v->boolean; }
|
|
117
|
+
|
|
118
|
+
std::vector<std::string> keys(const V& m) {
|
|
119
|
+
std::vector<std::string> out;
|
|
120
|
+
if (!ismap(m)) return out;
|
|
121
|
+
out.reserve(m->entries.size());
|
|
122
|
+
for (const auto& e : m->entries) out.push_back(e.first);
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
std::vector<std::string> sortedkeys(const V& m) {
|
|
127
|
+
auto out = keys(m);
|
|
128
|
+
/* BYTE-WISE, not locale-aware: std::sort on std::string compares by
|
|
129
|
+
* char value, which is what every other port's sort does. A
|
|
130
|
+
* locale-collating comparison would order mixed-case refs differently
|
|
131
|
+
* per machine. */
|
|
132
|
+
std::sort(out.begin(), out.end());
|
|
133
|
+
return out;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
bool truthy(const V& v) {
|
|
137
|
+
if (!v) return false;
|
|
138
|
+
switch (v->kind) {
|
|
139
|
+
case Kind::Null: return false;
|
|
140
|
+
case Kind::Bool: return v->boolean;
|
|
141
|
+
/* §4 rule 4: JSON truthiness. 0 and "" are FALSE, matching every
|
|
142
|
+
* other port's `truthy`, not C++'s "any nonzero scalar". */
|
|
143
|
+
case Kind::Num: return 0.0 != v->num;
|
|
144
|
+
case Kind::Str: return !v->str.empty();
|
|
145
|
+
default: return true;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
bool same(const V& a, const V& b) {
|
|
150
|
+
bool anull = isnull(a), bnull = isnull(b);
|
|
151
|
+
if (anull || bnull) return anull && bnull;
|
|
152
|
+
/* TYPE FIRST. `true` and `1` are different values, and
|
|
153
|
+
* `capability/match` is the entry that says so. */
|
|
154
|
+
if (a->kind != b->kind) return false;
|
|
155
|
+
switch (a->kind) {
|
|
156
|
+
case Kind::Bool: return a->boolean == b->boolean;
|
|
157
|
+
case Kind::Num: return a->num == b->num;
|
|
158
|
+
case Kind::Str: return a->str == b->str;
|
|
159
|
+
case Kind::List: {
|
|
160
|
+
if (a->items.size() != b->items.size()) return false;
|
|
161
|
+
for (size_t i = 0; i < a->items.size(); i++) {
|
|
162
|
+
if (!same(at(a, i), at(b, i))) return false;
|
|
163
|
+
}
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
case Kind::Map: {
|
|
167
|
+
if (a->entries.size() != b->entries.size()) return false;
|
|
168
|
+
for (const auto& e : a->entries) {
|
|
169
|
+
if (!has(b, e.first)) return false;
|
|
170
|
+
if (!same(e.second, get(b, e.first))) return false;
|
|
171
|
+
}
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
default: return true;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
V clone(const V& v) {
|
|
179
|
+
if (!v) return nullptr;
|
|
180
|
+
switch (v->kind) {
|
|
181
|
+
case Kind::List: {
|
|
182
|
+
V out = vlist();
|
|
183
|
+
for (const auto& i : v->items) push(out, clone(i));
|
|
184
|
+
return out;
|
|
185
|
+
}
|
|
186
|
+
case Kind::Map: {
|
|
187
|
+
V out = vmap();
|
|
188
|
+
for (const auto& e : v->entries) set(out, e.first, clone(e.second));
|
|
189
|
+
return out;
|
|
190
|
+
}
|
|
191
|
+
default: return std::make_shared<Value>(*v);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* --- json ----------------------------------------------------------- */
|
|
196
|
+
|
|
197
|
+
std::string numstr(double n) {
|
|
198
|
+
char tmp[64];
|
|
199
|
+
/* An integral double renders as an integer: the corpus's expected
|
|
200
|
+
* values are written `1`, not `1.0`, and a port that emits the latter
|
|
201
|
+
* fails every comparison for a reason that has nothing to do with the
|
|
202
|
+
* behaviour under test. */
|
|
203
|
+
if (std::isfinite(n) && n == static_cast<double>(static_cast<long long>(n))) {
|
|
204
|
+
std::snprintf(tmp, sizeof(tmp), "%lld", static_cast<long long>(n));
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
std::snprintf(tmp, sizeof(tmp), "%.17g", n);
|
|
208
|
+
}
|
|
209
|
+
return tmp;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
static void escape(const std::string& s, std::string& out) {
|
|
213
|
+
out += '"';
|
|
214
|
+
for (unsigned char c : s) {
|
|
215
|
+
switch (c) {
|
|
216
|
+
case '"': out += "\\\""; break;
|
|
217
|
+
case '\\': out += "\\\\"; break;
|
|
218
|
+
case '\n': out += "\\n"; break;
|
|
219
|
+
case '\r': out += "\\r"; break;
|
|
220
|
+
case '\t': out += "\\t"; break;
|
|
221
|
+
case '\b': out += "\\b"; break;
|
|
222
|
+
case '\f': out += "\\f"; break;
|
|
223
|
+
default:
|
|
224
|
+
if (0x20 > c) {
|
|
225
|
+
char tmp[8];
|
|
226
|
+
std::snprintf(tmp, sizeof(tmp), "\\u%04x", c);
|
|
227
|
+
out += tmp;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
out += static_cast<char>(c);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
out += '"';
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
static void render(const V& v, std::string& out) {
|
|
238
|
+
if (isnull(v)) { out += "null"; return; }
|
|
239
|
+
switch (v->kind) {
|
|
240
|
+
case Kind::Bool: out += v->boolean ? "true" : "false"; break;
|
|
241
|
+
case Kind::Num: out += numstr(v->num); break;
|
|
242
|
+
case Kind::Str: escape(v->str, out); break;
|
|
243
|
+
case Kind::List: {
|
|
244
|
+
out += '[';
|
|
245
|
+
for (size_t i = 0; i < v->items.size(); i++) {
|
|
246
|
+
if (0 < i) out += ',';
|
|
247
|
+
render(at(v, i), out);
|
|
248
|
+
}
|
|
249
|
+
out += ']';
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
case Kind::Map: {
|
|
253
|
+
out += '{';
|
|
254
|
+
/* SORTED, so two values that are `same` render identically. */
|
|
255
|
+
auto ks = sortedkeys(v);
|
|
256
|
+
for (size_t i = 0; i < ks.size(); i++) {
|
|
257
|
+
if (0 < i) out += ',';
|
|
258
|
+
escape(ks[i], out);
|
|
259
|
+
out += ':';
|
|
260
|
+
render(get(v, ks[i]), out);
|
|
261
|
+
}
|
|
262
|
+
out += '}';
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
default: out += "null";
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
std::string json(const V& v) {
|
|
270
|
+
std::string out;
|
|
271
|
+
render(v, out);
|
|
272
|
+
return out;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
namespace {
|
|
276
|
+
|
|
277
|
+
struct Parser {
|
|
278
|
+
const std::string& text;
|
|
279
|
+
size_t i = 0;
|
|
280
|
+
std::string err;
|
|
281
|
+
|
|
282
|
+
explicit Parser(const std::string& t) : text(t) {}
|
|
283
|
+
|
|
284
|
+
void skip() {
|
|
285
|
+
while (i < text.size() &&
|
|
286
|
+
(' ' == text[i] || '\t' == text[i] || '\n' == text[i] ||
|
|
287
|
+
'\r' == text[i])) {
|
|
288
|
+
i++;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
bool lit(const char* word) {
|
|
293
|
+
size_t n = std::char_traits<char>::length(word);
|
|
294
|
+
if (text.compare(i, n, word) != 0) return false;
|
|
295
|
+
i += n;
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
int hex4() {
|
|
300
|
+
if (i + 4 > text.size()) return -1;
|
|
301
|
+
int acc = 0;
|
|
302
|
+
for (int k = 0; k < 4; k++) {
|
|
303
|
+
char c = text[i + static_cast<size_t>(k)];
|
|
304
|
+
int d;
|
|
305
|
+
if ('0' <= c && '9' >= c) d = c - '0';
|
|
306
|
+
else if ('a' <= c && 'f' >= c) d = c - 'a' + 10;
|
|
307
|
+
else if ('A' <= c && 'F' >= c) d = c - 'A' + 10;
|
|
308
|
+
else return -1;
|
|
309
|
+
acc = acc * 16 + d;
|
|
310
|
+
}
|
|
311
|
+
i += 4;
|
|
312
|
+
return acc;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
static void utf8(unsigned cp, std::string& out) {
|
|
316
|
+
if (0x80 > cp) {
|
|
317
|
+
out += static_cast<char>(cp);
|
|
318
|
+
}
|
|
319
|
+
else if (0x800 > cp) {
|
|
320
|
+
out += static_cast<char>(0xC0 | (cp >> 6));
|
|
321
|
+
out += static_cast<char>(0x80 | (cp & 0x3F));
|
|
322
|
+
}
|
|
323
|
+
else if (0x10000 > cp) {
|
|
324
|
+
out += static_cast<char>(0xE0 | (cp >> 12));
|
|
325
|
+
out += static_cast<char>(0x80 | ((cp >> 6) & 0x3F));
|
|
326
|
+
out += static_cast<char>(0x80 | (cp & 0x3F));
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
out += static_cast<char>(0xF0 | (cp >> 18));
|
|
330
|
+
out += static_cast<char>(0x80 | ((cp >> 12) & 0x3F));
|
|
331
|
+
out += static_cast<char>(0x80 | ((cp >> 6) & 0x3F));
|
|
332
|
+
out += static_cast<char>(0x80 | (cp & 0x3F));
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
bool string(std::string& out) {
|
|
337
|
+
if (i >= text.size() || '"' != text[i]) { err = "expected a string"; return false; }
|
|
338
|
+
i++;
|
|
339
|
+
while (i < text.size() && '"' != text[i]) {
|
|
340
|
+
char c = text[i];
|
|
341
|
+
if ('\\' != c) { out += c; i++; continue; }
|
|
342
|
+
i++;
|
|
343
|
+
if (i >= text.size()) { err = "unterminated escape"; return false; }
|
|
344
|
+
char e = text[i++];
|
|
345
|
+
switch (e) {
|
|
346
|
+
case '"': out += '"'; break;
|
|
347
|
+
case '\\': out += '\\'; break;
|
|
348
|
+
case '/': out += '/'; break;
|
|
349
|
+
case 'n': out += '\n'; break;
|
|
350
|
+
case 'r': out += '\r'; break;
|
|
351
|
+
case 't': out += '\t'; break;
|
|
352
|
+
case 'b': out += '\b'; break;
|
|
353
|
+
case 'f': out += '\f'; break;
|
|
354
|
+
case 'u': {
|
|
355
|
+
int hi = hex4();
|
|
356
|
+
if (0 > hi) { err = "bad \\u escape"; return false; }
|
|
357
|
+
unsigned cp = static_cast<unsigned>(hi);
|
|
358
|
+
if (0xD800 <= cp && 0xDBFF >= cp && i + 1 < text.size() &&
|
|
359
|
+
'\\' == text[i] && 'u' == text[i + 1]) {
|
|
360
|
+
i += 2;
|
|
361
|
+
int lo = hex4();
|
|
362
|
+
if (0 > lo) { err = "bad \\u escape"; return false; }
|
|
363
|
+
cp = 0x10000 + ((cp - 0xD800) << 10) +
|
|
364
|
+
(static_cast<unsigned>(lo) - 0xDC00);
|
|
365
|
+
}
|
|
366
|
+
utf8(cp, out);
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
default: err = "bad escape"; return false;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
if (i >= text.size()) { err = "unterminated string"; return false; }
|
|
373
|
+
i++;
|
|
374
|
+
return true;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
V value() {
|
|
378
|
+
skip();
|
|
379
|
+
if (i >= text.size()) { err = "unexpected end of input"; return nullptr; }
|
|
380
|
+
char c = text[i];
|
|
381
|
+
|
|
382
|
+
if ('n' == c) {
|
|
383
|
+
if (!lit("null")) { err = "bad literal"; return nullptr; }
|
|
384
|
+
return vnull();
|
|
385
|
+
}
|
|
386
|
+
if ('t' == c) {
|
|
387
|
+
if (!lit("true")) { err = "bad literal"; return nullptr; }
|
|
388
|
+
return vbool(true);
|
|
389
|
+
}
|
|
390
|
+
if ('f' == c) {
|
|
391
|
+
if (!lit("false")) { err = "bad literal"; return nullptr; }
|
|
392
|
+
return vbool(false);
|
|
393
|
+
}
|
|
394
|
+
if ('"' == c) {
|
|
395
|
+
std::string s;
|
|
396
|
+
if (!string(s)) return nullptr;
|
|
397
|
+
return vstr(s);
|
|
398
|
+
}
|
|
399
|
+
if ('[' == c) {
|
|
400
|
+
i++;
|
|
401
|
+
V out = vlist();
|
|
402
|
+
skip();
|
|
403
|
+
if (i < text.size() && ']' == text[i]) { i++; return out; }
|
|
404
|
+
for (;;) {
|
|
405
|
+
V item = value();
|
|
406
|
+
if (!item) return nullptr;
|
|
407
|
+
push(out, item);
|
|
408
|
+
skip();
|
|
409
|
+
if (i < text.size() && ',' == text[i]) { i++; continue; }
|
|
410
|
+
if (i < text.size() && ']' == text[i]) { i++; return out; }
|
|
411
|
+
err = "expected , or ] in array";
|
|
412
|
+
return nullptr;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
if ('{' == c) {
|
|
416
|
+
i++;
|
|
417
|
+
V out = vmap();
|
|
418
|
+
skip();
|
|
419
|
+
if (i < text.size() && '}' == text[i]) { i++; return out; }
|
|
420
|
+
for (;;) {
|
|
421
|
+
skip();
|
|
422
|
+
std::string key;
|
|
423
|
+
if (!string(key)) return nullptr;
|
|
424
|
+
skip();
|
|
425
|
+
if (i >= text.size() || ':' != text[i]) {
|
|
426
|
+
err = "expected : in object";
|
|
427
|
+
return nullptr;
|
|
428
|
+
}
|
|
429
|
+
i++;
|
|
430
|
+
V val = value();
|
|
431
|
+
if (!val) return nullptr;
|
|
432
|
+
set(out, key, val);
|
|
433
|
+
skip();
|
|
434
|
+
if (i < text.size() && ',' == text[i]) { i++; continue; }
|
|
435
|
+
if (i < text.size() && '}' == text[i]) { i++; return out; }
|
|
436
|
+
err = "expected , or } in object";
|
|
437
|
+
return nullptr;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/* JSON's number grammar is STRICT, and §9.5 makes that observable:
|
|
442
|
+
env values "parse as JSON, falling back to string", so anything
|
|
443
|
+
this reader accepts loosely silently becomes a number where the
|
|
444
|
+
canonical keeps the authored string. `1e`, `1.`, `01`, `.5` and a
|
|
445
|
+
bare `-` are all errors to JSON.parse; only `-0` and `1e5` are
|
|
446
|
+
not.
|
|
447
|
+
|
|
448
|
+
number = [ '-' ] int [ frac ] [ exp ]
|
|
449
|
+
int = '0' | digit1-9 *digit
|
|
450
|
+
frac = '.' 1*digit
|
|
451
|
+
exp = ('e'|'E') [ '+' | '-' ] 1*digit
|
|
452
|
+
*/
|
|
453
|
+
auto digit = [this]() {
|
|
454
|
+
return i < text.size() && '0' <= text[i] && '9' >= text[i];
|
|
455
|
+
};
|
|
456
|
+
size_t start = i;
|
|
457
|
+
if (i < text.size() && '-' == text[i]) i++;
|
|
458
|
+
if (!digit()) { err = "bad number"; return nullptr; }
|
|
459
|
+
if ('0' == text[i]) i++;
|
|
460
|
+
else while (digit()) i++;
|
|
461
|
+
if (i < text.size() && '.' == text[i]) {
|
|
462
|
+
i++;
|
|
463
|
+
if (!digit()) { err = "bad number"; return nullptr; }
|
|
464
|
+
while (digit()) i++;
|
|
465
|
+
}
|
|
466
|
+
if (i < text.size() && ('e' == text[i] || 'E' == text[i])) {
|
|
467
|
+
i++;
|
|
468
|
+
if (i < text.size() && ('+' == text[i] || '-' == text[i])) i++;
|
|
469
|
+
if (!digit()) { err = "bad number"; return nullptr; }
|
|
470
|
+
while (digit()) i++;
|
|
471
|
+
}
|
|
472
|
+
std::string piece = text.substr(start, i - start);
|
|
473
|
+
char* end = nullptr;
|
|
474
|
+
double n = std::strtod(piece.c_str(), &end);
|
|
475
|
+
if (nullptr == end || '\0' != *end) { err = "bad number"; return nullptr; }
|
|
476
|
+
return vnum(n);
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
} // namespace
|
|
481
|
+
|
|
482
|
+
V parsejson(const std::string& text, std::string& err) {
|
|
483
|
+
Parser p(text);
|
|
484
|
+
V out = p.value();
|
|
485
|
+
if (!out) { err = p.err; return nullptr; }
|
|
486
|
+
p.skip();
|
|
487
|
+
if (p.i != text.size()) { err = "trailing content"; return nullptr; }
|
|
488
|
+
return out;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
} // namespace plugin
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// VENDORED: @voxgig/plugin sdk-20260908-1556-0 (cpp/src/value.hpp)
|
|
2
|
+
// Source: https://github.com/voxgig/plugin @ 48392f5e2b6d1434ee9b1a4a9a11f4480aaeb46a [tag: sdk-20260908-1556-0]
|
|
3
|
+
// License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
|
|
4
|
+
/* The dynamic value, and the JSON reader that fills it (§16).
|
|
5
|
+
*
|
|
6
|
+
* NO DEPENDENCIES, not even a JSON library: §16 permits exactly one
|
|
7
|
+
* runtime dependency (voxgig/struct) and C++ has no port of it, so the
|
|
8
|
+
* corpus JSON is parsed here. A package graph is also a supply chain.
|
|
9
|
+
*
|
|
10
|
+
* SHARED_PTR, NOT AN ARENA — and that is the whole difference from the
|
|
11
|
+
* `c` port sitting next door. C++ has destructors and shared ownership,
|
|
12
|
+
* so a value's lifetime is the language's problem rather than the
|
|
13
|
+
* library's, and the arena that makes `longjmp` safe in c is not needed
|
|
14
|
+
* where `throw` unwinds properly.
|
|
15
|
+
*
|
|
16
|
+
* NULLPTR MEANS "NOTHING", A NULL VALUE MEANS "JSON null". They are
|
|
17
|
+
* different answers and several places need both: `bail` declining is
|
|
18
|
+
* not `bail` answering null, and a missing export is not an export of
|
|
19
|
+
* null. Every accessor here tolerates a nullptr, which is why they are
|
|
20
|
+
* free functions rather than members.
|
|
21
|
+
*
|
|
22
|
+
* A MAP PRESERVES INSERTION ORDER AND SORTS ON DEMAND. §4 rule 4 makes
|
|
23
|
+
* order observable in several places (`keys` is sorted, `pos` is the
|
|
24
|
+
* sorted-ref index), so both orders have to be available and the code
|
|
25
|
+
* has to say which it means at each use. */
|
|
26
|
+
|
|
27
|
+
#ifndef VOXGIG_PLUGIN_VALUE_HPP
|
|
28
|
+
#define VOXGIG_PLUGIN_VALUE_HPP
|
|
29
|
+
|
|
30
|
+
#include <memory>
|
|
31
|
+
#include <string>
|
|
32
|
+
#include <utility>
|
|
33
|
+
#include <vector>
|
|
34
|
+
|
|
35
|
+
namespace plugin {
|
|
36
|
+
|
|
37
|
+
enum class Kind { Null, Bool, Num, Str, List, Map };
|
|
38
|
+
|
|
39
|
+
class Value;
|
|
40
|
+
using V = std::shared_ptr<Value>;
|
|
41
|
+
|
|
42
|
+
class Value {
|
|
43
|
+
public:
|
|
44
|
+
Kind kind = Kind::Null;
|
|
45
|
+
bool boolean = false;
|
|
46
|
+
double num = 0;
|
|
47
|
+
std::string str;
|
|
48
|
+
std::vector<V> items;
|
|
49
|
+
/* A vector of pairs rather than a std::map: insertion order must
|
|
50
|
+
* survive, the maps here hold a handful of keys, and an ordered
|
|
51
|
+
* container keyed by string would sort them behind our back. */
|
|
52
|
+
std::vector<std::pair<std::string, V>> entries;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/* --- construction --------------------------------------------------- */
|
|
56
|
+
|
|
57
|
+
V vnull();
|
|
58
|
+
V vbool(bool b);
|
|
59
|
+
V vnum(double n);
|
|
60
|
+
V vstr(const std::string& s);
|
|
61
|
+
V vlist();
|
|
62
|
+
V vmap();
|
|
63
|
+
|
|
64
|
+
/* --- kinds ---------------------------------------------------------- */
|
|
65
|
+
|
|
66
|
+
bool isnull(const V& v);
|
|
67
|
+
bool isbool(const V& v);
|
|
68
|
+
bool isnum(const V& v);
|
|
69
|
+
bool isstr(const V& v);
|
|
70
|
+
bool islist(const V& v);
|
|
71
|
+
bool ismap(const V& v);
|
|
72
|
+
|
|
73
|
+
/* --- access --------------------------------------------------------- */
|
|
74
|
+
|
|
75
|
+
/* `get` answers a null Value for a missing key AND for a key holding
|
|
76
|
+
* JSON null; `has` distinguishes them, which is what §9.1's "an
|
|
77
|
+
* authored null is not an absent key" needs. */
|
|
78
|
+
V get(const V& m, const std::string& key);
|
|
79
|
+
bool has(const V& m, const std::string& key);
|
|
80
|
+
void set(const V& m, const std::string& key, const V& val);
|
|
81
|
+
void del(const V& m, const std::string& key);
|
|
82
|
+
|
|
83
|
+
V at(const V& l, size_t i);
|
|
84
|
+
void push(const V& l, const V& item);
|
|
85
|
+
size_t len(const V& v);
|
|
86
|
+
|
|
87
|
+
std::string asstr(const V& v);
|
|
88
|
+
double asnum(const V& v);
|
|
89
|
+
bool asbool(const V& v);
|
|
90
|
+
|
|
91
|
+
/* Keys in INSERTION order. */
|
|
92
|
+
std::vector<std::string> keys(const V& m);
|
|
93
|
+
/* Keys SORTED by byte order — §4 rule 4's deterministic walk. */
|
|
94
|
+
std::vector<std::string> sortedkeys(const V& m);
|
|
95
|
+
|
|
96
|
+
/* §4 rule 4: truthiness is JSON's, not C++'s. */
|
|
97
|
+
bool truthy(const V& v);
|
|
98
|
+
|
|
99
|
+
/* Deep equality INCLUDING JSON type, which is the half that matters:
|
|
100
|
+
* half the ports are written in languages whose `==` says `true == 1`,
|
|
101
|
+
* and `capability/match` exists to catch exactly that. */
|
|
102
|
+
bool same(const V& a, const V& b);
|
|
103
|
+
|
|
104
|
+
V clone(const V& v);
|
|
105
|
+
|
|
106
|
+
/* --- json ----------------------------------------------------------- */
|
|
107
|
+
|
|
108
|
+
/* Parse, or nullptr with `err` set to a message. */
|
|
109
|
+
V parsejson(const std::string& text, std::string& err);
|
|
110
|
+
/* Canonical JSON, keys in SORTED order so two values that are `same`
|
|
111
|
+
* render identically — the corpus compares rendered forms in places. */
|
|
112
|
+
std::string json(const V& v);
|
|
113
|
+
|
|
114
|
+
/* Numbers render as integers when they are integral, which is what the
|
|
115
|
+
* corpus's expected values look like. */
|
|
116
|
+
std::string numstr(double n);
|
|
117
|
+
|
|
118
|
+
} // namespace plugin
|
|
119
|
+
|
|
120
|
+
#endif
|