@voxgig/sdkgen 1.2.0 → 1.3.1

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 (329) hide show
  1. package/bin/voxgig-sdkgen +2 -2
  2. package/dist/action/action.d.ts +2 -1
  3. package/dist/action/action.js +15 -9
  4. package/dist/action/action.js.map +1 -1
  5. package/dist/action/feature.js +6 -3
  6. package/dist/action/feature.js.map +1 -1
  7. package/dist/action/target.d.ts +7 -1
  8. package/dist/action/target.js +13 -6
  9. package/dist/action/target.js.map +1 -1
  10. package/dist/cmp/Changelog.d.ts +2 -0
  11. package/dist/cmp/Changelog.js +30 -0
  12. package/dist/cmp/Changelog.js.map +1 -0
  13. package/dist/cmp/Deploy.d.ts +2 -0
  14. package/dist/cmp/Deploy.js +227 -0
  15. package/dist/cmp/Deploy.js.map +1 -0
  16. package/dist/cmp/FeatureHook.js +5 -6
  17. package/dist/cmp/FeatureHook.js.map +1 -1
  18. package/dist/cmp/License.d.ts +2 -0
  19. package/dist/cmp/License.js +44 -0
  20. package/dist/cmp/License.js.map +1 -0
  21. package/dist/cmp/Readme.js +2 -0
  22. package/dist/cmp/Readme.js.map +1 -1
  23. package/dist/cmp/ReadmeErrors.d.ts +2 -0
  24. package/dist/cmp/ReadmeErrors.js +210 -0
  25. package/dist/cmp/ReadmeErrors.js.map +1 -0
  26. package/dist/cmp/ReadmeExplanation.js +213 -223
  27. package/dist/cmp/ReadmeExplanation.js.map +1 -1
  28. package/dist/cmp/ReadmeModel.js +6 -1
  29. package/dist/cmp/ReadmeModel.js.map +1 -1
  30. package/dist/cmp/ReadmeTop.js +389 -82
  31. package/dist/cmp/ReadmeTop.js.map +1 -1
  32. package/dist/cmp/Security.d.ts +2 -0
  33. package/dist/cmp/Security.js +36 -0
  34. package/dist/cmp/Security.js.map +1 -0
  35. package/dist/helpers/canonType.d.ts +7 -0
  36. package/dist/helpers/canonType.js +74 -0
  37. package/dist/helpers/canonType.js.map +1 -0
  38. package/dist/helpers/collectDeps.d.ts +3 -2
  39. package/dist/helpers/collectDeps.js.map +1 -1
  40. package/dist/helpers/naming.d.ts +3 -0
  41. package/dist/helpers/naming.js +51 -0
  42. package/dist/helpers/naming.js.map +1 -0
  43. package/dist/helpers/opExample.d.ts +13 -0
  44. package/dist/helpers/opExample.js +149 -0
  45. package/dist/helpers/opExample.js.map +1 -0
  46. package/dist/helpers/opShape.d.ts +18 -0
  47. package/dist/helpers/opShape.js +193 -0
  48. package/dist/helpers/opShape.js.map +1 -0
  49. package/dist/helpers/packageMeta.d.ts +27 -0
  50. package/dist/helpers/packageMeta.js +224 -0
  51. package/dist/helpers/packageMeta.js.map +1 -0
  52. package/dist/sdkgen.d.ts +11 -1
  53. package/dist/sdkgen.js +57 -18
  54. package/dist/sdkgen.js.map +1 -1
  55. package/dist/tsconfig.tsbuildinfo +1 -1
  56. package/dist/types.d.ts +65 -2
  57. package/dist/types.js.map +1 -1
  58. package/dist/utility.js +20 -11
  59. package/dist/utility.js.map +1 -1
  60. package/model/sdkgen.aontu +137 -0
  61. package/package.json +13 -6
  62. package/project/.sdk/model/target/go-cli.jsonic +47 -0
  63. package/project/.sdk/model/target/go-mcp.jsonic +41 -0
  64. package/project/.sdk/model/target/go.jsonic +9 -3
  65. package/project/.sdk/model/target/js.jsonic +13 -0
  66. package/project/.sdk/model/target/lua.jsonic +13 -0
  67. package/project/.sdk/model/target/php.jsonic +13 -0
  68. package/project/.sdk/model/target/py.jsonic +13 -0
  69. package/project/.sdk/model/target/rb.jsonic +13 -0
  70. package/project/.sdk/model/target/ts.jsonic +13 -0
  71. package/project/.sdk/src/cmp/go/EntityOperation_go.ts +1 -0
  72. package/project/.sdk/src/cmp/go/EntityTypes_go.ts +197 -0
  73. package/project/.sdk/src/cmp/go/Entity_go.ts +2 -1
  74. package/project/.sdk/src/cmp/go/MainEntity_go.ts +6 -0
  75. package/project/.sdk/src/cmp/go/Main_go.ts +23 -3
  76. package/project/.sdk/src/cmp/go/Package_go.ts +1 -1
  77. package/project/.sdk/src/cmp/go/ReadmeEntity_go.ts +18 -6
  78. package/project/.sdk/src/cmp/go/ReadmeExamplesTest_go.ts +684 -0
  79. package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +1 -1
  80. package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +48 -8
  81. package/project/.sdk/src/cmp/go/ReadmeInstall_go.ts +11 -6
  82. package/project/.sdk/src/cmp/go/ReadmeIntro_go.ts +40 -1
  83. package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +63 -17
  84. package/project/.sdk/src/cmp/go/ReadmeOptions_go.ts +4 -3
  85. package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +124 -115
  86. package/project/.sdk/src/cmp/go/ReadmeRef_go.ts +28 -15
  87. package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +33 -9
  88. package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +35 -5
  89. package/project/.sdk/src/cmp/go/TestEntity_go.ts +1 -1
  90. package/project/.sdk/src/cmp/go/Test_go.ts +5 -1
  91. package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +21 -0
  92. package/project/.sdk/src/cmp/go/fragment/EntityCreateOp.fragment.go +11 -0
  93. package/project/.sdk/src/cmp/go/fragment/EntityListOp.fragment.go +11 -0
  94. package/project/.sdk/src/cmp/go/fragment/EntityLoadOp.fragment.go +11 -0
  95. package/project/.sdk/src/cmp/go/fragment/EntityRemoveOp.fragment.go +11 -0
  96. package/project/.sdk/src/cmp/go/fragment/EntityUpdateOp.fragment.go +11 -0
  97. package/project/.sdk/src/cmp/go-cli/Main_go-cli.ts +195 -0
  98. package/project/.sdk/src/cmp/go-cli/fragment/main.fragment.go +106 -0
  99. package/project/.sdk/src/cmp/go-cli/fragment/words.fragment.go +132 -0
  100. package/project/.sdk/src/cmp/go-mcp/Main_go-mcp.ts +184 -0
  101. package/project/.sdk/src/cmp/go-mcp/fragment/main.fragment.go +68 -0
  102. package/project/.sdk/src/cmp/go-mcp/fragment/tools.fragment.go +114 -0
  103. package/project/.sdk/src/cmp/js/EntityTypes_js.ts +111 -0
  104. package/project/.sdk/src/cmp/js/MainEntity_js.ts +1 -0
  105. package/project/.sdk/src/cmp/js/Main_js.ts +3 -0
  106. package/project/.sdk/src/cmp/js/Package_js.ts +16 -7
  107. package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +13 -7
  108. package/project/.sdk/src/cmp/js/ReadmeExplanation_js.ts +2 -2
  109. package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +52 -11
  110. package/project/.sdk/src/cmp/js/ReadmeIntro_js.ts +39 -1
  111. package/project/.sdk/src/cmp/js/ReadmeModel_js.ts +50 -18
  112. package/project/.sdk/src/cmp/js/ReadmeOptions_js.ts +4 -3
  113. package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +45 -19
  114. package/project/.sdk/src/cmp/js/ReadmeRef_js.ts +24 -13
  115. package/project/.sdk/src/cmp/js/ReadmeTopHowto_js.ts +3 -0
  116. package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +28 -12
  117. package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +23 -3
  118. package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +5 -0
  119. package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +5 -0
  120. package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +5 -0
  121. package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +5 -0
  122. package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +5 -0
  123. package/project/.sdk/src/cmp/js/utility_js.ts +57 -0
  124. package/project/.sdk/src/cmp/lua/EntityTypes_lua.ts +113 -0
  125. package/project/.sdk/src/cmp/lua/MainEntity_lua.ts +8 -0
  126. package/project/.sdk/src/cmp/lua/Main_lua.ts +4 -0
  127. package/project/.sdk/src/cmp/lua/Package_lua.ts +23 -4
  128. package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +12 -10
  129. package/project/.sdk/src/cmp/lua/ReadmeExamplesTest_lua.ts +293 -0
  130. package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +46 -8
  131. package/project/.sdk/src/cmp/lua/ReadmeInstall_lua.ts +19 -3
  132. package/project/.sdk/src/cmp/lua/ReadmeIntro_lua.ts +38 -1
  133. package/project/.sdk/src/cmp/lua/ReadmeModel_lua.ts +51 -16
  134. package/project/.sdk/src/cmp/lua/ReadmeOptions_lua.ts +4 -3
  135. package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +79 -18
  136. package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +25 -20
  137. package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +17 -9
  138. package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +32 -5
  139. package/project/.sdk/src/cmp/lua/Test_lua.ts +4 -0
  140. package/project/.sdk/src/cmp/lua/fragment/EntityCreateOp.fragment.lua +4 -0
  141. package/project/.sdk/src/cmp/lua/fragment/EntityListOp.fragment.lua +4 -0
  142. package/project/.sdk/src/cmp/lua/fragment/EntityLoadOp.fragment.lua +4 -0
  143. package/project/.sdk/src/cmp/lua/fragment/EntityRemoveOp.fragment.lua +4 -0
  144. package/project/.sdk/src/cmp/lua/fragment/EntityUpdateOp.fragment.lua +4 -0
  145. package/project/.sdk/src/cmp/php/EntityTypes_php.ts +142 -0
  146. package/project/.sdk/src/cmp/php/MainEntity_php.ts +18 -1
  147. package/project/.sdk/src/cmp/php/Main_php.ts +4 -0
  148. package/project/.sdk/src/cmp/php/Package_php.ts +18 -7
  149. package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +15 -11
  150. package/project/.sdk/src/cmp/php/ReadmeExamplesTest_php.ts +401 -0
  151. package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +56 -13
  152. package/project/.sdk/src/cmp/php/ReadmeInstall_php.ts +15 -3
  153. package/project/.sdk/src/cmp/php/ReadmeIntro_php.ts +40 -1
  154. package/project/.sdk/src/cmp/php/ReadmeModel_php.ts +26 -8
  155. package/project/.sdk/src/cmp/php/ReadmeOptions_php.ts +4 -3
  156. package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +80 -22
  157. package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +51 -42
  158. package/project/.sdk/src/cmp/php/ReadmeTopHowto_php.ts +1 -1
  159. package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +19 -11
  160. package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +41 -11
  161. package/project/.sdk/src/cmp/php/TestDirect_php.ts +9 -9
  162. package/project/.sdk/src/cmp/php/TestEntity_php.ts +6 -12
  163. package/project/.sdk/src/cmp/php/Test_php.ts +4 -0
  164. package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +13 -1
  165. package/project/.sdk/src/cmp/php/fragment/EntityCreateOp.fragment.php +10 -1
  166. package/project/.sdk/src/cmp/php/fragment/EntityListOp.fragment.php +10 -1
  167. package/project/.sdk/src/cmp/php/fragment/EntityLoadOp.fragment.php +10 -1
  168. package/project/.sdk/src/cmp/php/fragment/EntityRemoveOp.fragment.php +10 -1
  169. package/project/.sdk/src/cmp/php/fragment/EntityUpdateOp.fragment.php +10 -1
  170. package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +22 -14
  171. package/project/.sdk/src/cmp/py/EntityTypes_py.ts +184 -0
  172. package/project/.sdk/src/cmp/py/Entity_py.ts +27 -0
  173. package/project/.sdk/src/cmp/py/MainEntity_py.ts +2 -1
  174. package/project/.sdk/src/cmp/py/Main_py.ts +35 -0
  175. package/project/.sdk/src/cmp/py/Package_py.ts +24 -3
  176. package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +27 -11
  177. package/project/.sdk/src/cmp/py/ReadmeExamplesTest_py.ts +626 -0
  178. package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +53 -14
  179. package/project/.sdk/src/cmp/py/ReadmeInstall_py.ts +19 -3
  180. package/project/.sdk/src/cmp/py/ReadmeIntro_py.ts +48 -1
  181. package/project/.sdk/src/cmp/py/ReadmeModel_py.ts +28 -10
  182. package/project/.sdk/src/cmp/py/ReadmeOptions_py.ts +4 -3
  183. package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +73 -24
  184. package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +57 -37
  185. package/project/.sdk/src/cmp/py/ReadmeTopHowto_py.ts +1 -1
  186. package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +19 -11
  187. package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +30 -5
  188. package/project/.sdk/src/cmp/py/TestDirect_py.ts +7 -9
  189. package/project/.sdk/src/cmp/py/TestEntity_py.ts +6 -14
  190. package/project/.sdk/src/cmp/py/Test_py.ts +4 -0
  191. package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +5 -2
  192. package/project/.sdk/src/cmp/py/fragment/EntityCreateOp.fragment.py +1 -1
  193. package/project/.sdk/src/cmp/py/fragment/EntityListOp.fragment.py +5 -1
  194. package/project/.sdk/src/cmp/py/fragment/EntityLoadOp.fragment.py +6 -1
  195. package/project/.sdk/src/cmp/py/fragment/EntityRemoveOp.fragment.py +6 -1
  196. package/project/.sdk/src/cmp/py/fragment/EntityUpdateOp.fragment.py +1 -1
  197. package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +17 -10
  198. package/project/.sdk/src/cmp/rb/EntityTypes_rb.ts +136 -0
  199. package/project/.sdk/src/cmp/rb/MainEntity_rb.ts +1 -0
  200. package/project/.sdk/src/cmp/rb/Main_rb.ts +4 -0
  201. package/project/.sdk/src/cmp/rb/Package_rb.ts +34 -7
  202. package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +26 -10
  203. package/project/.sdk/src/cmp/rb/ReadmeExamplesTest_rb.ts +289 -0
  204. package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +72 -21
  205. package/project/.sdk/src/cmp/rb/ReadmeInstall_rb.ts +16 -4
  206. package/project/.sdk/src/cmp/rb/ReadmeIntro_rb.ts +40 -1
  207. package/project/.sdk/src/cmp/rb/ReadmeModel_rb.ts +29 -12
  208. package/project/.sdk/src/cmp/rb/ReadmeOptions_rb.ts +4 -3
  209. package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +85 -22
  210. package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +56 -37
  211. package/project/.sdk/src/cmp/rb/ReadmeTopHowto_rb.ts +1 -1
  212. package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +19 -11
  213. package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +43 -11
  214. package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +9 -9
  215. package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +6 -12
  216. package/project/.sdk/src/cmp/rb/Test_rb.ts +4 -0
  217. package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +2 -0
  218. package/project/.sdk/src/cmp/rb/fragment/EntityCreateOp.fragment.rb +5 -0
  219. package/project/.sdk/src/cmp/rb/fragment/EntityListOp.fragment.rb +20 -2
  220. package/project/.sdk/src/cmp/rb/fragment/EntityLoadOp.fragment.rb +8 -1
  221. package/project/.sdk/src/cmp/rb/fragment/EntityRemoveOp.fragment.rb +6 -1
  222. package/project/.sdk/src/cmp/rb/fragment/EntityUpdateOp.fragment.rb +5 -0
  223. package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +24 -8
  224. package/project/.sdk/src/cmp/ts/EntityTypes_ts.ts +105 -0
  225. package/project/.sdk/src/cmp/ts/Entity_ts.ts +17 -1
  226. package/project/.sdk/src/cmp/ts/MainEntity_ts.ts +1 -0
  227. package/project/.sdk/src/cmp/ts/Main_ts.ts +6 -0
  228. package/project/.sdk/src/cmp/ts/Package_ts.ts +14 -7
  229. package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +13 -7
  230. package/project/.sdk/src/cmp/ts/ReadmeExampleTest_ts.ts +81 -0
  231. package/project/.sdk/src/cmp/ts/ReadmeExamplesTest_ts.ts +446 -0
  232. package/project/.sdk/src/cmp/ts/ReadmeExplanation_ts.ts +2 -2
  233. package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +57 -11
  234. package/project/.sdk/src/cmp/ts/ReadmeInstall_ts.ts +19 -6
  235. package/project/.sdk/src/cmp/ts/ReadmeIntro_ts.ts +39 -1
  236. package/project/.sdk/src/cmp/ts/ReadmeModel_ts.ts +50 -18
  237. package/project/.sdk/src/cmp/ts/ReadmeOptions_ts.ts +4 -3
  238. package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +95 -40
  239. package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +24 -13
  240. package/project/.sdk/src/cmp/ts/ReadmeTopHowto_ts.ts +3 -0
  241. package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +44 -12
  242. package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +23 -3
  243. package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +2 -2
  244. package/project/.sdk/src/cmp/ts/Test_ts.ts +5 -0
  245. package/project/.sdk/src/cmp/ts/fragment/Entity.fragment.ts +3 -1
  246. package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +10 -5
  247. package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +4 -2
  248. package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +4 -2
  249. package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +4 -2
  250. package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +4 -2
  251. package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +4 -2
  252. package/project/.sdk/src/cmp/ts/utility_ts.ts +59 -0
  253. package/project/.sdk/tm/go/LICENSE +1 -1
  254. package/project/.sdk/tm/go/Makefile +36 -1
  255. package/project/.sdk/tm/go/VERSION +1 -0
  256. package/project/.sdk/tm/go/core/context.go +12 -7
  257. package/project/.sdk/tm/go-cli/src/feature/README.md +6 -0
  258. package/project/.sdk/tm/go-cli/src/feature/base/.gitkeep +0 -0
  259. package/project/.sdk/tm/go-cli/src/feature/log/.gitkeep +0 -0
  260. package/project/.sdk/tm/go-cli/src/feature/test/.gitkeep +0 -0
  261. package/project/.sdk/tm/go-mcp/src/feature/README.md +6 -0
  262. package/project/.sdk/tm/go-mcp/src/feature/base/.gitkeep +0 -0
  263. package/project/.sdk/tm/go-mcp/src/feature/log/.gitkeep +0 -0
  264. package/project/.sdk/tm/go-mcp/src/feature/test/.gitkeep +0 -0
  265. package/project/.sdk/tm/js/LICENSE +1 -1
  266. package/project/.sdk/tm/js/Makefile +41 -0
  267. package/project/.sdk/tm/lua/LICENSE +1 -1
  268. package/project/.sdk/tm/lua/Makefile +40 -1
  269. package/project/.sdk/tm/lua/core/context.lua +13 -8
  270. package/project/.sdk/tm/php/LICENSE +1 -1
  271. package/project/.sdk/tm/php/Makefile +31 -1
  272. package/project/.sdk/tm/php/VERSION +1 -0
  273. package/project/.sdk/tm/php/core/Context.php +12 -6
  274. package/project/.sdk/tm/php/test/PrimaryUtilityTest.php +13 -4
  275. package/project/.sdk/tm/php/utility/Done.php +2 -2
  276. package/project/.sdk/tm/php/utility/MakeError.php +3 -3
  277. package/project/.sdk/tm/py/LICENSE +1 -1
  278. package/project/.sdk/tm/py/Makefile +34 -1
  279. package/project/.sdk/tm/py/core/context.py +12 -7
  280. package/project/.sdk/tm/py/test/test_primary_utility.py +15 -4
  281. package/project/.sdk/tm/py/utility/done.py +3 -1
  282. package/project/.sdk/tm/py/utility/make_error.py +2 -2
  283. package/project/.sdk/tm/rb/LICENSE +1 -1
  284. package/project/.sdk/tm/rb/Makefile +33 -1
  285. package/project/.sdk/tm/rb/core/context.rb +8 -3
  286. package/project/.sdk/tm/rb/test/primary_utility_test.rb +2 -2
  287. package/project/.sdk/tm/rb/utility/done.rb +3 -1
  288. package/project/.sdk/tm/rb/utility/make_error.rb +5 -2
  289. package/project/.sdk/tm/ts/LICENSE +1 -1
  290. package/project/.sdk/tm/ts/Makefile +42 -0
  291. package/project/.sdk/tm/ts/src/Context.ts +8 -3
  292. package/src/action/action.ts +17 -10
  293. package/src/action/feature.ts +8 -6
  294. package/src/action/target.ts +17 -8
  295. package/src/cmp/Changelog.ts +34 -0
  296. package/src/cmp/Deploy.ts +258 -0
  297. package/src/cmp/FeatureHook.ts +6 -8
  298. package/src/cmp/License.ts +49 -0
  299. package/src/cmp/Readme.ts +2 -0
  300. package/src/cmp/ReadmeErrors.ts +257 -0
  301. package/src/cmp/ReadmeExplanation.ts +250 -230
  302. package/src/cmp/ReadmeModel.ts +7 -2
  303. package/src/cmp/ReadmeTop.ts +411 -95
  304. package/src/cmp/Security.ts +41 -0
  305. package/src/helpers/canonType.ts +89 -0
  306. package/src/helpers/collectDeps.ts +5 -3
  307. package/src/helpers/naming.ts +59 -0
  308. package/src/helpers/opExample.ts +170 -0
  309. package/src/helpers/opShape.ts +236 -0
  310. package/src/helpers/packageMeta.ts +236 -0
  311. package/src/sdkgen.ts +87 -20
  312. package/src/tsconfig.json +1 -0
  313. package/src/types.ts +85 -2
  314. package/src/utility.ts +22 -11
  315. package/README.md +0 -2
  316. package/dist/action/lang.d.ts +0 -2
  317. package/dist/action/lang.js +0 -68
  318. package/dist/action/lang.js.map +0 -1
  319. package/dist/cmp/Hook.d.ts +0 -2
  320. package/dist/cmp/Hook.js +0 -10
  321. package/dist/cmp/Hook.js.map +0 -1
  322. package/dist/cmp/Top.d.ts +0 -2
  323. package/dist/cmp/Top.js +0 -23
  324. package/dist/cmp/Top.js.map +0 -1
  325. package/dist/prepare-openapi.d.ts +0 -2
  326. package/dist/prepare-openapi.js +0 -37
  327. package/dist/prepare-openapi.js.map +0 -1
  328. package/model/sdkgen.jsonic +0 -74
  329. package/project/.sdk/tm/go/utility/struct/go.mod +0 -3
