@voxgig/sdkgen 4.50.0 → 4.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (400) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/cmp/ReadmeExplanation.js +5 -2
  3. package/dist/cmp/ReadmeExplanation.js.map +1 -1
  4. package/dist/cmp/ReadmeFeatures.js +20 -6
  5. package/dist/cmp/ReadmeFeatures.js.map +1 -1
  6. package/dist/helpers/optspec.js +2 -2
  7. package/dist/helpers/optspec.js.map +1 -1
  8. package/dist/tsconfig.tsbuildinfo +1 -1
  9. package/model/sdkgen.aontu +1 -1
  10. package/package.json +1 -1
  11. package/project/.sdk/model/feature/audit.aontu +1 -1
  12. package/project/.sdk/model/feature/cache.aontu +7 -5
  13. package/project/.sdk/model/feature/clienttrack.aontu +1 -1
  14. package/project/.sdk/model/feature/cost.aontu +1 -1
  15. package/project/.sdk/model/feature/debug.aontu +1 -1
  16. package/project/.sdk/model/feature/idempotency.aontu +1 -1
  17. package/project/.sdk/model/feature/log.aontu +1 -1
  18. package/project/.sdk/model/feature/metrics.aontu +3 -1
  19. package/project/.sdk/model/feature/netsim.aontu +1 -1
  20. package/project/.sdk/model/feature/paging.aontu +4 -1
  21. package/project/.sdk/model/feature/proxy.aontu +1 -1
  22. package/project/.sdk/model/feature/ratelimit.aontu +3 -3
  23. package/project/.sdk/model/feature/rbac.aontu +1 -1
  24. package/project/.sdk/model/feature/retry.aontu +1 -1
  25. package/project/.sdk/model/feature/secrets.aontu +1 -1
  26. package/project/.sdk/model/feature/streaming.aontu +1 -1
  27. package/project/.sdk/model/feature/telemetry.aontu +2 -2
  28. package/project/.sdk/model/feature/test.aontu +1 -1
  29. package/project/.sdk/model/feature/timeout.aontu +1 -1
  30. package/project/.sdk/model/feature/validate.aontu +1 -1
  31. package/project/.sdk/model/target/lua.aontu +6 -0
  32. package/project/.sdk/src/cmp/c/Config_c.ts +3 -134
  33. package/project/.sdk/src/cmp/c/TestClean_c.ts +26 -11
  34. package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +17 -10
  35. package/project/.sdk/src/cmp/clojure/TestClean_clojure.ts +10 -5
  36. package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +18 -1
  37. package/project/.sdk/src/cmp/cpp/TestClean_cpp.ts +15 -1
  38. package/project/.sdk/src/cmp/csharp/TestClean_csharp.ts +9 -0
  39. package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +30 -2
  40. package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +31 -12
  41. package/project/.sdk/src/cmp/elixir/TestClean_elixir.ts +13 -4
  42. package/project/.sdk/src/cmp/elixir/fragment/Main.fragment.ex +51 -15
  43. package/project/.sdk/src/cmp/elixir/fragment/Pipeline.fragment.ex +17 -0
  44. package/project/.sdk/src/cmp/go/TestClean_go.ts +39 -3
  45. package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +42 -2
  46. package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +42 -14
  47. package/project/.sdk/src/cmp/java/TestClean_java.ts +17 -4
  48. package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +21 -0
  49. package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +13 -8
  50. package/project/.sdk/src/cmp/js/TestClean_js.ts +13 -5
  51. package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +26 -2
  52. package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +8 -0
  53. package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +8 -0
  54. package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +8 -0
  55. package/project/.sdk/src/cmp/js/fragment/EntityPatchOp.fragment.js +8 -0
  56. package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +8 -0
  57. package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +8 -0
  58. package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +12 -5
  59. package/project/.sdk/src/cmp/kotlin/TestClean_kotlin.ts +31 -4
  60. package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +19 -0
  61. package/project/.sdk/src/cmp/lua/TestClean_lua.ts +14 -4
  62. package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +42 -5
  63. package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +44 -10
  64. package/project/.sdk/src/cmp/lua/utility_lua.ts +2 -1
  65. package/project/.sdk/src/cmp/ocaml/TestClean_ocaml.ts +20 -5
  66. package/project/.sdk/src/cmp/ocaml/fragment/RunOp.fragment.ml +36 -21
  67. package/project/.sdk/src/cmp/perl/TestClean_perl.ts +13 -4
  68. package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +21 -0
  69. package/project/.sdk/src/cmp/perl/fragment/Main.fragment.pm +31 -12
  70. package/project/.sdk/src/cmp/php/TestClean_php.ts +10 -3
  71. package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +33 -4
  72. package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +13 -6
  73. package/project/.sdk/src/cmp/py/TestClean_py.ts +10 -3
  74. package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +25 -2
  75. package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +26 -12
  76. package/project/.sdk/src/cmp/rb/TestClean_rb.ts +11 -4
  77. package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +23 -2
  78. package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +27 -11
  79. package/project/.sdk/src/cmp/rust/TestClean_rust.ts +24 -17
  80. package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +22 -2
  81. package/project/.sdk/src/cmp/scala/TestClean_scala.ts +45 -11
  82. package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +14 -0
  83. package/project/.sdk/src/cmp/swift/TestClean_swift.ts +31 -21
  84. package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +9 -0
  85. package/project/.sdk/src/cmp/swift/fragment/Main.fragment.swift +24 -10
  86. package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +13 -8
  87. package/project/.sdk/src/cmp/ts/TestClean_ts.ts +13 -5
  88. package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +26 -2
  89. package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +8 -0
  90. package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +8 -0
  91. package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +8 -0
  92. package/project/.sdk/src/cmp/ts/fragment/EntityPatchOp.fragment.ts +8 -0
  93. package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +8 -0
  94. package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +8 -0
  95. package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +12 -5
  96. package/project/.sdk/src/cmp/zig/TestClean_zig.ts +23 -11
  97. package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +17 -10
  98. package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +41 -6
  99. package/project/.sdk/tm/c/core/context.c +1 -0
  100. package/project/.sdk/tm/c/core/sdk.h +7 -4
  101. package/project/.sdk/tm/c/feature/cache.c +243 -13
  102. package/project/.sdk/tm/c/feature/metrics.c +7 -0
  103. package/project/.sdk/tm/c/feature/paging.c +231 -2
  104. package/project/.sdk/tm/c/feature/ratelimit.c +5 -9
  105. package/project/.sdk/tm/c/feature/retry.c +51 -4
  106. package/project/.sdk/tm/c/feature/secrets.c +27 -38
  107. package/project/.sdk/tm/c/feature/streaming.c +2 -1
  108. package/project/.sdk/tm/c/feature/telemetry.c +19 -18
  109. package/project/.sdk/tm/c/feature/test.c +78 -54
  110. package/project/.sdk/tm/c/tests/feature_test.c +288 -0
  111. package/project/.sdk/tm/c/tests/primary_utility_test.c +2 -0
  112. package/project/.sdk/tm/c/utility/clean.c +26 -33
  113. package/project/.sdk/tm/c/utility/make_options.c +89 -17
  114. package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +14 -11
  115. package/project/.sdk/tm/clojure/src/sdk/client.clj +3 -1
  116. package/project/.sdk/tm/clojure/src/sdk/core.clj +50 -22
  117. package/project/.sdk/tm/clojure/src/sdk/features.clj +279 -80
  118. package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +103 -1
  119. package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +1 -0
  120. package/project/.sdk/tm/cpp/Makefile +5 -0
  121. package/project/.sdk/tm/cpp/core/types.hpp +148 -72
  122. package/project/.sdk/tm/cpp/feature/audit.hpp +12 -8
  123. package/project/.sdk/tm/cpp/feature/cache.hpp +188 -9
  124. package/project/.sdk/tm/cpp/feature/metrics.hpp +19 -0
  125. package/project/.sdk/tm/cpp/feature/paging.hpp +160 -2
  126. package/project/.sdk/tm/cpp/feature/ratelimit.hpp +18 -14
  127. package/project/.sdk/tm/cpp/feature/retry.hpp +46 -5
  128. package/project/.sdk/tm/cpp/feature/secrets.hpp +12 -0
  129. package/project/.sdk/tm/cpp/feature/streaming.hpp +2 -1
  130. package/project/.sdk/tm/cpp/feature/telemetry.hpp +17 -10
  131. package/project/.sdk/tm/cpp/feature/test.hpp +63 -53
  132. package/project/.sdk/tm/cpp/test/feature_test.cpp +236 -0
  133. package/project/.sdk/tm/cpp/utility/pipeline.hpp +44 -12
  134. package/project/.sdk/tm/csharp/core/Context.cs +4 -0
  135. package/project/.sdk/tm/csharp/feature/AuditFeature.cs +8 -1
  136. package/project/.sdk/tm/csharp/feature/CacheFeature.cs +126 -12
  137. package/project/.sdk/tm/csharp/feature/MetricsFeature.cs +23 -0
  138. package/project/.sdk/tm/csharp/feature/PagingFeature.cs +130 -3
  139. package/project/.sdk/tm/csharp/feature/RatelimitFeature.cs +26 -19
  140. package/project/.sdk/tm/csharp/feature/RetryFeature.cs +41 -7
  141. package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +9 -27
  142. package/project/.sdk/tm/csharp/feature/StreamingFeature.cs +2 -1
  143. package/project/.sdk/tm/csharp/feature/TelemetryFeature.cs +11 -9
  144. package/project/.sdk/tm/csharp/feature/TestFeature.cs +55 -67
  145. package/project/.sdk/tm/csharp/test/FeatureTest.cs +238 -0
  146. package/project/.sdk/tm/csharp/utility/Clean.cs +5 -10
  147. package/project/.sdk/tm/csharp/utility/Fetcher.cs +7 -1
  148. package/project/.sdk/tm/csharp/utility/MakeOptions.cs +94 -24
  149. package/project/.sdk/tm/elixir/lib/projectname/context.ex +2 -0
  150. package/project/.sdk/tm/elixir/lib/projectname/feature/cache.ex +146 -30
  151. package/project/.sdk/tm/elixir/lib/projectname/feature/metrics.ex +13 -0
  152. package/project/.sdk/tm/elixir/lib/projectname/feature/paging.ex +110 -5
  153. package/project/.sdk/tm/elixir/lib/projectname/feature/ratelimit.ex +6 -12
  154. package/project/.sdk/tm/elixir/lib/projectname/feature/retry.ex +33 -9
  155. package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +10 -56
  156. package/project/.sdk/tm/elixir/lib/projectname/feature/streaming.ex +2 -1
  157. package/project/.sdk/tm/elixir/lib/projectname/feature/telemetry.ex +7 -7
  158. package/project/.sdk/tm/elixir/lib/projectname/feature/test.ex +52 -48
  159. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +77 -47
  160. package/project/.sdk/tm/elixir/test/feature_test.exs +198 -0
  161. package/project/.sdk/tm/go/core/context.go +6 -0
  162. package/project/.sdk/tm/go/feature/audit_feature.go +1 -3
  163. package/project/.sdk/tm/go/feature/base_feature.go +11 -0
  164. package/project/.sdk/tm/go/feature/cache_feature.go +131 -4
  165. package/project/.sdk/tm/go/feature/metrics_feature.go +14 -0
  166. package/project/.sdk/tm/go/feature/paging_feature.go +108 -2
  167. package/project/.sdk/tm/go/feature/ratelimit_feature.go +19 -17
  168. package/project/.sdk/tm/go/feature/retry_feature.go +81 -9
  169. package/project/.sdk/tm/go/feature/secrets_feature.go +17 -71
  170. package/project/.sdk/tm/go/feature/streaming_feature.go +2 -1
  171. package/project/.sdk/tm/go/feature/telemetry_feature.go +18 -11
  172. package/project/.sdk/tm/go/feature/test_feature.go +65 -55
  173. package/project/.sdk/tm/go/test/feature_corpus_test.go +357 -28
  174. package/project/.sdk/tm/go/test/feature_test.go +93 -0
  175. package/project/.sdk/tm/go/utility/clean.go +5 -7
  176. package/project/.sdk/tm/go/utility/fetcher.go +11 -0
  177. package/project/.sdk/tm/go/utility/make_options.go +116 -13
  178. package/project/.sdk/tm/java/core/Context.java +9 -0
  179. package/project/.sdk/tm/java/core/SdkClient.java +43 -14
  180. package/project/.sdk/tm/java/feature/AuditFeature.java +5 -1
  181. package/project/.sdk/tm/java/feature/CacheFeature.java +123 -17
  182. package/project/.sdk/tm/java/feature/MetricsFeature.java +31 -0
  183. package/project/.sdk/tm/java/feature/PagingFeature.java +156 -2
  184. package/project/.sdk/tm/java/feature/RatelimitFeature.java +15 -13
  185. package/project/.sdk/tm/java/feature/RetryFeature.java +33 -6
  186. package/project/.sdk/tm/java/feature/SecretsFeature.java +9 -92
  187. package/project/.sdk/tm/java/feature/StreamingFeature.java +2 -1
  188. package/project/.sdk/tm/java/feature/TelemetryFeature.java +17 -9
  189. package/project/.sdk/tm/java/feature/TestFeature.java +50 -63
  190. package/project/.sdk/tm/java/test/FeatureCorpusTest.java +309 -17
  191. package/project/.sdk/tm/java/test/FeatureTest.java +60 -0
  192. package/project/.sdk/tm/java/utility/Clean.java +6 -10
  193. package/project/.sdk/tm/java/utility/Fetcher.java +5 -1
  194. package/project/.sdk/tm/java/utility/MakeOptions.java +131 -15
  195. package/project/.sdk/tm/js/src/Context.js +4 -0
  196. package/project/.sdk/tm/js/src/feature/cache/CacheFeature.js +118 -11
  197. package/project/.sdk/tm/js/src/feature/cost/CostFeature.js +3 -2
  198. package/project/.sdk/tm/js/src/feature/metrics/MetricsFeature.js +9 -4
  199. package/project/.sdk/tm/js/src/feature/paging/PagingFeature.js +103 -5
  200. package/project/.sdk/tm/js/src/feature/ratelimit/RatelimitFeature.js +5 -9
  201. package/project/.sdk/tm/js/src/feature/rbac/RbacFeature.js +4 -4
  202. package/project/.sdk/tm/js/src/feature/retry/RetryFeature.js +25 -3
  203. package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +16 -6
  204. package/project/.sdk/tm/js/src/feature/streaming/StreamingFeature.js +2 -1
  205. package/project/.sdk/tm/js/src/feature/telemetry/TelemetryFeature.js +11 -6
  206. package/project/.sdk/tm/js/src/feature/test/TestFeature.js +38 -1
  207. package/project/.sdk/tm/js/src/feature/validate/ValidateFeature.js +2 -1
  208. package/project/.sdk/tm/js/src/utility/CleanUtility.js +1 -1
  209. package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +61 -12
  210. package/project/.sdk/tm/js/test/feature/Corpus.test.js +191 -23
  211. package/project/.sdk/tm/js/test/feature/harness.js +3 -3
  212. package/project/.sdk/tm/js/test/feature.test.js +14 -1
  213. package/project/.sdk/tm/js/test/pipeline.test.js +1 -1
  214. package/project/.sdk/tm/kotlin/core/Context.kt +3 -0
  215. package/project/.sdk/tm/kotlin/core/SdkClient.kt +23 -10
  216. package/project/.sdk/tm/kotlin/feature/AuditFeature.kt +5 -1
  217. package/project/.sdk/tm/kotlin/feature/CacheFeature.kt +102 -7
  218. package/project/.sdk/tm/kotlin/feature/MetricsFeature.kt +22 -0
  219. package/project/.sdk/tm/kotlin/feature/PagingFeature.kt +125 -2
  220. package/project/.sdk/tm/kotlin/feature/RatelimitFeature.kt +16 -13
  221. package/project/.sdk/tm/kotlin/feature/RetryFeature.kt +36 -14
  222. package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +10 -20
  223. package/project/.sdk/tm/kotlin/feature/StreamingFeature.kt +4 -0
  224. package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +12 -10
  225. package/project/.sdk/tm/kotlin/feature/TestFeature.kt +45 -48
  226. package/project/.sdk/tm/kotlin/test/FeatureTest.kt +173 -0
  227. package/project/.sdk/tm/kotlin/utility/CoreUtil.kt +5 -5
  228. package/project/.sdk/tm/kotlin/utility/Fetcher.kt +4 -0
  229. package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +86 -15
  230. package/project/.sdk/tm/lua/core/context.lua +6 -0
  231. package/project/.sdk/tm/lua/feature/cache_feature.lua +212 -15
  232. package/project/.sdk/tm/lua/feature/debug_feature.lua +2 -3
  233. package/project/.sdk/tm/lua/feature/metrics_feature.lua +5 -0
  234. package/project/.sdk/tm/lua/feature/paging_feature.lua +143 -2
  235. package/project/.sdk/tm/lua/feature/ratelimit_feature.lua +5 -9
  236. package/project/.sdk/tm/lua/feature/retry_feature.lua +43 -5
  237. package/project/.sdk/tm/lua/feature/secrets_feature.lua +15 -80
  238. package/project/.sdk/tm/lua/feature/streaming_feature.lua +2 -1
  239. package/project/.sdk/tm/lua/feature/telemetry_feature.lua +18 -7
  240. package/project/.sdk/tm/lua/feature/test_feature.lua +60 -62
  241. package/project/.sdk/tm/lua/test/feature_test.lua +181 -3
  242. package/project/.sdk/tm/lua/utility/clean.lua +6 -9
  243. package/project/.sdk/tm/lua/utility/fetcher.lua +9 -0
  244. package/project/.sdk/tm/lua/utility/make_options.lua +60 -18
  245. package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +21 -6
  246. package/project/.sdk/tm/ocaml/sdk_features.ml +392 -68
  247. package/project/.sdk/tm/ocaml/sdk_runtime.ml +47 -21
  248. package/project/.sdk/tm/ocaml/sdk_types.ml +2 -0
  249. package/project/.sdk/tm/ocaml/test/t_feature.ml +107 -2
  250. package/project/.sdk/tm/perl/core/context.pm +3 -0
  251. package/project/.sdk/tm/perl/feature/audit_feature.pm +4 -7
  252. package/project/.sdk/tm/perl/feature/cache_feature.pm +111 -15
  253. package/project/.sdk/tm/perl/feature/debug_feature.pm +2 -2
  254. package/project/.sdk/tm/perl/feature/metrics_feature.pm +5 -0
  255. package/project/.sdk/tm/perl/feature/paging_feature.pm +139 -2
  256. package/project/.sdk/tm/perl/feature/ratelimit_feature.pm +5 -11
  257. package/project/.sdk/tm/perl/feature/retry_feature.pm +22 -4
  258. package/project/.sdk/tm/perl/feature/secrets_feature.pm +13 -18
  259. package/project/.sdk/tm/perl/feature/streaming_feature.pm +2 -0
  260. package/project/.sdk/tm/perl/feature/telemetry_feature.pm +17 -8
  261. package/project/.sdk/tm/perl/feature/test_feature.pm +45 -50
  262. package/project/.sdk/tm/perl/t/feature.t +68 -2
  263. package/project/.sdk/tm/perl/t/feature_corpus.t +204 -25
  264. package/project/.sdk/tm/perl/utility/clean.pm +6 -8
  265. package/project/.sdk/tm/perl/utility/fetcher.pm +4 -0
  266. package/project/.sdk/tm/perl/utility/make_options.pm +38 -15
  267. package/project/.sdk/tm/php/core/Context.php +4 -0
  268. package/project/.sdk/tm/php/feature/CacheFeature.php +98 -13
  269. package/project/.sdk/tm/php/feature/MetricsFeature.php +8 -0
  270. package/project/.sdk/tm/php/feature/PagingFeature.php +128 -1
  271. package/project/.sdk/tm/php/feature/RatelimitFeature.php +5 -9
  272. package/project/.sdk/tm/php/feature/RetryFeature.php +27 -3
  273. package/project/.sdk/tm/php/feature/SecretsFeature.php +18 -15
  274. package/project/.sdk/tm/php/feature/StreamingFeature.php +2 -1
  275. package/project/.sdk/tm/php/feature/TelemetryFeature.php +10 -7
  276. package/project/.sdk/tm/php/feature/TestFeature.php +55 -47
  277. package/project/.sdk/tm/php/test/FeatureCorpusTest.php +262 -17
  278. package/project/.sdk/tm/php/test/FeatureTest.php +68 -0
  279. package/project/.sdk/tm/php/utility/Clean.php +3 -10
  280. package/project/.sdk/tm/php/utility/Fetcher.php +8 -3
  281. package/project/.sdk/tm/php/utility/MakeOptions.php +45 -20
  282. package/project/.sdk/tm/py/pkg/core/context.py +4 -0
  283. package/project/.sdk/tm/py/pkg/feature/cache_feature.py +79 -13
  284. package/project/.sdk/tm/py/pkg/feature/metrics_feature.py +7 -0
  285. package/project/.sdk/tm/py/pkg/feature/paging_feature.py +86 -1
  286. package/project/.sdk/tm/py/pkg/feature/ratelimit_feature.py +13 -16
  287. package/project/.sdk/tm/py/pkg/feature/retry_feature.py +31 -6
  288. package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +15 -66
  289. package/project/.sdk/tm/py/pkg/feature/streaming_feature.py +2 -1
  290. package/project/.sdk/tm/py/pkg/feature/telemetry_feature.py +10 -6
  291. package/project/.sdk/tm/py/pkg/feature/test_feature.py +56 -53
  292. package/project/.sdk/tm/py/pkg/utility/clean.py +4 -10
  293. package/project/.sdk/tm/py/pkg/utility/make_options.py +77 -30
  294. package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +23 -9
  295. package/project/.sdk/tm/py/test/test_feature.py +61 -1
  296. package/project/.sdk/tm/py/test/test_feature_corpus.py +197 -17
  297. package/project/.sdk/tm/py-data/pkg/fetch.py +6 -3
  298. package/project/.sdk/tm/py-data/test/test_fetch.py +7 -4
  299. package/project/.sdk/tm/rb/core/context.rb +4 -1
  300. package/project/.sdk/tm/rb/feature/audit_feature.rb +6 -5
  301. package/project/.sdk/tm/rb/feature/cache_feature.rb +75 -11
  302. package/project/.sdk/tm/rb/feature/debug_feature.rb +2 -2
  303. package/project/.sdk/tm/rb/feature/metrics_feature.rb +8 -0
  304. package/project/.sdk/tm/rb/feature/paging_feature.rb +87 -1
  305. package/project/.sdk/tm/rb/feature/ratelimit_feature.rb +12 -16
  306. package/project/.sdk/tm/rb/feature/retry_feature.rb +19 -3
  307. package/project/.sdk/tm/rb/feature/secrets_feature.rb +9 -64
  308. package/project/.sdk/tm/rb/feature/streaming_feature.rb +2 -1
  309. package/project/.sdk/tm/rb/feature/telemetry_feature.rb +11 -6
  310. package/project/.sdk/tm/rb/feature/test_feature.rb +42 -49
  311. package/project/.sdk/tm/rb/test/feature_corpus_test.rb +191 -25
  312. package/project/.sdk/tm/rb/test/feature_test.rb +75 -1
  313. package/project/.sdk/tm/rb/utility/clean.rb +6 -7
  314. package/project/.sdk/tm/rb/utility/fetcher.rb +6 -0
  315. package/project/.sdk/tm/rb/utility/make_options.rb +37 -16
  316. package/project/.sdk/tm/rust/core/context.rs +8 -0
  317. package/project/.sdk/tm/rust/feature/audit.rs +2 -2
  318. package/project/.sdk/tm/rust/feature/cache.rs +120 -3
  319. package/project/.sdk/tm/rust/feature/metrics.rs +24 -1
  320. package/project/.sdk/tm/rust/feature/paging.rs +189 -3
  321. package/project/.sdk/tm/rust/feature/ratelimit.rs +5 -10
  322. package/project/.sdk/tm/rust/feature/retry.rs +59 -6
  323. package/project/.sdk/tm/rust/feature/secrets.rs +36 -98
  324. package/project/.sdk/tm/rust/feature/streaming.rs +3 -2
  325. package/project/.sdk/tm/rust/feature/support.rs +4 -0
  326. package/project/.sdk/tm/rust/feature/telemetry.rs +22 -11
  327. package/project/.sdk/tm/rust/feature/test.rs +63 -57
  328. package/project/.sdk/tm/rust/tests/feature/secrets/main.rs +3 -3
  329. package/project/.sdk/tm/rust/tests/feature_test.rs +274 -0
  330. package/project/.sdk/tm/rust/tests/primary_utility_test.rs +1 -0
  331. package/project/.sdk/tm/rust/utility/clean.rs +35 -43
  332. package/project/.sdk/tm/rust/utility/fetcher.rs +6 -0
  333. package/project/.sdk/tm/rust/utility/make_options.rs +130 -38
  334. package/project/.sdk/tm/scala/core/Context.scala +4 -0
  335. package/project/.sdk/tm/scala/core/SdkClient.scala +45 -11
  336. package/project/.sdk/tm/scala/feature/AuditFeature.scala +6 -1
  337. package/project/.sdk/tm/scala/feature/CacheFeature.scala +117 -11
  338. package/project/.sdk/tm/scala/feature/MetricsFeature.scala +31 -1
  339. package/project/.sdk/tm/scala/feature/PagingFeature.scala +122 -2
  340. package/project/.sdk/tm/scala/feature/RatelimitFeature.scala +14 -11
  341. package/project/.sdk/tm/scala/feature/RetryFeature.scala +29 -7
  342. package/project/.sdk/tm/scala/feature/SecretsFeature.scala +11 -24
  343. package/project/.sdk/tm/scala/feature/StreamingFeature.scala +2 -1
  344. package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +12 -10
  345. package/project/.sdk/tm/scala/feature/TestFeature.scala +44 -44
  346. package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +69 -0
  347. package/project/.sdk/tm/scala/utility/Fetcher.scala +5 -0
  348. package/project/.sdk/tm/scala/utility/Make.scala +99 -14
  349. package/project/.sdk/tm/scala/utility/Misc.scala +5 -8
  350. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +3 -0
  351. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +3 -2
  352. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/CacheFeature.swift +122 -11
  353. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/MetricsFeature.swift +20 -0
  354. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/PagingFeature.swift +102 -2
  355. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RatelimitFeature.swift +19 -13
  356. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RetryFeature.swift +40 -5
  357. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/SecretsFeature.swift +9 -13
  358. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/StreamingFeature.swift +2 -1
  359. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +11 -9
  360. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TestFeature.swift +55 -49
  361. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Fetcher.swift +4 -0
  362. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +56 -17
  363. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +4 -5
  364. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +166 -0
  365. package/project/.sdk/tm/ts/src/Context.ts +4 -0
  366. package/project/.sdk/tm/ts/src/feature/cache/CacheFeature.ts +115 -4
  367. package/project/.sdk/tm/ts/src/feature/cost/CostFeature.ts +3 -2
  368. package/project/.sdk/tm/ts/src/feature/metrics/MetricsFeature.ts +6 -1
  369. package/project/.sdk/tm/ts/src/feature/paging/PagingFeature.ts +103 -5
  370. package/project/.sdk/tm/ts/src/feature/ratelimit/RatelimitFeature.ts +5 -9
  371. package/project/.sdk/tm/ts/src/feature/rbac/RbacFeature.ts +4 -4
  372. package/project/.sdk/tm/ts/src/feature/retry/RetryFeature.ts +25 -3
  373. package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +14 -2
  374. package/project/.sdk/tm/ts/src/feature/streaming/StreamingFeature.ts +2 -1
  375. package/project/.sdk/tm/ts/src/feature/telemetry/TelemetryFeature.ts +11 -6
  376. package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +8 -7
  377. package/project/.sdk/tm/ts/src/feature/validate/ValidateFeature.ts +2 -1
  378. package/project/.sdk/tm/ts/src/utility/CleanUtility.ts +1 -1
  379. package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +63 -12
  380. package/project/.sdk/tm/ts/test/feature/Corpus.test.ts +192 -23
  381. package/project/.sdk/tm/ts/test/feature/harness.ts +3 -3
  382. package/project/.sdk/tm/ts/test/feature.test.ts +14 -1
  383. package/project/.sdk/tm/ts/test/pipeline.test.ts +1 -1
  384. package/project/.sdk/tm/zig/core/context.zig +5 -0
  385. package/project/.sdk/tm/zig/core/utility.zig +118 -17
  386. package/project/.sdk/tm/zig/feature/cache.zig +144 -13
  387. package/project/.sdk/tm/zig/feature/metrics.zig +19 -0
  388. package/project/.sdk/tm/zig/feature/paging.zig +172 -4
  389. package/project/.sdk/tm/zig/feature/ratelimit.zig +5 -11
  390. package/project/.sdk/tm/zig/feature/retry.zig +41 -3
  391. package/project/.sdk/tm/zig/feature/secrets.zig +6 -1
  392. package/project/.sdk/tm/zig/feature/streaming.zig +2 -0
  393. package/project/.sdk/tm/zig/feature/telemetry.zig +15 -9
  394. package/project/.sdk/tm/zig/feature/test.zig +56 -40
  395. package/project/.sdk/tm/zig/test/feature_test.zig +174 -0
  396. package/project/.sdk/tm/zig/test/primary_utility_test.zig +2 -0
  397. package/project/sdkgen-package.json +1 -1
  398. package/src/cmp/ReadmeExplanation.ts +5 -2
  399. package/src/cmp/ReadmeFeatures.ts +21 -6
  400. package/src/helpers/optspec.ts +2 -2
