@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
|
@@ -7,8 +7,10 @@ module ProjectNameUtilities
|
|
|
7
7
|
er.delete("err") if er.is_a?(Hash)
|
|
8
8
|
end
|
|
9
9
|
if ctx.result && ctx.result.ok
|
|
10
|
-
return ctx.result.resdata
|
|
10
|
+
return ctx.result.resdata
|
|
11
11
|
end
|
|
12
|
+
# On error, make_error raises the exception (or, when throw_err is
|
|
13
|
+
# disabled, returns the bare result data). Propagate its value.
|
|
12
14
|
ctx.utility.make_error.call(ctx, nil)
|
|
13
15
|
}
|
|
14
16
|
end
|
|
@@ -36,9 +36,12 @@ module ProjectNameUtilities
|
|
|
36
36
|
|
|
37
37
|
ctx.ctrl.err = sdk_err
|
|
38
38
|
|
|
39
|
+
# Opt-out escape hatch: when throwing is explicitly disabled, return the
|
|
40
|
+
# bare result data instead of raising.
|
|
39
41
|
if ctx.ctrl.throw_err == false
|
|
40
|
-
return result.resdata
|
|
42
|
+
return result.resdata
|
|
41
43
|
end
|
|
42
|
-
|
|
44
|
+
# Default idiomatic path: raise the already-constructed exception.
|
|
45
|
+
raise sdk_err
|
|
43
46
|
}
|
|
44
47
|
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.PHONY: test build clean publish
|
|
2
|
+
|
|
3
|
+
# tsc emits to dist/ + dist-test/; the test runner reads dist-test/, so build first.
|
|
4
|
+
test: build
|
|
5
|
+
npm test
|
|
6
|
+
|
|
7
|
+
build:
|
|
8
|
+
npm run build
|
|
9
|
+
|
|
10
|
+
clean:
|
|
11
|
+
rm -rf dist dist-test node_modules
|
|
12
|
+
|
|
13
|
+
# --- Release: publish to npm ----------------------------------------------
|
|
14
|
+
# Compile, then publish this package to npm and tag ts/vX.Y.Z. Run headless
|
|
15
|
+
# under the aql key vault, which injects the npm auth token + the GitHub token
|
|
16
|
+
# (never on disk or argv):
|
|
17
|
+
# aql vault exec --for=npm=<alias> --for=github=<alias> -- make publish
|
|
18
|
+
# aql `--dry-run` injects a filler token we detect to rehearse (build only, no
|
|
19
|
+
# publish/tag). set -e + tag-last: a failed publish never leaves a tag behind.
|
|
20
|
+
SHELL := /bin/bash
|
|
21
|
+
VERSION := $(shell node -p "require('./package.json').version")
|
|
22
|
+
TAG := ts/v$(VERSION)
|
|
23
|
+
AQL_DRY_RUN_FILLER := AQL-DRY-RUN-FILLER-NOT-A-REAL-SECRET
|
|
24
|
+
publish: test
|
|
25
|
+
@if git rev-parse -q --verify "refs/tags/$(TAG)" >/dev/null; then \
|
|
26
|
+
echo "tag $(TAG) already exists — bump package.json version first"; exit 1; fi
|
|
27
|
+
@set -e; \
|
|
28
|
+
token="$${GITHUB_TOKEN:-$$GH_TOKEN}"; \
|
|
29
|
+
if [ "$$token" = "$(AQL_DRY_RUN_FILLER)" ]; then \
|
|
30
|
+
echo "[dry-run] aql filler token detected: would publish to npm and tag $(TAG); nothing pushed."; \
|
|
31
|
+
exit 0; \
|
|
32
|
+
fi; \
|
|
33
|
+
npm publish --access public --registry https://registry.npmjs.org; \
|
|
34
|
+
git tag -a "$(TAG)" -m "ts v$(VERSION)"; \
|
|
35
|
+
url=$$(git remote get-url origin | sed -E 's#^git@github.com:#https://github.com/#'); \
|
|
36
|
+
if [ -n "$$token" ] && printf '%s' "$$url" | grep -q '^https://github.com/'; then \
|
|
37
|
+
hdr="AUTHORIZATION: basic $$(printf 'x-access-token:%s' "$$token" | base64 | tr -d '\n')"; \
|
|
38
|
+
git -c http.extraheader="$$hdr" push "$$url" "$(TAG)"; \
|
|
39
|
+
else \
|
|
40
|
+
git push origin "$(TAG)"; \
|
|
41
|
+
fi; \
|
|
42
|
+
echo "Published to npm + tag $(TAG)."
|
|
@@ -86,10 +86,15 @@ class Context {
|
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
resolveOp(opname: string): Operation {
|
|
89
|
-
|
|
89
|
+
// Cache key is `<entity>:<opname>` so two entities with the same op
|
|
90
|
+
// (e.g. both have a "list") get distinct cached Operations. Keying on
|
|
91
|
+
// opname alone caused the first-resolved entity's points to be served
|
|
92
|
+
// to every subsequent entity's call.
|
|
93
|
+
const entname = getprop(this.entity, 'name', '')
|
|
94
|
+
const cacheKey = entname + ':' + opname
|
|
95
|
+
let op: Operation = getprop(this.opmap, cacheKey)
|
|
90
96
|
|
|
91
97
|
if (null == op && null != opname) {
|
|
92
|
-
const entname = getprop(this.entity, 'name', '')
|
|
93
98
|
const opcfg = getpath(this.config, ['entity', entname, 'op', opname])
|
|
94
99
|
let input = 'match'
|
|
95
100
|
|
|
@@ -104,7 +109,7 @@ class Context {
|
|
|
104
109
|
points: getprop(opcfg, 'points', [])
|
|
105
110
|
})
|
|
106
111
|
|
|
107
|
-
setprop(this.opmap,
|
|
112
|
+
setprop(this.opmap, cacheKey, op)
|
|
108
113
|
}
|
|
109
114
|
|
|
110
115
|
return op
|
package/src/action/action.ts
CHANGED
|
@@ -12,22 +12,39 @@ import type {
|
|
|
12
12
|
} from '../types'
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
// Append `@"<name>.aontu"` import lines for each name not already present in
|
|
16
|
+
// the index content. Checking against the accumulating result (not the
|
|
17
|
+
// original) means duplicate names in the same call are added at most once.
|
|
18
|
+
function appendIndexEntries(content: string, names: string[]): string {
|
|
19
|
+
let out = content
|
|
20
|
+
|
|
21
|
+
for (const n of names) {
|
|
22
|
+
const entry = `@"${n}.aontu"`
|
|
23
|
+
if (!out.includes(entry)) {
|
|
24
|
+
out += '\n' + entry
|
|
25
|
+
}
|
|
26
|
+
}
|
|
17
27
|
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
return out
|
|
29
|
+
}
|
|
20
30
|
|
|
21
|
-
names.map((n: string) => {
|
|
22
|
-
if (!oldcontent.includes(`@"${n}.jsonic"`)) {
|
|
23
|
-
newcontent += `\n@"${n}.jsonic"`
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
const UpdateIndex = cmp(function UpdateIndex(props: any) {
|
|
33
|
+
Content(appendIndexEntries(props.content, props.names))
|
|
28
34
|
})
|
|
29
35
|
|
|
30
36
|
|
|
37
|
+
// Names given to an `add` action: every positional after the subcommand is
|
|
38
|
+
// a name, each possibly comma-separated — `target add ts,py,go` and
|
|
39
|
+
// `target add ts py go` are equivalent (space-separated extras used to be
|
|
40
|
+
// silently dropped).
|
|
41
|
+
function parseAddNames(args: any[]): string[] {
|
|
42
|
+
return args.slice(2)
|
|
43
|
+
.flatMap((a: any) => 'string' === typeof a ? a.split(',') : a)
|
|
44
|
+
.filter((n: any) => null != n && '' !== n)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
31
48
|
function loadContent(actx: ActionContext, which: string | string[]) {
|
|
32
49
|
which = Array.isArray(which) ? which : [which]
|
|
33
50
|
|
|
@@ -37,7 +54,7 @@ function loadContent(actx: ActionContext, which: string | string[]) {
|
|
|
37
54
|
const modelfolder = Path.dirname(actx.url)
|
|
38
55
|
|
|
39
56
|
which.map((w: string) => {
|
|
40
|
-
const indexfile = Path.join(modelfolder, w, w + '-index.
|
|
57
|
+
const indexfile = Path.join(modelfolder, w, w + '-index.aontu')
|
|
41
58
|
const indexcontent = fs.readFileSync(indexfile, 'utf8')
|
|
42
59
|
content[`${w}_index`] = indexcontent
|
|
43
60
|
})
|
|
@@ -49,5 +66,7 @@ function loadContent(actx: ActionContext, which: string | string[]) {
|
|
|
49
66
|
|
|
50
67
|
export {
|
|
51
68
|
UpdateIndex,
|
|
69
|
+
appendIndexEntries,
|
|
70
|
+
parseAddNames,
|
|
52
71
|
loadContent
|
|
53
72
|
}
|
package/src/action/feature.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import Path from 'node:path'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
Jostraca,
|
|
6
5
|
Project,
|
|
7
6
|
File,
|
|
8
7
|
Folder,
|
|
@@ -27,6 +26,7 @@ import { SdkGenError } from '../utility'
|
|
|
27
26
|
|
|
28
27
|
import {
|
|
29
28
|
UpdateIndex,
|
|
29
|
+
parseAddNames,
|
|
30
30
|
loadContent,
|
|
31
31
|
} from './action'
|
|
32
32
|
|
|
@@ -53,18 +53,16 @@ async function action_feature(args: string[], actx: ActionContext): Promise<Acti
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
async function cmd_feature_add(args: string[], actx: ActionContext): Promise<ActionResult> {
|
|
56
|
-
|
|
57
|
-
const features_arg = args[2]
|
|
58
|
-
const features: string[] =
|
|
59
|
-
'string' === typeof features_arg ? features_arg.split(',') : features_arg
|
|
60
|
-
|
|
61
|
-
return feature_add(features, actx)
|
|
56
|
+
return feature_add(parseAddNames(args), actx)
|
|
62
57
|
}
|
|
63
58
|
|
|
64
59
|
|
|
65
60
|
async function feature_add(features: string[], actx: ActionContext): Promise<ActionResult> {
|
|
66
61
|
|
|
67
|
-
|
|
62
|
+
// Reuse the caller's Jostraca instance so feature generation honours the
|
|
63
|
+
// shared controls (notably `dryrun`). A fresh Jostraca() defaults dryrun
|
|
64
|
+
// to false and would write files during a dry run.
|
|
65
|
+
const jostraca = actx.jostraca
|
|
68
66
|
|
|
69
67
|
const opts = {
|
|
70
68
|
fs: actx.fs,
|
|
@@ -120,21 +118,21 @@ const FeatureRoot = cmp(function FeatureRoot(props: any) {
|
|
|
120
118
|
Folder({ name: 'model/feature' }, () => {
|
|
121
119
|
Copy({
|
|
122
120
|
// TODO: these paths needs to be parameterised
|
|
123
|
-
from: BASE + '/project/.sdk/model/feature/' + fname + '.
|
|
121
|
+
from: BASE + '/project/.sdk/model/feature/' + fname + '.aontu',
|
|
124
122
|
exclude: true
|
|
125
123
|
})
|
|
126
|
-
File({ name: 'feature-index.
|
|
124
|
+
File({ name: 'feature-index.aontu' }, () => UpdateIndex({
|
|
127
125
|
content: ctx$.meta.content.feature_index,
|
|
128
126
|
names: features,
|
|
129
127
|
}))
|
|
130
128
|
})
|
|
131
129
|
|
|
132
|
-
each(target, (
|
|
133
|
-
Folder({ name: 'tm/' +
|
|
130
|
+
each(target, (t) =>
|
|
131
|
+
Folder({ name: 'tm/' + t.name + '/src/feature/' + fname }, () => {
|
|
134
132
|
const from = Path.join(
|
|
135
|
-
(
|
|
133
|
+
(t.base || Path.join(BASE, '/project/.sdk')),
|
|
136
134
|
'tm',
|
|
137
|
-
|
|
135
|
+
t.name,
|
|
138
136
|
'/src/feature/',
|
|
139
137
|
fname
|
|
140
138
|
)
|
package/src/action/target.ts
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
|
|
32
32
|
import {
|
|
33
33
|
UpdateIndex,
|
|
34
|
+
parseAddNames,
|
|
34
35
|
loadContent,
|
|
35
36
|
} from './action'
|
|
36
37
|
|
|
@@ -55,11 +56,7 @@ async function action_target(args: string[], actx: ActionContext): Promise<Actio
|
|
|
55
56
|
|
|
56
57
|
|
|
57
58
|
async function cmd_target_add(args: string[], actx: ActionContext): Promise<ActionResult> {
|
|
58
|
-
|
|
59
|
-
const targets: string[] =
|
|
60
|
-
'string' === typeof targets_arg ? targets_arg.split(',') : targets_arg
|
|
61
|
-
|
|
62
|
-
return target_add(targets, actx)
|
|
59
|
+
return target_add(parseAddNames(args), actx)
|
|
63
60
|
}
|
|
64
61
|
|
|
65
62
|
|
|
@@ -87,17 +84,22 @@ async function target_add(targets: string[], actx: ActionContext): Promise<Actio
|
|
|
87
84
|
})
|
|
88
85
|
|
|
89
86
|
|
|
90
|
-
const jres = await jostraca.generate(opts, () => TargetRoot({ targets, actx }))
|
|
91
|
-
|
|
92
|
-
showChanges(opts.log, 'target-result', jres)
|
|
93
|
-
|
|
94
87
|
// The `test` feature is required by every generated target (SDK.test()
|
|
95
88
|
// depends on it), so ensure it is added even if the model does not yet
|
|
96
89
|
// declare it.
|
|
97
90
|
const features = Array.from(new Set([
|
|
98
91
|
'test',
|
|
99
|
-
...Object.keys(actx.model.main[KIT]
|
|
92
|
+
...Object.keys(actx.model.main[KIT]?.feature ?? {}),
|
|
100
93
|
]))
|
|
94
|
+
|
|
95
|
+
const jres = await jostraca.generate(opts, () =>
|
|
96
|
+
TargetRoot({ targets, features, actx }))
|
|
97
|
+
|
|
98
|
+
showChanges(opts.log, 'target-result', jres)
|
|
99
|
+
|
|
100
|
+
// feature_add copies feature templates for targets already registered in
|
|
101
|
+
// the model. The targets added above are not in the in-memory model yet,
|
|
102
|
+
// so TargetRoot copies their feature templates itself.
|
|
101
103
|
await feature_add(features, actx)
|
|
102
104
|
|
|
103
105
|
opts.log.info({
|
|
@@ -112,13 +114,18 @@ async function target_add(targets: string[], actx: ActionContext): Promise<Actio
|
|
|
112
114
|
|
|
113
115
|
|
|
114
116
|
const TargetRoot = cmp(function TargetRoot(props: any) {
|
|
115
|
-
const { ctx$, targets } = props
|
|
117
|
+
const { ctx$, targets, features } = props
|
|
116
118
|
const { model, log } = ctx$
|
|
117
119
|
|
|
118
120
|
// TODO: jostraca - make from value easier to specify
|
|
119
121
|
// const tfolder = 'node_modules/@voxgig/sdkgen/project/.sdk'
|
|
120
122
|
|
|
121
123
|
Project({}, () => {
|
|
124
|
+
// Resolved names of every target in this run. The index File is
|
|
125
|
+
// re-rendered per target and the last render wins, so each render must
|
|
126
|
+
// carry all names seen so far, not just its own.
|
|
127
|
+
const tnames: string[] = []
|
|
128
|
+
|
|
122
129
|
each(targets, (n) => {
|
|
123
130
|
const tref = n.val$
|
|
124
131
|
|
|
@@ -129,6 +136,7 @@ const TargetRoot = cmp(function TargetRoot(props: any) {
|
|
|
129
136
|
})
|
|
130
137
|
|
|
131
138
|
const { tname, tfolder, torigname, base } = resolveTarget(tref, ctx$)
|
|
139
|
+
tnames.push(tname)
|
|
132
140
|
const targetNote = tname + (tname != tref ? ' ref:' + tref : '')
|
|
133
141
|
|
|
134
142
|
log.info({
|
|
@@ -140,16 +148,15 @@ const TargetRoot = cmp(function TargetRoot(props: any) {
|
|
|
140
148
|
|
|
141
149
|
Folder({ name: 'model/target' }, () => {
|
|
142
150
|
Copy({
|
|
143
|
-
from: tfolder + '/model/target/' + torigname + '.
|
|
151
|
+
from: tfolder + '/model/target/' + torigname + '.aontu',
|
|
144
152
|
// exclude: true
|
|
145
153
|
replace: {
|
|
146
154
|
"'BASE'": "'" + base + "'"
|
|
147
155
|
}
|
|
148
156
|
})
|
|
149
|
-
File({ name: 'target-index.
|
|
157
|
+
File({ name: 'target-index.aontu' }, () => UpdateIndex({
|
|
150
158
|
content: ctx$.meta.content.target_index,
|
|
151
|
-
|
|
152
|
-
names: [tname]
|
|
159
|
+
names: tnames,
|
|
153
160
|
}))
|
|
154
161
|
})
|
|
155
162
|
|
|
@@ -174,8 +181,11 @@ const TargetRoot = cmp(function TargetRoot(props: any) {
|
|
|
174
181
|
Folder({ name: 'src/feature' }, () => {
|
|
175
182
|
Copy({ from: tfolder + '/tm/' + torigname + '/src/feature/README.md' })
|
|
176
183
|
|
|
177
|
-
|
|
178
|
-
|
|
184
|
+
each(Array.from(new Set(['base', ...(features ?? [])])), (f: any) => {
|
|
185
|
+
const fname = f.val$
|
|
186
|
+
Folder({ name: fname }, () => {
|
|
187
|
+
Copy({ from: tfolder + '/tm/' + torigname + '/src/feature/' + fname })
|
|
188
|
+
})
|
|
179
189
|
})
|
|
180
190
|
})
|
|
181
191
|
})
|
|
@@ -256,4 +266,5 @@ function resolveTarget(tref: string, ctx$: any) {
|
|
|
256
266
|
export {
|
|
257
267
|
action_target,
|
|
258
268
|
target_add,
|
|
269
|
+
resolveTarget,
|
|
259
270
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { cmp, Content, File } from 'jostraca'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// Root CHANGELOG.md seed. Generated as an initial "Keep a Changelog" skeleton;
|
|
5
|
+
// the version reflects the lockstep SDK version at generation time. (Publish
|
|
6
|
+
// history is carried by the git release tags <target>/vX.Y.Z.)
|
|
7
|
+
const Changelog = cmp(function Changelog(props: any) {
|
|
8
|
+
const { ctx$ } = props
|
|
9
|
+
const { model } = ctx$
|
|
10
|
+
|
|
11
|
+
const name = model.Name || model.name
|
|
12
|
+
|
|
13
|
+
File({ name: 'CHANGELOG.md' }, () => {
|
|
14
|
+
Content(`# Changelog
|
|
15
|
+
|
|
16
|
+
All notable changes to the generated ${name} SDK are documented here.
|
|
17
|
+
This project follows [Keep a Changelog](https://keepachangelog.com) and
|
|
18
|
+
[Semantic Versioning](https://semver.org).
|
|
19
|
+
|
|
20
|
+
## [Unreleased]
|
|
21
|
+
|
|
22
|
+
## [0.0.1]
|
|
23
|
+
|
|
24
|
+
- Initial generated release of the ${name} SDK (TypeScript, Python, PHP, Go,
|
|
25
|
+
Ruby, and Lua, plus CLI and MCP surfaces), generated from the upstream
|
|
26
|
+
OpenAPI specification by @voxgig/sdkgen.
|
|
27
|
+
`)
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
Changelog
|
|
34
|
+
}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { cmp, each, Content, File } from 'jostraca'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
KIT,
|
|
5
|
+
getModelPath
|
|
6
|
+
} from '../types'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// Generate the SDK root deployment Makefile from the model's per-target
|
|
10
|
+
// `publish` sections (see model/sdkgen.aontu):
|
|
11
|
+
//
|
|
12
|
+
// publish.tag — git release tag `<prefix>/vX.Y.Z`; every port has
|
|
13
|
+
// one, pushed with a token from the aql key vault
|
|
14
|
+
// (--for recipe + alias, default github/github).
|
|
15
|
+
// publish.registry — package registry details (name, url, vault
|
|
16
|
+
// credential recipe or raw env mapping) plus a
|
|
17
|
+
// `state` (pending | active | inactive; the legacy
|
|
18
|
+
// `active: true` bool is honoured as an alias for
|
|
19
|
+
// state === 'active'). While a registry is NOT
|
|
20
|
+
// active (publish pending) a real deploy publishes
|
|
21
|
+
// the git tag only; the package upload starts when
|
|
22
|
+
// state flips to 'active'. Tag-only ports (go
|
|
23
|
+
// family) have no registry.
|
|
24
|
+
//
|
|
25
|
+
// Follows the voxgig/struct root Makefile conventions: per-target deploy
|
|
26
|
+
// targets, deliberately no all-targets real deploy (each upload is
|
|
27
|
+
// irreversible), and an everything-at-once DRY run leaning on
|
|
28
|
+
// `aql vault exec --dry-run` filler-token cooperation in each target's
|
|
29
|
+
// publish recipe.
|
|
30
|
+
const Deploy = cmp(function Deploy(props: any) {
|
|
31
|
+
const { ctx$ } = props
|
|
32
|
+
const { model } = ctx$
|
|
33
|
+
|
|
34
|
+
const targetMap = getModelPath(model, `main.${KIT}.target`) || {}
|
|
35
|
+
const targets: any[] = []
|
|
36
|
+
each(targetMap, (t: any) => {
|
|
37
|
+
if (false !== t.active) targets.push(t)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
if (0 === targets.length) {
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
File({ name: 'Makefile' }, () => {
|
|
45
|
+
Content(makeDeployMakefile(model, targets))
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
ctx$.log.info({
|
|
49
|
+
point: 'generate-deploy',
|
|
50
|
+
note: 'targets: ' + targets.map((t: any) =>
|
|
51
|
+
t.name + (registryOf(t) ? (':' + registryOf(t).name + (regIsActive(registryOf(t)) ? '' : '(publish pending)')) : ':tag-only')
|
|
52
|
+
).join(',')
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
function registryOf(t: any): any | undefined {
|
|
58
|
+
const reg = t.publish?.registry
|
|
59
|
+
return (reg && '' !== (reg.name || '')) ? reg : undefined
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
// A registry is active (package really uploaded) when its tri-state
|
|
64
|
+
// `state === 'active'`. The legacy boolean `active: true` is honoured as a
|
|
65
|
+
// back-compat alias. Anything else — 'pending' (the default), 'inactive' —
|
|
66
|
+
// means a deploy publishes the git tag only.
|
|
67
|
+
function regIsActive(reg: any): boolean {
|
|
68
|
+
if (null == reg) return false
|
|
69
|
+
if (true === reg.active) return true // legacy alias
|
|
70
|
+
return 'active' === reg.state
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
function aliasVarName(name: string): string {
|
|
75
|
+
return name.toUpperCase().replace(/[^A-Z0-9]+/g, '_') + '_ALIAS'
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
// The aql vault exec argument string for a target: `--for=<recipe>=<alias>`
|
|
80
|
+
// flags where a preset recipe exists, or a raw `'alias=ENV_VAR,...'`
|
|
81
|
+
// mapping when any credential lacks a preset (e.g. luarocks). The github
|
|
82
|
+
// token for the tag push is always included.
|
|
83
|
+
function vaultExecArgs(t: any): string {
|
|
84
|
+
const tagVault = t.publish?.tag?.vault || {}
|
|
85
|
+
const ghRecipe = tagVault.recipe || 'github'
|
|
86
|
+
const ghVar = aliasVarName(ghRecipe)
|
|
87
|
+
const reg = registryOf(t)
|
|
88
|
+
const regVault = reg?.vault || {}
|
|
89
|
+
const regVar = reg ? aliasVarName(reg.name) : ''
|
|
90
|
+
|
|
91
|
+
if (reg && '' === (regVault.recipe || '') && '' !== (regVault.env || '')) {
|
|
92
|
+
// Raw env mapping style: every credential as alias=ENV_VAR.
|
|
93
|
+
return `'$(${regVar})=${regVault.env},$(${ghVar})=GITHUB_TOKEN'`
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const flags = []
|
|
97
|
+
if (reg && '' !== (regVault.recipe || '')) {
|
|
98
|
+
flags.push(`--for=${regVault.recipe}=$(${regVar})`)
|
|
99
|
+
}
|
|
100
|
+
flags.push(`--for=${ghRecipe}=$(${ghVar})`)
|
|
101
|
+
return flags.join(' ')
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
function makeDeployMakefile(model: any, targets: any[]): string {
|
|
106
|
+
// Alias variables: one per distinct vault credential, defaulting to the
|
|
107
|
+
// model's alias (or the registry/recipe name).
|
|
108
|
+
const aliasVars = new Map<string, string>()
|
|
109
|
+
for (const t of targets) {
|
|
110
|
+
const tagVault = t.publish?.tag?.vault || {}
|
|
111
|
+
const ghRecipe = tagVault.recipe || 'github'
|
|
112
|
+
if (!aliasVars.has(aliasVarName(ghRecipe))) {
|
|
113
|
+
aliasVars.set(aliasVarName(ghRecipe), tagVault.alias || ghRecipe)
|
|
114
|
+
}
|
|
115
|
+
const reg = registryOf(t)
|
|
116
|
+
if (reg && !aliasVars.has(aliasVarName(reg.name))) {
|
|
117
|
+
aliasVars.set(aliasVarName(reg.name), reg.vault?.alias || reg.name)
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const summary = targets.map((t: any) => {
|
|
122
|
+
const reg = registryOf(t)
|
|
123
|
+
const state = reg
|
|
124
|
+
? `${reg.name} (${regIsActive(reg) ? 'ACTIVE' : 'publish pending: deploy publishes the git tag only'}) ${reg.url || ''}`.trim()
|
|
125
|
+
: 'tag-only'
|
|
126
|
+
return `# ${t.name.padEnd(8)} ${state}`
|
|
127
|
+
}).join('\n')
|
|
128
|
+
|
|
129
|
+
const deployRules = targets.map((t: any) => {
|
|
130
|
+
const reg = registryOf(t)
|
|
131
|
+
// The github token is the only credential a tag-only deploy needs.
|
|
132
|
+
const tagVault = t.publish?.tag?.vault || {}
|
|
133
|
+
const ghRecipe = tagVault.recipe || 'github'
|
|
134
|
+
const ghArgs = `--for=${ghRecipe}=$(${aliasVarName(ghRecipe)})`
|
|
135
|
+
const args = vaultExecArgs(t)
|
|
136
|
+
|
|
137
|
+
const via = t.publish?.tag?.via || 'port'
|
|
138
|
+
|
|
139
|
+
if (!reg && 'root' === via) {
|
|
140
|
+
// Tag-only port with no Makefile of its own (e.g. go-cli): the
|
|
141
|
+
// root tag-push recipe is the whole deploy.
|
|
142
|
+
return `
|
|
143
|
+
deploy-${t.name}:
|
|
144
|
+
\t@echo "deploy-${t.name}: tag-only port — publishing the git tag."
|
|
145
|
+
\taql vault exec ${ghArgs} -- $(MAKE) tag-push-${t.name}
|
|
146
|
+
|
|
147
|
+
deploy-dry-${t.name}:
|
|
148
|
+
\taql vault exec --dry-run ${ghArgs} -- $(MAKE) tag-push-${t.name}
|
|
149
|
+
${tagPushRecipe(t.name, 'tag-only port')}
|
|
150
|
+
`
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (reg && !regIsActive(reg)) {
|
|
154
|
+
// Publish pending: deploying this target publishes its git tag
|
|
155
|
+
// only. The package upload turns on by flipping
|
|
156
|
+
// publish.registry.state to 'active' in the model and regenerating.
|
|
157
|
+
return `
|
|
158
|
+
deploy-${t.name}:
|
|
159
|
+
\t@echo "deploy-${t.name}: ${reg.name} publication is pending — publishing the git tag only."
|
|
160
|
+
\taql vault exec ${ghArgs} -- $(MAKE) tag-push-${t.name}
|
|
161
|
+
|
|
162
|
+
deploy-dry-${t.name}:
|
|
163
|
+
\taql vault exec --dry-run ${ghArgs} -- $(MAKE) tag-push-${t.name}
|
|
164
|
+
${tagPushRecipe(t.name, reg.name + ' publication pending — tag-only deploy')}
|
|
165
|
+
`
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return `
|
|
169
|
+
deploy-${t.name}:
|
|
170
|
+
\taql vault exec ${args} -- $(MAKE) -C ${t.name} publish
|
|
171
|
+
|
|
172
|
+
deploy-dry-${t.name}:
|
|
173
|
+
\taql vault exec --dry-run ${args} -- $(MAKE) -C ${t.name} publish
|
|
174
|
+
`
|
|
175
|
+
}).join('')
|
|
176
|
+
|
|
177
|
+
const varLines = Array.from(aliasVars.entries())
|
|
178
|
+
.map(([v, def]) => `${v} ?= ${def}`).join('\n')
|
|
179
|
+
|
|
180
|
+
return `# ${model.Name} SDK deployment. GENERATED by @voxgig/sdkgen — regenerated
|
|
181
|
+
# on every \`npm run generate\` in .sdk/; publication details live in the
|
|
182
|
+
# model (.sdk/model/target/<target>.aontu, \`publish\` section).
|
|
183
|
+
#
|
|
184
|
+
# Every port gets a git release tag <target>/vX.Y.Z. Ports with an ACTIVE
|
|
185
|
+
# registry also publish a package there. Credentials are injected at exec
|
|
186
|
+
# time by the aql key vault (https://github.com/aql-lang/aql) — never
|
|
187
|
+
# stored on disk or passed on the command line.
|
|
188
|
+
#
|
|
189
|
+
# Publication state (from the model):
|
|
190
|
+
${summary}
|
|
191
|
+
#
|
|
192
|
+
# make deploy list per-target deploy commands
|
|
193
|
+
# make deploy-<target> deploy ONE target (no deploy-all: each
|
|
194
|
+
# registry upload is irreversible); while a
|
|
195
|
+
# registry is pending this publishes the
|
|
196
|
+
# port's git tag only
|
|
197
|
+
# make deploy-dry rehearse EVERY target: aql --dry-run
|
|
198
|
+
# injects a filler token that each publish
|
|
199
|
+
# recipe detects, so build + test run in full
|
|
200
|
+
# but nothing is uploaded and no tag is cut
|
|
201
|
+
#
|
|
202
|
+
# Vault aliases (override per invocation, e.g. make deploy-ts NPM_ALIAS=work:npm):
|
|
203
|
+
|
|
204
|
+
SHELL := /bin/bash
|
|
205
|
+
|
|
206
|
+
${varLines}
|
|
207
|
+
|
|
208
|
+
# Lockstep SDK version, read from the canonical ts manifest.
|
|
209
|
+
VERSION := $(shell node -p "require('./ts/package.json').version" 2>/dev/null || echo 0.0.0)
|
|
210
|
+
AQL_DRY_RUN_FILLER := AQL-DRY-RUN-FILLER-NOT-A-REAL-SECRET
|
|
211
|
+
|
|
212
|
+
TARGETS := ${targets.map((t: any) => t.name).join(' ')}
|
|
213
|
+
|
|
214
|
+
.PHONY: deploy deploy-dry \\
|
|
215
|
+
$(addprefix deploy-,$(TARGETS)) $(addprefix deploy-dry-,$(TARGETS)) \\
|
|
216
|
+
$(addprefix tag-push-,$(TARGETS))
|
|
217
|
+
|
|
218
|
+
deploy:
|
|
219
|
+
\t@echo "Deployment is per-target — pick one (each upload is irreversible):"
|
|
220
|
+
\t@echo " make deploy-<target> targets: $(TARGETS)"
|
|
221
|
+
\t@echo "Registry state is set in the model (.sdk/model/target/<t>.aontu):"
|
|
222
|
+
${targets.map((t: any) => {
|
|
223
|
+
const reg = registryOf(t)
|
|
224
|
+
const state = reg ? `${reg.name} ${regIsActive(reg) ? 'ACTIVE' : 'publish pending (deploy = git tag only)'}` : 'tag-only'
|
|
225
|
+
return `\t@echo " deploy-${t.name.padEnd(8)} ${state}"`
|
|
226
|
+
}).join('\n')}
|
|
227
|
+
\t@echo "Rehearse everything safely first: make deploy-dry"
|
|
228
|
+
|
|
229
|
+
deploy-dry: $(addprefix deploy-dry-,$(TARGETS))
|
|
230
|
+
\t@echo "deploy-dry: all targets rehearsed OK ($(TARGETS))"
|
|
231
|
+
${deployRules}`
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
// The root-level tag creation + push recipe for a target: aql --dry-run
|
|
237
|
+
// filler cooperation, idempotent tag creation, token-authenticated https
|
|
238
|
+
// push (works from an ssh-remote clone without ssh keys).
|
|
239
|
+
function tagPushRecipe(name: string, note: string): string {
|
|
240
|
+
return `
|
|
241
|
+
tag-push-${name}:
|
|
242
|
+
\t@set -e; tag="${name}/v$(VERSION)"; \\
|
|
243
|
+
\ttoken="\$\${GITHUB_TOKEN:-$$GH_TOKEN}"; \\
|
|
244
|
+
\tif [ "$$token" = "$(AQL_DRY_RUN_FILLER)" ]; then \\
|
|
245
|
+
\t echo "[dry-run] aql filler token detected: would create (if missing) and push tag $$tag; nothing pushed."; exit 0; fi; \\
|
|
246
|
+
\tif [ -z "$$token" ]; then echo "tag-push-${name}: no GITHUB_TOKEN in env — run via make deploy-${name} (aql vault exec)"; exit 1; fi; \\
|
|
247
|
+
\tif git rev-parse -q --verify "refs/tags/$$tag" >/dev/null; then \\
|
|
248
|
+
\t echo "tag $$tag already exists — pushing existing tag"; \\
|
|
249
|
+
\telse git tag -a "$$tag" -m "Release $$tag"; fi; \\
|
|
250
|
+
\turl=$$(git remote get-url origin | sed -E 's#^git@github.com:#https://github.com/#'); \\
|
|
251
|
+
\thdr="AUTHORIZATION: basic $$(printf 'x-access-token:%s' "$$token" | base64 | tr -d '\\n')"; \\
|
|
252
|
+
\tgit -c http.extraheader="$$hdr" push "$$url" "$$tag"; \\
|
|
253
|
+
\techo "pushed $$tag (${note})"`
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export {
|
|
257
|
+
Deploy
|
|
258
|
+
}
|
package/src/cmp/FeatureHook.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { each, cmp
|
|
2
|
+
import { each, cmp } from 'jostraca'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -12,14 +12,12 @@ const FeatureHook = cmp(function FeatureHook(props: any, children: any) {
|
|
|
12
12
|
|
|
13
13
|
const feature = getModelPath(model, `main.${KIT}.feature`)
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// TODO: much better error reporting for invalid feature hook names
|
|
15
|
+
// A feature need not implement every pipeline stage; only fire the hook
|
|
16
|
+
// for features that declare it as active. Optional chaining guards
|
|
17
|
+
// features whose `hook` map omits this stage entirely.
|
|
19
18
|
each(feature)
|
|
20
|
-
|
|
21
|
-
.
|
|
22
|
-
.map(feature => each(children, { call: true, args: feature }))
|
|
19
|
+
.filter(feature => feature.active && feature.hook?.[props.name]?.active)
|
|
20
|
+
.forEach(feature => each(children, { call: true, args: feature }))
|
|
23
21
|
})
|
|
24
22
|
|
|
25
23
|
|