@@ -1,16 +1,29 @@
1
1
 
2
- import { cmp, Content } from '@voxgig/sdkgen'
2
+ import { cmp, Content, installCommand, isPublished, repoInfo } from '@voxgig/sdkgen'
3
3
 
4
4
 
5
5
  const ReadmeInstall = cmp(function ReadmeInstall(props: any) {
6
- const { target } = props
6
+ const { target, ctx$ } = props
7
+ const { model } = ctx$
7
8
 
8
- Content('```bash')
9
- Content(`
10
- npm install ${target.module.name}
9
+ if (isPublished(model, target.name)) {
10
+ Content('```bash')
11
+ Content(`
12
+ ${installCommand(model, target.name)}
11
13
  `)
12
- Content('```')
14
+ Content('```')
15
+ return
16
+ }
13
17
 
18
+ // Publish pending: the package is not yet on npm, so install from the
19
+ // git release tag instead of a `npm install` that would 404.
20
+ const { releasesUrl } = repoInfo(model)
21
+ Content(`This package is not yet published to npm. Install it from the GitHub
22
+ release tag (\`${target.name}/vX.Y.Z\`):
23
+
24
+ - Releases: [${releasesUrl}](${releasesUrl})
25
+
26
+ `)
14
27
  })
15
28
 
