@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
@@ -1,6 +1,7 @@
1
1
  // ProjectName SDK utility: makeOptions - merge, validate and derive the
2
2
  // client options.
3
3
 
4
+ using System.Collections;
4
5
  using System.Text.RegularExpressions;
5
6
 
6
7
  using Voxgig.Struct;
@@ -134,6 +135,40 @@ public static partial class SdkUtility
134
135
  opts.Remove("auth");
135
136
  }
136
137
 
138
+ var config = ctx.Config ?? new Dictionary<string, object?>();
139
+ var cfgopts = config.TryGetValue("options", out var co) &&
140
+ co is Dictionary<string, object?> cm
141
+ ? cm : new Dictionary<string, object?>();
142
+
143
+ // The secret registry exists BEFORE validation, fed from the raw
144
+ // input, so the constructor's own rejection of a mistyped credential
145
+ // is clean too.
146
+ var cleanlayers = new List<object?>
147
+ {
148
+ new Dictionary<string, object?>(),
149
+ StructUtils.Clone(StructUtils.GetProp(SdkSchema.Optspec, "clean")),
150
+ StructUtils.Clone(StructUtils.GetProp(cfgopts, "clean")) ?? new Dictionary<string, object?>(),
151
+ };
152
+ if (opts.TryGetValue("clean", out var cleanraw) && cleanraw != null)
153
+ {
154
+ cleanlayers.Add(cleanraw);
155
+ }
156
+ var cleancfg = MakeCleanConfig(StructUtils.Merge(cleanlayers));
157
+ var cleanctx = new Context(new Dictionary<string, object?>
158
+ {
159
+ ["options"] = new Dictionary<string, object?>
160
+ {
161
+ ["__derived__"] = new Dictionary<string, object?> { ["clean"] = cleancfg },
162
+ },
163
+ }, null);
164
+ CleanAddOptions(cleanctx, opts, "clean");
165
+ foreach (var raw in CleanSplitValues(
166
+ StructUtils.GetPath(cfgopts, StructUtils.Jt("clean", "values")))
167
+ .Concat(CleanSplitValues(StructUtils.GetPath(opts, StructUtils.Jt("clean", "values")))))
168
+ {
169
+ CleanAddUtil(cleanctx, raw);
170
+ }
171
+
137
172
  // Feature add-order. options.feature may be given as an ordered LIST of
138
173
  // { name, active, ...opts } entries (the list position IS the order in
139
174
  // which features are added), or as a { name: {opts} } map. Normalize a
@@ -159,11 +194,6 @@ public static partial class SdkUtility
159
194
  opts["feature"] = fmap;
160
195
  }
161
196
 
162
- var config = ctx.Config ?? new Dictionary<string, object?>();
163
- var cfgopts = config.TryGetValue("options", out var co) &&
164
- co is Dictionary<string, object?> cm
165
- ? cm : new Dictionary<string, object?>();
166
-
167
197
  // THE OPTION SPEC IS GENERATED, NOT WRITTEN HERE.
168
198
  //
169
199
  // Built from the model: `main.kit.optspec` for the standard options,
@@ -192,7 +222,24 @@ public static partial class SdkUtility
192
222
  StructUtils.Clone(cfgopts),
193
223
  opts,
194
224
  });
195
- var validated = StructUtils.Validate(merged, optspec);
225
+ object? validated;
226
+ try
227
+ {
228
+ validated = StructUtils.Validate(merged, optspec);
229
+ }
230
+ catch (Exception verr)
231
+ {
232
+ // The struct port's message quotes the offending value, which is
233
+ // the credential when that is what was mistyped. Exception's
234
+ // message is read-only, so a changed message travels as the SDK's
235
+ // own error; an unchanged one is the original, rethrown.
236
+ var cleaned = CleanUtil(cleanctx, verr.Message) as string ?? verr.Message;
237
+ if (cleaned == verr.Message)
238
+ {
239
+ throw;
240
+ }
241
+ throw new ProjectNameError("options_invalid", cleaned, null);
242
+ }
196
243
  opts = validated as Dictionary<string, object?> ?? new Dictionary<string, object?>();
197
244
 
198
245
  // Restore the suppression the optspec default would otherwise erase.
@@ -263,20 +310,6 @@ public static partial class SdkUtility
263
310
  }
264
311
  }
265
312
 
