@voxgig/sdkgen 2.0.2 → 3.1.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 (403) hide show
  1. package/bin/voxgig-sdkgen +22 -2
  2. package/dist/action/doctor.d.ts +14 -0
  3. package/dist/action/doctor.js +351 -0
  4. package/dist/action/doctor.js.map +1 -0
  5. package/dist/action/feature.js +48 -9
  6. package/dist/action/feature.js.map +1 -1
  7. package/dist/action/target.d.ts +6 -1
  8. package/dist/action/target.js +134 -22
  9. package/dist/action/target.js.map +1 -1
  10. package/dist/cmp/Entity.js +5 -0
  11. package/dist/cmp/Entity.js.map +1 -1
  12. package/dist/cmp/ExternalTarget.d.ts +2 -0
  13. package/dist/cmp/ExternalTarget.js +104 -0
  14. package/dist/cmp/ExternalTarget.js.map +1 -0
  15. package/dist/cmp/Feature.js +2 -1
  16. package/dist/cmp/Feature.js.map +1 -1
  17. package/dist/cmp/Main.js +5 -1
  18. package/dist/cmp/Main.js.map +1 -1
  19. package/dist/cmp/ReadmeExplanation.js +1 -1
  20. package/dist/cmp/ReadmeExplanation.js.map +1 -1
  21. package/dist/cmp/ReadmeTop.js +16 -6
  22. package/dist/cmp/ReadmeTop.js.map +1 -1
  23. package/dist/cmp/Registered.d.ts +7 -0
  24. package/dist/cmp/Registered.js +70 -0
  25. package/dist/cmp/Registered.js.map +1 -0
  26. package/dist/cmp/Test.js +3 -1
  27. package/dist/cmp/Test.js.map +1 -1
  28. package/dist/helpers/dryrun.d.ts +10 -0
  29. package/dist/helpers/dryrun.js +35 -0
  30. package/dist/helpers/dryrun.js.map +1 -0
  31. package/dist/helpers/featureSource.d.ts +13 -0
  32. package/dist/helpers/featureSource.js +156 -0
  33. package/dist/helpers/featureSource.js.map +1 -0
  34. package/dist/helpers/naming.d.ts +9 -1
  35. package/dist/helpers/naming.js +66 -2
  36. package/dist/helpers/naming.js.map +1 -1
  37. package/dist/helpers/opExample.js +23 -3
  38. package/dist/helpers/opExample.js.map +1 -1
  39. package/dist/helpers/opShape.d.ts +11 -1
  40. package/dist/helpers/opShape.js +51 -0
  41. package/dist/helpers/opShape.js.map +1 -1
  42. package/dist/helpers/packageMeta.d.ts +16 -1
  43. package/dist/helpers/packageMeta.js +181 -10
  44. package/dist/helpers/packageMeta.js.map +1 -1
  45. package/dist/helpers/stdrep.d.ts +3 -0
  46. package/dist/helpers/stdrep.js +47 -0
  47. package/dist/helpers/stdrep.js.map +1 -0
  48. package/dist/helpers/testPolicy.d.ts +2 -0
  49. package/dist/helpers/testPolicy.js +46 -0
  50. package/dist/helpers/testPolicy.js.map +1 -0
  51. package/dist/sdkgen.d.ts +15 -6
  52. package/dist/sdkgen.js +273 -5
  53. package/dist/sdkgen.js.map +1 -1
  54. package/dist/tsconfig.tsbuildinfo +1 -1
  55. package/dist/types.d.ts +12 -0
  56. package/dist/utility.js +10 -1
  57. package/dist/utility.js.map +1 -1
  58. package/model/sdkgen.aontu +245 -0
  59. package/package.json +5 -3
  60. package/project/.sdk/model/target/c.aontu +28 -3
  61. package/project/.sdk/model/target/clojure.aontu +24 -3
  62. package/project/.sdk/model/target/cpp.aontu +25 -3
  63. package/project/.sdk/model/target/csharp.aontu +25 -3
  64. package/project/.sdk/model/target/dart.aontu +15 -3
  65. package/project/.sdk/model/target/elixir.aontu +15 -3
  66. package/project/.sdk/model/target/go-cli.aontu +16 -1
  67. package/project/.sdk/model/target/go-mcp.aontu +16 -1
  68. package/project/.sdk/model/target/go.aontu +14 -4
  69. package/project/.sdk/model/target/haskell.aontu +24 -3
  70. package/project/.sdk/model/target/java.aontu +25 -3
  71. package/project/.sdk/model/target/js.aontu +15 -3
  72. package/project/.sdk/model/target/kotlin.aontu +25 -3
  73. package/project/.sdk/model/target/lean.aontu +24 -3
  74. package/project/.sdk/model/target/lua.aontu +15 -3
  75. package/project/.sdk/model/target/ocaml.aontu +24 -3
  76. package/project/.sdk/model/target/perl.aontu +15 -3
  77. package/project/.sdk/model/target/php.aontu +15 -3
  78. package/project/.sdk/model/target/py-data.aontu +15 -3
  79. package/project/.sdk/model/target/py.aontu +15 -3
  80. package/project/.sdk/model/target/rb.aontu +15 -3
  81. package/project/.sdk/model/target/rust.aontu +25 -3
  82. package/project/.sdk/model/target/scala.aontu +24 -3
  83. package/project/.sdk/model/target/seneca-provider.aontu +118 -0
  84. package/project/.sdk/model/target/swift.aontu +25 -3
  85. package/project/.sdk/model/target/ts.aontu +15 -3
  86. package/project/.sdk/model/target/zig.aontu +25 -3
  87. package/project/.sdk/src/cmp/c/Config_c.ts +10 -11
  88. package/project/.sdk/src/cmp/c/Entity_c.ts +5 -1
  89. package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +23 -5
  90. package/project/.sdk/src/cmp/c/fragment/EntityCreateOp.fragment.c +9 -2
  91. package/project/.sdk/src/cmp/c/fragment/EntityListOp.fragment.c +19 -2
  92. package/project/.sdk/src/cmp/c/fragment/EntityLoadOp.fragment.c +9 -2
  93. package/project/.sdk/src/cmp/c/fragment/EntityRemoveOp.fragment.c +12 -2
  94. package/project/.sdk/src/cmp/c/fragment/EntityUpdateOp.fragment.c +9 -2
  95. package/project/.sdk/src/cmp/c/fragment/Main.fragment.c +1 -0
  96. package/project/.sdk/src/cmp/clojure/TestEntity_clojure.ts +6 -3
  97. package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +18 -1
  98. package/project/.sdk/src/cmp/clojure/fragment/EntityCreateOp.fragment.clj +2 -2
  99. package/project/.sdk/src/cmp/clojure/fragment/EntityLoadOp.fragment.clj +2 -2
  100. package/project/.sdk/src/cmp/clojure/fragment/EntityRemoveOp.fragment.clj +12 -8
  101. package/project/.sdk/src/cmp/clojure/fragment/EntityUpdateOp.fragment.clj +2 -2
  102. package/project/.sdk/src/cmp/cpp/Entity_cpp.ts +5 -1
  103. package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +12 -9
  104. package/project/.sdk/src/cmp/cpp/fragment/EntityCreateOp.fragment.cpp +8 -2
  105. package/project/.sdk/src/cmp/cpp/fragment/EntityListOp.fragment.cpp +18 -2
  106. package/project/.sdk/src/cmp/cpp/fragment/EntityLoadOp.fragment.cpp +8 -2
  107. package/project/.sdk/src/cmp/cpp/fragment/EntityRemoveOp.fragment.cpp +11 -2
  108. package/project/.sdk/src/cmp/cpp/fragment/EntityUpdateOp.fragment.cpp +8 -2
  109. package/project/.sdk/src/cmp/csharp/Package_csharp.ts +2 -1
  110. package/project/.sdk/src/cmp/csharp/TestDirect_csharp.ts +3 -3
  111. package/project/.sdk/src/cmp/csharp/TestEntity_csharp.ts +6 -6
  112. package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +38 -1
  113. package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +42 -33
  114. package/project/.sdk/src/cmp/dart/Package_dart.ts +2 -1
  115. package/project/.sdk/src/cmp/dart/ReadmeEntity_dart.ts +13 -2
  116. package/project/.sdk/src/cmp/dart/ReadmeHowto_dart.ts +2 -1
  117. package/project/.sdk/src/cmp/dart/ReadmeInstall_dart.ts +3 -3
  118. package/project/.sdk/src/cmp/dart/ReadmeModel_dart.ts +1 -1
  119. package/project/.sdk/src/cmp/dart/ReadmeQuick_dart.ts +17 -6
  120. package/project/.sdk/src/cmp/dart/ReadmeRef_dart.ts +13 -2
  121. package/project/.sdk/src/cmp/dart/ReadmeTopQuick_dart.ts +13 -2
  122. package/project/.sdk/src/cmp/dart/TestDirect_dart.ts +3 -3
  123. package/project/.sdk/src/cmp/dart/TestEntity_dart.ts +8 -8
  124. package/project/.sdk/src/cmp/dart/fragment/EntityBase.fragment.dart +18 -1
  125. package/project/.sdk/src/cmp/dart/fragment/EntityCreateOp.fragment.dart +9 -1
  126. package/project/.sdk/src/cmp/dart/fragment/EntityLoadOp.fragment.dart +9 -1
  127. package/project/.sdk/src/cmp/dart/fragment/EntityRemoveOp.fragment.dart +15 -1
  128. package/project/.sdk/src/cmp/dart/fragment/EntityUpdateOp.fragment.dart +9 -1
  129. package/project/.sdk/src/cmp/dart/fragment/SdkError.fragment.dart +8 -0
  130. package/project/.sdk/src/cmp/elixir/Package_elixir.ts +3 -1
  131. package/project/.sdk/src/cmp/elixir/ReadmeInstall_elixir.ts +2 -2
  132. package/project/.sdk/src/cmp/elixir/TestEntity_elixir.ts +11 -2
  133. package/project/.sdk/src/cmp/elixir/fragment/EntityCreateOp.fragment.ex +2 -1
  134. package/project/.sdk/src/cmp/elixir/fragment/EntityListOp.fragment.ex +1 -0
  135. package/project/.sdk/src/cmp/elixir/fragment/EntityLoadOp.fragment.ex +2 -1
  136. package/project/.sdk/src/cmp/elixir/fragment/EntityRemoveOp.fragment.ex +4 -1
  137. package/project/.sdk/src/cmp/elixir/fragment/EntityUpdateOp.fragment.ex +2 -1
  138. package/project/.sdk/src/cmp/go/EntityTypes_go.ts +38 -8
  139. package/project/.sdk/src/cmp/go/Entity_go.ts +2 -2
  140. package/project/.sdk/src/cmp/go/Main_go.ts +4 -5
  141. package/project/.sdk/src/cmp/go/Package_go.ts +8 -5
  142. package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +2 -2
  143. package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +2 -2
  144. package/project/.sdk/src/cmp/go/ReadmeInstall_go.ts +4 -2
  145. package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +2 -2
  146. package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +2 -2
  147. package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +2 -2
  148. package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +2 -2
  149. package/project/.sdk/src/cmp/go/TestDirect_go.ts +21 -15
  150. package/project/.sdk/src/cmp/go/TestEntity_go.ts +9 -9
  151. package/project/.sdk/src/cmp/go/Test_go.ts +2 -2
  152. package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +42 -1
  153. package/project/.sdk/src/cmp/go-cli/Main_go-cli.ts +4 -4
  154. package/project/.sdk/src/cmp/go-mcp/Main_go-mcp.ts +4 -4
  155. package/project/.sdk/src/cmp/haskell/Package_haskell.ts +2 -1
  156. package/project/.sdk/src/cmp/haskell/ReadmeEntity_haskell.ts +10 -5
  157. package/project/.sdk/src/cmp/haskell/ReadmeModel_haskell.ts +10 -8
  158. package/project/.sdk/src/cmp/haskell/ReadmeQuick_haskell.ts +14 -10
  159. package/project/.sdk/src/cmp/haskell/ReadmeRef_haskell.ts +21 -18
  160. package/project/.sdk/src/cmp/haskell/ReadmeTopQuick_haskell.ts +4 -4
  161. package/project/.sdk/src/cmp/haskell/Test_haskell.ts +23 -11
  162. package/project/.sdk/src/cmp/java/Package_java.ts +2 -1
  163. package/project/.sdk/src/cmp/java/ReadmeHowto_java.ts +2 -1
  164. package/project/.sdk/src/cmp/java/ReadmeInstall_java.ts +2 -2
  165. package/project/.sdk/src/cmp/java/ReadmeModel_java.ts +1 -1
  166. package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +3 -3
  167. package/project/.sdk/src/cmp/java/TestDirect_java.ts +3 -3
  168. package/project/.sdk/src/cmp/java/TestEntity_java.ts +6 -6
  169. package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +34 -1
  170. package/project/.sdk/src/cmp/java/fragment/SdkError.fragment.java +12 -0
  171. package/project/.sdk/src/cmp/js/Main_js.ts +4 -1
  172. package/project/.sdk/src/cmp/js/Package_js.ts +7 -1
  173. package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +13 -2
  174. package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +2 -1
  175. package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +13 -2
  176. package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +13 -2
  177. package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +2 -1
  178. package/project/.sdk/src/cmp/js/TestDirect_js.ts +3 -3
  179. package/project/.sdk/src/cmp/js/TestEntity_js.ts +8 -8
  180. package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +22 -1
  181. package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +9 -1
  182. package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +9 -1
  183. package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +15 -1
  184. package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +9 -1
  185. package/project/.sdk/src/cmp/js/fragment/SdkError.fragment.js +13 -0
  186. package/project/.sdk/src/cmp/kotlin/Package_kotlin.ts +2 -1
  187. package/project/.sdk/src/cmp/kotlin/ReadmeHowto_kotlin.ts +2 -1
  188. package/project/.sdk/src/cmp/kotlin/ReadmeInstall_kotlin.ts +2 -2
  189. package/project/.sdk/src/cmp/kotlin/ReadmeModel_kotlin.ts +1 -1
  190. package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +3 -3
  191. package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +3 -3
  192. package/project/.sdk/src/cmp/kotlin/TestEntity_kotlin.ts +6 -6
  193. package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +32 -1
  194. package/project/.sdk/src/cmp/lean/Package_lean.ts +3 -1
  195. package/project/.sdk/src/cmp/lua/MainEntity_lua.ts +9 -4
  196. package/project/.sdk/src/cmp/lua/Package_lua.ts +4 -3
  197. package/project/.sdk/src/cmp/lua/ReadmeModel_lua.ts +11 -3
  198. package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +1 -1
  199. package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +3 -3
  200. package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +9 -9
  201. package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +37 -1
  202. package/project/.sdk/src/cmp/lua/fragment/SdkError.fragment.lua +12 -0
  203. package/project/.sdk/src/cmp/ocaml/EntityOperation_ocaml.ts +30 -3
  204. package/project/.sdk/src/cmp/ocaml/Entity_ocaml.ts +11 -5
  205. package/project/.sdk/src/cmp/ocaml/Package_ocaml.ts +3 -1
  206. package/project/.sdk/src/cmp/ocaml/ReadmeEntity_ocaml.ts +10 -5
  207. package/project/.sdk/src/cmp/ocaml/ReadmeHowto_ocaml.ts +6 -2
  208. package/project/.sdk/src/cmp/ocaml/ReadmeModel_ocaml.ts +10 -8
  209. package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +14 -13
  210. package/project/.sdk/src/cmp/ocaml/ReadmeRef_ocaml.ts +20 -18
  211. package/project/.sdk/src/cmp/ocaml/ReadmeTopQuick_ocaml.ts +4 -4
  212. package/project/.sdk/src/cmp/ocaml/ReadmeTopTest_ocaml.ts +8 -2
  213. package/project/.sdk/src/cmp/ocaml/TestEntity_ocaml.ts +8 -5
  214. package/project/.sdk/src/cmp/perl/ReadmeHowto_perl.ts +2 -1
  215. package/project/.sdk/src/cmp/perl/ReadmeModel_perl.ts +1 -1
  216. package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +3 -3
  217. package/project/.sdk/src/cmp/perl/ReadmeTopQuick_perl.ts +1 -1
  218. package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +3 -3
  219. package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +6 -6
  220. package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +36 -1
  221. package/project/.sdk/src/cmp/php/MainEntity_php.ts +21 -16
  222. package/project/.sdk/src/cmp/php/Package_php.ts +2 -2
  223. package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +6 -6
  224. package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +4 -3
  225. package/project/.sdk/src/cmp/php/ReadmeIntro_php.ts +2 -2
  226. package/project/.sdk/src/cmp/php/ReadmeModel_php.ts +1 -1
  227. package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +12 -12
  228. package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +6 -6
  229. package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +4 -4
  230. package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +2 -2
  231. package/project/.sdk/src/cmp/php/TestDirect_php.ts +3 -3
  232. package/project/.sdk/src/cmp/php/TestEntity_php.ts +17 -15
  233. package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +20 -1
  234. package/project/.sdk/src/cmp/php/fragment/SdkError.fragment.php +11 -0
  235. package/project/.sdk/src/cmp/py/Package_py.ts +4 -3
  236. package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +13 -2
  237. package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +2 -1
  238. package/project/.sdk/src/cmp/py/ReadmeModel_py.ts +1 -1
  239. package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +17 -6
  240. package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +14 -3
  241. package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +13 -2
  242. package/project/.sdk/src/cmp/py/TestDirect_py.ts +3 -3
  243. package/project/.sdk/src/cmp/py/TestEntity_py.ts +9 -9
  244. package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +29 -1
  245. package/project/.sdk/src/cmp/py/fragment/SdkError.fragment.py +11 -0
  246. package/project/.sdk/src/cmp/py-data/Main_py-data.ts +2 -1
  247. package/project/.sdk/src/cmp/rb/Package_rb.ts +4 -3
  248. package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +1 -1
  249. package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +2 -1
  250. package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +5 -5
  251. package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +1 -1
  252. package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +3 -3
  253. package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +9 -9
  254. package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +31 -1
  255. package/project/.sdk/src/cmp/rb/fragment/SdkError.fragment.rb +10 -1
  256. package/project/.sdk/src/cmp/rust/Entity_rust.ts +5 -1
  257. package/project/.sdk/src/cmp/rust/Main_rust.ts +21 -0
  258. package/project/.sdk/src/cmp/rust/Package_rust.ts +2 -1
  259. package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +3 -3
  260. package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +12 -12
  261. package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +18 -0
  262. package/project/.sdk/src/cmp/rust/fragment/EntityCreateOp.fragment.rs +8 -2
  263. package/project/.sdk/src/cmp/rust/fragment/EntityListOp.fragment.rs +20 -3
  264. package/project/.sdk/src/cmp/rust/fragment/EntityLoadOp.fragment.rs +8 -2
  265. package/project/.sdk/src/cmp/rust/fragment/EntityRemoveOp.fragment.rs +10 -2
  266. package/project/.sdk/src/cmp/rust/fragment/EntityUpdateOp.fragment.rs +8 -2
  267. package/project/.sdk/src/cmp/rust/fragment/SdkError.fragment.rs +10 -0
  268. package/project/.sdk/src/cmp/scala/ReadmeHowto_scala.ts +2 -1
  269. package/project/.sdk/src/cmp/scala/ReadmeInstall_scala.ts +3 -3
  270. package/project/.sdk/src/cmp/scala/ReadmeModel_scala.ts +1 -1
  271. package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +3 -3
  272. package/project/.sdk/src/cmp/scala/TestEntity_scala.ts +3 -3
  273. package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +27 -1
  274. package/project/.sdk/src/cmp/seneca-provider/Extras_seneca-provider.ts +3915 -0
  275. package/project/.sdk/src/cmp/seneca-provider/Main_seneca-provider.ts +960 -0
  276. package/project/.sdk/src/cmp/swift/ReadmeHowto_swift.ts +2 -1
  277. package/project/.sdk/src/cmp/swift/ReadmeInstall_swift.ts +3 -3
  278. package/project/.sdk/src/cmp/swift/ReadmeModel_swift.ts +1 -1
  279. package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +3 -3
  280. package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +34 -1
  281. package/project/.sdk/src/cmp/ts/EntityOperation_ts.ts +9 -1
  282. package/project/.sdk/src/cmp/ts/EntityTypes_ts.ts +18 -1
  283. package/project/.sdk/src/cmp/ts/Gitignore_ts.ts +5 -2
  284. package/project/.sdk/src/cmp/ts/Main_ts.ts +4 -1
  285. package/project/.sdk/src/cmp/ts/Package_ts.ts +10 -1
  286. package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +13 -2
  287. package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +2 -1
  288. package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +21 -6
  289. package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +52 -2
  290. package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +14 -3
  291. package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +34 -2
  292. package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +64 -43
  293. package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +8 -8
  294. package/project/.sdk/src/cmp/ts/fragment/Direct.test.fragment.ts +2 -2
  295. package/project/.sdk/src/cmp/ts/fragment/Entity.test.fragment.ts +2 -2
  296. package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +25 -1
  297. package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +10 -2
  298. package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +1 -1
  299. package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +10 -2
  300. package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +27 -3
  301. package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +10 -2
  302. package/project/.sdk/src/cmp/ts/fragment/SdkError.fragment.ts +15 -0
  303. package/project/.sdk/src/cmp/zig/Entity_zig.ts +5 -1
  304. package/project/.sdk/src/cmp/zig/Package_zig.ts +3 -1
  305. package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +39 -0
  306. package/project/.sdk/src/cmp/zig/fragment/EntityCreateOp.fragment.zig +2 -2
  307. package/project/.sdk/src/cmp/zig/fragment/EntityListOp.fragment.zig +21 -2
  308. package/project/.sdk/src/cmp/zig/fragment/EntityLoadOp.fragment.zig +2 -2
  309. package/project/.sdk/src/cmp/zig/fragment/EntityRemoveOp.fragment.zig +5 -2
  310. package/project/.sdk/src/cmp/zig/fragment/EntityUpdateOp.fragment.zig +2 -2
  311. package/project/.sdk/tm/c/VERSION +1 -1
  312. package/project/.sdk/tm/c/core/helpers.c +1 -0
  313. package/project/.sdk/tm/c/core/sdk.h +22 -6
  314. package/project/.sdk/tm/c/tests/feature_harness.h +1 -0
  315. package/project/.sdk/tm/c/tests/primary_utility_test.c +4 -1
  316. package/project/.sdk/tm/c/utility/make_url.c +1 -0
  317. package/project/.sdk/tm/c/utility/param.c +1 -0
  318. package/project/.sdk/tm/clojure/VERSION +1 -1
  319. package/project/.sdk/tm/cpp/VERSION +1 -1
  320. package/project/.sdk/tm/cpp/core/types.hpp +33 -8
  321. package/project/.sdk/tm/cpp/test/pipeline_test.cpp +5 -0
  322. package/project/.sdk/tm/cpp/test/runner_support.hpp +4 -4
  323. package/project/.sdk/tm/csharp/VERSION +1 -1
  324. package/project/.sdk/tm/csharp/core/Types.cs +6 -0
  325. package/project/.sdk/tm/csharp/test/FeatureHarness.cs +396 -0
  326. package/project/.sdk/tm/csharp/test/FeatureTest.cs +7 -385
  327. package/project/.sdk/tm/csharp/test/Runner.cs +4 -4
  328. package/project/.sdk/tm/dart/lib/utility/MakeErrorUtility.dart +4 -0
  329. package/project/.sdk/tm/dart/test/utility.dart +4 -4
  330. package/project/.sdk/tm/elixir/VERSION +1 -1
  331. package/project/.sdk/tm/elixir/lib/projectname/entity_base.ex +26 -0
  332. package/project/.sdk/tm/go/VERSION +1 -1
  333. package/project/.sdk/tm/go/core/types.go +6 -0
  334. package/project/.sdk/tm/go/test/feature_harness_test.go +361 -0
  335. package/project/.sdk/tm/go/test/feature_test.go +7 -350
  336. package/project/.sdk/tm/go/test/pipeline_test.go +6 -0
  337. package/project/.sdk/tm/go/test/runner_test.go +16 -4
  338. package/project/.sdk/tm/haskell/VERSION +1 -1
  339. package/project/.sdk/tm/haskell/src/SdkFeatures.hs +28 -5
  340. package/project/.sdk/tm/haskell/src/SdkTypes.hs +14 -5
  341. package/project/.sdk/tm/java/VERSION +1 -1
  342. package/project/.sdk/tm/java/test/RunnerSupport.java +4 -4
  343. package/project/.sdk/tm/java/utility/MakeError.java +4 -0
  344. package/project/.sdk/tm/js/src/utility/MakeErrorUtility.js +4 -0
  345. package/project/.sdk/tm/js/test/utility.js +3 -3
  346. package/project/.sdk/tm/kotlin/VERSION +1 -1
  347. package/project/.sdk/tm/kotlin/test/RunnerSupport.kt +3 -3
  348. package/project/.sdk/tm/lean/VERSION +1 -1
  349. package/project/.sdk/tm/lean/test/TFeature.lean +27 -14
  350. package/project/.sdk/tm/lua/test/runner.lua +4 -4
  351. package/project/.sdk/tm/lua/utility/make_error.lua +4 -0
  352. package/project/.sdk/tm/ocaml/VERSION +1 -1
  353. package/project/.sdk/tm/ocaml/sdk_types.ml +14 -5
  354. package/project/.sdk/tm/ocaml/test/t_pipeline.ml +5 -2
  355. package/project/.sdk/tm/perl/t/runner.pm +4 -4
  356. package/project/.sdk/tm/php/VERSION +1 -1
  357. package/project/.sdk/tm/php/test/Runner.php +4 -4
  358. package/project/.sdk/tm/php/utility/MakeError.php +5 -0
  359. package/project/.sdk/tm/py/pkg/utility/make_error.py +4 -0
  360. package/project/.sdk/tm/py/test/runner.py +19 -4
  361. package/project/.sdk/tm/rb/test/runner.rb +4 -4
  362. package/project/.sdk/tm/rb/utility/make_error.rb +4 -0
  363. package/project/.sdk/tm/rust/VERSION +1 -1
  364. package/project/.sdk/tm/rust/core/types.rs +22 -6
  365. package/project/.sdk/tm/rust/tests/common/mod.rs +6 -6
  366. package/project/.sdk/tm/rust/tests/pipeline_test.rs +6 -0
  367. package/project/.sdk/tm/rust/utility/make_error.rs +4 -0
  368. package/project/.sdk/tm/scala/VERSION +1 -1
  369. package/project/.sdk/tm/seneca-provider/CODE_OF_CONDUCT.md +132 -0
  370. package/project/.sdk/tm/seneca-provider/LICENSE +21 -0
  371. package/project/.sdk/tm/seneca-provider/Makefile +15 -0
  372. package/project/.sdk/tm/seneca-provider/src/tsconfig.json +18 -0
  373. package/project/.sdk/tm/seneca-provider/test/tsconfig.json +16 -0
  374. package/project/.sdk/tm/seneca-provider/tsfmt.json +3 -0
  375. package/project/.sdk/tm/swift/VERSION +1 -1
  376. package/project/.sdk/tm/ts/src/tsconfig.json +1 -0
  377. package/project/.sdk/tm/ts/src/utility/MakeErrorUtility.ts +4 -0
  378. package/project/.sdk/tm/ts/test/tsconfig.json +1 -0
  379. package/project/.sdk/tm/ts/test/utility.ts +3 -3
  380. package/project/.sdk/tm/zig/VERSION +1 -1
  381. package/src/action/doctor.ts +475 -0
  382. package/src/action/feature.ts +54 -16
  383. package/src/action/target.ts +174 -25
  384. package/src/cmp/Entity.ts +7 -0
  385. package/src/cmp/ExternalTarget.ts +125 -0
  386. package/src/cmp/Feature.ts +3 -1
  387. package/src/cmp/Main.ts +7 -1
  388. package/src/cmp/ReadmeExplanation.ts +2 -2
  389. package/src/cmp/ReadmeTop.ts +22 -9
  390. package/src/cmp/Registered.ts +100 -0
  391. package/src/cmp/Test.ts +4 -1
  392. package/src/helpers/dryrun.ts +57 -0
  393. package/src/helpers/featureSource.ts +208 -0
  394. package/src/helpers/naming.ts +73 -2
  395. package/src/helpers/opExample.ts +19 -2
  396. package/src/helpers/opShape.ts +65 -0
  397. package/src/helpers/packageMeta.ts +211 -10
  398. package/src/helpers/stdrep.ts +56 -0
  399. package/src/helpers/testPolicy.ts +52 -0
  400. package/src/sdkgen.ts +350 -5
  401. package/src/types.ts +24 -1
  402. package/src/utility.ts +10 -1
  403. package/project/.sdk/tm/rust/feature/mod.rs +0 -24
