@voxgig/sdkgen 4.32.1 → 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 (411) 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/feature/audit/AuditFeature.js +2 -2
  220. package/project/.sdk/tm/js/src/feature/cost/CostFeature.js +2 -2
  221. package/project/.sdk/tm/js/src/feature/debug/DebugFeature.js +13 -7
  222. package/project/.sdk/tm/js/src/feature/log/LogFeature.js +9 -5
  223. package/project/.sdk/tm/js/src/feature/proxy/ProxyFeature.js +19 -1
  224. package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +14 -0
  225. package/project/.sdk/tm/js/src/feature/telemetry/TelemetryFeature.js +4 -2
  226. package/project/.sdk/tm/js/src/utility/CleanUtility.js +294 -21
  227. package/project/.sdk/tm/js/src/utility/DoneUtility.js +17 -5
  228. package/project/.sdk/tm/js/src/utility/MakeErrorUtility.js +18 -2
  229. package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +39 -15
  230. package/project/.sdk/tm/js/src/utility/Utility.js +4 -2
  231. package/project/.sdk/tm/js/test/feature/harness.js +11 -1
  232. package/project/.sdk/tm/js/test/feature.test.js +9 -2
  233. package/project/.sdk/tm/kotlin/core/Context.kt +19 -0
  234. package/project/.sdk/tm/kotlin/core/SdkClient.kt +9 -2
  235. package/project/.sdk/tm/kotlin/core/Utility.kt +2 -0
  236. package/project/.sdk/tm/kotlin/feature/AuditFeature.kt +11 -9
  237. package/project/.sdk/tm/kotlin/feature/CostFeature.kt +8 -5
  238. package/project/.sdk/tm/kotlin/feature/DebugFeature.kt +15 -22
  239. package/project/.sdk/tm/kotlin/feature/LogFeature.kt +8 -4
  240. package/project/.sdk/tm/kotlin/feature/ProxyFeature.kt +26 -2
  241. package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +11 -0
  242. package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +4 -2
  243. package/project/.sdk/tm/kotlin/test/FeatureTest.kt +2 -2
  244. package/project/.sdk/tm/kotlin/utility/CoreUtil.kt +447 -11
  245. package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +38 -31
  246. package/project/.sdk/tm/kotlin/utility/Register.kt +1 -0
  247. package/project/.sdk/tm/lua/core/context.lua +43 -0
  248. package/project/.sdk/tm/lua/core/error.lua +36 -1
  249. package/project/.sdk/tm/lua/core/utility_type.lua +4 -0
  250. package/project/.sdk/tm/lua/feature/audit_feature.lua +2 -2
  251. package/project/.sdk/tm/lua/feature/cost_feature.lua +2 -2
  252. package/project/.sdk/tm/lua/feature/debug_feature.lua +21 -17
  253. package/project/.sdk/tm/lua/feature/log_feature.lua +2 -1
  254. package/project/.sdk/tm/lua/feature/proxy_feature.lua +23 -1
  255. package/project/.sdk/tm/lua/feature/secrets_feature.lua +18 -0
  256. package/project/.sdk/tm/lua/feature/telemetry_feature.lua +4 -2
  257. package/project/.sdk/tm/lua/test/feature/secrets/secrets_feature_test.lua +3 -2
  258. package/project/.sdk/tm/lua/test/feature_test.lua +10 -3
  259. package/project/.sdk/tm/lua/utility/clean.lua +426 -2
  260. package/project/.sdk/tm/lua/utility/clean_explain.lua +34 -0
  261. package/project/.sdk/tm/lua/utility/done.lua +1 -7
  262. package/project/.sdk/tm/lua/utility/make_error.lua +3 -1
  263. package/project/.sdk/tm/lua/utility/make_options.lua +76 -30
  264. package/project/.sdk/tm/lua/utility/register.lua +4 -1
  265. package/project/.sdk/tm/ocaml/Makefile +5 -1
  266. package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +12 -1
  267. package/project/.sdk/tm/ocaml/sdk_features.ml +78 -18
  268. package/project/.sdk/tm/ocaml/sdk_helpers.ml +27 -0
  269. package/project/.sdk/tm/ocaml/sdk_runtime.ml +304 -26
  270. package/project/.sdk/tm/ocaml/sdk_types.ml +1 -0
  271. package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +3 -1
  272. package/project/.sdk/tm/ocaml/test/t_feature.ml +2 -2
  273. package/project/.sdk/tm/perl/core/context.pm +27 -0
  274. package/project/.sdk/tm/perl/core/error.pm +52 -5
  275. package/project/.sdk/tm/perl/feature/audit_feature.pm +2 -2
  276. package/project/.sdk/tm/perl/feature/cost_feature.pm +2 -2
  277. package/project/.sdk/tm/perl/feature/debug_feature.pm +17 -13
  278. package/project/.sdk/tm/perl/feature/log_feature.pm +3 -1
  279. package/project/.sdk/tm/perl/feature/proxy_feature.pm +21 -1
  280. package/project/.sdk/tm/perl/feature/secrets_feature.pm +20 -1
  281. package/project/.sdk/tm/perl/feature/telemetry_feature.pm +4 -2
  282. package/project/.sdk/tm/perl/t/feature.t +4 -2
  283. package/project/.sdk/tm/perl/utility/clean.pm +345 -1
  284. package/project/.sdk/tm/perl/utility/done.pm +24 -6
  285. package/project/.sdk/tm/perl/utility/make_error.pm +17 -4
  286. package/project/.sdk/tm/perl/utility/make_options.pm +33 -14
  287. package/project/.sdk/tm/php/core/Context.php +24 -1
  288. package/project/.sdk/tm/php/core/Error.php +34 -3
  289. package/project/.sdk/tm/php/core/UtilityType.php +4 -0
  290. package/project/.sdk/tm/php/feature/AuditFeature.php +2 -2
  291. package/project/.sdk/tm/php/feature/CostFeature.php +2 -2
  292. package/project/.sdk/tm/php/feature/DebugFeature.php +18 -9
  293. package/project/.sdk/tm/php/feature/LogFeature.php +5 -2
  294. package/project/.sdk/tm/php/feature/ProxyFeature.php +20 -1
  295. package/project/.sdk/tm/php/feature/SecretsFeature.php +18 -0
  296. package/project/.sdk/tm/php/feature/TelemetryFeature.php +4 -2
  297. package/project/.sdk/tm/php/test/FeatureTest.php +2 -2
  298. package/project/.sdk/tm/php/utility/Clean.php +438 -2
  299. package/project/.sdk/tm/php/utility/Done.php +14 -7
  300. package/project/.sdk/tm/php/utility/MakeError.php +9 -7
  301. package/project/.sdk/tm/php/utility/MakeOptions.php +62 -38
  302. package/project/.sdk/tm/php/utility/Register.php +2 -0
  303. package/project/.sdk/tm/py/pkg/core/context.py +17 -0
  304. package/project/.sdk/tm/py/pkg/core/error.py +42 -1
  305. package/project/.sdk/tm/py/pkg/core/utility_type.py +4 -0
  306. package/project/.sdk/tm/py/pkg/feature/audit_feature.py +2 -2
  307. package/project/.sdk/tm/py/pkg/feature/cost_feature.py +2 -2
  308. package/project/.sdk/tm/py/pkg/feature/debug_feature.py +17 -12
  309. package/project/.sdk/tm/py/pkg/feature/log_feature.py +2 -1
  310. package/project/.sdk/tm/py/pkg/feature/proxy_feature.py +18 -1
  311. package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +12 -0
  312. package/project/.sdk/tm/py/pkg/feature/telemetry_feature.py +4 -2
  313. package/project/.sdk/tm/py/pkg/utility/clean.py +311 -1
  314. package/project/.sdk/tm/py/pkg/utility/done.py +18 -5
  315. package/project/.sdk/tm/py/pkg/utility/make_error.py +9 -6
  316. package/project/.sdk/tm/py/pkg/utility/make_options.py +64 -25
  317. package/project/.sdk/tm/py/pkg/utility/make_response.py +19 -13
  318. package/project/.sdk/tm/py/pkg/utility/register.py +4 -2
  319. package/project/.sdk/tm/py/test/feature_harness.py +4 -0
  320. package/project/.sdk/tm/py/test/test_feature.py +2 -2
  321. package/project/.sdk/tm/py/test/test_primary_utility.py +1 -0
  322. package/project/.sdk/tm/rb/core/context.rb +28 -0
  323. package/project/.sdk/tm/rb/core/error.rb +30 -0
  324. package/project/.sdk/tm/rb/core/utility_type.rb +1 -1
  325. package/project/.sdk/tm/rb/feature/audit_feature.rb +2 -2
  326. package/project/.sdk/tm/rb/feature/cost_feature.rb +2 -2
  327. package/project/.sdk/tm/rb/feature/debug_feature.rb +15 -12
  328. package/project/.sdk/tm/rb/feature/log_feature.rb +3 -1
  329. package/project/.sdk/tm/rb/feature/proxy_feature.rb +25 -1
  330. package/project/.sdk/tm/rb/feature/secrets_feature.rb +17 -0
  331. package/project/.sdk/tm/rb/feature/telemetry_feature.rb +4 -2
  332. package/project/.sdk/tm/rb/test/feature_test.rb +4 -2
  333. package/project/.sdk/tm/rb/utility/clean.rb +312 -1
  334. package/project/.sdk/tm/rb/utility/done.rb +15 -5
  335. package/project/.sdk/tm/rb/utility/make_error.rb +13 -4
  336. package/project/.sdk/tm/rb/utility/make_options.rb +31 -12
  337. package/project/.sdk/tm/rb/utility/register.rb +2 -0
  338. package/project/.sdk/tm/rust/core/context.rs +55 -0
  339. package/project/.sdk/tm/rust/core/utility_type.rs +17 -0
  340. package/project/.sdk/tm/rust/feature/audit.rs +2 -0
  341. package/project/.sdk/tm/rust/feature/cost.rs +3 -2
  342. package/project/.sdk/tm/rust/feature/debug.rs +16 -16
  343. package/project/.sdk/tm/rust/feature/log.rs +42 -7
  344. package/project/.sdk/tm/rust/feature/proxy.rs +48 -2
  345. package/project/.sdk/tm/rust/feature/secrets.rs +12 -0
  346. package/project/.sdk/tm/rust/feature/telemetry.rs +2 -0
  347. package/project/.sdk/tm/rust/tests/feature_test.rs +2 -2
  348. package/project/.sdk/tm/rust/utility/clean.rs +446 -5
  349. package/project/.sdk/tm/rust/utility/done.rs +22 -12
  350. package/project/.sdk/tm/rust/utility/make_error.rs +4 -1
  351. package/project/.sdk/tm/rust/utility/make_options.rs +73 -19
  352. package/project/.sdk/tm/scala/Makefile +3 -1
  353. package/project/.sdk/tm/scala/core/Context.scala +16 -0
  354. package/project/.sdk/tm/scala/core/SdkClient.scala +14 -4
  355. package/project/.sdk/tm/scala/core/SdkError.scala +28 -0
  356. package/project/.sdk/tm/scala/core/Types.scala +3 -0
  357. package/project/.sdk/tm/scala/core/Utility.scala +2 -0
  358. package/project/.sdk/tm/scala/feature/AuditFeature.scala +16 -10
  359. package/project/.sdk/tm/scala/feature/CostFeature.scala +10 -5
  360. package/project/.sdk/tm/scala/feature/DebugFeature.scala +24 -21
  361. package/project/.sdk/tm/scala/feature/LogFeature.scala +9 -4
  362. package/project/.sdk/tm/scala/feature/ProxyFeature.scala +23 -2
  363. package/project/.sdk/tm/scala/feature/SecretsFeature.scala +14 -0
  364. package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +9 -2
  365. package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +2 -2
  366. package/project/.sdk/tm/scala/utility/Make.scala +63 -20
  367. package/project/.sdk/tm/scala/utility/Misc.scala +358 -5
  368. package/project/.sdk/tm/scala/utility/Register.scala +1 -0
  369. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +29 -0
  370. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Utility.swift +2 -0
  371. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +10 -9
  372. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/CostFeature.swift +7 -5
  373. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/DebugFeature.swift +19 -15
  374. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/FeatureOptions.swift +16 -0
  375. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/LogFeature.swift +4 -1
  376. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/ProxyFeature.swift +20 -5
  377. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/SecretsFeature.swift +13 -0
  378. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +4 -2
  379. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeError.swift +15 -5
  380. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +58 -19
  381. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Register.swift +1 -0
  382. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +391 -4
  383. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +2 -2
  384. package/project/.sdk/tm/ts/src/Context.ts +5 -1
  385. package/project/.sdk/tm/ts/src/feature/audit/AuditFeature.ts +2 -2
  386. package/project/.sdk/tm/ts/src/feature/cost/CostFeature.ts +2 -2
  387. package/project/.sdk/tm/ts/src/feature/debug/DebugFeature.ts +13 -7
  388. package/project/.sdk/tm/ts/src/feature/log/LogFeature.ts +9 -5
  389. package/project/.sdk/tm/ts/src/feature/proxy/ProxyFeature.ts +19 -1
  390. package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +12 -0
  391. package/project/.sdk/tm/ts/src/feature/telemetry/TelemetryFeature.ts +4 -2
  392. package/project/.sdk/tm/ts/src/utility/CleanUtility.ts +287 -9
  393. package/project/.sdk/tm/ts/src/utility/DoneUtility.ts +18 -5
  394. package/project/.sdk/tm/ts/src/utility/MakeErrorUtility.ts +18 -8
  395. package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +38 -16
  396. package/project/.sdk/tm/ts/src/utility/Utility.ts +4 -2
  397. package/project/.sdk/tm/ts/test/feature/harness.ts +11 -1
  398. package/project/.sdk/tm/ts/test/feature.test.ts +9 -2
  399. package/project/.sdk/tm/zig/core/context.zig +34 -0
  400. package/project/.sdk/tm/zig/core/error.zig +22 -1
  401. package/project/.sdk/tm/zig/core/utility.zig +403 -39
  402. package/project/.sdk/tm/zig/feature/audit.zig +4 -2
  403. package/project/.sdk/tm/zig/feature/cost.zig +3 -2
  404. package/project/.sdk/tm/zig/feature/debug.zig +20 -25
  405. package/project/.sdk/tm/zig/feature/log.zig +3 -1
  406. package/project/.sdk/tm/zig/feature/proxy.zig +47 -6
  407. package/project/.sdk/tm/zig/feature/secrets.zig +7 -0
  408. package/project/.sdk/tm/zig/feature/telemetry.zig +4 -2
  409. package/project/.sdk/tm/zig/test/feature_test.zig +2 -2
  410. package/project/sdkgen-package.json +1 -1
  411. package/src/helpers/naming.ts +1 -1
