@voxgig/sdkgen 1.2.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (345) hide show
  1. package/bin/voxgig-sdkgen +2 -2
  2. package/dist/action/action.d.ts +3 -1
  3. package/dist/action/action.js +26 -10
  4. package/dist/action/action.js.map +1 -1
  5. package/dist/action/feature.js +9 -8
  6. package/dist/action/feature.js.map +1 -1
  7. package/dist/action/target.d.ts +7 -1
  8. package/dist/action/target.js +22 -13
  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 +225 -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 +12 -2
  53. package/dist/sdkgen.js +60 -20
  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.d.ts +2 -1
  59. package/dist/utility.js +39 -11
  60. package/dist/utility.js.map +1 -1
  61. package/model/sdkgen.aontu +137 -0
  62. package/package.json +11 -5
  63. package/project/.sdk/model/feature/feature-index.aontu +5 -0
  64. package/project/.sdk/model/target/go-cli.aontu +47 -0
  65. package/project/.sdk/model/target/go-mcp.aontu +41 -0
  66. package/project/.sdk/model/target/go.aontu +28 -0
  67. package/project/.sdk/model/target/{js.jsonic → js.aontu} +13 -0
  68. package/project/.sdk/model/target/{lua.jsonic → lua.aontu} +13 -0
  69. package/project/.sdk/model/target/{php.jsonic → php.aontu} +13 -0
  70. package/project/.sdk/model/target/{py.jsonic → py.aontu} +13 -0
  71. package/project/.sdk/model/target/{rb.jsonic → rb.aontu} +13 -0
  72. package/project/.sdk/model/target/{ts.jsonic → ts.aontu} +13 -0
  73. package/project/.sdk/src/cmp/go/Config_go.ts +3 -2
  74. package/project/.sdk/src/cmp/go/EntityOperation_go.ts +1 -0
  75. package/project/.sdk/src/cmp/go/EntityTypes_go.ts +197 -0
  76. package/project/.sdk/src/cmp/go/Entity_go.ts +2 -1
  77. package/project/.sdk/src/cmp/go/MainEntity_go.ts +6 -0
  78. package/project/.sdk/src/cmp/go/Main_go.ts +23 -3
  79. package/project/.sdk/src/cmp/go/Package_go.ts +1 -1
  80. package/project/.sdk/src/cmp/go/ReadmeEntity_go.ts +48 -10
  81. package/project/.sdk/src/cmp/go/ReadmeExamplesTest_go.ts +688 -0
  82. package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +1 -1
  83. package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +52 -8
  84. package/project/.sdk/src/cmp/go/ReadmeInstall_go.ts +11 -6
  85. package/project/.sdk/src/cmp/go/ReadmeIntro_go.ts +40 -1
  86. package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +67 -17
  87. package/project/.sdk/src/cmp/go/ReadmeOptions_go.ts +4 -3
  88. package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +146 -116
  89. package/project/.sdk/src/cmp/go/ReadmeRef_go.ts +87 -21
  90. package/project/.sdk/src/cmp/go/ReadmeTopHowto_go.ts +4 -0
  91. package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +75 -16
  92. package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +35 -5
  93. package/project/.sdk/src/cmp/go/TestEntity_go.ts +1 -1
  94. package/project/.sdk/src/cmp/go/Test_go.ts +5 -1
  95. package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +21 -0
  96. package/project/.sdk/src/cmp/go/fragment/EntityCreateOp.fragment.go +11 -0
  97. package/project/.sdk/src/cmp/go/fragment/EntityListOp.fragment.go +11 -0
  98. package/project/.sdk/src/cmp/go/fragment/EntityLoadOp.fragment.go +11 -0
  99. package/project/.sdk/src/cmp/go/fragment/EntityRemoveOp.fragment.go +11 -0
  100. package/project/.sdk/src/cmp/go/fragment/EntityUpdateOp.fragment.go +11 -0
  101. package/project/.sdk/src/cmp/go/utility_go.ts +70 -0
  102. package/project/.sdk/src/cmp/go-cli/Main_go-cli.ts +195 -0
  103. package/project/.sdk/src/cmp/go-cli/fragment/main.fragment.go +106 -0
  104. package/project/.sdk/src/cmp/go-cli/fragment/words.fragment.go +132 -0
  105. package/project/.sdk/src/cmp/go-mcp/Main_go-mcp.ts +184 -0
  106. package/project/.sdk/src/cmp/go-mcp/fragment/main.fragment.go +68 -0
  107. package/project/.sdk/src/cmp/go-mcp/fragment/tools.fragment.go +114 -0
  108. package/project/.sdk/src/cmp/js/Config_js.ts +3 -6
  109. package/project/.sdk/src/cmp/js/EntityTypes_js.ts +111 -0
  110. package/project/.sdk/src/cmp/js/MainEntity_js.ts +1 -0
  111. package/project/.sdk/src/cmp/js/Main_js.ts +3 -0
  112. package/project/.sdk/src/cmp/js/Package_js.ts +16 -7
  113. package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +33 -10
  114. package/project/.sdk/src/cmp/js/ReadmeExplanation_js.ts +2 -2
  115. package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +52 -11
  116. package/project/.sdk/src/cmp/js/ReadmeIntro_js.ts +39 -1
  117. package/project/.sdk/src/cmp/js/ReadmeModel_js.ts +50 -18
  118. package/project/.sdk/src/cmp/js/ReadmeOptions_js.ts +4 -3
  119. package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +70 -20
  120. package/project/.sdk/src/cmp/js/ReadmeRef_js.ts +50 -16
  121. package/project/.sdk/src/cmp/js/ReadmeTopHowto_js.ts +3 -0
  122. package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +45 -19
  123. package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +35 -3
  124. package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +5 -0
  125. package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +5 -0
  126. package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +5 -0
  127. package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +5 -0
  128. package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +5 -0
  129. package/project/.sdk/src/cmp/js/utility_js.ts +57 -0
  130. package/project/.sdk/src/cmp/lua/Config_lua.ts +3 -2
  131. package/project/.sdk/src/cmp/lua/EntityTypes_lua.ts +113 -0
  132. package/project/.sdk/src/cmp/lua/MainEntity_lua.ts +8 -0
  133. package/project/.sdk/src/cmp/lua/Main_lua.ts +4 -0
  134. package/project/.sdk/src/cmp/lua/Package_lua.ts +23 -4
  135. package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +50 -13
  136. package/project/.sdk/src/cmp/lua/ReadmeExamplesTest_lua.ts +293 -0
  137. package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +46 -8
  138. package/project/.sdk/src/cmp/lua/ReadmeInstall_lua.ts +19 -3
  139. package/project/.sdk/src/cmp/lua/ReadmeIntro_lua.ts +38 -1
  140. package/project/.sdk/src/cmp/lua/ReadmeModel_lua.ts +51 -16
  141. package/project/.sdk/src/cmp/lua/ReadmeOptions_lua.ts +4 -3
  142. package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +156 -21
  143. package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +71 -23
  144. package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +46 -9
  145. package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +43 -5
  146. package/project/.sdk/src/cmp/lua/Test_lua.ts +4 -0
  147. package/project/.sdk/src/cmp/lua/fragment/EntityCreateOp.fragment.lua +4 -0
  148. package/project/.sdk/src/cmp/lua/fragment/EntityListOp.fragment.lua +4 -0
  149. package/project/.sdk/src/cmp/lua/fragment/EntityLoadOp.fragment.lua +4 -0
  150. package/project/.sdk/src/cmp/lua/fragment/EntityRemoveOp.fragment.lua +4 -0
  151. package/project/.sdk/src/cmp/lua/fragment/EntityUpdateOp.fragment.lua +4 -0
  152. package/project/.sdk/src/cmp/php/Config_php.ts +3 -2
  153. package/project/.sdk/src/cmp/php/EntityTypes_php.ts +142 -0
  154. package/project/.sdk/src/cmp/php/MainEntity_php.ts +18 -1
  155. package/project/.sdk/src/cmp/php/Main_php.ts +4 -0
  156. package/project/.sdk/src/cmp/php/Package_php.ts +18 -7
  157. package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +46 -14
  158. package/project/.sdk/src/cmp/php/ReadmeExamplesTest_php.ts +401 -0
  159. package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +56 -13
  160. package/project/.sdk/src/cmp/php/ReadmeInstall_php.ts +15 -3
  161. package/project/.sdk/src/cmp/php/ReadmeIntro_php.ts +40 -1
  162. package/project/.sdk/src/cmp/php/ReadmeModel_php.ts +26 -8
  163. package/project/.sdk/src/cmp/php/ReadmeOptions_php.ts +4 -3
  164. package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +159 -25
  165. package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +90 -45
  166. package/project/.sdk/src/cmp/php/ReadmeTopHowto_php.ts +1 -1
  167. package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +43 -11
  168. package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +52 -11
  169. package/project/.sdk/src/cmp/php/TestDirect_php.ts +9 -9
  170. package/project/.sdk/src/cmp/php/TestEntity_php.ts +6 -12
  171. package/project/.sdk/src/cmp/php/Test_php.ts +4 -0
  172. package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +13 -1
  173. package/project/.sdk/src/cmp/php/fragment/EntityCreateOp.fragment.php +10 -1
  174. package/project/.sdk/src/cmp/php/fragment/EntityListOp.fragment.php +10 -1
  175. package/project/.sdk/src/cmp/php/fragment/EntityLoadOp.fragment.php +10 -1
  176. package/project/.sdk/src/cmp/php/fragment/EntityRemoveOp.fragment.php +10 -1
  177. package/project/.sdk/src/cmp/php/fragment/EntityUpdateOp.fragment.php +10 -1
  178. package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +22 -14
  179. package/project/.sdk/src/cmp/py/Config_py.ts +3 -2
  180. package/project/.sdk/src/cmp/py/EntityTypes_py.ts +184 -0
  181. package/project/.sdk/src/cmp/py/Entity_py.ts +27 -0
  182. package/project/.sdk/src/cmp/py/MainEntity_py.ts +2 -1
  183. package/project/.sdk/src/cmp/py/Main_py.ts +35 -0
  184. package/project/.sdk/src/cmp/py/Package_py.ts +24 -3
  185. package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +48 -14
  186. package/project/.sdk/src/cmp/py/ReadmeExamplesTest_py.ts +626 -0
  187. package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +53 -14
  188. package/project/.sdk/src/cmp/py/ReadmeInstall_py.ts +19 -3
  189. package/project/.sdk/src/cmp/py/ReadmeIntro_py.ts +48 -1
  190. package/project/.sdk/src/cmp/py/ReadmeModel_py.ts +28 -10
  191. package/project/.sdk/src/cmp/py/ReadmeOptions_py.ts +4 -3
  192. package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +150 -27
  193. package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +86 -40
  194. package/project/.sdk/src/cmp/py/ReadmeTopHowto_py.ts +1 -1
  195. package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +45 -11
  196. package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +43 -5
  197. package/project/.sdk/src/cmp/py/TestDirect_py.ts +7 -9
  198. package/project/.sdk/src/cmp/py/TestEntity_py.ts +6 -14
  199. package/project/.sdk/src/cmp/py/Test_py.ts +4 -0
  200. package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +5 -2
  201. package/project/.sdk/src/cmp/py/fragment/EntityCreateOp.fragment.py +1 -1
  202. package/project/.sdk/src/cmp/py/fragment/EntityListOp.fragment.py +5 -1
  203. package/project/.sdk/src/cmp/py/fragment/EntityLoadOp.fragment.py +6 -1
  204. package/project/.sdk/src/cmp/py/fragment/EntityRemoveOp.fragment.py +6 -1
  205. package/project/.sdk/src/cmp/py/fragment/EntityUpdateOp.fragment.py +1 -1
  206. package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +17 -10
  207. package/project/.sdk/src/cmp/rb/Config_rb.ts +3 -2
  208. package/project/.sdk/src/cmp/rb/EntityTypes_rb.ts +136 -0
  209. package/project/.sdk/src/cmp/rb/MainEntity_rb.ts +1 -0
  210. package/project/.sdk/src/cmp/rb/Main_rb.ts +4 -0
  211. package/project/.sdk/src/cmp/rb/Package_rb.ts +34 -7
  212. package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +47 -13
  213. package/project/.sdk/src/cmp/rb/ReadmeExamplesTest_rb.ts +289 -0
  214. package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +72 -21
  215. package/project/.sdk/src/cmp/rb/ReadmeInstall_rb.ts +16 -4
  216. package/project/.sdk/src/cmp/rb/ReadmeIntro_rb.ts +40 -1
  217. package/project/.sdk/src/cmp/rb/ReadmeModel_rb.ts +29 -12
  218. package/project/.sdk/src/cmp/rb/ReadmeOptions_rb.ts +4 -3
  219. package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +163 -25
  220. package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +85 -40
  221. package/project/.sdk/src/cmp/rb/ReadmeTopHowto_rb.ts +1 -1
  222. package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +45 -11
  223. package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +54 -11
  224. package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +9 -9
  225. package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +6 -12
  226. package/project/.sdk/src/cmp/rb/Test_rb.ts +4 -0
  227. package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +2 -0
  228. package/project/.sdk/src/cmp/rb/fragment/EntityCreateOp.fragment.rb +5 -0
  229. package/project/.sdk/src/cmp/rb/fragment/EntityListOp.fragment.rb +20 -2
  230. package/project/.sdk/src/cmp/rb/fragment/EntityLoadOp.fragment.rb +8 -1
  231. package/project/.sdk/src/cmp/rb/fragment/EntityRemoveOp.fragment.rb +6 -1
  232. package/project/.sdk/src/cmp/rb/fragment/EntityUpdateOp.fragment.rb +5 -0
  233. package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +24 -8
  234. package/project/.sdk/src/cmp/ts/Config_ts.ts +3 -6
  235. package/project/.sdk/src/cmp/ts/EntityTypes_ts.ts +105 -0
  236. package/project/.sdk/src/cmp/ts/Entity_ts.ts +17 -1
  237. package/project/.sdk/src/cmp/ts/MainEntity_ts.ts +1 -0
  238. package/project/.sdk/src/cmp/ts/Main_ts.ts +6 -0
  239. package/project/.sdk/src/cmp/ts/Package_ts.ts +14 -7
  240. package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +32 -10
  241. package/project/.sdk/src/cmp/ts/ReadmeExampleTest_ts.ts +81 -0
  242. package/project/.sdk/src/cmp/ts/ReadmeExamplesTest_ts.ts +446 -0
  243. package/project/.sdk/src/cmp/ts/ReadmeExplanation_ts.ts +2 -2
  244. package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +57 -11
  245. package/project/.sdk/src/cmp/ts/ReadmeInstall_ts.ts +19 -6
  246. package/project/.sdk/src/cmp/ts/ReadmeIntro_ts.ts +39 -1
  247. package/project/.sdk/src/cmp/ts/ReadmeModel_ts.ts +50 -18
  248. package/project/.sdk/src/cmp/ts/ReadmeOptions_ts.ts +4 -3
  249. package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +141 -48
  250. package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +50 -16
  251. package/project/.sdk/src/cmp/ts/ReadmeTopHowto_ts.ts +3 -0
  252. package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +58 -19
  253. package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +35 -3
  254. package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +2 -2
  255. package/project/.sdk/src/cmp/ts/Test_ts.ts +5 -0
  256. package/project/.sdk/src/cmp/ts/fragment/Entity.fragment.ts +3 -1
  257. package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +10 -5
  258. package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +4 -2
  259. package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +4 -2
  260. package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +4 -2
  261. package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +4 -2
  262. package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +4 -2
  263. package/project/.sdk/src/cmp/ts/utility_ts.ts +59 -0
  264. package/project/.sdk/tm/go/LICENSE +1 -1
  265. package/project/.sdk/tm/go/Makefile +36 -1
  266. package/project/.sdk/tm/go/VERSION +1 -0
  267. package/project/.sdk/tm/go/core/context.go +12 -7
  268. package/project/.sdk/tm/go-cli/src/feature/README.md +6 -0
  269. package/project/.sdk/tm/go-cli/src/feature/base/.gitkeep +0 -0
  270. package/project/.sdk/tm/go-cli/src/feature/log/.gitkeep +0 -0
  271. package/project/.sdk/tm/go-cli/src/feature/test/.gitkeep +0 -0
  272. package/project/.sdk/tm/go-mcp/src/feature/README.md +6 -0
  273. package/project/.sdk/tm/go-mcp/src/feature/base/.gitkeep +0 -0
  274. package/project/.sdk/tm/go-mcp/src/feature/log/.gitkeep +0 -0
  275. package/project/.sdk/tm/go-mcp/src/feature/test/.gitkeep +0 -0
  276. package/project/.sdk/tm/js/LICENSE +1 -1
  277. package/project/.sdk/tm/js/Makefile +41 -0
  278. package/project/.sdk/tm/lua/LICENSE +1 -1
  279. package/project/.sdk/tm/lua/Makefile +40 -1
  280. package/project/.sdk/tm/lua/core/context.lua +13 -8
  281. package/project/.sdk/tm/php/LICENSE +1 -1
  282. package/project/.sdk/tm/php/Makefile +31 -1
  283. package/project/.sdk/tm/php/VERSION +1 -0
  284. package/project/.sdk/tm/php/core/Context.php +12 -6
  285. package/project/.sdk/tm/php/test/PrimaryUtilityTest.php +13 -4
  286. package/project/.sdk/tm/php/utility/Done.php +2 -2
  287. package/project/.sdk/tm/php/utility/MakeError.php +3 -3
  288. package/project/.sdk/tm/py/LICENSE +1 -1
  289. package/project/.sdk/tm/py/Makefile +34 -1
  290. package/project/.sdk/tm/py/core/context.py +12 -7
  291. package/project/.sdk/tm/py/test/test_primary_utility.py +15 -4
  292. package/project/.sdk/tm/py/test/test_struct_utility.py +1 -1
  293. package/project/.sdk/tm/py/utility/done.py +3 -1
  294. package/project/.sdk/tm/py/utility/make_error.py +2 -2
  295. package/project/.sdk/tm/rb/LICENSE +1 -1
  296. package/project/.sdk/tm/rb/Makefile +36 -2
  297. package/project/.sdk/tm/rb/core/context.rb +8 -3
  298. package/project/.sdk/tm/rb/test/primary_utility_test.rb +2 -2
  299. package/project/.sdk/tm/rb/utility/done.rb +3 -1
  300. package/project/.sdk/tm/rb/utility/make_error.rb +5 -2
  301. package/project/.sdk/tm/ts/LICENSE +1 -1
  302. package/project/.sdk/tm/ts/Makefile +42 -0
  303. package/project/.sdk/tm/ts/src/Context.ts +8 -3
  304. package/src/action/action.ts +30 -11
  305. package/src/action/feature.ts +12 -14
  306. package/src/action/target.ts +28 -17
  307. package/src/cmp/Changelog.ts +34 -0
  308. package/src/cmp/Deploy.ts +258 -0
  309. package/src/cmp/FeatureHook.ts +6 -8
  310. package/src/cmp/License.ts +49 -0
  311. package/src/cmp/Readme.ts +2 -0
  312. package/src/cmp/ReadmeErrors.ts +257 -0
  313. package/src/cmp/ReadmeExplanation.ts +250 -230
  314. package/src/cmp/ReadmeModel.ts +7 -2
  315. package/src/cmp/ReadmeTop.ts +411 -95
  316. package/src/cmp/Security.ts +41 -0
  317. package/src/helpers/canonType.ts +89 -0
  318. package/src/helpers/collectDeps.ts +5 -3
  319. package/src/helpers/naming.ts +59 -0
  320. package/src/helpers/opExample.ts +170 -0
  321. package/src/helpers/opShape.ts +274 -0
  322. package/src/helpers/packageMeta.ts +236 -0
  323. package/src/sdkgen.ts +91 -23
  324. package/src/tsconfig.json +1 -0
  325. package/src/types.ts +85 -2
  326. package/src/utility.ts +45 -11
  327. package/README.md +0 -2
  328. package/dist/action/lang.d.ts +0 -2
  329. package/dist/action/lang.js +0 -68
  330. package/dist/action/lang.js.map +0 -1
  331. package/dist/cmp/Hook.d.ts +0 -2
  332. package/dist/cmp/Hook.js +0 -10
  333. package/dist/cmp/Hook.js.map +0 -1
  334. package/dist/cmp/Top.d.ts +0 -2
  335. package/dist/cmp/Top.js +0 -23
  336. package/dist/cmp/Top.js.map +0 -1
  337. package/dist/prepare-openapi.d.ts +0 -2
  338. package/dist/prepare-openapi.js +0 -37
  339. package/dist/prepare-openapi.js.map +0 -1
  340. package/model/sdkgen.jsonic +0 -74
  341. package/project/.sdk/model/feature/feature-index.jsonic +0 -5
  342. package/project/.sdk/model/target/go.jsonic +0 -22
  343. package/project/.sdk/tm/go/utility/struct/go.mod +0 -3
  344. /package/project/.sdk/model/feature/{log.jsonic → log.aontu} +0 -0
  345. /package/project/.sdk/model/feature/{test.jsonic → test.aontu} +0 -0
