@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.
Files changed (304) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/package.json +1 -1
  3. package/project/.sdk/model/feature/secrets.aon +330 -0
  4. package/project/.sdk/model/target/c.aon +15 -2
  5. package/project/.sdk/model/target/cpp.aon +18 -0
  6. package/project/.sdk/model/target/lua.aon +17 -0
  7. package/project/.sdk/model/target/ocaml.aon +48 -5
  8. package/project/.sdk/model/target/zig.aon +30 -4
  9. package/project/.sdk/src/cmp/c/Config_c.ts +338 -1
  10. package/project/.sdk/src/cmp/c/Main_c.ts +57 -2
  11. package/project/.sdk/src/cmp/c/Package_c.ts +12 -2
  12. package/project/.sdk/src/cmp/cpp/Config_cpp.ts +324 -2
  13. package/project/.sdk/src/cmp/cpp/Gitignore_cpp.ts +2 -0
  14. package/project/.sdk/src/cmp/cpp/Main_cpp.ts +62 -4
  15. package/project/.sdk/src/cmp/cpp/Package_cpp.ts +10 -0
  16. package/project/.sdk/src/cmp/lua/Config_lua.ts +88 -0
  17. package/project/.sdk/src/cmp/lua/Gitignore_lua.ts +4 -0
  18. package/project/.sdk/src/cmp/lua/Main_lua.ts +93 -3
  19. package/project/.sdk/src/cmp/lua/Package_lua.ts +60 -0
  20. package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +10 -0
  21. package/project/.sdk/src/cmp/ocaml/Config_ocaml.ts +183 -5
  22. package/project/.sdk/src/cmp/ocaml/Main_ocaml.ts +160 -3
  23. package/project/.sdk/src/cmp/ocaml/Package_ocaml.ts +25 -1
  24. package/project/.sdk/src/cmp/zig/Config_zig.ts +130 -9
  25. package/project/.sdk/src/cmp/zig/Main_zig.ts +208 -4
  26. package/project/.sdk/{tm/zig/build.zig → src/cmp/zig/fragment/Build.fragment.zig} +7 -0
  27. package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +25 -0
  28. package/project/.sdk/{tm/zig/root.zig → src/cmp/zig/fragment/Root.fragment.zig} +9 -0
  29. package/project/.sdk/tm/c/Makefile +58 -9
  30. package/project/.sdk/tm/c/core/sdk.h +10 -0
  31. package/project/.sdk/tm/c/feature/secrets/plugin/capability.c +133 -0
  32. package/project/.sdk/tm/c/feature/secrets/plugin/capability.h +39 -0
  33. package/project/.sdk/tm/c/feature/secrets/plugin/catalog.c +83 -0
  34. package/project/.sdk/tm/c/feature/secrets/plugin/catalog.h +48 -0
  35. package/project/.sdk/tm/c/feature/secrets/plugin/config.c +413 -0
  36. package/project/.sdk/tm/c/feature/secrets/plugin/config.h +24 -0
  37. package/project/.sdk/tm/c/feature/secrets/plugin/depend.c +264 -0
  38. package/project/.sdk/tm/c/feature/secrets/plugin/depend.h +29 -0
  39. package/project/.sdk/tm/c/feature/secrets/plugin/env.c +220 -0
  40. package/project/.sdk/tm/c/feature/secrets/plugin/env.h +19 -0
  41. package/project/.sdk/tm/c/feature/secrets/plugin/export.c +97 -0
  42. package/project/.sdk/tm/c/feature/secrets/plugin/export.h +19 -0
  43. package/project/.sdk/tm/c/feature/secrets/plugin/graph.c +237 -0
  44. package/project/.sdk/tm/c/feature/secrets/plugin/graph.h +17 -0
  45. package/project/.sdk/tm/c/feature/secrets/plugin/host.c +1494 -0
  46. package/project/.sdk/tm/c/feature/secrets/plugin/host.h +135 -0
  47. package/project/.sdk/tm/c/feature/secrets/plugin/order.c +288 -0
  48. package/project/.sdk/tm/c/feature/secrets/plugin/order.h +18 -0
  49. package/project/.sdk/tm/c/feature/secrets/plugin/point.c +141 -0
  50. package/project/.sdk/tm/c/feature/secrets/plugin/point.h +80 -0
  51. package/project/.sdk/tm/c/feature/secrets/plugin/ref.c +170 -0
  52. package/project/.sdk/tm/c/feature/secrets/plugin/ref.h +52 -0
  53. package/project/.sdk/tm/c/feature/secrets/plugin/resolve.c +98 -0
  54. package/project/.sdk/tm/c/feature/secrets/plugin/resolve.h +18 -0
  55. package/project/.sdk/tm/c/feature/secrets/plugin/types.c +150 -0
  56. package/project/.sdk/tm/c/feature/secrets/plugin/types.h +104 -0
  57. package/project/.sdk/tm/c/feature/secrets/plugin/value.c +649 -0
  58. package/project/.sdk/tm/c/feature/secrets/plugin/value.h +135 -0
  59. package/project/.sdk/tm/c/feature/secrets/plugin/version.c +151 -0
  60. package/project/.sdk/tm/c/feature/secrets/plugin/version.h +34 -0
  61. package/project/.sdk/tm/c/feature/secrets/plugins/aws.c +281 -0
  62. package/project/.sdk/tm/c/feature/secrets/plugins/azuresecrets.c +207 -0
  63. package/project/.sdk/tm/c/feature/secrets/plugins/boru.c +164 -0
  64. package/project/.sdk/tm/c/feature/secrets/plugins/clock.c +75 -0
  65. package/project/.sdk/tm/c/feature/secrets/plugins/doppler.c +141 -0
  66. package/project/.sdk/tm/c/feature/secrets/plugins/encode.c +144 -0
  67. package/project/.sdk/tm/c/feature/secrets/plugins/gcpsecrets.c +177 -0
  68. package/project/.sdk/tm/c/feature/secrets/plugins/hashicorp.c +239 -0
  69. package/project/.sdk/tm/c/feature/secrets/plugins/httpjson.c +599 -0
  70. package/project/.sdk/tm/c/feature/secrets/plugins/infisical.c +165 -0
  71. package/project/.sdk/tm/c/feature/secrets/plugins/onepassword.c +194 -0
  72. package/project/.sdk/tm/c/feature/secrets/plugins/proc.c +233 -0
  73. package/project/.sdk/tm/c/feature/secrets/plugins/secretspec.c +125 -0
  74. package/project/.sdk/tm/c/feature/secrets/plugins/sekretoplugins.h +125 -0
  75. package/project/.sdk/tm/c/feature/secrets/plugins/sha256.c +270 -0
  76. package/project/.sdk/tm/c/feature/secrets/plugins/sigv4.c +382 -0
  77. package/project/.sdk/tm/c/feature/secrets/plugins/support.h +153 -0
  78. package/project/.sdk/tm/c/feature/secrets/plugins/tls.c +420 -0
  79. package/project/.sdk/tm/c/feature/secrets/sekreto/internal.h +86 -0
  80. package/project/.sdk/tm/c/feature/secrets/sekreto/json.c +721 -0
  81. package/project/.sdk/tm/c/feature/secrets/sekreto/providers.c +813 -0
  82. package/project/.sdk/tm/c/feature/secrets/sekreto/sekreto.c +944 -0
  83. package/project/.sdk/tm/c/feature/secrets/sekreto/sekreto.h +490 -0
  84. package/project/.sdk/tm/c/feature/secrets/sekreto/util.c +442 -0
  85. package/project/.sdk/tm/c/feature/secrets.c +797 -0
  86. package/project/.sdk/tm/c/feature/secrets.h +46 -0
  87. package/project/.sdk/tm/c/src/feature/secrets/.gitkeep +0 -0
  88. package/project/.sdk/tm/c/tests/feature/secrets/secrets_test.c +802 -0
  89. package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +38 -11
  90. package/project/.sdk/tm/clojure/test/sdk/test/feature/secrets.clj +40 -6
  91. package/project/.sdk/tm/cpp/Makefile +48 -4
  92. package/project/.sdk/tm/cpp/feature/secrets/plugin/capability.cpp +121 -0
  93. package/project/.sdk/tm/cpp/feature/secrets/plugin/capability.hpp +41 -0
  94. package/project/.sdk/tm/cpp/feature/secrets/plugin/catalog.cpp +60 -0
  95. package/project/.sdk/tm/cpp/feature/secrets/plugin/catalog.hpp +66 -0
  96. package/project/.sdk/tm/cpp/feature/secrets/plugin/config.cpp +376 -0
  97. package/project/.sdk/tm/cpp/feature/secrets/plugin/config.hpp +29 -0
  98. package/project/.sdk/tm/cpp/feature/secrets/plugin/depend.cpp +230 -0
  99. package/project/.sdk/tm/cpp/feature/secrets/plugin/depend.hpp +31 -0
  100. package/project/.sdk/tm/cpp/feature/secrets/plugin/env.cpp +205 -0
  101. package/project/.sdk/tm/cpp/feature/secrets/plugin/env.hpp +25 -0
  102. package/project/.sdk/tm/cpp/feature/secrets/plugin/export.cpp +84 -0
  103. package/project/.sdk/tm/cpp/feature/secrets/plugin/export.hpp +24 -0
  104. package/project/.sdk/tm/cpp/feature/secrets/plugin/graph.cpp +222 -0
  105. package/project/.sdk/tm/cpp/feature/secrets/plugin/graph.hpp +21 -0
  106. package/project/.sdk/tm/cpp/feature/secrets/plugin/host.cpp +1200 -0
  107. package/project/.sdk/tm/cpp/feature/secrets/plugin/host.hpp +250 -0
  108. package/project/.sdk/tm/cpp/feature/secrets/plugin/order.cpp +250 -0
  109. package/project/.sdk/tm/cpp/feature/secrets/plugin/order.hpp +22 -0
  110. package/project/.sdk/tm/cpp/feature/secrets/plugin/point.cpp +110 -0
  111. package/project/.sdk/tm/cpp/feature/secrets/plugin/point.hpp +79 -0
  112. package/project/.sdk/tm/cpp/feature/secrets/plugin/ref.cpp +136 -0
  113. package/project/.sdk/tm/cpp/feature/secrets/plugin/ref.hpp +60 -0
  114. package/project/.sdk/tm/cpp/feature/secrets/plugin/resolve.cpp +82 -0
  115. package/project/.sdk/tm/cpp/feature/secrets/plugin/resolve.hpp +25 -0
  116. package/project/.sdk/tm/cpp/feature/secrets/plugin/types.cpp +90 -0
  117. package/project/.sdk/tm/cpp/feature/secrets/plugin/types.hpp +65 -0
  118. package/project/.sdk/tm/cpp/feature/secrets/plugin/value.cpp +491 -0
  119. package/project/.sdk/tm/cpp/feature/secrets/plugin/value.hpp +120 -0
  120. package/project/.sdk/tm/cpp/feature/secrets/plugin/version.cpp +143 -0
  121. package/project/.sdk/tm/cpp/feature/secrets/plugin/version.hpp +36 -0
  122. package/project/.sdk/tm/cpp/feature/secrets/plugins/Aws.cpp +248 -0
  123. package/project/.sdk/tm/cpp/feature/secrets/plugins/Aws.hpp +30 -0
  124. package/project/.sdk/tm/cpp/feature/secrets/plugins/Azuresecrets.cpp +149 -0
  125. package/project/.sdk/tm/cpp/feature/secrets/plugins/Azuresecrets.hpp +23 -0
  126. package/project/.sdk/tm/cpp/feature/secrets/plugins/Boru.cpp +117 -0
  127. package/project/.sdk/tm/cpp/feature/secrets/plugins/Boru.hpp +27 -0
  128. package/project/.sdk/tm/cpp/feature/secrets/plugins/Crypto.cpp +180 -0
  129. package/project/.sdk/tm/cpp/feature/secrets/plugins/Crypto.hpp +52 -0
  130. package/project/.sdk/tm/cpp/feature/secrets/plugins/Doppler.cpp +87 -0
  131. package/project/.sdk/tm/cpp/feature/secrets/plugins/Doppler.hpp +23 -0
  132. package/project/.sdk/tm/cpp/feature/secrets/plugins/Gcpsecrets.cpp +121 -0
  133. package/project/.sdk/tm/cpp/feature/secrets/plugins/Gcpsecrets.hpp +23 -0
  134. package/project/.sdk/tm/cpp/feature/secrets/plugins/Hashicorp.cpp +153 -0
  135. package/project/.sdk/tm/cpp/feature/secrets/plugins/Hashicorp.hpp +23 -0
  136. package/project/.sdk/tm/cpp/feature/secrets/plugins/Httpjson.cpp +666 -0
  137. package/project/.sdk/tm/cpp/feature/secrets/plugins/Httpjson.hpp +160 -0
  138. package/project/.sdk/tm/cpp/feature/secrets/plugins/Infisical.cpp +123 -0
  139. package/project/.sdk/tm/cpp/feature/secrets/plugins/Infisical.hpp +23 -0
  140. package/project/.sdk/tm/cpp/feature/secrets/plugins/Onepassword.cpp +125 -0
  141. package/project/.sdk/tm/cpp/feature/secrets/plugins/Onepassword.hpp +23 -0
  142. package/project/.sdk/tm/cpp/feature/secrets/plugins/Proc.cpp +223 -0
  143. package/project/.sdk/tm/cpp/feature/secrets/plugins/Proc.hpp +47 -0
  144. package/project/.sdk/tm/cpp/feature/secrets/plugins/Secretspec.cpp +104 -0
  145. package/project/.sdk/tm/cpp/feature/secrets/plugins/Secretspec.hpp +27 -0
  146. package/project/.sdk/tm/cpp/feature/secrets/plugins/Sigv4.cpp +242 -0
  147. package/project/.sdk/tm/cpp/feature/secrets/plugins/Sigv4.hpp +58 -0
  148. package/project/.sdk/tm/cpp/feature/secrets/plugins/Tls.cpp +260 -0
  149. package/project/.sdk/tm/cpp/feature/secrets/plugins/Tls.hpp +47 -0
  150. package/project/.sdk/tm/cpp/feature/secrets/sekreto/Json.cpp +476 -0
  151. package/project/.sdk/tm/cpp/feature/secrets/sekreto/Json.hpp +89 -0
  152. package/project/.sdk/tm/cpp/feature/secrets/sekreto/Provider.cpp +312 -0
  153. package/project/.sdk/tm/cpp/feature/secrets/sekreto/Provider.hpp +263 -0
  154. package/project/.sdk/tm/cpp/feature/secrets/sekreto/Providers.cpp +354 -0
  155. package/project/.sdk/tm/cpp/feature/secrets/sekreto/Providers.hpp +111 -0
  156. package/project/.sdk/tm/cpp/feature/secrets/sekreto/Sekreto.cpp +613 -0
  157. package/project/.sdk/tm/cpp/feature/secrets/sekreto/Sekreto.hpp +227 -0
  158. package/project/.sdk/tm/cpp/feature/secrets.hpp +745 -0
  159. package/project/.sdk/tm/cpp/src/feature/secrets/.gitkeep +0 -0
  160. package/project/.sdk/tm/cpp/test/feature/secrets/secrets_test.cpp +808 -0
  161. package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +34 -8
  162. package/project/.sdk/tm/csharp/test/feature/secrets/SecretsFeatureTest.cs +85 -0
  163. package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +17 -2
  164. package/project/.sdk/tm/elixir/test/feature/secrets/secrets_test.exs +41 -0
  165. package/project/.sdk/tm/go/feature/secrets_feature.go +32 -10
  166. package/project/.sdk/tm/go/test/feature/secrets/secrets_feature_test.go +116 -0
  167. package/project/.sdk/tm/java/feature/SecretsFeature.java +33 -8
  168. package/project/.sdk/tm/java/test/feature/secrets/SecretsFeatureTest.java +64 -0
  169. package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +34 -11
  170. package/project/.sdk/tm/js/test/feature/secrets/Secrets.test.js +73 -0
  171. package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +32 -7
  172. package/project/.sdk/tm/kotlin/test/feature/secrets/SecretsTest.kt +69 -0
  173. package/project/.sdk/tm/lua/Makefile +15 -4
  174. package/project/.sdk/tm/lua/feature/secrets/native/sekretonet.c +806 -0
  175. package/project/.sdk/tm/lua/feature/secrets/plugin/capability.lua +135 -0
  176. package/project/.sdk/tm/lua/feature/secrets/plugin/catalog.lua +63 -0
  177. package/project/.sdk/tm/lua/feature/secrets/plugin/config.lua +361 -0
  178. package/project/.sdk/tm/lua/feature/secrets/plugin/depend.lua +232 -0
  179. package/project/.sdk/tm/lua/feature/secrets/plugin/env.lua +168 -0
  180. package/project/.sdk/tm/lua/feature/secrets/plugin/export.lua +66 -0
  181. package/project/.sdk/tm/lua/feature/secrets/plugin/graph.lua +194 -0
  182. package/project/.sdk/tm/lua/feature/secrets/plugin/host.lua +1190 -0
  183. package/project/.sdk/tm/lua/feature/secrets/plugin/json.lua +169 -0
  184. package/project/.sdk/tm/lua/feature/secrets/plugin/order.lua +207 -0
  185. package/project/.sdk/tm/lua/feature/secrets/plugin/point.lua +106 -0
  186. package/project/.sdk/tm/lua/feature/secrets/plugin/ref.lua +115 -0
  187. package/project/.sdk/tm/lua/feature/secrets/plugin/resolve.lua +78 -0
  188. package/project/.sdk/tm/lua/feature/secrets/plugin/types.lua +275 -0
  189. package/project/.sdk/tm/lua/feature/secrets/plugin/version.lua +131 -0
  190. package/project/.sdk/tm/lua/feature/secrets/plugin.lua +76 -0
  191. package/project/.sdk/tm/lua/feature/secrets/sekreto/addr.lua +124 -0
  192. package/project/.sdk/tm/lua/feature/secrets/sekreto/err.lua +47 -0
  193. package/project/.sdk/tm/lua/feature/secrets/sekreto/name.lua +315 -0
  194. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/aws.lua +228 -0
  195. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/azuresecrets.lua +137 -0
  196. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/boru.lua +124 -0
  197. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/crypto.lua +212 -0
  198. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/doppler.lua +89 -0
  199. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/gcpsecrets.lua +129 -0
  200. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/hashicorp.lua +154 -0
  201. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/httpjson.lua +248 -0
  202. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/infisical.lua +113 -0
  203. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/json.lua +449 -0
  204. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/net.lua +198 -0
  205. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/onepassword.lua +126 -0
  206. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/secretspec.lua +93 -0
  207. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/sigv4.lua +269 -0
  208. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/support.lua +146 -0
  209. package/project/.sdk/tm/lua/feature/secrets/sekreto/providers.lua +346 -0
  210. package/project/.sdk/tm/lua/feature/secrets/sekreto.lua +479 -0
  211. package/project/.sdk/tm/lua/feature/secrets_feature.lua +690 -0
  212. package/project/.sdk/tm/lua/src/feature/secrets/.gitkeep +0 -0
  213. package/project/.sdk/tm/lua/test/extend_test.lua +105 -0
  214. package/project/.sdk/tm/lua/test/feature/secrets/secrets_feature_test.lua +862 -0
  215. package/project/.sdk/tm/ocaml/Makefile +52 -8
  216. package/project/.sdk/tm/ocaml/feature/secrets/plugin/capability.ml +106 -0
  217. package/project/.sdk/tm/ocaml/feature/secrets/plugin/catalog.ml +43 -0
  218. package/project/.sdk/tm/ocaml/feature/secrets/plugin/config.ml +349 -0
  219. package/project/.sdk/tm/ocaml/feature/secrets/plugin/defs.ml +143 -0
  220. package/project/.sdk/tm/ocaml/feature/secrets/plugin/depend.ml +217 -0
  221. package/project/.sdk/tm/ocaml/feature/secrets/plugin/env.ml +197 -0
  222. package/project/.sdk/tm/ocaml/feature/secrets/plugin/export.ml +89 -0
  223. package/project/.sdk/tm/ocaml/feature/secrets/plugin/graph.ml +227 -0
  224. package/project/.sdk/tm/ocaml/feature/secrets/plugin/host.ml +1112 -0
  225. package/project/.sdk/tm/ocaml/feature/secrets/plugin/order.ml +202 -0
  226. package/project/.sdk/tm/ocaml/feature/secrets/plugin/point.ml +138 -0
  227. package/project/.sdk/tm/ocaml/feature/secrets/plugin/ref.ml +126 -0
  228. package/project/.sdk/tm/ocaml/feature/secrets/plugin/resolve.ml +62 -0
  229. package/project/.sdk/tm/ocaml/feature/secrets/plugin/types.ml +97 -0
  230. package/project/.sdk/tm/ocaml/feature/secrets/plugin/value.ml +387 -0
  231. package/project/.sdk/tm/ocaml/feature/secrets/plugin/version.ml +139 -0
  232. package/project/.sdk/tm/ocaml/feature/secrets/plugins/aws.ml +171 -0
  233. package/project/.sdk/tm/ocaml/feature/secrets/plugins/azuresecrets.ml +116 -0
  234. package/project/.sdk/tm/ocaml/feature/secrets/plugins/boru.ml +95 -0
  235. package/project/.sdk/tm/ocaml/feature/secrets/plugins/crypto.ml +149 -0
  236. package/project/.sdk/tm/ocaml/feature/secrets/plugins/doppler.ml +61 -0
  237. package/project/.sdk/tm/ocaml/feature/secrets/plugins/gcpsecrets.ml +93 -0
  238. package/project/.sdk/tm/ocaml/feature/secrets/plugins/hashicorp.ml +120 -0
  239. package/project/.sdk/tm/ocaml/feature/secrets/plugins/http.ml +421 -0
  240. package/project/.sdk/tm/ocaml/feature/secrets/plugins/httpjson.ml +66 -0
  241. package/project/.sdk/tm/ocaml/feature/secrets/plugins/infisical.ml +85 -0
  242. package/project/.sdk/tm/ocaml/feature/secrets/plugins/onepassword.ml +112 -0
  243. package/project/.sdk/tm/ocaml/feature/secrets/plugins/runcmd.ml +97 -0
  244. package/project/.sdk/tm/ocaml/feature/secrets/plugins/secretspec.ml +68 -0
  245. package/project/.sdk/tm/ocaml/feature/secrets/plugins/sigv4.ml +259 -0
  246. package/project/.sdk/tm/ocaml/feature/secrets/plugins/tls.ml +44 -0
  247. package/project/.sdk/tm/ocaml/feature/secrets/plugins/tls_stubs.c +358 -0
  248. package/project/.sdk/tm/ocaml/feature/secrets/sekreto/json.ml +376 -0
  249. package/project/.sdk/tm/ocaml/feature/secrets/sekreto/provider.ml +647 -0
  250. package/project/.sdk/tm/ocaml/feature/secrets/sekreto/secret.ml +299 -0
  251. package/project/.sdk/tm/ocaml/feature/secrets/sekreto/sekreto.ml +347 -0
  252. package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +453 -0
  253. package/project/.sdk/tm/ocaml/src/feature/secrets/.gitkeep +0 -0
  254. package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +670 -0
  255. package/project/.sdk/tm/perl/feature/secrets_feature.pm +33 -12
  256. package/project/.sdk/tm/perl/t/feature/secrets/secrets.t +47 -0
  257. package/project/.sdk/tm/php/feature/SecretsFeature.php +30 -6
  258. package/project/.sdk/tm/php/test/feature/secrets/SecretsTest.php +98 -0
  259. package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +28 -6
  260. package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +114 -0
  261. package/project/.sdk/tm/rb/feature/secrets_feature.rb +28 -6
  262. package/project/.sdk/tm/rb/test/feature/secrets/secrets_feature_test.rb +93 -0
  263. package/project/.sdk/tm/rust/feature/secrets.rs +33 -10
  264. package/project/.sdk/tm/rust/tests/feature/secrets/main.rs +96 -0
  265. package/project/.sdk/tm/scala/feature/SecretsFeature.scala +29 -7
  266. package/project/.sdk/tm/scala/sdktest/feature/secrets/SecretsTestMain.scala +71 -0
  267. package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +35 -12
  268. package/project/.sdk/tm/ts/test/feature/secrets/Secrets.test.ts +73 -0
  269. package/project/.sdk/tm/zig/feature/secrets/plugin/capability.zig +137 -0
  270. package/project/.sdk/tm/zig/feature/secrets/plugin/catalog.zig +90 -0
  271. package/project/.sdk/tm/zig/feature/secrets/plugin/config.zig +346 -0
  272. package/project/.sdk/tm/zig/feature/secrets/plugin/depend.zig +244 -0
  273. package/project/.sdk/tm/zig/feature/secrets/plugin/env.zig +201 -0
  274. package/project/.sdk/tm/zig/feature/secrets/plugin/export.zig +83 -0
  275. package/project/.sdk/tm/zig/feature/secrets/plugin/graph.zig +212 -0
  276. package/project/.sdk/tm/zig/feature/secrets/plugin/host.zig +1224 -0
  277. package/project/.sdk/tm/zig/feature/secrets/plugin/inst.zig +126 -0
  278. package/project/.sdk/tm/zig/feature/secrets/plugin/order.zig +228 -0
  279. package/project/.sdk/tm/zig/feature/secrets/plugin/plugin.zig +34 -0
  280. package/project/.sdk/tm/zig/feature/secrets/plugin/point.zig +166 -0
  281. package/project/.sdk/tm/zig/feature/secrets/plugin/ref.zig +147 -0
  282. package/project/.sdk/tm/zig/feature/secrets/plugin/resolve.zig +74 -0
  283. package/project/.sdk/tm/zig/feature/secrets/plugin/types.zig +140 -0
  284. package/project/.sdk/tm/zig/feature/secrets/plugin/value.zig +662 -0
  285. package/project/.sdk/tm/zig/feature/secrets/plugin/version.zig +139 -0
  286. package/project/.sdk/tm/zig/feature/secrets/plugins/aws.zig +294 -0
  287. package/project/.sdk/tm/zig/feature/secrets/plugins/azuresecrets.zig +222 -0
  288. package/project/.sdk/tm/zig/feature/secrets/plugins/boru.zig +188 -0
  289. package/project/.sdk/tm/zig/feature/secrets/plugins/doppler.zig +135 -0
  290. package/project/.sdk/tm/zig/feature/secrets/plugins/gcpsecrets.zig +170 -0
  291. package/project/.sdk/tm/zig/feature/secrets/plugins/hashicorp.zig +242 -0
  292. package/project/.sdk/tm/zig/feature/secrets/plugins/httpjson.zig +535 -0
  293. package/project/.sdk/tm/zig/feature/secrets/plugins/infisical.zig +167 -0
  294. package/project/.sdk/tm/zig/feature/secrets/plugins/onepassword.zig +202 -0
  295. package/project/.sdk/tm/zig/feature/secrets/plugins/secretspec.zig +160 -0
  296. package/project/.sdk/tm/zig/feature/secrets/plugins/sigv4.zig +336 -0
  297. package/project/.sdk/tm/zig/feature/secrets/sekreto/addr.zig +148 -0
  298. package/project/.sdk/tm/zig/feature/secrets/sekreto/builtins.zig +259 -0
  299. package/project/.sdk/tm/zig/feature/secrets/sekreto/provider.zig +440 -0
  300. package/project/.sdk/tm/zig/feature/secrets/sekreto/sekreto.zig +944 -0
  301. package/project/.sdk/tm/zig/feature/secrets.zig +854 -0
  302. package/project/.sdk/tm/zig/src/feature/secrets/.gitkeep +0 -0
  303. package/project/.sdk/tm/zig/test/feature/secrets/secrets_test.zig +891 -0
  304. package/project/sdkgen-package.json +1 -1
