@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,12 +1,50 @@
1
1
 
2
- import { cmp, Content, isAuthActive } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, entityPrimaryOp, opRequestShape } from '@voxgig/sdkgen'
3
+
4
+ import {
5
+ KIT,
6
+ getModelPath,
7
+ nom,
8
+ } from '@voxgig/apidef'
9
+
10
+
11
+ // A type-correct Python literal for a field's canonical type.
12
+ function pyLit(type: any): string {
13
+ const k = canonKey(type)
14
+ if ('INTEGER' === k || 'NUMBER' === k) return '1'
15
+ if ('BOOLEAN' === k) return 'True'
16
+ if ('ARRAY' === k) return '[]'
17
+ if ('OBJECT' === k) return '{}'
18
+ return '"example"'
19
+ }
3
20
 
4
21
 
5
22
  const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
6
23
  const { target, ctx$: { model } } = props
7
24
 
25
+ const entity = getModelPath(model, `main.${KIT}.entity`)
26
+ const exampleEntity = Object.values(entity || {}).find((e: any) => e && e.active !== false) as any
27
+ const eName = exampleEntity ? nom(exampleEntity, 'Name') : 'Entity'
28
+ // Model-driven id key: null when the entity has no id-like field, so a
29
+ // match op takes no argument.
30
+ const idF = exampleEntity ? entityIdField(exampleEntity) : null
31
+ // Drive the test-mode example off the entity's PRIMARY op — never a hardcoded
32
+ // `load` a create-only entity lacks.
33
+ const primaryOp = exampleEntity ? (entityPrimaryOp(exampleEntity) || 'load') : 'load'
34
+ const isMatchOp = 'load' === primaryOp || 'remove' === primaryOp
35
+ let testArg = ''
36
+ if (exampleEntity && isMatchOp) {
37
+ testArg = idF ? `{"${idF}": "test01"}` : ''
38
+ } else if (exampleEntity && ('create' === primaryOp || 'update' === primaryOp)) {
39
+ const items = opRequestShape(exampleEntity, primaryOp).items
40
+ .filter((it: any) => it.name !== idF && it.name !== 'id')
41
+ const required = items.filter((it: any) => !it.optional)
42
+ const chosen = required.length ? required : items.slice(0, 3)
43
+ testArg = `{${chosen.map((it: any) => `"${it.name}": ${pyLit(it.type)}`).join(', ')}}`
44
+ }
45
+
8
46
  const apikeyEnvLine = isAuthActive(model)
9
- ? `\n${model.NAME}_APIKEY=<your-key>`
47
+ ? `\n${envName(model)}_APIKEY=<your-key>`
10
48
  : ''
11
49
 
