@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
@@ -77,16 +77,23 @@ public class FeatureCorpusTest {
77
77
  * <p>Returns the shape the real fetcher returns: the parsed body behind a
78
78
  * `json` supplier and `body` as the raw string. A script that only set
79
79
  * `body` would look like an empty result, which reads as a feature defect
80
- * rather than a mis-shaped script.
80
+ * rather than a mis-shaped script. Each URL it is sent is kept in `sent`;
81
+ * a `cut` response is one whose body stops before its end.
81
82
  */
82
- private static Utility.FetcherFn scriptedFetcher(Object resRaw) {
83
+ private static Utility.FetcherFn scriptedFetcher(Object resRaw, List<String> sent,
84
+ List<Long> sentAt) {
83
85
  List<Object> res = resRaw instanceof List ? (List<Object>) resRaw : List.of();
84
86
  int[] n = {-1};
85
87
  return (ctx, fullurl, fetchdef) -> {
86
- n[0]++;
88
+ int at;
89
+ synchronized (n) {
90
+ at = ++n[0];
91
+ sent.add(fullurl);
92
+ sentAt.add(System.nanoTime() / 1_000_000);
93
+ }
87
94
  Map<String, Object> spec = new LinkedHashMap<>();
88
95
  if (!res.isEmpty()) {
89
- int i = n[0] >= res.size() ? res.size() - 1 : n[0];
96
+ int i = at >= res.size() ? res.size() - 1 : at;
90
97
  Object entry = res.get(i);
91
98
  if (entry instanceof Map) {
92
99
  spec = (Map<String, Object>) entry;
@@ -111,6 +118,13 @@ public class FeatureCorpusTest {
111
118
  out.put("status", status);
112
119
  out.put("statusText", status < 400 ? "OK" : "ERR");
113
120
  out.put("headers", headers);
121
+ if (Boolean.TRUE.equals(spec.get("cut"))) {
122
+ String raw = RunnerSupport.jsonStr(jsonBody);
123
+ out.put("json", (Supplier<Object>) () -> null);
124
+ out.put("body", raw.substring(0, raw.length() / 2));
125
+ out.put("unreadable", true);
126
+ return out;
127
+ }
114
128
  out.put("json", (Supplier<Object>) () -> jsonBody);
115
129
  out.put("body", RunnerSupport.jsonStr(jsonBody));
116
130
  return out;
@@ -125,8 +139,13 @@ public class FeatureCorpusTest {
125
139
  * would shadow the script.
126
140
  */
127
141
  private static ProjectNameSDK buildClient(Map<String, Object> kase) {
142
+ return buildClient(kase, new ArrayList<>(), new ArrayList<>());
143
+ }
144
+
145
+ private static ProjectNameSDK buildClient(Map<String, Object> kase, List<String> sent,
146
+ List<Long> sentAt) {
128
147
  Map<String, Object> utility = new LinkedHashMap<>();
129
- utility.put("fetcher", scriptedFetcher(kase.get("res")));
148
+ utility.put("fetcher", scriptedFetcher(kase.get("res"), sent, sentAt));
130
149
 
131
150
  // "test" is the OPTION, not the `test` FEATURE: it says "this client is
132
151
  // not live", so a REQUIRED OpenAPI server variable resolves to a
@@ -203,9 +222,14 @@ public class FeatureCorpusTest {
203
222
 
204
223
  private static Object invoke(ProjectNameSDK client, Op op, Map<String, Object> ctrl)
205
224
  throws Exception {
225
+ return invoke(client, op, ctrl, new LinkedHashMap<String, Object>());
226
+ }
227
+
228
+ private static Object invoke(ProjectNameSDK client, Op op, Map<String, Object> ctrl,
229
+ Map<String, Object> args) throws Exception {
206
230
  Object ent = op.accessor.invoke(client, new Object[] {null});
207
231
  try {
208
- return op.call.invoke(ent, new LinkedHashMap<String, Object>(), ctrl);
232
+ return op.call.invoke(ent, new LinkedHashMap<String, Object>(args), ctrl);
209
233
  }
210
234
  catch (java.lang.reflect.InvocationTargetException ite) {
211
235
  // Unwrap: a reflective call reports the SDK's error as its cause, and a
@@ -241,6 +265,202 @@ public class FeatureCorpusTest {
241
265
  return picked;
242
266
  }
243
267
 
268
+ private static final List<String> READ_OPS = List.of("list", "load");
269
+ private static final List<String> WRITE_OPS = List.of("create", "update", "patch", "remove");
270
+
271
+ /** A read and a write of one entity (#READ, #WRITE), each driven as usableOps drives an op. */
272
+ private static Map<String, Op> usablePair() {
273
+ Map<String, Map<String, Op>> found = new LinkedHashMap<>();
274
+ for (Op cand : candidates(buildClient(Map.of()))) {
275
+ int dot = cand.key.indexOf('.');
276
+ String entity = cand.key.substring(0, dot);
277
+ String opname = cand.key.substring(dot + 1);
278
+ String role = READ_OPS.contains(opname) ? "read" : WRITE_OPS.contains(opname) ? "write" : null;
279
+ Map<String, Op> seen = found.computeIfAbsent(entity, (k) -> new LinkedHashMap<>());
280
+ if (null == role || seen.containsKey(role)) {
281
+ continue;
282
+ }
283
+ try {
284
+ invoke(buildClient(Map.of()), cand, new LinkedHashMap<>());
285
+ }
286
+ catch (Exception e) {
287
+ continue;
288
+ }
289
+ seen.put(role, cand);
290
+ if (seen.containsKey("read") && seen.containsKey("write")) {
291
+ return seen;
292
+ }
293
+ }
294
+ return null;
295
+ }
296
+
297
+ private static final Map<String, Object> ITEM_ARGS = Map.of("id", "corpus-item");
298
+
299
+ private static String entityOf(Op op) {
300
+ return op.key.substring(0, op.key.indexOf('.'));
301
+ }
302
+
303
+ /** A write of one entity (#ITEM) that completes when driven with ITEM_ARGS. */
304
+ private static Op usableItem(String entity) {
305
+ for (Op cand : candidates(buildClient(Map.of()))) {
306
+ String opname = cand.key.substring(cand.key.indexOf('.') + 1);
307
+ if (!entity.equals(entityOf(cand)) || !List.of("update", "patch", "remove").contains(opname)) {
308
+ continue;
309
+ }
310
+ try {
311
+ invoke(buildClient(Map.of()), cand, new LinkedHashMap<>(), ITEM_ARGS);
312
+ }
313
+ catch (Exception e) {
314
+ continue;
315
+ }
316
+ return cand;
317
+ }
318
+ return null;
319
+ }
320
+
321
+ /** Read one operation through the entity's stream(); how many it yields. */
322
+ private static long streamItems(ProjectNameSDK client, Op op, Map<String, Object> ctrl,
323
+ Map<String, Object> args) throws Exception {
324
+ Object ent = op.accessor.invoke(client, new Object[] {null});
325
+ Method stream = ent.getClass().getMethod("stream", String.class, Map.class, Map.class);
326
+ Map<String, Object> callopts = new LinkedHashMap<>();
327
+ callopts.put("ctrl", ctrl);
328
+ try {
329
+ return ((java.util.stream.Stream<Object>) stream.invoke(ent,
330
+ op.key.substring(op.key.indexOf('.') + 1), new LinkedHashMap<>(args), callopts)).count();
331
+ }
332
+ catch (java.lang.reflect.InvocationTargetException ite) {
333
+ if (ite.getCause() instanceof Exception) {
334
+ throw (Exception) ite.getCause();
335
+ }
336
+ throw ite;
337
+ }
338
+ }
339
+
340
+ /**
341
+ * Each request a case expects, in order: its path, and its whole query. A
342
+ * path is compared without its leading slash, which an SDK with no base
343
+ * omits.
344
+ */
345
+ private static void checkSent(List<String> sent, Object expectRaw, String label) {
346
+ List<Object> expect = (List<Object>) expectRaw;
347
+ assertEquals(expect.size(), sent.size(), label + ": requests sent: " + String.join(" | ", sent));
348
+ for (int i = 0; i < expect.size(); i++) {
349
+ Map<String, Object> want = (Map<String, Object>) expect.get(i);
350
+ String rest = sent.get(i).replaceFirst("(?i)^[a-z][a-z0-9+.-]*://[^/?#]*", "");
351
+ int mark = rest.indexOf('?');
352
+ String path = mark < 0 ? rest : rest.substring(0, mark);
353
+ String rawquery = mark < 0 ? "" : rest.substring(mark + 1);
354
+ if (want.get("path") != null) {
355
+ assertEquals(String.valueOf(want.get("path")).replaceFirst("^/+", ""),
356
+ path.replaceFirst("^/+", ""), label + ": request " + i + " path");
357
+ }
358
+ if (want.get("query") instanceof Map) {
359
+ Map<String, Object> query = new TreeMap<>();
360
+ for (String pair : rawquery.split("&")) {
361
+ if (pair.isEmpty()) {
362
+ continue;
363
+ }
364
+ int eq = pair.indexOf('=');
365
+ query.put(
366
+ java.net.URLDecoder.decode(eq < 0 ? pair : pair.substring(0, eq),
367
+ java.nio.charset.StandardCharsets.UTF_8),
368
+ java.net.URLDecoder.decode(eq < 0 ? "" : pair.substring(eq + 1),
369
+ java.nio.charset.StandardCharsets.UTF_8));
370
+ }
371
+ assertEquals(new TreeMap<>((Map<String, Object>) want.get("query")), query,
372
+ label + ": request " + i + " query");
373
+ }
374
+ }
375
+ }
376
+
377
+ /**
378
+ * One step: it may wait, may add request headers, and may pass `args` as
379
+ * the first argument. A `stream` step reads the operation through
380
+ * stream(), and `items` is how many it yields.
381
+ */
382
+ private static Object step(ProjectNameSDK client, Op op, Map<String, Object> step,
383
+ Map<String, Object> ctrl) throws Exception {
384
+ if (step.get("wait") instanceof Number) {
385
+ Thread.sleep(((Number) step.get("wait")).longValue());
386
+ }
387
+ Map<String, Object> args = step.get("args") instanceof Map
388
+ ? (Map<String, Object>) step.get("args") : new LinkedHashMap<>();
389
+ if (Boolean.TRUE.equals(step.get("stream"))) {
390
+ long items = streamItems(client, op, ctrl, args);
391
+ if (step.get("items") instanceof Number) {
392
+ assertEquals(((Number) step.get("items")).longValue(), items, op.key + ": items streamed");
393
+ }
394
+ return items;
395
+ }
396
+ if (!(step.get("headers") instanceof Map)) {
397
+ return invoke(client, op, ctrl, args);
398
+ }
399
+ Map<String, Object> options = client.getRootCtx().options;
400
+ boolean had = options.containsKey("headers");
401
+ Object prior = options.get("headers");
402
+ Map<String, Object> merged = new LinkedHashMap<>();
403
+ if (prior instanceof Map) {
404
+ merged.putAll((Map<String, Object>) prior);
405
+ }
406
+ merged.putAll((Map<String, Object>) step.get("headers"));
407
+ options.put("headers", merged);
408
+ try {
409
+ return invoke(client, op, ctrl, args);
410
+ }
411
+ finally {
412
+ if (had) {
413
+ options.put("headers", prior);
414
+ }
415
+ else {
416
+ options.remove("headers");
417
+ }
418
+ }
419
+ }
420
+
421
+ /**
422
+ * Runs a step once, or with `together: N` as N overlapping calls, and
423
+ * returns each call's exception, or null.
424
+ */
425
+ private static List<Throwable> calls(ProjectNameSDK client, Op op, Map<String, Object> step,
426
+ Map<String, Object> ctrl) throws InterruptedException {
427
+ int n = step.get("together") instanceof Number ? ((Number) step.get("together")).intValue() : 1;
428
+ Throwable[] errs = new Throwable[n];
429
+ List<Thread> threads = new ArrayList<>();
430
+ for (int i = 0; i < n; i++) {
431
+ final int k = i;
432
+ Thread t = new Thread(() -> {
433
+ try {
434
+ step(client, op, step, ctrl);
435
+ }
436
+ catch (Throwable e) {
437
+ errs[k] = e;
438
+ }
439
+ });
440
+ threads.add(t);
441
+ t.start();
442
+ }
443
+ for (Thread t : threads) {
444
+ t.join();
445
+ }
446
+ return java.util.Arrays.asList(errs);
447
+ }
448
+
449
+ /** The most requests seen in any window of `ms`. */
450
+ private static int busiest(List<Long> sent, long ms) {
451
+ int most = 0;
452
+ for (long from : sent) {
453
+ int count = 0;
454
+ for (long t : sent) {
455
+ if (from <= t && t < from + ms) {
456
+ count++;
457
+ }
458
+ }
459
+ most = Math.max(most, count);
460
+ }
461
+ return most;
462
+ }
463
+
244
464
  /** Replace #OPn throughout a case, keys included. */
245
465
  private static Object resolve(Object node, Map<String, String> tokens) {
246
466
  if (node instanceof String) {
@@ -318,6 +538,16 @@ public class FeatureCorpusTest {
318
538
  return;
319
539
  }
320
540
 
541
+ if (expect instanceof List) {
542
+ List<Object> want = (List<Object>) expect;
543
+ assertTrue(actual instanceof List && ((List<Object>) actual).size() == want.size(),
544
+ path + ": want " + want.size() + " item(s), got " + actual);
545
+ for (int i = 0; i < want.size(); i++) {
546
+ subset(((List<Object>) actual).get(i), want.get(i), path + "[" + i + "]");
547
+ }
548
+ return;
549
+ }
550
+
321
551
  if (expect instanceof Boolean) {
322
552
  assertEquals(expect, actual, path);
323
553
  return;
@@ -448,6 +678,23 @@ public class FeatureCorpusTest {
448
678
  for (Op o : ops) {
449
679
  byKey.put(o.key, o);
450
680
  }
681
+ Map<String, Op> pair = usablePair();
682
+ if (null != pair) {
683
+ for (Op o : pair.values()) {
684
+ byKey.put(o.key, o);
685
+ }
686
+ }
687
+ Op item = null == pair ? null : usableItem(entityOf(pair.get("read")));
688
+ if (null != item) {
689
+ byKey.put(item.key, item);
690
+ }
691
+ Op other = null;
692
+ for (Op o : null == pair ? List.<Op>of() : ops) {
693
+ if (!entityOf(o).equals(entityOf(pair.get("read")))) {
694
+ other = o;
695
+ break;
696
+ }
697
+ }
451
698
 
452
699
  int ran = 0;
453
700
  for (Object rawCase : cases) {
@@ -460,6 +707,27 @@ public class FeatureCorpusTest {
460
707
  continue;
461
708
  }
462
709
 
710
+ boolean paired = java.util.regex.Pattern.compile("#(READ|WRITE|ITEM|OTHER)\\b")
711
+ .matcher(String.valueOf(rawCase)).find();
712
+ if (paired && null == pair) {
713
+ System.err.println(String.format(
714
+ "skip \"%s\": needs a read and a write of one entity, this SDK offers none", rawName));
715
+ continue;
716
+ }
717
+
718
+ String lacking = null;
719
+ if (paired && null == item && String.valueOf(rawCase).matches("(?s).*#ITEM\\b.*")) {
720
+ lacking = "#ITEM";
721
+ }
722
+ else if (paired && null == other && String.valueOf(rawCase).matches("(?s).*#OTHER\\b.*")) {
723
+ lacking = "#OTHER";
724
+ }
725
+ if (null != lacking) {
726
+ System.err.println(String.format(
727
+ "skip \"%s\": needs %s, which this SDK cannot drive", rawName, lacking));
728
+ continue;
729
+ }
730
+
463
731
  String missing = missingFeature(rawCase, have);
464
732
  if (null != missing) {
465
733
  System.err.println(String.format(
@@ -472,14 +740,29 @@ public class FeatureCorpusTest {
472
740
  for (int i = 0; i < need; i++) {
473
741
  tokens.put("#OP" + (i + 1), ops.get(i).key);
474
742
  }
743
+ if (paired) {
744
+ tokens.put("#READ", pair.get("read").key);
745
+ tokens.put("#WRITE", pair.get("write").key);
746
+ if (null != item) {
747
+ tokens.put("#ITEM", item.key);
748
+ }
749
+ if (null != other) {
750
+ tokens.put("#OTHER", other.key);
751
+ }
752
+ }
475
753
  Map<String, Object> kase = (Map<String, Object>) resolve(rawCase, tokens);
476
754
  String label = String.valueOf(kase.get("name"));
477
755
  ran++;
478
756
 
479
757
  // Every failing case is reported, not only the first.
480
758
  try {
481
- ProjectNameSDK client = buildClient(kase);
759
+ List<String> sent = java.util.Collections.synchronizedList(new ArrayList<>());
760
+ List<Long> sentAt = java.util.Collections.synchronizedList(new ArrayList<>());
761
+ ProjectNameSDK client = buildClient(kase, sent, sentAt);
482
762
 
763
+ // A case-level ctrl is one control object every step shares.
764
+ Map<String, Object> shared = kase.get("ctrl") instanceof Map
765
+ ? (Map<String, Object>) kase.get("ctrl") : null;
483
766
  List<Object> steps = kase.get("op") instanceof List
484
767
  ? (List<Object>) kase.get("op") : List.of();
485
768
  for (Object stepRaw : steps) {
@@ -488,19 +771,16 @@ public class FeatureCorpusTest {
488
771
  assertNotNull(op, label + ": no operation " + step.get("op"));
489
772
  Map<String, Object> ctrl = step.get("ctrl") instanceof Map
490
773
  ? new LinkedHashMap<>((Map<String, Object>) step.get("ctrl"))
491
- : new LinkedHashMap<>();
774
+ : null != shared ? shared : new LinkedHashMap<>();
492
775
  Object wanterr = step.get("err");
493
776
 
494
- try {
495
- invoke(client, op, ctrl);
496
- if (null != wanterr) {
497
- fail(label + ": " + step.get("op") + " was expected to fail, and did not");
777
+ for (Throwable err : calls(client, op, step, ctrl)) {
778
+ if (null == err) {
779
+ if (null != wanterr) {
780
+ fail(label + ": " + step.get("op") + " was expected to fail, and did not");
781
+ }
782
+ continue;
498
783
  }
499
- }
500
- catch (org.opentest4j.AssertionFailedError e) {
501
- throw e;
502
- }
503
- catch (Exception err) {
504
784
  assertNotNull(wanterr,
505
785
  label + ": " + step.get("op") + " failed unexpectedly: " + err);
506
786
  if (wanterr instanceof String) {
@@ -513,6 +793,18 @@ public class FeatureCorpusTest {
513
793
  }
514
794
  }
515
795
 
796
+ if (kase.get("pace") instanceof Map) {
797
+ Map<String, Object> pace = (Map<String, Object>) kase.get("pace");
798
+ long ms = ((Number) pace.get("ms")).longValue();
799
+ int max = ((Number) pace.get("max")).intValue();
800
+ int most = busiest(new ArrayList<>(sentAt), ms);
801
+ assertTrue(most <= max,
802
+ label + ": " + most + " requests within " + ms + " ms, want at most " + max);
803
+ }
804
+
805
+ if (kase.get("sent") != null) {
806
+ checkSent(new ArrayList<>(sent), kase.get("sent"), label);
807
+ }
516
808
  subset(record(client, name), kase.get("out"), label + ": _" + name);
517
809
  }
518
810
  catch (AssertionError | Exception e) {
@@ -487,6 +487,66 @@ public class FeatureTest {
487
487
  assertEquals(3, rec.calls.size(), "expected 3 calls");
488
488
  }
489
489
 
490
+ @Test
491
+ public void cache_keysOnRequestHeaders() {
492
+ assumeFeatures("cache");
493
+ FhRecorder rec = new FhRecorder();
494
+ FhHarness h = fhMake(rec::fetch, fhF(new CacheFeature(), fhMap("ttl", 10000)));
495
+ h.op(fhOp("load").path("/w/1").headers(fhMap("x-tenant", "tenant-a")));
496
+ h.op(fhOp("load").path("/w/1").headers(fhMap("X-Tenant", "tenant-b")));
497
+ assertEquals(2, rec.calls.size(), "a second tenant was served the first tenant's entry");
498
+ h.op(fhOp("load").path("/w/1").headers(fhMap("x-tenant", "tenant-b")));
499
+ assertEquals(2, rec.calls.size(), "the same headers did not share an entry");
500
+ }
501
+
502
+ @Test
503
+ public void cache_aWriteDropsItsCollection() {
504
+ assumeFeatures("cache");
505
+ FhRecorder rec = new FhRecorder();
506
+ CacheFeature f = new CacheFeature();
507
+ FhHarness h = fhMake(rec::fetch, fhF(f, fhMap("ttl", 10000)));
508
+ String[] paths = {"/w/1", "/w", "/w/1/part", "/other/1", "/w/2"};
509
+ for (String p : paths) {
510
+ h.op(fhOp("load").path(p));
511
+ }
512
+ h.op(fhOp("update").method("PUT").path("/w/1"));
513
+ for (String p : paths) {
514
+ h.op(fhOp("load").path(p));
515
+ }
516
+ assertEquals(9, rec.calls.size(), "expected the collection refetched and /other cached");
517
+ assertEquals(2, f.hit, "expected /other served from cache");
518
+ }
519
+
520
+ @Test
521
+ public void cache_cacheControlPreventsStoring() {
522
+ assumeFeatures("cache");
523
+ for (String control : new String[] {"no-store", "private", "No-Cache", "max-age=60, private"}) {
524
+ FhRecorder rec = new FhRecorder();
525
+ rec.reply = (n, fetchdef) -> fhResponse(200, fhMap("ok", true), fhMap("Cache-Control", control));
526
+ FhHarness h = fhMake(rec::fetch, fhF(new CacheFeature(), fhMap("ttl", 10000)));
527
+ h.op(fhOp("load").path("/w"));
528
+ h.op(fhOp("load").path("/w"));
529
+ assertEquals(2, rec.calls.size(), control + " was stored");
530
+ }
531
+ }
532
+
533
+ @Test
534
+ public void cache_maxAgeCapsTheTtl() {
535
+ assumeFeatures("cache");
536
+ FhClock clock = new FhClock();
537
+ FhRecorder rec = new FhRecorder();
538
+ rec.reply = (n, fetchdef) -> fhResponse(200, fhMap("ok", true), fhMap("cache-control", "max-age=1"));
539
+ FhHarness h = fhMake(rec::fetch, fhF(new CacheFeature(),
540
+ fhMap("ttl", 10000, "now", (LongSupplier) clock::now)));
541
+ h.op(fhOp("load").path("/w"));
542
+ clock.advance(500);
543
+ h.op(fhOp("load").path("/w"));
544
+ assertEquals(1, rec.calls.size(), "expected a hit inside max-age");
545
+ clock.advance(600);
546
+ h.op(fhOp("load").path("/w"));
547
+ assertEquals(2, rec.calls.size(), "expected max-age=1 to expire the entry before the ttl");
548
+ }
549
+
490
550
  @Test
491
551
  public void cache_inactiveDoesNotWrap() {
492
552
  assumeFeatures("cache");
@@ -40,8 +40,8 @@ import JAVAPACKAGE.utility.struct.Struct;
40
40
  // sensitive KEY name is masked whatever it holds. Inside the pipeline data
41
41
  // stays raw, so a hook can still read the header it must add to.
42
42
  //
43
- // The configuration is the derived block MakeOptions builds
44
- // (`options.__derived__.clean`): active, keys, values, mask, hint, min. It
43
+ // The configuration is the registry MakeOptions builds beside the options
44
+ // (`ctx.cleancfg`): active, keys, values, mask, hint, min. It
45
45
  // is a map so the registry can grow after construction - the auth step and
46
46
  // the features register what they handle later.
47
47
  @SuppressWarnings({"unchecked"})
@@ -74,16 +74,12 @@ final class Clean {
74
74
 
75
75
  private Clean() {}
76
76
 
77
- // A context without options (makeError is reached with a bare one) falls
78
- // back to the schema defaults, so nothing leaves raw for want of a
77
+ // A context without a registry (makeError is reached with a bare one)
78
+ // falls back to the schema defaults, so nothing leaves raw for want of a
79
79
  // constructor.
80
80
  static Map<String, Object> cleanConfig(Context ctx) {
81
- Object derived = null;
82
- if (ctx != null && ctx.options != null) {
83
- derived = Struct.getpath(ctx.options, List.of("__derived__", "clean"));
84
- }
85
- if (derived instanceof Map) {
86
- return (Map<String, Object>) derived;
81
+ if (ctx != null && ctx.cleancfg != null) {
82
+ return ctx.cleancfg;
87
83
  }
88
84
  return makeCleanConfig(Helpers.toMapAny(Schema.optspec().get("clean")));
89
85
  }
@@ -226,6 +226,10 @@ public final class Fetcher {
226
226
  catch (RuntimeException e) {
227
227
  throw new RuntimeException("fetch: invalid url: " + fullurl, e);
228
228
  }
229
+ // A bound in milliseconds, for a caller beneath the timeout feature.
230
+ if (fetchdef.get("timeout") instanceof Number && 0 < ((Number) fetchdef.get("timeout")).longValue()) {
231
+ reqb.timeout(java.time.Duration.ofMillis(((Number) fetchdef.get("timeout")).longValue()));
232
+ }
229
233
 
230
234
  boolean hasUA = false;
231
235
  Object headersRaw = fetchdef.get("headers");
@@ -379,7 +383,7 @@ public final class Fetcher {
379
383
  }
380
384
  }
381
385
 
382
- static Object fetcher(Context ctx, String fullurl, Map<String, Object> fetchdef) {
386
+ public static Object fetcher(Context ctx, String fullurl, Map<String, Object> fetchdef) {
383
387
  if (!"live".equals(ctx.client.mode)) {
384
388
  throw ctx.makeError("fetch_mode_block",
385
389
  "Request blocked by mode: \"" + ctx.client.mode