@voxgig/sdkgen 4.32.1 → 4.34.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 (442) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/action/copies.d.ts +21 -0
  3. package/dist/action/copies.js +146 -0
  4. package/dist/action/copies.js.map +1 -0
  5. package/dist/action/doctor.d.ts +15 -2
  6. package/dist/action/doctor.js +169 -23
  7. package/dist/action/doctor.js.map +1 -1
  8. package/dist/action/edition.js +6 -2
  9. package/dist/action/edition.js.map +1 -1
  10. package/dist/action/feature.js +6 -2
  11. package/dist/action/feature.js.map +1 -1
  12. package/dist/action/package.js +28 -10
  13. package/dist/action/package.js.map +1 -1
  14. package/dist/action/remove.js +2 -0
  15. package/dist/action/remove.js.map +1 -1
  16. package/dist/action/resolve.d.ts +1 -0
  17. package/dist/action/resolve.js +10 -2
  18. package/dist/action/resolve.js.map +1 -1
  19. package/dist/action/target.js +6 -2
  20. package/dist/action/target.js.map +1 -1
  21. package/dist/helpers/naming.js +1 -1
  22. package/dist/helpers/naming.js.map +1 -1
  23. package/dist/sdkgen.d.ts +2 -1
  24. package/dist/sdkgen.js +36 -3
  25. package/dist/sdkgen.js.map +1 -1
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/model/sdkgen.aontu +7 -1
  28. package/package.json +1 -1
  29. package/project/.sdk/model/feature/debug.aontu +3 -1
  30. package/project/.sdk/src/cmp/c/PrepareAuth_c.ts +8 -28
  31. package/project/.sdk/src/cmp/c/TestClean_c.ts +774 -0
  32. package/project/.sdk/src/cmp/c/Test_c.ts +3 -0
  33. package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +16 -5
  34. package/project/.sdk/src/cmp/c/fragment/Main.fragment.c +1 -1
  35. package/project/.sdk/src/cmp/clojure/PrepareAuth_clojure.ts +3 -0
  36. package/project/.sdk/src/cmp/clojure/TestClean_clojure.ts +473 -0
  37. package/project/.sdk/src/cmp/clojure/Test_clojure.ts +6 -0
  38. package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +18 -8
  39. package/project/.sdk/src/cmp/cpp/PrepareAuth_cpp.ts +3 -0
  40. package/project/.sdk/src/cmp/cpp/TestClean_cpp.ts +782 -0
  41. package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +1 -1
  42. package/project/.sdk/src/cmp/cpp/Test_cpp.ts +2 -0
  43. package/project/.sdk/src/cmp/csharp/PrepareAuth_csharp.ts +3 -0
  44. package/project/.sdk/src/cmp/csharp/TestClean_csharp.ts +887 -0
  45. package/project/.sdk/src/cmp/csharp/Test_csharp.ts +2 -0
  46. package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +68 -4
  47. package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +8 -2
  48. package/project/.sdk/src/cmp/csharp/fragment/SdkError.fragment.cs +49 -0
  49. package/project/.sdk/src/cmp/elixir/PrepareAuth_elixir.ts +3 -0
  50. package/project/.sdk/src/cmp/elixir/Schema_elixir.ts +20 -10
  51. package/project/.sdk/src/cmp/elixir/TestClean_elixir.ts +666 -0
  52. package/project/.sdk/src/cmp/elixir/Test_elixir.ts +4 -0
  53. package/project/.sdk/src/cmp/elixir/fragment/Main.fragment.ex +1 -1
  54. package/project/.sdk/src/cmp/elixir/fragment/Pipeline.fragment.ex +14 -2
  55. package/project/.sdk/src/cmp/go/PrepareAuth_go.ts +3 -0
  56. package/project/.sdk/src/cmp/go/TestClean_go.ts +804 -0
  57. package/project/.sdk/src/cmp/go/Test_go.ts +3 -0
  58. package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +54 -4
  59. package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +27 -2
  60. package/project/.sdk/src/cmp/java/PrepareAuth_java.ts +3 -0
  61. package/project/.sdk/src/cmp/java/TestClean_java.ts +884 -0
  62. package/project/.sdk/src/cmp/java/Test_java.ts +2 -0
  63. package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +56 -11
  64. package/project/.sdk/src/cmp/java/fragment/SdkError.fragment.java +36 -3
  65. package/project/.sdk/src/cmp/js/PrepareAuth_js.ts +3 -0
  66. package/project/.sdk/src/cmp/js/TestClean_js.ts +458 -0
  67. package/project/.sdk/src/cmp/js/Test_js.ts +2 -0
  68. package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +5 -4
  69. package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +7 -1
  70. package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +7 -1
  71. package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +7 -1
  72. package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +7 -1
  73. package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +7 -1
  74. package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +11 -2
  75. package/project/.sdk/src/cmp/js/fragment/SdkError.fragment.js +17 -1
  76. package/project/.sdk/src/cmp/kotlin/Package_kotlin.ts +5 -0
  77. package/project/.sdk/src/cmp/kotlin/PrepareAuth_kotlin.ts +3 -0
  78. package/project/.sdk/src/cmp/kotlin/TestClean_kotlin.ts +654 -0
  79. package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +3 -0
  80. package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +44 -11
  81. package/project/.sdk/src/cmp/kotlin/fragment/SdkError.fragment.kt +31 -0
  82. package/project/.sdk/src/cmp/lua/PrepareAuth_lua.ts +3 -0
  83. package/project/.sdk/src/cmp/lua/TestClean_lua.ts +769 -0
  84. package/project/.sdk/src/cmp/lua/Test_lua.ts +3 -0
  85. package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +77 -1
  86. package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +49 -2
  87. package/project/.sdk/src/cmp/ocaml/Entity_ocaml.ts +3 -2
  88. package/project/.sdk/src/cmp/ocaml/PrepareAuth_ocaml.ts +4 -25
  89. package/project/.sdk/src/cmp/ocaml/TestClean_ocaml.ts +538 -0
  90. package/project/.sdk/src/cmp/ocaml/Test_ocaml.ts +5 -0
  91. package/project/.sdk/src/cmp/ocaml/fragment/RunOp.fragment.ml +16 -4
  92. package/project/.sdk/src/cmp/perl/PrepareAuth_perl.ts +3 -0
  93. package/project/.sdk/src/cmp/perl/TestClean_perl.ts +619 -0
  94. package/project/.sdk/src/cmp/perl/Test_perl.ts +3 -0
  95. package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +67 -5
  96. package/project/.sdk/src/cmp/perl/fragment/Main.fragment.pm +13 -1
  97. package/project/.sdk/src/cmp/php/PrepareAuth_php.ts +3 -0
  98. package/project/.sdk/src/cmp/php/TestClean_php.ts +809 -0
  99. package/project/.sdk/src/cmp/php/Test_php.ts +2 -0
  100. package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +96 -55
  101. package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +15 -2
  102. package/project/.sdk/src/cmp/py/PrepareAuth_py.ts +3 -0
  103. package/project/.sdk/src/cmp/py/TestClean_py.ts +549 -0
  104. package/project/.sdk/src/cmp/py/Test_py.ts +3 -0
  105. package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +83 -55
  106. package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +19 -3
  107. package/project/.sdk/src/cmp/rb/PrepareAuth_rb.ts +3 -0
  108. package/project/.sdk/src/cmp/rb/TestClean_rb.ts +535 -0
  109. package/project/.sdk/src/cmp/rb/Test_rb.ts +3 -0
  110. package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +108 -46
  111. package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +12 -1
  112. package/project/.sdk/src/cmp/rust/PrepareAuth_rust.ts +9 -45
  113. package/project/.sdk/src/cmp/rust/TestClean_rust.ts +881 -0
  114. package/project/.sdk/src/cmp/rust/Test_rust.ts +3 -0
  115. package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +14 -6
  116. package/project/.sdk/src/cmp/rust/fragment/Main.fragment.rs +17 -1
  117. package/project/.sdk/src/cmp/rust/fragment/SdkError.fragment.rs +34 -2
  118. package/project/.sdk/src/cmp/scala/PrepareAuth_scala.ts +3 -0
  119. package/project/.sdk/src/cmp/scala/TestClean_scala.ts +608 -0
  120. package/project/.sdk/src/cmp/scala/Test_scala.ts +3 -0
  121. package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +58 -6
  122. package/project/.sdk/src/cmp/swift/PrepareAuth_swift.ts +3 -0
  123. package/project/.sdk/src/cmp/swift/TestClean_swift.ts +671 -0
  124. package/project/.sdk/src/cmp/swift/Test_swift.ts +3 -0
  125. package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +10 -0
  126. package/project/.sdk/src/cmp/swift/fragment/Main.fragment.swift +16 -2
  127. package/project/.sdk/src/cmp/swift/fragment/SdkError.fragment.swift +47 -3
  128. package/project/.sdk/src/cmp/ts/PrepareAuth_ts.ts +3 -0
  129. package/project/.sdk/src/cmp/ts/TestClean_ts.ts +465 -0
  130. package/project/.sdk/src/cmp/ts/Test_ts.ts +2 -0
  131. package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +5 -4
  132. package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +7 -1
  133. package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +7 -1
  134. package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +7 -1
  135. package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +7 -1
  136. package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +7 -1
  137. package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +8 -2
  138. package/project/.sdk/src/cmp/ts/fragment/SdkError.fragment.ts +20 -2
  139. package/project/.sdk/src/cmp/zig/PrepareAuth_zig.ts +3 -0
  140. package/project/.sdk/src/cmp/zig/TestClean_zig.ts +791 -0
  141. package/project/.sdk/src/cmp/zig/Test_zig.ts +5 -0
  142. package/project/.sdk/src/cmp/zig/fragment/Build.fragment.zig +19 -0
  143. package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +14 -5
  144. package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +1 -1
  145. package/project/.sdk/tm/c/core/context.c +25 -0
  146. package/project/.sdk/tm/c/core/error.c +16 -0
  147. package/project/.sdk/tm/c/core/sdk.h +22 -0
  148. package/project/.sdk/tm/c/feature/audit.c +2 -0
  149. package/project/.sdk/tm/c/feature/cost.c +1 -0
  150. package/project/.sdk/tm/c/feature/debug.c +19 -29
  151. package/project/.sdk/tm/c/feature/log.c +21 -2
  152. package/project/.sdk/tm/c/feature/proxy.c +55 -3
  153. package/project/.sdk/tm/c/feature/secrets.c +7 -0
  154. package/project/.sdk/tm/c/feature/telemetry.c +2 -0
  155. package/project/.sdk/tm/c/tests/feature_test.c +2 -2
  156. package/project/.sdk/tm/c/utility/clean.c +530 -8
  157. package/project/.sdk/tm/c/utility/done.c +28 -12
  158. package/project/.sdk/tm/c/utility/make_error.c +4 -3
  159. package/project/.sdk/tm/c/utility/make_options.c +71 -45
  160. package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +15 -0
  161. package/project/.sdk/tm/clojure/src/sdk/client.clj +20 -4
  162. package/project/.sdk/tm/clojure/src/sdk/core.clj +319 -35
  163. package/project/.sdk/tm/clojure/src/sdk/features.clj +68 -30
  164. package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +4 -2
  165. package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +47 -20
  166. package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +4 -0
  167. package/project/.sdk/tm/cpp/core/types.hpp +93 -3
  168. package/project/.sdk/tm/cpp/feature/audit.hpp +1 -0
  169. package/project/.sdk/tm/cpp/feature/cost.hpp +1 -0
  170. package/project/.sdk/tm/cpp/feature/debug.hpp +20 -12
  171. package/project/.sdk/tm/cpp/feature/log.hpp +31 -9
  172. package/project/.sdk/tm/cpp/feature/proxy.hpp +52 -6
  173. package/project/.sdk/tm/cpp/feature/secrets.hpp +13 -0
  174. package/project/.sdk/tm/cpp/feature/telemetry.hpp +4 -2
  175. package/project/.sdk/tm/cpp/test/feature_test.cpp +2 -2
  176. package/project/.sdk/tm/cpp/utility/pipeline.hpp +426 -51
  177. package/project/.sdk/tm/csharp/core/Context.cs +32 -0
  178. package/project/.sdk/tm/csharp/core/Utility.cs +2 -0
  179. package/project/.sdk/tm/csharp/feature/AuditFeature.cs +1 -0
  180. package/project/.sdk/tm/csharp/feature/CostFeature.cs +7 -5
  181. package/project/.sdk/tm/csharp/feature/DebugFeature.cs +19 -16
  182. package/project/.sdk/tm/csharp/feature/FeatureOptions.cs +16 -0
  183. package/project/.sdk/tm/csharp/feature/LogFeature.cs +4 -1
  184. package/project/.sdk/tm/csharp/feature/ProxyFeature.cs +26 -5
  185. package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +16 -0
  186. package/project/.sdk/tm/csharp/feature/TelemetryFeature.cs +4 -2
  187. package/project/.sdk/tm/csharp/test/FeatureTest.cs +2 -2
  188. package/project/.sdk/tm/csharp/utility/Clean.cs +440 -2
  189. package/project/.sdk/tm/csharp/utility/Done.cs +27 -11
  190. package/project/.sdk/tm/csharp/utility/MakeError.cs +19 -8
  191. package/project/.sdk/tm/csharp/utility/MakeOptions.cs +119 -29
  192. package/project/.sdk/tm/csharp/utility/MakeResponse.cs +21 -11
  193. package/project/.sdk/tm/csharp/utility/Register.cs +1 -0
  194. package/project/.sdk/tm/elixir/lib/projectname/context.ex +19 -0
  195. package/project/.sdk/tm/elixir/lib/projectname/entity_base.ex +22 -1
  196. package/project/.sdk/tm/elixir/lib/projectname/error.ex +24 -0
  197. package/project/.sdk/tm/elixir/lib/projectname/feature/audit.ex +2 -2
  198. package/project/.sdk/tm/elixir/lib/projectname/feature/cost.ex +2 -2
  199. package/project/.sdk/tm/elixir/lib/projectname/feature/debug.ex +13 -13
  200. package/project/.sdk/tm/elixir/lib/projectname/feature/log.ex +18 -5
  201. package/project/.sdk/tm/elixir/lib/projectname/feature/proxy.ex +19 -1
  202. package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +15 -0
  203. package/project/.sdk/tm/elixir/lib/projectname/feature/telemetry.ex +4 -2
  204. package/project/.sdk/tm/elixir/lib/projectname/feature.ex +22 -0
  205. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +464 -41
  206. package/project/.sdk/tm/elixir/test/feature_test.exs +3 -2
  207. package/project/.sdk/tm/go/core/context.go +42 -0
  208. package/project/.sdk/tm/go/core/error.go +30 -10
  209. package/project/.sdk/tm/go/core/utility_type.go +2 -0
  210. package/project/.sdk/tm/go/feature/audit_feature.go +1 -0
  211. package/project/.sdk/tm/go/feature/base_feature.go +12 -0
  212. package/project/.sdk/tm/go/feature/cost_feature.go +2 -2
  213. package/project/.sdk/tm/go/feature/debug_feature.go +14 -12
  214. package/project/.sdk/tm/go/feature/log_feature.go +13 -8
  215. package/project/.sdk/tm/go/feature/proxy_feature.go +26 -6
  216. package/project/.sdk/tm/go/feature/secrets_feature.go +19 -0
  217. package/project/.sdk/tm/go/feature/telemetry_feature.go +4 -2
  218. package/project/.sdk/tm/go/test/feature_test.go +2 -2
  219. package/project/.sdk/tm/go/utility/clean.go +585 -2
  220. package/project/.sdk/tm/go/utility/done.go +29 -9
  221. package/project/.sdk/tm/go/utility/make_error.go +51 -16
  222. package/project/.sdk/tm/go/utility/make_options.go +77 -36
  223. package/project/.sdk/tm/go/utility/register.go +12 -0
  224. package/project/.sdk/tm/java/core/Context.java +29 -0
  225. package/project/.sdk/tm/java/core/SdkClient.java +4 -2
  226. package/project/.sdk/tm/java/core/Utility.java +7 -0
  227. package/project/.sdk/tm/java/feature/AuditFeature.java +6 -0
  228. package/project/.sdk/tm/java/feature/CostFeature.java +5 -0
  229. package/project/.sdk/tm/java/feature/DebugFeature.java +25 -14
  230. package/project/.sdk/tm/java/feature/LogFeature.java +11 -4
  231. package/project/.sdk/tm/java/feature/ProxyFeature.java +41 -6
  232. package/project/.sdk/tm/java/feature/SecretsFeature.java +18 -0
  233. package/project/.sdk/tm/java/feature/TelemetryFeature.java +8 -2
  234. package/project/.sdk/tm/java/test/FeatureTest.java +2 -2
  235. package/project/.sdk/tm/java/utility/Clean.java +519 -1
  236. package/project/.sdk/tm/java/utility/Done.java +1 -1
  237. package/project/.sdk/tm/java/utility/MakeError.java +5 -1
  238. package/project/.sdk/tm/java/utility/MakeOptions.java +55 -31
  239. package/project/.sdk/tm/java/utility/Register.java +4 -0
  240. package/project/.sdk/tm/js/src/Context.js +5 -1
  241. package/project/.sdk/tm/js/src/feature/audit/AuditFeature.js +2 -2
  242. package/project/.sdk/tm/js/src/feature/cost/CostFeature.js +2 -2
  243. package/project/.sdk/tm/js/src/feature/debug/DebugFeature.js +13 -7
  244. package/project/.sdk/tm/js/src/feature/log/LogFeature.js +9 -5
  245. package/project/.sdk/tm/js/src/feature/proxy/ProxyFeature.js +19 -1
  246. package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +14 -0
  247. package/project/.sdk/tm/js/src/feature/telemetry/TelemetryFeature.js +4 -2
  248. package/project/.sdk/tm/js/src/utility/CleanUtility.js +294 -21
  249. package/project/.sdk/tm/js/src/utility/DoneUtility.js +17 -5
  250. package/project/.sdk/tm/js/src/utility/MakeErrorUtility.js +18 -2
  251. package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +39 -15
  252. package/project/.sdk/tm/js/src/utility/Utility.js +4 -2
  253. package/project/.sdk/tm/js/test/feature/harness.js +11 -1
  254. package/project/.sdk/tm/js/test/feature.test.js +9 -2
  255. package/project/.sdk/tm/kotlin/core/Context.kt +19 -0
  256. package/project/.sdk/tm/kotlin/core/SdkClient.kt +9 -2
  257. package/project/.sdk/tm/kotlin/core/Utility.kt +2 -0
  258. package/project/.sdk/tm/kotlin/feature/AuditFeature.kt +11 -9
  259. package/project/.sdk/tm/kotlin/feature/CostFeature.kt +8 -5
  260. package/project/.sdk/tm/kotlin/feature/DebugFeature.kt +15 -22
  261. package/project/.sdk/tm/kotlin/feature/LogFeature.kt +8 -4
  262. package/project/.sdk/tm/kotlin/feature/ProxyFeature.kt +26 -2
  263. package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +11 -0
  264. package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +4 -2
  265. package/project/.sdk/tm/kotlin/test/FeatureTest.kt +2 -2
  266. package/project/.sdk/tm/kotlin/utility/CoreUtil.kt +447 -11
  267. package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +38 -31
  268. package/project/.sdk/tm/kotlin/utility/Register.kt +1 -0
  269. package/project/.sdk/tm/lua/core/context.lua +43 -0
  270. package/project/.sdk/tm/lua/core/error.lua +36 -1
  271. package/project/.sdk/tm/lua/core/utility_type.lua +4 -0
  272. package/project/.sdk/tm/lua/feature/audit_feature.lua +2 -2
  273. package/project/.sdk/tm/lua/feature/cost_feature.lua +2 -2
  274. package/project/.sdk/tm/lua/feature/debug_feature.lua +21 -17
  275. package/project/.sdk/tm/lua/feature/log_feature.lua +2 -1
  276. package/project/.sdk/tm/lua/feature/proxy_feature.lua +23 -1
  277. package/project/.sdk/tm/lua/feature/secrets_feature.lua +18 -0
  278. package/project/.sdk/tm/lua/feature/telemetry_feature.lua +4 -2
  279. package/project/.sdk/tm/lua/test/feature/secrets/secrets_feature_test.lua +3 -2
  280. package/project/.sdk/tm/lua/test/feature_test.lua +10 -3
  281. package/project/.sdk/tm/lua/utility/clean.lua +426 -2
  282. package/project/.sdk/tm/lua/utility/clean_explain.lua +34 -0
  283. package/project/.sdk/tm/lua/utility/done.lua +1 -7
  284. package/project/.sdk/tm/lua/utility/make_error.lua +3 -1
  285. package/project/.sdk/tm/lua/utility/make_options.lua +76 -30
  286. package/project/.sdk/tm/lua/utility/register.lua +4 -1
  287. package/project/.sdk/tm/ocaml/Makefile +5 -1
  288. package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +12 -1
  289. package/project/.sdk/tm/ocaml/sdk_features.ml +78 -18
  290. package/project/.sdk/tm/ocaml/sdk_helpers.ml +27 -0
  291. package/project/.sdk/tm/ocaml/sdk_runtime.ml +304 -26
  292. package/project/.sdk/tm/ocaml/sdk_types.ml +1 -0
  293. package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +3 -1
  294. package/project/.sdk/tm/ocaml/test/t_feature.ml +2 -2
  295. package/project/.sdk/tm/perl/core/context.pm +27 -0
  296. package/project/.sdk/tm/perl/core/error.pm +52 -5
  297. package/project/.sdk/tm/perl/feature/audit_feature.pm +2 -2
  298. package/project/.sdk/tm/perl/feature/cost_feature.pm +2 -2
  299. package/project/.sdk/tm/perl/feature/debug_feature.pm +17 -13
  300. package/project/.sdk/tm/perl/feature/log_feature.pm +3 -1
  301. package/project/.sdk/tm/perl/feature/proxy_feature.pm +21 -1
  302. package/project/.sdk/tm/perl/feature/secrets_feature.pm +20 -1
  303. package/project/.sdk/tm/perl/feature/telemetry_feature.pm +4 -2
  304. package/project/.sdk/tm/perl/t/feature.t +4 -2
  305. package/project/.sdk/tm/perl/utility/clean.pm +345 -1
  306. package/project/.sdk/tm/perl/utility/done.pm +24 -6
  307. package/project/.sdk/tm/perl/utility/make_error.pm +17 -4
  308. package/project/.sdk/tm/perl/utility/make_options.pm +33 -14
  309. package/project/.sdk/tm/php/core/Context.php +24 -1
  310. package/project/.sdk/tm/php/core/Error.php +34 -3
  311. package/project/.sdk/tm/php/core/UtilityType.php +4 -0
  312. package/project/.sdk/tm/php/feature/AuditFeature.php +2 -2
  313. package/project/.sdk/tm/php/feature/CostFeature.php +2 -2
  314. package/project/.sdk/tm/php/feature/DebugFeature.php +18 -9
  315. package/project/.sdk/tm/php/feature/LogFeature.php +5 -2
  316. package/project/.sdk/tm/php/feature/ProxyFeature.php +20 -1
  317. package/project/.sdk/tm/php/feature/SecretsFeature.php +18 -0
  318. package/project/.sdk/tm/php/feature/TelemetryFeature.php +4 -2
  319. package/project/.sdk/tm/php/test/FeatureTest.php +2 -2
  320. package/project/.sdk/tm/php/utility/Clean.php +438 -2
  321. package/project/.sdk/tm/php/utility/Done.php +14 -7
  322. package/project/.sdk/tm/php/utility/MakeError.php +9 -7
  323. package/project/.sdk/tm/php/utility/MakeOptions.php +62 -38
  324. package/project/.sdk/tm/php/utility/Register.php +2 -0
  325. package/project/.sdk/tm/py/pkg/core/context.py +17 -0
  326. package/project/.sdk/tm/py/pkg/core/error.py +42 -1
  327. package/project/.sdk/tm/py/pkg/core/utility_type.py +4 -0
  328. package/project/.sdk/tm/py/pkg/feature/audit_feature.py +2 -2
  329. package/project/.sdk/tm/py/pkg/feature/cost_feature.py +2 -2
  330. package/project/.sdk/tm/py/pkg/feature/debug_feature.py +17 -12
  331. package/project/.sdk/tm/py/pkg/feature/log_feature.py +2 -1
  332. package/project/.sdk/tm/py/pkg/feature/proxy_feature.py +18 -1
  333. package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +12 -0
  334. package/project/.sdk/tm/py/pkg/feature/telemetry_feature.py +4 -2
  335. package/project/.sdk/tm/py/pkg/utility/clean.py +311 -1
  336. package/project/.sdk/tm/py/pkg/utility/done.py +18 -5
  337. package/project/.sdk/tm/py/pkg/utility/make_error.py +9 -6
  338. package/project/.sdk/tm/py/pkg/utility/make_options.py +64 -25
  339. package/project/.sdk/tm/py/pkg/utility/make_response.py +19 -13
  340. package/project/.sdk/tm/py/pkg/utility/register.py +4 -2
  341. package/project/.sdk/tm/py/test/feature_harness.py +4 -0
  342. package/project/.sdk/tm/py/test/test_feature.py +2 -2
  343. package/project/.sdk/tm/py/test/test_primary_utility.py +1 -0
  344. package/project/.sdk/tm/rb/core/context.rb +28 -0
  345. package/project/.sdk/tm/rb/core/error.rb +30 -0
  346. package/project/.sdk/tm/rb/core/utility_type.rb +1 -1
  347. package/project/.sdk/tm/rb/feature/audit_feature.rb +2 -2
  348. package/project/.sdk/tm/rb/feature/cost_feature.rb +2 -2
  349. package/project/.sdk/tm/rb/feature/debug_feature.rb +15 -12
  350. package/project/.sdk/tm/rb/feature/log_feature.rb +3 -1
  351. package/project/.sdk/tm/rb/feature/proxy_feature.rb +25 -1
  352. package/project/.sdk/tm/rb/feature/secrets_feature.rb +17 -0
  353. package/project/.sdk/tm/rb/feature/telemetry_feature.rb +4 -2
  354. package/project/.sdk/tm/rb/test/feature_test.rb +4 -2
  355. package/project/.sdk/tm/rb/utility/clean.rb +312 -1
  356. package/project/.sdk/tm/rb/utility/done.rb +15 -5
  357. package/project/.sdk/tm/rb/utility/make_error.rb +13 -4
  358. package/project/.sdk/tm/rb/utility/make_options.rb +31 -12
  359. package/project/.sdk/tm/rb/utility/register.rb +2 -0
  360. package/project/.sdk/tm/rust/core/context.rs +55 -0
  361. package/project/.sdk/tm/rust/core/utility_type.rs +17 -0
  362. package/project/.sdk/tm/rust/feature/audit.rs +2 -0
  363. package/project/.sdk/tm/rust/feature/cost.rs +3 -2
  364. package/project/.sdk/tm/rust/feature/debug.rs +16 -16
  365. package/project/.sdk/tm/rust/feature/log.rs +42 -7
  366. package/project/.sdk/tm/rust/feature/proxy.rs +48 -2
  367. package/project/.sdk/tm/rust/feature/secrets.rs +12 -0
  368. package/project/.sdk/tm/rust/feature/telemetry.rs +2 -0
  369. package/project/.sdk/tm/rust/tests/feature_test.rs +2 -2
  370. package/project/.sdk/tm/rust/utility/clean.rs +446 -5
  371. package/project/.sdk/tm/rust/utility/done.rs +22 -12
  372. package/project/.sdk/tm/rust/utility/make_error.rs +4 -1
  373. package/project/.sdk/tm/rust/utility/make_options.rs +73 -19
  374. package/project/.sdk/tm/scala/Makefile +3 -1
  375. package/project/.sdk/tm/scala/core/Context.scala +16 -0
  376. package/project/.sdk/tm/scala/core/SdkClient.scala +14 -4
  377. package/project/.sdk/tm/scala/core/SdkError.scala +28 -0
  378. package/project/.sdk/tm/scala/core/Types.scala +3 -0
  379. package/project/.sdk/tm/scala/core/Utility.scala +2 -0
  380. package/project/.sdk/tm/scala/feature/AuditFeature.scala +16 -10
  381. package/project/.sdk/tm/scala/feature/CostFeature.scala +10 -5
  382. package/project/.sdk/tm/scala/feature/DebugFeature.scala +24 -21
  383. package/project/.sdk/tm/scala/feature/LogFeature.scala +9 -4
  384. package/project/.sdk/tm/scala/feature/ProxyFeature.scala +23 -2
  385. package/project/.sdk/tm/scala/feature/SecretsFeature.scala +14 -0
  386. package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +9 -2
  387. package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +2 -2
  388. package/project/.sdk/tm/scala/utility/Make.scala +63 -20
  389. package/project/.sdk/tm/scala/utility/Misc.scala +358 -5
  390. package/project/.sdk/tm/scala/utility/Register.scala +1 -0
  391. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +29 -0
  392. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Utility.swift +2 -0
  393. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +10 -9
  394. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/CostFeature.swift +7 -5
  395. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/DebugFeature.swift +19 -15
  396. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/FeatureOptions.swift +16 -0
  397. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/LogFeature.swift +4 -1
  398. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/ProxyFeature.swift +20 -5
  399. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/SecretsFeature.swift +13 -0
  400. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +4 -2
  401. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeError.swift +15 -5
  402. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +58 -19
  403. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Register.swift +1 -0
  404. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +391 -4
  405. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +2 -2
  406. package/project/.sdk/tm/ts/src/Context.ts +5 -1
  407. package/project/.sdk/tm/ts/src/feature/audit/AuditFeature.ts +2 -2
  408. package/project/.sdk/tm/ts/src/feature/cost/CostFeature.ts +2 -2
  409. package/project/.sdk/tm/ts/src/feature/debug/DebugFeature.ts +13 -7
  410. package/project/.sdk/tm/ts/src/feature/log/LogFeature.ts +9 -5
  411. package/project/.sdk/tm/ts/src/feature/proxy/ProxyFeature.ts +19 -1
  412. package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +12 -0
  413. package/project/.sdk/tm/ts/src/feature/telemetry/TelemetryFeature.ts +4 -2
  414. package/project/.sdk/tm/ts/src/utility/CleanUtility.ts +287 -9
  415. package/project/.sdk/tm/ts/src/utility/DoneUtility.ts +18 -5
  416. package/project/.sdk/tm/ts/src/utility/MakeErrorUtility.ts +18 -8
  417. package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +38 -16
  418. package/project/.sdk/tm/ts/src/utility/Utility.ts +4 -2
  419. package/project/.sdk/tm/ts/test/feature/harness.ts +11 -1
  420. package/project/.sdk/tm/ts/test/feature.test.ts +9 -2
  421. package/project/.sdk/tm/zig/core/context.zig +34 -0
  422. package/project/.sdk/tm/zig/core/error.zig +22 -1
  423. package/project/.sdk/tm/zig/core/utility.zig +403 -39
  424. package/project/.sdk/tm/zig/feature/audit.zig +4 -2
  425. package/project/.sdk/tm/zig/feature/cost.zig +3 -2
  426. package/project/.sdk/tm/zig/feature/debug.zig +20 -25
  427. package/project/.sdk/tm/zig/feature/log.zig +3 -1
  428. package/project/.sdk/tm/zig/feature/proxy.zig +47 -6
  429. package/project/.sdk/tm/zig/feature/secrets.zig +7 -0
  430. package/project/.sdk/tm/zig/feature/telemetry.zig +4 -2
  431. package/project/.sdk/tm/zig/test/feature_test.zig +2 -2
  432. package/project/sdkgen-package.json +1 -1
  433. package/src/action/copies.ts +219 -0
  434. package/src/action/doctor.ts +247 -21
  435. package/src/action/edition.ts +10 -2
  436. package/src/action/feature.ts +11 -2
  437. package/src/action/package.ts +31 -10
  438. package/src/action/remove.ts +4 -0
  439. package/src/action/resolve.ts +16 -3
  440. package/src/action/target.ts +10 -2
  441. package/src/helpers/naming.ts +1 -1
  442. package/src/sdkgen.ts +45 -5
