@voxgig/sdkgen 4.32.0 → 4.33.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 (415) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/helpers/naming.js +1 -1
  3. package/dist/helpers/naming.js.map +1 -1
  4. package/dist/tsconfig.tsbuildinfo +1 -1
  5. package/model/sdkgen.aontu +7 -1
  6. package/package.json +1 -1
  7. package/project/.sdk/model/feature/debug.aontu +3 -1
  8. package/project/.sdk/src/cmp/c/PrepareAuth_c.ts +8 -28
  9. package/project/.sdk/src/cmp/c/TestClean_c.ts +774 -0
  10. package/project/.sdk/src/cmp/c/Test_c.ts +3 -0
  11. package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +16 -5
  12. package/project/.sdk/src/cmp/c/fragment/Main.fragment.c +1 -1
  13. package/project/.sdk/src/cmp/clojure/PrepareAuth_clojure.ts +3 -0
  14. package/project/.sdk/src/cmp/clojure/TestClean_clojure.ts +473 -0
  15. package/project/.sdk/src/cmp/clojure/Test_clojure.ts +6 -0
  16. package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +18 -8
  17. package/project/.sdk/src/cmp/cpp/PrepareAuth_cpp.ts +3 -0
  18. package/project/.sdk/src/cmp/cpp/TestClean_cpp.ts +782 -0
  19. package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +1 -1
  20. package/project/.sdk/src/cmp/cpp/Test_cpp.ts +2 -0
  21. package/project/.sdk/src/cmp/csharp/PrepareAuth_csharp.ts +3 -0
  22. package/project/.sdk/src/cmp/csharp/TestClean_csharp.ts +887 -0
  23. package/project/.sdk/src/cmp/csharp/Test_csharp.ts +2 -0
  24. package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +68 -4
  25. package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +8 -2
  26. package/project/.sdk/src/cmp/csharp/fragment/SdkError.fragment.cs +49 -0
  27. package/project/.sdk/src/cmp/elixir/PrepareAuth_elixir.ts +3 -0
  28. package/project/.sdk/src/cmp/elixir/Schema_elixir.ts +20 -10
  29. package/project/.sdk/src/cmp/elixir/TestClean_elixir.ts +666 -0
  30. package/project/.sdk/src/cmp/elixir/Test_elixir.ts +4 -0
  31. package/project/.sdk/src/cmp/elixir/fragment/Main.fragment.ex +1 -1
  32. package/project/.sdk/src/cmp/elixir/fragment/Pipeline.fragment.ex +14 -2
  33. package/project/.sdk/src/cmp/go/PrepareAuth_go.ts +3 -0
  34. package/project/.sdk/src/cmp/go/TestClean_go.ts +804 -0
  35. package/project/.sdk/src/cmp/go/Test_go.ts +3 -0
  36. package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +54 -4
  37. package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +27 -2
  38. package/project/.sdk/src/cmp/java/PrepareAuth_java.ts +3 -0
  39. package/project/.sdk/src/cmp/java/TestClean_java.ts +884 -0
  40. package/project/.sdk/src/cmp/java/Test_java.ts +2 -0
  41. package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +56 -11
  42. package/project/.sdk/src/cmp/java/fragment/SdkError.fragment.java +36 -3
  43. package/project/.sdk/src/cmp/js/PrepareAuth_js.ts +3 -0
  44. package/project/.sdk/src/cmp/js/TestClean_js.ts +458 -0
  45. package/project/.sdk/src/cmp/js/Test_js.ts +2 -0
  46. package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +5 -4
  47. package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +7 -1
  48. package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +7 -1
  49. package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +7 -1
  50. package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +7 -1
  51. package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +7 -1
  52. package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +11 -2
  53. package/project/.sdk/src/cmp/js/fragment/SdkError.fragment.js +17 -1
  54. package/project/.sdk/src/cmp/kotlin/Package_kotlin.ts +5 -0
  55. package/project/.sdk/src/cmp/kotlin/PrepareAuth_kotlin.ts +3 -0
  56. package/project/.sdk/src/cmp/kotlin/TestClean_kotlin.ts +654 -0
  57. package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +3 -0
  58. package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +44 -11
  59. package/project/.sdk/src/cmp/kotlin/fragment/SdkError.fragment.kt +31 -0
  60. package/project/.sdk/src/cmp/lua/PrepareAuth_lua.ts +3 -0
  61. package/project/.sdk/src/cmp/lua/TestClean_lua.ts +769 -0
  62. package/project/.sdk/src/cmp/lua/Test_lua.ts +3 -0
  63. package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +77 -1
  64. package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +49 -2
  65. package/project/.sdk/src/cmp/ocaml/Entity_ocaml.ts +3 -2
  66. package/project/.sdk/src/cmp/ocaml/PrepareAuth_ocaml.ts +4 -25
  67. package/project/.sdk/src/cmp/ocaml/TestClean_ocaml.ts +538 -0
  68. package/project/.sdk/src/cmp/ocaml/Test_ocaml.ts +5 -0
  69. package/project/.sdk/src/cmp/ocaml/fragment/RunOp.fragment.ml +16 -4
  70. package/project/.sdk/src/cmp/perl/PrepareAuth_perl.ts +3 -0
  71. package/project/.sdk/src/cmp/perl/TestClean_perl.ts +619 -0
  72. package/project/.sdk/src/cmp/perl/Test_perl.ts +3 -0
  73. package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +67 -5
  74. package/project/.sdk/src/cmp/perl/fragment/Main.fragment.pm +13 -1
  75. package/project/.sdk/src/cmp/php/PrepareAuth_php.ts +3 -0
  76. package/project/.sdk/src/cmp/php/TestClean_php.ts +809 -0
  77. package/project/.sdk/src/cmp/php/Test_php.ts +2 -0
  78. package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +96 -55
  79. package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +15 -2
  80. package/project/.sdk/src/cmp/py/PrepareAuth_py.ts +3 -0
  81. package/project/.sdk/src/cmp/py/TestClean_py.ts +549 -0
  82. package/project/.sdk/src/cmp/py/Test_py.ts +3 -0
  83. package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +83 -55
  84. package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +19 -3
  85. package/project/.sdk/src/cmp/rb/PrepareAuth_rb.ts +3 -0
  86. package/project/.sdk/src/cmp/rb/TestClean_rb.ts +535 -0
  87. package/project/.sdk/src/cmp/rb/Test_rb.ts +3 -0
  88. package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +108 -46
  89. package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +12 -1
  90. package/project/.sdk/src/cmp/rust/PrepareAuth_rust.ts +9 -45
  91. package/project/.sdk/src/cmp/rust/TestClean_rust.ts +881 -0
  92. package/project/.sdk/src/cmp/rust/Test_rust.ts +3 -0
  93. package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +14 -6
  94. package/project/.sdk/src/cmp/rust/fragment/Main.fragment.rs +17 -1
  95. package/project/.sdk/src/cmp/rust/fragment/SdkError.fragment.rs +34 -2
  96. package/project/.sdk/src/cmp/scala/PrepareAuth_scala.ts +3 -0
  97. package/project/.sdk/src/cmp/scala/TestClean_scala.ts +608 -0
  98. package/project/.sdk/src/cmp/scala/Test_scala.ts +3 -0
  99. package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +58 -6
  100. package/project/.sdk/src/cmp/swift/PrepareAuth_swift.ts +3 -0
  101. package/project/.sdk/src/cmp/swift/TestClean_swift.ts +671 -0
  102. package/project/.sdk/src/cmp/swift/Test_swift.ts +3 -0
  103. package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +10 -0
  104. package/project/.sdk/src/cmp/swift/fragment/Main.fragment.swift +16 -2
  105. package/project/.sdk/src/cmp/swift/fragment/SdkError.fragment.swift +47 -3
  106. package/project/.sdk/src/cmp/ts/PrepareAuth_ts.ts +3 -0
  107. package/project/.sdk/src/cmp/ts/TestClean_ts.ts +465 -0
  108. package/project/.sdk/src/cmp/ts/Test_ts.ts +2 -0
  109. package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +5 -4
  110. package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +7 -1
  111. package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +7 -1
  112. package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +7 -1
  113. package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +7 -1
  114. package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +7 -1
  115. package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +8 -2
  116. package/project/.sdk/src/cmp/ts/fragment/SdkError.fragment.ts +20 -2
  117. package/project/.sdk/src/cmp/zig/PrepareAuth_zig.ts +3 -0
  118. package/project/.sdk/src/cmp/zig/TestClean_zig.ts +791 -0
  119. package/project/.sdk/src/cmp/zig/Test_zig.ts +5 -0
  120. package/project/.sdk/src/cmp/zig/fragment/Build.fragment.zig +19 -0
  121. package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +14 -5
  122. package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +1 -1
  123. package/project/.sdk/tm/c/core/context.c +25 -0
  124. package/project/.sdk/tm/c/core/error.c +16 -0
  125. package/project/.sdk/tm/c/core/sdk.h +22 -0
  126. package/project/.sdk/tm/c/feature/audit.c +2 -0
  127. package/project/.sdk/tm/c/feature/cost.c +1 -0
  128. package/project/.sdk/tm/c/feature/debug.c +19 -29
  129. package/project/.sdk/tm/c/feature/log.c +21 -2
  130. package/project/.sdk/tm/c/feature/proxy.c +55 -3
  131. package/project/.sdk/tm/c/feature/secrets.c +7 -0
  132. package/project/.sdk/tm/c/feature/telemetry.c +2 -0
  133. package/project/.sdk/tm/c/tests/feature_test.c +2 -2
  134. package/project/.sdk/tm/c/utility/clean.c +530 -8
  135. package/project/.sdk/tm/c/utility/done.c +28 -12
  136. package/project/.sdk/tm/c/utility/make_error.c +4 -3
  137. package/project/.sdk/tm/c/utility/make_options.c +71 -45
  138. package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +15 -0
  139. package/project/.sdk/tm/clojure/src/sdk/client.clj +20 -4
  140. package/project/.sdk/tm/clojure/src/sdk/core.clj +319 -35
  141. package/project/.sdk/tm/clojure/src/sdk/features.clj +68 -30
  142. package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +4 -2
  143. package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +47 -20
  144. package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +4 -0
  145. package/project/.sdk/tm/cpp/core/types.hpp +93 -3
  146. package/project/.sdk/tm/cpp/feature/audit.hpp +1 -0
  147. package/project/.sdk/tm/cpp/feature/cost.hpp +1 -0
  148. package/project/.sdk/tm/cpp/feature/debug.hpp +20 -12
  149. package/project/.sdk/tm/cpp/feature/log.hpp +31 -9
  150. package/project/.sdk/tm/cpp/feature/proxy.hpp +52 -6
  151. package/project/.sdk/tm/cpp/feature/secrets.hpp +13 -0
  152. package/project/.sdk/tm/cpp/feature/telemetry.hpp +4 -2
  153. package/project/.sdk/tm/cpp/test/feature_test.cpp +2 -2
  154. package/project/.sdk/tm/cpp/utility/pipeline.hpp +426 -51
  155. package/project/.sdk/tm/csharp/core/Context.cs +32 -0
  156. package/project/.sdk/tm/csharp/core/Utility.cs +2 -0
  157. package/project/.sdk/tm/csharp/feature/AuditFeature.cs +1 -0
  158. package/project/.sdk/tm/csharp/feature/CostFeature.cs +7 -5
  159. package/project/.sdk/tm/csharp/feature/DebugFeature.cs +19 -16
  160. package/project/.sdk/tm/csharp/feature/FeatureOptions.cs +16 -0
  161. package/project/.sdk/tm/csharp/feature/LogFeature.cs +4 -1
  162. package/project/.sdk/tm/csharp/feature/ProxyFeature.cs +26 -5
  163. package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +16 -0
  164. package/project/.sdk/tm/csharp/feature/TelemetryFeature.cs +4 -2
  165. package/project/.sdk/tm/csharp/test/FeatureTest.cs +2 -2
  166. package/project/.sdk/tm/csharp/utility/Clean.cs +440 -2
  167. package/project/.sdk/tm/csharp/utility/Done.cs +27 -11
  168. package/project/.sdk/tm/csharp/utility/MakeError.cs +19 -8
  169. package/project/.sdk/tm/csharp/utility/MakeOptions.cs +119 -29
  170. package/project/.sdk/tm/csharp/utility/MakeResponse.cs +21 -11
  171. package/project/.sdk/tm/csharp/utility/Register.cs +1 -0
  172. package/project/.sdk/tm/elixir/lib/projectname/context.ex +19 -0
  173. package/project/.sdk/tm/elixir/lib/projectname/entity_base.ex +22 -1
  174. package/project/.sdk/tm/elixir/lib/projectname/error.ex +24 -0
  175. package/project/.sdk/tm/elixir/lib/projectname/feature/audit.ex +2 -2
  176. package/project/.sdk/tm/elixir/lib/projectname/feature/cost.ex +2 -2
  177. package/project/.sdk/tm/elixir/lib/projectname/feature/debug.ex +13 -13
  178. package/project/.sdk/tm/elixir/lib/projectname/feature/log.ex +18 -5
  179. package/project/.sdk/tm/elixir/lib/projectname/feature/proxy.ex +19 -1
  180. package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +15 -0
  181. package/project/.sdk/tm/elixir/lib/projectname/feature/telemetry.ex +4 -2
  182. package/project/.sdk/tm/elixir/lib/projectname/feature.ex +22 -0
  183. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +464 -41
  184. package/project/.sdk/tm/elixir/test/feature_test.exs +3 -2
  185. package/project/.sdk/tm/go/core/context.go +42 -0
  186. package/project/.sdk/tm/go/core/error.go +30 -10
  187. package/project/.sdk/tm/go/core/utility_type.go +2 -0
  188. package/project/.sdk/tm/go/feature/audit_feature.go +1 -0
  189. package/project/.sdk/tm/go/feature/base_feature.go +12 -0
  190. package/project/.sdk/tm/go/feature/cost_feature.go +2 -2
  191. package/project/.sdk/tm/go/feature/debug_feature.go +14 -12
  192. package/project/.sdk/tm/go/feature/log_feature.go +13 -8
  193. package/project/.sdk/tm/go/feature/proxy_feature.go +26 -6
  194. package/project/.sdk/tm/go/feature/secrets_feature.go +19 -0
  195. package/project/.sdk/tm/go/feature/telemetry_feature.go +4 -2
  196. package/project/.sdk/tm/go/test/feature_test.go +2 -2
  197. package/project/.sdk/tm/go/utility/clean.go +585 -2
  198. package/project/.sdk/tm/go/utility/done.go +29 -9
  199. package/project/.sdk/tm/go/utility/make_error.go +51 -16
  200. package/project/.sdk/tm/go/utility/make_options.go +77 -36
  201. package/project/.sdk/tm/go/utility/register.go +12 -0
  202. package/project/.sdk/tm/java/core/Context.java +29 -0
  203. package/project/.sdk/tm/java/core/SdkClient.java +4 -2
  204. package/project/.sdk/tm/java/core/Utility.java +7 -0
  205. package/project/.sdk/tm/java/feature/AuditFeature.java +6 -0
  206. package/project/.sdk/tm/java/feature/CostFeature.java +5 -0
  207. package/project/.sdk/tm/java/feature/DebugFeature.java +25 -14
  208. package/project/.sdk/tm/java/feature/LogFeature.java +11 -4
  209. package/project/.sdk/tm/java/feature/ProxyFeature.java +41 -6
  210. package/project/.sdk/tm/java/feature/SecretsFeature.java +18 -0
  211. package/project/.sdk/tm/java/feature/TelemetryFeature.java +8 -2
  212. package/project/.sdk/tm/java/test/FeatureTest.java +2 -2
  213. package/project/.sdk/tm/java/utility/Clean.java +519 -1
  214. package/project/.sdk/tm/java/utility/Done.java +1 -1
  215. package/project/.sdk/tm/java/utility/MakeError.java +5 -1
  216. package/project/.sdk/tm/java/utility/MakeOptions.java +55 -31
  217. package/project/.sdk/tm/java/utility/Register.java +4 -0
  218. package/project/.sdk/tm/js/src/Context.js +5 -1
  219. package/project/.sdk/tm/js/src/Response.js +14 -1
  220. package/project/.sdk/tm/js/src/feature/audit/AuditFeature.js +2 -2
  221. package/project/.sdk/tm/js/src/feature/cost/CostFeature.js +2 -2
  222. package/project/.sdk/tm/js/src/feature/debug/DebugFeature.js +13 -7
  223. package/project/.sdk/tm/js/src/feature/log/LogFeature.js +9 -5
  224. package/project/.sdk/tm/js/src/feature/proxy/ProxyFeature.js +19 -1
  225. package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +14 -0
  226. package/project/.sdk/tm/js/src/feature/telemetry/TelemetryFeature.js +4 -2
  227. package/project/.sdk/tm/js/src/utility/CleanUtility.js +294 -21
  228. package/project/.sdk/tm/js/src/utility/DoneUtility.js +17 -5
  229. package/project/.sdk/tm/js/src/utility/MakeErrorUtility.js +18 -2
  230. package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +39 -15
  231. package/project/.sdk/tm/js/src/utility/Utility.js +4 -2
  232. package/project/.sdk/tm/js/test/feature/harness.js +11 -1
  233. package/project/.sdk/tm/js/test/feature.test.js +9 -2
  234. package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +25 -0
  235. package/project/.sdk/tm/kotlin/core/Context.kt +19 -0
  236. package/project/.sdk/tm/kotlin/core/SdkClient.kt +9 -2
  237. package/project/.sdk/tm/kotlin/core/Utility.kt +2 -0
  238. package/project/.sdk/tm/kotlin/feature/AuditFeature.kt +11 -9
  239. package/project/.sdk/tm/kotlin/feature/CostFeature.kt +8 -5
  240. package/project/.sdk/tm/kotlin/feature/DebugFeature.kt +15 -22
  241. package/project/.sdk/tm/kotlin/feature/LogFeature.kt +8 -4
  242. package/project/.sdk/tm/kotlin/feature/ProxyFeature.kt +26 -2
  243. package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +11 -0
  244. package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +4 -2
  245. package/project/.sdk/tm/kotlin/test/FeatureTest.kt +2 -2
  246. package/project/.sdk/tm/kotlin/utility/CoreUtil.kt +447 -11
  247. package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +38 -31
  248. package/project/.sdk/tm/kotlin/utility/Register.kt +1 -0
  249. package/project/.sdk/tm/lua/core/context.lua +43 -0
  250. package/project/.sdk/tm/lua/core/error.lua +36 -1
  251. package/project/.sdk/tm/lua/core/utility_type.lua +4 -0
  252. package/project/.sdk/tm/lua/feature/audit_feature.lua +2 -2
  253. package/project/.sdk/tm/lua/feature/cost_feature.lua +2 -2
  254. package/project/.sdk/tm/lua/feature/debug_feature.lua +21 -17
  255. package/project/.sdk/tm/lua/feature/log_feature.lua +2 -1
  256. package/project/.sdk/tm/lua/feature/proxy_feature.lua +23 -1
  257. package/project/.sdk/tm/lua/feature/secrets_feature.lua +18 -0
  258. package/project/.sdk/tm/lua/feature/telemetry_feature.lua +4 -2
  259. package/project/.sdk/tm/lua/test/feature/secrets/secrets_feature_test.lua +3 -2
  260. package/project/.sdk/tm/lua/test/feature_test.lua +10 -3
  261. package/project/.sdk/tm/lua/utility/clean.lua +426 -2
  262. package/project/.sdk/tm/lua/utility/clean_explain.lua +34 -0
  263. package/project/.sdk/tm/lua/utility/done.lua +1 -7
  264. package/project/.sdk/tm/lua/utility/make_error.lua +3 -1
  265. package/project/.sdk/tm/lua/utility/make_options.lua +76 -30
  266. package/project/.sdk/tm/lua/utility/register.lua +4 -1
  267. package/project/.sdk/tm/ocaml/Makefile +5 -1
  268. package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +12 -1
  269. package/project/.sdk/tm/ocaml/sdk_features.ml +78 -18
  270. package/project/.sdk/tm/ocaml/sdk_helpers.ml +27 -0
  271. package/project/.sdk/tm/ocaml/sdk_runtime.ml +304 -26
  272. package/project/.sdk/tm/ocaml/sdk_types.ml +1 -0
  273. package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +3 -1
  274. package/project/.sdk/tm/ocaml/test/t_feature.ml +2 -2
  275. package/project/.sdk/tm/perl/core/context.pm +27 -0
  276. package/project/.sdk/tm/perl/core/error.pm +52 -5
  277. package/project/.sdk/tm/perl/feature/audit_feature.pm +2 -2
  278. package/project/.sdk/tm/perl/feature/cost_feature.pm +2 -2
  279. package/project/.sdk/tm/perl/feature/debug_feature.pm +17 -13
  280. package/project/.sdk/tm/perl/feature/log_feature.pm +3 -1
  281. package/project/.sdk/tm/perl/feature/proxy_feature.pm +21 -1
  282. package/project/.sdk/tm/perl/feature/secrets_feature.pm +20 -1
  283. package/project/.sdk/tm/perl/feature/telemetry_feature.pm +4 -2
  284. package/project/.sdk/tm/perl/t/feature.t +4 -2
  285. package/project/.sdk/tm/perl/utility/clean.pm +345 -1
  286. package/project/.sdk/tm/perl/utility/done.pm +24 -6
  287. package/project/.sdk/tm/perl/utility/make_error.pm +17 -4
  288. package/project/.sdk/tm/perl/utility/make_options.pm +33 -14
  289. package/project/.sdk/tm/php/core/Context.php +24 -1
  290. package/project/.sdk/tm/php/core/Error.php +34 -3
  291. package/project/.sdk/tm/php/core/UtilityType.php +4 -0
  292. package/project/.sdk/tm/php/feature/AuditFeature.php +2 -2
  293. package/project/.sdk/tm/php/feature/CostFeature.php +2 -2
  294. package/project/.sdk/tm/php/feature/DebugFeature.php +18 -9
  295. package/project/.sdk/tm/php/feature/LogFeature.php +5 -2
  296. package/project/.sdk/tm/php/feature/ProxyFeature.php +20 -1
  297. package/project/.sdk/tm/php/feature/SecretsFeature.php +18 -0
  298. package/project/.sdk/tm/php/feature/TelemetryFeature.php +4 -2
  299. package/project/.sdk/tm/php/test/FeatureTest.php +2 -2
  300. package/project/.sdk/tm/php/utility/Clean.php +438 -2
  301. package/project/.sdk/tm/php/utility/Done.php +14 -7
  302. package/project/.sdk/tm/php/utility/MakeError.php +9 -7
  303. package/project/.sdk/tm/php/utility/MakeOptions.php +62 -38
  304. package/project/.sdk/tm/php/utility/Register.php +2 -0
  305. package/project/.sdk/tm/py/pkg/core/context.py +17 -0
  306. package/project/.sdk/tm/py/pkg/core/error.py +42 -1
  307. package/project/.sdk/tm/py/pkg/core/utility_type.py +4 -0
  308. package/project/.sdk/tm/py/pkg/feature/audit_feature.py +2 -2
  309. package/project/.sdk/tm/py/pkg/feature/cost_feature.py +2 -2
  310. package/project/.sdk/tm/py/pkg/feature/debug_feature.py +17 -12
  311. package/project/.sdk/tm/py/pkg/feature/log_feature.py +2 -1
  312. package/project/.sdk/tm/py/pkg/feature/proxy_feature.py +18 -1
  313. package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +12 -0
  314. package/project/.sdk/tm/py/pkg/feature/telemetry_feature.py +4 -2
  315. package/project/.sdk/tm/py/pkg/utility/clean.py +311 -1
  316. package/project/.sdk/tm/py/pkg/utility/done.py +18 -5
  317. package/project/.sdk/tm/py/pkg/utility/make_error.py +9 -6
  318. package/project/.sdk/tm/py/pkg/utility/make_options.py +64 -25
  319. package/project/.sdk/tm/py/pkg/utility/make_response.py +19 -13
  320. package/project/.sdk/tm/py/pkg/utility/register.py +4 -2
  321. package/project/.sdk/tm/py/test/feature_harness.py +4 -0
  322. package/project/.sdk/tm/py/test/test_feature.py +2 -2
  323. package/project/.sdk/tm/py/test/test_primary_utility.py +1 -0
  324. package/project/.sdk/tm/rb/core/context.rb +28 -0
  325. package/project/.sdk/tm/rb/core/error.rb +30 -0
  326. package/project/.sdk/tm/rb/core/utility_type.rb +1 -1
  327. package/project/.sdk/tm/rb/feature/audit_feature.rb +2 -2
  328. package/project/.sdk/tm/rb/feature/cost_feature.rb +2 -2
  329. package/project/.sdk/tm/rb/feature/debug_feature.rb +15 -12
  330. package/project/.sdk/tm/rb/feature/log_feature.rb +3 -1
  331. package/project/.sdk/tm/rb/feature/proxy_feature.rb +25 -1
  332. package/project/.sdk/tm/rb/feature/secrets_feature.rb +17 -0
  333. package/project/.sdk/tm/rb/feature/telemetry_feature.rb +4 -2
  334. package/project/.sdk/tm/rb/test/feature_test.rb +4 -2
  335. package/project/.sdk/tm/rb/utility/clean.rb +312 -1
  336. package/project/.sdk/tm/rb/utility/done.rb +15 -5
  337. package/project/.sdk/tm/rb/utility/make_error.rb +13 -4
  338. package/project/.sdk/tm/rb/utility/make_options.rb +31 -12
  339. package/project/.sdk/tm/rb/utility/register.rb +2 -0
  340. package/project/.sdk/tm/rust/core/context.rs +55 -0
  341. package/project/.sdk/tm/rust/core/utility_type.rs +17 -0
  342. package/project/.sdk/tm/rust/feature/audit.rs +2 -0
  343. package/project/.sdk/tm/rust/feature/cost.rs +3 -2
  344. package/project/.sdk/tm/rust/feature/debug.rs +16 -16
  345. package/project/.sdk/tm/rust/feature/log.rs +42 -7
  346. package/project/.sdk/tm/rust/feature/proxy.rs +48 -2
  347. package/project/.sdk/tm/rust/feature/secrets.rs +12 -0
  348. package/project/.sdk/tm/rust/feature/telemetry.rs +2 -0
  349. package/project/.sdk/tm/rust/tests/feature_test.rs +2 -2
  350. package/project/.sdk/tm/rust/utility/clean.rs +446 -5
  351. package/project/.sdk/tm/rust/utility/done.rs +22 -12
  352. package/project/.sdk/tm/rust/utility/make_error.rs +4 -1
  353. package/project/.sdk/tm/rust/utility/make_options.rs +73 -19
  354. package/project/.sdk/tm/scala/Makefile +3 -1
  355. package/project/.sdk/tm/scala/core/Context.scala +16 -0
  356. package/project/.sdk/tm/scala/core/SdkClient.scala +14 -4
  357. package/project/.sdk/tm/scala/core/SdkError.scala +28 -0
  358. package/project/.sdk/tm/scala/core/Types.scala +3 -0
  359. package/project/.sdk/tm/scala/core/Utility.scala +2 -0
  360. package/project/.sdk/tm/scala/feature/AuditFeature.scala +16 -10
  361. package/project/.sdk/tm/scala/feature/CostFeature.scala +10 -5
  362. package/project/.sdk/tm/scala/feature/DebugFeature.scala +24 -21
  363. package/project/.sdk/tm/scala/feature/LogFeature.scala +9 -4
  364. package/project/.sdk/tm/scala/feature/ProxyFeature.scala +23 -2
  365. package/project/.sdk/tm/scala/feature/SecretsFeature.scala +14 -0
  366. package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +9 -2
  367. package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +2 -2
  368. package/project/.sdk/tm/scala/utility/Make.scala +63 -20
  369. package/project/.sdk/tm/scala/utility/Misc.scala +358 -5
  370. package/project/.sdk/tm/scala/utility/Register.scala +1 -0
  371. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +29 -0
  372. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Utility.swift +2 -0
  373. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +10 -9
  374. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/CostFeature.swift +7 -5
  375. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/DebugFeature.swift +19 -15
  376. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/FeatureOptions.swift +16 -0
  377. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/LogFeature.swift +4 -1
  378. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/ProxyFeature.swift +20 -5
  379. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/SecretsFeature.swift +13 -0
  380. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +4 -2
  381. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeError.swift +15 -5
  382. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +58 -19
  383. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Register.swift +1 -0
  384. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +391 -4
  385. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +2 -2
  386. package/project/.sdk/tm/ts/src/Context.ts +5 -1
  387. package/project/.sdk/tm/ts/src/Response.ts +14 -1
  388. package/project/.sdk/tm/ts/src/feature/audit/AuditFeature.ts +2 -2
  389. package/project/.sdk/tm/ts/src/feature/cost/CostFeature.ts +2 -2
  390. package/project/.sdk/tm/ts/src/feature/debug/DebugFeature.ts +13 -7
  391. package/project/.sdk/tm/ts/src/feature/log/LogFeature.ts +9 -5
  392. package/project/.sdk/tm/ts/src/feature/proxy/ProxyFeature.ts +19 -1
  393. package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +12 -0
  394. package/project/.sdk/tm/ts/src/feature/telemetry/TelemetryFeature.ts +4 -2
  395. package/project/.sdk/tm/ts/src/utility/CleanUtility.ts +287 -9
  396. package/project/.sdk/tm/ts/src/utility/DoneUtility.ts +18 -5
  397. package/project/.sdk/tm/ts/src/utility/MakeErrorUtility.ts +18 -8
  398. package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +38 -16
  399. package/project/.sdk/tm/ts/src/utility/Utility.ts +4 -2
  400. package/project/.sdk/tm/ts/test/feature/harness.ts +11 -1
  401. package/project/.sdk/tm/ts/test/feature.test.ts +9 -2
  402. package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +25 -0
  403. package/project/.sdk/tm/zig/core/context.zig +34 -0
  404. package/project/.sdk/tm/zig/core/error.zig +22 -1
  405. package/project/.sdk/tm/zig/core/utility.zig +403 -39
  406. package/project/.sdk/tm/zig/feature/audit.zig +4 -2
  407. package/project/.sdk/tm/zig/feature/cost.zig +3 -2
  408. package/project/.sdk/tm/zig/feature/debug.zig +20 -25
  409. package/project/.sdk/tm/zig/feature/log.zig +3 -1
  410. package/project/.sdk/tm/zig/feature/proxy.zig +47 -6
  411. package/project/.sdk/tm/zig/feature/secrets.zig +7 -0
  412. package/project/.sdk/tm/zig/feature/telemetry.zig +4 -2
  413. package/project/.sdk/tm/zig/test/feature_test.zig +2 -2
  414. package/project/sdkgen-package.json +1 -1
  415. package/src/helpers/naming.ts +1 -1
