@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,328 @@
1
+ // ignore_for_file: non_constant_identifier_names
2
+
3
+ import 'dart:async';
4
+ import 'dart:math';
5
+
6
+ import '../../utility/voxgig_struct.dart' as vs;
7
+
8
+ import '../base/BaseFeature.dart';
9
+
10
+ const S_NOT_FOUND = 'Not found';
11
+
12
+ class TestFeature extends BaseFeature {
13
+ dynamic _client;
14
+ int _netcalls = 0;
15
+
16
+ TestFeature() {
17
+ version = '0.0.1';
18
+ name = 'test';
19
+ active = true;
20
+ }
21
+
22
+ @override
23
+ dynamic init(dynamic ctx, dynamic opts) {
24
+ _client = ctx.client;
25
+ options = opts is Map ? Map<String, dynamic>.from(opts) : {};
26
+
27
+ final entity = options['entity'];
28
+
29
+ _client.mode = 'test';
30
+
31
+ // Ensure entity ids are correct.
32
+ vs.walk(entity, before: (k, v, parent, path) {
33
+ if (2 == vs.size(path)) {
34
+ vs.setprop(v, 'id', k);
35
+ }
36
+ return v;
37
+ });
38
+
39
+ final self = this;
40
+
41
+ // THE MOCK HAS TO AGREE WITH THE MODEL. A point carrying
42
+ // `transform.res: `body.item`` describes an API that answers
43
+ // {"item": {...}}, and the response transform unwraps that key on the way
44
+ // back. Returning the bare payload means the transform unwraps a property
45
+ // that is not there and the caller gets nothing. Mirrors the go/ts/lua/php
46
+ // mocks.
47
+ dynamic envelope(dynamic fctx, dynamic data) {
48
+ if (null == data || null == fctx || null == fctx.point) {
49
+ return data;
50
+ }
51
+ // dart wraps the point in a Point OBJECT (Context._aspoint), so its
52
+ // fields are typed properties, not map keys — vs.getprop on it returns
53
+ // null and the envelope silently never applies.
54
+ final tm = fctx.point.transform;
55
+ final spec = vs.getprop(tm, 'res');
56
+ if (spec is! String) {
57
+ return data;
58
+ }
59
+ // Exactly `body.<key>`; a deeper path is not an envelope this mock can
60
+ // synthesise, so it is left alone rather than guessed at.
61
+ final m = RegExp(r'^`body\.([^`.]+)`$').firstMatch(spec);
62
+ if (null == m) {
63
+ return data;
64
+ }
65
+ return <String, dynamic>{m.group(1)!: data};
66
+ }
67
+
68
+ dynamic respond(dynamic fctx, int status, [dynamic data, dynamic res]) {
69
+ final payload = envelope(fctx, data);
70
+ final out = vs.merge([
71
+ <String, dynamic>{
72
+ 'status': status,
73
+ 'statusText': 'OK',
74
+ 'json': () => payload,
75
+ 'body': 'not-used',
76
+ },
77
+ vs.getdef(res, {}),
78
+ ]);
79
+
80
+ final headers = vs.getprop(out, 'headers', {});
81
+ out['headers'] = headers;
82
+
83
+ return out;
84
+ }
85
+
86
+ dynamic testFetcher(dynamic fctx, dynamic _fullurl, dynamic _fetchdef) {
87
+ final param = fctx.utility.param;
88
+
89
+ final op = fctx.op;
90
+ final entmap = vs.getprop(entity, op.entity, {});
91
+
92
+ if ('load' == op.name) {
93
+ final args = self.buildArgs(fctx, op, fctx.reqmatch);
94
+ final found = vs.select(entmap, args);
95
+ final ent = vs.getelem(found, 0);
96
+ if (null == ent) {
97
+ return respond(fctx, 404, null, {'statusText': S_NOT_FOUND});
98
+ } else {
99
+ vs.delprop(ent, r'$KEY');
100
+ final out = vs.clone(ent);
101
+ return respond(fctx, 200, out);
102
+ }
103
+ } else if ('list' == op.name) {
104
+ final args = self.buildArgs(fctx, op, fctx.reqmatch);
105
+ final found = vs.select(entmap, args);
106
+ if (null == found) {
107
+ return respond(fctx, 404, null, {'statusText': S_NOT_FOUND});
108
+ } else {
109
+ for (final ent in found) {
110
+ vs.delprop(ent, r'$KEY');
111
+ }
112
+ final out = vs.clone(found);
113
+ return respond(fctx, 200, out);
114
+ }
115
+ } else if ('update' == op.name) {
116
+ final args = self.buildArgs(fctx, op, fctx.reqdata);
117
+ final found = vs.select(entmap, args);
118
+ final ent = vs.getelem(found, 0);
119
+ if (null == ent) {
120
+ return respond(fctx, 404, null, {'statusText': S_NOT_FOUND});
121
+ } else {
122
+ // Dart's single null stands in for the donor's undefined: merge
123
+ // must not overwrite stored values with absent ones.
124
+ final upddata = <String, dynamic>{};
125
+ if (fctx.reqdata is Map) {
126
+ (fctx.reqdata as Map).forEach((k, v) {
127
+ if (null != v) {
128
+ upddata[k.toString()] = v;
129
+ }
130
+ });
131
+ }
132
+ vs.merge([ent, upddata]);
133
+ vs.delprop(ent, r'$KEY');
134
+ final out = vs.clone(ent);
135
+ return respond(fctx, 200, out);
136
+ }
137
+ } else if ('remove' == op.name) {
138
+ final args = self.buildArgs(fctx, op, fctx.reqmatch);
139
+ final found = vs.select(entmap, args);
140
+ final ent = vs.getelem(found, 0);
141
+ // Remove only the first matched entity. If nothing matches,
142
+ // succeed as a no-op rather than erroring.
143
+ if (null != ent) {
144
+ vs.delprop(entmap, vs.getprop(ent, 'id'));
145
+ }
146
+ return respond(fctx, 200);
147
+ } else if ('create' == op.name) {
148
+ self.buildArgs(fctx, op, fctx.reqdata);
149
+ dynamic id = param(fctx, 'id');
150
+ if (null == id) {
151
+ final rng = Random();
152
+ final h = () => rng.nextInt(0x10000).toRadixString(16);
153
+ id = (h() + h() + h() + h()).padRight(16, '0');
154
+ }
155
+
156
+ final ent = vs.clone(fctx.reqdata);
157
+ vs.setprop(ent, 'id', id);
158
+ vs.setprop(entmap, id, ent);
159
+ vs.delprop(ent, r'$KEY');
160
+ final out = vs.clone(ent);
161
+ return respond(fctx, 200, out);
162
+ }
163
+
164
+ return null;
165
+ }
166
+
167
+ // Optional network behaviour simulation over the mock transport. Enable
168
+ // per test via `SDK.test({ net: { latency, failTimes, ... } })`. When
169
+ // `net` is absent the mock behaves exactly as before (no wrapping), so
170
+ // existing generated tests are unaffected.
171
+ final net = options['net'];
172
+ ctx.utility.fetcher =
173
+ (null == net) ? testFetcher : makeNetsim(net, testFetcher);
174
+ return null;
175
+ }
176
+
177
+ // Wrap a transport with simulated network conditions: latency (fixed or
178
+ // {min,max}), a budget of first-N failures (`failTimes` -> `failStatus`),
179
+ // first-N connection errors (`errorTimes`), or a hard `offline` outage.
180
+ // Counter-driven, so simulations are deterministic across a test.
181
+ dynamic makeNetsim(dynamic net, dynamic inner) {
182
+ final self = this;
183
+ self._netcalls = 0;
184
+
185
+ int pickLatency() {
186
+ final l = net['latency'];
187
+ if (null == l) {
188
+ return 0;
189
+ }
190
+ if (l is num) {
191
+ return l < 0 ? 0 : l.toInt();
192
+ }
193
+ final min = (l['min'] is num) ? (l['min'] as num).toInt() : 0;
194
+ final max = null == l['max'] ? min : (l['max'] as num).toInt();
195
+ return max <= min ? min : min + ((max - min) >> 1);
196
+ }
197
+
198
+ Future<void> sleep(int ms) {
199
+ if (0 >= ms) {
200
+ return Future.value();
201
+ }
202
+ final sleeper = net['sleep'];
203
+ if (sleeper is Function) {
204
+ return Future.value(sleeper(ms)).then((_x) {});
205
+ }
206
+ return Future.delayed(Duration(milliseconds: ms));
207
+ }
208
+
209
+ return (dynamic fctx, dynamic url, dynamic fetchdef) async {
210
+ self._netcalls++;
211
+ final call = self._netcalls;
212
+
213
+ if (true == net['offline']) {
214
+ await sleep(pickLatency());
215
+ return fctx.error('netsim_offline',
216
+ 'Simulated network offline (URL was: "' + url.toString() + '")');
217
+ }
218
+ final errorTimes = net['errorTimes'] is num ? net['errorTimes'] : 0;
219
+ if (call <= errorTimes) {
220
+ await sleep(pickLatency());
221
+ return fctx.error('netsim_conn',
222
+ 'Simulated connection error (call ' + call.toString() + ')');
223
+ }
224
+ final failTimes = net['failTimes'] is num ? net['failTimes'] : 0;
225
+ if (call <= failTimes) {
226
+ await sleep(pickLatency());
227
+ final status = null == net['failStatus'] ? 503 : net['failStatus'];
228
+ return <String, dynamic>{
229
+ 'status': status,
230
+ 'statusText': 'Simulated Failure',
231
+ 'body': 'not-used',
232
+ 'json': () => null,
233
+ 'headers': {},
234
+ };
235
+ }
236
+ await sleep(pickLatency());
237
+ return inner(fctx, url, fetchdef);
238
+ };
239
+ }
240
+
241
+ dynamic buildArgs(dynamic ctx, dynamic op, dynamic args) {
242
+ final param = ctx.utility.param;
243
+
244
+ final opname = op.name;
245
+
246
+ // Pick the entity's own endpoint from config, not a cross-reference from
247
+ // another resource that also returns it — the same rule makePoint falls
248
+ // back to, so the seed-data query is built from the endpoint the request
249
+ // will actually be sent to: a terminal `{id}` marks a record route, and
250
+ // failing that the shallower path wins.
251
+ final points = vs.getpath(
252
+ ctx.config, ['entity', _entname(ctx.entity), 'op', opname, 'points']);
253
+ var point = vs.getelem(points, 0);
254
+ if (points is List) {
255
+ int pointPartsLen(dynamic p) {
256
+ final parts = vs.getprop(p, 'parts');
257
+ return parts is List ? parts.length : 0;
258
+ }
259
+
260
+ bool pointTerminalParam(dynamic p) {
261
+ final parts = vs.getprop(p, 'parts');
262
+ if (parts is! List || parts.isEmpty) {
263
+ return false;
264
+ }
265
+ final last = parts[parts.length - 1];
266
+ return last is String && last.startsWith('{');
267
+ }
268
+
269
+ for (final cand in points) {
270
+ if (pointTerminalParam(cand) != pointTerminalParam(point)) {
271
+ if (pointTerminalParam(cand)) {
272
+ point = cand;
273
+ }
274
+ } else if (pointPartsLen(cand) < pointPartsLen(point)) {
275
+ point = cand;
276
+ }
277
+ }
278
+ }
279
+
280
+ final reqd = vs.transform(
281
+ vs.select(vs.getpath(point, ['args', 'params']), {'reqd': true}),
282
+ ['`\$EACH`', '', '`\$KEY.name`'],
283
+ );
284
+
285
+ final qand = <dynamic>[];
286
+ final q = {'`\$AND`': qand};
287
+
288
+ for (final k in vs.keysof(args)) {
289
+ if ('id' == k || !vs.isempty(vs.select(reqd, k))) {
290
+ final v = param(ctx, k);
291
+ // Dart's single null stands in for the donor's undefined: an
292
+ // absent match value constrains nothing.
293
+ if (null == v) {
294
+ continue;
295
+ }
296
+ // NOTE: mirrors the donor: op.alias is not present on Operation,
297
+ // so no alias alternates are generated here.
298
+ dynamic qor = [
299
+ {k: v}
300
+ ];
301
+
302
+ qor = {'`\$OR`': qor};
303
+
304
+ qand.add(qor);
305
+ }
306
+ }
307
+
308
+ if (null != ctx.ctrl['explain']) {
309
+ ctx.ctrl['explain']['test'] = {'query': q};
310
+ }
311
+
312
+ return q;
313
+ }
314
+
315
+ String _entname(dynamic ent) {
316
+ if (null == ent) {
317
+ return '';
318
+ }
319
+ if (ent is Map) {
320
+ return (vs.getprop(ent, 'name', '') ?? '').toString();
321
+ }
322
+ try {
323
+ return (ent.name ?? '').toString();
324
+ } catch (_e) {
325
+ return '';
326
+ }
327
+ }
328
+ }
@@ -0,0 +1,104 @@
1
+ // ignore_for_file: non_constant_identifier_names
2
+
3
+ import 'dart:async';
4
+
5
+ import '../../utility/ErrUtility.dart';
6
+
7
+ import '../base/BaseFeature.dart';
8
+
9
+ // Per-request timeout. Wraps the active transport and races each attempt
10
+ // against a deadline; if the deadline wins, the request resolves to a
11
+ // timeout error instead of hanging. The timer (`setTimer`/`clearTimer`)
12
+ // is injectable so tests can drive the deadline deterministically; the
13
+ // losing transport future is swallowed once the race is settled.
14
+ class TimeoutFeature extends BaseFeature {
15
+ dynamic _client;
16
+
17
+ TimeoutFeature() {
18
+ version = '0.0.1';
19
+ name = 'timeout';
20
+ active = true;
21
+ }
22
+
23
+ @override
24
+ dynamic init(dynamic ctx, dynamic opts) {
25
+ _client = ctx.client;
26
+ options = opts is Map ? Map<String, dynamic>.from(opts) : {};
27
+ active = true == options['active'];
28
+
29
+ if (!active) {
30
+ return null;
31
+ }
32
+
33
+ final self = this;
34
+ final utility = ctx.utility;
35
+ final inner = utility.fetcher;
36
+
37
+ utility.fetcher = (dynamic ctx2, dynamic url, dynamic fetchdef) async {
38
+ return self._withTimeout(ctx2, url, fetchdef, inner);
39
+ };
40
+ return null;
41
+ }
42
+
43
+ Future<dynamic> _withTimeout(
44
+ dynamic ctx, dynamic url, dynamic fetchdef, dynamic inner) async {
45
+ final ms =
46
+ null == options['ms'] ? 30000 : (options['ms'] as num).toInt();
47
+ if (0 >= ms) {
48
+ return Future.value(inner(ctx, url, fetchdef));
49
+ }
50
+
51
+ final completer = Completer<dynamic>();
52
+
53
+ dynamic timer;
54
+ fire() {
55
+ if (!completer.isCompleted) {
56
+ completer.complete(ctx.error(
57
+ 'timeout', 'Request exceeded timeout of ' + ms.toString() + 'ms'));
58
+ }
59
+ }
60
+
61
+ final schedule = options['setTimer'];
62
+ if (schedule is Function) {
63
+ timer = schedule(fire, ms);
64
+ } else {
65
+ timer = Timer(Duration(milliseconds: ms), fire);
66
+ }
67
+
68
+ Future.sync(() => inner(ctx, url, fetchdef)).then((res) {
69
+ if (!completer.isCompleted) {
70
+ completer.complete(res);
71
+ }
72
+ }, onError: (err, st) {
73
+ if (!completer.isCompleted) {
74
+ completer.completeError(err, st);
75
+ }
76
+ // Late transport failures after the deadline are swallowed.
77
+ });
78
+
79
+ try {
80
+ final res = await completer.future;
81
+
82
+ if (iserr(res) && 'timeout' == errcode(res)) {
83
+ _track(ctx, ms);
84
+ }
85
+
86
+ return res;
87
+ } finally {
88
+ final clear = options['clearTimer'];
89
+ if (clear is Function) {
90
+ clear(timer);
91
+ } else if (timer is Timer) {
92
+ timer.cancel();
93
+ }
94
+ }
95
+ }
96
+
97
+ void _track(dynamic ctx, int ms) {
98
+ final track = _client.track;
99
+ if (null == track['timeout']) {
100
+ track['timeout'] = <String, dynamic>{'count': 0, 'ms': ms};
101
+ }
102
+ track['timeout']['count']++;
103
+ }
104
+ }
@@ -0,0 +1,12 @@
1
+ // Clean request data by partially hiding sensitive values.
2
+ dynamic clean(dynamic ctx, dynamic val) {
3
+ // final options = ctx.options
4
+ // final cleankeyre = options?['__derived__']?['clean']?['keyre']
5
+ // final hintsize = 4
6
+
7
+ // NOTE: mirrors the donor (ts) implementation, where the masking pass is
8
+ // currently disabled; the derived clean.keyre is still computed by
9
+ // makeOptions so this can be enabled without an options change.
10
+
11
+ return val;
12
+ }
@@ -0,0 +1,18 @@
1
+ import 'voxgig_struct.dart' as vs;
2
+
3
+ import 'CleanUtility.dart';
4
+
5
+ dynamic done(dynamic ctx) {
6
+ final error = ctx.utility.makeError;
7
+
8
+ if (null != ctx.ctrl['explain']) {
9
+ ctx.ctrl['explain'] = clean(ctx, ctx.ctrl['explain']);
10
+ vs.delprop(ctx.ctrl['explain']['result'], 'err');
11
+ }
12
+
13
+ if (null != ctx.result && true == ctx.result.ok) {
14
+ return ctx.result.resdata;
15
+ }
16
+
17
+ return error(ctx);
18
+ }
@@ -0,0 +1,46 @@
1
+ // Error helpers for the ProjectName SDK.
2
+ //
3
+ // The donor (ts) pipeline distinguishes error values from results with
4
+ // `instanceof Error`; Dart splits throwables into Error and Exception, so
5
+ // `iserr` accepts both. `errmsg`/`errcode` read the conventional members
6
+ // (message/code) from any error-ish value, falling back to toString().
7
+
8
+ bool iserr(dynamic v) => v is Error || v is Exception;
9
+
10
+ String errmsg(dynamic err) {
11
+ if (null == err) {
12
+ return 'unknown error';
13
+ }
14
+ if (err is Map) {
15
+ final m = err['message'];
16
+ return (m is String && '' != m) ? m : 'unknown error';
17
+ }
18
+ try {
19
+ final m = (err as dynamic).message;
20
+ if (m is String && '' != m) {
21
+ return m;
22
+ }
23
+ } catch (_e) {
24
+ // No message member: fall through to toString.
25
+ }
26
+ return err.toString();
27
+ }
28
+
29
+ String errcode(dynamic err) {
30
+ if (null == err) {
31
+ return '';
32
+ }
33
+ if (err is Map) {
34
+ final c = err['code'];
35
+ return c is String ? c : '';
36
+ }
37
+ try {
38
+ final c = (err as dynamic).code;
39
+ if (c is String) {
40
+ return c;
41
+ }
42
+ } catch (_e) {
43
+ // No code member.
44
+ }
45
+ return '';
46
+ }
@@ -0,0 +1,35 @@
1
+ void featureAdd(dynamic ctx, dynamic f) {
2
+ final client = ctx.client;
3
+
4
+ final dynamic rawopts = f.options;
5
+ final Map fopts = rawopts is Map ? rawopts : {};
6
+ var added = false;
7
+ final List features = client.features;
8
+
9
+ final before = fopts['__before__'];
10
+ final after = fopts['__after__'];
11
+ final repl = fopts['__replace__'];
12
+
13
+ if (null != before || null != after || null != repl) {
14
+ for (var i = 0; i < features.length; i++) {
15
+ final ef = features[i];
16
+ if (before == ef.name) {
17
+ features.insert(i, f);
18
+ added = true;
19
+ break;
20
+ } else if (after == ef.name) {
21
+ features.insert(i + 1, f);
22
+ added = true;
23
+ break;
24
+ } else if (repl == ef.name) {
25
+ features[i] = f;
26
+ added = true;
27
+ break;
28
+ }
29
+ }
30
+ }
31
+
32
+ if (!added) {
33
+ features.add(f);
34
+ }
35
+ }
@@ -0,0 +1,20 @@
1
+ import 'dart:async';
2
+
3
+ dynamic featureHook(dynamic ctx, String name) {
4
+ final client = ctx.client;
5
+
6
+ final resp = <Future>[];
7
+ final List features = (null == client ? null : client.features) ?? [];
8
+
9
+ for (final f in features) {
10
+ final fres = f.invokeHook(name, ctx);
11
+ if (fres is Future) {
12
+ resp.add(fres);
13
+ }
14
+ }
15
+
16
+ if (0 < resp.length) {
17
+ return Future.wait(resp);
18
+ }
19
+ return null;
20
+ }
@@ -0,0 +1,9 @@
1
+ import 'voxgig_struct.dart' as vs;
2
+
3
+ void featureInit(dynamic ctx, dynamic f) {
4
+ final fopts =
5
+ vs.getprop(vs.getprop(ctx.options, 'feature'), f.name) ?? {};
6
+ if (true == fopts['active']) {
7
+ f.init(ctx, fopts);
8
+ }
9
+ }
@@ -0,0 +1,104 @@
1
+ import 'dart:async';
2
+ import 'dart:convert';
3
+ import 'dart:io';
4
+
5
+ import 'voxgig_struct.dart' as vs;
6
+
7
+ // Make HTTP call using dart:io. Replace this utility for mocking etc.
8
+ Future<dynamic> fetcher(dynamic ctx, dynamic fullurl, dynamic fetchdef) async {
9
+ if ('live' != ctx.client.mode) {
10
+ return ctx.error(
11
+ 'fetch_mode_block',
12
+ 'Request blocked by mode: "' +
13
+ ctx.client.mode.toString() +
14
+ '" (URL was: "' +
15
+ fullurl.toString() +
16
+ '")');
17
+ }
18
+
19
+ final options = ctx.client.options();
20
+
21
+ if (true == vs.getpath(options, 'feature.test.active')) {
22
+ return ctx.error(
23
+ 'fetch_test_block',
24
+ 'Request blocked as test feature is active' +
25
+ ' (URL was: "' +
26
+ fullurl.toString() +
27
+ '")');
28
+ }
29
+
30
+ final fetch = vs.getpath(options, 'system.fetch') ?? httpFetch;
31
+
32
+ final response = await Future.value(fetch(fullurl, fetchdef));
33
+
34
+ return response;
35
+ }
36
+
37
+ // Default live transport over dart:io HttpClient. Returns a transport-shaped
38
+ // map: { status, statusText, headers, body, json } — the same shape as the
39
+ // test feature's mock, so the result pipeline treats both identically.
40
+ Future<dynamic> httpFetch(dynamic fullurl, dynamic fetchdef) async {
41
+ final client = HttpClient();
42
+ try {
43
+ final uri = Uri.parse(fullurl.toString());
44
+ final method =
45
+ (vs.getprop(fetchdef, 'method', 'GET') ?? 'GET').toString();
46
+
47
+ final req = await client.openUrl(method, uri);
48
+
49
+ // Manual redirects: fetchdef['redirect'] == 'manual' surfaces a 3xx as
50
+ // an ordinary response instead of auto-following it — HttpClient would
51
+ // otherwise replay the request, headers included, against whatever host
52
+ // Location names. Set by the station feature's transport middleware
53
+ // under an egress hosts policy (mirrors the ts fetch option).
54
+ if ('manual' == vs.getprop(fetchdef, 'redirect')) {
55
+ req.followRedirects = false;
56
+ }
57
+
58
+ final headers = vs.getprop(fetchdef, 'headers');
59
+ if (headers is Map) {
60
+ headers.forEach((k, v) {
61
+ if (null != v) {
62
+ req.headers.set(k.toString(), v.toString());
63
+ }
64
+ });
65
+ }
66
+
67
+ final body = vs.getprop(fetchdef, 'body');
68
+ if (null != body) {
69
+ if (null == req.headers.value('content-type')) {
70
+ req.headers.set('content-type', 'application/json');
71
+ }
72
+ req.write(body.toString());
73
+ }
74
+
75
+ final res = await req.close();
76
+ final text = await res.transform(utf8.decoder).join();
77
+
78
+ final hmap = <String, dynamic>{};
79
+ res.headers.forEach((name, values) {
80
+ hmap[name.toLowerCase()] = values.join(', ');
81
+ });
82
+
83
+ dynamic jsonBody() {
84
+ if ('' == text) {
85
+ return null;
86
+ }
87
+ try {
88
+ return jsonDecode(text);
89
+ } catch (_e) {
90
+ return null;
91
+ }
92
+ }
93
+
94
+ return {
95
+ 'status': res.statusCode,
96
+ 'statusText': res.reasonPhrase,
97
+ 'headers': hmap,
98
+ 'body': '' == text ? null : text,
99
+ 'json': jsonBody,
100
+ };
101
+ } finally {
102
+ client.close(force: true);
103
+ }
104
+ }