@@ -7,18 +7,7 @@ use crate::utility::voxgigstruct as vs;
7
7
  use crate::utility::voxgigstruct::Value;
8
8
 
9
9
  pub fn done_util(ctx: &Rc<Context>) -> Result<Value, ProjectNameError> {
10
- {
11
- let ctrl = ctx.ctrl.borrow().clone();
12
- let mut c = ctrl.borrow_mut();
13
- if c.has_explain() {
14
- let explain = crate::utility::clean::clean_util(ctx, &c.explain);
15
- if let Value::Map(_) = getp(&explain, "result") {
16
- let rm = to_map(&getp(&explain, "result"));
17
- vs::del_prop(rm, &Value::str("err"));
18
- }
19
- c.explain = explain;
20
- }
21
- }
10
+ clean_explain_util(ctx);
22
11
 
23
12
  let result = ctx.result.borrow().clone();
24
13
  if let Some(res) = result {
@@ -29,3 +18,24 @@ pub fn done_util(ctx: &Rc<Context>) -> Result<Value, ProjectNameError> {
29
18
 
30
19
  crate::utility::make_error::make_error_util(ctx, None)
31
20
  }
21
+
22
+ /// Clean the explain record in place. It is the caller's own map (Control
23
+ /// copies the Rc), so its entries are replaced by the cleaned copy's; with
24
+ /// clean off the cleaned record is that map, already current.
25
+ pub fn clean_explain_util(ctx: &Rc<Context>) {
26
+ let ctrl = ctx.ctrl.borrow().clone();
27
+ let explain = ctrl.borrow().explain.clone();
28
+ let Value::Map(orig) = &explain else {
29
+ return;
30
+ };
31
+ if let Value::Map(cleaned) = crate::utility::clean::clean_util(ctx, &explain) {
32
+ if !Rc::ptr_eq(orig, &cleaned) {
33
+ let entries = cleaned.borrow().clone();
34
+ *orig.borrow_mut() = entries;
35
+ }
36
+ }
37
+ // explain.result is a to_value snapshot, never the live result.
38
+ if let Value::Map(_) = getp(&explain, "result") {
39
+ vs::del_prop(to_map(&getp(&explain, "result")), &Value::str("err"));
40
+ }
41
+ }
@@ -46,6 +46,8 @@ pub fn make_error_util(
46
46
  None => Value::Noval,
47
47
  };
48
48
 
49
+ crate::utility::done::clean_explain_util(ctx);
50
+
49
51
  let ctrl = ctx.ctrl.borrow().clone();
50
52
  {
51
53
  let c = ctrl.borrow();
@@ -59,7 +61,8 @@ pub fn make_error_util(
59
61
  }
60
62
 
61
63
  let mut sdk_err = ProjectNameError::new("", &msg);
62
- sdk_err.code = err.code.clone();
64
+ // A hook's own error supplies the code as well as the message.
65
+ sdk_err.code = crate::utility::clean::clean_str(ctx, &err.code);
63
66
  sdk_err.result = crate::utility::clean::clean_util(ctx, &result.borrow().to_value());
64
67
  sdk_err.spec = crate::utility::clean::clean_util(ctx, &spec_val);
65
68
 
@@ -2,6 +2,7 @@ use std::rc::Rc;
2
2
 
3
3
  use crate::core::context::Context;
4
4
  use crate::core::helpers::{get_str, getp, getpath, ja, jo, setp, to_map};
5
+ use crate::utility::clean;
5
6
  use crate::utility::voxgigstruct as vs;
6
7
  use crate::utility::voxgigstruct::Value;
7
8
 
@@ -58,6 +59,26 @@ pub fn make_options_util(ctx: &Rc<Context>) -> Value {
58
59
 
59
60
  let optspec = crate::core::schema::optspec();
60
61
 
62
+ // The secret registry exists BEFORE validation, fed from the raw input.
63
+ // Its block is Rc-shared: what is registered into `cleanopts` here is
64
+ // what `opts.__derived__.clean` carries out below.
65
+ let cleancfg = clean::make_clean_config(&vs::merge(
66
+ &ja(vec![
67
+ Value::empty_map(),
68
+ vs::clone(&getp(&optspec, "clean")),
69
+ clean_block(&cfgopts),
70
+ clean_block(&opts),
71
+ ]),
72
+ None,
73
+ ));
74
+ let cleanopts = jo(vec![("__derived__", jo(vec![("clean", cleancfg.clone())]))]);
75
+ clean::clean_add_sensitive_opts(&cleanopts, &without(&opts, &["clean"]));
76
+ for src in [&cfgopts, &opts] {
77
+ for value in clean::splitvalues(&getpath(&["clean", "values"], src)) {
78
+ clean::clean_add_opts(&cleanopts, &value);
79
+ }
80
+ }
81
+
61
82
  // Preserve system.fetch before merge/validate (validation strips it).
62
83
  let sys_fetch = getpath(&["system", "fetch"], &opts);
63
84
 
@@ -145,19 +166,6 @@ pub fn make_options_util(ctx: &Rc<Context>) -> Value {
145
166
  }
146
167
  }
147
168
 
148
- let clean_keys = match getpath(&["clean", "keys"], &opts) {
149
- Value::Str(s) => s,
150
- _ => "key,token,id".to_string(),
151
- };
152
-
153
- let filtered: Vec<String> = clean_keys
154
- .split(',')
155
- .map(|p| p.trim())
156
- .filter(|p| !p.is_empty())
157
- .map(|p| vs::esc_re(&Value::str(p)))
158
- .collect();
159
- let keyre = filtered.join("|");
160
-
161
169
  // Resolve the feature add-order: an explicit List order (above) wins;
162
170
  // otherwise order the map test-first, then the remaining names sorted, so
163
171
  // the outcome is deterministic and `test` is always the base transport.
@@ -188,20 +196,66 @@ pub fn make_options_util(ctx: &Rc<Context>) -> Value {
188
196
  let order_list =
189
197
  Value::list(feature_order.into_iter().map(|n| Value::str(n)).collect());
190
198
 
191
- let derived_clean = if keyre.is_empty() {
192
- Value::empty_map()
193
- } else {
194
- jo(vec![("keyre", Value::str(keyre))])
195
- };
196
199
  setp(
197
200
  &opts,
198
201
  "__derived__",
199
- jo(vec![("clean", derived_clean), ("featureorder", order_list)]),
202
+ jo(vec![("clean", cleancfg), ("featureorder", order_list)]),
200
203
  );
201
204
 
205
+ // Again over the merged result: the config's own defaults can carry one.
206
+ clean::clean_add_sensitive_opts(&opts, &without(&opts, &["clean", "__derived__"]));
207
+
202
208
  opts
203
209
  }
204
210
 
211
+ // A copy of the clean block, or an empty one: merge lets a missing value
212
+ // replace everything merged before it, schema defaults included.
213
+ fn clean_block(opts: &Value) -> Value {
214
+ match getp(opts, "clean") {
215
+ Value::Map(_) => vs::clone(&getp(opts, "clean")),
216
+ _ => Value::empty_map(),
217
+ }
218
+ }
219
+
220
+ // The options to scan for secrets. The feature map is keyed by feature
221
+ // names, not field names, so it is scanned as a list: `secrets` must not
222
+ // make every setting of that feature a secret. Entity blocks hold entity
223
+ // settings and seeded records, never a credential, so none is scanned.
224
+ fn without(val: &Value, keys: &[&str]) -> Value {
225
+ let out = Value::empty_map();
226
+ if let Value::Map(m) = val {
227
+ for (k, v) in m.borrow().iter() {
228
+ if "entity" == k.as_str() || keys.contains(&k.as_str()) {
229
+ continue;
230
+ }
231
+ let v = match (k.as_str(), v) {
232
+ ("feature", Value::Map(fm)) => {
233
+ Value::list(fm.borrow().iter().map(|(_, fv)| noentity(fv)).collect())
234
+ }
235
+ ("test", _) => noentity(v),
236
+ _ => v.clone(),
237
+ };
238
+ setp(&out, k, v);
239
+ }
240
+ }
241
+ out
242
+ }
243
+
244
+ fn noentity(val: &Value) -> Value {
245
+ match val {
246
+ Value::Map(m) => {
247
+ let out = Value::empty_map();
248
+ for (k, v) in m.borrow().iter() {
249
+ if "entity" != k.as_str() {
250
+ setp(&out, k, v.clone());
251
+ }
252
+ }
253
+ out
254
+ }
255
+ _ => val.clone(),
256
+ }
257
+ }
258
+
205
259
  /// Read a string option (helper shared by prepare utilities).
206
260
  pub fn opt_str(options: &Value, key: &str) -> String {
207
261
  get_str(options, key).unwrap_or_default()
@@ -15,11 +15,13 @@ build:
15
15
  #
16
16
  # Main classes are NAMED here rather than globbed, so a per-feature suite has
17
17
  # to be listed. SecretsTestMain drives the feature through the `extend` seam
18
- # and so runs in every scala SDK, model-activated or not.
18
+ # and so runs in every scala SDK, model-activated or not. SdkCleanTestMain is
19
+ # the canary sweep: no credential leaves the SDK in any form.
19
20
  test:
20
21
  scala-cli run . --main-class OmniSmoke
21
22
  scala-cli run . --main-class SdkTestMain
22
23
  scala-cli run . --main-class SdkEntityTestMain
24
+ scala-cli run . --main-class SdkCleanTestMain
23
25
  scala-cli run . --main-class SecretsTestMain
24
26
  scala-cli run . --main-class Runner -- ../.sdk/test/test.json
25
27
  scala-cli run . --main-class PrimaryCorpusMain -- ../.sdk/test/test.json
@@ -158,4 +158,20 @@ class Context(ctxmap: JMap[String, Object], basectx: Context) {
158
158
  }
159
159
 
160
160
  def makeError(code: String, msg: String): SdkError = new SdkError(code, msg, this)
161
+
162
+ // The serialised context leaves the pipeline (a logger, an error dump), so
163
+ // it is cleaned; the live fields stay raw for the pipeline's own use.
164
+ def toMap(): Object = {
165
+ val record = new LinkedHashMap[String, Object]()
166
+ record.put("id", id)
167
+ record.put("op", op)
168
+ record.put("spec", spec)
169
+ record.put("entity", entity)
170
+ record.put("result", result)
171
+ record.put("response", response)
172
+ record.put("meta", meta)
173
+ if (utility == null || utility.clean == null) record else utility.clean(this, record)
174
+ }
175
+
176
+ override def toString: String = "Context " + Struct.jsonify(toMap())
161
177
  }
@@ -2,6 +2,7 @@ package SCALAPACKAGE.core
2
2
 
3
3
  import java.util.{ArrayList, LinkedHashMap, List => JList, Map => JMap}
4
4
  import java.util.function.Supplier
5
+ import scala.util.control.NonFatal
5
6
  import SCALAPACKAGE.utility.struct.Struct
6
7
 
7
8
  // Shared client runtime for the ProjectName SDK. The generated
@@ -76,6 +77,9 @@ abstract class SdkClient(options0: JMap[String, Object]) {
76
77
  this.utility.featureHook(this.rootctx, "PostConstruct")
77
78
  }
78
79
 
80
+ // The options hold the credential; a printed client shows only its name.
81
+ override def toString: String = this.getClass.getSimpleName + "(mode=" + this.mode + ")"
82
+
79
83
  def optionsMap(): JMap[String, Object] = Struct.clone(this.options) match {
80
84
  case m: JMap[_, _] => m.asInstanceOf[JMap[String, Object]]
81
85
  case _ => new LinkedHashMap[String, Object]()
@@ -241,15 +245,15 @@ abstract class SdkClient(options0: JMap[String, Object]) {
241
245
 
242
246
  val fetchdef =
243
247
  try this.prepare(fetchargs)
244
- catch { case err: RuntimeException =>
245
- out.put("ok", java.lang.Boolean.FALSE); out.put("err", err); return out
248
+ catch { case NonFatal(err) =>
249
+ out.put("ok", java.lang.Boolean.FALSE); out.put("err", cleanErr(ctx, err)); return out
246
250
  }
247
251
 
248
252
  val url = fetchdef.get("url")
249
253
  val fetched =
250
254
  try utility.fetcher(ctx, url match { case s: String => s; case _ => "" }, fetchdef)
251
- catch { case err: RuntimeException =>
252
- out.put("ok", java.lang.Boolean.FALSE); out.put("err", err); return out
255
+ catch { case NonFatal(err) =>
256
+ out.put("ok", java.lang.Boolean.FALSE); out.put("err", cleanErr(ctx, err)); return out
253
257
  }
254
258
 
255
259
  if (fetched == null) {
@@ -292,6 +296,12 @@ abstract class SdkClient(options0: JMap[String, Object]) {
292
296
  out
293
297
  }
294
298
  }
299
+
300
+ // A raw request returns its error rather than passing it through makeError.
301
+ private def cleanErr(ctx: Context, err: Throwable): Object = this.utility.clean(ctx, err) match {
302
+ case t: Throwable => t
303
+ case _ => err
304
+ }
295
305
  }
296
306
 
297
307
  object SdkClient {
@@ -1,5 +1,8 @@
1
1
  package SCALAPACKAGE.core
2
2
 
3
+ import java.util.{LinkedHashMap, Map => JMap}
4
+ import SCALAPACKAGE.utility.struct.Struct
5
+
3
6
  // ProjectName SDK error. Carries the SDK error code, the operation context,
4
7
  // and cleaned copies of the result and spec at failure time.
5
8
  class SdkError(code0: String, msg0: String, ctx0: Context) extends RuntimeException(msg0) {
@@ -7,9 +10,34 @@ class SdkError(code0: String, msg0: String, ctx0: Context) extends RuntimeExcept
7
10
  val sdk: String = "ProjectName"
8
11
  var code: String = if (code0 == null) "" else code0
9
12
  var msg: String = msg0
13
+
14
+ // The HTTP status when there was a response, -1 otherwise.
15
+ var status: Int = -1
16
+
17
+ // Reachable for a debugger, out of every serialisation: the context holds
18
+ // the live spec and options, and an error is what gets logged.
10
19
  @transient var ctx: Context = ctx0
11
20
  @transient var result: Object = null
12
21
  @transient var spec: Object = null
13
22
 
23
+ def notFound: Boolean = 404 == this.status
24
+
14
25
  override def getMessage: String = this.msg
26
+
27
+ // What makeError attached is already cleaned; the context is not part of
28
+ // the record.
29
+ def toMap(): JMap[String, Object] = {
30
+ val out = new LinkedHashMap[String, Object]()
31
+ out.put("sdk", this.sdk)
32
+ out.put("code", this.code)
33
+ out.put("message", this.msg)
34
+ out.put("status", java.lang.Integer.valueOf(this.status))
35
+ out.put("result", this.result)
36
+ out.put("spec", this.spec)
37
+ out
38
+ }
39
+
40
+ def toJson(): String = Struct.jsonify(this.toMap())
41
+
42
+ override def toString: String = "ProjectNameError " + this.toJson()
15
43
  }
@@ -15,6 +15,9 @@ type FetcherFn = (Context, String, JMap[String, Object]) => Object
15
15
  // clean(ctx, val) -> val
16
16
  type CleanFn = (Context, Object) => Object
17
17
 
18
+ // cleanAdd(ctx, value): registers a secret the SDK handles
19
+ type CleanAddFn = (Context, Object) => Unit
20
+
18
21
  // makeError(ctx, err) -> value (throws, or returns fallback)
19
22
  type MakeErrorFn = (Context, RuntimeException) => Object
20
23
 
@@ -8,6 +8,7 @@ import java.util.{LinkedHashMap, Map => JMap}
8
8
  class Utility private (noregister: Boolean) {
9
9
 
10
10
  var clean: CleanFn = null
11
+ var cleanAdd: CleanAddFn = null
11
12
  var done: CtxFn[Object] = null
12
13
  var makeError: MakeErrorFn = null
13
14
  var featureAdd: FeatureFn = null
@@ -53,6 +54,7 @@ class Utility private (noregister: Boolean) {
53
54
  def copy(): Utility = {
54
55
  val u = new Utility(true)
55
56
  u.clean = this.clean
57
+ u.cleanAdd = this.cleanAdd
56
58
  u.done = this.done
57
59
  u.makeError = this.makeError
58
60
  u.featureAdd = this.featureAdd
@@ -1,7 +1,7 @@
1
1
  package SCALAPACKAGE.feature
2
2
 
3
3
  import java.util.{ArrayList, LinkedHashMap, List => JList, Map => JMap}
4
- import SCALAPACKAGE.core.{Context, SdkClient}
4
+ import SCALAPACKAGE.core.{Context, Helpers, SdkClient}
5
5
 
6
6
  // Audit trail. Emits a structured record for every operation — who (actor),
7
7
  // what (entity + op), the outcome, and a correlation id — suitable for
@@ -74,17 +74,23 @@ class AuditFeature extends BaseFeature("audit", "0.0.1", true) {
74
74
  opname = ctx.op.name
75
75
  }
76
76
 
77
- val record = new LinkedHashMap[String, Object]()
78
- record.put("seq", java.lang.Integer.valueOf(this.seq))
79
- record.put("ts", java.lang.Long.valueOf(FeatureOptions.foptNow(this.options).getAsLong()))
80
- record.put("actor", actor)
81
- record.put("entity", entity)
82
- record.put("op", opname)
83
- record.put("outcome", outcome)
84
- record.put("correlationId", ctx.id)
77
+ val raw = new LinkedHashMap[String, Object]()
78
+ raw.put("seq", java.lang.Integer.valueOf(this.seq))
79
+ raw.put("ts", java.lang.Long.valueOf(FeatureOptions.foptNow(this.options).getAsLong()))
80
+ raw.put("actor", actor)
81
+ raw.put("entity", entity)
82
+ raw.put("op", opname)
83
+ raw.put("outcome", outcome)
84
+ raw.put("correlationId", ctx.id)
85
85
  if (ctx.result != null) {
86
- record.put("status", java.lang.Integer.valueOf(ctx.result.status))
86
+ raw.put("status", java.lang.Integer.valueOf(ctx.result.status))
87
87
  }
88
+ val record =
89
+ if (ctx.utility == null || ctx.utility.clean == null) raw
90
+ else {
91
+ val out = Helpers.toMapAny(ctx.utility.clean(ctx, raw))
92
+ if (out == null) raw else out
93
+ }
88
94
 
89
95
  this.records.add(record)
90
96
  val max = FeatureOptions.foptInt(this.options, "max", 1000)
@@ -266,15 +266,20 @@ class CostFeature extends BaseFeature("cost", "0.0.1", true) {
266
266
  bump(this.ops, entity + "." + opname, amount)
267
267
  bump(this.actors, actor, amount)
268
268
 
269
+ // The record leaves through `last` and the sink, so its text is cleaned.
270
+ def cs(s: String): String =
271
+ if (ctx.utility == null || ctx.utility.clean == null) s
272
+ else String.valueOf(ctx.utility.clean(ctx, s))
273
+
269
274
  this.seq += 1
270
275
  val record = new CostRecord()
271
276
  record.seq = this.seq
272
- record.entity = entity
273
- record.op = opname
274
- record.actor = actor
277
+ record.entity = cs(entity)
278
+ record.op = cs(opname)
279
+ record.actor = cs(actor)
275
280
  record.amount = amount
276
- record.currency = this.currency
277
- record.source = source
281
+ record.currency = cs(this.currency)
282
+ record.source = cs(source)
278
283
  record.attempts = pending.attempts
279
284
  this.last = record
280
285
 
@@ -19,10 +19,6 @@ class DebugFeature extends BaseFeature("debug", "0.0.1", true) {
19
19
 
20
20
  private val DEBUG_ENTRY_KEY = "debug_entry"
21
21
 
22
- private val DEFAULT_REDACT: JList[String] = java.util.List.of(
23
- "authorization", "cookie", "set-cookie", "api-key", "apikey",
24
- "x-api-key", "idempotency-key")
25
-
26
22
  override def init(ctx: Context, options: JMap[String, Object]): Unit = {
27
23
  this.client = ctx.client
28
24
  this.options = options
@@ -51,7 +47,7 @@ class DebugFeature extends BaseFeature("debug", "0.0.1", true) {
51
47
  } else {
52
48
  entry.put("url", ctx.spec.path)
53
49
  }
54
- entry.put("headers", redact(ctx.spec.headers))
50
+ entry.put("headers", redact(ctx, ctx.spec.headers))
55
51
  }
56
52
  ctx.out.put(DEBUG_ENTRY_KEY, entry)
57
53
  }
@@ -88,7 +84,7 @@ class DebugFeature extends BaseFeature("debug", "0.0.1", true) {
88
84
 
89
85
  private def finish(ctx: Context, ok: Boolean): Unit = {
90
86
  // Finish once per operation: the marker in ctx.out is consumed here.
91
- val entry = Helpers.toMapAny(ctx.out.get(DEBUG_ENTRY_KEY))
87
+ var entry = Helpers.toMapAny(ctx.out.get(DEBUG_ENTRY_KEY))
92
88
  if (entry == null) {
93
89
  return
94
90
  }
@@ -105,6 +101,11 @@ class DebugFeature extends BaseFeature("debug", "0.0.1", true) {
105
101
  entry.put("status", java.lang.Integer.valueOf(ctx.result.status))
106
102
  }
107
103
 
104
+ // The whole entry leaves through the buffer and the callback: the url
105
+ // and the error message can carry a query credential the header mask
106
+ // above never saw.
107
+ entry = cleaned(ctx, entry)
108
+
108
109
  this.entries.add(entry)
109
110
  val max = FeatureOptions.foptInt(this.options, "max", 100)
110
111
  while (this.entries.size() > max) {
@@ -118,32 +119,34 @@ class DebugFeature extends BaseFeature("debug", "0.0.1", true) {
118
119
  }
119
120
  }
120
121
 
121
- private def redact(headers: JMap[String, Object]): JMap[String, Object] = {
122
+ private def cleaned(ctx: Context, m: JMap[String, Object]): JMap[String, Object] = {
123
+ if (ctx.utility == null || ctx.utility.clean == null) return m
124
+ val out = Helpers.toMapAny(ctx.utility.clean(ctx, m))
125
+ if (out == null) m else out
126
+ }
127
+
128
+ // The core clean rules apply (clean.keys, every registered value); the
129
+ // feature's own `redact` list ADDS header names on top of them.
130
+ private def redact(ctx: Context, headers: JMap[String, Object]): JMap[String, Object] = {
122
131
  val out = new LinkedHashMap[String, Object]()
123
132
  if (headers == null) {
124
133
  return out
125
134
  }
126
- var patterns = FeatureOptions.foptStrList(this.options, "redact")
127
- if (patterns == null) {
128
- patterns = DEFAULT_REDACT
135
+ val patterns = new ArrayList[String]()
136
+ val listed = FeatureOptions.foptStrList(this.options, "redact")
137
+ if (listed != null) {
138
+ val pit = listed.iterator()
139
+ while (pit.hasNext) patterns.add(pit.next().toLowerCase())
129
140
  }
130
141
  val it = headers.entrySet().iterator()
131
142
  while (it.hasNext) {
132
143
  val h = it.next()
133
- var masked = false
134
- val pit = patterns.iterator()
135
- while (!masked && pit.hasNext) {
136
- val p = pit.next()
137
- if (h.getKey.toLowerCase().equals(p)) {
138
- masked = true
139
- }
140
- }
141
- if (masked) {
142
- out.put(h.getKey, "<redacted>")
144
+ if (patterns.contains(h.getKey.toLowerCase())) {
145
+ out.put(h.getKey, "[redacted]")
143
146
  } else {
144
147
  out.put(h.getKey, h.getValue)
145
148
  }
146
149
  }
147
- out
150
+ cleaned(ctx, out)
148
151
  }
149
152
  }
@@ -54,11 +54,16 @@ class LogFeature extends BaseFeature("log", "0.0.1", true) {
54
54
  if (ctx.op != null) msg.append(" op=").append(ctx.op.name)
55
55
  if (ctx.spec != null) msg.append(" spec=").append(ctx.spec.method).append(" ").append(ctx.spec.path)
56
56
 
57
+ // A log line leaves the pipeline, so it carries the cleaned text.
58
+ val line =
59
+ if (ctx.utility == null || ctx.utility.clean == null) msg.toString
60
+ else String.valueOf(ctx.utility.clean(ctx, msg.toString))
61
+
57
62
  level match {
58
- case "debug" => this.logger.fine(msg.toString)
59
- case "warn" => this.logger.warning(msg.toString)
60
- case "error" => this.logger.severe(msg.toString)
61
- case _ => this.logger.info(msg.toString)
63
+ case "debug" => this.logger.fine(line)
64
+ case "warn" => this.logger.warning(line)
65
+ case "error" => this.logger.severe(line)
66
+ case _ => this.logger.info(line)
62
67
  }
63
68
  }
64
69
  }
@@ -1,6 +1,7 @@
1
1
  package SCALAPACKAGE.feature
2
2
 
3
3
  import java.util.{ArrayList, LinkedHashMap, List => JList, Map => JMap}
4
+ import java.net.URI
4
5
  import java.util.regex.{Matcher, Pattern}
5
6
  import SCALAPACKAGE.core.{Context, FetcherFn, SdkClient}
6
7
 
@@ -21,6 +22,8 @@ class ProxyFeature extends BaseFeature("proxy", "0.0.1", true) {
21
22
  var routed: Int = 0
22
23
  var url: String = ""
23
24
 
25
+ private var target: String = ""
26
+
24
27
  private val HOST_RE: Pattern =
25
28
  Pattern.compile("^[a-z]+://([^/:]+)", Pattern.CASE_INSENSITIVE)
26
29
 
@@ -59,18 +62,36 @@ class ProxyFeature extends BaseFeature("proxy", "0.0.1", true) {
59
62
  }
60
63
  }
61
64
 
65
+ // A proxy URL may carry credentials as userinfo, from the option or the
66
+ // environment, and neither is under a sensitive key name. The transport
67
+ // is handed the raw target; the activity record shows the cleaned one.
68
+ this.target = this.url
69
+ if (!"".equals(this.url) && ctx.utility != null) {
70
+ try {
71
+ val parsed = new URI(this.url)
72
+ for (info <- List(parsed.getRawUserInfo, parsed.getUserInfo)) {
73
+ if (info != null && !"".equals(info)) {
74
+ for (part <- info.split(":", 2)) {
75
+ if (!"".equals(part)) ctx.utility.cleanAdd(ctx, part)
76
+ }
77
+ }
78
+ }
79
+ } catch { case _: RuntimeException => }
80
+ this.url = String.valueOf(ctx.utility.clean(ctx, this.url))
81
+ }
82
+
62
83
  val inner: FetcherFn = ctx.utility.fetcher
63
84
 
64
85
  ctx.utility.fetcher = (ctx2, u, fetchdef) => inner(ctx2, u, route(u, fetchdef))
65
86
  }
66
87
 
67
88
  private def route(u: String, fetchdef: JMap[String, Object]): JMap[String, Object] = {
68
- if ("".equals(this.url) || bypass(u)) {
89
+ if ("".equals(this.target) || bypass(u)) {
69
90
  return fetchdef
70
91
  }
71
92
 
72
93
  val out = new LinkedHashMap[String, Object](fetchdef)
73
- out.put("proxy", this.url)
94
+ out.put("proxy", this.target)
74
95
 
75
96
  this.routed += 1
76
97
  out
@@ -64,6 +64,16 @@ class SecretsFeature extends BaseFeature("secrets", "0.1.0", true) {
64
64
 
65
65
  private var client: SdkClient = null
66
66
 
67
+ // Every value this feature resolves or buys is a secret the SDK handles,
68
+ // and none arrives under an option key the intake registration saw.
69
+ private def register(value: Object): Unit = {
70
+ if (this.client == null) return
71
+ val ctx = this.client.getRootCtx()
72
+ if (ctx != null && ctx.utility != null && ctx.utility.cleanAdd != null) {
73
+ ctx.utility.cleanAdd(ctx, value)
74
+ }
75
+ }
76
+
67
77
  // The LIVE options map (root ctx options). READ ONLY: this feature never
68
78
  // writes it - see the class note.
69
79
  private var liveopts: JMap[String, Object] = null
@@ -171,6 +181,7 @@ class SecretsFeature extends BaseFeature("secrets", "0.1.0", true) {
171
181
  val entries = ListBuffer.empty[Any]
172
182
 
173
183
  if ("" != explicit) {
184
+ register(explicit)
174
185
  try
175
186
  entries += ProviderSpec(
176
187
  kind = "memory",
@@ -291,6 +302,7 @@ class SecretsFeature extends BaseFeature("secrets", "0.1.0", true) {
291
302
  // tryget returns None for a MISS and RAISES for an ERROR. That is the
292
303
  // whole miss-vs-error rule, and it is sekreto's, not this feature's.
293
304
  val found = this.sek.tryget(this.secretname)
305
+ register(found.orNull)
294
306
 
295
307
  if (!this.xactive) {
296
308
  // An UNCACHED miss after an earlier hit is a revocation: the chain now
@@ -439,6 +451,7 @@ class SecretsFeature extends BaseFeature("secrets", "0.1.0", true) {
439
451
  // required server variable, for the same reason.
440
452
  if ("live" != this.client.mode) {
441
453
  this.cred = "test-" + this.xresponse
454
+ register(this.cred)
442
455
  return this.cred
443
456
  }
444
457
 
@@ -503,6 +516,7 @@ class SecretsFeature extends BaseFeature("secrets", "0.1.0", true) {
503
516
  "' field from " + url)
504
517
  }
505
518
 
519
+ register(token)
506
520
  this.cred = token
507
521
  token
508
522
  }
@@ -101,12 +101,19 @@ class TelemetryFeature extends BaseFeature("telemetry", "0.0.1", true) {
101
101
  span.put("durationMs", java.lang.Long.valueOf(dur))
102
102
  span.put("ok", java.lang.Boolean.valueOf(ok))
103
103
 
104
+ val out =
105
+ if (ctx.utility == null || ctx.utility.clean == null) span
106
+ else {
107
+ val c = Helpers.toMapAny(ctx.utility.clean(ctx, span))
108
+ if (c == null) span else c
109
+ }
110
+
104
111
  this.activeSpans -= 1
105
- this.spans.add(span)
112
+ this.spans.add(out)
106
113
 
107
114
  this.options.get("exporter") match {
108
115
  case c: java.util.function.Consumer[_] =>
109
- c.asInstanceOf[java.util.function.Consumer[JMap[String, Object]]].accept(span)
116
+ c.asInstanceOf[java.util.function.Consumer[JMap[String, Object]]].accept(out)
110
117
  case _ =>
111
118
  }
112
119
  }