@voxgig/sdkgen 4.8.1 → 4.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/action/doctor.d.ts +1 -0
  3. package/dist/action/doctor.js +50 -2
  4. package/dist/action/doctor.js.map +1 -1
  5. package/dist/helpers/naming.js +4 -2
  6. package/dist/helpers/naming.js.map +1 -1
  7. package/dist/tsconfig.tsbuildinfo +1 -1
  8. package/model/sdkgen.aon +21 -0
  9. package/package.json +2 -2
  10. package/project/.sdk/model/feature/secrets.aon +120 -18
  11. package/project/.sdk/model/target/c.aon +10 -0
  12. package/project/.sdk/model/target/clojure.aon +13 -0
  13. package/project/.sdk/model/target/cpp.aon +10 -0
  14. package/project/.sdk/model/target/csharp.aon +9 -0
  15. package/project/.sdk/model/target/dart.aon +10 -0
  16. package/project/.sdk/model/target/elixir.aon +9 -0
  17. package/project/.sdk/model/target/go.aon +13 -0
  18. package/project/.sdk/model/target/java.aon +9 -0
  19. package/project/.sdk/model/target/js.aon +7 -0
  20. package/project/.sdk/model/target/kotlin.aon +9 -0
  21. package/project/.sdk/model/target/lean.aon +17 -0
  22. package/project/.sdk/model/target/lua.aon +8 -0
  23. package/project/.sdk/model/target/ocaml.aon +9 -0
  24. package/project/.sdk/model/target/perl.aon +8 -0
  25. package/project/.sdk/model/target/php.aon +8 -0
  26. package/project/.sdk/model/target/py.aon +13 -0
  27. package/project/.sdk/model/target/rb.aon +8 -0
  28. package/project/.sdk/model/target/rust.aon +10 -0
  29. package/project/.sdk/model/target/scala.aon +21 -2
  30. package/project/.sdk/model/target/swift.aon +18 -0
  31. package/project/.sdk/model/target/ts.aon +13 -0
  32. package/project/.sdk/src/cmp/clojure/Package_clojure.ts +9 -2
  33. package/project/.sdk/src/cmp/cpp/Gitignore_cpp.ts +3 -0
  34. package/project/.sdk/src/cmp/dart/Test_dart.ts +2 -0
  35. package/project/.sdk/src/cmp/elixir/Package_elixir.ts +4 -1
  36. package/project/.sdk/src/cmp/go/Config_go.ts +59 -2
  37. package/project/.sdk/src/cmp/go/Main_go.ts +8 -2
  38. package/project/.sdk/src/cmp/java/Test_java.ts +6 -5
  39. package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +6 -5
  40. package/project/.sdk/src/cmp/lean/Package_lean.ts +23 -0
  41. package/project/.sdk/src/cmp/lean/ReadmeInstall_lean.ts +1 -0
  42. package/project/.sdk/src/cmp/lean/ReadmeTopTest_lean.ts +1 -0
  43. package/project/.sdk/src/cmp/ocaml/Gitignore_ocaml.ts +1 -0
  44. package/project/.sdk/src/cmp/ocaml/Main_ocaml.ts +7 -3
  45. package/project/.sdk/src/cmp/py/Config_py.ts +82 -1
  46. package/project/.sdk/src/cmp/py/Main_py.ts +44 -0
  47. package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +2 -0
  48. package/project/.sdk/src/cmp/swift/Main_swift.ts +10 -0
  49. package/project/.sdk/src/cmp/swift/Package_swift.ts +13 -1
  50. package/project/.sdk/src/cmp/ts/Config_ts.ts +42 -17
  51. package/project/.sdk/src/cmp/ts/fragment/Config.data.fragment.ts +13 -1
  52. package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +13 -1
  53. package/project/.sdk/tm/c/Makefile +38 -3
  54. package/project/.sdk/tm/c/tests/omni_resolver.h +361 -0
  55. package/project/.sdk/tm/c/tests/omni_smoke_test.c +237 -0
  56. package/project/.sdk/tm/c/tests/primary_corpus_test.c +205 -284
  57. package/project/.sdk/tm/c/tests/struct_corpus_test.c +292 -212
  58. package/project/.sdk/tm/c/tests/vendor/omni/json.c +811 -0
  59. package/project/.sdk/tm/c/tests/vendor/omni/omni.h +240 -0
  60. package/project/.sdk/tm/c/tests/vendor/omni/runner.c +940 -0
  61. package/project/.sdk/tm/c/tests/vendor/omni/util.c +351 -0
  62. package/project/.sdk/tm/c/utility/struct/utility.c +7 -2
  63. package/project/.sdk/tm/clojure/test/sdk/test/omni.clj +401 -0
  64. package/project/.sdk/tm/clojure/test/sdk/test/omni_smoke.clj +81 -0
  65. package/project/.sdk/tm/clojure/test/sdk/test/primary.clj +92 -58
  66. package/project/.sdk/tm/clojure/test/sdk/test/struct_corpus.clj +122 -149
  67. package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +8 -3
  68. package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/json.clj +145 -0
  69. package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/runner.clj +445 -0
  70. package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/util.clj +145 -0
  71. package/project/.sdk/tm/cpp/Makefile +5 -1
  72. package/project/.sdk/tm/cpp/test/omni_resolver.hpp +473 -0
  73. package/project/.sdk/tm/cpp/test/omni_smoke_test.cpp +209 -0
  74. package/project/.sdk/tm/cpp/test/primary_utility_test.cpp +243 -184
  75. package/project/.sdk/tm/cpp/test/runner_support.hpp +68 -181
  76. package/project/.sdk/tm/cpp/test/struct_corpus_test.cpp +183 -56
  77. package/project/.sdk/tm/cpp/test/vendor/omni/json.hpp +406 -0
  78. package/project/.sdk/tm/cpp/test/vendor/omni/omni.hpp +751 -0
  79. package/project/.sdk/tm/cpp/test/vendor/omni/util.hpp +256 -0
  80. package/project/.sdk/tm/cpp/utility/pipeline.hpp +7 -1
  81. package/project/.sdk/tm/csharp/test/OmniResolver.cs +491 -0
  82. package/project/.sdk/tm/csharp/test/OmniSmokeTest.cs +106 -0
  83. package/project/.sdk/tm/csharp/test/PrimaryUtilityTest.cs +299 -316
  84. package/project/.sdk/tm/csharp/test/Runner.cs +104 -269
  85. package/project/.sdk/tm/csharp/test/StructUtilityTest.cs +535 -724
  86. package/project/.sdk/tm/csharp/test/vendor/omni/Runner.cs +864 -0
  87. package/project/.sdk/tm/csharp/test/vendor/omni/Util.cs +347 -0
  88. package/project/.sdk/tm/csharp/utility/MakeSpec.cs +3 -1
  89. package/project/.sdk/tm/csharp/utility/PrepareMethod.cs +6 -1
  90. package/project/.sdk/tm/csharp/utility/struct/Struct.cs +21 -5
  91. package/project/.sdk/tm/dart/test/omni.dart +520 -0
  92. package/project/.sdk/tm/dart/test/omni_smoke_test.dart +143 -0
  93. package/project/.sdk/tm/dart/test/primary_test.dart +86 -28
  94. package/project/.sdk/tm/dart/test/struct_test.dart +438 -11
  95. package/project/.sdk/tm/dart/test/vendor/omni/omni.dart +7 -0
  96. package/project/.sdk/tm/dart/test/vendor/omni/runner.dart +653 -0
  97. package/project/.sdk/tm/dart/test/vendor/omni/util.dart +232 -0
  98. package/project/.sdk/tm/elixir/Makefile +11 -3
  99. package/project/.sdk/tm/elixir/test/omni_smoke_test.exs +117 -0
  100. package/project/.sdk/tm/elixir/test/primary_utility_test.exs +341 -16
  101. package/project/.sdk/tm/elixir/test/struct_corpus_test.exs +554 -9
  102. package/project/.sdk/tm/elixir/test/support/omni.ex +377 -0
  103. package/project/.sdk/tm/elixir/test/vendor/omni/json.ex +122 -0
  104. package/project/.sdk/tm/elixir/test/vendor/omni/runner.ex +623 -0
  105. package/project/.sdk/tm/elixir/test/vendor/omni/util.ex +187 -0
  106. package/project/.sdk/tm/go/core/context.go +32 -16
  107. package/project/.sdk/tm/go/feature/secrets/plugin/capability.go +261 -0
  108. package/project/.sdk/tm/go/feature/secrets/plugin/catalog.go +78 -0
  109. package/project/.sdk/tm/go/feature/secrets/plugin/config.go +652 -0
  110. package/project/.sdk/tm/go/feature/secrets/plugin/depend.go +250 -0
  111. package/project/.sdk/tm/go/feature/secrets/plugin/env.go +194 -0
  112. package/project/.sdk/tm/go/feature/secrets/plugin/export.go +80 -0
  113. package/project/.sdk/tm/go/feature/secrets/plugin/graph.go +238 -0
  114. package/project/.sdk/tm/go/feature/secrets/plugin/host.go +1575 -0
  115. package/project/.sdk/tm/go/feature/secrets/plugin/order.go +248 -0
  116. package/project/.sdk/tm/go/feature/secrets/plugin/point.go +184 -0
  117. package/project/.sdk/tm/go/feature/secrets/plugin/ref.go +123 -0
  118. package/project/.sdk/tm/go/feature/secrets/plugin/resolve.go +79 -0
  119. package/project/.sdk/tm/go/feature/secrets/plugin/types.go +296 -0
  120. package/project/.sdk/tm/go/feature/secrets/plugin/util.go +87 -0
  121. package/project/.sdk/tm/go/feature/secrets/plugin/version.go +161 -0
  122. package/project/.sdk/tm/go/feature/secrets/plugins/aws/aws.go +292 -0
  123. package/project/.sdk/tm/go/feature/secrets/plugins/aws/sigv4.go +201 -0
  124. package/project/.sdk/tm/go/feature/secrets/plugins/azuresecrets/azuresecrets.go +187 -0
  125. package/project/.sdk/tm/go/feature/secrets/plugins/boru/boru.go +184 -0
  126. package/project/.sdk/tm/go/feature/secrets/plugins/doppler/doppler.go +114 -0
  127. package/project/.sdk/tm/go/feature/secrets/plugins/gcpsecrets/gcpsecrets.go +156 -0
  128. package/project/.sdk/tm/go/feature/secrets/plugins/hashicorp/hashicorp.go +209 -0
  129. package/project/.sdk/tm/go/feature/secrets/plugins/httpjson/httpjson.go +241 -0
  130. package/project/.sdk/tm/go/feature/secrets/plugins/infisical/infisical.go +151 -0
  131. package/project/.sdk/tm/go/feature/secrets/plugins/onepassword/onepassword.go +152 -0
  132. package/project/.sdk/tm/go/feature/secrets/plugins/secretspec/secretspec.go +143 -0
  133. package/project/.sdk/tm/go/feature/secrets/sekreto/addr.go +120 -0
  134. package/project/.sdk/tm/go/feature/secrets/sekreto/providers.go +439 -0
  135. package/project/.sdk/tm/go/feature/secrets/sekreto/sekreto.go +685 -0
  136. package/project/.sdk/tm/go/feature/secrets_feature.go +675 -0
  137. package/project/.sdk/tm/go/src/feature/secrets/.gitkeep +0 -0
  138. package/project/.sdk/tm/go/test/feature/secrets/secrets_feature_test.go +799 -0
  139. package/project/.sdk/tm/go/test/omni/omni.go +897 -0
  140. package/project/.sdk/tm/go/test/omni/util.go +360 -0
  141. package/project/.sdk/tm/go/test/omniresolver_test.go +748 -0
  142. package/project/.sdk/tm/go/test/omnismoke_test.go +112 -0
  143. package/project/.sdk/tm/go/test/primary_utility_test.go +123 -191
  144. package/project/.sdk/tm/go/test/struct_utility_test.go +323 -16
  145. package/project/.sdk/tm/go/test/testsupport_test.go +294 -0
  146. package/project/.sdk/tm/go/utility/make_options.go +8 -1
  147. package/project/.sdk/tm/go/utility/prepare_method.go +5 -1
  148. package/project/.sdk/tm/go/utility/struct/voxgigstruct.go +2 -2
  149. package/project/.sdk/tm/java/test/OmniResolver.java +355 -0
  150. package/project/.sdk/tm/java/test/OmniSmokeTest.java +99 -0
  151. package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +254 -280
  152. package/project/.sdk/tm/java/test/RunnerSupport.java +9 -194
  153. package/project/.sdk/tm/java/test/StructCorpusTest.java +119 -42
  154. package/project/.sdk/tm/java/test/vendor/omni/Json.java +287 -0
  155. package/project/.sdk/tm/java/test/vendor/omni/Runner.java +851 -0
  156. package/project/.sdk/tm/java/test/vendor/omni/Util.java +322 -0
  157. package/project/.sdk/tm/java/utility/MakeSpec.java +3 -1
  158. package/project/.sdk/tm/java/utility/PrepareMethod.java +5 -5
  159. package/project/.sdk/tm/java/utility/struct/Struct.java +17 -4
  160. package/project/.sdk/tm/js/src/utility/StructUtility.js +3 -3
  161. package/project/.sdk/tm/js/test/omni.js +251 -0
  162. package/project/.sdk/tm/js/test/omni.test.js +105 -0
  163. package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +6 -2
  164. package/project/.sdk/tm/js/test/utility/StructUtility.test.js +27 -2
  165. package/project/.sdk/tm/js/test/vendor/omni/index.js +77 -0
  166. package/project/.sdk/tm/js/test/vendor/omni/runner.js +613 -0
  167. package/project/.sdk/tm/js/test/vendor/omni/util.js +212 -0
  168. package/project/.sdk/tm/kotlin/core/Utility.kt +1 -1
  169. package/project/.sdk/tm/kotlin/test/OmniResolver.kt +343 -0
  170. package/project/.sdk/tm/kotlin/test/OmniSmokeTest.kt +100 -0
  171. package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +244 -262
  172. package/project/.sdk/tm/kotlin/test/RunnerSupport.kt +9 -178
  173. package/project/.sdk/tm/kotlin/test/StructCorpusTest.kt +121 -32
  174. package/project/.sdk/tm/kotlin/test/vendor/omni/Json.kt +264 -0
  175. package/project/.sdk/tm/kotlin/test/vendor/omni/Runner.kt +615 -0
  176. package/project/.sdk/tm/kotlin/test/vendor/omni/Util.kt +139 -0
  177. package/project/.sdk/tm/kotlin/utility/MakeSpecUrl.kt +6 -3
  178. package/project/.sdk/tm/kotlin/utility/Prepare.kt +6 -6
  179. package/project/.sdk/tm/kotlin/utility/struct/Struct.kt +18 -2
  180. package/project/.sdk/tm/lean/Makefile +12 -5
  181. package/project/.sdk/tm/lean/src/SdkUtility.lean +14 -1
  182. package/project/.sdk/tm/lean/test/OmniResolver.lean +358 -0
  183. package/project/.sdk/tm/lean/test/OmniSmoke.lean +174 -0
  184. package/project/.sdk/tm/lean/test/StructCorpus.lean +245 -574
  185. package/project/.sdk/tm/lean/test/TPrimaryUtility.lean +155 -291
  186. package/project/.sdk/tm/lean/test/vendor/omni/Omni.lean +997 -0
  187. package/project/.sdk/tm/lua/test/omni.lua +456 -0
  188. package/project/.sdk/tm/lua/test/omni_smoke_test.lua +103 -0
  189. package/project/.sdk/tm/lua/test/primary_utility_test.lua +250 -509
  190. package/project/.sdk/tm/lua/test/struct_utility_test.lua +161 -70
  191. package/project/.sdk/tm/lua/test/vendor/omni/json.lua +268 -0
  192. package/project/.sdk/tm/lua/test/vendor/omni/regex.lua +385 -0
  193. package/project/.sdk/tm/lua/test/vendor/omni/runner.lua +641 -0
  194. package/project/.sdk/tm/lua/test/vendor/omni/util.lua +282 -0
  195. package/project/.sdk/tm/lua/utility/prepare_method.lua +5 -1
  196. package/project/.sdk/tm/lua/utility/struct/regex.lua +663 -0
  197. package/project/.sdk/tm/lua/utility/struct/struct.lua +660 -420
  198. package/project/.sdk/tm/ocaml/Makefile +37 -12
  199. package/project/.sdk/tm/ocaml/test/omni_resolver.ml +284 -0
  200. package/project/.sdk/tm/ocaml/test/omni_smoke_test.ml +169 -0
  201. package/project/.sdk/tm/ocaml/test/primary_utility_test.ml +84 -100
  202. package/project/.sdk/tm/ocaml/test/struct_corpus.ml +225 -201
  203. package/project/.sdk/tm/ocaml/test/vendor/omni/omni.ml +1157 -0
  204. package/project/.sdk/tm/perl/lib/Voxgig/Struct.pm +88 -12
  205. package/project/.sdk/tm/perl/t/omni.pm +647 -0
  206. package/project/.sdk/tm/perl/t/omni_smoke.t +87 -0
  207. package/project/.sdk/tm/perl/t/primary_utility.t +189 -487
  208. package/project/.sdk/tm/perl/t/struct_utility.t +455 -389
  209. package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni/Runner.pm +649 -0
  210. package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni/Util.pm +253 -0
  211. package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni.pm +24 -0
  212. package/project/.sdk/tm/perl/utility/prepare_method.pm +7 -2
  213. package/project/.sdk/tm/php/test/Omni.php +691 -0
  214. package/project/.sdk/tm/php/test/OmniSmokeTest.php +93 -0
  215. package/project/.sdk/tm/php/test/PrimaryUtilityTest.php +210 -571
  216. package/project/.sdk/tm/php/test/StructUtilityTest.php +320 -342
  217. package/project/.sdk/tm/php/test/vendor/omni/Runner.php +644 -0
  218. package/project/.sdk/tm/php/test/vendor/omni/Util.php +283 -0
  219. package/project/.sdk/tm/php/utility/MakeSpec.php +10 -3
  220. package/project/.sdk/tm/php/utility/PrepareBody.php +7 -1
  221. package/project/.sdk/tm/php/utility/PrepareMethod.php +6 -2
  222. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/__init__.py +36 -0
  223. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/capability.py +141 -0
  224. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/catalog.py +50 -0
  225. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/config.py +333 -0
  226. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/depend.py +198 -0
  227. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/env.py +147 -0
  228. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/export.py +52 -0
  229. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/graph.py +139 -0
  230. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/host.py +1053 -0
  231. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/order.py +171 -0
  232. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/point.py +95 -0
  233. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/ref.py +116 -0
  234. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/resolve.py +59 -0
  235. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/types.py +87 -0
  236. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/version.py +112 -0
  237. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/__init__.py +74 -0
  238. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/addr.py +116 -0
  239. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/aws.py +192 -0
  240. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/azuresecrets.py +120 -0
  241. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/boru.py +140 -0
  242. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/doppler.py +62 -0
  243. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/gcpsecrets.py +101 -0
  244. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/hashicorp.py +152 -0
  245. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/httpjson.py +115 -0
  246. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/infisical.py +92 -0
  247. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/onepassword.py +101 -0
  248. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/secretspec.py +119 -0
  249. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/sigv4.py +125 -0
  250. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/providers.py +211 -0
  251. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/sekreto.py +455 -0
  252. package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +467 -0
  253. package/project/.sdk/tm/py/pkg/utility/prepare_method.py +5 -1
  254. package/project/.sdk/tm/py/pkg/utility/voxgig_struct/__init__.py +0 -2
  255. package/project/.sdk/tm/py/pkg/utility/voxgig_struct/voxgig_struct.py +780 -529
  256. package/project/.sdk/tm/py/src/feature/secrets/.gitkeep +0 -0
  257. package/project/.sdk/tm/py/test/feature/__init__.py +0 -0
  258. package/project/.sdk/tm/py/test/feature/secrets/__init__.py +0 -0
  259. package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +337 -0
  260. package/project/.sdk/tm/py/test/omni.py +415 -0
  261. package/project/.sdk/tm/py/test/test_omni_smoke.py +74 -0
  262. package/project/.sdk/tm/py/test/test_primary_utility.py +144 -668
  263. package/project/.sdk/tm/py/test/test_struct_utility.py +74 -27
  264. package/project/.sdk/tm/py/test/voxgig_omni/__init__.py +62 -0
  265. package/project/.sdk/tm/py/test/voxgig_omni/runner.py +566 -0
  266. package/project/.sdk/tm/py/test/voxgig_omni/util.py +237 -0
  267. package/project/.sdk/tm/rb/test/omni.rb +505 -0
  268. package/project/.sdk/tm/rb/test/omni_smoke_test.rb +72 -0
  269. package/project/.sdk/tm/rb/test/primary_utility_test.rb +174 -560
  270. package/project/.sdk/tm/rb/test/struct_utility_test.rb +13 -7
  271. package/project/.sdk/tm/rb/test/vendor/omni/runner.rb +493 -0
  272. package/project/.sdk/tm/rb/test/vendor/omni/util.rb +199 -0
  273. package/project/.sdk/tm/rb/test/vendor/omni/voxgig_omni.rb +15 -0
  274. package/project/.sdk/tm/rb/utility/prepare_method.rb +5 -1
  275. package/project/.sdk/tm/rust/tests/common/mod.rs +19 -242
  276. package/project/.sdk/tm/rust/tests/omni_resolver/mod.rs +888 -0
  277. package/project/.sdk/tm/rust/tests/omni_smoke_test.rs +286 -0
  278. package/project/.sdk/tm/rust/tests/primary_utility_test.rs +318 -312
  279. package/project/.sdk/tm/rust/tests/struct_utility_test.rs +66 -28
  280. package/project/.sdk/tm/rust/tests/vendor/omni/json.rs +412 -0
  281. package/project/.sdk/tm/rust/tests/vendor/omni/mod.rs +38 -0
  282. package/project/.sdk/tm/rust/tests/vendor/omni/regex.rs +392 -0
  283. package/project/.sdk/tm/rust/tests/vendor/omni/runner.rs +1001 -0
  284. package/project/.sdk/tm/rust/tests/vendor/omni/util.rs +161 -0
  285. package/project/.sdk/tm/rust/utility/prepare_method.rs +5 -1
  286. package/project/.sdk/tm/scala/Makefile +16 -6
  287. package/project/.sdk/tm/scala/sdktest/OmniResolver.scala +497 -0
  288. package/project/.sdk/tm/scala/sdktest/OmniSmoke.scala +192 -0
  289. package/project/.sdk/tm/scala/sdktest/PrimaryCorpus.scala +47 -19
  290. package/project/.sdk/tm/scala/sdktest/StructCorpus.scala +0 -0
  291. package/project/.sdk/tm/scala/sdktest/vendor/omni/Json.scala +229 -0
  292. package/project/.sdk/tm/scala/sdktest/vendor/omni/Runner.scala +552 -0
  293. package/project/.sdk/tm/scala/sdktest/vendor/omni/Util.scala +104 -0
  294. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Constants.swift +10 -0
  295. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Inject.swift +28 -5
  296. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Injection.swift +5 -1
  297. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Minor.swift +4 -1
  298. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Validate.swift +15 -5
  299. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Prepare.swift +6 -1
  300. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/OmniResolver.swift +474 -0
  301. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/OmniSmokeTest.swift +107 -0
  302. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PrimaryUtilityTest.swift +141 -178
  303. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/Runner.swift +17 -113
  304. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/StructUtilityTest.swift +295 -446
  305. package/project/.sdk/tm/swift/Tests/vendor/omni/Json.swift +364 -0
  306. package/project/.sdk/tm/swift/Tests/vendor/omni/Runner.swift +730 -0
  307. package/project/.sdk/tm/swift/Tests/vendor/omni/Util.swift +162 -0
  308. package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +7 -0
  309. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Capability.ts +148 -0
  310. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Catalog.ts +55 -0
  311. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Config.ts +344 -0
  312. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Depend.ts +205 -0
  313. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Env.ts +138 -0
  314. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Export.ts +46 -0
  315. package/project/.sdk/tm/ts/src/feature/secrets/plugin/FeatureHost.ts +349 -0
  316. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Graph.ts +181 -0
  317. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Host.ts +1132 -0
  318. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Order.ts +177 -0
  319. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Point.ts +119 -0
  320. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Ref.ts +102 -0
  321. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Resolve.ts +61 -0
  322. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Types.ts +112 -0
  323. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Version.ts +100 -0
  324. package/project/.sdk/tm/ts/src/feature/secrets/plugin/index.ts +37 -0
  325. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/Sekreto.ts +163 -30
  326. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/index.ts +27 -22
  327. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/aws.ts +26 -36
  328. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/azuresecrets.ts +19 -21
  329. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/boru.ts +36 -17
  330. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/doppler.ts +14 -21
  331. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/gcpsecrets.ts +27 -27
  332. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/hashicorp.ts +25 -39
  333. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/httpjson.ts +99 -0
  334. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/infisical.ts +14 -16
  335. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/onepassword.ts +15 -22
  336. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/secretspec.ts +98 -0
  337. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{Sigv4.ts → plugins/sigv4.ts} +7 -6
  338. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/addr.ts +97 -23
  339. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/builtin.ts +37 -0
  340. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/dotenv.ts +4 -17
  341. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/env.ts +4 -16
  342. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/file.ts +11 -25
  343. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/memory.ts +6 -23
  344. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/support.ts +106 -39
  345. package/project/.sdk/tm/ts/src/utility/StructUtility.ts +3 -3
  346. package/project/.sdk/tm/ts/test/omni.ts +104 -32
  347. package/project/.sdk/tm/ts/test/utility/StructUtility.test.ts +27 -0
  348. package/project/.sdk/tm/ts/test/vendor/omni/Runner.ts +32 -5
  349. package/project/.sdk/tm/ts/test/vendor/omni/Util.ts +2 -2
  350. package/project/.sdk/tm/ts/test/vendor/omni/index.ts +2 -2
  351. package/project/.sdk/tm/zig/test/primary_utility_test.zig +1 -1
  352. package/project/.sdk/tm/zig/test/struct_runner.zig +5 -4
  353. package/project/sdkgen-package.json +1 -1
  354. package/src/action/doctor.ts +66 -2
  355. package/src/helpers/naming.ts +4 -2
  356. package/project/.sdk/tm/c/tests/runner.h +0 -274
  357. package/project/.sdk/tm/cpp/test/struct_runner.hpp +0 -314
  358. package/project/.sdk/tm/csharp/test/StructRunner.cs +0 -276
  359. package/project/.sdk/tm/dart/test/runner.dart +0 -406
  360. package/project/.sdk/tm/dart/test/struct_corpus.dart +0 -531
  361. package/project/.sdk/tm/elixir/test/support/struct_corpus.ex +0 -1088
  362. package/project/.sdk/tm/go/test/runner_test.go +0 -629
  363. package/project/.sdk/tm/go/test/struct_runner_test.go +0 -1094
  364. package/project/.sdk/tm/java/test/StructRunner.java +0 -281
  365. package/project/.sdk/tm/js/test/runner.js +0 -387
  366. package/project/.sdk/tm/kotlin/test/StructRunner.kt +0 -177
  367. package/project/.sdk/tm/lua/test/struct_runner.lua +0 -602
  368. package/project/.sdk/tm/ocaml/test/corpus_runner.ml +0 -185
  369. package/project/.sdk/tm/perl/t/struct_runner.pm +0 -275
  370. package/project/.sdk/tm/php/test/StructRunner.php +0 -275
  371. package/project/.sdk/tm/py/test/struct_runner.py +0 -411
  372. package/project/.sdk/tm/rb/test/struct_runner.rb +0 -309
  373. package/project/.sdk/tm/rust/tests/struct_runner/mod.rs +0 -424
  374. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/Registry.ts +0 -90
  375. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/http.ts +0 -66
  376. package/project/.sdk/tm/ts/test/vendor/omni/compat.ts +0 -188
