@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,261 @@
1
+ import {
2
+ Content,
3
+ File,
4
+ Folder,
5
+ cmp,
6
+ each,
7
+ entityCollection,
8
+ } from '@voxgig/sdkgen'
9
+
10
+ import {
11
+ Model,
12
+ } from '@voxgig/apidef'
13
+
14
+
15
+ // True when an op has at least one endpoint point that needs no path params
16
+ // (a top-level operation the live smoke test can call without an id).
17
+ function hasParamFreePoint(op: any): boolean {
18
+ if (null == op) return false
19
+ const points = op.points || []
20
+ for (const pt of points) {
21
+ const params = ((pt.args || {}).params) || []
22
+ if (params.length === 0) return true
23
+ }
24
+ return false
25
+ }
26
+
27
+
28
+ // True when an op selects a single record by path params — i.e. loading it by
29
+ // id is meaningful. A load whose every point is param-free is a singleton
30
+ // endpoint (`/current`): passing it an id matches no point at all, and the
31
+ // runtime raises `has no matching endpoint`.
32
+ function selectsByParams(op: any): boolean {
33
+ if (null == op) return false
34
+ const points = op.points || []
35
+ for (const pt of points) {
36
+ const params = ((pt.args || {}).params) || []
37
+ if (0 < params.length) return true
38
+ }
39
+ return false
40
+ }
41
+
42
+
43
+ // Synthesize a create payload from the entity's required non-id fields.
44
+ function synthData(fields: any): any {
45
+ const o: any = {}
46
+ each(fields, (f: any) => {
47
+ if (f.req && f.name !== 'id') {
48
+ const t = String(f.type || '').toLowerCase()
49
+ o[f.name] =
50
+ (t.includes('number') || t.includes('integer') || t.includes('decimal')) ? 42
51
+ : t.includes('bool') ? true
52
+ : 'leantest'
53
+ }
54
+ })
55
+ return o
56
+ }
57
+
58
+
59
+ // The generated `test/Runner.lean` exe runs TWO lanes:
60
+ //
61
+ // - OFFLINE (always): a test-mode client seeded from the entity's generated
62
+ // `<Entity>TestData.json` answers operations from an in-memory store, so
63
+ // entity behaviour (list/load/create/load-back/remove) is verified with no
64
+ // server — the same guarantee the `test` feature gives the other targets.
65
+ // - LIVE (only when SDK_TEST_BASE is set): the same flow against a real
66
+ // server, exercising the curl transport end to end.
67
+ const Test = cmp(async function Test(props: any) {
68
+ const ctx$ = props.ctx$
69
+ const target = props.target
70
+ const model: Model = ctx$.model
71
+
72
+ const entity = each(entityCollection(model))
73
+ .filter((e: any) => false !== e.active)
74
+
75
+ // Per-entity OFFLINE (test-mode) blocks: seeded store, no server.
76
+ let offline = ''
77
+ each(entity, (e: any) => {
78
+ const ns = e.name.charAt(0).toUpperCase() + e.name.slice(1)
79
+ const Name = e.Name || (e.name.charAt(0).toUpperCase() + e.name.slice(1))
80
+ const ops = e.op || {}
81
+ if (!ops.list && !ops.load) return
82
+
83
+ // Only call the ops the entity actually declares. `Entity.create` is not
84
+ // generated for a load-only entity, so emitting the create/remove block
85
+ // unconditionally fails the build with "Unknown identifier X.create".
86
+ // Value's constructors are spelled out (`Value.list`, not `.list`) — the
87
+ // expected type is not known at the match scrutinee, and Lean reports the
88
+ // dotted form as ambiguous against Std's own `.list`.
89
+ let body = ''
90
+
91
+ if (ops.list) {
92
+ body += ` -- list returns every seeded entity
93
+ let items ← ${ns}.list tclient (← emptyMap) (← emptyMap)
94
+ let n ← (match items with | Value.list lid => do pure (← listItems lid).size | _ => pure 0)
95
+ if n == ids.size then pass s!"${e.name}.list offline -> {n} seeded"
96
+ else fail s!"${e.name}.list offline: got {n}, want {ids.size}"
97
+ `
98
+ }
99
+
100
+ if (ops.load && selectsByParams(ops.load)) {
101
+ body += ` -- load the first seeded entity by id
102
+ if ids.size > 0 then do
103
+ let wid := ids[0]!
104
+ let m ← newMap #[("id", Value.str wid)]
105
+ let got ← ${ns}.load tclient m (← emptyMap)
106
+ let gid ← SdkRuntime.gpS got "id"
107
+ if gid == wid then pass s!"${e.name}.load offline (id={wid})"
108
+ else fail s!"${e.name}.load offline: got {gid}, want {wid}"
109
+ `
110
+ }
111
+ // A singleton load (`/current`, `/slack`) is deliberately NOT asserted
112
+ // here. The offline lane answers from a store keyed by entity id, so a
113
+ // load carrying no id has nothing to look up — the only honest assertion
114
+ // would need the model-driven match data the other targets build in their
115
+ // TestEntity components. Until this lane is model-driven too, such an
116
+ // entity contributes no offline block rather than a misleading one.
117
+
118
+ if (ops.create && ops.load && ops.remove) {
119
+ body += ` -- create -> load back -> remove, all in the store
120
+ let newmap ← SdkRuntime.gp (← SdkRuntime.gp seed "new") "${e.name}"
121
+ let nks ← keysof newmap
122
+ if nks.size > 0 then do
123
+ let payload ← SdkRuntime.gp newmap nks[0]!
124
+ let created ← ${ns}.create tclient payload (← emptyMap)
125
+ let cid ← SdkRuntime.gpS created "id"
126
+ if cid == "" then fail "${e.name}.create offline returned no id" else do
127
+ let m2 ← newMap #[("id", Value.str cid)]
128
+ let back ← ${ns}.load tclient m2 (← emptyMap)
129
+ if (← SdkRuntime.gpS back "id") == cid then
130
+ pass s!"${e.name}.create/load offline (id={cid})"
131
+ else fail s!"${e.name}.create/load offline mismatch"
132
+ let _ ← ${ns}.remove tclient m2 (← emptyMap)
133
+ let gone ← ${ns}.load tclient m2 (← emptyMap)
134
+ match gone with
135
+ | Value.map _ => fail s!"${e.name}.remove offline: still present"
136
+ | _ => pass s!"${e.name}.remove offline (id={cid})"
137
+ `
138
+ }
139
+
140
+ // Nothing to assert (an entity whose only op needs path params we cannot
141
+ // synthesise) — skip the block rather than emit an empty `do`.
142
+ if ('' === body) return
143
+
144
+ offline += ` -- ${e.name}: offline (test-mode) entity behaviour
145
+ (do
146
+ let seedPath := "../.sdk/test/entity/${e.name}/${Name}TestData.json"
147
+ if !(← System.FilePath.pathExists seedPath) then
148
+ IO.println s!"skip - ${e.name}: no seed at {seedPath}"
149
+ else do
150
+ let seed ← SdkJson.jsonRead (← IO.FS.readFile seedPath)
151
+ let tclient ← Sdk.testSdk0 seed
152
+ let existing ← SdkRuntime.gp (← SdkRuntime.gp seed "existing") "${e.name}"
153
+ let ids ← keysof existing
154
+ ${body})
155
+ `
156
+ })
157
+
158
+ // Per-entity LIVE test blocks.
159
+ let blocks = ''
160
+ each(entity, (e: any) => {
161
+ const ns = e.name.charAt(0).toUpperCase() + e.name.slice(1)
162
+ const listOp = (e.op || {}).list
163
+ const createOp = (e.op || {}).create
164
+ const removeOp = (e.op || {}).remove
165
+
166
+ if (hasParamFreePoint(listOp)) {
167
+ blocks += ` -- ${e.name}: list smoke
168
+ (do
169
+ let items ← ${ns}.list client (← emptyMap) (← emptyMap)
170
+ match items with
171
+ | Value.list lid => pass s!"${e.name}.list -> {(← listItems lid).size} items"
172
+ | _ => fail "${e.name}.list did not return a list")
173
+ `
174
+ }
175
+
176
+ // Round-trip when create is param-free (creatable without an id); load and
177
+ // remove then use the id returned by create.
178
+ const loadOp = (e.op || {}).load
179
+ if (hasParamFreePoint(createOp) && loadOp && removeOp) {
180
+ const data = JSON.stringify(synthData(e.fields))
181
+ blocks += ` -- ${e.name}: create / load / remove round-trip
182
+ (do
183
+ let d ← SdkJson.jsonRead ${JSON.stringify(data)}
184
+ let created ← ${ns}.create client d (← emptyMap)
185
+ let nid ← SdkRuntime.gpS created "id"
186
+ if nid == "" then fail "${e.name}.create returned no id" else do
187
+ let m ← newMap #[("id", .str nid)]
188
+ let back ← ${ns}.load client m (← emptyMap)
189
+ let bid ← SdkRuntime.gpS back "id"
190
+ if bid == nid then pass s!"${e.name}.create/load round-trip (id={nid})"
191
+ else fail s!"${e.name}.load mismatch: {bid} != {nid}"
192
+ let _ ← ${ns}.remove client m (← emptyMap)
193
+ pass s!"${e.name}.remove (id={nid})")
194
+ `
195
+ }
196
+ })
197
+
198
+ // The live lane nests two levels deeper than the offline lane.
199
+ const liveBlocks = blocks.split('\n').map((l) => l ? ' ' + l : l).join('\n')
200
+
201
+ // A `do` block whose last statement is a `let` is a type error in Lean
202
+ // ("the rest of the do block has monadic result type"), and an entirely
203
+ // empty one does not parse at all. An API whose entities offer no op these
204
+ // lanes can drive leaves both empty, so terminate them explicitly.
205
+ const offlineBody = '' === offline ? ' pure ()\n' : offline
206
+ const liveBody = '' === blocks ? ' pure ()\n' : liveBlocks
207
+
208
+ Folder({ name: 'test' }, () => {
209
+ File({ name: 'Runner.' + target.ext }, () => {
210
+ Content(`-- ${model.const.Name} SDK test runner (generated by @voxgig/sdkgen).
211
+ --
212
+ -- OFFLINE lane (always): a test-mode client seeded from the generated entity
213
+ -- test data answers operations from an in-memory store — no server needed.
214
+ -- LIVE lane (only when SDK_TEST_BASE is set): the same flow over real HTTP.
215
+
216
+ import VoxgigStruct
217
+ import SdkJson
218
+ import SdkRuntime
219
+ import SdkClient
220
+
221
+ open VoxgigStruct
222
+
223
+ initialize npass : IO.Ref Nat ← IO.mkRef 0
224
+ initialize nfail : IO.Ref Nat ← IO.mkRef 0
225
+
226
+ def pass (msg : String) : SIO Unit := do
227
+ npass.modify (· + 1)
228
+ IO.println s!"ok - {msg}"
229
+
230
+ def fail (msg : String) : SIO Unit := do
231
+ nfail.modify (· + 1)
232
+ IO.println s!"FAIL - {msg}"
233
+
234
+ def defaultBase : String := "http://localhost:8901"
235
+
236
+ def main : IO UInt32 := do
237
+ let liveBase ← IO.getEnv "SDK_TEST_BASE"
238
+ let ctx ← mkCtx
239
+ let offline : SIO Unit := do
240
+ ${offlineBody} offline.run ctx
241
+ match liveBase with
242
+ | none => IO.println "skip - live lane (set SDK_TEST_BASE to enable)"
243
+ | some base => do
244
+ let live : SIO Unit := do
245
+ let opts ← newMap #[("base", .str base)]
246
+ let client ← Sdk.newSdk opts
247
+ ${liveBody} live.run ctx
248
+ let p ← npass.get
249
+ let f ← nfail.get
250
+ IO.println ""
251
+ IO.println s!"PASS {p} FAIL {f}"
252
+ if f > 0 then return 1 else return 0
253
+ `)
254
+ })
255
+ })
256
+ })
257
+
258
+
259
+ export {
260
+ Test
261
+ }
@@ -0,0 +1,129 @@
1
+ import * as Path from 'node:path'
2
+
3
+ import {
4
+ clone,
5
+ walk,
6
+ } from '@voxgig/struct'
7
+
8
+
9
+ function projectPath(suffix?: string): string {
10
+ return Path.normalize(Path.join(__dirname, '../../..', suffix ?? ''))
11
+ }
12
+
13
+
14
+ // A Lean 4 string literal. Lean strings are UTF-8, so non-ASCII passes through;
15
+ // only the structural characters need escaping. (Backticks are ordinary in Lean
16
+ // strings, so the config's `body`-style transform exprs embed verbatim.)
17
+ function leanString(s: string): string {
18
+ let out = '"'
19
+ for (const ch of String(s)) {
20
+ if (ch === '"') out += '\\"'
21
+ else if (ch === '\\') out += '\\\\'
22
+ else if (ch === '\n') out += '\\n'
23
+ else if (ch === '\t') out += '\\t'
24
+ else if (ch === '\r') out += '\\r'
25
+ else out += ch
26
+ }
27
+ return out + '"'
28
+ }
29
+
30
+
31
+ // Lean reserved words that cannot be bare identifiers.
32
+ const LEAN_RESERVED = new Set<string>([
33
+ 'do', 'let', 'fun', 'match', 'with', 'if', 'then', 'else', 'by', 'end',
34
+ 'namespace', 'section', 'open', 'import', 'def', 'partial', 'mutual',
35
+ 'structure', 'inductive', 'class', 'instance', 'where', 'deriving', 'return',
36
+ 'try', 'catch', 'for', 'in', 'while', 'have', 'show', 'from', 'set_option',
37
+ ])
38
+
39
+
40
+ // A collision-free lower-camel Lean identifier for a model name.
41
+ function leanVarName(name: string): string {
42
+ let s = String(name).replace(/[^a-zA-Z0-9_]/g, '_')
43
+ if (s.length === 0) {
44
+ s = 'x'
45
+ }
46
+ s = s.charAt(0).toLowerCase() + s.slice(1)
47
+ if (!/^[a-z_]/.test(s)) {
48
+ s = 'e_' + s
49
+ }
50
+ return LEAN_RESERVED.has(s) ? s + '_' : s
51
+ }
52
+
53
+
54
+ // The lowercase-hyphenated package name (used for the lake package + repo).
55
+ function pkgName(model: any): string {
56
+ const org = (model.origin || 'voxgig-sdk').replace(/-sdk$/, '')
57
+ return `${org}-${model.name}-sdk`.toLowerCase().replace(/[^a-z0-9-]/g, '-')
58
+ }
59
+
60
+
61
+ // Remove `$`-suffixed model annotation keys (so the embedded config is clean).
62
+ // Emission-time normalisation of a model subtree (L0).
63
+ //
64
+ // Always drops jostraca's iteration metadata (`$`-suffixed keys: index$,
65
+ // key$, val$). With `dropDefaults`, also drops keys whose value IS the
66
+ // default the runtime already assumes when the key is absent, which is pure
67
+ // payload — see CONFIG_DEFAULT.
68
+ //
69
+ // Rebuilds the tree rather than mutating during a walk. The previous
70
+ // implementation walked a clone calling `delete p[k]`, but walk() assigns its
71
+ // callback's result back over the child (`setprop(out, ckey, walk(...))`), so
72
+ // the delete was undone on the way out and the helper silently did nothing.
73
+ // Returning `undefined` from the callback does not fix it either: setprop
74
+ // stores undefined rather than removing the key, which then emits as a null.
75
+ //
76
+ // `dropDefaults` is opt-in and must be passed ONLY for the entity subtree.
77
+ // `active` means something different in feature config, where absent reads as
78
+ // INACTIVE (see feature_init) — dropping `active: true` there would silently
79
+ // disable the feature.
80
+ // jostraca's iteration metadata, injected by each()/names() while it walks the
81
+ // model. Listed explicitly rather than matched by trailing-dollar suffix: a
82
+ // trailing dollar is not exclusive to jostraca -- Seneca uses entity$ as real
83
+ // data -- so a blanket suffix match can silently drop a legitimate API field.
84
+ const MODEL_META = ['index$', 'key$', 'val$']
85
+
86
+ // Keys whose value IS the default the runtime already assumes when the key is
87
+ // absent, so emitting them is pure payload.
88
+ const CONFIG_DEFAULT: Record<string, any> = {
89
+ active: true,
90
+ req: false,
91
+ reqd: false,
92
+ }
93
+
94
+ // Subtrees carrying user payload rather than schema. An active:true inside an
95
+ // OpenAPI example is DATA, not a default, so default-pruning stops at these
96
+ // keys and everything below them is passed through untouched.
97
+ const PAYLOAD_KEYS = ['default', 'example', 'examples']
98
+
99
+ function clean(o: any, dropDefaults?: boolean): any {
100
+ const prune = (node: any, defaults: boolean): any => {
101
+ if (Array.isArray(node)) {
102
+ return node.map((n: any) => prune(n, defaults))
103
+ }
104
+ if (null != node && 'object' === typeof node) {
105
+ const out: any = {}
106
+ for (const k of Object.keys(node)) {
107
+ if (MODEL_META.includes(k)) {
108
+ continue
109
+ }
110
+ if (defaults && k in CONFIG_DEFAULT && CONFIG_DEFAULT[k] === node[k]) {
111
+ continue
112
+ }
113
+ out[k] = prune(node[k], defaults && !PAYLOAD_KEYS.includes(k))
114
+ }
115
+ return out
116
+ }
117
+ return node
118
+ }
119
+ return prune(o, true === dropDefaults)
120
+ }
121
+
122
+
123
+ export {
124
+ clean,
125
+ leanString,
126
+ leanVarName,
127
+ pkgName,
128
+ projectPath,
129
+ }
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) $$const.year$$ Voxgig
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,50 @@
1
+ .PHONY: test build lint clean publish
2
+
3
+ # Run the full generated test suite (dependency-free plain runner).
4
+ test:
5
+ dart run test/main.dart
6
+
7
+ # "Lint": static analysis (a clean `dart analyze` means the code is sound).
8
+ lint:
9
+ dart analyze
10
+
11
+ # Build smoke-test: compile the SDK entry to a kernel snapshot.
12
+ build:
13
+ dart analyze lib
14
+
15
+ clean:
16
+ rm -rf .dart_tool *.dill
17
+
18
+ # --- Release: publish to pub.dev -------------------------------------------
19
+ # Publish this package to pub.dev, then tag dart/vX.Y.Z. pub.dev uses OAuth —
20
+ # headless, the vault supplies the credentials JSON as PUB_CREDENTIALS and we
21
+ # write it to the dart config path before publishing; the github token pushes
22
+ # the tag. set -e + tag-last: a failed upload never leaves a tag behind.
23
+ VERSION := $(shell sed -nE 's/^version: *([0-9][^ ]*).*/\1/p' pubspec.yaml | head -1)
24
+ TAG := dart/v$(VERSION)
25
+ BORU_DRY_RUN_FILLER := BORU-DRY-RUN-FILLER-NOT-A-REAL-SECRET
26
+ publish: test
27
+ @if git rev-parse -q --verify "refs/tags/$(TAG)" >/dev/null; then \
28
+ echo "tag $(TAG) already exists — bump pubspec.yaml version first"; exit 1; fi
29
+ @set -e; \
30
+ token="$${GITHUB_TOKEN:-$$GH_TOKEN}"; \
31
+ if [ "$$token" = "$(BORU_DRY_RUN_FILLER)" ]; then \
32
+ echo "[dry-run] boru filler token detected: would publish to pub.dev and tag $(TAG); nothing pushed."; \
33
+ exit 0; \
34
+ fi; \
35
+ if [ -n "$$PUB_CREDENTIALS" ]; then \
36
+ creddir="$$HOME/Library/Application Support/dart"; \
37
+ [ -d "$$HOME/Library/Application Support" ] || creddir="$${XDG_CONFIG_HOME:-$$HOME/.config}/dart"; \
38
+ mkdir -p "$$creddir"; \
39
+ printf '%s' "$$PUB_CREDENTIALS" > "$$creddir/pub-credentials.json"; \
40
+ fi; \
41
+ dart pub publish --force; \
42
+ git tag -a "$(TAG)" -m "dart v$(VERSION)"; \
43
+ url=$$(git remote get-url origin | sed -E 's#^git@github.com:#https://github.com/#'); \
44
+ if [ -n "$$token" ] && printf '%s' "$$url" | grep -q '^https://github.com/'; then \
45
+ hdr="AUTHORIZATION: basic $$(printf 'x-access-token:%s' "$$token" | base64 | tr -d '\n')"; \
46
+ git -c http.extraheader="$$hdr" push "$$url" "$(TAG)"; \
47
+ else \
48
+ git push origin "$(TAG)"; \
49
+ fi; \
50
+ echo "Published to pub.dev + tag $(TAG)."
@@ -0,0 +1,150 @@
1
+ import 'dart:math';
2
+
3
+ import 'ProjectNameError.dart';
4
+
5
+ import 'utility/voxgig_struct.dart' as vs;
6
+
7
+ import 'Operation.dart';
8
+ import 'Point.dart';
9
+ import 'Response.dart';
10
+ import 'Result.dart';
11
+ import 'Spec.dart';
12
+
13
+ class Context {
14
+ String id = 'C' +
15
+ (Random().nextInt(0x3fffffff) + 0x40000000).toString().substring(0, 8);
16
+
17
+ // Store the output of each operation step.
18
+ Map<String, dynamic> out = {};
19
+
20
+ // Per-operation control settings (plain map: throw, explain, actor, ...).
21
+ dynamic ctrl = {};
22
+ dynamic meta = {};
23
+
24
+ dynamic client;
25
+ dynamic utility;
26
+
27
+ dynamic op;
28
+ dynamic point;
29
+
30
+ dynamic config;
31
+ dynamic entopts;
32
+ dynamic options;
33
+
34
+ dynamic opmap;
35
+
36
+ dynamic response;
37
+ dynamic result;
38
+ dynamic spec;
39
+
40
+ dynamic data;
41
+ dynamic reqdata;
42
+ dynamic match;
43
+ dynamic reqmatch;
44
+
45
+ dynamic entity;
46
+
47
+ // Shared persistent store.
48
+ dynamic shared;
49
+
50
+ Context(dynamic ctxmap, [dynamic basectx]) {
51
+ client = vs.getprop(ctxmap, 'client') ?? basectx?.client;
52
+ utility = vs.getprop(ctxmap, 'utility') ?? basectx?.utility;
53
+
54
+ final rawctrl = vs.getprop(ctxmap, 'ctrl');
55
+ ctrl = null != rawctrl
56
+ ? (rawctrl is Map && rawctrl is! Map<String, dynamic>
57
+ ? Map<String, dynamic>.from(rawctrl)
58
+ : rawctrl)
59
+ : (basectx?.ctrl ?? {});
60
+ meta = vs.getprop(ctxmap, 'meta') ?? basectx?.meta ?? {};
61
+
62
+ config = vs.getprop(ctxmap, 'config') ?? basectx?.config;
63
+ entopts = vs.getprop(ctxmap, 'entopts') ?? basectx?.entopts;
64
+ options = vs.getprop(ctxmap, 'options') ?? basectx?.options;
65
+
66
+ entity = vs.getprop(ctxmap, 'entity') ?? basectx?.entity;
67
+ shared = vs.getprop(ctxmap, 'shared') ?? basectx?.shared;
68
+ opmap = vs.getprop(ctxmap, 'opmap') ?? basectx?.opmap ?? {};
69
+
70
+ data = vs.getprop(ctxmap, 'data', {});
71
+ reqdata = vs.getprop(ctxmap, 'reqdata', {});
72
+ match = vs.getprop(ctxmap, 'match', {});
73
+ reqmatch = vs.getprop(ctxmap, 'reqmatch', {});
74
+
75
+ point = _aspoint(vs.getprop(ctxmap, 'point')) ?? basectx?.point;
76
+ spec = _asspec(vs.getprop(ctxmap, 'spec')) ?? basectx?.spec;
77
+ result = _asresult(vs.getprop(ctxmap, 'result')) ?? basectx?.result;
78
+ response = _asresponse(vs.getprop(ctxmap, 'response')) ?? basectx?.response;
79
+
80
+ final opname = vs.getprop(ctxmap, 'opname');
81
+ op = resolveOp(opname);
82
+ }
83
+
84
+ // JSON-sourced context maps carry plain maps for the pipeline value
85
+ // classes; coerce them so utilities can use typed member access.
86
+ dynamic _aspoint(dynamic v) => v is Map ? Point(v) : v;
87
+ dynamic _asspec(dynamic v) => v is Map ? Spec(v) : v;
88
+ dynamic _asresult(dynamic v) => v is Map ? Result(v) : v;
89
+ dynamic _asresponse(dynamic v) => v is Map ? Response(v) : v;
90
+
91
+ dynamic resolveOp(dynamic opname) {
92
+ // Cache key is `<entity>:<opname>` so two entities with the same op
93
+ // (e.g. both have a "list") get distinct cached Operations. Keying on
94
+ // opname alone caused the first-resolved entity's points to be served
95
+ // to every subsequent entity's call.
96
+ var entname = '';
97
+ final ent = entity;
98
+ if (null != ent) {
99
+ if (ent is Map) {
100
+ entname = vs.getprop(ent, 'name', '') ?? '';
101
+ } else {
102
+ try {
103
+ entname = (ent.name ?? '') as String;
104
+ } catch (_e) {
105
+ entname = '';
106
+ }
107
+ }
108
+ }
109
+
110
+ final cacheKey = entname + ':' + ('' + (opname ?? '').toString());
111
+ dynamic op = vs.getprop(opmap, cacheKey);
112
+
113
+ if (null == op && null != opname) {
114
+ final opcfg = vs.getpath(config, ['entity', entname, 'op', opname]);
115
+ var input = 'match';
116
+
117
+ if ('update' == opname || 'create' == opname) {
118
+ input = 'data';
119
+ }
120
+
121
+ op = Operation({
122
+ 'entity': entname,
123
+ 'name': opname,
124
+ 'input': input,
125
+ 'points': vs.getprop(opcfg, 'points', []),
126
+ });
127
+
128
+ vs.setprop(opmap, cacheKey, op);
129
+ }
130
+
131
+ return op;
132
+ }
133
+
134
+ ProjectNameError error(String code, String msg) {
135
+ return ProjectNameError(code, msg, this);
136
+ }
137
+
138
+ Map<String, dynamic> toJSON() => {
139
+ 'id': id,
140
+ 'op': op,
141
+ 'spec': spec,
142
+ 'entity': entity,
143
+ 'result': result,
144
+ 'response': response,
145
+ 'meta': meta,
146
+ };
147
+
148
+ @override
149
+ String toString() => 'Context ' + id;
150
+ }
@@ -0,0 +1,15 @@
1
+ import 'utility/voxgig_struct.dart' as vs;
2
+
3
+ // The operation pipeline passes ctrl as a plain map (see Context.ctrl);
4
+ // this class documents the recognised control keys.
5
+ class Control {
6
+ dynamic throwErr;
7
+ dynamic err;
8
+ dynamic explain;
9
+
10
+ Control(dynamic ctrlmap) {
11
+ throwErr = vs.getprop(ctrlmap, 'throw');
12
+ err = vs.getprop(ctrlmap, 'err');
13
+ explain = vs.getprop(ctrlmap, 'explain');
14
+ }
15
+ }
@@ -0,0 +1,31 @@
1
+ import 'utility/voxgig_struct.dart' as vs;
2
+
3
+ import 'Point.dart';
4
+
5
+ class Operation {
6
+ dynamic entity;
7
+ dynamic name;
8
+ dynamic input;
9
+ List<dynamic> points = [];
10
+
11
+ Operation(dynamic opmap) {
12
+ entity = vs.getprop(opmap, 'entity', '_');
13
+ name = vs.getprop(opmap, 'name', '_');
14
+ input = vs.getprop(opmap, 'input', '_');
15
+
16
+ final rawpoints = vs.getprop(opmap, 'points', []);
17
+ points = [];
18
+ if (rawpoints is List) {
19
+ for (final p in rawpoints) {
20
+ points.add(p is Point ? p : Point(p));
21
+ }
22
+ }
23
+ }
24
+
25
+ Map<String, dynamic> toJSON() => {
26
+ 'entity': entity,
27
+ 'name': name,
28
+ 'input': input,
29
+ 'points': points,
30
+ };
31
+ }