@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,386 @@
1
+ -- Primary utility tests. One focused test per primary pipeline utility,
2
+ -- driving each through the client utility / SdkRuntime directly (the rust
3
+ -- donor tests/primary_utility_test.rs analog). Verifies the shared `primary`
4
+ -- subtree is present, then exercises prepare*/make*/result*/transform*/
5
+ -- feature*/fetcher/clean/done/makeError with deterministic assertions.
6
+
7
+ {-# LANGUAGE ScopedTypeVariables #-}
8
+
9
+ module TPrimaryUtility (tests) where
10
+
11
+ import Control.Exception (try)
12
+ import Control.Monad (when)
13
+ import Data.IORef
14
+ import Data.Maybe (isNothing)
15
+
16
+ import VoxgigStruct (Value (..), ismap, emptyMap, emptyList, isNoval)
17
+ import SdkTypes
18
+ import SdkHelpers
19
+ import SdkRuntime
20
+ import qualified SdkClient as C
21
+ import Testutil
22
+
23
+ mkCtx :: Client -> String -> IO Context
24
+ mkCtx cl opname = do
25
+ root <- readIORef (clRootctx cl)
26
+ makeContextImpl (defaultCtxSpec { csOpname = Just opname, csClient = Just cl, csUtility = Just (clUtility cl) }) root
27
+
28
+ mkCtxCtrl :: Client -> String -> Value -> IO Context
29
+ mkCtxCtrl cl opname ctrl = do
30
+ root <- readIORef (clRootctx cl)
31
+ makeContextImpl (defaultCtxSpec { csOpname = Just opname, csClient = Just cl, csUtility = Just (clUtility cl), csCtrl = Just ctrl }) root
32
+
33
+ -- A ctx with a fully-populated point + match/reqmatch (rust make_test_full_ctx).
34
+ mkFullCtx :: Client -> IO Context
35
+ mkFullCtx cl = do
36
+ ctx <- mkCtx cl "load"
37
+ idp <- jo [("name", VStr "id"), ("reqd", VBool True)]
38
+ pl <- ja [idp]
39
+ argsm <- jo [("params", pl)]
40
+ partsL <- ja [VStr "items", VStr "{id}"]
41
+ paramsL <- ja [VStr "id"]
42
+ al <- emptyMap; sel <- emptyMap; tr <- emptyMap
43
+ point <- jo [ ("parts", partsL), ("args", argsm), ("params", paramsL)
44
+ , ("alias", al), ("select", sel), ("active", VBool True), ("transform", tr) ]
45
+ writeIORef (cPoint ctx) point
46
+ m <- jo [("id", VStr "item01")]; writeIORef (cMatch ctx) m
47
+ rm <- jo [("id", VStr "item01")]; writeIORef (cReqmatch ctx) rm
48
+ pure ctx
49
+
50
+ fullSpec :: IO Value
51
+ fullSpec = do
52
+ pm <- emptyMap; qm <- emptyMap; hm <- emptyMap
53
+ newSpec =<< jo [ ("base", VStr "http://h"), ("prefix", VStr ""), ("suffix", VStr "")
54
+ , ("path", VStr "a"), ("method", VStr "GET"), ("params", pm)
55
+ , ("query", qm), ("headers", hm), ("step", VStr "s") ]
56
+
57
+ namedFeature :: String -> Value -> IO Feature
58
+ namedFeature nm opts = do
59
+ active <- newIORef True; fopts <- newIORef opts
60
+ pure Feature { fName = nm, fVersion = "0.0.1", fActive = active, fOptions = fopts, fInit = \_ _ -> pure (), fHook = \_ _ -> pure () }
61
+
62
+ errCodeIs :: Value -> String -> IO Bool
63
+ errCodeIs e code = do c <- errCode e; pure (c == code)
64
+
65
+ tests :: Counters -> Value -> IO ()
66
+ tests c alltests = do
67
+
68
+ runTest c "primary.subtree_present" $ do
69
+ primary <- getp alltests "primary"
70
+ pure (ismap primary)
71
+
72
+ runTest c "primary.utility_exists" $ do
73
+ cl <- C.testSdk0
74
+ ctx <- mkCtx cl "load"
75
+ m <- prepareMethodUtil ctx
76
+ h <- prepareHeadersUtil ctx
77
+ q <- prepareQueryUtil ctx
78
+ p <- prepareParamsUtil ctx
79
+ raw <- emptyMap; writeIORef (cOptions ctx) raw
80
+ o <- makeOptionsUtil ctx
81
+ cv <- cleanUtil ctx (VStr "x")
82
+ pure (m == "GET" && ismap h && ismap q && ismap p && ismap o && vstring cv == "x")
83
+
84
+ runTest c "primary.clean_identity" $ do
85
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
86
+ r <- cleanUtil ctx (VStr "x")
87
+ pure (vstring r == "x")
88
+
89
+ runTest c "primary.clean_map" $ do
90
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
91
+ v <- jo [("key", VStr "secret"), ("name", VStr "test")]
92
+ r <- cleanUtil ctx v
93
+ pure (ismap r)
94
+
95
+ runTest c "primary.done_returns_resdata" $ do
96
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
97
+ res <- newResult =<< jo [("ok", VBool True), ("resdata", VNum 42)]; writeIORef (cResult ctx) res
98
+ r <- doneUtil ctx
99
+ pure (case r of VNum n -> n == 42; _ -> False)
100
+
101
+ runTest c "primary.make_error_no_throw" $ do
102
+ cl <- C.testSdk0; ctrl <- jo [("throw_err", VBool False)]
103
+ ctx <- mkCtxCtrl cl "load" ctrl
104
+ res <- newResult =<< jo [("ok", VBool False), ("resdata", VStr "fallback")]; writeIORef (cResult ctx) res
105
+ r <- makeErrorUtil ctx Nothing
106
+ pure (vstring r == "fallback")
107
+
108
+ runTest c "primary.make_error_throws_by_default" $ do
109
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
110
+ res <- newResult =<< jo [("ok", VBool False)]; writeIORef (cResult ctx) res
111
+ r <- try (makeErrorUtil ctx Nothing) :: IO (Either SdkException Value)
112
+ pure (case r of Left _ -> True; Right _ -> False)
113
+
114
+ runTest c "primary.feature_add_appends" $ do
115
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
116
+ start <- readIORef (clFeatures cl) >>= \fs -> pure (length fs)
117
+ f <- namedFeature "aaa" VNoval
118
+ featureAddUtil ctx f
119
+ len2 <- readIORef (clFeatures cl) >>= \fs -> pure (length fs)
120
+ pure (len2 == start + 1)
121
+
122
+ runTest c "primary.feature_hook_dispatches" $ do
123
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
124
+ called <- newIORef False
125
+ active <- newIORef True; fopts <- newIORef VNoval
126
+ let feat = Feature { fName = "hookfeat", fVersion = "0.0.1", fActive = active, fOptions = fopts
127
+ , fInit = \_ _ -> pure (), fHook = \name _ -> when (name == "TestHook") (writeIORef called True) }
128
+ writeIORef (clFeatures cl) [feat]
129
+ featureHookUtil ctx "TestHook"
130
+ readIORef called
131
+
132
+ runTest c "primary.feature_init_active" $ do
133
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
134
+ fo <- jo [("active", VBool True)]; featm <- jo [("initfeat", fo)]; opts <- jo [("feature", featm)]
135
+ writeIORef (cOptions ctx) opts
136
+ initCalled <- newIORef False
137
+ active <- newIORef True; fopts <- newIORef VNoval
138
+ let feat = Feature { fName = "initfeat", fVersion = "0.0.1", fActive = active, fOptions = fopts
139
+ , fInit = \_ _ -> writeIORef initCalled True, fHook = \_ _ -> pure () }
140
+ featureInitUtil ctx feat
141
+ readIORef initCalled
142
+
143
+ runTest c "primary.feature_init_inactive" $ do
144
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
145
+ fo <- jo [("active", VBool False)]; featm <- jo [("nofeat", fo)]; opts <- jo [("feature", featm)]
146
+ writeIORef (cOptions ctx) opts
147
+ initCalled <- newIORef False
148
+ active <- newIORef False; fopts <- newIORef VNoval
149
+ let feat = Feature { fName = "nofeat", fVersion = "0.0.1", fActive = active, fOptions = fopts
150
+ , fInit = \_ _ -> writeIORef initCalled True, fHook = \_ _ -> pure () }
151
+ featureInitUtil ctx feat
152
+ called <- readIORef initCalled
153
+ pure (not called)
154
+
155
+ runTest c "primary.fetcher_blocked_test_mode" $ do
156
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
157
+ hm <- emptyMap; fd <- jo [("method", VStr "GET"), ("headers", hm)]
158
+ (_, merr) <- fetcherUtil ctx "http://x" fd
159
+ case merr of Just e -> errCodeIs e "fetch_mode_block"; Nothing -> pure False
160
+
161
+ runTest c "primary.fetcher_live_calls_system_fetch" $ do
162
+ recRef <- newIORef ([] :: [Value])
163
+ let fetchFn = VFunc (\_ args _ _ -> do modifyIORef recRef (++ [args]); jo [("status", VNum 200), ("statusText", VStr "OK")])
164
+ sys <- jo [("fetch", fetchFn)]; opts <- jo [("system", sys)]
165
+ cl <- C.newSdk opts
166
+ ctx <- mkCtx cl "load"
167
+ hm <- emptyMap; fd <- jo [("method", VStr "GET"), ("headers", hm)]
168
+ (_, merr) <- fetcherUtil ctx "http://example.com/test" fd
169
+ calls <- readIORef recRef
170
+ first <- case calls of (x : _) -> vlistItems x; [] -> pure []
171
+ let url = case first of (u : _) -> vstring u; [] -> ""
172
+ pure (isNothing merr && length calls == 1 && url == "http://example.com/test")
173
+
174
+ runTest c "primary.make_context_inherits_options" $ do
175
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
176
+ opts <- readIORef (cOptions ctx)
177
+ pure (ismap opts)
178
+
179
+ runTest c "primary.make_context_has_id" $ do
180
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
181
+ pure (not (null (cId ctx)))
182
+
183
+ runTest c "primary.make_fetch_def_basic" $ do
184
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
185
+ writeIORef (cResult ctx) VNoval
186
+ sp <- newSpec =<< jo [("base", VStr "http://localhost:8080"), ("path", VStr "items/x"), ("method", VStr "GET")]
187
+ writeIORef (cSpec ctx) sp
188
+ (fd, merr) <- makeFetchDefUtil ctx
189
+ method <- getp fd "method"; url <- getStrD fd "url" ""
190
+ pure (isNothing merr && vstring method == "GET" && substrContains url "items/x")
191
+
192
+ runTest c "primary.make_fetch_def_with_body" $ do
193
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
194
+ writeIORef (cResult ctx) VNoval
195
+ b <- jo [("name", VStr "test")]
196
+ sp <- newSpec =<< jo [("base", VStr "http://h"), ("path", VStr "items"), ("method", VStr "POST"), ("body", b)]
197
+ writeIORef (cSpec ctx) sp
198
+ (fd, merr) <- makeFetchDefUtil ctx
199
+ bs <- getp fd "body"
200
+ pure (isNothing merr && (case bs of VStr s -> substrContains s "name"; _ -> False))
201
+
202
+ runTest c "primary.make_options_map" $ do
203
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
204
+ raw <- emptyMap; writeIORef (cOptions ctx) raw
205
+ o <- makeOptionsUtil ctx
206
+ pure (ismap o)
207
+
208
+ runTest c "primary.make_options_derives_clean_keyre" $ do
209
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
210
+ raw <- emptyMap; writeIORef (cOptions ctx) raw
211
+ o <- makeOptionsUtil ctx
212
+ kr <- getpathS o "__derived__.clean.keyre"
213
+ pure (case kr of VStr s -> not (null s); _ -> False)
214
+
215
+ runTest c "primary.make_request_guard_no_spec" $ do
216
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
217
+ writeIORef (cSpec ctx) VNoval
218
+ (_, merr) <- makeRequestUtil ctx
219
+ case merr of Just e -> errCodeIs e "request_no_spec"; Nothing -> pure False
220
+
221
+ runTest c "primary.make_response_2xx_parses_body" $ do
222
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
223
+ sp <- fullSpec; writeIORef (cSpec ctx) sp
224
+ d <- jo [("v", VNum 1)]
225
+ resp <- newResponse =<< jo [("status", VNum 200), ("statusText", VStr "OK"), ("json", jsonThunk d), ("body", VStr "raw")]
226
+ writeIORef (cResponse ctx) resp
227
+ res <- newResult =<< emptyMap; writeIORef (cResult ctx) res
228
+ (_, merr) <- makeResponseUtil ctx
229
+ rv <- readIORef (cResult ctx); ok <- getp rv "ok"; bv <- getp rv "body" >>= \b -> getp b "v"
230
+ pure (isNothing merr && isTrueV ok && (case bv of VNum n -> n == 1; _ -> False))
231
+
232
+ runTest c "primary.make_result_basic" $ do
233
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
234
+ sp <- fullSpec; writeIORef (cSpec ctx) sp
235
+ rd <- jo [("id", VStr "item01")]
236
+ res <- newResult =<< jo [("ok", VBool True), ("status", VNum 200), ("resdata", rd)]; writeIORef (cResult ctx) res
237
+ (ro, merr) <- makeResultUtil ctx
238
+ st <- getp ro "status"
239
+ pure (isNothing merr && toInt st == 200)
240
+
241
+ runTest c "primary.make_result_no_spec" $ do
242
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
243
+ writeIORef (cSpec ctx) VNoval
244
+ res <- newResult =<< jo [("ok", VBool True)]; writeIORef (cResult ctx) res
245
+ (_, merr) <- makeResultUtil ctx
246
+ case merr of Just e -> errCodeIs e "result_no_spec"; Nothing -> pure False
247
+
248
+ runTest c "primary.make_result_no_result" $ do
249
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
250
+ sp <- newSpec =<< jo [("step", VStr "start")]; writeIORef (cSpec ctx) sp
251
+ writeIORef (cResult ctx) VNoval
252
+ (_, merr) <- makeResultUtil ctx
253
+ case merr of Just e -> errCodeIs e "result_no_result"; Nothing -> pure False
254
+
255
+ runTest c "primary.make_spec_basic" $ do
256
+ cl <- C.testSdk0; ctx <- mkFullCtx cl
257
+ (sp, merr) <- makeSpecUtil ctx
258
+ method <- getp sp "method"; path <- getStrD sp "path" ""
259
+ pure (isNothing merr && vstring method == "GET" && path == "items/{id}")
260
+
261
+ runTest c "primary.make_point_basic" $ do
262
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
263
+ parts <- ja [VStr "items", VStr "{id}"]
264
+ point <- jo [("method", VStr "GET"), ("parts", parts)]
265
+ pts <- ja [point]
266
+ op <- newOperation =<< jo [("name", VStr "load"), ("points", pts)]
267
+ writeIORef (cOp ctx) op
268
+ (_, merr) <- makePointUtil ctx
269
+ pt <- readIORef (cPoint ctx)
270
+ pure (isNothing merr && ismap pt)
271
+
272
+ runTest c "primary.make_url_basic" $ do
273
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
274
+ p <- jo [("id", VStr "item01")]
275
+ sp <- newSpec =<< jo [("base", VStr "http://h"), ("path", VStr "items/{id}"), ("params", p), ("method", VStr "GET")]
276
+ writeIORef (cSpec ctx) sp
277
+ res <- newResult =<< emptyMap; writeIORef (cResult ctx) res
278
+ (urlV, merr) <- makeUrlUtil ctx
279
+ pure (isNothing merr && substrContains (vstring urlV) "http://h/items/item01")
280
+
281
+ runTest c "primary.operator_basic" $ do
282
+ pts <- emptyList
283
+ op <- newOperation =<< jo [("entity", VStr "planet"), ("name", VStr "load"), ("input", VStr "match"), ("points", pts)]
284
+ pure (opEntity op == "planet" && opName op == "load" && opInput op == "match")
285
+
286
+ runTest c "primary.param_basic" $ do
287
+ cl <- C.testSdk0; ctx <- mkFullCtx cl
288
+ v <- paramUtil ctx (VStr "id")
289
+ pure (vstring v == "item01")
290
+
291
+ runTest c "primary.prepare_auth_apikey" $ do
292
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
293
+ ap <- jo [("prefix", VStr "Bearer")]; o <- jo [("apikey", VStr "K"), ("auth", ap)]; writeIORef (clOptions cl) o
294
+ hm <- emptyMap; sp <- newSpec =<< jo [("headers", hm)]; writeIORef (cSpec ctx) sp
295
+ _ <- prepareAuthUtil ctx
296
+ spv <- readIORef (cSpec ctx); h <- getp spv "headers"; av <- getp h "authorization"
297
+ pure (vstring av == "Bearer K")
298
+
299
+ runTest c "primary.prepare_body_match_is_noval" $ do
300
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
301
+ b <- prepareBodyUtil ctx
302
+ pure (isNoval b)
303
+
304
+ runTest c "primary.prepare_headers_map" $ do
305
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
306
+ h <- prepareHeadersUtil ctx
307
+ pure (ismap h)
308
+
309
+ runTest c "primary.prepare_method_get" $ do
310
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
311
+ m <- prepareMethodUtil ctx
312
+ pure (m == "GET")
313
+
314
+ runTest c "primary.prepare_method_post" $ do
315
+ cl <- C.testSdk0; ctx <- mkCtx cl "create"
316
+ m <- prepareMethodUtil ctx
317
+ pure (m == "POST")
318
+
319
+ runTest c "primary.prepare_params_map" $ do
320
+ cl <- C.testSdk0; ctx <- mkFullCtx cl
321
+ p <- prepareParamsUtil ctx
322
+ pure (ismap p)
323
+
324
+ runTest c "primary.prepare_path_basic" $ do
325
+ cl <- C.testSdk0; ctx <- mkFullCtx cl
326
+ p <- preparePathUtil ctx
327
+ pure (p == "items/{id}")
328
+
329
+ runTest c "primary.prepare_path_single" $ do
330
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
331
+ parts <- ja [VStr "items"]
332
+ point <- jo [("parts", parts)]
333
+ writeIORef (cPoint ctx) point
334
+ p <- preparePathUtil ctx
335
+ pure (p == "items")
336
+
337
+ runTest c "primary.prepare_query_map" $ do
338
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
339
+ q <- prepareQueryUtil ctx
340
+ pure (ismap q)
341
+
342
+ runTest c "primary.result_basic_sets_status" $ do
343
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
344
+ resp <- newResponse =<< jo [("status", VNum 200), ("statusText", VStr "OK")]; writeIORef (cResponse ctx) resp
345
+ res <- newResult =<< emptyMap; writeIORef (cResult ctx) res
346
+ resultBasicUtil ctx
347
+ rv <- readIORef (cResult ctx); st <- getp rv "status"
348
+ pure (toInt st == 200)
349
+
350
+ runTest c "primary.result_body_parses_json" $ do
351
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
352
+ d <- jo [("a", VNum 1)]
353
+ resp <- newResponse =<< jo [("status", VNum 200), ("json", jsonThunk d), ("body", VStr "raw")]; writeIORef (cResponse ctx) resp
354
+ res <- newResult =<< emptyMap; writeIORef (cResult ctx) res
355
+ resultBodyUtil ctx
356
+ rv <- readIORef (cResult ctx); a <- getp rv "body" >>= \b -> getp b "a"
357
+ pure (case a of VNum n -> n == 1; _ -> False)
358
+
359
+ runTest c "primary.result_headers_copies" $ do
360
+ cl <- C.testSdk0; ctx <- mkCtx cl "load"
361
+ hm <- jo [("x-a", VStr "1")]
362
+ resp <- newResponse =<< jo [("status", VNum 200), ("headers", hm)]; writeIORef (cResponse ctx) resp
363
+ res <- newResult =<< emptyMap; writeIORef (cResult ctx) res
364
+ resultHeadersUtil ctx
365
+ rv <- readIORef (cResult ctx); h <- getp rv "headers"; xa <- getp h "x-a"
366
+ pure (vstring xa == "1")
367
+
368
+ runTest c "primary.transform_request_sets_step" $ do
369
+ cl <- C.testSdk0; ctx <- mkFullCtx cl
370
+ sp <- newSpec =<< jo [("method", VStr "GET")]; writeIORef (cSpec ctx) sp
371
+ _ <- transformRequestUtil ctx
372
+ spv <- readIORef (cSpec ctx); step <- getStrD spv "step" ""
373
+ pure (step == "reqform")
374
+
375
+ runTest c "primary.transform_response_sets_step" $ do
376
+ cl <- C.testSdk0; ctx <- mkFullCtx cl
377
+ sp <- newSpec =<< jo [("method", VStr "GET")]; writeIORef (cSpec ctx) sp
378
+ res <- newResult =<< jo [("ok", VBool True)]; writeIORef (cResult ctx) res
379
+ _ <- transformResponseUtil ctx
380
+ spv <- readIORef (cSpec ctx); step <- getStrD spv "step" ""
381
+ pure (step == "resform")
382
+
383
+ runTest c "primary.new_sdk_mode_live" $ do
384
+ cl <- C.newSdk VNoval
385
+ m <- readIORef (clMode cl)
386
+ pure (m == "live")
@@ -0,0 +1,59 @@
1
+ -- Minimal SDK test harness: a shared Counters record accumulates pass/fail;
2
+ -- `runTest` executes an IO Bool assertion (exceptions count as failures);
3
+ -- `check` records a pure boolean. A final `summary` prints counts and exits
4
+ -- non-zero on any failure.
5
+
6
+ {-# LANGUAGE ScopedTypeVariables #-}
7
+
8
+ module Testutil where
9
+
10
+ import Control.Exception (SomeException, try)
11
+ import Data.IORef
12
+ import System.Exit (exitFailure)
13
+
14
+ data Counters = Counters
15
+ { npass :: IORef Int
16
+ , nfail :: IORef Int
17
+ , failures :: IORef [String]
18
+ }
19
+
20
+ newCounters :: IO Counters
21
+ newCounters = Counters <$> newIORef 0 <*> newIORef 0 <*> newIORef []
22
+
23
+ recordPass :: Counters -> IO ()
24
+ recordPass c = modifyIORef' (npass c) (+ 1)
25
+
26
+ recordFail :: Counters -> String -> IO ()
27
+ recordFail c msg = do modifyIORef' (nfail c) (+ 1); modifyIORef' (failures c) (++ ["FAIL " ++ msg])
28
+
29
+ -- Record a pure boolean assertion.
30
+ check :: Counters -> String -> Bool -> IO ()
31
+ check c name ok = if ok then recordPass c else recordFail c name
32
+
33
+ -- Run an IO Bool assertion; an exception (or False) is a failure.
34
+ runTest :: Counters -> String -> IO Bool -> IO ()
35
+ runTest c name act = do
36
+ r <- try act :: IO (Either SomeException Bool)
37
+ case r of
38
+ Right True -> recordPass c
39
+ Right False -> recordFail c (name ++ " (assertion false)")
40
+ Left e -> recordFail c (name ++ " (exception: " ++ firstLine (show e) ++ ")")
41
+ where firstLine s = case lines s of (l : _) -> l; [] -> s
42
+
43
+ -- Run an IO action that raises on failure (used for imperative-style checks).
44
+ runAction :: Counters -> String -> IO () -> IO ()
45
+ runAction c name act = do
46
+ r <- try act :: IO (Either SomeException ())
47
+ case r of
48
+ Right () -> recordPass c
49
+ Left e -> recordFail c (name ++ " (exception: " ++ firstLine (show e) ++ ")")
50
+ where firstLine s = case lines s of (l : _) -> l; [] -> s
51
+
52
+ summary :: Counters -> IO ()
53
+ summary c = do
54
+ fs <- readIORef (failures c)
55
+ mapM_ putStrLn fs
56
+ p <- readIORef (npass c)
57
+ f <- readIORef (nfail c)
58
+ putStrLn ("\nSDK PASS " ++ show p ++ " FAIL " ++ show f)
59
+ if f > 0 then exitFailure else pure ()