@voxgig/sdkgen 4.8.2 → 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 +1 -1
  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
@@ -1,477 +1,361 @@
1
- // Struct corpus runner loads ../../../.sdk/test/test.json and exercises every
2
- // subsystem the canonical TS test suite drives.
1
+ // Drives the shared struct corpus (../../../.sdk/test/test.json, root key
2
+ // "struct") against the vendored struct utility THROUGH the vendored omni
3
+ // runner (OmniResolver over Tests/vendor/omni) - the engine half of the
4
+ // hand-written runner this file used to carry. Mirrors
5
+ // tm/csharp/test/StructUtilityTest.cs and tm/go/test/struct_utility_test.go.
6
+ //
7
+ // What changed with the migration, and why each change is load-bearing:
8
+ //
9
+ // - A missing or EMPTY category/section now FAILS. The retired inline
10
+ // engine returned early whenever a section did not resolve to a list,
11
+ // so `testSentinels` drove a category called "sentinels" that the
12
+ // corpus renamed to "nullsem" LONG AGO and reported PASS over zero
13
+ // assertions for every one of its 33 entries.
14
+ //
15
+ // - `err:` entries now RUN. The retired engine skipped every entry
16
+ // carrying one ("not yet wired uniformly"), which silently dropped 55
17
+ // cases - all of validate.invalid and transform.apply among them.
18
+ // Struct's Swift port COLLECTS diagnostics in `Injection.errs` instead
19
+ // of raising (unlike the C#/TS ports, which throw), so the validate and
20
+ // transform subjects below collect and raise them; the messages
21
+ // asserted are the port's own.
22
+ //
23
+ // - `match:` entries now RUN. The retired engine compared `out` only, so
24
+ // `minor.setpath` and `merge.integrity` - thirteen entries whose whole
25
+ // point is `match: {args: ...}`, i.e. what the call did to its
26
+ // ARGUMENTS - asserted nothing about that. Subjects therefore no longer
27
+ // clone their input: an in-place rewrite has to be visible.
28
+ //
29
+ // - `.noval` and `.null` are DISTINCT. The retired engine's canonical
30
+ // comparison folded them together; omni's `null` flag decides per
31
+ // section, and the flags below track csharp's.
32
+ //
33
+ // RUN: cd swift && swift test
34
+ // RUN-SOME: swift test --filter StructUtilityTest.testMinor
3
35
 
36
+ import Foundation
4
37
  import XCTest
5
38
 
6
39
  @testable import ProjectNameSdk
7
40
 