@@ -0,0 +1,293 @@
1
+ import { cmp, Content, File } from '@voxgig/sdkgen'
2
+
3
+ import {
4
+ KIT,
5
+ getModelPath,
6
+ } from '@voxgig/apidef'
7
+
8
+
9
+ // Emits lua/test/readme_examples_test.lua — a busted spec that is a
10
+ // COMPLETENESS GATE over every ```lua block in ALL THREE docs that ship
11
+ // lua examples:
12
+ // - the root README.md (top-level, multi-language quick start)
13
+ // - the per-language lua/README.md
14
+ // - the per-language lua/REFERENCE.md
15
+ //
16
+ // For every ```lua block, tagged by (source doc, index):
17
+ // 1. Syntax: it must compile with Lua's load() — catches malformed
18
+ // example code (missing end, bad token, ...).
19
+ // 2. Offline run: every RUNNABLE block (one that builds a client via
20
+ // sdk.new/sdk.test or references `client`) is EXECUTED with the mock
21
+ // transport (no network). Each client constructor is rewritten to the
22
+ // seeded test-mode form, and fragments that only use `client` get a
23
+ // seeded test client injected. A call to a method that does not exist
24
+ // — e.g. a lowercase entity accessor after the API capitalised it to
25
+ // client:Entity() — raises "call a nil value" and FAILS the test.
26
+ // Entity operations return a (value, err) tuple, so a seeded-fixture
27
+ // miss surfaces as a tolerated (nil, err) not-found domain error.
28
+ // 3. Completeness: every block is partitioned into {executed, illustration}
29
+ // and total == executed + illustration is asserted per doc. A block that
30
+ // is neither runnable nor a NARROW explicit illustration (a comment-only
31
+ // / --[[ ]] placeholder) is a silently-untested example and FAILS the
32
+ // gate — "illustration" is never a catch-all.
33
+ const ReadmeExamplesTest = cmp(function ReadmeExamplesTest(props: any) {
34
+ const { ctx$: { model } } = props
35
+
36
+ // Every active entity, keyed by its model name, is seeded with a `test01`
37
+ // fixture whose id is `test01` — so a load({ id = "test01" }) in a doc
38
+ // resolves offline. Bracket-string keys keep the literal valid for any
39
+ // entity name.
40
+ const entity = getModelPath(model, `main.${KIT}.entity`) || {}
41
+ const entnames = Object.values(entity)
42
+ .filter((e: any) => e && e.active !== false)
43
+ .map((e: any) => e.name)
44
+
45
+ const seedEntries = entnames
46
+ .map((n: string) => `["${n}"] = { ["test01"] = { id = "test01" } }`)
47
+ .join(', ')
48
+ const seedLiteral = `{ entity = { ${seedEntries} } }`
49
+
50
+ File({ name: 'readme_examples_test.lua' }, () => {
51
+ Content(`-- README lua example snippets check. Generated by @voxgig/sdkgen.
52
+ --
53
+ -- COMPLETENESS GATE over every \`\`\`lua block in all three docs that ship
54
+ -- lua examples: the root README.md, the lua/README.md, and the
55
+ -- lua/REFERENCE.md. For every block:
56
+ -- 1. Syntax: each block must compile with Lua's load().
57
+ -- 2. Offline run: every runnable block (one that builds a client or
58
+ -- references \`client\`) is EXECUTED with the mock transport (no
59
+ -- network). Each client constructor is rewritten to the seeded
60
+ -- test-mode form, and fragments that only use \`client\` get a seeded
61
+ -- test client injected. A call to a method that does not exist raises
62
+ -- "call a nil value" and FAILS the test. A seeded-fixture miss surfaces
63
+ -- as a tolerated (nil, err) not-found domain error, not a raised error.
64
+ -- 3. Completeness: total == executed + illustration per doc. A block that
65
+ -- is neither runnable nor an explicit comment-only placeholder FAILS
66
+ -- the gate, so no runnable example can be silently skipped.
67
+
68
+ local SDK_MODULE = "${model.name}_sdk"
69
+
70
+ -- A test-mode client seeded with a fixture for every entity. The constructor
71
+ -- of each runnable snippet is rewritten to this form so the offline mock has
72
+ -- data to return.
73
+ local TEST_SEED = '${seedLiteral}'
74
+ local TEST_CTOR = "sdk.test(" .. TEST_SEED .. ")"
75
+
76
+ local function script_dir()
77
+ local src = debug.getinfo(1, "S").source
78
+ local path = src:sub(1, 1) == "@" and src:sub(2) or src
79
+ return path:match("^(.*)[/\\\\][^/\\\\]*$") or "."
80
+ end
81
+
82
+ -- Read a doc by its path relative to this test file's directory (which is
83
+ -- <repo>/lua/test). The root README is two levels up; the lua docs are one.
84
+ local function read_doc(relpath)
85
+ local dir = script_dir()
86
+ local candidates = {
87
+ dir .. "/" .. relpath,
88
+ relpath,
89
+ }
90
+ for _, p in ipairs(candidates) do
91
+ local f = io.open(p, "r")
92
+ if f then
93
+ local data = f:read("*a")
94
+ f:close()
95
+ return data, p
96
+ end
97
+ end
98
+ return nil
99
+ end
100
+
101
+ local function trim(s)
102
+ return (s:gsub("^%s+", ""):gsub("%s+$", ""))
103
+ end
104
+
105
+ local function extract_blocks(md, lang)
106
+ local blocks = {}
107
+ local open = "\`\`\`" .. lang
108
+ local in_block = false
109
+ local cur = {}
110
+ for line in (md .. "\\n"):gmatch("([^\\n]*)\\n") do
111
+ local t = trim(line)
112
+ if not in_block then
113
+ if t == open then
114
+ in_block = true
115
+ cur = {}
116
+ end
117
+ else
118
+ if t == "\`\`\`" then
119
+ table.insert(blocks, table.concat(cur, "\\n"))
120
+ in_block = false
121
+ else
122
+ table.insert(cur, line)
123
+ end
124
+ end
125
+ end
126
+ return blocks
127
+ end
128
+
129
+ -- A block is runnable if it builds a client (sdk.new / sdk.test) or uses one
130
+ -- (references \`client\`). These are the blocks we EXECUTE offline.
131
+ local function is_runnable(block)
132
+ return block:find("sdk%s*%.%s*new") ~= nil
133
+ or block:find("sdk%s*%.%s*test") ~= nil
134
+ or block:find("client") ~= nil
135
+ end
136
+
137
+ -- NARROW illustration class:
138
+ -- - a comment-only block (nothing remains after stripping lua comments), or
139
+ -- - a --[[ ]] value-slot placeholder template (e.g. field = --[[ type ]]):
140
+ -- the placeholder stands in for a value, so the block does not parse.
141
+ -- Everything else must be runnable and is executed; a non-runnable,
142
+ -- non-illustration block is a silently-untested example and fails the
143
+ -- completeness gate.
144
+ local function is_illustration(block)
145
+ local stripped = block:gsub("%-%-%[%[.-%]%]", "") -- block comments
146
+ stripped = stripped:gsub("%-%-[^\\n]*", "") -- line comments
147
+ if trim(stripped) == "" then
148
+ return true
149
+ end
150
+ if block:find("%-%-%[%[") and load(block) == nil then
151
+ return true
152
+ end
153
+ return false
154
+ end
155
+
156
+ -- Transform a README block into an executable offline snippet: rewrite any
157
+ -- client constructor to the seeded test-mode form, inject a seeded client for
158
+ -- bare fragments, and ensure \`sdk\` is in scope.
159
+ local function make_runnable(block)
160
+ local src = block
161
+
162
+ local constructs = block:find("sdk%s*%.%s*new") ~= nil
163
+ or block:find("sdk%s*%.%s*test") ~= nil
164
+
165
+ if constructs then
166
+ -- %b() matches a balanced ( ... ) argument list, so nested tables/parens
167
+ -- in the original constructor call are replaced wholesale.
168
+ src = src:gsub("sdk%s*%.%s*new%s*%b()", function() return TEST_CTOR end)
169
+ src = src:gsub("sdk%s*%.%s*test%s*%b()", function() return TEST_CTOR end)
170
+ end
171
+
172
+ local prelude = {}
173
+ if not src:find("require%s*%(") then
174
+ table.insert(prelude, 'local sdk = require("' .. SDK_MODULE .. '")')
175
+ end
176
+ if not constructs and src:find("client") then
177
+ table.insert(prelude, "local client = " .. TEST_CTOR)
178
+ end
179
+
180
+ if #prelude > 0 then
181
+ src = table.concat(prelude, "\\n") .. "\\n" .. src
182
+ end
183
+ return src
184
+ end
185
+
186
+ -- All three docs are checked identically. relpath is resolved against this
187
+ -- test file's directory (<repo>/lua/test).
188
+ local DOCS = {
189
+ { label = "root README", relpath = "../../README.md" },
190
+ { label = "lua/README", relpath = "../README.md" },
191
+ { label = "lua/REFERENCE", relpath = "../REFERENCE.md" },
192
+ }
193
+
194
+ for _, doc in ipairs(DOCS) do
195
+ describe("lua doc examples (" .. doc.label .. ")", function()
196
+ local md = read_doc(doc.relpath)
197
+
198
+ it(doc.label .. " is present", function()
199
+ assert.is_not_nil(md, "could not read " .. doc.label ..
200
+ " (" .. doc.relpath .. ")")
201
+ end)
202
+
203
+ if not md then
204
+ return
205
+ end
206
+
207
+ local blocks = extract_blocks(md, "lua")
208
+
209
+ it(doc.label .. " has lua example blocks", function()
210
+ assert.is_true(#blocks > 0, "no lua code blocks found in " .. doc.label)
211
+ end)
212
+
213
+ it(doc.label .. ": every lua block is syntactically valid", function()
214
+ for i, block in ipairs(blocks) do
215
+ -- Illustration placeholders (--[[ type ]] templates) intentionally do
216
+ -- not parse; every other block must.
217
+ if not is_illustration(block) then
218
+ local chunk, err = load(block, "=" .. doc.label .. "-lua-" .. i)
219
+ assert.is_not_nil(chunk,
220
+ doc.label .. " lua block #" .. i .. " has a syntax error: " ..
221
+ tostring(err) .. "\\n----\\n" .. block .. "\\n----")
222
+ end
223
+ end
224
+ end)
225
+
226
+ it(doc.label .. ": every runnable lua block runs offline in test mode",
227
+ function()
228
+ local ran = 0
229
+ for i, block in ipairs(blocks) do
230
+ if is_runnable(block) and not is_illustration(block) then
231
+ local src = make_runnable(block)
232
+ local chunk, err = load(src, "=" .. doc.label .. "-run-" .. i)
233
+ assert.is_not_nil(chunk,
234
+ doc.label .. " runnable block #" .. i .. " failed to compile: " ..
235
+ tostring(err) .. "\\n----\\n" .. src .. "\\n----")
236
+ local ok, e = pcall(chunk)
237
+ if not ok then
238
+ local msg = tostring(e)
239
+ -- A nil accessor / missing method / bad index is a real doc bug:
240
+ -- the documented call does not exist.
241
+ if msg:find("nil value") or msg:find("attempt to call")
242
+ or msg:find("attempt to index") then
243
+ assert.is_true(false,
244
+ doc.label .. " runnable block #" .. i .. " hit a runtime " ..
245
+ "error (missing method / nil call): " .. msg ..
246
+ "\\n----\\n" .. src .. "\\n----")
247
+ end
248
+ -- Other runtime errors (a seeded-fixture miss surfaces as a
249
+ -- tolerated not-found domain error, e.g. "request: 404") are
250
+ -- expected offline and tolerated.
251
+ end
252
+ ran = ran + 1
253
+ end
254
+ end
255
+ assert.is_true(ran > 0,
256
+ "expected at least one runnable lua block in " .. doc.label)
257
+ end)
258
+
259
+ it(doc.label .. ": every lua block is executed or an explicit " ..
260
+ "illustration (completeness)", function()
261
+ local executed, illustration = 0, 0
262
+ local unclassified = {}
263
+ for i, block in ipairs(blocks) do
264
+ if is_illustration(block) then
265
+ illustration = illustration + 1
266
+ elseif is_runnable(block) then
267
+ executed = executed + 1
268
+ else
269
+ table.insert(unclassified, i)
270
+ end
271
+ end
272
+ assert.is_true(#unclassified == 0,
273
+ doc.label .. " has lua block(s) that are neither runnable nor a " ..
274
+ "recognized illustration and would be silently untested: #" ..
275
+ table.concat(unclassified, ", #"))
276
+ assert.are.equal(#blocks, executed + illustration,
277
+ doc.label .. " completeness: total " .. #blocks ..
278
+ " != executed " .. executed .. " + illustration " .. illustration)
279
+ print(string.format(
280
+ "[readme-lua] %s: total=%d executed=%d illustration=%d",
281
+ doc.label, #blocks, executed, illustration))
282
+ end)
283
+ end)
284
+ end
285
+ `)
286
+ })
287
+
288
+ })
289
+
290
+
291
+ export {
292
+ ReadmeExamplesTest
293
+ }
@@ -1,12 +1,52 @@
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 Lua literal for a field's canonical type.
12
+ function luaLit(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 || 'OBJECT' === k) return '{}'
17
+ return '"example"'
18
+ }
19
+
20
+ function luaKey(name: string): string {
21
+ return /^[A-Za-z_]\w*$/.test(name) ? name : `["${name}"]`
22
+ }
3
23
 