@@ -86,10 +86,26 @@ pub const Utility = struct {
86
86
  _ = self;
87
87
  return clean_util(ctx, val);
88
88
  }
89
+ pub fn clean_str(self: *Utility, ctx: *Context, val: []const u8) []const u8 {
90
+ _ = self;
91
+ return clean_str_util(ctx, val);
92
+ }
93
+ pub fn clean_add(self: *Utility, ctx: *Context, value: []const u8) void {
94
+ _ = self;
95
+ clean_add_util(ctx, value);
96
+ }
97
+ pub fn clean_key(self: *Utility, ctx: *Context, key: []const u8) bool {
98
+ _ = self;
99
+ return clean_key_util(ctx, key);
100
+ }
89
101
  pub fn done(self: *Utility, ctx: *Context) E!Value {
90
102
  _ = self;
91
103
  return done_util(ctx);
92
104
  }
105
+ pub fn clean_explain(self: *Utility, ctx: *Context) void {
106
+ _ = self;
107
+ clean_explain_util(ctx);
108
+ }
93
109
  pub fn make_error(self: *Utility, ctx: *Context) E!Value {
94
110
  _ = self;
95
111
  return make_error_util(ctx);
@@ -160,27 +176,307 @@ pub const Utility = struct {
160
176
  // clean / done / make_error
161
177
  // ============================================================================
162
178
 
163
- pub fn clean_util(ctx: *Context, val: Value) Value {
164
- _ = ctx;
165
- return val;
179
+ // Everything that leaves the pipeline passes through clean; inside it data
180
+ // stays raw, so a hook can still read the header it must add to. The zig
181
+ // port of tm/ts/src/utility/CleanUtility.ts. The derived clean block is a
182
+ // Value map (`options.__derived__.clean`) whose `values` list is MUTABLE:
183
+ // features register secrets after make_options.
184
+
185
+ const CLEAN_MAXDEPTH: usize = 32;
186
+ const CLEAN_CIRCULAR = "[circular]";
187
+ // The schema's own default, for a context that reaches clean before any
188
+ // options exist.
189
+ const CLEAN_DEFAULT_KEYS = "key,secret,token,password,passwd,authorization,cookie,credential,signature";
190
+
191
+ const CleanCfg = struct {
192
+ active: bool,
193
+ keys: Value,
194
+ values: Value,
195
+ mask: []const u8,
196
+ hint: i64,
197
+ min: i64,
198
+ };
199
+
200
+ fn clean_normkey(key: []const u8) []const u8 {
201
+ var out: std.ArrayList(u8) = .empty;
202
+ for (key) |c| {
203
+ if (c == '-' or c == '_') continue;
204
+ out.append(h.A(), std.ascii.toLower(c)) catch {};
205
+ }
206
+ return out.toOwnedSlice(h.A()) catch key;
166
207
  }
167
- pub fn clean_str(ctx: *Context, val: []const u8) []const u8 {
168
- _ = ctx;
169
- return val;
208
+
209
+ fn clean_count(v: Value, dflt: i64) i64 {
210
+ return switch (v) {
211
+ .integer => |i| if (i >= 0) i else dflt,
212
+ .float => |f| if (f >= 0) @as(i64, @intFromFloat(@floor(f))) else dflt,
213
+ .string => |s| blk: {
214
+ const n = std.fmt.parseFloat(f64, std.mem.trim(u8, s, " \t")) catch break :blk dflt;
215
+ break :blk if (n >= 0) @as(i64, @intFromFloat(@floor(n))) else dflt;
216
+ },
217
+ else => dflt,
218
+ };
170
219
  }
171
220
 
172
- pub fn done_util(ctx: *Context) E!Value {
173
- {
174
- const c = ctx.ctrl;
175
- if (c.has_explain()) {
176
- const explain = clean_util(ctx, c.explain);
177
- if (h.getp(explain, "result") == .object) {
178
- const rm = h.to_map(h.getp(explain, "result"));
179
- h.del_prop(rm, h.vstr("err"));
221
+ pub fn make_clean_config(cleanopts: Value) Value {
222
+ const keys_src: []const u8 = switch (h.getp(cleanopts, "keys")) {
223
+ .string => |s| s,
224
+ else => CLEAN_DEFAULT_KEYS,
225
+ };
226
+ const keys = h.olist();
227
+ var it = std.mem.splitScalar(u8, keys_src, ',');
228
+ while (it.next()) |p| {
229
+ const k = clean_normkey(std.mem.trim(u8, p, " \t"));
230
+ if (k.len != 0) keys.array.append(h.vstr(k)) catch {};
231
+ }
232
+ const active = switch (h.getp(cleanopts, "active")) {
233
+ .bool => |b| b,
234
+ else => true,
235
+ };
236
+ const mask: []const u8 = switch (h.getp(cleanopts, "mask")) {
237
+ .string => |s| s,
238
+ else => "[redacted]",
239
+ };
240
+ return h.jo(&.{
241
+ .{ "active", h.vbool(active) },
242
+ .{ "keys", keys },
243
+ .{ "values", h.olist() },
244
+ .{ "mask", h.vstr(mask) },
245
+ .{ "hint", h.vnum(clean_count(h.getp(cleanopts, "hint"), 0)) },
246
+ .{ "min", h.vnum(@max(1, clean_count(h.getp(cleanopts, "min"), 4))) },
247
+ });
248
+ }
249
+
250
+ // The comma-separated `clean.values` option, or a list of strings.
251
+ pub fn clean_splitvalues(values: Value) [][]const u8 {
252
+ var out: std.ArrayList([]const u8) = .empty;
253
+ switch (values) {
254
+ .array => |l| {
255
+ for (l.data.items) |v| {
256
+ if (v == .string) out.append(h.A(), v.string) catch {};
180
257
  }
181
- c.explain = explain;
258
+ },
259
+ .string => |s| {
260
+ var it = std.mem.splitScalar(u8, s, ',');
261
+ while (it.next()) |p| {
262
+ const t = std.mem.trim(u8, p, " \t");
263
+ if (t.len != 0) out.append(h.A(), t) catch {};
264
+ }
265
+ },
266
+ else => {},
267
+ }
268
+ return out.toOwnedSlice(h.A()) catch &.{};
269
+ }
270
+
271
+ // A context without options (make_error accepts a bare one) still masks by
272
+ // the schema defaults.
273
+ fn clean_config(ctx: *Context) Value {
274
+ const derived = h.getpath(&.{ "__derived__", "clean" }, ctx.options);
275
+ if (derived == .object and h.getp(derived, "values") == .array) return derived;
276
+ return make_clean_config(h.getp(schema.shared_optspec(), "clean"));
277
+ }
278
+
279
+ fn clean_view(cfg: Value) CleanCfg {
280
+ return .{
281
+ .active = h.get_bool(cfg, "active") orelse true,
282
+ .keys = h.getp(cfg, "keys"),
283
+ .values = h.getp(cfg, "values"),
284
+ .mask = h.get_str(cfg, "mask") orelse "[redacted]",
285
+ .hint = h.get_i64(cfg, "hint") orelse 0,
286
+ .min = @max(1, h.get_i64(cfg, "min") orelse 4),
287
+ };
288
+ }
289
+
290
+ fn clean_base64(text: []const u8) []const u8 {
291
+ const enc = std.base64.standard.Encoder;
292
+ const buf = h.A().alloc(u8, enc.calcSize(text.len)) catch return "";
293
+ return enc.encode(buf, text);
294
+ }
295
+
296
+ fn clean_json_escape(text: []const u8) []const u8 {
297
+ const quoted = h.jsonify_compact(h.vstr(text));
298
+ if (quoted.len >= 2 and quoted[0] == '"' and quoted[quoted.len - 1] == '"') {
299
+ return quoted[1 .. quoted.len - 1];
300
+ }
301
+ return text;
302
+ }
303
+
304
+ fn clean_values_has(values: Value, s: []const u8) bool {
305
+ if (values != .array) return false;
306
+ for (values.array.data.items) |v| {
307
+ if (v == .string and std.mem.eql(u8, v.string, s)) return true;
308
+ }
309
+ return false;
310
+ }
311
+
312
+ fn clean_longer_first(_: void, a: Value, b: Value) bool {
313
+ const al: usize = if (a == .string) a.string.len else 0;
314
+ const bl: usize = if (b == .string) b.string.len else 0;
315
+ return al > bl;
316
+ }
317
+
318
+ // Register a value with the encoded forms it travels in.
319
+ pub fn clean_add_cfg(cfg: Value, value: []const u8) void {
320
+ const c = clean_view(cfg);
321
+ if (c.values != .array) return;
322
+ if (@as(i64, @intCast(value.len)) < c.min) return;
323
+ const forms = [_][]const u8{ value, clean_base64(value), h.esc_url(value), clean_json_escape(value) };
324
+ var changed = false;
325
+ for (forms) |form| {
326
+ if (form.len == 0 or @as(i64, @intCast(form.len)) < c.min) continue;
327
+ if (clean_values_has(c.values, form)) continue;
328
+ c.values.array.append(h.vstr(form)) catch {};
329
+ changed = true;
330
+ }
331
+ if (changed) std.mem.sort(Value, c.values.array.data.items, {}, clean_longer_first);
332
+ }
333
+
334
+ pub fn clean_add_util(ctx: *Context, value: []const u8) void {
335
+ clean_add_cfg(clean_config(ctx), value);
336
+ }
337
+
338
+ fn clean_mask_value(c: CleanCfg, value: []const u8) []const u8 {
339
+ if (0 < c.hint and @as(i64, @intCast(value.len)) > 2 * c.hint) {
340
+ const keep: usize = @intCast(c.hint);
341
+ return fmt("{s}{s}", .{ c.mask, value[value.len - keep ..] });
342
+ }
343
+ return c.mask;
344
+ }
345
+
346
+ fn clean_string(c: CleanCfg, text: []const u8) []const u8 {
347
+ var out = text;
348
+ if (c.values != .array) return out;
349
+ for (c.values.array.data.items) |v| {
350
+ if (v != .string or v.string.len == 0) continue;
351
+ if (std.mem.indexOf(u8, out, v.string) != null) {
352
+ out = std.mem.replaceOwned(u8, h.A(), out, v.string, clean_mask_value(c, v.string)) catch out;
182
353
  }
183
354
  }
355
+ return out;
356
+ }
357
+
358
+ fn clean_sensitive_key(c: CleanCfg, key: ?[]const u8) bool {
359
+ const k = key orelse return false;
360
+ if (c.keys != .array) return false;
361
+ const nk = clean_normkey(k);
362
+ for (c.keys.array.data.items) |kv| {
363
+ if (kv == .string and kv.string.len != 0 and std.mem.indexOf(u8, nk, kv.string) != null) return true;
364
+ }
365
+ return false;
366
+ }
367
+
368
+ fn clean_seen(seen: []const usize, id: usize) bool {
369
+ for (seen) |s| {
370
+ if (s == id) return true;
371
+ }
372
+ return false;
373
+ }
374
+
375
+ // A registered value used as a property name is masked like any other
376
+ // string; names that mask alike take a counter, so none is lost.
377
+ fn clean_name(c: CleanCfg, out: Value, key: []const u8) []const u8 {
378
+ const name = clean_string(c, key);
379
+ if (std.mem.eql(u8, name, key) or out.object.get(name) == null) return name;
380
+ var i: usize = 1;
381
+ while (out.object.get(fmt("{s}#{d}", .{ name, i })) != null) i += 1;
382
+ return fmt("{s}#{d}", .{ name, i });
383
+ }
384
+
385
+ // A masked plain-data copy: functions dropped, cycles cut, and nothing
386
+ // shared with the live value, whose spec must stay raw.
387
+ fn clean_snapshot(c: CleanCfg, val: Value, key: ?[]const u8, depth: usize, seen: *std.ArrayList(usize)) Value {
388
+ switch (val) {
389
+ .null => return val,
390
+ .string => |s| return h.vstr(if (clean_sensitive_key(c, key)) clean_mask_value(c, s) else clean_string(c, s)),
391
+ .function => return h.vnull(),
392
+ .bool, .integer, .float, .number_string => return if (clean_sensitive_key(c, key)) h.vstr(c.mask) else val,
393
+ .object => |m| {
394
+ const id = @intFromPtr(m);
395
+ if (CLEAN_MAXDEPTH <= depth or clean_seen(seen.items, id)) return h.vstr(CLEAN_CIRCULAR);
396
+ if (clean_sensitive_key(c, key)) return h.vstr(c.mask);
397
+ seen.append(h.A(), id) catch {};
398
+ defer _ = seen.pop();
399
+ const out = h.omap();
400
+ var it = m.iterator();
401
+ while (it.next()) |kv| {
402
+ if (kv.value_ptr.* == .function) continue;
403
+ const v = clean_snapshot(c, kv.value_ptr.*, kv.key_ptr.*, depth + 1, seen);
404
+ h.setp(out, clean_name(c, out, kv.key_ptr.*), v);
405
+ }
406
+ return out;
407
+ },
408
+ .array => |l| {
409
+ const id = @intFromPtr(l);
410
+ if (CLEAN_MAXDEPTH <= depth or clean_seen(seen.items, id)) return h.vstr(CLEAN_CIRCULAR);
411
+ if (clean_sensitive_key(c, key)) return h.vstr(c.mask);
412
+ seen.append(h.A(), id) catch {};
413
+ defer _ = seen.pop();
414
+ const out = h.olist();
415
+ for (l.data.items) |item| {
416
+ out.array.append(clean_snapshot(c, item, null, depth + 1, seen)) catch {};
417
+ }
418
+ return out;
419
+ },
420
+ }
421
+ }
422
+
423
+ pub fn clean_util(ctx: *Context, val: Value) Value {
424
+ const c = clean_view(clean_config(ctx));
425
+ if (!c.active) return val;
426
+ var seen: std.ArrayList(usize) = .empty;
427
+ return clean_snapshot(c, val, null, 0, &seen);
428
+ }
429
+
430
+ pub fn clean_str_util(ctx: *Context, val: []const u8) []const u8 {
431
+ const c = clean_view(clean_config(ctx));
432
+ if (!c.active) return val;
433
+ return clean_string(c, val);
434
+ }
435
+
436
+ pub fn clean_key_util(ctx: *Context, key: []const u8) bool {
437
+ return clean_sensitive_key(clean_view(clean_config(ctx)), key);
438
+ }
439
+
440
+ // Every scalar under a sensitive name, at any depth and of any shape, is
441
+ // registered: a credential mistyped as a map or a number is still a
442
+ // credential.
443
+ pub fn clean_add_sensitive_cfg(cfg: Value, val: Value) void {
444
+ var seen: std.ArrayList(usize) = .empty;
445
+ clean_add_sensitive_in(cfg, clean_view(cfg), val, false, 0, &seen);
446
+ }
447
+
448
+ pub fn clean_add_sensitive_util(ctx: *Context, val: Value) void {
449
+ clean_add_sensitive_cfg(clean_config(ctx), val);
450
+ }
451
+
452
+ fn clean_add_sensitive_in(cfg: Value, c: CleanCfg, val: Value, under: bool, depth: usize, seen: *std.ArrayList(usize)) void {
453
+ if (CLEAN_MAXDEPTH <= depth) return;
454
+ switch (val) {
455
+ .string, .integer, .float, .number_string => {
456
+ if (under) clean_add_cfg(cfg, h.scalar_str(val));
457
+ },
458
+ .object => |m| {
459
+ const id = @intFromPtr(m);
460
+ if (clean_seen(seen.items, id)) return;
461
+ seen.append(h.A(), id) catch {};
462
+ var it = m.iterator();
463
+ while (it.next()) |kv| {
464
+ const sub = under or clean_sensitive_key(c, kv.key_ptr.*);
465
+ clean_add_sensitive_in(cfg, c, kv.value_ptr.*, sub, depth + 1, seen);
466
+ }
467
+ },
468
+ .array => |l| {
469
+ const id = @intFromPtr(l);
470
+ if (clean_seen(seen.items, id)) return;
471
+ seen.append(h.A(), id) catch {};
472
+ for (l.data.items) |item| clean_add_sensitive_in(cfg, c, item, under, depth + 1, seen);
473
+ },
474
+ else => {},
475
+ }
476
+ }
477
+
478
+ pub fn done_util(ctx: *Context) E!Value {
479
+ clean_explain_util(ctx);
184
480
 
185
481
  if (ctx.result) |res| {
186
482
  if (res.ok) return res.resdata;
@@ -189,6 +485,25 @@ pub fn done_util(ctx: *Context) E!Value {
189
485
  return make_error_util(ctx);
190
486
  }
191
487
 
488
+ // Clean the explain record in place. The caller holds this map, so the
489
+ // masked entries replace its own; with clean off the cleaned record is that
490
+ // map, already current.
491
+ pub fn clean_explain_util(ctx: *Context) void {
492
+ const c = ctx.ctrl;
493
+ if (!c.has_explain()) return;
494
+ const explain = c.explain;
495
+ const cleaned = clean_util(ctx, explain);
496
+ if (cleaned == .object and cleaned.object != explain.object) {
497
+ explain.object.data.clearRetainingCapacity();
498
+ var it = cleaned.object.iterator();
499
+ while (it.next()) |kv| h.setp(explain, kv.key_ptr.*, kv.value_ptr.*);
500
+ }
501
+ // explain.result is a to_value snapshot, never the live result.
502
+ if (h.getp(explain, "result") == .object) {
503
+ h.del_prop(h.to_map(h.getp(explain, "result")), h.vstr("err"));
504
+ }
505
+ }
506
+
192
507
  pub fn make_error_util(ctx: *Context) E!Value {
193
508
  const in_err = ctx.take_err();
194
509
 
@@ -207,19 +522,22 @@ pub fn make_error_util(ctx: *Context) E!Value {
207
522
 
208
523
  const errmsg = the_err.msg;
209
524
  const msg0 = fmt("ProjectNameSDK: {s}: {s}", .{ opname, errmsg });
210
- const msg = clean_str(ctx, msg0);
525
+ const msg = clean_str_util(ctx, msg0);
211
526
 
212
527
  result.err = null;
213
528
 
214
529
  const spec_val: Value = if (ctx.spec) |s| s.to_value() else h.vnull();
215
530
 
531
+ clean_explain_util(ctx);
532
+
216
533
  const c = ctx.ctrl;
217
534
  if (c.has_explain()) {
218
535
  h.setp(c.explain, "err", h.jo(&.{.{ "message", h.vstr(msg) }}));
219
536
  }
220
537
 
221
538
  const sdk_err = err.ProjectNameError.make("", msg);
222
- sdk_err.code = the_err.code;
539
+ // A hook's own error supplies the code as well as the message.
540
+ sdk_err.code = clean_str_util(ctx, the_err.code);
223
541
  sdk_err.result = clean_util(ctx, result.to_value());
224
542
  sdk_err.spec = clean_util(ctx, spec_val);
225
543
 
@@ -304,6 +622,50 @@ fn mo_str_less(_: void, a: []const u8, b: []const u8) bool {
304
622
  return std.mem.order(u8, a, b) == .lt;
305
623
  }
306
624
 
625
+ fn mo_noentity(val: Value) Value {
626
+ if (val != .object) return val;
627
+ const out = h.omap();
628
+ var it = val.object.iterator();
629
+ while (it.next()) |kv| {
630
+ if (!std.mem.eql(u8, kv.key_ptr.*, "entity")) h.setp(out, kv.key_ptr.*, kv.value_ptr.*);
631
+ }
632
+ return out;
633
+ }
634
+
635
+ // The options to scan for secrets. The feature map is keyed by feature
636
+ // names, not field names, so it is scanned as a list: `secrets` must not
637
+ // make every setting of that feature a secret. Entity blocks hold entity
638
+ // settings and seeded records, never a credential, so none is scanned. The
639
+ // raw scan still sees the feature list form, whose entries each carry `name`.
640
+ fn mo_without(opts: Value, keys: []const []const u8) Value {
641
+ const out = h.omap();
642
+ if (opts != .object) return out;
643
+ var it = opts.object.iterator();
644
+ outer: while (it.next()) |kv| {
645
+ const key = kv.key_ptr.*;
646
+ if (std.mem.eql(u8, key, "entity")) continue;
647
+ for (keys) |k| {
648
+ if (std.mem.eql(u8, key, k)) continue :outer;
649
+ }
650
+ const v = kv.value_ptr.*;
651
+ if (std.mem.eql(u8, key, "feature") and (v == .object or v == .array)) {
652
+ const list = h.olist();
653
+ if (v == .object) {
654
+ var fit = v.object.iterator();
655
+ while (fit.next()) |f| list.array.append(mo_noentity(f.value_ptr.*)) catch {};
656
+ } else {
657
+ for (v.array.data.items) |f| list.array.append(mo_noentity(f)) catch {};
658
+ }
659
+ h.setp(out, key, list);
660
+ } else if (std.mem.eql(u8, key, "test")) {
661
+ h.setp(out, key, mo_noentity(v));
662
+ } else {
663
+ h.setp(out, key, v);
664
+ }
665
+ }
666
+ return out;
667
+ }
668
+
307
669
  pub fn make_options_util(ctx: *Context) Value {
308
670
  const options: Value = switch (ctx.options) {
309
671
  .object => ctx.options,
@@ -339,6 +701,26 @@ pub fn make_options_util(ctx: *Context) Value {
339
701
 
340
702
  var opts = h.clone(options);
341
703
 
704
+ const config = ctx.config;
705
+ const cfgopts: Value = switch (h.to_map(h.getp(config, "options"))) {
706
+ .object => h.to_map(h.getp(config, "options")),
707
+ else => h.omap(),
708
+ };
709
+
710
+ // The secret registry exists BEFORE validation, fed from the raw input, so
711
+ // the constructor's own rejection of a mistyped credential is clean too.
712
+ const cfgclean = h.to_map(h.getp(cfgopts, "clean"));
713
+ const rawclean = h.to_map(h.getp(opts, "clean"));
714
+ const cleancfg = make_clean_config(h.merge(h.ja(&.{
715
+ h.omap(),
716
+ h.clone(h.getp(schema.shared_optspec(), "clean")),
717
+ if (cfgclean == .object) h.clone(cfgclean) else h.omap(),
718
+ if (rawclean == .object) h.clone(rawclean) else h.omap(),
719
+ })));
720
+ clean_add_sensitive_cfg(cleancfg, mo_without(opts, &.{"clean"}));
721
+ for (clean_splitvalues(h.getp(cfgclean, "values"))) |raw| clean_add_cfg(cleancfg, raw);
722
+ for (clean_splitvalues(h.getp(rawclean, "values"))) |raw| clean_add_cfg(cleancfg, raw);
723
+
342
724
  if (auth_suppressed) h.del_prop(opts, h.vstr("auth"));
343
725
 
344
726
  // Feature add-order. options.feature may be an ordered list of
@@ -364,12 +746,6 @@ pub fn make_options_util(ctx: *Context) Value {
364
746
  h.setp(opts, "feature", fmap);
365
747
  }
366
748
 
367
- const config = ctx.config;
368
- const cfgopts: Value = switch (h.to_map(h.getp(config, "options"))) {
369
- .object => h.to_map(h.getp(config, "options")),
370
- else => h.omap(),
371
- };
372
-
373
749
  // THE OPTION SPEC IS GENERATED, NOT WRITTEN HERE.
374
750
  //
375
751
  // Built from the model: `main.kit.optspec` for the standard options, plus
@@ -478,20 +854,6 @@ pub fn make_options_util(ctx: *Context) Value {
478
854
  }
479
855
  }
480
856
 
481
- // Derived clean config.
482
- const clean_keys: []const u8 = switch (h.getpath(&.{ "clean", "keys" }, opts)) {
483
- .string => |s| s,
484
- else => "key,token,id",
485
- };
486
-
487
- var parts: std.ArrayList([]const u8) = .empty;
488
- var it = std.mem.splitScalar(u8, clean_keys, ',');
489
- while (it.next()) |p| {
490
- const t = std.mem.trim(u8, p, " \t");
491
- if (t.len != 0) parts.append(h.A(), h.esc_re(t)) catch {};
492
- }
493
- const keyre = std.mem.join(h.A(), "|", parts.items) catch "";
494
-
495
857
  // Resolve the feature add-order: an explicit list order (above) wins;
496
858
  // otherwise order the map test-first, then the remaining names sorted, so
497
859
  // the outcome is deterministic and `test` is always the base transport.
@@ -513,12 +875,14 @@ pub fn make_options_util(ctx: *Context) Value {
513
875
  }
514
876
  }
515
877
 
516
- const derived_clean = if (keyre.len == 0) h.omap() else h.jo(&.{.{ "keyre", h.vstr(keyre) }});
517
878
  h.setp(opts, "__derived__", h.jo(&.{
518
- .{ "clean", derived_clean },
879
+ .{ "clean", cleancfg },
519
880
  .{ "featureorder", feature_order },
520
881
  }));
521
882
 
883
+ // Again over the merged result: the config's own defaults can carry one.
884
+ clean_add_sensitive_cfg(cleancfg, mo_without(opts, &.{ "clean", "__derived__" }));
885
+
522
886
  return opts;
523
887
  }
524
888
 
@@ -73,7 +73,9 @@ pub const AuditFeature = struct {
73
73
  h.setp(record, "correlationId", h.vstr(ctx.id));
74
74
  if (ctx.result) |r| h.setp(record, "status", h.vnum(r.status));
75
75
 
76
- self.records.append(h.A(), record) catch {};
76
+ const out = ctx.util().clean(ctx, record);
77
+
78
+ self.records.append(h.A(), out) catch {};
77
79
  const max: usize = @intCast(@max(sup.fopt_int(self.options, "max", 1000), 0));
78
80
  while (self.records.items.len > max) {
79
81
  _ = self.records.orderedRemove(0);
@@ -81,7 +83,7 @@ pub const AuditFeature = struct {
81
83
 
82
84
  const sink = h.getp(self.options, "sink");
83
85
  if (sink == .function) {
84
- _ = h.call_vfn(sink, record);
86
+ _ = h.call_vfn(sink, out);
85
87
  }
86
88
  }
87
89
 
@@ -415,11 +415,12 @@ fn commit(track: *CostTrack, options: Value, ctx: *Context, pending: Value, enti
415
415
  h.setp(record, "currency", h.vstr(track.currency));
416
416
  h.setp(record, "source", h.vstr(source));
417
417
  h.setp(record, "attempts", h.vfloat(h.get_f64(pending, "attempts") orelse 0));
418
- track.last = record;
418
+ const out = ctx.util().clean(ctx, record);
419
+ track.last = out;
419
420
 
420
421
  const sink = h.getp(options, "sink");
421
422
  if (sink == .function) {
422
- _ = h.call_vfn(sink, record);
423
+ _ = h.call_vfn(sink, out);
423
424
  }
424
425
  }
425
426
 
@@ -1,9 +1,10 @@
1
1
  // Request/response capture for debugging (mirrors go feature/debug_feature.go
2
2
  // / rust feature/debug.rs). Records a bounded ring buffer of per-operation
3
3
  // traces — method, URL, redacted headers, response status and timing — on the
4
- // feature's entries. Sensitive header values (matching `redact`, default
5
- // authorization/cookie/api-key style names) are masked. An optional `onEntry`
6
- // callback receives each finished entry. `max` caps the buffer (default 100).
4
+ // feature's entries. Every entry passes through the SDK's clean rules
5
+ // (clean.keys and every registered secret); the `redact` option ADDS header
6
+ // names on top of them. An optional `onEntry` callback receives each finished
7
+ // entry. `max` caps the buffer (default 100).
7
8
 
8
9
  const std = @import("std");
9
10
  const h = @import("../core/helpers.zig");
@@ -17,16 +18,6 @@ const OutVal = types.OutVal;
17
18
 
18
19
  const DEBUG_ENTRY_KEY: []const u8 = "debug_entry";
19
20
 
20
- const DEBUG_DEFAULT_REDACT = [_][]const u8{
21
- "authorization",
22
- "cookie",
23
- "set-cookie",
24
- "api-key",
25
- "apikey",
26
- "x-api-key",
27
- "idempotency-key",
28
- };
29
-
30
21
  pub const DebugFeature = struct {
31
22
  name: []const u8 = "debug",
32
23
  active: bool = true,
@@ -46,13 +37,11 @@ pub const DebugFeature = struct {
46
37
  return @ptrCast(@alignCast(p));
47
38
  }
48
39
 
49
- fn redact(self: *DebugFeature, headers: Value) Value {
40
+ // The core clean rules apply (clean.keys, every registered value); the
41
+ // feature's own `redact` list ADDS header names on top of them.
42
+ fn redact(self: *DebugFeature, ctx: *Context, headers: Value) Value {
50
43
  const out = h.omap();
51
- const patterns: [][]const u8 = sup.fopt_str_list(self.options, "redact") orelse blk: {
52
- var l: std.ArrayList([]const u8) = .empty;
53
- for (DEBUG_DEFAULT_REDACT) |p| l.append(h.A(), p) catch {};
54
- break :blk l.toOwnedSlice(h.A()) catch &.{};
55
- };
44
+ const patterns: [][]const u8 = sup.fopt_str_list(self.options, "redact") orelse &.{};
56
45
  if (headers == .object) {
57
46
  var it = headers.object.iterator();
58
47
  while (it.next()) |kv| {
@@ -60,19 +49,20 @@ pub const DebugFeature = struct {
60
49
  const lower = std.ascii.allocLowerString(h.A(), key) catch key;
61
50
  var masked = false;
62
51
  for (patterns) |p| {
63
- if (std.mem.eql(u8, lower, p)) {
52
+ const plower = std.ascii.allocLowerString(h.A(), p) catch p;
53
+ if (std.mem.eql(u8, lower, plower)) {
64
54
  masked = true;
65
55
  break;
66
56
  }
67
57
  }
68
58
  if (masked) {
69
- h.setp(out, key, h.vstr("<redacted>"));
59
+ h.setp(out, key, h.vstr("[redacted]"));
70
60
  } else {
71
61
  h.setp(out, key, kv.value_ptr.*);
72
62
  }
73
63
  }
74
64
  }
75
- return out;
65
+ return ctx.util().clean(ctx, out);
76
66
  }
77
67
 
78
68
  fn finish(self: *DebugFeature, ctx: *Context, ok: bool) void {
@@ -92,7 +82,12 @@ pub const DebugFeature = struct {
92
82
  if (ctx.result) |r| h.setp(entry, "status", h.vnum(r.status));
93
83
  }
94
84
 
95
- self.entries.append(h.A(), entry) catch {};
85
+ // The whole entry leaves through the buffer and the callback: the url
86
+ // and the error message can carry a query credential the header mask
87
+ // above never saw.
88
+ const out = ctx.util().clean(ctx, entry);
89
+
90
+ self.entries.append(h.A(), out) catch {};
96
91
  const max: usize = @intCast(@max(sup.fopt_int(self.options, "max", 100), 0));
97
92
  while (self.entries.items.len > max) {
98
93
  _ = self.entries.orderedRemove(0);
@@ -100,7 +95,7 @@ pub const DebugFeature = struct {
100
95
 
101
96
  const on_entry = h.getp(self.options, "onEntry");
102
97
  if (on_entry == .function) {
103
- _ = h.call_vfn(on_entry, entry);
98
+ _ = h.call_vfn(on_entry, out);
104
99
  }
105
100
  }
106
101
 
@@ -120,7 +115,7 @@ pub const DebugFeature = struct {
120
115
  } else {
121
116
  h.setp(entry, "url", h.vstr(sp.path));
122
117
  }
123
- h.setp(entry, "headers", self.redact(sp.headers));
118
+ h.setp(entry, "headers", self.redact(ctx, sp.headers));
124
119
  }
125
120
  ctx.out_set(DEBUG_ENTRY_KEY, OutVal{ .val = entry });
126
121
  }
@@ -46,7 +46,9 @@ pub const LogFeature = struct {
46
46
  else
47
47
  "";
48
48
 
49
- std.debug.print("name=log hook={s} op={s} spec={s}\n", .{ hook, opname, specinfo });
49
+ // A log line leaves the pipeline, so it is cleaned like every record.
50
+ const line = std.fmt.allocPrint(h.A(), "name=log hook={s} op={s} spec={s}", .{ hook, opname, specinfo }) catch "";
51
+ std.debug.print("{s}\n", .{ctx.util().clean_str(ctx, line)});
50
52
  }
51
53
 
52
54
  fn vname(p: *anyopaque) []const u8 {