16
29
 
@@ -1,13 +1,51 @@
1
1
 
2
2
  import { cmp, Content } from '@voxgig/sdkgen'
3
3
 
4
+ import {
5
+ KIT,
6
+ getModelPath,
7
+ nom,
8
+ } from '@voxgig/apidef'
9
+
4
10
 
5
11
  const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
6
12
  const { target, ctx$: { model } } = props
13
+ const info = (model.main && model.main.kit && model.main.kit.info) || {}
14
+ const tagline = info.tagline || ''
15
+
16
+ const entity = getModelPath(model, `main.${KIT}.entity`)
17
+ const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
18
+ const eName = exampleEntity ? nom(exampleEntity, 'Name') : 'Entity'
19
+
20
+ // Model-driven op list — only the operations the active entities actually
21
+ // expose (a read-only entity has just list+load); never claim
22
+ // create/update/remove exist when no entity has them.
23
+ const CANON_OPS = ['list', 'load', 'create', 'update', 'remove']
24
+ const opSet = new Set<string>()
25
+ Object.values(entity || {}).forEach((e: any) => {
26
+ if (!e || e.active === false) return
27
+ Object.keys(e.op || {}).forEach((o: string) => {
28
+ if (e.op[o] && e.op[o].active !== false) opSet.add(o)
29
+ })
30
+ })
31
+ const opNames = CANON_OPS.filter((o) => opSet.has(o))
32
+ .concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
33
+ const opList = (opNames.length ? opNames : ['list', 'load'])
34
+ .map((o) => '`' + o + '`').join(', ')
7
35
 