@@ -269,34 +269,61 @@
269
269
  (t/is-deep (vec (vs/getpath o "__derived__.featureorder")) ["cache" "retry"] "sorted")))))
270
270
 
271
271
  ;; ---- prepare-auth ----
272
- (let [auth-ctx (fn [opts headers]
272
+ ;; The credential's container and name are this API's own, so the cases
273
+ ;; read them from a probe run. A nil probe means a public API. `basic`
274
+ ;; is false so an HTTP Basic SDK places the key as it is.
275
+ (let [auth-ctx (fn [opts spec]
273
276
  (let [c (fake-client-opts opts)
274
277
  ctx (core/make-context (vs/jm "client" c "utility" utility "opname" "load") nil)]
275
- (core/oset! ctx :spec (when headers (core/make-spec (vs/jm "headers" headers "step" "s"))))
276
- ctx))]
278
+ (core/oset! ctx :spec spec)
279
+ ctx))
280
+ auth (fn [prefix] (vs/jm "prefix" prefix "basic" false))
281
+ bags (fn [] (core/make-spec (vs/jm "headers" (vs/jm) "query" (vs/jm) "step" "s")))
282
+ bag (fn [spec where] (core/oget spec (if (= "query" where) :query :headers)))
283
+ ;; A cookie credential rides the header bag as `<scheme>=K`.
284
+ cookie-pair? (fn [v] (and (string? v) (some? (re-matches #"[^=;]+=K" v))))
285
+ probe (fn [opts]
286
+ (let [spec (bags) ctx (auth-ctx opts spec)]
287
+ ((core/uget ctx :prepare-auth) ctx)
288
+ (some (fn [where]
289
+ (when-let [name (first (vs/keysof (bag spec where)))]
290
+ (let [value (mget (bag spec where) name)]
291
+ {:where where :name name :value value
292
+ :pair (if (and (= "headers" where) (= "cookie" name) (cookie-pair? value))
293
+ (subs value 0 (dec (count value))) "")})))
294
+ ["headers" "query"])))
295
+ cred (probe (vs/jm "apikey" "K" "auth" (auth "Bearer")))
296
+ placed (fn [opts seed]
297
+ (let [spec (bags)]
298
+ (when (and cred seed)
299
+ (.put ^java.util.Map (bag spec (:where cred)) (:name cred) (str (:pair cred) seed)))
300
+ (let [ctx (auth-ctx opts spec)]
301
+ ((core/uget ctx :prepare-auth) ctx)
302
+ (when cred (mget (bag spec (:where cred)) (:name cred))))))]
277
303
  (chk "auth-guards-missing-spec"
278
- (fn [] (let [ctx (auth-ctx (vs/jm "auth" (vs/jm "prefix" "") "apikey" "K") nil)]
304
+ (fn [] (let [ctx (auth-ctx (vs/jm "auth" (auth "") "apikey" "K") nil)]
279
305
  (t/is-eq (:code (second ((core/uget ctx :prepare-auth) ctx))) "auth_no_spec" "no spec"))))
280
- (chk "auth-apikey-with-prefix-space-joined"
281
- (fn [] (let [ctx (auth-ctx (vs/jm "apikey" "K" "auth" (vs/jm "prefix" "Bearer")) (vs/jm))]
282
- ((core/uget ctx :prepare-auth) ctx)
283
- (t/is-eq (mget (core/oget (core/oget ctx :spec) :headers) "authorization") "Bearer K" "joined"))))
306
+ ;; Without this every case below could pass on the public-API path.
307
+ (chk "auth-probe-finds-the-credential"
308
+ (fn [] (t/is-eq (some? cred)
309
+ (some? (probe (vs/jm "apikey" "K" "secret" "S"
310
+ "auth" (vs/jm "prefix" "Bearer" "basic" true))))
311
+ "probe")))
312
+ (chk "auth-apikey-placed-where-this-api-puts-it"
313
+ (fn [] (cond
314
+ (nil? cred) (t/is-nil (placed (vs/jm "apikey" "K" "auth" (auth "Bearer")) nil) "public API")
315
+ (not= "" (:pair cred)) (t/is-true (cookie-pair? (:value cred)) (str "cookie: " (:value cred)))
316
+ ;; A query parameter has nowhere to put a scheme name.
317
+ :else (t/is-eq (:value cred) (if (= "query" (:where cred)) "K" "Bearer K") "placed"))))
284
318
  (chk "auth-raw-apikey"
285
- (fn [] (let [ctx (auth-ctx (vs/jm "apikey" "K" "auth" (vs/jm "prefix" "")) (vs/jm))]
286
- ((core/uget ctx :prepare-auth) ctx)
287
- (t/is-eq (mget (core/oget (core/oget ctx :spec) :headers) "authorization") "K" "raw"))))
319
+ (fn [] (t/is-eq (placed (vs/jm "apikey" "K" "auth" (auth "")) nil)
320
+ (when cred (str (:pair cred) "K")) "raw")))
288
321
  (chk "auth-empty-apikey-drops"
289
- (fn [] (let [ctx (auth-ctx (vs/jm "apikey" "" "auth" (vs/jm "prefix" "Bearer")) (vs/jm "authorization" "stale"))]
290
- ((core/uget ctx :prepare-auth) ctx)
291
- (t/is-nil (mget (core/oget (core/oget ctx :spec) :headers) "authorization") "dropped"))))
322
+ (fn [] (t/is-nil (placed (vs/jm "apikey" "" "auth" (auth "Bearer")) "stale") "dropped")))
292
323
  (chk "auth-public-api-drops"
293
- (fn [] (let [ctx (auth-ctx (vs/jm "apikey" "K") (vs/jm "authorization" "stale"))]
294
- ((core/uget ctx :prepare-auth) ctx)
295
- (t/is-nil (mget (core/oget (core/oget ctx :spec) :headers) "authorization") "dropped"))))
324
+ (fn [] (t/is-nil (placed (vs/jm "apikey" "K") "stale") "dropped")))
296
325
  (chk "auth-missing-apikey-drops"
297
- (fn [] (let [ctx (auth-ctx (vs/jm "auth" (vs/jm "prefix" "Bearer")) (vs/jm "authorization" "stale"))]
298
- ((core/uget ctx :prepare-auth) ctx)
299
- (t/is-nil (mget (core/oget (core/oget ctx :spec) :headers) "authorization") "dropped")))))
326
+ (fn [] (t/is-nil (placed (vs/jm "auth" (auth "Bearer")) "stale") "dropped"))))
300
327
 
301
328
  ;; ---- result helpers ----
302
329
  (chk "result-headers-non-hash-empty"
@@ -10,6 +10,7 @@
10
10
  [sdk.test.netsim :as netsim]
11
11
  [sdk.test.struct-corpus :as corpus]
12
12
  [sdk.test.omni-smoke :as omnismoke]
13
+ [sdk.test.clean :as clean]
13
14
  [sdk.gentest :as gentest]
14
15
  [clojure.java.io :as io]))
