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