@voxgig/sdkgen 4.8.2 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (407) 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/model/target/zig.aon +9 -0
  33. package/project/.sdk/src/cmp/clojure/Package_clojure.ts +9 -2
  34. package/project/.sdk/src/cmp/cpp/Gitignore_cpp.ts +3 -0
  35. package/project/.sdk/src/cmp/dart/Test_dart.ts +2 -0
  36. package/project/.sdk/src/cmp/elixir/Package_elixir.ts +4 -1
  37. package/project/.sdk/src/cmp/go/Config_go.ts +59 -2
  38. package/project/.sdk/src/cmp/go/Main_go.ts +8 -2
  39. package/project/.sdk/src/cmp/java/Test_java.ts +6 -5
  40. package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +6 -5
  41. package/project/.sdk/src/cmp/lean/Package_lean.ts +23 -0
  42. package/project/.sdk/src/cmp/lean/ReadmeInstall_lean.ts +1 -0
  43. package/project/.sdk/src/cmp/lean/ReadmeTopTest_lean.ts +1 -0
  44. package/project/.sdk/src/cmp/ocaml/Gitignore_ocaml.ts +1 -0
  45. package/project/.sdk/src/cmp/ocaml/Main_ocaml.ts +7 -3
  46. package/project/.sdk/src/cmp/py/Config_py.ts +82 -1
  47. package/project/.sdk/src/cmp/py/Main_py.ts +44 -0
  48. package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +2 -0
  49. package/project/.sdk/src/cmp/swift/Main_swift.ts +10 -0
  50. package/project/.sdk/src/cmp/swift/Package_swift.ts +13 -1
  51. package/project/.sdk/src/cmp/ts/Config_ts.ts +42 -17
  52. package/project/.sdk/src/cmp/ts/fragment/Config.data.fragment.ts +13 -1
  53. package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +13 -1
  54. package/project/.sdk/src/cmp/zig/Package_zig.ts +15 -11
  55. package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +3 -3
  56. package/project/.sdk/src/cmp/zig/fragment/EntityListOp.fragment.zig +3 -3
  57. package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +3 -3
  58. package/project/.sdk/src/cmp/zig/utility_zig.ts +50 -1
  59. package/project/.sdk/tm/c/Makefile +38 -3
  60. package/project/.sdk/tm/c/tests/omni_resolver.h +361 -0
  61. package/project/.sdk/tm/c/tests/omni_smoke_test.c +237 -0
  62. package/project/.sdk/tm/c/tests/primary_corpus_test.c +205 -284
  63. package/project/.sdk/tm/c/tests/struct_corpus_test.c +292 -212
  64. package/project/.sdk/tm/c/tests/vendor/omni/json.c +811 -0
  65. package/project/.sdk/tm/c/tests/vendor/omni/omni.h +240 -0
  66. package/project/.sdk/tm/c/tests/vendor/omni/runner.c +940 -0
  67. package/project/.sdk/tm/c/tests/vendor/omni/util.c +351 -0
  68. package/project/.sdk/tm/c/utility/struct/utility.c +7 -2
  69. package/project/.sdk/tm/clojure/test/sdk/test/omni.clj +401 -0
  70. package/project/.sdk/tm/clojure/test/sdk/test/omni_smoke.clj +81 -0
  71. package/project/.sdk/tm/clojure/test/sdk/test/primary.clj +92 -58
  72. package/project/.sdk/tm/clojure/test/sdk/test/struct_corpus.clj +122 -149
  73. package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +8 -3
  74. package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/json.clj +145 -0
  75. package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/runner.clj +445 -0
  76. package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/util.clj +145 -0
  77. package/project/.sdk/tm/cpp/Makefile +5 -1
  78. package/project/.sdk/tm/cpp/test/omni_resolver.hpp +473 -0
  79. package/project/.sdk/tm/cpp/test/omni_smoke_test.cpp +209 -0
  80. package/project/.sdk/tm/cpp/test/primary_utility_test.cpp +243 -184
  81. package/project/.sdk/tm/cpp/test/runner_support.hpp +68 -181
  82. package/project/.sdk/tm/cpp/test/struct_corpus_test.cpp +183 -56
  83. package/project/.sdk/tm/cpp/test/vendor/omni/json.hpp +406 -0
  84. package/project/.sdk/tm/cpp/test/vendor/omni/omni.hpp +751 -0
  85. package/project/.sdk/tm/cpp/test/vendor/omni/util.hpp +256 -0
  86. package/project/.sdk/tm/cpp/utility/pipeline.hpp +7 -1
  87. package/project/.sdk/tm/csharp/test/OmniResolver.cs +491 -0
  88. package/project/.sdk/tm/csharp/test/OmniSmokeTest.cs +106 -0
  89. package/project/.sdk/tm/csharp/test/PrimaryUtilityTest.cs +299 -316
  90. package/project/.sdk/tm/csharp/test/Runner.cs +104 -269
  91. package/project/.sdk/tm/csharp/test/StructUtilityTest.cs +535 -724
  92. package/project/.sdk/tm/csharp/test/vendor/omni/Runner.cs +864 -0
  93. package/project/.sdk/tm/csharp/test/vendor/omni/Util.cs +347 -0
  94. package/project/.sdk/tm/csharp/utility/MakeSpec.cs +3 -1
  95. package/project/.sdk/tm/csharp/utility/PrepareMethod.cs +6 -1
  96. package/project/.sdk/tm/csharp/utility/struct/Struct.cs +21 -5
  97. package/project/.sdk/tm/dart/test/omni.dart +520 -0
  98. package/project/.sdk/tm/dart/test/omni_smoke_test.dart +143 -0
  99. package/project/.sdk/tm/dart/test/primary_test.dart +86 -28
  100. package/project/.sdk/tm/dart/test/struct_test.dart +438 -11
  101. package/project/.sdk/tm/dart/test/vendor/omni/omni.dart +7 -0
  102. package/project/.sdk/tm/dart/test/vendor/omni/runner.dart +653 -0
  103. package/project/.sdk/tm/dart/test/vendor/omni/util.dart +232 -0
  104. package/project/.sdk/tm/elixir/Makefile +11 -3
  105. package/project/.sdk/tm/elixir/test/omni_smoke_test.exs +117 -0
  106. package/project/.sdk/tm/elixir/test/primary_utility_test.exs +341 -16
  107. package/project/.sdk/tm/elixir/test/struct_corpus_test.exs +554 -9
  108. package/project/.sdk/tm/elixir/test/support/omni.ex +377 -0
  109. package/project/.sdk/tm/elixir/test/vendor/omni/json.ex +122 -0
  110. package/project/.sdk/tm/elixir/test/vendor/omni/runner.ex +623 -0
  111. package/project/.sdk/tm/elixir/test/vendor/omni/util.ex +187 -0
  112. package/project/.sdk/tm/go/core/context.go +32 -16
  113. package/project/.sdk/tm/go/feature/secrets/plugin/capability.go +261 -0
  114. package/project/.sdk/tm/go/feature/secrets/plugin/catalog.go +78 -0
  115. package/project/.sdk/tm/go/feature/secrets/plugin/config.go +652 -0
  116. package/project/.sdk/tm/go/feature/secrets/plugin/depend.go +250 -0
  117. package/project/.sdk/tm/go/feature/secrets/plugin/env.go +194 -0
  118. package/project/.sdk/tm/go/feature/secrets/plugin/export.go +80 -0
  119. package/project/.sdk/tm/go/feature/secrets/plugin/graph.go +238 -0
  120. package/project/.sdk/tm/go/feature/secrets/plugin/host.go +1575 -0
  121. package/project/.sdk/tm/go/feature/secrets/plugin/order.go +248 -0
  122. package/project/.sdk/tm/go/feature/secrets/plugin/point.go +184 -0
  123. package/project/.sdk/tm/go/feature/secrets/plugin/ref.go +123 -0
  124. package/project/.sdk/tm/go/feature/secrets/plugin/resolve.go +79 -0
  125. package/project/.sdk/tm/go/feature/secrets/plugin/types.go +296 -0
  126. package/project/.sdk/tm/go/feature/secrets/plugin/util.go +87 -0
  127. package/project/.sdk/tm/go/feature/secrets/plugin/version.go +161 -0
  128. package/project/.sdk/tm/go/feature/secrets/plugins/aws/aws.go +292 -0
  129. package/project/.sdk/tm/go/feature/secrets/plugins/aws/sigv4.go +201 -0
  130. package/project/.sdk/tm/go/feature/secrets/plugins/azuresecrets/azuresecrets.go +187 -0
  131. package/project/.sdk/tm/go/feature/secrets/plugins/boru/boru.go +184 -0
  132. package/project/.sdk/tm/go/feature/secrets/plugins/doppler/doppler.go +114 -0
  133. package/project/.sdk/tm/go/feature/secrets/plugins/gcpsecrets/gcpsecrets.go +156 -0
  134. package/project/.sdk/tm/go/feature/secrets/plugins/hashicorp/hashicorp.go +208 -0
  135. package/project/.sdk/tm/go/feature/secrets/plugins/httpjson/httpjson.go +241 -0
  136. package/project/.sdk/tm/go/feature/secrets/plugins/infisical/infisical.go +150 -0
  137. package/project/.sdk/tm/go/feature/secrets/plugins/onepassword/onepassword.go +152 -0
  138. package/project/.sdk/tm/go/feature/secrets/plugins/secretspec/secretspec.go +143 -0
  139. package/project/.sdk/tm/go/feature/secrets/sekreto/addr.go +120 -0
  140. package/project/.sdk/tm/go/feature/secrets/sekreto/providers.go +442 -0
  141. package/project/.sdk/tm/go/feature/secrets/sekreto/sekreto.go +714 -0
  142. package/project/.sdk/tm/go/feature/secrets_feature.go +675 -0
  143. package/project/.sdk/tm/go/src/feature/secrets/.gitkeep +0 -0
  144. package/project/.sdk/tm/go/test/feature/secrets/secrets_feature_test.go +799 -0
  145. package/project/.sdk/tm/go/test/omni/omni.go +902 -0
  146. package/project/.sdk/tm/go/test/omni/util.go +381 -0
  147. package/project/.sdk/tm/go/test/omniresolver_test.go +748 -0
  148. package/project/.sdk/tm/go/test/omnismoke_test.go +112 -0
  149. package/project/.sdk/tm/go/test/primary_utility_test.go +123 -191
  150. package/project/.sdk/tm/go/test/struct_utility_test.go +323 -16
  151. package/project/.sdk/tm/go/test/testsupport_test.go +294 -0
  152. package/project/.sdk/tm/go/utility/make_options.go +8 -1
  153. package/project/.sdk/tm/go/utility/prepare_method.go +5 -1
  154. package/project/.sdk/tm/go/utility/struct/voxgigstruct.go +2 -2
  155. package/project/.sdk/tm/java/test/OmniResolver.java +355 -0
  156. package/project/.sdk/tm/java/test/OmniSmokeTest.java +99 -0
  157. package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +254 -280
  158. package/project/.sdk/tm/java/test/RunnerSupport.java +9 -194
  159. package/project/.sdk/tm/java/test/StructCorpusTest.java +119 -42
  160. package/project/.sdk/tm/java/test/vendor/omni/Json.java +287 -0
  161. package/project/.sdk/tm/java/test/vendor/omni/Runner.java +851 -0
  162. package/project/.sdk/tm/java/test/vendor/omni/Util.java +322 -0
  163. package/project/.sdk/tm/java/utility/MakeSpec.java +3 -1
  164. package/project/.sdk/tm/java/utility/PrepareMethod.java +5 -5
  165. package/project/.sdk/tm/java/utility/struct/Struct.java +17 -4
  166. package/project/.sdk/tm/js/src/utility/StructUtility.js +3 -3
  167. package/project/.sdk/tm/js/test/omni.js +251 -0
  168. package/project/.sdk/tm/js/test/omni.test.js +105 -0
  169. package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +6 -2
  170. package/project/.sdk/tm/js/test/utility/StructUtility.test.js +27 -2
  171. package/project/.sdk/tm/js/test/vendor/omni/index.js +77 -0
  172. package/project/.sdk/tm/js/test/vendor/omni/runner.js +628 -0
  173. package/project/.sdk/tm/js/test/vendor/omni/util.js +229 -0
  174. package/project/.sdk/tm/kotlin/core/Utility.kt +1 -1
  175. package/project/.sdk/tm/kotlin/test/OmniResolver.kt +343 -0
  176. package/project/.sdk/tm/kotlin/test/OmniSmokeTest.kt +100 -0
  177. package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +244 -262
  178. package/project/.sdk/tm/kotlin/test/RunnerSupport.kt +9 -178
  179. package/project/.sdk/tm/kotlin/test/StructCorpusTest.kt +121 -32
  180. package/project/.sdk/tm/kotlin/test/vendor/omni/Json.kt +264 -0
  181. package/project/.sdk/tm/kotlin/test/vendor/omni/Runner.kt +615 -0
  182. package/project/.sdk/tm/kotlin/test/vendor/omni/Util.kt +139 -0
  183. package/project/.sdk/tm/kotlin/utility/MakeSpecUrl.kt +6 -3
  184. package/project/.sdk/tm/kotlin/utility/Prepare.kt +6 -6
  185. package/project/.sdk/tm/kotlin/utility/struct/Struct.kt +18 -2
  186. package/project/.sdk/tm/lean/Makefile +12 -5
  187. package/project/.sdk/tm/lean/src/SdkUtility.lean +14 -1
  188. package/project/.sdk/tm/lean/test/OmniResolver.lean +358 -0
  189. package/project/.sdk/tm/lean/test/OmniSmoke.lean +174 -0
  190. package/project/.sdk/tm/lean/test/StructCorpus.lean +245 -574
  191. package/project/.sdk/tm/lean/test/TPrimaryUtility.lean +155 -291
  192. package/project/.sdk/tm/lean/test/vendor/omni/Omni.lean +997 -0
  193. package/project/.sdk/tm/lua/test/omni.lua +456 -0
  194. package/project/.sdk/tm/lua/test/omni_smoke_test.lua +103 -0
  195. package/project/.sdk/tm/lua/test/primary_utility_test.lua +250 -509
  196. package/project/.sdk/tm/lua/test/struct_utility_test.lua +161 -70
  197. package/project/.sdk/tm/lua/test/vendor/omni/json.lua +268 -0
  198. package/project/.sdk/tm/lua/test/vendor/omni/regex.lua +385 -0
  199. package/project/.sdk/tm/lua/test/vendor/omni/runner.lua +641 -0
  200. package/project/.sdk/tm/lua/test/vendor/omni/util.lua +282 -0
  201. package/project/.sdk/tm/lua/utility/prepare_method.lua +5 -1
  202. package/project/.sdk/tm/lua/utility/struct/regex.lua +663 -0
  203. package/project/.sdk/tm/lua/utility/struct/struct.lua +660 -420
  204. package/project/.sdk/tm/ocaml/Makefile +37 -12
  205. package/project/.sdk/tm/ocaml/test/omni_resolver.ml +284 -0
  206. package/project/.sdk/tm/ocaml/test/omni_smoke_test.ml +169 -0
  207. package/project/.sdk/tm/ocaml/test/primary_utility_test.ml +84 -100
  208. package/project/.sdk/tm/ocaml/test/struct_corpus.ml +225 -201
  209. package/project/.sdk/tm/ocaml/test/vendor/omni/omni.ml +1157 -0
  210. package/project/.sdk/tm/perl/lib/Voxgig/Struct.pm +88 -12
  211. package/project/.sdk/tm/perl/t/omni.pm +647 -0
  212. package/project/.sdk/tm/perl/t/omni_smoke.t +87 -0
  213. package/project/.sdk/tm/perl/t/primary_utility.t +189 -487
  214. package/project/.sdk/tm/perl/t/struct_utility.t +455 -389
  215. package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni/Runner.pm +649 -0
  216. package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni/Util.pm +253 -0
  217. package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni.pm +24 -0
  218. package/project/.sdk/tm/perl/utility/prepare_method.pm +7 -2
  219. package/project/.sdk/tm/php/test/Omni.php +691 -0
  220. package/project/.sdk/tm/php/test/OmniSmokeTest.php +93 -0
  221. package/project/.sdk/tm/php/test/PrimaryUtilityTest.php +210 -571
  222. package/project/.sdk/tm/php/test/StructUtilityTest.php +320 -342
  223. package/project/.sdk/tm/php/test/vendor/omni/Runner.php +644 -0
  224. package/project/.sdk/tm/php/test/vendor/omni/Util.php +283 -0
  225. package/project/.sdk/tm/php/utility/MakeSpec.php +10 -3
  226. package/project/.sdk/tm/php/utility/PrepareBody.php +7 -1
  227. package/project/.sdk/tm/php/utility/PrepareMethod.php +6 -2
  228. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/__init__.py +36 -0
  229. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/capability.py +141 -0
  230. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/catalog.py +50 -0
  231. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/config.py +333 -0
  232. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/depend.py +198 -0
  233. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/env.py +147 -0
  234. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/export.py +52 -0
  235. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/graph.py +139 -0
  236. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/host.py +1053 -0
  237. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/order.py +171 -0
  238. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/point.py +95 -0
  239. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/ref.py +116 -0
  240. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/resolve.py +59 -0
  241. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/types.py +87 -0
  242. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/version.py +112 -0
  243. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/__init__.py +76 -0
  244. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/addr.py +116 -0
  245. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/aws.py +192 -0
  246. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/azuresecrets.py +120 -0
  247. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/boru.py +140 -0
  248. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/doppler.py +62 -0
  249. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/gcpsecrets.py +101 -0
  250. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/hashicorp.py +151 -0
  251. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/httpjson.py +115 -0
  252. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/infisical.py +90 -0
  253. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/onepassword.py +101 -0
  254. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/secretspec.py +119 -0
  255. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/sigv4.py +125 -0
  256. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/providers.py +211 -0
  257. package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/sekreto.py +475 -0
  258. package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +467 -0
  259. package/project/.sdk/tm/py/pkg/utility/prepare_method.py +5 -1
  260. package/project/.sdk/tm/py/pkg/utility/voxgig_struct/__init__.py +0 -2
  261. package/project/.sdk/tm/py/pkg/utility/voxgig_struct/voxgig_struct.py +780 -529
  262. package/project/.sdk/tm/py/src/feature/secrets/.gitkeep +0 -0
  263. package/project/.sdk/tm/py/test/feature/__init__.py +0 -0
  264. package/project/.sdk/tm/py/test/feature/secrets/__init__.py +0 -0
  265. package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +337 -0
  266. package/project/.sdk/tm/py/test/omni.py +415 -0
  267. package/project/.sdk/tm/py/test/test_omni_smoke.py +74 -0
  268. package/project/.sdk/tm/py/test/test_primary_utility.py +144 -668
  269. package/project/.sdk/tm/py/test/test_struct_utility.py +74 -27
  270. package/project/.sdk/tm/py/test/voxgig_omni/__init__.py +62 -0
  271. package/project/.sdk/tm/py/test/voxgig_omni/runner.py +580 -0
  272. package/project/.sdk/tm/py/test/voxgig_omni/util.py +252 -0
  273. package/project/.sdk/tm/rb/test/omni.rb +505 -0
  274. package/project/.sdk/tm/rb/test/omni_smoke_test.rb +72 -0
  275. package/project/.sdk/tm/rb/test/primary_utility_test.rb +174 -560
  276. package/project/.sdk/tm/rb/test/struct_utility_test.rb +13 -7
  277. package/project/.sdk/tm/rb/test/vendor/omni/runner.rb +493 -0
  278. package/project/.sdk/tm/rb/test/vendor/omni/util.rb +199 -0
  279. package/project/.sdk/tm/rb/test/vendor/omni/voxgig_omni.rb +15 -0
  280. package/project/.sdk/tm/rb/utility/prepare_method.rb +5 -1
  281. package/project/.sdk/tm/rust/tests/common/mod.rs +19 -242
  282. package/project/.sdk/tm/rust/tests/omni_resolver/mod.rs +888 -0
  283. package/project/.sdk/tm/rust/tests/omni_smoke_test.rs +286 -0
  284. package/project/.sdk/tm/rust/tests/primary_utility_test.rs +318 -312
  285. package/project/.sdk/tm/rust/tests/struct_utility_test.rs +66 -28
  286. package/project/.sdk/tm/rust/tests/vendor/omni/json.rs +412 -0
  287. package/project/.sdk/tm/rust/tests/vendor/omni/mod.rs +38 -0
  288. package/project/.sdk/tm/rust/tests/vendor/omni/regex.rs +392 -0
  289. package/project/.sdk/tm/rust/tests/vendor/omni/runner.rs +1001 -0
  290. package/project/.sdk/tm/rust/tests/vendor/omni/util.rs +161 -0
  291. package/project/.sdk/tm/rust/utility/prepare_method.rs +5 -1
  292. package/project/.sdk/tm/scala/Makefile +16 -6
  293. package/project/.sdk/tm/scala/sdktest/OmniResolver.scala +497 -0
  294. package/project/.sdk/tm/scala/sdktest/OmniSmoke.scala +192 -0
  295. package/project/.sdk/tm/scala/sdktest/PrimaryCorpus.scala +47 -19
  296. package/project/.sdk/tm/scala/sdktest/StructCorpus.scala +0 -0
  297. package/project/.sdk/tm/scala/sdktest/vendor/omni/Json.scala +229 -0
  298. package/project/.sdk/tm/scala/sdktest/vendor/omni/Runner.scala +552 -0
  299. package/project/.sdk/tm/scala/sdktest/vendor/omni/Util.scala +104 -0
  300. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Constants.swift +10 -0
  301. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Inject.swift +28 -5
  302. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Injection.swift +5 -1
  303. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Minor.swift +4 -1
  304. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Validate.swift +15 -5
  305. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Prepare.swift +6 -1
  306. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/OmniResolver.swift +474 -0
  307. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/OmniSmokeTest.swift +107 -0
  308. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PrimaryUtilityTest.swift +141 -178
  309. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/Runner.swift +17 -113
  310. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/StructUtilityTest.swift +295 -446
  311. package/project/.sdk/tm/swift/Tests/vendor/omni/Json.swift +364 -0
  312. package/project/.sdk/tm/swift/Tests/vendor/omni/Runner.swift +730 -0
  313. package/project/.sdk/tm/swift/Tests/vendor/omni/Util.swift +162 -0
  314. package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +7 -0
  315. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Capability.ts +148 -0
  316. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Catalog.ts +55 -0
  317. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Config.ts +344 -0
  318. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Depend.ts +205 -0
  319. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Env.ts +138 -0
  320. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Export.ts +46 -0
  321. package/project/.sdk/tm/ts/src/feature/secrets/plugin/FeatureHost.ts +349 -0
  322. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Graph.ts +181 -0
  323. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Host.ts +1132 -0
  324. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Order.ts +177 -0
  325. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Point.ts +119 -0
  326. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Ref.ts +102 -0
  327. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Resolve.ts +61 -0
  328. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Types.ts +112 -0
  329. package/project/.sdk/tm/ts/src/feature/secrets/plugin/Version.ts +100 -0
  330. package/project/.sdk/tm/ts/src/feature/secrets/plugin/index.ts +37 -0
  331. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/Sekreto.ts +163 -30
  332. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/index.ts +27 -22
  333. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/aws.ts +26 -36
  334. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/azuresecrets.ts +19 -21
  335. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/boru.ts +36 -17
  336. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/doppler.ts +14 -21
  337. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/gcpsecrets.ts +27 -27
  338. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/hashicorp.ts +25 -39
  339. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/httpjson.ts +99 -0
  340. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/infisical.ts +14 -16
  341. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/onepassword.ts +15 -22
  342. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/secretspec.ts +98 -0
  343. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{Sigv4.ts → plugins/sigv4.ts} +7 -6
  344. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/addr.ts +97 -23
  345. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/builtin.ts +37 -0
  346. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/dotenv.ts +4 -17
  347. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/env.ts +4 -16
  348. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/file.ts +11 -25
  349. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/memory.ts +6 -23
  350. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/support.ts +106 -39
  351. package/project/.sdk/tm/ts/src/utility/StructUtility.ts +3 -3
  352. package/project/.sdk/tm/ts/test/omni.ts +104 -32
  353. package/project/.sdk/tm/ts/test/utility/StructUtility.test.ts +27 -0
  354. package/project/.sdk/tm/ts/test/vendor/omni/Runner.ts +32 -5
  355. package/project/.sdk/tm/ts/test/vendor/omni/Util.ts +2 -2
  356. package/project/.sdk/tm/ts/test/vendor/omni/index.ts +2 -2
  357. package/project/.sdk/tm/zig/Makefile +15 -1
  358. package/project/.sdk/tm/zig/build.zig +23 -5
  359. package/project/.sdk/tm/zig/core/helpers.zig +52 -11
  360. package/project/.sdk/tm/zig/core/mem.zig +17 -1
  361. package/project/.sdk/tm/zig/core/utility.zig +23 -19
  362. package/project/.sdk/tm/zig/feature/audit.zig +2 -2
  363. package/project/.sdk/tm/zig/feature/cache.zig +2 -2
  364. package/project/.sdk/tm/zig/feature/debug.zig +5 -5
  365. package/project/.sdk/tm/zig/feature/netsim.zig +2 -2
  366. package/project/.sdk/tm/zig/feature/paging.zig +2 -2
  367. package/project/.sdk/tm/zig/feature/proxy.zig +15 -8
  368. package/project/.sdk/tm/zig/feature/streaming.zig +5 -5
  369. package/project/.sdk/tm/zig/feature/support.zig +3 -3
  370. package/project/.sdk/tm/zig/feature/telemetry.zig +5 -5
  371. package/project/.sdk/tm/zig/feature/test.zig +10 -5
  372. package/project/.sdk/tm/zig/test/fh.zig +10 -10
  373. package/project/.sdk/tm/zig/test/gotcha_test.zig +5 -5
  374. package/project/.sdk/tm/zig/test/omniresolver.zig +515 -0
  375. package/project/.sdk/tm/zig/test/omnismoke_test.zig +284 -0
  376. package/project/.sdk/tm/zig/test/pipeline_test.zig +8 -8
  377. package/project/.sdk/tm/zig/test/primary_utility_test.zig +145 -155
  378. package/project/.sdk/tm/zig/test/struct_corpus.zig +264 -187
  379. package/project/.sdk/tm/zig/test/vendor/omni/omni.zig +1314 -0
  380. package/project/.sdk/tm/zig/test/vendor/omni/regex.zig +446 -0
  381. package/project/.sdk/tm/zig/utility/voxgigstruct/regex.zig +7 -4
  382. package/project/.sdk/tm/zig/utility/voxgigstruct/struct.zig +356 -157
  383. package/project/sdkgen-package.json +1 -1
  384. package/src/action/doctor.ts +66 -2
  385. package/src/helpers/naming.ts +4 -2
  386. package/project/.sdk/tm/c/tests/runner.h +0 -274
  387. package/project/.sdk/tm/cpp/test/struct_runner.hpp +0 -314
  388. package/project/.sdk/tm/csharp/test/StructRunner.cs +0 -276
  389. package/project/.sdk/tm/dart/test/runner.dart +0 -406
  390. package/project/.sdk/tm/dart/test/struct_corpus.dart +0 -531
  391. package/project/.sdk/tm/elixir/test/support/struct_corpus.ex +0 -1088
  392. package/project/.sdk/tm/go/test/runner_test.go +0 -629
  393. package/project/.sdk/tm/go/test/struct_runner_test.go +0 -1094
  394. package/project/.sdk/tm/java/test/StructRunner.java +0 -281
  395. package/project/.sdk/tm/js/test/runner.js +0 -387
  396. package/project/.sdk/tm/kotlin/test/StructRunner.kt +0 -177
  397. package/project/.sdk/tm/lua/test/struct_runner.lua +0 -602
  398. package/project/.sdk/tm/ocaml/test/corpus_runner.ml +0 -185
  399. package/project/.sdk/tm/perl/t/struct_runner.pm +0 -275
  400. package/project/.sdk/tm/php/test/StructRunner.php +0 -275
  401. package/project/.sdk/tm/py/test/struct_runner.py +0 -411
  402. package/project/.sdk/tm/rb/test/struct_runner.rb +0 -309
  403. package/project/.sdk/tm/rust/tests/struct_runner/mod.rs +0 -424
  404. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/Registry.ts +0 -90
  405. package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/http.ts +0 -66
  406. package/project/.sdk/tm/ts/test/vendor/omni/compat.ts +0 -188
  407. package/project/.sdk/tm/zig/test/struct_runner.zig +0 -464