15
16
 
@@ -111,6 +112,9 @@
111
112
  (run-feature-suites rec)
112
113
  (netsim/run rec)
113
114
  (gentest/run rec)
115
+ ;; The canary sweep (generated: sdk/test/clean.clj) prints its own
116
+ ;; `clean: swept N surface(s), M leak(s)` line, which sdkgen's lane reads.
117
+ (clean/run rec)
114
118
  (let [fails (filter (complement :ok) @results)
115
119
  np (count (filter :ok @results))
116
120
  nf (count fails)]
@@ -14,6 +14,7 @@
14
14
  #include <functional>
15
15
  #include <map>
16
16
  #include <memory>
17
+ #include <ostream>
17
18
  #include <stdexcept>
18
19
  #include <string>
19
20
  #include <vector>
@@ -80,17 +81,42 @@ public:
80
81
  std::string sdk = "ProjectName";
81
82
  std::string code;
82
83
  std::string msg;
84
+ // Reachable for a debugger, never printed: the context holds the live
85
+ // spec and options, and an error is what gets logged (ADR-003).
83
86
  Context* ctx = nullptr;
84
- ResultPtr result_obj;
85
- SpecPtr spec_obj;
87
+ int status = -1;
88
+ // Masked plain-data copies, never the live Result/Spec: masking them can
89
+ // never mask the pipeline's own request.
90
+ Value result = Value::undef();
91
+ Value spec = Value::undef();
86
92
 
87
93
  SdkError(const std::string& code_, const std::string& msg_, Context* ctx_)
88
94
  : std::runtime_error(msg_), code(code_), msg(msg_), ctx(ctx_) {}
89
95
 
90
96
  const char* what() const noexcept override { return msg.c_str(); }
91
97
  const std::string& getMessage() const { return msg; }
98
+ bool notFound() const { return 404 == status; }
99
+
100
+ // What makeError attached is already cleaned; the context is not part of
101
+ // the record.
102
+ Value toValue() const {
103
+ Value o = vmap();
104
+ map_put(o, "sdk", Value(sdk));
105
+ map_put(o, "code", Value(code));
106
+ map_put(o, "message", Value(msg));
107
+ map_put(o, "status", Value(status));
108
+ if (!result.is_undef()) map_put(o, "result", result);
109
+ if (!spec.is_undef()) map_put(o, "spec", spec);
110
+ return o;
111
+ }
112
+
113
+ std::string to_string() const { return sdk + "Error " + vs::jsonify(toValue(), 0); }
92
114
  };