@@ -17,7 +17,7 @@ import {
17
17
  each,
18
18
  buildIdNames,
19
19
  getMatchEntries,
20
- isAuthActive,
20
+ isAuthActive, envName, envToken
21
21
  } from '@voxgig/sdkgen'
22
22
 
23
23
 
@@ -56,8 +56,8 @@ const TestEntity = cmp(function TestEntity(props: any) {
56
56
  return
57
57
  }
58
58
 
59
- const PROJUPPER = nom(model.const, 'Name').toUpperCase().replace(/[^A-Z_]/g, '_')
60
- const ENTUPPER = entity.name.toUpperCase().replace(/[^A-Z_]/g, '_')
59
+ const PROJUPPER = envName(model)
60
+ const ENTUPPER = envToken(entity.name)
61
61
  const entidEnvVar = `${PROJUPPER}_TEST_${ENTUPPER}_ENTID`
62
62
 
63
63
  const SDK = model.const.Name + 'SDK'
@@ -317,7 +317,7 @@ const generateCreate: OpGen = (ctx, step, index) => {
317
317
 
318
318
  Content(`
319
319
  val ${datavar}Result = ${entvar}.create(${datavar}, null)
320
- ${datavar} = Helpers.toMapAny(${datavar}Result) ?: linkedMapOf()
320
+ ${datavar} = Helpers.toMapAny(if (${datavar}Result is SdkEntity) ${datavar}Result.data() else ${datavar}Result) ?: linkedMapOf()
321
321
  assertNotNull(${datavar}, "expected create result to be a map")
322
322
  `)
323
323
  if (null != ctx.entity.id) {
@@ -451,7 +451,7 @@ const generateUpdate: OpGen = (ctx, step, index) => {
451
451
 
452
452
  Content(`
453
453
  val ${resdatavar}Result = ${entvar}.update(${datavar}Up, null)
454
- val ${resdatavar} = Helpers.toMapAny(${resdatavar}Result) ?: linkedMapOf()
454
+ val ${resdatavar} = Helpers.toMapAny(if (${resdatavar}Result is SdkEntity) ${resdatavar}Result.data() else ${resdatavar}Result) ?: linkedMapOf()
455
455
  assertNotNull(${resdatavar}, "expected update result to be a map")
456
456
  `)
457
457
  if (hasEntIdU) {
@@ -516,7 +516,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
516
516
  if (hasEntId) {
517
517
  Content(` ${matchvar}["id"] = ${srcdatavar}["id"]
518
518
  val ${datavar}Loaded = ${entvar}.load(${matchvar}, null)
519
- val ${datavar}LoadResult = Helpers.toMapAny(${datavar}Loaded) ?: linkedMapOf()
519
+ val ${datavar}LoadResult = Helpers.toMapAny(if (${datavar}Loaded is SdkEntity) ${datavar}Loaded.data() else ${datavar}Loaded) ?: linkedMapOf()
520
520
  assertNotNull(${datavar}LoadResult, "expected load result to be a map")
521
521
  assertEquals(${srcdatavar}["id"], ${datavar}LoadResult["id"],
522
522
  "expected load result id to match")
@@ -71,6 +71,18 @@ abstract class EntityBase(nm: String, clientIn: SdkClient, entoptsIn: MutableMap
71
71
  // runOp drives one operation through the pipeline: for each stage the
72
72
  // feature hook fires, then the stage runs; a failing stage routes through
73
73
  // makeError (which throws, or returns fallback data when ctrl.throw false).
74
+ // Every operation resolves to the entity; `remove` additionally marks
75
+ // it. The instance KEEPS the data it held — a caller can still read
76
+ // what was deleted — but it is no longer a live record. See AGENTS.md.
77
+ private var deletedFlag: Boolean = false
78
+
79
+ fun markDeleted() {
80
+ this.deletedFlag = true
81
+ }
82
+
83
+ fun deleted(): Boolean = this.deletedFlag
84
+
85
+
74
86
  protected fun runOp(ctx: Context, postDone: () -> Unit): Any? {
75
87
  val utility = this.utility
76
88
 
@@ -104,7 +116,26 @@ abstract class EntityBase(nm: String, clientIn: SdkClient, entoptsIn: MutableMap
104
116
 
105
117
  postDone()
106
118
 
107
- return utility.done(ctx)
119
+ val out = utility.done(ctx)
120
+
121
+ // An operation resolves to the ENTITY, not the raw data. Entities are
122
+ // stateful: postDone has just absorbed resdata/resmatch into this
123
+ // instance, and the caller reaches the record through data(). Two
124
+ // structural exceptions: `list` resolves to the ARRAY of entity
125
+ // instances makeResult built, and a failed op with throwing disabled
126
+ // hands back the error payload unchanged. `remove` additionally marks
127
+ // the entity deleted; it KEEPS its data, so a caller can still read
128
+ // what was removed. See AGENTS.md "Entity operations return ENTITIES".
129
+ val opname = ctx.op?.name
130
+
131
+ if (ctx.result != null && ctx.result!!.ok && "list" != opname) {
132
+ if ("remove" == opname) {
133
+ this.markDeleted()
134
+ }
135
+ return this
136
+ }
137
+
138
+ return out
108
139
  } catch (err: RuntimeException) {
109
140
  // An error already finalised by makeError (e.g. via done) must not be
110
141
  // wrapped a second time.
@@ -2,6 +2,7 @@ import {
2
2
  Content,
3
3
  File,
4
4
  cmp,
5
+ packageVersion,
5
6
  } from '@voxgig/sdkgen'
6
7
 
7
8
  import type {
@@ -22,6 +23,7 @@ const LIBS = [
22
23
 
23
24
  const Package = cmp(async function Package(props: any) {
24
25
  const ctx$ = props.ctx$
26
+ const target = props.target
25
27
  const model: Model = ctx$.model
26
28
 
27
29
  const libBlocks = LIBS.map((n) =>
@@ -30,7 +32,7 @@ const Package = cmp(async function Package(props: any) {
30
32
  File({ name: 'lakefile.toml' }, () => {
31
33
  Content(`# ${model.const.Name} SDK for Lean 4 (generated by @voxgig/sdkgen).
32
34
  name = "${pkgName(model)}"
33
- version = "0.0.1"
35
+ version = "${packageVersion(model, target.name)}"
34
36
  defaultTargets = ["SdkClient"]
35
37
 
36
38
  ${libBlocks}
@@ -1,11 +1,16 @@
1
1
 
2
2
 
3
- import { cmp, Content } from '@voxgig/sdkgen'
3
+ import { cmp, Content, entityCacheField } from '@voxgig/sdkgen'
4
4
 
5
5
 
6
6
  const MainEntity = cmp(async function MainEntity(props: any) {
7
7
  const { entity } = props
8
8
  const { model } = props.ctx$
9
+ // The cache slot must not alias one of the SDK's own fields: an entity
10
+ // named `utility` made client:Utility() hand back self._utility, the SDK's
11
+ // internal utility object, whose :load() is nil.
12
+ const field = entityCacheField(entity.name)
13
+
9
14
 
10
15
  Content(`
11
16
  -- Idiomatic facade: client:${entity.Name}():list() / client:${entity.Name}():load({ id = ... })
@@ -13,10 +18,10 @@ const MainEntity = cmp(async function MainEntity(props: any) {
13
18
  function ${model.const.Name}SDK:${entity.Name}(data)
14
19
  local EntityMod = require("entity.${entity.name}_entity")
15
20
  if data == nil then
16
- if self._${entity.name} == nil then
17
- self._${entity.name} = EntityMod.new(self, nil)
21
+ if self._${field} == nil then
22
+ self._${field} = EntityMod.new(self, nil)
18
23
  end
19
- return self._${entity.name}
24
+ return self._${field}
20
25
  end
21
26
  return EntityMod.new(self, data)
22
27
  end
@@ -6,7 +6,8 @@ import {
6
6
  collectDeps,
7
7
  pkgDescription,
8
8
  keywords,
9
- repoInfo,
9
+ repoInfo, packageName,
10
+ packageVersion,
10
11
  } from '@voxgig/sdkgen'
11
12
 
12
13
 
@@ -26,13 +27,13 @@ const Package = cmp(async function Package(props: any) {
26
27
  // (`${model.name}_sdk`) used by `require` is unchanged.
27
28
  const ns = model.origin || 'voxgig-sdk'
28
29
  const pkgBase = ns.endsWith('-sdk') ? model.name : `${model.name}-sdk`
29
- const rockName = `${ns}-${pkgBase}`
30
+ const rockName = packageName(model, 'lua')
30
31
  const { repoUrl, issuesUrl } = repoInfo(model)
31
32
  const labels = keywords(model).map((k) => `"${k}"`).join(', ')
32
33
 
33
34
  // Single source for the version so the rockspec version and the source.tag
34
35
  // (which `make publish` pushes as lua/v<rockVersion>) can never drift apart.
35
- const rockVersion = '0.0.1'
36
+ const rockVersion = packageVersion(model, target.name)
36
37
 
37
38
  File({ name: model.name + '.rockspec' }, () => {
38
39
  Content(`package = "${rockName}"
@@ -40,9 +40,16 @@ const ReadmeModel = cmp(function ReadmeModel(props: any) {
40
40
  if (opUnion.has('list')) resultRows.push('| `list` | an array (`table`) of entity records |')
41
41
  const resultShapeRows = resultRows.join('\n')
42
42
 
43
- const exEnt: any = entityList[0] || {}
43
+ // The Result-shape illustration calls `load`, so the example entity must
44
+ // actually HAVE load — entityList[0] need not. api-tools' first entity is
45
+ // Cryptography (create-only), so the generated README demonstrated
46
+ // `client:Cryptography():load()` and the readme_examples test died with
47
+ // "attempt to call a nil value (method 'load')".
48
+ const exEnt: any =
49
+ entityList.find((e: any) => (e.op || {}).load) || entityList[0] || {}
44
50
  const eName = exEnt.Name || 'Entity'
45
51
  const eLower = String(exEnt.name || 'entity').toLowerCase()
52
+ const hasLoad = null != (exEnt.op || {}).load
46
53
  // Model-driven id key: null when the example entity has no id-like field, so
47
54
  // the Result-shape load illustration takes no match argument.
48
55
  const idF = entityIdField(exEnt)
@@ -119,9 +126,10 @@ ${resultShapeRows}
119
126
 
120
127
  Check \`err\` first (it is non-\`nil\` on failure), then use \`value\`:
121
128
 
122
- local ${eLower}, err = client:${eName}():load(${idF ? `{ ${idF} = "example_id" }` : ''})
129
+ local ${eLower}, err = client:${eName}():${hasLoad ? 'load' : 'list'}(${
130
+ hasLoad && idF ? `{ ${idF} = "example_id" }` : ''})
123
131
  if err then error(err) end
124
- -- ${eLower} is the loaded record
132
+ -- ${eLower} is the ${hasLoad ? 'loaded record' : 'record list'}
125
133
 
126
134
  Only \`direct()\` returns a response envelope — a \`table\` with \`ok\`,
127
135
  \`status\`, \`headers\`, and \`data\` keys.
@@ -190,7 +190,7 @@ print(${eVar})
190
190
  return it && it.type
191
191
  }
192
192
  const idValueFor = (opname: string): string => (null != dataIdF && opnames.includes('create'))
193
- ? `created["${dataIdF}"]`
193
+ ? `created:data_get()["${dataIdF}"]`
194
194
  : luaLit(idParamType(opname), 'example_id')
195
195
 
196
196
  if (opnames.includes('create') || opnames.includes('update') || opnames.includes('remove')) {
@@ -11,7 +11,7 @@ import {
11
11
  File,
12
12
  cmp,
13
13
  snakify,
14
- isAuthActive,
14
+ isAuthActive, envName, envToken
15
15
  } from '@voxgig/sdkgen'
16
16
 
17
17
 
@@ -60,7 +60,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
60
60
  const target = props.target
61
61
  const entity: ModelEntity = props.entity
62
62
 
63
- const PROJECTNAME = nom(model, 'Name').toUpperCase().replace(/[^A-Z_]/g, '_')
63
+ const PROJECTNAME = envName(model)
64
64
 
65
65
  const authActive = isAuthActive(model)
66
66
  const apikeyEnvEntry = authActive
@@ -125,7 +125,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
125
125
  ? loadParams.map((p: any) => ` params["${p.name}"] = ${JSON.stringify(p.example)}`).join('\n')
126
126
  : ''
127
127
 
128
- const entidEnvVar = `${PROJECTNAME}_TEST_${nom(entity, 'NAME').replace(/[^A-Z_]/g, '_')}_ENTID`
128
+ const entidEnvVar = `${PROJECTNAME}_TEST_${envToken(entity.name)}_ENTID`
129
129
 
130
130
  File({ name: entity.name + '_direct_test.' + target.ext }, () => {
131
131
 
@@ -24,7 +24,7 @@ import {
24
24
  buildIdNames,
25
25
  getMatchEntries,
26
26
  isAuthActive,
27
- entityDataIdField,
27
+ entityDataIdField, envName, envToken
28
28
  } from '@voxgig/sdkgen'
29
29
 
30
30
 
@@ -58,7 +58,7 @@ const TestEntity = cmp(function TestEntity(props: any) {
58
58
  return
59
59
  }
60
60
 
61
- const PROJUPPER = nom(model.const, 'Name').toUpperCase().replace(/[^A-Z_]/g, '_')
61
+ const PROJUPPER = envName(model)
62
62
 
63
63
  const authActive = isAuthActive(model)
64
64
  const apikeyEnvEntry = authActive
@@ -154,7 +154,7 @@ ${hasList ? `
154
154
  -- The basic flow consumes synthetic IDs from the fixture. In live mode
155
155
  -- without an *_ENTID env override, those IDs hit the live API and 4xx.
156
156
  if setup.synthetic_only then
157
- pending("live entity test uses synthetic IDs from fixture — set ${PROJUPPER}_TEST_${entity.name.toUpperCase().replace(/[^A-Z_]/g, '_')}_ENTID JSON to run live")
157
+ pending("live entity test uses synthetic IDs from fixture — set ${PROJUPPER}_TEST_${envToken(entity.name)}_ENTID JSON to run live")
158
158
  return
159
159
  end
160
160
  local client = setup.client
@@ -235,17 +235,17 @@ end)
235
235
  Content(` -- Detect ENTID env override before envOverride consumes it. When live
236
236
  -- mode is on without a real override, the basic test runs against synthetic
237
237
  -- IDs from the fixture and 4xx's. Surface this so the test can skip.
238
- local entid_env_raw = os.getenv("${PROJUPPER}_TEST_${entity.name.toUpperCase().replace(/[^A-Z_]/g, '_')}_ENTID")
238
+ local entid_env_raw = os.getenv("${PROJUPPER}_TEST_${envToken(entity.name)}_ENTID")
239
239
  local idmap_overridden = entid_env_raw ~= nil and entid_env_raw:match("^%s*{") ~= nil
240
240
 
241
241
  local env = runner.env_override({
242
- ["${PROJUPPER}_TEST_${entity.name.toUpperCase().replace(/[^A-Z_]/g, '_')}_ENTID"] = idmap,
242
+ ["${PROJUPPER}_TEST_${envToken(entity.name)}_ENTID"] = idmap,
243
243
  ["${PROJUPPER}_TEST_LIVE"] = "FALSE",
244
244
  ["${PROJUPPER}_TEST_EXPLAIN"] = "FALSE",${apikeyEnvEntry}
245
245
  })
246
246
 
247
247
  local idmap_resolved = helpers.to_map(
248
- env["${PROJUPPER}_TEST_${entity.name.toUpperCase().replace(/[^A-Z_]/g, '_')}_ENTID"])
248
+ env["${PROJUPPER}_TEST_${envToken(entity.name)}_ENTID"])
249
249
  if idmap_resolved == nil then
250
250
  idmap_resolved = helpers.to_map(idmap)
251
251
  end
@@ -331,7 +331,7 @@ const generateCreate: OpGen = (ctx, step, index) => {
331
331
  Content(`
332
332
  local ${datavar}_result, err = ${entvar}:create(${datavar}, nil)
333
333
  assert.is_nil(err)
334
- ${datavar} = helpers.to_map(${datavar}_result)
334
+ ${datavar} = helpers.to_map(type(${datavar}_result) == 'table' and ${datavar}_result.data_get and ${datavar}_result:data_get() or ${datavar}_result)
335
335
  assert.is_not_nil(${datavar})
336
336
  `)
337
337
  if (null != ctx.entity.id) {
@@ -467,7 +467,7 @@ const generateUpdate: OpGen = (ctx, step, index) => {
467
467
  Content(`
468
468
  local ${resdatavar}_result, err = ${entvar}:update(${datavar}_up, nil)
469
469
  assert.is_nil(err)
470
- local ${resdatavar} = helpers.to_map(${resdatavar}_result)
470
+ local ${resdatavar} = helpers.to_map(type(${resdatavar}_result) == 'table' and ${resdatavar}_result.data_get and ${resdatavar}_result:data_get() or ${resdatavar}_result)
471
471
  assert.is_not_nil(${resdatavar})
472
472
  `)
473
473
  if (hasEntIdU) {
@@ -533,7 +533,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
533
533
  }
534
534
  local ${datavar}_loaded, err = ${entvar}:load(${matchvar}, nil)
535
535
  assert.is_nil(err)
536
- local ${datavar}_load_result = helpers.to_map(${datavar}_loaded)
536
+ local ${datavar}_load_result = helpers.to_map(type(${datavar}_loaded) == 'table' and ${datavar}_loaded.data_get and ${datavar}_loaded:data_get() or ${datavar}_loaded)
537
537
  assert.is_not_nil(${datavar}_load_result)
538
538
  assert.are.equal(${datavar}_load_result["id"], ${srcdatavar}["id"])
539
539
  `)
@@ -23,6 +23,7 @@ function EntyClass.new(client, entopts)
23
23
  self._utility = client:get_utility()
24
24
  self._entopts = entopts
25
25
  self._data = {}
26
+ self._deleted = false
26
27
  self._match = {}
27
28
 
28
29
  self._entctx = self._utility.make_context({
@@ -50,6 +51,19 @@ function EntyClass:make()
50
51
  end
51
52
 
52
53
 
54
+ -- Every operation resolves to the entity; `remove` additionally marks
55
+ -- it. The instance KEEPS the data it held — a caller can still read what
56
+ -- was deleted — but it is no longer a live record. See AGENTS.md.
57
+ function EntyClass:mark_deleted()
58
+ self._deleted = true
59
+ end
60
+
61
+
62
+ function EntyClass:deleted()
63
+ return true == self._deleted
64
+ end
65
+
66
+
53
67
  function EntyClass:data_set(args)
54
68
  if args ~= nil then
55
69
  self._data = helpers.to_map(vs.clone(args)) or {}
@@ -277,7 +291,29 @@ function EntyClass:_run_op(ctx, post_done)
277
291
 
278
292
  post_done()
279
293
 
280
- return utility.done(ctx)
294
+ local out, done_err = utility.done(ctx)
295
+ if done_err ~= nil then
296
+ return out, done_err
297
+ end
298
+
299
+ -- An operation resolves to the ENTITY, not the raw data. Entities are
300
+ -- stateful: post_done has just absorbed resdata/resmatch into this
301
+ -- instance, and the caller reaches the record through data(). Two
302
+ -- structural exceptions: `list` resolves to the ARRAY of entity
303
+ -- instances make_result built, and a failed op with throwing disabled
304
+ -- hands back the error payload unchanged. `remove` additionally marks
305
+ -- the entity deleted; it KEEPS its data, so a caller can still read
306
+ -- what was removed. See AGENTS.md "Entity operations return ENTITIES".
307
+ local opname = ctx.op ~= nil and ctx.op.name or nil
308
+
309
+ if ctx.result ~= nil and ctx.result.ok and opname ~= "list" then
310
+ if opname == "remove" then
311
+ self:mark_deleted()
312
+ end
313
+ return self, nil
314
+ end
315
+
316
+ return out, nil
281
317
  end
282
318
 
283
319
 
@@ -9,10 +9,22 @@ function ProjectNameError.new(code, msg)
9
9
  self.code = code or ""
10
10
  self.msg = msg or ""
11
11
  self.sdk = "ProjectName"
12
+
13
+ -- HTTP status of the response that caused this error, or -1 when the
14
+ -- request never got one. PROMOTED to the top level: it used to be
15
+ -- reachable only at `err.result.status`, so every consumer coupled itself
16
+ -- to the internal shape of `result`.
17
+ self.status = -1
18
+
12
19
  return self
13
20
  end
14
21
 
15
22
 
23
+ function ProjectNameError:not_found()
24
+ return 404 == self.status
25
+ end
26
+
27
+
16
28
  function ProjectNameError:error()
17
29
  return self.sdk .. ": " .. self.code .. ": " .. self.msg
18
30
  end
@@ -41,6 +41,33 @@ function entityOp(opname: string, present: boolean, entityname: string): string
41
41
  post = ` ()\n`
42
42
  }
43
43
 
44
+ // The op resolves to the ENTITY (see Sdk_types). `list` builds one entity
45
+ // per record here, since make_result works in `value` and cannot; `remove`
46
+ // marks the instance. With throwing disabled run_op returns the error
47
+ // payload, which an entity_obj return cannot carry, so that path resolves to
48
+ // the entity too and the caller reads ctrl.err - the mechanism no-throw mode
49
+ // documents anyway.
50
+ const tail =
51
+ 'list' === opname
52
+ ? ` let out = run_op ctx post_done in
53
+ (match out with
54
+ | List items ->
55
+ List.map (fun entry ->
56
+ let e = ent.e_make () in
57
+ (match entry with Map _ -> e.e_data_set entry | _ -> ());
58
+ e)
59
+ !items
60
+ | _ -> []));
61
+ `
62
+ : 'remove' === opname
63
+ ? ` ignore (run_op ctx post_done);
64
+ ent.e_mark_deleted ();
65
+ ent);
66
+ `
67
+ : ` ignore (run_op ctx post_done);
68
+ ent);
69
+ `
70
+
44
71
  return ` ent.${field} <- (fun ${arg} ctrl ->
45
72
  let ${arg} = if is_nullish ${arg} then empty_map () else ${arg} in
46
73
  let ctx = utility.u_make_context
@@ -50,11 +77,11 @@ function entityOp(opname: string, present: boolean, entityname: string): string
50
77
  cs_match = Some ent.e_match; cs_data = Some ent.e_data;
51
78
  ${inputField} = Some ${arg} }
52
79
  (Some entctx) in
53
- run_op ctx (fun () ->
80
+ let post_done () =
54
81
  match ctx.c_result with
55
82
  | Some result ->
56
- ${post} | None -> ()));
57
- `
83
+ ${post} | None -> () in
84
+ ${tail}`
58
85
  }
59
86
 
60
87
 
@@ -76,11 +76,16 @@ let rec make (client : sdk_client) (entopts_in : value) : entity_obj =
76
76
  e_data_get = (fun () -> empty_map ());
77
77
  e_match_set = (fun _ -> ());
78
78
  e_match_get = (fun () -> empty_map ());
79
- e_load = (fun _ _ -> Noval);
80
- e_list = (fun _ _ -> Noval);
81
- e_create = (fun _ _ -> Noval);
82
- e_update = (fun _ _ -> Noval);
83
- e_remove = (fun _ _ -> Noval);
79
+ (* Placeholders: the real closures are installed below. They cannot name
80
+ * \`ent\` here, and the op signatures resolve to entity_obj, so failwith
81
+ * (which types as 'a) stands in. *)
82
+ e_load = (fun _ _ -> failwith "op not installed");
83
+ e_list = (fun _ _ -> failwith "op not installed");
84
+ e_create = (fun _ _ -> failwith "op not installed");
85
+ e_update = (fun _ _ -> failwith "op not installed");
86
+ e_remove = (fun _ _ -> failwith "op not installed");
87
+ e_deleted = false;
88
+ e_mark_deleted = (fun () -> ());
84
89
  e_stream = (fun _ _ _ -> Seq.empty);
85
90
  } in
86
91
  let entctx = utility.u_make_context
@@ -99,6 +104,7 @@ let rec make (client : sdk_client) (entopts_in : value) : entity_obj =
99
104
  utility.u_feature_hook entctx "SetMatch"
100
105
  end);
101
106
  ent.e_match_get <- (fun () -> utility.u_feature_hook entctx "GetMatch"; clone ent.e_match);
107
+ ent.e_mark_deleted <- (fun () -> ent.e_deleted <- true);
102
108
  (* Streaming operation. Runs \`action\` (an op name, e.g. "list") through the
103
109
  * full pipeline and returns a lazy Seq over result items, so the streaming
104
110
  * feature's incremental output is reachable (a normal op call materialises
@@ -3,6 +3,7 @@ import {
3
3
  Content,
4
4
  File,
5
5
  cmp,
6
+ packageVersion,
6
7
  } from '@voxgig/sdkgen'
7
8
 
8
9
 
@@ -15,6 +16,7 @@ import { packageName } from './utility_ocaml'
15
16
  // there is no depends list beyond the OCaml compiler.
16
17
  const Package = cmp(async function Package(props: any) {
17
18
  const ctx$ = props.ctx$
19
+ const target = props.target
18
20
  const model = ctx$.model
19
21
 
20
22
  const pkg = packageName(model)
@@ -22,7 +24,7 @@ const Package = cmp(async function Package(props: any) {
22
24
  File({ name: pkg + '.opam' }, () => {
23
25
  Content(`opam-version: "2.0"
24
26
  name: "${pkg}"
25
- version: "0.0.1"
27
+ version: "${packageVersion(model, target.name)}"
26
28
  synopsis: "${model.const.Name} SDK for OCaml (generated by @voxgig/sdkgen)"
27
29
  maintainer: "voxgig"
28
30
  authors: "voxgig"
@@ -39,11 +39,11 @@ function ocamlType(type: any): string {
39
39
  // The op accessor spelling on the entity_obj record, plus a language-agnostic
40
40
  // description.
41
41
  const OP_DESC: Record<string, { method: string, desc: string }> = {
42
- load: { method: 'e_load reqmatch ctrl', desc: 'Load a single entity by match criteria.' },
43
- list: { method: 'e_list reqmatch ctrl', desc: 'List entities, optionally matching the given criteria.' },
44
- create: { method: 'e_create reqdata ctrl', desc: 'Create a new entity with the given data.' },
45
- update: { method: 'e_update reqdata ctrl', desc: 'Update an existing entity.' },
46
- remove: { method: 'e_remove reqmatch ctrl', desc: 'Remove the matching entity.' },
42
+ load: { method: 'e_load reqmatch ctrl', desc: 'Load a single entity by match criteria. Resolves to the entity.' },
43
+ list: { method: 'e_list reqmatch ctrl', desc: 'List entities, optionally matching the given criteria. Resolves to one entity per record.' },
44
+ create: { method: 'e_create reqdata ctrl', desc: 'Create a new entity with the given data. Resolves to the entity.' },
45
+ update: { method: 'e_update reqdata ctrl', desc: 'Update an existing entity. Resolves to the entity.' },
46
+ remove: { method: 'e_remove reqmatch ctrl', desc: 'Remove the matching entity. Resolves to the entity, marked deleted.' },
47
47
  }
48
48
 
49
49
 
@@ -138,7 +138,9 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
138
138
  Content(`#### Example: Load
139
139
 
140
140
  \`\`\`ocaml
141
+ (* The op resolves to the ENTITY; the record is inside it. *)
141
142
  let ${fn} = (Sdk_client.${fn} client Noval).e_load (${loadArg}) Noval
143
+ let ${fn}_data = ${fn}.e_data_get ()
142
144
  \`\`\`
143
145
 
144
146
  `)
@@ -148,7 +150,9 @@ let ${fn} = (Sdk_client.${fn} client Noval).e_load (${loadArg}) Noval
148
150
  Content(`#### Example: List
149
151
 
150
152
  \`\`\`ocaml
153
+ (* One ENTITY per record. *)
151
154
  let ${fn}s = (Sdk_client.${fn} client Noval).e_list (empty_map ()) Noval
155
+ let ${fn}_datas = List.map (fun e -> e.e_data_get ()) ${fn}s
152
156
  \`\`\`
153
157
 
154
158
  `)
@@ -167,6 +171,7 @@ let ${fn} = (Sdk_client.${fn} client Noval).e_create (jo [
167
171
  `)
168
172
  })
169
173
  Content(`]) Noval
174
+ let ${fn}_data = ${fn}.e_data_get ()
170
175
  \`\`\`
171
176
 
172
177
  `)
@@ -53,9 +53,13 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
53
53
  // The op-driven test-mode line, shown only when the SDK has an entity op.
54
54
  // A direct()-only SDK (no ops anywhere) shows a direct() call instead.
55
55
  const testModeExample = primaryOp
56
- ? `(* Entity ops return the bare record and raise on error. *)
56
+ ? ('list' === primaryOp
57
+ ? `(* Entity ops resolve to the ENTITY (list: one per record) and raise on error. *)
58
+ let ${fn}s = (Sdk_client.${fn} client Noval).${field} ${testArg} Noval in
59
+ List.iter (fun e -> print_endline (stringify (e.e_data_get ()))) ${fn}s (* the mock records *)`
60
+ : `(* Entity ops resolve to the ENTITY and raise on error. *)
57
61
  let ${fn} = (Sdk_client.${fn} client Noval).${field} ${testArg} Noval in
58
- print_endline (stringify ${fn}) (* the mock response record *)`
62
+ print_endline (stringify (${fn}.e_data_get ())) (* the mock response record *)`)
59
63
  : `let result = Sdk_client.direct client (jo [("path", Str "/api/resource"); ("method", Str "GET")]) in
60
64
  print_endline (stringify result)`
61
65
 
@@ -21,11 +21,11 @@ const ReadmeModel = cmp(function ReadmeModel(props: any) {
21
21
  entityList.forEach((e: any) => Object.keys(e.op || {})
22
22
  .forEach((o: string) => { if (e.op[o] && e.op[o].active !== false) opUnion.add(o) }))
23
23
  const opRowDefs: Record<string, string> = {
24
- load: '| `e_load` | `value -> value -> value` | Load a single entity by match criteria. Raises on error. |',
25
- list: '| `e_list` | `value -> value -> value` | List entities matching the criteria (returns a List). Raises on error. |',
26
- create: '| `e_create` | `value -> value -> value` | Create a new entity. Raises on error. |',
27
- update: '| `e_update` | `value -> value -> value` | Update an existing entity. Raises on error. |',
28
- remove: '| `e_remove` | `value -> value -> value` | Remove an entity. Raises on error. |',
24
+ load: '| `e_load` | `value -> value -> entity_obj` | Load a single entity by match criteria. Resolves to the entity. Raises on error. |',
25
+ list: '| `e_list` | `value -> value -> entity_obj list` | List entities matching the criteria. Resolves to one entity per record. Raises on error. |',
26
+ create: '| `e_create` | `value -> value -> entity_obj` | Create a new entity. Resolves to the entity. Raises on error. |',
27
+ update: '| `e_update` | `value -> value -> entity_obj` | Update an existing entity. Resolves to the entity. Raises on error. |',
28
+ remove: '| `e_remove` | `value -> value -> entity_obj` | Remove an entity. Resolves to the entity, marked deleted. Raises on error. |',
29
29
  }
30
30
  const opRows = ['load', 'list', 'create', 'update', 'remove']
31
31
  .filter((o) => opUnion.has(o)).map((o) => opRowDefs[o]).join('\n')
@@ -98,9 +98,11 @@ ${opRows}
98
98
 
99
99
  ### Result shape
100
100
 
101
- Entity operations return the bare result value (a \`Map\` for single-entity
102
- ops, a \`List\` for \`e_list\`) and raise \`Sdk_error.E\` on error. Wrap calls
103
- in \`try\`/\`with\` to handle failures.
101
+ Entity operations resolve to the ENTITY, not the raw record \u2014 \`e_list\` to
102
+ one entity per record \u2014 and raise \`Sdk_error.E\` on error. The record is
103
+ reached through \`e_data_get\`, which returns the entity's data container.
104
+ \`e_remove\` resolves to the entity marked deleted (\`e_deleted\`); it keeps the
105
+ data it held. Wrap calls in \`try\`/\`with\` to handle failures.
104
106
 
105
107
  The \`direct\` escape hatch never raises — it returns a result \`value\` map
106
108
  you branch on via \`getp result "ok"\`: