@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.
- package/bin/voxgig-sdkgen +2 -2
- package/dist/action/action.d.ts +2 -1
- package/dist/action/action.js +15 -9
- package/dist/action/action.js.map +1 -1
- package/dist/action/feature.js +6 -3
- package/dist/action/feature.js.map +1 -1
- package/dist/action/target.d.ts +7 -1
- package/dist/action/target.js +13 -6
- 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 +193 -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 +11 -1
- package/dist/sdkgen.js +57 -18
- 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.js +20 -11
- package/dist/utility.js.map +1 -1
- package/model/sdkgen.aontu +137 -0
- package/package.json +13 -6
- package/project/.sdk/model/target/go-cli.jsonic +47 -0
- package/project/.sdk/model/target/go-mcp.jsonic +41 -0
- package/project/.sdk/model/target/go.jsonic +9 -3
- package/project/.sdk/model/target/js.jsonic +13 -0
- package/project/.sdk/model/target/lua.jsonic +13 -0
- package/project/.sdk/model/target/php.jsonic +13 -0
- package/project/.sdk/model/target/py.jsonic +13 -0
- package/project/.sdk/model/target/rb.jsonic +13 -0
- package/project/.sdk/model/target/ts.jsonic +13 -0
- 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 +18 -6
- package/project/.sdk/src/cmp/go/ReadmeExamplesTest_go.ts +684 -0
- package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +1 -1
- package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +48 -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 +63 -17
- package/project/.sdk/src/cmp/go/ReadmeOptions_go.ts +4 -3
- package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +124 -115
- package/project/.sdk/src/cmp/go/ReadmeRef_go.ts +28 -15
- package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +33 -9
- 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-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/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 +13 -7
- 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 +45 -19
- package/project/.sdk/src/cmp/js/ReadmeRef_js.ts +24 -13
- package/project/.sdk/src/cmp/js/ReadmeTopHowto_js.ts +3 -0
- package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +28 -12
- package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +23 -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/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 +12 -10
- 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 +79 -18
- package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +25 -20
- package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +17 -9
- package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +32 -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/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 +15 -11
- 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 +80 -22
- package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +51 -42
- package/project/.sdk/src/cmp/php/ReadmeTopHowto_php.ts +1 -1
- package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +19 -11
- package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +41 -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/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 +27 -11
- 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 +73 -24
- package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +57 -37
- package/project/.sdk/src/cmp/py/ReadmeTopHowto_py.ts +1 -1
- package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +19 -11
- package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +30 -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/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 +26 -10
- 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 +85 -22
- package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +56 -37
- package/project/.sdk/src/cmp/rb/ReadmeTopHowto_rb.ts +1 -1
- package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +19 -11
- package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +43 -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/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 +13 -7
- 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 +95 -40
- package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +24 -13
- package/project/.sdk/src/cmp/ts/ReadmeTopHowto_ts.ts +3 -0
- package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +44 -12
- package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +23 -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/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 +33 -1
- 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 +17 -10
- package/src/action/feature.ts +8 -6
- package/src/action/target.ts +17 -8
- 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 +236 -0
- package/src/helpers/packageMeta.ts +236 -0
- package/src/sdkgen.ts +87 -20
- package/src/tsconfig.json +1 -0
- package/src/types.ts +85 -2
- package/src/utility.ts +22 -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/tm/go/utility/struct/go.mod +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, File, isAuthActive } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, File, isAuthActive, entityIdField } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -70,8 +70,7 @@ Create a new SDK client instance.
|
|
|
70
70
|
| Name | Type | Description |
|
|
71
71
|
| --- | --- | --- |
|
|
72
72
|
| \`options\` | \`map[string]any\` | SDK configuration options. |
|
|
73
|
-
| \`options["apikey"]\` | \`string\` | API key for authentication. |
|
|
74
|
-
| \`options["base"]\` | \`string\` | Base URL for API requests. |
|
|
73
|
+
${isAuthActive(model) ? '| \`options["apikey"]\` | \`string\` | API key for authentication. |\n' : ''}| \`options["base"]\` | \`string\` | Base URL for API requests. |
|
|
75
74
|
| \`options["prefix"]\` | \`string\` | URL prefix appended after base. |
|
|
76
75
|
| \`options["suffix"]\` | \`string\` | URL suffix appended after path. |
|
|
77
76
|
| \`options["headers"]\` | \`map[string]any\` | Custom headers for all requests. |
|
|
@@ -86,12 +85,20 @@ Create a new SDK client instance.
|
|
|
86
85
|
|
|
87
86
|
`)
|
|
88
87
|
|
|
89
|
-
Content(`#### \`
|
|
88
|
+
Content(`#### \`Test() *${model.const.Name}SDK\`
|
|
90
89
|
|
|
91
|
-
|
|
90
|
+
No-arg convenience constructor for the common no-options test case.
|
|
92
91
|
|
|
93
92
|
\`\`\`go
|
|
94
|
-
client := sdk.
|
|
93
|
+
client := sdk.Test()
|
|
94
|
+
\`\`\`
|
|
95
|
+
|
|
96
|
+
#### \`TestSDK(testopts, sdkopts map[string]any) *${model.const.Name}SDK\`
|
|
97
|
+
|
|
98
|
+
Test client with options. Both arguments may be \`nil\`.
|
|
99
|
+
|
|
100
|
+
\`\`\`go
|
|
101
|
+
client := sdk.TestSDK(testopts, sdkopts)
|
|
95
102
|
\`\`\`
|
|
96
103
|
|
|
97
104
|
`)
|
|
@@ -153,6 +160,9 @@ same parameters as \`Direct()\`.
|
|
|
153
160
|
publishedEntities.map((ent: any) => {
|
|
154
161
|
const opnames = Object.keys(ent.op || {})
|
|
155
162
|
const fields = ent.fields || []
|
|
163
|
+
// Model-driven id key: null when this entity has no id-like field, in
|
|
164
|
+
// which case load/remove pass a nil match and update omits the id.
|
|
165
|
+
const idF = entityIdField(ent)
|
|
156
166
|
|
|
157
167
|
Content(`
|
|
158
168
|
---
|
|
@@ -184,7 +194,7 @@ ${ent.name} := client.${ent.Name}(nil)
|
|
|
184
194
|
each(fields, (field: any) => {
|
|
185
195
|
const req = field.req ? 'Yes' : 'No'
|
|
186
196
|
const desc = field.short || ''
|
|
187
|
-
Content(`| \`${field.name}\` | \`${field.type
|
|
197
|
+
Content(`| \`${field.name}\` | \`${canonToType(field.type, target.name)}\` | ${req} | ${desc} |
|
|
188
198
|
`)
|
|
189
199
|
})
|
|
190
200
|
|
|
@@ -194,15 +204,18 @@ ${ent.name} := client.${ent.Name}(nil)
|
|
|
194
204
|
// Field operations breakdown
|
|
195
205
|
const hasFieldOps = fields.some((f: any) => f.op && Object.keys(f.op).length > 0)
|
|
196
206
|
if (hasFieldOps) {
|
|
207
|
+
// Only emit columns for operations this entity actually exposes —
|
|
208
|
+
// never advertise a create/update/remove column the entity lacks.
|
|
209
|
+
const opcols = ['load', 'list', 'create', 'update', 'remove']
|
|
210
|
+
.filter((op: string) => opnames.includes(op) && ent.op[op]?.active !== false)
|
|
197
211
|
Content(`### Field Usage by Operation
|
|
198
212
|
|
|
199
|
-
| Field |
|
|
200
|
-
| --- |
|
|
213
|
+
| Field | ${opcols.join(' | ')} |
|
|
214
|
+
| --- | ${opcols.map(() => '---').join(' | ')} |
|
|
201
215
|
`)
|
|
202
216
|
each(fields, (field: any) => {
|
|
203
217
|
const fops = field.op || {}
|
|
204
|
-
const cols =
|
|
205
|
-
if (!opnames.includes(op)) return '-'
|
|
218
|
+
const cols = opcols.map((op: string) => {
|
|
206
219
|
const fop = fops[op]
|
|
207
220
|
if (null == fop) return '-'
|
|
208
221
|
if (fop.active === false) return '-'
|
|
@@ -238,7 +251,7 @@ ${info.desc}
|
|
|
238
251
|
if ('load' === opname || 'remove' === opname) {
|
|
239
252
|
const goOpName = opname.charAt(0).toUpperCase() + opname.slice(1)
|
|
240
253
|
Content(`\`\`\`go
|
|
241
|
-
result, err := client.${ent.Name}(nil).${goOpName}(map[string]any{"
|
|
254
|
+
result, err := client.${ent.Name}(nil).${goOpName}(${idF ? `map[string]any{"${idF}": "${ent.name}_id"}` : 'nil'}, nil)
|
|
242
255
|
\`\`\`
|
|
243
256
|
|
|
244
257
|
`)
|
|
@@ -256,7 +269,7 @@ result, err := client.${ent.Name}(nil).Create(map[string]any{
|
|
|
256
269
|
`)
|
|
257
270
|
each(fields, (field: any) => {
|
|
258
271
|
if ('id' !== field.name && field.req) {
|
|
259
|
-
Content(` "${field.name}": /* ${field.type
|
|
272
|
+
Content(` "${field.name}": /* ${canonToType(field.type, target.name)} */,
|
|
260
273
|
`)
|
|
261
274
|
}
|
|
262
275
|
})
|
|
@@ -266,10 +279,10 @@ result, err := client.${ent.Name}(nil).Create(map[string]any{
|
|
|
266
279
|
`)
|
|
267
280
|
}
|
|
268
281
|
else if ('update' === opname) {
|
|
282
|
+
const updateIdLine = idF ? ` "${idF}": "${ent.name}_id",\n` : ''
|
|
269
283
|
Content(`\`\`\`go
|
|
270
284
|
result, err := client.${ent.Name}(nil).Update(map[string]any{
|
|
271
|
-
|
|
272
|
-
// Fields to update
|
|
285
|
+
${updateIdLine} // Fields to update
|
|
273
286
|
}, nil)
|
|
274
287
|
\`\`\`
|
|
275
288
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, entityIdField, safeVarName } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -13,29 +13,35 @@ const ReadmeTopQuick = cmp(function ReadmeTopQuick(props: any) {
|
|
|
13
13
|
|
|
14
14
|
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
15
15
|
// Go module path == repo path on GitHub (org from model.origin).
|
|
16
|
-
const gomodule = `github.com/${model.origin || 'voxgig-sdk'}/${model.name}-sdk`
|
|
16
|
+
const gomodule = `github.com/${model.origin || 'voxgig-sdk'}/${model.name}-sdk/go`
|
|
17
17
|
|
|
18
18
|
const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
|
|
19
19
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
:
|
|
20
|
+
const authActive = isAuthActive(model)
|
|
21
|
+
const ctor = authActive
|
|
22
|
+
? `sdk.New${model.const.Name}SDK(map[string]any{\n "apikey": os.Getenv("${envName(model)}_APIKEY"),\n})`
|
|
23
|
+
: `sdk.New()`
|
|
23
24
|
|
|
24
25
|
Content(`\`\`\`go
|
|
25
26
|
import sdk "${gomodule}"
|
|
26
27
|
|
|
27
|
-
client :=
|
|
28
|
+
client := ${ctor}
|
|
28
29
|
|
|
29
30
|
`)
|
|
30
31
|
|
|
31
32
|
if (exampleEntity) {
|
|
32
33
|
const eName = nom(exampleEntity, 'Name')
|
|
34
|
+
const eVar = safeVarName(eName.toLowerCase(), 'go')
|
|
33
35
|
const opnames = Object.keys(exampleEntity.op || {})
|
|
34
36
|
|
|
37
|
+
let hasCall = false
|
|
38
|
+
|
|
35
39
|
if (opnames.includes('list')) {
|
|
36
40
|
Content(`// List all ${eName.toLowerCase()}s
|
|
37
|
-
${
|
|
41
|
+
${eVar}s, err := client.${eName}(nil).List(nil, nil)
|
|
42
|
+
fmt.Println(${eVar}s)
|
|
38
43
|
`)
|
|
44
|
+
hasCall = true
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
// Find a nested entity for a more interesting example
|
|
@@ -45,16 +51,34 @@ ${eName.toLowerCase()}s, err := client.${eName}(nil).List(nil, nil)
|
|
|
45
51
|
|
|
46
52
|
if (nestedEntity && opnames.includes('load')) {
|
|
47
53
|
const neName = nom(nestedEntity, 'Name')
|
|
54
|
+
const neVar = safeVarName(neName.toLowerCase(), 'go')
|
|
48
55
|
const parentFields = (nestedEntity.fields || [])
|
|
49
56
|
.filter((f: any) => f.name !== 'id' && f.name.endsWith('_id'))
|
|
50
57
|
const parentParam = parentFields.length > 0 ? parentFields[0].name : 'parent_id'
|
|
58
|
+
// Model-driven id key: only include the nested entity's id if it has one.
|
|
59
|
+
const neIdF = entityIdField(nestedEntity)
|
|
60
|
+
const neMatchPairs = [`"${parentParam}": "example"`]
|
|
61
|
+
if (neIdF) {
|
|
62
|
+
neMatchPairs.push(`"${neIdF}": "example_id"`)
|
|
63
|
+
}
|
|
51
64
|
|
|
52
65
|
Content(`
|
|
53
66
|
// Load a specific ${neName.toLowerCase()}
|
|
54
|
-
${
|
|
55
|
-
map[string]any{
|
|
67
|
+
${neVar}, err := client.${neName}(nil).Load(
|
|
68
|
+
map[string]any{${neMatchPairs.join(', ')}}, nil,
|
|
56
69
|
)
|
|
70
|
+
fmt.Println(${neVar})
|
|
71
|
+
`)
|
|
72
|
+
hasCall = true
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Fallback: APIs with only `load` (no list, no nested) — still show one call.
|
|
76
|
+
if (!hasCall && opnames.includes('load')) {
|
|
77
|
+
Content(`// Load ${eName.toLowerCase()} data
|
|
78
|
+
${eVar}, err := client.${eName}(nil).Load(map[string]any{}, nil)
|
|
79
|
+
fmt.Println(${eVar})
|
|
57
80
|
`)
|
|
81
|
+
hasCall = true
|
|
58
82
|
}
|
|
59
83
|
}
|
|
60
84
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, canonKey, entityIdField, entityPrimaryOp, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -8,23 +8,53 @@ import {
|
|
|
8
8
|
} from '@voxgig/apidef'
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
// A type-correct Go literal for a field's canonical type.
|
|
12
|
+
function goLit(type: any): string {
|
|
13
|
+
const k = canonKey(type)
|
|
14
|
+
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
15
|
+
if ('BOOLEAN' === k) return 'true'
|
|
16
|
+
if ('ARRAY' === k) return '[]any{}'
|
|
17
|
+
if ('OBJECT' === k) return 'map[string]any{}'
|
|
18
|
+
return '"example"'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function cap(s: string): string {
|
|
22
|
+
return s.charAt(0).toUpperCase() + s.slice(1)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
11
26
|
const ReadmeTopTest = cmp(function ReadmeTopTest(props: any) {
|
|
12
27
|
const { target, ctx$: { model } } = props
|
|
13
28
|
|
|
14
29
|
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
15
30
|
// Go module path == repo path on GitHub (org from model.origin).
|
|
16
|
-
const gomodule = `github.com/${model.origin || 'voxgig-sdk'}/${model.name}-sdk`
|
|
31
|
+
const gomodule = `github.com/${model.origin || 'voxgig-sdk'}/${model.name}-sdk/go`
|
|
17
32
|
|
|
18
33
|
const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
|
|
19
34
|
|
|
20
35
|
Content(`\`\`\`go
|
|
21
|
-
client := sdk.
|
|
36
|
+
client := sdk.Test()
|
|
22
37
|
`)
|
|
23
38
|
|
|
24
39
|
if (exampleEntity) {
|
|
25
40
|
const eName = nom(exampleEntity, 'Name')
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
// Drive the test-mode example off the entity's PRIMARY op (never a hardcoded
|
|
42
|
+
// `Load` a create-only entity lacks).
|
|
43
|
+
const idF = entityIdField(exampleEntity)
|
|
44
|
+
const primaryOp = entityPrimaryOp(exampleEntity) || 'load'
|
|
45
|
+
const isMatchOp = 'load' === primaryOp || 'remove' === primaryOp
|
|
46
|
+
let arg = 'nil'
|
|
47
|
+
if (isMatchOp) {
|
|
48
|
+
arg = idF ? `map[string]any{"${idF}": "test01"}` : 'nil'
|
|
49
|
+
} else if ('create' === primaryOp || 'update' === primaryOp) {
|
|
50
|
+
const items = opRequestShape(exampleEntity, primaryOp).items
|
|
51
|
+
.filter((it: any) => it.name !== idF && it.name !== 'id')
|
|
52
|
+
const required = items.filter((it: any) => !it.optional)
|
|
53
|
+
const chosen = required.length ? required : items.slice(0, 3)
|
|
54
|
+
arg = `map[string]any{${chosen.map((it: any) => `"${it.name}": ${goLit(it.type)}`).join(', ')}}`
|
|
55
|
+
}
|
|
56
|
+
Content(`result, err := client.${eName}(nil).${cap(primaryOp)}(
|
|
57
|
+
${arg}, nil,
|
|
28
58
|
)
|
|
29
59
|
`)
|
|
30
60
|
}
|
|
@@ -13,6 +13,7 @@ import { cmp, each, Folder, File, Content } from '@voxgig/sdkgen'
|
|
|
13
13
|
|
|
14
14
|
import { TestEntity } from './TestEntity_go'
|
|
15
15
|
import { TestDirect } from './TestDirect_go'
|
|
16
|
+
import { ReadmeExamplesTest } from './ReadmeExamplesTest_go'
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
const Test = cmp(function Test(props: any) {
|
|
@@ -21,7 +22,7 @@ const Test = cmp(function Test(props: any) {
|
|
|
21
22
|
|
|
22
23
|
// Module name: concatenated lowercase
|
|
23
24
|
// Go module path == repo path on GitHub (org from model.origin).
|
|
24
|
-
const gomodule = `github.com/${model.origin || 'voxgig-sdk'}/${model.name}-sdk`
|
|
25
|
+
const gomodule = `github.com/${model.origin || 'voxgig-sdk'}/${model.name}-sdk/go`
|
|
25
26
|
|
|
26
27
|
Folder({ name: 'test' }, () => {
|
|
27
28
|
|
|
@@ -51,6 +52,9 @@ func TestExists(t *testing.T) {
|
|
|
51
52
|
TestEntity({ target, entity, gomodule })
|
|
52
53
|
TestDirect({ target, entity, gomodule })
|
|
53
54
|
})
|
|
55
|
+
|
|
56
|
+
// README ```go example snippets must compile against the real SDK.
|
|
57
|
+
ReadmeExamplesTest({ target })
|
|
54
58
|
})
|
|
55
59
|
})
|
|
56
60
|
|
|
@@ -85,6 +85,27 @@ func (e *EntityNameEntity) Match(args ...any) any {
|
|
|
85
85
|
return out
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
// DataTyped is the statically-typed accessor for this entity's data. With no
|
|
89
|
+
// argument it returns the current data as an EntityName; with an argument it
|
|
90
|
+
// sets the data and returns the stored value. It delegates to the untyped Data
|
|
91
|
+
// (identical runtime) and converts at the typed boundary.
|
|
92
|
+
func (e *EntityNameEntity) DataTyped(data ...EntityName) EntityName {
|
|
93
|
+
if len(data) > 0 {
|
|
94
|
+
return typedFrom[EntityName](e.Data(asMap(data[0])))
|
|
95
|
+
}
|
|
96
|
+
return typedFrom[EntityName](e.Data())
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// MatchTyped mirrors DataTyped for the entity's match filter. The match is a
|
|
100
|
+
// partial of the entity, so it round-trips through EntityName (all fields
|
|
101
|
+
// optional at the wire level).
|
|
102
|
+
func (e *EntityNameEntity) MatchTyped(match ...EntityName) EntityName {
|
|
103
|
+
if len(match) > 0 {
|
|
104
|
+
return typedFrom[EntityName](e.Match(asMap(match[0])))
|
|
105
|
+
}
|
|
106
|
+
return typedFrom[EntityName](e.Match())
|
|
107
|
+
}
|
|
108
|
+
|
|
88
109
|
// #LoadOp
|
|
89
110
|
|
|
90
111
|
// #ListOp
|
|
@@ -32,4 +32,15 @@ func (e *EntityNameEntity) Create(reqdata map[string]any, ctrl map[string]any) (
|
|
|
32
32
|
})
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
// CreateTyped is the statically-typed variant of Create: it takes an
|
|
36
|
+
// EntityNameCreateData and returns an EntityName. It delegates to the untyped
|
|
37
|
+
// Create (identical runtime) and converts at the typed boundary.
|
|
38
|
+
func (e *EntityNameEntity) CreateTyped(reqdata EntityNameCreateData, ctrl map[string]any) (EntityName, error) {
|
|
39
|
+
res, err := e.Create(asMap(reqdata), ctrl)
|
|
40
|
+
if err != nil {
|
|
41
|
+
return EntityName{}, err
|
|
42
|
+
}
|
|
43
|
+
return typedFrom[EntityName](res), nil
|
|
44
|
+
}
|
|
45
|
+
|
|
35
46
|
// EJECT-END
|
|
@@ -23,4 +23,15 @@ func (e *EntityNameEntity) List(reqmatch map[string]any, ctrl map[string]any) (a
|
|
|
23
23
|
})
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
// ListTyped is the statically-typed variant of List: it takes an
|
|
27
|
+
// EntityNameListMatch and returns []EntityName. It delegates to the untyped
|
|
28
|
+
// List (identical runtime) and converts at the typed boundary.
|
|
29
|
+
func (e *EntityNameEntity) ListTyped(reqmatch EntityNameListMatch, ctrl map[string]any) ([]EntityName, error) {
|
|
30
|
+
res, err := e.List(asMap(reqmatch), ctrl)
|
|
31
|
+
if err != nil {
|
|
32
|
+
return nil, err
|
|
33
|
+
}
|
|
34
|
+
return typedSliceFrom[EntityName](res), nil
|
|
35
|
+
}
|
|
36
|
+
|
|
26
37
|
// EJECT-END
|
|
@@ -35,4 +35,15 @@ func (e *EntityNameEntity) Load(reqmatch map[string]any, ctrl map[string]any) (a
|
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
// LoadTyped is the statically-typed variant of Load: it takes an
|
|
39
|
+
// EntityNameLoadMatch and returns an EntityName. It delegates to the untyped
|
|
40
|
+
// Load (identical runtime) and converts at the typed boundary.
|
|
41
|
+
func (e *EntityNameEntity) LoadTyped(reqmatch EntityNameLoadMatch, ctrl map[string]any) (EntityName, error) {
|
|
42
|
+
res, err := e.Load(asMap(reqmatch), ctrl)
|
|
43
|
+
if err != nil {
|
|
44
|
+
return EntityName{}, err
|
|
45
|
+
}
|
|
46
|
+
return typedFrom[EntityName](res), nil
|
|
47
|
+
}
|
|
48
|
+
|
|
38
49
|
// EJECT-END
|
|
@@ -35,4 +35,15 @@ func (e *EntityNameEntity) Remove(reqmatch map[string]any, ctrl map[string]any)
|
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
// RemoveTyped is the statically-typed variant of Remove: it takes an
|
|
39
|
+
// EntityNameRemoveMatch and returns an EntityName. It delegates to the untyped
|
|
40
|
+
// Remove (identical runtime) and converts at the typed boundary.
|
|
41
|
+
func (e *EntityNameEntity) RemoveTyped(reqmatch EntityNameRemoveMatch, ctrl map[string]any) (EntityName, error) {
|
|
42
|
+
res, err := e.Remove(asMap(reqmatch), ctrl)
|
|
43
|
+
if err != nil {
|
|
44
|
+
return EntityName{}, err
|
|
45
|
+
}
|
|
46
|
+
return typedFrom[EntityName](res), nil
|
|
47
|
+
}
|
|
48
|
+
|
|
38
49
|
// EJECT-END
|
|
@@ -35,4 +35,15 @@ func (e *EntityNameEntity) Update(reqdata map[string]any, ctrl map[string]any) (
|
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
// UpdateTyped is the statically-typed variant of Update: it takes an
|
|
39
|
+
// EntityNameUpdateData and returns an EntityName. It delegates to the untyped
|
|
40
|
+
// Update (identical runtime) and converts at the typed boundary.
|
|
41
|
+
func (e *EntityNameEntity) UpdateTyped(reqdata EntityNameUpdateData, ctrl map[string]any) (EntityName, error) {
|
|
42
|
+
res, err := e.Update(asMap(reqdata), ctrl)
|
|
43
|
+
if err != nil {
|
|
44
|
+
return EntityName{}, err
|
|
45
|
+
}
|
|
46
|
+
return typedFrom[EntityName](res), nil
|
|
47
|
+
}
|
|
48
|
+
|
|
38
49
|
// EJECT-END
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
|
|
2
|
+
import * as Path from 'node:path'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
cmp, each,
|
|
6
|
+
File, Content, Fragment, Slot,
|
|
7
|
+
} from '@voxgig/sdkgen'
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
ModelEntity,
|
|
11
|
+
} from '@voxgig/apidef'
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
KIT,
|
|
15
|
+
getModelPath,
|
|
16
|
+
} from '@voxgig/apidef'
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
// Published aql/eng/go version. Tagged at aql-lang/aql under
|
|
20
|
+
// eng/go/v<X.Y.Z>. Bump here when adopting a newer engine.
|
|
21
|
+
const AQL_ENG_VERSION = 'v0.0.1'
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const Main = cmp(function Main(props: any) {
|
|
25
|
+
const { target } = props
|
|
26
|
+
const { model } = props.ctx$
|
|
27
|
+
|
|
28
|
+
const org = model.origin || 'voxgig-sdk'
|
|
29
|
+
const sdkModule = `github.com/${org}/${model.name}-sdk/go`
|
|
30
|
+
const cliModule = `github.com/${org}/${model.name}-sdk/go-cli`
|
|
31
|
+
|
|
32
|
+
const entityMap: any = getModelPath(model, `main.${KIT}.entity`)
|
|
33
|
+
const entityNames = Object.keys(entityMap).map(n => n.toLowerCase())
|
|
34
|
+
|
|
35
|
+
const FRAGMENT = Path.normalize(__dirname + '/../../../src/cmp/go-cli/fragment')
|
|
36
|
+
|
|
37
|
+
// .gitignore — the compiled binary lands at /<modulename>-cli; ignore it.
|
|
38
|
+
File({ name: '.gitignore' }, () => Content(`/${model.name}-cli
|
|
39
|
+
`))
|
|
40
|
+
|
|
41
|
+
// README.md — usage guide for the AQL-driven CLI.
|
|
42
|
+
const entityList = entityNames.length > 0 ? entityNames.join(' ') : '(none)'
|
|
43
|
+
|
|
44
|
+
// MODEL-DRIVEN verbs. The CLI implements three AQL words (list / load /
|
|
45
|
+
// update; see words.fragment.go + runOp). Each README verb row is
|
|
46
|
+
// advertised ONLY when at least one active entity actually exposes that
|
|
47
|
+
// op (op.<name>.active !== false) — never document an operation no entity
|
|
48
|
+
// supports.
|
|
49
|
+
const CLI_VERB_ROWS: Record<string, string> = {
|
|
50
|
+
list: '| `list` | `[entity]` · `[query entity]` | List records |',
|
|
51
|
+
load: '| `load` | `[entity]` · `[query entity]` | Load a single record |',
|
|
52
|
+
update: '| `update` | `[entity]` · `[query entity]` | Update a record |',
|
|
53
|
+
}
|
|
54
|
+
const supportedOps = new Set<string>()
|
|
55
|
+
each(entityMap, (entity: any) => {
|
|
56
|
+
if (entity && entity.active === false) return
|
|
57
|
+
const ops = (entity && entity.op) || {}
|
|
58
|
+
for (const opname of Object.keys(ops)) {
|
|
59
|
+
if (ops[opname] && ops[opname].active !== false) supportedOps.add(opname)
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
const verbRows = ['list', 'load', 'update']
|
|
63
|
+
.filter(op => supportedOps.has(op))
|
|
64
|
+
.map(op => CLI_VERB_ROWS[op])
|
|
65
|
+
.join('\n')
|
|
66
|
+
|
|
67
|
+
// MODEL-DRIVEN run examples, gated on the first entity's own ops so the
|
|
68
|
+
// Run section never demonstrates a verb the example entity lacks.
|
|
69
|
+
const firstEntityObj: any =
|
|
70
|
+
Object.values(entityMap).find((e: any) => e && e.active !== false)
|
|
71
|
+
const firstEntity = firstEntityObj
|
|
72
|
+
? String(firstEntityObj.name).toLowerCase()
|
|
73
|
+
: (entityNames[0] || 'entity')
|
|
74
|
+
const firstOps: any = (firstEntityObj && firstEntityObj.op) || {}
|
|
75
|
+
const firstHas = (op: string) => !!(firstOps[op] && firstOps[op].active !== false)
|
|
76
|
+
const runLines: string[] = ['# One-shot: arguments form a single AQL expression']
|
|
77
|
+
if (firstHas('list')) {
|
|
78
|
+
runLines.push(`./${model.name}-cli list ${firstEntity}`)
|
|
79
|
+
}
|
|
80
|
+
if (firstHas('load')) {
|
|
81
|
+
runLines.push(`./${model.name}-cli load 1 ${firstEntity}`)
|
|
82
|
+
runLines.push(`./${model.name}-cli load '{id:1}' ${firstEntity}`)
|
|
83
|
+
}
|
|
84
|
+
if (firstHas('update')) {
|
|
85
|
+
runLines.push(`./${model.name}-cli update '{id:1}' ${firstEntity}`)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
File({ name: 'README.md' }, () => Content(`# ${model.name}-cli
|
|
89
|
+
|
|
90
|
+
AQL-driven CLI and REPL for the ${model.Name} SDK. Positional arguments are
|
|
91
|
+
joined into a single AQL expression and evaluated; with no arguments,
|
|
92
|
+
falls into an interactive REPL.
|
|
93
|
+
|
|
94
|
+
Built on \`github.com/aql-lang/aql/eng/go\` and the sibling Go SDK at \`../go\`.
|
|
95
|
+
|
|
96
|
+
## Build
|
|
97
|
+
|
|
98
|
+
\`\`\`sh
|
|
99
|
+
go build -o ${model.name}-cli ./...
|
|
100
|
+
\`\`\`
|
|
101
|
+
|
|
102
|
+
## Run
|
|
103
|
+
|
|
104
|
+
\`\`\`sh
|
|
105
|
+
${runLines.join('\n')}
|
|
106
|
+
|
|
107
|
+
# REPL
|
|
108
|
+
./${model.name}-cli
|
|
109
|
+
\`\`\`
|
|
110
|
+
|
|
111
|
+
## Words
|
|
112
|
+
|
|
113
|
+
| Word | Signatures | Description |
|
|
114
|
+
|----------|----------------------------------------------|----------------------------|
|
|
115
|
+
${verbRows}
|
|
116
|
+
|
|
117
|
+
\`query\` is either a Map (\`{id:1}\`) or a Scalar (\`1\`, treated as \`{id:1}\`).
|
|
118
|
+
\`entity\` is one of the SDK's entity names (auto-quoted as an atom).
|
|
119
|
+
|
|
120
|
+
## Entities
|
|
121
|
+
|
|
122
|
+
${entityList}
|
|
123
|
+
|
|
124
|
+
## REPL commands
|
|
125
|
+
|
|
126
|
+
- \`:quit\` / \`:q\` / \`:exit\` — exit the REPL
|
|
127
|
+
- \`:help\` / \`:h\` / \`:?\` — show help
|
|
128
|
+
|
|
129
|
+
## Generated by
|
|
130
|
+
|
|
131
|
+
sdkgen \`go-cli\` target. See the target source under
|
|
132
|
+
\`.sdk/src/cmp/go-cli/\` in this repo, or upstream at
|
|
133
|
+
\`github.com/voxgig/sdkgen/project/.sdk/src/cmp/go-cli/\`.
|
|
134
|
+
`))
|
|
135
|
+
|
|
136
|
+
// go.mod — sibling SDK via relative replace; aql/eng/go from the
|
|
137
|
+
// public Go module proxy.
|
|
138
|
+
File({ name: 'go.mod' }, () => Content(`module ${cliModule}
|
|
139
|
+
|
|
140
|
+
go 1.21
|
|
141
|
+
|
|
142
|
+
require ${sdkModule} v0.0.0
|
|
143
|
+
require github.com/aql-lang/aql/eng/go ${AQL_ENG_VERSION}
|
|
144
|
+
|
|
145
|
+
replace ${sdkModule} => ../go
|
|
146
|
+
`))
|
|
147
|
+
|
|
148
|
+
// main.go — produced from fragment/main.fragment.go with two Slots
|
|
149
|
+
// for the prompt label and the entity help line.
|
|
150
|
+
File({ name: 'main.go' }, () => {
|
|
151
|
+
Fragment(
|
|
152
|
+
{
|
|
153
|
+
from: Path.join(FRAGMENT, 'main.fragment.go'),
|
|
154
|
+
replace: {
|
|
155
|
+
...props.ctx$.stdrep,
|
|
156
|
+
GOMODULE: sdkModule,
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
() => {
|
|
160
|
+
Slot({ name: 'promptName' }, () => Content(model.name))
|
|
161
|
+
Slot({ name: 'entityNamesSpaced' }, () => Content(entityNames.join(' ')))
|
|
162
|
+
},
|
|
163
|
+
)
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
// words.go — produced from fragment/words.fragment.go with a single
|
|
167
|
+
// Slot that emits one `case "<name>":` per entity.
|
|
168
|
+
File({ name: 'words.go' }, () => {
|
|
169
|
+
Fragment(
|
|
170
|
+
{
|
|
171
|
+
from: Path.join(FRAGMENT, 'words.fragment.go'),
|
|
172
|
+
replace: {
|
|
173
|
+
...props.ctx$.stdrep,
|
|
174
|
+
GOMODULE: sdkModule,
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
() => {
|
|
178
|
+
Slot({ name: 'entityCases' }, () => {
|
|
179
|
+
each(entityMap, (entity: ModelEntity) => {
|
|
180
|
+
const lower = entity.name.toLowerCase()
|
|
181
|
+
const pascal = (entity as any).Name
|
|
182
|
+
Content(`\tcase "${lower}":
|
|
183
|
+
\t\treturn client.${pascal}(nil), nil
|
|
184
|
+
`)
|
|
185
|
+
})
|
|
186
|
+
})
|
|
187
|
+
},
|
|
188
|
+
)
|
|
189
|
+
})
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
export {
|
|
194
|
+
Main
|
|
195
|
+
}
|