@@ -1,438 +1,504 @@
1
1
  #!perl
2
- # Vendored from voxgig/struct/perl (adapted for the ProjectName SDK).
3
- # Corpus test runner: loads ../.sdk/test/test.json and runs the struct
4
- # test sets the canonical TS test suite drives, through the SDK utility
5
- # object's struct facade (mirrors the rb struct_utility_test).
2
+ # VERSION: @voxgig/struct 0.1.1 (vendored; driven via t/omni.pm)
3
+ #
4
+ # ProjectName SDK struct utility test
5
+ #
6
+ # Corpus sections run through the vendored omni runner, via the resolver
7
+ # in t/omni.pm (struct-runner shape over native Voxgig::Omni;
8
+ # t/struct_runner.pm is retired - see docs/design/vendor-tag-rollout.md).
9
+ # This file only says WHICH subject answers each group and with which
10
+ # flags - the entry loop, the comparison, the error and `match` handling
11
+ # all live in the runner, identically for every port. Flags mirror
12
+ # canonical (tm/ts/test/utility/StructUtility.test.ts).
6
13
 
7
14
  use 5.018;
8
15
  use strict;
9
16
  use warnings;
10
17
  use Test::More;
11
18
  use FindBin;
19
+ use lib "$FindBin::Bin/../lib";
12
20
  use Scalar::Util ();