@@ -0,0 +1,649 @@
1
+ // VENDORED: @voxgig/plugin sdk-20260908-1556-0 (c/src/value.c)
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.h for why the arena
5
+ * is the design rather than a shortcut. */
6
+
7
+ #include <stdio.h>
8
+ #include <stdlib.h>
9
+ #include <string.h>
10
+ #include <math.h>
11
+
12
+ #include "value.h"
13
+
14
+ /* --- arena ---------------------------------------------------------- */
15
+
16
+ /* A chain of blocks. Big allocations get their own block rather than
17
+ * rounding the block size up, so one long string cannot waste a block. */
18
+ typedef struct Block {
19
+ struct Block *next;
20
+ size_t used;
21
+ size_t size;
22
+ char *data;
23
+ } Block;
24
+
25
+ #define BLOCK_MIN (64 * 1024)
26
+
27
+ static Block *arena_head = NULL;
28
+
29
+ static void arena_die(void) {
30
+ fprintf(stderr, "plugin: out of memory\n");
31
+ exit(70);
32
+ }
33
+
34
+ void *arena_alloc(size_t size) {
35
+ /* Align to 16, so a Value or a double placed here is aligned. */
36
+ size = (size + 15u) & ~((size_t)15u);
37
+
38
+ if (NULL == arena_head || arena_head->used + size > arena_head->size) {
39
+ size_t want = size > BLOCK_MIN ? size : BLOCK_MIN;
40
+ Block *b = (Block *)calloc(1, sizeof(Block));
41
+ if (NULL == b) arena_die();
42
+ b->data = (char *)calloc(1, want);
43
+ if (NULL == b->data) arena_die();
44
+ b->size = want;
45
+ b->used = 0;
46
+ b->next = arena_head;
47
+ arena_head = b;
48
+ }
49
+
50
+ void *p = arena_head->data + arena_head->used;
51
+ arena_head->used += size;
52
+ return p;
53
+ }
54
+
55
+ char *arena_strndup(const char *s, size_t n) {
56
+ char *out = (char *)arena_alloc(n + 1);
57
+ if (NULL != s && 0 < n) memcpy(out, s, n);
58
+ out[n] = '\0';
59
+ return out;
60
+ }
61
+
62
+ char *arena_strdup(const char *s) {
63
+ return arena_strndup(s, NULL == s ? 0 : strlen(s));
64
+ }
65
+
66
+ void arena_reset(void) {
67
+ Block *b = arena_head;
68
+ while (NULL != b) {
69
+ Block *next = b->next;
70
+ free(b->data);
71
+ free(b);
72
+ b = next;
73
+ }
74
+ arena_head = NULL;
75
+ }
76
+
77
+ /* --- construction --------------------------------------------------- */
78
+
79
+ static Value *vnew(VKind kind) {
80
+ Value *v = (Value *)arena_alloc(sizeof(Value));
81
+ v->kind = kind;
82
+ return v;
83
+ }
84
+
85
+ Value *vnull(void) { return vnew(VNULL); }
86
+
87
+ Value *vbool(bool b) {
88
+ Value *v = vnew(VBOOL);
89
+ v->boolean = b;
90
+ return v;
91
+ }
92
+
93
+ Value *vnum(double n) {
94
+ Value *v = vnew(VNUM);
95
+ v->num = n;
96
+ return v;
97
+ }
98
+
99
+ Value *vstr(const char *s) {
100
+ Value *v = vnew(VSTR);
101
+ v->str = arena_strdup(NULL == s ? "" : s);
102
+ return v;
103
+ }
104
+
105
+ Value *vlist(void) {
106
+ Value *v = vnew(VLIST);
107
+ v->cap = 8;
108
+ v->items = (Value **)arena_alloc(sizeof(Value *) * v->cap);
109
+ v->len = 0;
110
+ return v;
111
+ }
112
+
113
+ Value *vmap(void) { return vnew(VMAP); }
114
+
115
+ /* --- access --------------------------------------------------------- */
116
+
117
+ bool visnull(const Value *v) { return NULL == v || VNULL == v->kind; }
118
+ bool vismap(const Value *v) { return NULL != v && VMAP == v->kind; }
119
+ bool vislist(const Value *v) { return NULL != v && VLIST == v->kind; }
120
+ bool visstr(const Value *v) { return NULL != v && VSTR == v->kind; }
121
+ bool visnum(const Value *v) { return NULL != v && VNUM == v->kind; }
122
+ bool visbool(const Value *v) { return NULL != v && VBOOL == v->kind; }
123
+
124
+ static VEntry *ventry(const Value *m, const char *key) {
125
+ if (!vismap(m) || NULL == key) return NULL;
126
+ for (VEntry *e = m->first; NULL != e; e = e->next) {
127
+ if (0 == strcmp(e->key, key)) return e;
128
+ }
129
+ return NULL;
130
+ }
131
+
132
+ Value *vget(const Value *m, const char *key) {
133
+ VEntry *e = ventry(m, key);
134
+ return NULL == e ? NULL : e->val;
135
+ }
136
+
137
+ bool vhas(const Value *m, const char *key) {
138
+ return NULL != ventry(m, key);
139
+ }
140
+
141
+ void vset(Value *m, const char *key, Value *val) {
142
+ if (!vismap(m)) return;
143
+ VEntry *e = ventry(m, key);
144
+ if (NULL != e) {
145
+ e->val = val;
146
+ return;
147
+ }
148
+ e = (VEntry *)arena_alloc(sizeof(VEntry));
149
+ e->key = arena_strdup(key);
150
+ e->val = val;
151
+ e->next = NULL;
152
+ if (NULL == m->first) {
153
+ m->first = e;
154
+ m->last = e;
155
+ }
156
+ else {
157
+ m->last->next = e;
158
+ m->last = e;
159
+ }
160
+ }
161
+
162
+ void vdel(Value *m, const char *key) {
163
+ if (!vismap(m) || NULL == key) return;
164
+ VEntry *prev = NULL;
165
+ for (VEntry *e = m->first; NULL != e; e = e->next) {
166
+ if (0 == strcmp(e->key, key)) {
167
+ if (NULL == prev) m->first = e->next;
168
+ else prev->next = e->next;
169
+ if (m->last == e) m->last = prev;
170
+ return;
171
+ }
172
+ prev = e;
173
+ }
174
+ }
175
+
176
+ Value *vat(const Value *l, size_t i) {
177
+ if (!vislist(l) || i >= l->len) return NULL;
178
+ return l->items[i];
179
+ }
180
+
181
+ void vpush(Value *l, Value *item) {
182
+ if (!vislist(l)) return;
183
+ if (l->len == l->cap) {
184
+ size_t cap = l->cap * 2;
185
+ Value **items = (Value **)arena_alloc(sizeof(Value *) * cap);
186
+ memcpy(items, l->items, sizeof(Value *) * l->len);
187
+ l->items = items;
188
+ l->cap = cap;
189
+ }
190
+ l->items[l->len++] = item;
191
+ }
192
+
193
+ size_t vlen(const Value *v) {
194
+ if (vislist(v)) return v->len;
195
+ if (vismap(v)) {
196
+ size_t n = 0;
197
+ for (VEntry *e = v->first; NULL != e; e = e->next) n++;
198
+ return n;
199
+ }
200
+ return 0;
201
+ }
202
+
203
+ const char *vasstr(const Value *v) { return visstr(v) ? v->str : NULL; }
204
+ double vasnum(const Value *v) { return visnum(v) ? v->num : 0.0; }
205
+ bool vasbool(const Value *v) { return visbool(v) ? v->boolean : false; }
206
+
207
+ size_t vkeys(const Value *m, const char ***out) {
208
+ size_t n = vlen(m);
209
+ const char **keys = (const char **)arena_alloc(sizeof(char *) * (n + 1));
210
+ size_t i = 0;
211
+ if (vismap(m)) {
212
+ for (VEntry *e = m->first; NULL != e; e = e->next) keys[i++] = e->key;
213
+ }
214
+ *out = keys;
215
+ return i;
216
+ }
217
+
218
+ static int cmpstr(const void *a, const void *b) {
219
+ return strcmp(*(const char **)a, *(const char **)b);
220
+ }
221
+
222
+ size_t vsortedkeys(const Value *m, const char ***out) {
223
+ size_t n = vkeys(m, out);
224
+ if (1 < n) qsort((void *)*out, n, sizeof(char *), cmpstr);
225
+ return n;
226
+ }
227
+
228
+ bool vtruthy(const Value *v) {
229
+ if (NULL == v) return false;
230
+ switch (v->kind) {
231
+ case VNULL: return false;
232
+ case VBOOL: return v->boolean;
233
+ /* §4 rule 4: JSON truthiness. 0 and "" are FALSE, matching every
234
+ * other port's `truthy`, not C's "any nonzero scalar". */
235
+ case VNUM: return 0.0 != v->num;
236
+ case VSTR: return '\0' != v->str[0];
237
+ default: return true;
238
+ }
239
+ }
240
+
241
+ bool vsame(const Value *a, const Value *b) {
242
+ bool anull = visnull(a), bnull = visnull(b);
243
+ if (anull || bnull) return anull && bnull;
244
+ /* TYPE FIRST. `true` and `1` are different values, and
245
+ * `capability/match` is the entry that says so. */
246
+ if (a->kind != b->kind) return false;
247
+ switch (a->kind) {
248
+ case VBOOL: return a->boolean == b->boolean;
249
+ case VNUM: return a->num == b->num;
250
+ case VSTR: return 0 == strcmp(a->str, b->str);
251
+ case VLIST: {
252
+ if (a->len != b->len) return false;
253
+ for (size_t i = 0; i < a->len; i++) {
254
+ if (!vsame(a->items[i], b->items[i])) return false;
255
+ }
256
+ return true;
257
+ }
258
+ case VMAP: {
259
+ if (vlen(a) != vlen(b)) return false;
260
+ for (VEntry *e = a->first; NULL != e; e = e->next) {
261
+ if (!vhas(b, e->key)) return false;
262
+ if (!vsame(e->val, vget(b, e->key))) return false;
263
+ }
264
+ return true;
265
+ }
266
+ default: return true;
267
+ }
268
+ }
269
+
270
+ Value *vclone(const Value *v) {
271
+ if (NULL == v) return NULL;
272
+ switch (v->kind) {
273
+ case VNULL: return vnull();
274
+ case VBOOL: return vbool(v->boolean);
275
+ case VNUM: return vnum(v->num);
276
+ case VSTR: return vstr(v->str);
277
+ case VLIST: {
278
+ Value *out = vlist();
279
+ for (size_t i = 0; i < v->len; i++) vpush(out, vclone(v->items[i]));
280
+ return out;
281
+ }
282
+ case VMAP: {
283
+ Value *out = vmap();
284
+ for (VEntry *e = v->first; NULL != e; e = e->next) {
285
+ vset(out, e->key, vclone(e->val));
286
+ }
287
+ return out;
288
+ }
289
+ default: return vnull();
290
+ }
291
+ }
292
+
293
+ /* --- a growable output buffer, for json ----------------------------- */
294
+
295
+ typedef struct {
296
+ char *data;
297
+ size_t len;
298
+ size_t cap;
299
+ } Buf;
300
+
301
+ static void bufinit(Buf *b) {
302
+ b->cap = 256;
303
+ b->data = (char *)arena_alloc(b->cap);
304
+ b->len = 0;
305
+ b->data[0] = '\0';
306
+ }
307
+
308
+ static void bufgrow(Buf *b, size_t need) {
309
+ if (b->len + need + 1 <= b->cap) return;
310
+ size_t cap = b->cap;
311
+ while (cap < b->len + need + 1) cap *= 2;
312
+ char *data = (char *)arena_alloc(cap);
313
+ memcpy(data, b->data, b->len);
314
+ b->data = data;
315
+ b->cap = cap;
316
+ }
317
+
318
+ static void bufputn(Buf *b, const char *s, size_t n) {
319
+ bufgrow(b, n);
320
+ memcpy(b->data + b->len, s, n);
321
+ b->len += n;
322
+ b->data[b->len] = '\0';
323
+ }
324
+
325
+ static void bufputs(Buf *b, const char *s) { bufputn(b, s, strlen(s)); }
326
+ static void bufputc(Buf *b, char c) { bufputn(b, &c, 1); }
327
+
328
+ /* --- json out ------------------------------------------------------- */
329
+
330
+ const char *vnumstr(double n) {
331
+ char tmp[64];
332
+ /* An integral double renders as an integer: the corpus's expected
333
+ * values are written `1`, not `1.0`, and a port that emits the latter
334
+ * fails every comparison for a reason that has nothing to do with the
335
+ * behaviour under test. */
336
+ if (isfinite(n) && n == (double)(long long)n) {
337
+ snprintf(tmp, sizeof(tmp), "%lld", (long long)n);
338
+ }
339
+ else {
340
+ snprintf(tmp, sizeof(tmp), "%.17g", n);
341
+ }
342
+ return arena_strdup(tmp);
343
+ }
344
+
345
+ static void jsonstr(Buf *b, const char *s) {
346
+ bufputc(b, '"');
347
+ for (const unsigned char *p = (const unsigned char *)s; '\0' != *p; p++) {
348
+ switch (*p) {
349
+ case '"': bufputs(b, "\\\""); break;
350
+ case '\\': bufputs(b, "\\\\"); break;
351
+ case '\n': bufputs(b, "\\n"); break;
352
+ case '\r': bufputs(b, "\\r"); break;
353
+ case '\t': bufputs(b, "\\t"); break;
354
+ case '\b': bufputs(b, "\\b"); break;
355
+ case '\f': bufputs(b, "\\f"); break;
356
+ default:
357
+ if (0x20 > *p) {
358
+ char esc[8];
359
+ snprintf(esc, sizeof(esc), "\\u%04x", *p);
360
+ bufputs(b, esc);
361
+ }
362
+ else {
363
+ bufputc(b, (char)*p);
364
+ }
365
+ }
366
+ }
367
+ bufputc(b, '"');
368
+ }
369
+
370
+ static void jsonval(Buf *b, const Value *v) {
371
+ if (visnull(v)) { bufputs(b, "null"); return; }
372
+ switch (v->kind) {
373
+ case VBOOL: bufputs(b, v->boolean ? "true" : "false"); break;
374
+ case VNUM: bufputs(b, vnumstr(v->num)); break;
375
+ case VSTR: jsonstr(b, v->str); break;
376
+ case VLIST: {
377
+ bufputc(b, '[');
378
+ for (size_t i = 0; i < v->len; i++) {
379
+ if (0 < i) bufputc(b, ',');
380
+ jsonval(b, v->items[i]);
381
+ }
382
+ bufputc(b, ']');
383
+ break;
384
+ }
385
+ case VMAP: {
386
+ /* SORTED keys, so two `vsame` values render identically. */
387
+ const char **keys;
388
+ size_t n = vsortedkeys(v, &keys);
389
+ bufputc(b, '{');
390
+ for (size_t i = 0; i < n; i++) {
391
+ if (0 < i) bufputc(b, ',');
392
+ jsonstr(b, keys[i]);
393
+ bufputc(b, ':');
394
+ jsonval(b, vget(v, keys[i]));
395
+ }
396
+ bufputc(b, '}');
397
+ break;
398
+ }
399
+ default: bufputs(b, "null");
400
+ }
401
+ }
402
+
403
+ const char *vjson(const Value *v) {
404
+ Buf b;
405
+ bufinit(&b);
406
+ jsonval(&b, v);
407
+ return b.data;
408
+ }
409
+
410
+ /* --- json in -------------------------------------------------------- */
411
+
412
+ typedef struct {
413
+ const char *s;
414
+ size_t i;
415
+ size_t n;
416
+ const char *err;
417
+ } Parser;
418
+
419
+ static Value *parseval(Parser *p);
420
+
421
+ static void skipws(Parser *p) {
422
+ while (p->i < p->n) {
423
+ char c = p->s[p->i];
424
+ if (' ' == c || '\t' == c || '\n' == c || '\r' == c) p->i++;
425
+ else break;
426
+ }
427
+ }
428
+
429
+ static bool lit(Parser *p, const char *word) {
430
+ size_t n = strlen(word);
431
+ if (p->i + n <= p->n && 0 == strncmp(p->s + p->i, word, n)) {
432
+ p->i += n;
433
+ return true;
434
+ }
435
+ return false;
436
+ }
437
+
438
+ /* One UTF-16 code unit as UTF-8, surrogate pairs included — the corpus
439
+ * is ASCII today, and a parser that mangles the first non-ASCII string
440
+ * anyone adds is a trap rather than a simplification. */
441
+ static void pututf8(Buf *b, unsigned int cp) {
442
+ if (0x80 > cp) {
443
+ bufputc(b, (char)cp);
444
+ }
445
+ else if (0x800 > cp) {
446
+ bufputc(b, (char)(0xC0 | (cp >> 6)));
447
+ bufputc(b, (char)(0x80 | (cp & 0x3F)));
448
+ }
449
+ else if (0x10000 > cp) {
450
+ bufputc(b, (char)(0xE0 | (cp >> 12)));
451
+ bufputc(b, (char)(0x80 | ((cp >> 6) & 0x3F)));
452
+ bufputc(b, (char)(0x80 | (cp & 0x3F)));
453
+ }
454
+ else {
455
+ bufputc(b, (char)(0xF0 | (cp >> 18)));
456
+ bufputc(b, (char)(0x80 | ((cp >> 12) & 0x3F)));
457
+ bufputc(b, (char)(0x80 | ((cp >> 6) & 0x3F)));
458
+ bufputc(b, (char)(0x80 | (cp & 0x3F)));
459
+ }
460
+ }
461
+
462
+ static int hex4(Parser *p) {
463
+ if (p->i + 4 > p->n) return -1;
464
+ int out = 0;
465
+ for (int k = 0; k < 4; k++) {
466
+ char c = p->s[p->i + (size_t)k];
467
+ int d;
468
+ if ('0' <= c && '9' >= c) d = c - '0';
469
+ else if ('a' <= c && 'f' >= c) d = c - 'a' + 10;
470
+ else if ('A' <= c && 'F' >= c) d = c - 'A' + 10;
471
+ else return -1;
472
+ out = out * 16 + d;
473
+ }
474
+ p->i += 4;
475
+ return out;
476
+ }
477
+
478
+ static const char *parsestr(Parser *p) {
479
+ if (p->i >= p->n || '"' != p->s[p->i]) { p->err = "expected string"; return NULL; }
480
+ p->i++;
481
+ Buf b;
482
+ bufinit(&b);
483
+ while (p->i < p->n) {
484
+ char c = p->s[p->i];
485
+ if ('"' == c) { p->i++; return b.data; }
486
+ if ('\\' == c) {
487
+ p->i++;
488
+ if (p->i >= p->n) break;
489
+ char e = p->s[p->i++];
490
+ switch (e) {
491
+ case '"': bufputc(&b, '"'); break;
492
+ case '\\': bufputc(&b, '\\'); break;
493
+ case '/': bufputc(&b, '/'); break;
494
+ case 'n': bufputc(&b, '\n'); break;
495
+ case 't': bufputc(&b, '\t'); break;
496
+ case 'r': bufputc(&b, '\r'); break;
497
+ case 'b': bufputc(&b, '\b'); break;
498
+ case 'f': bufputc(&b, '\f'); break;
499
+ case 'u': {
500
+ int hi = hex4(p);
501
+ if (0 > hi) { p->err = "bad \\u escape"; return NULL; }
502
+ unsigned int cp = (unsigned int)hi;
503
+ if (0xD800 <= cp && 0xDBFF >= cp && p->i + 1 < p->n &&
504
+ '\\' == p->s[p->i] && 'u' == p->s[p->i + 1]) {
505
+ p->i += 2;
506
+ int lo = hex4(p);
507
+ if (0 > lo) { p->err = "bad \\u escape"; return NULL; }
508
+ cp = 0x10000 + ((cp - 0xD800) << 10) + ((unsigned int)lo - 0xDC00);
509
+ }
510
+ pututf8(&b, cp);
511
+ break;
512
+ }
513
+ default: p->err = "bad escape"; return NULL;
514
+ }
515
+ continue;
516
+ }
517
+ bufputc(&b, c);
518
+ p->i++;
519
+ }
520
+ p->err = "unterminated string";
521
+ return NULL;
522
+ }
523
+
524
+ static Value *parseval(Parser *p) {
525
+ skipws(p);
526
+ if (p->i >= p->n) { p->err = "unexpected end"; return NULL; }
527
+
528
+ char c = p->s[p->i];
529
+
530
+ if ('n' == c) {
531
+ if (lit(p, "null")) return vnull();
532
+ p->err = "bad literal"; return NULL;
533
+ }
534
+ if ('t' == c) {
535
+ if (lit(p, "true")) return vbool(true);
536
+ p->err = "bad literal"; return NULL;
537
+ }
538
+ if ('f' == c) {
539
+ if (lit(p, "false")) return vbool(false);
540
+ p->err = "bad literal"; return NULL;
541
+ }
542
+ if ('"' == c) {
543
+ const char *s = parsestr(p);
544
+ return NULL == s ? NULL : vstr(s);
545
+ }
546
+ if ('[' == c) {
547
+ p->i++;
548
+ Value *out = vlist();
549
+ skipws(p);
550
+ if (p->i < p->n && ']' == p->s[p->i]) { p->i++; return out; }
551
+ for (;;) {
552
+ Value *item = parseval(p);
553
+ if (NULL == item) return NULL;
554
+ vpush(out, item);
555
+ skipws(p);
556
+ if (p->i >= p->n) { p->err = "unterminated array"; return NULL; }
557
+ if (',' == p->s[p->i]) { p->i++; continue; }
558
+ if (']' == p->s[p->i]) { p->i++; return out; }
559
+ p->err = "expected , or ]";
560
+ return NULL;
561
+ }
562
+ }
563
+ if ('{' == c) {
564
+ p->i++;
565
+ Value *out = vmap();
566
+ skipws(p);
567
+ if (p->i < p->n && '}' == p->s[p->i]) { p->i++; return out; }
568
+ for (;;) {
569
+ skipws(p);
570
+ const char *key = parsestr(p);
571
+ if (NULL == key) return NULL;
572
+ skipws(p);
573
+ if (p->i >= p->n || ':' != p->s[p->i]) { p->err = "expected :"; return NULL; }
574
+ p->i++;
575
+ Value *val = parseval(p);
576
+ if (NULL == val) return NULL;
577
+ vset(out, key, val);
578
+ skipws(p);
579
+ if (p->i >= p->n) { p->err = "unterminated object"; return NULL; }
580
+ if (',' == p->s[p->i]) { p->i++; continue; }
581
+ if ('}' == p->s[p->i]) { p->i++; return out; }
582
+ p->err = "expected , or }";
583
+ return NULL;
584
+ }
585
+ }
586
+
587
+ if ('-' == c || ('0' <= c && '9' >= c)) {
588
+ /* JSON's number grammar is STRICT, and §9.5 makes that observable:
589
+ * env values "parse as JSON, falling back to string", so anything
590
+ * this reader accepts loosely silently becomes a number where the
591
+ * canonical keeps the authored string. `1e`, `1.`, `01`, `.5` and a
592
+ * bare `-` are all errors to JSON.parse; only `-0` and `1e5` are
593
+ * not.
594
+ *
595
+ * number = [ '-' ] int [ frac ] [ exp ]
596
+ * int = '0' | digit1-9 *digit
597
+ * frac = '.' 1*digit
598
+ * exp = ('e'|'E') [ '+' | '-' ] 1*digit
599
+ */
600
+ size_t start = p->i;
601
+ if ('-' == p->s[p->i]) p->i++;
602
+ if (p->i >= p->n) { p->err = "bad number"; return NULL; }
603
+ if ('0' == p->s[p->i]) {
604
+ p->i++;
605
+ }
606
+ else if ('1' <= p->s[p->i] && '9' >= p->s[p->i]) {
607
+ while (p->i < p->n && '0' <= p->s[p->i] && '9' >= p->s[p->i]) p->i++;
608
+ }
609
+ else { p->err = "bad number"; return NULL; }
610
+ if (p->i < p->n && '.' == p->s[p->i]) {
611
+ p->i++;
612
+ size_t d = p->i;
613
+ while (p->i < p->n && '0' <= p->s[p->i] && '9' >= p->s[p->i]) p->i++;
614
+ if (d == p->i) { p->err = "bad number"; return NULL; }
615
+ }
616
+ if (p->i < p->n && ('e' == p->s[p->i] || 'E' == p->s[p->i])) {
617
+ p->i++;
618
+ if (p->i < p->n && ('+' == p->s[p->i] || '-' == p->s[p->i])) p->i++;
619
+ size_t d = p->i;
620
+ while (p->i < p->n && '0' <= p->s[p->i] && '9' >= p->s[p->i]) p->i++;
621
+ if (d == p->i) { p->err = "bad number"; return NULL; }
622
+ }
623
+ char *text = arena_strndup(p->s + start, p->i - start);
624
+ return vnum(strtod(text, NULL));
625
+ }
626
+
627
+ p->err = "unexpected character";
628
+ return NULL;
629
+ }
630
+
631
+ Value *vparse(const char *text, const char **err) {
632
+ Parser p;
633
+ p.s = text;
634
+ p.i = 0;
635
+ p.n = strlen(text);
636
+ p.err = NULL;
637
+
638
+ Value *v = parseval(&p);
639
+ if (NULL == v) {
640
+ if (NULL != err) *err = NULL == p.err ? "parse failed" : p.err;
641
+ return NULL;
642
+ }
643
+ skipws(&p);
644
+ if (p.i != p.n) {
645
+ if (NULL != err) *err = "trailing content";
646
+ return NULL;
647
+ }
648
+ return v;
649
+ }