@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,105 @@
1
+ // VENDORED: @voxgig/plugin sdk-20260908-1556-0 (dart/lib/capability.dart)
2
+ // Source: https://github.com/voxgig/plugin @ 48392f5e2b6d1434ee9b1a4a9a11f4480aaeb46a [tag: sdk-20260908-1556-0]
3
+ // License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
4
+ /// Capabilities (section 11.1).
5
+ ///
6
+ /// A DEPENDENCY IS ON A CAPABILITY, NOT ON A REF - because it is a
7
+ /// dependency on something that can do the job, and which instance is doing
8
+ /// it is exactly the configuration detail a plugin must not care about.
9
+ ///
10
+ /// But A BINDING IS TO AN INSTANCE, not to a capability, which is what
11
+ /// decides behaviour when the bound provider leaves while another match
12
+ /// remains.
13
+ library;
14
+
15
+ import 'types.dart' as t;
16
+ import 'version.dart' as v;
17
+
18
+ /// Rank the matching live providers and return them best-first: highest
19
+ /// `version`, then LOWEST `priority` (default 0), then declaration position
20
+ /// `pos` ascending.
21
+ ///
22
+ /// `priority` is a field on the capability rather than section 7's `order`
23
+ /// band, because bands live on POINT BINDINGS: a provider may have several
24
+ /// bindings with different bands, or none at all, so a rank reaching for
25
+ /// one would be undefined in the common case.
26
+ ///
27
+ /// Without a total rank, "any provider satisfies" is true of the GRAPH and
28
+ /// useless to the PLUGIN - two ports could bind different `store`
29
+ /// instances, both resolve green, and behave differently, which is
30
+ /// precisely the divergence a shared corpus exists to catch.
31
+ List<dynamic> resolveCapability(dynamic req, dynamic candidates) {
32
+ final hits = (candidates as List)
33
+ .where((c) => matches(req, t.get(c, 'provides') ?? {}))
34
+ .toList();
35
+ return t.stableSortBy(hits, rankKey);
36
+ }
37
+
38
+ /// An ABSENT version sorts LAST, whatever the other is - "no version" loses
39
+ /// to every version rather than being read as 0.0.0. The leading flag is
40
+ /// what expresses that in a sort KEY rather than a comparator.
41
+ List<Object> rankKey(dynamic cand) {
42
+ final prov = t.get(cand, 'provides') ?? {};
43
+ final version = t.get(prov, 'version');
44
+ return [
45
+ version == null ? 1 : 0,
46
+ version == null
47
+ ? <Object>[0, 0, 0]
48
+ : v.versionParts(version as String).map((n) => -n).toList().cast<Object>(),
49
+ (t.get(prov, 'priority') ?? 0) as Object,
50
+ (t.get(cand, 'pos') ?? 0) as Object,
51
+ ];
52
+ }
53
+
54
+ bool matches(dynamic req, dynamic prov) {
55
+ if (t.get(req, 'name') != t.get(prov, 'name')) return false;
56
+
57
+ if (t.get(req, 'range') != null) {
58
+ if (t.get(prov, 'version') == null) return false;
59
+ if (!v.satisfiesq(t.get(prov, 'version'), t.get(req, 'range'))) return false;
60
+ }
61
+
62
+ // `match` is checked against the provider's `attrs`, key by key. A key the
63
+ // provider does not carry is a miss, not a pass: a requirement asking for
64
+ // `transactional: true` must not be satisfied by a provider that never
65
+ // said.
66
+ final want = t.get(req, 'match');
67
+ if (want != null) {
68
+ final attrs = t.get(prov, 'attrs') ?? {};
69
+ for (final k in t.sortedKeys(want)) {
70
+ if (!t.has(attrs, k)) return false;
71
+ if (!matchValue(t.get(want, k), t.get(attrs, k))) return false;
72
+ }
73
+ }
74
+ return true;
75
+ }
76
+
77
+ /// PARTIAL MATCH, RECURSING INTO MAPS (section 11.1).
78
+ ///
79
+ /// Every leaf in the requirement must be present and equal in the
80
+ /// capability, keys not mentioned are not checked. Equality is by JSON TYPE
81
+ /// as well as value: `transactional: 1` does not satisfy
82
+ /// `transactional: true`. DART NEEDS NO GUARD FOR THAT - `true == 1` is
83
+ /// false, because `bool` and `int` are unrelated types with no coercion.
84
+ /// Python, PHP, Perl and Lua all need one, and `capability/match` pins the
85
+ /// behaviour for every port rather than trusting each language's `==`.
86
+ ///
87
+ /// A LIST IS COMPARED LEAF-WISE AT THE SAME LENGTH, not as a subset.
88
+ bool matchValue(dynamic want, dynamic got) {
89
+ if (want is Map) {
90
+ if (got is! Map) return false;
91
+ for (final k in t.sortedKeys(want)) {
92
+ if (!got.containsKey(k)) return false;
93
+ if (!matchValue(want[k], got[k])) return false;
94
+ }
95
+ return true;
96
+ }
97
+ if (want is List) {
98
+ if (got is! List || want.length != got.length) return false;
99
+ for (var i = 0; i < want.length; i++) {
100
+ if (!matchValue(want[i], got[i])) return false;
101
+ }
102
+ return true;
103
+ }
104
+ return t.same(want, got);
105
+ }
@@ -0,0 +1,46 @@
1
+ // VENDORED: @voxgig/plugin sdk-20260908-1556-0 (dart/lib/catalog.dart)
2
+ // Source: https://github.com/voxgig/plugin @ 48392f5e2b6d1434ee9b1a4a9a11f4480aaeb46a [tag: sdk-20260908-1556-0]
3
+ // License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
4
+ /// The definition catalog (section 10.1).
5
+ ///
6
+ /// A definition is registered once and may back many instances. Option
7
+ /// shapes are validated AT REGISTRATION, not when a document happens to
8
+ /// exercise a key - so a malformed shape fails once, and in the same place
9
+ /// everywhere (section 9.4).
10
+ library;
11
+
12
+ import 'types.dart' as t;
13
+ import 'ref.dart' as r;
14
+ import 'config.dart' as config;
15
+
16
+ class Catalog {
17
+ final Map<String, dynamic> _defs = {};
18
+
19
+ void add(dynamic definition) {
20
+ final name = t.get(definition, 'name');
21
+ if (definition is! Map || !r.checkName(name)) {
22
+ final shown = definition is Map ? name : definition;
23
+ t.fail('plugin_definition_name', 'invalid definition name: $shown');
24
+ }
25
+ // Validate the shape HERE. Deferring it to resolution time means a
26
+ // malformed shape surfaces at a different moment in every host that
27
+ // loads it, which is the divergence the stated domain exists to prevent.
28
+ final shape = t.get(definition, 'shape');
29
+ if (shape != null) config.checkShape(shape);
30
+ _defs[name as String] = definition;
31
+ }
32
+
33
+ dynamic get(String name) => _defs[name];
34
+
35
+ bool has(String name) => _defs.containsKey(name);
36
+
37
+ List<String> names() => _defs.keys.toList()..sort();
38
+ }
39
+
40
+ Catalog makeCatalog([List<dynamic>? definitions]) {
41
+ final catalog = Catalog();
42
+ for (final d in definitions ?? const []) {
43
+ catalog.add(d);
44
+ }
45
+ return catalog;
46
+ }
@@ -0,0 +1,297 @@
1
+ // VENDORED: @voxgig/plugin sdk-20260908-1556-0 (dart/lib/config.dart)
2
+ // Source: https://github.com/voxgig/plugin @ 48392f5e2b6d1434ee9b1a4a9a11f4480aaeb46a [tag: sdk-20260908-1556-0]
3
+ // License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
4
+ /// The declarative document (section 9): normalization, and the ten-level
5
+ /// precedence ladder.
6
+ ///
7
+ /// TWO FUNCTIONS, AND THE SPLIT BETWEEN THEM IS FORCED.
8
+ ///
9
+ /// `normalizeConfig` normalizes STRUCTURE and ENTRY KEYS. It does not merge
10
+ /// options, and cannot: section 9.4 makes merge behaviour a property of the
11
+ /// definition's option SHAPE, which normalization has never seen. A
12
+ /// normalizer that flattened the option layers would make `$MERGE: append`
13
+ /// unimplementable at load time, because the layers it must concatenate
14
+ /// would already be collapsed.
15
+ ///
16
+ /// `resolveOptions` applies the ladder, and it is the only place that knows
17
+ /// the shape.
18
+ library;
19
+
20
+ import 'types.dart' as t;
21
+ import 'ref.dart' as r;
22
+
23
+ const mergeWords = ['replace', 'append'];
24
+
25
+ class _Entries {
26
+ final Map<String, dynamic> map = {};
27
+ final List<String> order = [];
28
+ }
29
+
30
+ /// Both document forms reduce to {ref -> entry} plus the order the form
31
+ /// implies: array POSITION for the array form, sorted refs for the map form.
32
+ _Entries _entries(dynamic src) {
33
+ final out = _Entries();
34
+ if (src == null) return out;
35
+
36
+ if (src is List) {
37
+ for (final item in src) {
38
+ final ref = r.canonRef(t.get(item, 'ref'));
39
+ out.map[ref] = item;
40
+ out.order.add(ref);
41
+ }
42
+ return out;
43
+ }
44
+
45
+ // Map-form refs arrive as KEYS, through a different path than an array
46
+ // element's `ref` field - and must canonicalize the same way.
47
+ for (final key in t.sortedKeys(src)) {
48
+ out.map[r.canonRef(key)] = t.get(src, key);
49
+ }
50
+ // Byte-wise, NOT locale-aware and NOT case-folded. All-lowercase refs sort
51
+ // identically under all three, so only mixed input discriminates: '@' is
52
+ // 0x40, uppercase 0x41-0x5A, lowercase 0x61-0x7A. Dart's String.compareTo
53
+ // is UTF-16 code unit order, which is exactly that for a ref.
54
+ out.order.addAll(out.map.keys.toList()..sort());
55
+ return out;
56
+ }
57
+
58
+ void _checkReserved(String ref, List reserved) {
59
+ if (!reserved.contains(r.refName(ref))) return;
60
+ t.fail('plugin_ref_reserved', 'ref is reserved by the host: $ref',
61
+ {'ref': ref});
62
+ }
63
+
64
+ /// PRESENCE decides, not truthiness and not null. A JSON `null` is a present
65
+ /// value in JavaScript (`undefined !== null`), so it must be one here.
66
+ dynamic _pick(dynamic src, String key, dynamic dflt) =>
67
+ t.has(src, key) ? t.get(src, key) : dflt;
68
+
69
+ Map<String, dynamic> normalizeConfig(dynamic input) {
70
+ final doc = t.get(input, 'doc') ?? {};
71
+ final keys = t.get(input, 'keys') ?? {};
72
+ final ikey = (t.get(keys, 'instance') ?? 'instance') as String;
73
+ final dkey = (t.get(keys, 'default') ?? 'default') as String;
74
+ final reserved = (t.get(input, 'reserved') ?? []) as List;
75
+ final profile = t.get(input, 'profile');
76
+
77
+ // The rename is applied at TWO PLACES AND NO OTHERS: the document root,
78
+ // and every profile.<name> overlay root (section 9.1). A rename applied
79
+ // only at the root would leave `profile.prod.sdk` untranslated and
80
+ // silently drop every environment override the host depends on. Recursing
81
+ // further would be worse: option data is the definition's.
82
+ final basedef = t.get(doc, dkey) ?? {};
83
+ var overlay = profile == null ? null : t.get(t.get(doc, 'profile'), profile);
84
+ if (overlay is! Map) overlay = {};
85
+ final overdef = t.get(overlay, dkey) ?? {};
86
+
87
+ final base = _entries(t.get(doc, ikey));
88
+ final over = _entries(t.get(overlay, ikey));
89
+
90
+ for (final group in [
91
+ base.map.keys.toList(),
92
+ over.map.keys.toList(),
93
+ t.sortedKeys(basedef),
94
+ t.sortedKeys(overdef)
95
+ ]) {
96
+ for (final ref in group) {
97
+ _checkReserved(ref, reserved);
98
+ }
99
+ }
100
+
101
+ // A PARTIAL ARRAY IS NOT A FILTER (section 9.1). sdkgen learned this the
102
+ // hard way: deriving order from a partial array silently dropped
103
+ // config-activated features. Refs in the base but absent from the overlay
104
+ // still load, in sorted position AFTER the listed ones. A profile may also
105
+ // INTRODUCE a ref the base never declared. The remainder keeps the BASE's
106
+ // own order.
107
+ final order = <String>[];
108
+ for (final ref in [...over.order, ...base.order]) {
109
+ if (!order.contains(ref)) order.add(ref);
110
+ }
111
+
112
+ final instance = <String, dynamic>{};
113
+ for (var i = 0; i < order.length; i++) {
114
+ final ref = order[i];
115
+ final b = base.map[ref];
116
+ final o = over.map[ref];
117
+
118
+ // MERGE THE ENTRIES AS AUTHORED, THEN APPLY DEFAULTS TO THE RESULT
119
+ // (section 9.3). A safety rule, not a tidiness one: if the overlay had
120
+ // its defaults filled in before merging it would carry a synthesized
121
+ // active:true and overwrite a base's false - silently re-enabling a
122
+ // deliberately disabled integration in production.
123
+ final block = _pick(o, 'order', _pick(b, 'order', null));
124
+
125
+ // Option layers, levels 3-6, IN LADDER ORDER. Never merged here.
126
+ final nm = r.refName(ref);
127
+ final layers = <dynamic>[];
128
+ for (final src in [t.get(basedef, nm), b, t.get(overdef, nm), o]) {
129
+ if (t.has(src, 'options')) layers.add(t.get(src, 'options'));
130
+ }
131
+
132
+ final ent = <String, dynamic>{
133
+ 'pos': i,
134
+ 'active': _pick(o, 'active', _pick(b, 'active', true)),
135
+ 'start': _pick(o, 'start', _pick(b, 'start', 'eager')),
136
+ 'optionlayers': layers,
137
+ };
138
+ if (block != null) ent['order'] = block;
139
+ instance[ref] = ent;
140
+ }
141
+
142
+ // `default` DECLARES NOTHING (section 9.3). It is a base for every
143
+ // instance of that definition; it does not create one, and an entry for a
144
+ // name with no instances is inert rather than an error - which is what
145
+ // makes a shared library of defaults shippable.
146
+ final defout = <String, dynamic>{};
147
+ for (final k in t.sortedKeys(basedef)) {
148
+ defout[k] = t.get(basedef, k);
149
+ }
150
+ for (final k in t.sortedKeys(overdef)) {
151
+ defout[k] = t.get(overdef, k);
152
+ }
153
+
154
+ return {'instance': instance, 'order': order, 'default': defout};
155
+ }
156
+
157
+ /// Section 9.4: N is an integer of at least 1, and everything else is an
158
+ /// error.
159
+ ///
160
+ /// `{"deep": 0}` is rejected DESPITE having an obvious reading, because
161
+ /// "replace at this key" already has a spelling and two spellings for one
162
+ /// behaviour is the defect class this repo exists to avoid.
163
+ void checkShape(dynamic shape) {
164
+ if (shape is! Map) return;
165
+ for (final k in t.sortedKeys(shape)) {
166
+ final v = t.get(shape, k);
167
+ if (!t.has(v, r'$MERGE')) continue;
168
+ final directive = t.get(v, r'$MERGE');
169
+
170
+ if (directive is String) {
171
+ if (mergeWords.contains(directive)) continue;
172
+ t.fail('plugin_shape_invalid', 'invalid \$MERGE directive at $k: $directive',
173
+ {'key': k, 'directive': directive});
174
+ }
175
+ if (t.has(directive, 'deep')) {
176
+ final n = t.get(directive, 'deep');
177
+ // `true is int` is false in dart, so the boolean case falls out for
178
+ // free here - unlike python, where it does not.
179
+ if (n is int && n >= 1) continue;
180
+ t.fail('plugin_shape_invalid',
181
+ 'invalid \$MERGE deep at $k: ${t.encode(n)}',
182
+ {'key': k, 'directive': directive});
183
+ }
184
+ t.fail('plugin_shape_invalid',
185
+ 'invalid \$MERGE directive at $k: ${t.encode(directive)}',
186
+ {'key': k, 'directive': directive});
187
+ }
188
+ }
189
+
190
+ /// The shape's non-directive values are the level-1 defaults.
191
+ Map<String, dynamic> _defaultsOf(dynamic shape) {
192
+ final out = <String, dynamic>{};
193
+ for (final k in t.sortedKeys(shape)) {
194
+ final v = t.get(shape, k);
195
+ if (t.has(v, r'$MERGE')) continue;
196
+ out[k] = v;
197
+ }
198
+ return out;
199
+ }
200
+
201
+ dynamic _optsOf(dynamic src, String key) {
202
+ if (src == null) return null;
203
+ // The array form is equivalent to the map form (section 9.1).
204
+ if (src is List) {
205
+ for (final item in src) {
206
+ if (r.canonRef(t.get(item, 'ref')) == key) return t.get(item, 'options');
207
+ }
208
+ return null;
209
+ }
210
+ for (final k in t.sortedKeys(src)) {
211
+ if (r.canonRef(k) != key) continue;
212
+ final entry = t.get(src, k);
213
+ return entry is Map ? t.get(entry, 'options') : null;
214
+ }
215
+ return null;
216
+ }
217
+
218
+ /// Merge N levels below this key, replace below that.
219
+ dynamic _deepTo(dynamic base, dynamic over, int n) {
220
+ if (n <= 0) return over;
221
+ if (base is! Map || over is! Map) return over;
222
+ final out = Map<String, dynamic>.from(base);
223
+ for (final k in t.sortedKeys(over)) {
224
+ out[k] = _deepTo(out[k], over[k], n - 1);
225
+ }
226
+ return out;
227
+ }
228
+
229
+ /// Merge ONE layer onto the accumulator, honouring the shape's directives.
230
+ /// The directive holds at EVERY precedence level, not only between document
231
+ /// levels - section 9.4 makes it a property of the shape, which does not
232
+ /// know which layer a value arrived from.
233
+ dynamic _mergeOne(dynamic base, dynamic over, dynamic shape) {
234
+ if (over == null) return base;
235
+ if (base is! Map || over is! Map) return over;
236
+
237
+ final out = Map<String, dynamic>.from(base);
238
+ for (final k in t.sortedKeys(over)) {
239
+ final o = over[k];
240
+ final b = out[k];
241
+ final directive = t.get(t.get(shape, k), r'$MERGE');
242
+
243
+ if (directive == 'replace') {
244
+ out[k] = o;
245
+ } else if (directive == 'append') {
246
+ final bl = b is List ? b : [];
247
+ final ol = o is List ? o : [o];
248
+ out[k] = [...bl, ...ol];
249
+ } else if (t.has(directive, 'deep')) {
250
+ out[k] = _deepTo(b, o, t.get(directive, 'deep') as int);
251
+ } else {
252
+ // Library default: deep for maps, REPLACE for lists. struct.merge is
253
+ // element-wise by index, which for option maps is nearly always wrong
254
+ // - ["a"] over ["x","y","z"] yielding ["a","y","z"] is the defect
255
+ // station hit on secrets.providers.
256
+ out[k] = (b is Map && o is Map) ? _mergeOne(b, o, null) : o;
257
+ }
258
+ }
259
+ return out;
260
+ }
261
+
262
+ Map<String, dynamic> resolveOptions(dynamic input) {
263
+ final shape = t.get(input, 'shape') ?? {};
264
+ checkShape(shape);
265
+
266
+ final ref = r.canonRef(t.get(input, 'ref'));
267
+ final name = r.refName(ref);
268
+ final doc = t.get(input, 'doc') ?? {};
269
+ final profile = t.get(input, 'profile');
270
+
271
+ var overlay = profile == null ? null : t.get(t.get(doc, 'profile'), profile);
272
+ if (overlay is! Map) overlay = {};
273
+
274
+ // ONE ordered merge, lowest to highest. Levels 3-6 are not two namespaces
275
+ // collapsed separately and composed afterwards: that inverts the rule that
276
+ // PROFILE SPECIFICITY OUTRANKS DEFINITION SPECIFICITY, so a prod
277
+ // per-definition default would lose to a base instance value.
278
+ final layers = [
279
+ _defaultsOf(shape), // 1
280
+ t.get(input, 'hostdefaults'), // 2
281
+ _optsOf(t.get(doc, 'default'), name), // 3
282
+ _optsOf(t.get(doc, 'instance'), ref), // 4
283
+ _optsOf(t.get(overlay, 'default'), name), // 5
284
+ _optsOf(t.get(overlay, 'instance'), ref), // 6
285
+ t.get(input, 'env'), // 7
286
+ t.get(input, 'hostoptions'), // 8
287
+ t.get(input, 'loadoptions'), // 9
288
+ t.get(input, 'patch'), // 10
289
+ ];
290
+
291
+ dynamic out = <String, dynamic>{};
292
+ for (final layer in layers) {
293
+ if (layer == null) continue;
294
+ out = _mergeOne(out, layer, shape);
295
+ }
296
+ return out as Map<String, dynamic>;
297
+ }
@@ -0,0 +1,198 @@
1
+ // VENDORED: @voxgig/plugin sdk-20260908-1556-0 (dart/lib/depend.dart)
2
+ // Source: https://github.com/voxgig/plugin @ 48392f5e2b6d1434ee9b1a4a9a11f4480aaeb46a [tag: sdk-20260908-1556-0]
3
+ // License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
4
+ /// Dependency cardinality, policy, and the restart graph (section 11.3).
5
+ ///
6
+ /// TWO AXES, BOTH DECLARED BY THE DEFINITION THAT HAS THE REQUIREMENT,
7
+ /// because only it knows what it can cope with:
8
+ ///
9
+ /// | static (default) | dynamic
10
+ /// -------------|---------------------------|--------------------------
11
+ /// mandatory | unmet -> pending; | unmet -> pending;
12
+ /// (default) | lost -> pending, | lost -> STAYS LIVE,
13
+ /// | recursively | notified
14
+ /// -------------|---------------------------|--------------------------
15
+ /// optional:true| never gates activation; | never gates activation;
16
+ /// | a change deactivates and | a change is a
17
+ /// | reactivates | notification, nothing else
18
+ ///
19
+ /// `dynamic` means the plugin has said, IN WRITING, that it can survive its
20
+ /// provider being swapped underneath it. It is not the default because most
21
+ /// plugins cannot, and the cost of wrongly assuming they can is a live
22
+ /// instance holding a dead reference.
23
+ ///
24
+ /// The rebinding-preference axis is deliberately omitted. OSGi has
25
+ /// reluctant vs greedy and it is a knob every author must understand to read
26
+ /// anyone else's component; we take always-reluctant. Three axes were more
27
+ /// than the model can carry across twenty ports.
28
+ library;
29
+
30
+ import 'types.dart' as t;
31
+ import 'ref.dart' as r;
32
+
33
+ /// One node of the requirement graph. An internal shape, never a corpus
34
+ /// value.
35
+ class GraphNode {
36
+ final String ref;
37
+ final List<String> provides;
38
+ final List<dynamic> requires;
39
+ GraphNode(this.ref, this.provides, this.requires);
40
+ }
41
+
42
+ /// A bare string is shorthand for `{name}`.
43
+ Map<String, dynamic> normRequire(dynamic raw) {
44
+ if (raw is String) return {'name': raw};
45
+ if (raw is Map) return Map<String, dynamic>.from(raw);
46
+ return {};
47
+ }
48
+
49
+ /// The requirements a definition declared, normalized.
50
+ ///
51
+ /// BOTH AXES ARE READ AT TWO LEVELS, AND THE PER-REQUIREMENT ONE WINS.
52
+ ///
53
+ /// The instance-level `policy` and `optional` list are how a DOCUMENT states
54
+ /// the axis without editing the definition, and they apply to every
55
+ /// requirement. The per-requirement form is the one section 11.1's object
56
+ /// syntax exists for, and it is strictly more expressive: an instance that
57
+ /// is `static` on its store and `dynamic` on its metrics cannot be written
58
+ /// at all at the instance level.
59
+ ///
60
+ /// `optional` unions rather than overriding - both spellings are statements
61
+ /// that this requirement need not gate activation, and there is no reading
62
+ /// under which one of them means "actually, mandatory".
63
+ List<Map<String, dynamic>> requirements(dynamic options) {
64
+ final raw = (t.get(options, 'requires') ?? []) as List;
65
+ final marked = t.get(options, 'optional');
66
+ final fallback = t.get(options, 'policy');
67
+
68
+ return raw.map((item) {
69
+ final req = normRequire(item);
70
+ if (t.truthy(req['optional']) ||
71
+ (marked is List && marked.contains(req['name']))) {
72
+ req['optional'] = true;
73
+ }
74
+ if (req['policy'] == null && fallback != null) req['policy'] = fallback;
75
+ return req;
76
+ }).toList();
77
+ }
78
+
79
+ /// Does losing this requirement's SELECTED provider restart the consumer?
80
+ /// The mandatory ones under `static`, and the `static` optional ones - both
81
+ /// make a capability change deactivate and reactivate. `dynamic` never
82
+ /// restarts.
83
+ bool restartsOnLoss(dynamic req) =>
84
+ (t.get(req, 'policy') ?? 'static') != 'dynamic';
85
+
86
+ /// Does an unmet requirement keep the consumer out of `live`?
87
+ ///
88
+ /// Cardinality alone decides this, NOT policy. `dynamic` is a statement
89
+ /// about surviving a SWAP, not about starting without the thing at all - a
90
+ /// mandatory-dynamic consumer still waits in `pending` for its first
91
+ /// provider.
92
+ bool gatesActivation(dynamic req) => t.get(req, 'optional') != true;
93
+
94
+ /// Edges that can cause a restart, which is exactly the set a cycle must be
95
+ /// detected over (section 11.3).
96
+ ///
97
+ /// ONLY `dynamic` OPTIONAL EDGES ARE EXCLUDED, and they are the ones the
98
+ /// exclusion was for: two plugins that optionally and dynamically consume
99
+ /// each other's capabilities both activate happily, neither gates on the
100
+ /// other, and each is merely notified when the other appears. Nothing
101
+ /// restarts, so nothing oscillates. An earlier draft of section 11.3
102
+ /// excluded EVERY optional edge and thereby admitted the non-terminating
103
+ /// case it was trying to permit.
104
+ bool restartCausing(dynamic req) =>
105
+ gatesActivation(req) || restartsOnLoss(req);
106
+
107
+ /// A cycle through restart-causing requirements is
108
+ /// `plugin_dependency_cycle`, detected AT LOAD - before anything runs,
109
+ /// because the failure it describes is a non-terminating reconcile and the
110
+ /// only safe time to report that is before it starts.
111
+ ///
112
+ /// The graph is over capabilities, not refs: an edge runs from a consumer to
113
+ /// EVERY node that provides what it needs, because any of them could be the
114
+ /// one selected and a cycle through any is a cycle. A node also satisfies
115
+ /// its own name as a ref (section 11.1), which is why the ref is a provider
116
+ /// of itself here.
117
+ List<String>? dependencyCycle(List<GraphNode> nodes) {
118
+ // TWO INDEXES, NOT ONE MERGED MAP. Capability names and refs are matched
119
+ // differently - a capability by its exact name, a ref through the
120
+ // canonical spelling (section 4 rule 5) - and one map keyed by both can
121
+ // only do one of them. Keyed by both and looked up raw, as this was, a
122
+ // cycle spelled `a$`/`b$` found no providers and EVADED the load-time
123
+ // check that exists to catch a non-terminating reconcile.
124
+ final bycap = <String, List<String>>{};
125
+ final isref = <String>{};
126
+ for (final n in nodes) {
127
+ isref.add(n.ref);
128
+ for (final cap in n.provides) {
129
+ bycap.putIfAbsent(cap, () => []).add(n.ref);
130
+ }
131
+ }
132
+
133
+ final edges = <String, List<String>>{};
134
+ for (final n in nodes) {
135
+ final out = <String>[];
136
+ for (final req in n.requires) {
137
+ if (!restartCausing(req)) continue;
138
+ final reqname = t.get(req, 'name');
139
+ final from = <String>[...(bycap[reqname] ?? const <String>[])];
140
+ // A node satisfies its own name AS A REF (section 11.1),
141
+ // canonically - exactly what `providersOf` does at runtime. `canon`
142
+ // hands back a name no ref could have unchanged, and no instance ref
143
+ // can equal one, so it is the tolerant test.
144
+ final asref = r.canon(reqname);
145
+ if (isref.contains(asref) && !from.contains(asref)) from.add(asref);
146
+ for (final p in from) {
147
+ if (p != n.ref && !out.contains(p)) out.add(p);
148
+ }
149
+ }
150
+ edges[n.ref] = out..sort();
151
+ }
152
+
153
+ // Iterative DFS with an explicit stack: twenty ports, and several of them
154
+ // have no recursion budget worth relying on.
155
+ const white = 0, grey = 1, black = 2;
156
+ final colour = {for (final n in nodes) n.ref: white};
157
+
158
+ for (final start in edges.keys.toList()..sort()) {
159
+ if (colour[start] != white) continue;
160
+
161
+ final path = <String>[start];
162
+ final stack = <List<dynamic>>[
163
+ [start, 0]
164
+ ];
165
+ colour[start] = grey;
166
+
167
+ while (stack.isNotEmpty) {
168
+ final top = stack.last;
169
+ final node = top[0] as String;
170
+ if ((top[1] as int) >= edges[node]!.length) {
171
+ colour[node] = black;
172
+ stack.removeLast();
173
+ path.removeLast();
174
+ continue;
175
+ }
176
+ final next = edges[node]![top[1] as int];
177
+ top[1] = (top[1] as int) + 1;
178
+ if (colour[next] == grey) {
179
+ // Report the cycle itself, not the walk that found it.
180
+ return [...path.sublist(path.indexOf(next)), next];
181
+ }
182
+ if (colour[next] == black) continue;
183
+ colour[next] = grey;
184
+ path.add(next);
185
+ stack.add([next, 0]);
186
+ }
187
+ }
188
+ return null;
189
+ }
190
+
191
+ /// Raise on a cycle, naming it. Separate from the detector so the detector
192
+ /// stays pure and corpus-testable.
193
+ void checkCycle(List<GraphNode> nodes) {
194
+ final cycle = dependencyCycle(nodes);
195
+ if (cycle == null) return;
196
+ t.fail('plugin_dependency_cycle', 'requirements cycle: ${cycle.join(' -> ')}',
197
+ {'cycle': cycle});
198
+ }