12
50
  Content(`### Make a direct HTTP request
@@ -14,29 +52,31 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
14
52
  For endpoints not covered by entity methods:
15
53
 
16
54
  \`\`\`python
17
- result, err = client.direct({
55
+ result = client.direct({
18
56
  "path": "/api/resource/{id}",
19
57
  "method": "GET",
20
58
  "params": {"id": "example"},
21
59
  })
22
- if err:
23
- raise Exception(err)
24
60
 
25
61
  if result["ok"]:
26
62
  print(result["status"]) # 200
27
63
  print(result["data"]) # response body
64
+ else:
65
+ # A non-2xx response carries status + data (the error body); a
66
+ # transport-level failure carries err instead. Only one is present, so
67
+ # read both with .get() rather than indexing a key that may be absent.
68
+ print(result.get("status"), result.get("err"))
28
69
  \`\`\`
29
70
 
30
71
  ### Prepare a request without sending it
31
72
 
32
73
  \`\`\`python
33
- fetchdef, err = client.prepare({
74
+ # prepare() returns the fetch definition and raises on error.
75
+ fetchdef = client.prepare({
34
76
  "path": "/api/resource/{id}",
35
77
  "method": "DELETE",
36
78
  "params": {"id": "example"},
37
79
  })
38
- if err:
39
- raise Exception(err)
40
80
 
41
81
  print(fetchdef["url"])
42
82
  print(fetchdef["method"])
@@ -48,12 +88,11 @@ print(fetchdef["headers"])
48
88
  Create a mock client for unit testing — no server required:
49
89
 
50
90
  \`\`\`python
51
- client = ${model.const.Name}SDK.test(None, None)
91
+ client = ${model.const.Name}SDK.test()
52
92
 
53
- result, err = client.${model.const.Name}(None).load(
54
- {"id": "test01"}, None
55
- )
56
- # result contains mock response data
93
+ # Entity ops return the bare record and raise on error.
94
+ ${eName.toLowerCase()} = client.${eName}().${primaryOp}(${testArg})
95
+ # ${eName.toLowerCase()} contains the mock response record
57
96
  \`\`\`
58
97
 
59
98
  ### Use a custom fetch function
@@ -82,7 +121,7 @@ client = ${model.const.Name}SDK({
82
121
  Create a \`.env.local\` file at the project root:
83
122
 
84
123
  \`\`\`
85
- ${model.NAME}_TEST_LIVE=TRUE${apikeyEnvLine}
124
+ ${envName(model)}_TEST_LIVE=TRUE${apikeyEnvLine}
86
125
  \`\`\`
87
126
 
88
127
  Then run:
@@ -1,13 +1,14 @@
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
6
  const { target, ctx$ } = props
7
7
  const { model } = ctx$
8
8
 
9
- Content(`\`\`\`bash
10
- pip install ${model.name}-sdk
9
+ if (isPublished(model, target.name)) {
10
+ Content(`\`\`\`bash
11
+ ${installCommand(model, target.name)}
11
12
  \`\`\`
12
13
 
13
14
  Or install from source:
@@ -16,6 +17,21 @@ Or install from source:
16
17
  pip install -e .
17
18
  \`\`\`
18
19
 
20
+ `)
21
+ return
22
+ }
23
+
24
+ // Publish pending: not yet on PyPI. Install from the git release tag or
25
+ // from a local source checkout.
26
+ const { releasesUrl } = repoInfo(model)
27
+ Content(`This package is not yet published to PyPI. Install it from the GitHub
28
+ release tag (\`${target.name}/vX.Y.Z\`, see [Releases](${releasesUrl})) or
29
+ from a source checkout:
30
+
31
+ \`\`\`bash
32
+ pip install -e .
33
+ \`\`\`
34
+
19
35
  `)
20
36
  })
21
37
 
@@ -1,13 +1,60 @@
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 || ''
7
15
 
8
16
  Content(`# ${model.Name} ${target.title} SDK
9
17
 
10
- The ${target.title} SDK for the ${model.Name} API. Provides an entity-oriented interface following Pythonic conventions.
18
+ ${tagline}
19
+
20
+ The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following Pythonic conventions.
21
+
22
+ `)
23
+
24
+ // Emphasise the entity-oriented design: the SDK surfaces the API as
25
+ // capitalised, semantic Entities with a small, uniform verb set rather
26
+ // than raw URL paths and query strings. The example entity name is
27
+ // derived from the model, never hardcoded.
28
+ const entity = getModelPath(model, `main.${KIT}.entity`)
29
+ const exampleEntity = Object.values(entity || {})
30
+ .find((e: any) => e.active !== false) as any
31
+ const example = exampleEntity
32
+ ? `for example \`client.${nom(exampleEntity, 'Name')}()\` — each`
33
+ : 'each'
34
+
35
+ // Model-driven op list — only the operations the active entities actually
36
+ // expose (a read-only entity has just list+load); never claim
37
+ // create/update/remove exist when no entity has them.
38
+ const CANON_OPS = ['list', 'load', 'create', 'update', 'remove']
39
+ const opSet = new Set<string>()
40
+ Object.values(entity || {}).forEach((e: any) => {
41
+ if (!e || e.active === false) return
42
+ Object.keys(e.op || {}).forEach((o: string) => {
43
+ if (e.op[o] && e.op[o].active !== false) opSet.add(o)
44
+ })
45
+ })
46
+ const opNames = CANON_OPS.filter((o) => opSet.has(o))
47
+ .concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
48
+ const opList = (opNames.length ? opNames : ['list', 'load'])
49
+ .map((o) => '`' + o + '`').join(', ')
50
+
51
+ Content(`The SDK exposes the API as capitalised, semantic **Entities** — ${example}
52
+ carrying a small, uniform set of operations (${opList}) instead of raw URL
53
+ paths and query strings. You work with named resources and verbs, which
54
+ keeps the cognitive load low.
55
+
56
+ > Other languages, the CLI, and MCP server live alongside this one — see
57
+ > the [top-level README](../README.md).
11
58
 
12
59
  `)
13
60
  })
