@voxgig/sdkgen 4.50.0 → 4.52.0

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 (400) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/cmp/ReadmeExplanation.js +5 -2
  3. package/dist/cmp/ReadmeExplanation.js.map +1 -1
  4. package/dist/cmp/ReadmeFeatures.js +20 -6
  5. package/dist/cmp/ReadmeFeatures.js.map +1 -1
  6. package/dist/helpers/optspec.js +2 -2
  7. package/dist/helpers/optspec.js.map +1 -1
  8. package/dist/tsconfig.tsbuildinfo +1 -1
  9. package/model/sdkgen.aontu +1 -1
  10. package/package.json +1 -1
  11. package/project/.sdk/model/feature/audit.aontu +1 -1
  12. package/project/.sdk/model/feature/cache.aontu +7 -5
  13. package/project/.sdk/model/feature/clienttrack.aontu +1 -1
  14. package/project/.sdk/model/feature/cost.aontu +1 -1
  15. package/project/.sdk/model/feature/debug.aontu +1 -1
  16. package/project/.sdk/model/feature/idempotency.aontu +1 -1
  17. package/project/.sdk/model/feature/log.aontu +1 -1
  18. package/project/.sdk/model/feature/metrics.aontu +3 -1
  19. package/project/.sdk/model/feature/netsim.aontu +1 -1
  20. package/project/.sdk/model/feature/paging.aontu +4 -1
  21. package/project/.sdk/model/feature/proxy.aontu +1 -1
  22. package/project/.sdk/model/feature/ratelimit.aontu +3 -3
  23. package/project/.sdk/model/feature/rbac.aontu +1 -1
  24. package/project/.sdk/model/feature/retry.aontu +1 -1
  25. package/project/.sdk/model/feature/secrets.aontu +1 -1
  26. package/project/.sdk/model/feature/streaming.aontu +1 -1
  27. package/project/.sdk/model/feature/telemetry.aontu +2 -2
  28. package/project/.sdk/model/feature/test.aontu +1 -1
  29. package/project/.sdk/model/feature/timeout.aontu +1 -1
  30. package/project/.sdk/model/feature/validate.aontu +1 -1
  31. package/project/.sdk/model/target/lua.aontu +6 -0
  32. package/project/.sdk/src/cmp/c/Config_c.ts +3 -134
  33. package/project/.sdk/src/cmp/c/TestClean_c.ts +26 -11
  34. package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +17 -10
  35. package/project/.sdk/src/cmp/clojure/TestClean_clojure.ts +10 -5
  36. package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +18 -1
  37. package/project/.sdk/src/cmp/cpp/TestClean_cpp.ts +15 -1
  38. package/project/.sdk/src/cmp/csharp/TestClean_csharp.ts +9 -0
  39. package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +30 -2
  40. package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +31 -12
  41. package/project/.sdk/src/cmp/elixir/TestClean_elixir.ts +13 -4
  42. package/project/.sdk/src/cmp/elixir/fragment/Main.fragment.ex +51 -15
  43. package/project/.sdk/src/cmp/elixir/fragment/Pipeline.fragment.ex +17 -0
  44. package/project/.sdk/src/cmp/go/TestClean_go.ts +39 -3
  45. package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +42 -2
  46. package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +42 -14
  47. package/project/.sdk/src/cmp/java/TestClean_java.ts +17 -4
  48. package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +21 -0
  49. package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +13 -8
  50. package/project/.sdk/src/cmp/js/TestClean_js.ts +13 -5
  51. package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +26 -2
  52. package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +8 -0
  53. package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +8 -0
  54. package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +8 -0
  55. package/project/.sdk/src/cmp/js/fragment/EntityPatchOp.fragment.js +8 -0
  56. package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +8 -0
  57. package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +8 -0
  58. package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +12 -5
  59. package/project/.sdk/src/cmp/kotlin/TestClean_kotlin.ts +31 -4
  60. package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +19 -0
  61. package/project/.sdk/src/cmp/lua/TestClean_lua.ts +14 -4
  62. package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +42 -5
  63. package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +44 -10
  64. package/project/.sdk/src/cmp/lua/utility_lua.ts +2 -1
  65. package/project/.sdk/src/cmp/ocaml/TestClean_ocaml.ts +20 -5
  66. package/project/.sdk/src/cmp/ocaml/fragment/RunOp.fragment.ml +36 -21
  67. package/project/.sdk/src/cmp/perl/TestClean_perl.ts +13 -4
  68. package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +21 -0
  69. package/project/.sdk/src/cmp/perl/fragment/Main.fragment.pm +31 -12
  70. package/project/.sdk/src/cmp/php/TestClean_php.ts +10 -3
  71. package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +33 -4
  72. package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +13 -6
  73. package/project/.sdk/src/cmp/py/TestClean_py.ts +10 -3
  74. package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +25 -2
  75. package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +26 -12
  76. package/project/.sdk/src/cmp/rb/TestClean_rb.ts +11 -4
  77. package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +23 -2
  78. package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +27 -11
  79. package/project/.sdk/src/cmp/rust/TestClean_rust.ts +24 -17
  80. package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +22 -2
  81. package/project/.sdk/src/cmp/scala/TestClean_scala.ts +45 -11
  82. package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +14 -0
  83. package/project/.sdk/src/cmp/swift/TestClean_swift.ts +31 -21
  84. package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +9 -0
  85. package/project/.sdk/src/cmp/swift/fragment/Main.fragment.swift +24 -10
  86. package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +13 -8
  87. package/project/.sdk/src/cmp/ts/TestClean_ts.ts +13 -5
  88. package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +26 -2
  89. package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +8 -0
  90. package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +8 -0
  91. package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +8 -0
  92. package/project/.sdk/src/cmp/ts/fragment/EntityPatchOp.fragment.ts +8 -0
  93. package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +8 -0
  94. package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +8 -0
  95. package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +12 -5
  96. package/project/.sdk/src/cmp/zig/TestClean_zig.ts +23 -11
  97. package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +17 -10
  98. package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +41 -6
  99. package/project/.sdk/tm/c/core/context.c +1 -0
  100. package/project/.sdk/tm/c/core/sdk.h +7 -4
  101. package/project/.sdk/tm/c/feature/cache.c +243 -13
  102. package/project/.sdk/tm/c/feature/metrics.c +7 -0
  103. package/project/.sdk/tm/c/feature/paging.c +231 -2
  104. package/project/.sdk/tm/c/feature/ratelimit.c +5 -9
  105. package/project/.sdk/tm/c/feature/retry.c +51 -4
  106. package/project/.sdk/tm/c/feature/secrets.c +27 -38
  107. package/project/.sdk/tm/c/feature/streaming.c +2 -1
  108. package/project/.sdk/tm/c/feature/telemetry.c +19 -18
  109. package/project/.sdk/tm/c/feature/test.c +78 -54
  110. package/project/.sdk/tm/c/tests/feature_test.c +288 -0
  111. package/project/.sdk/tm/c/tests/primary_utility_test.c +2 -0
  112. package/project/.sdk/tm/c/utility/clean.c +26 -33
  113. package/project/.sdk/tm/c/utility/make_options.c +89 -17
  114. package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +14 -11
  115. package/project/.sdk/tm/clojure/src/sdk/client.clj +3 -1
  116. package/project/.sdk/tm/clojure/src/sdk/core.clj +50 -22
  117. package/project/.sdk/tm/clojure/src/sdk/features.clj +279 -80
  118. package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +103 -1
  119. package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +1 -0
  120. package/project/.sdk/tm/cpp/Makefile +5 -0
  121. package/project/.sdk/tm/cpp/core/types.hpp +148 -72
  122. package/project/.sdk/tm/cpp/feature/audit.hpp +12 -8
  123. package/project/.sdk/tm/cpp/feature/cache.hpp +188 -9
  124. package/project/.sdk/tm/cpp/feature/metrics.hpp +19 -0
  125. package/project/.sdk/tm/cpp/feature/paging.hpp +160 -2
  126. package/project/.sdk/tm/cpp/feature/ratelimit.hpp +18 -14
  127. package/project/.sdk/tm/cpp/feature/retry.hpp +46 -5
  128. package/project/.sdk/tm/cpp/feature/secrets.hpp +12 -0
  129. package/project/.sdk/tm/cpp/feature/streaming.hpp +2 -1
  130. package/project/.sdk/tm/cpp/feature/telemetry.hpp +17 -10
  131. package/project/.sdk/tm/cpp/feature/test.hpp +63 -53
  132. package/project/.sdk/tm/cpp/test/feature_test.cpp +236 -0
  133. package/project/.sdk/tm/cpp/utility/pipeline.hpp +44 -12
  134. package/project/.sdk/tm/csharp/core/Context.cs +4 -0
  135. package/project/.sdk/tm/csharp/feature/AuditFeature.cs +8 -1
  136. package/project/.sdk/tm/csharp/feature/CacheFeature.cs +126 -12
  137. package/project/.sdk/tm/csharp/feature/MetricsFeature.cs +23 -0
  138. package/project/.sdk/tm/csharp/feature/PagingFeature.cs +130 -3
  139. package/project/.sdk/tm/csharp/feature/RatelimitFeature.cs +26 -19
  140. package/project/.sdk/tm/csharp/feature/RetryFeature.cs +41 -7
  141. package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +9 -27
  142. package/project/.sdk/tm/csharp/feature/StreamingFeature.cs +2 -1
  143. package/project/.sdk/tm/csharp/feature/TelemetryFeature.cs +11 -9
  144. package/project/.sdk/tm/csharp/feature/TestFeature.cs +55 -67
  145. package/project/.sdk/tm/csharp/test/FeatureTest.cs +238 -0
  146. package/project/.sdk/tm/csharp/utility/Clean.cs +5 -10
  147. package/project/.sdk/tm/csharp/utility/Fetcher.cs +7 -1
  148. package/project/.sdk/tm/csharp/utility/MakeOptions.cs +94 -24
  149. package/project/.sdk/tm/elixir/lib/projectname/context.ex +2 -0
  150. package/project/.sdk/tm/elixir/lib/projectname/feature/cache.ex +146 -30
  151. package/project/.sdk/tm/elixir/lib/projectname/feature/metrics.ex +13 -0
  152. package/project/.sdk/tm/elixir/lib/projectname/feature/paging.ex +110 -5
  153. package/project/.sdk/tm/elixir/lib/projectname/feature/ratelimit.ex +6 -12
  154. package/project/.sdk/tm/elixir/lib/projectname/feature/retry.ex +33 -9
  155. package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +10 -56
  156. package/project/.sdk/tm/elixir/lib/projectname/feature/streaming.ex +2 -1
  157. package/project/.sdk/tm/elixir/lib/projectname/feature/telemetry.ex +7 -7
  158. package/project/.sdk/tm/elixir/lib/projectname/feature/test.ex +52 -48
  159. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +77 -47
  160. package/project/.sdk/tm/elixir/test/feature_test.exs +198 -0
  161. package/project/.sdk/tm/go/core/context.go +6 -0
  162. package/project/.sdk/tm/go/feature/audit_feature.go +1 -3
  163. package/project/.sdk/tm/go/feature/base_feature.go +11 -0
  164. package/project/.sdk/tm/go/feature/cache_feature.go +131 -4
  165. package/project/.sdk/tm/go/feature/metrics_feature.go +14 -0
  166. package/project/.sdk/tm/go/feature/paging_feature.go +108 -2
  167. package/project/.sdk/tm/go/feature/ratelimit_feature.go +19 -17
  168. package/project/.sdk/tm/go/feature/retry_feature.go +81 -9
  169. package/project/.sdk/tm/go/feature/secrets_feature.go +17 -71
  170. package/project/.sdk/tm/go/feature/streaming_feature.go +2 -1
  171. package/project/.sdk/tm/go/feature/telemetry_feature.go +18 -11
  172. package/project/.sdk/tm/go/feature/test_feature.go +65 -55
  173. package/project/.sdk/tm/go/test/feature_corpus_test.go +357 -28
  174. package/project/.sdk/tm/go/test/feature_test.go +93 -0
  175. package/project/.sdk/tm/go/utility/clean.go +5 -7
  176. package/project/.sdk/tm/go/utility/fetcher.go +11 -0
  177. package/project/.sdk/tm/go/utility/make_options.go +116 -13
  178. package/project/.sdk/tm/java/core/Context.java +9 -0
  179. package/project/.sdk/tm/java/core/SdkClient.java +43 -14
  180. package/project/.sdk/tm/java/feature/AuditFeature.java +5 -1
  181. package/project/.sdk/tm/java/feature/CacheFeature.java +123 -17
  182. package/project/.sdk/tm/java/feature/MetricsFeature.java +31 -0
  183. package/project/.sdk/tm/java/feature/PagingFeature.java +156 -2
  184. package/project/.sdk/tm/java/feature/RatelimitFeature.java +15 -13
  185. package/project/.sdk/tm/java/feature/RetryFeature.java +33 -6
  186. package/project/.sdk/tm/java/feature/SecretsFeature.java +9 -92
  187. package/project/.sdk/tm/java/feature/StreamingFeature.java +2 -1
  188. package/project/.sdk/tm/java/feature/TelemetryFeature.java +17 -9
  189. package/project/.sdk/tm/java/feature/TestFeature.java +50 -63
  190. package/project/.sdk/tm/java/test/FeatureCorpusTest.java +309 -17
  191. package/project/.sdk/tm/java/test/FeatureTest.java +60 -0
  192. package/project/.sdk/tm/java/utility/Clean.java +6 -10
  193. package/project/.sdk/tm/java/utility/Fetcher.java +5 -1
  194. package/project/.sdk/tm/java/utility/MakeOptions.java +131 -15
  195. package/project/.sdk/tm/js/src/Context.js +4 -0
  196. package/project/.sdk/tm/js/src/feature/cache/CacheFeature.js +118 -11
  197. package/project/.sdk/tm/js/src/feature/cost/CostFeature.js +3 -2
  198. package/project/.sdk/tm/js/src/feature/metrics/MetricsFeature.js +9 -4
  199. package/project/.sdk/tm/js/src/feature/paging/PagingFeature.js +103 -5
  200. package/project/.sdk/tm/js/src/feature/ratelimit/RatelimitFeature.js +5 -9
  201. package/project/.sdk/tm/js/src/feature/rbac/RbacFeature.js +4 -4
  202. package/project/.sdk/tm/js/src/feature/retry/RetryFeature.js +25 -3
  203. package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +16 -6
  204. package/project/.sdk/tm/js/src/feature/streaming/StreamingFeature.js +2 -1
  205. package/project/.sdk/tm/js/src/feature/telemetry/TelemetryFeature.js +11 -6
  206. package/project/.sdk/tm/js/src/feature/test/TestFeature.js +38 -1
  207. package/project/.sdk/tm/js/src/feature/validate/ValidateFeature.js +2 -1
  208. package/project/.sdk/tm/js/src/utility/CleanUtility.js +1 -1
  209. package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +61 -12
  210. package/project/.sdk/tm/js/test/feature/Corpus.test.js +191 -23
  211. package/project/.sdk/tm/js/test/feature/harness.js +3 -3
  212. package/project/.sdk/tm/js/test/feature.test.js +14 -1
  213. package/project/.sdk/tm/js/test/pipeline.test.js +1 -1
  214. package/project/.sdk/tm/kotlin/core/Context.kt +3 -0
  215. package/project/.sdk/tm/kotlin/core/SdkClient.kt +23 -10
  216. package/project/.sdk/tm/kotlin/feature/AuditFeature.kt +5 -1
  217. package/project/.sdk/tm/kotlin/feature/CacheFeature.kt +102 -7
  218. package/project/.sdk/tm/kotlin/feature/MetricsFeature.kt +22 -0
  219. package/project/.sdk/tm/kotlin/feature/PagingFeature.kt +125 -2
  220. package/project/.sdk/tm/kotlin/feature/RatelimitFeature.kt +16 -13
  221. package/project/.sdk/tm/kotlin/feature/RetryFeature.kt +36 -14
  222. package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +10 -20
  223. package/project/.sdk/tm/kotlin/feature/StreamingFeature.kt +4 -0
  224. package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +12 -10
  225. package/project/.sdk/tm/kotlin/feature/TestFeature.kt +45 -48
  226. package/project/.sdk/tm/kotlin/test/FeatureTest.kt +173 -0
  227. package/project/.sdk/tm/kotlin/utility/CoreUtil.kt +5 -5
  228. package/project/.sdk/tm/kotlin/utility/Fetcher.kt +4 -0
  229. package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +86 -15
  230. package/project/.sdk/tm/lua/core/context.lua +6 -0
  231. package/project/.sdk/tm/lua/feature/cache_feature.lua +212 -15
  232. package/project/.sdk/tm/lua/feature/debug_feature.lua +2 -3
  233. package/project/.sdk/tm/lua/feature/metrics_feature.lua +5 -0
  234. package/project/.sdk/tm/lua/feature/paging_feature.lua +143 -2
  235. package/project/.sdk/tm/lua/feature/ratelimit_feature.lua +5 -9
  236. package/project/.sdk/tm/lua/feature/retry_feature.lua +43 -5
  237. package/project/.sdk/tm/lua/feature/secrets_feature.lua +15 -80
  238. package/project/.sdk/tm/lua/feature/streaming_feature.lua +2 -1
  239. package/project/.sdk/tm/lua/feature/telemetry_feature.lua +18 -7
  240. package/project/.sdk/tm/lua/feature/test_feature.lua +60 -62
  241. package/project/.sdk/tm/lua/test/feature_test.lua +181 -3
  242. package/project/.sdk/tm/lua/utility/clean.lua +6 -9
  243. package/project/.sdk/tm/lua/utility/fetcher.lua +9 -0
  244. package/project/.sdk/tm/lua/utility/make_options.lua +60 -18
  245. package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +21 -6
  246. package/project/.sdk/tm/ocaml/sdk_features.ml +392 -68
  247. package/project/.sdk/tm/ocaml/sdk_runtime.ml +47 -21
  248. package/project/.sdk/tm/ocaml/sdk_types.ml +2 -0
  249. package/project/.sdk/tm/ocaml/test/t_feature.ml +107 -2
  250. package/project/.sdk/tm/perl/core/context.pm +3 -0
  251. package/project/.sdk/tm/perl/feature/audit_feature.pm +4 -7
  252. package/project/.sdk/tm/perl/feature/cache_feature.pm +111 -15
  253. package/project/.sdk/tm/perl/feature/debug_feature.pm +2 -2
  254. package/project/.sdk/tm/perl/feature/metrics_feature.pm +5 -0
  255. package/project/.sdk/tm/perl/feature/paging_feature.pm +139 -2
  256. package/project/.sdk/tm/perl/feature/ratelimit_feature.pm +5 -11
  257. package/project/.sdk/tm/perl/feature/retry_feature.pm +22 -4
  258. package/project/.sdk/tm/perl/feature/secrets_feature.pm +13 -18
  259. package/project/.sdk/tm/perl/feature/streaming_feature.pm +2 -0
  260. package/project/.sdk/tm/perl/feature/telemetry_feature.pm +17 -8
  261. package/project/.sdk/tm/perl/feature/test_feature.pm +45 -50
  262. package/project/.sdk/tm/perl/t/feature.t +68 -2
  263. package/project/.sdk/tm/perl/t/feature_corpus.t +204 -25
  264. package/project/.sdk/tm/perl/utility/clean.pm +6 -8
  265. package/project/.sdk/tm/perl/utility/fetcher.pm +4 -0
  266. package/project/.sdk/tm/perl/utility/make_options.pm +38 -15
  267. package/project/.sdk/tm/php/core/Context.php +4 -0
  268. package/project/.sdk/tm/php/feature/CacheFeature.php +98 -13
  269. package/project/.sdk/tm/php/feature/MetricsFeature.php +8 -0
  270. package/project/.sdk/tm/php/feature/PagingFeature.php +128 -1
  271. package/project/.sdk/tm/php/feature/RatelimitFeature.php +5 -9
  272. package/project/.sdk/tm/php/feature/RetryFeature.php +27 -3
  273. package/project/.sdk/tm/php/feature/SecretsFeature.php +18 -15
  274. package/project/.sdk/tm/php/feature/StreamingFeature.php +2 -1
  275. package/project/.sdk/tm/php/feature/TelemetryFeature.php +10 -7
  276. package/project/.sdk/tm/php/feature/TestFeature.php +55 -47
  277. package/project/.sdk/tm/php/test/FeatureCorpusTest.php +262 -17
  278. package/project/.sdk/tm/php/test/FeatureTest.php +68 -0
  279. package/project/.sdk/tm/php/utility/Clean.php +3 -10
  280. package/project/.sdk/tm/php/utility/Fetcher.php +8 -3
  281. package/project/.sdk/tm/php/utility/MakeOptions.php +45 -20
  282. package/project/.sdk/tm/py/pkg/core/context.py +4 -0
  283. package/project/.sdk/tm/py/pkg/feature/cache_feature.py +79 -13
  284. package/project/.sdk/tm/py/pkg/feature/metrics_feature.py +7 -0
  285. package/project/.sdk/tm/py/pkg/feature/paging_feature.py +86 -1
  286. package/project/.sdk/tm/py/pkg/feature/ratelimit_feature.py +13 -16
  287. package/project/.sdk/tm/py/pkg/feature/retry_feature.py +31 -6
  288. package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +15 -66
  289. package/project/.sdk/tm/py/pkg/feature/streaming_feature.py +2 -1
  290. package/project/.sdk/tm/py/pkg/feature/telemetry_feature.py +10 -6
  291. package/project/.sdk/tm/py/pkg/feature/test_feature.py +56 -53
  292. package/project/.sdk/tm/py/pkg/utility/clean.py +4 -10
  293. package/project/.sdk/tm/py/pkg/utility/make_options.py +77 -30
  294. package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +23 -9
  295. package/project/.sdk/tm/py/test/test_feature.py +61 -1
  296. package/project/.sdk/tm/py/test/test_feature_corpus.py +197 -17
  297. package/project/.sdk/tm/py-data/pkg/fetch.py +6 -3
  298. package/project/.sdk/tm/py-data/test/test_fetch.py +7 -4
  299. package/project/.sdk/tm/rb/core/context.rb +4 -1
  300. package/project/.sdk/tm/rb/feature/audit_feature.rb +6 -5
  301. package/project/.sdk/tm/rb/feature/cache_feature.rb +75 -11
  302. package/project/.sdk/tm/rb/feature/debug_feature.rb +2 -2
  303. package/project/.sdk/tm/rb/feature/metrics_feature.rb +8 -0
  304. package/project/.sdk/tm/rb/feature/paging_feature.rb +87 -1
  305. package/project/.sdk/tm/rb/feature/ratelimit_feature.rb +12 -16
  306. package/project/.sdk/tm/rb/feature/retry_feature.rb +19 -3
  307. package/project/.sdk/tm/rb/feature/secrets_feature.rb +9 -64
  308. package/project/.sdk/tm/rb/feature/streaming_feature.rb +2 -1
  309. package/project/.sdk/tm/rb/feature/telemetry_feature.rb +11 -6
  310. package/project/.sdk/tm/rb/feature/test_feature.rb +42 -49
  311. package/project/.sdk/tm/rb/test/feature_corpus_test.rb +191 -25
  312. package/project/.sdk/tm/rb/test/feature_test.rb +75 -1
  313. package/project/.sdk/tm/rb/utility/clean.rb +6 -7
  314. package/project/.sdk/tm/rb/utility/fetcher.rb +6 -0
  315. package/project/.sdk/tm/rb/utility/make_options.rb +37 -16
  316. package/project/.sdk/tm/rust/core/context.rs +8 -0
  317. package/project/.sdk/tm/rust/feature/audit.rs +2 -2
  318. package/project/.sdk/tm/rust/feature/cache.rs +120 -3
  319. package/project/.sdk/tm/rust/feature/metrics.rs +24 -1
  320. package/project/.sdk/tm/rust/feature/paging.rs +189 -3
  321. package/project/.sdk/tm/rust/feature/ratelimit.rs +5 -10
  322. package/project/.sdk/tm/rust/feature/retry.rs +59 -6
  323. package/project/.sdk/tm/rust/feature/secrets.rs +36 -98
  324. package/project/.sdk/tm/rust/feature/streaming.rs +3 -2
  325. package/project/.sdk/tm/rust/feature/support.rs +4 -0
  326. package/project/.sdk/tm/rust/feature/telemetry.rs +22 -11
  327. package/project/.sdk/tm/rust/feature/test.rs +63 -57
  328. package/project/.sdk/tm/rust/tests/feature/secrets/main.rs +3 -3
  329. package/project/.sdk/tm/rust/tests/feature_test.rs +274 -0
  330. package/project/.sdk/tm/rust/tests/primary_utility_test.rs +1 -0
  331. package/project/.sdk/tm/rust/utility/clean.rs +35 -43
  332. package/project/.sdk/tm/rust/utility/fetcher.rs +6 -0
  333. package/project/.sdk/tm/rust/utility/make_options.rs +130 -38
  334. package/project/.sdk/tm/scala/core/Context.scala +4 -0
  335. package/project/.sdk/tm/scala/core/SdkClient.scala +45 -11
  336. package/project/.sdk/tm/scala/feature/AuditFeature.scala +6 -1
  337. package/project/.sdk/tm/scala/feature/CacheFeature.scala +117 -11
  338. package/project/.sdk/tm/scala/feature/MetricsFeature.scala +31 -1
  339. package/project/.sdk/tm/scala/feature/PagingFeature.scala +122 -2
  340. package/project/.sdk/tm/scala/feature/RatelimitFeature.scala +14 -11
  341. package/project/.sdk/tm/scala/feature/RetryFeature.scala +29 -7
  342. package/project/.sdk/tm/scala/feature/SecretsFeature.scala +11 -24
  343. package/project/.sdk/tm/scala/feature/StreamingFeature.scala +2 -1
  344. package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +12 -10
  345. package/project/.sdk/tm/scala/feature/TestFeature.scala +44 -44
  346. package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +69 -0
  347. package/project/.sdk/tm/scala/utility/Fetcher.scala +5 -0
  348. package/project/.sdk/tm/scala/utility/Make.scala +99 -14
  349. package/project/.sdk/tm/scala/utility/Misc.scala +5 -8
  350. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +3 -0
  351. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +3 -2
  352. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/CacheFeature.swift +122 -11
  353. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/MetricsFeature.swift +20 -0
  354. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/PagingFeature.swift +102 -2
  355. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RatelimitFeature.swift +19 -13
  356. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RetryFeature.swift +40 -5
  357. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/SecretsFeature.swift +9 -13
  358. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/StreamingFeature.swift +2 -1
  359. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +11 -9
  360. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TestFeature.swift +55 -49
  361. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Fetcher.swift +4 -0
  362. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +56 -17
  363. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +4 -5
  364. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +166 -0
  365. package/project/.sdk/tm/ts/src/Context.ts +4 -0
  366. package/project/.sdk/tm/ts/src/feature/cache/CacheFeature.ts +115 -4
  367. package/project/.sdk/tm/ts/src/feature/cost/CostFeature.ts +3 -2
  368. package/project/.sdk/tm/ts/src/feature/metrics/MetricsFeature.ts +6 -1
  369. package/project/.sdk/tm/ts/src/feature/paging/PagingFeature.ts +103 -5
  370. package/project/.sdk/tm/ts/src/feature/ratelimit/RatelimitFeature.ts +5 -9
  371. package/project/.sdk/tm/ts/src/feature/rbac/RbacFeature.ts +4 -4
  372. package/project/.sdk/tm/ts/src/feature/retry/RetryFeature.ts +25 -3
  373. package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +14 -2
  374. package/project/.sdk/tm/ts/src/feature/streaming/StreamingFeature.ts +2 -1
  375. package/project/.sdk/tm/ts/src/feature/telemetry/TelemetryFeature.ts +11 -6
  376. package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +8 -7
  377. package/project/.sdk/tm/ts/src/feature/validate/ValidateFeature.ts +2 -1
  378. package/project/.sdk/tm/ts/src/utility/CleanUtility.ts +1 -1
  379. package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +63 -12
  380. package/project/.sdk/tm/ts/test/feature/Corpus.test.ts +192 -23
  381. package/project/.sdk/tm/ts/test/feature/harness.ts +3 -3
  382. package/project/.sdk/tm/ts/test/feature.test.ts +14 -1
  383. package/project/.sdk/tm/ts/test/pipeline.test.ts +1 -1
  384. package/project/.sdk/tm/zig/core/context.zig +5 -0
  385. package/project/.sdk/tm/zig/core/utility.zig +118 -17
  386. package/project/.sdk/tm/zig/feature/cache.zig +144 -13
  387. package/project/.sdk/tm/zig/feature/metrics.zig +19 -0
  388. package/project/.sdk/tm/zig/feature/paging.zig +172 -4
  389. package/project/.sdk/tm/zig/feature/ratelimit.zig +5 -11
  390. package/project/.sdk/tm/zig/feature/retry.zig +41 -3
  391. package/project/.sdk/tm/zig/feature/secrets.zig +6 -1
  392. package/project/.sdk/tm/zig/feature/streaming.zig +2 -0
  393. package/project/.sdk/tm/zig/feature/telemetry.zig +15 -9
  394. package/project/.sdk/tm/zig/feature/test.zig +56 -40
  395. package/project/.sdk/tm/zig/test/feature_test.zig +174 -0
  396. package/project/.sdk/tm/zig/test/primary_utility_test.zig +2 -0
  397. package/project/sdkgen-package.json +1 -1
  398. package/src/cmp/ReadmeExplanation.ts +5 -2
  399. package/src/cmp/ReadmeFeatures.ts +21 -6
  400. package/src/helpers/optspec.ts +2 -2
