@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
@@ -16,6 +16,7 @@ static int TESTS = 0;
16
16
  do { \
17
17
  TESTS++; \
18
18
  fn(); \
19
+ printf("ran %s\n", #fn); \
19
20
  } while (0)
20
21
 
21
22
  // ---- reply callbacks for the mock transport --------------------------------
@@ -501,6 +502,105 @@ static void test_cache_inactive_does_not_wrap(void) {
501
502
  CHECK_INT_EQ(rec_count(calls), 2, "cache inactive: 2 calls");
502
503
  }
503
504
 
505
+ uint64_t feature_cache_siphash24(const uint8_t key[16], const uint8_t* in, size_t len);
506
+
507
+ // The reference vectors of the SipHash paper: key 00..0f, message 00..len-1.
508
+ static void test_cache_siphash_matches_the_reference_vectors(void) {
509
+ if (!fh_present("cache")) return;
510
+ static const struct { size_t len; uint64_t want; } vectors[] = {
511
+ {0, 0x726fdb47dd0e0e31ULL},
512
+ {1, 0x74f839c593dc67fdULL},
513
+ {2, 0x0d6c8009d9a94f5aULL},
514
+ {3, 0x85676696d7fb7e2dULL},
515
+ {4, 0xcf2794e0277187b7ULL},
516
+ {5, 0x18765564cd99a68dULL},
517
+ {6, 0xcbc9466e58fee3ceULL},
518
+ {7, 0xab0200f58b01d137ULL},
519
+ {8, 0x93f5f5799a932462ULL},
520
+ {15, 0xa129ca6149be45e5ULL},
521
+ {16, 0x3f2acc7f57c29bdbULL},
522
+ {63, 0x958a324ceb064572ULL}
523
+ };
524
+ uint8_t key[16], msg[64];
525
+ for (int i = 0; i < 16; i++) key[i] = (uint8_t)i;
526
+ for (int i = 0; i < 64; i++) msg[i] = (uint8_t)i;
527
+ for (size_t i = 0; i < sizeof(vectors) / sizeof(vectors[0]); i++) {
528
+ CHECK(feature_cache_siphash24(key, msg, vectors[i].len) == vectors[i].want, "cache: siphash reference vector");
529
+ }
530
+ }
531
+
532
+ static voxgig_value* rep_control(void* ud, int64_t n, voxgig_value* fd, Context* ctx, PNError** e) {
533
+ (void)n; (void)fd; (void)ctx; *e = NULL;
534
+ return fh_response(200, cmap(1, "ok", v_bool(true)),
535
+ cmap(1, "Cache-Control", v_str((const char*)ud)));
536
+ }
537
+
538
+ static FhOpSpec op_load_headers(const char* path, voxgig_value* headers) {
539
+ FhOpSpec o = op_load_path(path); o.headers = headers; return o;
540
+ }
541
+
542
+ static void test_cache_keys_on_request_headers(void) {
543
+ if (!fh_present("cache")) return;
544
+ voxgig_value* calls;
545
+ Fetcher* srv = fh_recorder(NULL, NULL, &calls);
546
+ Feature* f = feature_cache_new();
547
+ FhFeat feats[] = {{f, cmap(1, "ttl", v_num(10000))}};
548
+ FhHarness h = fh_make(srv, feats, 1);
549
+ fh_op(&h, op_load_headers("/w/1", cmap(1, "x-tenant", v_str("tenant-a"))));
550
+ fh_op(&h, op_load_headers("/w/1", cmap(1, "X-Tenant", v_str("tenant-b"))));
551
+ CHECK_INT_EQ(rec_count(calls), 2, "cache tenant header: 2 calls");
552
+ fh_op(&h, op_load_headers("/w/1", cmap(1, "x-tenant", v_str("tenant-b"))));
553
+ CHECK_INT_EQ(rec_count(calls), 2, "cache same headers: still 2 calls");
554
+ }
555
+
556
+ static void test_cache_a_write_drops_its_collection(void) {
557
+ if (!fh_present("cache")) return;
558
+ voxgig_value* calls;
559
+ Fetcher* srv = fh_recorder(NULL, NULL, &calls);
560
+ Feature* f = feature_cache_new();
561
+ FhFeat feats[] = {{f, cmap(1, "ttl", v_num(10000))}};
562
+ FhHarness h = fh_make(srv, feats, 1);
563
+ const char* paths[] = {"/w/1", "/w", "/w/1/part", "/other/1", "/w/2"};
564
+ for (int i = 0; i < 5; i++) fh_op(&h, op_load_path(paths[i]));
565
+ FhOpSpec w; memset(&w, 0, sizeof(w)); w.op = "update"; w.method = "PUT"; w.path = "/w/1";
566
+ fh_op(&h, w);
567
+ for (int i = 0; i < 5; i++) fh_op(&h, op_load_path(paths[i]));
568
+ CHECK_INT_EQ(rec_count(calls), 9, "cache write: collection refetched");
569
+ CHECK_INT_EQ(fh_track_int(f, "hit"), 2, "cache write: other entity cached");
570
+ }
571
+
572
+ static void test_cache_control_prevents_storing(void) {
573
+ if (!fh_present("cache")) return;
574
+ const char* controls[] = {"no-store", "private", "No-Cache", "max-age=60, private"};
575
+ for (int i = 0; i < 4; i++) {
576
+ voxgig_value* calls;
577
+ Fetcher* srv = fh_recorder(rep_control, (void*)controls[i], &calls);
578
+ Feature* f = feature_cache_new();
579
+ FhFeat feats[] = {{f, cmap(1, "ttl", v_num(10000))}};
580
+ FhHarness h = fh_make(srv, feats, 1);
581
+ fh_op(&h, op_load_path("/w"));
582
+ fh_op(&h, op_load_path("/w"));
583
+ CHECK_INT_EQ(rec_count(calls), 2, controls[i]);
584
+ }
585
+ }
586
+
587
+ static void test_cache_max_age_caps_the_ttl(void) {
588
+ if (!fh_present("cache")) return;
589
+ FhClock clock = fh_clock_new();
590
+ voxgig_value* calls;
591
+ Fetcher* srv = fh_recorder(rep_control, (void*)"max-age=1", &calls);
592
+ Feature* f = feature_cache_new();
593
+ FhFeat feats[] = {{f, cmap(2, "ttl", v_num(10000), "now", fh_now_fn(&clock))}};
594
+ FhHarness h = fh_make(srv, feats, 1);
595
+ fh_op(&h, op_load_path("/w"));
596
+ fh_advance(&clock, 500);
597
+ fh_op(&h, op_load_path("/w"));
598
+ CHECK_INT_EQ(rec_count(calls), 1, "cache max-age: a hit inside max-age");
599
+ fh_advance(&clock, 600);
600
+ fh_op(&h, op_load_path("/w"));
601
+ CHECK_INT_EQ(rec_count(calls), 2, "cache max-age: expired before the ttl");
602
+ }
603
+
504
604
  // =============================================================================
505
605
  // idempotency
506
606
  // =============================================================================
@@ -1020,6 +1120,149 @@ static void test_paging_body_cursor_and_explicit_cursor(void) {
1020
1120
  CHECK(get_bool(paging, "hasMore", &hm) && hm, "paging: hasMore true");
1021
1121
  }
1022
1122
 
1123
+ static voxgig_value* rep_paging_next_cursor(void* ud, int64_t n, voxgig_value* fd, Context* ctx, PNError** e) {
1124
+ (void)ud; (void)fd; (void)ctx; *e = NULL;
1125
+ const char* pages[] = { "c3", "c6" };
1126
+ return fh_response(200, cmap(1, "next", n <= 2 ? v_str(pages[n - 1]) : v_null()), v_undef());
1127
+ }
1128
+ static voxgig_value* rep_paging_next_url(void* ud, int64_t n, voxgig_value* fd, Context* ctx, PNError** e) {
1129
+ (void)ud; (void)fd; (void)ctx; *e = NULL;
1130
+ const char* pages[] = { "http://api.test/v2/w?cursor=c%2F3&limit=3", "/v2/w?cursor=c6" };
1131
+ return fh_response(200, cmap(1, "next", n <= 2 ? v_str(pages[n - 1]) : v_null()), v_undef());
1132
+ }
1133
+ static voxgig_value* rep_paging_link(void* ud, int64_t n, voxgig_value* fd, Context* ctx, PNError** e) {
1134
+ (void)ud; (void)fd; (void)ctx; *e = NULL;
1135
+ const char* links[] = { "<http://api.test/w?after=b3>; rel=\"next\"", "</w?after=b6>; rel=\"next\"" };
1136
+ return fh_response(200, clist(0), n <= 2 ? cmap(1, "link", v_str(links[n - 1])) : v_undef());
1137
+ }
1138
+
1139
+ static voxgig_value* rep_paging_query_only(void* ud, int64_t n, voxgig_value* fd, Context* ctx, PNError** e) {
1140
+ (void)ud; (void)fd; (void)ctx; *e = NULL;
1141
+ const char* links[] = { "</v1/items?page=2>; rel=\"next\"", "<?page=3>; rel=\"next\"" };
1142
+ return fh_response(200, clist(0), n <= 2 ? cmap(1, "link", v_str(links[n - 1])) : v_undef());
1143
+ }
1144
+
1145
+ static voxgig_value* rep_paging_path_relative(void* ud, int64_t n, voxgig_value* fd, Context* ctx, PNError** e) {
1146
+ (void)ud; (void)fd; (void)ctx; *e = NULL;
1147
+ const char* links[] = { "</v1/items?page=2>; rel=\"next\"", "<more?page=3>; rel=\"next\"" };
1148
+ return fh_response(200, clist(0), n <= 2 ? cmap(1, "link", v_str(links[n - 1])) : v_undef());
1149
+ }
1150
+
1151
+ static voxgig_value* rep_paging_foreign(void* ud, int64_t n, voxgig_value* fd, Context* ctx, PNError** e) {
1152
+ (void)ud; (void)n; (void)fd; (void)ctx; *e = NULL;
1153
+ return fh_response(200, clist(0), cmap(1, "link", v_str("<https://elsewhere.test/w?after=b3>; rel=\"next\"")));
1154
+ }
1155
+ static voxgig_value* rep_paging_slash_cursor(void* ud, int64_t n, voxgig_value* fd, Context* ctx, PNError** e) {
1156
+ (void)ud; (void)fd; (void)ctx; *e = NULL;
1157
+ return fh_response(200, cmap(1, "next", n == 1 ? v_str("/c3") : v_null()), v_undef());
1158
+ }
1159
+
1160
+ // The documented hasMore loop, one request per page.
1161
+ static voxgig_value* paging_walk_with(FhReplyFn reply, voxgig_value* options, voxgig_value** paging) {
1162
+ voxgig_value* calls;
1163
+ Fetcher* srv = fh_recorder(reply, NULL, &calls);
1164
+ Feature* f = feature_paging_new();
1165
+ FhFeat feats[] = {{f, options}};
1166
+ FhHarness h = fh_make(srv, feats, 1);
1167
+ *paging = v_map();
1168
+ FhOpSpec o = op_list_path("/w");
1169
+ o.ctrl = cmap(1, "paging", *paging);
1170
+ fh_op(&h, o);
1171
+ bool more = false;
1172
+ while (get_bool(*paging, "hasMore", &more) && more && rec_count(calls) < 4) {
1173
+ fh_op(&h, o);
1174
+ }
1175
+ return calls;
1176
+ }
1177
+
1178
+ static voxgig_value* paging_walk(FhReplyFn reply, voxgig_value** paging) {
1179
+ return paging_walk_with(reply, v_undef(), paging);
1180
+ }
1181
+
1182
+ static void check_walk_n(voxgig_value* calls, voxgig_value* paging, const char** want, int n,
1183
+ const char* label) {
1184
+ CHECK_INT_EQ(rec_count(calls), n, label);
1185
+ for (int i = 0; i < n && i < rec_count(calls); i++) {
1186
+ CHECK_STR_EQ(rec_url(calls, i), want[i], label);
1187
+ }
1188
+ bool more = true;
1189
+ CHECK(get_bool(paging, "hasMore", &more) && !more, label);
1190
+ }
1191
+
1192
+ static void check_walk(voxgig_value* calls, voxgig_value* paging, const char** want, const char* label) {
1193
+ check_walk_n(calls, paging, want, 3, label);
1194
+ }
1195
+
1196
+ static void test_paging_foreign_link_ends_the_walk(void) {
1197
+ if (!fh_present("paging")) return;
1198
+ voxgig_value* paging;
1199
+ voxgig_value* calls = paging_walk(rep_paging_foreign, &paging);
1200
+ const char* want[] = { "http://api.test/w?page=1" };
1201
+ check_walk_n(calls, paging, want, 1, "paging: a foreign link ends the walk");
1202
+ CHECK_STR_EQ(get_str(paging, "foreign"), "https://elsewhere.test/w?after=b3", "paging: the foreign link is kept");
1203
+ }
1204
+
1205
+ static void test_paging_cursor_mode_sends_a_slash_cursor(void) {
1206
+ if (!fh_present("paging")) return;
1207
+ voxgig_value* paging;
1208
+ voxgig_value* calls = paging_walk_with(rep_paging_slash_cursor, cmap(1, "next", v_str("cursor")), &paging);
1209
+ // The harness writes query values unescaped.
1210
+ const char* want[] = { "http://api.test/w?page=1", "http://api.test/w?cursor=/c3" };
1211
+ check_walk_n(calls, paging, want, 2, "paging: next cursor sends a / cursor");
1212
+ }
1213
+
1214
+ static void test_paging_body_next_is_sent_as_the_cursor(void) {
1215
+ if (!fh_present("paging")) return;
1216
+ voxgig_value* paging;
1217
+ voxgig_value* calls = paging_walk(rep_paging_next_cursor, &paging);
1218
+ const char* want[] = {
1219
+ "http://api.test/w?page=1", "http://api.test/w?cursor=c3", "http://api.test/w?cursor=c6",
1220
+ };
1221
+ check_walk(calls, paging, want, "paging: a body next is the cursor");
1222
+ }
1223
+
1224
+ static void test_paging_body_next_url_is_the_next_request(void) {
1225
+ if (!fh_present("paging")) return;
1226
+ voxgig_value* paging;
1227
+ voxgig_value* calls = paging_walk(rep_paging_next_url, &paging);
1228
+ // The harness writes query values unescaped, so the decoded cursor shows.
1229
+ const char* want[] = {
1230
+ "http://api.test/w?page=1", "http://api.test/v2/w?cursor=c/3&limit=3",
1231
+ "http://api.test/v2/w?cursor=c6",
1232
+ };
1233
+ check_walk(calls, paging, want, "paging: a body next URL is the next request");
1234
+ }
1235
+
1236
+ static void test_paging_link_next_url_is_the_next_request(void) {
1237
+ if (!fh_present("paging")) return;
1238
+ voxgig_value* paging;
1239
+ voxgig_value* calls = paging_walk(rep_paging_link, &paging);
1240
+ const char* want[] = {
1241
+ "http://api.test/w?page=1", "http://api.test/w?after=b3", "http://api.test/w?after=b6",
1242
+ };
1243
+ check_walk(calls, paging, want, "paging: a Link next URL is the next request");
1244
+ }
1245
+
1246
+ static void test_paging_query_only_link_keeps_the_path(void) {
1247
+ if (!fh_present("paging")) return;
1248
+ voxgig_value* paging;
1249
+ voxgig_value* calls = paging_walk(rep_paging_query_only, &paging);
1250
+ const char* want[] = {
1251
+ "http://api.test/w?page=1", "http://api.test/v1/items?page=2", "http://api.test/v1/items?page=3",
1252
+ };
1253
+ check_walk(calls, paging, want, "paging: a query-only Link keeps the path");
1254
+ }
1255
+
1256
+ static void test_paging_path_relative_link_resolves_against_the_request(void) {
1257
+ if (!fh_present("paging")) return;
1258
+ voxgig_value* paging;
1259
+ voxgig_value* calls = paging_walk(rep_paging_path_relative, &paging);
1260
+ const char* want[] = {
1261
+ "http://api.test/w?page=1", "http://api.test/v1/items?page=2", "http://api.test/v1/more?page=3",
1262
+ };
1263
+ check_walk(calls, paging, want, "paging: a path-relative Link resolves against the request");
1264
+ }
1265
+
1023
1266
  static void test_paging_non_list_not_paged(void) {
1024
1267
  if (!fh_present("paging")) return;
1025
1268
  voxgig_value* calls;
@@ -1074,6 +1317,37 @@ static void test_streaming_batches_with_chunksize(void) {
1074
1317
  CHECK(v_eq(batches, want), "streaming: chunked batches");
1075
1318
  }
1076
1319
 
1320
+ static voxgig_value* rep_stream_empty(void* ud, int64_t n, voxgig_value* fd, Context* ctx, PNError** e) {
1321
+ (void)ud; (void)n; (void)fd; (void)ctx; *e = NULL;
1322
+ return fh_response(200, clist(0), v_undef());
1323
+ }
1324
+
1325
+ static void test_streaming_failed_result_is_not_streamed(void) {
1326
+ if (!fh_present("streaming")) return;
1327
+ Fetcher* srv = fh_recorder(rep_503, NULL, NULL);
1328
+ Feature* f = feature_streaming_new();
1329
+ FhFeat feats[] = {{f, v_undef()}};
1330
+ FhHarness h = fh_make(srv, feats, 1);
1331
+ FhOpResult res = fh_op(&h, op_list_path("/w"));
1332
+ CHECK(!res.result->streaming && res.result->stream == NULL,
1333
+ "streaming: a failed result keeps no stream");
1334
+ CHECK_INT_EQ(fh_track_int(f, "opened"), 0, "streaming: a failed result opens nothing");
1335
+ }
1336
+
1337
+ static void test_streaming_empty_list_streams_nothing(void) {
1338
+ if (!fh_present("streaming")) return;
1339
+ Fetcher* srv = fh_recorder(rep_stream_empty, NULL, NULL);
1340
+ Feature* f = feature_streaming_new();
1341
+ FhFeat feats[] = {{f, v_undef()}};
1342
+ FhHarness h = fh_make(srv, feats, 1);
1343
+ FhOpResult res = fh_op(&h, op_list_path("/w"));
1344
+ CHECK(res.result->stream != NULL, "streaming: an empty list still streams");
1345
+ if (res.result->stream != NULL) {
1346
+ voxgig_value* seen = res.result->stream(res.result->stream_ud);
1347
+ CHECK(v_eq(seen, clist(0)), "streaming: an empty list streams nothing");
1348
+ }
1349
+ }
1350
+
1077
1351
  static void test_streaming_non_list_not_streamed(void) {
1078
1352
  if (!fh_present("streaming")) return;
1079
1353
  Feature* f = feature_streaming_new();
@@ -1216,6 +1490,11 @@ int main(void) {
1216
1490
  RUN(test_cache_refetches_after_ttl);
1217
1491
  RUN(test_cache_evicts_oldest_past_max);
1218
1492
  RUN(test_cache_inactive_does_not_wrap);
1493
+ RUN(test_cache_keys_on_request_headers);
1494
+ RUN(test_cache_a_write_drops_its_collection);
1495
+ RUN(test_cache_control_prevents_storing);
1496
+ RUN(test_cache_max_age_caps_the_ttl);
1497
+ RUN(test_cache_siphash_matches_the_reference_vectors);
1219
1498
  // idempotency
1220
1499
  RUN(test_idempotency_adds_key_to_mutating_ops);
1221
1500
  RUN(test_idempotency_adds_key_by_http_method);
@@ -1258,11 +1537,20 @@ int main(void) {
1258
1537
  // paging
1259
1538
  RUN(test_paging_stamps_page_limit_and_reads_headers);
1260
1539
  RUN(test_paging_body_cursor_and_explicit_cursor);
1540
+ RUN(test_paging_body_next_is_sent_as_the_cursor);
1541
+ RUN(test_paging_body_next_url_is_the_next_request);
1542
+ RUN(test_paging_link_next_url_is_the_next_request);
1543
+ RUN(test_paging_query_only_link_keeps_the_path);
1544
+ RUN(test_paging_path_relative_link_resolves_against_the_request);
1545
+ RUN(test_paging_foreign_link_ends_the_walk);
1546
+ RUN(test_paging_cursor_mode_sends_a_slash_cursor);
1261
1547
  RUN(test_paging_non_list_not_paged);
1262
1548
  RUN(test_paging_inactive_stamps_nothing);
1263
1549
  // streaming
1264
1550
  RUN(test_streaming_streams_list_items);
1265
1551
  RUN(test_streaming_batches_with_chunksize);
1552
+ RUN(test_streaming_failed_result_is_not_streamed);
1553
+ RUN(test_streaming_empty_list_streams_nothing);
1266
1554
  RUN(test_streaming_non_list_not_streamed);
1267
1555
  RUN(test_streaming_inactive_is_noop);
1268
1556
  // proxy
@@ -106,6 +106,7 @@ static void test_primary_utility_exists(void) {
106
106
  CHECK(voxgig_is_map(prepare_headers_util(ctx)), "prepare_headers is map");
107
107
  CHECK(voxgig_is_map(prepare_query_util(ctx)), "prepare_query is map");
108
108
  CHECK(voxgig_is_map(prepare_params_util(ctx)), "prepare_params is map");
109
+ ctx->options = v_map();
109
110
  CHECK(voxgig_is_map(make_options_util(ctx, NULL)), "make_options is map");
110
111
  clean_util(ctx, v_str("x"));
111
112
  }
@@ -184,6 +185,7 @@ static void test_primary_prepare_body_basic(void) {
184
185
  static void test_primary_make_options_basic(void) {
185
186
  base_client();
186
187
  Context* ctx = test_ctx();
188
+ ctx->options = v_map();
187
189
  voxgig_value* opts = make_options_util(ctx, NULL);
188
190
  CHECK(voxgig_is_map(opts), "make_options map");
189
191
  CHECK(!v_is_noval(getp(opts, "base")), "make_options has base");
@@ -7,10 +7,10 @@
7
7
  // sensitive KEY name is masked whatever it holds. Inside the pipeline data
8
8
  // stays raw, so a hook can still read the header it must add to.
9
9
  //
10
- // The registry is the `values` list of the derived clean block that
11
- // make_options builds (`options.__derived__.clean`). Nodes are shared by
12
- // pointer, so a feature registering a value later reaches the same list
13
- // every context reads.
10
+ // The registry is the `values` list of the clean block that make_options
11
+ // builds and holds on the context as `cleancfg`, beside the options rather
12
+ // than in them. Nodes are shared by pointer, so a feature registering a value
13
+ // later reaches the same list every context reads.
14
14
 
15
15
  #include "sdk.h"
16
16
 
@@ -142,16 +142,12 @@ voxgig_value* clean_make_config(voxgig_value* cleanopts) {
142
142
  "min", v_int(min));
143
143
  }
144
144
 
145
- static voxgig_value* derived_block(voxgig_value* options) {
146
- return getpath2(options, "__derived__", "clean");
147
- }
148
-
149
- // A context without options (make_error is reached with a bare one) falls
145
+ // A context without a registry (make_error is reached with a bare one) falls
150
146
  // back to the schema defaults, so nothing leaves raw for want of a
151
147
  // constructor.
152
148
  static voxgig_value* config_block(Context* ctx) {
153
- voxgig_value* derived = ctx ? derived_block(ctx->options) : NULL;
154
- if (voxgig_is_map(derived)) return derived;
149
+ voxgig_value* cfg = ctx ? ctx->cleancfg : NULL;
150
+ if (voxgig_is_map(cfg)) return cfg;
155
151
  return clean_make_config(getp(shared_optspec(), "clean"));
156
152
  }
157
153
 
@@ -227,12 +223,11 @@ static int longest_first(const void* a, const void* b) {
227
223
  return la < lb ? 1 : (la > lb ? -1 : 0);
228
224
  }
229
225
 
230
- // Register a secret value against an options map. Idempotent; shorter
231
- // than `min` is not a secret the SDK can mask without blanking ordinary
232
- // text. A map with no derived block registers nothing.
233
- void clean_add_opts(voxgig_value* options, const char* value) {
226
+ // Register a secret value in a clean registry. Idempotent; shorter than
227
+ // `min` is not a secret the SDK can mask without blanking ordinary text.
228
+ // Anything but a registry map registers nothing.
229
+ void clean_add_cfg(voxgig_value* block, const char* value) {
234
230
  if (!value) return;
235
- voxgig_value* block = derived_block(options);
236
231
  if (!voxgig_is_map(block)) return;
237
232
  int64_t min = count(getp(block, "min"), 4);
238
233
  if (min < 1) min = 1;
@@ -267,10 +262,10 @@ void clean_add_opts(voxgig_value* options, const char* value) {
267
262
  }
268
263
  }
269
264
 
270
- // Register a secret value the context's options will mask from now on.
265
+ // Register a secret value the context's registry will mask from now on.
271
266
  void clean_add_util(Context* ctx, const char* value) {
272
267
  if (!ctx) return;
273
- clean_add_opts(ctx->options, value);
268
+ clean_add_cfg(ctx->cleancfg, value);
274
269
  }
275
270
 
276
271
  static char* mask_value(const CleanCfg* cfg, const char* value) {
@@ -507,10 +502,9 @@ char* clean_str(Context* ctx, const char* val) {
507
502
  return clean_string(&cfg, val);
508
503
  }
509
504
 
510
- // Clean a value against an options map rather than a context, for a
511
- // feature that holds the options but no context.
512
- voxgig_value* clean_opts(voxgig_value* options, voxgig_value* val) {
513
- voxgig_value* block = derived_block(options);
505
+ // Clean a value against a registry rather than a context, for a feature
506
+ // that holds the registry but no context.
507
+ voxgig_value* clean_cfg(voxgig_value* block, voxgig_value* val) {
514
508
  if (!voxgig_is_map(block)) return val;
515
509
  CleanCfg cfg;
516
510
  read_cfg(block, &cfg);
@@ -549,17 +543,17 @@ typedef struct {
549
543
  size_t cap;
550
544
  } Visited;
551
545
 
552
- static void add_sensitive(const CleanCfg* cfg, voxgig_value* options, voxgig_value* val,
546
+ static void add_sensitive(const CleanCfg* cfg, voxgig_value* block, voxgig_value* val,
553
547
  bool under, size_t depth, Visited* seen) {
554
548
  if (!val || CLEAN_MAXDEPTH <= depth) return;
555
549
  if (voxgig_is_string(val)) {
556
- if (under) clean_add_opts(options, voxgig_as_string(val));
550
+ if (under) clean_add_cfg(block, voxgig_as_string(val));
557
551
  return;
558
552
  }
559
553
  if (voxgig_is_number(val)) {
560
554
  if (under) {
561
555
  char* text = voxgig_stringify(val, -1);
562
- clean_add_opts(options, text);
556
+ clean_add_cfg(block, text);
563
557
  free(text);
564
558
  }
565
559
  return;
@@ -579,33 +573,32 @@ static void add_sensitive(const CleanCfg* cfg, voxgig_value* options, voxgig_val
579
573
  if (voxgig_is_list(val)) {
580
574
  voxgig_list* l = voxgig_as_list(val);
581
575
  for (size_t i = 0; i < l->len; i++) {
582
- add_sensitive(cfg, options, l->items[i], under, depth + 1, seen);
576
+ add_sensitive(cfg, block, l->items[i], under, depth + 1, seen);
583
577
  }
584
578
  } else {
585
579
  voxgig_map* m = voxgig_as_map(val);
586
580
  for (size_t i = 0; i < m->len; i++) {
587
581
  bool sub = under || sensitive_key(cfg, m->entries[i].key);
588
- add_sensitive(cfg, options, m->entries[i].value, sub, depth + 1, seen);
582
+ add_sensitive(cfg, block, m->entries[i].value, sub, depth + 1, seen);
589
583
  }
590
584
  }
591
585
  }
592
586
 
593
587
  // Every scalar under a sensitive name, at any depth and of any shape, is
594
- // registered against `options`: a credential mistyped as a map or a number
595
- // is still a credential.
596
- void clean_add_sensitive_opts(voxgig_value* options, voxgig_value* val) {
597
- voxgig_value* block = derived_block(options);
588
+ // registered in `block`: a credential mistyped as a map or a number is
589
+ // still a credential.
590
+ void clean_add_sensitive_cfg(voxgig_value* block, voxgig_value* val) {
598
591
  if (!voxgig_is_map(block)) return;
599
592
  CleanCfg cfg;
600
593
  read_cfg(block, &cfg);
601
594
  Visited seen = { NULL, 0, 0 };
602
- add_sensitive(&cfg, options, val, false, 0, &seen);
595
+ add_sensitive(&cfg, block, val, false, 0, &seen);
603
596
  free((void*)seen.ptrs);
604
597
  }
605
598
 
606
599
  void clean_add_sensitive_util(Context* ctx, voxgig_value* val) {
607
600
  if (!ctx) return;
608
- clean_add_sensitive_opts(ctx->options, val);
601
+ clean_add_sensitive_cfg(ctx->cleancfg, val);
609
602
  }
610
603
 
611
604
  // Whether a named value is a secret: by its name, or by a registered value
@@ -66,6 +66,40 @@ static bool mo_true(voxgig_value* v) {
66
66
  return voxgig_is_bool(v) && voxgig_as_bool(v);
67
67
  }
68
68
 
69
+ // The model's options for a feature sit beneath the caller's, key by key: a
70
+ // key the caller sets replaces the default whole, so a list is never merged.
71
+ static void mo_feature_defaults(voxgig_value* opts, voxgig_value* cfgfeature) {
72
+ voxgig_value* feature = getp(opts, "feature");
73
+ if (!voxgig_is_map(cfgfeature) || (voxgig_is_map(opts) && !voxgig_is_map(feature) &&
74
+ NULL != voxgig_map_get(voxgig_as_map(opts), "feature") && !voxgig_is_null(feature))) {
75
+ return;
76
+ }
77
+ voxgig_value* out = voxgig_is_map(feature) ? feature : NULL;
78
+ voxgig_map* cm = voxgig_as_map(cfgfeature);
79
+ for (size_t i = 0; i < cm->len; i++) {
80
+ const char* name = cm->entries[i].key;
81
+ voxgig_value* dflt = getp(cm->entries[i].value, "options");
82
+ voxgig_value* given = NULL == out ? NULL : voxgig_map_get(voxgig_as_map(out), name);
83
+ if (NULL != given && voxgig_is_null(given)) given = NULL;
84
+ if (!voxgig_is_map(dflt) || (NULL == given && !mo_true(getp(dflt, "active"))) ||
85
+ (NULL != given && !voxgig_is_map(given))) {
86
+ continue;
87
+ }
88
+ voxgig_value* merged = v_clone(dflt);
89
+ if (NULL != given) {
90
+ voxgig_map* gm = voxgig_as_map(given);
91
+ for (size_t g = 0; g < gm->len; g++) {
92
+ setp(merged, gm->entries[g].key, voxgig_retain(gm->entries[g].value));
93
+ }
94
+ }
95
+ if (NULL == out) {
96
+ out = v_map();
97
+ setp(opts, "feature", out);
98
+ }
99
+ setp(out, name, merged);
100
+ }
101
+ }
102
+
69
103
  static bool mo_namechar(char c) {
70
104
  return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || '_' == c;
71
105
  }
@@ -202,6 +236,8 @@ voxgig_value* make_options_util(Context* ctx, PNError** err) {
202
236
  voxgig_value* cfgopts = to_map(getp(config, "options"));
203
237
  if (!voxgig_is_map(cfgopts)) cfgopts = voxgig_new_map();
204
238
 
239
+ mo_feature_defaults(opts, getp(config, "feature"));
240
+
205
241
  /* THE OPTION SPEC IS GENERATED, NOT WRITTEN HERE.
206
242
  *
207
243
  * Built from the model: `main.kit.optspec` for the standard options, plus
@@ -216,20 +252,19 @@ voxgig_value* make_options_util(Context* ctx, PNError** err) {
216
252
  voxgig_value* optspec = shared_optspec();
217
253
 
218
254
  /* The secret registry exists BEFORE validation, fed from the raw input.
219
- * Its block is shared by pointer: what is registered into `cleanopts`
220
- * here is what `opts.__derived__.clean` carries out below. */
255
+ * Its block is shared by pointer: what is registered here is what the
256
+ * context's `cleancfg` carries out below. */
221
257
  voxgig_value* cleancfg = clean_make_config(voxgig_merge(
222
258
  clist(4, v_map(), voxgig_clone(getp(optspec, "clean")),
223
259
  mo_clean_block(cfgopts), mo_clean_block(opts)),
224
260
  VOXGIG_MAXDEPTH));
225
- voxgig_value* cleanopts = cmap(1, "__derived__", cmap(1, "clean", v_share(cleancfg)));
226
- clean_add_sensitive_opts(cleanopts, mo_without(opts, "clean", NULL));
261
+ clean_add_sensitive_cfg(cleancfg, mo_without(opts, "clean", NULL));
227
262
  voxgig_value* valueblocks[2] = { cfgopts, opts };
228
263
  for (int b = 0; b < 2; b++) {
229
264
  voxgig_list* rawvals =
230
265
  voxgig_as_list(clean_split_values(getpath2(valueblocks[b], "clean", "values")));
231
266
  for (size_t i = 0; i < rawvals->len; i++) {
232
- clean_add_opts(cleanopts, voxgig_as_string(rawvals->items[i]));
267
+ clean_add_cfg(cleancfg, voxgig_as_string(rawvals->items[i]));
233
268
  }
234
269
  }
235
270
 
@@ -242,7 +277,34 @@ voxgig_value* make_options_util(Context* ctx, PNError** err) {
242
277
  * the shared config and inherited by every client built afterwards. */
243
278
  voxgig_value* mergelist = clist(3, v_map(), voxgig_clone(cfgopts), v_share(opts));
244
279
  voxgig_value* merged = voxgig_merge(mergelist, VOXGIG_MAXDEPTH);
245
- voxgig_value* validated = voxgig_validate(merged, optspec, NULL);
280
+ voxgig_injection* vinj = voxgig_inj_new(NULL, NULL);
281
+ vinj->mode = 0;
282
+ voxgig_release(vinj->errs);
283
+ vinj->errs = voxgig_new_list();
284
+ voxgig_value* validated = voxgig_validate(merged, optspec, vinj);
285
+ voxgig_list* verrs = voxgig_as_list(vinj->errs);
286
+ if (0 < verrs->len) {
287
+ size_t mlen = strlen("invalid options: ") + 1;
288
+ for (size_t i = 0; i < verrs->len; i++) {
289
+ const char* e = voxgig_is_string(verrs->items[i]) ? voxgig_as_string(verrs->items[i]) : "";
290
+ mlen += strlen(e) + 3;
291
+ }
292
+ char* msg = (char*)malloc(mlen);
293
+ strcpy(msg, "invalid options: ");
294
+ for (size_t i = 0; i < verrs->len; i++) {
295
+ if (0 < i) strcat(msg, " | ");
296
+ strcat(msg, voxgig_is_string(verrs->items[i]) ? voxgig_as_string(verrs->items[i]) : "");
297
+ }
298
+ voxgig_value* cleaned = clean_cfg(cleancfg, v_str(msg));
299
+ if (err) {
300
+ *err = pn_error_new("options_invalid",
301
+ voxgig_is_string(cleaned) ? voxgig_as_string(cleaned) : "invalid options");
302
+ }
303
+ free(msg);
304
+ voxgig_inj_free(vinj);
305
+ return NULL;
306
+ }
307
+ voxgig_inj_free(vinj);
246
308
  if (voxgig_is_map(validated)) {
247
309
  opts = validated;
248
310
  }
@@ -264,17 +326,25 @@ voxgig_value* make_options_util(Context* ctx, PNError** err) {
264
326
 
265
327
  if (!mo_resolve_base(opts, config, err)) return NULL;
266
328
 
267
- // Resolve the feature add-order: an explicit list order (above) wins;
268
- // otherwise order the map test-first, then the remaining names sorted, so
269
- // the outcome is deterministic and `test` is always the base transport.
270
- if (voxgig_as_list(feature_order)->len == 0) {
329
+ // Resolve the feature add-order: an explicit list order (above) wins, and
330
+ // the names it leaves out follow it test-first, then sorted, so the outcome
331
+ // is deterministic and `test` is the base transport of a map.
332
+ {
271
333
  voxgig_value* fmap = getp(opts, "feature");
272
334
  if (v_is_map(fmap)) {
273
335
  voxgig_map* fm = voxgig_as_map(fmap);
274
- size_t fn = fm->len;
336
+ voxgig_list* given = voxgig_as_list(feature_order);
337
+ size_t gn = given->len;
338
+ const char** names = (const char**)malloc(sizeof(char*) * (fm->len + 1));
339
+ size_t fn = 0;
340
+ for (size_t i = 0; i < fm->len; i++) {
341
+ bool listed = false;
342
+ for (size_t g = 0; g < gn; g++) {
343
+ if (0 == strcmp(voxgig_as_string(given->items[g]), fm->entries[i].key)) listed = true;
344
+ }
345
+ if (!listed) names[fn++] = fm->entries[i].key;
346
+ }
275
347
  if (fn > 0) {
276
- const char** names = (const char**)malloc(sizeof(char*) * fn);
277
- for (size_t i = 0; i < fn; i++) names[i] = fm->entries[i].key;
278
348
  qsort(names, fn, sizeof(char*), mo_cmp_cstr);
279
349
  bool has_test = false;
280
350
  for (size_t i = 0; i < fn; i++) {
@@ -299,16 +369,18 @@ voxgig_value* make_options_util(Context* ctx, PNError** err) {
299
369
  voxgig_list_push(voxgig_as_list(feature_order), v_str(names[i]));
300
370
  }
301
371
  }
302
- free(names);
303
372
  }
373
+ free(names);
304
374
  }
305
375
  }
306
376
 
307
- setp(opts, "__derived__",
308
- cmap(2, "clean", v_share(cleancfg), "featureorder", feature_order));
377
+ setp(opts, "__derived__", cmap(1, "featureorder", feature_order));
378
+
379
+ // Beside the options, not in them: options_map hands them to callers.
380
+ ctx->cleancfg = v_share(cleancfg);
309
381
 
310
382
  // Again over the merged result: the config's own defaults can carry one.
311
- clean_add_sensitive_opts(opts, mo_without(opts, "clean", "__derived__"));
383
+ clean_add_sensitive_cfg(cleancfg, mo_without(opts, "clean", "__derived__"));
312
384
 
313
385
  return opts;
314
386
  }