@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
@@ -5,12 +5,12 @@ pub mod sekreto;
5
5
 
6
6
  use std::cell::RefCell;
7
7
  use std::collections::BTreeMap;
8
- use std::rc::Rc;
8
+ use std::rc::{Rc, Weak};
9
9
 
10
10
  use crate::core::context::Context;
11
11
  use crate::core::error::ProjectNameError;
12
12
  use crate::core::helpers::{
13
- call_json, call_vfn, get_str, getp, getpath, ja, jo, json_thunk, setp, to_int, vfn,
13
+ call_json, call_vfn, get_str, getp, getpath, jo, setp, to_int, vfn,
14
14
  };
15
15
  use crate::core::types::{Feature, FetcherFn};
16
16
  use crate::feature::support::{fopt_bool, fopt_int, fopt_list, fopt_map, fopt_str, fres_status};
@@ -65,7 +65,10 @@ pub struct SecretsState {
65
65
  /// The client's options, READ-ONLY. This feature never writes them -
66
66
  /// see the header note.
67
67
  options: Value,
68
+ /// The client's clean registry, which a resolved value joins.
69
+ cleancfg: Value,
68
70
  mode: String,
71
+ rootctx: Weak<Context>,
69
72
 
70
73
  /// What prepare_auth was generated from: the config declares auth only
71
74
  /// where it places a credential, and Basic only where it composes one.
@@ -75,10 +78,8 @@ pub struct SecretsState {
75
78
  cred: String,
76
79
  refresh: String,
77
80
 
78
- /// A settled SUCCESSFUL resolution. Kept only while caching is on
79
- /// (`cache: false` means every request asks the chain again), and
80
- /// never set by a FAILURE - a transient vault outage must not poison
81
- /// the client permanently.
81
+ /// A settled SUCCESSFUL resolution, kept only while caching is on and
82
+ /// never set by a FAILURE, so a vault outage cannot poison the client.
82
83
  resolved: bool,
83
84
 
84
85
  /// A chain that could not be built. The transport gate refuses to send
@@ -95,7 +96,9 @@ impl SecretsState {
95
96
  cache: true,
96
97
  exchange: None,
97
98
  options: Value::Noval,
99
+ cleancfg: Value::Noval,
98
100
  mode: "live".to_string(),
101
+ rootctx: Weak::new(),
99
102
  declared: false,
100
103
  basic: false,
101
104
  cred: String::new(),
@@ -217,6 +220,7 @@ impl Feature for SecretsFeature {
217
220
  }
218
221
 
219
222
  let mut state = SecretsState::empty();
223
+ state.rootctx = Rc::downgrade(ctx);
220
224
 
221
225
  state.mode = ctx
222
226
  .client
@@ -225,6 +229,7 @@ impl Feature for SecretsFeature {
225
229
  .map(|c| c.mode.borrow().clone())
226
230
  .unwrap_or_else(|| "live".to_string());
227
231
  state.options = ctx.options.borrow().clone();
232
+ state.cleancfg = ctx.cleancfg.borrow().clone();
228
233
 
229
234
  let config = ctx.config.borrow().clone();
230
235
  let declared = getpath(&["options", "auth"], &config);
@@ -272,7 +277,7 @@ impl Feature for SecretsFeature {
272
277
  let mut specs: Vec<ProviderSpec> = Vec::new();
273
278
 
274
279
  if !explicit.is_empty() {
275
- register(&state.options, &explicit);
280
+ register(&state.cleancfg, &explicit);
276
281
  match envkey(&state.secretname, "") {
277
282
  Ok(key) => {
278
283
  let mut values: BTreeMap<String, String> = BTreeMap::new();
@@ -465,7 +470,7 @@ fn resolve_once(state: &Rc<RefCell<SecretsState>>) -> Result<bool, ProjectNameEr
465
470
  let found = found.map_err(|err| fail(&format!("{}", err)))?;
466
471
 
467
472
  if let Some(value) = &found {
468
- register(&state.borrow().options, value);
473
+ register(&state.borrow().cleancfg, value);
469
474
  }
470
475
 
471
476
  {
@@ -565,10 +570,8 @@ fn with_refresh(
565
570
  }
566
571
 
567
572
  // Another request may have bought a token while this one was in
568
- // flight. Spend what is current before buying: a second exchange
569
- // for a token that is already fresh is wasted, and on a provider
570
- // that invalidates the previous credential on issuance it breaks
571
- // the first request's own retry.
573
+ // flight: spend what is current rather than buy a second, which a
574
+ // provider invalidating on issuance would break this retry with.
572
575
  let current = state.borrow().cred.clone();
573
576
 
574
577
  let token = if !current.is_empty() && current != used {
@@ -576,10 +579,8 @@ fn with_refresh(
576
579
  } else {
577
580
  match buy(state) {
578
581
  Ok(token) => token,
579
- // The purchase failed: answer with the API's own refusal
580
- // rather than this one. The caller asked for data, and the
581
- // refusal is the more useful of the two - the exchange
582
- // error is a symptom.
582
+ // The purchase failed: answer with the API's own refusal,
583
+ // the more useful of the two.
583
584
  Err(_) => return out,
584
585
  }
585
586
  };
@@ -693,25 +694,26 @@ fn buy(state: &Rc<RefCell<SecretsState>>) -> Result<String, ProjectNameError> {
693
694
 
694
695
  let token = buy_once(state)?;
695
696
  state.borrow_mut().cred = token.clone();
696
- register(&state.borrow().options, &token);
697
+ register(&state.borrow().cleancfg, &token);
697
698
 
698
699
  Ok(token)
699
700
  }
700
701
 
701
702
  // A resolved or bought value arrives under no option key the intake
702
- // registration saw; the options map is the client's own, Rc-shared.
703
- fn register(options: &Value, value: &str) {
704
- crate::utility::clean::clean_add_opts(options, value);
703
+ // registration saw; the registry is the client's own, Rc-shared.
704
+ fn register(cleancfg: &Value, value: &str) {
705
+ crate::utility::clean::clean_add_cfg(cleancfg, value);
705
706
  }
706
707
 
707
708
  fn buy_once(state: &Rc<RefCell<SecretsState>>) -> Result<String, ProjectNameError> {
708
- let (refresh, exchange, options, secretname) = {
709
+ let (refresh, exchange, options, secretname, rootctx) = {
709
710
  let s = state.borrow();
710
711
  (
711
712
  s.refresh.clone(),
712
713
  s.exchange.clone(),
713
714
  s.options.clone(),
714
715
  s.secretname.clone(),
716
+ s.rootctx.upgrade(),
715
717
  )
716
718
  };
717
719
 
@@ -754,21 +756,13 @@ fn buy_once(state: &Rc<RefCell<SecretsState>>) -> Result<String, ProjectNameErro
754
756
  ),
755
757
  ("body", Value::str(body)),
756
758
  ("redirect", Value::str("manual")),
759
+ // Its own bound, in milliseconds: the timeout feature's wrapper is above it.
760
+ ("timeout", Value::Num(30000.0)),
757
761
  ]);
758
762
 
759
- let sys_fetch = getpath(&["system", "fetch"], &options);
760
-
761
- let fetch = |at: &str| -> Result<Value, ProjectNameError> {
762
- if let Value::Func(_) = sys_fetch {
763
- let out = call_vfn(&sys_fetch, &ja(vec![Value::str(at), fetchdef.clone()]));
764
- if let Some(msg) = get_str(&out, "__err__") {
765
- return Err(fail(&msg));
766
- }
767
- Ok(out)
768
- } else {
769
- raw_exchange_fetch(at, &fetchdef)
770
- }
771
- };
763
+ // The SDK's own transport beneath every wrapper: the test block and GET-only guard.
764
+ let rootctx = rootctx.ok_or_else(|| fail("secrets: the client is gone"))?;
765
+ let fetch = |at: &str| crate::utility::fetcher::fetcher_util(&rootctx, at, &fetchdef);
772
766
 
773
767
  let mut res = fetch(&url)?;
774
768
 
@@ -816,6 +810,14 @@ fn buy_once(state: &Rc<RefCell<SecretsState>>) -> Result<String, ProjectNameErro
816
810
 
817
811
  const REDIRECT_MAX: usize = 5;
818
812
 
813
+ // An agent that follows nothing, for reading URLs the way ureq sends them.
814
+ fn exchange_agent() -> ureq::Agent {
815
+ static AGENT: std::sync::OnceLock<ureq::Agent> = std::sync::OnceLock::new();
816
+ AGENT
817
+ .get_or_init(|| ureq::AgentBuilder::new().redirects(0).build())
818
+ .clone()
819
+ }
820
+
819
821
  // The URL a body-keeping redirect names, while it stays on the exchange's own
820
822
  // origin. Any other redirect would drop the body or leave the origin.
821
823
  fn moved(url: &str, at: &str, res: &Value) -> Option<String> {
@@ -834,67 +836,3 @@ fn moved(url: &str, at: &str, res: &Value) -> Option<String> {
834
836
  None
835
837
  }
836
838
  }
837
-
838
- // One pooled agent for every exchange; a followed redirect would carry the token.
839
- fn exchange_agent() -> ureq::Agent {
840
- static AGENT: std::sync::OnceLock<ureq::Agent> = std::sync::OnceLock::new();
841
- AGENT
842
- .get_or_init(|| ureq::AgentBuilder::new().redirects(0).build())
843
- .clone()
844
- }
845
-
846
- fn raw_exchange_fetch(fullurl: &str, fetchdef: &Value) -> Result<Value, ProjectNameError> {
847
- let method = get_str(fetchdef, "method")
848
- .filter(|m| !m.is_empty())
849
- .unwrap_or_else(|| "POST".to_string());
850
-
851
- let agent = exchange_agent();
852
- let mut req = agent.request(&method, fullurl);
853
-
854
- if let Value::Map(m) = getp(fetchdef, "headers") {
855
- for (k, v) in m.borrow().iter() {
856
- if let Value::Str(sv) = v {
857
- req = req.set(k, sv);
858
- }
859
- }
860
- }
861
-
862
- let body = get_str(fetchdef, "body").unwrap_or_default();
863
-
864
- let sent = if body.is_empty() {
865
- req.call()
866
- } else {
867
- req.send_string(&body)
868
- };
869
-
870
- let resp = match sent {
871
- Ok(resp) => resp,
872
- Err(ureq::Error::Status(_code, resp)) => resp,
873
- Err(err) => return Err(fail(&format!("secrets: token exchange: {}", err))),
874
- };
875
-
876
- let status = resp.status() as i64;
877
-
878
- let headers = Value::empty_map();
879
- for name in resp.headers_names() {
880
- if let Some(val) = resp.header(&name) {
881
- setp(&headers, &name.to_lowercase(), Value::str(val));
882
- }
883
- }
884
-
885
- let text = resp
886
- .into_string()
887
- .map_err(|err| fail(&format!("secrets: token exchange body: {}", err)))?;
888
-
889
- let parsed = if text.is_empty() {
890
- Value::Noval
891
- } else {
892
- crate::utility::jsonparse::json_parse(&text).unwrap_or(Value::Noval)
893
- };
894
-
895
- Ok(jo(vec![
896
- ("status", Value::Num(status as f64)),
897
- ("headers", headers),
898
- ("json", json_thunk(parsed)),
899
- ]))
900
- }
@@ -55,9 +55,10 @@ impl Feature for StreamingFeature {
55
55
  if !self.active || !self.streamable(ctx) {
56
56
  return;
57
57
  }
58
+ // A failed result keeps no stream, so the entity's stream raises its error.
58
59
  let result = match ctx.result.borrow().clone() {
59
- Some(r) => r,
60
- None => return,
60
+ Some(r) if r.borrow().err.is_none() => r,
61
+ _ => return,
61
62
  };
62
63
 
63
64
  let options = self.options.clone();
@@ -2,6 +2,10 @@
2
2
  use crate::core::helpers::{call_vfn, getp, now_ms, sleep_ms, to_int};
3
3
  use crate::utility::voxgigstruct::Value;
4
4
 
5
+ pub fn call_sink(sink: &Value, record: &Value) {
6
+ let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| call_vfn(sink, record)));
7
+ }
8
+
5
9
  pub fn fopt_bool(options: &Value, key: &str, def: bool) -> bool {
6
10
  match getp(options, key) {
7
11
  Value::Bool(b) => b,
@@ -14,7 +14,6 @@ pub struct TelemetryFeature {
14
14
  pub active: bool,
15
15
  pub add_opts: Option<Value>,
16
16
  options: Value,
17
- seq: i64,
18
17
 
19
18
  // Activity tracking (mirrors the ts client._telemetry record).
20
19
  pub spans: Vec<Value>,
@@ -28,7 +27,6 @@ impl TelemetryFeature {
28
27
  active: true,
29
28
  add_opts: None,
30
29
  options: Value::Noval,
31
- seq: 0,
32
30
  spans: Vec::new(),
33
31
  active_spans: 0,
34
32
  }
@@ -41,14 +39,7 @@ impl TelemetryFeature {
41
39
  return s;
42
40
  }
43
41
  }
44
- // Deterministic-ish sequential id; unique within a client instance.
45
- self.seq += 1;
46
- let mut n = format!("{:04x}", self.seq);
47
- let prefix = if kind == "trace" { "t" } else { "s" };
48
- while n.len() < 16 {
49
- n.push('0');
50
- }
51
- format!("{}{}", prefix, n)
42
+ random_hex(if kind == "trace" { 16 } else { 8 })
52
43
  }
53
44
 
54
45
  fn close(&mut self, ctx: &Rc<Context>, ok: bool) {
@@ -92,7 +83,6 @@ impl Feature for TelemetryFeature {
92
83
  fn init(&mut self, _ctx: &Rc<Context>, options: &Value) {
93
84
  self.options = options.clone();
94
85
  self.active = fopt_bool(options, "active", false);
95
- self.seq = 0;
96
86
  }
97
87
 
98
88
  fn pre_point(&mut self, ctx: &Rc<Context>) {
@@ -177,3 +167,24 @@ impl Feature for TelemetryFeature {
177
167
  self.close(ctx, false);
178
168
  }
179
169
  }
170
+
171
+ // W3C trace context: lowercase hex from the platform's random source, never all
172
+ // zeros. Without /dev/urandom, the OS-seeded hasher keys stand in.
173
+ fn random_hex(bytes: usize) -> String {
174
+ use std::hash::{BuildHasher, Hasher};
175
+ use std::io::Read;
176
+ loop {
177
+ let mut buf = vec![0u8; bytes];
178
+ let read = std::fs::File::open("/dev/urandom").and_then(|mut f| f.read_exact(&mut buf));
179
+ if read.is_err() {
180
+ for chunk in buf.chunks_mut(8) {
181
+ let mut h = std::collections::hash_map::RandomState::new().build_hasher();
182
+ h.write_usize(chunk.as_ptr() as usize);
183
+ chunk.copy_from_slice(&h.finish().to_le_bytes()[..chunk.len()]);
184
+ }
185
+ }
186
+ if buf.iter().any(|b| *b != 0) {
187
+ return buf.iter().map(|b| format!("{:02x}", b)).collect();
188
+ }
189
+ }
190
+ }
@@ -86,21 +86,9 @@ fn respond(ctx: &Rc<Context>, status: i64, data: Value, extra: Vec<(&str, Value)
86
86
  out
87
87
  }
88
88
 
89
- // For single-entity ops (load, remove) with an empty explicit match, fall
90
- // back to the id the entity client already knows from a prior create/load
91
- // (in ctx.mtch / ctx.data). Mirrors the TS mock where param() resolves the
92
- // id from that accumulated state.
93
- fn resolve_match(ctx: &Rc<Context>, explicit: &Value) -> Value {
94
- if vs::size(explicit) > 0 {
95
- return explicit.clone();
96
- }
97
- for src in [ctx.mtch.borrow().clone(), ctx.data.borrow().clone()] {
98
- let v = getp(&src, "id");
99
- if !v.is_noval() && !v.is_null() && v != Value::str("__UNDEFINED__") {
100
- return jo(vec![("id", v)]);
101
- }
102
- }
103
- Value::empty_map()
89
+ fn held(src: &Value, key: &str) -> bool {
90
+ let v = getp(src, key);
91
+ !v.is_noval() && !v.is_null() && v != Value::str("__UNDEFINED__")
104
92
  }
105
93
 
106
94
  fn point_terminal(p: &Value) -> bool {
@@ -180,27 +168,65 @@ fn build_args(ctx: &Rc<Context>, args: &Value) -> Value {
180
168
  let qand = Value::empty_list();
181
169
  let q = jo(vec![("`$AND`", qand.clone())]);
182
170
 
183
- if let Value::Map(_) = args {
184
- let keys = vs::keysof_vec(args);
185
- for key in keys {
186
- let is_id = key == "id";
187
- let is_reqd = !vs::is_empty(&vs::select(&reqd_params, &Value::str(key.clone())))
188
- || !vs::is_empty(&vs::select(&reqd_query, &Value::str(key.clone())));
171
+ let config = ctx.config.borrow().clone();
172
+ let idfrom = crate::core::helpers::getpath(&["entity", &entname, "id", "from"], &config);
173
+
174
+ let mut names: Vec<String> = match args {
175
+ Value::Map(_) => vs::keysof_vec(args),
176
+ _ => vec![],
177
+ };
178
+
179
+ // With no id in the call, the entity's held id (or composite parts) stands in.
180
+ if !held(args, "id") {
181
+ let parts: Vec<String> = match crate::core::helpers::getpath(&["entity", &entname, "id", "parts"], &config) {
182
+ Value::List(l) => l.borrow().iter().map(|p| match p {
183
+ Value::Str(s) => s.to_string(),
184
+ other => vs::stringify(other, None, false),
185
+ }).collect(),
186
+ _ if opname == "list" => vec![],
187
+ _ => vec!["id".to_string()],
188
+ };
189
+ let mtch = ctx.mtch.borrow().clone();
190
+ let data = ctx.data.borrow().clone();
191
+ for pname in parts {
192
+ if !names.contains(&pname) && (held(&mtch, &pname) || held(&data, &pname)) {
193
+ names.push(pname);
194
+ }
195
+ }
196
+ }
197
+
198
+ for key in names {
199
+ let is_id = key == "id";
200
+ let is_reqd = !vs::is_empty(&vs::select(&reqd_params, &Value::str(key.clone())))
201
+ || !vs::is_empty(&vs::select(&reqd_query, &Value::str(key.clone())));
189
202
 
190
- if is_id || is_reqd {
191
- let v = ctx.util().param(ctx, &Value::str(key.clone()));
192
- let ka = getp(&op.alias, &key);
203
+ if is_id || is_reqd {
204
+ let v = ctx.util().param(ctx, &Value::str(key.clone()));
205
+ let ka = getp(&op.alias, &key);
193
206
 
194
- let qor = Value::list(vec![jo(vec![(key.as_str(), v.clone())])]);
195
- if let Value::Str(kas) = &ka {
207
+ let qor = Value::list(vec![jo(vec![(key.as_str(), v.clone())])]);
208
+ if let Value::Str(kas) = &ka {
209
+ if let Value::List(l) = &qor {
210
+ l.borrow_mut().push(jo(vec![(kas.as_str(), v.clone())]));
211
+ }
212
+ }
213
+
214
+ // An alternative, never a replacement: a seed keeping the
215
+ // parameter flat is still found.
216
+ if let Value::Str(kf) = getp(&idfrom, &key) {
217
+ if kf.as_str() != key.as_str() {
218
+ let mut nest = v.clone();
219
+ for seg in kf.split('.').rev() {
220
+ nest = jo(vec![(seg, nest)]);
221
+ }
196
222
  if let Value::List(l) = &qor {
197
- l.borrow_mut().push(jo(vec![(kas.as_str(), v.clone())]));
223
+ l.borrow_mut().push(nest);
198
224
  }
199
225
  }
226
+ }
200
227
 
201
- if let Value::List(l) = &qand {
202
- l.borrow_mut().push(jo(vec![("`$OR`", qor)]));
203
- }
228
+ if let Value::List(l) = &qand {
229
+ l.borrow_mut().push(jo(vec![("`$OR`", qor)]));
204
230
  }
205
231
  }
206
232
  }
@@ -239,8 +265,7 @@ fn test_fetch(
239
265
 
240
266
  match op.name.as_str() {
241
267
  "load" => {
242
- let m = resolve_match(ctx, &ctx.reqmatch.borrow().clone());
243
- let args = build_args(ctx, &m);
268
+ let args = build_args(ctx, &ctx.reqmatch.borrow().clone());
244
269
  let found = vs::select(&entmap, &args);
245
270
  let ent = vs::get_elem(&found, &Value::Num(0.0), Value::Noval);
246
271
  if ent.is_noval() || ent.is_null() {
@@ -272,25 +297,10 @@ fn test_fetch(
272
297
 
273
298
  "update" | "patch" => {
274
299
  let reqdata = ctx.reqdata.borrow().clone();
275
- let update_match = Value::empty_map();
276
- if let Value::Map(_) = reqdata {
277
- let idv = getp(&reqdata, "id");
278
- if !idv.is_noval() {
279
- setp(&update_match, "id", idv);
280
- }
281
- if let Value::Str(alias_id) = getp(&op.alias, "id") {
282
- let av = getp(&reqdata, &alias_id);
283
- if !av.is_noval() {
284
- setp(&update_match, &alias_id, av);
285
- }
286
- }
287
- }
288
- let update_match = if vs::size(&update_match) == 0 {
289
- resolve_match(ctx, &Value::empty_map())
290
- } else {
291
- update_match
292
- };
293
- let args = build_args(ctx, &update_match);
300
+ // `$body` travels on the wire alone; the record is the rest.
301
+ let rec = vs::clone(&reqdata);
302
+ vs::del_prop(rec.clone(), &Value::str("$body"));
303
+ let args = build_args(ctx, &rec);
294
304
  let found = vs::select(&entmap, &args);
295
305
  let ent = vs::get_elem(&found, &Value::Num(0.0), Value::Noval);
296
306
  if ent.is_noval() || ent.is_null() {
@@ -300,10 +310,7 @@ fn test_fetch(
300
310
  vec![("statusText", Value::str("Not found"))],
301
311
  ));
302
312
  }
303
- if let (Value::Map(_), Value::Map(_)) = (&ent, &reqdata) {
304
- // `$body` travels on the wire alone; the record is the rest.
305
- let rec = vs::clone(&reqdata);
306
- vs::del_prop(rec.clone(), &Value::str("$body"));
313
+ if let (Value::Map(_), Value::Map(_)) = (&ent, &rec) {
307
314
  vs::merge(&Value::list(vec![ent.clone(), rec]), None);
308
315
  }
309
316
  vs::del_prop(ent.clone(), &Value::str("$KEY"));
@@ -311,8 +318,7 @@ fn test_fetch(
311
318
  }
312
319
 
313
320
  "remove" => {
314
- let m = resolve_match(ctx, &ctx.reqmatch.borrow().clone());
315
- let args = build_args(ctx, &m);
321
+ let args = build_args(ctx, &ctx.reqmatch.borrow().clone());
316
322
  let found = vs::select(&entmap, &args);
317
323
  let ent = vs::get_elem(&found, &Value::Num(0.0), Value::Noval);
318
324
  // Remove only the first matched entity. If nothing matches,
@@ -1660,7 +1660,7 @@ fn exchange_auth_null_suppresses_and_is_never_retried() {
1660
1660
  }
1661
1661
 
1662
1662
  #[test]
1663
- fn the_exchange_has_a_raw_transport_when_no_system_fetch_is_given() {
1663
+ fn the_exchange_goes_through_the_sdk_transport_when_no_system_fetch_is_given() {
1664
1664
  if skipped_without_auth() {
1665
1665
  return;
1666
1666
  }
@@ -1690,8 +1690,8 @@ fn the_exchange_has_a_raw_transport_when_no_system_fetch_is_given() {
1690
1690
  assert_eq!(getp(&res, "ok"), Value::Bool(false));
1691
1691
  let err = get_str(&res, "err").unwrap_or_default();
1692
1692
  assert!(
1693
- err.contains("token exchange"),
1694
- "expected the exchange's own refusal from the raw transport, got: {}",
1693
+ err.contains("/api/auth/token"),
1694
+ "expected the SDK transport's failure for the token endpoint, got: {}",
1695
1695
  err
1696
1696
  );
1697
1697
  }