@voxgig/sdkgen 4.51.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 (289) 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 +1 -1
  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/src/cmp/c/TestClean_c.ts +12 -11
  32. package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +17 -10
  33. package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +18 -1
  34. package/project/.sdk/src/cmp/cpp/TestClean_cpp.ts +2 -1
  35. package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +30 -2
  36. package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +31 -12
  37. package/project/.sdk/src/cmp/elixir/TestClean_elixir.ts +2 -1
  38. package/project/.sdk/src/cmp/elixir/fragment/Main.fragment.ex +51 -15
  39. package/project/.sdk/src/cmp/elixir/fragment/Pipeline.fragment.ex +17 -0
  40. package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +42 -2
  41. package/project/.sdk/src/cmp/go/fragment/Main.fragment.go +42 -14
  42. package/project/.sdk/src/cmp/java/TestClean_java.ts +9 -4
  43. package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +21 -0
  44. package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +13 -8
  45. package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +26 -2
  46. package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +8 -0
  47. package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +8 -0
  48. package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +8 -0
  49. package/project/.sdk/src/cmp/js/fragment/EntityPatchOp.fragment.js +8 -0
  50. package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +8 -0
  51. package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +8 -0
  52. package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +12 -5
  53. package/project/.sdk/src/cmp/kotlin/TestClean_kotlin.ts +9 -4
  54. package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +19 -0
  55. package/project/.sdk/src/cmp/lua/TestClean_lua.ts +2 -1
  56. package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +42 -5
  57. package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +44 -10
  58. package/project/.sdk/src/cmp/lua/utility_lua.ts +2 -1
  59. package/project/.sdk/src/cmp/ocaml/TestClean_ocaml.ts +2 -1
  60. package/project/.sdk/src/cmp/ocaml/fragment/RunOp.fragment.ml +36 -21
  61. package/project/.sdk/src/cmp/perl/TestClean_perl.ts +1 -1
  62. package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +21 -0
  63. package/project/.sdk/src/cmp/perl/fragment/Main.fragment.pm +31 -12
  64. package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +33 -4
  65. package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +13 -6
  66. package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +25 -2
  67. package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +26 -12
  68. package/project/.sdk/src/cmp/rb/TestClean_rb.ts +1 -1
  69. package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +23 -2
  70. package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +27 -11
  71. package/project/.sdk/src/cmp/rust/TestClean_rust.ts +14 -17
  72. package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +22 -2
  73. package/project/.sdk/src/cmp/scala/TestClean_scala.ts +11 -11
  74. package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +14 -0
  75. package/project/.sdk/src/cmp/swift/TestClean_swift.ts +11 -11
  76. package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +9 -0
  77. package/project/.sdk/src/cmp/swift/fragment/Main.fragment.swift +24 -10
  78. package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +13 -8
  79. package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +26 -2
  80. package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +8 -0
  81. package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +8 -0
  82. package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +8 -0
  83. package/project/.sdk/src/cmp/ts/fragment/EntityPatchOp.fragment.ts +8 -0
  84. package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +8 -0
  85. package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +8 -0
  86. package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +12 -5
  87. package/project/.sdk/src/cmp/zig/TestClean_zig.ts +11 -11
  88. package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +17 -10
  89. package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +41 -6
  90. package/project/.sdk/tm/c/feature/metrics.c +7 -0
  91. package/project/.sdk/tm/c/feature/paging.c +231 -2
  92. package/project/.sdk/tm/c/feature/ratelimit.c +5 -9
  93. package/project/.sdk/tm/c/feature/retry.c +51 -4
  94. package/project/.sdk/tm/c/feature/streaming.c +2 -1
  95. package/project/.sdk/tm/c/feature/telemetry.c +19 -18
  96. package/project/.sdk/tm/c/feature/test.c +78 -54
  97. package/project/.sdk/tm/c/tests/feature_test.c +184 -0
  98. package/project/.sdk/tm/c/tests/primary_utility_test.c +2 -0
  99. package/project/.sdk/tm/c/utility/make_options.c +80 -9
  100. package/project/.sdk/tm/clojure/src/sdk/core.clj +31 -11
  101. package/project/.sdk/tm/clojure/src/sdk/features.clj +198 -70
  102. package/project/.sdk/tm/clojure/test/sdk/test/feature.clj +70 -1
  103. package/project/.sdk/tm/cpp/core/types.hpp +137 -68
  104. package/project/.sdk/tm/cpp/feature/audit.hpp +6 -1
  105. package/project/.sdk/tm/cpp/feature/metrics.hpp +19 -0
  106. package/project/.sdk/tm/cpp/feature/paging.hpp +160 -2
  107. package/project/.sdk/tm/cpp/feature/ratelimit.hpp +18 -14
  108. package/project/.sdk/tm/cpp/feature/retry.hpp +46 -5
  109. package/project/.sdk/tm/cpp/feature/streaming.hpp +2 -1
  110. package/project/.sdk/tm/cpp/feature/telemetry.hpp +17 -10
  111. package/project/.sdk/tm/cpp/feature/test.hpp +63 -53
  112. package/project/.sdk/tm/cpp/test/feature_test.cpp +137 -0
  113. package/project/.sdk/tm/cpp/utility/pipeline.hpp +35 -5
  114. package/project/.sdk/tm/csharp/feature/AuditFeature.cs +8 -1
  115. package/project/.sdk/tm/csharp/feature/MetricsFeature.cs +23 -0
  116. package/project/.sdk/tm/csharp/feature/PagingFeature.cs +130 -3
  117. package/project/.sdk/tm/csharp/feature/RatelimitFeature.cs +26 -19
  118. package/project/.sdk/tm/csharp/feature/RetryFeature.cs +41 -7
  119. package/project/.sdk/tm/csharp/feature/StreamingFeature.cs +2 -1
  120. package/project/.sdk/tm/csharp/feature/TelemetryFeature.cs +11 -9
  121. package/project/.sdk/tm/csharp/feature/TestFeature.cs +55 -67
  122. package/project/.sdk/tm/csharp/test/FeatureTest.cs +162 -0
  123. package/project/.sdk/tm/csharp/utility/MakeOptions.cs +89 -12
  124. package/project/.sdk/tm/elixir/lib/projectname/feature/metrics.ex +13 -0
  125. package/project/.sdk/tm/elixir/lib/projectname/feature/paging.ex +110 -5
  126. package/project/.sdk/tm/elixir/lib/projectname/feature/ratelimit.ex +6 -12
  127. package/project/.sdk/tm/elixir/lib/projectname/feature/retry.ex +33 -9
  128. package/project/.sdk/tm/elixir/lib/projectname/feature/streaming.ex +2 -1
  129. package/project/.sdk/tm/elixir/lib/projectname/feature/telemetry.ex +7 -7
  130. package/project/.sdk/tm/elixir/lib/projectname/feature/test.ex +52 -48
  131. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +59 -35
  132. package/project/.sdk/tm/elixir/test/feature_test.exs +137 -0
  133. package/project/.sdk/tm/go/feature/audit_feature.go +1 -3
  134. package/project/.sdk/tm/go/feature/base_feature.go +11 -0
  135. package/project/.sdk/tm/go/feature/metrics_feature.go +14 -0
  136. package/project/.sdk/tm/go/feature/paging_feature.go +108 -2
  137. package/project/.sdk/tm/go/feature/ratelimit_feature.go +19 -17
  138. package/project/.sdk/tm/go/feature/retry_feature.go +81 -9
  139. package/project/.sdk/tm/go/feature/streaming_feature.go +2 -1
  140. package/project/.sdk/tm/go/feature/telemetry_feature.go +18 -11
  141. package/project/.sdk/tm/go/feature/test_feature.go +65 -55
  142. package/project/.sdk/tm/go/test/feature_corpus_test.go +209 -28
  143. package/project/.sdk/tm/go/test/feature_test.go +32 -0
  144. package/project/.sdk/tm/go/utility/make_options.go +111 -6
  145. package/project/.sdk/tm/java/core/SdkClient.java +43 -14
  146. package/project/.sdk/tm/java/feature/AuditFeature.java +5 -1
  147. package/project/.sdk/tm/java/feature/MetricsFeature.java +31 -0
  148. package/project/.sdk/tm/java/feature/PagingFeature.java +156 -2
  149. package/project/.sdk/tm/java/feature/RatelimitFeature.java +15 -13
  150. package/project/.sdk/tm/java/feature/RetryFeature.java +33 -6
  151. package/project/.sdk/tm/java/feature/StreamingFeature.java +2 -1
  152. package/project/.sdk/tm/java/feature/TelemetryFeature.java +17 -9
  153. package/project/.sdk/tm/java/feature/TestFeature.java +50 -63
  154. package/project/.sdk/tm/java/test/FeatureCorpusTest.java +170 -17
  155. package/project/.sdk/tm/java/utility/MakeOptions.java +128 -14
  156. package/project/.sdk/tm/js/src/feature/metrics/MetricsFeature.js +8 -3
  157. package/project/.sdk/tm/js/src/feature/paging/PagingFeature.js +99 -1
  158. package/project/.sdk/tm/js/src/feature/ratelimit/RatelimitFeature.js +5 -9
  159. package/project/.sdk/tm/js/src/feature/retry/RetryFeature.js +25 -3
  160. package/project/.sdk/tm/js/src/feature/streaming/StreamingFeature.js +2 -1
  161. package/project/.sdk/tm/js/src/feature/telemetry/TelemetryFeature.js +11 -6
  162. package/project/.sdk/tm/js/src/feature/test/TestFeature.js +38 -1
  163. package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +55 -6
  164. package/project/.sdk/tm/js/test/feature/Corpus.test.js +95 -25
  165. package/project/.sdk/tm/js/test/feature.test.js +14 -1
  166. package/project/.sdk/tm/kotlin/core/SdkClient.kt +23 -10
  167. package/project/.sdk/tm/kotlin/feature/AuditFeature.kt +5 -1
  168. package/project/.sdk/tm/kotlin/feature/MetricsFeature.kt +22 -0
  169. package/project/.sdk/tm/kotlin/feature/PagingFeature.kt +125 -2
  170. package/project/.sdk/tm/kotlin/feature/RatelimitFeature.kt +16 -13
  171. package/project/.sdk/tm/kotlin/feature/RetryFeature.kt +36 -14
  172. package/project/.sdk/tm/kotlin/feature/StreamingFeature.kt +4 -0
  173. package/project/.sdk/tm/kotlin/feature/TelemetryFeature.kt +12 -10
  174. package/project/.sdk/tm/kotlin/feature/TestFeature.kt +45 -48
  175. package/project/.sdk/tm/kotlin/test/FeatureTest.kt +114 -0
  176. package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +83 -14
  177. package/project/.sdk/tm/lua/feature/debug_feature.lua +2 -3
  178. package/project/.sdk/tm/lua/feature/metrics_feature.lua +5 -0
  179. package/project/.sdk/tm/lua/feature/paging_feature.lua +143 -2
  180. package/project/.sdk/tm/lua/feature/ratelimit_feature.lua +5 -9
  181. package/project/.sdk/tm/lua/feature/retry_feature.lua +43 -5
  182. package/project/.sdk/tm/lua/feature/streaming_feature.lua +2 -1
  183. package/project/.sdk/tm/lua/feature/telemetry_feature.lua +18 -7
  184. package/project/.sdk/tm/lua/feature/test_feature.lua +60 -62
  185. package/project/.sdk/tm/lua/test/feature_test.lua +100 -3
  186. package/project/.sdk/tm/lua/utility/make_options.lua +55 -13
  187. package/project/.sdk/tm/ocaml/sdk_features.ml +286 -60
  188. package/project/.sdk/tm/ocaml/sdk_runtime.ml +34 -11
  189. package/project/.sdk/tm/ocaml/test/t_feature.ml +72 -1
  190. package/project/.sdk/tm/perl/feature/debug_feature.pm +2 -2
  191. package/project/.sdk/tm/perl/feature/metrics_feature.pm +5 -0
  192. package/project/.sdk/tm/perl/feature/paging_feature.pm +139 -2
  193. package/project/.sdk/tm/perl/feature/ratelimit_feature.pm +5 -11
  194. package/project/.sdk/tm/perl/feature/retry_feature.pm +22 -4
  195. package/project/.sdk/tm/perl/feature/streaming_feature.pm +2 -0
  196. package/project/.sdk/tm/perl/feature/telemetry_feature.pm +17 -8
  197. package/project/.sdk/tm/perl/feature/test_feature.pm +45 -50
  198. package/project/.sdk/tm/perl/t/feature.t +2 -2
  199. package/project/.sdk/tm/perl/t/feature_corpus.t +126 -23
  200. package/project/.sdk/tm/perl/utility/make_options.pm +33 -10
  201. package/project/.sdk/tm/php/feature/MetricsFeature.php +8 -0
  202. package/project/.sdk/tm/php/feature/PagingFeature.php +128 -1
  203. package/project/.sdk/tm/php/feature/RatelimitFeature.php +5 -9
  204. package/project/.sdk/tm/php/feature/RetryFeature.php +27 -3
  205. package/project/.sdk/tm/php/feature/StreamingFeature.php +2 -1
  206. package/project/.sdk/tm/php/feature/TelemetryFeature.php +10 -7
  207. package/project/.sdk/tm/php/feature/TestFeature.php +55 -47
  208. package/project/.sdk/tm/php/test/FeatureCorpusTest.php +151 -16
  209. package/project/.sdk/tm/php/utility/MakeOptions.php +40 -13
  210. package/project/.sdk/tm/py/pkg/feature/metrics_feature.py +7 -0
  211. package/project/.sdk/tm/py/pkg/feature/paging_feature.py +86 -1
  212. package/project/.sdk/tm/py/pkg/feature/ratelimit_feature.py +13 -16
  213. package/project/.sdk/tm/py/pkg/feature/retry_feature.py +31 -6
  214. package/project/.sdk/tm/py/pkg/feature/streaming_feature.py +2 -1
  215. package/project/.sdk/tm/py/pkg/feature/telemetry_feature.py +10 -6
  216. package/project/.sdk/tm/py/pkg/feature/test_feature.py +56 -53
  217. package/project/.sdk/tm/py/pkg/utility/make_options.py +68 -20
  218. package/project/.sdk/tm/py/test/test_feature.py +11 -1
  219. package/project/.sdk/tm/py/test/test_feature_corpus.py +111 -16
  220. package/project/.sdk/tm/py-data/pkg/fetch.py +6 -3
  221. package/project/.sdk/tm/py-data/test/test_fetch.py +7 -4
  222. package/project/.sdk/tm/rb/feature/debug_feature.rb +2 -2
  223. package/project/.sdk/tm/rb/feature/metrics_feature.rb +8 -0
  224. package/project/.sdk/tm/rb/feature/paging_feature.rb +87 -1
  225. package/project/.sdk/tm/rb/feature/ratelimit_feature.rb +12 -16
  226. package/project/.sdk/tm/rb/feature/retry_feature.rb +19 -3
  227. package/project/.sdk/tm/rb/feature/streaming_feature.rb +2 -1
  228. package/project/.sdk/tm/rb/feature/telemetry_feature.rb +11 -6
  229. package/project/.sdk/tm/rb/feature/test_feature.rb +42 -49
  230. package/project/.sdk/tm/rb/test/feature_corpus_test.rb +108 -24
  231. package/project/.sdk/tm/rb/test/feature_test.rb +1 -1
  232. package/project/.sdk/tm/rb/utility/make_options.rb +32 -11
  233. package/project/.sdk/tm/rust/feature/audit.rs +2 -2
  234. package/project/.sdk/tm/rust/feature/metrics.rs +24 -1
  235. package/project/.sdk/tm/rust/feature/paging.rs +189 -3
  236. package/project/.sdk/tm/rust/feature/ratelimit.rs +5 -10
  237. package/project/.sdk/tm/rust/feature/retry.rs +59 -6
  238. package/project/.sdk/tm/rust/feature/streaming.rs +3 -2
  239. package/project/.sdk/tm/rust/feature/support.rs +4 -0
  240. package/project/.sdk/tm/rust/feature/telemetry.rs +22 -11
  241. package/project/.sdk/tm/rust/feature/test.rs +63 -57
  242. package/project/.sdk/tm/rust/tests/feature_test.rs +174 -0
  243. package/project/.sdk/tm/rust/tests/primary_utility_test.rs +1 -0
  244. package/project/.sdk/tm/rust/utility/make_options.rs +122 -27
  245. package/project/.sdk/tm/scala/core/SdkClient.scala +45 -11
  246. package/project/.sdk/tm/scala/feature/AuditFeature.scala +6 -1
  247. package/project/.sdk/tm/scala/feature/MetricsFeature.scala +31 -1
  248. package/project/.sdk/tm/scala/feature/PagingFeature.scala +122 -2
  249. package/project/.sdk/tm/scala/feature/RatelimitFeature.scala +14 -11
  250. package/project/.sdk/tm/scala/feature/RetryFeature.scala +29 -7
  251. package/project/.sdk/tm/scala/feature/StreamingFeature.scala +2 -1
  252. package/project/.sdk/tm/scala/feature/TelemetryFeature.scala +12 -10
  253. package/project/.sdk/tm/scala/feature/TestFeature.scala +44 -44
  254. package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +41 -0
  255. package/project/.sdk/tm/scala/utility/Make.scala +96 -13
  256. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/AuditFeature.swift +3 -2
  257. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/MetricsFeature.swift +20 -0
  258. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/PagingFeature.swift +102 -2
  259. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RatelimitFeature.swift +19 -13
  260. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/RetryFeature.swift +40 -5
  261. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/StreamingFeature.swift +2 -1
  262. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TelemetryFeature.swift +11 -9
  263. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TestFeature.swift +55 -49
  264. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +51 -13
  265. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/FeatureTest.swift +111 -0
  266. package/project/.sdk/tm/ts/src/feature/metrics/MetricsFeature.ts +5 -0
  267. package/project/.sdk/tm/ts/src/feature/paging/PagingFeature.ts +99 -1
  268. package/project/.sdk/tm/ts/src/feature/ratelimit/RatelimitFeature.ts +5 -9
  269. package/project/.sdk/tm/ts/src/feature/retry/RetryFeature.ts +25 -3
  270. package/project/.sdk/tm/ts/src/feature/streaming/StreamingFeature.ts +2 -1
  271. package/project/.sdk/tm/ts/src/feature/telemetry/TelemetryFeature.ts +11 -6
  272. package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +8 -7
  273. package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +57 -6
  274. package/project/.sdk/tm/ts/test/feature/Corpus.test.ts +95 -25
  275. package/project/.sdk/tm/ts/test/feature.test.ts +14 -1
  276. package/project/.sdk/tm/zig/core/utility.zig +107 -8
  277. package/project/.sdk/tm/zig/feature/metrics.zig +19 -0
  278. package/project/.sdk/tm/zig/feature/paging.zig +172 -4
  279. package/project/.sdk/tm/zig/feature/ratelimit.zig +5 -11
  280. package/project/.sdk/tm/zig/feature/retry.zig +41 -3
  281. package/project/.sdk/tm/zig/feature/streaming.zig +2 -0
  282. package/project/.sdk/tm/zig/feature/telemetry.zig +15 -9
  283. package/project/.sdk/tm/zig/feature/test.zig +56 -40
  284. package/project/.sdk/tm/zig/test/feature_test.zig +109 -0
  285. package/project/.sdk/tm/zig/test/primary_utility_test.zig +2 -0
  286. package/project/sdkgen-package.json +1 -1
  287. package/src/cmp/ReadmeExplanation.ts +5 -2
  288. package/src/cmp/ReadmeFeatures.ts +21 -6
  289. package/src/helpers/optspec.ts +2 -2