4
24
 
5
25
  const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
6
26
  const { target, ctx$: { model } } = props
7
27
 
28
+ const entity = getModelPath(model, `main.${KIT}.entity`)
29
+ const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
30
+ const eName = exampleEntity ? nom(exampleEntity, 'Name') : 'Entity'
31
+ // Model-driven id key: null when the entity has no id-like field.
32
+ const idF = exampleEntity ? entityIdField(exampleEntity) : null
33
+ // Drive the test-mode example off the entity's PRIMARY op — never a hardcoded
34
+ // `load` a create-only entity lacks.
35
+ const primaryOp = exampleEntity ? (entityPrimaryOp(exampleEntity) || 'load') : 'load'
36
+ const isMatchOp = 'load' === primaryOp || 'remove' === primaryOp
37
+ let testCallArg = ''
38
+ if (exampleEntity && isMatchOp) {
39
+ testCallArg = idF ? `{ ${idF} = "test01" }` : ''
40
+ } else if (exampleEntity && ('create' === primaryOp || 'update' === primaryOp)) {
41
+ const items = opRequestShape(exampleEntity, primaryOp).items
42
+ .filter((it: any) => it.name !== idF && it.name !== 'id')
43
+ const required = items.filter((it: any) => !it.optional)
44
+ const chosen = required.length ? required : items.slice(0, 3)
45
+ testCallArg = `{ ${chosen.map((it: any) => `${luaKey(it.name)} = ${luaLit(it.type)}`).join(', ')} }`
46
+ }
47
+
8
48
  const apikeyEnvLine = isAuthActive(model)