266
- // Derived clean config.
267
- var cleanKeys = "key,token,id";
268
- if (StructUtils.GetPath(opts, StructUtils.Jt("clean", "keys")) is string cks)
269
- {
270
- cleanKeys = cks;
271
- }
272
-
273
- var filtered = cleanKeys.Split(',')
274
- .Select(p => p.Trim())
275
- .Where(p => p != "")
276
- .Select(StructUtils.EscRe)
277
- .ToList();
278
- var keyre = string.Join("|", filtered);
279
-
280
313
  // Resolve the feature add-order: an explicit list order (above) wins;
281
314
  // otherwise order the map test-first, then the remaining names sorted,
282
315
  // so the outcome is deterministic and `test` is always the base
@@ -319,20 +352,77 @@ public static partial class SdkUtility
319
352
  }
320
353
  }
321
354
 
322
- var derived = new Dictionary<string, object?>
355
+ opts["__derived__"] = new Dictionary<string, object?>
323
356
  {
324
- ["clean"] = new Dictionary<string, object?>(),
357
+ ["clean"] = cleancfg,
358
+ ["featureorder"] = featureorder,
325
359
  };
326
- if (keyre != "")
360
+
361
+ // Again over the merged result: the config's own defaults can carry one.
362
+ CleanAddOptions(cleanctx, opts, "clean", "__derived__");
363
+
364
+ return opts;
365
+ }
366
+
367
+ // A feature's name is not a field name: a feature called `secrets` does
368
+ // not make every one of its options a secret. Entity blocks (entity
369
+ // settings, seeded records) hold no credential.
370
+ private static void CleanAddOptions(Context cleanctx, Dictionary<string, object?> opts,
371
+ params string[] omit)
372
+ {
373
+ var top = CleanOmit(opts, omit.Append("feature").Append("entity").ToArray());
374
+ if (top.ContainsKey("test"))
375
+ {
376
+ top["test"] = CleanNoEntity(top["test"]);
377
+ }
378
+ CleanAddSensitive(cleanctx, top);
379
+ var feature = opts.GetValueOrDefault("feature");
380
+ if (feature is IDictionary fmap)
381
+ {
382
+ foreach (DictionaryEntry kv in fmap)
383
+ {
384
+ CleanAddSensitive(cleanctx, CleanNoEntity(kv.Value));
385
+ }
386
+ }
387
+ else if (feature is IList flist)
388
+ {
389
+ foreach (var entry in flist)
390
+ {
391
+ CleanAddSensitive(cleanctx, CleanNoEntity(entry));
392
+ }
393
+ }
394
+ else
395
+ {
396
+ CleanAddSensitive(cleanctx, feature);
397
+ }
398
+ }
399
+
400
+ private static object? CleanNoEntity(object? block)
401
+ {
402
+ if (block is not IDictionary dict)
327
403
  {
328
- derived["clean"] = new Dictionary<string, object?>
404
+ return block;
405
+ }
406
+ var out_ = new Dictionary<string, object?>();
407
+ foreach (DictionaryEntry kv in dict)
408
+ {
409
+ var key = Convert.ToString(kv.Key) ?? "";
410
+ if (key != "entity")
329
411
  {
330
- ["keyre"] = keyre,
331
- };
412
+ out_[key] = kv.Value;
413
+ }
332
414
  }
333
- derived["featureorder"] = featureorder;
334
- opts["__derived__"] = derived;
415
+ return out_;
416
+ }
335
417
 
336
- return opts;
418
+ private static Dictionary<string, object?> CleanOmit(Dictionary<string, object?> opts,
419
+ params string[] keys)
420
+ {
421
+ var out_ = new Dictionary<string, object?>(opts);
422
+ foreach (var key in keys)
423
+ {
424
+ out_.Remove(key);
425
+ }
426
+ return out_;
337
427
  }
338
428
  }
@@ -35,21 +35,31 @@ public static partial class SdkUtility
35
35
 
36
36
  spec.Step = "response";
37
37
 