8
36
  Content(`# ${model.Name} ${target.title} SDK
9
37
 
10
- The ${target.title} SDK for the ${model.Name} API. Provides a type-safe, entity-oriented interface with full async/await support.
38
+ ${tagline}
39
+
40
+ The ${target.title} SDK for the ${model.Name} API — a type-safe, entity-oriented client with full async/await support.
41
+
42
+ The API is exposed as capitalised, semantic **Entities** — e.g.
43
+ \`client.${eName}()\` — each with a small set of operations (${opList})
44
+ instead of raw URL paths and query parameters. This keeps the surface
45
+ predictable and low-friction for both humans and AI agents.
46
+
47
+ > Other languages, the CLI, and MCP server live alongside this one — see
48
+ > the [top-level README](../README.md).
11
49
 
12
50
  `)
13
51
  })
@@ -13,6 +13,43 @@ const ReadmeModel = cmp(function ReadmeModel(props: any) {
13
13
  const entity = getModelPath(model, `main.${KIT}.entity`)
14
14
  const entityList = each(entity).filter((e: any) => e.active !== false)
15
15
 
16
+ // Model-driven op rows for the shared entity interface: emit a
17
+ // load/list/create/update/remove row only for operations at least one active
18
+ // entity actually exposes (a read-only entity has just list+load) — never
19
+ // document an operation no entity has.
20
+ const opUnion = new Set<string>()
21
+ entityList.forEach((e: any) => Object.keys(e.op || {})
22
+ .forEach((o: string) => { if (e.op[o] && e.op[o].active !== false) opUnion.add(o) }))
23
+ const opRowDefs: Record<string, string> = {
24
+ load: '| `load` | `load(reqmatch?, ctrl?): Promise<Entity>` | Load a single entity by match criteria. |',
25
+ list: '| `list` | `list(reqmatch?, ctrl?): Promise<Entity[]>` | List entities matching the criteria. |',
26
+ create: '| `create` | `create(reqdata?, ctrl?): Promise<Entity>` | Create a new entity. |',
27
+ update: '| `update` | `update(reqdata?, ctrl?): Promise<Entity>` | Update an existing entity. |',
28
+ remove: '| `remove` | `remove(reqmatch?, ctrl?): Promise<void>` | Remove an entity. |',
29
+ }
30
+ const opRows = ['load', 'list', 'create', 'update', 'remove']
31
+ .filter((o) => opUnion.has(o)).map((o) => opRowDefs[o]).join('\n')
32
+
33
+ // Model-driven return-value bullets: describe only the operations that
34
+ // actually exist (single-object ops among load/create/update, plus
35
+ // list/remove) — never document return semantics for a missing op.
36
+ const singleOps = ['load', 'create', 'update'].filter((o) => opUnion.has(o))
37
+ .map((o) => '`' + o + '`')
38
+ const retBullets: string[] = []
39
+ if (singleOps.length) {
40
+ const joined = singleOps.length > 1
41
+ ? singleOps.slice(0, -1).join(', ') + ' and ' + singleOps[singleOps.length - 1]
42
+ : singleOps[0]
43
+ retBullets.push(`- ${joined} ${singleOps.length > 1 ? 'resolve' : 'resolves'} to a single entity object.`)
44
+ }
45
+ if (opUnion.has('list')) {
46
+ retBullets.push('- `list` resolves to an **array** of entity objects (iterate it directly;\n there is no `.data` and no `.ok`).')
47
+ }
48
+ if (opUnion.has('remove')) {
49
+ retBullets.push('- `remove` resolves to `void`.')
50
+ }
51
+ const returnBullets = retBullets.join('\n')
52
+
16
53
  const authActive = isAuthActive(model)
17
54
  const apikeyOptionType = authActive ? `\n apikey?: string` : ''
18
55
  const apikeyOptionRow = authActive
@@ -52,7 +89,8 @@ ${apikeyOptionRow}| \`base\` | \`string\` | Base URL of the API server. |
52
89
  `)
53
90
 
54
91
  each(entityList, (ent: any) => {
55
- Content(`| \`${ent.Name}(data?)\` | \`${ent.Name}Entity\` | Create a ${ent.Name} entity instance. |
92
+ const article = /^[aeiou]/i.test(ent.Name) ? 'an' : 'a'
93
+ Content(`| \`${ent.Name}(data?)\` | \`${ent.Name}Entity\` | Create ${article} ${ent.Name} entity instance. |
56
94
  `)
57
95
  })
58
96
 
@@ -72,29 +110,23 @@ All entities share the same interface.
72
110
 
73
111
  | Method | Signature | Description |
74
112
  | --- | --- | --- |
75
- | \`load\` | \`load(reqmatch?, ctrl?): Promise<Result>\` | Load a single entity by match criteria. |
76
- | \`list\` | \`list(reqmatch?, ctrl?): Promise<Result>\` | List entities matching the criteria. |
77
- | \`create\` | \`create(reqdata?, ctrl?): Promise<Result>\` | Create a new entity. |
78
- | \`update\` | \`update(reqdata?, ctrl?): Promise<Result>\` | Update an existing entity. |
79
- | \`remove\` | \`remove(reqmatch?, ctrl?): Promise<Result>\` | Remove an entity. |
80
- | \`data\` | \`data(data?): any\` | Get or set entity data. |
81
- | \`match\` | \`match(match?): any\` | Get or set entity match criteria. |
113
+ ${opRows}
114
+ | \`data\` | \`data(data?: Partial<Entity>): Entity\` | Get or set entity data. |
115
+ | \`match\` | \`match(match?: Partial<Entity>): Partial<Entity>\` | Get or set entity match criteria. |
82
116
  | \`make\` | \`make(): Entity\` | Create a new instance with the same options. |
83
117
  | \`client\` | \`client(): ${model.const.Name}SDK\` | Return the parent SDK client. |
84
118
  | \`entopts\` | \`entopts(): object\` | Return a copy of the entity options. |
85
119
 
86
- #### Result shape
120
+ #### Return values
87
121
 
88
- All entity operations return a Result object:
122
+ Entity operations resolve to the entity data directly there is no
123
+ result envelope:
89
124
 
90
- \`\`\`ts
91
- {
92
- ok: boolean // true if the HTTP status is 2xx
93
- status: number // HTTP status code
94
- headers: object // response headers
95
- data: any // parsed JSON response body
96
- }
97
- \`\`\`
125
+ ${returnBullets}
126
+
127
+ On a failed request these methods **throw**, so wrap calls in
128
+ \`try\`/\`catch\` to handle errors. Only \`direct()\` returns the result
129
+ envelope described below.
98
130
 
99
131
  ### DirectResult shape
100
132
 
@@ -1,12 +1,13 @@
1
1
 
2
- import { cmp, each, Content } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, envName, isAuthActive } from '@voxgig/sdkgen'
3
3
 
4
4
 
5
5
  const ReadmeOptions = cmp(function ReadmeOptions(props: any) {
6
6
  const { target } = props
7
7
  const { model } = props.ctx$
8
8
 
9
- const publishedOptions = each(target.options).filter((option: any) => option.publish)
9
+ const publishedOptions = each(target.options).filter((option: any) =>
10
+ option.publish && ('apikey' !== option.name || isAuthActive(model)))
10
11
  if (0 === publishedOptions.length) {
11
12
  return
12
13
  }
@@ -25,7 +26,7 @@ const client = new ${model.Name}SDK({
25
26
 
26
27
  publishedOptions.map((option: any) => {
27
28
  if ('apikey' === option.name) {
28
- Content(` ${option.name}: process.env.${model.NAME}_APIKEY,
29
+ Content(` ${option.name}: process.env.${envName(model)}_APIKEY,
29
30
  `)
30
31
  }