@@ -152,6 +152,17 @@
152
152
  (core/feature-hook ctx "PreUnexpected")
153
153
  {"ok" false "error" err "result" (core/oget ctx :result) "ctx" ctx})))))
154
154
 
155
+ ;; The documented hasMore loop, one request per page.
156
+ (defn- paging-walk [reply & opts]
157
+ (let [[server calls] (recording-server (fn [n _fd] [(reply n) nil]))
158
+ h (make-harness [(apply fspec "paging" opts)] :server server)
159
+ paging (vs/jm)
160
+ ctrl (vs/jm "paging" paging)]
161
+ (h-op h :opname "list" :path "/w" :ctrl ctrl)
162
+ (while (and (= true (mget paging "hasMore")) (< (count @calls) 4))
163
+ (h-op h :opname "list" :path "/w" :ctrl ctrl))
164
+ [(mapv #(str (vs/getprop % "url")) @calls) paging]))
165
+
155
166
  (defn- rstatus [res] (core/oget (get res "result") :status))
156
167
  (defn- rcode [res] (:code (get res "error")))
157
168
 
@@ -365,6 +376,39 @@
365
376
  h (make-harness [(fspec "cache" "active" false)] :server server)]
366
377
  (h-op h :path "/x") (h-op h :path "/x")
367
378
  (t/is-eq (count @calls) 2 "two calls"))))
