@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,162 @@
1
+ import 'voxgig_struct.dart' as vs;
2
+
3
+ // GraphQL transport. API-INDEPENDENT: every GraphQL SDK this generator
4
+ // produces uses this file unchanged. The API-specific part — which
5
+ // operations exist and what each one's document is — is model data,
6
+ // computed once by apidef and emitted into Config.
7
+ //
8
+ // Two jobs:
9
+ //
10
+ // graphqlBody — build { query, variables } for a point, binding the
11
+ // op's arguments to the document's declared variables.
12
+ //
13
+ // graphqlErrors — lift a GraphQL failure into an SDK error. GraphQL
14
+ // reports failures as a top-level `errors` array under
15
+ // HTTP 200, so the status-driven path in resultBasic
16
+ // never sees them.
17
+
18
+ // Content type every GraphQL-over-HTTP request uses.
19
+ const String graphqlContentType = 'application/json';
20
+
21
+ // Map a GraphQL error to the same error codes the HTTP path produces, so a
22
+ // caller handles auth or rate limiting identically on both transports.
23
+ // Servers put the machine-readable code in `extensions.code`; Linear-style
24
+ // APIs use `extensions.type`.
25
+ String graphqlErrorCode(dynamic gqlerr) {
26
+ final ext = vs.getprop(gqlerr, 'extensions');
27
+
28
+ var raw = vs.getprop(ext, 'code');
29
+ if (null == raw || '' == raw) {
30
+ raw = vs.getprop(ext, 'type');
31
+ }
32
+ final code = (raw is String) ? raw.toUpperCase() : '';
33
+
34
+ if (code.contains('AUTH') ||
35
+ code.contains('FORBIDDEN') ||
36
+ code.contains('UNAUTHENTICATED')) {
37
+ return 'request_auth';
38
+ }
39
+ if (code.contains('RATELIMIT') ||
40
+ code.contains('RATE_LIMIT') ||
41
+ code.contains('TOO_MANY')) {
42
+ return 'request_ratelimit';
43
+ }
44
+ if (code.contains('BAD_USER_INPUT') ||
45
+ code.contains('VALIDATION') ||
46
+ code.contains('INVALID')) {
47
+ return 'request_invalid';
48
+ }
49
+
50
+ return 'request_graphql';
51
+ }
52
+
53
+ // Build the request body for a GraphQL point.
54
+ //
55
+ // Variables come from the op's own arguments: a named variable binds to the
56
+ // like-named argument (`from`), and the input-object variable (empty
57
+ // `from`) takes the request data as a whole — which is what makes a
58
+ // generated create/update call look exactly like its REST equivalent.
59
+ dynamic graphqlBody(dynamic ctx) {
60
+ final gql = ctx.point?.graphql;
61
+
62
+ if (gql is! Map) {
63
+ return null;
64
+ }
65
+
66
+ // reqmatch/reqdata hold the caller's arguments for THIS call; data/match
67
+ // hold the entity's current state. Which pair depends on whether the op
68
+ // takes match or data input. A named variable falls back to the current
69
+ // state, so updating a loaded entity with just {title} still binds the
70
+ // stored id the mutation requires.
71
+ var reqsrc = ctx.reqmatch;
72
+ var datasrc = ctx.match;
73
+ if (null != ctx.op && 'data' == ctx.op.input) {
74
+ reqsrc = ctx.reqdata;
75
+ datasrc = ctx.data;
76
+ }
77
+ if (reqsrc is! Map) {
78
+ reqsrc = <String, dynamic>{};
79
+ }
80
+ if (datasrc is! Map) {
81
+ datasrc = <String, dynamic>{};
82
+ }
83
+
84
+ final variables = <String, dynamic>{};
85
+
86
+ final varlist = vs.getprop(gql, 'vars');
87
+ if (varlist is List) {
88
+ for (final spec in varlist) {
89
+ if (spec is! Map) {
90
+ continue;
91
+ }
92
+
93
+ final name = vs.getprop(spec, 'name');
94
+ final from = vs.getprop(spec, 'from');
95
+ if (null == name) {
96
+ continue;
97
+ }
98
+
99
+ if (null == from || '' == from) {
100
+ // The input object IS the request body. Strip the action selector,
101
+ // which is an SDK-side point discriminator, not an API field.
102
+ final body = <String, dynamic>{};
103
+ reqsrc.forEach((k, v) {
104
+ if ('\$action' != k) {
105
+ body[k.toString()] = v;
106
+ }
107
+ });
108
+ variables[name.toString()] = body;
109
+ continue;
110
+ }
111
+
112
+ // Only send variables the caller actually supplied: sending an
113
+ // explicit null would clear a field on many APIs.
114
+ final val = vs.getprop(reqsrc, from) ?? vs.getprop(datasrc, from);
115
+ if (null != val) {
116
+ variables[name.toString()] = val;
117
+ }
118
+ }
119
+ }
120
+
121
+ return {
122
+ 'query': vs.getprop(gql, 'doc'),
123
+ 'variables': variables,
124
+ };
125
+ }
126
+
127
+ // Inspect a decoded GraphQL response body and record a failure when the
128
+ // server reported one. Returns true when an error was recorded.
129
+ //
130
+ // Partial data (`data` alongside `errors`) is treated as failure: the REST
131
+ // surface has no partial-success concept, and silently returning half an
132
+ // object would be worse than failing.
133
+ bool graphqlErrors(dynamic ctx) {
134
+ final result = ctx.result;
135
+
136
+ if (null == result || null == ctx.point) {
137
+ return false;
138
+ }
139
+
140
+ if ('graphql' != ctx.point.kind) {
141
+ return false;
142
+ }
143
+
144
+ final errors = vs.getprop(result.body, 'errors');
145
+ if (errors is! List || 0 == errors.length) {
146
+ return false;
147
+ }
148
+
149
+ final first = errors[0];
150
+ var msg = vs.getprop(first, 'message');
151
+ if (msg is! String || '' == msg) {
152
+ msg = 'graphql error';
153
+ }
154
+ if (1 < errors.length) {
155
+ msg = msg + ' (+' + (errors.length - 1).toString() + ' more)';
156
+ }
157
+
158
+ result.err = ctx.error(graphqlErrorCode(first), 'graphql: ' + msg);
159
+ result.ok = false;
160
+
161
+ return true;
162
+ }
@@ -0,0 +1,6 @@
1
+ import '../Context.dart';
2
+
3
+ dynamic makeContext(dynamic ctxmap, [dynamic basectx]) {
4
+ final ctx = Context(ctxmap, basectx);
5
+ return ctx;
6
+ }
@@ -0,0 +1,71 @@
1
+ import '../ProjectNameError.dart';
2
+ import '../Result.dart';
3
+
4
+ import 'CleanUtility.dart';
5
+ import 'ErrUtility.dart';
6
+
7
+ dynamic makeError(dynamic ctx, [dynamic err]) {
8
+ final op = ctx.op;
9
+ final opname =
10
+ (null == op || null == op.name) ? 'unknown operation' : op.name;
11
+
12
+ final result = ctx.result ?? Result({});
13
+ result.ok = false;
14
+
15
+ final reserr = result.err;
16
+
17
+ err ??= reserr;
18
+ err ??= ctx.error('unknown', 'unknown error');
19
+
20
+ // TODO: project name should come from config
21
+ // avoids spurious changes between template and generated utility
22
+ // applies for all utility files
23
+ final msg = 'ProjectNameSDK: ' + opname.toString() + ': ' + errmsg(err);
24
+
25
+ ProjectNameError sdkerr;
26
+ if (err is ProjectNameError) {
27
+ sdkerr = err;
28
+ sdkerr.message = clean(ctx, msg);
29
+ } else {
30
+ final code = errcode(err);
31
+ sdkerr = ProjectNameError('' == code ? 'unknown' : code, clean(ctx, msg), ctx);
32
+ }
33
+
34
+ if (null != result.err) {
35
+ result.err = null;
36
+ }
37
+
38
+ final spec = ctx.spec;
39
+
40
+ if (null != ctx.ctrl['explain']) {
41
+ ctx.ctrl['explain']['err'] = {
42
+ 'code': sdkerr.code,
43
+ 'message': sdkerr.message,
44
+ };
45
+ }
46
+
47
+ sdkerr.result = clean(ctx, result);
48
+ sdkerr.spec = clean(ctx, spec);
49
+
50
+ // Promote the HTTP status to the top level, so a consumer can branch on
51
+ // `err.status` / `err.notFound` instead of reaching into `err.result`.
52
+ sdkerr.status = null == result.status ? -1 : result.status;
53
+
54
+ ctx.ctrl['err'] = sdkerr;
55
+
56
+ // Fire PreUnexpected so observability features (metrics, telemetry, audit,
57
+ // debug) close/record error paths that never reach PreDone (e.g. a PrePoint
58
+ // rbac short-circuit). Fires after ctx.ctrl['err'] is set so hooks can read
59
+ // the error; features guard against double-recording when PreDone fired.
60
+ final utility = ctx.utility;
61
+ if (null != utility && null != utility.featureHook) {
62
+ utility.featureHook(ctx, 'PreUnexpected');
63
+ }
64
+
65
+ // TODO: model option to return instead
66
+ if (false == ctx.ctrl['throw']) {
67
+ return result.resdata;
68
+ } else {
69
+ throw sdkerr;
70
+ }
71
+ }
@@ -0,0 +1,42 @@
1
+ import '../Result.dart';
2
+
3
+ import 'voxgig_struct.dart' as vs;
4
+
5
+ import 'ErrUtility.dart';
6
+
7
+ dynamic makeFetchDef(dynamic ctx) {
8
+ final spec = ctx.spec;
9
+ final utility = ctx.utility;
10
+ final makeUrl = utility.makeUrl;
11
+
12
+ if (null == spec) {
13
+ return ctx.error(
14
+ 'fetchdef_no_spec', 'Expected context spec property to be defined.');
15
+ }
16
+
17
+ if (null == ctx.result) {
18
+ ctx.result = Result({});
19
+ }
20
+
21
+ spec.step = 'prepare';
22
+
23
+ final url = makeUrl(ctx);
24
+ if (iserr(url)) {
25
+ return url;
26
+ }
27
+
28
+ spec.url = url;
29
+
30
+ final fetchdef = <String, dynamic>{
31
+ 'url': url,
32
+ 'method': spec.method,
33
+ 'headers': spec.headers,
34
+ };
35
+
36
+ if (null != spec.body) {
37
+ fetchdef['body'] =
38
+ vs.isnode(spec.body) ? vs.jsonify(spec.body) : spec.body;
39
+ }
40
+
41
+ return fetchdef;
42
+ }
@@ -0,0 +1,233 @@
1
+ import '../ProjectNameError.dart';
2
+
3
+ import 'voxgig_struct.dart' as vs;
4
+
5
+ import 'FetcherUtility.dart';
6
+
7
+ dynamic makeOptions(dynamic ctx) {
8
+ final utility = ctx.utility;
9
+ final options = ctx.options;
10
+
11
+ // Custom utility overrides.
12
+ final customUtils = vs.getprop(options, 'utility') ?? {};
13
+ for (final item in vs.items(customUtils)) {
14
+ utility.setUtility(item[0], item[1]);
15
+ }
16
+
17
+ final config = ctx.config ?? {};
18
+ final cfgopts = vs.getprop(config, 'options') ?? {};
19
+
20
+ // Standard SDK option values.
21
+ final optspec = {
22
+ 'apikey': '',
23
+ 'base': 'http://localhost:8000',
24
+ 'secret': '',
25
+ 'prefix': '',
26
+ 'suffix': '',
27
+ // `basic` and `secret`: HTTP Basic Auth needs a second credential and a
28
+ // flag to say the pair is Basic rather than a single bearer token.
29
+ 'auth': {
30
+ 'prefix': '',
31
+ 'basic': false,
32
+ },
33
+ 'headers': {
34
+ '`\$CHILD`': '`\$STRING`',
35
+ },
36
+ 'allow': {
37
+ 'method': 'GET,PUT,POST,PATCH,DELETE,OPTIONS',
38
+ 'op': 'create,update,load,list,remove,command,direct,graphql',
39
+ },
40
+ 'entity': {
41
+ '`\$CHILD`': {
42
+ '`\$OPEN`': true,
43
+ 'active': false,
44
+ 'alias': {},
45
+ },
46
+ },
47
+ 'feature': {
48
+ '`\$CHILD`': {
49
+ '`\$OPEN`': true,
50
+ 'active': false,
51
+ },
52
+ },
53
+ 'utility': {},
54
+ // Feature INSTANCES supplied at construction (the station adopt
55
+ // path): consumed by the constructor's featureAdd loop, so they are
56
+ // class instances, not data - `$ANY` accepts them verbatim. Without
57
+ // this entry the seam is dead: the constructor reads
58
+ // options.extend, but validate rejected the key.
59
+ 'extend': '`\$ANY`',
60
+ 'system': {},
61
+ 'test': {
62
+ 'active': false,
63
+ 'entity': {
64
+ '`\$OPEN`': true,
65
+ },
66
+ },
67
+ 'clean': {
68
+ 'keys': 'key,token,id',
69
+ },
70
+ // Server-variable values for a templated base URL (OpenAPI server
71
+ // variables): {name} placeholders in "base" are substituted from this
72
+ // map at construction. Spec defaults arrive via the generated config;
73
+ // user values override them. Mirrors go's make_options optspec.
74
+ 'server': {'`\$CHILD`': ''},
75
+ };
76
+
77
+ // Dart specific: preserve the (function-valued) system.fetch across
78
+ // merge/validate, defaulting to the dart:io transport.
79
+ final sysFetch = vs.getpath(options, 'system.fetch') ?? httpFetch;
80
+
81
+ // Feature add-order. `options.feature` may be given as an ordered List of
82
+ // { name, active, ...opts } entries (the List position IS the order in
83
+ // which features are added), or as a { name: {opts} } map. Normalize a
84
+ // List to a map (so merge/validate are unchanged) and remember the
85
+ // explicit order; a map defaults to test-first so the `test` mock
86
+ // transport is installed as the base of the transport wrapper chain.
87
+ final featureorder = <String>[];
88
+ dynamic mergeOptions = options ?? {};
89
+ final rawFeature = vs.getprop(options, 'feature');
90
+ if (rawFeature is List) {
91
+ final fmap = <String, dynamic>{};
92
+ for (final entry in rawFeature) {
93
+ if (entry is Map && null != vs.getprop(entry, 'name')) {
94
+ final fname = vs.getprop(entry, 'name').toString();
95
+ final fopts = <String, dynamic>{};
96
+ entry.forEach((k, v) {
97
+ if ('name' != k) {
98
+ fopts[k.toString()] = v;
99
+ }
100
+ });
101
+ fmap[fname] = fopts;
102
+ featureorder.add(fname);
103
+ }
104
+ }
105
+ mergeOptions = vs.clone(options);
106
+ mergeOptions['feature'] = fmap;
107
+ }
108
+
109
+ // `auth: null` is the documented way to disable auth outright, and
110
+ // prepareAuth honours it before it ever reads the apikey. It cannot survive
111
+ // validate: depending on the struct port a stored null is either REPLACED
112
+ // by the optspec default — transmitting the credential the caller withheld
113
+ // — or REJECTED outright. Withhold the key for validate, then put the null
114
+ // back. Same fix as ts/js/go makeOptions.
115
+ //
116
+ // Suppliedness cannot be recovered after validate, hence here, and it must
117
+ // tell an ABSENT auth from a present null: containsKey rather than a null
118
+ // check on the value, which cannot distinguish them.
119
+ final authSuppressed =
120
+ options is Map && options.containsKey('auth') && null == options['auth'];
121
+
122
+ // User option maps are cloned first — their (possibly narrow) literal
123
+ // types must not constrain the merged structures.
124
+ dynamic opts = vs.merge([{}, cfgopts, vs.clone(mergeOptions)]);
125
+
126
+ if (authSuppressed && opts is Map) {
127
+ opts.remove('auth');
128
+ }
129
+
130
+ opts = vs.validate(opts, optspec);
131
+
132
+ // Restore the suppression the optspec default would otherwise erase.
133
+ if (authSuppressed && opts is Map) {
134
+ opts['auth'] = null;
135
+ }
136
+
137
+ // Resolve a templated base URL (e.g. https://{tenant_id}.hanko.io).
138
+ // Every placeholder must resolve to a non-empty value: from options.server
139
+ // (user), else the Config default. A placeholder that resolves to '' is a
140
+ // construction ERROR in live mode — the URL cannot work — but in test mode
141
+ // substitutes the deterministic value `test-<name>` so offline tests need no
142
+ // configuration. The SDK constructor has no error return, so a missing
143
+ // required variable THROWS: construction-time misconfiguration.
144
+ final baseVal = vs.getprop(opts, 'base');
145
+ if (baseVal is String && baseVal.contains('{')) {
146
+ final testmode = true == vs.getpath(opts, 'test.active') ||
147
+ true == vs.getpath(opts, 'feature.test.active');
148
+ final server = vs.getprop(opts, 'server') ?? {};
149
+ final sdkname = (vs.getpath(config, 'main.name') ?? 'SDK').toString();
150
+
151
+ opts['base'] = baseVal.replaceAllMapped(
152
+ RegExp(r'\{([A-Za-z0-9_]+)\}'),
153
+ (m) {
154
+ final name = m.group(1) as String;
155
+ final raw = vs.getprop(server, name);
156
+ final val = raw is String ? raw : '';
157
+ if ('' == val) {
158
+ if (testmode) {
159
+ return 'test-' + name;
160
+ }
161
+ throw ProjectNameError(
162
+ 'server_var_required',
163
+ "$sdkname: the server variable '$name' is required: the API base "
164
+ "URL is '$baseVal' — pass { 'server': { '$name': '...' } } in the "
165
+ 'SDK options',
166
+ );
167
+ }
168
+ return val;
169
+ },
170
+ );
171
+ }
172
+
173
+ final sys = vs.getprop(opts, 'system');
174
+ if (sys is Map) {
175
+ sys['fetch'] = sysFetch;
176
+ } else {
177
+ opts['system'] = {'fetch': sysFetch};
178
+ }
179
+
180
+ final cleanKeys =
181
+ (vs.getpath(opts, 'clean.keys') ?? 'key,token,id').toString();
182
+
183
+ final parts = <String>[];
184
+ for (final part in cleanKeys.split(',')) {
185
+ final trimmed = part.trim();
186
+ if ('' != trimmed) {
187
+ parts.add(vs.escre(trimmed));
188
+ }
189
+ }
190
+ final keyre = parts.join('|');
191
+
192
+ // Resolve the feature add-order: an explicit List order (above) wins;
193
+ // otherwise order the map test-first, then the remaining names sorted, so
194
+ // the outcome is deterministic and `test` is always the base transport.
195
+ if (0 == featureorder.length) {
196
+ final featureMap = vs.getprop(opts, 'feature') ?? {};
197
+ final names = <String>[];
198
+ for (final it in vs.items(featureMap)) {
199
+ names.add(it[0].toString());
200
+ }
201
+ names.sort();
202
+ if (names.contains('test')) {
203
+ featureorder.add('test');
204
+ for (final n in names) {
205
+ if ('test' != n) {
206
+ featureorder.add(n);
207
+ }
208
+ }
209
+ } else {
210
+ featureorder.addAll(names);
211
+ }
212
+ // Station special case, mirroring test's: its transport wrap must
213
+ // sit immediately outside the base transport (inside retry/cache/
214
+ // netsim), so map-form activation hoists it to just after test -
215
+ // or first, when no test entry exists. Without this the sorted
216
+ // default would init station last and wrap OUTSIDE the recording
217
+ // features, turning its wire-truth events into fiction.
218
+ if (featureorder.contains('station')) {
219
+ featureorder.remove('station');
220
+ final ti = featureorder.indexOf('test');
221
+ featureorder.insert(-1 == ti ? 0 : ti + 1, 'station');
222
+ }
223
+ }
224
+
225
+ opts['__derived__'] = {
226
+ 'clean': {
227
+ 'keyre': '' == keyre ? null : keyre,
228
+ },
229
+ 'featureorder': featureorder,
230
+ };
231
+
232
+ return opts;
233
+ }
@@ -0,0 +1,130 @@
1
+ import 'voxgig_struct.dart' as vs;
2
+
3
+ dynamic makePoint(dynamic ctx) {
4
+ if (null != ctx.out['point']) {
5
+ return ctx.point = ctx.out['point'];
6
+ }
7
+
8
+ final op = ctx.op;
9
+ final options = ctx.options;
10
+
11
+ final allowop = (vs.getpath(options, 'allow.op') ?? '').toString();
12
+ if (!allowop.contains(op.name.toString())) {
13
+ return ctx.error(
14
+ 'point_op_allow',
15
+ 'Operation "' +
16
+ op.name.toString() +
17
+ '" not allowed by SDK option allow.op value: "' +
18
+ allowop +
19
+ '"');
20
+ }
21
+
22
+ if (0 == op.points.length) {
23
+ return ctx.error(
24
+ 'point_no_points',
25
+ 'Operation "' + op.name.toString() + '" has no endpoint definitions.');
26
+ }
27
+
28
+ // Choose the appropriate point based on the match or data.
29
+ if (1 == op.points.length) {
30
+ ctx.point = op.points[0];
31
+ } else {
32
+ // Operation argument has priority, but also look in current data or match.
33
+ final reqselector = 'data' == op.input ? ctx.reqdata : ctx.reqmatch;
34
+ final selector = 'data' == op.input ? ctx.data : ctx.match;
35
+
36
+ dynamic point;
37
+ var matched = false;
38
+ for (var i = 0; i < op.points.length; i++) {
39
+ final cand = op.points[i];
40
+ final select = cand.select;
41
+ var found = true;
42
+
43
+ final exist = vs.getprop(select, 'exist');
44
+ if (null != selector && exist is List) {
45
+ for (var j = 0; j < exist.length; j++) {
46
+ final existkey = exist[j];
47
+
48
+ if (null == vs.getprop(reqselector, existkey) &&
49
+ null == vs.getprop(selector, existkey)) {
50
+ found = false;
51
+ break;
52
+ }
53
+ }
54
+ }
55
+
56
+ // Action is only in operation argument.
57
+ if (found &&
58
+ vs.getprop(reqselector, r'$action') !=
59
+ vs.getprop(select, r'$action')) {
60
+ found = false;
61
+ }
62
+
63
+ if (found) {
64
+ point = cand;
65
+ matched = true;
66
+ break;
67
+ }
68
+ }
69
+
70
+ // select.exist can list more than the params needed to pick a point, so
71
+ // nothing matches — fall back to the entity's own route rather than
72
+ // whichever point came last.
73
+ if (!matched) {
74
+ // A request naming an action reaches here only because that action's
75
+ // own point failed its exist test, so it is unbuildable whatever we
76
+ // pick. Refuse it BEFORE choosing a fallback: the guard below compares
77
+ // the chosen point's $action and would wave the request through
78
+ // whenever the fallback lands on the action point itself.
79
+ if (null != vs.getprop(reqselector, r'$action')) {
80
+ return ctx.error(
81
+ 'point_action_invalid',
82
+ 'Operation "' +
83
+ op.name.toString() +
84
+ '" action "' +
85
+ vs.getprop(reqselector, r'$action').toString() +
86
+ '" is not valid.');
87
+ }
88
+
89
+ // A terminal parameter marks a record route (/boards/{id}); a
90
+ // cross-reference ends in the relationship's name
91
+ // (/posts/{id}/author). Failing that, the shallower path wins.
92
+ bool terminalParam(dynamic p) {
93
+ final parts = p.parts;
94
+ if (parts.isEmpty) {
95
+ return false;
96
+ }
97
+ final last = parts[parts.length - 1];
98
+ return last is String && last.startsWith('{');
99
+ }
100
+
101
+ point = op.points[0];
102
+ for (final cand in op.points) {
103
+ if (terminalParam(cand) != terminalParam(point)) {
104
+ if (terminalParam(cand)) {
105
+ point = cand;
106
+ }
107
+ } else if (cand.parts.length < point.parts.length) {
108
+ point = cand;
109
+ }
110
+ }
111
+ }
112
+
113
+ if (null != vs.getprop(reqselector, r'$action') &&
114
+ null != point &&
115
+ vs.getprop(reqselector, r'$action') !=
116
+ vs.getprop(point.select, r'$action')) {
117
+ return ctx.error(
118
+ 'point_action_invalid',
119
+ 'Operation "' +
120
+ op.name.toString() +
121
+ '" action "' +
122
+ vs.getprop(reqselector, r'$action').toString() +
123
+ '" is not valid.');
124
+ }
125
+
126
+ ctx.point = point;
127
+ }
128
+
129
+ return ctx.point;
130
+ }