@voxgig/sdkgen-langpack 0.0.1

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 (300) hide show
  1. package/.sdk/model/target/dart.aon +63 -0
  2. package/.sdk/model/target/haskell.aon +72 -0
  3. package/.sdk/model/target/lean.aon +91 -0
  4. package/.sdk/src/cmp/dart/Config_dart.ts +248 -0
  5. package/.sdk/src/cmp/dart/EntityBase_dart.ts +34 -0
  6. package/.sdk/src/cmp/dart/EntityOperation_dart.ts +43 -0
  7. package/.sdk/src/cmp/dart/EntityTypes_dart.ts +207 -0
  8. package/.sdk/src/cmp/dart/Entity_dart.ts +87 -0
  9. package/.sdk/src/cmp/dart/Gitignore_dart.ts +34 -0
  10. package/.sdk/src/cmp/dart/MainEntity_dart.ts +33 -0
  11. package/.sdk/src/cmp/dart/Main_dart.ts +178 -0
  12. package/.sdk/src/cmp/dart/Package_dart.ts +82 -0
  13. package/.sdk/src/cmp/dart/ReadmeEntity_dart.ts +177 -0
  14. package/.sdk/src/cmp/dart/ReadmeExamplesTest_dart.ts +238 -0
  15. package/.sdk/src/cmp/dart/ReadmeExplanation_dart.ts +53 -0
  16. package/.sdk/src/cmp/dart/ReadmeHowto_dart.ts +152 -0
  17. package/.sdk/src/cmp/dart/ReadmeInstall_dart.ts +59 -0
  18. package/.sdk/src/cmp/dart/ReadmeIntro_dart.ts +65 -0
  19. package/.sdk/src/cmp/dart/ReadmeModel_dart.ts +151 -0
  20. package/.sdk/src/cmp/dart/ReadmeOptions_dart.ts +63 -0
  21. package/.sdk/src/cmp/dart/ReadmeQuick_dart.ts +225 -0
  22. package/.sdk/src/cmp/dart/ReadmeRef_dart.ts +397 -0
  23. package/.sdk/src/cmp/dart/ReadmeTopHowto_dart.ts +24 -0
  24. package/.sdk/src/cmp/dart/ReadmeTopQuick_dart.ts +106 -0
  25. package/.sdk/src/cmp/dart/ReadmeTopTest_dart.ts +78 -0
  26. package/.sdk/src/cmp/dart/SdkError_dart.ts +42 -0
  27. package/.sdk/src/cmp/dart/TestDirect_dart.ts +516 -0
  28. package/.sdk/src/cmp/dart/TestEntity_dart.ts +628 -0
  29. package/.sdk/src/cmp/dart/Test_dart.ts +138 -0
  30. package/.sdk/src/cmp/dart/fragment/Config.data.fragment.dart +98 -0
  31. package/.sdk/src/cmp/dart/fragment/Config.fragment.dart +70 -0
  32. package/.sdk/src/cmp/dart/fragment/Direct.test.fragment.dart +25 -0
  33. package/.sdk/src/cmp/dart/fragment/Entity.fragment.dart +29 -0
  34. package/.sdk/src/cmp/dart/fragment/Entity.test.fragment.dart +28 -0
  35. package/.sdk/src/cmp/dart/fragment/EntityBase.fragment.dart +302 -0
  36. package/.sdk/src/cmp/dart/fragment/EntityCreateOp.fragment.dart +98 -0
  37. package/.sdk/src/cmp/dart/fragment/EntityListOp.fragment.dart +90 -0
  38. package/.sdk/src/cmp/dart/fragment/EntityLoadOp.fragment.dart +102 -0
  39. package/.sdk/src/cmp/dart/fragment/EntityRemoveOp.fragment.dart +108 -0
  40. package/.sdk/src/cmp/dart/fragment/EntityUpdateOp.fragment.dart +102 -0
  41. package/.sdk/src/cmp/dart/fragment/Main.fragment.dart +339 -0
  42. package/.sdk/src/cmp/dart/fragment/SdkError.fragment.dart +26 -0
  43. package/.sdk/src/cmp/dart/tsconfig.json +15 -0
  44. package/.sdk/src/cmp/dart/utility_dart.ts +155 -0
  45. package/.sdk/src/cmp/haskell/Config_haskell.ts +98 -0
  46. package/.sdk/src/cmp/haskell/Entity_haskell.ts +13 -0
  47. package/.sdk/src/cmp/haskell/Gitignore_haskell.ts +27 -0
  48. package/.sdk/src/cmp/haskell/Main_haskell.ts +123 -0
  49. package/.sdk/src/cmp/haskell/Package_haskell.ts +60 -0
  50. package/.sdk/src/cmp/haskell/ReadmeEntity_haskell.ts +186 -0
  51. package/.sdk/src/cmp/haskell/ReadmeExamplesTest_haskell.ts +135 -0
  52. package/.sdk/src/cmp/haskell/ReadmeExplanation_haskell.ts +48 -0
  53. package/.sdk/src/cmp/haskell/ReadmeHowto_haskell.ts +168 -0
  54. package/.sdk/src/cmp/haskell/ReadmeInstall_haskell.ts +51 -0
  55. package/.sdk/src/cmp/haskell/ReadmeIntro_haskell.ts +67 -0
  56. package/.sdk/src/cmp/haskell/ReadmeModel_haskell.ts +162 -0
  57. package/.sdk/src/cmp/haskell/ReadmeOptions_haskell.ts +74 -0
  58. package/.sdk/src/cmp/haskell/ReadmeQuick_haskell.ts +241 -0
  59. package/.sdk/src/cmp/haskell/ReadmeRef_haskell.ts +408 -0
  60. package/.sdk/src/cmp/haskell/ReadmeTopHowto_haskell.ts +31 -0
  61. package/.sdk/src/cmp/haskell/ReadmeTopQuick_haskell.ts +104 -0
  62. package/.sdk/src/cmp/haskell/ReadmeTopTest_haskell.ts +80 -0
  63. package/.sdk/src/cmp/haskell/Test_haskell.ts +297 -0
  64. package/.sdk/src/cmp/haskell/tsconfig.json +15 -0
  65. package/.sdk/src/cmp/haskell/utility_haskell.ts +166 -0
  66. package/.sdk/src/cmp/lean/Config_lean.ts +93 -0
  67. package/.sdk/src/cmp/lean/Entity_lean.ts +9 -0
  68. package/.sdk/src/cmp/lean/Gitignore_lean.ts +18 -0
  69. package/.sdk/src/cmp/lean/Main_lean.ts +120 -0
  70. package/.sdk/src/cmp/lean/Package_lean.ts +93 -0
  71. package/.sdk/src/cmp/lean/ReadmeEntity_lean.ts +29 -0
  72. package/.sdk/src/cmp/lean/ReadmeExplanation_lean.ts +19 -0
  73. package/.sdk/src/cmp/lean/ReadmeHowto_lean.ts +25 -0
  74. package/.sdk/src/cmp/lean/ReadmeInstall_lean.ts +39 -0
  75. package/.sdk/src/cmp/lean/ReadmeIntro_lean.ts +25 -0
  76. package/.sdk/src/cmp/lean/ReadmeModel_lean.ts +24 -0
  77. package/.sdk/src/cmp/lean/ReadmeOptions_lean.ts +22 -0
  78. package/.sdk/src/cmp/lean/ReadmeQuick_lean.ts +50 -0
  79. package/.sdk/src/cmp/lean/ReadmeRef_lean.ts +40 -0
  80. package/.sdk/src/cmp/lean/ReadmeTopHowto_lean.ts +16 -0
  81. package/.sdk/src/cmp/lean/ReadmeTopQuick_lean.ts +23 -0
  82. package/.sdk/src/cmp/lean/ReadmeTopTest_lean.ts +19 -0
  83. package/.sdk/src/cmp/lean/Test_lean.ts +261 -0
  84. package/.sdk/src/cmp/lean/utility_lean.ts +129 -0
  85. package/.sdk/tm/dart/LICENSE +22 -0
  86. package/.sdk/tm/dart/Makefile +50 -0
  87. package/.sdk/tm/dart/lib/Context.dart +150 -0
  88. package/.sdk/tm/dart/lib/Control.dart +15 -0
  89. package/.sdk/tm/dart/lib/Operation.dart +31 -0
  90. package/.sdk/tm/dart/lib/Point.dart +51 -0
  91. package/.sdk/tm/dart/lib/Response.dart +32 -0
  92. package/.sdk/tm/dart/lib/Result.dart +39 -0
  93. package/.sdk/tm/dart/lib/Spec.dart +49 -0
  94. package/.sdk/tm/dart/lib/feature/audit/AuditFeature.dart +103 -0
  95. package/.sdk/tm/dart/lib/feature/base/BaseFeature.dart +76 -0
  96. package/.sdk/tm/dart/lib/feature/cache/CacheFeature.dart +152 -0
  97. package/.sdk/tm/dart/lib/feature/clienttrack/ClienttrackFeature.dart +104 -0
  98. package/.sdk/tm/dart/lib/feature/cost/CostFeature.dart +446 -0
  99. package/.sdk/tm/dart/lib/feature/debug/DebugFeature.dart +153 -0
  100. package/.sdk/tm/dart/lib/feature/idempotency/IdempotencyFeature.dart +92 -0
  101. package/.sdk/tm/dart/lib/feature/log/LogFeature.dart +85 -0
  102. package/.sdk/tm/dart/lib/feature/metrics/MetricsFeature.dart +103 -0
  103. package/.sdk/tm/dart/lib/feature/netsim/NetsimFeature.dart +186 -0
  104. package/.sdk/tm/dart/lib/feature/paging/PagingFeature.dart +240 -0
  105. package/.sdk/tm/dart/lib/feature/proxy/ProxyFeature.dart +118 -0
  106. package/.sdk/tm/dart/lib/feature/ratelimit/RatelimitFeature.dart +103 -0
  107. package/.sdk/tm/dart/lib/feature/rbac/RbacFeature.dart +121 -0
  108. package/.sdk/tm/dart/lib/feature/retry/RetryFeature.dart +155 -0
  109. package/.sdk/tm/dart/lib/feature/secrets/SecretsFeature.dart +649 -0
  110. package/.sdk/tm/dart/lib/feature/secrets/plugin/capability.dart +105 -0
  111. package/.sdk/tm/dart/lib/feature/secrets/plugin/catalog.dart +46 -0
  112. package/.sdk/tm/dart/lib/feature/secrets/plugin/config.dart +297 -0
  113. package/.sdk/tm/dart/lib/feature/secrets/plugin/depend.dart +198 -0
  114. package/.sdk/tm/dart/lib/feature/secrets/plugin/env.dart +144 -0
  115. package/.sdk/tm/dart/lib/feature/secrets/plugin/export.dart +58 -0
  116. package/.sdk/tm/dart/lib/feature/secrets/plugin/graph.dart +160 -0
  117. package/.sdk/tm/dart/lib/feature/secrets/plugin/host.dart +1067 -0
  118. package/.sdk/tm/dart/lib/feature/secrets/plugin/order.dart +172 -0
  119. package/.sdk/tm/dart/lib/feature/secrets/plugin/plugin.dart +23 -0
  120. package/.sdk/tm/dart/lib/feature/secrets/plugin/point.dart +117 -0
  121. package/.sdk/tm/dart/lib/feature/secrets/plugin/ref.dart +105 -0
  122. package/.sdk/tm/dart/lib/feature/secrets/plugin/resolve.dart +58 -0
  123. package/.sdk/tm/dart/lib/feature/secrets/plugin/types.dart +201 -0
  124. package/.sdk/tm/dart/lib/feature/secrets/plugin/version.dart +116 -0
  125. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/aws.dart +285 -0
  126. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/azuresecrets.dart +178 -0
  127. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/boru.dart +145 -0
  128. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/crypto.dart +194 -0
  129. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/doppler.dart +101 -0
  130. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/gcpsecrets.dart +143 -0
  131. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/hashicorp.dart +190 -0
  132. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/httpjson.dart +363 -0
  133. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/infisical.dart +149 -0
  134. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/onepassword.dart +146 -0
  135. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/secretspec.dart +116 -0
  136. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/sigv4.dart +237 -0
  137. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/addr.dart +138 -0
  138. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/json.dart +276 -0
  139. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/provider.dart +31 -0
  140. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/providers.dart +243 -0
  141. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/sekreto.dart +730 -0
  142. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/spec.dart +200 -0
  143. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/support.dart +217 -0
  144. package/.sdk/tm/dart/lib/feature/streaming/StreamingFeature.dart +97 -0
  145. package/.sdk/tm/dart/lib/feature/telemetry/TelemetryFeature.dart +136 -0
  146. package/.sdk/tm/dart/lib/feature/test/TestFeature.dart +328 -0
  147. package/.sdk/tm/dart/lib/feature/timeout/TimeoutFeature.dart +104 -0
  148. package/.sdk/tm/dart/lib/utility/CleanUtility.dart +12 -0
  149. package/.sdk/tm/dart/lib/utility/DoneUtility.dart +18 -0
  150. package/.sdk/tm/dart/lib/utility/ErrUtility.dart +46 -0
  151. package/.sdk/tm/dart/lib/utility/FeatureAddUtility.dart +35 -0
  152. package/.sdk/tm/dart/lib/utility/FeatureHookUtility.dart +20 -0
  153. package/.sdk/tm/dart/lib/utility/FeatureInitUtility.dart +9 -0
  154. package/.sdk/tm/dart/lib/utility/FetcherUtility.dart +104 -0
  155. package/.sdk/tm/dart/lib/utility/GraphqlUtility.dart +162 -0
  156. package/.sdk/tm/dart/lib/utility/MakeContextUtility.dart +6 -0
  157. package/.sdk/tm/dart/lib/utility/MakeErrorUtility.dart +71 -0
  158. package/.sdk/tm/dart/lib/utility/MakeFetchDefUtility.dart +42 -0
  159. package/.sdk/tm/dart/lib/utility/MakeOptionsUtility.dart +233 -0
  160. package/.sdk/tm/dart/lib/utility/MakePointUtility.dart +130 -0
  161. package/.sdk/tm/dart/lib/utility/MakeRequestUtility.dart +66 -0
  162. package/.sdk/tm/dart/lib/utility/MakeResponseUtility.dart +59 -0
  163. package/.sdk/tm/dart/lib/utility/MakeResultUtility.dart +49 -0
  164. package/.sdk/tm/dart/lib/utility/MakeSpecUtility.dart +77 -0
  165. package/.sdk/tm/dart/lib/utility/MakeUrlUtility.dart +51 -0
  166. package/.sdk/tm/dart/lib/utility/ParamUtility.dart +56 -0
  167. package/.sdk/tm/dart/lib/utility/PrepareAuthUtility.dart +46 -0
  168. package/.sdk/tm/dart/lib/utility/PrepareBodyUtility.dart +19 -0
  169. package/.sdk/tm/dart/lib/utility/PrepareHeadersUtility.dart +11 -0
  170. package/.sdk/tm/dart/lib/utility/PrepareMethodUtility.dart +30 -0
  171. package/.sdk/tm/dart/lib/utility/PrepareParamsUtility.dart +23 -0
  172. package/.sdk/tm/dart/lib/utility/PreparePathUtility.dart +9 -0
  173. package/.sdk/tm/dart/lib/utility/PrepareQueryUtility.dart +18 -0
  174. package/.sdk/tm/dart/lib/utility/ResultBasicUtility.dart +29 -0
  175. package/.sdk/tm/dart/lib/utility/ResultBodyUtility.dart +15 -0
  176. package/.sdk/tm/dart/lib/utility/ResultHeadersUtility.dart +18 -0
  177. package/.sdk/tm/dart/lib/utility/StructUtility.dart +127 -0
  178. package/.sdk/tm/dart/lib/utility/TransformRequestUtility.dart +28 -0
  179. package/.sdk/tm/dart/lib/utility/TransformResponseUtility.dart +44 -0
  180. package/.sdk/tm/dart/lib/utility/Utility.dart +239 -0
  181. package/.sdk/tm/dart/lib/utility/voxgig_struct.dart +2462 -0
  182. package/.sdk/tm/dart/src/feature/README.md +3 -0
  183. package/.sdk/tm/dart/src/feature/audit/.gitkeep +0 -0
  184. package/.sdk/tm/dart/src/feature/base/.gitkeep +0 -0
  185. package/.sdk/tm/dart/src/feature/cache/.gitkeep +0 -0
  186. package/.sdk/tm/dart/src/feature/clienttrack/.gitkeep +0 -0
  187. package/.sdk/tm/dart/src/feature/cost/.gitkeep +0 -0
  188. package/.sdk/tm/dart/src/feature/debug/.gitkeep +0 -0
  189. package/.sdk/tm/dart/src/feature/idempotency/.gitkeep +0 -0
  190. package/.sdk/tm/dart/src/feature/log/.gitkeep +0 -0
  191. package/.sdk/tm/dart/src/feature/metrics/.gitkeep +0 -0
  192. package/.sdk/tm/dart/src/feature/netsim/.gitkeep +0 -0
  193. package/.sdk/tm/dart/src/feature/paging/.gitkeep +0 -0
  194. package/.sdk/tm/dart/src/feature/proxy/.gitkeep +0 -0
  195. package/.sdk/tm/dart/src/feature/ratelimit/.gitkeep +0 -0
  196. package/.sdk/tm/dart/src/feature/rbac/.gitkeep +0 -0
  197. package/.sdk/tm/dart/src/feature/retry/.gitkeep +0 -0
  198. package/.sdk/tm/dart/src/feature/secrets/.gitkeep +0 -0
  199. package/.sdk/tm/dart/src/feature/streaming/.gitkeep +0 -0
  200. package/.sdk/tm/dart/src/feature/telemetry/.gitkeep +0 -0
  201. package/.sdk/tm/dart/src/feature/test/.gitkeep +0 -0
  202. package/.sdk/tm/dart/src/feature/timeout/.gitkeep +0 -0
  203. package/.sdk/tm/dart/test/custom_test.dart +65 -0
  204. package/.sdk/tm/dart/test/exists_test.dart +12 -0
  205. package/.sdk/tm/dart/test/feature/harness.dart +347 -0
  206. package/.sdk/tm/dart/test/feature/secrets/secrets_test.dart +1107 -0
  207. package/.sdk/tm/dart/test/feature_test.dart +1193 -0
  208. package/.sdk/tm/dart/test/harness.dart +153 -0
  209. package/.sdk/tm/dart/test/netsim_test.dart +48 -0
  210. package/.sdk/tm/dart/test/omni.dart +520 -0
  211. package/.sdk/tm/dart/test/omni_smoke_test.dart +143 -0
  212. package/.sdk/tm/dart/test/pipeline_test.dart +608 -0
  213. package/.sdk/tm/dart/test/primary_test.dart +476 -0
  214. package/.sdk/tm/dart/test/sdk-test-control.json +19 -0
  215. package/.sdk/tm/dart/test/struct_test.dart +468 -0
  216. package/.sdk/tm/dart/test/utility.dart +198 -0
  217. package/.sdk/tm/dart/test/vendor/omni/omni.dart +7 -0
  218. package/.sdk/tm/dart/test/vendor/omni/runner.dart +653 -0
  219. package/.sdk/tm/dart/test/vendor/omni/util.dart +232 -0
  220. package/.sdk/tm/haskell/LICENSE +21 -0
  221. package/.sdk/tm/haskell/Makefile +22 -0
  222. package/.sdk/tm/haskell/VERSION +1 -0
  223. package/.sdk/tm/haskell/src/SdkFeatures.hs +1440 -0
  224. package/.sdk/tm/haskell/src/SdkHelpers.hs +337 -0
  225. package/.sdk/tm/haskell/src/SdkJson.hs +111 -0
  226. package/.sdk/tm/haskell/src/SdkRuntime.hs +1279 -0
  227. package/.sdk/tm/haskell/src/SdkTypes.hs +195 -0
  228. package/.sdk/tm/haskell/src/VoxgigStruct.hs +2299 -0
  229. package/.sdk/tm/haskell/src/Vregex.hs +237 -0
  230. package/.sdk/tm/haskell/src/feature/README.md +5 -0
  231. package/.sdk/tm/haskell/src/feature/audit/.gitkeep +0 -0
  232. package/.sdk/tm/haskell/src/feature/base/.gitkeep +0 -0
  233. package/.sdk/tm/haskell/src/feature/cache/.gitkeep +0 -0
  234. package/.sdk/tm/haskell/src/feature/clienttrack/.gitkeep +0 -0
  235. package/.sdk/tm/haskell/src/feature/debug/.gitkeep +0 -0
  236. package/.sdk/tm/haskell/src/feature/idempotency/.gitkeep +0 -0
  237. package/.sdk/tm/haskell/src/feature/log/.gitkeep +0 -0
  238. package/.sdk/tm/haskell/src/feature/metrics/.gitkeep +0 -0
  239. package/.sdk/tm/haskell/src/feature/netsim/.gitkeep +0 -0
  240. package/.sdk/tm/haskell/src/feature/paging/.gitkeep +0 -0
  241. package/.sdk/tm/haskell/src/feature/proxy/.gitkeep +0 -0
  242. package/.sdk/tm/haskell/src/feature/ratelimit/.gitkeep +0 -0
  243. package/.sdk/tm/haskell/src/feature/rbac/.gitkeep +0 -0
  244. package/.sdk/tm/haskell/src/feature/retry/.gitkeep +0 -0
  245. package/.sdk/tm/haskell/src/feature/streaming/.gitkeep +0 -0
  246. package/.sdk/tm/haskell/src/feature/telemetry/.gitkeep +0 -0
  247. package/.sdk/tm/haskell/src/feature/test/.gitkeep +0 -0
  248. package/.sdk/tm/haskell/src/feature/timeout/.gitkeep +0 -0
  249. package/.sdk/tm/haskell/test/Harness.hs +281 -0
  250. package/.sdk/tm/haskell/test/OmniResolver.hs +252 -0
  251. package/.sdk/tm/haskell/test/Runner.hs +49 -0
  252. package/.sdk/tm/haskell/test/StructCorpus.hs +449 -0
  253. package/.sdk/tm/haskell/test/TCustomUtility.hs +38 -0
  254. package/.sdk/tm/haskell/test/TFeature.hs +794 -0
  255. package/.sdk/tm/haskell/test/TNetsim.hs +50 -0
  256. package/.sdk/tm/haskell/test/TPipeline.hs +334 -0
  257. package/.sdk/tm/haskell/test/TPrimaryCorpus.hs +263 -0
  258. package/.sdk/tm/haskell/test/TPrimaryUtility.hs +386 -0
  259. package/.sdk/tm/haskell/test/Testutil.hs +59 -0
  260. package/.sdk/tm/haskell/test/vendor/omni/Omni.hs +1147 -0
  261. package/.sdk/tm/lean/LICENSE +21 -0
  262. package/.sdk/tm/lean/Makefile +32 -0
  263. package/.sdk/tm/lean/VERSION +1 -0
  264. package/.sdk/tm/lean/src/SdkFeature.lean +171 -0
  265. package/.sdk/tm/lean/src/SdkFeatures.lean +787 -0
  266. package/.sdk/tm/lean/src/SdkJson.lean +134 -0
  267. package/.sdk/tm/lean/src/SdkRuntime.lean +374 -0
  268. package/.sdk/tm/lean/src/SdkUtility.lean +809 -0
  269. package/.sdk/tm/lean/src/VoxgigStruct.lean +2880 -0
  270. package/.sdk/tm/lean/src/Vregex.lean +412 -0
  271. package/.sdk/tm/lean/src/feature/README.md +5 -0
  272. package/.sdk/tm/lean/src/feature/audit/.gitkeep +0 -0
  273. package/.sdk/tm/lean/src/feature/base/.gitkeep +0 -0
  274. package/.sdk/tm/lean/src/feature/cache/.gitkeep +0 -0
  275. package/.sdk/tm/lean/src/feature/clienttrack/.gitkeep +0 -0
  276. package/.sdk/tm/lean/src/feature/cost/.gitkeep +0 -0
  277. package/.sdk/tm/lean/src/feature/debug/.gitkeep +0 -0
  278. package/.sdk/tm/lean/src/feature/idempotency/.gitkeep +0 -0
  279. package/.sdk/tm/lean/src/feature/log/.gitkeep +0 -0
  280. package/.sdk/tm/lean/src/feature/metrics/.gitkeep +0 -0
  281. package/.sdk/tm/lean/src/feature/netsim/.gitkeep +0 -0
  282. package/.sdk/tm/lean/src/feature/paging/.gitkeep +0 -0
  283. package/.sdk/tm/lean/src/feature/proxy/.gitkeep +0 -0
  284. package/.sdk/tm/lean/src/feature/ratelimit/.gitkeep +0 -0
  285. package/.sdk/tm/lean/src/feature/rbac/.gitkeep +0 -0
  286. package/.sdk/tm/lean/src/feature/retry/.gitkeep +0 -0
  287. package/.sdk/tm/lean/src/feature/streaming/.gitkeep +0 -0
  288. package/.sdk/tm/lean/src/feature/telemetry/.gitkeep +0 -0
  289. package/.sdk/tm/lean/src/feature/test/.gitkeep +0 -0
  290. package/.sdk/tm/lean/src/feature/timeout/.gitkeep +0 -0
  291. package/.sdk/tm/lean/test/OmniResolver.lean +358 -0
  292. package/.sdk/tm/lean/test/OmniSmoke.lean +174 -0
  293. package/.sdk/tm/lean/test/StructCorpus.lean +368 -0
  294. package/.sdk/tm/lean/test/TFeature.lean +281 -0
  295. package/.sdk/tm/lean/test/TPrimaryUtility.lean +227 -0
  296. package/.sdk/tm/lean/test/vendor/omni/Omni.lean +997 -0
  297. package/LICENSE +21 -0
  298. package/README.md +104 -0
  299. package/package.json +78 -0
  300. package/sdkgen-package.json +22 -0