13
-
14
21
  use File::Basename ();
15
22
  use Cwd ();
16
- require(Cwd::abs_path("$FindBin::Bin/../lib/Voxgig/Struct.pm"));
17
- require(Cwd::abs_path("$FindBin::Bin/struct_runner.pm"));
18
23
 
19
- my $corpus_path = "$FindBin::Bin/../../.sdk/test/test.json";
24
+ use ProjectNameSDK;
25
+
26
+ require(Cwd::abs_path("$FindBin::Bin/omni.pm"));
20
27
 
21
- unless (-e $corpus_path) {
22
- plan skip_all => "Corpus file not found: $corpus_path";
28
+ my $corpus_path = Cwd::abs_path("$FindBin::Bin/../../.sdk/test/test.json");
29
+
30
+ unless (defined $corpus_path && -e $corpus_path) {
31
+ plan skip_all => "Corpus file not found";
23
32
  }
24
33
 
25
- my $client = StructTestClient->new;
26
- my $runner = StructRunner::make_runner($corpus_path, $client);
27
- my $runpack = $runner->('struct');
28
- my $struct_spec = $runpack->{spec};
29
- my $struct = $client->utility->{struct};
34
+ # The struct corpus drives the LIVE SDK's struct utilities, as ts does.
35
+ my $client = ProjectNameSDK->test(undef, undef);
36
+ my $runner = ProjectNameOmni::make_runner($corpus_path, $client);
37
+ my $R = $runner->('struct');
38
+
39
+ my $struct_spec = $R->{spec};
40
+ my $runset = $R->{runset};
41
+ my $runsetflags = $R->{runsetflags};
30
42
 
31
43
  # The struct facade exposed via the client utility carries the full API.
44
+ my $S = $client->get_utility->{struct};
45
+
32
46
  for my $meth (qw(
33
47
  clone delprop escre escurl filter flatten getdef getelem getpath getprop
34
48
  haskey inject isempty isfunc iskey islist ismap isnode items join jsonify
35
49
  keysof merge pad pathify select setpath setprop size slice strkey stringify
36
50
  transform typify typename validate walk jm jt
37
51
  )) {
38
- ok(ref $struct->{$meth} eq 'CODE', "utility struct facade has $meth");
52
+ ok(ref $S->{$meth} eq 'CODE', "utility struct facade has $meth");
39
53
  }
40
54
 
55
+ my $jbool = \&Voxgig::Struct::jbool;
56
+ my $NULLMARK = ProjectNameOmni::NULLMARK();
57
+
58
+ # Canonical comparison string for the single-entry cases below (they are
59
+ # not sets, so they are compared here rather than by the runner): sorted
60
+ # map keys, so key order is not significant.
41
61
  sub canon {
42
- my ($v) = @_;
43
- # Map keys aren't significant for equality - sort them so the
44
- # comparison ignores insertion order (matches node's deepStrictEqual).
45
- return Voxgig::Struct::_stringify_inner($v, 1);
62
+ my ($v) = @_;
63
+ return Voxgig::Struct::_stringify_inner($v, 1);
46
64
  }
47
65
 
48
- # Run a single set with a "subject" callback that takes `in` and returns the
49
- # computed result. The canonical out lives at entry->{out}.
50
- sub runset {
51
- my ($label, $entries, $subject) = @_;
52
- return unless $entries;
53
- return unless Voxgig::Struct::islist($entries);
54
- my $idx = 0;
55
- my $pass = 0;
56
- my $fail = 0;
57
- for my $entry (@$entries) {
58
- next unless Voxgig::Struct::ismap($entry);
59
- my $in_val = $entry->{in};
60
- my $expected = exists $entry->{out} ? $entry->{out} : undef;
61
- my $err_field = $entry->{err};
62
- my $got = eval { $subject->($in_val, $entry) };
63
- my $err = $@;
64
- if (defined $err_field) {
65
- my $this = $idx;
66
- $idx++;
67
- if (!$err) {
68
- $fail++;
69
- diag("[$label#$this] expected error but none thrown (err=" . canon($err_field) . ")");
70
- next;
71
- }
72
- my $msg = "$err";
73
- my $ok;
74
- if (Voxgig::Struct::is_jbool($err_field)) {
75
- $ok = ${$err_field} ? 1 : 0; # err: true -> any error
76
- }
77
- elsif (!ref $err_field) {
78
- if ($err_field =~ m{^/(.+)/$}s) {
79
- my $re = $1;
80
- $ok = ($msg =~ /$re/) ? 1 : 0;
81
- }
82
- else {
83
- $ok = (index(lc $msg, lc $err_field) >= 0) ? 1 : 0;
84
- }
85
- }
86
- else {
87
- $ok = 1;
88
- }
89
- if ($ok) { $pass++ }
90
- else {
91
- $fail++;
92
- diag("[$label#$this] err mismatch: expected=" . canon($err_field) . " got=[$msg]");
93
- }
94
- next;
95
- }
96
- if ($err) {
97
- $fail++;
98
- diag("[$label#$idx] unexpected error: $err");
99
- $idx++;
100
- next;
101
- }
102
- my $got_j = canon($got);
103
- my $exp_j = canon($expected);
104
- if ($got_j eq $exp_j) {
105
- $pass++;
106
- }
107
- else {
108
- $fail++;
109
- diag("[$label#$idx] expected=$exp_j got=$got_j");
110
- }
111
- $idx++;
112
- }
113
- ok($fail == 0, "$label: $pass/" . ($pass + $fail));
66
+ # Each group is one Test::More assertion, so a failure names the group and
67
+ # the entry (omni's message carries the index, the entry and both values).
68
+ sub group {
69
+ my ($label, $testspec, $flags, $subject) = @_;
70
+ unless (ref($testspec) eq 'HASH' && ref($testspec->{set}) eq 'ARRAY') {
71
+ fail("$label: corpus group missing");
72
+ return 0;
73
+ }
74
+ my $ok = eval { $runsetflags->($testspec, $flags, $subject); 1 };
75
+ if ($ok) {
76
+ pass($label);
77
+ return 1;
78
+ }
79
+ my $err = $@;
80
+ fail($label);
81
+ diag("$label: $err");
82
+ return 0;
114
83
  }
115
84
 
116
- # Minor subtests.
117
- my $minor = $struct_spec->{minor};
118
- if (Voxgig::Struct::ismap($minor)) {
119
- runset('minor.isnode', $minor->{isnode}{set},
120
- sub { Voxgig::Struct::isnode($_[0]) ? Voxgig::Struct::JTRUE() : Voxgig::Struct::JFALSE() });
121
- runset('minor.ismap', $minor->{ismap}{set},
122
- sub { Voxgig::Struct::ismap($_[0]) ? Voxgig::Struct::JTRUE() : Voxgig::Struct::JFALSE() });
123
- runset('minor.islist', $minor->{islist}{set},
124
- sub { Voxgig::Struct::islist($_[0]) ? Voxgig::Struct::JTRUE() : Voxgig::Struct::JFALSE() });
125
- runset('minor.iskey', $minor->{iskey}{set},
126
- sub { Voxgig::Struct::iskey($_[0]) ? Voxgig::Struct::JTRUE() : Voxgig::Struct::JFALSE() });
127
- runset('minor.isempty', $minor->{isempty}{set},
128
- sub { Voxgig::Struct::isempty($_[0]) ? Voxgig::Struct::JTRUE() : Voxgig::Struct::JFALSE() });
129
- runset('minor.size', $minor->{size}{set},
130
- sub { Voxgig::Struct::size($_[0]) });
131
- runset('minor.keysof', $minor->{keysof}{set},
132
- sub { Voxgig::Struct::keysof($_[0]) });
133
- runset('minor.haskey', $minor->{haskey}{set},
134
- sub {
135
- my $in = $_[0];
136
- Voxgig::Struct::haskey($in->{src}, $in->{key}) ? Voxgig::Struct::JTRUE() : Voxgig::Struct::JFALSE();
137
- });
138
- runset('minor.getprop', $minor->{getprop}{set},
139
- sub {
140
- my $in = $_[0];
141
- my $r = Voxgig::Struct::getprop($in->{val}, $in->{key}, $in->{alt});
142
- Voxgig::Struct::is_none($r) ? undef : $r;
143
- });
144
- runset('minor.clone', $minor->{clone}{set},
145
- sub { Voxgig::Struct::clone($_[0]) });
146
- runset('minor.escre', $minor->{escre}{set},
147
- sub { Voxgig::Struct::escre($_[0]) });
148
- runset('minor.escurl', $minor->{escurl}{set},
149
- sub { Voxgig::Struct::escurl($_[0]) });
150
- runset('minor.stringify', $minor->{stringify}{set},
151
- sub {
152
- my $in = $_[0];
153
- if (Voxgig::Struct::ismap($in)) {
154
- return Voxgig::Struct::stringify($in->{val}, $in->{max});
155
- }
156
- return Voxgig::Struct::stringify($in);
157
- });
158
- runset('minor.slice', $minor->{slice}{set},
159
- sub {
160
- my $in = $_[0];
161
- return Voxgig::Struct::slice($in->{val}, $in->{start}, $in->{end});
162
- });
163
- my %filter_checks = (
164
- gt3 => sub { $_[0][1] > 3 },
165
- lt3 => sub { $_[0][1] < 3 },
166
- );
167
- runset('minor.filter', $minor->{filter}{set},
168
- sub {
169
- my $in = $_[0];
170
- return Voxgig::Struct::filter($in->{val}, $filter_checks{$in->{check}});
171
- });
172
- runset('minor.isfunc', $minor->{isfunc}{set},
173
- sub { Voxgig::Struct::isfunc($_[0]) ? Voxgig::Struct::JTRUE() : Voxgig::Struct::JFALSE() });
174
- runset('minor.getelem', $minor->{getelem}{set},
175
- sub {
176
- my $in = $_[0];
177
- my $r = Voxgig::Struct::getelem($in->{val}, $in->{key}, $in->{alt});
178
- Voxgig::Struct::is_none($r) ? undef : $r;
179
- });
180
- runset('minor.items', $minor->{items}{set},
181
- sub { Voxgig::Struct::items($_[0]) });
182
- runset('minor.flatten', $minor->{flatten}{set},
183
- sub { my $in = $_[0]; Voxgig::Struct::flatten($in->{val}, $in->{depth}) });
184
- runset('minor.typename', $minor->{typename}{set},
185
- sub { Voxgig::Struct::typename($_[0]) });
186
- runset('minor.typify', $minor->{typify}{set},
187
- sub { Voxgig::Struct::typify($_[0]) });
188
- runset('minor.join', $minor->{join}{set},
189
- sub { my $in = $_[0]; Voxgig::Struct::join($in->{val}, $in->{sep}, $in->{url}) });
190
- runset('minor.jsonify', $minor->{jsonify}{set},
191
- sub { my $in = $_[0]; Voxgig::Struct::jsonify($in->{val}, $in->{flags}) });
192
- runset('minor.pad', $minor->{pad}{set},
193
- sub { my $in = $_[0]; Voxgig::Struct::pad($in->{val}, $in->{pad}, $in->{char}) });
194
- runset('minor.setprop', $minor->{setprop}{set},
195
- sub { my $in = $_[0]; Voxgig::Struct::setprop(Voxgig::Struct::clone($in->{parent}), $in->{key}, $in->{val}) });
196
- runset('minor.delprop', $minor->{delprop}{set},
197
- sub { my $in = $_[0]; Voxgig::Struct::delprop(Voxgig::Struct::clone($in->{parent}), $in->{key}) });
198
- runset('minor.setpath', $minor->{setpath}{set},
199
- sub {
200
- my ($in, $entry) = @_;
201
- my $store = $in->{store};
202
- my $r = Voxgig::Struct::setpath($store, $in->{path}, $in->{val});
203
- my $want_store = eval { $entry->{match}{args}{'0'}{store} };
204
- if (defined $want_store) {
205
- my $got = canon($store);
206
- my $exp = canon($want_store);
207
- if ($got ne $exp) {
208
- diag("[minor.setpath store-mutation] expected=$exp got=$got");
209
- die "minor.setpath store mutation mismatch\n";
210
- }
211
- }
212
- Voxgig::Struct::is_none($r) ? undef : $r;
213
- });
214
- runset('minor.strkey', $minor->{strkey}{set},
215
- sub { Voxgig::Struct::strkey($_[0]) });
216
- runset('minor.pathify', $minor->{pathify}{set},
217
- sub { my $in = $_[0]; Voxgig::Struct::pathify($in->{path}, $in->{from}) });
85
+ # One group, omni's default flags (`null` on).
86
+ sub grun {
87
+ my ($label, $testspec, $subject) = @_;
88
+ return group($label, $testspec, {}, $subject);
218
89
  }
219
90
 
220
- # Walk. Canonical test uses walkpath callback (appends `~path`).
221
- if (Voxgig::Struct::ismap($struct_spec->{walk})) {
222
- my $walkpath = sub {
223
- my ($key, $val, $parent, $path) = @_;
224
- return $val if !defined $val || ref $val;
225
- return $val if Voxgig::Struct::is_jbool($val) || Voxgig::Struct::is_jnull($val);
226
- my $is_str = !Scalar::Util::looks_like_number($val) || "$val" =~ /[^0-9eE.+\-]/;
227
- return $val unless $is_str;
228
- return $val . '~' . CORE::join('.', @$path);
229
- };
230
- runset('walk.basic', $struct_spec->{walk}{basic}{set},
231
- sub {
232
- my $in = Voxgig::Struct::clone($_[0]);
233
- return Voxgig::Struct::walk($in, $walkpath);
234
- });
91
+ # One group with explicit flags.
92
+ sub grunflags {
93
+ my ($label, $testspec, $flags, $subject) = @_;
94
+ return group($label, $testspec, $flags, $subject);
235
95
  }
236
96
 
237
- # Merge.
238
- if (Voxgig::Struct::ismap($struct_spec->{merge})) {
239
- runset('merge.basic', $struct_spec->{merge}{basic}{set},
240
- sub {
241
- my $in = $_[0];
242
- return Voxgig::Struct::merge($in);
243
- });
244
- }
245
97
 
246
- # Getpath.
247
- if (Voxgig::Struct::ismap($struct_spec->{getpath})) {
248
- my $gp = $struct_spec->{getpath};
249
- runset('getpath.basic', $gp->{basic}{set},
250
- sub {
251
- my $in = $_[0];
252
- return Voxgig::Struct::getpath($in->{store}, $in->{path});
253
- });
254
- runset('getpath.relative', $gp->{relative}{set},
255
- sub {
256
- my $in = $_[0];
257
- my $dp = $in->{dpath};
258
- return Voxgig::Struct::getpath($in->{store}, $in->{path}, {
259
- dparent => $in->{dparent},
260
- (defined $dp ? (dpath => [ split /\./, $dp ]) : ()),
261
- });
262
- });
263
- runset('getpath.special', $gp->{special}{set},
264
- sub {
265
- my $in = $_[0];
266
- return Voxgig::Struct::getpath($in->{store}, $in->{path}, $in->{inj});
267
- });
268
- runset('getpath.handler', $gp->{handler}{set},
269
- sub {
270
- my $in = $_[0];
271
- return Voxgig::Struct::getpath(
272
- { '$TOP' => $in->{store}, '$FOO' => sub { 'foo' } },
273
- $in->{path},
274
- { handler => sub { my ($inj, $val, $cur, $ref) = @_; $val->() } },
275
- );
276
- });
98
+ # ===========================================================================
99
+ # minor
100
+ # ===========================================================================
101
+
102
+ my $minor = $struct_spec->{minor};
103
+
104
+ grun('minor.isnode', $minor->{isnode}, sub { $jbool->($S->{isnode}->($_[0])) });
105
+ grun('minor.ismap', $minor->{ismap}, sub { $jbool->($S->{ismap}->($_[0])) });
106
+ grun('minor.islist', $minor->{islist}, sub { $jbool->($S->{islist}->($_[0])) });
107
+
108
+ grunflags('minor.iskey', $minor->{iskey}, { null => 0 },
109
+ sub { $jbool->($S->{iskey}->($_[0])) });
110
+
111
+ grunflags('minor.strkey', $minor->{strkey}, { null => 0 },
112
+ sub { $S->{strkey}->($_[0]) });
113
+
114
+ grunflags('minor.isempty', $minor->{isempty}, { null => 0 },
115
+ sub { $jbool->($S->{isempty}->($_[0])) });
116
+
117
+ grun('minor.isfunc', $minor->{isfunc}, sub { $jbool->($S->{isfunc}->($_[0])) });
118
+
119
+ grunflags('minor.clone', $minor->{clone}, { null => 0 },
120
+ sub { $S->{clone}->($_[0]) });
121
+
122
+ # The corpus names the predicate; the test file supplies it.
123
+ my %checkmap = (
124
+ gt3 => sub { $_[0][1] > 3 },
125
+ lt3 => sub { $_[0][1] < 3 },
126
+ );
127
+ grun('minor.filter', $minor->{filter},
128
+ sub { $S->{filter}->($_[0]{val}, $checkmap{ $_[0]{check} }) });
129
+
130
+ grun('minor.flatten', $minor->{flatten},
131
+ sub { $S->{flatten}->($_[0]{val}, $_[0]{depth}) });
132
+
133
+ grun('minor.escre', $minor->{escre}, sub { $S->{escre}->($_[0]) });
134
+ grun('minor.escurl', $minor->{escurl}, sub { $S->{escurl}->($_[0]) });
135
+
136
+ # An entry with NO `val` is canonical stringify(undefined) == ''; a
137
+ # NULLMARK val (null flag on) is a real JSON null to stringify.
138
+ grun('minor.stringify', $minor->{stringify}, sub {
139
+ my ($in) = @_;
140
+ return '' if ref($in) ne 'HASH' || !exists $in->{val};
141
+ my $val = $in->{val};
142
+ my $isnul = defined $val && !ref $val && $val eq $NULLMARK;
143
+ return $S->{stringify}->($isnul ? 'null' : $val, $in->{max});
144
+ });
145
+
146
+ grunflags('minor.jsonify', $minor->{jsonify}, { null => 0 },
147
+ sub { $S->{jsonify}->($_[0]{val}, $_[0]{flags}) });
148
+
149
+ # `null: true`, so an absent path arrives as NULLMARK and the rendered
150
+ # path has to be put back the way canonical renders a real undefined
151
+ # (ported from upstream struct's t/struct.t).
152
+ grunflags('minor.pathify', $minor->{pathify}, { null => 1 }, sub {
153
+ my ($in) = @_;
154
+ return '<unknown-path>' if ref($in) ne 'HASH' || !exists $in->{path};
155
+ my $raw = $in->{path};
156
+ my $isnul = defined $raw && !ref $raw && $raw eq $NULLMARK;
157
+ my $path = $isnul ? undef : $raw;
158
+ my $str = $S->{pathify}->($path, $in->{from});
159
+ $str =~ s/\Q$NULLMARK\E\.//;
160
+ $str =~ s/>/:null>/g if $isnul;
161
+ return $str;
162
+ });
163
+
164
+ grun('minor.items', $minor->{items}, sub { $S->{items}->($_[0]) });
165
+
166
+ # `alt` is omitted where the corpus omits it: passing an explicit undef is
167
+ # a different call, and getelem/getprop differ on whether a NULL alt
168
+ # counts.
169
+ grunflags('minor.getelem', $minor->{getelem}, { null => 0 }, sub {
170
+ my ($in) = @_;
171
+ my $alt = $in->{alt};
172
+ return (!defined $alt || Voxgig::Struct::is_jnull($alt))
173
+ ? $S->{getelem}->($in->{val}, $in->{key})
174
+ : $S->{getelem}->($in->{val}, $in->{key}, $alt);
175
+ });
176
+
177
+ grunflags('minor.getprop', $minor->{getprop}, { null => 0 }, sub {
178
+ my ($in) = @_;
179
+ return exists $in->{alt}
180
+ ? $S->{getprop}->($in->{val}, $in->{key}, $in->{alt})
181
+ : $S->{getprop}->($in->{val}, $in->{key});
182
+ });
183
+
184
+ grun('minor.setprop', $minor->{setprop},
185
+ sub { $S->{setprop}->($_[0]{parent}, $_[0]{key}, $_[0]{val}) });
186
+
187
+ grun('minor.delprop', $minor->{delprop},
188
+ sub { $S->{delprop}->($_[0]{parent}, $_[0]{key}) });
189
+
190
+ grunflags('minor.haskey', $minor->{haskey}, { null => 0 },
191
+ sub { $jbool->($S->{haskey}->($_[0]{src}, $_[0]{key})) });
192
+
193
+ grun('minor.keysof', $minor->{keysof}, sub { $S->{keysof}->($_[0]) });
194
+
195
+ grunflags('minor.join', $minor->{join}, { null => 0 },
196
+ sub { $S->{join}->($_[0]{val}, $_[0]{sep}, $_[0]{url}) });
197
+
198
+ grun('minor.typename', $minor->{typename}, sub { $S->{typename}->($_[0]) });
199
+
200
+ grunflags('minor.typify', $minor->{typify}, { null => 0 },
201
+ sub { $S->{typify}->($_[0]) });
202
+
203
+ grunflags('minor.size', $minor->{size}, { null => 0 },
204
+ sub { $S->{size}->($_[0]) });
205
+
206
+ grunflags('minor.slice', $minor->{slice}, { null => 0 },
207
+ sub { $S->{slice}->($_[0]{val}, $_[0]{start}, $_[0]{end}) });
208
+
209
+ grunflags('minor.pad', $minor->{pad}, { null => 0 },
210
+ sub { $S->{pad}->($_[0]{val}, $_[0]{pad}, $_[0]{char}) });
211
+
212
+ # setpath rewrites `store` IN PLACE, and the entries assert that rewrite
213
+ # through `match.args` - the resolver's in-place model conversion is what
214
+ # lets the runner see it (t/omni.pm, decision 2).
215
+ grunflags('minor.setpath', $minor->{setpath}, { null => 0 },
216
+ sub { $S->{setpath}->($_[0]{store}, $_[0]{path}, $_[0]{val}) });
217
+
218
+
219
+ # ===========================================================================
220
+ # nullsem - does a PRESENT key holding a JSON null read as "no value"?
221
+ # Opt-in per target (create-sdkgen ships it; an older project corpus may
222
+ # predate it - the skip says so OUT LOUD rather than passing vacuously).
223
+ # All lanes {null: 0}, so the stored nulls are REAL (JNULL after the model
224
+ # conversion), not the NULLMARK string.
225
+ # ===========================================================================
226
+
227
+ SKIP: {
228
+ my $nullsem = (ref($struct_spec) eq 'HASH') ? $struct_spec->{nullsem} : undef;
229
+ skip 'corpus predates struct.nullsem - refresh .sdk/test/struct from create-sdkgen', 5
230
+ unless ref($nullsem) eq 'HASH';
231
+
232
+ grunflags('nullsem.getprop', $nullsem->{getprop}, { null => 0 }, sub {
233
+ my ($in) = @_;
234
+ return exists $in->{alt}
235
+ ? $S->{getprop}->($in->{val}, $in->{key}, $in->{alt})
236
+ : $S->{getprop}->($in->{val}, $in->{key});
237
+ });
238
+
239
+ grunflags('nullsem.getelem', $nullsem->{getelem}, { null => 0 }, sub {
240
+ my ($in) = @_;
241
+ return exists $in->{alt}
242
+ ? $S->{getelem}->($in->{val}, $in->{key}, $in->{alt})
243
+ : $S->{getelem}->($in->{val}, $in->{key});
244
+ });
245
+
246
+ grunflags('nullsem.getpath', $nullsem->{getpath}, { null => 0 },
247
+ sub { $S->{getpath}->($_[0]{store}, $_[0]{path}) });
248
+
249
+ grunflags('nullsem.haskey', $nullsem->{haskey}, { null => 0 },
250
+ sub { $jbool->($S->{haskey}->($_[0]{src}, $_[0]{key})) });
251
+
252
+ grunflags('nullsem.keysof', $nullsem->{keysof}, { null => 0 },
253
+ sub { $S->{keysof}->($_[0]) });
277
254
  }
278
255
 
279
- # NULLMARK fixup - the canonical test runner replaces JSON nulls with
280
- # "__NULL__" before running, and tests pass a `nullModifier` callback that
281
- # swaps any string containing "__NULL__" back to "null".
282
- my $NULLMARK = '__NULL__';
283
- my $fix_null;
284
- $fix_null = sub {
285
- my ($v) = @_;
286
- if (Voxgig::Struct::is_jnull($v)) { return $NULLMARK }
287
- if (Voxgig::Struct::ismap($v)) {
288
- my $out = Voxgig::Struct::jm();
289
- for my $k (Voxgig::Struct::_map_keys($v)) {
290
- $out->{$k} = $fix_null->($v->{$k});
291
- }
292
- return $out;
293
- }
294
- if (Voxgig::Struct::islist($v)) {
295
- return [ map { $fix_null->($_) } @$v ];
256
+
257
+ # ===========================================================================
258
+ # walk
259
+ # ===========================================================================
260
+
261
+ my $walk_spec = $struct_spec->{walk};
262
+
263
+ grun('walk.basic', $walk_spec->{basic}, sub {
264
+ my $walkpath = sub {
265
+ my ($_key, $val, $_parent, $path) = @_;
266
+ return $val if ref $val || !defined $val;
267
+ return $val if !Voxgig::Struct::_is_string_sv($val);
268
+ return $val . '~' . CORE::join('.', @$path);
269
+ };
270
+ return $S->{walk}->($_[0], $walkpath);
271
+ });
272
+
273
+ grun('walk.copy', $walk_spec->{copy}, sub {
274
+ my ($in) = @_;
275
+ my $cur;
276
+ my $walkcopy = sub {
277
+ my ($key, $val, $_parent, $path) = @_;
278
+ if (!defined $key) {
279
+ $cur = [];
280
+ $cur->[0] =
281
+ Voxgig::Struct::ismap($val) ? Voxgig::Struct::jm()
282
+ : Voxgig::Struct::islist($val) ? []
283
+ : $val;
284
+ return $val;
296
285
  }
297
- return $v;
298
- };
299
- my $null_modifier = sub {
300
- my ($val, $key, $parent) = @_;
301
- return unless defined $parent && ref $parent;
302
- if (defined $val && !ref($val) && $val eq $NULLMARK) {
303
- if (Voxgig::Struct::ismap($parent)) { $parent->{$key} = Voxgig::Struct::JNULL() }
304
- elsif (Voxgig::Struct::islist($parent)) { $parent->[$key] = Voxgig::Struct::JNULL() }
286
+
287
+ my $v = $val;
288
+ my $i = Voxgig::Struct::size($path);
289
+
290
+ if (Voxgig::Struct::isnode($v)) {
291
+ $v = $cur->[$i] = Voxgig::Struct::ismap($v) ? Voxgig::Struct::jm() : [];
305
292
  }
306
- elsif (defined $val && !ref($val) && index($val, $NULLMARK) >= 0) {
307
- my $s = $val;
308
- $s =~ s/\Q$NULLMARK\E/null/g;
309
- if (Voxgig::Struct::ismap($parent)) { $parent->{$key} = $s }
310
- elsif (Voxgig::Struct::islist($parent)) { $parent->[$key] = $s }
293
+
294
+ Voxgig::Struct::setprop($cur->[$i - 1], $key, $v);
295
+
296
+ return $val;
297
+ };
298
+ $S->{walk}->($in, $walkcopy);
299
+ return $cur->[0];
300
+ });
301
+
302
+ grunflags('walk.depth', $walk_spec->{depth}, { null => 0 }, sub {
303
+ my ($in) = @_;
304
+ my ($top, $cur);
305
+ my $copy = sub {
306
+ my ($key, $val, $_parent, $_path) = @_;
307
+ if (!defined $key || Voxgig::Struct::isnode($val)) {
308
+ my $child = Voxgig::Struct::islist($val) ? [] : Voxgig::Struct::jm();
309
+ if (!defined $key) { $top = $cur = $child }
310
+ else {
311
+ Voxgig::Struct::setprop($cur, $key, $child);
312
+ $cur = $child;
313
+ }
311
314
  }
312
- };
313
-
314
- # Inject - inject.basic is a single entry, not a set.
315
- if (Voxgig::Struct::ismap($struct_spec->{inject})) {
316
- my $basic = $struct_spec->{inject}{basic};
317
- if (Voxgig::Struct::ismap($basic) && exists $basic->{in}) {
318
- my $got_b = Voxgig::Struct::inject(
319
- Voxgig::Struct::clone($basic->{in}{val}),
320
- $basic->{in}{store},
321
- );
322
- my $exp_b = $basic->{out};
323
- is(canon($got_b), canon($exp_b), 'inject.basic');
315
+ else {
316
+ Voxgig::Struct::setprop($cur, $key, $val);
324
317
  }
325
- runset('inject.string', $struct_spec->{inject}{string}{set},
326
- sub {
327
- my $in = $_[0];
328
- my $val = $fix_null->(Voxgig::Struct::clone($in->{val}));
329
- my $store = $fix_null->(Voxgig::Struct::clone($in->{store}));
330
- my $r = Voxgig::Struct::inject($val, $store, { modify => $null_modifier });
331
- return $r;
332
- });
333
- runset('inject.deep', $struct_spec->{inject}{deep}{set},
334
- sub {
335
- my $in = $_[0];
336
- return Voxgig::Struct::inject(
337
- Voxgig::Struct::clone($in->{val}),
338
- $in->{store});
339
- });
318
+ return $val;
319
+ };
320
+ $S->{walk}->($in->{src}, $copy, undef, $in->{maxdepth});
321
+ return $top;
322
+ });
323
+
324
+ # walk.log is a single entry, not a set: the callback log for the after,
325
+ # before and both walks, in canonical's own rendering.
326
+ {
327
+ my $td = ProjectNameOmni::tostruct(
328
+ Voxgig::Omni::Util::clone($walk_spec->{log}));
329
+
330
+ my $mklog = sub {
331
+ my ($log) = @_;
332
+ return sub {
333
+ my ($key, $val, $parent, $path) = @_;
334
+ push @$log, 'k=' . (defined $key ? Voxgig::Struct::stringify($key) : '')
335
+ . ', v=' . Voxgig::Struct::stringify($val)
336
+ . ', p=' . (defined $parent ? Voxgig::Struct::stringify($parent) : '')
337
+ . ', t=' . Voxgig::Struct::pathify($path);
338
+ return $val;
339
+ };
340
+ };
341
+
342
+ my %lanes = (
343
+ after => sub { my ($in, $log) = @_; $S->{walk}->($in, undef, $mklog->($log)) },
344
+ before => sub { my ($in, $log) = @_; $S->{walk}->($in, $mklog->($log)) },
345
+ both => sub { my ($in, $log) = @_; my $l = $mklog->($log); $S->{walk}->($in, $l, $l) },
346
+ );
347
+
348
+ for my $lane (sort keys %lanes) {
349
+ my $log = [];
350
+ $lanes{$lane}->(Voxgig::Struct::clone($td->{in}), $log);
351
+ is_deeply($log, $td->{out}{$lane}, "walk.log $lane");
352
+ }
340
353
  }
341
354
 
342
- # Transform.
343
- if (Voxgig::Struct::ismap($struct_spec->{transform})) {
344
- my $tx = $struct_spec->{transform};
345
- if (Voxgig::Struct::ismap($tx->{basic}) && exists $tx->{basic}{in}) {
346
- my $b = $tx->{basic};
347
- my $got = eval { Voxgig::Struct::transform(
348
- Voxgig::Struct::clone($b->{in}{data}),
349
- Voxgig::Struct::clone($b->{in}{spec}),
350
- ) };
351
- is(canon($got), canon($b->{out}), 'transform.basic');
352
- }
353
- for my $sec (qw(paths cmds each pack ref apply format)) {
354
- runset("transform.$sec", $tx->{$sec}{set},
355
- sub {
356
- my $in = $_[0];
357
- return Voxgig::Struct::transform(
358
- Voxgig::Struct::clone($in->{data}),
359
- Voxgig::Struct::clone($in->{spec}),
360
- );
361
- });
362
- }
363
- runset('transform.modify', $tx->{modify}{set},
364
- sub {
365
- my $in = $_[0];
366
- return Voxgig::Struct::transform(
367
- Voxgig::Struct::clone($in->{data}),
368
- Voxgig::Struct::clone($in->{spec}),
369
- { modify => sub {
370
- my ($val, $key, $parent) = @_;
371
- return unless defined $key && defined $parent && ref $parent;
372
- return if ref $val;
373
- return if !defined $val;
374
- return if Voxgig::Struct::is_jbool($val) || Voxgig::Struct::is_jnull($val);
375
- return unless Voxgig::Struct::_is_string_sv($val);
376
- my $new = '@' . $val;
377
- if (Voxgig::Struct::ismap($parent)) { $parent->{$key} = $new }
378
- elsif (Voxgig::Struct::islist($parent)) { $parent->[$key] = $new }
379
- }},
380
- );
381
- });
355
+
356
+ # ===========================================================================
357
+ # merge
358
+ # ===========================================================================
359
+
360
+ my $merge_spec = $struct_spec->{merge};
361
+
362
+ # `merge.basic` is a single entry, not a set.
363
+ {
364
+ my $basic = ProjectNameOmni::tostruct(
365
+ Voxgig::Omni::Util::clone($merge_spec->{basic}));
366
+ is(canon($S->{merge}->($basic->{in})), canon($basic->{out}), 'merge.basic');
382
367
  }
383
368
 
384
- # Validate. The canonical runner applies the NULLMARK fixup (flags.null,
385
- # the default) to these sections, so JSON nulls in data/spec/out are
386
- # encoded as "__NULL__" strings before validate runs - genuine nulls only
387
- # flow through the sections run with { null: false } (basic, invalid),
388
- # mirroring the rb struct_utility_test flags.
389
- if (Voxgig::Struct::ismap($struct_spec->{validate})) {
390
- my $vd = $struct_spec->{validate};
391
- for my $sec (qw(basic invalid)) {
392
- runset("validate.$sec", $vd->{$sec}{set},
393
- sub {
394
- my $in = $_[0];
395
- return Voxgig::Struct::validate(
396
- Voxgig::Struct::clone($in->{data}),
397
- Voxgig::Struct::clone($in->{spec}),
398
- $in->{inj},
399
- );
400
- });
401
- }
402
- for my $sec (qw(child one exact special)) {
403
- my $entries = $vd->{$sec}{set};
404
- next unless Voxgig::Struct::islist($entries);
405
- my $fixed = $fix_null->(Voxgig::Struct::clone($entries));
406
- runset("validate.$sec", $fixed,
407
- sub {
408
- my $in = $_[0];
409
- return Voxgig::Struct::validate(
410
- Voxgig::Struct::clone($in->{data}),
411
- Voxgig::Struct::clone($in->{spec}),
412
- $in->{inj},
413
- );
414
- });
415
- }
369
+ grun('merge.cases', $merge_spec->{cases}, sub { $S->{merge}->($_[0]) });
370
+ grun('merge.array', $merge_spec->{array}, sub { $S->{merge}->($_[0]) });
371
+
372
+ # The entries assert the in-place result through `match.args`.
373
+ grun('merge.integrity', $merge_spec->{integrity}, sub { $S->{merge}->($_[0]) });
374
+
375
+ grun('merge.depth', $merge_spec->{depth},
376
+ sub { $S->{merge}->($_[0]{val}, $_[0]{depth}) });
377
+
378
+
379
+ # ===========================================================================
380
+ # getpath
381
+ # ===========================================================================
382
+
383
+ my $getpath_spec = $struct_spec->{getpath};
384
+
385
+ grun('getpath.basic', $getpath_spec->{basic},
386
+ sub { $S->{getpath}->($_[0]{store}, $_[0]{path}) });
387
+
388
+ grun('getpath.relative', $getpath_spec->{relative}, sub {
389
+ my ($in) = @_;
390
+ my $dpath = $in->{dpath};
391
+ return $S->{getpath}->($in->{store}, $in->{path}, {
392
+ dparent => $in->{dparent},
393
+ (defined $dpath && !ref $dpath ? (dpath => [ split /\./, $dpath ]) : ()),
394
+ });
395
+ });
396
+
397
+ grun('getpath.special', $getpath_spec->{special},
398
+ sub { $S->{getpath}->($_[0]{store}, $_[0]{path}, $_[0]{inj}) });
399
+
400
+ grun('getpath.handler', $getpath_spec->{handler}, sub {
401
+ my ($in) = @_;
402
+ return $S->{getpath}->(
403
+ Voxgig::Struct::jm('$TOP', $in->{store}, '$FOO', sub { 'foo' }),
404
+ $in->{path},
405
+ { handler => sub { my ($_inj, $val, $_cur, $_ref) = @_; return $val->() } },
406
+ );
407
+ });
408
+
409
+
410
+ # ===========================================================================
411
+ # inject
412
+ # ===========================================================================
413
+
414
+ my $inject_spec = $struct_spec->{inject};
415
+
416
+ # `inject.basic` is a single entry, not a set.
417
+ {
418
+ my $basic = ProjectNameOmni::tostruct(
419
+ Voxgig::Omni::Util::clone($inject_spec->{basic}));
420
+ is(canon($S->{inject}->($basic->{in}{val}, $basic->{in}{store})),
421
+ canon($basic->{out}), 'inject.basic');
416
422
  }
417
423
 
418
- # Select. Apply NULLMARK fixup (the canonical runner does this by default
419
- # with flags.null=true so a stored null encodes as "__NULL__").
420
- if (Voxgig::Struct::ismap($struct_spec->{select})) {
421
- my $sl = $struct_spec->{select};
422
- for my $sec (qw(basic operators edge alts)) {
423
- my $entries = $sl->{$sec}{set};
424
- next unless Voxgig::Struct::islist($entries);
425
- for (my $i = 0; $i < @$entries; $i++) {
426
- my $entry = $entries->[$i];
427
- next unless Voxgig::Struct::ismap($entry);
428
- my $in = $entry->{in};
429
- my $obj = $fix_null->(Voxgig::Struct::clone($in->{obj}));
430
- my $query = $fix_null->(Voxgig::Struct::clone($in->{query}));
431
- my $got = Voxgig::Struct::select($obj, $query);
432
- my $exp = $fix_null->(Voxgig::Struct::clone($entry->{out}));
433
- is(canon($got), canon($exp), "select.$sec#$i");
434
- }
435
- }
424
+ # The runner encodes "value is JSON null" as the NULLMARK string so it
425
+ # survives a JSON round trip; the resolver's null_modifier puts THIS
426
+ # port's null (JNULL) back as the structure is built.
427
+ grun('inject.string', $inject_spec->{string},
428
+ sub { $S->{inject}->($_[0]{val}, $_[0]{store},
429
+ { modify => \&ProjectNameOmni::null_modifier }) });
430
+
431
+ grun('inject.deep', $inject_spec->{deep},
432
+ sub { $S->{inject}->($_[0]{val}, $_[0]{store}) });
433
+
434
+
435
+ # ===========================================================================
436
+ # transform
437
+ # ===========================================================================
438
+
439
+ my $transform_spec = $struct_spec->{transform};
440
+
441
+ # `transform.basic` is a single entry, not a set.
442
+ {
443
+ my $basic = ProjectNameOmni::tostruct(
444
+ Voxgig::Omni::Util::clone($transform_spec->{basic}));
445
+ my $got = eval { $S->{transform}->($basic->{in}{data}, $basic->{in}{spec}) };
446
+ is(canon($got), canon($basic->{out}), 'transform.basic');
447
+ }
448
+
449
+ for my $sec (qw(paths cmds each pack ref apply)) {
450
+ grun("transform.$sec", $transform_spec->{$sec},
451
+ sub { $S->{transform}->($_[0]{data}, $_[0]{spec}) });
452
+ }
453
+
454
+ grunflags('transform.format', $transform_spec->{format}, { null => 0 },
455
+ sub { $S->{transform}->($_[0]{data}, $_[0]{spec}) });
456
+
457
+ grun('transform.modify', $transform_spec->{modify}, sub {
458
+ my ($in) = @_;
459
+ return $S->{transform}->($in->{data}, $in->{spec}, {
460
+ modify => sub {
461
+ my ($val, $key, $parent) = @_;
462
+ return if !defined $key || !defined $parent || !ref $parent;
463
+ return if ref $val || !defined $val;
464
+ return if !Voxgig::Struct::_is_string_sv($val);
465
+ Voxgig::Struct::setprop($parent, $key, '@' . $val);
466
+ return;
467
+ },
468
+ });
469
+ });
470
+
471
+
472
+ # ===========================================================================
473
+ # validate
474
+ # ===========================================================================
475
+
476
+ my $validate_spec = $struct_spec->{validate};
477
+
478
+ grunflags('validate.basic', $validate_spec->{basic}, { null => 0 },
479
+ sub { $S->{validate}->($_[0]{data}, $_[0]{spec}) });
480
+
481
+ for my $sec (qw(child one exact)) {
482
+ grun("validate.$sec", $validate_spec->{$sec},
483
+ sub { $S->{validate}->($_[0]{data}, $_[0]{spec}) });
484
+ }
485
+
486
+ grunflags('validate.invalid', $validate_spec->{invalid}, { null => 0 },
487
+ sub { $S->{validate}->($_[0]{data}, $_[0]{spec}) });
488
+
489
+ grun('validate.special', $validate_spec->{special},
490
+ sub { $S->{validate}->($_[0]{data}, $_[0]{spec}, $_[0]{inj}) });
491
+
492
+
493
+ # ===========================================================================
494
+ # select
495
+ # ===========================================================================
496
+
497
+ my $select_spec = $struct_spec->{select};
498
+
499
+ for my $sec (qw(basic operators edge alts)) {
500
+ grun("select.$sec", $select_spec->{$sec},
501
+ sub { $S->{select}->($_[0]{obj}, $_[0]{query}) });
436
502
  }
437
503
 
438
504
  done_testing();