@voxgig/sdkgen 1.2.1 → 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 +11 -5
  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
@@ -0,0 +1,258 @@
1
+ import { cmp, each, Content, File } from 'jostraca'
2
+
3
+ import {
4
+ KIT,
5
+ getModelPath
6
+ } from '../types'
7
+
8
+
9
+ // Generate the SDK root deployment Makefile from the model's per-target
10
+ // `publish` sections (see model/sdkgen.jsonic):
11
+ //
12
+ // publish.tag — git release tag `<prefix>/vX.Y.Z`; every port has
13
+ // one, pushed with a token from the aql key vault
14
+ // (--for recipe + alias, default github/github).
15
+ // publish.registry — package registry details (name, url, vault
16
+ // credential recipe or raw env mapping) plus a
17
+ // `state` (pending | active | inactive; the legacy
18
+ // `active: true` bool is honoured as an alias for
19
+ // state === 'active'). While a registry is NOT
20
+ // active (publish pending) a real deploy publishes
21
+ // the git tag only; the package upload starts when
22
+ // state flips to 'active'. Tag-only ports (go
23
+ // family) have no registry.
24
+ //
25
+ // Follows the voxgig/struct root Makefile conventions: per-target deploy
26
+ // targets, deliberately no all-targets real deploy (each upload is
27
+ // irreversible), and an everything-at-once DRY run leaning on
28
+ // `aql vault exec --dry-run` filler-token cooperation in each target's
29
+ // publish recipe.
30
+ const Deploy = cmp(function Deploy(props: any) {
31
+ const { ctx$ } = props
32
+ const { model } = ctx$
33
+
34
+ const targetMap = getModelPath(model, `main.${KIT}.target`) || {}
35
+ const targets: any[] = []
36
+ each(targetMap, (t: any) => {
37
+ if (false !== t.active) targets.push(t)
38
+ })
39
+
40
+ if (0 === targets.length) {
41
+ return
42
+ }
43
+
44
+ File({ name: 'Makefile' }, () => {
45
+ Content(makeDeployMakefile(model, targets))
46
+ })
47
+
48
+ ctx$.log.info({
49
+ point: 'generate-deploy',
50
+ note: 'targets: ' + targets.map((t: any) =>
51
+ t.name + (registryOf(t) ? (':' + registryOf(t).name + (regIsActive(registryOf(t)) ? '' : '(publish pending)')) : ':tag-only')
52
+ ).join(',')
53
+ })
54
+ })
55
+
56
+
57
+ function registryOf(t: any): any | undefined {
58
+ const reg = t.publish?.registry
59
+ return (reg && '' !== (reg.name || '')) ? reg : undefined
60
+ }
61
+
62
+
63
+ // A registry is active (package really uploaded) when its tri-state
64
+ // `state === 'active'`. The legacy boolean `active: true` is honoured as a
65
+ // back-compat alias. Anything else — 'pending' (the default), 'inactive' —
66
+ // means a deploy publishes the git tag only.
67
+ function regIsActive(reg: any): boolean {
68
+ if (null == reg) return false
69
+ if (true === reg.active) return true // legacy alias
70
+ return 'active' === reg.state
71
+ }
72
+
73
+
74
+ function aliasVarName(name: string): string {
75
+ return name.toUpperCase().replace(/[^A-Z0-9]+/g, '_') + '_ALIAS'
76
+ }
77
+
78
+
79
+ // The aql vault exec argument string for a target: `--for=<recipe>=<alias>`
80
+ // flags where a preset recipe exists, or a raw `'alias=ENV_VAR,...'`
81
+ // mapping when any credential lacks a preset (e.g. luarocks). The github
82
+ // token for the tag push is always included.
83
+ function vaultExecArgs(t: any): string {
84
+ const tagVault = t.publish?.tag?.vault || {}
85
+ const ghRecipe = tagVault.recipe || 'github'
86
+ const ghVar = aliasVarName(ghRecipe)
87
+ const reg = registryOf(t)
88
+ const regVault = reg?.vault || {}
89
+ const regVar = reg ? aliasVarName(reg.name) : ''
90
+
91
+ if (reg && '' === (regVault.recipe || '') && '' !== (regVault.env || '')) {
92
+ // Raw env mapping style: every credential as alias=ENV_VAR.
93
+ return `'$(${regVar})=${regVault.env},$(${ghVar})=GITHUB_TOKEN'`
94
+ }
95
+
96
+ const flags = []
97
+ if (reg && '' !== (regVault.recipe || '')) {
98
+ flags.push(`--for=${regVault.recipe}=$(${regVar})`)
99
+ }
100
+ flags.push(`--for=${ghRecipe}=$(${ghVar})`)
101
+ return flags.join(' ')
102
+ }
103
+
104
+
105
+ function makeDeployMakefile(model: any, targets: any[]): string {
106
+ // Alias variables: one per distinct vault credential, defaulting to the
107
+ // model's alias (or the registry/recipe name).
108
+ const aliasVars = new Map<string, string>()
109
+ for (const t of targets) {
110
+ const tagVault = t.publish?.tag?.vault || {}
111
+ const ghRecipe = tagVault.recipe || 'github'
112
+ if (!aliasVars.has(aliasVarName(ghRecipe))) {
113
+ aliasVars.set(aliasVarName(ghRecipe), tagVault.alias || ghRecipe)
114
+ }
115
+ const reg = registryOf(t)
116
+ if (reg && !aliasVars.has(aliasVarName(reg.name))) {
117
+ aliasVars.set(aliasVarName(reg.name), reg.vault?.alias || reg.name)
118
+ }
119
+ }
120
+
121
+ const summary = targets.map((t: any) => {
122
+ const reg = registryOf(t)
123
+ const state = reg
124
+ ? `${reg.name} (${regIsActive(reg) ? 'ACTIVE' : 'publish pending: deploy publishes the git tag only'}) ${reg.url || ''}`.trim()
125
+ : 'tag-only'
126
+ return `# ${t.name.padEnd(8)} ${state}`
127
+ }).join('\n')
128
+
129
+ const deployRules = targets.map((t: any) => {
130
+ const reg = registryOf(t)
131
+ // The github token is the only credential a tag-only deploy needs.
132
+ const tagVault = t.publish?.tag?.vault || {}
133
+ const ghRecipe = tagVault.recipe || 'github'
134
+ const ghArgs = `--for=${ghRecipe}=$(${aliasVarName(ghRecipe)})`
135
+ const args = vaultExecArgs(t)
136
+
137
+ const via = t.publish?.tag?.via || 'port'
138
+
139
+ if (!reg && 'root' === via) {
140
+ // Tag-only port with no Makefile of its own (e.g. go-cli): the
141
+ // root tag-push recipe is the whole deploy.
142
+ return `
143
+ deploy-${t.name}:
144
+ \t@echo "deploy-${t.name}: tag-only port — publishing the git tag."
145
+ \taql vault exec ${ghArgs} -- $(MAKE) tag-push-${t.name}
146
+
147
+ deploy-dry-${t.name}:
148
+ \taql vault exec --dry-run ${ghArgs} -- $(MAKE) tag-push-${t.name}
149
+ ${tagPushRecipe(t.name, 'tag-only port')}
150
+ `
151
+ }
152
+
153
+ if (reg && !regIsActive(reg)) {
154
+ // Publish pending: deploying this target publishes its git tag
155
+ // only. The package upload turns on by flipping
156
+ // publish.registry.state to 'active' in the model and regenerating.
157
+ return `
158
+ deploy-${t.name}:
159
+ \t@echo "deploy-${t.name}: ${reg.name} publication is pending — publishing the git tag only."
160
+ \taql vault exec ${ghArgs} -- $(MAKE) tag-push-${t.name}
161
+
162
+ deploy-dry-${t.name}:
163
+ \taql vault exec --dry-run ${ghArgs} -- $(MAKE) tag-push-${t.name}
164
+ ${tagPushRecipe(t.name, reg.name + ' publication pending — tag-only deploy')}
165
+ `
166
+ }
167
+
168
+ return `
169
+ deploy-${t.name}:
170
+ \taql vault exec ${args} -- $(MAKE) -C ${t.name} publish
171
+
172
+ deploy-dry-${t.name}:
173
+ \taql vault exec --dry-run ${args} -- $(MAKE) -C ${t.name} publish
174
+ `
175
+ }).join('')
176
+
177
+ const varLines = Array.from(aliasVars.entries())
178
+ .map(([v, def]) => `${v} ?= ${def}`).join('\n')
179
+
180
+ return `# ${model.Name} SDK deployment. GENERATED by @voxgig/sdkgen — regenerated
181
+ # on every \`npm run generate\` in .sdk/; publication details live in the
182
+ # model (.sdk/model/target/<target>.jsonic, \`publish\` section).
183
+ #
184
+ # Every port gets a git release tag <target>/vX.Y.Z. Ports with an ACTIVE
185
+ # registry also publish a package there. Credentials are injected at exec
186
+ # time by the aql key vault (https://github.com/aql-lang/aql) — never
187
+ # stored on disk or passed on the command line.
188
+ #
189
+ # Publication state (from the model):
190
+ ${summary}
191
+ #
192
+ # make deploy list per-target deploy commands
193
+ # make deploy-<target> deploy ONE target (no deploy-all: each
194
+ # registry upload is irreversible); while a
195
+ # registry is pending this publishes the
196
+ # port's git tag only
197
+ # make deploy-dry rehearse EVERY target: aql --dry-run
198
+ # injects a filler token that each publish
199
+ # recipe detects, so build + test run in full
200
+ # but nothing is uploaded and no tag is cut
201
+ #
202
+ # Vault aliases (override per invocation, e.g. make deploy-ts NPM_ALIAS=work:npm):
203
+
204
+ SHELL := /bin/bash
205
+
206
+ ${varLines}
207
+
208
+ # Lockstep SDK version, read from the canonical ts manifest.
209
+ VERSION := $(shell node -p "require('./ts/package.json').version" 2>/dev/null || echo 0.0.0)
210
+ AQL_DRY_RUN_FILLER := AQL-DRY-RUN-FILLER-NOT-A-REAL-SECRET
211
+
212
+ TARGETS := ${targets.map((t: any) => t.name).join(' ')}
213
+
214
+ .PHONY: deploy deploy-dry \\
215
+ $(addprefix deploy-,$(TARGETS)) $(addprefix deploy-dry-,$(TARGETS)) \\
216
+ $(addprefix tag-push-,$(TARGETS))
217
+
218
+ deploy:
219
+ \t@echo "Deployment is per-target — pick one (each upload is irreversible):"
220
+ \t@echo " make deploy-<target> targets: $(TARGETS)"
221
+ \t@echo "Registry state is set in the model (.sdk/model/target/<t>.jsonic):"
222
+ ${targets.map((t: any) => {
223
+ const reg = registryOf(t)
224
+ const state = reg ? `${reg.name} ${regIsActive(reg) ? 'ACTIVE' : 'publish pending (deploy = git tag only)'}` : 'tag-only'
225
+ return `\t@echo " deploy-${t.name.padEnd(8)} ${state}"`
226
+ }).join('\n')}
227
+ \t@echo "Rehearse everything safely first: make deploy-dry"
228
+
229
+ deploy-dry: $(addprefix deploy-dry-,$(TARGETS))
230
+ \t@echo "deploy-dry: all targets rehearsed OK ($(TARGETS))"
231
+ ${deployRules}`
232
+ }
233
+
234
+
235
+
236
+ // The root-level tag creation + push recipe for a target: aql --dry-run
237
+ // filler cooperation, idempotent tag creation, token-authenticated https
238
+ // push (works from an ssh-remote clone without ssh keys).
239
+ function tagPushRecipe(name: string, note: string): string {
240
+ return `
241
+ tag-push-${name}:
242
+ \t@set -e; tag="${name}/v$(VERSION)"; \\
243
+ \ttoken="\$\${GITHUB_TOKEN:-$$GH_TOKEN}"; \\
244
+ \tif [ "$$token" = "$(AQL_DRY_RUN_FILLER)" ]; then \\
245
+ \t echo "[dry-run] aql filler token detected: would create (if missing) and push tag $$tag; nothing pushed."; exit 0; fi; \\
246
+ \tif [ -z "$$token" ]; then echo "tag-push-${name}: no GITHUB_TOKEN in env — run via make deploy-${name} (aql vault exec)"; exit 1; fi; \\
247
+ \tif git rev-parse -q --verify "refs/tags/$$tag" >/dev/null; then \\
248
+ \t echo "tag $$tag already exists — pushing existing tag"; \\
249
+ \telse git tag -a "$$tag" -m "Release $$tag"; fi; \\
250
+ \turl=$$(git remote get-url origin | sed -E 's#^git@github.com:#https://github.com/#'); \\
251
+ \thdr="AUTHORIZATION: basic $$(printf 'x-access-token:%s' "$$token" | base64 | tr -d '\\n')"; \\
252
+ \tgit -c http.extraheader="$$hdr" push "$$url" "$$tag"; \\
253
+ \techo "pushed $$tag (${note})"`
254
+ }
255
+
256
+ export {
257
+ Deploy
258
+ }
@@ -1,5 +1,5 @@
1
1
 
