@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.
- package/bin/voxgig-sdkgen +2 -2
- package/dist/action/action.d.ts +3 -1
- package/dist/action/action.js +26 -10
- package/dist/action/action.js.map +1 -1
- package/dist/action/feature.js +9 -8
- package/dist/action/feature.js.map +1 -1
- package/dist/action/target.d.ts +7 -1
- package/dist/action/target.js +22 -13
- package/dist/action/target.js.map +1 -1
- package/dist/cmp/Changelog.d.ts +2 -0
- package/dist/cmp/Changelog.js +30 -0
- package/dist/cmp/Changelog.js.map +1 -0
- package/dist/cmp/Deploy.d.ts +2 -0
- package/dist/cmp/Deploy.js +227 -0
- package/dist/cmp/Deploy.js.map +1 -0
- package/dist/cmp/FeatureHook.js +5 -6
- package/dist/cmp/FeatureHook.js.map +1 -1
- package/dist/cmp/License.d.ts +2 -0
- package/dist/cmp/License.js +44 -0
- package/dist/cmp/License.js.map +1 -0
- package/dist/cmp/Readme.js +2 -0
- package/dist/cmp/Readme.js.map +1 -1
- package/dist/cmp/ReadmeErrors.d.ts +2 -0
- package/dist/cmp/ReadmeErrors.js +210 -0
- package/dist/cmp/ReadmeErrors.js.map +1 -0
- package/dist/cmp/ReadmeExplanation.js +213 -223
- package/dist/cmp/ReadmeExplanation.js.map +1 -1
- package/dist/cmp/ReadmeModel.js +6 -1
- package/dist/cmp/ReadmeModel.js.map +1 -1
- package/dist/cmp/ReadmeTop.js +389 -82
- package/dist/cmp/ReadmeTop.js.map +1 -1
- package/dist/cmp/Security.d.ts +2 -0
- package/dist/cmp/Security.js +36 -0
- package/dist/cmp/Security.js.map +1 -0
- package/dist/helpers/canonType.d.ts +7 -0
- package/dist/helpers/canonType.js +74 -0
- package/dist/helpers/canonType.js.map +1 -0
- package/dist/helpers/collectDeps.d.ts +3 -2
- package/dist/helpers/collectDeps.js.map +1 -1
- package/dist/helpers/naming.d.ts +3 -0
- package/dist/helpers/naming.js +51 -0
- package/dist/helpers/naming.js.map +1 -0
- package/dist/helpers/opExample.d.ts +13 -0
- package/dist/helpers/opExample.js +149 -0
- package/dist/helpers/opExample.js.map +1 -0
- package/dist/helpers/opShape.d.ts +18 -0
- package/dist/helpers/opShape.js +225 -0
- package/dist/helpers/opShape.js.map +1 -0
- package/dist/helpers/packageMeta.d.ts +27 -0
- package/dist/helpers/packageMeta.js +224 -0
- package/dist/helpers/packageMeta.js.map +1 -0
- package/dist/sdkgen.d.ts +12 -2
- package/dist/sdkgen.js +60 -20
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +65 -2
- package/dist/types.js.map +1 -1
- package/dist/utility.d.ts +2 -1
- package/dist/utility.js +39 -11
- package/dist/utility.js.map +1 -1
- package/model/sdkgen.aontu +137 -0
- package/package.json +11 -5
- package/project/.sdk/model/feature/feature-index.aontu +5 -0
- package/project/.sdk/model/target/go-cli.aontu +47 -0
- package/project/.sdk/model/target/go-mcp.aontu +41 -0
- package/project/.sdk/model/target/go.aontu +28 -0
- package/project/.sdk/model/target/{js.jsonic → js.aontu} +13 -0
- package/project/.sdk/model/target/{lua.jsonic → lua.aontu} +13 -0
- package/project/.sdk/model/target/{php.jsonic → php.aontu} +13 -0
- package/project/.sdk/model/target/{py.jsonic → py.aontu} +13 -0
- package/project/.sdk/model/target/{rb.jsonic → rb.aontu} +13 -0
- package/project/.sdk/model/target/{ts.jsonic → ts.aontu} +13 -0
- package/project/.sdk/src/cmp/go/Config_go.ts +3 -2
- package/project/.sdk/src/cmp/go/EntityOperation_go.ts +1 -0
- package/project/.sdk/src/cmp/go/EntityTypes_go.ts +197 -0
- package/project/.sdk/src/cmp/go/Entity_go.ts +2 -1
- package/project/.sdk/src/cmp/go/MainEntity_go.ts +6 -0
- package/project/.sdk/src/cmp/go/Main_go.ts +23 -3
- package/project/.sdk/src/cmp/go/Package_go.ts +1 -1
- package/project/.sdk/src/cmp/go/ReadmeEntity_go.ts +48 -10
- package/project/.sdk/src/cmp/go/ReadmeExamplesTest_go.ts +688 -0
- package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +1 -1
- package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +52 -8
- package/project/.sdk/src/cmp/go/ReadmeInstall_go.ts +11 -6
- package/project/.sdk/src/cmp/go/ReadmeIntro_go.ts +40 -1
- package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +67 -17
- package/project/.sdk/src/cmp/go/ReadmeOptions_go.ts +4 -3
- package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +146 -116
- package/project/.sdk/src/cmp/go/ReadmeRef_go.ts +87 -21
- package/project/.sdk/src/cmp/go/ReadmeTopHowto_go.ts +4 -0
- package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +75 -16
- package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +35 -5
- package/project/.sdk/src/cmp/go/TestEntity_go.ts +1 -1
- package/project/.sdk/src/cmp/go/Test_go.ts +5 -1
- package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +21 -0
- package/project/.sdk/src/cmp/go/fragment/EntityCreateOp.fragment.go +11 -0
- package/project/.sdk/src/cmp/go/fragment/EntityListOp.fragment.go +11 -0
- package/project/.sdk/src/cmp/go/fragment/EntityLoadOp.fragment.go +11 -0
- package/project/.sdk/src/cmp/go/fragment/EntityRemoveOp.fragment.go +11 -0
- package/project/.sdk/src/cmp/go/fragment/EntityUpdateOp.fragment.go +11 -0
- package/project/.sdk/src/cmp/go/utility_go.ts +70 -0
- package/project/.sdk/src/cmp/go-cli/Main_go-cli.ts +195 -0
- package/project/.sdk/src/cmp/go-cli/fragment/main.fragment.go +106 -0
- package/project/.sdk/src/cmp/go-cli/fragment/words.fragment.go +132 -0
- package/project/.sdk/src/cmp/go-mcp/Main_go-mcp.ts +184 -0
- package/project/.sdk/src/cmp/go-mcp/fragment/main.fragment.go +68 -0
- package/project/.sdk/src/cmp/go-mcp/fragment/tools.fragment.go +114 -0
- package/project/.sdk/src/cmp/js/Config_js.ts +3 -6
- package/project/.sdk/src/cmp/js/EntityTypes_js.ts +111 -0
- package/project/.sdk/src/cmp/js/MainEntity_js.ts +1 -0
- package/project/.sdk/src/cmp/js/Main_js.ts +3 -0
- package/project/.sdk/src/cmp/js/Package_js.ts +16 -7
- package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +33 -10
- package/project/.sdk/src/cmp/js/ReadmeExplanation_js.ts +2 -2
- package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +52 -11
- package/project/.sdk/src/cmp/js/ReadmeIntro_js.ts +39 -1
- package/project/.sdk/src/cmp/js/ReadmeModel_js.ts +50 -18
- package/project/.sdk/src/cmp/js/ReadmeOptions_js.ts +4 -3
- package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +70 -20
- package/project/.sdk/src/cmp/js/ReadmeRef_js.ts +50 -16
- package/project/.sdk/src/cmp/js/ReadmeTopHowto_js.ts +3 -0
- package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +45 -19
- package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +35 -3
- package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +5 -0
- package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +5 -0
- package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +5 -0
- package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +5 -0
- package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +5 -0
- package/project/.sdk/src/cmp/js/utility_js.ts +57 -0
- package/project/.sdk/src/cmp/lua/Config_lua.ts +3 -2
- package/project/.sdk/src/cmp/lua/EntityTypes_lua.ts +113 -0
- package/project/.sdk/src/cmp/lua/MainEntity_lua.ts +8 -0
- package/project/.sdk/src/cmp/lua/Main_lua.ts +4 -0
- package/project/.sdk/src/cmp/lua/Package_lua.ts +23 -4
- package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +50 -13
- package/project/.sdk/src/cmp/lua/ReadmeExamplesTest_lua.ts +293 -0
- package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +46 -8
- package/project/.sdk/src/cmp/lua/ReadmeInstall_lua.ts +19 -3
- package/project/.sdk/src/cmp/lua/ReadmeIntro_lua.ts +38 -1
- package/project/.sdk/src/cmp/lua/ReadmeModel_lua.ts +51 -16
- package/project/.sdk/src/cmp/lua/ReadmeOptions_lua.ts +4 -3
- package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +156 -21
- package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +71 -23
- package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +46 -9
- package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +43 -5
- package/project/.sdk/src/cmp/lua/Test_lua.ts +4 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityCreateOp.fragment.lua +4 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityListOp.fragment.lua +4 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityLoadOp.fragment.lua +4 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityRemoveOp.fragment.lua +4 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityUpdateOp.fragment.lua +4 -0
- package/project/.sdk/src/cmp/php/Config_php.ts +3 -2
- package/project/.sdk/src/cmp/php/EntityTypes_php.ts +142 -0
- package/project/.sdk/src/cmp/php/MainEntity_php.ts +18 -1
- package/project/.sdk/src/cmp/php/Main_php.ts +4 -0
- package/project/.sdk/src/cmp/php/Package_php.ts +18 -7
- package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +46 -14
- package/project/.sdk/src/cmp/php/ReadmeExamplesTest_php.ts +401 -0
- package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +56 -13
- package/project/.sdk/src/cmp/php/ReadmeInstall_php.ts +15 -3
- package/project/.sdk/src/cmp/php/ReadmeIntro_php.ts +40 -1
- package/project/.sdk/src/cmp/php/ReadmeModel_php.ts +26 -8
- package/project/.sdk/src/cmp/php/ReadmeOptions_php.ts +4 -3
- package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +159 -25
- package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +90 -45
- package/project/.sdk/src/cmp/php/ReadmeTopHowto_php.ts +1 -1
- package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +43 -11
- package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +52 -11
- package/project/.sdk/src/cmp/php/TestDirect_php.ts +9 -9
- package/project/.sdk/src/cmp/php/TestEntity_php.ts +6 -12
- package/project/.sdk/src/cmp/php/Test_php.ts +4 -0
- package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +13 -1
- package/project/.sdk/src/cmp/php/fragment/EntityCreateOp.fragment.php +10 -1
- package/project/.sdk/src/cmp/php/fragment/EntityListOp.fragment.php +10 -1
- package/project/.sdk/src/cmp/php/fragment/EntityLoadOp.fragment.php +10 -1
- package/project/.sdk/src/cmp/php/fragment/EntityRemoveOp.fragment.php +10 -1
- package/project/.sdk/src/cmp/php/fragment/EntityUpdateOp.fragment.php +10 -1
- package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +22 -14
- package/project/.sdk/src/cmp/py/Config_py.ts +3 -2
- package/project/.sdk/src/cmp/py/EntityTypes_py.ts +184 -0
- package/project/.sdk/src/cmp/py/Entity_py.ts +27 -0
- package/project/.sdk/src/cmp/py/MainEntity_py.ts +2 -1
- package/project/.sdk/src/cmp/py/Main_py.ts +35 -0
- package/project/.sdk/src/cmp/py/Package_py.ts +24 -3
- package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +48 -14
- package/project/.sdk/src/cmp/py/ReadmeExamplesTest_py.ts +626 -0
- package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +53 -14
- package/project/.sdk/src/cmp/py/ReadmeInstall_py.ts +19 -3
- package/project/.sdk/src/cmp/py/ReadmeIntro_py.ts +48 -1
- package/project/.sdk/src/cmp/py/ReadmeModel_py.ts +28 -10
- package/project/.sdk/src/cmp/py/ReadmeOptions_py.ts +4 -3
- package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +150 -27
- package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +86 -40
- package/project/.sdk/src/cmp/py/ReadmeTopHowto_py.ts +1 -1
- package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +45 -11
- package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +43 -5
- package/project/.sdk/src/cmp/py/TestDirect_py.ts +7 -9
- package/project/.sdk/src/cmp/py/TestEntity_py.ts +6 -14
- package/project/.sdk/src/cmp/py/Test_py.ts +4 -0
- package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +5 -2
- package/project/.sdk/src/cmp/py/fragment/EntityCreateOp.fragment.py +1 -1
- package/project/.sdk/src/cmp/py/fragment/EntityListOp.fragment.py +5 -1
- package/project/.sdk/src/cmp/py/fragment/EntityLoadOp.fragment.py +6 -1
- package/project/.sdk/src/cmp/py/fragment/EntityRemoveOp.fragment.py +6 -1
- package/project/.sdk/src/cmp/py/fragment/EntityUpdateOp.fragment.py +1 -1
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +17 -10
- package/project/.sdk/src/cmp/rb/Config_rb.ts +3 -2
- package/project/.sdk/src/cmp/rb/EntityTypes_rb.ts +136 -0
- package/project/.sdk/src/cmp/rb/MainEntity_rb.ts +1 -0
- package/project/.sdk/src/cmp/rb/Main_rb.ts +4 -0
- package/project/.sdk/src/cmp/rb/Package_rb.ts +34 -7
- package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +47 -13
- package/project/.sdk/src/cmp/rb/ReadmeExamplesTest_rb.ts +289 -0
- package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +72 -21
- package/project/.sdk/src/cmp/rb/ReadmeInstall_rb.ts +16 -4
- package/project/.sdk/src/cmp/rb/ReadmeIntro_rb.ts +40 -1
- package/project/.sdk/src/cmp/rb/ReadmeModel_rb.ts +29 -12
- package/project/.sdk/src/cmp/rb/ReadmeOptions_rb.ts +4 -3
- package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +163 -25
- package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +85 -40
- package/project/.sdk/src/cmp/rb/ReadmeTopHowto_rb.ts +1 -1
- package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +45 -11
- package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +54 -11
- package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +9 -9
- package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +6 -12
- package/project/.sdk/src/cmp/rb/Test_rb.ts +4 -0
- package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +2 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityCreateOp.fragment.rb +5 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityListOp.fragment.rb +20 -2
- package/project/.sdk/src/cmp/rb/fragment/EntityLoadOp.fragment.rb +8 -1
- package/project/.sdk/src/cmp/rb/fragment/EntityRemoveOp.fragment.rb +6 -1
- package/project/.sdk/src/cmp/rb/fragment/EntityUpdateOp.fragment.rb +5 -0
- package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +24 -8
- package/project/.sdk/src/cmp/ts/Config_ts.ts +3 -6
- package/project/.sdk/src/cmp/ts/EntityTypes_ts.ts +105 -0
- package/project/.sdk/src/cmp/ts/Entity_ts.ts +17 -1
- package/project/.sdk/src/cmp/ts/MainEntity_ts.ts +1 -0
- package/project/.sdk/src/cmp/ts/Main_ts.ts +6 -0
- package/project/.sdk/src/cmp/ts/Package_ts.ts +14 -7
- package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +32 -10
- package/project/.sdk/src/cmp/ts/ReadmeExampleTest_ts.ts +81 -0
- package/project/.sdk/src/cmp/ts/ReadmeExamplesTest_ts.ts +446 -0
- package/project/.sdk/src/cmp/ts/ReadmeExplanation_ts.ts +2 -2
- package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +57 -11
- package/project/.sdk/src/cmp/ts/ReadmeInstall_ts.ts +19 -6
- package/project/.sdk/src/cmp/ts/ReadmeIntro_ts.ts +39 -1
- package/project/.sdk/src/cmp/ts/ReadmeModel_ts.ts +50 -18
- package/project/.sdk/src/cmp/ts/ReadmeOptions_ts.ts +4 -3
- package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +141 -48
- package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +50 -16
- package/project/.sdk/src/cmp/ts/ReadmeTopHowto_ts.ts +3 -0
- package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +58 -19
- package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +35 -3
- package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +2 -2
- package/project/.sdk/src/cmp/ts/Test_ts.ts +5 -0
- package/project/.sdk/src/cmp/ts/fragment/Entity.fragment.ts +3 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +10 -5
- package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +4 -2
- package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +4 -2
- package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +4 -2
- package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +4 -2
- package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +4 -2
- package/project/.sdk/src/cmp/ts/utility_ts.ts +59 -0
- package/project/.sdk/tm/go/LICENSE +1 -1
- package/project/.sdk/tm/go/Makefile +36 -1
- package/project/.sdk/tm/go/VERSION +1 -0
- package/project/.sdk/tm/go/core/context.go +12 -7
- package/project/.sdk/tm/go-cli/src/feature/README.md +6 -0
- package/project/.sdk/tm/go-cli/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/README.md +6 -0
- package/project/.sdk/tm/go-mcp/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/js/LICENSE +1 -1
- package/project/.sdk/tm/js/Makefile +41 -0
- package/project/.sdk/tm/lua/LICENSE +1 -1
- package/project/.sdk/tm/lua/Makefile +40 -1
- package/project/.sdk/tm/lua/core/context.lua +13 -8
- package/project/.sdk/tm/php/LICENSE +1 -1
- package/project/.sdk/tm/php/Makefile +31 -1
- package/project/.sdk/tm/php/VERSION +1 -0
- package/project/.sdk/tm/php/core/Context.php +12 -6
- package/project/.sdk/tm/php/test/PrimaryUtilityTest.php +13 -4
- package/project/.sdk/tm/php/utility/Done.php +2 -2
- package/project/.sdk/tm/php/utility/MakeError.php +3 -3
- package/project/.sdk/tm/py/LICENSE +1 -1
- package/project/.sdk/tm/py/Makefile +34 -1
- package/project/.sdk/tm/py/core/context.py +12 -7
- package/project/.sdk/tm/py/test/test_primary_utility.py +15 -4
- package/project/.sdk/tm/py/test/test_struct_utility.py +1 -1
- package/project/.sdk/tm/py/utility/done.py +3 -1
- package/project/.sdk/tm/py/utility/make_error.py +2 -2
- package/project/.sdk/tm/rb/LICENSE +1 -1
- package/project/.sdk/tm/rb/Makefile +36 -2
- package/project/.sdk/tm/rb/core/context.rb +8 -3
- package/project/.sdk/tm/rb/test/primary_utility_test.rb +2 -2
- package/project/.sdk/tm/rb/utility/done.rb +3 -1
- package/project/.sdk/tm/rb/utility/make_error.rb +5 -2
- package/project/.sdk/tm/ts/LICENSE +1 -1
- package/project/.sdk/tm/ts/Makefile +42 -0
- package/project/.sdk/tm/ts/src/Context.ts +8 -3
- package/src/action/action.ts +30 -11
- package/src/action/feature.ts +12 -14
- package/src/action/target.ts +28 -17
- package/src/cmp/Changelog.ts +34 -0
- package/src/cmp/Deploy.ts +258 -0
- package/src/cmp/FeatureHook.ts +6 -8
- package/src/cmp/License.ts +49 -0
- package/src/cmp/Readme.ts +2 -0
- package/src/cmp/ReadmeErrors.ts +257 -0
- package/src/cmp/ReadmeExplanation.ts +250 -230
- package/src/cmp/ReadmeModel.ts +7 -2
- package/src/cmp/ReadmeTop.ts +411 -95
- package/src/cmp/Security.ts +41 -0
- package/src/helpers/canonType.ts +89 -0
- package/src/helpers/collectDeps.ts +5 -3
- package/src/helpers/naming.ts +59 -0
- package/src/helpers/opExample.ts +170 -0
- package/src/helpers/opShape.ts +274 -0
- package/src/helpers/packageMeta.ts +236 -0
- package/src/sdkgen.ts +91 -23
- package/src/tsconfig.json +1 -0
- package/src/types.ts +85 -2
- package/src/utility.ts +45 -11
- package/README.md +0 -2
- package/dist/action/lang.d.ts +0 -2
- package/dist/action/lang.js +0 -68
- package/dist/action/lang.js.map +0 -1
- package/dist/cmp/Hook.d.ts +0 -2
- package/dist/cmp/Hook.js +0 -10
- package/dist/cmp/Hook.js.map +0 -1
- package/dist/cmp/Top.d.ts +0 -2
- package/dist/cmp/Top.js +0 -23
- package/dist/cmp/Top.js.map +0 -1
- package/dist/prepare-openapi.d.ts +0 -2
- package/dist/prepare-openapi.js +0 -37
- package/dist/prepare-openapi.js.map +0 -1
- package/model/sdkgen.jsonic +0 -74
- package/project/.sdk/model/feature/feature-index.jsonic +0 -5
- package/project/.sdk/model/target/go.jsonic +0 -22
- package/project/.sdk/tm/go/utility/struct/go.mod +0 -3
- /package/project/.sdk/model/feature/{log.jsonic → log.aontu} +0 -0
- /package/project/.sdk/model/feature/{test.jsonic → test.aontu} +0 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
// Typed-model generator (Go target).
|
|
4
|
+
//
|
|
5
|
+
// Reads main.<KIT>.entity.<e>.fields[] and per-op params
|
|
6
|
+
// (op.<name>.points[].args.params[]) and emits one file, entity/types.go, in
|
|
7
|
+
// the `entity` package, with a Go `type <Name> struct { ... }` per entity plus
|
|
8
|
+
// a request/match struct per active op. Field/param sentinels ($STRING,
|
|
9
|
+
// $INTEGER, ...) are turned into real Go types by the shared sdkgen helper
|
|
10
|
+
// `canonToType` (source of truth: @voxgig/apidef VALID_CANON).
|
|
11
|
+
//
|
|
12
|
+
// PORT NOTES (Go specifics vs the TS reference):
|
|
13
|
+
// * Types live in the SAME package as the entity methods (`entity`), so the
|
|
14
|
+
// generated typed accessors reference them without an import (task step B).
|
|
15
|
+
// * Go has no method overloading and go-cli / go-mcp dispatch entities
|
|
16
|
+
// dynamically through the untyped `core.ProjectNameEntity` interface
|
|
17
|
+
// (Load/List/... (map[string]any) (any, error)). That interface — and the
|
|
18
|
+
// untyped concrete methods that satisfy it — are therefore KEPT unchanged.
|
|
19
|
+
// Typed access is delivered ADDITIVELY: the op fragments emit `LoadTyped`
|
|
20
|
+
// / `ListTyped` / ... alongside the untyped methods, and Entity.fragment.go
|
|
21
|
+
// emits `DataTyped` / `MatchTyped`. All are thin typed wrappers over the
|
|
22
|
+
// untyped runtime (identical behaviour), converting at the typed boundary
|
|
23
|
+
// via the JSON-round-trip helpers emitted at the bottom of this file.
|
|
24
|
+
// * `list` typed op returns []<Name>; other typed ops return <Name>.
|
|
25
|
+
// * op WITH params -> a struct of those params (reqd:false -> pointer +
|
|
26
|
+
// ,omitempty). op WITHOUT params -> a struct mirroring the entity fields
|
|
27
|
+
// with every field optional (Go's analog of TS `Partial<Name>`).
|
|
28
|
+
|
|
29
|
+
import {
|
|
30
|
+
cmp, each,
|
|
31
|
+
File, Content, Folder,
|
|
32
|
+
} from '@voxgig/sdkgen'
|
|
33
|
+
|
|
34
|
+
import { canonToType, opTypeName, opRequestShape } from '@voxgig/sdkgen'
|
|
35
|
+
|
|
36
|
+
import {
|
|
37
|
+
KIT,
|
|
38
|
+
getModelPath,
|
|
39
|
+
} from '@voxgig/apidef'
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
const LANG = 'go'
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
function cap(s: string): string {
|
|
46
|
+
return s.charAt(0).toUpperCase() + s.slice(1)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
// A model field/param name -> an exported Go field identifier:
|
|
51
|
+
// advice -> Advice, some_field -> SomeField, id -> Id.
|
|
52
|
+
function goField(name: string): string {
|
|
53
|
+
const out = String(name)
|
|
54
|
+
.replace(/[^A-Za-z0-9]+/g, ' ')
|
|
55
|
+
.trim()
|
|
56
|
+
.split(/\s+/)
|
|
57
|
+
.filter(Boolean)
|
|
58
|
+
.map((s) => s.charAt(0).toUpperCase() + s.slice(1))
|
|
59
|
+
.join('')
|
|
60
|
+
// Go identifiers can't start with a digit.
|
|
61
|
+
return /^[A-Za-z_]/.test(out) ? out : 'F' + out
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
// One Go struct field line. `optional` -> pointer + ,omitempty (Go's closest
|
|
66
|
+
// analog to an optional/absent field).
|
|
67
|
+
function fieldLine(name: string, sentinel: any, optional: boolean): string {
|
|
68
|
+
const gt = canonToType(sentinel, LANG)
|
|
69
|
+
const typ = optional ? ('*' + gt) : gt
|
|
70
|
+
const tag = optional ? `\`json:"${name},omitempty"\`` : `\`json:"${name}"\``
|
|
71
|
+
return `\t${goField(name)} ${typ} ${tag}\n`
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
const EntityTypes = cmp(function EntityTypes(props: any) {
|
|
76
|
+
const { target } = props
|
|
77
|
+
const { model } = props.ctx$
|
|
78
|
+
|
|
79
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
80
|
+
// Emit for every entity that gets an entity file. Main_go.ts iterates
|
|
81
|
+
// entities WITHOUT an `active` filter, so a struct is required for each so
|
|
82
|
+
// the typed accessors in every *_entity.go resolve at compile time.
|
|
83
|
+
const entityList = each(entity).filter((e: any) => e && null != e.Name)
|
|
84
|
+
|
|
85
|
+
Folder({ name: 'entity' }, () => {
|
|
86
|
+
|
|
87
|
+
File({ name: 'types.' + target.ext }, () => {
|
|
88
|
+
|
|
89
|
+
Content(`// Typed models for the ${model.const.Name} SDK.
|
|
90
|
+
//
|
|
91
|
+
// GENERATED from the API model: main.${KIT}.entity.<e>.fields[] and per-op
|
|
92
|
+
// params (op.<name>.points[].args.params[]). Field/param types come from the
|
|
93
|
+
// canonical type sentinels via @voxgig/sdkgen canonToType (source of truth:
|
|
94
|
+
// @voxgig/apidef VALID_CANON). Do not edit by hand.
|
|
95
|
+
package entity
|
|
96
|
+
|
|
97
|
+
import "encoding/json"
|
|
98
|
+
|
|
99
|
+
`)
|
|
100
|
+
|
|
101
|
+
entityList.forEach((ent: any) => {
|
|
102
|
+
const Name = ent.Name
|
|
103
|
+
const fields = (ent.fields ? each(ent.fields) : [])
|
|
104
|
+
.filter((f: any) => f.active !== false)
|
|
105
|
+
|
|
106
|
+
// Entity data model: one field per model field. req:false -> pointer.
|
|
107
|
+
Content(`// ${Name} is the typed data model for the ${ent.name} entity.
|
|
108
|
+
type ${Name} struct {
|
|
109
|
+
`)
|
|
110
|
+
fields.forEach((f: any) => {
|
|
111
|
+
Content(fieldLine(f.name, f.type, false === f.req))
|
|
112
|
+
})
|
|
113
|
+
Content(`}
|
|
114
|
+
|
|
115
|
+
`)
|
|
116
|
+
|
|
117
|
+
// Per active op: a request/match struct (same package as the entity
|
|
118
|
+
// methods, so no import is needed there). Members and their optionality
|
|
119
|
+
// come from the shared partiality policy (opRequestShape); this file
|
|
120
|
+
// only renders them as a Go struct (optional -> pointer + ,omitempty).
|
|
121
|
+
const ops = ent.op || {}
|
|
122
|
+
;['load', 'list', 'create', 'update', 'remove'].forEach((opname: string) => {
|
|
123
|
+
if (null == ops[opname]) {
|
|
124
|
+
return
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const typeName = opTypeName(Name, opname)
|
|
128
|
+
const { items } = opRequestShape(ent, opname)
|
|
129
|
+
|
|
130
|
+
Content(`// ${typeName} is the typed request payload for ${Name}.${cap(opname)}Typed.
|
|
131
|
+
type ${typeName} struct {
|
|
132
|
+
`)
|
|
133
|
+
items.forEach((it: any) => {
|
|
134
|
+
Content(fieldLine(it.name, it.type, it.optional))
|
|
135
|
+
})
|
|
136
|
+
Content(`}
|
|
137
|
+
|
|
138
|
+
`)
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
// Conversion helpers shared by the generated typed accessors/methods.
|
|
143
|
+
// Kept unexported and package-local so the typed boundary stays a pure
|
|
144
|
+
// wrapper over the untyped runtime.
|
|
145
|
+
Content(`// asMap turns a typed request/data struct into the map[string]any the
|
|
146
|
+
// runtime op pipeline consumes, honouring the json tags above.
|
|
147
|
+
func asMap(v any) map[string]any {
|
|
148
|
+
out := map[string]any{}
|
|
149
|
+
b, err := json.Marshal(v)
|
|
150
|
+
if err != nil {
|
|
151
|
+
return out
|
|
152
|
+
}
|
|
153
|
+
_ = json.Unmarshal(b, &out)
|
|
154
|
+
return out
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// typedFrom decodes a runtime value (a map[string]any produced by the op
|
|
158
|
+
// pipeline) into a typed model T via a JSON round-trip. On any error it
|
|
159
|
+
// returns the zero value of T; the op's own (value, error) tuple carries the
|
|
160
|
+
// real error.
|
|
161
|
+
func typedFrom[T any](v any) T {
|
|
162
|
+
var out T
|
|
163
|
+
if v == nil {
|
|
164
|
+
return out
|
|
165
|
+
}
|
|
166
|
+
b, err := json.Marshal(v)
|
|
167
|
+
if err != nil {
|
|
168
|
+
return out
|
|
169
|
+
}
|
|
170
|
+
_ = json.Unmarshal(b, &out)
|
|
171
|
+
return out
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// typedSliceFrom decodes a runtime list value ([]any of maps) into a typed
|
|
175
|
+
// slice []T via a JSON round-trip, for list ops.
|
|
176
|
+
func typedSliceFrom[T any](v any) []T {
|
|
177
|
+
var out []T
|
|
178
|
+
if v == nil {
|
|
179
|
+
return out
|
|
180
|
+
}
|
|
181
|
+
b, err := json.Marshal(v)
|
|
182
|
+
if err != nil {
|
|
183
|
+
return out
|
|
184
|
+
}
|
|
185
|
+
_ = json.Unmarshal(b, &out)
|
|
186
|
+
return out
|
|
187
|
+
}
|
|
188
|
+
`)
|
|
189
|
+
|
|
190
|
+
})
|
|
191
|
+
})
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
export {
|
|
196
|
+
EntityTypes,
|
|
197
|
+
}
|
|
@@ -15,7 +15,7 @@ const Entity = cmp(function Entity(props: any) {
|
|
|
15
15
|
|
|
16
16
|
// Module name: concatenated lowercase
|
|
17
17
|
// Go module path == repo path on GitHub (org from model.origin).
|
|
18
|
-
const gomodule = `github.com/${model.origin || 'voxgig-sdk'}/${model.name}-sdk`
|
|
18
|
+
const gomodule = `github.com/${model.origin || 'voxgig-sdk'}/${model.name}-sdk/go`
|
|
19
19
|
|
|
20
20
|
const entrep = {
|
|
21
21
|
...stdrep,
|
|
@@ -57,6 +57,7 @@ const Entity = cmp(function Entity(props: any) {
|
|
|
57
57
|
replace: {
|
|
58
58
|
...entrep,
|
|
59
59
|
'GOMODULE': gomodule,
|
|
60
|
+
'"github.com/voxgig/struct"': `"${gomodule}/utility/struct"`,
|
|
60
61
|
ProjectName: model.const.Name,
|
|
61
62
|
EntityName: entity.Name,
|
|
62
63
|
entityname: entity.name,
|
|
@@ -7,7 +7,13 @@ const MainEntity = cmp(async function MainEntity(props: any) {
|
|
|
7
7
|
const { entity, gomodule } = props
|
|
8
8
|
const { model } = props.ctx$
|
|
9
9
|
|
|
10
|
+
// Go keeps the PascalCase accessor: exported identifiers must be PascalCase,
|
|
11
|
+
// so a lowercase facade is not idiomatic (nor exportable) in Go.
|
|
12
|
+
// Idiomatic usage: client.${entity.Name}(nil).List(nil, nil) / .Load(...).
|
|
10
13
|
Content(`
|
|
14
|
+
// ${entity.Name} returns a ${entity.Name} entity bound to this client.
|
|
15
|
+
// Idiomatic usage: client.${entity.Name}(nil).List(nil, nil) or
|
|
16
|
+
// client.${entity.Name}(nil).Load(map[string]any{"id": ...}, nil).
|
|
11
17
|
func (sdk *${model.const.Name}SDK) ${entity.Name}(data map[string]any) ${model.const.Name}Entity {
|
|
12
18
|
return New${entity.Name}EntityFunc(sdk, data)
|
|
13
19
|
}
|
|
@@ -22,6 +22,7 @@ import { Package } from './Package_go'
|
|
|
22
22
|
import { Config } from './Config_go'
|
|
23
23
|
import { Gitignore } from './Gitignore_go'
|
|
24
24
|
import { MainEntity } from './MainEntity_go'
|
|
25
|
+
import { EntityTypes } from './EntityTypes_go'
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
const Main = cmp(async function Main(props: any) {
|
|
@@ -34,7 +35,7 @@ const Main = cmp(async function Main(props: any) {
|
|
|
34
35
|
|
|
35
36
|
// Go module path == the repo path on GitHub (org from model.origin),
|
|
36
37
|
// e.g. github.com/voxgig-sdk/<slug>-sdk. Used in go.mod and every import.
|
|
37
|
-
const gomodule = `github.com/${model.origin || 'voxgig-sdk'}/${model.name}-sdk`
|
|
38
|
+
const gomodule = `github.com/${model.origin || 'voxgig-sdk'}/${model.name}-sdk/go`
|
|
38
39
|
// The root package name must be a plain Go identifier (can't be a path),
|
|
39
40
|
// so it stays as the concatenated-lowercase form (e.g. voxgigdogsdk).
|
|
40
41
|
const gopackage = (model.origin || 'voxgig-sdk').replace(/-sdk$/, '').replace(/[^a-z0-9]/gi, '') +
|
|
@@ -44,16 +45,27 @@ const Main = cmp(async function Main(props: any) {
|
|
|
44
45
|
|
|
45
46
|
Gitignore({})
|
|
46
47
|
|
|
47
|
-
// Copy tm/go files with replacements
|
|
48
|
+
// Copy tm/go files with replacements.
|
|
49
|
+
//
|
|
50
|
+
// Rewrite the placeholder `github.com/voxgig/struct` import (used in the
|
|
51
|
+
// template since it's a self-contained module there) to its in-SDK path.
|
|
52
|
+
// The struct package is inlined under `<gomodule>/utility/struct` so the
|
|
53
|
+
// module is fully self-contained — no external go.mod required by
|
|
54
|
+
// downstream consumers.
|
|
48
55
|
Copy({
|
|
49
56
|
from: 'tm/' + target.name,
|
|
50
|
-
exclude: [/src
|
|
57
|
+
exclude: [/src\//, /utility\/struct\/go\.mod$/],
|
|
51
58
|
replace: {
|
|
52
59
|
...props.ctx$.stdrep,
|
|
53
60
|
GOMODULE: gomodule,
|
|
61
|
+
'"github.com/voxgig/struct"': `"${gomodule}/utility/struct"`,
|
|
54
62
|
}
|
|
55
63
|
})
|
|
56
64
|
|
|
65
|
+
// Typed models: entity/types.go (package entity), emitted alongside the
|
|
66
|
+
// generated *_entity.go files so the typed accessors resolve without imports.
|
|
67
|
+
EntityTypes({ target })
|
|
68
|
+
|
|
57
69
|
// Generate main SDK file in core/ folder
|
|
58
70
|
Folder({ name: 'core' }, () => {
|
|
59
71
|
|
|
@@ -65,6 +77,7 @@ const Main = cmp(async function Main(props: any) {
|
|
|
65
77
|
replace: {
|
|
66
78
|
...props.ctx$.stdrep,
|
|
67
79
|
'ProjectNameModule': gomodule,
|
|
80
|
+
'"github.com/voxgig/struct"': `"${gomodule}/utility/struct"`,
|
|
68
81
|
|
|
69
82
|
'#BuildFeatures': ({ indent }: any) => {
|
|
70
83
|
each(feature, (feat: any) => {
|
|
@@ -190,6 +203,13 @@ var NewResult = core.NewResult
|
|
|
190
203
|
var NewResponse = core.NewResponse
|
|
191
204
|
var NewOperation = core.NewOperation
|
|
192
205
|
var MakeConfig = core.MakeConfig
|
|
206
|
+
|
|
207
|
+
// No-arg convenience constructors. Go has no default-argument syntax,
|
|
208
|
+
// so these aliases let callers write \`sdk.New()\` / \`sdk.Test()\`
|
|
209
|
+
// instead of \`sdk.New${model.const.Name}SDK(nil)\` / \`sdk.TestSDK(nil, nil)\`
|
|
210
|
+
// for the common no-options case.
|
|
211
|
+
func New() *${model.const.Name}SDK { return New${model.const.Name}SDK(nil) }
|
|
212
|
+
func Test() *${model.const.Name}SDK { return TestSDK(nil, nil) }
|
|
193
213
|
`)
|
|
194
214
|
|
|
195
215
|
// Feature constructor re-exports - base is always present
|
|
@@ -20,7 +20,7 @@ const Package = cmp(async function Package(props: any) {
|
|
|
20
20
|
|
|
21
21
|
// Module name: concatenated lowercase (e.g., voxgigsolardemosdk)
|
|
22
22
|
// Go module path == repo path on GitHub (org from model.origin).
|
|
23
|
-
const gomodule = `github.com/${model.origin || 'voxgig-sdk'}/${model.name}-sdk`
|
|
23
|
+
const gomodule = `github.com/${model.origin || 'voxgig-sdk'}/${model.name}-sdk/go`
|
|
24
24
|
|
|
25
25
|
File({ name: 'go.mod' }, () => {
|
|
26
26
|
Content(`module ${gomodule}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, entityIdField, entityOps, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
6
6
|
getModelPath,
|
|
7
7
|
} from '@voxgig/apidef'
|
|
8
8
|
|
|
9
|
+
import { exampleValue, goVarName } from './utility_go'
|
|
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
|
|
@@ -39,8 +41,15 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
|
|
|
39
41
|
`)
|
|
40
42
|
|
|
41
43
|
publishedEntities.map((entity: any) => {
|
|
42
|
-
|
|
44
|
+
// ACTIVE ops only — an inactive op generates no method, so an example
|
|
45
|
+
// calling it would not compile.
|
|
46
|
+
const opnames = entityOps(entity)
|
|
43
47
|
const fields = entity.fields || []
|
|
48
|
+
// Model-driven id key: null when this entity has no id-like field.
|
|
49
|
+
const idF = entityIdField(entity)
|
|
50
|
+
// camelCase Go identifier (a `status_embed_config` entity must not bind a
|
|
51
|
+
// snake_case Go variable, and a `type`/`range` entity not a Go keyword).
|
|
52
|
+
const eVar = goVarName(entity.name)
|
|
44
53
|
|
|
45
54
|
Content(`
|
|
46
55
|
### ${entity.Name}
|
|
@@ -53,7 +62,7 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
|
|
|
53
62
|
`)
|
|
54
63
|
}
|
|
55
64
|
|
|
56
|
-
Content(`Create an instance: \`${
|
|
65
|
+
Content(`Create an instance: \`${eVar} := client.${entity.Name}(nil)\`
|
|
57
66
|
|
|
58
67
|
`)
|
|
59
68
|
|
|
@@ -84,7 +93,7 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
|
|
|
84
93
|
|
|
85
94
|
each(fields, (field: any) => {
|
|
86
95
|
const desc = field.short || ''
|
|
87
|
-
Content(`| \`${field.name}\` | \`${field.type
|
|
96
|
+
Content(`| \`${field.name}\` | \`${canonToType(field.type, target.name)}\` | ${desc} |
|
|
88
97
|
`)
|
|
89
98
|
})
|
|
90
99
|
|
|
@@ -93,10 +102,26 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
|
|
|
93
102
|
}
|
|
94
103
|
|
|
95
104
|
if (opnames.includes('load')) {
|
|
105
|
+
// The id key plus every REQUIRED match key (parent path params like
|
|
106
|
+
// page_id) — the same shape that generates the op's request match, so
|
|
107
|
+
// the example always carries the keys the route needs.
|
|
108
|
+
const loadItems = opRequestShape(entity, 'load').items
|
|
109
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
110
|
+
.sort((a: any, b: any) =>
|
|
111
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
112
|
+
const loadArg = 0 < loadItems.length
|
|
113
|
+
? `map[string]any{${loadItems.map((it: any) =>
|
|
114
|
+
`"${it.name}": ${exampleValue(entity, entity.op && entity.op.load, it.name,
|
|
115
|
+
it.name === idF ? entity.name + '_id' : it.name)}`).join(', ')}}`
|
|
116
|
+
: 'nil'
|
|
96
117
|
Content(`#### Example: Load
|
|
97
118
|
|
|
98
119
|
\`\`\`go
|
|
99
|
-
|
|
120
|
+
${eVar}, err := client.${entity.Name}(nil).Load(${loadArg}, nil)
|
|
121
|
+
if err != nil {
|
|
122
|
+
panic(err)
|
|
123
|
+
}
|
|
124
|
+
fmt.Println(${eVar}) // the loaded record
|
|
100
125
|
\`\`\`
|
|
101
126
|
|
|
102
127
|
`)
|
|
@@ -106,25 +131,38 @@ result, err := client.${entity.Name}(nil).Load(map[string]any{"id": "${entity.na
|
|
|
106
131
|
Content(`#### Example: List
|
|
107
132
|
|
|
108
133
|
\`\`\`go
|
|
109
|
-
|
|
134
|
+
${eVar}s, err := client.${entity.Name}(nil).List(nil, nil)
|
|
135
|
+
if err != nil {
|
|
136
|
+
panic(err)
|
|
137
|
+
}
|
|
138
|
+
fmt.Println(${eVar}s) // the array of records
|
|
110
139
|
\`\`\`
|
|
111
140
|
|
|
112
141
|
`)
|
|
113
142
|
}
|
|
114
143
|
|
|
115
144
|
if (opnames.includes('create')) {
|
|
145
|
+
// Members come from the SAME shape that generates the op's request
|
|
146
|
+
// data: every required member must appear — including a required id
|
|
147
|
+
// (the /* type */ placeholders also mark the block as an illustration
|
|
148
|
+
// for the doc gates); an all-optional create renders an empty — still
|
|
149
|
+
// valid — literal, and the compiled example is self-consuming.
|
|
150
|
+
const createItems = opRequestShape(entity, 'create').items
|
|
151
|
+
.filter((it: any) => !it.optional)
|
|
116
152
|
Content(`#### Example: Create
|
|
117
153
|
|
|
118
154
|
\`\`\`go
|
|
119
155
|
result, err := client.${entity.Name}(nil).Create(map[string]any{
|
|
120
156
|
`)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
Content(` "${field.name}": /* ${field.type || 'value'} */,
|
|
157
|
+
createItems.map((it: any) => {
|
|
158
|
+
Content(` "${it.name}": /* ${canonToType(it.type, target.name)} */,
|
|
124
159
|
`)
|
|
125
|
-
}
|
|
126
160
|
})
|
|
127
161
|
Content(`}, nil)
|
|
162
|
+
if err != nil {
|
|
163
|
+
panic(err)
|
|
164
|
+
}
|
|
165
|
+
fmt.Println(result)
|
|
128
166
|
\`\`\`
|
|
129
167
|
|
|
130
168
|
`)
|