@voxgig/sdkgen 4.34.1 → 4.34.2

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 (305) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/cmp/ReadmeErrors.js +3 -3
  3. package/dist/cmp/ReadmeErrors.js.map +1 -1
  4. package/dist/cmp/ReadmeExplanation.js +3 -3
  5. package/dist/cmp/ReadmeExplanation.js.map +1 -1
  6. package/dist/cmp/ReadmeQuick.js +3 -1
  7. package/dist/cmp/ReadmeQuick.js.map +1 -1
  8. package/dist/cmp/ReadmeTop.js +9 -8
  9. package/dist/cmp/ReadmeTop.js.map +1 -1
  10. package/dist/helpers/definitionPlan.js +8 -4
  11. package/dist/helpers/definitionPlan.js.map +1 -1
  12. package/dist/helpers/naming.d.ts +2 -1
  13. package/dist/helpers/naming.js +11 -4
  14. package/dist/helpers/naming.js.map +1 -1
  15. package/dist/helpers/opExample.d.ts +16 -2
  16. package/dist/helpers/opExample.js +80 -21
  17. package/dist/helpers/opExample.js.map +1 -1
  18. package/dist/helpers/opShape.d.ts +3 -1
  19. package/dist/helpers/opShape.js +21 -8
  20. package/dist/helpers/opShape.js.map +1 -1
  21. package/dist/sdkgen.d.ts +4 -4
  22. package/dist/sdkgen.js +12 -4
  23. package/dist/sdkgen.js.map +1 -1
  24. package/dist/tsconfig.tsbuildinfo +1 -1
  25. package/dist/utility.d.ts +2 -1
  26. package/dist/utility.js +29 -3
  27. package/dist/utility.js.map +1 -1
  28. package/package.json +2 -2
  29. package/project/.sdk/src/cmp/c/ReadmeEntity_c.ts +3 -2
  30. package/project/.sdk/src/cmp/c/ReadmeHowto_c.ts +7 -3
  31. package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +3 -2
  32. package/project/.sdk/src/cmp/c/ReadmeRef_c.ts +5 -4
  33. package/project/.sdk/src/cmp/c/ReadmeTopQuick_c.ts +3 -2
  34. package/project/.sdk/src/cmp/c/ReadmeTopTest_c.ts +8 -7
  35. package/project/.sdk/src/cmp/c/utility_c.ts +21 -2
  36. package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +4 -1
  37. package/project/.sdk/src/cmp/clojure/ReadmeHowto_clojure.ts +17 -6
  38. package/project/.sdk/src/cmp/clojure/ReadmeModel_clojure.ts +6 -6
  39. package/project/.sdk/src/cmp/clojure/ReadmeQuick_clojure.ts +13 -8
  40. package/project/.sdk/src/cmp/clojure/ReadmeRef_clojure.ts +21 -18
  41. package/project/.sdk/src/cmp/clojure/ReadmeTopQuick_clojure.ts +6 -3
  42. package/project/.sdk/src/cmp/clojure/ReadmeTopTest_clojure.ts +16 -9
  43. package/project/.sdk/src/cmp/clojure/TestClean_clojure.ts +4 -4
  44. package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +2 -1
  45. package/project/.sdk/src/cmp/clojure/utility_clojure.ts +14 -0
  46. package/project/.sdk/src/cmp/cpp/ReadmeEntity_cpp.ts +3 -2
  47. package/project/.sdk/src/cmp/cpp/ReadmeHowto_cpp.ts +7 -3
  48. package/project/.sdk/src/cmp/cpp/ReadmeQuick_cpp.ts +3 -2
  49. package/project/.sdk/src/cmp/cpp/ReadmeRef_cpp.ts +6 -5
  50. package/project/.sdk/src/cmp/cpp/ReadmeTopQuick_cpp.ts +3 -2
  51. package/project/.sdk/src/cmp/cpp/ReadmeTopTest_cpp.ts +8 -7
  52. package/project/.sdk/src/cmp/cpp/utility_cpp.ts +13 -0
  53. package/project/.sdk/src/cmp/csharp/ReadmeEntity_csharp.ts +3 -2
  54. package/project/.sdk/src/cmp/csharp/ReadmeHowto_csharp.ts +20 -8
  55. package/project/.sdk/src/cmp/csharp/ReadmeQuick_csharp.ts +13 -8
  56. package/project/.sdk/src/cmp/csharp/ReadmeRef_csharp.ts +10 -5
  57. package/project/.sdk/src/cmp/csharp/ReadmeTopQuick_csharp.ts +14 -7
  58. package/project/.sdk/src/cmp/csharp/ReadmeTopTest_csharp.ts +18 -10
  59. package/project/.sdk/src/cmp/csharp/utility_csharp.ts +13 -0
  60. package/project/.sdk/src/cmp/elixir/ReadmeEntity_elixir.ts +4 -4
  61. package/project/.sdk/src/cmp/elixir/ReadmeExplanation_elixir.ts +2 -1
  62. package/project/.sdk/src/cmp/elixir/ReadmeHowto_elixir.ts +13 -6
  63. package/project/.sdk/src/cmp/elixir/ReadmeModel_elixir.ts +5 -5
  64. package/project/.sdk/src/cmp/elixir/ReadmeQuick_elixir.ts +13 -10
  65. package/project/.sdk/src/cmp/elixir/ReadmeRef_elixir.ts +11 -11
  66. package/project/.sdk/src/cmp/elixir/ReadmeTopQuick_elixir.ts +8 -6
  67. package/project/.sdk/src/cmp/elixir/ReadmeTopTest_elixir.ts +14 -10
  68. package/project/.sdk/src/cmp/elixir/fragment/EntityCreateOp.fragment.ex +4 -3
  69. package/project/.sdk/src/cmp/elixir/fragment/EntityListOp.fragment.ex +4 -3
  70. package/project/.sdk/src/cmp/elixir/fragment/EntityLoadOp.fragment.ex +4 -3
  71. package/project/.sdk/src/cmp/elixir/fragment/EntityPatchOp.fragment.ex +4 -3
  72. package/project/.sdk/src/cmp/elixir/fragment/EntityRemoveOp.fragment.ex +4 -3
  73. package/project/.sdk/src/cmp/elixir/fragment/EntityUpdateOp.fragment.ex +4 -3
  74. package/project/.sdk/src/cmp/elixir/utility_elixir.ts +12 -0
  75. package/project/.sdk/src/cmp/go/ReadmeEntity_go.ts +8 -5
  76. package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +3 -1
  77. package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +20 -8
  78. package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +16 -13
  79. package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +14 -13
  80. package/project/.sdk/src/cmp/go/ReadmeRef_go.ts +14 -13
  81. package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +10 -8
  82. package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +6 -2
  83. package/project/.sdk/src/cmp/go/utility_go.ts +1 -1
  84. package/project/.sdk/src/cmp/java/ReadmeEntity_java.ts +8 -19
  85. package/project/.sdk/src/cmp/java/ReadmeHowto_java.ts +19 -22
  86. package/project/.sdk/src/cmp/java/ReadmeModel_java.ts +10 -9
  87. package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +24 -28
  88. package/project/.sdk/src/cmp/java/ReadmeRef_java.ts +27 -35
  89. package/project/.sdk/src/cmp/java/ReadmeTopQuick_java.ts +22 -25
  90. package/project/.sdk/src/cmp/java/ReadmeTopTest_java.ts +18 -24
  91. package/project/.sdk/src/cmp/java/utility_java.ts +25 -0
  92. package/project/.sdk/src/cmp/js/EntityOperation_js.ts +3 -1
  93. package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +2 -8
  94. package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +11 -9
  95. package/project/.sdk/src/cmp/js/ReadmeModel_js.ts +9 -9
  96. package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +7 -13
  97. package/project/.sdk/src/cmp/js/ReadmeRef_js.ts +14 -15
  98. package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +16 -11
  99. package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +11 -7
  100. package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +1 -1
  101. package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +1 -1
  102. package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +1 -1
  103. package/project/.sdk/src/cmp/js/fragment/EntityPatchOp.fragment.js +1 -1
  104. package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +1 -1
  105. package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +1 -1
  106. package/project/.sdk/src/cmp/js/utility_js.ts +2 -1
  107. package/project/.sdk/src/cmp/kotlin/ReadmeEntity_kotlin.ts +3 -2
  108. package/project/.sdk/src/cmp/kotlin/ReadmeHowto_kotlin.ts +19 -9
  109. package/project/.sdk/src/cmp/kotlin/ReadmeModel_kotlin.ts +10 -9
  110. package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +14 -9
  111. package/project/.sdk/src/cmp/kotlin/ReadmeRef_kotlin.ts +18 -15
  112. package/project/.sdk/src/cmp/kotlin/ReadmeTopQuick_kotlin.ts +14 -8
  113. package/project/.sdk/src/cmp/kotlin/ReadmeTopTest_kotlin.ts +17 -10
  114. package/project/.sdk/src/cmp/kotlin/utility_kotlin.ts +21 -1
  115. package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +3 -2
  116. package/project/.sdk/src/cmp/lua/ReadmeExamplesTest_lua.ts +7 -4
  117. package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +9 -7
  118. package/project/.sdk/src/cmp/lua/ReadmeModel_lua.ts +13 -13
  119. package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +20 -9
  120. package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +9 -8
  121. package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +15 -7
  122. package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +6 -5
  123. package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +1 -0
  124. package/project/.sdk/src/cmp/lua/fragment/EntityCreateOp.fragment.lua +1 -1
  125. package/project/.sdk/src/cmp/lua/fragment/EntityListOp.fragment.lua +1 -1
  126. package/project/.sdk/src/cmp/lua/fragment/EntityLoadOp.fragment.lua +1 -1
  127. package/project/.sdk/src/cmp/lua/fragment/EntityPatchOp.fragment.lua +1 -1
  128. package/project/.sdk/src/cmp/lua/fragment/EntityRemoveOp.fragment.lua +1 -1
  129. package/project/.sdk/src/cmp/lua/fragment/EntityUpdateOp.fragment.lua +1 -1
  130. package/project/.sdk/src/cmp/ocaml/ReadmeEntity_ocaml.ts +3 -2
  131. package/project/.sdk/src/cmp/ocaml/ReadmeHowto_ocaml.ts +3 -2
  132. package/project/.sdk/src/cmp/ocaml/ReadmeModel_ocaml.ts +1 -0
  133. package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +5 -3
  134. package/project/.sdk/src/cmp/ocaml/ReadmeRef_ocaml.ts +10 -8
  135. package/project/.sdk/src/cmp/ocaml/ReadmeTopQuick_ocaml.ts +4 -2
  136. package/project/.sdk/src/cmp/ocaml/ReadmeTopTest_ocaml.ts +3 -2
  137. package/project/.sdk/src/cmp/ocaml/utility_ocaml.ts +13 -1
  138. package/project/.sdk/src/cmp/perl/ReadmeEntity_perl.ts +4 -1
  139. package/project/.sdk/src/cmp/perl/ReadmeHowto_perl.ts +10 -5
  140. package/project/.sdk/src/cmp/perl/ReadmeModel_perl.ts +6 -6
  141. package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +8 -5
  142. package/project/.sdk/src/cmp/perl/ReadmeRef_perl.ts +21 -18
  143. package/project/.sdk/src/cmp/perl/ReadmeTopQuick_perl.ts +6 -3
  144. package/project/.sdk/src/cmp/perl/ReadmeTopTest_perl.ts +11 -8
  145. package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +1 -1
  146. package/project/.sdk/src/cmp/perl/fragment/EntityCreateOp.fragment.pm +2 -2
  147. package/project/.sdk/src/cmp/perl/fragment/EntityLoadOp.fragment.pm +2 -2
  148. package/project/.sdk/src/cmp/perl/fragment/EntityPatchOp.fragment.pm +2 -2
  149. package/project/.sdk/src/cmp/perl/fragment/EntityRemoveOp.fragment.pm +1 -1
  150. package/project/.sdk/src/cmp/perl/fragment/EntityUpdateOp.fragment.pm +2 -2
  151. package/project/.sdk/src/cmp/perl/utility_perl.ts +11 -1
  152. package/project/.sdk/src/cmp/php/EntityOperation_php.ts +3 -1
  153. package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +4 -3
  154. package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +12 -6
  155. package/project/.sdk/src/cmp/php/ReadmeModel_php.ts +9 -9
  156. package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +3 -2
  157. package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +15 -14
  158. package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +5 -4
  159. package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +13 -7
  160. package/project/.sdk/src/cmp/php/fragment/EntityCreateOp.fragment.php +2 -2
  161. package/project/.sdk/src/cmp/php/fragment/EntityListOp.fragment.php +2 -2
  162. package/project/.sdk/src/cmp/php/fragment/EntityLoadOp.fragment.php +2 -2
  163. package/project/.sdk/src/cmp/php/fragment/EntityPatchOp.fragment.php +2 -2
  164. package/project/.sdk/src/cmp/php/fragment/EntityRemoveOp.fragment.php +2 -2
  165. package/project/.sdk/src/cmp/php/fragment/EntityUpdateOp.fragment.php +2 -2
  166. package/project/.sdk/src/cmp/py/EntityOperation_py.ts +3 -1
  167. package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +3 -8
  168. package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +9 -9
  169. package/project/.sdk/src/cmp/py/ReadmeModel_py.ts +9 -9
  170. package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +9 -14
  171. package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +23 -30
  172. package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +7 -12
  173. package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +8 -7
  174. package/project/.sdk/src/cmp/py/fragment/EntityCreateOp.fragment.py +1 -1
  175. package/project/.sdk/src/cmp/py/fragment/EntityListOp.fragment.py +1 -1
  176. package/project/.sdk/src/cmp/py/fragment/EntityLoadOp.fragment.py +1 -1
  177. package/project/.sdk/src/cmp/py/fragment/EntityPatchOp.fragment.py +1 -1
  178. package/project/.sdk/src/cmp/py/fragment/EntityRemoveOp.fragment.py +1 -1
  179. package/project/.sdk/src/cmp/py/fragment/EntityUpdateOp.fragment.py +1 -1
  180. package/project/.sdk/src/cmp/rb/EntityOperation_rb.ts +3 -1
  181. package/project/.sdk/src/cmp/rb/EntityTypes_rb.ts +2 -1
  182. package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +4 -1
  183. package/project/.sdk/src/cmp/rb/ReadmeExamplesTest_rb.ts +3 -2
  184. package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +20 -10
  185. package/project/.sdk/src/cmp/rb/ReadmeModel_rb.ts +10 -9
  186. package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +6 -3
  187. package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +14 -11
  188. package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +6 -3
  189. package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +14 -10
  190. package/project/.sdk/src/cmp/rb/fragment/EntityCreateOp.fragment.rb +2 -1
  191. package/project/.sdk/src/cmp/rb/fragment/EntityListOp.fragment.rb +1 -1
  192. package/project/.sdk/src/cmp/rb/fragment/EntityLoadOp.fragment.rb +2 -1
  193. package/project/.sdk/src/cmp/rb/fragment/EntityPatchOp.fragment.rb +2 -1
  194. package/project/.sdk/src/cmp/rb/fragment/EntityRemoveOp.fragment.rb +2 -1
  195. package/project/.sdk/src/cmp/rb/fragment/EntityUpdateOp.fragment.rb +2 -1
  196. package/project/.sdk/src/cmp/rb/utility_rb.ts +10 -0
  197. package/project/.sdk/src/cmp/rust/ReadmeEntity_rust.ts +3 -2
  198. package/project/.sdk/src/cmp/rust/ReadmeHowto_rust.ts +6 -2
  199. package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +3 -2
  200. package/project/.sdk/src/cmp/rust/ReadmeRef_rust.ts +5 -4
  201. package/project/.sdk/src/cmp/rust/ReadmeTopQuick_rust.ts +3 -2
  202. package/project/.sdk/src/cmp/rust/ReadmeTopTest_rust.ts +7 -6
  203. package/project/.sdk/src/cmp/rust/utility_rust.ts +13 -1
  204. package/project/.sdk/src/cmp/scala/EntityTypes_scala.ts +5 -2
  205. package/project/.sdk/src/cmp/scala/ReadmeEntity_scala.ts +8 -19
  206. package/project/.sdk/src/cmp/scala/ReadmeHowto_scala.ts +17 -22
  207. package/project/.sdk/src/cmp/scala/ReadmeModel_scala.ts +10 -9
  208. package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +18 -28
  209. package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +25 -35
  210. package/project/.sdk/src/cmp/scala/ReadmeTopQuick_scala.ts +14 -25
  211. package/project/.sdk/src/cmp/scala/ReadmeTopTest_scala.ts +16 -24
  212. package/project/.sdk/src/cmp/scala/utility_scala.ts +25 -0
  213. package/project/.sdk/src/cmp/swift/EntityTypes_swift.ts +1 -1
  214. package/project/.sdk/src/cmp/swift/ReadmeEntity_swift.ts +3 -2
  215. package/project/.sdk/src/cmp/swift/ReadmeHowto_swift.ts +22 -8
  216. package/project/.sdk/src/cmp/swift/ReadmeModel_swift.ts +10 -9
  217. package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +16 -8
  218. package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +20 -15
  219. package/project/.sdk/src/cmp/swift/ReadmeTopQuick_swift.ts +12 -7
  220. package/project/.sdk/src/cmp/swift/ReadmeTopTest_swift.ts +21 -10
  221. package/project/.sdk/src/cmp/swift/utility_swift.ts +14 -1
  222. package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +2 -8
  223. package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +11 -9
  224. package/project/.sdk/src/cmp/ts/ReadmeModel_ts.ts +9 -9
  225. package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +7 -13
  226. package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +14 -23
  227. package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +8 -14
  228. package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +29 -14
  229. package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +1 -1
  230. package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +1 -1
  231. package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +1 -1
  232. package/project/.sdk/src/cmp/ts/fragment/EntityPatchOp.fragment.ts +1 -1
  233. package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +1 -1
  234. package/project/.sdk/src/cmp/ts/utility_ts.ts +2 -1
  235. package/project/.sdk/src/cmp/zig/ReadmeEntity_zig.ts +3 -2
  236. package/project/.sdk/src/cmp/zig/ReadmeHowto_zig.ts +6 -2
  237. package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +4 -3
  238. package/project/.sdk/src/cmp/zig/ReadmeRef_zig.ts +5 -4
  239. package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +3 -2
  240. package/project/.sdk/src/cmp/zig/ReadmeTopTest_zig.ts +7 -6
  241. package/project/.sdk/src/cmp/zig/utility_zig.ts +13 -0
  242. package/project/.sdk/tm/c/utility/transform_request.c +1 -1
  243. package/project/.sdk/tm/clojure/src/sdk/core.clj +32 -26
  244. package/project/.sdk/tm/clojure/test/sdk/test/concurrency.clj +136 -0
  245. package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +3 -1
  246. package/project/.sdk/tm/cpp/core/types.hpp +36 -6
  247. package/project/.sdk/tm/cpp/test/concurrency_test.cpp +348 -0
  248. package/project/.sdk/tm/cpp/utility/pipeline.hpp +42 -25
  249. package/project/.sdk/tm/csharp/core/Context.cs +8 -5
  250. package/project/.sdk/tm/csharp/test/ConcurrencyTest.cs +238 -0
  251. package/project/.sdk/tm/csharp/utility/Clean.cs +12 -10
  252. package/project/.sdk/tm/csharp/utility/TransformRequest.cs +1 -1
  253. package/project/.sdk/tm/elixir/lib/projectname/context.ex +3 -0
  254. package/project/.sdk/tm/elixir/lib/projectname/entity_base.ex +2 -1
  255. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +31 -10
  256. package/project/.sdk/tm/elixir/test/concurrency_test.exs +176 -0
  257. package/project/.sdk/tm/go/core/context.go +5 -1
  258. package/project/.sdk/tm/go/test/concurrency_test.go +214 -0
  259. package/project/.sdk/tm/go/utility/transform_request.go +1 -1
  260. package/project/.sdk/tm/java/core/Context.java +6 -3
  261. package/project/.sdk/tm/java/test/ConcurrencyTest.java +221 -0
  262. package/project/.sdk/tm/java/utility/Clean.java +22 -17
  263. package/project/.sdk/tm/java/utility/TransformRequest.java +1 -1
  264. package/project/.sdk/tm/js/src/utility/TransformRequestUtility.js +1 -1
  265. package/project/.sdk/tm/kotlin/core/Context.kt +5 -3
  266. package/project/.sdk/tm/kotlin/test/ConcurrencyTest.kt +193 -0
  267. package/project/.sdk/tm/kotlin/utility/ResultTransform.kt +1 -1
  268. package/project/.sdk/tm/lua/utility/transform_request.lua +1 -1
  269. package/project/.sdk/tm/ocaml/Makefile +21 -8
  270. package/project/.sdk/tm/ocaml/sdk_runtime.ml +27 -12
  271. package/project/.sdk/tm/ocaml/sdk_types.ml +6 -2
  272. package/project/.sdk/tm/ocaml/test/concurrency_test.ml +148 -0
  273. package/project/.sdk/tm/perl/utility/transform_request.pm +1 -1
  274. package/project/.sdk/tm/php/feature/TestFeature.php +9 -9
  275. package/project/.sdk/tm/php/utility/TransformRequest.php +1 -1
  276. package/project/.sdk/tm/py/pkg/core/context.py +2 -2
  277. package/project/.sdk/tm/py/pkg/utility/clean.py +12 -8
  278. package/project/.sdk/tm/py/pkg/utility/transform_request.py +1 -1
  279. package/project/.sdk/tm/py/test/test_concurrency.py +177 -0
  280. package/project/.sdk/tm/rb/core/context.rb +8 -3
  281. package/project/.sdk/tm/rb/test/concurrency_test.rb +160 -0
  282. package/project/.sdk/tm/rb/utility/clean.rb +8 -7
  283. package/project/.sdk/tm/rb/utility/transform_request.rb +1 -1
  284. package/project/.sdk/tm/rust/utility/transform_request.rs +1 -1
  285. package/project/.sdk/tm/scala/Makefile +2 -0
  286. package/project/.sdk/tm/scala/core/Context.scala +6 -4
  287. package/project/.sdk/tm/scala/sdktest/ConcurrencyTest.scala +186 -0
  288. package/project/.sdk/tm/scala/utility/Transform.scala +1 -1
  289. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +2 -0
  290. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +35 -12
  291. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/ConcurrencyTest.swift +214 -0
  292. package/project/.sdk/tm/ts/src/utility/TransformRequestUtility.ts +1 -1
  293. package/project/.sdk/tm/zig/core/utility.zig +1 -1
  294. package/project/.sdk/tm/zig/feature/test.zig +10 -8
  295. package/project/sdkgen-package.json +1 -1
  296. package/src/cmp/ReadmeErrors.ts +5 -5
  297. package/src/cmp/ReadmeExplanation.ts +4 -5
  298. package/src/cmp/ReadmeQuick.ts +3 -1
  299. package/src/cmp/ReadmeTop.ts +10 -12
  300. package/src/helpers/definitionPlan.ts +8 -4
  301. package/src/helpers/naming.ts +12 -4
  302. package/src/helpers/opExample.ts +97 -25
  303. package/src/helpers/opShape.ts +25 -9
  304. package/src/sdkgen.ts +14 -3
  305. package/src/utility.ts +31 -4