93
115
 
116
+ inline std::ostream& operator<<(std::ostream& os, const SdkError& err) {
117
+ return os << err.to_string();
118
+ }
119
+
94
120
  // ---- Control ----------------------------------------------------------
95
121
 
96
122
  class Control {
@@ -461,15 +487,28 @@ public:
461
487
 
462
488
  SdkErrorPtr makeError(const std::string& code, const std::string& msg);
463
489
 
490
+ // The raw record, for the pipeline's own use.
491
+ Value toValue() const;
492
+
493
+ // The serialised context leaves the pipeline (a logger, an error dump), so
494
+ // it is cleaned; the live fields stay raw.
495
+ std::string to_string() const;
496
+
464
497
  private:
465
498
  OperationPtr resolveOp(const std::string& opname);
466
499
  };
467
500
 
501
+ inline std::ostream& operator<<(std::ostream& os, const Context& ctx) {
502
+ return os << ctx.to_string();
503
+ }
504
+
468
505
  // ---- Utility (swappable pipeline function bundle) ---------------------
469
506
 
470
507
  class Utility {
471
508
  public:
472
509
  std::function<Value(CtxPtr, const Value&)> clean;
510
+ std::function<void(CtxPtr, const Value&)> cleanAdd;
511
+ std::function<void(CtxPtr)> cleanExplain;
473
512
  std::function<Value(CtxPtr)> done;
474
513
  std::function<Value(CtxPtr, SdkErrorPtr)> makeError;
475
514
  std::function<void(CtxPtr, FeaturePtr)> featureAdd;
@@ -512,6 +551,8 @@ public:
512
551
  UtilityPtr copy() const {
513
552
  auto u = std::shared_ptr<Utility>(new Utility(NoRegister{}));
514
553
  u->clean = clean;
554
+ u->cleanAdd = cleanAdd;
555
+ u->cleanExplain = cleanExplain;
515
556
  u->done = done;
516
557
  u->makeError = makeError;
517
558
  u->featureAdd = featureAdd;
@@ -569,6 +610,9 @@ public:
569
610
  UtilityPtr getUtility();
570
611
  CtxPtr getRootCtx() { return rootctx; }
571
612
 
613
+ // The options hold the credential; the printed client names itself only.
614
+ std::string to_string() const { return "ProjectNameSDK{mode=" + mode + "}"; }
615
+
572
616
  Value prepare(const Value& fetchargs);
573
617
  Value direct(const Value& fetchargs);
574
618
  Value graphql(const std::string& query, const Value& variables = Value::undef(),
@@ -584,6 +628,10 @@ public:
584
628
  static Value testOptions(const Value& testopts, const Value& sdkopts);
585
629
  };
586
630
 
631
+ inline std::ostream& operator<<(std::ostream& os, const SdkClient& client) {
632
+ return os << client.to_string();
633
+ }
634
+
587
635
  // ---- SdkEntity contract -----------------------------------------------
588
636
 
589
637
  class SdkEntity;
@@ -782,6 +830,40 @@ inline SdkErrorPtr Context::makeError(const std::string& code, const std::string
782
830
  return std::make_shared<SdkError>(code, msg, this);
783
831
  }
784
832
 
833
+ inline Value Context::toValue() const {
834
+ Value o = vmap();
835
+ map_put(o, "id", Value(id));
836
+ if (op) {
837
+ map_put(o, "op", vmap({{"entity", Value(op->entity)}, {"name", Value(op->name)},
838
+ {"input", Value(op->input)}}));
839
+ }
840
+ if (spec) map_put(o, "spec", spec->toValue());
841
+ if (entity) map_put(o, "entity", Value(entity->getName()));
842
+ if (result) map_put(o, "result", result->toValue());
843
+ if (response) {
844
+ Value r = vmap();
845
+ map_put(r, "status", Value(response->status));
846
+ map_put(r, "statusText", Value(response->statusText));
847
+ if (response->headers.is_map()) map_put(r, "headers", response->headers);
848
+ if (!response->body.is_undef()) map_put(r, "body", response->body);
849
+ if (response->err) map_put(r, "err", vmap({{"message", Value(response->err->msg)}}));
850
+ map_put(o, "response", r);
851
+ }
852
+ if (meta.is_map()) map_put(o, "meta", meta);
853
+ return o;
854
+ }
855
+
856
+ inline std::string Context::to_string() const {
857
+ Value record = toValue();
858
+ if (utility && utility->clean) {
859
+ // clean takes the context by shared pointer; the record is what it reads
860
+ // the configuration from, so a non-owning alias is enough here.
861
+ CtxPtr self(const_cast<Context*>(this), [](Context*) {});
862
+ record = utility->clean(self, record);
863
+ }
864
+ return "Context " + vs::jsonify(record, 0);
865
+ }
866
+
785
867
  // ---- SdkClient ----
786
868
  inline SdkClient::SdkClient(const Value& options_) {
787
869
  utility = std::make_shared<Utility>();
@@ -1012,7 +1094,7 @@ inline Value SdkClient::rawRequest(const Value& fetchargs_) {
1012
1094
  fetched = u->fetcher(ctx, url.is_string() ? url.as_string() : "", fetchdef);
1013
1095
  } catch (const SdkErrorPtr& err) {
1014
1096
  map_put(out, "ok", Value(false));
1015
- map_put(out, "err", vmap({{"message", Value(err->msg)}}));
1097
+ map_put(out, "err", vmap({{"message", u->clean(ctx, Value(err->msg))}}));
1016
1098
  return out;
1017
1099
  }
1018
1100
 
@@ -1138,6 +1220,9 @@ inline Value EntityBase::runOp(CtxPtr ctx, const std::function<void()>& postDone
1138
1220
  } catch (const SdkErrorPtr& err) {
1139
1221
  if (ctx->ctrl->err && err == ctx->ctrl->err) throw;
1140
1222
  return u->makeError(ctx, err);
1223
+ } catch (const std::exception& e) {
1224
+ // An exception a hook threw never passed through makeError.
1225
+ return u->makeError(ctx, ctx->makeError("unexpected", e.what()));
1141
1226
  }
1142
1227
  }
1143
1228
 
@@ -1197,6 +1282,8 @@ inline std::vector<Value> EntityBase::stream(const std::string& action,
1197
1282
  // back to the materialised items so stream always yields.
1198
1283
  ResultPtr res = ctx->result;
1199
1284
  if (res && res->stream) {
1285
+ // done() does not run on this path, so its record is cleaned here.
1286
+ u->cleanExplain(ctx);
1200
1287
  return res->stream();
1201
1288
  }
1202
1289
 
@@ -1212,6 +1299,9 @@ inline std::vector<Value> EntityBase::stream(const std::string& action,
1212
1299
  if (ctx->ctrl->err && err == ctx->ctrl->err) throw;
1213
1300
  u->makeError(ctx, err);
1214
1301
  return std::vector<Value>();
1302
+ } catch (const std::exception& e) {
1303
+ u->makeError(ctx, ctx->makeError("unexpected", e.what()));
1304
+ return std::vector<Value>();
1215
1305
  }
1216
1306
  }
1217
1307
 
@@ -87,6 +87,7 @@ private:
87
87
  if (ctx->result) {
88
88
  map_put(record, "status", Value(ctx->result->status));
89
89
  }
90
+ record = ctx->utility->clean(ctx, record);
90
91
 
91
92
  records.as_list()->push_back(record);
92
93
  int max = fopt::foptInt(options, "max", 1000);
@@ -223,6 +223,7 @@ private:
223
223
  map_put(record, "currency", Value(currency));
224
224
  map_put(record, "source", Value(source));
225
225
  map_put(record, "attempts", Value(p.attempts));
226
+ record = ctx->utility->clean(ctx, record);
226
227
  last = record;
227
228
 
228
229
  Value sink = getp(options, "sink");
@@ -1,10 +1,11 @@
1
1
  // ProjectName SDK — debug feature (mirrors java feature/DebugFeature.java).
2
2
  // Request/response capture for debugging. Records a bounded ring buffer of
3
3
  // per-operation traces — method, URL, redacted headers, response status and
4
- // timing — on the feature's entries. Sensitive header values (matching
5
- // `redact`) are masked. An optional `onEntry` callback receives each finished
6
- // entry. `max` caps the buffer (default 100). The per-context entry marker
7
- // (java ctx.out) is kept here keyed by ctx.id.
4
+ // timing — on the feature's entries. The SDK's own clean rules apply to the
5
+ // whole entry; the `redact` option ADDS header names on top of them. An
6
+ // optional `onEntry` callback receives each finished entry. `max` caps the
7
+ // buffer (default 100). The per-context entry marker (java ctx.out) is kept
8
+ // here keyed by ctx.id.
8
9
 
9
10
  #ifndef SDK_FEATURE_DEBUG_HPP
10
11
  #define SDK_FEATURE_DEBUG_HPP
@@ -56,7 +57,7 @@ public:
56
57
  } else {
57
58
  map_put(entry, "url", Value(ctx->spec->path));
58
59
  }
59
- map_put(entry, "headers", redact(ctx->spec->headers));
60
+ map_put(entry, "headers", redact(ctx, ctx->spec->headers));
60
61
  }