@@ -13,6 +13,23 @@ 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` | `(reqmatch, ctrl) -> any` | Load a single entity by match criteria. Raises on error. |',
25
+ list: '| `list` | `(reqmatch, ctrl) -> list` | List entities matching the criteria. Raises on error. |',
26
+ create: '| `create` | `(reqdata, ctrl) -> any` | Create a new entity. Raises on error. |',
27
+ update: '| `update` | `(reqdata, ctrl) -> any` | Update an existing entity. Raises on error. |',
28
+ remove: '| `remove` | `(reqmatch, ctrl) -> any` | Remove an entity. Raises on error. |',
29
+ }
30
+ const opRows = ['load', 'list', 'create', 'update', 'remove']
31
+ .filter((o) => opUnion.has(o)).map((o) => opRowDefs[o]).join('\n')
32
+
16
33
  const apikeyOptionRow = isAuthActive(model)
17
34
  ? '| `apikey` | `str` | API key for authentication. |\n'
18
35
  : ''
@@ -50,12 +67,13 @@ Creates a test-mode client with mock transport. Both arguments may be \`None\`.
50
67
  | --- | --- | --- |
51
68
  | \`options_map\` | \`() -> dict\` | Deep copy of current SDK options. |
52
69
  | \`get_utility\` | \`() -> Utility\` | Copy of the SDK utility object. |
53
- | \`prepare\` | \`(fetchargs) -> (dict, err)\` | Build an HTTP request definition without sending. |
54
- | \`direct\` | \`(fetchargs) -> (dict, err)\` | Build and send an HTTP request. |
70
+ | \`prepare\` | \`(fetchargs) -> dict\` | Build an HTTP request definition without sending. Raises on error. |
71
+ | \`direct\` | \`(fetchargs) -> dict\` | Build and send an HTTP request. Returns a result dict (branch on \`ok\`). |
55
72
  `)
56
73
 
57
74
  each(entityList, (ent: any) => {
58
- Content(`| \`${ent.Name}\` | \`(data) -> ${ent.Name}Entity\` | Create a ${ent.Name} entity instance. |
75
+ const article = /^[aeiou]/i.test(ent.Name) ? 'an' : 'a'
76
+ Content(`| \`${ent.Name}\` | \`(data) -> ${ent.Name}Entity\` | Create ${article} ${ent.Name} entity instance. |
59
77
  `)
60
78
  })
61
79
 
@@ -66,11 +84,7 @@ All entities share the same interface.
66
84
 
67
85
  | Method | Signature | Description |
68
86
  | --- | --- | --- |
69
- | \`load\` | \`(reqmatch, ctrl) -> (any, err)\` | Load a single entity by match criteria. |
70
- | \`list\` | \`(reqmatch, ctrl) -> (any, err)\` | List entities matching the criteria. |
71
- | \`create\` | \`(reqdata, ctrl) -> (any, err)\` | Create a new entity. |
72
- | \`update\` | \`(reqdata, ctrl) -> (any, err)\` | Update an existing entity. |
73
- | \`remove\` | \`(reqmatch, ctrl) -> (any, err)\` | Remove an entity. |
87
+ ${opRows}
74
88
  | \`data_get\` | \`() -> dict\` | Get entity data. |
75
89
  | \`data_set\` | \`(data)\` | Set entity data. |
76
90
  | \`match_get\` | \`() -> dict\` | Get entity match criteria. |
@@ -80,8 +94,12 @@ All entities share the same interface.
80
94
 
81
95
  ### Result shape
82
96
 
83
- Entity operations return \`(any, err)\`. The first value is a
84
- \`dict\` with these keys:
97
+ Entity operations return the bare result data (a \`dict\` for single-entity
98
+ ops, a \`list\` for \`list\`) and raise on error. Wrap calls in
99
+ \`try\`/\`except\` to handle failures.
100
+
101
+ The \`direct()\` escape hatch never raises — it returns a result \`dict\`
102
+ you branch on via \`result["ok"]\`:
85
103
 
86
104
  | Key | Type | Description |
87
105
  | --- | --- | --- |
@@ -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 @@ client = ${model.Name}SDK({
25
26
 
26
27
  publishedOptions.map((option: any) => {
27
28
  if ('apikey' === option.name) {
28
- Content(` "${option.name}": os.environ.get("${model.NAME}_APIKEY"),
29
+ Content(` "${option.name}": os.environ.get("${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, envName, canonKey, opRequestShape, entityIdField, entityDataIdField } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -20,74 +20,123 @@ const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
20
20
 
21
21
  const authActive = isAuthActive(model)
22
22
  const apikeyImport = authActive ? `import os\n` : ''
23
- const apikeyArg = authActive
24
- ? `\n "apikey": os.environ.get("${model.NAME}_APIKEY"),\n`
25
- : ''
23
+ const ctor = authActive
24
+ ? `${model.const.Name}SDK({\n "apikey": os.environ.get("${envName(model)}_APIKEY"),\n})`
25
+ : `${model.const.Name}SDK()`
26
26
 
27
27
  Content(`### 1. Create a client
28
28
 
29
29
  \`\`\`python
30
30
  ${apikeyImport}from ${model.const.Name.toLowerCase()}_sdk import ${model.const.Name}SDK
31
31
 
32
- client = ${model.const.Name}SDK({${apikeyArg}})
32
+ client = ${ctor}
33
33
  \`\`\`
34
34
 
35
35
  `)