@@ -1,17 +1,18 @@
1
1
 
2
- import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, requiredItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
6
6
  getModelPath,
7
7
  } from '@voxgig/apidef'
8
8
 
9
- import { kotlinVarName } from './utility_kotlin'
9
+ import { kotlinVarName, kotlinString } from './utility_kotlin'
10
10
 
11
11
 
12
12
  // A type-correct Kotlin literal for a field's canonical type.
13
13
  function kotlinLit(type: any): string {
14
14
  const k = canonScalarKey(type)
15
+ if ('NULL' === k) return 'null'
15
16
  if ('INTEGER' === k) return '1L'
16
17
  if ('NUMBER' === k) return '1.0'
17
18
  if ('BOOLEAN' === k) return 'true'
@@ -40,16 +41,16 @@ val client = ${SDK}.testSDK(null, null)
40
41
  const idF = entityIdField(exampleEntity)
41
42
  const isMatchOp = 'load' === primaryOp || 'remove' === primaryOp
42
43
  let arg = 'null'
43
- if (isMatchOp) {
44
+ if (isMatchOp || ('list' === primaryOp && 0 < requiredItems(exampleEntity, 'list').length)) {
44
45
  // Every REQUIRED match key (id first) — the same shape that generates
45
46
  // the op's request type, so the block stays honest.
46
- const items = opRequestShape(exampleEntity, primaryOp).items
47
- .filter((it: any) => !it.optional || it.name === idF)
47
+ const items = (isMatchOp ? opRequestShape(exampleEntity, primaryOp).items
48
+ .filter((it: any) => !it.optional || it.name === idF) : requiredItems(exampleEntity, 'list'))
48
49
  .sort((a: any, b: any) =>
49
50
  (a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
50
51
  arg = 0 < items.length
51
52
  ? `mutableMapOf<String, Any?>(${items.map((it: any) =>
52
- `"${it.name}" to ${it.name === idF ? '"test01"' : kotlinLit(it.type)}`).join(', ')})`
53
+ `${kotlinString(it.name)} to ${isMatchOp && it.name === idF ? '"test01"' : kotlinLit(it.type)}`).join(', ')})`
53
54
  : 'null'
54
55
  } else if ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp) {
55
56
  const items = opRequestShape(exampleEntity, primaryOp).items
@@ -57,12 +58,18 @@ val client = ${SDK}.testSDK(null, null)
57
58
  const required = items.filter((it: any) => !it.optional)
58
59
  const chosen = required.length ? required : items.slice(0, 3)
59
60
  arg = `mutableMapOf<String, Any?>(${chosen.map((it: any) =>
60
- `"${it.name}" to ${kotlinLit(it.type)}`).join(', ')})`
61
+ `${kotlinString(it.name)} to ${kotlinLit(it.type)}`).join(', ')})`
61
62
  }
62
- const eVar = kotlinVarName(exampleEntity.name) + ('list' === primaryOp ? 'List' : '')
63
+ const eVar = kotlinVarName(exampleEntity.name)
63
64
  const accessor = kotlinVarName(exampleEntity.name)
64
- Content(`val ${eVar} = client.${accessor}(null).${primaryOp}(${arg}, null)
65
- println(${eVar})
65
+ Content('list' === primaryOp
66
+ ? `val ${eVar}List = client.${accessor}(null).list(${arg}, null) as List<*>
67
+ for (${eVar}Item in ${eVar}List) {
68
+ println((${eVar}Item as SdkEntity).data())
69
+ }
70
+ `
71
+ : `val ${eVar} = client.${accessor}(null).${primaryOp}(${arg}, null) as SdkEntity
72
+ println(${eVar}.data())
66
73
  `)
67
74
  }
68
75
 
@@ -4,6 +4,8 @@ import * as Path from 'node:path'
4
4
 
5
5
  import {
6
6
  camelify,
7
+ canonScalarKey,
8
+ requiredItems,
7
9
  } from '@voxgig/sdkgen'
8
10
 
9
11
  import {
@@ -102,14 +104,32 @@ function jsonAppendLines(value: any, bufname: string): string {
102
104
  return json
103
105
  .split('\n')
104
106
  .map((line) => {
105
- const lit = JSON.stringify(line).replace(/\$/g, '\\$')
107
+ const lit = kotlinString(line)
106
108
  return ` ${bufname}.append(${lit})\n`
107
109
  })
108
110
  .join('')
109
111
  }
110
112
 
113
+ // A list's required route and query parameters, as the match it is called with.
114
+ // A Kotlin string literal, whose `$` would start a template.
115
+ function kotlinString(s: string): string {
116
+ return JSON.stringify(s).replace(/\$/g, '\\$')
117
+ }
118
+
119
+
120
+ function kotlinListMatch(entity: any): string {
121
+ const lit = (type: any): string =>
122
+ (({ NULL: 'null', INTEGER: '1L', NUMBER: '1.0', BOOLEAN: 'true', ARRAY: 'listOf<Any?>()', OBJECT: 'mapOf<String, Any?>()' }) as any)[canonScalarKey(type)] ?? '"example"'
123
+ const items = requiredItems(entity, 'list')
124
+ return 0 < items.length
125
+ ? `mutableMapOf<String, Any?>(${items.map((it: any) => `${kotlinString(it.name)} to ${lit(it.type)}`).join(', ')})`
126
+ : 'null'
127
+ }
128
+
111
129
 
112
130
  export {
131
+ kotlinString,
132
+ kotlinListMatch,
113
133
  cleanModel,
114
134
  gradleGroup,
115
135
  kotlinPackage,
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, opRequestShape, safeVarName, exampleVarName, luaKey, opNeedsAction } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, opRequestShape, safeVarName, exampleVarName, luaKey, opNeedsAction, listMatchArg } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -13,6 +13,7 @@ import {
13
13
  // parse).
14
14
  function luaLit(type: any, placeholder: string = 'example'): string {
15
15
  const k = canonScalarKey(type)
16
+ if ('NULL' === k) return 'nil'
16
17
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
17
18
  if ('BOOLEAN' === k) return 'true'
18
19
  if ('ARRAY' === k || 'OBJECT' === k) return '{}'
@@ -133,7 +134,7 @@ local ${eVar}, err = client:${entity.Name}():load(${loadArg})
133
134
  Content(`#### Example: List
134
135
 
135
136
  \`\`\`lua
136
- local ${eVar}s, err = client:${entity.Name}():list()
137
+ local ${eVar}s, err = client:${entity.Name}():list(${listMatchArg('lua', entity)})
137
138
  \`\`\`
138
139
 
139
140
  `)
@@ -35,7 +35,8 @@ const ReadmeExamplesTest = cmp(function ReadmeExamplesTest(props: any) {
35
35
  -- network). Each client constructor is rewritten to the seeded
36
36
  -- test-mode form, and fragments that only use \`client\` get a seeded
37
37
  -- test client injected. A call to a method that does not exist raises
38
- -- "call a nil value" and FAILS the test. A seeded-fixture miss surfaces
38
+ -- "call a nil value" and FAILS the test, as does an SDK module that
39
+ -- does not load. A seeded-fixture miss surfaces
39
40
  -- as a tolerated (nil, err) not-found domain error, not a raised error.
40
41
  -- 3. Completeness: total == executed + illustration per doc. A block that
41
42
  -- is neither runnable nor an explicit comment-only placeholder FAILS
@@ -219,12 +220,14 @@ for _, doc in ipairs(DOCS) do
219
220
  if not ok then
220
221
  local msg = tostring(e)
221
222
  -- A nil accessor / missing method / bad index is a real doc bug:
222
- -- the documented call does not exist.
223
+ -- the documented call does not exist. A module that does not
224
+ -- load is an SDK that does not load.
223
225
  if msg:find("nil value") or msg:find("attempt to call")
224
- or msg:find("attempt to index") then
226
+ or msg:find("attempt to index") or msg:find("error loading module")
227
+ or msg:find("module '[^']*' not found") then
225
228
  assert.is_true(false,
226
229
  doc.label .. " runnable block #" .. i .. " hit a runtime " ..
227
- "error (missing method / nil call): " .. msg ..
230
+ "error (missing method / nil call / module load): " .. msg ..
228
231
  "\\n----\\n" .. src .. "\\n----")
229
232
  end
230
233
  -- Other runtime errors (a seeded-fixture miss surfaces as a
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, luaKey } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, luaKey, requiredItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -11,6 +11,7 @@ import {
11
11
  // A type-correct Lua literal for a field's canonical type.
12
12
  function luaLit(type: any): string {
13
13
  const k = canonScalarKey(type)
14
+ if ('NULL' === k) return 'nil'
14
15
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
15
16
  if ('BOOLEAN' === k) return 'true'
16
17
  if ('ARRAY' === k || 'OBJECT' === k) return '{}'
@@ -31,12 +32,12 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
31
32
  const idF = exampleEntity ? entityIdField(exampleEntity) : null
32
33
  const isMatchOp = 'load' === primaryOp || 'remove' === primaryOp
33
34
  let testCallArg = ''
34
- if (exampleEntity && isMatchOp) {
35
- const items = opRequestShape(exampleEntity, primaryOp).items
36
- .filter((it: any) => !it.optional || it.name === idF)
35
+ if (exampleEntity && (isMatchOp || ('list' === primaryOp && 0 < requiredItems(exampleEntity, 'list').length))) {
36
+ const items = (isMatchOp ? opRequestShape(exampleEntity, primaryOp).items
37
+ .filter((it: any) => !it.optional || it.name === idF) : requiredItems(exampleEntity, 'list'))
37
38
  .sort((a: any, b: any) => (a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
38
39
  testCallArg = 0 < items.length
39
- ? `{ ${items.map((it: any) => `${luaKey(it.name)} = ${it.name === idF ? '"test01"' : luaLit(it.type)}`).join(', ')} }`
40
+ ? `{ ${items.map((it: any) => `${luaKey(it.name)} = ${isMatchOp && it.name === idF ? '"test01"' : luaLit(it.type)}`).join(', ')} }`
40
41
  : ''
41
42
  } else if (exampleEntity && ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp)) {
42
43
  const items = opRequestShape(exampleEntity, primaryOp).items
@@ -50,9 +51,10 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
50
51
  // A direct()-only SDK (no ops anywhere) shows a direct() call instead.
51
52
  const testModeExample = primaryOp
52
53
  ? `local result, err = client:${eName}():${primaryOp}(${testCallArg})
53
- -- result is the returned data; err is set on failure`
54
+ -- ${'list' === primaryOp ? 'result is an array of entities, one per mock record'
55
+ : 'result is the entity; data_get() reads its mock record'}; err is set on failure`
54
56
  : `local result, err = client:direct({ path = "/api/resource", method = "GET" })
55
- -- result is the returned data; err is set on failure`
57
+ -- result holds ok, status, headers and data; err is set on failure`
56
58
 
57
59
  const apikeyEnvLine = isAuthActive(model)
58
60
  ? `\n${envName(model)}_APIKEY=<your-key>`
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, isAuthActive, entityIdField } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, isAuthActive, entityIdField, listMatchArg } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -17,12 +17,12 @@ const ReadmeModel = cmp(function ReadmeModel(props: any) {
17
17
  entityList.forEach((e: any) => Object.keys(e.op || {})
18
18
  .forEach((o: string) => { if (e.op[o] && e.op[o].active !== false) opUnion.add(o) }))
19
19
  const opRowDefs: Record<string, string> = {
20
- load: '| `load` | `(reqmatch, ctrl) -> any, err` | Load a single entity by match criteria. |',
21
- list: '| `list` | `(reqmatch, ctrl) -> any, err` | List entities matching the criteria. |',
22
- create: '| `create` | `(reqdata, ctrl) -> any, err` | Create a new entity. |',
23
- update: '| `update` | `(reqdata, ctrl) -> any, err` | Update an existing entity. |',
24
- patch: '| `patch` | `(reqdata, ctrl) -> any, err` | Change part of an existing entity. |',
25
- remove: '| `remove` | `(reqmatch, ctrl) -> any, err` | Remove an entity. |',
20
+ load: '| `load` | `(reqmatch, ctrl) -> any, err` | Load a single entity by match criteria, and return it. |',
21
+ list: '| `list` | `(reqmatch, ctrl) -> any, err` | List entities matching the criteria, one per record. |',
22
+ create: '| `create` | `(reqdata, ctrl) -> any, err` | Create a new entity, and return it. |',
23
+ update: '| `update` | `(reqdata, ctrl) -> any, err` | Update an existing entity, and return it. |',
24
+ patch: '| `patch` | `(reqdata, ctrl) -> any, err` | Change part of an existing entity, and return it. |',
25
+ remove: '| `remove` | `(reqmatch, ctrl) -> any, err` | Remove an entity, and return it marked as deleted. |',
26
26
  }
27
27
  const opRows = ['load', 'list', 'create', 'update', 'patch', 'remove']
28
28
  .filter((o) => opUnion.has(o)).map((o) => opRowDefs[o]).join('\n')
@@ -30,8 +30,8 @@ const ReadmeModel = cmp(function ReadmeModel(props: any) {
30
30
  const recordOps = ['load', 'create', 'update', 'patch', 'remove'].filter((o) => opUnion.has(o))
31
31
  .map((o) => '`' + o + '`')
32
32
  const resultRows: string[] = []
33
- if (recordOps.length) resultRows.push('| ' + recordOps.join(' / ') + ' | the entity record (a `table`) |')
34
- if (opUnion.has('list')) resultRows.push('| `list` | an array (`table`) of entity records |')
33
+ if (recordOps.length) resultRows.push('| ' + recordOps.join(' / ') + ' | the entity, whose `data_get()` reads its record (a `table`) |')
34
+ if (opUnion.has('list')) resultRows.push('| `list` | an array (`table`) of entities, one per record |')
35
35
  const resultShapeRows = resultRows.join('\n')
36
36
 
37
37
  // The Result-shape illustration calls `load`, so the example entity must
@@ -109,8 +109,8 @@ ${opRows}
109
109
 
110
110
  ### Result shape
111
111
 
112
- Entity operations return \`(value, err)\`. The \`value\` is the operation's
113
- data **directly** — there is no wrapper:
112
+ Entity operations return \`(value, err)\`. The \`value\` is the entity
113
+ itself — there is no wrapper:
114
114
 
115
115
  | Operation | \`value\` |
116
116
  | --- | --- |
@@ -119,9 +119,9 @@ ${resultShapeRows}
119
119
  Check \`err\` first (it is non-\`nil\` on failure), then use \`value\`:
120
120
 
121
121
  local ${eLower}, err = client:${eName}():${hasLoad ? 'load' : 'list'}(${
122
- hasLoad && idF ? `{ ${idF} = "example_id" }` : ''})
122
+ hasLoad ? (idF ? `{ ${idF} = "example_id" }` : '') : listMatchArg('lua', exEnt)})
123
123
  if err then error(err) end
124
- -- ${eLower} is the ${hasLoad ? 'loaded record' : 'record list'}
124
+ -- ${eLower} is ${hasLoad ? 'the loaded entity' : 'an array of entities, one per record'}
125
125
 
126
126
  Only \`direct()\` returns a response envelope — a \`table\` with \`ok\`,
127
127
  \`status\`, \`headers\`, and \`data\` keys.
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName, luaKey } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName, luaKey, listMatchArg } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -57,6 +57,7 @@ local client = ${ctor}
57
57
  // placeholder would not parse). Non-identifier keys use bracket syntax.
58
58
  const luaLit = (type: any, placeholder: string = 'example'): string => {
59
59
  const k = canonScalarKey(type)
60
+ if ('NULL' === k) return 'nil'
60
61
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
61
62
  if ('BOOLEAN' === k) return 'true'
62
63
  if ('ARRAY' === k || 'OBJECT' === k) return '{}'
@@ -77,19 +78,24 @@ local client = ${ctor}
77
78
  fields.find((f: any) => f && !idNames.has(f.n) && isStringField(f)) ||
78
79
  fields.find((f: any) => f && !idNames.has(f.n))
79
80
  const displayField = displayFieldObj ? displayFieldObj.name : null
80
- const idCol = dataIdF ? `item["${dataIdF}"]` : null
81
- const dispCol = displayField ? `item["${displayField}"]` : null
81
+ const idCol = dataIdF ? `rec["${dataIdF}"]` : null
82
+ const dispCol = displayField ? `rec["${displayField}"]` : null
82
83
  const printCols = [idCol, dispCol].filter(Boolean).join(', ')
83
- const printLine = printCols ? ` print(${printCols})` : ` print(item)`
84
+ // A record with neither column prints every field it holds.
85
+ const printRecord = (v: string, cols: string, pad: string): string => cols
86
+ ? `${pad}local rec = ${v}:data_get()\n${pad}print(${cols})`
87
+ : `${pad}for k, val in pairs(${v}:data_get()) do print(k, val) end`
88
+ const printLine = printRecord('item', printCols, ' ')
84
89
 
85
90
  if (opnames.includes('list')) {
86
91
  Content(`### 2. List ${eName.toLowerCase()} records
87
92
 
88
- Entity operations return \`(value, err)\`. For \`list\`, \`value\` is the
89
- array of records itself — iterate it directly (there is no wrapper).
93
+ Entity operations return \`(value, err)\`. For \`list\`, \`value\` is an
94
+ array of entities, one per record — iterate it directly (there is no
95
+ wrapper), and read each record with \`data_get()\`.
90
96
 
91
97
  \`\`\`lua
92
- local ${eVar}s, err = client:${eName}():list()
98
+ local ${eVar}s, err = client:${eName}():list(${listMatchArg('lua', exampleEntity)})
93
99
  if err then error(err) end
94
100
 
95
101
  for _, item in ipairs(${eVar}s) do
@@ -104,6 +110,7 @@ end
104
110
  const neName = nom(nestedEntity, 'Name')
105
111
  const neArticle = /^[aeiou]/i.test(neName) ? "an" : "a"
106
112
  const neVar = exampleVarName(neName.toLowerCase(), 'lua')
113
+ const neDataIdF = entityDataIdField(nestedEntity)
107
114
 
108
115
  const neIdF = entityIdField(nestedEntity)
109
116
  const neRequired = opRequestShape(nestedEntity, 'load').items
@@ -121,10 +128,12 @@ end
121
128
 
122
129
  ${neName} is nested under ${parentName}, so provide the \`${parentParam}\`.
123
130
 
131
+ \`load\` returns the entity; \`data_get()\` reads its record.
132
+
124
133
  \`\`\`lua
125
134
  local ${neVar}, err = client:${neName}():load({ ${neMatch.join(', ')} })
126
135
  if err then error(err) end
127
- print(${neVar})
136
+ ${printRecord(neVar, neDataIdF ? `rec["${neDataIdF}"]` : '', '')}
128
137
  \`\`\`
129
138
 
130
139
  `)
@@ -142,10 +151,12 @@ print(${neVar})
142
151
 
143
152
  Content(`### 3. Load ${article} ${eName.toLowerCase()}
144
153
 
154
+ \`load\` returns the entity; \`data_get()\` reads its record.
155
+
145
156
  \`\`\`lua
146
157
  local ${eVar}, err = client:${eName}():load(${loadArg})
147
158
  if err then error(err) end
148
- print(${eVar})
159
+ ${printRecord(eVar, printCols, '')}
149
160
  \`\`\`
150
161
 
151
162
  `)
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, canonKey, canonScalarKey, File, isAuthActive, entityIdField, opRequestShape, safeVarName, exampleVarName, luaKey , targetFeatures, opNeedsAction, bodyNote } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, canonKey, canonScalarKey, File, isAuthActive, entityIdField, opRequestShape, safeVarName, exampleVarName, luaKey, targetFeatures, opNeedsAction, bodyNote, listMatchArg } from '@voxgig/sdkgen'
3
3
  import { ReadmeRefFeatures } from '@voxgig/sdkgen'
