@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
@@ -9,6 +9,7 @@
9
9
  # priority. Parameter names ("pageParam", "limitParam", "cursorParam"),
10
10
  # "startPage" (default 1) and page size ("limit") are configurable.
11
11
 
12
+ require 'uri'
12
13
  require_relative 'base_feature'
13
14
 
14
15
  class ProjectNamePagingFeature < ProjectNameBaseFeature
@@ -55,6 +56,8 @@ class ProjectNamePagingFeature < ProjectNameBaseFeature
55
56
 
56
57
  if !paging["cursor"].nil?
57
58
  spec.query[cursor_param] = paging["cursor"]
59
+ elsif paging["next"].is_a?(String) && !_foreign?(paging["next"], spec.base)
60
+ _follow(spec, paging["next"])
58
61
  elsif spec.query[page_param].nil?
59
62
  # A record written back by PreResult holds the page just fetched as
60
63
  # "page" and the one to fetch as "nextPage", so nextPage wins.
@@ -117,6 +120,7 @@ class ProjectNamePagingFeature < ProjectNameBaseFeature
117
120
  "nextPage" => _num(_header(headers, "x-next-page")),
118
121
  "next" => nil,
119
122
  "cursor" => nil,
123
+ "foreign" => nil,
120
124
  "hasMore" => false,
121
125
  }
122
126
 
@@ -162,7 +166,13 @@ class ProjectNamePagingFeature < ProjectNameBaseFeature
162
166
 
163
167
  # Body-level signals; snake_case forms are read first so camelCase wins.
164
168
  if body.is_a?(Hash)
165
- paging["next"] = paging["next"] || body["next"] unless body["next"].nil?
169
+ unless body["next"].nil?
170
+ if _link?(body["next"])
171
+ paging["next"] = paging["next"] || body["next"]
172
+ else
173
+ paging["cursor"] = body["next"]
174
+ end
175
+ end
166
176
  paging["cursor"] = body["next_cursor"] unless body["next_cursor"].nil?
167
177
  paging["cursor"] = body["cursor"] unless body["cursor"].nil?
168
178
  paging["cursor"] = body["nextCursor"] unless body["nextCursor"].nil?
@@ -180,6 +190,14 @@ class ProjectNamePagingFeature < ProjectNameBaseFeature
180
190
  end
181
191
  end
182
192
 
193
+ # A link to another origin is recorded, never followed, and ends the walk.
194
+ base = ctx.spec ? ctx.spec.base : (ctx.options || {})["base"]
195
+ paging["next"] = _resolve(paging["next"], ctx.spec.url) if paging["next"].is_a?(String) && ctx.spec
196
+ if !paging["next"].nil? && _foreign?(paging["next"], base)
197
+ paging["foreign"] = paging["next"]
198
+ paging["next"] = nil
199
+ end
200
+
183
201
  # Cursor presence only INFERS another page. When the server stated the
184
202
  # answer outright — relay's `hasNextPage: false`, or a body `hasMore` —
185
203
  # that wins: a final page normally carries both an end cursor and
@@ -190,6 +208,10 @@ class ProjectNamePagingFeature < ProjectNameBaseFeature
190
208
  !paging["next"].nil? || !paging["cursor"].nil? || !paging["nextPage"].nil?
191
209
  end
192
210
 
211
+ if !paging["foreign"].nil? && paging["cursor"].nil? && paging["nextPage"].nil?
212
+ paging["hasMore"] = false
213
+ end
214
+
193
215
  result.paging = paging
194
216
 
195
217
  if ctx.ctrl && ctx.ctrl.respond_to?(:paging=)
@@ -206,6 +228,70 @@ class ProjectNamePagingFeature < ProjectNameBaseFeature
206
228
  @client.instance_variable_set(:@_paging, { "last" => paging })
207
229
  end
208
230
 