@@ -211,7 +211,7 @@ main: kit: feature: &: {
211
211
 
212
212
  config: {
213
213
  optspec: &: top
214
- strict: *false | boolean
214
+ strict: *true | boolean
215
215
  }
216
216
 
217
217
  plugin: &: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voxgig/sdkgen",
3
- "version": "4.51.0",
3
+ "version": "4.52.0",
4
4
  "main": "dist/sdkgen.js",
5
5
  "type": "commonjs",
6
6
  "engines": {
@@ -11,7 +11,7 @@ main: kit: feature: audit: {
11
11
 
12
12
  config: {
13
13
  options: {
14
- active: false
14
+ active: *false | boolean
15
15
  actor: 'anonymous'
16
16
  # maximum retained records
17
17
  max: 1000
@@ -11,7 +11,7 @@ main: kit: feature: cache: {
11
11
 
12
12
  config: {
13
13
  options: {
14
- active: false
14
+ active: *false | boolean
15
15
  # time-to-live in milliseconds; a response's Cache-Control max-age caps it
16
16
  ttl: 5000
17
17
  # maximum cached entries in this client's store (oldest evicted)
@@ -11,7 +11,7 @@ main: kit: feature: clienttrack: {
11
11
 
12
12
  config: {
13
13
  options: {
14
- active: false
14
+ active: *false | boolean
15
15
  clientVersion: '0.0.1'
16
16
  }
17
17
  }
@@ -15,7 +15,7 @@ main: kit: feature: cost: {
15
15
 
16
16
  config: {
17
17
  options: {
18
- active: false
18
+ active: *false | boolean
19
19
  currency: 'USD'
20
20
  unit: 0
21
21
  rates: {}
@@ -11,7 +11,7 @@ main: kit: feature: debug: {
11
11
 
12
12
  config: {
13
13
  options: {
14
- active: false
14
+ active: *false | boolean
15
15
  # maximum retained entries
16
16
  max: 100
17
17
  # header names masked in captured traces IN ADDITION to the SDK's own
@@ -11,7 +11,7 @@ main: kit: feature: idempotency: {
11
11
 
12
12
  config: {
13
13
  options: {
14
- active: false
14
+ active: *false | boolean
15
15
  header: 'Idempotency-Key'
16
16
  methods: ['POST', 'PUT', 'PATCH', 'DELETE']
17
17
  ops: ['create', 'update', 'remove']
@@ -11,7 +11,7 @@ main: kit: feature: log: {
11
11
 
12
12
 
13
13
  config: {
14
- options: active: true
14
+ options: active: *false | boolean
15
15
  }
16
16
 
17
17
  hook: {
@@ -11,7 +11,7 @@ main: kit: feature: metrics: {
11
11
 
12
12
  config: {
13
13
  options: {
14
- active: false
14
+ active: *false | boolean
15
15
  }
16
16
  }
17
17
 
@@ -26,4 +26,6 @@ main: kit: feature: metrics: {
26
26
  main: kit: feature: metrics: config: optspec: {
27
27
  # injected clock, for deterministic durations
28
28
  now: '`$FUNCTION`'
29
+ # receives a copy of the counters after each operation
30
+ sink: '`$FUNCTION`'
29
31
  }
@@ -11,7 +11,7 @@ main: kit: feature: netsim: {
11
11
 
12
12
  config: {
13
13
  options: {
14
- active: false
14
+ active: *false | boolean
15
15
  latency: 0
16
16
  failTimes: 0
17
17
  failStatus: 503
@@ -11,12 +11,15 @@ main: kit: feature: paging: {
11
11
 
12
12
  config: {
13
13
  options: {
14
- active: false
14
+ active: *false | boolean
15
15
  pageParam: 'page'
16
16
  limitParam: 'limit'
17
17
  cursorParam: 'cursor'
18
18
  startPage: 1
19
19
 
20
+ # how a body `next` is read: 'auto', 'cursor' or 'url'
21
+ next: 'auto'
22
+
20
23
  # GraphQL (relay) list ops paginate through operation variables
21
24
  # rather than query parameters. These name the variables to bind;
22
25
  # the cursor/hasMore response paths come from the model's per-op
@@ -11,7 +11,7 @@ main: kit: feature: proxy: {
11
11
 
12
12
  config: {
13
13
  options: {
14
- active: false
14
+ active: *false | boolean
15
15
  # proxy URL, e.g. 'http://proxy.internal:8080' ('' = use env when fromEnv)
16
16
  url: ''
17
17
  # read HTTPS_PROXY / HTTP_PROXY / NO_PROXY from the environment
@@ -11,11 +11,9 @@ main: kit: feature: ratelimit: {
11
11
 
12
12
  config: {
13
13
  options: {
14
- active: false
14
+ active: *false | boolean
15
15
  # tokens per second
16
16
  rate: 5
17
- # bucket capacity (defaults to `rate` when unset)
18
- burst: 5
19
17
  }
20
18
  }
21
19
 
@@ -25,6 +23,8 @@ main: kit: feature: ratelimit: {
25
23
 
26
24
 
27
25
  main: kit: feature: ratelimit: config: optspec: {
26
+ # bucket capacity; `rate` when unset
27
+ burst: '`$NUMBER`'
28
28
  # injected clock
29
29
  now: '`$FUNCTION`'
30
30
  # injected delay, so a test need not really wait
@@ -11,7 +11,7 @@ main: kit: feature: rbac: {
11
11
 
12
12
  config: {
13
13
  options: {
14
- active: false
14
+ active: *false | boolean
15
15
  # permissions the client holds ('*' grants everything)
16
16
  permissions: []
17
17
  # required permission keyed by '<entity>.<op>', '<op>', or '*'
@@ -12,7 +12,7 @@ main: kit: feature: retry: {
12
12
  config: {
13
13
  # Opt-in: enable per SDK via options.feature.retry.active = true
14
14
  options: {
15
- active: false
15
+ active: *false | boolean
16
16
  retries: 2
17
17
  minDelay: 50
18
18
  maxDelay: 2000
@@ -907,7 +907,7 @@ main: kit: feature: secrets: {
907
907
 
908
908
  config: {
909
909
  options: {
910
- active: false
910
+ active: *false | boolean
911
911
 
912
912
  # The sekreto provider chain, in first-hit order. Each entry is a
913
913
  # sekreto ProviderSpec ({ kind, name, ... }) or a provider object.
@@ -11,7 +11,7 @@ main: kit: feature: streaming: {
11
11
 
12
12
  config: {
13
13
  options: {
14
- active: false
14
+ active: *false | boolean
15
15
  # simulate paced delivery (ms between chunks) — mainly for tests
16
16
  chunkDelay: 0
17
17
  # group items into batches of this size (0 = one item per step)
@@ -11,7 +11,7 @@ main: kit: feature: telemetry: {
11
11
 
12
12
  config: {
13
13
  options: {
14
- active: false
14
+ active: *false | boolean
15
15
  }
16
16
  }
17
17
 
@@ -29,7 +29,7 @@ main: kit: feature: telemetry: config: optspec: {
29
29
  exporter: '`$FUNCTION`'
30
30
  # extra headers merged into the propagated context
31
31
  headers: '`$MAP`'
32
- # supplies trace and span ids
32
+ # supplies trace and span ids in place of random W3C ones
33
33
  idgen: '`$FUNCTION`'
34
34
  # injected clock
35
35
  now: '`$FUNCTION`'
@@ -11,7 +11,7 @@ main: kit: feature: test: {
11
11
 
12
12
  config: {
13
13
  # Test mode is off until a client activates it
14
- options: active: false
14
+ options: active: *false | boolean
15
15
  }
16
16
 
17
17
  hook: {
@@ -11,7 +11,7 @@ main: kit: feature: timeout: {
11
11
 
12
12
  config: {
13
13
  options: {
14
- active: false
14
+ active: *false | boolean
15
15
  ms: 30000
16
16
  }
17
17
  }
@@ -13,7 +13,7 @@ main: kit: feature: validate: {
13
13
 
14
14
  config: {
15
15
  options: {
16
- active: false
16
+ active: *false | boolean
17
17
 
18
18
  request: true
19
19
 
@@ -839,18 +839,16 @@ int main(void) {
839
839
  // out whichever name prepare_auth placed.
840
840
  drive(make_sdk_with(SC_OK, NULL, NULL, cmap(1, "name", v_str("zzcred"))), op, NULL);
841
841
 
842
- // A credential mistyped as a map. The C validator defaults rather than
843
- // rejects, so what the constructor produced is swept instead: a string
844
- // quoting the value, cleaned the way a validation message is.
845
- ${Name}SDK* mistyped = ${ident}_sdk_new(offline(cmap(2,
842
+ // A credential mistyped as a map is rejected by validation, whose message
843
+ // quotes the value it rejected.
844
+ PNError* rejected = NULL;
845
+ ${Name}SDK* refused = ${ident}_sdk_new(offline(cmap(2,
846
846
  "apikey", cmap(1, "value", v_str(CANARY_APIKEY)),
847
+ "clean", cmap(1, "values", v_str(CANARY_VALUE)))), &rejected);
848
+ CHECK(NULL == refused && NULL != rejected, "a credential mistyped as a map should be rejected");
849
+ if (rejected) push_error("rejected", rejected);
850
+ ${Name}SDK* mistyped = ${ident}_sdk_new(offline(cmap(1,
847
851
  "clean", cmap(1, "values", v_str(CANARY_VALUE)))), NULL);
848
- {
849
- char quoted[256];
850
- snprintf(quoted, sizeof(quoted), "apikey: expected string, got {\\"value\\":\\"%s\\"}",
851
- CANARY_APIKEY);
852
- push("mistyped:quoted", clean_str(sdk_get_root_ctx(mistyped), quoted));
853
- }
854
852
 
855
853
  // An error a feature hook raises, quoting the request, with explain on.
856
854
  Feature* thrower = (Feature*)calloc(1, sizeof(CaptureFeature));
@@ -1047,13 +1045,16 @@ int main(void) {
1047
1045
  // name and id, is not read at all, and nor are rbac's rules, keyed by entity
1048
1046
  // and operation names.
1049
1047
  {
1048
+ voxgig_value* providers = v_list();
1049
+ voxgig_list_push(voxgig_as_list(providers),
1050
+ cmap(2, "name", v_str("static"), "token", v_str("ZZTOKEN-feat456")));
1050
1051
  ${Name}SDK* featured = ${ident}_sdk_new(offline(cmap(3,
1051
1052
  "apikey", v_str(CANARY_APIKEY),
1052
1053
  "feature", cmap(3,
1053
1054
  "secrets", cmap(3,
1054
1055
  "active", v_bool(false),
1055
1056
  "name", v_str("ZZNAME-feat123"),
1056
- "token", v_str("ZZTOKEN-feat456")),
1057
+ "providers", providers),
1057
1058
  "rbac", cmap(2,
1058
1059
  "active", v_bool(false),
1059
1060
  "rules", cmap(1, "zztoken.load", v_str("PLAINRULE-k7j5h3g1"))),
@@ -72,6 +72,13 @@ Entity* entyvar_entity_new(ProjectNameSDK* client, voxgig_value* entopts) {
72
72
  return (Entity*)self;
73
73
  }
74
74
 
75
+ // A failed step leaves through make_error, then PreDone, which it skipped.
76
+ static voxgig_value* entyvar_failed(Context* ctx, PNError* e, PNError** err) {
77
+ voxgig_value* out = make_error_util(ctx, e, err);
78
+ feature_hook_util(ctx, "PreDone");
79
+ return out;
80
+ }
81
+
75
82
  // Pipeline: make_point -> make_spec -> make_request -> make_response ->
76
83
  // make_result -> post_done -> done. Feature hooks fire between stages.
77
84
  static voxgig_value* entyvar_run_op(entyvar_entity* self, Context* ctx,
@@ -83,31 +90,31 @@ static voxgig_value* entyvar_run_op(entyvar_entity* self, Context* ctx,
83
90
  // #PrePoint-Hook
84
91
 
85
92
  voxgig_value* point = make_point_util(ctx, &e);
86
- if (e) return make_error_util(ctx, e, err);
93
+ if (e) return entyvar_failed(ctx, e, err);
87
94
  ctx_out_set_point_val(ctx, point);
88
95
 
89
96
  // #PreSpec-Hook
90
97
 
91
98
  Spec* spec = make_spec_util(ctx, &e);
92
- if (e) return make_error_util(ctx, e, err);
99
+ if (e) return entyvar_failed(ctx, e, err);
93
100
  ctx->out_spec = spec;
94
101
 
95
102
  // #PreRequest-Hook
96
103
 
97
104
  Response* resp = make_request_util(ctx, &e);
98
- if (e) return make_error_util(ctx, e, err);
105
+ if (e) return entyvar_failed(ctx, e, err);
99
106
  ctx->out_request = resp;
100
107
 
101
108
  // #PreResponse-Hook
102
109
 
103
110
  Response* resp2 = make_response_util(ctx, &e);
104
- if (e) return make_error_util(ctx, e, err);
111
+ if (e) return entyvar_failed(ctx, e, err);
105
112
  ctx->out_response = resp2;
106
113
 
107
114
  // #PreResult-Hook
108
115
 
109
116
  SdkResult* result = make_result_util(ctx, &e);
110
- if (e) return make_error_util(ctx, e, err);
117
+ if (e) return entyvar_failed(ctx, e, err);
111
118
  ctx->out_result = result;
112
119
 
113
120
  // #PreDone-Hook
@@ -176,27 +183,27 @@ voxgig_value* entyvar_stream(Entity* e, const char* action, voxgig_value* args,
176
183
 
177
184
  feature_hook_util(ctx, "PrePoint");
178
185
  voxgig_value* point = make_point_util(ctx, &pe);
179
- if (pe) return entyvar_stream_items(make_error_util(ctx, pe, err), err);
186
+ if (pe) return entyvar_stream_items(entyvar_failed(ctx, pe, err), err);
180
187
  ctx_out_set_point_val(ctx, point);
181
188
 
182
189
  feature_hook_util(ctx, "PreSpec");
183
190
  Spec* spec = make_spec_util(ctx, &pe);
184
- if (pe) return entyvar_stream_items(make_error_util(ctx, pe, err), err);
191
+ if (pe) return entyvar_stream_items(entyvar_failed(ctx, pe, err), err);
185
192
  ctx->out_spec = spec;
186
193
 
187
194
  feature_hook_util(ctx, "PreRequest");
188
195
  Response* resp = make_request_util(ctx, &pe);
189
- if (pe) return entyvar_stream_items(make_error_util(ctx, pe, err), err);
196
+ if (pe) return entyvar_stream_items(entyvar_failed(ctx, pe, err), err);
190
197
  ctx->out_request = resp;
191
198
 
192
199
  feature_hook_util(ctx, "PreResponse");
193
200
  Response* resp2 = make_response_util(ctx, &pe);
194
- if (pe) return entyvar_stream_items(make_error_util(ctx, pe, err), err);
201
+ if (pe) return entyvar_stream_items(entyvar_failed(ctx, pe, err), err);
195
202
  ctx->out_response = resp2;
196
203
 
197
204
  feature_hook_util(ctx, "PreResult");
198
205
  SdkResult* result = make_result_util(ctx, &pe);
199
- if (pe) return entyvar_stream_items(make_error_util(ctx, pe, err), err);
206
+ if (pe) return entyvar_stream_items(entyvar_failed(ctx, pe, err), err);
200
207
  ctx->out_result = result;
201
208
 
202
209
  feature_hook_util(ctx, "PreDone");
@@ -91,7 +91,19 @@
91
91
  (when-not (= false (core/oget (core/oget ctx :ctrl) :throw))
92
92
  (throw cleaned)))))
93
93
 
94
+ (defn- late-done
95
+ "PreDone on an exit that left before it. What the hook throws leaves
96
+ cleaned, in place of the error already on its way out."
97
+ [ctx]
98
+ (try
99
+ (core/feature-hook ctx "PreDone")
100
+ (catch Throwable hookerr
101
+ (let [cleaned (core/clean-throwable ctx hookerr)]
102
+ (when-not (= false (core/oget (core/oget ctx :ctrl) :throw))
103
+ (throw cleaned))))))
104
+
94
105
  (defn- run-op [ctx post-done]
106
+ (let [predone (volatile! false)]
95
107
  (try
96
108
  ; #PrePoint-Hook
97
109
  (let [[point err] ((core/uget ctx :make-point) ctx)]
@@ -123,11 +135,16 @@
123
135
  (if err
124
136
  ((core/uget ctx :make-error) ctx err)
125
137
  (do
138
+ (vreset! predone true)
126
139
  ; #PreDone-Hook
127
140
  (post-done)
128
141
  ((core/uget ctx :done) ctx))))))))))))))))
129
142
  (catch Throwable operr
130
- (unexpected ctx operr))))
143
+ (unexpected ctx operr))
144
+ ;; A refusal, a failed step or a throw left before PreDone.
145
+ (finally
146
+ (when-not @predone
147
+ (late-done ctx))))))
131
148
 
132
149
  ;; Streaming operation. Runs `action` (an op name, e.g. "list") through the
133
150
  ;; full pipeline and returns a LAZY SEQUENCE of result items, so incremental
@@ -894,7 +894,8 @@ static void a_feature_name_is_read_as_a_name() {
894
894
  {"apikey", Value(CANARY_APIKEY)},
895
895
  {"feature", vmap({
896
896
  {"secrets", vmap({
897
- {"active", Value(false)}, {"name", Value("ZZNAME-feat123")}, {"token", Value("ZZTOKEN-feat456")},
897
+ {"active", Value(false)}, {"name", Value("ZZNAME-feat123")},
898
+ {"providers", vlist({vmap({{"name", Value("static")}, {"token", Value("ZZTOKEN-feat456")}})})},
898
899
  })},
899
900
  {"rbac", vmap({
900
901
  {"active", Value(false)}, {"rules", vmap({{"zztoken.load", Value("PLAINRULE-k7j5h3g1")}})},
@@ -124,14 +124,41 @@ public abstract class ProjectNameEntityBase : IEntity
124
124
 
125
125
  protected object? RunOp(Context ctx, Action postDone)
126
126
  {
127
+ var predone = false;
127
128
  try
128
129
  {
129
- return RunPipeline(ctx, postDone);
130
+ return RunPipeline(ctx, postDone, ref predone);
130
131
  }
131
132
  catch (Exception err) when (!ReferenceEquals(err, ctx.Ctrl.Err))
132
133
  {
133
134
  return Unexpected(ctx, err);
134
135
  }
136
+ finally
137
+ {
138
+ // A refusal, a failed step or a throw left before PreDone.
139
+ if (!predone)
140
+ {
141
+ LateDone(ctx);
142
+ }
143
+ }
144
+ }
145
+
146
+ // PreDone on an exit that left before it. What the hook throws leaves
147
+ // cleaned, in place of the error already on its way out.
148
+ private void LateDone(Context ctx)
149
+ {
150
+ try
151
+ {
152
+ utility.FeatureHook(ctx, "PreDone");
153
+ }
154
+ catch (Exception err) when (ctx.Ctrl.Throw != false)
155
+ {
156
+ var cause = Unwrapped(err);
157
+ throw utility.Clean(ctx, cause) as Exception ?? cause;
158
+ }
159
+ catch (Exception)
160
+ {
161
+ }
135
162
  }
136
163
 
137
164
  // The catch path. A hook's exception never passed through MakeError, and
@@ -154,7 +181,7 @@ public abstract class ProjectNameEntityBase : IEntity
154
181
  private static Exception Unwrapped(Exception err) =>
155
182
  err is TargetInvocationException { InnerException: { } inner } ? inner : err;
156
183
 
157
- private object? RunPipeline(Context ctx, Action postDone)
184
+ private object? RunPipeline(Context ctx, Action postDone, ref bool predone)
158
185
  {
159
186
  // #PrePoint-Hook
160
187
 
@@ -216,6 +243,7 @@ public abstract class ProjectNameEntityBase : IEntity
216
243
  return utility.MakeError(ctx, err);
217
244
  }
218
245
 
246
+ predone = true;
219
247
  // #PreDone-Hook
220
248
 
221
249
  postDone();
@@ -61,27 +61,46 @@ public class ProjectNameSDK
61
61
  var featureOrder = global::Voxgig.Struct.StructUtils.GetPath(_options,
62
62
  global::Voxgig.Struct.StructUtils.Jt("__derived__", "featureorder")) as List<object?>
63
63
  ?? new List<object?>();
64
+ bool Active(string fname)
65
+ {
66
+ var fopts = global::ProjectNameSdk.Helpers.ToMapAny(global::Voxgig.Struct.StructUtils.GetProp(featureOpts, fname));
67
+ return fopts != null && fopts.TryGetValue("active", out var active) && active is bool ab && ab;
68
+ }
69
+ var extend = (global::Voxgig.Struct.StructUtils.GetProp(_options, "extend") as List<object?>)
70
+ ?.OfType<BaseFeature>().ToList() ?? new List<BaseFeature>();
71
+ var placed = new List<BaseFeature>();
64
72
  foreach (var fnameObj in featureOrder)
65
73
  {
66
74
  var fname = fnameObj as string ?? "";
67
- var fopts = global::ProjectNameSdk.Helpers.ToMapAny(global::Voxgig.Struct.StructUtils.GetProp(featureOpts, fname));
68
- if (fopts != null &&
69
- fopts.TryGetValue("active", out var active) &&
70
- active is bool ab && ab)
75
+ if (!Active(fname))
71
76
  {
72
- _utility.FeatureAdd(_rootctx, global::ProjectNameSdk.SdkConfig.MakeFeature(fname));
77
+ continue;
73
78
  }
79
+ var gen = global::ProjectNameSdk.SdkConfig.MakeFeature(fname);
80
+ // An active name with no generated class is legal when an
81
+ // extend-supplied instance carries that name (station's adopt
82
+ // path): the instance takes the slot the order gives its name.
83
+ var carried = gen.GetName() == fname ? null : extend.FirstOrDefault(f => f.GetName() == fname);
84
+ if (carried != null)
85
+ {
86
+ placed.Add(carried);
87
+ _utility.FeatureAdd(_rootctx, carried);
88
+ continue;
89
+ }
90
+ _utility.FeatureAdd(_rootctx, gen);
74
91
  }
75
92
 
76
- // Add extension features.
77
- if (global::Voxgig.Struct.StructUtils.GetProp(_options, "extend") is List<object?> extList)
93
+ // An extend feature is active by its option, else by its own flag.
94
+ bool ExtActive(BaseFeature feat)
95
+ {
96
+ var fopts = global::ProjectNameSdk.Helpers.ToMapAny(global::Voxgig.Struct.StructUtils.GetProp(featureOpts, feat.GetName()));
97
+ return fopts != null && fopts.TryGetValue("active", out var fa) && fa is bool fab ? fab : feat.GetActive();
98
+ }
99
+ foreach (var feat in extend)
78
100
  {
79
- foreach (var f in extList)
101
+ if (!placed.Any(p => ReferenceEquals(p, feat)) && ExtActive(feat))
80
102
  {
81
- if (f is BaseFeature feat)
82
- {
83
- _utility.FeatureAdd(_rootctx, feat);
84
- }
103
+ _utility.FeatureAdd(_rootctx, feat);
85
104
  }
86
105
  }
87
106
 
@@ -713,7 +713,8 @@ ${candidates(Name, entity, model)}
713
713
  "apikey", @canary.apikey,
714
714
  "feature",
715
715
  S.jm([
716
- "secrets", S.jm(["active", false, "name", "ZZNAME-feat123", "token", "ZZTOKEN-feat456"]),
716
+ "secrets", S.jm(["active", false, "name", "ZZNAME-feat123",
717
+ "providers", [S.jm(["name", "static", "token", "ZZTOKEN-feat456"])]]),
717
718
  "rbac", S.jm(["active", false, "rules", S.jm(["zztoken.load", "PLAINRULE-k7j5h3g1"])]),
718
719
  "test", S.jm(["active", false, "entity", record])
719
720
  ]),
@@ -50,26 +50,62 @@ defmodule ProjectName do
50
50
  feature_opts = H.or_(H.to_map(S.getprop(opts, "feature")), S.jm([]))
51
51
  feature_order = S.getpath(opts, "__derived__.featureorder")
52
52
 
53
- if S.islist(feature_order) and S.size(feature_order) > 0 do
54
- Enum.each(0..(S.size(feature_order) - 1), fn i ->
55
- fname = S.getelem(feature_order, i)
56
- fom = H.to_map(S.getprop(feature_opts, fname))
57
-
58
- if fom != nil and S.getprop(fom, "active") == true do
59
- Utility.feature_add(rootctx, ProjectName.Features.make_feature(fname))
60
- end
61
- end)
53
+ active = fn fname ->
54
+ fom = H.to_map(S.getprop(feature_opts, fname))
55
+ fom != nil and S.getprop(fom, "active") == true
62
56
  end
63
57
 
64
- extend = S.getprop(opts, "extend")
58
+ given = S.getprop(opts, "extend")
59
+
60
+ extend =
61
+ if S.islist(given) and S.size(given) > 0,
62
+ do: Enum.filter(Enum.map(0..(S.size(given) - 1), &S.getelem(given, &1)), &S.ismap/1),
63
+ else: []
64
+
65
+ placed =
66
+ if S.islist(feature_order) and S.size(feature_order) > 0 do
67
+ Enum.flat_map(0..(S.size(feature_order) - 1), fn i ->
68
+ fname = S.getelem(feature_order, i)
69
+
70
+ if active.(fname) do
71
+ gen = ProjectName.Features.make_feature(fname)
72
+
73
+ # An active name with no generated class is legal when an
74
+ # extend-supplied instance carries that name (station's adopt
75
+ # path): the instance takes the slot the order gives its name.
76
+ carried =
77
+ if S.getprop(gen, "name") != fname,
78
+ do: Enum.find(extend, fn fx -> S.getprop(fx, "name") == fname end)
79
+
80
+ if carried != nil do
81
+ Utility.feature_add(rootctx, carried)
82
+ [carried]
83
+ else
84
+ Utility.feature_add(rootctx, gen)
85
+ []
86
+ end
87
+ else
88
+ []
89
+ end
90
+ end)
91
+ else
92
+ []
93
+ end
65
94
 
66
- if S.islist(extend) and S.size(extend) > 0 do
67
- Enum.each(0..(S.size(extend) - 1), fn i ->
68
- fx = S.getelem(extend, i)
69
- if S.ismap(fx), do: Utility.feature_add(rootctx, fx)
70
- end)
95
+ # An extend feature is active by its option, else by its own flag.
96
+ ext_active = fn fx ->
97
+ fom = H.to_map(S.getprop(feature_opts, S.getprop(fx, "name")))
98
+ fa = if fom != nil, do: S.getprop(fom, "active")
99
+
100
+ if is_boolean(fa), do: fa, else: S.getprop(fx, "active") == true
71
101
  end
72
102
 
103
+ Enum.each(extend, fn fx ->
104
+ unless Enum.any?(placed, &(&1 === fx)) or not ext_active.(fx) do
105
+ Utility.feature_add(rootctx, fx)
106
+ end
107
+ end)
108
+
73
109
  Enum.each(S.getprop(client, "features"), fn fe -> Utility.feature_init(rootctx, fe) end)
74
110
  Utility.feature_hook(rootctx, "PostConstruct")
75
111