38
- utility.ResultBasic(ctx);
39
- utility.ResultHeaders(ctx);
40
- utility.ResultBody(ctx);
38
+ // A shaping failure (a body that is not JSON) is the operation's
39
+ // result, as in ts: carried on result.Err so the pipeline still
40
+ // reaches Done, which is what cleans the explain record.
41
+ try
42
+ {
43
+ utility.ResultBasic(ctx);
44
+ utility.ResultHeaders(ctx);
45
+ utility.ResultBody(ctx);
41
46
 
42
- // GraphQL reports failures as a top-level `errors` array under HTTP
43
- // 200, so ResultBasic's status check never sees them. Lift them
44
- // here, before the response transform tries to unwrap data that is
45
- // not there.
46
- utility.GraphqlErrors(ctx);
47
+ // GraphQL reports failures as a top-level `errors` array under HTTP
48
+ // 200, so ResultBasic's status check never sees them. Lift them
49
+ // here, before the response transform tries to unwrap data that is
50
+ // not there.
51
+ utility.GraphqlErrors(ctx);
47
52
 
48
- utility.TransformResponse(ctx);
53
+ utility.TransformResponse(ctx);
49
54
 
50
- if (result.Err == null)
55
+ if (result.Err == null)
56
+ {
57
+ result.Ok = true;
58
+ }
59
+ }
60
+ catch (Exception err)
51
61
  {
52
- result.Ok = true;
62
+ result.Err = err;
53
63
  }
54
64
 
55
65
  if (ctx.Ctrl.Explain != null)
@@ -9,6 +9,7 @@ public static partial class SdkUtility
9
9
  public static void RegisterAll(Utility u)