@@ -91,7 +91,19 @@
91
91
  (when-not (= false (core/oget (core/oget ctx :ctrl) :throw))
92
92
  (throw cleaned)))))
93
93
 
94
+ (defn- late-done
95
+ "PreDone on an exit that left before it. What the hook throws leaves
96
+ cleaned, in place of the error already on its way out."
97
+ [ctx]
98
+ (try
99
+ (core/feature-hook ctx "PreDone")
100
+ (catch Throwable hookerr
101
+ (let [cleaned (core/clean-throwable ctx hookerr)]
102
+ (when-not (= false (core/oget (core/oget ctx :ctrl) :throw))
103
+ (throw cleaned))))))
104
+
94
105
  (defn- run-op [ctx post-done]
106
+ (let [predone (volatile! false)]
95
107
  (try
96
108
  ; #PrePoint-Hook
97
109
  (let [[point err] ((core/uget ctx :make-point) ctx)]
@@ -123,11 +135,16 @@
123
135
  (if err
124
136
  ((core/uget ctx :make-error) ctx err)
125
137
  (do
138
+ (vreset! predone true)
126
139
  ; #PreDone-Hook
127
140
  (post-done)
128
141
  ((core/uget ctx :done) ctx))))))))))))))))
129
142
  (catch Throwable operr
130
- (unexpected ctx operr))))
143
+ (unexpected ctx operr))
144
+ ;; A refusal, a failed step or a throw left before PreDone.
145
+ (finally
146
+ (when-not @predone
147
+ (late-done ctx))))))
131
148
 