9
- ? `\n${model.NAME}_APIKEY=<your-key>`
49
+ ? `\n${envName(model)}_APIKEY=<your-key>`
10
50
  : ''
11
51
 
12
52
  Content(`### Make a direct HTTP request
@@ -47,12 +87,10 @@ print(fetchdef["headers"])
47
87
  Create a mock client for unit testing — no server required:
48
88
 
49
89
  \`\`\`lua
50
- local client = sdk.test(nil, nil)
90
+ local client = sdk.test()
51
91
 
52
- local result, err = client:${model.const.Name}(nil):load(
53
- { id = "test01" }, nil
54
- )
55
- -- result contains mock response data
92
+ local result, err = client:${eName}():${primaryOp}(${testCallArg})
93
+ -- result is the returned data; err is set on failure
56
94
  \`\`\`
57
95
 
58
96
  ### Use a custom fetch function
@@ -84,7 +122,7 @@ local client = sdk.new({
84
122
  Create a \`.env.local\` file at the project root:
85
123
 
86
124
  \`\`\`
87
- ${model.NAME}_TEST_LIVE=TRUE${apikeyEnvLine}
125
+ ${envName(model)}_TEST_LIVE=TRUE${apikeyEnvLine}
88
126
  \`\`\`
89
127
 
90
128
  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
- luarocks install ${model.name}-sdk
9
+ if (isPublished(model, target.name)) {
10
+ Content(`\`\`\`bash
11
+ ${installCommand(model, target.name)}
11
12
  \`\`\`
12
13
 
13
14
  If the module is not yet published, add the source directory to
@@ -17,6 +18,21 @@ your \`LUA_PATH\`:
17
18
  export LUA_PATH="path/to/lua/?.lua;path/to/lua/?/init.lua;;"
18
19
  \`\`\`
19
20
 
21
+ `)
22
+ return
23
+ }
24
+
25
+ // Publish pending: not yet on LuaRocks. Install from the git release tag,
26
+ // or add the source directory to LUA_PATH.
27
+ const { releasesUrl } = repoInfo(model)
28
+ Content(`This package is not yet published to LuaRocks. Install it from the
29
+ GitHub release tag (\`${target.name}/vX.Y.Z\`, see [Releases](${releasesUrl})),
30
+ or add the source directory to your \`LUA_PATH\`:
31
+
32
+ \`\`\`bash
33
+ export LUA_PATH="path/to/lua/?.lua;path/to/lua/?/init.lua;;"
34
+ \`\`\`
35
+
20
36
  `)