31
32
  else {
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, isAuthActive } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, isAuthActive, packageName, envName, opRequestShape, entityIdField, entityDataIdField, safeVarName } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -7,6 +7,8 @@ import {
7
7
  nom,
8
8
  } from '@voxgig/apidef'
9
9
 
10
+ import { exampleValue } from './utility_ts'
11
+
10
12
 
11
13
  const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
12
14
  const { target, ctx$: { model } } = props
@@ -21,16 +23,16 @@ const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
21
23
  e.active !== false && e.ancestors && e.ancestors.length > 0
22
24
  ) as any
23
25
 
24
- const apikeyArg = isAuthActive(model)
25
- ? `\n apikey: process.env.${model.NAME}_APIKEY,\n`
26
- : ''
26
+ const ctor = isAuthActive(model)
27
+ ? `new ${model.const.Name}SDK({\n apikey: process.env.${envName(model)}_APIKEY,\n})`
28
+ : `new ${model.const.Name}SDK()`
27
29
 
28
30
  Content(`### 1. Create a client
29
31
 
30
32
  \`\`\`ts
31
- import { ${model.const.Name}SDK } from '${target.module.name}'
33
+ import { ${model.const.Name}SDK } from '${packageName(model, target.name)}'
32
34
 
33
- const client = new ${model.const.Name}SDK({${apikeyArg}})
35
+ const client = ${ctor}
34
36
  \`\`\`
35
37
 
36
38
  `)