2
- import { each, cmp, names, Content } from 'jostraca'
2
+ import { each, cmp } from 'jostraca'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -12,14 +12,12 @@ const FeatureHook = cmp(function FeatureHook(props: any, children: any) {
12
12
 
13
13
  const feature = getModelPath(model, `main.${KIT}.feature`)
14
14
 
15
- const hook: any = {}
16
- names(hook, props.name)
17
-
18
- // TODO: much better error reporting for invalid feature hook names
15
+ // A feature need not implement every pipeline stage; only fire the hook
16
+ // for features that declare it as active. Optional chaining guards
17
+ // features whose `hook` map omits this stage entirely.
19
18
  each(feature)
20
- // .map(feature => (console.log(props.name, feature), feature))
21
- .filter(feature => feature.active && feature.hook[props.name].active)
22
- .map(feature => each(children, { call: true, args: feature }))
19
+ .filter(feature => feature.active && feature.hook?.[props.name]?.active)
20
+ .forEach(feature => each(children, { call: true, args: feature }))
23
21
  })
24
22
 
25
23
 
@@ -0,0 +1,49 @@
1
+ import { cmp, Content, File } from 'jostraca'
2
+
3
+ import { PUBLISHER, nonAffiliation } from '../helpers/packageMeta'
4
+
5
+
6
+ // Root MIT LICENSE for the generated SDK repo. The copyright holder is the
7
+ // PUBLISHER (Voxgig): this is an unofficial, generated SDK, so it is NOT
8
+ // attributed to the upstream API owner. A non-affiliation note is appended so
9
+ // the license file itself carries the disclosure.
10
+ const License = cmp(function License(props: any) {
11
+ const { ctx$ } = props
12
+ const { model } = ctx$
13
+
14
+ const year = (model.const && model.const.year) || new Date().getFullYear()
15
+
16
+ File({ name: 'LICENSE' }, () => {
17
+ Content(`MIT License
18
+
19
+ Copyright (c) ${year} ${PUBLISHER}
20
+
21
+ Permission is hereby granted, free of charge, to any person obtaining a copy
22
+ of this software and associated documentation files (the "Software"), to deal
23
+ in the Software without restriction, including without limitation the rights
24
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
+ copies of the Software, and to permit persons to whom the Software is
26
+ furnished to do so, subject to the following conditions:
27
+
28
+ The above copyright notice and this permission notice shall be included in all
29
+ copies or substantial portions of the Software.
30
+
31
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
+ SOFTWARE.
38
+
39
+ ---
40
+
41
+ ${nonAffiliation(model)}
42
+ `)
43
+ })
44
+ })
45
+
46
+
47
+ export {
48
+ License
49
+ }
package/src/cmp/Readme.ts CHANGED
@@ -5,6 +5,7 @@ import { cmp, File, Content } from 'jostraca'
5
5
  import { ReadmeIntro } from './ReadmeIntro'