@@ -0,0 +1,811 @@
1
+ // VENDORED: @voxgig/omni sdk-20260904-1610-0 (c/src/json.c)
2
+ // Source: https://github.com/voxgig/omni @ 8c3e1b573a8d35796f7fc45e3226b977023cabf7 [tag: sdk-20260904-1610-0]
3
+ // License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
4
+ /* The omni JSON value model, pool allocator, parser and printer.
5
+ *
6
+ * The omni runner must be able to test *any* library, and must add no
7
+ * third-party dependencies, so it carries its own JSON support rather than
8
+ * borrowing one or using the system under test.
9
+ */
10
+
11
+ #include <math.h>
12
+ #include <stdio.h>
13
+ #include <stdlib.h>
14
+ #include <string.h>
15
+
16
+ #include "omni.h"
17
+
18
+ /* ---- pool ---------------------------------------------------------- */
19
+
20
+ typedef struct omni_block omni_block;
21
+
22
+ struct omni_block {
23
+ void *ptr;
24
+ omni_block *next;
25
+ };
26
+
27
+ struct omni_pool {
28
+ omni_block *blocks;
29
+ };
30
+
31
+ omni_pool *omni_pool_new(void) {
32
+ omni_pool *pool = (omni_pool *)calloc(1, sizeof(omni_pool));
33
+ return pool;
34
+ }
35
+
36
+ void *omni_pool_alloc(omni_pool *pool, size_t size) {
37
+ void *ptr = calloc(1, size);
38
+ omni_block *block;
39
+
40
+ if (NULL == ptr) {
41
+ return NULL;
42
+ }
43
+
44
+ block = (omni_block *)calloc(1, sizeof(omni_block));
45
+ if (NULL == block) {
46
+ free(ptr);
47
+ return NULL;
48
+ }
49
+
50
+ block->ptr = ptr;
51
+ block->next = pool->blocks;
52
+ pool->blocks = block;
53
+
54
+ return ptr;
55
+ }
56
+
57
+ char *omni_pool_strdup(omni_pool *pool, const char *text) {
58
+ size_t len;
59
+ char *out;
60
+
61
+ if (NULL == text) {
62
+ text = "";
63
+ }
64
+
65
+ len = strlen(text);
66
+ out = (char *)omni_pool_alloc(pool, len + 1);
67
+ if (NULL == out) {
68
+ return NULL;
69
+ }
70
+
71
+ memcpy(out, text, len);
72
+ out[len] = '\0';
73
+
74
+ return out;
75
+ }
76
+
77
+ void omni_pool_free(omni_pool *pool) {
78
+ omni_block *block;
79
+
80
+ if (NULL == pool) {
81
+ return;
82
+ }
83
+
84
+ block = pool->blocks;
85
+ while (NULL != block) {
86
+ omni_block *next = block->next;
87
+ free(block->ptr);
88
+ free(block);
89
+ block = next;
90
+ }
91
+
92
+ free(pool);
93
+ }
94
+
95
+ /* ---- values -------------------------------------------------------- */
96
+
97
+ static omni_json *omni_new(omni_pool *pool, omni_type type) {
98
+ omni_json *val = (omni_json *)omni_pool_alloc(pool, sizeof(omni_json));
99
+ if (NULL == val) {
100
+ return NULL;
101
+ }
102
+ val->type = type;
103
+ val->pool = pool;
104
+ return val;
105
+ }
106
+
107
+ omni_json *omni_absent(omni_pool *pool) { return omni_new(pool, OMNI_ABSENT); }
108
+ omni_json *omni_null(omni_pool *pool) { return omni_new(pool, OMNI_NULL); }
109
+
110
+ omni_json *omni_bool(omni_pool *pool, int val) {
111
+ omni_json *out = omni_new(pool, OMNI_BOOL);
112
+ out->boolval = val ? 1 : 0;
113
+ return out;
114
+ }
115
+
116
+ omni_json *omni_num(omni_pool *pool, double val) {
117
+ omni_json *out = omni_new(pool, OMNI_NUM);
118
+ out->numval = val;
119
+ return out;
120
+ }
121
+
122
+ omni_json *omni_str(omni_pool *pool, const char *val) {
123
+ omni_json *out = omni_new(pool, OMNI_STR);
124
+ out->strval = omni_pool_strdup(pool, val);
125
+ return out;
126
+ }
127
+
128
+ omni_json *omni_list(omni_pool *pool) { return omni_new(pool, OMNI_LIST); }
129
+ omni_json *omni_map(omni_pool *pool) { return omni_new(pool, OMNI_MAP); }
130
+
131
+ /* Pool-backed growth: the old array is kept (and freed with the pool). */
132
+ static void *omni_grow(omni_pool *pool, void *old, size_t entrysize, size_t used, size_t *cap) {
133
+ size_t newcap = (0 == *cap) ? 8 : (*cap * 2);
134
+ void *out = omni_pool_alloc(pool, entrysize * newcap);
135
+
136
+ if (NULL == out) {
137
+ return old;
138
+ }
139
+
140
+ if (NULL != old && 0 < used) {
141
+ memcpy(out, old, entrysize * used);
142
+ }
143
+
144
+ *cap = newcap;
145
+ return out;
146
+ }
147
+
148
+ void omni_list_push(omni_json *list, omni_json *val) {
149
+ if (NULL == list || OMNI_LIST != list->type) {
150
+ return;
151
+ }
152
+
153
+ if (list->listlen >= list->listcap) {
154
+ list->list = (omni_json **)omni_grow(list->pool, list->list, sizeof(omni_json *),
155
+ list->listlen, &list->listcap);
156
+ }
157
+
158
+ list->list[list->listlen++] = val;
159
+ }
160
+
161
+ void omni_map_set(omni_json *map, const char *key, omni_json *val) {
162
+ size_t index;
163
+
164
+ if (NULL == map || OMNI_MAP != map->type) {
165
+ return;
166
+ }
167
+
168
+ for (index = 0; index < map->maplen; index++) {
169
+ if (0 == strcmp(map->keys[index], key)) {
170
+ map->vals[index] = val;
171
+ return;
172
+ }
173
+ }
174
+
175
+ if (map->maplen >= map->mapcap) {
176
+ size_t keycap = map->mapcap;
177
+ size_t valcap = map->mapcap;
178
+ map->keys = (char **)omni_grow(map->pool, map->keys, sizeof(char *), map->maplen, &keycap);
179
+ map->vals =
180
+ (omni_json **)omni_grow(map->pool, map->vals, sizeof(omni_json *), map->maplen, &valcap);
181
+ map->mapcap = keycap;
182
+ }
183
+
184
+ map->keys[map->maplen] = omni_pool_strdup(map->pool, key);
185
+ map->vals[map->maplen] = val;
186
+ map->maplen++;
187
+ }
188
+
189
+ omni_json *omni_map_get(const omni_json *map, const char *key) {
190
+ size_t index;
191
+
192
+ if (NULL == map || OMNI_MAP != map->type) {
193
+ return NULL;
194
+ }
195
+
196
+ for (index = 0; index < map->maplen; index++) {
197
+ if (0 == strcmp(map->keys[index], key)) {
198
+ return map->vals[index];
199
+ }
200
+ }
201
+
202
+ return omni_absent(map->pool);
203
+ }
204
+
205
+ int omni_map_has(const omni_json *map, const char *key) {
206
+ size_t index;
207
+
208
+ if (NULL == map || OMNI_MAP != map->type) {
209
+ return 0;
210
+ }
211
+
212
+ for (index = 0; index < map->maplen; index++) {
213
+ if (0 == strcmp(map->keys[index], key)) {
214
+ return 1;
215
+ }
216
+ }
217
+
218
+ return 0;
219
+ }
220
+
221
+ omni_json *omni_list_get(const omni_json *list, size_t index) {
222
+ if (NULL == list || OMNI_LIST != list->type || index >= list->listlen) {
223
+ return NULL;
224
+ }
225
+ return list->list[index];
226
+ }
227
+
228
+ int omni_ismap(const omni_json *val) { return NULL != val && OMNI_MAP == val->type; }
229
+ int omni_islist(const omni_json *val) { return NULL != val && OMNI_LIST == val->type; }
230
+ int omni_isnode(const omni_json *val) { return omni_ismap(val) || omni_islist(val); }
231
+ int omni_isabsent(const omni_json *val) { return NULL == val || OMNI_ABSENT == val->type; }
232
+ int omni_isnull(const omni_json *val) { return NULL != val && OMNI_NULL == val->type; }
233
+ int omni_isnone(const omni_json *val) { return omni_isabsent(val) || omni_isnull(val); }
234
+ int omni_isnum(const omni_json *val) { return NULL != val && OMNI_NUM == val->type; }
235
+ int omni_isstr(const omni_json *val) { return NULL != val && OMNI_STR == val->type; }
236
+
237
+ const char *omni_strval(const omni_json *val) {
238
+ return omni_isstr(val) ? val->strval : NULL;
239
+ }
240
+
241
+ double omni_numval(const omni_json *val) { return omni_isnum(val) ? val->numval : 0.0; }
242
+
243
+ /* ---- text buffer --------------------------------------------------- */
244
+
245
+ typedef struct {
246
+ omni_pool *pool;
247
+ char *text;
248
+ size_t len;
249
+ size_t cap;
250
+ } omni_buf;
251
+
252
+ static void buf_init(omni_buf *buf, omni_pool *pool) {
253
+ buf->pool = pool;
254
+ buf->cap = 64;
255
+ buf->len = 0;
256
+ buf->text = (char *)omni_pool_alloc(pool, buf->cap);
257
+ if (NULL != buf->text) {
258
+ buf->text[0] = '\0';
259
+ }
260
+ }
261
+
262
+ static void buf_add(omni_buf *buf, const char *text) {
263
+ size_t len = strlen(text);
264
+
265
+ if (buf->len + len + 1 > buf->cap) {
266
+ size_t newcap = buf->cap;
267
+ char *grown;
268
+ while (buf->len + len + 1 > newcap) {
269
+ newcap *= 2;
270
+ }
271
+ grown = (char *)omni_pool_alloc(buf->pool, newcap);
272
+ if (NULL == grown) {
273
+ return;
274
+ }
275
+ memcpy(grown, buf->text, buf->len);
276
+ buf->text = grown;
277
+ buf->cap = newcap;
278
+ }
279
+
280
+ memcpy(buf->text + buf->len, text, len);
281
+ buf->len += len;
282
+ buf->text[buf->len] = '\0';
283
+ }
284
+
285
+ static void buf_addchar(omni_buf *buf, char ch) {
286
+ char text[2];
287
+ text[0] = ch;
288
+ text[1] = '\0';
289
+ buf_add(buf, text);
290
+ }
291
+
292
+ /* ---- number and string rendering ----------------------------------- */
293
+
294
+ char *omni_numstr(omni_pool *pool, double val) {
295
+ char text[64];
296
+
297
+ if (val != val || val > 1e308 * 10 || val < -1e308 * 10) {
298
+ return omni_pool_strdup(pool, "null");
299
+ }
300
+
301
+ if (val == floor(val) && fabs(val) < 9007199254740992.0) {
302
+ snprintf(text, sizeof(text), "%.0f", val);
303
+ /* "-0" is still zero. */
304
+ if (0 == strcmp(text, "-0")) {
305
+ return omni_pool_strdup(pool, "0");
306
+ }
307
+ return omni_pool_strdup(pool, text);
308
+ }
309
+
310
+ snprintf(text, sizeof(text), "%.17g", val);
311
+ return omni_pool_strdup(pool, text);
312
+ }
313
+
314
+ static void buf_quote(omni_buf *buf, const char *text) {
315
+ size_t index;
316
+ char escape[8];
317
+
318
+ buf_addchar(buf, '"');
319
+
320
+ for (index = 0; '\0' != text[index]; index++) {
321
+ unsigned char ch = (unsigned char)text[index];
322
+ switch (ch) {
323
+ case '"':
324
+ buf_add(buf, "\\\"");
325
+ break;
326
+ case '\\':
327
+ buf_add(buf, "\\\\");
328
+ break;
329
+ case '\n':
330
+ buf_add(buf, "\\n");
331
+ break;
332
+ case '\r':
333
+ buf_add(buf, "\\r");
334
+ break;
335
+ case '\t':
336
+ buf_add(buf, "\\t");
337
+ break;
338
+ default:
339
+ if (0x20 > ch) {
340
+ snprintf(escape, sizeof(escape), "\\u%04x", ch);
341
+ buf_add(buf, escape);
342
+ } else {
343
+ buf_addchar(buf, (char)ch);
344
+ }
345
+ }
346
+ }
347
+
348
+ buf_addchar(buf, '"');
349
+ }
350
+
351
+ static void jsonstr_val(omni_buf *buf, const omni_json *val) {
352
+ size_t index;
353
+ size_t inner;
354
+
355
+ if (omni_isabsent(val)) {
356
+ buf_add(buf, "undefined");
357
+ return;
358
+ }
359
+
360
+ switch (val->type) {
361
+ case OMNI_NULL:
362
+ buf_add(buf, "null");
363
+ return;
364
+ case OMNI_BOOL:
365
+ buf_add(buf, val->boolval ? "true" : "false");
366
+ return;
367
+ case OMNI_NUM:
368
+ buf_add(buf, omni_numstr(buf->pool, val->numval));
369
+ return;
370
+ case OMNI_STR:
371
+ buf_quote(buf, val->strval);
372
+ return;
373
+ case OMNI_LIST:
374
+ buf_addchar(buf, '[');
375
+ for (index = 0; index < val->listlen; index++) {
376
+ if (0 < index) {
377
+ buf_addchar(buf, ',');
378
+ }
379
+ jsonstr_val(buf, val->list[index]);
380
+ }
381
+ buf_addchar(buf, ']');
382
+ return;
383
+ case OMNI_MAP: {
384
+ /* Sorted keys, so messages are identical in every port. */
385
+ size_t *order = (size_t *)omni_pool_alloc(buf->pool, sizeof(size_t) * (val->maplen + 1));
386
+ for (index = 0; index < val->maplen; index++) {
387
+ order[index] = index;
388
+ }
389
+ for (index = 1; index < val->maplen; index++) {
390
+ size_t hold = order[index];
391
+ inner = index;
392
+ while (0 < inner && 0 < strcmp(val->keys[order[inner - 1]], val->keys[hold])) {
393
+ order[inner] = order[inner - 1];
394
+ inner--;
395
+ }
396
+ order[inner] = hold;
397
+ }
398
+
399
+ buf_addchar(buf, '{');
400
+ for (index = 0; index < val->maplen; index++) {
401
+ if (0 < index) {
402
+ buf_addchar(buf, ',');
403
+ }
404
+ buf_quote(buf, val->keys[order[index]]);
405
+ buf_addchar(buf, ':');
406
+ jsonstr_val(buf, val->vals[order[index]]);
407
+ }
408
+ buf_addchar(buf, '}');
409
+ return;
410
+ }
411
+ default:
412
+ buf_add(buf, "undefined");
413
+ }
414
+ }
415
+
416
+ char *omni_jsonstr(omni_pool *pool, const omni_json *val) {
417
+ omni_buf buf;
418
+ buf_init(&buf, pool);
419
+ jsonstr_val(&buf, val);
420
+ return buf.text;
421
+ }
422
+
423
+ char *omni_stringify(omni_pool *pool, const omni_json *val) {
424
+ if (omni_isstr(val)) {
425
+ return omni_pool_strdup(pool, val->strval);
426
+ }
427
+ return omni_jsonstr(pool, val);
428
+ }
429
+
430
+ /* ---- parser -------------------------------------------------------- */
431
+
432
+ /* Nesting bound: a value nested deeper than this fails the parse rather
433
+ * than overflowing the C stack. */
434
+ #define OMNI_PARSE_MAXDEPTH 4096
435
+
436
+ typedef struct {
437
+ omni_pool *pool;
438
+ const char *text;
439
+ size_t pos;
440
+ size_t len;
441
+ int depth;
442
+ char *err;
443
+ } omni_parser;
444
+
445
+ static void parse_error(omni_parser *parser, const char *reason) {
446
+ char text[128];
447
+ if (NULL != parser->err) {
448
+ return;
449
+ }
450
+ snprintf(text, sizeof(text), "omni: %s at %lu", reason, (unsigned long)parser->pos);
451
+ parser->err = omni_pool_strdup(parser->pool, text);
452
+ }
453
+
454
+ static void parse_ws(omni_parser *parser) {
455
+ while (parser->pos < parser->len) {
456
+ char ch = parser->text[parser->pos];
457
+ if (' ' == ch || '\t' == ch || '\n' == ch || '\r' == ch) {
458
+ parser->pos++;
459
+ } else {
460
+ break;
461
+ }
462
+ }
463
+ }
464
+
465
+ static omni_json *parse_val(omni_parser *parser);
466
+
467
+ static char *parse_rawstr(omni_parser *parser) {
468
+ omni_buf buf;
469
+
470
+ if (parser->pos >= parser->len || '"' != parser->text[parser->pos]) {
471
+ parse_error(parser, "expected string");
472
+ return NULL;
473
+ }
474
+ parser->pos++;
475
+
476
+ buf_init(&buf, parser->pool);
477
+
478
+ while (parser->pos < parser->len) {
479
+ char ch = parser->text[parser->pos++];
480
+
481
+ if ('"' == ch) {
482
+ return buf.text;
483
+ }
484
+
485
+ if ('\\' != ch) {
486
+ buf_addchar(&buf, ch);
487
+ continue;
488
+ }
489
+
490
+ if (parser->pos >= parser->len) {
491
+ break;
492
+ }
493
+
494
+ ch = parser->text[parser->pos++];
495
+ switch (ch) {
496
+ case '"':
497
+ buf_addchar(&buf, '"');
498
+ break;
499
+ case '\\':
500
+ buf_addchar(&buf, '\\');
501
+ break;
502
+ case '/':
503
+ buf_addchar(&buf, '/');
504
+ break;
505
+ case 'b':
506
+ buf_addchar(&buf, '\b');
507
+ break;
508
+ case 'f':
509
+ buf_addchar(&buf, '\f');
510
+ break;
511
+ case 'n':
512
+ buf_addchar(&buf, '\n');
513
+ break;
514
+ case 'r':
515
+ buf_addchar(&buf, '\r');
516
+ break;
517
+ case 't':
518
+ buf_addchar(&buf, '\t');
519
+ break;
520
+ case 'u': {
521
+ unsigned int code = 0;
522
+ int digit;
523
+ if (parser->pos + 4 > parser->len) {
524
+ parse_error(parser, "bad unicode escape");
525
+ return NULL;
526
+ }
527
+ for (digit = 0; digit < 4; digit++) {
528
+ char hex = parser->text[parser->pos++];
529
+ code *= 16;
530
+ if ('0' <= hex && '9' >= hex) {
531
+ code += (unsigned int)(hex - '0');
532
+ } else if ('a' <= hex && 'f' >= hex) {
533
+ code += (unsigned int)(hex - 'a' + 10);
534
+ } else if ('A' <= hex && 'F' >= hex) {
535
+ code += (unsigned int)(hex - 'A' + 10);
536
+ } else {
537
+ parse_error(parser, "bad unicode escape");
538
+ return NULL;
539
+ }
540
+ }
541
+ /* UTF-8 encode the code point. */
542
+ if (0x80 > code) {
543
+ buf_addchar(&buf, (char)code);
544
+ } else if (0x800 > code) {
545
+ buf_addchar(&buf, (char)(0xC0 | (code >> 6)));
546
+ buf_addchar(&buf, (char)(0x80 | (code & 0x3F)));
547
+ } else {
548
+ buf_addchar(&buf, (char)(0xE0 | (code >> 12)));
549
+ buf_addchar(&buf, (char)(0x80 | ((code >> 6) & 0x3F)));
550
+ buf_addchar(&buf, (char)(0x80 | (code & 0x3F)));
551
+ }
552
+ break;
553
+ }
554
+ default:
555
+ parse_error(parser, "bad escape");
556
+ return NULL;
557
+ }
558
+ }
559
+
560
+ parse_error(parser, "unterminated string");
561
+ return NULL;
562
+ }
563
+
564
+ static omni_json *parse_map(omni_parser *parser) {
565
+ omni_json *out = omni_map(parser->pool);
566
+ parser->pos++; /* { */
567
+
568
+ parse_ws(parser);
569
+ if (parser->pos < parser->len && '}' == parser->text[parser->pos]) {
570
+ parser->pos++;
571
+ return out;
572
+ }
573
+
574
+ for (;;) {
575
+ char *key;
576
+ omni_json *val;
577
+
578
+ parse_ws(parser);
579
+ key = parse_rawstr(parser);
580
+ if (NULL == key) {
581
+ return NULL;
582
+ }
583
+
584
+ parse_ws(parser);
585
+ if (parser->pos >= parser->len || ':' != parser->text[parser->pos]) {
586
+ parse_error(parser, "expected ':'");
587
+ return NULL;
588
+ }
589
+ parser->pos++;
590
+
591
+ parse_ws(parser);
592
+ val = parse_val(parser);
593
+ if (NULL == val) {
594
+ return NULL;
595
+ }
596
+ omni_map_set(out, key, val);
597
+
598
+ parse_ws(parser);
599
+ if (parser->pos >= parser->len) {
600
+ parse_error(parser, "unterminated object");
601
+ return NULL;
602
+ }
603
+ if (',' == parser->text[parser->pos]) {
604
+ parser->pos++;
605
+ continue;
606
+ }
607
+ if ('}' == parser->text[parser->pos]) {
608
+ parser->pos++;
609
+ return out;
610
+ }
611
+
612
+ parse_error(parser, "expected ',' or '}'");
613
+ return NULL;
614
+ }
615
+ }
616
+
617
+ static omni_json *parse_list(omni_parser *parser) {
618
+ omni_json *out = omni_list(parser->pool);
619
+ parser->pos++; /* [ */
620
+
621
+ parse_ws(parser);
622
+ if (parser->pos < parser->len && ']' == parser->text[parser->pos]) {
623
+ parser->pos++;
624
+ return out;
625
+ }
626
+
627
+ for (;;) {
628
+ omni_json *val;
629
+
630
+ parse_ws(parser);
631
+ val = parse_val(parser);
632
+ if (NULL == val) {
633
+ return NULL;
634
+ }
635
+ omni_list_push(out, val);
636
+
637
+ parse_ws(parser);
638
+ if (parser->pos >= parser->len) {
639
+ parse_error(parser, "unterminated array");
640
+ return NULL;
641
+ }
642
+ if (',' == parser->text[parser->pos]) {
643
+ parser->pos++;
644
+ continue;
645
+ }
646
+ if (']' == parser->text[parser->pos]) {
647
+ parser->pos++;
648
+ return out;
649
+ }
650
+
651
+ parse_error(parser, "expected ',' or ']'");
652
+ return NULL;
653
+ }
654
+ }
655
+
656
+ static int parse_word(omni_parser *parser, const char *word) {
657
+ size_t len = strlen(word);
658
+ if (parser->pos + len > parser->len ||
659
+ 0 != strncmp(parser->text + parser->pos, word, len)) {
660
+ parse_error(parser, "bad literal");
661
+ return 0;
662
+ }
663
+ parser->pos += len;
664
+ return 1;
665
+ }
666
+
667
+ static omni_json *parse_num(omni_parser *parser) {
668
+ size_t start = parser->pos;
669
+ char text[64];
670
+ char *end;
671
+ size_t len;
672
+ double val;
673
+
674
+ if (parser->pos < parser->len &&
675
+ ('-' == parser->text[parser->pos] || '+' == parser->text[parser->pos])) {
676
+ parser->pos++;
677
+ }
678
+
679
+ while (parser->pos < parser->len) {
680
+ char ch = parser->text[parser->pos];
681
+ if (('0' <= ch && '9' >= ch) || '.' == ch || 'e' == ch || 'E' == ch || '-' == ch ||
682
+ '+' == ch) {
683
+ parser->pos++;
684
+ } else {
685
+ break;
686
+ }
687
+ }
688
+
689
+ len = parser->pos - start;
690
+ if (0 == len || len >= sizeof(text)) {
691
+ parse_error(parser, "bad number");
692
+ return NULL;
693
+ }
694
+
695
+ memcpy(text, parser->text + start, len);
696
+ text[len] = '\0';
697
+
698
+ /* The number must consume exactly the scanned run: `1-2` scans as one
699
+ * token, strtod stops at the `-`, and the remainder is garbage, not a
700
+ * number. Silently keeping the prefix would accept malformed JSON. */
701
+ end = NULL;
702
+ val = strtod(text, &end);
703
+ if (end != text + len) {
704
+ parse_error(parser, "bad number");
705
+ return NULL;
706
+ }
707
+
708
+ return omni_num(parser->pool, val);
709
+ }
710
+
711
+ static omni_json *parse_val(omni_parser *parser) {
712
+ char ch;
713
+
714
+ if (parser->pos >= parser->len) {
715
+ parse_error(parser, "unexpected end of JSON");
716
+ return NULL;
717
+ }
718
+
719
+ ch = parser->text[parser->pos];
720
+
721
+ if ('{' == ch || '[' == ch) {
722
+ omni_json *out;
723
+
724
+ if (OMNI_PARSE_MAXDEPTH <= parser->depth) {
725
+ parse_error(parser, "too deeply nested");
726
+ return NULL;
727
+ }
728
+
729
+ parser->depth++;
730
+ out = '{' == ch ? parse_map(parser) : parse_list(parser);
731
+ parser->depth--;
732
+ return out;
733
+ }
734
+ if ('"' == ch) {
735
+ char *text = parse_rawstr(parser);
736
+ return NULL == text ? NULL : omni_str(parser->pool, text);
737
+ }
738
+ if ('t' == ch) {
739
+ return parse_word(parser, "true") ? omni_bool(parser->pool, 1) : NULL;
740
+ }
741
+ if ('f' == ch) {
742
+ return parse_word(parser, "false") ? omni_bool(parser->pool, 0) : NULL;
743
+ }
744
+ if ('n' == ch) {
745
+ return parse_word(parser, "null") ? omni_null(parser->pool) : NULL;
746
+ }
747
+
748
+ return parse_num(parser);
749
+ }
750
+
751
+ omni_json *omni_parse(omni_pool *pool, const char *text, char **errout) {
752
+ omni_parser parser;
753
+ omni_json *val;
754
+
755
+ parser.pool = pool;
756
+ parser.text = text;
757
+ parser.pos = 0;
758
+ parser.len = strlen(text);
759
+ parser.depth = 0;
760
+ parser.err = NULL;
761
+
762
+ parse_ws(&parser);
763
+ val = parse_val(&parser);
764
+ parse_ws(&parser);
765
+
766
+ if (NULL != val && parser.pos < parser.len) {
767
+ parse_error(&parser, "trailing content");
768
+ val = NULL;
769
+ }
770
+
771
+ if (NULL != errout) {
772
+ *errout = parser.err;
773
+ }
774
+
775
+ return val;
776
+ }
777
+
778
+ char *omni_readfile(omni_pool *pool, const char *path) {
779
+ FILE *handle = fopen(path, "rb");
780
+ char *text;
781
+ long size;
782
+ size_t got;
783
+
784
+ if (NULL == handle) {
785
+ return NULL;
786
+ }
787
+
788
+ if (0 != fseek(handle, 0, SEEK_END)) {
789
+ fclose(handle);
790
+ return NULL;
791
+ }
792
+
793
+ size = ftell(handle);
794
+ if (0 > size) {
795
+ fclose(handle);
796
+ return NULL;
797
+ }
798
+ rewind(handle);
799
+
800
+ text = (char *)omni_pool_alloc(pool, (size_t)size + 1);
801
+ if (NULL == text) {
802
+ fclose(handle);
803
+ return NULL;
804
+ }
805
+
806
+ got = fread(text, 1, (size_t)size, handle);
807
+ text[got] = '\0';
808
+ fclose(handle);
809
+
810
+ return text;
811
+ }