@@ -0,0 +1,50 @@
1
+ -- Network-behaviour simulation over the offline mock transport. The `test`
2
+ -- feature accepts an optional `net` config so unit tests can exercise slow,
3
+ -- failing and offline conditions without a live server. These drive the
4
+ -- transport through direct(), which needs no entity.
5
+
6
+ module TNetsim (tests) where
7
+
8
+ import Data.IORef (readIORef)
9
+
10
+ import VoxgigStruct (Value (..))
11
+ import SdkTypes
12
+ import SdkHelpers
13
+ import qualified SdkFeatures as F
14
+ import qualified SdkClient as C
15
+ import Testutil
16
+
17
+ tests :: Counters -> IO ()
18
+ tests c = do
19
+ runTest c "netsim.offline_fails" $ do
20
+ net <- jo [("offline", VBool True)]
21
+ opt <- jo [("net", net)]
22
+ sdk <- C.testSdk opt VNoval
23
+ args <- jo [("path", VStr "/ping")]
24
+ res <- F.direct sdk args
25
+ ok <- getp res "ok"
26
+ pure (not (isTrueV ok))
27
+
28
+ runTest c "netsim.failstatus_surfaces_status" $ do
29
+ net <- jo [("failTimes", VNum 1), ("failStatus", VNum 503)]
30
+ opt <- jo [("net", net)]
31
+ sdk <- C.testSdk opt VNoval
32
+ args <- jo [("path", VStr "/ping")]
33
+ res <- F.direct sdk args
34
+ ok <- getp res "ok"
35
+ st <- getp res "status"
36
+ pure (not (isTrueV ok) && toInt st == 503)
37
+
38
+ runTest c "netsim.errortimes_conn_error" $ do
39
+ net <- jo [("errorTimes", VNum 1)]
40
+ opt <- jo [("net", net)]
41
+ sdk <- C.testSdk opt VNoval
42
+ args <- jo [("path", VStr "/ping")]
43
+ res <- F.direct sdk args
44
+ ok <- getp res "ok"
45
+ pure (not (isTrueV ok))
46
+
47
+ runTest c "netsim.plain_test_mode" $ do
48
+ sdk <- C.testSdk0
49
+ m <- readIORef (clMode sdk)
50
+ pure (m == "test")
@@ -0,0 +1,334 @@
1
+ -- Direct unit tests for the operation-pipeline utilities (mirrors the dynamic
2
+ -- donors' test_pipeline). Drives the error/edge branches a happy-path op never
3
+ -- reaches. API-agnostic: everything is reached through the client utility.
4
+
5
+ module TPipeline (tests) where
6
+
7
+ import Data.IORef
8
+ import Data.Maybe (isNothing)
9
+
10
+ import VoxgigStruct (Value (..), emptyMap, emptyList, mkList, size, ismap, isNoval, vint)
11
+ import SdkTypes
12
+ import SdkHelpers
13
+ import SdkRuntime
14
+ import qualified SdkFeatures as F
15
+ import qualified SdkClient as C
16
+ import Testutil
17
+
18
+ client :: IO Client
19
+ client = C.testSdk0
20
+
21
+ mkCtx :: Client -> String -> IO Context
22
+ mkCtx cl opname = do
23
+ root <- readIORef (clRootctx cl)
24
+ makeContextImpl (defaultCtxSpec { csOpname = Just opname, csClient = Just cl, csUtility = Just (clUtility cl) }) root
25
+
26
+ mkCtxCtrl :: Client -> String -> Value -> IO Context
27
+ mkCtxCtrl cl opname ctrl = do
28
+ root <- readIORef (clRootctx cl)
29
+ makeContextImpl (defaultCtxSpec { csOpname = Just opname, csClient = Just cl, csUtility = Just (clUtility cl), csCtrl = Just ctrl }) root
30
+
31
+ fullSpec :: IO Value
32
+ fullSpec = do
33
+ pm <- emptyMap; qm <- emptyMap; hm <- emptyMap
34
+ newSpec =<< jo [("base", VStr "http://h"), ("prefix", VStr ""), ("suffix", VStr ""), ("path", VStr "a"), ("method", VStr "GET"), ("params", pm), ("query", qm), ("headers", hm), ("step", VStr "s")]
35
+
36
+ respMap :: Int -> Value -> [(String, Value)] -> IO Value
37
+ respMap status dat headers = do
38
+ hm <- emptyMap
39
+ mapM_ (\(k, v) -> setp hm (lower k) v) headers
40
+ newResponse =<< jo [("status", vint status), ("statusText", VStr (if status < 400 then "OK" else "ERR")), ("headers", hm), ("json", jsonThunk dat), ("body", VStr "body")]
41
+
42
+ namedFeature :: String -> Value -> IO Feature
43
+ namedFeature nm opts = do
44
+ active <- newIORef True; fopts <- newIORef opts
45
+ pure Feature { fName = nm, fVersion = "0.0.1", fActive = active, fOptions = fopts, fInit = \_ _ -> pure (), fHook = \_ _ -> pure () }
46
+
47
+ errCodeIs :: Value -> String -> IO Bool
48
+ errCodeIs e code = do c <- errCode e; pure (c == code)
49
+
50
+ tests :: Counters -> IO ()
51
+ tests c = do
52
+ -- feature order (PR review #2): makeOptions resolves the feature add-order
53
+ -- into __derived__.featureorder. A map defaults test-first (so the test mock
54
+ -- is the base transport), an explicit array preserves the developer order,
55
+ -- and a map without test is deterministic (names sorted).
56
+ let orderNames opts = do
57
+ fo <- getpathS opts "__derived__.featureorder"
58
+ case fo of
59
+ VList ref -> do { xs <- readIORef ref; pure [s | VStr s <- xs] }
60
+ _ -> pure []
61
+ resolveOrder feature = do
62
+ cl <- client
63
+ ctx <- mkCtx cl "load"
64
+ o <- jo [("feature", feature)]; writeIORef (cOptions ctx) o
65
+ cfgo <- emptyMap; cf <- jo [("options", cfgo)]; writeIORef (cConfig ctx) cf
66
+ makeOptionsUtil ctx
67
+
68
+ runTest c "feature_order.map_test_first" $ do
69
+ m <- jo [("active", VBool True)]; t <- jo [("active", VBool True)]
70
+ feat <- jo [("metrics", m), ("test", t)]
71
+ o <- resolveOrder feat
72
+ order <- orderNames o
73
+ pure (order == ["test", "metrics"])
74
+
75
+ runTest c "feature_order.array_preserves_order" $ do
76
+ e1 <- jo [("name", VStr "metrics"), ("active", VBool True)]
77
+ e2 <- jo [("name", VStr "test"), ("active", VBool True)]
78
+ feat <- ja [e1, e2]
79
+ o <- resolveOrder feat
80
+ order <- orderNames o
81
+ ma <- getpathS o "feature.metrics.active"
82
+ ta <- getpathS o "feature.test.active"
83
+ pure (order == ["metrics", "test"] && isTrueV ma && isTrueV ta)
84
+
85
+ runTest c "feature_order.map_no_test_deterministic" $ do
86
+ r <- jo [("active", VBool True)]; ca <- jo [("active", VBool True)]
87
+ feat <- jo [("retry", r), ("cache", ca)]
88
+ o <- resolveOrder feat
89
+ order <- orderNames o
90
+ pure (order == ["cache", "retry"])
91
+
92
+ runTest c "make_point.rejects_disallowed_op" $ do
93
+ cl <- client; ctx <- mkCtx cl "nope"
94
+ ao <- jo [("op", VStr "load")]; o <- jo [("allow", ao)]; writeIORef (cOptions ctx) o
95
+ (_, merr) <- makePointUtil ctx
96
+ case merr of Just e -> errCodeIs e "point_op_allow"; Nothing -> pure False
97
+
98
+ runTest c "make_point.rejects_no_endpoints" $ do
99
+ cl <- client; ctx <- mkCtx cl "load"
100
+ (_, merr) <- makePointUtil ctx
101
+ case merr of Just e -> errCodeIs e "point_no_points"; Nothing -> pure False
102
+
103
+ runTest c "make_point.single_point" $ do
104
+ cl <- client; ctx <- mkCtx cl "load"
105
+ parts <- ja [VStr "a"]
106
+ point <- jo [("method", VStr "GET"), ("parts", parts)]
107
+ pts <- ja [point]
108
+ op <- newOperation =<< jo [("name", VStr "load"), ("points", pts)]
109
+ writeIORef (cOp ctx) op
110
+ (out, merr) <- makePointUtil ctx
111
+ m <- getp out "method"
112
+ pt <- readIORef (cPoint ctx)
113
+ pure (isNothing merr && vstring m == "GET" && ismap pt)
114
+
115
+ runTest c "make_point.short_circuits_preset" $ do
116
+ cl <- client; ctx <- mkCtx cl "load"
117
+ preset <- jo [("method", VStr "GET")]
118
+ out <- readIORef (cOut ctx); setp out "point" preset
119
+ (o, merr) <- makePointUtil ctx
120
+ m <- getp o "method"
121
+ pure (isNothing merr && vstring m == "GET")
122
+
123
+ runTest c "make_point.surfaces_feature_error" $ do
124
+ cl <- client; ctx <- mkCtx cl "load"
125
+ denied <- mkErr "rbac_denied" "no permission"
126
+ out <- readIORef (cOut ctx); setp out "point" denied
127
+ (_, merr) <- makePointUtil ctx
128
+ case merr of Just e -> errCodeIs e "rbac_denied"; Nothing -> pure False
129
+
130
+ runTest c "make_spec.short_circuits_preset" $ do
131
+ cl <- client; ctx <- mkCtx cl "load"
132
+ preset <- newSpec =<< jo [("method", VStr "GET")]
133
+ out <- readIORef (cOut ctx); setp out "spec" preset
134
+ (o, merr) <- makeSpecUtil ctx
135
+ m <- getp o "method"
136
+ pure (isNothing merr && vstring m == "GET")
137
+
138
+ runTest c "make_spec.surfaces_feature_error" $ do
139
+ cl <- client; ctx <- mkCtx cl "load"
140
+ boom <- mkErr "boom" "boom"
141
+ out <- readIORef (cOut ctx); setp out "spec" boom
142
+ (_, merr) <- makeSpecUtil ctx
143
+ case merr of Just e -> errCodeIs e "boom"; Nothing -> pure False
144
+
145
+ runTest c "make_response.guard_no_spec" $ do
146
+ cl <- client; ctx <- mkCtx cl "load"
147
+ writeIORef (cSpec ctx) VNoval
148
+ r <- respMap 200 VNoval []; writeIORef (cResponse ctx) r
149
+ res <- newResult =<< emptyMap; writeIORef (cResult ctx) res
150
+ (_, merr) <- makeResponseUtil ctx
151
+ case merr of Just e -> errCodeIs e "response_no_spec"; Nothing -> pure False
152
+
153
+ runTest c "make_response.4xx_sets_err_and_headers" $ do
154
+ cl <- client; ctx <- mkCtx cl "load"
155
+ sp <- fullSpec; writeIORef (cSpec ctx) sp
156
+ r <- respMap 404 VNoval [("x-a", VStr "1")]; writeIORef (cResponse ctx) r
157
+ res <- newResult =<< emptyMap; writeIORef (cResult ctx) res
158
+ _ <- makeResponseUtil ctx
159
+ rv <- readIORef (cResult ctx)
160
+ errv <- getp rv "err"; isE <- isErr errv
161
+ st <- getp rv "status"; ha <- getp rv "headers" >>= \h -> getp h "x-a"
162
+ ok <- getp rv "ok"
163
+ pure (isE && toInt st == 404 && vstring ha == "1" && not (isTrueV ok))
164
+
165
+ runTest c "make_response.2xx_parses_body" $ do
166
+ cl <- client; ctx <- mkCtx cl "load"
167
+ sp <- fullSpec; writeIORef (cSpec ctx) sp
168
+ d <- jo [("v", VNum 1)]
169
+ r <- respMap 200 d []; writeIORef (cResponse ctx) r
170
+ res <- newResult =<< emptyMap; writeIORef (cResult ctx) res
171
+ _ <- makeResponseUtil ctx
172
+ rv <- readIORef (cResult ctx)
173
+ ok <- getp rv "ok"; bv <- getp rv "body" >>= \b -> getp b "v"
174
+ pure (isTrueV ok && (case bv of VNum n -> n == 1; _ -> False))
175
+
176
+ runTest c "make_response.records_explain" $ do
177
+ cl <- client; ex <- emptyMap; ctrl <- jo [("explain", ex)]
178
+ ctx <- mkCtxCtrl cl "load" ctrl
179
+ sp <- fullSpec; writeIORef (cSpec ctx) sp
180
+ d <- jo [("v", VNum 2)]; r <- respMap 200 d []; writeIORef (cResponse ctx) r
181
+ res <- newResult =<< emptyMap; writeIORef (cResult ctx) res
182
+ _ <- makeResponseUtil ctx
183
+ ctrlV <- readIORef (cCtrl ctx); exv <- getp ctrlV "explain"; resv <- getp exv "result"
184
+ pure (ismap resv)
185
+
186
+ runTest c "make_result.guard_no_result" $ do
187
+ cl <- client; ctx <- mkCtx cl "load"
188
+ sp <- fullSpec; writeIORef (cSpec ctx) sp
189
+ writeIORef (cResult ctx) VNoval
190
+ (_, merr) <- makeResultUtil ctx
191
+ case merr of Just e -> errCodeIs e "result_no_result"; Nothing -> pure False
192
+
193
+ runTest c "make_result.list_wraps_resdata" $ do
194
+ cl <- client; ctx <- mkCtx cl "list"
195
+ ent <- F.makeEntity cl "planet" VNoval; writeIORef (cEntity ctx) (Just ent)
196
+ sp <- fullSpec; writeIORef (cSpec ctx) sp
197
+ a1 <- jo [("a", VNum 1)]; a2 <- jo [("a", VNum 2)]; rd <- ja [a1, a2]
198
+ res <- newResult =<< jo [("resdata", rd)]; writeIORef (cResult ctx) res
199
+ (ro, merr) <- makeResultUtil ctx
200
+ n <- getp ro "resdata" >>= size
201
+ pure (isNothing merr && n == 2)
202
+
203
+ runTest c "make_request.guard_no_spec" $ do
204
+ cl <- client; ctx <- mkCtx cl "load"
205
+ writeIORef (cSpec ctx) VNoval
206
+ (_, merr) <- makeRequestUtil ctx
207
+ case merr of Just e -> errCodeIs e "request_no_spec"; Nothing -> pure False
208
+
209
+ runTest c "make_request.transport_error_on_response" $ do
210
+ cl <- client; ctx <- mkCtx cl "load"
211
+ u <- copyUtility (clUtility cl)
212
+ boom <- mkErr "boom" "boom"
213
+ writeIORef (uFetcher u) (\_ _ _ -> pure (VNoval, Just boom))
214
+ writeIORef (cUtility ctx) (Just u)
215
+ sp <- fullSpec; writeIORef (cSpec ctx) sp
216
+ (ro, _) <- makeRequestUtil ctx
217
+ errv <- getp ro "err"; errCodeIs errv "boom"
218
+
219
+ runTest c "make_request.null_transport" $ do
220
+ cl <- client; ctx <- mkCtx cl "load"
221
+ u <- copyUtility (clUtility cl)
222
+ writeIORef (uFetcher u) (\_ _ _ -> pure (VNoval, Nothing))
223
+ writeIORef (cUtility ctx) (Just u)
224
+ sp <- fullSpec; writeIORef (cSpec ctx) sp
225
+ (ro, _) <- makeRequestUtil ctx
226
+ errv <- getp ro "err"; errCodeIs errv "request_no_response"
227
+
228
+ runTest c "make_fetch_def.guard_no_spec" $ do
229
+ cl <- client; ctx <- mkCtx cl "load"
230
+ writeIORef (cSpec ctx) VNoval
231
+ (_, merr) <- makeFetchDefUtil ctx
232
+ case merr of Just e -> errCodeIs e "fetchdef_no_spec"; Nothing -> pure False
233
+
234
+ runTest c "make_fetch_def.serialises_body" $ do
235
+ cl <- client; ctx <- mkCtx cl "load"
236
+ writeIORef (cResult ctx) VNoval
237
+ sp <- fullSpec; setp sp "method" (VStr "POST"); b <- jo [("x", VNum 1)]; setp sp "body" b
238
+ writeIORef (cSpec ctx) sp
239
+ (fd, merr) <- makeFetchDefUtil ctx
240
+ bs <- getp fd "body"
241
+ rv <- readIORef (cResult ctx)
242
+ pure (isNothing merr && (case bs of VStr s -> not (null s); _ -> False) && ismap rv)
243
+
244
+ runTest c "done.returns_resdata_on_success" $ do
245
+ cl <- client; ctx <- mkCtx cl "load"
246
+ res <- newResult =<< jo [("ok", VBool True), ("resdata", VNum 42)]; writeIORef (cResult ctx) res
247
+ r <- doneUtil ctx
248
+ pure (case r of VNum n -> n == 42; _ -> False)
249
+
250
+ runTest c "make_error.returns_resdata_when_throw_disabled" $ do
251
+ cl <- client; ctrl <- jo [("throw_err", VBool False)]
252
+ ctx <- mkCtxCtrl cl "load" ctrl
253
+ res <- newResult =<< jo [("ok", VBool False), ("resdata", VStr "fallback")]; writeIORef (cResult ctx) res
254
+ r <- makeErrorUtil ctx Nothing
255
+ pure (vstring r == "fallback")
256
+
257
+ runTest c "make_error.records_explain" $ do
258
+ cl <- client; ex <- emptyMap; ctrl <- jo [("throw_err", VBool False), ("explain", ex)]
259
+ ctx <- mkCtxCtrl cl "load" ctrl
260
+ res <- newResult =<< jo [("ok", VBool False)]; writeIORef (cResult ctx) res
261
+ _ <- makeErrorUtil ctx Nothing
262
+ ctrlV <- readIORef (cCtrl ctx); exv <- getp ctrlV "explain"; errv <- getp exv "err"
263
+ pure (ismap errv)
264
+
265
+ runTest c "feature_add.appends_in_order" $ do
266
+ cl <- client; ctx <- mkCtx cl "load"
267
+ start <- readIORef (clFeatures cl) >>= \fs -> pure (map fName fs)
268
+ a <- namedFeature "aaa" VNoval; z <- namedFeature "zzz" VNoval
269
+ featureAddUtil ctx a; featureAddUtil ctx z
270
+ names <- readIORef (clFeatures cl) >>= \fs -> pure (map fName fs)
271
+ pure (names == start ++ ["aaa", "zzz"])
272
+
273
+ runTest c "feature_add.ordering" $ do
274
+ cl <- client; ctx <- mkCtx cl "load"
275
+ writeIORef (clFeatures cl) []
276
+ let names = readIORef (clFeatures cl) >>= \fs -> pure (map fName fs)
277
+ fa <- namedFeature "a" VNoval; fb <- namedFeature "b" VNoval
278
+ featureAddUtil ctx fa; featureAddUtil ctx fb
279
+ n1 <- names
280
+ ob <- jo [("__before__", VStr "b")]; z1 <- namedFeature "z1" ob; featureAddUtil ctx z1
281
+ n2 <- names
282
+ oa <- jo [("__after__", VStr "a")]; z2 <- namedFeature "z2" oa; featureAddUtil ctx z2
283
+ n3 <- names
284
+ orp <- jo [("__replace__", VStr "z1")]; z3 <- namedFeature "z3" orp; featureAddUtil ctx z3
285
+ n4 <- names
286
+ om <- jo [("__before__", VStr "missing")]; z4 <- namedFeature "z4" om; featureAddUtil ctx z4
287
+ n5 <- names
288
+ pure (n1 == ["a", "b"] && n2 == ["a", "z1", "b"] && n3 == ["a", "z2", "z1", "b"] && n4 == ["a", "z2", "z3", "b"] && n5 == ["a", "z2", "z3", "b", "z4"])
289
+
290
+ runTest c "feature.transport_wrapping_order" $ do
291
+ cl <- client; ctx <- readIORef (clRootctx cl) >>= \(Just r) -> pure r
292
+ let u = clUtility cl
293
+ order <- newIORef []
294
+ writeIORef (uFetcher u) (\_ _ _ -> do modifyIORef order (++ ["server"]); r <- jo [("status", VNum 200), ("statusText", VStr "OK")]; pure (r, Nothing))
295
+ let wrap tag = do inner <- readIORef (uFetcher u); writeIORef (uFetcher u) (\cc url fd -> do modifyIORef order (++ [tag]); inner cc url fd)
296
+ wrap "first"; wrap "second"
297
+ fetcher <- readIORef (uFetcher u)
298
+ hm <- emptyMap; fd <- jo [("method", VStr "GET"), ("headers", hm)]
299
+ _ <- fetcher ctx "http://h/a" fd
300
+ o <- readIORef order
301
+ pure (o == ["second", "first", "server"])
302
+
303
+ runTest c "prepare_auth.apikey_prefix_space_joined" $ do
304
+ cl <- client; ctx <- mkCtx cl "load"
305
+ ap <- jo [("prefix", VStr "Bearer")]; o <- jo [("apikey", VStr "K"), ("auth", ap)]; writeIORef (clOptions cl) o
306
+ hm <- emptyMap; sp <- newSpec =<< jo [("headers", hm)]; writeIORef (cSpec ctx) sp
307
+ _ <- prepareAuthUtil ctx
308
+ spv <- readIORef (cSpec ctx); h <- getp spv "headers"; av <- getp h "authorization"
309
+ pure (vstring av == "Bearer K")
310
+
311
+ runTest c "prepare_auth.empty_apikey_drops_header" $ do
312
+ cl <- client; ctx <- mkCtx cl "load"
313
+ ap <- jo [("prefix", VStr "Bearer")]; o <- jo [("apikey", VStr ""), ("auth", ap)]; writeIORef (clOptions cl) o
314
+ stale <- jo [("authorization", VStr "stale")]; sp <- newSpec =<< jo [("headers", stale)]; writeIORef (cSpec ctx) sp
315
+ _ <- prepareAuthUtil ctx
316
+ spv <- readIORef (cSpec ctx); h <- getp spv "headers"; av <- getp h "authorization"
317
+ pure (isNoval av)
318
+
319
+ runTest c "result_headers.no_headers_empty_map" $ do
320
+ cl <- client; ctx <- mkCtx cl "load"
321
+ r <- newResponse =<< jo [("status", VNum 200)]; writeIORef (cResponse ctx) r
322
+ res <- newResult =<< emptyMap; writeIORef (cResult ctx) res
323
+ resultHeadersUtil ctx
324
+ rv <- readIORef (cResult ctx); h <- getp rv "headers"; n <- size h
325
+ pure (n == 0)
326
+
327
+ runTest c "result_body.skips_absent_body" $ do
328
+ cl <- client; ctx <- mkCtx cl "load"
329
+ d <- jo [("a", VNum 1)]
330
+ r <- newResponse =<< jo [("status", VNum 200), ("json", jsonThunk d)]; writeIORef (cResponse ctx) r
331
+ res <- newResult =<< emptyMap; writeIORef (cResult ctx) res
332
+ resultBodyUtil ctx
333
+ rv <- readIORef (cResult ctx); b <- getp rv "body"
334
+ pure (isNoval b)
@@ -0,0 +1,263 @@
1
+ -- ProjectName SDK primary-utility corpus.
2
+ --
3
+ -- Drives the SHARED language-neutral corpus (../.sdk/test/test.json ->
4
+ -- "primary") through this SDK's request-shaping utilities, so the cases
5
+ -- cannot drift from the reference implementation. Each section is looked up
6
+ -- by name and executed on the VENDORED @voxgig/omni engine through
7
+ -- OmniResolver, exactly as the ts/js reference harness does.
8
+ --
9
+ -- This is what makes the target FULL tier. `TPrimaryUtility` remains beside
10
+ -- it: its hand-written cases cover utilities the 22 corpus sections do not
11
+ -- reach (featureAdd/featureHook/featureInit, fetcher, clean), and deleting
12
+ -- them to "replace with the corpus" would lose coverage rather than gain it.
13
+ --
14
+ -- Every section uses `runsetArgs`: a `ctx` entry arrives as the first
15
+ -- argument, a MAP, which the call site turns into a LIVE Context, runs the
16
+ -- utility on, and writes the observable state back into — which is what makes
17
+ -- `match: {ctx: ...}` (retargeted onto `match: {args: {"0": ...}}` by the
18
+ -- resolver, decision 3) read the POST-call state rather than a stale
19
+ -- pre-call copy.
20
+
21
+ {-# LANGUAGE LambdaCase #-}
22
+ {-# LANGUAGE ScopedTypeVariables #-}
23
+
24
+ module TPrimaryCorpus (tests) where
25
+
26
+ import Control.Exception (try)
27
+ import Control.Monad (forM_, when)
28
+ import Data.Char (toLower)
29
+ import Data.IORef
30
+
31
+ import qualified Omni as O
32
+ import OmniResolver
33
+
34
+ import VoxgigStruct (Value (..), emptyMap, ismap, isNoval, keysof, mkList)
35
+ import SdkTypes
36
+ import SdkHelpers
37
+ import SdkRuntime
38
+ import qualified SdkClient as C
39
+ import Testutil
40
+
41
+
42
+ -- A client built from a section's DEF.setup.a block. prepareAuth reads the
43
+ -- CLIENT's options, as the ts reference does via client.options(), so a
44
+ -- section's setup cannot reach it through ctx.options.
45
+ clientFor :: Runner -> String -> IO Client
46
+ clientFor r name = do
47
+ let setup = O.getpath (runnerSpec r) [name, "DEF", "setup", "a"]
48
+ if O.ismap setup
49
+ -- `testSdk testopts sdkopts` — a section's setup block is SDK options
50
+ -- (base/prefix/suffix), so it is the SECOND argument. Passing it as the
51
+ -- first made it test options, which makeSpec never reads: every base,
52
+ -- prefix and suffix came out empty.
53
+ then do sv <- tostruct setup; C.testSdk VNoval sv
54
+ else C.testSdk0
55
+
56
+
57
+ -- A LIVE Context from a corpus map. This port stores spec, result and
58
+ -- response as plain `IORef Value`, so the corpus's maps go straight in —
59
+ -- no typed-record construction, unlike the ocaml and rust peers.
60
+ ctxFrom :: Client -> Value -> IO Context
61
+ ctxFrom cl ctxmap = do
62
+ -- The corpus names the op — {"ctx": {"opname": "create"}} — and
63
+ -- prepareMethod reads it. Hardcoding "load" made every method GET, and
64
+ -- defaulting to it made the SDK report the wrong operation where the
65
+ -- corpus expects "unknown operation".
66
+ opname <- getp ctxmap "opname"
67
+ let cs = case opname of
68
+ VStr s -> defaultCtxSpec { csOpname = Just s, csClient = Just cl
69
+ , csUtility = Just (clUtility cl) }
70
+ _ -> defaultCtxSpec { csClient = Just cl, csUtility = Just (clUtility cl) }
71
+ root <- readIORef (clRootctx cl)
72
+ ctx <- makeContextImpl cs root
73
+
74
+ let put ref key = do
75
+ v <- getp ctxmap key
76
+ when (not (isNoval v)) (writeIORef ref v)
77
+
78
+ put (cSpec ctx) "spec"
79
+ put (cResult ctx) "result"
80
+
81
+ -- The corpus writes `result.err` as a plain {"message": ...}, but `isErr`
82
+ -- recognises an error by its `__sdkerr__` marker — so resultBasic saw no
83
+ -- previous error and dropped the message it must PREPEND ("Foo: request:
84
+ -- 400: BAD" came out as "request: 400: BAD"). Rebuild it as a real error.
85
+ -- The ocaml and lua drivers do the same for the same reason.
86
+ resv <- readIORef (cResult ctx)
87
+ when (ismap resv) $ do
88
+ err <- getp resv "err"
89
+ when (ismap err) $ do
90
+ m <- getp err "message"
91
+ case m of
92
+ VStr msg | not (null msg) -> do e <- mkErr "" msg; setp resv "err" e
93
+ _ -> pure ()
94
+ put (cPoint ctx) "point"
95
+ put (cReqdata ctx) "reqdata"
96
+ put (cReqmatch ctx) "reqmatch"
97
+ put (cData ctx) "data"
98
+ put (cMatch ctx) "match"
99
+ put (cConfig ctx) "config"
100
+ put (cOptions ctx) "options"
101
+
102
+ response <- getp ctxmap "response"
103
+ when (ismap response) $ do
104
+ -- resultBodyUtil reads response.json and requires it to be CALLABLE;
105
+ -- the corpus supplies a plain `body`, so wrap it, as the ocaml, lua and
106
+ -- elixir drivers do. Without this every ctx.result.body match reads empty.
107
+ body <- getp response "body"
108
+ when (not (isNoval body)) $
109
+ setp response "json" (VFunc (\_ _ _ _ -> pure body))
110
+ -- Header names arrive from the wire in any case and the contract is
111
+ -- lowercase; resultHeadersUtil copies them verbatim, so normalise here
112
+ -- rather than in the utility, as the other drivers do.
113
+ hdrs <- getp response "headers"
114
+ when (ismap hdrs) $ do
115
+ low <- emptyMap
116
+ ks <- keysof hdrs
117
+ forM_ ks $ \k -> do v <- getp hdrs k; setp low (map toLower k) v
118
+ setp response "headers" low
119
+ writeIORef (cResponse ctx) response
120
+
121
+ pure ctx
122
+
123
+
124
+ -- Publish the MUTATED state back onto the corpus map the match reads. The
125
+ -- resolver retargets `match: {ctx: ...}` onto `match: {args: {"0": ...}}` and
126
+ -- writes the argument array back after the call, so this map IS what the
127
+ -- assertions read — but only for the state written here.
128
+ publish :: Value -> Context -> IO ()
129
+ publish ctxmap ctx = do
130
+ sp <- readIORef (cSpec ctx)
131
+ when (not (isNoval sp)) (setp ctxmap "spec" sp)
132
+ rs <- readIORef (cResult ctx)
133
+ when (not (isNoval rs)) (setp ctxmap "result" rs)
134
+ rp <- readIORef (cResponse ctx)
135
+ when (not (isNoval rp)) (setp ctxmap "response" (VStr O.existsmark))
136
+
137
+
138
+ -- A `UResult` utility reports its error in the second component. Raise it, so
139
+ -- omni sees a subject failure and an `err` entry can match on the message;
140
+ -- returning it as data would make every error case read as a pass.
141
+ ures :: UResult -> IO Value
142
+ ures act = do
143
+ (v, merr) <- act
144
+ case merr of
145
+ Just e | not (isNoval e) -> do
146
+ msg <- getp e "message"
147
+ case msg of
148
+ VStr m -> errorWithoutStackTrace m
149
+ _ -> pure v
150
+ _ -> pure v
151
+
152
+
153
+ -- The SDK raises `SdkException`, whose `Show` instance is the constant
154
+ -- "DemoSDK error" — the message lives in the wrapped value. omni renders an
155
+ -- unknown exception through `displayException`, so without this every `err`
156
+ -- entry matched against that constant instead of the real message. Translated
157
+ -- HERE, not in OmniResolver, because this is where `SdkTypes` is in scope.
158
+ guarded :: IO Value -> IO Value
159
+ guarded act = do
160
+ r <- try act
161
+ case r of
162
+ Right v -> pure v
163
+ Left (SdkException ev) -> do
164
+ m <- errMsg ev
165
+ errorWithoutStackTrace m
166
+
167
+
168
+ arg :: [Value] -> Int -> Value
169
+ arg vs i = if i < length vs then vs !! i else VNoval
170
+
171
+
172
+ tests :: Counters -> Value -> IO ()
173
+ tests c alltests = do
174
+ jalltests <- toomni alltests
175
+ r <- newRunner jalltests "primary"
176
+
177
+ cl <- C.testSdk0
178
+
179
+ -- Sections whose first argument IS the ctx map.
180
+ -- Every section goes through `guarded`: the bare-args ones raise the same
181
+ -- branded exception as the ctx ones, and makeError raises it BY DESIGN.
182
+ let runsetVals name f = runsetArgs r name (guarded . f)
183
+ runsetCtxWith cl2 name f =
184
+ runsetArgs r name $ \args -> do
185
+ let ctxmap = arg args 0
186
+ ctx <- ctxFrom cl2 ctxmap
187
+ out <- guarded (f ctx)
188
+ publish ctxmap ctx
189
+ pure out
190
+ runsetCtx name f = runsetCtxWith cl name f
191
+
192
+ runsetCtx "done" doneUtil
193
+ runsetCtx "makeUrl" (\ctx -> ures (makeUrlUtil ctx))
194
+ runsetCtx "makeRequest" (\ctx -> ures (makeRequestUtil ctx) >> readIORef (cResult ctx))
195
+ runsetCtx "makeResponse" (\ctx -> ures (makeResponseUtil ctx) >> readIORef (cResult ctx))
196
+ runsetCtx "prepareBody" prepareBodyUtil
197
+ runsetCtx "prepareHeaders" prepareHeadersUtil
198
+ runsetCtx "prepareMethod" (\ctx -> do
199
+ m <- prepareMethodUtil ctx
200
+ pure (if null m then VNoval else VStr m))
201
+ runsetCtx "prepareParams" prepareParamsUtil
202
+ runsetCtx "preparePath" (\ctx -> VStr <$> preparePathUtil ctx)
203
+ runsetCtx "prepareQuery" prepareQueryUtil
204
+ runsetCtx "resultBasic" (\ctx -> resultBasicUtil ctx >> readIORef (cResult ctx))
205
+ runsetCtx "resultBody" (\ctx -> resultBodyUtil ctx >> readIORef (cResult ctx))
206
+ runsetCtx "resultHeaders" (\ctx -> resultHeadersUtil ctx >> readIORef (cResult ctx))
207
+ runsetCtx "transformRequest" transformRequestUtil
208
+ runsetCtx "transformResponse" transformResponseUtil
209
+
210
+ -- Sections configured by their own DEF.setup block get their own client.
211
+ clSpec <- clientFor r "makeSpec"
212
+ runsetCtxWith clSpec "makeSpec" (\ctx -> ures (makeSpecUtil ctx))
213
+ clAuth <- clientFor r "prepareAuth"
214
+ runsetCtxWith clAuth "prepareAuth"
215
+ (\ctx -> ures (prepareAuthUtil ctx) >> readIORef (cSpec ctx))
216
+
217
+ -- Sections that take a bare map or explicit args rather than a ctx.
218
+ runsetVals "makeContext" $ \args -> do
219
+ ctx <- ctxFrom cl (arg args 0)
220
+ op <- readIORef (cOp ctx)
221
+ inner <- jo [ ("entity", VStr (opEntity op)), ("name", VStr (opName op))
222
+ , ("input", VStr (opInput op)), ("points", opPoints op) ]
223
+ jo [("op", inner)]
224
+
225
+ runsetVals "makeOptions" $ \args -> do
226
+ let inv = arg args 0
227
+ em <- emptyMap
228
+ ctx <- ctxFrom cl em
229
+ cfg <- getp inv "config"; writeIORef (cConfig ctx) cfg
230
+ opt <- getp inv "options"; writeIORef (cOptions ctx) opt
231
+ makeOptionsUtil ctx
232
+
233
+ runsetVals "makeError" $ \args -> do
234
+ let a0 = arg args 0
235
+ ctx <- ctxFrom cl a0
236
+ msg <- getp (arg args 1) "message"
237
+ out <- case msg of
238
+ VStr m | not (null m) -> do
239
+ e <- jo [("message", VStr m)]
240
+ makeErrorUtil ctx (Just e)
241
+ _ -> makeErrorUtil ctx Nothing
242
+ publish a0 ctx
243
+ pure out
244
+
245
+ runsetVals "operator" $ \args -> do
246
+ op <- newOperation (arg args 0)
247
+ jo [ ("entity", VStr (opEntity op)), ("input", VStr (opInput op))
248
+ , ("name", VStr (opName op)), ("points", opPoints op) ]
249
+
250
+ runsetVals "param" $ \args -> do
251
+ let a0 = arg args 0
252
+ ctx <- ctxFrom cl a0
253
+ out <- paramUtil ctx (arg args 1)
254
+ publish a0 ctx
255
+ pure out
256
+
257
+ -- One counter entry per section, so a regression names the section.
258
+ p <- runnerPass r
259
+ f <- runnerFail r
260
+ msgs <- runnerFailures r
261
+ forM_ msgs (recordFail c)
262
+ forM_ [1 .. p] (\_ -> recordPass c)
263
+ when (f /= length msgs) (recordFail c "primary corpus: counter mismatch")