@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
@@ -185,7 +185,7 @@ ${listSkipBlock} client = setup[:client]
185
185
  `)
186
186
  }
187
187
  Content(`
188
- result, err = client.direct({
188
+ result = client.direct({
189
189
  "path" => "${listPath}",
190
190
  "method" => "GET",
191
191
  "params" => params,
@@ -193,7 +193,7 @@ ${listSkipBlock} client = setup[:client]
193
193
  `)
194
194
  } else {
195
195
  Content(`
196
- result, err = client.direct({
196
+ result = client.direct({
197
197
  "path" => "${listPath}",
198
198
  "method" => "GET",
199
199
  "params" => {},
@@ -205,8 +205,8 @@ ${listSkipBlock} client = setup[:client]
205
205
  # Live mode is lenient: synthetic IDs frequently 4xx and the list-
206
206
  # response shape varies wildly across public APIs. Skip rather than
207
207
  # fail when the call doesn't return a usable list.
208
- if !err.nil?
209
- skip("list call failed (likely synthetic IDs against live API): #{err}")
208
+ if !result["err"].nil?
209
+ skip("list call failed (likely synthetic IDs against live API): #{result["err"]}")
210
210
  return
211
211
  end
212
212
  unless result["ok"]
@@ -219,7 +219,7 @@ ${listSkipBlock} client = setup[:client]
219
219
  return
220
220
  end
221
221
  else
222
- assert_nil err
222
+ assert_nil result["err"]
223
223
  assert result["ok"]
224
224
  assert_equal 200, Helpers.to_int(result["status"])
225
225
  assert result["data"].is_a?(Array)
@@ -294,7 +294,7 @@ ${loadLiveQueryLines}
294
294
  }
295
295
 
296
296
  Content(`
297
- result, err = client.direct({
297
+ result = client.direct({
298
298
  "path" => "${loadPath}",
299
299
  "method" => "GET",
300
300
  `)
@@ -311,8 +311,8 @@ ${loadLiveQueryLines}
311
311
  # Live mode is lenient: synthetic IDs frequently 4xx. Skip rather
312
312
  # than fail when the load endpoint isn't reachable with the IDs
313
313
  # we can construct from setup.idmap.
314
- if !err.nil?
315
- skip("load call failed (likely synthetic IDs against live API): #{err}")
314
+ if !result["err"].nil?
315
+ skip("load call failed (likely synthetic IDs against live API): #{result["err"]}")
316
316
  return
317
317
  end
318
318
  unless result["ok"]
@@ -325,7 +325,7 @@ ${loadLiveQueryLines}
325
325
  return
326
326
  end
327
327
  else
328
- assert_nil err
328
+ assert_nil result["err"]
329
329
  assert result["ok"]
330
330
  assert_equal 200, Helpers.to_int(result["status"])
331
331
  assert !result["data"].nil?
@@ -264,8 +264,7 @@ const generateCreate: OpGen = (ctx, step, index) => {
264
264
  }
265
265
 
266
266
  Content(`
267
- ${datavar}_result, err = ${entvar}.create(${datavar}, nil)
268
- assert_nil err
267
+ ${datavar}_result = ${entvar}.create(${datavar}, nil)
269
268
  ${datavar} = Helpers.to_map(${datavar}_result)
270
269
  assert !${datavar}.nil?
271
270
  `)
@@ -310,8 +309,7 @@ const generateList: OpGen = (ctx, step, index) => {
310
309
  }
311
310
 
312
311
  Content(`
313
- ${listvar}_result, err = ${entvar}.list(${matchvar}, nil)
314
- assert_nil err
312
+ ${listvar}_result = ${entvar}.list(${matchvar}, nil)
315
313
  assert ${listvar}_result.is_a?(Array)
316
314
  `)
317
315
 
@@ -399,8 +397,7 @@ const generateUpdate: OpGen = (ctx, step, index) => {
399
397
  }
400
398
 
401
399
  Content(`
402
- ${resdatavar}_result, err = ${entvar}.update(${datavar}_up, nil)
403
- assert_nil err
400
+ ${resdatavar}_result = ${entvar}.update(${datavar}_up, nil)
404
401
  ${resdatavar} = Helpers.to_map(${resdatavar}_result)
405
402
  assert !${resdatavar}.nil?
406
403
  `)
@@ -465,8 +462,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
465
462
  Content(` ${matchvar} = {
466
463
  "id" => ${srcdatavar}["id"],
467
464
  }
468
- ${datavar}_loaded, err = ${entvar}.load(${matchvar}, nil)
469
- assert_nil err
465
+ ${datavar}_loaded = ${entvar}.load(${matchvar}, nil)
470
466
  ${datavar}_load_result = Helpers.to_map(${datavar}_loaded)
471
467
  assert !${datavar}_load_result.nil?
472
468
  assert_equal ${datavar}_load_result["id"], ${srcdatavar}["id"]
@@ -474,8 +470,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
474
470
  }
475
471
  else {
476
472
  Content(` ${matchvar} = {}
477
- ${datavar}_loaded, err = ${entvar}.load(${matchvar}, nil)
478
- assert_nil err
473
+ ${datavar}_loaded = ${entvar}.load(${matchvar}, nil)
479
474
  assert !${datavar}_loaded.nil?
480
475
  `)
481
476
  }
@@ -503,8 +498,7 @@ const generateRemove: OpGen = (ctx, step, index) => {
503
498
  Content(` ${matchvar} = {
504
499
  "id" => ${srcdatavar}["id"],
505
500
  }
506
- _, err = ${entvar}.remove(${matchvar}, nil)
507
- assert_nil err
501
+ ${entvar}.remove(${matchvar}, nil)
508
502
  `)
509
503
  }
510
504
 
@@ -13,6 +13,7 @@ import { cmp, each, Folder, File, Content } from '@voxgig/sdkgen'
13
13
 
14
14
  import { TestEntity } from './TestEntity_rb'
15
15
  import { TestDirect } from './TestDirect_rb'
16
+ import { ReadmeExamplesTest } from './ReadmeExamplesTest_rb'
16
17
 
17
18
 
18
19
  const Test = cmp(function Test(props: any) {
@@ -41,6 +42,9 @@ end
41
42
  TestEntity({ target, entity })
42
43
  TestDirect({ target, entity })
43
44
  })
45
+
46
+ // README example snippet test (syntax + offline test-mode run).
47
+ ReadmeExamplesTest({ target })
44
48
  })
45
49
  })
46
50
 
@@ -45,6 +45,7 @@ class EntityNameEntity
45
45
  end
46
46
  end
47
47
 
48
+ # @return [EntityName, Hash] the current EntityName data
48
49
  def data_get
49
50
  @_utility.feature_hook.call(@_entctx, "GetData")
50
51
  VoxgigStruct.clone(@_data)
@@ -57,6 +58,7 @@ class EntityNameEntity
57
58
  end
58
59
  end
59
60
 
61
+ # @return [Hash] the current match filter (any subset of EntityName fields)
60
62
  def match_get
61
63
  @_utility.feature_hook.call(@_entctx, "GetMatch")
62
64
  VoxgigStruct.clone(@_match)
@@ -3,6 +3,11 @@ require_relative '../core/helpers'
3
3
 
4
4
  # EJECT-START
5
5
 
6
+ # Create a new EntityName.
7
+ #
8
+ # @param reqdata [EntityNameCreateData, Hash, nil] body data
9
+ # @param ctrl [Object, nil] optional per-call control
10
+ # @return [EntityName, Hash] the created EntityName; raises ProjectNameError on failure
6
11
  def create(reqdata, ctrl = nil)
7
12
  utility = @_utility
8
13
  ctx = utility.make_context.call({
@@ -1,6 +1,12 @@
1
1
  # EJECT-START
2
2
 
3
- def list(reqmatch, ctrl = nil)
3
+ # List EntityName items matching the given filter.
4
+ #
5
+ # @param reqmatch [EntityNameListMatch, Hash, nil] match filter (any subset of
6
+ # EntityName fields); defaults to nil, treated as an empty match that lists all.
7
+ # @param ctrl [Object, nil] optional per-call control
8
+ # @return [Array<EntityName>, Array] the matching EntityName items; raises ProjectNameError on failure
9
+ def list(reqmatch = nil, ctrl = nil)
4
10
  utility = @_utility
5
11
  ctx = utility.make_context.call({
6
12
  "opname" => "list",
@@ -10,11 +16,23 @@
10
16
  "reqmatch" => reqmatch,
11
17
  }, @_entctx)
12
18
 
13
- _run_op(ctx) do
19
+ records = _run_op(ctx) do
14
20
  if ctx.result
15
21
  @_match = ctx.result.resmatch if ctx.result.resmatch
16
22
  end
17
23
  end
24
+
25
+ # list yields the BARE Array of records — each an accessible Hash — so
26
+ # callers can index item["id"] directly, matching py/lua/go. make_result
27
+ # wraps each entry as an Entity instance for internal use; unwrap those
28
+ # back to their bare record Hashes here (load/create/etc. are unaffected).
29
+ if records.is_a?(Array)
30
+ records = records.map do |item|
31
+ item.respond_to?(:data_get) ? item.data_get : item
32
+ end
33
+ end
34
+
35
+ records
18
36
  end
19
37
 
20
38
  # EJECT-END
@@ -3,7 +3,14 @@ require_relative '../core/helpers'
3
3
 
4
4
  # EJECT-START
5
5
 
6
- def load(reqmatch, ctrl = nil)
6
+ # Load a single EntityName.
7
+ #
8
+ # @param reqmatch [EntityNameLoadMatch, Hash, nil] match criteria (id/query fields);
9
+ # optional — an entity with no id-like key loads with no match (nil is treated
10
+ # as an empty match, so client.EntityName.load works with no args).
11
+ # @param ctrl [Object, nil] optional per-call control
12
+ # @return [EntityName, Hash] the loaded EntityName; raises ProjectNameError on failure
13
+ def load(reqmatch = nil, ctrl = nil)
7
14
  utility = @_utility
8
15
  ctx = utility.make_context.call({
9
16
  "opname" => "load",
@@ -3,7 +3,12 @@ require_relative '../core/helpers'
3
3
 
4
4
  # EJECT-START
5
5
 
6
- def remove(reqmatch, ctrl = nil)
6
+ # Remove an EntityName matching the given criteria.
7
+ #
8
+ # @param reqmatch [EntityNameRemoveMatch, Hash, nil] match criteria (id/query fields)
9
+ # @param ctrl [Object, nil] optional per-call control
10
+ # @return [EntityName, Hash] the removed EntityName; raises ProjectNameError on failure
11
+ def remove(reqmatch = nil, ctrl = nil)
7
12
  utility = @_utility
8
13
  ctx = utility.make_context.call({
9
14
  "opname" => "remove",
@@ -3,6 +3,11 @@ require_relative '../core/helpers'
3
3
 
4
4
  # EJECT-START
5
5
 
6
+ # Update an existing EntityName.
7
+ #
8
+ # @param reqdata [EntityNameUpdateData, Hash, nil] body data
9
+ # @param ctrl [Object, nil] optional per-call control
10
+ # @return [EntityName, Hash] the updated EntityName; raises ProjectNameError on failure
6
11
  def update(reqdata, ctrl = nil)
7
12
  utility = @_utility
8
13
  ctx = utility.make_context.call({
@@ -13,6 +13,9 @@ require_relative 'config'
13
13
  require_relative 'feature/base_feature'
14
14
  require_relative 'features'
15
15
 
16
+ # Load typed models (Struct value objects).
17
+ require_relative 'ProjectName_types'
18
+
16
19
 
17
20
  class ProjectNameSDK
18
21
  attr_accessor :mode, :features, :options
@@ -131,16 +134,29 @@ class ProjectNameSDK
131
134
  end
132
135
 
133
136
  _, err = utility.prepare_auth.call(ctx)
134
- return nil, err if err
137
+ raise err if err
138
+
139
+ # make_fetch_def returns a (fetchdef, err) tuple; destructure it and
140
+ # return just the fetchdef Hash (raising on error) so callers — including
141
+ # direct(), which indexes fetchdef["url"] — receive a Hash, mirroring the
142
+ # ts/py prepare().
143
+ fetchdef, fd_err = utility.make_fetch_def.call(ctx)
144
+ raise fd_err if fd_err
135
145
 
136
- utility.make_fetch_def.call(ctx)
146
+ fetchdef
137
147
  end
138
148
 
139
149
  def direct(fetchargs = {})
140
150
  utility = @_utility
141
151
 
142
- fetchdef, err = prepare(fetchargs)
143
- return { "ok" => false, "err" => err }, nil if err
152
+ # direct() is the raw-HTTP escape hatch: it always returns a result hash
153
+ # ({ "ok" => ..., ... }) and never raises. prepare() raises on error, so
154
+ # trap that and surface it in the hash.
155
+ begin
156
+ fetchdef = prepare(fetchargs)
157
+ rescue ProjectNameError => err
158
+ return { "ok" => false, "err" => err }
159
+ end
144
160
 
145
161
  fetchargs ||= {}
146
162
  ctrl = ProjectNameHelpers.to_map(VoxgigStruct.getprop(fetchargs, "ctrl")) || {}
@@ -153,13 +169,13 @@ class ProjectNameSDK
153
169
  url = fetchdef["url"] || ""
154
170
  fetched, fetch_err = utility.fetcher.call(ctx, url, fetchdef)
155
171
 
156
- return { "ok" => false, "err" => fetch_err }, nil if fetch_err
172
+ return { "ok" => false, "err" => fetch_err } if fetch_err
157
173
 
158
174
  if fetched.nil?
159
175
  return {
160
176
  "ok" => false,
161
177
  "err" => ctx.make_error("direct_no_response", "response: undefined"),
162
- }, nil
178
+ }
163
179
  end
164
180
 
165
181
  if fetched.is_a?(Hash)
@@ -189,13 +205,13 @@ class ProjectNameSDK
189
205
  "status" => status,
190
206
  "headers" => headers,
191
207
  "data" => json_data,
192
- }, nil
208
+ }
193
209
  end
194
210
 
195
211
  return {
196
212
  "ok" => false,
197
213
  "err" => ctx.make_error("direct_invalid", "invalid response type"),
198
- }, nil
214
+ }
199
215
  end
200
216
 
201
217
  # <[SLOT]>
@@ -0,0 +1,105 @@
1
+
2
+
3
+ // Typed-model generator (TypeScript reference target).
4
+ //
5
+ // Reads main.<KIT>.entity.<e>.fields[] and per-op params
6
+ // (op.<name>.points[].args.params[]) and emits one file, src/<Sdk>Types.ts,
7
+ // with a TS `interface <Name>` per active entity plus a request/match type per
8
+ // active op. Field/param sentinels ($STRING, $INTEGER, ...) are turned into
9
+ // real TS types by the shared sdkgen helper `canonToType` (source of truth:
10
+ // @voxgig/apidef VALID_CANON).
11
+ //
12
+ // PORT RECIPE (language X): copy this file to EntityTypes_<X>.ts, keep the SAME
13
+ // type-name scheme (<Name>, <Name>LoadMatch, <Name>ListMatch, <Name>CreateData,
14
+ // <Name>UpdateData, <Name>RemoveMatch), swap the interface syntax for X's
15
+ // struct/class/dataclass syntax, pass 'X' to canonToType, wire it into
16
+ // Main_<X>.ts next to EntityBase, and reference the same type names from the
17
+ // <X> op fragments + entity accessor.
18
+
19
+ import {
20
+ cmp, each,
21
+ File, Content,
22
+ } from '@voxgig/sdkgen'
23
+
24
+ import { canonToType, opTypeName, opRequestShape } from '@voxgig/sdkgen'
25
+
26
+ import {
27
+ KIT,
28
+ getModelPath,
29
+ } from '@voxgig/apidef'
30
+
31
+
32
+ const LANG = 'ts'
33
+
34
+
35
+ // A valid TS property key, or a quoted string literal for anything else.
36
+ function propKey(name: string): string {
37
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) ? name : JSON.stringify(name)
38
+ }
39
+
40
+
41
+ const EntityTypes = cmp(function EntityTypes(props: any) {
42
+ const { model } = props.ctx$
43
+
44
+ const entity = getModelPath(model, `main.${KIT}.entity`)
45
+ const entityList = each(entity).filter((e: any) => e.active !== false)
46
+
47
+ File({ name: model.const.Name + 'Types.' + LANG }, () => {
48
+
49
+ Content(`// Typed models for the ${model.const.Name} SDK.
50
+ //
51
+ // GENERATED from the API model: main.${KIT}.entity.<e>.fields[] and per-op
52
+ // params (op.<name>.points[].args.params[]). Field/param types come from the
53
+ // canonical type sentinels via @voxgig/sdkgen canonToType (source of truth:
54
+ // @voxgig/apidef VALID_CANON). Do not edit by hand.
55
+
56
+ `)
57
+
58
+ entityList.forEach((ent: any) => {
59
+ const Name = ent.Name
60
+ const fields = (ent.fields ? each(ent.fields) : [])
61
+ .filter((f: any) => f.active !== false)
62
+
63
+ // Entity data model: one property per field, `req:false` -> optional.
64
+ Content(`export interface ${Name} {
65
+ `)
66
+ fields.forEach((f: any) => {
67
+ const opt = false === f.req ? '?' : ''
68
+ Content(` ${propKey(f.name)}${opt}: ${canonToType(f.type, LANG)}
69
+ `)
70
+ })
71
+ Content(`}
72
+
73
+ `)
74
+
75
+ // Per active op: a request/match type. The members and each member's
76
+ // required/optional decision come from the shared partiality policy
77
+ // (opRequestShape); this file only renders them as a TS interface.
78
+ const ops = ent.op || {}
79
+ ;['load', 'list', 'create', 'update', 'remove'].forEach((opname: string) => {
80
+ if (null == ops[opname]) {
81
+ return
82
+ }
83
+
84
+ const typeName = opTypeName(Name, opname)
85
+ const { items } = opRequestShape(ent, opname)
86
+
87
+ Content(`export interface ${typeName} {
88
+ `)
89
+ items.forEach((it: any) => {
90
+ const opt = it.optional ? '?' : ''
91
+ Content(` ${propKey(it.name)}${opt}: ${canonToType(it.type, LANG)}
92
+ `)
93
+ })
94
+ Content(`}
95
+
96
+ `)
97
+ })
98
+ })
99
+ })
100
+ })
101
+
102
+
103
+ export {
104
+ EntityTypes,
105
+ }
@@ -3,7 +3,8 @@ import * as Path from 'node:path'
3
3
 
4
4
  import {
5
5
  cmp, each, camelify, names,
6
- File, Content, Folder, Fragment, Line, FeatureHook, Slot
6
+ File, Content, Folder, Fragment, Line, FeatureHook, Slot,
7
+ opTypeName,
7
8
  } from '@voxgig/sdkgen'
8
9
 
9
10
  import { EntityOperation } from './EntityOperation_ts'
@@ -20,6 +21,19 @@ const Entity = cmp(function Entity(props: any) {
20
21
 
21
22
  names(entrep, entity.Name, 'EntityName')
22
23
 
24
+ // Import exactly the typed models this entity references: its data type plus
25
+ // one request type per ACTIVE op (matches what EntityTypes_ts.ts emits).
26
+ const typeNames = [entity.Name]
27
+ const opnamesAll = Object.keys(entity.op || {})
28
+ ;['load', 'list', 'create', 'update', 'remove'].forEach((opname: string) => {
29
+ if (opnamesAll.includes(opname)) {
30
+ typeNames.push(opTypeName(entity.Name, opname))
31
+ }
32
+ })
33
+ const typeImport =
34
+ 'import type {\n ' + typeNames.join(',\n ') +
35
+ `,\n} from '../${model.const.Name}Types'`
36
+
23
37
  const ff = Path.normalize(__dirname + '/../../../src/cmp/ts/fragment/')
24
38
 
25
39
  Folder({ name: 'src/entity' }, () => {
@@ -44,6 +58,8 @@ const Entity = cmp(function Entity(props: any) {
44
58
  SdkName: model.const.Name,
45
59
  EntityName: entity.Name,
46
60
 
61
+ '#TypeImports': ({ indent }: any) => Content({ indent }, typeImport),
62
+
47
63
  '#Feature-Hook': ({ name, indent }: any) =>
48
64
  Content({ indent }, `
49
65
  fres = featureHook(ctx, '${name}')
@@ -7,6 +7,7 @@ const MainEntity = cmp(async function MainEntity(props: any) {
7
7
  const { entity } = props
8
8
 
9
9
  Content(`
10
+ // Entity access: \`client.${entity.Name}().list()\` / \`client.${entity.Name}().load({ id })\`.
10
11
  ${entity.Name}(data?: any) {
11
12
  const self = this
12
13
  return new ${entity.Name}Entity(self,data)
@@ -23,6 +23,7 @@ import { Config } from './Config_ts'
23
23
  import { Gitignore } from './Gitignore_ts'
24
24
  import { MainEntity } from './MainEntity_ts'
25
25
  import { EntityBase } from './EntityBase_ts'
26
+ import { EntityTypes } from './EntityTypes_ts'
26
27
  import { SdkError } from './SdkError_ts'
27
28
 
28
29
 
@@ -57,6 +58,10 @@ const Main = cmp(async function Main(props: any) {
57
58
  List({ item: entity }, ({ item }: any) =>
58
59
  Line(`import { ${item.Name}Entity } from './entity/${item.Name}Entity'`))
59
60
 
61
+ // Re-export the generated typed models so consumers can
62
+ // `import { Advice, AdviceLoadMatch } from '<pkg>'`.
63
+ Line(`export type * from './${model.const.Name}Types'\n`)
64
+
60
65
  Fragment(
61
66
  {
62
67
  from: Path.normalize(__dirname + '/../../../src/cmp/ts/fragment/Main.fragment.ts'),
@@ -99,6 +104,7 @@ if (fres instanceof Promise) { await fres }
99
104
 
100
105
  Config({ target })
101
106
  EntityBase({ target })
107
+ EntityTypes({ target })
102
108
 
103
109
  })
104
110
  })
@@ -5,6 +5,12 @@ import {
5
5
  cmp,
6
6
  each,
7
7
  omap,
8
+ packageName,
9
+ pkgDescription,
10
+ keywords,
11
+ repoInfo,
12
+ PUBLISHER,
13
+ PUBLISHER_URL,
8
14
  } from '@voxgig/sdkgen'
9
15
 
10
16
 
@@ -43,16 +49,17 @@ const Package = cmp(async function Package(props: any) {
43
49
  dev: only('dev', target.deps),
44
50
  })
45
51
 
46
- const sdkname = model.name
47
52
  const SdkName = nom(model, 'Name')
48
- const origin = null == model.origin ? '' : `@${model.origin}/`
49
- const sdknamesuffix = model.origin?.endsWith('-sdk') ? '' : '-sdk'
53
+ const { repoUrl, issuesUrl } = repoInfo(model)
50
54
 
51
- // TODO: complete SDK meta data in model and use here
52
55
  const pkg = {
53
- name: `${origin}${sdkname}${sdknamesuffix}`,
56
+ name: packageName(model, 'npm'),
54
57
  version: `0.0.1`,
55
- description: 'DESCRIPTION',
58
+ description: pkgDescription(model, target.name),
59
+ keywords: keywords(model),
60
+ homepage: `${repoUrl}#readme`,
61
+ repository: { type: 'git', url: `git+${repoUrl}.git` },
62
+ bugs: { url: issuesUrl },
56
63
  main: `dist/${SdkName}SDK.js`,
57
64
  type: 'commonjs',
58
65
  types: `dist/${SdkName}SDK.d.ts`,
@@ -67,7 +74,7 @@ const Package = cmp(async function Package(props: any) {
67
74
  "clean": "rm -rf node_modules yarn.lock package-lock.json",
68
75
  "reset": "npm run clean && npm i && npm run build && npm test",
69
76
  },
70
- author: `${SdkName}`,
77
+ author: { name: PUBLISHER, url: PUBLISHER_URL },
71
78
 
72
79
  // TODO: needs to be config
73
80
  license: 'MIT',
@@ -1,11 +1,13 @@
1
1
 
2
- import { cmp, each, Content } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, entityIdField, safeVarName } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
6
6
  getModelPath,
7
7
  } from '@voxgig/apidef'
8
8
 
9
+ import { exampleValue } from './utility_ts'
10
+
9
11
 
10
12
  // Operation method spelling differs between Go and other languages — Go
11
13
  // uses PascalCase methods with explicit ctrl arg, others use lowercase
@@ -41,6 +43,10 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
41
43
  publishedEntities.map((entity: any) => {
42
44
  const opnames = Object.keys(entity.op || {})
43
45
  const fields = entity.fields || []
46
+ // Model-driven id key: null when this entity has no id-like field.
47
+ const idF = entityIdField(entity)
48
+ // Variable-safe lowercase name (a `Delete` entity must not bind `delete`).
49
+ const eVar = safeVarName(entity.name, target.name)
44
50
 
45
51
  Content(`
46
52
  ### ${entity.Name}
@@ -53,7 +59,7 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
53
59
  `)
54
60
  }
55
61
 
56
- Content(`Create an instance: \`const ${entity.name} = client.${entity.Name}()\`
62
+ Content(`Create an instance: \`const ${eVar} = client.${entity.Name}()\`
57
63
 
58
64
  `)
59
65
 
@@ -84,7 +90,7 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
84
90
 
85
91
  each(fields, (field: any) => {
86
92
  const desc = field.short || ''
87
- Content(`| \`${field.name}\` | \`${field.type || 'any'}\` | ${desc} |
93
+ Content(`| \`${field.name}\` | \`${canonToType(field.type, target.name)}\` | ${desc} |
88
94
  `)
89
95
  })
90
96
 
@@ -96,7 +102,7 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
96
102
  Content(`#### Example: Load
97
103
 
98
104
  \`\`\`ts
99
- const ${entity.name} = await client.${entity.Name}().load({ id: '${entity.name}_id' })
105
+ const ${eVar} = await client.${entity.Name}().load(${idF ? `{ ${idF}: ${exampleValue(entity, entity.op && entity.op.load, idF, entity.name + '_id')} }` : ''})
100
106
  \`\`\`
101
107
 
102
108
  `)
@@ -106,7 +112,7 @@ const ${entity.name} = await client.${entity.Name}().load({ id: '${entity.name}_
106
112
  Content(`#### Example: List
107
113
 
108
114
  \`\`\`ts
109
- const ${entity.name}s = await client.${entity.Name}().list()
115
+ const ${eVar}s = await client.${entity.Name}().list()
110
116
  \`\`\`
111
117
 
112
118
  `)
@@ -116,11 +122,11 @@ const ${entity.name}s = await client.${entity.Name}().list()
116
122
  Content(`#### Example: Create
117
123
 
118
124
  \`\`\`ts
119
- const ${entity.name} = await client.${entity.Name}().create({
125
+ const ${eVar} = await client.${entity.Name}().create({
120
126
  `)
121
127
  each(fields, (field: any) => {
122
128
  if ('id' !== field.name && field.req) {
123
- Content(` ${field.name}: /* ${field.type || 'value'} */,
129
+ Content(` ${field.name}: /* ${canonToType(field.type, target.name)} */,
124
130
  `)
125
131
  }
126
132
  })