10
10
  {
11
11
  u.Clean = CleanUtil;
12
+ u.CleanAdd = CleanAddUtil;
12
13
  u.Done = DoneUtil;
13
14
  u.MakeError = MakeErrorUtil;
14
15
  u.FeatureAdd = FeatureAddUtil;
@@ -21,6 +21,25 @@ defmodule ProjectName.Context do
21
21
 
22
22
  def make_error(ctx, code, msg), do: Error.new(code, msg, ctx)
23
23
 
24
+ # The serialised context leaves the pipeline (a logger, an error dump), so
25
+ # it is the cleaned record; the live fields stay raw for the pipeline's use.
26
+ # A context node itself inspects as a handle, so this is the SDK's own
27
+ # serialisation of one.
28
+ def to_data(ctx) do
29
+ record =
30
+ S.jm([
31
+ "id", S.getprop(ctx, "id"),
32
+ "op", S.getprop(ctx, "op"),
33
+ "spec", S.getprop(ctx, "spec"),
34
+ "entity", entity_name(S.getprop(ctx, "entity")),
35
+ "result", S.getprop(ctx, "result"),
36
+ "response", S.getprop(ctx, "response"),
37
+ "meta", S.getprop(ctx, "meta")
38
+ ])
39
+
40
+ ProjectName.Feature.clean(ctx, record)
41
+ end
42
+
24
43
  def new(ctxmap \\ nil, basectx \\ nil) do
25
44
  cm = if S.ismap(ctxmap), do: ctxmap, else: nil
26
45
  gp = fn k -> H.get_ctx_prop(cm, k) end
@@ -153,7 +153,7 @@ defmodule ProjectName.EntityBase do
153
153
  # materialised items so stream always yields.
154
154
  items =
155
155
  if S.isfunc(stream_fn) do
156
- stream_fn.()
156
+ cleaned(ctx, stream_fn)
157
157
  else
158
158
  rd = if result != nil, do: S.getprop(result, "resdata"), else: nil
159
159
 
@@ -167,6 +167,27 @@ defmodule ProjectName.EntityBase do
167
167
  items
168
168
  |> Stream.take_while(fn _ -> not (S.isfunc(signal) and signal.() == true) end)
169
169
  |> Stream.map(&stream_unwrap/1)
170
+ |> guarded(ctx)
171
+ end
172
+
173
+ # The caller iterates after run_op has returned, so what the stream raises
174
+ # is cleaned here, as run_op's rescue would clean it. The caller's own
175
+ # reducer runs inside the reduce, so what it raises is cleaned too.
176
+ defp cleaned(ctx, step) do
177
+ step.()
178
+ rescue
179
+ e -> reraise(Utility.clean_exception(ctx, e), __STACKTRACE__)
180
+ end
181
+
182
+ defp guarded(enum, ctx) do
183
+ fn acc, fun -> reduce_step(ctx, fn -> Enumerable.reduce(enum, acc, fun) end) end
184
+ end
185
+
186
+ defp reduce_step(ctx, step) do
187
+ case cleaned(ctx, step) do
188
+ {:suspended, acc, cont} -> {:suspended, acc, fn a -> reduce_step(ctx, fn -> cont.(a) end) end}
189
+ done -> done
190
+ end
170
191
  end
171
192
 
172
193
  # Unwrap an entity node to its bare record; recurse into chunk lists.
@@ -13,4 +13,28 @@ defmodule ProjectName.Error do
13
13
  def new(code \\ "", msg \\ "", ctx \\ nil) do
14
14
  %__MODULE__{code: code, msg: msg, sdk: "ProjectName", ctx: ctx}
15
15
  end
16
+
17
+ # The HTTP status, promoted so a caller can branch without reaching into
18
+ # the result's shape; -1 when there was no response.
19
+ def status(%__MODULE__{result: result}) do
20
+ s = if Voxgig.Struct.ismap(result), do: Voxgig.Struct.getprop(result, "status"), else: nil
21
+ if is_number(s), do: trunc(s), else: -1
22
+ end
23
+
24
+ def not_found?(%__MODULE__{} = e), do: 404 == status(e)
25
+ end
26
+
27
+ # The context holds the live spec and options, and an error is what gets
28
+ # logged: the printed form carries what make_error attached, which is already
29
+ # cleaned, and never the context. A struct node prints as its JSON, since a
30
+ # bare handle says nothing.
31
+ defimpl Inspect, for: ProjectName.Error do
32
+ import Inspect.Algebra
33
+ alias Voxgig.Struct, as: S
34
+
35
+ def inspect(e, opts) do
36
+ show = fn v -> if S.isnode(v), do: S.jsonify(v, S.jm(["indent", 0])), else: v end
37
+ fields = [code: e.code, msg: e.msg, sdk: e.sdk, result: show.(e.result), spec: show.(e.spec)]
38
+ concat(["#ProjectName.Error<", to_doc(fields, opts), ">"])
39
+ end
16
40
  end
@@ -76,7 +76,7 @@ defmodule ProjectName.Feature.Audit do
76
76
  status = if result != nil, do: S.getprop(result, "status"), else: nil
77
77
 
78
78
  record =
79
- S.jm([
79
+ Feature.clean(ctx, S.jm([
80
80
  "seq", seq,
81
81
  "ts", Feature.now(f),
82
82
  "actor", actor,
@@ -85,7 +85,7 @@ defmodule ProjectName.Feature.Audit do
85
85
  "outcome", outcome,
86
86
  "status", status,
87
87
  "correlationId", S.getprop(ctx, "id")
88
- ])
88
+ ]))
89
89
 
90
90
  client = S.getprop(f, "client")
91
91
  records = S.getprop(S.getprop(client, "_audit"), "records")
@@ -261,7 +261,7 @@ defmodule ProjectName.Feature.Cost do
261
261
  S.setprop(f, "seq", seq)
262
262
 
263
263
  record =
264
- S.jm([
264
+ Feature.clean(ctx, S.jm([
265
265
  "seq", seq,
266
266
  "entity", entity,
267
267
  "op", opname,
@@ -270,7 +270,7 @@ defmodule ProjectName.Feature.Cost do
270
270
  "currency", S.getprop(cost, "currency"),
271
271
  "source", source,
272
272
  "attempts", S.getprop(pending, "attempts")
273
- ])
273
+ ]))
274
274
 
275
275
  S.setprop(cost, "last", record)
276
276
 
@@ -54,7 +54,7 @@ defmodule ProjectName.Feature.Debug do
54
54
  "method", if(spec != nil, do: S.getprop(spec, "method"), else: nil),
55
55
  "url",
56
56
  if(spec != nil, do: H.or_(S.getprop(spec, "url"), S.getprop(spec, "path")), else: nil),
57
- "headers", redact(f, if(spec != nil, do: S.getprop(spec, "headers"), else: nil)),
57
+ "headers", redact(f, ctx, if(spec != nil, do: S.getprop(spec, "headers"), else: nil)),
58
58
  "start", F.now(f),
59
59
  "status", nil,
60
60
  "ok", nil,
@@ -137,6 +137,11 @@ defmodule ProjectName.Feature.Debug do
137
137
  S.setprop(entry, "status", S.getprop(result, "status"))
138
138
  end
139
139
 
140
+ # The whole entry leaves through the buffer and the callback: the url
141
+ # and the error message can carry a query credential the header mask
142
+ # never saw.
143
+ entry = F.clean(ctx, entry)
144
+
140
145
  client = S.getprop(f, "client")
141
146
  buf = S.getprop(S.getprop(client, "_debug"), "entries")
142
147
  F.list_push(buf, entry)
@@ -158,32 +163,27 @@ defmodule ProjectName.Feature.Debug do
158
163
  end
159
164
  end
160
165
 
161
- defp redact(f, headers) do
166
+ # The core clean rules apply (clean.keys, every registered value); the
167
+ # feature's own `redact` list ADDS header names on top of them.
168
+ defp redact(f, ctx, headers) do
162
169
  if headers == nil do
163
170
  S.jm([])
164
171
  else
165
172
  patterns =
166
- opt_list(S.getprop(F.opts(f), "redact"), [
167
- "authorization",
168
- "cookie",
169
- "set-cookie",
170
- "api-key",
171
- "apikey",
172
- "x-api-key",
173
- "idempotency-key"
174
- ])
173
+ opt_list(S.getprop(F.opts(f), "redact"), [])
174
+ |> Enum.map(fn p -> String.downcase(to_string(p)) end)
175
175
 
176
176
  out = S.jm([])
177
177
 
178
178
  Enum.each(H.entries(headers), fn {k, v} ->
179
179
  if String.downcase(to_string(k)) in patterns do
180
- S.setprop(out, k, "<redacted>")
180
+ S.setprop(out, k, "[redacted]")
181
181
  else
182
182
  S.setprop(out, k, v)
183
183
  end
184
184
  end)
185
185
 
186
- out
186
+ F.clean(ctx, out)
187
187
  end
188
188
  end
189
189
 
@@ -28,11 +28,13 @@ defmodule ProjectName.Feature.Log do
28
28
  logger = S.getprop(F.opts(f), "logger")
29
29
 
30
30
  logger =
31
- if S.ismap(logger) do
31
+ if S.ismap(logger) or S.isfunc(logger) do
32
32
  logger
33
33
  else
34
34
  mk = fn level ->
35
- fn msg -> IO.write(:stderr, "[" <> level <> "] " <> msg <> "\n") end
35
+ fn record ->
36
+ IO.write(:stderr, "[" <> level <> "] " <> S.jsonify(record, S.jm(["indent", 0])) <> "\n")
37
+ end
36
38
  end
37
39
 
38
40
  S.jm(["info", mk.("INFO"), "debug", mk.("DEBUG"), "warn", mk.("WARN"), "error", mk.("ERROR")])
@@ -44,6 +46,9 @@ defmodule ProjectName.Feature.Log do
44
46
  nil
45
47
  end
46
48
 
49
+ # A log line leaves the pipeline, so it carries the cleaned record: the
50
+ # spec after auth holds the credential, and a logger serialises whatever it
51
+ # is handed. `logger` is a fn of the record, or a map with an "info" fn.
47
52
  defp loghook(f, hook, ctx) do
48
53
  if F.active?(f) do
49
54
  logger = S.getprop(f, "logger")
@@ -51,9 +56,17 @@ defmodule ProjectName.Feature.Log do
51
56
  if logger != nil do
52
57
  op = S.getprop(ctx, "op")
53
58
  opname = if op != nil, do: S.getprop(op, "name"), else: ""
54
- msg = "hook=" <> hook <> " op=" <> to_string(opname)
55
- log_fn = S.getprop(logger, "info")
56
- if S.isfunc(log_fn), do: log_fn.(msg)
59
+
60
+ record =
61
+ F.clean(ctx, S.jm([
62
+ "hook", hook,
63
+ "op", opname,
64
+ "spec", S.getprop(ctx, "spec"),
65
+ "ctx", ProjectName.Context.to_data(ctx)
66
+ ]))
67
+
68
+ log_fn = if S.isfunc(logger), do: logger, else: S.getprop(logger, "info")
69
+ if S.isfunc(log_fn), do: log_fn.(record)
57
70
  end
58
71
  end
59
72
 
@@ -52,7 +52,25 @@ defmodule ProjectName.Feature.Proxy do
52
52
 
53
53
  np_list = Enum.filter(np_list, fn s -> s != nil and s != "" end)
54
54
 
55
+ # A proxy URL may carry credentials as userinfo, from the option or
56
+ # the environment, and neither is under a sensitive key name.
57
+ if is_binary(url) do
58
+ case URI.parse(url).userinfo do
59
+ nil ->
60
+ nil
61
+
62
+ ui ->
63
+ Enum.each(String.split(ui, ":", parts: 2), fn part ->
64
+ if part != "" do
65
+ F.clean_add(ctx, part)
66
+ F.clean_add(ctx, URI.decode(part))
67
+ end
68
+ end)
69
+ end
70
+ end
71
+
55
72
  S.setprop(f, "url", url)
73
+ S.setprop(f, "clean_url", if(is_binary(url), do: F.clean(ctx, url), else: url))
56
74
  S.setprop(f, "no_proxy", S.jt(np_list))
57
75
 
58
76
  utility = S.getprop(ctx, "utility")
@@ -112,7 +130,7 @@ defmodule ProjectName.Feature.Proxy do
112
130
 
113
131
  defp track(f) do
114
132
  client = S.getprop(f, "client")
115
- track = F.track_node(client, "_proxy", S.jm(["routed", 0, "url", S.getprop(f, "url")]))
133
+ track = F.track_node(client, "_proxy", S.jm(["routed", 0, "url", S.getprop(f, "clean_url")]))
116
134
  S.setprop(track, "routed", S.getprop(track, "routed") + 1)
117
135
  end
118
136
 
@@ -229,6 +229,8 @@ defmodule ProjectName.Feature.Secrets do
229
229
  if xopts == nil, do: nil, else: S.getprop(xopts, "refresh")
230
230
  end
231
231
 
232
+ register(f, explicit)
233
+
232
234
  first =
233
235
  if is_binary(explicit) and explicit != "" do
234
236
  [%Sekreto.ProviderSpec{
@@ -431,7 +433,18 @@ defmodule ProjectName.Feature.Secrets do
431
433
  end
432
434
  end
433
435
 
436
+ # Every value the chain resolves and every token bought can leave through
437
+ # the SDK's diagnostics, so each is registered with the clean utility the
438
+ # moment this feature sees it.
439
+ defp register(f, v) do
440
+ client = S.getprop(f, "client")
441
+ ctx = if client != nil, do: S.getprop(client, "_rootctx"), else: nil
442
+ if is_binary(v) and ctx != nil, do: F.clean_add(ctx, v)
443
+ nil
444
+ end
445
+
434
446
  defp settle(f, found) do
447
+ register(f, found)
435
448
  x = S.getprop(f, "_exchange")
436
449
 
437
450
  if x == nil do
@@ -637,11 +650,13 @@ defmodule ProjectName.Feature.Secrets do
637
650
  if S.getprop(client, "mode") != "live" do
638
651
  token = "test-" <> x.response
639
652
  S.setprop(f, "_cred", token)
653
+ register(f, token)
640
654
  {:ok, token}
641
655
  else
642
656
  case buy_once(f, x) do
643
657
  {:ok, token} ->
644
658
  S.setprop(f, "_cred", token)
659
+ register(f, token)
645
660
  {:ok, token}
646
661
 
647
662
  other ->
@@ -132,15 +132,17 @@ defmodule ProjectName.Feature.Telemetry do
132
132
  S.setprop(span, "durationMs", max(0, fin - S.getprop(span, "start")))
133
133
  S.setprop(span, "ok", ok)
134
134
 
135
+ out = F.clean(ctx, span)
136
+
135
137
  telemetry = S.getprop(S.getprop(f, "client"), "_telemetry")
136
138
  S.setprop(telemetry, "active", S.getprop(telemetry, "active") - 1)
137
- F.list_push(S.getprop(telemetry, "spans"), span)
139
+ F.list_push(S.getprop(telemetry, "spans"), out)
138
140
 
139
141
  exporter = S.getprop(F.opts(f), "exporter")
140
142
 
141
143
  if S.isfunc(exporter) do
142
144
  try do
143
- exporter.(span)
145
+ exporter.(out)
144
146
  rescue
145
147
  _ -> nil
146
148
  end
@@ -42,6 +42,28 @@ defmodule ProjectName.Feature do
42
42
 
43
43
  def active?(f), do: S.getprop(f, "active") == true
44
44
 
45
+ # The utility's clean, or the shipped one when a caller-built utility (the
46
+ # test harness) carries no such member. What a feature emits, it cleans.
47
+ def clean(ctx, v) do
48
+ case util_member(ctx, "clean") do
49
+ nil -> ProjectName.Utility.clean_impl(ctx, v)
50
+ f -> f.(ctx, v)
51
+ end
52
+ end
53
+
54
+ def clean_add(ctx, v) do
55
+ case util_member(ctx, "clean_add") do
56
+ nil -> ProjectName.Utility.clean_add_impl(ctx, v)
57
+ f -> f.(ctx, v)
58
+ end
59
+ end
60
+
61
+ defp util_member(ctx, name) do
62
+ u = if S.ismap(ctx), do: S.getprop(ctx, "utility"), else: nil
63
+ f = if S.ismap(u), do: S.getprop(u, name), else: nil
64
+ if S.isfunc(f), do: f, else: nil
65
+ end
66
+
45
67
  # Injectable clock (ms) — options.now() when a function, else wall clock.
46
68
  def now(f) do
47
69
  n = S.getprop(opts(f), "now")