8
- private let CORPUS_PATH =
9
- (URL(fileURLWithPath: #filePath)
10
- .deletingLastPathComponent() // ProjectNameSDKTests/
11
- .deletingLastPathComponent() // Tests/
12
- .deletingLastPathComponent() // swift/ (generated SDK root)
13
- .deletingLastPathComponent() // <project>/ (holds .sdk/)
14
- .appendingPathComponent(".sdk")
15
- .appendingPathComponent("test")
16
- .appendingPathComponent("test.json"))
17
-
18
- private let NULLMARK = "__NULL__"
19
-
20
- // Apply the canonical NULLMARK fixup: replace every JSON null with the
21
- // sentinel string "__NULL__" so "stored null" vs "absent" survives the
22
- // otherwise lossy round-trip through the test entry.
23
- private func fixNull(_ v: Value) -> Value {
24
- switch v {
25
- case .null: return .string(NULLMARK)
26
- case .list(let l): return .list(l.items.map { fixNull($0) })
27
- case .map(let m):
28
- let nm = VMap()
29
- for (k, vv) in m.entries { nm.entries[k] = fixNull(vv) }
30
- return .map(nm)
31
- default: return v
41
+ final class StructUtilityTest: XCTestCase {
42
+
43
+ // One corpus runner for the whole suite (XCTest builds a fresh instance
44
+ // per test method, so the runner is static).
45
+ private static var RUN: OmniResolver.Run?
46
+ private static let runLock = NSLock()
47
+
48
+ private static func structRun() throws -> OmniResolver.Run {
49
+ runLock.lock()
50
+ defer { runLock.unlock() }
51
+ if let run = RUN { return run }
52
+ let run = try OmniResolver.makeRunner(
53
+ SdkRunner.testJsonPath(), ProjectNameSDK.testSDK(nil, nil))("struct")
54
+ RUN = run
55
+ return run
32
56
  }
33
- }
34
57
 
35
- // Modifier that mirrors test/runner.ts `nullModifier`. Swaps any string
36
- // `"__NULL__"` slot for actual JSON null, and replaces embedded
37
- // "__NULL__" substrings with the literal string "null".
38
- private func nullModifier(_ val: Value, _ key: Value, _ parent: Value, _ inj: Injection, _ store: Value) {
39
- if case .string(let s) = val {
40
- if s == NULLMARK {
41
- setprop(parent, key, .null)
42
- } else if s.contains(NULLMARK) {
43
- setprop(parent, key, .string(s.replacingOccurrences(of: NULLMARK, with: "null")))
58
+ // Run one corpus section through the vendored engine, failing loudly when
59
+ // the category, the section, or its `set` is missing or EMPTY - a renamed
60
+ // fixture must not report PASS while running zero assertions. The case
61
+ // count is printed so a collapse is visible in the log, not just in a
62
+ // red/green bit.
63
+ private func runStruct(
64
+ _ category: String, _ name: String, _ nullFlag: Bool,
65
+ _ subject: @escaping (Value) throws -> Value,
66
+ file: StaticString = #filePath, line: UInt = #line
67
+ ) {
68
+ let label = category + "." + name
69
+ do {
70
+ let run = try StructUtilityTest.structRun()
71
+
72
+ let cat = run.spec.get(category)
73
+ guard cat.isMap else {
74
+ return XCTFail(
75
+ "struct corpus category missing: \(category) - check .sdk/test/struct/",
76
+ file: file, line: line)
77
+ }
78
+
79
+ let section = cat.get(name)
80
+ guard section.isMap else {
81
+ return XCTFail(
82
+ "struct corpus section missing: \(label) - check .sdk/test/struct/",
83
+ file: file, line: line)
84
+ }
85
+
86
+ guard let count = section.setCount else {
87
+ return XCTFail(
88
+ "struct corpus section has no set list: \(label) - zero cases would run",
89
+ file: file, line: line)
90
+ }
91
+ guard 0 < count else {
92
+ return XCTFail(
93
+ "struct corpus section is EMPTY: \(label) - zero cases would run",
94
+ file: file, line: line)
95
+ }
96
+
97
+ try run.runsetflags(section, nullFlag) { args in
98
+ try subject(args.first ?? .noval)
99
+ }
100
+
101
+ print("ok \(label): \(count)/\(count)")
102
+ } catch {
103
+ XCTFail("\(label): \(OmniResolver.message(error))", file: file, line: line)
44
104
  }
45
105
  }
46
- }
47
106
 
48
- // Stable JSON-string with sorted map keys so per-port map order doesn't
49
- // flap the equality check (matches the way other-port runners compare
50
- // via deepStrictEqual / canonical jsonify). At the test-runner level we
51
- // treat NOVAL and NULL as equivalent — the canonical TS runner roundtrips
52
- // values through JSON.stringify which erases the distinction.
53
- private func canon(_ v: Value) -> String {
54
- let normalised = normaliseAbsent(v)
55
- return stringify(normalised)
56
- }
107
+ // A section of the corpus in the SDK's value model, for the few subjects
108
+ // that need to read fixture data directly.
109
+ private func section(_ category: String, _ name: String) throws -> Value {
110
+ try StructUtilityTest.structRun().spec.get([category, name]).value
111
+ }
112
+
113
+ // MARK: - Local helpers
114
+
115
+ private func intArg(_ v: Value) -> Int? { v.asInt.map(Int.init) }
57
116
 
58
- private func normaliseAbsent(_ v: Value) -> Value {
59
- switch v {
60
- case .noval: return .null
61
- case .list(let l):
62
- return .list(l.items.map { normaliseAbsent($0) })
63
- case .map(let m):
64
- let nm = VMap()
65
- for (k, vv) in m.entries { nm.entries[k] = normaliseAbsent(vv) }
66
- return .map(nm)
67
- default: return v
117
+ // A RAW fixture read. `gp`/`getprop` is Group A - a stored null reads as
118
+ // absent - so reading a fixture field with it collapses the very
119
+ // distinction the `null: false` sections exist to test (an explicit
120
+ // `alt: null` arrived as "no alt", and `data: null` as "no data").
121
+ // `lookup` is Group B: the stored value, null included, and `.noval` only
122
+ // when the key is genuinely missing.
123
+ private func raw(_ v: Value, _ key: String) -> Value { lookup(v, .string(key)) }
124
+
125
+ // An Injection whose `errs` list this suite holds, so the diagnostics
126
+ // struct's Swift port COLLECTS can be raised as the failure the corpus
127
+ // `err:` entries expect. (The C# port raises them from inside Validate;
128
+ // the Swift port does not - see the header note.)
129
+ private func errCollector() -> (Injection, VList) {
130
+ let inj = Injection(val: .noval, parent: .noval)
131
+ let errs = VList()
132
+ inj.errs = errs
133
+ return (inj, errs)
68
134
  }
69
- }
70
135
 
71
- final class StructUtilityTest: XCTestCase {
72
- private func loadStructSpec() -> Value {
73
- do {
74
- let text = try String(contentsOf: CORPUS_PATH, encoding: .utf8)
75
- let spec = try JSON.parse(text)
76
- return getprop(spec, .string("struct"))
77
- } catch {
78
- XCTFail("Failed to load corpus at \(CORPUS_PATH.path): \(error)")
79
- return .noval
80
- }
136
+ private func raiseErrs(_ errs: VList) throws {
137
+ if errs.items.isEmpty { return }
138
+ throw OmniResolver.SubjectError(
139
+ errs.items.map { stringify($0) }.joined(separator: " | "))
81
140
  }
82
141
 
83
- private func runset(_ label: String, _ entries: Value, _ subject: (Value) -> Value) {
84
- guard case .list(let l) = entries else { return }
85
- var pass = 0
86
- var fails: [String] = []
87
- for (i, entry) in l.items.enumerated() {
88
- guard case .map(let em) = entry else { continue }
89
- let inVal = em.entries["in"] ?? .noval
90
- // Skip entries with an `err:` field — those exercise error
91
- // collection, which is not yet wired uniformly.
92
- if em.entries["err"] != nil { continue }
93
- let expected = em.entries["out"] ?? .noval
94
- let got = subject(inVal)
95
- let exp = canon(expected)
96
- let gotS = canon(got)
97
- if exp == gotS { pass += 1 } else { fails.append("[\(label)#\(i)] exp=\(exp) got=\(gotS)") }
98
- }
99
- if !fails.isEmpty {
100
- for f in fails.prefix(5) { print(f) }
101
- XCTFail("\(label): \(pass)/\(pass + fails.count) — \(fails.count) failed")
102
- } else {
103
- print("ok \(label): \(pass)/\(pass)")
104
- }
142
+ // MARK: - Existence
143
+
144
+ func testMinorExists() {
145
+ XCTAssertFalse(isnode(.noval))
146
+ XCTAssertTrue(isnode(.map(VMap())))
147
+ XCTAssertEqual(typename(T_string), S_string)
148
+ XCTAssertEqual(escre(.string("a.b")), "a\\.b")
105
149
  }
106
150
 
107
151
  // MARK: - Minor
108
152
 
109
153
  func testMinor() {
110
- let s = loadStructSpec()
111
- guard case .map(let minor) = getprop(s, .string("minor")) else {
112
- return XCTFail("missing minor")
154
+ runStruct("minor", "isnode", true) { .bool(isnode($0)) }
155
+ runStruct("minor", "ismap", true) { .bool(ismap($0)) }
156
+ runStruct("minor", "islist", true) { .bool(islist($0)) }
157
+ runStruct("minor", "iskey", false) { .bool(iskey($0)) }
158
+ runStruct("minor", "isempty", false) { .bool(isempty($0)) }
159
+ runStruct("minor", "isfunc", true) { .bool(isfunc($0)) }
160
+ runStruct("minor", "size", false) { .int(Int64(size($0))) }
161
+ runStruct("minor", "typify", false) { .int(Int64(typify($0))) }
162
+ runStruct("minor", "typename", true) { .string(typename(Int($0.asInt ?? 0))) }
163
+ runStruct("minor", "strkey", false) { .string(strkey($0)) }
164
+ runStruct("minor", "keysof", true) { .list(keysof($0).map { Value.string($0) }) }
165
+ runStruct("minor", "clone", false) { clone($0) }
166
+ runStruct("minor", "escre", true) { .string(escre($0)) }
167
+ runStruct("minor", "escurl", true) { .string(escurl($0)) }
168
+ runStruct("minor", "items", true) { .list(items($0).map { Value.list($0) }) }
169
+
170
+ runStruct("minor", "haskey", false) {
171
+ .bool(haskey(gp($0, "src"), gp($0, "key")))
172
+ }
173
+ runStruct("minor", "getprop", false) {
174
+ getprop(gp($0, "val"), gp($0, "key"), self.raw($0, "alt"))
175
+ }
176
+ runStruct("minor", "getelem", false) {
177
+ getelem(gp($0, "val"), gp($0, "key"), gp($0, "alt"))
178
+ }
179
+ runStruct("minor", "stringify", false) {
180
+ if case .map(let m) = $0 {
181
+ return .string(stringify(m.entries["val"] ?? .noval,
182
+ m.entries["max"]?.asInt.map(Int.init)))
183
+ }
184
+ return .string(stringify($0))
185
+ }
186
+ runStruct("minor", "jsonify", false) {
187
+ var indent = 2
188
+ var offset = 0
189
+ let flags = gp($0, "flags")
190
+ if case .map = flags {
191
+ if case .int(let n) = gp(flags, "indent") { indent = Int(n) }
192
+ if case .int(let n) = gp(flags, "offset") { offset = Int(n) }
193
+ }
194
+ return .string(jsonify(lookup($0, .string("val")), indent: indent, offset: offset))
195
+ }
196
+ runStruct("minor", "pathify", false) {
197
+ .string(pathify(lookup($0, .string("path")), self.intArg(gp($0, "from"))))
198
+ }
199
+ runStruct("minor", "flatten", true) {
200
+ flatten(gp($0, "val"), self.intArg(gp($0, "depth")))
201
+ }
202
+ runStruct("minor", "filter", true) {
203
+ let checks: [String: (Value, Value) -> Bool] = [
204
+ "gt3": { _, v in (v.asDouble ?? 0) > 3 },
205
+ "lt3": { _, v in (v.asDouble ?? 0) < 3 },
206
+ ]
207
+ let check = strkey(gp($0, "check"))
208
+ return filter(gp($0, "val"), checks[check] ?? { _, _ in false })
209
+ }
210
+ runStruct("minor", "join", false) {
211
+ let sep: String
212
+ if case .string(let s) = gp($0, "sep") { sep = s } else { sep = "," }
213
+ var url = false
214
+ if case .bool(let b) = gp($0, "url") { url = b }
215
+ return .string(join(gp($0, "val"), sep, url))
216
+ }
217
+ runStruct("minor", "slice", false) {
218
+ slice(gp($0, "val"), self.intArg(gp($0, "start")), self.intArg(gp($0, "end")))
219
+ }
220
+ runStruct("minor", "pad", false) {
221
+ let padding = self.intArg(gp($0, "pad"))
222
+ var padchar: Character = " "
223
+ if case .string(let c) = gp($0, "char"), let f = c.first { padchar = f }
224
+ return pad(lookup($0, .string("val")), padding, padchar)
113
225
  }
114
226
 
115
- runset(
116
- "minor.isnode", getprop(.map(minor), .string("isnode")) |> setProp("set"),
117
- { .bool(isnode($0)) })
118
- runset(
119
- "minor.ismap", getprop(.map(minor), .string("ismap")) |> setProp("set"),
120
- { .bool(ismap($0)) })
121
- runset(
122
- "minor.islist", getprop(.map(minor), .string("islist")) |> setProp("set"),
123
- { .bool(islist($0)) })
124
- runset(
125
- "minor.iskey", getprop(.map(minor), .string("iskey")) |> setProp("set"),
126
- { .bool(iskey($0)) })
127
- runset(
128
- "minor.isempty", getprop(.map(minor), .string("isempty")) |> setProp("set"),
129
- { .bool(isempty($0)) })
130
- runset(
131
- "minor.size", getprop(.map(minor), .string("size")) |> setProp("set"),
132
- { .int(Int64(size($0))) })
133
- runset(
134
- "minor.keysof", getprop(.map(minor), .string("keysof")) |> setProp("set"),
135
- { .list(keysof($0).map { Value.string($0) }) })
136
- runset(
137
- "minor.haskey", getprop(.map(minor), .string("haskey")) |> setProp("set"),
138
- { .bool(haskey(getprop($0, .string("src")), getprop($0, .string("key")))) })
139
- runset(
140
- "minor.getprop", getprop(.map(minor), .string("getprop")) |> setProp("set"),
141
- {
142
- getprop(
143
- getprop($0, .string("val")),
144
- getprop($0, .string("key")),
145
- getprop($0, .string("alt")))
146
- })
147
- runset(
148
- "minor.clone", getprop(.map(minor), .string("clone")) |> setProp("set"),
149
- { clone($0) })
150
- runset(
151
- "minor.escre", getprop(.map(minor), .string("escre")) |> setProp("set"),
152
- { .string(escre($0)) })
153
- runset(
154
- "minor.escurl", getprop(.map(minor), .string("escurl")) |> setProp("set"),
155
- { .string(escurl($0)) })
156
- runset(
157
- "minor.stringify", getprop(.map(minor), .string("stringify")) |> setProp("set"),
158
- {
159
- if case .map(let m) = $0 {
160
- let v = m.entries["val"] ?? .noval
161
- let maxlen = m.entries["max"]?.asInt.map(Int.init)
162
- return .string(stringify(v, maxlen))
163
- }
164
- return .string(stringify($0))
165
- })
166
-
167
- func mset(_ name: String) -> Value { getprop(.map(minor), .string(name)) |> setProp("set") }
168
- runset("minor.isfunc", mset("isfunc"), { .bool(isfunc($0)) })
169
- runset("minor.typify", mset("typify"), { .int(Int64(typify($0))) })
170
- runset("minor.typename", mset("typename"), { .string(typename(Int($0.asInt ?? 0))) })
171
- runset("minor.strkey", mset("strkey"), { .string(strkey($0)) })
172
- runset(
173
- "minor.getelem", mset("getelem"),
174
- {
175
- getelem(
176
- getprop($0, .string("val")), getprop($0, .string("key")), getprop($0, .string("alt")))
177
- })
178
- runset("minor.items", mset("items"), { .list(items($0).map { Value.list($0) }) })
179
- runset(
180
- "minor.flatten", mset("flatten"),
181
- {
182
- flatten(getprop($0, .string("val")), getprop($0, .string("depth")).asInt.map(Int.init))
183
- })
184
- let filterChecks: [String: (Value, Value) -> Bool] = [
185
- "gt3": { _, v in (v.asDouble ?? 0) > 3 },
186
- "lt3": { _, v in (v.asDouble ?? 0) < 3 },
187
- ]
188
- runset(
189
- "minor.filter", mset("filter"),
190
- {
191
- let check = strkey(getprop($0, .string("check")))
192
- return filter(getprop($0, .string("val")), filterChecks[check] ?? { _, _ in false })
193
- })
194
- runset(
195
- "minor.join", mset("join"),
196
- {
197
- let sep: String
198
- if case .string(let s) = getprop($0, .string("sep")) { sep = s } else { sep = "," }
199
- var url = false
200
- if case .bool(let b) = getprop($0, .string("url")) { url = b }
201
- return .string(join(getprop($0, .string("val")), sep, url))
202
- })
203
- runset(
204
- "minor.jsonify", mset("jsonify"),
205
- {
206
- var indent = 2
207
- var offset = 0
208
- let flags = getprop($0, .string("flags"))
209
- if case .map = flags {
210
- if case .int(let n) = getprop(flags, .string("indent")) { indent = Int(n) }
211
- if case .int(let n) = getprop(flags, .string("offset")) { offset = Int(n) }
212
- }
213
- return .string(jsonify(lookup($0, .string("val")), indent: indent, offset: offset))
214
- })
215
- runset(
216
- "minor.pathify", mset("pathify"),
217
- {
218
- .string(
219
- pathify(lookup($0, .string("path")), getprop($0, .string("from")).asInt.map(Int.init)))
220
- })
221
- runset(
222
- "minor.slice", mset("slice"),
223
- {
224
- slice(
225
- getprop($0, .string("val")),
226
- getprop($0, .string("start")).asInt.map(Int.init),
227
- getprop($0, .string("end")).asInt.map(Int.init))
228
- })
229
- runset(
230
- "minor.pad", mset("pad"),
231
- {
232
- let padding = getprop($0, .string("pad")).asInt.map(Int.init)
233
- let padchar: Character
234
- if case .string(let c) = getprop($0, .string("char")), let f = c.first {
235
- padchar = f
236
- } else {
237
- padchar = " "
238
- }
239
- return pad(lookup($0, .string("val")), padding, padchar)
240
- })
241
- runset(
242
- "minor.setprop", mset("setprop"),
243
- {
244
- setprop(
245
- clone(getprop($0, .string("parent"))), getprop($0, .string("key")),
246
- lookup($0, .string("val")))
247
- })
248
- runset(
249
- "minor.delprop", mset("delprop"),
250
- {
251
- delprop(clone(getprop($0, .string("parent"))), getprop($0, .string("key")))
252
- })
253
- runset(
254
- "minor.setpath", mset("setpath"),
255
- {
256
- setpath(
257
- clone(getprop($0, .string("store"))), getprop($0, .string("path")),
258
- lookup($0, .string("val")))
259
- })
227
+ // setprop/delprop/setpath REWRITE the container they are given, and
228
+ // minor.setpath asserts exactly that through `match: {args: ...}`, so
229
+ // the argument crosses by identity - no clone.
230
+ runStruct("minor", "setprop", true) {
231
+ setprop(gp($0, "parent"), gp($0, "key"), lookup($0, .string("val")))
232
+ }
233
+ runStruct("minor", "delprop", true) {
234
+ delprop(gp($0, "parent"), gp($0, "key"))
235
+ }
236
+ runStruct("minor", "setpath", false) {
237
+ setpath(gp($0, "store"), gp($0, "path"), lookup($0, .string("val")))
238
+ }
260
239
  }
261
240
 
262
- // MARK: - Sentinels (null / absent unification across the readers)
263
-
264
- func testSentinels() {
265
- let s = loadStructSpec()
266
- guard case .map(let sn) = getprop(s, .string("sentinels")) else { return }
267
- func sset(_ name: String) -> Value { getprop(.map(sn), .string(name)) |> setProp("set") }
268
- runset(
269
- "sentinels.getprop_unify", sset("getprop_unify"),
270
- {
271
- getprop(
272
- getprop($0, .string("val")), getprop($0, .string("key")), getprop($0, .string("alt")))
273
- })
274
- runset(
275
- "sentinels.getelem_absent", sset("getelem_absent"),
276
- {
277
- getelem(
278
- getprop($0, .string("val")), getprop($0, .string("key")), getprop($0, .string("alt")))
279
- })
280
- runset(
281
- "sentinels.haskey_unify", sset("haskey_unify"),
282
- {
283
- .bool(haskey(getprop($0, .string("val")), getprop($0, .string("key"))))
284
- })
285
- runset("sentinels.isempty_unify", sset("isempty_unify"), { .bool(isempty($0)) })
286
- runset("sentinels.isnode_unify", sset("isnode_unify"), { .bool(isnode($0)) })
287
- runset("sentinels.stringify_null", sset("stringify_null"), { .string(stringify($0)) })
241
+ // MARK: - Null semantics
242
+ //
243
+ // The corpus group is `nullsem` - it was called `sentinels` once, and the
244
+ // retired engine kept driving the old name over zero entries.
245
+
246
+ func testNullsem() {
247
+ runStruct("nullsem", "getprop", false) {
248
+ getprop(gp($0, "val"), gp($0, "key"), self.raw($0, "alt"))
249
+ }
250
+ runStruct("nullsem", "getelem", false) {
251
+ getelem(gp($0, "val"), gp($0, "key"), gp($0, "alt"))
252
+ }
253
+ runStruct("nullsem", "getpath", false) {
254
+ getpath(gp($0, "store"), gp($0, "path"))
255
+ }
256
+ runStruct("nullsem", "haskey", false) {
257
+ .bool(haskey(gp($0, "src"), gp($0, "key")))
258
+ }
259
+ runStruct("nullsem", "keysof", false) {
260
+ .list(keysof($0).map { Value.string($0) })
261
+ }
288
262
  }
289
263
 
290
264
  // MARK: - Walk
291
265
 
292
266
  func testWalkBasic() {
293
- let s = loadStructSpec()
294
- let walkBasic = getprop(getprop(s, .string("walk")), .string("basic"))
295
- let set = getprop(walkBasic, .string("set"))
296
267
  let walkpath: WalkApply = { _, v, _, path in
297
268
  if case .string(let s) = v {
298
269
  return .string(s + "~" + path.joined(separator: "."))
299
270
  }
300
271
  return v
301
272
  }
302
- runset("walk.basic", set, { walk(clone($0), walkpath) })
273
+ runStruct("walk", "basic", true) { walk($0, walkpath) }
303
274
  }
304
275
 
305
276
  // MARK: - Getpath
306
277
 
307
278
  func testGetpathBasic() {
308
- let s = loadStructSpec()
309
- let set = getprop(getprop(s, .string("getpath")), .string("basic")) |> setProp("set")
310
- runset(
311
- "getpath.basic", set,
312
- {
313
- getpath(getprop($0, .string("store")), getprop($0, .string("path")))
314
- })
279
+ runStruct("getpath", "basic", true) {
280
+ getpath(gp($0, "store"), gp($0, "path"))
281
+ }
315
282
  }
316
283
 
317
284
  // MARK: - Merge
318
285
 
319
- func testMergeBasic() {
320
- let s = loadStructSpec()
321
- let mergeSpec = getprop(s, .string("merge"))
322
- if case .map(let mm) = mergeSpec {
323
- for (name, sub) in mm.entries {
324
- if name == "name" { continue }
325
- let set = getprop(sub, .string("set"))
326
- if name == "depth" {
327
- // depth set has shape {val: [...], depth: N}
328
- runset(
329
- "merge.\(name)", set,
330
- {
331
- let val = getprop($0, .string("val"))
332
- let depth = getprop($0, .string("depth")).asInt.map(Int.init) ?? MAXDEPTH
333
- return merge(clone(val), depth)
334
- })
335
- } else {
336
- runset("merge.\(name)", set, { merge(clone($0)) })
337
- }
338
- }
286
+ func testMerge() {
287
+ // merge.integrity asserts through `match: {args: ...}` that merge does
288
+ // NOT rewrite the list it was handed, so nothing is cloned here.
289
+ runStruct("merge", "cases", true) { merge($0) }
290
+ runStruct("merge", "array", true) { merge($0) }
291
+ runStruct("merge", "integrity", true) { merge($0) }
292
+ runStruct("merge", "depth", true) {
293
+ merge(gp($0, "val"), self.intArg(gp($0, "depth")) ?? MAXDEPTH)
339
294
  }
340
295
  }
341
296
 
342
297
  // MARK: - Inject
343
298
 
344
299
  func testInject() {
345
- let s = loadStructSpec()
346
- let injectSpec = getprop(s, .string("inject"))
347
- guard case .map(let im) = injectSpec else { return }
348
- // Single-entry `basic` is not a `.set`.
349
- if let basic = im.entries["basic"], case .map(let bm) = basic, let inv = bm.entries["in"] {
350
- let got = inject(
351
- clone(getprop(inv, .string("val"))),
352
- getprop(inv, .string("store")))
353
- let exp = bm.entries["out"] ?? .noval
354
- XCTAssertEqual(canon(got), canon(exp), "inject.basic")
300
+ runStruct("inject", "string", true) {
301
+ let inj = Injection(val: .noval, parent: .noval)
302
+ inj.modify = OmniResolver.nullModifier
303
+ return inject(gp($0, "val"), gp($0, "store"), inj)
355
304
  }
356
- // String / deep variants apply the NULLMARK fixup.
357
- if let stringSet = im.entries["string"], case .map(let sm) = stringSet,
358
- let set = sm.entries["set"], case .list(let sl) = set
359
- {
360
- var pass = 0
361
- var fail = 0
362
- for (i, entry) in sl.items.enumerated() {
363
- guard case .map(let em) = entry else { continue }
364
- if em.entries["err"] != nil { continue }
365
- let inVal = em.entries["in"] ?? .noval
366
- let v = fixNull(clone(getprop(inVal, .string("val"))))
367
- let st = fixNull(clone(getprop(inVal, .string("store"))))
368
- let runInj = Injection(val: .noval, parent: .noval)
369
- runInj.modify = nullModifier
370
- let got = inject(v, st, runInj)
371
- let exp = em.entries["out"] ?? .noval
372
- if canon(got) == canon(exp) {
373
- pass += 1
374
- } else {
375
- fail += 1
376
- if fail <= 5 { print("[inject.string#\(i)] exp=\(canon(exp)) got=\(canon(got))") }
377
- }
378
- }
379
- if fail > 0 {
380
- XCTFail("inject.string: \(pass)/\(pass + fail)")
381
- } else {
382
- print("ok inject.string: \(pass)/\(pass)")
383
- }
384
- }
385
- if let deepSet = im.entries["deep"], case .map(let dm) = deepSet,
386
- let set = dm.entries["set"]
387
- {
388
- runset(
389
- "inject.deep", set,
390
- {
391
- inject(
392
- clone(getprop($0, .string("val"))),
393
- getprop($0, .string("store")))
394
- })
305
+ runStruct("inject", "deep", true) {
306
+ inject(gp($0, "val"), gp($0, "store"))
395
307
  }
396
308
  }
397
309
 
398
310
  // MARK: - Transform
399
311
 
400
312
  func testTransform() {
401
- let s = loadStructSpec()
402
- let txSpec = getprop(s, .string("transform"))
403
- guard case .map(let tm) = txSpec else { return }
404
- if let basic = tm.entries["basic"], case .map(let bm) = basic, let inv = bm.entries["in"] {
405
- let got = transform(
406
- clone(getprop(inv, .string("data"))),
407
- clone(getprop(inv, .string("spec"))))
408
- let exp = bm.entries["out"] ?? .noval
409
- XCTAssertEqual(canon(got), canon(exp), "transform.basic")
410
- }
411
- for name in ["paths", "cmds", "each", "pack", "ref", "apply", "format"] {
412
- if let sub = tm.entries[name], case .map(let sm) = sub,
413
- let set = sm.entries["set"]
414
- {
415
- runset(
416
- "transform.\(name)", set,
417
- {
418
- transform(
419
- clone(getprop($0, .string("data"))),
420
- clone(getprop($0, .string("spec"))))
421
- })
313
+ for name in ["paths", "cmds", "each", "pack", "ref"] {
314
+ runStruct("transform", name, true) {
315
+ let (inj, errs) = self.errCollector()
316
+ let out = transform(gp($0, "data"), gp($0, "spec"), inj)
317
+ try self.raiseErrs(errs)
318
+ return out
422
319
  }
423
320
  }
424
- // Modify uses an `@`-prefix string modifier.
425
- if let sub = tm.entries["modify"], case .map(let sm) = sub,
426
- let set = sm.entries["set"]
427
- {
428
- runset(
429
- "transform.modify", set,
430
- {
431
- let runInj = Injection(val: .noval, parent: .noval)
432
- runInj.modify = { val, key, parent, _, _ in
433
- if case .string(let s) = val {
434
- setprop(parent, key, .string("@" + s))
435
- }
436
- }
437
- return transform(
438
- clone(getprop($0, .string("data"))),
439
- clone(getprop($0, .string("spec"))),
440
- runInj)
441
- })
321
+ runStruct("transform", "format", false) {
322
+ let (inj, errs) = self.errCollector()
323
+ let out = transform(gp($0, "data"), gp($0, "spec"), inj)
324
+ try self.raiseErrs(errs)
325
+ return out
326
+ }
327
+ runStruct("transform", "apply", true) {
328
+ let (inj, errs) = self.errCollector()
329
+ let out = transform(gp($0, "data"), gp($0, "spec"), inj)
330
+ try self.raiseErrs(errs)
331
+ return out
332
+ }
333
+ runStruct("transform", "modify", true) {
334
+ let inj = Injection(val: .noval, parent: .noval)
335
+ inj.modify = { val, key, parent, _, _ in
336
+ if case .string(let s) = val, !s.isEmpty {
337
+ setprop(parent, key, .string("@" + s))
338
+ }
339
+ }
340
+ return transform(gp($0, "data"), gp($0, "spec"), inj)
442
341
  }
443
342
  }
444
343
 
445
344
  // MARK: - Validate
446
345
 
447
346
  func testValidate() {
448
- let s = loadStructSpec()
449
- let vSpec = getprop(s, .string("validate"))
450
- guard case .map(let vm) = vSpec else { return }
451
- for name in ["basic", "child", "one", "exact", "invalid", "special"] {
452
- if let sub = vm.entries[name], case .map(let sm) = sub,
453
- let set = sm.entries["set"]
454
- {
455
- runset(
456
- "validate.\(name)", set,
457
- { entry in
458
- let runInj: Injection?
459
- if case .map(let im) = getprop(entry, .string("inj")) {
460
- let i = Injection(val: .noval, parent: .noval)
461
- i.meta = im
462
- runInj = i
463
- } else if let ij = (entry.asMap?.entries["inj"]), case .map(let im) = ij {
464
- let i = Injection(val: .noval, parent: .noval)
465
- i.meta = im
466
- runInj = i
467
- } else {
468
- runInj = nil
469
- }
470
- return validate(
471
- clone(getprop(entry, .string("data"))),
472
- clone(getprop(entry, .string("spec"))),
473
- runInj)
474
- })
347
+ for (name, nullFlag) in [
348
+ ("basic", false), ("child", true), ("one", true),
349
+ ("exact", true), ("invalid", false), ("special", true),
350
+ ] {
351
+ runStruct("validate", name, nullFlag) {
352
+ let (inj, errs) = self.errCollector()
353
+ if case .map(let im) = gp($0, "inj"), let meta = im.entries["meta"]?.asMap {
354
+ inj.meta = meta
355
+ }
356
+ let out = validate(self.raw($0, "data"), self.raw($0, "spec"), inj)
357
+ try self.raiseErrs(errs)
358
+ return out
475
359
  }
476
360
  }
477
361
  }
@@ -479,45 +363,10 @@ final class StructUtilityTest: XCTestCase {
479
363
  // MARK: - Select
480
364
 
481
365
  func testSelect() {
482
- let s = loadStructSpec()
483
- let sSpec = getprop(s, .string("select"))
484
- guard case .map(let sm) = sSpec else { return }
485
366
  for name in ["basic", "operators", "edge", "alts"] {
486
- if let sub = sm.entries[name], case .map(let ssm) = sub,
487
- let set = ssm.entries["set"], case .list(let sl) = set
488
- {
489
- var pass = 0
490
- var fail = 0
491
- for (i, entry) in sl.items.enumerated() {
492
- guard case .map(let em) = entry else { continue }
493
- if em.entries["err"] != nil { continue }
494
- let inVal = em.entries["in"] ?? .noval
495
- let obj = fixNull(clone(getprop(inVal, .string("obj"))))
496
- let q = fixNull(clone(getprop(inVal, .string("query"))))
497
- let got = select(obj, q)
498
- let exp = fixNull(clone(em.entries["out"] ?? .noval))
499
- if canon(got) == canon(exp) {
500
- pass += 1
501
- } else {
502
- fail += 1
503
- if fail <= 5 {
504
- print("[select.\(name)#\(i)] exp=\(canon(exp)) got=\(canon(got))")
505
- }
506
- }
507
- }
508
- if fail > 0 {
509
- XCTFail("select.\(name): \(pass)/\(pass + fail)")
510
- } else {
511
- print("ok select.\(name): \(pass)/\(pass)")
512
- }
367
+ runStruct("select", name, true) {
368
+ select(gp($0, "obj"), gp($0, "query"))
513
369
  }
514
370
  }
515
371
  }
516
372
  }
517
-
518
- // Convenience: "x |> setProp(y)" sugar to chain a getprop access.
519
- infix operator |> : MultiplicationPrecedence
520
- private func |> (lhs: Value, rhs: (Value) -> Value) -> Value { rhs(lhs) }
521
- private func setProp(_ key: String) -> (Value) -> Value {
522
- { v in getprop(v, .string(key)) }
523
- }