61
62
  pending[ctx->id] = entry;
62
63
  }
@@ -110,6 +111,11 @@ private:
110
111
  map_put(entry, "status", Value(ctx->result->status));
111
112
  }
112
113
 
114
+ // The whole entry leaves through the buffer and the callback: the url
115
+ // and the error message can carry a query credential the header mask
116
+ // above never saw.
117
+ entry = ctx->utility->clean(ctx, entry);
118
+
113
119
  entries.as_list()->push_back(entry);
114
120
  int max = fopt::foptInt(options, "max", 100);
115
121
  while ((int) entries.as_list()->size() > max) {
@@ -123,14 +129,16 @@ private:
123
129
  }
124
130
  }
125
131
 
126
- Value redact(const Value& headers) {
132
+ // The core clean rules apply (clean.keys, every registered value); the
133
+ // feature's own `redact` list ADDS header names on top of them.
134
+ Value redact(CtxPtr ctx, const Value& headers) {
127
135
  Value out = vmap();
128
136
  if (!headers.is_map()) return out;
129
137
 
130
- std::vector<std::string> patterns = fopt::foptStrList(options, "redact");
131
- if (!fopt::foptList(options, "redact").is_list()) {
132
- patterns = {"authorization", "cookie", "set-cookie", "api-key",
133
- "apikey", "x-api-key", "idempotency-key"};
138
+ std::vector<std::string> patterns;
139
+ for (std::string p : fopt::foptStrList(options, "redact")) {
140
+ for (auto& c : p) c = static_cast<char>(std::tolower((unsigned char)c));
141
+ patterns.push_back(p);
134
142
  }
135
143
  for (const auto& kv : *headers.as_map()) {
136
144
  std::string lk = kv.first;
@@ -143,12 +151,12 @@ private:
143
151
  }
144
152
  }
145
153
  if (masked) {
146
- map_put(out, kv.first, Value("<redacted>"));
154
+ map_put(out, kv.first, Value("[redacted]"));
147
155
  } else {
148
156
  map_put(out, kv.first, kv.second);
149
157
  }
150
158
  }
151
- return out;
159
+ return ctx->utility->clean(ctx, out);
152
160
  }