21
37
  })
22
38
 
@@ -1,13 +1,50 @@
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
+ // Derive a real entity accessor from the model for the semantic-entity
17
+ // note (fall back to a generic name if the model has no entities).
18
+ const entity = getModelPath(model, `main.${KIT}.entity`) || {}
19
+ const exampleEntity = Object.values(entity).find((e: any) => e && e.active !== false) as any
20
+ const eName = exampleEntity ? nom(exampleEntity, 'Name') : 'Entity'
21
+
22
+ // Model-driven op list — only the operations the active entities actually
23
+ // expose (a read-only entity has just list+load); never claim
24
+ // create/update/remove exist when no entity has them.
25
+ const CANON_OPS = ['list', 'load', 'create', 'update', 'remove']
26
+ const opSet = new Set<string>()
27
+ Object.values(entity || {}).forEach((e: any) => {
28
+ if (!e || e.active === false) return
29
+ Object.keys(e.op || {}).forEach((o: string) => {
30
+ if (e.op[o] && e.op[o].active !== false) opSet.add(o)
31
+ })
32
+ })
33
+ const opNames = CANON_OPS.filter((o) => opSet.has(o))
34
+ .concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
35
+ const opList = (opNames.length ? opNames : ['list', 'load'])
36
+ .map((o) => '`' + o + '`').join(', ')
7
37
 