379
+ (check "cache-keys-on-request-headers" "cache"
380
+ (fn [] (let [[server calls] (recording-server nil)
381
+ h (make-harness [(fspec "cache" "ttl" 10000)] :server server)]
382
+ (h-op h :path "/w/1" :headers (vs/jm "x-tenant" "tenant-a"))
383
+ (h-op h :path "/w/1" :headers (vs/jm "X-Tenant" "tenant-b"))
384
+ (t/is-eq (count @calls) 2 "a second tenant was not served the first tenant's entry")
385
+ (h-op h :path "/w/1" :headers (vs/jm "x-tenant" "tenant-b"))
386
+ (t/is-eq (count @calls) 2 "the same headers share an entry"))))
387
+ (check "cache-a-write-drops-its-collection" "cache"
388
+ (fn [] (let [[server calls] (recording-server nil)
389
+ h (make-harness [(fspec "cache" "ttl" 10000)] :server server)
390
+ paths ["/w/1" "/w" "/w/1/part" "/other/1" "/w/2"]]
391
+ (doseq [p paths] (h-op h :path p))
392
+ (h-op h :opname "update" :method "PUT" :path "/w/1")
393
+ (doseq [p paths] (h-op h :path p))
394
+ (t/is-eq (count @calls) 9 "the collection refetched")
395
+ (t/is-eq (mget (h-track h "_cache") "hit") 2 "the other entity stayed cached"))))
396
+ (check "cache-control-prevents-storing" "cache"
397
+ (fn [] (doseq [control ["no-store" "private" "No-Cache" "max-age=60, private"]]
398
+ (let [[server calls] (recording-server
399
+ (fn [_n _fd] [(make-response 200 (vs/jm "ok" true) (vs/jm "Cache-Control" control)) nil]))
400
+ h (make-harness [(fspec "cache" "ttl" 10000)] :server server)]
401
+ (h-op h :path "/w") (h-op h :path "/w")
402
+ (t/is-eq (count @calls) 2 (str control " was not stored"))))))
403
+ (check "cache-max-age-caps-the-ttl" "cache"
404
+ (fn [] (let [c (make-clock)
405
+ [server calls] (recording-server
406
+ (fn [_n _fd] [(make-response 200 (vs/jm "ok" true) (vs/jm "cache-control" "max-age=1")) nil]))
407
+ h (make-harness [(fspec "cache" "ttl" 10000 "now" (clock-now c))] :server server)]
408
+ (h-op h :path "/w") (clock-advance c 500) (h-op h :path "/w")
409
+ (t/is-eq (count @calls) 1 "a hit inside max-age")
410
+ (clock-advance c 600) (h-op h :path "/w")
411
+ (t/is-eq (count @calls) 2 "max-age expired before the ttl"))))
368
412
 
369
413
  ;; ---- idempotency ----
370
414
  (check "idempotency-adds-key-mutating" "idempotency"
@@ -465,7 +509,7 @@
465
509
  ;; ---- debug ----
466
510
  (check "debug-redacted-trace-on-entry-max" "debug"
467
511
  (fn [] (let [seen (atom [])
468
- h (make-harness [(fspec "debug" "max" 1 "on_entry" (fn [e] (swap! seen conj e)))])]
512
+ h (make-harness [(fspec "debug" "max" 1 "onEntry" (fn [e] (swap! seen conj e)))])]
469
513
  (h-op h :headers (vs/jm "authorization" "Bearer secret"))
470
514
  (h-op h :opname "list")
471
515
  (let [entries (mget (h-track h "_debug") "entries")]
@@ -583,6 +627,53 @@
583
627
  (t/is-true (boolean (re-find #"[?&]cursor=xyz(&|$)" (str (vs/getprop (nth @calls 0) "url")))) "cursor=xyz")
584
628
  (t/is-eq (mget (core/oget (get res "result") :paging) "cursor") "abc" "cursor abc")
585
629
  (t/is-eq (mget (core/oget (get res "result") :paging) "hasMore") true "hasMore"))))
630
+ (check "paging-body-next-is-sent-as-the-cursor" "paging"
631
+ (fn [] (let [[urls paging] (paging-walk (fn [n] (make-response 200 (vs/jm "next" (get ["c3" "c6"] (dec n))) nil)))]
632
+ (t/is-deep urls ["http://api.test/w?page=1" "http://api.test/w?cursor=c3"
633
+ "http://api.test/w?cursor=c6"] "requests")
634
+ (t/is-eq (mget paging "hasMore") false "hasMore"))))
635
+ (check "paging-body-next-url-is-the-next-request" "paging"
636
+ (fn [] (let [[urls paging] (paging-walk
637
+ (fn [n] (make-response 200 (vs/jm "next" (get ["http://api.test/v2/w?cursor=c%2F3&limit=3"
638
+ "/v2/w?cursor=c6"] (dec n))) nil)))]
639
+ (t/is-deep urls ["http://api.test/w?page=1" "http://api.test/v2/w?cursor=c%2F3&limit=3"
640
+ "http://api.test/v2/w?cursor=c6"] "requests")
641
+ (t/is-eq (mget paging "hasMore") false "hasMore"))))
642
+ (check "paging-link-next-url-is-the-next-request" "paging"
643
+ (fn [] (let [links ["<http://api.test/w?after=b3>; rel=\"next\"" "</w?after=b6>; rel=\"next\""]
644
+ [urls paging] (paging-walk
645
+ (fn [n] (make-response 200 (vs/jt)
646
+ (when-let [l (get links (dec n))] (vs/jm "link" l)))))]
647
+ (t/is-deep urls ["http://api.test/w?page=1" "http://api.test/w?after=b3"
648
+ "http://api.test/w?after=b6"] "requests")
649
+ (t/is-eq (mget paging "hasMore") false "hasMore"))))
650
+ (check "paging-query-only-link-keeps-the-path" "paging"
651
+ (fn [] (let [links ["</v1/items?page=2>; rel=\"next\"" "<?page=3>; rel=\"next\""]
652
+ [urls _] (paging-walk
653
+ (fn [n] (make-response 200 (vs/jt)
654
+ (when-let [l (get links (dec n))] (vs/jm "link" l)))))]
655
+ (t/is-deep urls ["http://api.test/w?page=1" "http://api.test/v1/items?page=2"
656
+ "http://api.test/v1/items?page=3"] "requests"))))
657
+ (check "paging-path-relative-link-resolves-against-the-request" "paging"
658
+ (fn [] (let [links ["</v1/items?page=2>; rel=\"next\"" "<more?page=3>; rel=\"next\""]
659
+ [urls _] (paging-walk
660
+ (fn [n] (make-response 200 (vs/jt)
661
+ (when-let [l (get links (dec n))] (vs/jm "link" l)))))]
662
+ (t/is-deep urls ["http://api.test/w?page=1" "http://api.test/v1/items?page=2"
663
+ "http://api.test/v1/more?page=3"] "requests"))))
664
+ (check "paging-foreign-link-ends-the-walk" "paging"
665
+ (fn [] (let [[urls paging] (paging-walk
666
+ (fn [_n] (make-response 200 (vs/jt)
667
+ (vs/jm "link" "<https://elsewhere.test/w?after=b3>; rel=\"next\""))))]
668
+ (t/is-deep urls ["http://api.test/w?page=1"] "one request")
669
+ (t/is-eq (mget paging "hasMore") false "hasMore")
670
+ (t/is-eq (mget paging "foreign") "https://elsewhere.test/w?after=b3" "foreign"))))
671
+ (check "paging-cursor-mode-sends-a-slash-cursor" "paging"
672
+ (fn [] (let [[urls paging] (paging-walk
673
+ (fn [n] (make-response 200 (vs/jm "next" (get ["/c3"] (dec n))) nil))
674
+ "next" "cursor")]
675
+ (t/is-deep urls ["http://api.test/w?page=1" "http://api.test/w?cursor=%2Fc3"] "requests")
676
+ (t/is-eq (mget paging "hasMore") false "hasMore"))))
586
677
  (check "paging-non-list-not-paged" "paging"
587
678
  (fn [] (let [[server calls] (recording-server nil)
588
679
  h (make-harness [(fspec "paging")] :server server)
@@ -606,6 +697,17 @@
606
697
  h (make-harness [(fspec "streaming" "chunkSize" 2)] :server server)
607
698
  res (h-op h :opname "list" :path "/w")]
608
699
  (t/is-deep (mapv vec ((core/oget (get res "result") :stream))) [[1 2] [3 4] [5]] "batches"))))
700
+ (check "streaming-failed-result-is-not-streamed" "streaming"
701
+ (fn [] (let [[server _calls] (recording-server (fn [_n _fd] [(make-response 503 (vs/jt) nil) nil]))
702
+ h (make-harness [(fspec "streaming")] :server server)
703
+ res (h-op h :opname "list" :path "/w")]
704
+ (t/is-eq (get res "ok") false "failed")
705
+ (t/is-nil (core/oget (get res "result") :stream) "no stream on a failed result"))))
706
+ (check "streaming-empty-list-streams-nothing" "streaming"
707
+ (fn [] (let [[server _calls] (recording-server (fn [_n _fd] [(make-response 200 (vs/jt) nil) nil]))
708
+ h (make-harness [(fspec "streaming")] :server server)
709
+ res (h-op h :opname "list" :path "/w")]
710
+ (t/is-deep (vec ((core/oget (get res "result") :stream))) [] "nothing streamed"))))
609
711
  (check "streaming-non-list-not-streamed" "streaming"
610
712
  (fn [] (let [h (make-harness [(fspec "streaming")])
611
713
  res (h-op h)]
@@ -15,6 +15,7 @@
15
15
  (let [utility (core/get-utility sdk)
16
16
  ctx (core/make-context (vs/jm "opname" opname "client" sdk "utility" utility) nil)]
17
17
  (when (nil? (core/oget ctx :options)) (core/oset! ctx :options (core/client-options-map sdk)))
18
+ (core/oset! ctx :cleancfg (core/oget (core/client-root-ctx sdk) :cleancfg))
18
19
  ctx))
19
20
 
20
21
  (defn- set-points! [ctx pts] (swap! (core/oget ctx :op) assoc :points pts))
@@ -10,6 +10,11 @@
10
10
 
11
11
  CXX ?= g++
12
12
  CXXFLAGS ?= -std=c++17 -O0 -g -Wall -Wextra -Wno-unused-parameter -pthread
13
+ ifeq ($(OS),Windows_NT)
14
+ ifneq (,$(findstring g++,$(CXX)))
15
+ CXXFLAGS += -Wa,-mbig-obj
16
+ endif
17
+ endif
13
18
 
14
19
  # ---- gated feature payloads (model/feature/<name>.aontu plugin groups) --------
15
20
  #
@@ -460,6 +460,7 @@ struct CtxSpec {
460
460
 
461
461
  Value config = Value::undef();
462
462
  Value options = Value::undef();
463
+ Value cleancfg = Value::undef();
463
464
  Value shared = Value::undef();
464
465
  Value meta = Value::undef();
465
466
  Value entopts = Value::undef();
@@ -491,6 +492,9 @@ struct CtxOut {
491
492
  ResponsePtr request;
492
493
  ResponsePtr response;
493
494
  ResultPtr result;
495
+ // Per-call feature state that must end with the call (the c port's
496
+ // ctx_out_extra).
497
+ std::map<std::string, Value> extra;
494
498
  };
495
499
 
496
500
  // ---- Context ----------------------------------------------------------
@@ -508,6 +512,8 @@ public:
508
512
  Value config = Value::undef();
509
513
  Value entopts = Value::undef();
510
514
  Value options = Value::undef();
515
+ // The clean registry, beside the options rather than in them.
516
+ Value cleancfg = Value::undef();
511
517
  OpMapPtr opmap;
512
518
  ResponsePtr response;
513
519
  ResultPtr result;
@@ -630,9 +636,9 @@ public:
630
636
 
631
637
  // ---- SdkClient --------------------------------------------------------
632
638
 
633
- // A registration replaces the secret registry (options.__derived__.clean
634
- // .values) while requests copy the options: it holds this lock exclusively,
635
- // and every read of that slot holds it shared.
639
+ // A registration replaces the secret registry's `values` slot while other
640
+ // threads clean: it holds this lock exclusively, and every read of that slot
641
+ // holds it shared.
636
642
  inline std::shared_mutex& cleanRegistryLock() {
637
643
  // winpthreads sets up a static rwlock on its first lock, failing threads
638
644
  // that race it with EINVAL; that first lock runs in this static's
@@ -751,6 +757,9 @@ public:
751
757
  protected:
752
758
  // runOp drives one operation through the pipeline with feature hooks.
753
759
  Value runOp(CtxPtr ctx, const std::function<void()>& postDone);
760
+
761
+ // PreDone on an exit that left before it.
762
+ void lateDone(CtxPtr ctx);
754
763
  };
755
764
 
756
765
  // =======================================================================
@@ -811,6 +820,8 @@ inline Context::Context(const CtxSpec& cs, const CtxPtr& basectx) {
811
820
  // Options
812
821
  if (cs.options.is_map()) options = cs.options;
813
822
  if (options.is_undef() && basectx) options = basectx->options;
823
+ if (cs.cleancfg.is_map()) cleancfg = cs.cleancfg;
824
+ if (cleancfg.is_undef() && basectx) cleancfg = basectx->cleancfg;
814
825
 
815
826
  // Entity
816
827
  entity = cs.entity;
@@ -978,7 +989,6 @@ inline SdkClient::SdkClient(const Value& options_) {
978
989
  }
979
990
 
980
991
  inline Value SdkClient::optionsMap() {
981
- std::shared_lock<std::shared_mutex> guard(cleanRegistryLock());
982
992
  Value out = Struct::clone(options);
983
993
  return out.is_map() ? out : vmap();
984
994
  }
@@ -1364,45 +1374,93 @@ inline Value EntityBase::match(const Value& arg) {
1364
1374
 
1365
1375
  inline Value EntityBase::runOp(CtxPtr ctx, const std::function<void()>& postDone) {
1366
1376
  UtilityPtr u = utility;
1367
- try {
1368
- u->featureHook(ctx, "PrePoint");
1377
+ bool predone = false;
1378
+ // A refusal, a failed step or a throw left before PreDone.
1379
+ auto late = [&]() {
1380
+ if (!predone) {
1381
+ predone = true;
1382
+ lateDone(ctx);
1383
+ }
1384
+ };
1385
+ auto steps = [&]() -> Value {
1386
+ try {
1387
+ u->featureHook(ctx, "PrePoint");
1369
1388
 
1370
- Value point = u->makePoint(ctx);
1371
- ctx->out.has_point = true;
1372
- ctx->out.point = point;
1389
+ Value point = u->makePoint(ctx);
1390
+ ctx->out.has_point = true;
1391
+ ctx->out.point = point;
1373
1392
 
1374
- u->featureHook(ctx, "PreSpec");
1393
+ u->featureHook(ctx, "PreSpec");
1375
1394
 
1376
- SpecPtr spec = u->makeSpec(ctx);
1377
- ctx->out.spec = spec;
1395
+ SpecPtr spec = u->makeSpec(ctx);
1396
+ ctx->out.spec = spec;
1378
1397
 
1379
- u->featureHook(ctx, "PreRequest");
1398
+ u->featureHook(ctx, "PreRequest");
1380
1399
 
1381
- ResponsePtr request = u->makeRequest(ctx);
1382
- ctx->out.request = request;
1400
+ ResponsePtr request = u->makeRequest(ctx);
1401
+ ctx->out.request = request;
1383
1402
 
1384
- u->featureHook(ctx, "PreResponse");
1403
+ u->featureHook(ctx, "PreResponse");
1385
1404
 
1386
- ResponsePtr response = u->makeResponse(ctx);
1387
- ctx->out.response = response;
1405
+ ResponsePtr response = u->makeResponse(ctx);
1406
+ ctx->out.response = response;
1388
1407
 
1389
- u->featureHook(ctx, "PreResult");
1408
+ u->featureHook(ctx, "PreResult");
1390
1409
 
1391
- ResultPtr result = u->makeResult(ctx);
1392
- ctx->out.result = result;
1410
+ ResultPtr result = u->makeResult(ctx);
1411
+ ctx->out.result = result;
1393
1412
 
1394
- u->featureHook(ctx, "PreDone");
1413
+ predone = true;
1414
+ u->featureHook(ctx, "PreDone");
1415
+
1416
+ postDone();
1395
1417
 
1396
- postDone();
1418
+ return u->done(ctx);
1419
+ } catch (const SdkErrorPtr& err) {
1420
+ if (ctx->ctrl->err && err == ctx->ctrl->err) throw;
1421
+ return u->makeError(ctx, err);
1422
+ } catch (const std::exception& e) {
1423
+ // An exception a hook threw never passed through makeError.
1424
+ return u->makeError(ctx, ctx->makeError("unexpected", e.what()));
1425
+ }
1426
+ };
1427
+ try {
1428
+ Value out = steps();
1429
+ late();
1430
+ return out;
1431
+ } catch (...) {
1432
+ late();
1433
+ throw;
1434
+ }
1435
+ }
1397
1436
 
1398
- return u->done(ctx);
1437
+ // What the late hook throws leaves cleaned, in place of the error already
1438
+ // on its way out; under throw false it is recorded and dropped.
1439
+ inline void EntityBase::lateDone(CtxPtr ctx) {
1440
+ UtilityPtr u = utility;
1441
+ SdkErrorPtr raised;
1442
+ try {
1443
+ u->featureHook(ctx, "PreDone");
1399
1444
  } catch (const SdkErrorPtr& err) {
1400
- if (ctx->ctrl->err && err == ctx->ctrl->err) throw;
1401
- return u->makeError(ctx, err);
1445
+ raised = err;
1402
1446
  } catch (const std::exception& e) {
1403
- // An exception a hook threw never passed through makeError.
1404
- return u->makeError(ctx, ctx->makeError("unexpected", e.what()));
1447
+ raised = ctx->makeError("unexpected", e.what());
1448
+ }
1449
+ if (!raised) return;
1450
+ Value msg = u->clean(ctx, Value(raised->msg));
1451
+ if (msg.is_string()) raised->msg = msg.as_string();
1452
+ Value code = u->clean(ctx, Value(raised->code));
1453
+ if (code.is_string()) raised->code = code.as_string();
1454
+ raised->result = u->clean(ctx, raised->result);
1455
+ raised->spec = u->clean(ctx, raised->spec);
1456
+ ctx->ctrl->err = raised;
1457
+ if (ctx->ctrl->explain.is_map()) {
1458
+ map_put(ctx->ctrl->explain, "unexpected",
1459
+ vmap({{"code", Value(raised->code)}, {"message", Value(raised->msg)}}));
1460
+ u->cleanExplain(ctx);
1405
1461
  }
1462
+ if (is_false(ctx->ctrl->throwing)) return;
1463
+ throw raised;
1406
1464
  }
1407
1465
 
1408
1466
  inline std::vector<Value> EntityBase::stream(const std::string& action,
@@ -1430,54 +1488,72 @@ inline std::vector<Value> EntityBase::stream(const std::string& action,
1430
1488
  cs.reqmatch = args.is_map() ? args : vmap();
1431
1489
  CtxPtr ctx = u->makeContext(cs, entctx);
1432
1490
 
1433
- try {
1434
- u->featureHook(ctx, "PrePoint");
1435
- Value point = u->makePoint(ctx);
1436
- ctx->out.has_point = true;
1437
- ctx->out.point = point;
1438
-
1439
- u->featureHook(ctx, "PreSpec");
1440
- SpecPtr spec = u->makeSpec(ctx);
1441
- ctx->out.spec = spec;
1442
-
1443
- u->featureHook(ctx, "PreRequest");
1444
- ResponsePtr request = u->makeRequest(ctx);
1445
- ctx->out.request = request;
1446
-
1447
- u->featureHook(ctx, "PreResponse");
1448
- ResponsePtr response = u->makeResponse(ctx);
1449
- ctx->out.response = response;
1450
-
1451
- u->featureHook(ctx, "PreResult");
1452
- ResultPtr result = u->makeResult(ctx);
1453
- ctx->out.result = result;
1454
-
1455
- u->featureHook(ctx, "PreDone");
1456
-
1457
- // Inbound: prefer the streaming feature's incremental producer; else fall
1458
- // back to the materialised items so stream always yields.
1459
- ResultPtr res = ctx->result;
1460
- if (res && res->stream) {
1461
- // done() does not run on this path, so its record is cleaned here.
1462
- u->cleanExplain(ctx);
1463
- return res->stream();
1491
+ bool predone = false;
1492
+ auto late = [&]() {
1493
+ if (!predone) {
1494
+ predone = true;
1495
+ lateDone(ctx);
1464
1496
  }
1497
+ };
1498
+ auto steps = [&]() -> std::vector<Value> {
1499
+ try {
1500
+ u->featureHook(ctx, "PrePoint");
1501
+ Value point = u->makePoint(ctx);
1502
+ ctx->out.has_point = true;
1503
+ ctx->out.point = point;
1504
+
1505
+ u->featureHook(ctx, "PreSpec");
1506
+ SpecPtr spec = u->makeSpec(ctx);
1507
+ ctx->out.spec = spec;
1508
+
1509
+ u->featureHook(ctx, "PreRequest");
1510
+ ResponsePtr request = u->makeRequest(ctx);
1511
+ ctx->out.request = request;
1512
+
1513
+ u->featureHook(ctx, "PreResponse");
1514
+ ResponsePtr response = u->makeResponse(ctx);
1515
+ ctx->out.response = response;
1516
+
1517
+ u->featureHook(ctx, "PreResult");
1518
+ ResultPtr result = u->makeResult(ctx);
1519
+ ctx->out.result = result;
1520
+
1521
+ predone = true;
1522
+ u->featureHook(ctx, "PreDone");
1523
+
1524
+ // Inbound: prefer the streaming feature's incremental producer; else fall
1525
+ // back to the materialised items so stream always yields.
1526
+ ResultPtr res = ctx->result;
1527
+ if (res && res->stream) {
1528
+ // done() does not run on this path, so its record is cleaned here.
1529
+ u->cleanExplain(ctx);
1530
+ return res->stream();
1531
+ }
1465
1532
 
1466
- Value data = u->done(ctx);
1467
- std::vector<Value> out;
1468
- if (data.is_list()) {
1469
- for (const auto& item : *data.as_list()) out.push_back(item);
1470
- } else if (!is_nullish(data)) {
1471
- out.push_back(data);
1533
+ Value data = u->done(ctx);
1534
+ std::vector<Value> out;
1535
+ if (data.is_list()) {
1536
+ for (const auto& item : *data.as_list()) out.push_back(item);
1537
+ } else if (!is_nullish(data)) {
1538
+ out.push_back(data);
1539
+ }
1540
+ return out;
1541
+ } catch (const SdkErrorPtr& err) {
1542
+ if (ctx->ctrl->err && err == ctx->ctrl->err) throw;
1543
+ u->makeError(ctx, err);
1544
+ return std::vector<Value>();
1545
+ } catch (const std::exception& e) {
1546
+ u->makeError(ctx, ctx->makeError("unexpected", e.what()));
1547
+ return std::vector<Value>();
1472
1548
  }
1549
+ };
1550
+ try {
1551
+ std::vector<Value> out = steps();
1552
+ late();
1473
1553
  return out;
1474
- } catch (const SdkErrorPtr& err) {
1475
- if (ctx->ctrl->err && err == ctx->ctrl->err) throw;
1476
- u->makeError(ctx, err);
1477
- return std::vector<Value>();
1478
- } catch (const std::exception& e) {
1479
- u->makeError(ctx, ctx->makeError("unexpected", e.what()));
1480
- return std::vector<Value>();
1554
+ } catch (...) {
1555
+ late();
1556
+ throw;
1481
1557
  }
1482
1558
  }
1483
1559
 
@@ -4,13 +4,12 @@
4
4
  // on the feature (bounded by `max`, default 1000) and, when a `sink` callback
5
5
  // is supplied, are pushed to it. The actor is the per-call ctrl actor,
6
6
  // falling back to the options `actor`, then "anonymous". Each operation is
7
- // audited exactly once (the per-context seen marker — java ctx.out — is kept
8
- // here keyed by ctx.id). Timestamps use the injectable `now` clock.
7
+ // audited exactly once (the per-context seen marker, java's ctx.out, is kept
8
+ // in ctx->out.extra). Timestamps use the injectable `now` clock.
9
9
 
10
10
  #ifndef SDK_FEATURE_AUDIT_HPP
11
11
  #define SDK_FEATURE_AUDIT_HPP
12
12
 
13
- #include <map>
14
13
  #include <string>
15
14
 
16
15
  #include "../core/types.hpp"
@@ -52,15 +51,15 @@ public:
52
51
  }
53
52
 
54
53
  private:
55
- std::map<std::string, bool> seen;
56
-
57
54
  void emit(CtxPtr ctx, const std::string& outcome) {
58
55
  if (!active) return;
59
56
 
60
57
  // One record per operation (PreDone + a following PreUnexpected on a
61
58
  // failure must not double-log).
62
- if (seen.count(ctx->id) && seen[ctx->id]) return;
63
- seen[ctx->id] = true;
59
+ auto& extra = ctx->out.extra;
60
+ auto at = extra.find("audit_seen");
61
+ if (at != extra.end() && at->second.is_bool() && at->second.as_bool()) return;
62
+ extra["audit_seen"] = Value(true);
64
63
 
65
64
  seq++;
66
65
 
@@ -98,7 +97,12 @@ private:
98
97
  Value sink = getp(options, "sink");
99
98
  if (sink.is_injector()) {
100
99
  vs::Injection inj(Value::undef(), Value::undef());
101
- sink.as_injector()(inj, vlist({record}), std::string(""), Value::undef());
100
+ // A failing sink never changes the operation's outcome.
101
+ try {
102
+ sink.as_injector()(inj, vlist({record}), std::string(""), Value::undef());
103
+ }
104
+ catch (...) {
105
+ }
102
106
  }
103
107
  }
104
108
  };