36
36
 
37
37
  if (exampleEntity) {
38
38
  const eName = nom(exampleEntity, 'Name')
39
+ const article = /^[aeiou]/i.test(eName) ? 'an' : 'a'
39
40
  const opnames = Object.keys(exampleEntity.op || {})
41
+ // Model-driven id key: `idF` is the entity's id-like MATCH field name, or
42
+ // null when it has none (a response-wrapped spec). `dataIdF` is the id on
43
+ // the RETURNED record's data type — an entity can key its match on an id it
44
+ // does not carry as data, so indexing `created["id"]` when the data type has
45
+ // none is wrong (and would KeyError at runtime).
46
+ const idF = entityIdField(exampleEntity)
47
+ const dataIdF = entityDataIdField(exampleEntity)
40
48
 
41
49
  if (opnames.includes('list')) {
42
- Content(`### 2. List ${eName.toLowerCase()}s
50
+ Content(`### 2. List ${eName.toLowerCase()} records
51
+
52
+ \`list()\` returns a \`list\` of records (each a \`dict\`) and raises on
53
+ error — iterate it directly.
43
54
 
44
55
  \`\`\`python
45
- result, err = client.${eName}(None).list(None, None)
46
- if err:
47
- raise Exception(err)
48
-
49
- if isinstance(result, list):
50
- for item in result:
51
- d = item.data_get()
52
- print(d["id"], d["name"])
56
+ try:
57
+ ${eName.toLowerCase()}s = client.${eName}().list()
58
+ for ${eName.toLowerCase()} in ${eName.toLowerCase()}s:
59
+ print(${eName.toLowerCase()})
60
+ except Exception as err:
61
+ print(f"list failed: {err}")
53
62
  \`\`\`
54
63
 
55
64
  `)
56
65
  }
57
66
 
58
67
  if (opnames.includes('load')) {
59
- Content(`### 3. Load a ${eName.toLowerCase()}
68
+ Content(`### 3. Load ${article} ${eName.toLowerCase()}
69
+
70
+ \`load()\` returns the bare record (a \`dict\`) and raises on error.
60
71
 
61
72
  \`\`\`python
62
- result, err = client.${eName}(None).load({"id": "example_id"}, None)
63
- if err:
64
- raise Exception(err)
65
- print(result)
73
+ try:
74
+ ${eName.toLowerCase()} = client.${eName}().load(${idF ? `{"${idF}": "example_id"}` : ''})
75
+ print(${eName.toLowerCase()})
76
+ except Exception as err:
77
+ print(f"load failed: {err}")
66
78
  \`\`\`
67
79
 
68
80
  `)
69
81
  }
70
82
 
83
+ // Model-driven example fields: derive the create/update body from the op
84
+ // shape (opRequestShape) so the docs reference REAL writable fields, not a
85
+ // hardcoded "name" the entity may not have. Literals are Python-typed by
86
+ // the field's canonical type.
87
+ const idField = (exampleEntity.id && exampleEntity.id.field) || 'id'
88
+ const pyLit = (type: any): string => {
89
+ const k = canonKey(type)
90
+ if ('INTEGER' === k || 'NUMBER' === k) return '1'
91
+ if ('BOOLEAN' === k) return 'True'
92
+ if ('ARRAY' === k) return '[]'
93
+ if ('OBJECT' === k) return '{}'
94
+ return '"example"'
95
+ }
96
+ const examplePairs = (opname: string): string[] => {
97
+ const items = opRequestShape(exampleEntity, opname).items
98
+ .filter((it: any) => it.name !== idField && it.name !== 'id')
99
+ const required = items.filter((it: any) => !it.optional)
100
+ // create needs ALL required fields; update is a patch, so a couple suffice.
101
+ const chosen = 'create' === opname
102
+ ? (required.length ? required : items.slice(0, 2))
103
+ : items.slice(0, 2)
104
+ return chosen.map((it: any) => `"${it.name}": ${pyLit(it.type)}`)
105
+ }
106
+
107
+ // The id VALUE for an update/remove match: taken off the returned `created`
108
+ // record only when its data type carries the id AND a create ran; otherwise
109
+ // a type-correct literal.
110
+ const idParamType = (opname: string): any => {
111
+ const it = opRequestShape(exampleEntity, opname).items.find((x: any) => x.name === idF)
112
+ return it && it.type
113
+ }
114
+ const idValueFor = (opname: string): string => (null != dataIdF && opnames.includes('create'))
115
+ ? `created["${dataIdF}"]`
116
+ : pyLit(idParamType(opname))
117
+
71
118
  if (opnames.includes('create') || opnames.includes('update') || opnames.includes('remove')) {
72
119
  Content(`### 4. Create, update, and remove
73
120
 
74
121
  \`\`\`python
75
122
  `)
76
123
  if (opnames.includes('create')) {
77
- Content(`# Create
78
- created, _ = client.${eName}(None).create({"name": "Example"}, None)
124
+ Content(`# Create — returns the bare created record (a dict)
125
+ created = client.${eName}().create({${examplePairs('create').join(', ')}})
79
126
 
80
127
  `)
81
128
  }
82
129
  if (opnames.includes('update')) {
83
- Content(`# Update
84
- client.${eName}(None).update({"id": created["id"], "name": "Example-Renamed"}, None)
130
+ const updatePairs = (idF ? [`"${idF}": ${idValueFor('update')}`] : []).concat(examplePairs('update'))
131
+ const fromCreated = null != dataIdF && opnames.includes('create')
132
+ Content(`# Update${fromCreated ? " — the created record's id is a plain dict key" : ''}
133
+ client.${eName}().update({${updatePairs.join(', ')}})
85
134
 
86
135
  `)
87
136
  }
88
137
  if (opnames.includes('remove')) {
89
138
  Content(`# Remove
90
- client.${eName}(None).remove({"id": created["id"]}, None)
139
+ client.${eName}().remove(${idF ? `{"${idF}": ${idValueFor('remove')}}` : ''})
91
140
  `)
92
141
  }
93
142
  Content(`\`\`\`
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, File, isAuthActive } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, canonKey, File, isAuthActive, entityIdField } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -7,31 +7,43 @@ import {
7
7
  } from '@voxgig/apidef'
8
8
 
9
9
 
10
+ // A type-correct, JSON-serialisable Python literal — never an Ellipsis (`...`),
11
+ // which is not JSON-serialisable when a create body is executed by the doc test.
12
+ function pyLit(type: any): string {
13
+ const k = canonKey(type)
14
+ if ('INTEGER' === k || 'NUMBER' === k) return '1'
15
+ if ('BOOLEAN' === k) return 'True'
16
+ if ('ARRAY' === k) return '[]'
17
+ if ('OBJECT' === k) return '{}'
18
+ return '"example"'
19
+ }
20
+
21
+
10
22
  const OP_SIGNATURES: Record<string, { sig: string, returns: string, desc: string }> = {
11
23
  load: {
12
- sig: 'load(reqmatch, ctrl=None) -> tuple',
13
- returns: '(result, err)',
14
- desc: 'Load a single entity matching the given criteria.',
24
+ sig: 'load(reqmatch, ctrl=None) -> dict',
25
+ returns: 'the entity data',
26
+ desc: 'Load a single entity matching the given criteria. Returns the entity data and raises on error.',
15
27
  },
16
28
  list: {
17
- sig: 'list(reqmatch, ctrl=None) -> tuple',
18
- returns: '(result, err)',
19
- desc: 'List entities matching the given criteria. Returns an array.',
29
+ sig: 'list(reqmatch=None, ctrl=None) -> list',
30
+ returns: 'a list of entities',
31
+ desc: 'List entities matching the given criteria. The match is optional — call `list()` with no argument to list all records. Returns a list and raises on error.',
20
32
  },
21
33
  create: {
22
- sig: 'create(reqdata, ctrl=None) -> tuple',
23
- returns: '(result, err)',
24
- desc: 'Create a new entity with the given data.',
34
+ sig: 'create(reqdata, ctrl=None) -> dict',
35
+ returns: 'the created entity data',
36
+ desc: 'Create a new entity with the given data. Returns the created entity data and raises on error.',
25
37
  },
26
38
  update: {
27
- sig: 'update(reqdata, ctrl=None) -> tuple',
28
- returns: '(result, err)',
29
- desc: 'Update an existing entity. The data must include the entity `id`.',
39
+ sig: 'update(reqdata, ctrl=None) -> dict',
40
+ returns: 'the updated entity data',
41
+ desc: 'Update an existing entity. The data must include the entity `id`. Returns the updated entity data and raises on error.',
30
42
  },
31
43
  remove: {
32
- sig: 'remove(reqmatch, ctrl=None) -> tuple',
33
- returns: '(result, err)',
34
- desc: 'Remove the entity matching the given criteria.',
44
+ sig: 'remove(reqmatch, ctrl=None) -> dict',
45
+ returns: 'the removed entity data',
46
+ desc: 'Remove the entity matching the given criteria. Raises on error.',
35
47
  },
36
48
  }
37
49
 
@@ -60,7 +72,7 @@ Complete API reference for the ${model.Name} ${target.title} SDK.
60
72
  `)
61
73
 
62
74
  Content(`\`\`\`python
63
- from ${model.name}_sdk import ${model.const.Name}SDK
75
+ from ${model.const.Name.toLowerCase()}_sdk import ${model.const.Name}SDK
64
76
 
65
77
  client = ${model.const.Name}SDK(options)
66
78
  \`\`\`
@@ -72,8 +84,7 @@ Create a new SDK client instance.
72
84
  | Name | Type | Description |
73
85
  | --- | --- | --- |
74
86
  | \`options\` | \`dict\` | SDK configuration options. |
75
- | \`options["apikey"]\` | \`str\` | API key for authentication. |
76
- | \`options["base"]\` | \`str\` | Base URL for API requests. |
87
+ ${isAuthActive(model) ? '| \`options["apikey"]\` | \`str\` | API key for authentication. |\n' : ''}| \`options["base"]\` | \`str\` | Base URL for API requests. |
77
88
  | \`options["prefix"]\` | \`str\` | URL prefix appended after base. |
78
89
  | \`options["suffix"]\` | \`str\` | URL suffix appended after path. |
79
90
  | \`options["headers"]\` | \`dict\` | Custom headers for all requests. |
@@ -123,9 +134,9 @@ Return a deep copy of the current SDK options.
123
134
 
124
135
  Return a copy of the SDK utility object.
125
136
 
126
- #### \`direct(fetchargs=None) -> tuple\`
137
+ #### \`direct(fetchargs=None) -> dict\`
127
138
 
128
- Make a direct HTTP request to any API endpoint. Returns \`(result, err)\`.
139
+ Make a direct HTTP request to any API endpoint. Returns a result \`dict\` with \`ok\`, \`status\`, \`headers\`, and \`data\` (or \`err\` on failure). This escape hatch never raises — branch on \`result["ok"]\`.
129
140
 
130
141
  **Parameters:**
131
142
 
@@ -138,11 +149,11 @@ Make a direct HTTP request to any API endpoint. Returns \`(result, err)\`.
138
149
  | \`fetchargs["headers"]\` | \`dict\` | Request headers (merged with defaults). |
139
150
  | \`fetchargs["body"]\` | \`any\` | Request body (dicts are JSON-serialized). |
140
151
 
141
- **Returns:** \`(result_dict, err)\`
152
+ **Returns:** \`result_dict\`
142
153
 
143
- #### \`prepare(fetchargs=None) -> tuple\`
154
+ #### \`prepare(fetchargs=None) -> dict\`
144
155
 
145
- Prepare a fetch definition without sending. Returns \`(fetchdef, err)\`.
156
+ Prepare a fetch definition without sending. Returns the \`fetchdef\` and raises on error.
146
157
 
147
158
  `)
148
159
 
@@ -151,6 +162,9 @@ Prepare a fetch definition without sending. Returns \`(fetchdef, err)\`.
151
162
  publishedEntities.map((ent: any) => {
152
163
  const opnames = Object.keys(ent.op || {})
153
164
  const fields = ent.fields || []
165
+ // Model-driven id key: null when this entity has no id-like field, in
166
+ // which case load/remove match on no argument and update omits the id.
167
+ const idF = entityIdField(ent)
154
168
 
155
169
  Content(`
156
170
  ---
@@ -182,7 +196,7 @@ ${ent.name} = client.${ent.Name}()
182
196
  each(fields, (field: any) => {
183
197
  const req = field.req ? 'Yes' : 'No'
184
198
  const desc = field.short || ''
185
- Content(`| \`${field.name}\` | \`${field.type || 'any'}\` | ${req} | ${desc} |
199
+ Content(`| \`${field.name}\` | \`${canonToType(field.type, target.name)}\` | ${req} | ${desc} |
186
200
  `)
187
201
  })
188
202
 
@@ -192,15 +206,18 @@ ${ent.name} = client.${ent.Name}()
192
206
  // Field operations breakdown
193
207
  const hasFieldOps = fields.some((f: any) => f.op && Object.keys(f.op).length > 0)
194
208
  if (hasFieldOps) {
209
+ // Only emit columns for operations this entity actually exposes —
210
+ // never advertise a create/update/remove column the entity lacks.
211
+ const opcols = ['load', 'list', 'create', 'update', 'remove']
212
+ .filter((op: string) => opnames.includes(op) && ent.op[op]?.active !== false)
195
213
  Content(`### Field Usage by Operation
196
214
 
197
- | Field | load | list | create | update | remove |
198
- | --- | --- | --- | --- | --- | --- |
215
+ | Field | ${opcols.join(' | ')} |
216
+ | --- | ${opcols.map(() => '---').join(' | ')} |
199
217
  `)
200
218
  each(fields, (field: any) => {
201
219
  const fops = field.op || {}
202
- const cols = ['load', 'list', 'create', 'update', 'remove'].map((op: string) => {
203
- if (!opnames.includes(op)) return '-'
220
+ const cols = opcols.map((op: string) => {
204
221
  const fop = fops[op]
205
222
  if (null == fop) return '-'
206
223
  if (fop.active === false) return '-'
@@ -232,28 +249,31 @@ ${info.desc}
232
249
 
233
250
  `)
234
251
 
235
- // Show example
252
+ // Show example. Entity ops return the bare result and raise on
253
+ // error; direct() is the only method that returns a result dict.
236
254
  if ('load' === opname || 'remove' === opname) {
237
255
  Content(`\`\`\`python
238
- result, err = client.${ent.Name}().${opname}({"id": "${ent.name}_id"})
256
+ result = client.${ent.Name}().${opname}(${idF ? `{"${idF}": "${ent.name}_id"}` : ''})
239
257
  \`\`\`
240
258
 
241
259
  `)
242
260
  }
243
261
  else if ('list' === opname) {
244
262
  Content(`\`\`\`python
245
- results, err = client.${ent.Name}().list({})
263
+ results = client.${ent.Name}().list()
264
+ for ${ent.name} in results:
265
+ print(${ent.name})
246
266
  \`\`\`
247
267
 
248
268
  `)
249
269
  }
250
270
  else if ('create' === opname) {
251
271
  Content(`\`\`\`python
252
- result, err = client.${ent.Name}().create({
272
+ result = client.${ent.Name}().create({
253
273
  `)
254
274
  each(fields, (field: any) => {
255
275
  if ('id' !== field.name && field.req) {
256
- Content(` "${field.name}": # ${field.type || 'value'},
276
+ Content(` "${field.name}": ${pyLit(field.type)}, # ${canonToType(field.type, target.name)}
257
277
  `)
258
278
  }
259
279
  })
@@ -263,10 +283,10 @@ result, err = client.${ent.Name}().create({
263
283
  `)
264
284
  }
265
285
  else if ('update' === opname) {
286
+ const updateIdLine = idF ? ` "${idF}": "${ent.name}_id",\n` : ''
266
287
  Content(`\`\`\`python
267
- result, err = client.${ent.Name}().update({
268
- "id": "${ent.name}_id",
269
- # Fields to update
288
+ result = client.${ent.Name}().update({
289
+ ${updateIdLine} # Fields to update
270
290
  })
271
291
  \`\`\`
272
292