4
4
 
5
5
  import {
@@ -14,6 +14,7 @@ import {
14
14
  // parse).
15
15
  function luaLit(type: any, placeholder: string = 'example'): string {
16
16
  const k = canonScalarKey(type)
17
+ if ('NULL' === k) return 'nil'
17
18
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
18
19
  if ('BOOLEAN' === k) return 'true'
19
20
  if ('ARRAY' === k || 'OBJECT' === k) return '{}'
@@ -27,32 +28,32 @@ const OP_SIGNATURES: Record<string, { sig: string, returns: string, desc: string
27
28
  load: {
28
29
  sig: 'load(reqmatch, ctrl) -> any, err',
29
30
  returns: 'any, err',
30
- desc: 'Load a single entity matching the given criteria.',
31
+ desc: 'Load a single entity matching the given criteria. Returns the entity, whose record `data_get()` reads, or `nil` and an error on failure.',
31
32
  },
32
33
  list: {
33
34
  sig: 'list(reqmatch, ctrl) -> any, err',
34
35
  returns: 'any, err',
35
- desc: 'List entities matching the given criteria. Returns an array.',
36
+ desc: 'List entities matching the given criteria. Returns an array of entities, one per record, or `nil` and an error on failure.',
36
37
  },
37
38
  create: {
38
39
  sig: 'create(reqdata, ctrl) -> any, err',
39
40
  returns: 'any, err',
40
- desc: 'Create a new entity with the given data.',
41
+ desc: 'Create a new entity with the given data. Returns the created entity, or `nil` and an error on failure.',
41
42
  },
42
43
  update: {
43
44
  sig: 'update(reqdata, ctrl) -> any, err',
44
45
  returns: 'any, err',
45
- desc: 'Update an existing entity. The data must include the entity `id`.',
46
+ desc: 'Update an existing entity. The data must include the entity `id`. Returns the updated entity, or `nil` and an error on failure.',
46
47
  },
47
48
  patch: {
48
49
  sig: 'patch(reqdata, ctrl) -> any, err',
49
50
  returns: 'any, err',
50
- desc: 'Change part of an existing entity: only the fields given are sent. The data must include the entity `id`.',
51
+ desc: 'Change part of an existing entity: only the fields given are sent. The data must include the entity `id`. Returns the patched entity, or `nil` and an error on failure.',
51
52
  },
52
53
  remove: {
53
54
  sig: 'remove(reqmatch, ctrl) -> any, err',
54
55
  returns: 'any, err',
55
- desc: 'Remove the entity matching the given criteria.',
56
+ desc: 'Remove the entity matching the given criteria. Returns the entity, marked as deleted, or `nil` and an error on failure.',
56
57
  },
57
58
  }
58
59
 
@@ -285,7 +286,7 @@ local result, err = client:${ent.Name}():${opname}(${arg})
285
286
  }
286
287
  else if ('list' === opname) {
287
288
  Content(`\`\`\`lua
288
- local results, err = client:${ent.Name}():list()
289
+ local results, err = client:${ent.Name}():list(${listMatchArg('lua', ent)})
289
290
  \`\`\`
290
291
 
291
292
  `)
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, safeVarName, exampleVarName, luaKey } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, safeVarName, exampleVarName, luaKey, listMatchArg } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -13,6 +13,7 @@ import {
13
13
  // doc test EXECUTES this block, so a comment placeholder would break it).
14
14
  function luaLit(type: any, placeholder: string = 'example'): string {
15
15
  const k = canonScalarKey(type)
16
+ if ('NULL' === k) return 'nil'
16
17
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
17
18
  if ('BOOLEAN' === k) return 'true'
18
19
  if ('ARRAY' === k || 'OBJECT' === k) return '{}'
@@ -33,9 +34,12 @@ const ReadmeTopQuick = cmp(function ReadmeTopQuick(props: any) {
33
34
  ? `sdk.new({\n apikey = os.getenv("${envName(model)}_APIKEY"),\n})`
34
35
  : `sdk.new()`
35
36
 
37
+ const shown = null != exampleEntity &&
38
+ ['list', 'load'].some((op: string) => Object.keys(exampleEntity.op || {}).includes(op))
39
+
36
40
  Content(`\`\`\`lua
37
41
  local sdk = require("${model.name}_sdk")
38
-
42
+ ${shown ? 'local json = require("dkjson")\n' : ''}
39
43
  local client = ${ctor}
40
44
 
41
45
  `)
@@ -51,9 +55,12 @@ local client = ${ctor}
51
55
  let hasCall = false
52
56
 
53
57
  if (opnames.includes('list')) {
54
- Content(`-- List all ${eName.toLowerCase()}s
55
- local ${eVar}s, err = client:${eName}():list()
56
- print(${eVar}s)
58
+ Content(`-- List all ${eName.toLowerCase()}s (an array of entities, one per record; err on failure)
59
+ local ${eVar}s, err = client:${eName}():list(${listMatchArg('lua', exampleEntity)})
60
+ if err then error(err) end
61
+ for _, ${eVar} in ipairs(${eVar}s) do
62
+ print(json.encode(${eVar}:data_get()))
63
+ end
57
64
  `)
58
65
  hasCall = true
59
66
  }
@@ -72,9 +79,10 @@ print(${eVar}s)
72
79
  it.name === idF ? 'example_id' : 'example_' + it.name)}`).join(', ')} }`
73
80
  : ''
74
81
  Content(`
75
- -- Load a specific ${eName.toLowerCase()}
82
+ -- Load a specific ${eName.toLowerCase()} (returns the entity; err on failure)
76
83
  local ${eVar}, err = client:${eName}():load(${loadArg})
77
- print(${eVar})
84
+ if err then error(err) end
85
+ print(json.encode(${eVar}:data_get()))
78
86
  `)
79
87
  hasCall = true
80
88
  }
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, luaKey } from '@voxgig/sdkgen'
2
+ import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, luaKey, requiredItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -11,6 +11,7 @@ import {
11
11
  // A type-correct Lua literal for a field's canonical type.
12
12
  function luaLit(type: any): string {
13
13
  const k = canonScalarKey(type)
14
+ if ('NULL' === k) return 'nil'
14
15
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
15
16
  if ('BOOLEAN' === k) return 'true'
16
17
  if ('ARRAY' === k || 'OBJECT' === k) return '{}'
@@ -36,16 +37,16 @@ local client = sdk.test()
36
37
  const idF = entityIdField(exampleEntity)
37
38
  const isMatchOp = 'load' === primaryOp || 'remove' === primaryOp
38
39
  let arg = ''
39
- if (isMatchOp) {
40
+ if (isMatchOp || ('list' === primaryOp && 0 < requiredItems(exampleEntity, 'list').length)) {
40
41
  // Every REQUIRED match key (id first, then parent path params like
41
42
  // page_id) — the same shape the runtime resolves path params from.
42
- const items = opRequestShape(exampleEntity, primaryOp).items
43
- .filter((it: any) => !it.optional || it.name === idF)
43
+ const items = (isMatchOp ? opRequestShape(exampleEntity, primaryOp).items
44
+ .filter((it: any) => !it.optional || it.name === idF) : requiredItems(exampleEntity, 'list'))
44
45
  .sort((a: any, b: any) =>
45
46
  (a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
46
47
  arg = 0 < items.length
47
48
  ? `{ ${items.map((it: any) =>
48
- `${luaKey(it.name)} = ${it.name === idF ? '"test01"' : luaLit(it.type)}`).join(', ')} }`
49
+ `${luaKey(it.name)} = ${isMatchOp && it.name === idF ? '"test01"' : luaLit(it.type)}`).join(', ')} }`
49
50
  : ''
50
51
  } else if ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp) {
51
52
  const items = opRequestShape(exampleEntity, primaryOp).items
@@ -4,6 +4,7 @@ local json = require("dkjson")
4
4
  local vs = require("utility.struct.struct")
5
5
  local helpers = require("core.helpers")
6
6
 
7
+ ---@class EntyClass
7
8
  local EntyClass = {}
8
9
  EntyClass.__index = EntyClass
9
10
 
@@ -7,7 +7,7 @@ local entityCreateOp = {}
7
7
 
8
8
  ---@param reqdata EntityNameCreateData
9
9
  ---@param ctrl? table
10
- ---@return EntityName
10
+ ---@return EntyClass
11
11
  ---@return string? err
12
12
  function EntyClass:create(reqdata, ctrl)
13
13
  local utility = self._utility
@@ -4,7 +4,7 @@ local entityListOp = {}
4
4
 
5
5
  ---@param reqmatch EntityNameListMatch
6
6
  ---@param ctrl? table
7
- ---@return EntityName[]
7
+ ---@return EntyClass[]
8
8
  ---@return string? err
9
9
  function EntyClass:list(reqmatch, ctrl)
10
10
  local utility = self._utility
@@ -7,7 +7,7 @@ local entityLoadOp = {}
7
7
 
8
8
  ---@param reqmatch EntityNameLoadMatch
9
9
  ---@param ctrl? table
10
- ---@return EntityName
10
+ ---@return EntyClass
11
11
  ---@return string? err
12
12
  function EntyClass:load(reqmatch, ctrl)
13
13
  local utility = self._utility
@@ -7,7 +7,7 @@ local entityPatchOp = {}
7
7
 
8
8
  ---@param reqdata EntityNamePatchData
9
9
  ---@param ctrl? table
10
- ---@return EntityName
10
+ ---@return EntyClass
11
11
  ---@return string? err
12
12
  function EntyClass:patch(reqdata, ctrl)
13
13
  local utility = self._utility
@@ -7,7 +7,7 @@ local entityRemoveOp = {}
7
7
 
8
8
  ---@param reqmatch EntityNameRemoveMatch
9
9
  ---@param ctrl? table
10
- ---@return EntityName
10
+ ---@return EntyClass
11
11
  ---@return string? err
12
12
  function EntyClass:remove(reqmatch, ctrl)
13
13
  local utility = self._utility
@@ -7,7 +7,7 @@ local entityUpdateOp = {}
7
7
 
8
8
  ---@param reqdata EntityNameUpdateData
9
9
  ---@param ctrl? table
10
- ---@return EntityName
10
+ ---@return EntyClass
11
11
  ---@return string? err
12
12
  function EntyClass:update(reqdata, ctrl)
13
13
  local utility = self._utility
@@ -6,13 +6,14 @@ import {
6
6
  getModelPath,
7
7
  } from '@voxgig/apidef'
8
8
 
9
- import { ocamlVarName } from './utility_ocaml'
9
+ import { ocamlVarName, ocamlListMatch } from './utility_ocaml'
10
10
 
11
11
 
12
12
  // A type-correct OCaml `value` literal for a field's canonical type. Strings
13
13
  // render the quoted placeholder.
14
14
  function ocamlLit(type: any, placeholder: string = 'example'): string {
15
15
  const k = canonScalarKey(type)
16
+ if ('NULL' === k) return 'Null'
16
17
  if ('INTEGER' === k || 'NUMBER' === k) return '(Num 1.)'
17
18
  if ('BOOLEAN' === k) return '(Bool true)'
18
19
  if ('ARRAY' === k) return '(empty_list ())'
@@ -154,7 +155,7 @@ let ${fn}_data = ${fn}.e_data_get ()
154
155
 
155
156
  \`\`\`ocaml
156
157
  (* One ENTITY per record. *)
157
- let ${fn}s = (Sdk_client.${fn} client Noval).e_list (empty_map ()) Noval
158
+ let ${fn}s = (Sdk_client.${fn} client Noval).e_list ${ocamlListMatch(entity)} Noval
158
159
  let ${fn}_datas = List.map (fun e -> e.e_data_get ()) ${fn}s
159
160
  \`\`\`
160
161
 
@@ -6,12 +6,13 @@ import {
6
6
  getModelPath,
7
7
  } from '@voxgig/apidef'
8
8
 
9
- import { ocamlOpField, ocamlVarName } from './utility_ocaml'
9
+ import { ocamlListMatch, ocamlOpField, ocamlVarName } from './utility_ocaml'
10
10
 
11
11
 
12
12
  // A type-correct OCaml `value` literal for a field's canonical type.
13
13
  function ocamlLit(type: any): string {
14
14
  const k = canonScalarKey(type)
15
+ if ('NULL' === k) return 'Null'
15
16
  if ('INTEGER' === k || 'NUMBER' === k) return '(Num 1.)'
16
17
  if ('BOOLEAN' === k) return '(Bool true)'
17
18
  if ('ARRAY' === k) return '(empty_list ())'
@@ -34,7 +35,7 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
34
35
  const isMatchOp = 'load' === primaryOp || 'remove' === primaryOp
35
36
  let testArg = 'Noval'
36
37
  if (exampleEntity && 'list' === primaryOp) {
37
- testArg = '(empty_map ())'
38
+ testArg = ocamlListMatch(exampleEntity)
38
39
  } else if (exampleEntity && isMatchOp) {
39
40
  testArg = idF ? `(jo [("${idF}", Str "test01")])` : '(empty_map ())'
40
41
  } else if (exampleEntity && ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp)) {
@@ -40,6 +40,7 @@ const ReadmeModel = cmp(function ReadmeModel(props: any) {
40
40
  \`\`\`ocaml
41
41
  open Voxgig_struct
42
42
  open Sdk_helpers
43
+ open Sdk_types
43
44
 
44
45
  let client = Sdk_client.make options
45
46
  \`\`\`