8
38
  Content(`# ${model.Name} ${target.title} SDK
9
39
 
10
- The ${target.title} SDK for the ${model.Name} API. Provides an entity-oriented interface using Lua conventions.
40
+ ${tagline}
41
+
42
+ The ${target.title} SDK for the ${model.Name} API — an entity-oriented client using Lua conventions.
43
+
44
+ It exposes the API as capitalised, semantic **Entities** — e.g. \`client:${eName}()\` — each with the same small set of operations (${opList}) instead of raw URL paths and query strings. You call meaning, not endpoints, which keeps the cognitive load low.
45
+
46
+ > Other languages, the CLI, and MCP server live alongside this one — see
47
+ > the [top-level README](../README.md).
11
48
 
12
49
  `)
13
50
  })
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, isAuthActive } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, isAuthActive, entityIdField } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -13,6 +13,40 @@ 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, err` | Load a single entity by match criteria. |',
25
+ list: '| `list` | `(reqmatch, ctrl) -> any, err` | List entities matching the criteria. |',
26
+ create: '| `create` | `(reqdata, ctrl) -> any, err` | Create a new entity. |',
27
+ update: '| `update` | `(reqdata, ctrl) -> any, err` | Update an existing entity. |',
28
+ remove: '| `remove` | `(reqmatch, ctrl) -> any, err` | 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 Result-shape rows: only describe the operations that
34
+ // actually exist. Record-returning ops (load/create/update/remove) share
35
+ // one row; list has its own — never name a missing op.
36
+ const recordOps = ['load', 'create', 'update', 'remove'].filter((o) => opUnion.has(o))
37
+ .map((o) => '`' + o + '`')
38
+ const resultRows: string[] = []
39
+ if (recordOps.length) resultRows.push('| ' + recordOps.join(' / ') + ' | the entity record (a `table`) |')
40
+ if (opUnion.has('list')) resultRows.push('| `list` | an array (`table`) of entity records |')
41
+ const resultShapeRows = resultRows.join('\n')
42
+
43
+ const exEnt: any = entityList[0] || {}
44
+ const eName = exEnt.Name || 'Entity'
45
+ const eLower = String(exEnt.name || 'entity').toLowerCase()
46
+ // Model-driven id key: null when the example entity has no id-like field, so
47
+ // the Result-shape load illustration takes no match argument.
48
+ const idF = entityIdField(exEnt)
49
+
16
50
  const apikeyOptionRow = isAuthActive(model)
17
51
  ? '| `apikey` | `string` | API key for authentication. |\n'
18
52
  : ''
@@ -54,7 +88,8 @@ Creates a test-mode client with mock transport. Both arguments may be \`nil\`.
54
88
  `)
