@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,628 @@
1
+
2
+ import {
3
+ flatten,
4
+ items,
5
+ } from '@voxgig/struct'
6
+
7
+ import {
8
+ KIT,
9
+ Model,
10
+ ModelEntity,
11
+ ModelEntityFlow,
12
+ ModelEntityFlowStep,
13
+ getModelPath,
14
+ nom,
15
+ } from '@voxgig/apidef'
16
+
17
+
18
+ import {
19
+ Content,
20
+ File,
21
+ Folder,
22
+ Fragment,
23
+ Slot,
24
+ cmp,
25
+ each,
26
+ isAuthActive, envName, envToken,
27
+ serverVarEnv,
28
+ serverVariables
29
+ } from '@voxgig/sdkgen'
30
+
31
+
32
+ import {
33
+ projectPath, dartStringLiteral} from './utility_dart'
34
+
35
+
36
+ // GenCtx is the per-language generation context passed to every OpGen.
37
+ type GenCtx = {
38
+ model: Model
39
+ entity: ModelEntity
40
+ flow: ModelEntityFlow
41
+ PROJUPPER: string
42
+ }
43
+
44
+ type OpGen = (ctx: GenCtx, step: ModelEntityFlowStep, index: number) => void
45
+
46
+
47
+ const TestEntity = cmp(function TestEntity(props: any) {
48
+ const ctx$ = props.ctx$
49
+ const model: Model = ctx$.model
50
+ const stdrep = ctx$.stdrep
51
+
52
+ const entity: ModelEntity = props.entity
53
+
54
+ const PROJENVNAME = envName(model)
55
+ const ENTENVNAME = envToken(entity.name)
56
+ const authActive = isAuthActive(model)
57
+ const apikeyEnvEntry = authActive
58
+ ? `\n '${PROJENVNAME}_APIKEY': '',`
59
+ : ''
60
+ const apikeyLiveField = authActive
61
+ ? `
62
+ 'apikey': env['${PROJENVNAME}_APIKEY'],`
63
+ : ''
64
+
65
+ // A templated server URL (OpenAPI server variables) makes a LIVE client
66
+ // impossible to construct without values: makeOptions raises rather than
67
+ // request a URL with a literal `{account_id}` in it. So the live suite
68
+ // takes them from the environment the same way it takes the apikey.
69
+ const svars = serverVariables(model)
70
+ const serverEnvEntry = svars
71
+ .map((v: any) => `\n '${serverVarEnv(PROJENVNAME, v.name)}': ${dartStringLiteral(v.dflt)},`).join('')
72
+ const serverLiveField = 0 === svars.length ? '' : `
73
+ 'server': <String, dynamic>{${svars
74
+ .map((v: any) => `
75
+ '${v.name}': env['${serverVarEnv(PROJENVNAME, v.name)}'],`).join('')}
76
+ },`
77
+
78
+ const ff = projectPath('src/cmp/dart/fragment/')
79
+
80
+ Folder({ name: entity.name }, () => {
81
+
82
+ File({ name: nom(entity, 'Name') + 'Entity_test.dart' }, () => {
83
+
84
+ Fragment({
85
+ from: ff + 'Entity.test.fragment.dart',
86
+ replace: {
87
+ SdkName: nom(model.const, 'Name'),
88
+ EntityName: nom(entity, 'Name'),
89
+ entityname: entity.name,
90
+ PROJECTNAME: PROJENVNAME,
91
+ ...stdrep,
92
+ }
93
+ }, () => {
94
+
95
+ const basicflow = getModelPath(model, `main.${KIT}.flow.Basic${nom(entity, 'Name')}Flow`)
96
+
97
+ const dobasic = basicflow && true === basicflow.active
98
+
99
+ if (!dobasic) {
100
+ return;
101
+ }
102
+
103
+ const idlist = flatten([
104
+ entity.name + '01',
105
+ entity.name + '02',
106
+ entity.name + '03',
107
+ flatten(items(entity.relations.ancestors, (ap: any) =>
108
+ items(ap[1], (a: any) =>
109
+ items(['01', '02', '03'], (n: any) =>
110
+ a[1] + n[1]))), 2)
111
+ ])
112
+
113
+ // The stream test drives the `list` op; only emit it when the entity
114
+ // actually has a list op (a create-only entity like a *_result has no
115
+ // list endpoint, so ent.stream('list', …) would throw point_no_points).
116
+ const flowHasList = Object.values(basicflow.step)
117
+ .some((s: any) => 'list' === s.op)
118
+ Slot({ name: 'stream' }, () => {
119
+ if (!flowHasList) {
120
+ return
121
+ }
122
+ Content(`test('stream', (t) async {
123
+ // stream() runs the list op through the full pipeline and yields each
124
+ // result item. Seed two entities via test mode; with the \`streaming\`
125
+ // feature active it yields the feature's incremental items, else it
126
+ // falls back to the materialised items — either way every item yields.
127
+ final seed = <String, dynamic>{
128
+ 'entity': {
129
+ '${entity.name}': {
130
+ 'strm01': <String, dynamic>{'id': 'strm01'},
131
+ 'strm02': <String, dynamic>{'id': 'strm02'},
132
+ }
133
+ }
134
+ };
135
+
136
+ final sdkopts = <String, dynamic>{};
137
+ if (null != config.feature['streaming']) {
138
+ sdkopts['feature'] = {
139
+ 'streaming': {'active': true}
140
+ };
141
+ }
142
+
143
+ final testsdk = ${model.Name}SDK.test(seed, sdkopts);
144
+ final ent = testsdk.${nom(entity, 'Name')}();
145
+
146
+ final seen = [];
147
+ await for (final item in ent.stream('list', <String, dynamic>{})) {
148
+ seen.add(item);
149
+ }
150
+ equal(2, seen.length);
151
+
152
+ // Fallback: with streaming inactive, stream() still yields both items
153
+ // from the materialised result.
154
+ final plainsdk = ${model.Name}SDK.test(seed);
155
+ final plainent = plainsdk.${nom(entity, 'Name')}();
156
+ final seen2 = [];
157
+ await for (final item in plainent.stream('list', <String, dynamic>{})) {
158
+ seen2.add(item);
159
+ }
160
+ equal(2, seen2.length);
161
+ });
162
+ `)
163
+ })
164
+
165
+ Slot({ name: 'basicSetup' }, () => {
166
+ Content(`
167
+ Map<String, dynamic> basicSetup([dynamic extra]) {
168
+ final options = <String, dynamic>{};
169
+
170
+ final entityDataFile = resolveTestPath(
171
+ '../.sdk/test/entity/${entity.name}/${nom(entity, 'Name')}TestData.json');
172
+
173
+ final entityDataSource = File(entityDataFile).readAsStringSync();
174
+
175
+ final entityData = jsonDecode(entityDataSource);
176
+
177
+ options['entity'] = entityData['existing'];
178
+
179
+ var client = ${model.Name}SDK.test(options, extra);
180
+ final struct = client.utility().struct;
181
+ final merge = struct.merge;
182
+ final transform = struct.transform;
183
+
184
+ dynamic idmap = transform(
185
+ <dynamic>['${idlist.join("', '")}'],
186
+ <String, dynamic>{
187
+ '\`\\\$PACK\`': <dynamic>[
188
+ '',
189
+ <String, dynamic>{
190
+ '\`\\\$KEY\`': '\`\\\$COPY\`',
191
+ '\`\\\$VAL\`': <dynamic>['\`\\\$FORMAT\`', 'upper', '\`\\\$COPY\`'],
192
+ }
193
+ ]
194
+ });
195
+
196
+ // Detect whether the user provided a real ENTID JSON via env var. The
197
+ // basic flow consumes synthetic IDs from the fixture file; without an
198
+ // override those synthetic IDs reach the live API and 4xx. Surface this
199
+ // to the test so it can skip rather than fail.
200
+ final idmapEnvVal =
201
+ Platform.environment['${PROJENVNAME}_TEST_${ENTENVNAME}_ENTID'];
202
+ final idmapOverridden =
203
+ null != idmapEnvVal && idmapEnvVal.trim().startsWith('{');
204
+
205
+ final env = envOverride({
206
+ '${PROJENVNAME}_TEST_${ENTENVNAME}_ENTID': idmap,
207
+ '${PROJENVNAME}_TEST_LIVE': 'FALSE',
208
+ '${PROJENVNAME}_TEST_EXPLAIN': 'FALSE',${apikeyEnvEntry}${serverEnvEntry}
209
+ });
210
+
211
+ idmap = env['${PROJENVNAME}_TEST_${ENTENVNAME}_ENTID'];
212
+
213
+ final live = 'TRUE' == env['${PROJENVNAME}_TEST_LIVE'];
214
+
215
+ if (live) {
216
+ client = ${model.Name}SDK(merge([
217
+ // FIRST, so the generated fields below win: sdk-test-control.json's
218
+ // test.client.options adds to the live client, it does not redirect it.
219
+ liveClientOptions(),
220
+ <String, dynamic>{${apikeyLiveField}${serverLiveField}
221
+ },
222
+ // 'extra ?? {}', not a bare 'extra': merge returns null when the last
223
+ // entry is null, and basicSetup is normally called with no argument at
224
+ // all - so a bare 'extra' silently discarded the apikey and server
225
+ // values above and handed the SDK null.
226
+ extra ?? <String, dynamic>{}
227
+ ]));
228
+ }
229
+
230
+ final setup = <String, dynamic>{
231
+ 'idmap': idmap,
232
+ 'env': env,
233
+ 'options': options,
234
+ 'client': client,
235
+ 'struct': struct,
236
+ 'data': entityData,
237
+ 'explain': 'TRUE' == env['${PROJENVNAME}_TEST_EXPLAIN'],
238
+ 'live': live,
239
+ 'syntheticOnly': live && !idmapOverridden,
240
+ 'now': DateTime.now().millisecondsSinceEpoch,
241
+ };
242
+
243
+ return setup;
244
+ }
245
+ `)
246
+ })
247
+
248
+
249
+ Slot({ name: 'basic' }, () => {
250
+ const flowHasCreate = Object.values(basicflow.step).some(
251
+ (s: any) => s.op === 'create'
252
+ )
253
+
254
+ // The basic test exercises a flow with one or more ops (load,
255
+ // list, create, update, remove, ...). The control file lets users
256
+ // skip per-op for an entity. Since the flow is sequential and
257
+ // dependent (e.g. update needs prior load), skipping ANY op the
258
+ // flow exercises skips the whole basic test.
259
+ const flowOps = Array.from(new Set(
260
+ (basicflow.step as any[]).map((s: any) => s.op).filter(Boolean)
261
+ ))
262
+ const flowOpsLiteral = '[' + flowOps.map((o: any) => `'${o}'`).join(', ') + ']'
263
+
264
+ Content(`
265
+ final live = 'TRUE' == Platform.environment['${PROJENVNAME}_TEST_LIVE'];
266
+ for (final op in ${flowOpsLiteral}) {
267
+ if (maybeSkipControl(t, 'entityOp', '${entity.name}.' + op, live)) {
268
+ return;
269
+ }
270
+ }
271
+
272
+ final setup = basicSetup();
273
+ // The basic flow consumes synthetic IDs and field values from the
274
+ // fixture (entity TestData.json). Those don't exist on the live API.
275
+ // Skip live runs unless the user provided a real ENTID env override.
276
+ if (true == setup['syntheticOnly']) {
277
+ t.skip('live entity test uses synthetic IDs from fixture — set ${PROJENVNAME}_TEST_${ENTENVNAME}_ENTID JSON to run live');
278
+ return;
279
+ }
280
+ final client = setup['client'];
281
+ final struct = setup['struct'];
282
+
283
+ final isempty = struct.isempty;
284
+ final select = struct.select;
285
+
286
+ `)
287
+
288
+ // When the flow has no create step, bootstrap the entity data variable
289
+ // from existing test data so that subsequent update/load/remove steps
290
+ // can reference it.
291
+ if (!flowHasCreate) {
292
+ const ref01 = entity.name + '_ref01'
293
+ Content(` final ${ref01}_data =
294
+ (setup['data']['existing']['${entity.name}'] as Map).values.first;
295
+ `)
296
+ }
297
+
298
+ const genCtx: GenCtx = {
299
+ model, entity, flow: basicflow, PROJUPPER: PROJENVNAME,
300
+ }
301
+ each(basicflow.step, (step: ModelEntityFlowStep, index: number) => {
302
+ const opgen = GENERATE_OP[step.op]
303
+ if (null != opgen) {
304
+ opgen(genCtx, step, index)
305
+ Content('\n')
306
+ }
307
+ })
308
+ })
309
+ })
310
+ })
311
+ })
312
+ })
313
+
314
+
315
+ const generateCreate: OpGen = (ctx, step, index) => {
316
+ const { entity, flow } = ctx
317
+ const ref = step.input.ref ?? entity.name + '_ref01'
318
+ const entvar = step.input.entvar ?? ref + '_ent'
319
+ const datavar = step.input.datavar ?? (ref + '_data' + (step.input.suffix ?? ''))
320
+
321
+ const priorSteps = flow.step.slice(0, Number(index))
322
+ const needsEnt = !priorSteps.some(s =>
323
+ ['create', 'list', 'load', 'update', 'remove'].includes(s.op))
324
+
325
+ const hasDatvar = priorSteps.some(s => {
326
+ if ('create' === s.op) {
327
+ const priorRef = s.input.ref ?? entity.name + '_ref01'
328
+ const priorDatvar = s.input.datavar ?? (priorRef + '_data' + (s.input.suffix ?? ''))
329
+ return priorDatvar === datavar
330
+ }
331
+ return false
332
+ })
333
+
334
+ Content(`
335
+ // CREATE
336
+ `)
337
+ if (needsEnt) {
338
+ Content(` final ${entvar} = client.${nom(entity, 'Name')}();
339
+ `)
340
+ }
341
+ if (hasDatvar) {
342
+ Content(` ${datavar} = setup['data']['new']['${entity.name}']['${ref}'];
343
+ `)
344
+ } else {
345
+ Content(` dynamic ${datavar} = setup['data']['new']['${entity.name}']['${ref}'];
346
+ `)
347
+ }
348
+
349
+ each(step.match, (mi: any) => {
350
+ Content(` ${datavar}['${mi.key$}'] = setup['idmap']['${mi.val$}'];
351
+ `)
352
+ })
353
+
354
+ const hasEntIdC = null != entity.id
355
+
356
+ Content(`
357
+ ${datavar} = (await ${entvar}.create(${datavar})).data();
358
+ `)
359
+ if (hasEntIdC) {
360
+ Content(` ok(null != ${datavar}['id']);
361
+ `)
362
+ }
363
+ else {
364
+ Content(` ok(null != ${datavar});
365
+ `)
366
+ }
367
+ }
368
+
369
+
370
+ const generateList: OpGen = (ctx, step, index) => {
371
+ const { entity, flow } = ctx
372
+ const ref = step.input.ref ?? entity.name + '_ref01'
373
+ const entvar = step.input.entvar ?? ref + '_ent'
374
+ const matchvar = step.input.matchvar ?? (ref + '_match' + (step.input.suffix ?? ''))
375
+ const listvar = step.input.listvar ?? (ref + '_list' + (step.input.suffix ?? ''))
376
+
377
+ const priorSteps = flow.step.slice(0, Number(index))
378
+ const needsEnt = !priorSteps.some(s =>
379
+ ['create', 'list', 'load', 'update', 'remove'].includes(s.op))
380
+
381
+ Content(`
382
+ // LIST
383
+ `)
384
+ if (needsEnt) {
385
+ Content(` final ${entvar} = client.${nom(entity, 'Name')}();
386
+ `)
387
+ }
388
+ Content(` final ${matchvar} = <String, dynamic>{};
389
+ `)
390
+
391
+ each(step.match, (mi: any) => {
392
+ Content(` ${matchvar}['${mi.key$}'] = setup['idmap']['${mi.val$}'];
393
+ `)
394
+ })
395
+
396
+ Content(`
397
+ final ${listvar} = (await ${entvar}.list(${matchvar})).map((e) => e.data()).toList();
398
+ `)
399
+ const allSteps = flow.step
400
+ for (let vI = 0; vI < step.valid.length; vI++) {
401
+ const validator = step.valid[vI]
402
+ const validRef = validator.def?.ref
403
+ const hasRefData = validRef && allSteps.some(s => 'create' === s.op &&
404
+ ((s.input.ref ?? entity.name + '_ref01') === validRef))
405
+
406
+ // listvar is ALREADY a list of data maps — the list call above maps
407
+ // .data() over the entity instances. Mapping .data() a second time here
408
+ // called it on a plain Map and every entity test died at runtime with
409
+ // "Class '_Map<String, dynamic>' has no instance method 'data'".
410
+ if ('ItemExists' === validator.apply && hasRefData) {
411
+ Content(`
412
+ ok(!isempty(select(
413
+ ${listvar},
414
+ {'id': ${validRef}_data['id']})));
415
+ `)
416
+ }
417
+ else if ('ItemNotExists' === validator.apply && hasRefData) {
418
+ Content(`
419
+ ok(isempty(select(
420
+ ${listvar},
421
+ {'id': ${validRef}_data['id']})));
422
+ `)
423
+ }
424
+ }
425
+ }
426
+
427
+
428
+ const generateUpdate: OpGen = (ctx, step, index) => {
429
+ const { entity, flow } = ctx
430
+ const ref = step.input.ref ?? entity.name + '_ref01'
431
+ const entvar = step.input.entvar ?? ref + '_ent'
432
+ const datavar = step.input.datavar ?? (ref + '_data' + (step.input.suffix ?? ''))
433
+ const resdatavar = step.input.resdatavar ?? (ref + '_resdata' + (step.input.suffix ?? ''))
434
+ const markdefvar = step.input.markdefvar ?? (ref + '_markdef' + (step.input.suffix ?? ''))
435
+ const srcdatavar = step.input.srcdatavar ?? (ref + '_data' + (step.input.suffix ?? ''))
436
+
437
+ const priorSteps = flow.step.slice(0, Number(index))
438
+ const needsEnt = !priorSteps.some(s =>
439
+ ['create', 'list', 'load', 'update', 'remove'].includes(s.op))
440
+
441
+ const hasEntIdU = null != entity.id
442
+
443
+ // When the update writes into the same variable a prior step declared,
444
+ // reuse it; otherwise declare fresh.
445
+ const declared = datavar === srcdatavar
446
+
447
+ const updvar = declared ? datavar + '_upd' : datavar
448
+
449
+ Content(`
450
+ // UPDATE
451
+ `)
452
+ if (needsEnt) {
453
+ Content(` final ${entvar} = client.${nom(entity, 'Name')}();
454
+ `)
455
+ }
456
+ Content(` final ${updvar} = <String, dynamic>{};
457
+ `)
458
+ if (hasEntIdU) {
459
+ Content(` ${updvar}['id'] = ${srcdatavar}['id'];
460
+ `)
461
+ }
462
+
463
+ each(step.data, (mi: any) => {
464
+ if ('id' !== mi.key$) {
465
+ Content(` ${updvar}['${mi.key$}'] = setup['idmap']['${mi.key$}'];
466
+ `)
467
+ }
468
+ })
469
+
470
+
471
+ for (let sI = 0; sI < step.spec.length; sI++) {
472
+ const spec = step.spec[sI]
473
+ if ('TextFieldMark' === spec.apply && null != step.input.textfield) {
474
+ const fieldname = step.input.textfield
475
+ const fieldvalue = spec.def.mark
476
+ Content(`
477
+ final ${markdefvar} = <String, dynamic>{
478
+ 'name': '${fieldname}',
479
+ 'value': '${fieldvalue}_' + setup['now'].toString(),
480
+ };
481
+ ${updvar}[${markdefvar}['name']] = ${markdefvar}['value'];
482
+ `)
483
+ }
484
+ }
485
+
486
+ Content(`
487
+ final ${resdatavar} = (await ${entvar}.update(${updvar})).data();
488
+ `)
489
+ if (hasEntIdU) {
490
+ Content(` ok(${resdatavar}['id'] == ${updvar}['id']);
491
+ `)
492
+ }
493
+ else {
494
+ Content(` ok(null != ${resdatavar});
495
+ `)
496
+ }
497
+
498
+ for (let sI = 0; sI < step.spec.length; sI++) {
499
+ const spec = step.spec[sI]
500
+ if ('TextFieldMark' === spec.apply && null != step.input.textfield) {
501
+ Content(`
502
+ ok(${resdatavar}[${markdefvar}['name']] == ${markdefvar}['value']);
503
+ `)
504
+ }
505
+ }
506
+
507
+ }
508
+
509
+
510
+ const generateLoad: OpGen = (ctx, step, index) => {
511
+ const { entity, flow } = ctx
512
+ const ref = step.input.ref ?? entity.name + '_ref01'
513
+ const entvar = step.input.entvar ?? ref + '_ent'
514
+ const matchvar = step.input.matchvar ?? (ref + '_match' + (step.input.suffix ?? ''))
515
+ const datavarRaw = step.input.datavar ?? (ref + '_data' + (step.input.suffix ?? ''))
516
+ const srcdatavar = step.input.srcdatavar ?? (ref + '_data' + (step.input.suffix ?? ''))
517
+
518
+ const priorSteps = flow.step.slice(0, Number(index))
519
+ const hasEntVar = priorSteps.some(s =>
520
+ ['create', 'list', 'load', 'update', 'remove'].includes(s.op))
521
+
522
+ // Check if srcdatavar was declared by a prior create step or by the
523
+ // preamble bootstrap (which runs when the flow has no create step)
524
+ const flowHasCreate = flow.step.some(s => s.op === 'create')
525
+ const preambleRef = entity.name + '_ref01'
526
+ const hasSrcData = (!flowHasCreate && srcdatavar === preambleRef + '_data') ||
527
+ priorSteps.some(s => {
528
+ if ('create' === s.op) {
529
+ const priorRef = s.input.ref ?? entity.name + '_ref01'
530
+ const priorDatvar = s.input.datavar ?? (priorRef + '_data' + (s.input.suffix ?? ''))
531
+ return priorDatvar === srcdatavar
532
+ }
533
+ return false
534
+ })
535
+
536
+ // Loading into the same name the source data already uses needs a
537
+ // distinct local (Dart cannot shadow within the same block).
538
+ const datavar = datavarRaw === srcdatavar ? datavarRaw + '_loaded' : datavarRaw
539
+
540
+ const hasEntId = null != entity.id
541
+
542
+ // When the entity has no id model field but the load operation requires
543
+ // path parameters, calling load({}) leaves the URL with literal {param}
544
+ // placeholders. There is no synthetic identifier to substitute, so skip
545
+ // emitting the load step's call in that case — but still declare the
546
+ // entity-var if no prior step has, so later flow steps compile.
547
+ const loadOp = entity.op?.load
548
+ const loadPoint = loadOp?.points?.[0]
549
+ const loadPathParams = loadPoint?.args?.params || []
550
+ const loadHasRequiredParams = loadPathParams.some((p: any) => p.reqd !== false)
551
+ if (!hasEntId && loadHasRequiredParams) {
552
+ if (!hasEntVar) {
553
+ Content(`
554
+ // LOAD: skipped — no entity id field and load requires path params.
555
+ // Entity-var is declared here so later flow steps still compile.
556
+ final ${entvar} = client.${nom(entity, 'Name')}();
557
+ `)
558
+ }
559
+ return
560
+ }
561
+
562
+ Content(`
563
+ // LOAD
564
+ `)
565
+ if (!hasEntVar) {
566
+ Content(` final ${entvar} = client.${nom(entity, 'Name')}();
567
+ `)
568
+ }
569
+ if (!hasSrcData && hasEntId) {
570
+ Content(` final ${srcdatavar} =
571
+ (setup['data']['existing']['${entity.name}'] as Map).values.first;
572
+ `)
573
+ }
574
+ if (hasEntId) {
575
+ Content(` final ${matchvar} = <String, dynamic>{};
576
+ ${matchvar}['id'] = ${srcdatavar}['id'];
577
+ final ${datavar} = (await ${entvar}.load(${matchvar})).data();
578
+ ok(${datavar}['id'] == ${srcdatavar}['id']);
579
+ `)
580
+ }
581
+ else {
582
+ Content(` final ${matchvar} = <String, dynamic>{};
583
+ final ${datavar} = (await ${entvar}.load(${matchvar})).data();
584
+ ok(null != ${datavar});
585
+ `)
586
+ }
587
+ }
588
+
589
+
590
+ const generateRemove: OpGen = (ctx, step, index) => {
591
+ const { entity, flow } = ctx
592
+ const ref = step.input.ref ?? entity.name + '_ref01'
593
+ const entvar = step.input.entvar ?? ref + '_ent'
594
+ const matchvar = step.input.matchvar ?? (ref + '_match' + (step.input.suffix ?? ''))
595
+ const srcdatavar = step.input.srcdatavar ?? (ref + '_data')
596
+
597
+ const priorSteps = flow.step.slice(0, Number(index))
598
+ const needsEnt = !priorSteps.some(s =>
599
+ ['create', 'list', 'load', 'update', 'remove'].includes(s.op))
600
+
601
+ Content(`
602
+ // REMOVE
603
+ `)
604
+ if (needsEnt) {
605
+ Content(` final ${entvar} = client.${nom(entity, 'Name')}();
606
+ `)
607
+ }
608
+ // Always match the prior-created entity by id. The mock test feature
609
+ // removes the first match in entmap, so without a specific id the
610
+ // result depends on hash-sort order and flakes.
611
+ Content(` final ${matchvar} = <String, dynamic>{'id': ${srcdatavar}['id']};
612
+ await ${entvar}.remove(${matchvar});
613
+ `)
614
+ }
615
+
616
+
617
+ const GENERATE_OP: Record<string, OpGen> = {
618
+ create: generateCreate,
619
+ list: generateList,
620
+ update: generateUpdate,
621
+ load: generateLoad,
622
+ remove: generateRemove,
623
+ }
624
+
625
+
626
+ export {
627
+ TestEntity
628
+ }