@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,200 @@
1
+ // VENDORED: @voxgig/sekreto sdk-20260908-1556-0 (dart/src/spec.dart)
2
+ // Source: https://github.com/voxgig/sekreto @ 1267ee2e5f49566bc92695bc9eb3a60ef4924998 [tag: sdk-20260908-1556-0]
3
+ // License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
4
+ // The declarative form of a provider, and the credentials it may carry.
5
+ //
6
+ // `ProviderSpec` is what a config file, the shared spec and an app's own
7
+ // chain description all look like: `kind` picks the provider and everything
8
+ // else is that kind's own. A plugin instance reads it back as
9
+ // `inst.options` (see support.dart).
10
+ //
11
+ // IN THE CORE, and not because the core builds every kind - it builds four.
12
+ // A spec is the SHAPE a chain is declared in, so a chain a plugin will
13
+ // build is still described here; the plugin reads it back through the same
14
+ // pair of converters every other kind uses.
15
+ //
16
+ // A port of typescript/src/provider/support.ts, which is canonical.
17
+
18
+ /// Logging in to a vault instead of being handed a token. `method` is
19
+ /// `kubernetes` or `approle`; `mount` defaults to the method name.
20
+ class AuthSpec {
21
+ final String method;
22
+ final String? mount;
23
+
24
+ /// kubernetes: the Vault role to log in as.
25
+ final String? role;
26
+
27
+ /// kubernetes: the service-account JWT itself (tests).
28
+ final String? jwt;
29
+
30
+ /// kubernetes: where the JWT lives; the conventional pod path by default.
31
+ final String? jwtfile;
32
+
33
+ /// approle: the role and secret ids.
34
+ final String? roleid;
35
+ final String? secretid;
36
+
37
+ const AuthSpec({
38
+ required this.method,
39
+ this.mount,
40
+ this.role,
41
+ this.jwt,
42
+ this.jwtfile,
43
+ this.roleid,
44
+ this.secretid,
45
+ });
46
+
47
+ /// Printed without its credentials.
48
+ ///
49
+ /// A printer that walked every field would put the service-account JWT and
50
+ /// the AppRole secret id into `print('bad chain: $specs')` - which is what
51
+ /// someone writes when a chain will not build. Fields that hold a
52
+ /// credential report whether they are set, never what they are.
53
+ @override
54
+ String toString() => 'AuthSpec(method: $method, mount: $mount, role: $role, '
55
+ 'jwtfile: $jwtfile, roleid: $roleid, jwt: ${setornot(jwt)}, '
56
+ 'secretid: ${setornot(secretid)})';
57
+ }
58
+
59
+ /// What a credential field reports about itself.
60
+ String setornot(String? value) =>
61
+ (null != value && value.isNotEmpty) ? '[set]' : '[unset]';
62
+
63
+ /// The declarative form of a provider, as used in config and in the shared
64
+ /// spec. `kind` picks the provider; everything else is that kind's own.
65
+ class ProviderSpec {
66
+ final String kind;
67
+
68
+ /// The store name `Sekreto.getfrom` addresses. Defaults to `kind`.
69
+ final String? name;
70
+ final String? prefix;
71
+
72
+ /// dotenv: the file to read. secretspec: the declaration to read.
73
+ final String? file;
74
+
75
+ /// memory: literal values, keyed like environment variables. Insertion
76
+ /// ordered, because the spec compares whole maps.
77
+ final Map<String, String>? values;
78
+
79
+ /// file: the directory of one-secret-per-file entries.
80
+ final String? dir;
81
+
82
+ /// hashicorp / boru (wire) / gcp / 1password / doppler / infisical: the
83
+ /// base URL.
84
+ final String? addr;
85
+
86
+ /// hashicorp / boru (wire) / gcp / azure / 1password / doppler /
87
+ /// infisical: the token.
88
+ final String? token;
89
+
90
+ /// hashicorp / boru (wire): the KV mount (default `secret`).
91
+ final String? mount;
92
+
93
+ /// hashicorp: KV engine version, 1 or 2 (default 2).
94
+ final int? kv;
95
+
96
+ /// hashicorp: Vault Enterprise namespace (X-Vault-Namespace).
97
+ final String? vaultnamespace;
98
+
99
+ /// hashicorp: log in for a token instead of being handed one.
100
+ final AuthSpec? auth;
101
+
102
+ /// boru / secretspec: the executable to run (default: the kind's name).
103
+ final String? command;
104
+
105
+ /// secretspec: the profile to read (`--profile`).
106
+ final String? profile;
107
+
108
+ /// secretspec: which of ITS backends to read from (`--provider`), e.g.
109
+ /// `keyring` or `dotenv://.env`. Named `backend` here because `provider`
110
+ /// already means a sekreto provider.
111
+ final String? backend;
112
+
113
+ /// secretspec: the audit reason recorded for the read (`--reason`).
114
+ /// SecretSpec refuses to read without one.
115
+ final String? reason;
116
+
117
+ /// boru: the namespace qualifying the alias.
118
+ final String? namespace;
119
+
120
+ /// boru: the vault home, passed as BORU_HOME.
121
+ final String? home;
122
+
123
+ /// aws: region and credentials; the standard AWS_* variables fill the
124
+ /// rest.
125
+ final String? region;
126
+ final String? keyid;
127
+ final String? secret;
128
+ final String? session;
129
+
130
+ /// gcp / doppler / infisical: the project, however that store names it.
131
+ final String? project;
132
+
133
+ /// azure: the Key Vault name or full URL. 1password: the vault name or id.
134
+ final String? vault;
135
+
136
+ /// azure: client-credential login. infisical: universal-auth login.
137
+ final String? tenant;
138
+ final String? clientid;
139
+ final String? clientsecret;
140
+
141
+ /// azure: where to log in / where IMDS answers. gcp: the metadata server.
142
+ final String? loginaddr;
143
+ final String? imdsaddr;
144
+ final String? metadataaddr;
145
+
146
+ /// azure: the Key Vault API version (default 7.4).
147
+ final String? apiversion;
148
+
149
+ /// doppler: the config slug (with `project`).
150
+ final String? config;
151
+
152
+ /// infisical: the environment slug and secret path.
153
+ final String? environment;
154
+ final String? path;
155
+
156
+ const ProviderSpec({
157
+ required this.kind,
158
+ this.name,
159
+ this.prefix,
160
+ this.file,
161
+ this.values,
162
+ this.dir,
163
+ this.addr,
164
+ this.token,
165
+ this.mount,
166
+ this.kv,
167
+ this.vaultnamespace,
168
+ this.auth,
169
+ this.command,
170
+ this.profile,
171
+ this.backend,
172
+ this.reason,
173
+ this.namespace,
174
+ this.home,
175
+ this.region,
176
+ this.keyid,
177
+ this.secret,
178
+ this.session,
179
+ this.project,
180
+ this.vault,
181
+ this.tenant,
182
+ this.clientid,
183
+ this.clientsecret,
184
+ this.loginaddr,
185
+ this.imdsaddr,
186
+ this.metadataaddr,
187
+ this.apiversion,
188
+ this.config,
189
+ this.environment,
190
+ this.path,
191
+ });
192
+
193
+ /// Printed without its credentials. See AuthSpec.toString: a printer that
194
+ /// walked every field would put the Vault token, the AWS secret access key
195
+ /// and the Azure client secret into whatever formatted it.
196
+ @override
197
+ String toString() => 'ProviderSpec(kind: $kind, name: $name, addr: $addr, '
198
+ 'token: ${setornot(token)}, secret: ${setornot(secret)}, '
199
+ 'clientsecret: ${setornot(clientsecret)}, auth: $auth)';
200
+ }
@@ -0,0 +1,217 @@
1
+ // VENDORED: @voxgig/sekreto sdk-20260908-1556-0 (dart/src/support.dart)
2
+ // Source: https://github.com/voxgig/sekreto @ 1267ee2e5f49566bc92695bc9eb3a60ef4924998 [tag: sdk-20260908-1556-0]
3
+ // License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
4
+ // How a provider kind becomes a voxgig/plugin definition.
5
+ //
6
+ // This file is the whole bridge between the two libraries. A provider kind
7
+ // is a plugin `Definition` named after the kind; its `define` reads the
8
+ // instance's options as a `ProviderSpec`, builds the provider, and exports
9
+ // it under the key `provider`. `Sekreto` reads it back off the host. One
10
+ // helper makes every one of them, built-in or plugin, shipped or custom:
11
+ //
12
+ // final mystore = providerplugin('mystore', (spec) => Mystore(spec.addr));
13
+ //
14
+ // A port of typescript/src/provider/support.ts, which is canonical.
15
+
16
+ import '../../plugin/plugin.dart' as plugin;
17
+
18
+ import 'provider.dart';
19
+ import 'sekreto.dart';
20
+ import 'spec.dart';
21
+
22
+ /// A voxgig/plugin definition.
23
+ ///
24
+ /// plugin's value model is `dynamic`, and a definition is a map of `name` to
25
+ /// the kind and `define` to the callback - which is what makes a catalog a
26
+ /// data structure a document could produce. The alias exists so that a
27
+ /// `plugins` list reads as what it is rather than as
28
+ /// `List<Map<String, dynamic>>`.
29
+ typedef Definition = Map<String, dynamic>;
30
+
31
+ /// The export key under which a provider definition publishes the provider
32
+ /// it built. `Sekreto` reads `<ref>/provider` off the host.
33
+ const String PROVIDER_EXPORT = 'provider';
34
+
35
+ /// The voxgig/plugin error code a SekretoError travels under when it is
36
+ /// raised inside a definition's `define`.
37
+ ///
38
+ /// plugin wraps a code-less error raised by a callback as
39
+ /// `plugin_define_failed`, and keeps one that already carries a code. A
40
+ /// provider that refuses its own configuration - `kv: 3`, a missing project
41
+ /// - raises a SekretoError, and the shared spec pins that message byte for
42
+ /// byte, so it must come back out of the host exactly as it went in.
43
+ /// `providerplugin` gives it this code on the way in; `Sekreto` takes it off
44
+ /// on the way out. Nowhere else catches and rewraps.
45
+ const String ERROR_CODE = 'sekreto_error';
46
+
47
+ /// A provider kind, as a voxgig/plugin definition.
48
+ ///
49
+ /// Nothing runs at `activate`: a provider opens nothing until its first
50
+ /// lookup, so there is nothing to capture - a provider that does hold a
51
+ /// resource acquires it there and lets the instance scope unwind it.
52
+ Definition providerplugin(String kind, Provider Function(ProviderSpec) make) =>
53
+ {
54
+ 'name': kind,
55
+ // A one-argument closure, so plugin's `_run` sees a Function and calls
56
+ // it with the instance.
57
+ 'define': (plugin.Inst inst) {
58
+ final Provider provider;
59
+
60
+ try {
61
+ provider = make(specof(inst.options));
62
+ } on SekretoError catch (err) {
63
+ throw plugin.PluginError(
64
+ ERROR_CODE,
65
+ err.message,
66
+ {'ref': inst.ref, 'cause': err.message},
67
+ );
68
+ }
69
+
70
+ inst.export(PROVIDER_EXPORT, provider);
71
+ },
72
+ };
73
+
74
+ // --- the spec across the plugin boundary -----------------------------
75
+ //
76
+ // plugin's options are its own value model - a map of strings to null,
77
+ // bool, num, String, List and Map - and sekreto's spec is a typed class, so
78
+ // the two are written out field by field rather than reflected over.
79
+ // `optionsof` is what `Sekreto.declare` hands to `host.load`; `specof` is
80
+ // what a definition's `define` reads back. They are inverses, and the seam
81
+ // test `a provider spec survives the plugin boundary` is what says so - a
82
+ // field added to one and forgotten in the other would otherwise be lost in
83
+ // silence, and only for the kinds no conformance case exercises.
84
+
85
+ void _put(Map<String, dynamic> out, String key, Object? value) {
86
+ if (null != value) {
87
+ out[key] = value;
88
+ }
89
+ }
90
+
91
+ String? _str(Map<String, dynamic> options, String key) {
92
+ final value = options[key];
93
+ return value is String ? value : null;
94
+ }
95
+
96
+ /// A ProviderSpec as plugin instance options.
97
+ Map<String, dynamic> optionsof(ProviderSpec spec) {
98
+ final out = <String, dynamic>{};
99
+
100
+ out['kind'] = spec.kind;
101
+ _put(out, 'name', spec.name);
102
+ _put(out, 'prefix', spec.prefix);
103
+ _put(out, 'file', spec.file);
104
+ _put(out, 'values',
105
+ null == spec.values ? null : Map<String, dynamic>.from(spec.values!));
106
+ _put(out, 'dir', spec.dir);
107
+ _put(out, 'addr', spec.addr);
108
+ _put(out, 'token', spec.token);
109
+ _put(out, 'mount', spec.mount);
110
+ _put(out, 'kv', spec.kv);
111
+ _put(out, 'vaultnamespace', spec.vaultnamespace);
112
+
113
+ final auth = spec.auth;
114
+ if (null != auth) {
115
+ final nested = <String, dynamic>{};
116
+ nested['method'] = auth.method;
117
+ _put(nested, 'mount', auth.mount);
118
+ _put(nested, 'role', auth.role);
119
+ _put(nested, 'jwt', auth.jwt);
120
+ _put(nested, 'jwtfile', auth.jwtfile);
121
+ _put(nested, 'roleid', auth.roleid);
122
+ _put(nested, 'secretid', auth.secretid);
123
+ out['auth'] = nested;
124
+ }
125
+
126
+ _put(out, 'command', spec.command);
127
+ _put(out, 'profile', spec.profile);
128
+ _put(out, 'backend', spec.backend);
129
+ _put(out, 'reason', spec.reason);
130
+ _put(out, 'namespace', spec.namespace);
131
+ _put(out, 'home', spec.home);
132
+ _put(out, 'region', spec.region);
133
+ _put(out, 'keyid', spec.keyid);
134
+ _put(out, 'secret', spec.secret);
135
+ _put(out, 'session', spec.session);
136
+ _put(out, 'project', spec.project);
137
+ _put(out, 'vault', spec.vault);
138
+ _put(out, 'tenant', spec.tenant);
139
+ _put(out, 'clientid', spec.clientid);
140
+ _put(out, 'clientsecret', spec.clientsecret);
141
+ _put(out, 'loginaddr', spec.loginaddr);
142
+ _put(out, 'imdsaddr', spec.imdsaddr);
143
+ _put(out, 'metadataaddr', spec.metadataaddr);
144
+ _put(out, 'apiversion', spec.apiversion);
145
+ _put(out, 'config', spec.config);
146
+ _put(out, 'environment', spec.environment);
147
+ _put(out, 'path', spec.path);
148
+
149
+ return out;
150
+ }
151
+
152
+ /// Plugin instance options as a ProviderSpec.
153
+ ProviderSpec specof(Map<String, dynamic> options) {
154
+ final rawvalues = options['values'];
155
+ final values = rawvalues is Map
156
+ ? <String, String>{
157
+ for (final entry in rawvalues.entries)
158
+ '${entry.key}': '${entry.value}',
159
+ }
160
+ : null;
161
+
162
+ final rawauth = options['auth'];
163
+ final auth = rawauth is Map
164
+ ? AuthSpec(
165
+ method: rawauth['method'] is String ? rawauth['method'] as String : '',
166
+ mount: rawauth['mount'] is String ? rawauth['mount'] as String : null,
167
+ role: rawauth['role'] is String ? rawauth['role'] as String : null,
168
+ jwt: rawauth['jwt'] is String ? rawauth['jwt'] as String : null,
169
+ jwtfile:
170
+ rawauth['jwtfile'] is String ? rawauth['jwtfile'] as String : null,
171
+ roleid:
172
+ rawauth['roleid'] is String ? rawauth['roleid'] as String : null,
173
+ secretid: rawauth['secretid'] is String
174
+ ? rawauth['secretid'] as String
175
+ : null,
176
+ )
177
+ : null;
178
+
179
+ final kv = options['kv'];
180
+
181
+ return ProviderSpec(
182
+ kind: _str(options, 'kind') ?? '',
183
+ name: _str(options, 'name'),
184
+ prefix: _str(options, 'prefix'),
185
+ file: _str(options, 'file'),
186
+ values: values,
187
+ dir: _str(options, 'dir'),
188
+ addr: _str(options, 'addr'),
189
+ token: _str(options, 'token'),
190
+ mount: _str(options, 'mount'),
191
+ kv: kv is num ? kv.toInt() : null,
192
+ vaultnamespace: _str(options, 'vaultnamespace'),
193
+ auth: auth,
194
+ command: _str(options, 'command'),
195
+ profile: _str(options, 'profile'),
196
+ backend: _str(options, 'backend'),
197
+ reason: _str(options, 'reason'),
198
+ namespace: _str(options, 'namespace'),
199
+ home: _str(options, 'home'),
200
+ region: _str(options, 'region'),
201
+ keyid: _str(options, 'keyid'),
202
+ secret: _str(options, 'secret'),
203
+ session: _str(options, 'session'),
204
+ project: _str(options, 'project'),
205
+ vault: _str(options, 'vault'),
206
+ tenant: _str(options, 'tenant'),
207
+ clientid: _str(options, 'clientid'),
208
+ clientsecret: _str(options, 'clientsecret'),
209
+ loginaddr: _str(options, 'loginaddr'),
210
+ imdsaddr: _str(options, 'imdsaddr'),
211
+ metadataaddr: _str(options, 'metadataaddr'),
212
+ apiversion: _str(options, 'apiversion'),
213
+ config: _str(options, 'config'),
214
+ environment: _str(options, 'environment'),
215
+ path: _str(options, 'path'),
216
+ );
217
+ }
@@ -0,0 +1,97 @@
1
+ // ignore_for_file: non_constant_identifier_names
2
+
3
+ import 'dart:async';
4
+
5
+ import '../base/BaseFeature.dart';
6
+
7
+ // Streaming result support. For list-style operations it attaches a
8
+ // `result.stream()` Stream factory so callers can consume items
9
+ // incrementally with `await for (final item in result.stream())` instead of
10
+ // materialising the whole list. The stream reads the result's data lazily,
11
+ // so it reflects the parsed entities. A `chunkDelay` (ms) simulates
12
+ // paced/chunked delivery for offline tests via the injectable `sleep`; a
13
+ // `chunkSize` groups items into batches when set.
14
+ class StreamingFeature extends BaseFeature {
15
+ dynamic _client;
16
+
17
+ StreamingFeature() {
18
+ version = '0.0.1';
19
+ name = 'streaming';
20
+ active = true;
21
+ }
22
+
23
+ @override
24
+ dynamic init(dynamic ctx, dynamic opts) {
25
+ _client = ctx.client;
26
+ options = opts is Map ? Map<String, dynamic>.from(opts) : {};
27
+ active = true == options['active'];
28
+ return null;
29
+ }
30
+
31
+ @override
32
+ dynamic PreResult(dynamic ctx) {
33
+ if (!_streamable(ctx)) {
34
+ return null;
35
+ }
36
+ final result = ctx.result;
37
+ if (null == result) {
38
+ return null;
39
+ }
40
+
41
+ final self = this;
42
+ result.streaming = true;
43
+
44
+ result.stream = () {
45
+ return self._iterate(result);
46
+ };
47
+
48
+ final track = _client.track;
49
+ if (null == track['streaming']) {
50
+ track['streaming'] = {'opened': 0};
51
+ }
52
+ track['streaming']['opened']++;
53
+ return null;
54
+ }
55
+
56
+ Stream<dynamic> _iterate(dynamic result) async* {
57
+ final chunkDelay = (options['chunkDelay'] ?? 0) as num;
58
+ final chunkSize = (options['chunkSize'] ?? 0) as num;
59
+
60
+ // Read lazily so downstream result processing is reflected.
61
+ final items = result.resdata is List ? result.resdata as List : [];
62
+
63
+ if (0 < chunkSize) {
64
+ for (var i = 0; i < items.length; i += chunkSize.toInt()) {
65
+ if (0 < chunkDelay) {
66
+ await _sleep(chunkDelay.toInt());
67
+ }
68
+ final end = i + chunkSize.toInt();
69
+ yield items.sublist(i, end > items.length ? items.length : end);
70
+ }
71
+ return;
72
+ }
73
+
74
+ for (final item in items) {
75
+ if (0 < chunkDelay) {
76
+ await _sleep(chunkDelay.toInt());
77
+ }
78
+ yield item;
79
+ }
80
+ }
81
+
82
+ bool _streamable(dynamic ctx) {
83
+ final ops = options['ops'] ?? ['list'];
84
+ return (ops as List).contains(null == ctx.op ? null : ctx.op.name);
85
+ }
86
+
87
+ Future<void> _sleep(int ms) {
88
+ if (0 >= ms) {
89
+ return Future.value();
90
+ }
91
+ final sleeper = options['sleep'];
92
+ if (sleeper is Function) {
93
+ return Future.value(sleeper(ms)).then((_x) {});
94
+ }
95
+ return Future.delayed(Duration(milliseconds: ms));
96
+ }
97
+ }
@@ -0,0 +1,136 @@
1
+ // ignore_for_file: non_constant_identifier_names
2
+
3
+ import '../base/BaseFeature.dart';
4
+
5
+ // Distributed-tracing telemetry. Opens a span per operation (PrePoint),
6
+ // propagates trace context to the server as W3C `traceparent` plus
7
+ // `X-Trace-Id` / `X-Span-Id` headers (PreRequest), and closes the span on
8
+ // completion (PreDone) or failure (PreUnexpected). Finished spans are kept
9
+ // on the client track (`telemetry.spans`); an `exporter` callback, when
10
+ // provided, is invoked with each finished span. Trace/span id generation
11
+ // and the clock are injectable for deterministic tests.
12
+ class TelemetryFeature extends BaseFeature {
13
+ dynamic _client;
14
+ final Map<dynamic, dynamic> _spans = {};
15
+ int _seq = 0;
16
+
17
+ TelemetryFeature() {
18
+ version = '0.0.1';
19
+ name = 'telemetry';
20
+ active = true;
21
+ }
22
+
23
+ @override
24
+ dynamic init(dynamic ctx, dynamic opts) {
25
+ _client = ctx.client;
26
+ options = opts is Map ? Map<String, dynamic>.from(opts) : {};
27
+ active = true == options['active'];
28
+ _spans.clear();
29
+ _seq = 0;
30
+
31
+ final track = _client.track;
32
+ if (null == track['telemetry']) {
33
+ track['telemetry'] = <String, dynamic>{'spans': <dynamic>[], 'active': 0};
34
+ }
35
+ return null;
36
+ }
37
+
38
+ @override
39
+ dynamic PrePoint(dynamic ctx) {
40
+ final span = <String, dynamic>{
41
+ 'traceId': _id('trace'),
42
+ 'spanId': _id('span'),
43
+ 'name': (null == ctx.op ? '_' : (ctx.op.entity ?? '_')).toString() +
44
+ '.' +
45
+ (null == ctx.op ? '_' : (ctx.op.name ?? '_')).toString(),
46
+ 'start': _now(),
47
+ 'end': null,
48
+ 'durationMs': null,
49
+ 'ok': null,
50
+ };
51
+ _spans[ctx] = span;
52
+ _client.track['telemetry']['active']++;
53
+ return null;
54
+ }
55
+
56
+ @override
57
+ dynamic PreRequest(dynamic ctx) {
58
+ final span = _spans[ctx];
59
+ final spec = ctx.spec;
60
+ if (null == span || null == spec) {
61
+ return null;
62
+ }
63
+ spec.headers ??= {};
64
+ final h = options['headers'] ?? {};
65
+ spec.headers[h['trace'] ?? 'X-Trace-Id'] = span['traceId'];
66
+ spec.headers[h['span'] ?? 'X-Span-Id'] = span['spanId'];
67
+ spec.headers[h['parent'] ?? 'traceparent'] = '00-' +
68
+ span['traceId'].toString() +
69
+ '-' +
70
+ span['spanId'].toString() +
71
+ '-01';
72
+ return null;
73
+ }
74
+
75
+ @override
76
+ dynamic PreDone(dynamic ctx) {
77
+ _close(
78
+ ctx,
79
+ null != ctx.result &&
80
+ false != ctx.result.ok &&
81
+ null == ctx.result.err);
82
+ return null;
83
+ }
84
+
85
+ @override
86
+ dynamic PreUnexpected(dynamic ctx) {
87
+ _close(ctx, false);
88
+ return null;
89
+ }
90
+
91
+ void _close(dynamic ctx, bool ok) {
92
+ // Close once per operation; a PreDone followed by a pipeline throw
93
+ // (non-2xx) fires PreUnexpected too, which then finds no open span.
94
+ final span = _spans[ctx];
95
+ if (null == span) {
96
+ return;
97
+ }
98
+ _spans.remove(ctx);
99
+ span['end'] = _now();
100
+ final dur = span['end'] - span['start'];
101
+ span['durationMs'] = dur < 0 ? 0 : dur;
102
+ span['ok'] = ok;
103
+
104
+ final telemetry = _client.track['telemetry'];
105
+ telemetry['active']--;
106
+ telemetry['spans'].add(span);
107
+
108
+ final exporter = options['exporter'];
109
+ if (exporter is Function) {
110
+ try {
111
+ exporter(span);
112
+ } catch (_e) {
113
+ // Exporter failures are swallowed.
114
+ }
115
+ }
116
+ }
117
+
118
+ String _id(String kind) {
119
+ final idgen = options['idgen'];
120
+ if (idgen is Function) {
121
+ return idgen(kind).toString();
122
+ }
123
+ // Deterministic-ish sequential id; unique within a client instance.
124
+ _seq++;
125
+ final n = _seq.toRadixString(16).padLeft(4, '0');
126
+ return ('trace' == kind ? 't' : 's') + n.padRight(16, '0');
127
+ }
128
+
129
+ num _now() {
130
+ final now = options['now'];
131
+ if (now is Function) {
132
+ return now();
133
+ }
134
+ return DateTime.now().millisecondsSinceEpoch;
135
+ }
136
+ }