@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
@@ -16,13 +16,51 @@
16
16
  # wildcard; they are mutually independent so their relative order is free.
17
17
 
18
18
  OCAMLC = ocamlc
19
- INC = -I utility -I . -I test -I test/vendor/omni
19
+ CC ?= cc
20
+
21
+ # ---- gated feature build fragments ------------------------------------------
22
+ #
23
+ # A feature carried as a CONTAINER under feature/<name>/ (beside the single
24
+ # template module sdk_features.ml every other feature lives in) may need
25
+ # more than the verbatim copy: vendored modules that must be compiled in a
26
+ # specific order, a library archive, a C stub and its link flags. A
27
+ # generator component emits feature/<name>/feature.mk for such a feature
28
+ # ONLY when the model activates it, and this Makefile includes whatever
29
+ # fragments exist. Without one every variable below stays EMPTY: a tree
30
+ # whose model never activated such a feature compiles nothing extra and
31
+ # links the OCaml distribution alone.
32
+ #
33
+ # WHY A FRAGMENT AND NOT A WILDCARD. ocamlc compiles a module before anything
34
+ # that uses it and has no link-time reordering, so a `$(wildcard)` over a
35
+ # vendored directory - alphabetical - would not build. The fragment carries
36
+ # what only the model knows and only a Makefile can say in OCaml: the module
37
+ # list IN DEPENDENCY ORDER, and the one external dependency (if any) behind
38
+ # the plugin groups that need it.
39
+ #
40
+ # FEATURE_INC extra -I paths (and -I +unix when unix.cma is linked)
41
+ # FEATURE_LIB library archives, listed BEFORE the modules that use them
42
+ # FEATURE_SRC the ordered module list, ending in the feature module
43
+ # FEATURE_TESTS the feature's gated suite under test/feature/<name>/ (a
44
+ # `feature` container, so the trim drops it with the feature)
45
+ # FEATURE_OBJ compiled C stub objects, when the feature needs any
46
+ # FEATURE_LINK link flags for those stubs (-custom, -cclib ...)
47
+ FEATURE_INC ?=
48
+ FEATURE_LIB ?=
49
+ FEATURE_SRC ?=
50
+ FEATURE_TESTS ?=
51
+ FEATURE_OBJ ?=
52
+ FEATURE_LINK ?=
53
+ -include $(wildcard feature/*/feature.mk)
54
+
55
+ INC = -I utility -I . -I test -I test/vendor/omni $(FEATURE_INC)
20
56
 
21
57
  # The shared JSON corpus lives in the sibling .sdk workspace.
22
58
  CORPUS = ../.sdk/test/test.json
23
59
 
60
+ # A gated feature's modules come AFTER sdk_features.ml (a feature module
61
+ # opens it) and BEFORE sdk_config.ml (the generated factory names them).
24
62
  RUNTIME = utility/vregex.ml utility/voxgig_struct.ml sdk_json.ml \
25
- sdk_types.ml sdk_helpers.ml sdk_runtime.ml sdk_features.ml
63
+ sdk_types.ml sdk_helpers.ml sdk_runtime.ml sdk_features.ml $(FEATURE_SRC)
26
64
 
27
65
  # The vendored corpus engine plus the adapter that drives it. Order matters:
28
66
  # the adapter references the vendored module.
@@ -38,11 +76,12 @@ ENTITY_TESTS = $(sort $(wildcard test/*_entity_test.ml) $(wildcard test/*_direct
38
76
  # Wildcard so an absent file is simply skipped, never a missing-target error.
39
77
  DOC_TESTS = $(sort $(wildcard test/readme_examples_test.ml))
40
78
 
41
- # Fixed test order: harness deps first, generated/behaviour tests, summary last.
79
+ # Fixed test order: harness deps first, generated/behaviour tests, the gated
80
+ # feature suites, summary last.
42
81
  SDK_TEST = $(RUNTIME) sdk_config.ml $(ENTITIES) sdk_client.ml sdk_error.ml \
43
82
  test/testutil.ml test/harness.ml \
44
83
  test/t_pipeline.ml test/t_feature.ml test/custom_utility.ml \
45
- $(ENTITY_TESTS) $(DOC_TESTS) test/t_main.ml
84
+ $(ENTITY_TESTS) $(DOC_TESTS) $(FEATURE_TESTS) test/t_main.ml
46
85
 
47
86
  # The struct corpus needs only the struct library and the corpus engine —
48
87
  # omni carries its own JSON reader and regex engine, so nothing of the SDK
@@ -75,8 +114,11 @@ test-corpus: run_struct_corpus
75
114
  test-primary: run_primary_corpus
76
115
  ./run_primary_corpus $(CORPUS)
77
116
 
78
- run_sdk_test: $(SDK_TEST)
79
- $(OCAMLC) $(INC) $(SDK_TEST) -o run_sdk_test
117
+ # Every executable that links the RUNTIME links the gated feature tier with
118
+ # it: library archives FIRST (an archive must precede the modules that use
119
+ # it), stub objects and link flags LAST.
120
+ run_sdk_test: $(SDK_TEST) $(FEATURE_OBJ)
121
+ $(OCAMLC) $(INC) $(FEATURE_LIB) $(SDK_TEST) $(FEATURE_OBJ) $(FEATURE_LINK) -o run_sdk_test
80
122
 
81
123
  run_omni_smoke: $(SMOKE_SRC)
82
124
  $(OCAMLC) $(INC) $(SMOKE_SRC) -o run_omni_smoke
@@ -84,8 +126,8 @@ run_omni_smoke: $(SMOKE_SRC)
84
126
  run_struct_corpus: $(CORPUS_SRC)
85
127
  $(OCAMLC) $(INC) $(CORPUS_SRC) -o run_struct_corpus
86
128
 
87
- run_primary_corpus: $(PRIMARY_SRC)
88
- $(OCAMLC) $(INC) $(PRIMARY_SRC) -o run_primary_corpus
129
+ run_primary_corpus: $(PRIMARY_SRC) $(FEATURE_OBJ)
130
+ $(OCAMLC) $(INC) $(FEATURE_LIB) $(PRIMARY_SRC) $(FEATURE_OBJ) $(FEATURE_LINK) -o run_primary_corpus
89
131
 
90
132
  # Type-check the SDK library (a clean compile means it is sound).
91
133
  build: lint
@@ -96,4 +138,6 @@ lint:
96
138
  clean:
97
139
  rm -f *.cmi *.cmo test/*.cmi test/*.cmo utility/*.cmi utility/*.cmo \
98
140
  test/vendor/omni/*.cmi test/vendor/omni/*.cmo \
141
+ feature/*.cmi feature/*.cmo feature/*/*/*.cmi feature/*/*/*.cmo \
142
+ feature/*/*/*.o test/feature/*/*.cmi test/feature/*/*.cmo \
99
143
  run_sdk_test run_omni_smoke run_struct_corpus run_primary_corpus a.out
@@ -0,0 +1,106 @@
1
+ (* VENDORED: @voxgig/plugin sdk-20260908-1556-0 (ocaml/src/capability.ml) *)
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
+ (* Capabilities (§11.1).
5
+
6
+ A DEPENDENCY IS ON A CAPABILITY, NOT ON A REF — because it is a
7
+ dependency on something that can do the job, and which instance is
8
+ doing it is exactly the configuration detail a plugin must not care
9
+ about. (§11.1 makes one narrow exception for a ref, and `host.ml`
10
+ implements it; the ranking here is capabilities only.)
11
+
12
+ But A BINDING IS TO AN INSTANCE, not to a capability, which is what
13
+ decides behaviour when the bound provider leaves while another match
14
+ remains. *)
15
+
16
+ module V = Value
17
+
18
+ (* PARTIAL MATCH, RECURSING INTO MAPS (§11.1). THIS FUNCTION IS WHAT
19
+ "EVERY LEAF" MEANS, and an earlier draft of the canonical did not
20
+ have it: the check was a scalar compare, which for any compound
21
+ value is reference identity in JavaScript. A requirement and a
22
+ capability are declared in different places and are never the same
23
+ object, so `match: {limits: {max: 5}}` could not be satisfied by ANY
24
+ provider — including one declaring exactly that. Invisible while
25
+ every corpus entry is scalar, which is why the go port found it and
26
+ P2 did not.
27
+
28
+ A LIST IS COMPARED LEAF-WISE AT THE SAME LENGTH, not as a subset —
29
+ "the first two of your three regions" is not something `match` can
30
+ say. *)
31
+ let rec capmatchvalue want got =
32
+ if V.is_map want then
33
+ V.is_map got
34
+ && List.for_all
35
+ (fun k -> V.has got k && capmatchvalue (V.get want k) (V.get got k))
36
+ (V.keys want)
37
+ else if V.is_list want then
38
+ V.is_list got && V.len want = V.len got
39
+ && List.for_all2 capmatchvalue (V.items want) (V.items got)
40
+ else V.same want got
41
+
42
+ let capmatches req prov =
43
+ if not (V.same (V.get req "name") (V.get prov "name")) then false
44
+ else
45
+ let range = V.get req "range" in
46
+ let versionok =
47
+ if V.is_null range then true
48
+ else
49
+ let version = V.get prov "version" in
50
+ (not (V.is_null version)) && Version.satisfiesq version range
51
+ in
52
+ if not versionok then false
53
+ else
54
+ (* `match` is checked against the provider's `attrs`, key by key.
55
+ A key the provider does not carry is a MISS, not a pass: a
56
+ requirement asking for `transactional: true` must not be
57
+ satisfied by a provider that never said. *)
58
+ let m = V.get req "match" in
59
+ if V.is_null m then true
60
+ else
61
+ let attrs = V.get prov "attrs" in
62
+ let attrs = if V.is_null attrs then V.vmap () else attrs in
63
+ List.for_all
64
+ (fun k -> V.has attrs k && capmatchvalue (V.get m k) (V.get attrs k))
65
+ (V.keys m)
66
+
67
+ (* The rank, as a comparison over two candidates. Ordering is a TOTAL
68
+ rank on purpose: without one, "any provider satisfies" is true of
69
+ the GRAPH and useless to the PLUGIN — two ports could bind different
70
+ `store` instances, both resolve green, and behave differently, which
71
+ is precisely the divergence a shared corpus exists to catch. *)
72
+ let rank a b =
73
+ let ap = V.get a "provides" and bp = V.get b "provides" in
74
+ let av = V.get ap "version" and bv = V.get bp "version" in
75
+ let ahas = not (V.is_null av) and bhas = not (V.is_null bv) in
76
+ if ahas <> bhas then if ahas then -1 else 1 (* a version beats none *)
77
+ else
78
+ let byversion =
79
+ if ahas && bhas then
80
+ (* HIGHEST version first, so the comparison is reversed. *)
81
+ try Version.vercmp (Version.parseversion bv) (Version.parseversion av)
82
+ with Types.Plugin_error _ -> 0
83
+ else 0
84
+ in
85
+ if 0 <> byversion then byversion
86
+ else
87
+ let pri p =
88
+ let v = V.get p "priority" in
89
+ if V.is_num v then V.as_num v else 0.0
90
+ in
91
+ let apri = pri ap and bpri = pri bp in
92
+ (* LOWEST priority first. *)
93
+ if apri <> bpri then if apri < bpri then -1 else 1
94
+ else
95
+ let apos = V.as_num (V.get a "pos") and bpos = V.as_num (V.get b "pos") in
96
+ if apos <> bpos then if apos < bpos then -1 else 1 else 0
97
+
98
+ let resolvecapability req candidates =
99
+ let hits = List.filter (fun c -> capmatches req (V.get c "provides"))
100
+ (V.items candidates) in
101
+ (* `List.stable_sort` and `rank` is a TOTAL order (it falls through
102
+ to `pos`, which is unique), so stability is not relied on. An
103
+ earlier reading that stopped at `priority` would have left ties to
104
+ the sort's discretion, which is exactly the per-port divergence
105
+ the ranking exists to remove. *)
106
+ V.oflist (List.stable_sort rank hits)
@@ -0,0 +1,43 @@
1
+ (* VENDORED: @voxgig/plugin sdk-20260908-1556-0 (ocaml/src/catalog.ml) *)
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 definition catalog (§10.1).
5
+
6
+ A definition is registered once and may back many instances. Option
7
+ shapes are validated AT REGISTRATION, not when a document happens to
8
+ exercise a key — so a malformed shape fails once, and in the same
9
+ place everywhere (§9.4). `declare/shape` pins that timing. *)
10
+
11
+ module V = Value
12
+ open Defs
13
+
14
+ let makecatalog () = { defs = [] }
15
+
16
+ let add c def =
17
+ if not (Ref.checkname (V.vstr def.dname)) then
18
+ Types.fail "plugin_definition_name"
19
+ ("invalid definition name: " ^ def.dname);
20
+
21
+ (* Validate the shape HERE. Deferring it to resolution time means a
22
+ malformed shape surfaces at a different moment in every host that
23
+ loads it, which is the divergence the stated domain exists to
24
+ prevent. *)
25
+ if not (V.is_null def.shape) then Config.checkshape def.shape;
26
+
27
+ if List.mem_assoc def.dname c.defs then
28
+ c.defs <-
29
+ List.map (fun (k, d) -> if k = def.dname then (k, def) else (k, d)) c.defs
30
+ else c.defs <- c.defs @ [ (def.dname, def) ]
31
+
32
+ let get c name = List.assoc_opt name c.defs
33
+ let has c name = List.mem_assoc name c.defs
34
+ let names c = V.oflist (List.map V.vstr (List.sort compare (List.map fst c.defs)))
35
+
36
+ (* The callback for a phase, by the name the log and the corpus use. *)
37
+ let callback d at =
38
+ match at with
39
+ | "define" -> d.define
40
+ | "activate" -> d.activate
41
+ | "deactivate" -> d.deactivate
42
+ | "close" -> d.close
43
+ | _ -> None
@@ -0,0 +1,349 @@
1
+ (* VENDORED: @voxgig/plugin sdk-20260908-1556-0 (ocaml/src/config.ml) *)
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 declarative document (§9): normalization, and the ten-level
5
+ precedence ladder.
6
+
7
+ TWO FUNCTIONS, AND THE SPLIT BETWEEN THEM IS FORCED.
8
+
9
+ `normalizeconfig` normalizes STRUCTURE and ENTRY KEYS. It does not
10
+ merge options, and cannot: §9.4 makes merge behaviour a property of
11
+ the definition's option SHAPE, which normalization has never seen. A
12
+ normalizer that flattened the option layers would make
13
+ `$MERGE: append` unimplementable at load time, because the layers it
14
+ must concatenate would already be collapsed.
15
+
16
+ `resolveoptions` applies the ladder, and it is the only place that
17
+ knows the shape. *)
18
+
19
+ module V = Value
20
+
21
+ (* §9.1: reservation is all-or-nothing per NAME, so the tagged forms go
22
+ too. A configuration surface that can disable the thing reading it
23
+ is not a surface, it is a trap. *)
24
+ let checkreserved r reserved =
25
+ if V.is_list reserved && 0 < V.len reserved then begin
26
+ let name = Ref.refname r in
27
+ if List.exists (fun x -> V.is_str x && V.as_str x = name)
28
+ (V.items reserved)
29
+ then
30
+ Types.fail "plugin_ref_reserved"
31
+ ("ref is reserved by the host: " ^ r)
32
+ ~details:(Types.details1 "ref" (V.vstr r))
33
+ end
34
+
35
+ (* Both document forms reduce to {ref -> entry} plus the order the form
36
+ implies: array POSITION for the array form, sorted refs for the map
37
+ form. *)
38
+ let entriesof src =
39
+ let m = V.vmap () in
40
+ let order = V.vlist () in
41
+ if V.is_null src then (m, order)
42
+ else if V.is_list src then begin
43
+ List.iter
44
+ (fun item ->
45
+ let r = Ref.canonref (V.get item "ref") in
46
+ V.set m r item;
47
+ V.push order (V.vstr r))
48
+ (V.items src);
49
+ (m, order)
50
+ end
51
+ else begin
52
+ (* Map-form refs arrive as KEYS, through a different path than an
53
+ array element's `ref` field — and must canonicalize the same
54
+ way. *)
55
+ List.iter (fun k -> V.set m (Ref.canonrefs k) (V.get src k)) (V.keys src);
56
+ (* Byte-wise, NOT locale-aware and NOT case-folded. All-lowercase
57
+ refs sort identically under all three, so only mixed input
58
+ discriminates: '@' is 0x40, uppercase 0x41-0x5A, lowercase
59
+ 0x61-0x7A. *)
60
+ List.iter (fun k -> V.push order (V.vstr k)) (V.sortedkeys m);
61
+ (m, order)
62
+ end
63
+
64
+ (* PRESENT WINS, EVEN WHEN THE VALUE IS NULL. The canonical is
65
+ [src && undefined !== src[key]], and in JavaScript a key holding
66
+ [null] passes that test -- so a profile's [order: null] clears a base
67
+ ordering block and [active: null] over a base [active: true] is
68
+ falsy, and barred. Testing for non-null instead treated an authored
69
+ null as an absent key, which is 9.1's distinction inverted. *)
70
+ let pick src key dflt =
71
+ if V.is_map src && V.has src key then V.get src key else dflt
72
+
73
+ let listhas l s = List.exists (fun v -> V.is_str v && V.as_str v = s) (V.items l)
74
+
75
+ let normalizeconfig input =
76
+ let doc = V.get input "doc" in
77
+ let doc = if V.is_map doc then doc else V.vmap () in
78
+ let keyspec = V.get input "keys" in
79
+ let str k d =
80
+ let v = V.get keyspec k in
81
+ if V.is_str v then V.as_str v else d
82
+ in
83
+ let ikey = str "instance" "instance" and dkey = str "default" "default" in
84
+ let reserved = V.get input "reserved" in
85
+ let profile = V.get input "profile" in
86
+
87
+ (* The rename is applied at TWO PLACES AND NO OTHERS: the document
88
+ root, and every profile.<name> overlay root (§9.1). A rename
89
+ applied only at the root would leave `profile.prod.sdk`
90
+ untranslated and silently drop every environment override the host
91
+ depends on. Recursing further would be worse: option data is the
92
+ definition's. *)
93
+ let baseinst = V.get doc ikey in
94
+ let basedef = V.get doc dkey in
95
+ let basedef = if V.is_map basedef then basedef else V.vmap () in
96
+
97
+ let overlay =
98
+ if V.is_str profile then V.get (V.get doc "profile") (V.as_str profile)
99
+ else V.vnull
100
+ in
101
+ let overinst = if V.is_map overlay then V.get overlay ikey else V.vnull in
102
+ let overdef = if V.is_map overlay then V.get overlay dkey else V.vnull in
103
+ let overdef = if V.is_map overdef then overdef else V.vmap () in
104
+
105
+ let basemap, baseorder = entriesof baseinst in
106
+ let overmap, overorder = entriesof overinst in
107
+
108
+ List.iter
109
+ (fun m -> List.iter (fun k -> checkreserved k reserved) (V.keys m))
110
+ [ basemap; overmap; basedef; overdef ];
111
+
112
+ (* A PARTIAL ARRAY IS NOT A FILTER (§9.1). sdkgen learned this the
113
+ hard way: deriving order from a partial array silently dropped
114
+ config-activated features. Refs in the base but absent from the
115
+ overlay still load, in sorted position AFTER the listed ones. A
116
+ profile may also INTRODUCE a ref the base never declared. *)
117
+ let order = V.vlist () in
118
+ let add l =
119
+ List.iter
120
+ (fun v ->
121
+ let r = V.as_str v in
122
+ if not (listhas order r) then V.push order (V.vstr r))
123
+ (V.items l)
124
+ in
125
+ add overorder;
126
+ (* The remainder keeps the BASE's own order — array position for the
127
+ array form, sorted refs for the map form. Re-sorting here would
128
+ discard an array document's positional order entirely, which is
129
+ the one thing the array form exists to express. *)
130
+ add baseorder;
131
+
132
+ let instance = V.vmap () in
133
+ List.iteri
134
+ (fun i rv ->
135
+ let r = V.as_str rv in
136
+ let b = V.get basemap r and o = V.get overmap r in
137
+
138
+ (* MERGE THE ENTRIES AS AUTHORED, THEN APPLY DEFAULTS TO THE
139
+ RESULT (§9.3). A safety rule, not a tidiness one: if the
140
+ overlay had its defaults filled in before merging it would
141
+ carry a synthesized active:true and overwrite a base's false —
142
+ silently re-enabling a deliberately disabled integration in
143
+ production. *)
144
+ let active = pick o "active" (pick b "active" (V.vbool true)) in
145
+ let start = pick o "start" (pick b "start" (V.vstr "eager")) in
146
+ let ord = pick o "order" (pick b "order" V.vnull) in
147
+
148
+ (* Option layers, levels 3-6, IN LADDER ORDER. Never merged
149
+ here. *)
150
+ let layers = V.vlist () in
151
+ let nm = Ref.refname r in
152
+ let addopts src =
153
+ if V.is_map src && V.has src "options" then
154
+ V.push layers (V.get src "options")
155
+ in
156
+ addopts (V.get basedef nm);
157
+ addopts b;
158
+ addopts (V.get overdef nm);
159
+ addopts o;
160
+
161
+ let ent = V.vmap () in
162
+ V.set ent "pos" (V.vnum (float_of_int i));
163
+ V.set ent "active" active;
164
+ V.set ent "start" start;
165
+ V.set ent "optionlayers" layers;
166
+ if not (V.is_null ord) then V.set ent "order" ord;
167
+ V.set instance r ent)
168
+ (V.items order);
169
+
170
+ (* `default` DECLARES NOTHING (§9.3). It is a base for every instance
171
+ of that definition; it does not create one, and an entry for a
172
+ name with no instances is inert rather than an error — which is
173
+ what makes a shared library of defaults shippable. *)
174
+ let defout = V.vmap () in
175
+ List.iter (fun k -> V.set defout k (V.get basedef k)) (V.keys basedef);
176
+ List.iter (fun k -> V.set defout k (V.get overdef k)) (V.keys overdef);
177
+
178
+ let out = V.vmap () in
179
+ V.set out "instance" instance;
180
+ V.set out "order" order;
181
+ V.set out "default" defout;
182
+ out
183
+
184
+ (* ------------------------------------------------------------------ *)
185
+ (* resolveoptions — §9.3's ten levels, and §9.4's merge directives *)
186
+ (* ------------------------------------------------------------------ *)
187
+
188
+ (* §9.4: N is an integer of at least 1, and everything else is an
189
+ error.
190
+
191
+ `{"deep": 0}` is rejected DESPITE having an obvious reading, because
192
+ "replace at this key" already has a spelling and two spellings for
193
+ one behaviour is the defect class this repo exists to avoid. Without
194
+ the stated domain each port picks its own reading — reject, replace,
195
+ unlimited merge, or clamp to 1 — and the same document resolves
196
+ differently per language. *)
197
+ let checkshape shape =
198
+ if V.is_map shape then
199
+ List.iter
200
+ (fun k ->
201
+ let v = V.get shape k in
202
+ if V.is_map v && V.has v "$MERGE" then begin
203
+ let d = V.get v "$MERGE" in
204
+ let bad text =
205
+ Types.fail "plugin_shape_invalid" text
206
+ ~details:(Types.details2 "key" (V.vstr k) "directive" d)
207
+ in
208
+ if V.is_str d then begin
209
+ let w = V.as_str d in
210
+ if "replace" <> w && "append" <> w then
211
+ bad ("invalid $MERGE directive at " ^ k ^ ": " ^ w)
212
+ end
213
+ else if V.is_map d && V.has d "deep" then begin
214
+ let nv = V.get d "deep" in
215
+ let x = V.as_num nv in
216
+ if (not (V.is_num nv)) || (not (Float.is_integer x)) || 1.0 > x then
217
+ bad ("invalid $MERGE deep at " ^ k ^ ": " ^ V.json nv)
218
+ end
219
+ else bad ("invalid $MERGE directive at " ^ k ^ ": " ^ V.json d)
220
+ end)
221
+ (V.keys shape)
222
+
223
+ (* The shape's non-directive values are the level-1 defaults. *)
224
+ let defaultsof shape =
225
+ let out = V.vmap () in
226
+ if V.is_map shape then
227
+ List.iter
228
+ (fun k ->
229
+ let v = V.get shape k in
230
+ if not (V.is_map v && V.has v "$MERGE") then V.set out k v)
231
+ (V.keys shape);
232
+ out
233
+
234
+ let optsof src key =
235
+ if V.is_null src then None
236
+ (* The array form is equivalent to the map form (§9.1). *)
237
+ else if V.is_list src then
238
+ List.fold_left
239
+ (fun acc item ->
240
+ match acc with
241
+ | Some _ -> acc
242
+ | None ->
243
+ if Ref.canonref (V.get item "ref") = key then
244
+ if V.has item "options" then Some (V.get item "options") else None
245
+ else None)
246
+ None (V.items src)
247
+ else
248
+ List.fold_left
249
+ (fun acc k ->
250
+ match acc with
251
+ | Some _ -> acc
252
+ | None ->
253
+ if Ref.canonrefs k = key then
254
+ let e = V.get src k in
255
+ if V.has e "options" then Some (V.get e "options") else None
256
+ else None)
257
+ None (V.keys src)
258
+
259
+ (* Merge N levels below this key, replace below that. *)
260
+ let rec deepto base over n =
261
+ if 0 >= n then V.clone over
262
+ else if not (V.is_map base && V.is_map over) then V.clone over
263
+ else begin
264
+ let out = V.vmap () in
265
+ List.iter (fun k -> V.set out k (V.get base k)) (V.keys base);
266
+ List.iter
267
+ (fun k -> V.set out k (deepto (V.get out k) (V.get over k) (n - 1)))
268
+ (V.keys over);
269
+ out
270
+ end
271
+
272
+ (* Merge ONE layer onto the accumulator, honouring the shape's
273
+ directives. The directive holds at EVERY precedence level, not only
274
+ between document levels — §9.4 makes it a property of the shape,
275
+ which does not know which layer a value arrived from. *)
276
+ let rec mergeone base over shape =
277
+ if V.is_null over then base
278
+ else if not (V.is_map base && V.is_map over) then V.clone over
279
+ else begin
280
+ let out = V.vmap () in
281
+ List.iter (fun k -> V.set out k (V.get base k)) (V.keys base);
282
+ List.iter
283
+ (fun k ->
284
+ let entry = if V.is_map shape then V.get shape k else V.vnull in
285
+ let directive = if V.is_map entry then V.get entry "$MERGE" else V.vnull in
286
+ let b = V.get out k and o = V.get over k in
287
+ if V.is_str directive && "replace" = V.as_str directive then
288
+ V.set out k (V.clone o)
289
+ else if V.is_str directive && "append" = V.as_str directive then begin
290
+ let merged = V.vlist () in
291
+ if V.is_list b then List.iter (V.push merged) (V.items b);
292
+ if V.is_list o then List.iter (V.push merged) (V.items o)
293
+ else V.push merged o;
294
+ V.set out k merged
295
+ end
296
+ else if V.is_map directive && V.has directive "deep" then
297
+ V.set out k
298
+ (deepto b o (int_of_float (V.as_num (V.get directive "deep"))))
299
+ else if V.is_map b && V.is_map o then
300
+ (* Library default: deep for maps, REPLACE for lists.
301
+ struct.merge is element-wise by index, which for option
302
+ maps is nearly always wrong — ["a"] over ["x","y","z"]
303
+ yielding ["a","y","z"] is the defect station hit on
304
+ secrets.providers. *)
305
+ V.set out k (mergeone b o V.vnull)
306
+ else V.set out k (V.clone o))
307
+ (V.keys over);
308
+ out
309
+ end
310
+
311
+ let resolveoptions input =
312
+ let shape = V.get input "shape" in
313
+ let shape = if V.is_map shape then shape else V.vmap () in
314
+ checkshape shape;
315
+
316
+ let r = Ref.canonref (V.get input "ref") in
317
+ let name = Ref.refname r in
318
+ let doc = V.get input "doc" in
319
+ let doc = if V.is_map doc then doc else V.vmap () in
320
+
321
+ let profile = V.get input "profile" in
322
+ let overlay =
323
+ if V.is_str profile then V.get (V.get doc "profile") (V.as_str profile)
324
+ else V.vnull
325
+ in
326
+ let over key = if V.is_map overlay then V.get overlay key else V.vnull in
327
+ let some v = if V.is_null v then None else Some v in
328
+
329
+ (* ONE ordered merge, lowest to highest. Levels 3-6 are not two
330
+ namespaces collapsed separately and composed afterwards: that
331
+ inverts the rule that PROFILE SPECIFICITY OUTRANKS DEFINITION
332
+ SPECIFICITY, so a prod per-definition default would lose to a base
333
+ instance value. *)
334
+ let layers =
335
+ [ Some (defaultsof shape); (* 1 *)
336
+ some (V.get input "hostdefaults"); (* 2 *)
337
+ optsof (V.get doc "default") name; (* 3 *)
338
+ optsof (V.get doc "instance") r; (* 4 *)
339
+ optsof (over "default") name; (* 5 *)
340
+ optsof (over "instance") r; (* 6 *)
341
+ some (V.get input "env"); (* 7 *)
342
+ some (V.get input "hostoptions"); (* 8 *)
343
+ some (V.get input "loadoptions"); (* 9 *)
344
+ some (V.get input "patch") ] (* 10 *)
345
+ in
346
+ List.fold_left
347
+ (fun acc layer ->
348
+ match layer with None -> acc | Some l -> mergeone acc l shape)
349
+ (V.vmap ()) layers