55
89
 
56
90
  each(entityList, (ent: any) => {
57
- Content(`| \`${ent.Name}\` | \`(data) -> ${ent.Name}Entity\` | Create a ${ent.Name} entity instance. |
91
+ const article = /^[aeiou]/i.test(ent.Name) ? 'an' : 'a'
92
+ Content(`| \`${ent.Name}\` | \`(data) -> ${ent.Name}Entity\` | Create ${article} ${ent.Name} entity instance. |
58
93
  `)
59
94
  })
60
95
 
@@ -65,11 +100,7 @@ All entities share the same interface.
65
100
 
66
101
  | Method | Signature | Description |
67
102
  | --- | --- | --- |
68
- | \`load\` | \`(reqmatch, ctrl) -> any, err\` | Load a single entity by match criteria. |
69
- | \`list\` | \`(reqmatch, ctrl) -> any, err\` | List entities matching the criteria. |
70
- | \`create\` | \`(reqdata, ctrl) -> any, err\` | Create a new entity. |
71
- | \`update\` | \`(reqdata, ctrl) -> any, err\` | Update an existing entity. |
72
- | \`remove\` | \`(reqmatch, ctrl) -> any, err\` | Remove an entity. |
103
+ ${opRows}
73
104
  | \`data_get\` | \`() -> table\` | Get entity data. |
74
105
  | \`data_set\` | \`(data)\` | Set entity data. |
75
106
  | \`match_get\` | \`() -> table\` | Get entity match criteria. |
@@ -79,17 +110,21 @@ All entities share the same interface.
79
110
 
80
111
  ### Result shape
81
112
 
82
- Entity operations return \`(any, err)\`. The first value is a
83
- \`table\` with these keys:
113
+ Entity operations return \`(value, err)\`. The \`value\` is the operation's
114
+ data **directly** there is no wrapper:
84
115
 
85
- | Key | Type | Description |
86
- | --- | --- | --- |
87
- | \`ok\` | \`boolean\` | \`true\` if the HTTP status is 2xx. |
88
- | \`status\` | \`number\` | HTTP status code. |
89
- | \`headers\` | \`table\` | Response headers. |
90
- | \`data\` | \`any\` | Parsed JSON response body. |
116
+ | Operation | \`value\` |
117
+ | --- | --- |
118
+ ${resultShapeRows}
119
+
120
+ Check \`err\` first (it is non-\`nil\` on failure), then use \`value\`:
121
+
122
+ local ${eLower}, err = client:${eName}():load(${idF ? `{ ${idF} = "example_id" }` : ''})
123
+ if err then error(err) end
124
+ -- ${eLower} is the loaded record
91
125
 
92
- On error, \`ok\` is \`false\` and \`err\` contains the error value.
126
+ Only \`direct()\` returns a response envelope — a \`table\` with \`ok\`,
127
+ \`status\`, \`headers\`, and \`data\` keys.
93
128
 
94
129
  `)
95
130
 
@@ -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 @@ local client = sdk.new({
25
26
 
26
27
  publishedOptions.map((option: any) => {
27
28
  if ('apikey' === option.name) {
28
- Content(` ${option.name} = os.getenv("${model.NAME}_APIKEY"),
29
+ Content(` ${option.name} = os.getenv("${envName(model)}_APIKEY"),
29
30
  `)
30
31
  }
31
32
  else {