6
6
  import { ReadmeInstall } from './ReadmeInstall'
7
7
  import { ReadmeQuick } from './ReadmeQuick'
8
+ import { ReadmeErrors } from './ReadmeErrors'
8
9
  import { ReadmeModel } from './ReadmeModel'
9
10
  import { ReadmeOptions } from './ReadmeOptions'
10
11
  import { ReadmeEntity } from './ReadmeEntity'
@@ -22,6 +23,7 @@ const Readme = cmp(function Readme(props: any) {
22
23
  ReadmeIntro({ target })
23
24
  ReadmeInstall({ target })
24
25
  ReadmeQuick({ target })
26
+ ReadmeErrors({ target })
25
27
  ReadmeHowto({ target })
26
28
  ReadmeModel({ target })
27
29
  ReadmeOptions({ target })
@@ -0,0 +1,257 @@
1
+
2
+ import { cmp, Content } from 'jostraca'
3
+
4
+ import {
5
+ KIT,
6
+ getModelPath
7
+ } from '../types'
8
+
9
+ import { entityIdField, entityPrimaryOp } from '../helpers/opShape'
10
+ import { primaryOpCall } from '../helpers/opExample'
11
+ import type { ExampleLang, PrimaryCall } from '../helpers/opExample'
12
+ import { safeVarName } from '../helpers/naming'
13
+
14
+
15
+ // Error handling is one of the everyday developer tasks, so it gets its
16
+ // own user-facing section rather than being buried in the pipeline
17
+ // explanation. The convention differs by language in two ways:
18
+ //
19
+ // 1. Entity operations (load/list/create/update/remove) either THROW
20
+ // (ts, js, py, php, rb) or return an error value (go, lua).
21
+ // 2. The low-level `direct()`/`prepare()` escape hatch does NOT always
22
+ // follow the entity-op convention. In go/lua it returns (value, err);
23
+ // in ts/js it returns the value or an `Error`; in py/php/rb it returns
24
+ // the result envelope — branch on `ok`, and read `err` on failure.
25
+ //
26
+ // The entity-op snippet is rendered from the entity's PRIMARY op (never a
27
+ // hardcoded `load`, which a create-only entity lacks) with a type-correct
28
+ // match id (a numeric id renders `1`, not "example_id"). Targets not listed
29
+ // here (ts, js) use DEFAULT_LANG.
30
+ type LangErrors = {
31
+ // prose + snippet for the entity-op convention, given the pre-rendered
32
+ // primary-op invocation and its op name.
33
+ entity: (call: PrimaryCall, op: string) => string
34
+ // prose + snippet for the direct()/prepare() convention
35
+ direct: string
36
+ }
37
+
38
+
39
+ const DEFAULT_LANG: LangErrors = {
40
+ entity: (call, op) => `Entity operations reject on failure, so wrap them in \`try\` / \`catch\`:
41
+
42
+ \`\`\`ts
43
+ try {
44
+ const ${call.resultVar} = await ${call.expr}
45
+ console.log(${call.resultVar})
46
+ } catch (err) {
47
+ console.error('${op} failed:', err)
48
+ }
49
+ \`\`\`
50
+
51
+ `,
52
+ direct: `The low-level \`direct()\` method does **not** throw — it returns the
53
+ value or an \`Error\`, so check the result before using it:
54
+
55
+ \`\`\`ts
56
+ const result = await client.direct({
57
+ path: '/api/resource/{id}',
58
+ method: 'GET',
59
+ params: { id: 'example_id' },
60
+ })
61
+
62
+ if (result instanceof Error) {
63
+ throw result
64
+ }
65
+ \`\`\`
66
+
67
+ `,
68
+ }
69
+
70
+
71
+ const LANGS: Record<string, LangErrors> = {
72
+ py: {
73
+ entity: (call, op) => `Entity operations raise on failure, so wrap them in \`try\` / \`except\`:
74
+
75
+ \`\`\`python
76
+ try:
77
+ ${call.resultVar} = ${call.expr}
78
+ print(${call.resultVar})
79
+ except Exception as err:
80
+ print(f"${op} failed: {err}")
81
+ \`\`\`
82
+
83
+ `,
84
+ direct: `\`direct()\` does **not** raise — it returns the result envelope. Branch
85
+ on \`ok\`; on failure \`status\` holds the HTTP status (for error responses)
86
+ and \`err\` holds a transport error, so read both defensively:
87
+
88
+ \`\`\`python
89
+ result = client.direct({
90
+ "path": "/api/resource/{id}",
91
+ "method": "GET",
92
+ "params": {"id": "example_id"},
93
+ })
94
+
95
+ if not result["ok"]:
96
+ print("request failed:", result.get("status"), result.get("err"))
97
+ \`\`\`
98
+
99
+ `,
100
+ },
101
+
102
+ php: {
103
+ entity: (call, op) => `Entity operations throw a \`\\Throwable\` on failure, so wrap them in
104
+ \`try\` / \`catch\`:
105
+
106
+ \`\`\`php
107
+ try {
108
+ $${call.resultVar} = ${call.expr};
109
+ } catch (\\Throwable $err) {
110
+ echo "Error: " . $err->getMessage();
111
+ }
112
+ \`\`\`
113
+
114
+ `,
115
+ direct: `\`direct()\` does **not** throw — it returns the result array. Branch on
116
+ \`ok\`; on failure \`status\` holds the HTTP status (for error responses) and
117
+ \`err\` holds a transport error, so read both defensively:
118
+
119
+ \`\`\`php
120
+ $result = $client->direct([
121
+ "path" => "/api/resource/{id}",
122
+ "method" => "GET",
123
+ "params" => ["id" => "example_id"],
124
+ ]);
125
+
126
+ if (! $result["ok"]) {
127
+ $err = $result["err"] ?? null;
128
+ echo "request failed: " . ($err ? $err->getMessage() : "HTTP " . $result["status"]);
129
+ }
130
+ \`\`\`
131
+
132
+ `,
133
+ },
134
+
135
+ rb: {
136
+ entity: (call, op) => `Entity operations raise on failure, so rescue them:
137
+
138
+ \`\`\`ruby
139
+ begin
140
+ ${call.resultVar} = ${call.expr}
141
+ rescue => err
142
+ warn "${op} failed: #{err}"
143
+ end
144
+ \`\`\`
145
+
146
+ `,
147
+ direct: `\`direct\` does **not** raise — it returns the result hash. Branch on
148
+ \`ok\`; on failure \`status\` holds the HTTP status (for error responses) and
149
+ \`err\` holds a transport error, so read both defensively:
150
+
151
+ \`\`\`ruby
152
+ result = client.direct({
153
+ "path" => "/api/resource/{id}",
154
+ "method" => "GET",
155
+ "params" => { "id" => "example_id" },
156
+ })
157
+
158
+ warn "request failed: #{result["err"] || "HTTP #{result["status"]}"}" unless result["ok"]
159
+ \`\`\`
160
+
161
+ `,
162
+ },
163
+
164
+ lua: {
165
+ entity: (call, op) => `Entity operations return \`(value, err)\`. Check \`err\` before using
166
+ the value:
167
+
168
+ \`\`\`lua
169
+ local ${call.resultVar}, err = ${call.expr}
170
+ if err then error(err) end
171
+ \`\`\`
172
+
173
+ `,
174
+ direct: `\`direct\` follows the same \`(value, err)\` convention:
175
+
176
+ \`\`\`lua
177
+ local result, err = client:direct({
178
+ path = "/api/resource/{id}",
179
+ method = "GET",
180
+ params = { id = "example_id" },
181
+ })
182
+ if err then error(err) end
183
+ \`\`\`
184
+
185
+ `,
186
+ },
187
+
188
+ go: {
189
+ entity: (call, op) => `Every entity operation returns \`(value, error)\`. Check \`err\` before
190
+ using the value — there is no exception to catch:
191
+
192
+ \`\`\`go
193
+ ${call.resultVar}, err := ${call.expr}
194
+ if err != nil {
195
+ // handle err
196
+ return
197
+ }
198
+ _ = ${call.resultVar}
199
+ \`\`\`
200
+
201
+ `,
202
+ direct: `\`Direct\` follows the same \`(value, error)\` convention:
203
+
204
+ \`\`\`go
205
+ result, err := client.Direct(map[string]any{
206
+ "path": "/api/resource/{id}",
207
+ "method": "GET",
208
+ "params": map[string]any{"id": "example_id"},
209
+ })
210
+ if err != nil {
211
+ // handle err
212
+ }
213
+ _ = result
214
+ \`\`\`
215
+
216
+ `,
217
+ },
218
+ }
219
+
220
+
221
+ const ReadmeErrors = cmp(function ReadmeErrors(props: any) {
222
+ const { target, ctx$ } = props
223
+ const { model } = ctx$
224
+
225
+ const lang = LANGS[target.name] || DEFAULT_LANG
226
+
227
+ // Derive a real example entity from the model (the same way the sibling
228
+ // Readme components do) so the snippet never references a phantom entity.
229
+ const entity = getModelPath(model, `main.${KIT}.entity`, { only_active: false, required: false })
230
+ const ex = Object.values(entity || {}).find((e: any) => e && e.active !== false) as any
231
+ const eName = ex ? (ex.Name || (ex.name[0].toUpperCase() + ex.name.slice(1))) : 'Entity'
232
+ // Sanitise the variable name against the target's reserved words (a `Delete`
233
+ // entity must not bind `const delete = ...`).
234
+ const eLower = safeVarName(eName.toLowerCase(), target.name)
235
+
236
+ // The entity's id-like key field name, or null when it has none.
237
+ const idF = entityIdField(ex)
238
+ // The entity's PRIMARY op — an op it actually exposes (prefer list/load, else
239
+ // create/update/remove). A create-only entity therefore never shows a
240
+ // phantom `.load()`.
241
+ const primaryOp = entityPrimaryOp(ex) || 'load'
242
+ const call = primaryOpCall(target.name as ExampleLang, eName, eLower, primaryOp, idF, ex)
243
+
244
+ Content(`
245
+ ## Error handling
246
+
247
+ `)
248
+
249
+ Content(lang.entity(call, primaryOp))
250
+
251
+ Content(lang.direct)
252
+ })
253
+
254
+
255
+ export {
256
+ ReadmeErrors
257
+ }