231
+ PAGING_ORIGIN = %r{\A[a-z][a-z0-9+.-]*://[^/?#]*}i
232
+
233
+ # Under the `next` option's default, a URL or an absolute path is a link and
234
+ # anything else a cursor; `cursor` and `url` pin the reading.
235
+ def _link?(nxt)
236
+ return false unless nxt.is_a?(String)
237
+ mode = @options["next"] || "auto"
238
+ mode == "url" ||
239
+ (mode != "cursor" && (PAGING_ORIGIN.match?(nxt) || nxt.start_with?("/")))
240
+ end
241
+
242
+ def _origin(text)
243
+ m = text.is_a?(String) ? PAGING_ORIGIN.match(text) : nil
244
+ m ? m[0].downcase : ""
245
+ end
246
+
247
+ def _foreign?(link, base)
248
+ origin = _origin(link)
249
+ origin != "" && origin != _origin(base)
250
+ end
251
+
252
+ PAGING_SCHEME = /\A[a-z][a-z0-9+.-]*:/i
253
+ PAGING_HOLDER = "http://placeholder.invalid"
254
+
255
+ # RFC 3986 reference resolution against the URL of the request that
256
+ # returned the link. A link on that URL's origin comes back as its path and
257
+ # query; an absolute link is left as the server wrote it.
258
+ def _resolve(link, url)
259
+ return link if !url.is_a?(String) || url.empty? || PAGING_SCHEME.match?(link)
260
+ from = URI(PAGING_ORIGIN.match?(url) ? url : PAGING_HOLDER + (url.start_with?("/") ? "" : "/") + url)
261
+ out = from.merge(link)
262
+ return out.to_s.sub(/#.*\z/, "") if out.scheme != from.scheme || out.authority != from.authority
263
+ out.path + (out.query.nil? ? "" : "?" + out.query)
264
+ rescue URI::Error
265
+ link
266
+ end
267
+
268
+ # The request goes to the link's path and query, on the SDK's own origin.
269
+ def _follow(spec, nxt)
270
+ rest = nxt.sub(PAGING_ORIGIN, "").split("#", 2)[0] || ""
271
+ path, rawquery = rest.split("?", 2)
272
+
273
+ query = {}
274
+ (rawquery || "").split("&").each do |pair|
275
+ next if pair.empty?
276
+ key, val = pair.split("=", 2)
277
+ query[_unescape(key)] = _unescape(val || "")
278
+ end
279
+ (spec.authquery || []).each { |key| query[key] = spec.query[key] }
280
+
281
+ origin = PAGING_ORIGIN.match(spec.base.to_s)
282
+ spec.base = origin ? origin[0] : ""
283
+ spec.prefix = ""
284
+ spec.path = path || ""
285
+ spec.suffix = ""
286
+ spec.query = query
287
+ end
288
+
289
+ def _unescape(text)
290
+ URI.decode_www_form_component(text)
291
+ rescue ArgumentError
292
+ text
293
+ end
294
+
209
295
  def _list?(ctx)
210
296
  ops = @options["ops"] || ["list"]
211
297
  ops.include?(ctx.op ? ctx.op.name : nil)
@@ -20,6 +20,7 @@ class ProjectNameRatelimitFeature < ProjectNameBaseFeature
20
20
  @options = {}
21
21
  @tokens = 0
22
22
  @last = 0
23
+ @lock = Mutex.new
23
24
  end
24
25
 
25
26
  def init(ctx, options)
@@ -47,24 +48,19 @@ class ProjectNameRatelimitFeature < ProjectNameBaseFeature
47
48
  rate = @options["rate"] || 5
48
49
  burst = @options["burst"].nil? ? rate : @options["burst"]
49
50
 
50
- # Refill according to elapsed time.
51
- now = _now
52
- elapsed = now - @last
53
- @last = now
54
- @tokens = [burst, @tokens + (elapsed / 1000.0) * rate].min
55
-
56
- if @tokens >= 1
57
- @tokens -= 1
58
- return
51
+ # Refill, then reserve this call's token before any wait: a negative
52
+ # count is the calls already queued, so overlapping calls pace in turn.
53
+ wait_ms = @lock.synchronize do
54
+ now = _now
55
+ elapsed = now - @last
56
+ @last = now
57
+ @tokens = [burst, @tokens + (elapsed / 1000.0) * rate].min - 1
58
+ next 0 if @tokens >= 0
59
+ ms = ((-@tokens / rate.to_f) * 1000).ceil
60
+ _track(ctx, ms)
61
+ ms
59
62
  end
60
-
61
- # Not enough tokens: wait for one to accrue, then consume it.
62
- needed = 1 - @tokens
63
- wait_ms = ((needed / rate.to_f) * 1000).ceil
64
- _track(ctx, wait_ms)
65
63
  _sleep(wait_ms)
66
- @last = _now
67
- @tokens = 0
68
64
  end
69
65
 
70
66
  def _now
@@ -70,7 +70,7 @@ class ProjectNameRetryFeature < ProjectNameBaseFeature
70
70
  end
71
71
 
72
72
  def _backoff(res, attempt, min_delay, max_delay, factor)
73
- # Honour a server-provided Retry-After (seconds) when present.
73
+ # A server-provided Retry-After wins over the computed backoff.
74
74
  ra = _retry_after(res)
75
75
  return [max_delay, ra].min unless ra.nil?
76
76
  base = min_delay * (factor**attempt)
@@ -85,8 +85,24 @@ class ProjectNameRetryFeature < ProjectNameBaseFeature
85
85
  v = nil
86
86
  headers.each { |k, hv| v = hv if k.to_s.downcase == "retry-after" }
87
87
  return nil if v.nil?
88
- n = Float(v.to_s, exception: false)
89
- n.nil? ? nil : (n * 1000).to_i
88
+ ProjectNameRetryFeature.retry_after_ms(v.to_s, (Time.now.to_f * 1000).to_i)
89
+ end
90
+
91
+ MONTHS = %w[Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec].freeze
92
+
93
+ IMF_FIXDATE = /\A(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) ([A-Z][a-z]{2}) (\d{4}) (\d{2}):(\d{2}):(\d{2}) GMT\z/
94
+
95
+ # RFC 9110 Retry-After: delay-seconds or an IMF-fixdate, else nil.
96
+ def self.retry_after_ms(value, now)
97
+ s = value.gsub(/\A[ \t]+|[ \t]+\z/, "")
98
+ return s.to_i * 1000 if s.match?(/\A[0-9]+\z/)
99
+ m = IMF_FIXDATE.match(s)
100
+ return nil if m.nil? || !MONTHS.include?(m[2])
101
+ day, year, hour, min, sec = [1, 3, 4, 5, 6].map { |i| m[i].to_i }
102
+ return nil if day < 1 || day > 31 || hour > 23 || min > 59 || sec > 60
103
+ at = Time.utc(year, MONTHS.index(m[2]) + 1, day, hour, min, [sec, 59].min).to_i * 1000
104
+ at += 1000 if sec == 60
105
+ [0, at - now].max
90
106
  end
91
107
 
92
108
  def _sleep(ms)
@@ -47,11 +47,11 @@
47
47
  # mutex is always the innermost lock so the three can never deadlock.
48
48
 
49
49
  require 'json'
50
- require 'net/http'
51
50
  require 'uri'
52
51
 
53
52
  require_relative 'base_feature'
54
53
  require_relative '../utility/struct/voxgig_struct'
54
+ require_relative '../utility/fetcher'
55
55
  require_relative 'secrets/voxgig_sekreto'
56
56
 
57
57
  class ProjectNameSecretsFeature < ProjectNameBaseFeature
@@ -236,6 +236,7 @@ class ProjectNameSecretsFeature < ProjectNameBaseFeature
236
236
  # provider ERROR refuses the request with the provider's own message;
237
237
  # never an unauthenticated send.
238
238
  err = resolve
239
+ return nil, err if err.is_a?(ProjectNameError)
239
240
  unless err.nil?
240
241
  return nil, ctx.make_error("secrets_provider", err.to_s)
241
242
  end
@@ -454,27 +455,22 @@ class ProjectNameSecretsFeature < ProjectNameBaseFeature
454
455
  base = options["base"].is_a?(String) ? options["base"] : ""
455
456
  url = base.sub(%r{/+\z}, "") + "/" + x["path"].sub(%r{\A/+}, "")
456
457
 
457
- fetch = VoxgigStruct.getpath(options, "system.fetch")
458
-
459
- # No custom transport supplied - the ordinary case. make_options leaves
460
- # system.fetch unset, so the exchange gets its own raw HTTP path. Local
461
- # and minimal on purpose: see the NOT-the-SDK-transport note below.
462
- fetch = ProjectNameSecretsFeature.method(:raw_exchange_fetch) unless fetch.is_a?(Proc)
458
+ # The SDK's own transport, beneath every feature's wrapper: it holds the
459
+ # test feature's block and the GET-only guard, and the wrapped one would
460
+ # recurse on the first expiry.
461
+ fetch = ->(at, fd) { ProjectNameUtilities::Fetcher.call(@ctx, at, fd) }
463
462
 
464
463
  # The body is MARSHALLED, never concatenated: a refresh token (or a
465
464
  # configured request-field name) carrying a quote, backslash or newline
466
465
  # must arrive as that literal value, not as malformed JSON.
467
- #
468
- # Deliberately NOT the SDK transport. The transport is what this
469
- # feature wraps, and sending the token request back through it would
470
- # recurse on the first expiry - and would route the exchange through
471
- # the test mock, which knows nothing about it.
472
466
  fetchdef = {
473
467
  "method" => x["method"],
474
468
  "headers" => { "content-type" => "application/json" },
475
469
  "body" => JSON.generate({ x["request"] => @refresh }),
476
470
  # Never followed by the client: a redirect would carry the refresh token on.
477
471
  "redirect" => "manual",
472
+ # Its own bound, in milliseconds: the timeout feature's wrapper is above.
473
+ "timeout" => 30_000,
478
474
  }
479
475
 
480
476
  res, err = fetch.call(url, fetchdef)
@@ -490,6 +486,7 @@ class ProjectNameSecretsFeature < ProjectNameBaseFeature
490
486
  res, err = fetch.call(at, fetchdef)
491
487
  end
492
488
 
489
+ raise err if err.is_a?(ProjectNameError)
493
490
  unless err.nil?
494
491
  raise VoxgigSekreto::SekretoError,
495
492
  "secrets: token exchange failed: #{err} from #{url}"
@@ -599,56 +596,4 @@ class ProjectNameSecretsFeature < ProjectNameBaseFeature
599
596
  def _str(value, dflt)
600
597
  value.is_a?(String) && !value.empty? ? value : dflt
601
598
  end
602
-
603
- # Token-exchange transport of last resort: plain net/http, answering the
604
- # same [res, err] shape the system.fetch seam promises ("status" +
605
- # "json"). It exists so an exchange works with ordinary SDK options -
606
- # requiring a custom transport for the COMMON case would reject every
607
- # live token purchase before a request was made.
608
- def self.raw_exchange_fetch(fullurl, fetchdef)
609
- uri = URI.parse(fullurl)
610
- http = Net::HTTP.new(uri.host, uri.port)
611
- http.use_ssl = (uri.scheme == "https")
612
- http.open_timeout = 30
613
- http.read_timeout = 30
614
-
615
- method_str = (fetchdef["method"] || "POST").to_s.upcase
616
- klass = case method_str
617
- when "PUT" then Net::HTTP::Put
618
- when "PATCH" then Net::HTTP::Patch
619
- when "GET" then Net::HTTP::Get
620
- else Net::HTTP::Post
621
- end
622
-
623
- request = klass.new(uri)
624
- (fetchdef["headers"] || {}).each do |k, v|
625
- request[k] = v.to_s if v.is_a?(String)
626
- end
627
- body = fetchdef["body"]
628
- request.body = body if body.is_a?(String)
629
-
630
- # Net::HTTP#request follows no redirect: a 3xx is returned as its status.
631
- resp = http.request(request)
632
- raw = resp.body
633
-
634
- # A non-2xx answer IS a response: hand back its status so the caller
635
- # reports "token exchange failed: <status>" rather than a transport
636
- # error.
637
- resp_headers = {}
638
- resp.each_header { |k, v| resp_headers[k.downcase] = v }
639
-
640
- return {
641
- "status" => resp.code.to_i,
642
- "headers" => resp_headers,
643
- "json" => -> {
644
- begin
645
- raw.nil? || raw.empty? ? nil : JSON.parse(raw)
646
- rescue StandardError
647
- nil
648
- end
649
- },
650
- }, nil
651
- rescue StandardError => e
652
- return nil, e
653
- end
654
599
  end
@@ -30,8 +30,9 @@ class ProjectNameStreamingFeature < ProjectNameBaseFeature
30
30
  def PreResult(ctx)
31
31
  return unless @active
32
32
  return unless _streamable?(ctx)
33
+ # A failed result keeps no stream, so the entity's stream raises its error.
33
34
  result = ctx.result
34
- return if result.nil?
35
+ return if result.nil? || !result.err.nil?
35
36
 
36
37
  feature = self
37
38
  result.streaming = true
@@ -8,6 +8,8 @@
8
8
  # invoked with each finished span. Trace/span id generation ("idgen") and
9
9
  # the clock ("now", ms) are injectable for deterministic tests.
10
10
 
11
+ require 'securerandom'
12
+
11
13
  require_relative 'base_feature'
12
14
 
13
15
  class ProjectNameTelemetryFeature < ProjectNameBaseFeature
@@ -20,7 +22,6 @@ class ProjectNameTelemetryFeature < ProjectNameBaseFeature
20
22
  @client = nil
21
23
  @options = {}
22
24
  @spans = {}
23
- @seq = 0
24
25
  end
25
26
 
26
27
  def init(ctx, options)
@@ -28,7 +29,6 @@ class ProjectNameTelemetryFeature < ProjectNameBaseFeature
28
29
  @options = options.is_a?(Hash) ? options : {}
29
30
  @active = @options["active"] == true
30
31
  @spans = {}
31
- @seq = 0
32
32
 
33
33
  return unless @active
34
34
 
@@ -111,10 +111,15 @@ class ProjectNameTelemetryFeature < ProjectNameBaseFeature
111
111
  def _id(kind)
112
112
  idgen = @options["idgen"]
113
113
  return idgen.call(kind) if idgen.is_a?(Proc)
114
- # Deterministic-ish sequential id; unique within a client instance.
115
- @seq += 1
116
- n = @seq.to_s(16).rjust(4, "0")
117
- (kind == "trace" ? "t" : "s") + n.ljust(16, "0")
114
+ _random_hex(kind == "trace" ? 16 : 8)
115
+ end
116
+
117
+ # W3C trace context: lowercase hex from the platform's random source, never all zeros.
118
+ def _random_hex(nbytes)
119
+ loop do
120
+ hex = SecureRandom.hex(nbytes)
121
+ return hex if hex.match?(/[^0]/)
122
+ end
118
123
  end
119
124
 
120
125
  def _now
@@ -103,22 +103,8 @@ class ProjectNameTestFeature < ProjectNameBaseFeature
103
103
  entmap = VoxgigStruct.getprop(entity, op.entity)
104
104
  entmap = {} unless entmap.is_a?(Hash)
105
105
 
106
- # For single-entity ops (load, remove) with an empty explicit match, fall
107
- # back to the id the entity client already knows from a prior create/load
108
- # (in fctx.match / fctx.data). Mirrors the TS mock where param() resolves
109
- # the id from that accumulated state.
110
- resolve_match = lambda do |explicit|
111
- return explicit if explicit.is_a?(Hash) && !explicit.empty?
112
- [fctx.match, fctx.data].each do |src|
113
- next if src.nil?
114
- v = VoxgigStruct.getprop(src, "id")
115
- return { "id" => v } if !v.nil? && v != "__UNDEFINED__"
116
- end
117
- {}
118
- end
119
-
120
106
  if op.name == "load"
121
- args = test_self.build_args(fctx, op, resolve_match.call(fctx.reqmatch))
107
+ args = test_self.build_args(fctx, op, fctx.reqmatch)
122
108
  found = VoxgigStruct.select(entmap, args)
123
109
  ent = VoxgigStruct.getelem(found, 0)
124
110
  return respond.call(404, nil, { "statusText" => "Not found" }) unless ent
@@ -137,24 +123,7 @@ class ProjectNameTestFeature < ProjectNameBaseFeature
137
123
  respond.call(200, out, nil)
138
124
 
139
125
  elsif op.name == "update" || op.name == "patch"
140
- # Match the existing entity by id only (or its alias). reqdata also
141
- # contains the new field values, which would otherwise cause select
142
- # to filter out the entity we want to update. When reqdata has no id,
143
- # fall back to the id the entity client carries from a prior
144
- # create/load (in fctx.match / fctx.data), mirroring the TS mock
145
- # where param(ctx,'id') resolves from accumulated state.
146
- update_match = {}
147
- if fctx.reqdata.is_a?(Hash)
148
- update_match["id"] = fctx.reqdata["id"] if fctx.reqdata.key?("id")
149
- if op.alias_map
150
- alias_id = VoxgigStruct.getprop(op.alias_map, "id")
151
- if alias_id && fctx.reqdata.key?(alias_id)
152
- update_match[alias_id] = fctx.reqdata[alias_id]
153
- end
154
- end
155
- end
156
- update_match = resolve_match.call({}) if update_match.empty?
157
- args = test_self.build_args(fctx, op, update_match)
126
+ args = test_self.build_args(fctx, op, ProjectNameTestFeature.record(fctx.reqdata))
158
127
  found = VoxgigStruct.select(entmap, args)
159
128
  ent = VoxgigStruct.getelem(found, 0)
160
129
  # update miss: 404, never another record
@@ -167,7 +136,7 @@ class ProjectNameTestFeature < ProjectNameBaseFeature
167
136
  respond.call(200, out, nil)
168
137
 
169
138
  elsif op.name == "remove"
170
- args = test_self.build_args(fctx, op, resolve_match.call(fctx.reqmatch))
139
+ args = test_self.build_args(fctx, op, fctx.reqmatch)
171
140
  found = VoxgigStruct.select(entmap, args)
172
141
  ent = VoxgigStruct.getelem(found, 0)
173
142
  # Remove only the first matched entity. If nothing matches,
@@ -307,30 +276,54 @@ class ProjectNameTestFeature < ProjectNameBaseFeature
307
276
  qand = []
308
277
  q = { "`$AND`" => qand }
309
278
 
310
- if args
311
- keys = VoxgigStruct.keysof(args)
312
- if keys
313
- keys.each do |key|
314
- is_id = (key == "id")
315
- selected = VoxgigStruct.select(reqd, key)
316
- is_reqd = !VoxgigStruct.isempty(selected)
279
+ ename = ctx.entity.get_name
280
+ idfrom = VoxgigStruct.getpath(ctx.config, "entity.#{ename}.id.from")
281
+ idfrom = {} unless idfrom.is_a?(Hash)
317
282
 
318
- if is_id || is_reqd
319
- v = ctx.utility.param.call(ctx, key)
320
- ka = op.alias_map ? VoxgigStruct.getprop(op.alias_map, key) : nil
283
+ names = args ? (VoxgigStruct.keysof(args) || []).dup : []
321
284
 
322
- qor = [{ key => v }]
323
- qor << { ka => v } if ka.is_a?(String)
324
-
325
- qand << { "`$OR`" => qor }
326
- end
285
+ # With no id in the call, the entity's held id (or composite parts) stands in.
286
+ if VoxgigStruct.getprop(args, "id").nil?
287
+ parts = VoxgigStruct.getpath(ctx.config, "entity.#{ename}.id.parts")
288
+ parts = (opname == "list" ? [] : ["id"]) unless parts.is_a?(Array)
289
+ parts.each do |part|
290
+ pname = part.to_s
291
+ if !names.include?(pname) && (held?(ctx.match, pname) || held?(ctx.data, pname))
292
+ names << pname
327
293
  end
328
294
  end
329
295
  end
330
296
 
297
+ names.each do |key|
298
+ is_id = (key == "id")
299
+ selected = VoxgigStruct.select(reqd, key)
300
+ is_reqd = !VoxgigStruct.isempty(selected)
301
+
302
+ if is_id || is_reqd
303
+ v = ctx.utility.param.call(ctx, key)
304
+ ka = op.alias_map ? VoxgigStruct.getprop(op.alias_map, key) : nil
305
+
306
+ qor = [{ key => v }]
307
+ qor << { ka => v } if ka.is_a?(String)
308
+
309
+ # An alternative, never a replacement: a seed keeping the parameter
310
+ # flat is still found.
311
+ kf = idfrom[key]
312
+ qor << kf.split(".").reverse.reduce(v) { |acc, k| { k => acc } } if kf.is_a?(String) && kf != key
313
+
314
+ qand << { "`$OR`" => qor }
315
+ end
316
+ end
317
+
331
318
  q["`$AND`"] = qand
332
319
  ctx.ctrl.explain["test"] = { "query" => q } if ctx.ctrl.explain
333
320
 
334
321
  q
335
322
  end
323
+
324
+ def held?(src, key)
325
+ return false if src.nil?
326
+ v = VoxgigStruct.getprop(src, key)
327
+ !v.nil? && v != "__UNDEFINED__"
328
+ end
336
329
  end