153
161
  };
154
162
 
@@ -1,9 +1,10 @@
1
1
  // ProjectName SDK — log feature (mirrors java feature/LogFeature.java).
2
2
  // Hook logging. The java donor uses java.util.logging; the C++ target has no
3
3
  // such facility, so this emits the same "hook=… op=… spec=…" lines to
4
- // std::cerr, gated by a level threshold. Active by default (like the java
5
- // donor: the constructor sets active=true and init only overrides it when
6
- // options.active is an explicit boolean).
4
+ // std::cerr, gated by a level threshold, unless the `logger` option names a
5
+ // callable, which then receives [level, record] for every line instead.
6
+ // Active by default (like the java donor: the constructor sets active=true
7
+ // and init only overrides it when options.active is an explicit boolean).
7
8
 
8
9
  #ifndef SDK_FEATURE_LOG_HPP
9
10
  #define SDK_FEATURE_LOG_HPP
@@ -36,6 +37,7 @@ public:
36
37
 
37
38
  if (active) {
38
39
  hasLogger = true;
40
+ logger = getp(options, "logger");
39
41
  Value lvl = getp(options, "level");
40
42
  if (lvl.is_string()) {
41
43
  std::string s = lvl.as_string();
@@ -62,15 +64,16 @@ public:
62
64
  void preResult(CtxPtr ctx) override { loghook("PreResult", ctx, ""); }
63
65
 
64
66
  private:
67
+ Value logger = Value::undef();
68
+
69
+ // A log line leaves the pipeline, so it carries the cleaned record: the
70
+ // spec after auth holds the credential, and a logger serialises whatever
71
+ // it is handed.
65
72
  void loghook(const std::string& hook, CtxPtr ctx, std::string level) {
66
73
  if (!hasLogger) return;
67
74
 
68
75
  if (level.empty()) level = "info";
69
76
 
70
- std::string msg = "hook=" + hook;
71
- if (ctx->op) msg += " op=" + ctx->op->name;
72
- if (ctx->spec) msg += " spec=" + ctx->spec->method + " " + ctx->spec->path;
73
-
74
77
  // The per-call level (always "info" here) is emitted iff it clears the
75
78
  // configured threshold (mirrors Logger.info() vs Logger.setLevel()).
76
79
  int callLevel = 800;
@@ -79,9 +82,28 @@ private:
79
82
  else if (level == "warn") { callLevel = 900; tag = "WARNING"; }
80
83
  else if (level == "error") { callLevel = 1000; tag = "SEVERE"; }
81
84
 
82
- if (callLevel >= levelThreshold) {
83
- std::cerr << "ProjectNameSDK.log " << tag << ": " << msg << "\n";
85
+ if (callLevel < levelThreshold) return;
86
+
87
+ Value record = vmap();
88
+ map_put(record, "hook", Value(hook));
89
+ if (ctx->op) map_put(record, "op", Value(ctx->op->name));
90
+ if (ctx->spec) map_put(record, "spec", ctx->spec->toValue());
91
+ map_put(record, "ctx", ctx->toValue());
92
+ record = ctx->utility->clean(ctx, record);
93
+
94
+ if (logger.is_injector()) {
95
+ vs::Injection inj(Value::undef(), Value::undef());
96
+ logger.as_injector()(inj, vlist({Value(level), record}), std::string(""), Value::undef());
97
+ return;
98
+ }
99
+
100
+ std::string msg = "hook=" + hook;
101
+ if (ctx->op) msg += " op=" + ctx->op->name;
102
+ if (ctx->spec) {
103
+ Value spec = getp(record, "spec");
104
+ msg += " spec=" + as_str(getp(spec, "method")) + " " + as_str(getp(spec, "path"));
84
105
  }
106
+ std::cerr << "ProjectNameSDK.log " << tag << ": " << msg << "\n";
85
107
  }
86
108
  };
87
109
 
@@ -8,6 +8,7 @@
8
8
  #ifndef SDK_FEATURE_PROXY_HPP
9
9
  #define SDK_FEATURE_PROXY_HPP
10
10
 
11
+ #include <cctype>
11
12
  #include <cstdlib>
12
13
  #include <initializer_list>
13
14
  #include <regex>
@@ -26,7 +27,9 @@ public:
26
27
  Value options = Value::undef();
27
28
  std::vector<std::string> noProxy;
28
29
 
29
- // Activity tracking (mirrors the ts client._proxy record).
30
+ // Activity tracking (mirrors the ts client._proxy record). `url` is the
31
+ // CLEANED target: the raw one, userinfo included, stays in target_ for
32
+ // routing.
30
33
  int routed = 0;
31
34
  std::string url = "";
32
35
 
@@ -38,13 +41,13 @@ public:
38
41
  active = fopt::foptBool(options, "active", false);
39
42
  if (!active) return;
40
43
 
41
- url = fopt::foptStr(options, "url", "");
44
+ target_ = fopt::foptStr(options, "url", "");
42
45
  bool hasNoProxy = fopt::foptList(options, "noProxy").is_list();
43
46
  std::vector<std::string> noProxyRaw = fopt::foptStrList(options, "noProxy");
44
47
 
45
48
  if (fopt::foptBool(options, "fromEnv", false)) {
46
- if (url.empty()) {
47
- url = firstEnv({"HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy"});
49
+ if (target_.empty()) {
50
+ target_ = firstEnv({"HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy"});
48
51
  }
49
52
  if (!hasNoProxy) {
50
53
  std::string np = firstEnv({"NO_PROXY", "no_proxy"});
@@ -63,6 +66,15 @@ public:
63
66
  }
64
67
  }
65
68
 
69
+ // A proxy URL may carry credentials as userinfo, from the option or the
70
+ // environment, and neither is under a sensitive key name.
71
+ for (const auto& part : userinfo(target_)) {
72
+ ctx->utility->cleanAdd(ctx, Value(part));
73
+ ctx->utility->cleanAdd(ctx, Value(percentDecode(part)));
74
+ }
75
+ Value shown = ctx->utility->clean(ctx, Value(target_));
76
+ url = shown.is_string() ? shown.as_string() : "";
77
+
66
78
  auto inner = ctx->utility->fetcher;
67
79
  ctx->utility->fetcher = [this, inner](CtxPtr ctx2, const std::string& u,
68
80
  const Value& fetchdef) -> Value {
@@ -71,8 +83,10 @@ public:
71
83
  }
72
84
 
73
85
  private:
86
+ std::string target_ = "";
87
+
74
88
  Value route(const std::string& u, const Value& fetchdef) {
75
- if (url.empty() || bypass(u)) {
89
+ if (target_.empty() || bypass(u)) {
76
90
  return fetchdef;
77
91
  }
78
92
 
@@ -81,12 +95,44 @@ private:
81
95
  if (fetchdef.is_map()) {
82
96
  for (const auto& kv : *fetchdef.as_map()) map_put(out, kv.first, kv.second);
83
97
  }
84
- map_put(out, "proxy", Value(url));
98
+ map_put(out, "proxy", Value(target_));
85
99
 
86
100
  routed++;
87
101
  return out;
88
102
  }
89
103
 
104
+ // The username and password of `scheme://user:pass@host...`, raw.
105
+ static std::vector<std::string> userinfo(const std::string& u) {
106
+ std::vector<std::string> out;
107
+ size_t scheme = u.find("://");
108
+ size_t start = std::string::npos == scheme ? 0 : scheme + 3;
109
+ size_t end = u.find_first_of("/?#", start);
110
+ std::string authority = u.substr(start, std::string::npos == end ? std::string::npos : end - start);
111
+ size_t at = authority.rfind('@');
112
+ if (std::string::npos == at) return out;
113
+ std::string info = authority.substr(0, at);
114
+ size_t colon = info.find(':');
115
+ std::string user = std::string::npos == colon ? info : info.substr(0, colon);
116
+ std::string pass = std::string::npos == colon ? "" : info.substr(colon + 1);
117
+ if (!user.empty()) out.push_back(user);
118
+ if (!pass.empty()) out.push_back(pass);
119
+ return out;
120
+ }
121
+
122
+ static std::string percentDecode(const std::string& s) {
123
+ std::string out;
124
+ for (size_t i = 0; i < s.size(); i++) {
125
+ if ('%' == s[i] && i + 2 < s.size() && std::isxdigit((unsigned char)s[i + 1]) &&
126
+ std::isxdigit((unsigned char)s[i + 2])) {
127
+ out.push_back(static_cast<char>(std::stoi(s.substr(i + 1, 2), nullptr, 16)));
128
+ i += 2;
129
+ } else {
130
+ out.push_back(s[i]);
131
+ }
132
+ }
133
+ return out;
134
+ }
135
+
90
136
  bool bypass(const std::string& u) {
91
137
  if (noProxy.empty()) return false;
92
138
  std::string host = u;
@@ -264,6 +264,7 @@ public:
264
264
  std::vector<sekreto::ProviderSpec> specs;
265
265
 
266
266
  if (!explicitcred.empty()) {
267
+ registerSecret(explicitcred);
267
268
  try {
268
269
  std::string key = sekreto::envkey(secretname_, "");
269
270
  sekreto::ProviderSpec seat;
@@ -426,6 +427,15 @@ private:
426
427
  if (initerr_.empty()) initerr_ = msg;
427
428
  }
428
429
 
430
+ // Every value this feature resolves or buys is a secret the SDK handles,
431
+ // and none arrives under an option key the intake registration saw.
432
+ void registerSecret(const std::string& value) {
433
+ CtxPtr ctx = nullptr == client ? nullptr : client->rootctx;
434
+ if (ctx && ctx->utility && ctx->utility->cleanAdd) {
435
+ ctx->utility->cleanAdd(ctx, Value(value));
436
+ }
437
+ }
438
+
429
439
  // ---- options map -> sekreto ------------------------------------------------
430
440
 
431
441
  // An SDK Value as the plugin value model sekreto::specof reads. `values`
@@ -524,6 +534,7 @@ private:
524
534
  // required server variable, for the same reason.
525
535
  if (nullptr == client || "live" != client->mode) {
526
536
  cred_ = "test-" + x.response;
537
+ registerSecret(cred_);
527
538
  track_.buys++;
528
539
  return "";
529
540
  }
@@ -599,6 +610,7 @@ private:
599
610
  }
600
611
 
601
612
  cred_ = token.as_string();
613
+ registerSecret(cred_);
602
614
  track_.buys++;
603
615
  return "";
604
616
  }
@@ -630,6 +642,7 @@ private:
630
642
  return e.what();
631
643
  }
632
644
  track_.resolves++;
645
+ if (found.has_value()) registerSecret(found.value());
633
646
 
634
647
  if (!exchange_) {
635
648
  // A hit is the credential. An UNCACHED miss after an earlier hit is a
@@ -106,13 +106,15 @@ private:
106
106
  map_put(span, "durationMs", Value(dur));
107
107
  map_put(span, "ok", Value(ok));
108
108
 
109
+ Value out = ctx->utility->clean(ctx, span);
110
+
109
111
  activeSpans--;
110
- spans.as_list()->push_back(span);
112
+ spans.as_list()->push_back(out);
111
113
 
112
114
  Value exporter = getp(options, "exporter");
113
115
  if (exporter.is_injector()) {
114
116
  vs::Injection inj(Value::undef(), Value::undef());
115
- exporter.as_injector()(inj, vlist({span}), std::string(""), Value::undef());
117
+ exporter.as_injector()(inj, vlist({out}), std::string(""), Value::undef());
116
118
  }
117
119
  }
118
120
 
@@ -563,7 +563,7 @@ static void debug_redactsAndHonoursOnEntryMax() {
563
563
  ASSERT_EQ((int)f->entries.as_list()->size(), 1, "expected ring buffer capped at 1");
564
564
  ASSERT_EQ((int)seen.as_list()->size(), 2, "expected onEntry for both ops");
565
565
  Value headers = getp((*seen.as_list())[0], "headers");
566
- ASSERT_EQ_VAL(getp(headers, "authorization"), Value("<redacted>"), "expected redacted authorization");
566
+ ASSERT_EQ_VAL(getp(headers, "authorization"), Value("[redacted]"), "expected redacted authorization");
567
567
  }
568
568
 
569
569
  static void debug_capturesFailures() {
@@ -584,7 +584,7 @@ static void debug_injectedClockAndCustomRedact() {
584
584
  auto h = fhMake(nullptr, {FF(f, fhMap({{"now", clock.nowFn()}, {"redact", vlist({Value("x-secret")})}}))});
585
585
  h->op(fhOp("load").setHeaders(fhMap({{"x-secret", Value("hide")}, {"x-ok", Value("show")}})));
586
586
  Value headers = getp((*f->entries.as_list())[0], "headers");
587
- ASSERT_EQ_VAL(getp(headers, "x-secret"), Value("<redacted>"), "expected x-secret redacted");
587
+ ASSERT_EQ_VAL(getp(headers, "x-secret"), Value("[redacted]"), "expected x-secret redacted");
588
588
  ASSERT_EQ_VAL(getp(headers, "x-ok"), Value("show"), "expected x-ok kept");
589
589
  }
590
590