132
149
  ;; Streaming operation. Runs `action` (an op name, e.g. "list") through the
133
150
  ;; full pipeline and returns a LAZY SEQUENCE of result items, so incremental
@@ -738,6 +738,19 @@ static void no_credential_leaves_the_sdk() {
738
738
  ASSERT_TRUE(is_false(getp(direct, "ok")), "a transport failure should fail direct()");
739
739
  addForms(sinks, "direct", direct);
740
740
 
741
+ // The clean registry holds every credential in plain form, and is no option.
742
+ {
743
+ Value held = construct(vmap({{"apikey", Value(CANARY_APIKEY)}}))->optionsMap();
744
+ std::string heldjson = vs::jsonify(held, 0);
745
+ ASSERT_TRUE(getp(held, "apikey").is_string() && CANARY_APIKEY == getp(held, "apikey").as_string(),
746
+ "optionsMap keeps the caller's apikey");
747
+ std::string heldrest = heldjson;
748
+ size_t at = heldrest.find(CANARY_APIKEY);
749
+ if (std::string::npos != at) heldrest.erase(at, CANARY_APIKEY.size());
750
+ ASSERT_TRUE(leaks(heldrest).empty(),
751
+ "optionsMap carries a credential beyond the option the caller set: " + heldjson);
752
+ }
753
+
741
754
  std::string leaked;
742
755
  int leakcount = 0;
743
756
  for (const Sink& s : sinks) {
@@ -881,7 +894,8 @@ static void a_feature_name_is_read_as_a_name() {
881
894
  {"apikey", Value(CANARY_APIKEY)},
882
895
  {"feature", vmap({
883
896
  {"secrets", vmap({
884
- {"active", Value(false)}, {"name", Value("ZZNAME-feat123")}, {"token", Value("ZZTOKEN-feat456")},
897
+ {"active", Value(false)}, {"name", Value("ZZNAME-feat123")},
898
+ {"providers", vlist({vmap({{"name", Value("static")}, {"token", Value("ZZTOKEN-feat456")}})})},
885
899
  })},
886
900
  {"rbac", vmap({
887
901
  {"active", Value(false)}, {"rules", vmap({{"zztoken.load", Value("PLAINRULE-k7j5h3g1")}})},
@@ -876,6 +876,15 @@ ${candidateLines}
876
876
  new ${Name}Error("code_" + CanaryValue, "coded", null));
877
877
  sinks.AddRange(FormsOf("coded", coded));
878
878
 
879
+ // The clean registry holds every credential in plain form, and is no option.
880
+ var held = Construct(new Dictionary<string, object?> { ["apikey"] = CanaryApikey }).OptionsMap();
881
+ var heldtext = Render(held);
882
+ Assert.Equal(CanaryApikey, held.GetValueOrDefault("apikey"));
883
+ var heldat = heldtext.IndexOf(CanaryApikey, StringComparison.Ordinal);
884
+ var heldrest = heldat < 0 ? heldtext : heldtext.Remove(heldat, CanaryApikey.Length);
885
+ Assert.True(0 == Leaks(heldrest).Count,
886
+ "OptionsMap carries a credential beyond the option the caller set: " + heldtext);
887
+
879
888
  var leaked = sinks
880
889
  .Select(s => (s.Name, Found: Leaks(s.Text)))
881
890
  .Where(s => 0 < s.Found.Count)
@@ -124,14 +124,41 @@ public abstract class ProjectNameEntityBase : IEntity
124
124
 
125
125
  protected object? RunOp(Context ctx, Action postDone)
126
126
  {
127
+ var predone = false;
127
128
  try
128
129
  {
129
- return RunPipeline(ctx, postDone);
130
+ return RunPipeline(ctx, postDone, ref predone);
130
131
  }
131
132
  catch (Exception err) when (!ReferenceEquals(err, ctx.Ctrl.Err))
132
133
  {
133
134
  return Unexpected(ctx, err);
134
135
  }
136
+ finally
137
+ {
138
+ // A refusal, a failed step or a throw left before PreDone.
139
+ if (!predone)
140
+ {
141
+ LateDone(ctx);
142
+ }
143
+ }
144
+ }
145
+
146
+ // PreDone on an exit that left before it. What the hook throws leaves
147
+ // cleaned, in place of the error already on its way out.
148
+ private void LateDone(Context ctx)
149
+ {
150
+ try
151
+ {
152
+ utility.FeatureHook(ctx, "PreDone");
153
+ }
154
+ catch (Exception err) when (ctx.Ctrl.Throw != false)
155
+ {
156
+ var cause = Unwrapped(err);
157
+ throw utility.Clean(ctx, cause) as Exception ?? cause;
158
+ }
159
+ catch (Exception)
160
+ {
161
+ }
135
162
  }
136
163
 
137
164
  // The catch path. A hook's exception never passed through MakeError, and
@@ -154,7 +181,7 @@ public abstract class ProjectNameEntityBase : IEntity
154
181
  private static Exception Unwrapped(Exception err) =>
155
182
  err is TargetInvocationException { InnerException: { } inner } ? inner : err;
156
183
 
157
- private object? RunPipeline(Context ctx, Action postDone)
184
+ private object? RunPipeline(Context ctx, Action postDone, ref bool predone)
158
185
  {
159
186
  // #PrePoint-Hook
160
187
 
@@ -216,6 +243,7 @@ public abstract class ProjectNameEntityBase : IEntity
216
243
  return utility.MakeError(ctx, err);
217
244
  }
218
245
 
246
+ predone = true;
219
247
  // #PreDone-Hook
220
248
 
221
249
  postDone();
@@ -61,27 +61,46 @@ public class ProjectNameSDK
61
61
  var featureOrder = global::Voxgig.Struct.StructUtils.GetPath(_options,
62
62
  global::Voxgig.Struct.StructUtils.Jt("__derived__", "featureorder")) as List<object?>
63
63
  ?? new List<object?>();
64
+ bool Active(string fname)
65
+ {
66
+ var fopts = global::ProjectNameSdk.Helpers.ToMapAny(global::Voxgig.Struct.StructUtils.GetProp(featureOpts, fname));
67
+ return fopts != null && fopts.TryGetValue("active", out var active) && active is bool ab && ab;
68
+ }
69
+ var extend = (global::Voxgig.Struct.StructUtils.GetProp(_options, "extend") as List<object?>)
70
+ ?.OfType<BaseFeature>().ToList() ?? new List<BaseFeature>();
71
+ var placed = new List<BaseFeature>();
64
72
  foreach (var fnameObj in featureOrder)
65
73
  {
66
74
  var fname = fnameObj as string ?? "";
67
- var fopts = global::ProjectNameSdk.Helpers.ToMapAny(global::Voxgig.Struct.StructUtils.GetProp(featureOpts, fname));
68
- if (fopts != null &&
69
- fopts.TryGetValue("active", out var active) &&
70
- active is bool ab && ab)
75
+ if (!Active(fname))
71
76
  {
72
- _utility.FeatureAdd(_rootctx, global::ProjectNameSdk.SdkConfig.MakeFeature(fname));
77
+ continue;
73
78
  }
79
+ var gen = global::ProjectNameSdk.SdkConfig.MakeFeature(fname);
80
+ // An active name with no generated class is legal when an
81
+ // extend-supplied instance carries that name (station's adopt
82
+ // path): the instance takes the slot the order gives its name.
83
+ var carried = gen.GetName() == fname ? null : extend.FirstOrDefault(f => f.GetName() == fname);
84
+ if (carried != null)
85
+ {
86
+ placed.Add(carried);
87
+ _utility.FeatureAdd(_rootctx, carried);
88
+ continue;
89
+ }
90
+ _utility.FeatureAdd(_rootctx, gen);
74
91
  }
75
92
 
76
- // Add extension features.
77
- if (global::Voxgig.Struct.StructUtils.GetProp(_options, "extend") is List<object?> extList)
93
+ // An extend feature is active by its option, else by its own flag.
94
+ bool ExtActive(BaseFeature feat)
95
+ {
96
+ var fopts = global::ProjectNameSdk.Helpers.ToMapAny(global::Voxgig.Struct.StructUtils.GetProp(featureOpts, feat.GetName()));
97
+ return fopts != null && fopts.TryGetValue("active", out var fa) && fa is bool fab ? fab : feat.GetActive();
98
+ }
99
+ foreach (var feat in extend)
78
100
  {
79
- foreach (var f in extList)
101
+ if (!placed.Any(p => ReferenceEquals(p, feat)) && ExtActive(feat))
80
102
  {
81
- if (f is BaseFeature feat)
82
- {
83
- _utility.FeatureAdd(_rootctx, feat);
84
- }
103
+ _utility.FeatureAdd(_rootctx, feat);
85
104
  }
86
105
  }
87
106
 
@@ -613,6 +613,13 @@ ${candidates(Name, entity, model)}
613
613
  assert S.getprop(direct, "ok") == false, "a transport failure should fail direct()"
614
614
  add(sinks, forms("direct", S.getprop(direct, "err")))
615
615
 
616
+ # The clean registry holds every credential in plain form, and is no option.
617
+ held = ${Name}.options_map(construct(S.jm(["apikey", @canary.apikey])))
618
+ heldjson = S.jsonify(held)
619
+ assert S.getprop(held, "apikey") == @canary.apikey
620
+ assert leaks(String.replace(heldjson, @canary.apikey, "", global: false)) == [],
621
+ "options_map carries a credential beyond the option the caller set: " <> heldjson
622
+
616
623
  all = sink_list(sinks)
617
624
  leaked = Enum.filter(all, fn s -> leaks(s.text) != [] end)
618
625
 
@@ -683,7 +690,7 @@ ${candidates(Name, entity, model)}
683
690
 
684
691
  test "a registered value used as a property name is masked, collisions kept" do
685
692
  cfg = ${Name}.Utility.make_clean_config(S.jm(["keys", "key,secret,token"]))
686
- ctx = S.jm(["options", S.jm(["__derived__", S.jm(["clean", cfg])])])
693
+ ctx = S.jm(["cleancfg", cfg])
687
694
  ${Name}.Utility.clean_add_impl(ctx, "ZZVAL-abc123")
688
695
  ${Name}.Utility.clean_add_impl(ctx, "ZZVAL-xyz789")
689
696
  out = ${Name}.Utility.clean_impl(ctx, S.jm(["ZZVAL-abc123", 1, "ZZVAL-xyz789", 2, "plain", 3]))
@@ -706,7 +713,8 @@ ${candidates(Name, entity, model)}
706
713
  "apikey", @canary.apikey,
707
714
  "feature",
708
715
  S.jm([
709
- "secrets", S.jm(["active", false, "name", "ZZNAME-feat123", "token", "ZZTOKEN-feat456"]),
716
+ "secrets", S.jm(["active", false, "name", "ZZNAME-feat123",
717
+ "providers", [S.jm(["name", "static", "token", "ZZTOKEN-feat456"])]]),
710
718
  "rbac", S.jm(["active", false, "rules", S.jm(["zztoken.load", "PLAINRULE-k7j5h3g1"])]),
711
719
  "test", S.jm(["active", false, "entity", record])
712
720
  ]),
@@ -724,7 +732,8 @@ ${candidates(Name, entity, model)}
724
732
  test "the generated config's own clean block is honoured" do
725
733
  config = S.jm(["options", S.jm(["clean", S.jm(["keys", "zzsens", "values", "CONFIG-SEEDED-1"])])])
726
734
  ctx = S.jm(["config", config, "options", S.jm(["clean", S.jm(["values", "CALLER-SEEDED-2"])])])
727
- cctx = S.jm(["options", ${Name}.Utility.make_options_impl(ctx)])
735
+ S.setprop(ctx, "options", ${Name}.Utility.make_options_impl(ctx))
736
+ cctx = ctx
728
737
 
729
738
  assert ${Name}.Utility.clean_impl(cctx, "a CONFIG-SEEDED-1 b CALLER-SEEDED-2") ==
730
739
  "a " <> @mask <> " b " <> @mask
@@ -738,7 +747,7 @@ ${candidates(Name, entity, model)}
738
747
 
739
748
  test "clean_add_sensitive registers every scalar under a sensitive name, at any depth" do
740
749
  cfg = ${Name}.Utility.make_clean_config(S.jm(["keys", "key,secret,token"]))
741
- ctx = S.jm(["options", S.jm(["__derived__", S.jm(["clean", cfg])])])
750
+ ctx = S.jm(["cleancfg", cfg])
742
751
 
743
752
  ${Name}.Utility.clean_add_sensitive(ctx, S.jm([
744
753
  "apikey", S.jm(["value", "NESTED-SECRET-1"]),
@@ -50,26 +50,62 @@ defmodule ProjectName do
50
50
  feature_opts = H.or_(H.to_map(S.getprop(opts, "feature")), S.jm([]))
51
51
  feature_order = S.getpath(opts, "__derived__.featureorder")
52
52
 
53
- if S.islist(feature_order) and S.size(feature_order) > 0 do
54
- Enum.each(0..(S.size(feature_order) - 1), fn i ->
55
- fname = S.getelem(feature_order, i)
56
- fom = H.to_map(S.getprop(feature_opts, fname))
57
-
58
- if fom != nil and S.getprop(fom, "active") == true do
59
- Utility.feature_add(rootctx, ProjectName.Features.make_feature(fname))
60
- end
61
- end)
53
+ active = fn fname ->
54
+ fom = H.to_map(S.getprop(feature_opts, fname))
55
+ fom != nil and S.getprop(fom, "active") == true
62
56
  end
63
57
 
64
- extend = S.getprop(opts, "extend")
58
+ given = S.getprop(opts, "extend")
59
+
60
+ extend =
61
+ if S.islist(given) and S.size(given) > 0,
62
+ do: Enum.filter(Enum.map(0..(S.size(given) - 1), &S.getelem(given, &1)), &S.ismap/1),
63
+ else: []
64
+
65
+ placed =
66
+ if S.islist(feature_order) and S.size(feature_order) > 0 do
67
+ Enum.flat_map(0..(S.size(feature_order) - 1), fn i ->
68
+ fname = S.getelem(feature_order, i)
69
+
70
+ if active.(fname) do
71
+ gen = ProjectName.Features.make_feature(fname)
72
+
73
+ # An active name with no generated class is legal when an
74
+ # extend-supplied instance carries that name (station's adopt
75
+ # path): the instance takes the slot the order gives its name.
76
+ carried =
77
+ if S.getprop(gen, "name") != fname,
78
+ do: Enum.find(extend, fn fx -> S.getprop(fx, "name") == fname end)
79
+
80
+ if carried != nil do
81
+ Utility.feature_add(rootctx, carried)
82
+ [carried]
83
+ else
84
+ Utility.feature_add(rootctx, gen)
85
+ []
86
+ end
87
+ else
88
+ []
89
+ end
90
+ end)
91
+ else
92
+ []
93
+ end
65
94
 
66
- if S.islist(extend) and S.size(extend) > 0 do
67
- Enum.each(0..(S.size(extend) - 1), fn i ->
68
- fx = S.getelem(extend, i)
69
- if S.ismap(fx), do: Utility.feature_add(rootctx, fx)
70
- end)
95
+ # An extend feature is active by its option, else by its own flag.
96
+ ext_active = fn fx ->
97
+ fom = H.to_map(S.getprop(feature_opts, S.getprop(fx, "name")))
98
+ fa = if fom != nil, do: S.getprop(fom, "active")
99
+
100
+ if is_boolean(fa), do: fa, else: S.getprop(fx, "active") == true
71
101
  end
72
102
 
103
+ Enum.each(extend, fn fx ->
104
+ unless Enum.any?(placed, &(&1 === fx)) or not ext_active.(fx) do
105
+ Utility.feature_add(rootctx, fx)
106
+ end
107
+ end)
108
+
73
109
  Enum.each(S.getprop(client, "features"), fn fe -> Utility.feature_init(rootctx, fe) end)
74
110
  Utility.feature_hook(rootctx, "PostConstruct")
75
111
 
@@ -45,6 +45,7 @@ defmodule ProjectName.Pipeline do
45
45
  S.setprop(out, "result", result)
46
46
  if err != nil, do: throw({:sdk_ret, Utility.make_error(ctx, err)})
47
47
 
48
+ S.setprop(ctx, "done_fired", true)
48
49
  # #PreDone-Hook
49
50
 
50
51
  post_done.()
@@ -54,9 +55,25 @@ defmodule ProjectName.Pipeline do
54
55
  e -> unexpected(ctx, e, __STACKTRACE__)
55
56
  catch
56
57
  {:sdk_ret, v} -> v
58
+ after
59
+ # A refusal, a failed step or a raise left before PreDone.
60
+ if S.getprop(ctx, "done_fired") != true do
61
+ late_done(ctx)
62
+ end
57
63
  end
58
64
  end
59
65
 
66
+ # PreDone on an exit that left before it. What the hook raises leaves
67
+ # cleaned, in place of the error already on its way out.
68
+ defp late_done(ctx) do
69
+ Utility.feature_hook(ctx, "PreDone")
70
+ rescue
71
+ e ->
72
+ if S.getprop(S.getprop(ctx, "ctrl"), "throw_err") != false do
73
+ reraise(Utility.clean_exception(ctx, e), __STACKTRACE__)
74
+ end
75
+ end
76
+
60
77
  # The catch path every entity call leaves through: an error a hook raised
61
78
  # never passed through make_error. Nil when the caller switched throwing off.
62
79
  def unexpected(ctx, e, st) do
@@ -190,6 +190,33 @@ func cleanContentLeaks(text string, forms [][2]string) []string {
190
190
 
191
191
  // The default prints and the JSON form of a value: what a log line, a panic
192
192
  // message or a structured logger would carry.
193
+ // Every string a value holds, unexported fields included, as a debugger shows them.
194
+ func cleanDump(v reflect.Value, depth int) string {
195
+ if !v.IsValid() || 12 < depth {
196
+ return ""
197
+ }
198
+ parts := []string{}
199
+ switch v.Kind() {
200
+ case reflect.String:
201
+ return v.String()
202
+ case reflect.Ptr, reflect.Interface:
203
+ return cleanDump(v.Elem(), depth+1)
204
+ case reflect.Map:
205
+ for _, k := range v.MapKeys() {
206
+ parts = append(parts, cleanDump(k, depth+1)+"="+cleanDump(v.MapIndex(k), depth+1))
207
+ }
208
+ case reflect.Slice, reflect.Array:
209
+ for i := 0; i < v.Len(); i++ {
210
+ parts = append(parts, cleanDump(v.Index(i), depth+1))
211
+ }
212
+ case reflect.Struct:
213
+ for i := 0; i < v.NumField(); i++ {
214
+ parts = append(parts, cleanDump(v.Field(i), depth+1))
215
+ }
216
+ }
217
+ return "{" + strings.Join(parts, " ") + "}"
218
+ }
219
+
193
220
  func cleanSurfaces(name string, val any) []cleanSink {
194
221
  out := []cleanSink{}
195
222
  if raw, err := json.Marshal(val); err == nil {
@@ -872,15 +899,16 @@ func TestCleanSweep(t *testing.T) {
872
899
  // and is not changed by it.
873
900
  cfgclean := map[string]any{"keys": "zzsens", "values": cleanCanary["config"]}
874
901
  util := probe.GetUtility()
875
- cfgopts, err := util.MakeOptions(&core.Context{
902
+ cfgctx := &core.Context{
876
903
  Utility: util,
877
904
  Config: map[string]any{"options": map[string]any{"clean": cfgclean}},
878
905
  Options: map[string]any{"clean": map[string]any{"values": cleanCanary["value"]}},
879
- })
906
+ }
907
+ cfgopts, err := util.MakeOptions(cfgctx)
880
908
  if err != nil {
881
909
  t.Fatal(err)
882
910
  }
883
- cfgctx := &core.Context{Options: cfgopts}
911
+ cfgctx.Options = cfgopts
884
912
  seeded, _ := util.Clean(cfgctx, "config "+cleanCanary["config"]+" caller "+cleanCanary["value"]).(string)
885
913
  sinks = append(sinks, cleanSink{"config-clean", seeded})
886
914
  if want := "config " + cleanMask + " caller " + cleanMask; seeded != want {
@@ -941,6 +969,14 @@ func TestCleanSweep(t *testing.T) {
941
969
  t.Errorf("an rbac rule keyed by entity and operation was registered: %q", got)
942
970
  }
943
971
 
972
+ // The clean registry holds every credential in plain form, and is no option.
973
+ held := cleanNew(map[string]any{"apikey": cleanCanary["apikey"]}).OptionsMap()
974
+ helddump := cleanDump(reflect.ValueOf(held), 0)
975
+ if held["apikey"] != cleanCanary["apikey"] ||
976
+ 0 < len(cleanLeaks(strings.Replace(helddump, cleanCanary["apikey"], "", 1))) {
977
+ t.Errorf("OptionsMap() carries a credential beyond the option the caller set: %s", helddump)
978
+ }
979
+
944
980
  leaked := []string{}
945
981
  for _, s := range sinks {
946
982
  if found := cleanLeaks(s.text); 0 < len(found) {
@@ -210,12 +210,19 @@ func (e *EntyClass) Stream(action string, args map[string]any, callopts map[stri
210
210
  go func() {
211
211
  defer close(out)
212
212
 
213
+ predone := false
214
+
213
215
  // A panicking hook or stream function leaves through MakeError, as
214
216
  // runOp's does. A goroutine the stream function starts is out of reach.
215
217
  defer func() {
216
218
  if r := recover(); r != nil {
217
219
  sendData(e.recovered(ctx, r))
218
220
  }
221
+ if !predone {
222
+ if herr := e.lateDone(ctx); herr != nil {
223
+ send(core.StreamItem{Err: herr})
224
+ }
225
+ }
219
226
  }()
220
227
 
221
228
  // A failed step leaves through MakeError, as an operation's does.
@@ -224,6 +231,9 @@ func (e *EntyClass) Stream(action string, args map[string]any, callopts map[stri
224
231
  return
225
232
  }
226
233
 
234
+ predone = true
235
+ utility.FeatureHook(ctx, "PreDone")
236
+
227
237
  // Inbound: prefer the streaming feature's incremental iterator; else
228
238
  // fall back to the materialised items so Stream always yields.
229
239
  if ctx.Result != nil && ctx.Result.Stream != nil {
@@ -243,7 +253,7 @@ func (e *EntyClass) Stream(action string, args map[string]any, callopts map[stri
243
253
  return out
244
254
  }
245
255
 
246
- // The steps an operation runs, with their hooks; the first that fails hands
256
+ // The steps before PreDone, with their hooks; the first that fails hands
247
257
  // back its error.
248
258
  func (e *EntyClass) streamSteps(ctx *core.Context) error {
249
259
  utility := e.utility
@@ -283,7 +293,6 @@ func (e *EntyClass) streamSteps(ctx *core.Context) error {
283
293
  return err
284
294
  }
285
295
 
286
- utility.FeatureHook(ctx, "PreDone")
287
296
  return nil
288
297
  }
289
298
 
@@ -302,10 +311,18 @@ func (e *EntyClass) streamSteps(ctx *core.Context) error {
302
311
  func (e *EntyClass) runOp(ctx *core.Context, postDone func()) (out any, err error) {
303
312
  utility := e.utility
304
313
 
314
+ predone := false
315
+
305
316
  defer func() {
306
317
  if r := recover(); r != nil {
307
318
  out, err = e.recovered(ctx, r)
308
319
  }
320
+ // A refusal, a failed step or a panic left before PreDone.
321
+ if !predone {
322
+ if herr := e.lateDone(ctx); herr != nil {
323
+ out, err = nil, herr
324
+ }
325
+ }
309
326
  }()
310
327
 
311
328
  // #PrePoint-Hook
@@ -348,6 +365,7 @@ func (e *EntyClass) runOp(ctx *core.Context, postDone func()) (out any, err erro
348
365
  return utility.MakeError(ctx, err)
349
366
  }
350
367
 
368
+ predone = true
351
369
  // #PreDone-Hook
352
370
 
353
371
  postDone()
@@ -372,6 +390,28 @@ func (e *EntyClass) runOp(ctx *core.Context, postDone func()) (out any, err erro
372
390
  return out, nil
373
391
  }
374
392
 
393
+ // PreDone on an exit that left before it. What the hook panics with leaves
394
+ // cleaned, in place of the error already on its way out; nil under
395
+ // `throw: false`.
396
+ func (e *EntyClass) lateDone(ctx *core.Context) (herr error) {
397
+ defer func() {
398
+ if r := recover(); r != nil {
399
+ var ok bool
400
+ if herr, ok = r.(error); !ok {
401
+ herr = fmt.Errorf("%v", r)
402
+ }
403
+ if cerr, ok := e.utility.Clean(ctx, herr).(error); ok {
404
+ herr = cerr
405
+ }
406
+ if ctx.Ctrl.Throw != nil && !*ctx.Ctrl.Throw {
407
+ herr = nil
408
+ }
409
+ }
410
+ }()
411
+ e.utility.FeatureHook(ctx, "PreDone")
412
+ return nil
413
+ }
414
+
375
415
  // A hook, fetcher or parser that panics never reached MakeError, and its
376
416
  // message can quote the request.
377
417
  func (e *EntyClass) recovered(ctx *core.Context, r any) (any, error) {
@@ -52,30 +52,58 @@ func NewProjectNameSDK(options map[string]any) (*ProjectNameSDK, error) {
52
52
  // declares `transport: 'wrap'` wrap whatever is current, so `test`
53
53
  // must be added before them to sit at the base of the chain.
54
54
  featureOpts := ToMapAny(vs.GetProp(sdk.options, "feature"))
55
+ active := func(fname string) bool {
56
+ ab, _ := ToMapAny(featureOpts[fname])["active"].(bool)
57
+ return ab
58
+ }
59
+ // An extend feature is active by its option, else by its own flag.
60
+ extActive := func(feat Feature) bool {
61
+ if ab, ok := ToMapAny(featureOpts[feat.GetName()])["active"].(bool); ok {
62
+ return ab
63
+ }
64
+ return feat.GetActive()
65
+ }
66
+
67
+ var extList []any
68
+ if el, ok := vs.GetProp(sdk.options, "extend").([]any); ok {
69
+ extList = el
70
+ }
71
+ carried := func(fname string) Feature {
72
+ for _, f := range extList {
73
+ if feat, ok := f.(Feature); ok && feat.GetName() == fname {
74
+ return feat
75
+ }
76
+ }
77
+ return nil
78
+ }
79
+
80
+ placed := map[Feature]bool{}
55
81
  if featureOpts != nil {
56
82
  if fo, ok := vs.GetPath(sdk.options, []any{"__derived__", "featureorder"}).([]any); ok {
57
83
  for _, n := range fo {
58
84
  fname, _ := n.(string)
59
- fopts := ToMapAny(featureOpts[fname])
60
- if fopts != nil {
61
- if active, ok := fopts["active"]; ok {
62
- if ab, ok := active.(bool); ok && ab {
63
- sdk.utility.FeatureAdd(sdk.rootctx, makeFeature(fname))
64
- }
85
+ if !active(fname) {
86
+ continue
87
+ }
88
+ gen := makeFeature(fname)
89
+ // An active name with no generated class is legal when an
90
+ // extend-supplied instance carries that name (station's adopt
91
+ // path): the instance takes the slot the order gives its name.
92
+ if gen == nil || gen.GetName() != fname {
93
+ if feat := carried(fname); feat != nil {
94
+ placed[feat] = true
95
+ sdk.utility.FeatureAdd(sdk.rootctx, feat)
96
+ continue
65
97
  }
66
98
  }
99
+ sdk.utility.FeatureAdd(sdk.rootctx, gen)
67
100
  }
68
101
  }
69
102
  }
70
103
 
71
- // Add extension features.
72
- if extend := vs.GetProp(sdk.options, "extend"); extend != nil {
73
- if extList, ok := extend.([]any); ok {
74
- for _, f := range extList {
75
- if feat, ok := f.(Feature); ok {
76
- sdk.utility.FeatureAdd(sdk.rootctx, feat)
77
- }
78
- }
104
+ for _, f := range extList {
105
+ if feat, ok := f.(Feature); ok && !placed[feat] && extActive(feat) {
106
+ sdk.utility.FeatureAdd(sdk.rootctx, feat)
79
107
  }
80
108
  }
81
109
 
@@ -917,9 +917,13 @@ public class CleanTest {
917
917
  forms(sinks, "mistyped:rejected", e);
918
918
  }
919
919
 
920
- // A number is registered as the text a message quotes it in.
921
- ${sdk} numeric = construct(jm("apikey", 918273645));
922
- numbered = numeric.getUtility().clean.apply(numeric.getRootCtx(), "found 918273645");
920
+ // A number is registered as the text the refusal quotes it in.
921
+ try {
922
+ new ${sdk}(offline(jm("apikey", 918273645)));
923
+ }
924
+ catch (RuntimeException e) {
925
+ numbered = String.valueOf(e.getMessage());
926
+ }
923
927
 
924
928
  for (boolean unexpected : new boolean[] {false, true}) {
925
929
  ${sdk} hooked = makeSdk(SCENARIOS.get(0), sinks, null, new ThrowFeature(unexpected));
@@ -971,6 +975,14 @@ public class CleanTest {
971
975
  release(handler);
972
976
  }
973
977
 
978
+ // The clean registry holds every credential in plain form, and is no option.
979
+ Map<String, Object> held = construct(jm("apikey", CANARY_APIKEY)).optionsMap();
980
+ String heldjson = Struct.jsonify(plain(held, 0, new IdentityHashMap<>()));
981
+ assertEquals(CANARY_APIKEY, held.get("apikey"));
982
+ assertEquals(List.of(), leaks(heldjson.replaceFirst(
983
+ java.util.regex.Pattern.quote("\\"" + CANARY_APIKEY + "\\""), "")),
984
+ "optionsMap carries a credential beyond the option the caller set: " + heldjson);
985
+
974
986
  List<String> leaked = new ArrayList<>();
975
987
  for (Sink s : sinks) {
976
988
  List<String> found = leaks(s.text);
@@ -983,7 +995,8 @@ public class CleanTest {
983
995
 
984
996
  assertEquals(0, leaked.size(), "credential leaked through: " + String.join("; ", leaked));
985
997
 
986
- assertEquals("found " + MASK, numbered);
998
+ assertTrue(null != numbered && ((String) numbered).contains(MASK) &&
999
+ !((String) numbered).contains("918273645"), "a numeric credential: " + numbered);
987
1000
  assertEquals(jm(MASK, 1, MASK + "#1", 2, "plain", 3), named);
988
1001
 
989
1002
  // The positive half: the slot the credential travelled in is masked,