@@ -38,18 +40,30 @@ const client = new ${model.const.Name}SDK({${apikeyArg}})
38
40
 
39
41
  if (exampleEntity) {
40
42
  const eName = nom(exampleEntity, 'Name')
43
+ // Variable-safe lowercase name — a `Delete`/`Class` entity must not bind a
44
+ // reserved word (`const delete = ...` is a TS1109 syntax error).
45
+ const eVar = safeVarName(eName.toLowerCase(), 'ts')
46
+ const article = /^[aeiou]/i.test(eName) ? 'an' : 'a'
41
47
  const opnames = Object.keys(exampleEntity.op || {})
48
+ // Model-driven id key: `idF` is the entity's id-like MATCH field name, or
49
+ // null when it has none (then load/remove match on no argument).
50
+ const idF = entityIdField(exampleEntity)
51
+ // The id field on the RETURNED record's data type, or null. DISTINCT from
52
+ // idF (the match key): an entity can key its load-match on an id it does not
53
+ // carry as a data field, so `.id` off a returned record must be guarded on
54
+ // this — reading `created.id` when the data type has no id is a TS2339.
55
+ const dataIdF = entityDataIdField(exampleEntity)
42
56
 
43
57
  if (opnames.includes('list')) {
44
- Content(`### 2. List ${eName.toLowerCase()}s
58
+ Content(`### 2. List ${eName.toLowerCase()} records
59
+
60
+ \`list()\` resolves to an array of ${eName} objects — iterate it directly:
45
61
 
46
62
  \`\`\`ts
47
- const result = await client.${eName}().list()
63
+ const ${eVar}s = await client.${eName}().list()
48
64
 
49
- if (result.ok) {
50
- for (const item of result.data) {
51
- console.log(item.id, item.name)
52
- }
65
+ for (const ${eVar} of ${eVar}s) {
66
+ console.log(${eVar})
53
67
  }
54
68
  \`\`\`
55
69
 
@@ -58,70 +72,111 @@ if (result.ok) {
58
72
 
59
73
  if (nestedEntity) {
60
74
  const neName = nom(nestedEntity, 'Name')
75
+ const neVar = safeVarName(neName.toLowerCase(), 'ts')
76
+ const neArticle = /^[aeiou]/i.test(neName) ? 'an' : 'a'
61
77
  const parentFields = (nestedEntity.fields || [])
62
78
  .filter((f: any) => f.name !== 'id' && f.name.endsWith('_id'))
63
79
  const parentParam = parentFields.length > 0 ? parentFields[0].name : 'parent_id'
80
+ const loadOp = nestedEntity.op && nestedEntity.op.load
81
+
82
+ // Model-driven id key: only emit an id match line if this nested entity
83
+ // actually has an id-like key field (some response-wrapped specs do not).
84
+ const neIdF = entityIdField(nestedEntity)
85
+ const neMatchLines = [` ${parentParam}: ${exampleValue(nestedEntity, loadOp, parentParam, 'example')},`]
86
+ if (neIdF) {
87
+ neMatchLines.push(` ${neIdF}: ${exampleValue(nestedEntity, loadOp, neIdF, 'example_id')},`)
88
+ }
64
89
 
65
- Content(`### 3. Load a ${neName.toLowerCase()}
90
+ Content(`### 3. Load ${neArticle} ${neName.toLowerCase()}
66
91
 
67
- ${neName} is nested under ${eName}, so provide the \`${parentParam}\`:
92
+ ${neName} is nested under ${eName}, so provide the \`${parentParam}\`.
93
+ \`load()\` returns the entity directly and throws on failure:
68
94
 
69
95
  \`\`\`ts
70
- const ${neName.toLowerCase()} = client.${neName}()
71
- const result = await ${neName.toLowerCase()}.load({
72
- ${parentParam}: 'example',
73
- id: 'example_id',
74
- })
75
-
76
- if (result.ok) {
77
- console.log(result.data)
96
+ try {
97
+ const ${neVar} = await client.${neName}().load({
98
+ ${neMatchLines.join('\n')}
99
+ })
100
+ console.log(${neVar})
101
+ } catch (err) {
102
+ console.error('load failed:', err)
78
103
  }
79
104
  \`\`\`
80
105
 
81
106
  `)
82
107
  }
83
108
  else if (opnames.includes('load')) {
84
- Content(`### 3. Load a ${eName.toLowerCase()}
109
+ Content(`### 3. Load ${article} ${eName.toLowerCase()}
85
110
 
86
- \`\`\`ts
87
- const result = await client.${eName}().load({ id: 'example_id' })
111
+ \`load()\` returns the entity directly and throws on failure:
88
112
 
89
- if (result.ok) {
90
- console.log(result.data)
113
+ \`\`\`ts
114
+ try {
115
+ const ${eVar} = await client.${eName}().load(${idF ? `{ ${idF}: ${exampleValue(exampleEntity, exampleEntity.op && exampleEntity.op.load, idF, 'example_id')} }` : ''})
116
+ console.log(${eVar})
117
+ } catch (err) {
118
+ console.error('load failed:', err)
91
119
  }
92
120
  \`\`\`
93
121
 
94
122
  `)
95
123
  }
96
124
 
97
- // CRUD operations
125
+ // CRUD operations. The create/update example payloads are derived from the
126
+ // SAME op shapes that generate the <Name>CreateData / <Name>UpdateData types
127
+ // (opRequestShape), so the snippet always type-checks. Prefer writable
128
+ // non-id fields and render a type-correct literal per field via
129
+ // exampleValue — never a hardcoded field the entity may not have.
98
130
  if (opnames.includes('create') || opnames.includes('update') || opnames.includes('remove')) {
131
+ // Writable non-id example fields for an op body. For create the REQUIRED
132
+ // fields must all appear or the literal is not assignable to the typed
133
+ // <Name>CreateData (a TS2345); update is a patch, so a couple of fields
134
+ // suffice.
135
+ const exampleFields = (opname: string): string[] => {
136
+ const items = opRequestShape(exampleEntity, opname).items
137
+ .filter((it: any) => it.name !== idF && it.name !== 'id')
138
+ const required = items.filter((it: any) => !it.optional)
139
+ const chosen = 'create' === opname
140
+ ? (required.length ? required : items.slice(0, 2))
141
+ : items.slice(0, 2)
142
+ return chosen.map((it: any) =>
143
+ ` ${it.name}: ${exampleValue(exampleEntity, exampleEntity.op[opname], it.name, 'example_' + it.name)},`)
144
+ }
145
+
146
+ // The id VALUE for an update/remove match. When the entity's DATA type
147
+ // carries the id (dataIdF) AND a `created` record exists, take it off the
148
+ // returned record; otherwise use a type-correct literal — reading
149
+ // `created.id` off an id-less data type is a TS2339.
150
+ const canUseCreatedId = null != dataIdF && opnames.includes('create')
151
+ const idValueFor = (opname: string): string => canUseCreatedId
152
+ ? `created.${dataIdF}!`
153
+ : exampleValue(exampleEntity, exampleEntity.op[opname], idF as string, 'example_id')
154
+
99
155
  Content(`### 4. Create, update, and remove
100
156
 
101
157
  \`\`\`ts
102
158
  `)
103
159
  if (opnames.includes('create')) {
104
- Content(`// Create
105
- const created = await client.${eName}().create({
106
- name: 'Example',
107
- })
160
+ const createLines = exampleFields('create')
161
+ const createBody = createLines.length ? '\n' + createLines.join('\n') + '\n' : ''
162
+ Content(`// Create — returns the created ${eName}
163
+ const created = await client.${eName}().create({${createBody}})
108
164
 
109
165
  `)
110
166
  }
111
167
  if (opnames.includes('update')) {
112
- Content(`// Update
113
- const updated = await client.${eName}().update({
114
- id: created.data.id,
115
- name: 'Example-Renamed',
116
- })
168
+ // Match on the id (from the returned `created` record when the data
169
+ // type carries one, else a literal), plus a couple of patch fields.
170
+ const updateLines = (idF ? [` ${idF}: ${idValueFor('update')},`] : []).concat(exampleFields('update'))
171
+ const updateBody = updateLines.length ? '\n' + updateLines.join('\n') + '\n' : ''
172
+ Content(`// Update${canUseCreatedId ? ' — the id comes straight off the returned entity' : ''}
173
+ const updated = await client.${eName}().update({${updateBody}})
117
174
 
118
175
  `)
119
176
  }
120
177
  if (opnames.includes('remove')) {
121
178
  Content(`// Remove
122
- const removed = await client.${eName}().remove({
123
- id: created.data.id,
124
- })
179
+ await client.${eName}().remove(${idF ? `{\n ${idF}: ${idValueFor('remove')},\n}` : ''})
125
180
  `)
126
181
  }
127
182
  Content(`\`\`\`
@@ -1,11 +1,13 @@
1
1
 
2
- import { cmp, each, Content, File, isAuthActive } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, File, isAuthActive, entityIdField, safeVarName } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
6
6
  getModelPath,
7
7
  } from '@voxgig/apidef'
8
8
 
9
+ import { exampleValue } from './utility_ts'
10
+
9
11
 
10
12
  const OP_SIGNATURES: Record<string, { sig: string, returns: string, desc: string }> = {
11
13
  load: {
@@ -70,8 +72,7 @@ Create a new SDK client instance.
70
72
  | Name | Type | Description |
71
73
  | --- | --- | --- |
72
74
  | \`options\` | \`object\` | SDK configuration options. |
73
- | \`options.apikey\` | \`string\` | API key for authentication. |
74
- | \`options.base\` | \`string\` | Base URL for API requests. |
75
+ ${isAuthActive(model) ? '| \`options.apikey\` | \`string\` | API key for authentication. |\n' : ''}| \`options.base\` | \`string\` | Base URL for API requests. |
75
76
  | \`options.prefix\` | \`string\` | URL prefix appended after base. |
76
77
  | \`options.suffix\` | \`string\` | URL suffix appended after path. |
77
78
  | \`options.headers\` | \`object\` | Custom headers for all requests. |
@@ -180,6 +181,11 @@ Alias for \`${model.Name}SDK.test()\`.
180
181
  publishedEntities.map((ent: any) => {
181
182
  const opnames = Object.keys(ent.op || {})
182
183
  const fields = ent.fields || []
184
+ // Model-driven id key: null when this entity has no id-like field, in
185
+ // which case load/remove match on no argument and update omits the id.
186
+ const idF = entityIdField(ent)
187
+ // Variable-safe lowercase name (a `Delete` entity must not bind `delete`).
188
+ const eVar = safeVarName(ent.name, target.name)
183
189
 
184
190
  Content(`
185
191
  ---
@@ -195,7 +201,7 @@ Alias for \`${model.Name}SDK.test()\`.
195
201
  }
196
202
 
197
203
  Content(`\`\`\`ts
198
- const ${ent.name} = client.${ent.Name}()
204
+ const ${eVar} = client.${ent.Name}()
199
205
  \`\`\`
200
206
 
201
207
  `)
@@ -211,7 +217,7 @@ const ${ent.name} = client.${ent.Name}()
211
217
  each(fields, (field: any) => {
212
218
  const req = field.req ? 'Yes' : 'No'
213
219
  const desc = field.short || ''
214
- Content(`| \`${field.name}\` | \`${field.type || 'any'}\` | ${req} | ${desc} |
220
+ Content(`| \`${field.name}\` | \`${canonToType(field.type, target.name)}\` | ${req} | ${desc} |
215
221
  `)
216
222
  })
217
223
 
@@ -221,15 +227,18 @@ const ${ent.name} = client.${ent.Name}()
221
227
  // Field operations breakdown
222
228
  const hasFieldOps = fields.some((f: any) => f.op && Object.keys(f.op).length > 0)
223
229
  if (hasFieldOps) {
230
+ // Only emit columns for operations this entity actually exposes —
231
+ // never advertise a create/update/remove column the entity lacks.
232
+ const opcols = ['load', 'list', 'create', 'update', 'remove']
233
+ .filter((op: string) => opnames.includes(op) && ent.op[op]?.active !== false)
224
234
  Content(`### Field Usage by Operation
225
235
 
226
- | Field | load | list | create | update | remove |
227
- | --- | --- | --- | --- | --- | --- |
236
+ | Field | ${opcols.join(' | ')} |
237
+ | --- | ${opcols.map(() => '---').join(' | ')} |
228
238
  `)
229
239
  each(fields, (field: any) => {
230
240
  const fops = field.op || {}
231
- const cols = ['load', 'list', 'create', 'update', 'remove'].map((op: string) => {
232
- if (!opnames.includes(op)) return '-'
241
+ const cols = opcols.map((op: string) => {
233
242
  const fop = fops[op]
234
243
  if (null == fop) return '-'
235
244
  if (fop.active === false) return '-'
@@ -264,7 +273,7 @@ ${info.desc}
264
273
  // Show example
265
274
  if ('load' === opname || 'remove' === opname) {
266
275
  Content(`\`\`\`ts
267
- const result = await client.${ent.Name}().${opname}({ id: '${ent.name}_id' })
276
+ const result = await client.${ent.Name}().${opname}(${idF ? `{ ${idF}: ${exampleValue(ent, ent.op && ent.op[opname], idF, ent.name + '_id')} }` : ''})
268
277
  \`\`\`
269
278
 
270
279
  `)
@@ -282,7 +291,7 @@ const result = await client.${ent.Name}().create({
282
291
  `)
283
292
  each(fields, (field: any) => {
284
293
  if ('id' !== field.name && field.req) {
285
- Content(` ${field.name}: /* ${field.type || 'value'} */,
294
+ Content(` ${field.name}: /* ${canonToType(field.type, target.name)} */,
286
295
  `)
287
296
  }
288
297
  })
@@ -292,10 +301,12 @@ const result = await client.${ent.Name}().create({
292
301
  `)
293
302
  }
294
303
  else if ('update' === opname) {
304
+ const updateIdLine = idF
305
+ ? ` ${idF}: ${exampleValue(ent, ent.op && ent.op.update, idF, ent.name + '_id')},\n`
306
+ : ''
295
307
  Content(`\`\`\`ts
296
308
  const result = await client.${ent.Name}().update({
297
- id: '${ent.name}_id',
298
- // Fields to update
309
+ ${updateIdLine} // Fields to update
299
310
  })
300
311
  \`\`\`
301
312
 
@@ -12,6 +12,9 @@ const result = await client.direct({
12
12
  method: 'GET',
13
13
  params: { id: 'example' },
14
14
  })
15
+ if (result instanceof Error) {
16
+ throw result
17
+ }
15
18
  console.log(result.data)
16
19
  \`\`\`
17
20
 
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, packageName, envName, entityIdField, safeVarName } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -7,6 +7,8 @@ import {
7
7
  nom,
8
8
  } from '@voxgig/apidef'
9
9
 
10
+ import { exampleValue } from './utility_ts'
11
+
10
12
 
11
13
  const ReadmeTopQuick = cmp(function ReadmeTopQuick(props: any) {
12
14
  const { target, ctx$: { model } } = props
@@ -14,25 +16,33 @@ const ReadmeTopQuick = cmp(function ReadmeTopQuick(props: any) {
14
16
  const entity = getModelPath(model, `main.${KIT}.entity`)
15
17
  const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
16
18
 
17
- const apikeyArg = isAuthActive(model)
18
- ? `\n apikey: process.env.${model.NAME}_APIKEY,\n`
19
- : ''
19
+ const authActive = isAuthActive(model)
20
+ const ctor = authActive
21
+ ? `new ${model.const.Name}SDK({\n apikey: process.env.${envName(model)}_APIKEY,\n})`
22
+ : `new ${model.const.Name}SDK()`
20
23
 
21
24
  Content(`\`\`\`ts
22
- import { ${model.const.Name}SDK } from '${target.module.name}'
25
+ import { ${model.const.Name}SDK } from '${packageName(model, target.name)}'
23
26
 
24
- const client = new ${model.const.Name}SDK({${apikeyArg}})
27
+ const client = ${ctor}
25
28
 
26
29
  `)
27
30
 
28
31
  if (exampleEntity) {
29
32
  const eName = nom(exampleEntity, 'Name')
33
+ const eVar = safeVarName(eName.toLowerCase(), 'ts')
30
34
  const opnames = Object.keys(exampleEntity.op || {})
31
35
 
36
+ let hasCall = false
37
+
32
38
  if (opnames.includes('list')) {
33
- Content(`// List all ${eName.toLowerCase()}s
34
- const ${eName.toLowerCase()}s = await client.${eName}().list()
39
+ Content(`// List all ${eName.toLowerCase()}s (returns ${eName}[])
40
+ const ${eVar}s = await client.${eName}().list()
41
+ for (const ${eVar} of ${eVar}s) {
42
+ console.log(${eVar})
43
+ }
35
44
  `)
45
+ hasCall = true
36
46
  }
37
47
 
38
48
  // Find a nested entity for a more interesting example
@@ -42,17 +52,39 @@ const ${eName.toLowerCase()}s = await client.${eName}().list()
42
52
 
43
53
  if (nestedEntity && opnames.includes('load')) {
44
54
  const neName = nom(nestedEntity, 'Name')
55
+ const neVar = safeVarName(neName.toLowerCase(), 'ts')
45
56
  const parentFields = (nestedEntity.fields || [])
46
57
  .filter((f: any) => f.name !== 'id' && f.name.endsWith('_id'))
47
58
  const parentParam = parentFields.length > 0 ? parentFields[0].name : 'parent_id'
59
+ const loadOp = nestedEntity.op && nestedEntity.op.load
60
+
61
+ // Model-driven id key: only emit an id match line if the nested entity
62
+ // has an id-like key field.
63
+ const neIdF = entityIdField(nestedEntity)
64
+ const neMatchLines = [` ${parentParam}: ${exampleValue(nestedEntity, loadOp, parentParam, 'example')},`]
65
+ if (neIdF) {
66
+ neMatchLines.push(` ${neIdF}: ${exampleValue(nestedEntity, loadOp, neIdF, 'example_id')},`)
67
+ }
48
68
 
49
69
  Content(`
50
- // Load a specific ${neName.toLowerCase()}
51
- const ${neName.toLowerCase()} = await client.${neName}().load({
52
- ${parentParam}: 'example',
53
- id: 'example_id',
70
+ // Load a specific ${neName.toLowerCase()} (returns a ${neName})
71
+ const ${neVar} = await client.${neName}().load({
72
+ ${neMatchLines.join('\n')}
54
73
  })
74
+ console.log(${neVar})
75
+ `)
76
+ hasCall = true
77
+ }
78
+
79
+ // Fallback: APIs with only `load` (no list, no nested) — most public
80
+ // read-only services. Still show one concrete call. `load()` with no
81
+ // match is always valid (the match arg is optional).
82
+ if (!hasCall && opnames.includes('load')) {
83
+ Content(`// Load ${eName.toLowerCase()} data (returns a ${eName})
84
+ const ${eVar} = await client.${eName}().load()
85
+ console.log(${eVar})
55
86
  `)
87
+ hasCall = true
56
88
  }
57
89
  }
58
90