@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
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, File, isAuthActive } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, File, isAuthActive, entityIdField, opRequestShape, safeVarName } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
6
6
|
getModelPath,
|
|
7
7
|
} from '@voxgig/apidef'
|
|
8
8
|
|
|
9
|
+
import { exampleValue } from './utility_ts'
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
const OP_SIGNATURES: Record<string, { sig: string, returns: string, desc: string }> = {
|
|
11
13
|
load: {
|
|
@@ -70,8 +72,7 @@ Create a new SDK client instance.
|
|
|
70
72
|
| Name | Type | Description |
|
|
71
73
|
| --- | --- | --- |
|
|
72
74
|
| \`options\` | \`object\` | SDK configuration options. |
|
|
73
|
-
| \`options.apikey\` | \`string\` | API key for authentication. |
|
|
74
|
-
| \`options.base\` | \`string\` | Base URL for API requests. |
|
|
75
|
+
${isAuthActive(model) ? '| \`options.apikey\` | \`string\` | API key for authentication. |\n' : ''}| \`options.base\` | \`string\` | Base URL for API requests. |
|
|
75
76
|
| \`options.prefix\` | \`string\` | URL prefix appended after base. |
|
|
76
77
|
| \`options.suffix\` | \`string\` | URL suffix appended after path. |
|
|
77
78
|
| \`options.headers\` | \`object\` | Custom headers for all requests. |
|
|
@@ -180,6 +181,11 @@ Alias for \`${model.Name}SDK.test()\`.
|
|
|
180
181
|
publishedEntities.map((ent: any) => {
|
|
181
182
|
const opnames = Object.keys(ent.op || {})
|
|
182
183
|
const fields = ent.fields || []
|
|
184
|
+
// Model-driven id key: null when this entity has no id-like field, in
|
|
185
|
+
// which case load/remove match on no argument and update omits the id.
|
|
186
|
+
const idF = entityIdField(ent)
|
|
187
|
+
// Variable-safe lowercase name (a `Delete` entity must not bind `delete`).
|
|
188
|
+
const eVar = safeVarName(ent.name, target.name)
|
|
183
189
|
|
|
184
190
|
Content(`
|
|
185
191
|
---
|
|
@@ -195,7 +201,7 @@ Alias for \`${model.Name}SDK.test()\`.
|
|
|
195
201
|
}
|
|
196
202
|
|
|
197
203
|
Content(`\`\`\`ts
|
|
198
|
-
const ${
|
|
204
|
+
const ${eVar} = client.${ent.Name}()
|
|
199
205
|
\`\`\`
|
|
200
206
|
|
|
201
207
|
`)
|
|
@@ -211,7 +217,7 @@ const ${ent.name} = client.${ent.Name}()
|
|
|
211
217
|
each(fields, (field: any) => {
|
|
212
218
|
const req = field.req ? 'Yes' : 'No'
|
|
213
219
|
const desc = field.short || ''
|
|
214
|
-
Content(`| \`${field.name}\` | \`${field.type
|
|
220
|
+
Content(`| \`${field.name}\` | \`${canonToType(field.type, target.name)}\` | ${req} | ${desc} |
|
|
215
221
|
`)
|
|
216
222
|
})
|
|
217
223
|
|
|
@@ -221,15 +227,18 @@ const ${ent.name} = client.${ent.Name}()
|
|
|
221
227
|
// Field operations breakdown
|
|
222
228
|
const hasFieldOps = fields.some((f: any) => f.op && Object.keys(f.op).length > 0)
|
|
223
229
|
if (hasFieldOps) {
|
|
230
|
+
// Only emit columns for operations this entity actually exposes —
|
|
231
|
+
// never advertise a create/update/remove column the entity lacks.
|
|
232
|
+
const opcols = ['load', 'list', 'create', 'update', 'remove']
|
|
233
|
+
.filter((op: string) => opnames.includes(op) && ent.op[op]?.active !== false)
|
|
224
234
|
Content(`### Field Usage by Operation
|
|
225
235
|
|
|
226
|
-
| Field |
|
|
227
|
-
| --- |
|
|
236
|
+
| Field | ${opcols.join(' | ')} |
|
|
237
|
+
| --- | ${opcols.map(() => '---').join(' | ')} |
|
|
228
238
|
`)
|
|
229
239
|
each(fields, (field: any) => {
|
|
230
240
|
const fops = field.op || {}
|
|
231
|
-
const cols =
|
|
232
|
-
if (!opnames.includes(op)) return '-'
|
|
241
|
+
const cols = opcols.map((op: string) => {
|
|
233
242
|
const fop = fops[op]
|
|
234
243
|
if (null == fop) return '-'
|
|
235
244
|
if (fop.active === false) return '-'
|
|
@@ -263,8 +272,20 @@ ${info.desc}
|
|
|
263
272
|
|
|
264
273
|
// Show example
|
|
265
274
|
if ('load' === opname || 'remove' === opname) {
|
|
275
|
+
// The id key plus every REQUIRED match key (parent path params
|
|
276
|
+
// like page_id) — the same shape that generates <Name><Op>Match,
|
|
277
|
+
// so the example always type-checks.
|
|
278
|
+
const matchItems = opRequestShape(ent, opname).items
|
|
279
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
280
|
+
.sort((a: any, b: any) =>
|
|
281
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
282
|
+
const arg = 0 < matchItems.length
|
|
283
|
+
? `{ ${matchItems.map((it: any) =>
|
|
284
|
+
`${it.name}: ${exampleValue(ent, ent.op && ent.op[opname], it.name,
|
|
285
|
+
it.name === idF ? ent.name + '_id' : it.name)}`).join(', ')} }`
|
|
286
|
+
: ''
|
|
266
287
|
Content(`\`\`\`ts
|
|
267
|
-
const result = await client.${ent.Name}().${opname}(
|
|
288
|
+
const result = await client.${ent.Name}().${opname}(${arg})
|
|
268
289
|
\`\`\`
|
|
269
290
|
|
|
270
291
|
`)
|
|
@@ -277,14 +298,19 @@ const results = await client.${ent.Name}().${opname}()
|
|
|
277
298
|
`)
|
|
278
299
|
}
|
|
279
300
|
else if ('create' === opname) {
|
|
301
|
+
// Members come from the SAME shape that generates
|
|
302
|
+
// <Name>CreateData: every required member must appear (the
|
|
303
|
+
// /* type */ placeholders also mark the block as an illustration
|
|
304
|
+
// for the doc gates); an all-optional create renders an empty —
|
|
305
|
+
// still assignable — literal.
|
|
306
|
+
const createItems = opRequestShape(ent, 'create').items
|
|
307
|
+
.filter((it: any) => !it.optional)
|
|
280
308
|
Content(`\`\`\`ts
|
|
281
309
|
const result = await client.${ent.Name}().create({
|
|
282
310
|
`)
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
Content(` ${field.name}: /* ${field.type || 'value'} */,
|
|
311
|
+
createItems.map((it: any) => {
|
|
312
|
+
Content(` ${it.name}: /* ${canonToType(it.type, target.name)} */,
|
|
286
313
|
`)
|
|
287
|
-
}
|
|
288
314
|
})
|
|
289
315
|
Content(`})
|
|
290
316
|
\`\`\`
|
|
@@ -292,10 +318,18 @@ const result = await client.${ent.Name}().create({
|
|
|
292
318
|
`)
|
|
293
319
|
}
|
|
294
320
|
else if ('update' === opname) {
|
|
321
|
+
// The id key plus every REQUIRED data member — the same shape
|
|
322
|
+
// that generates <Name>UpdateData — then the patch-fields note.
|
|
323
|
+
const updateItems = opRequestShape(ent, 'update').items
|
|
324
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
325
|
+
.sort((a: any, b: any) =>
|
|
326
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
327
|
+
const updateLines = updateItems.map((it: any) =>
|
|
328
|
+
` ${it.name}: ${exampleValue(ent, ent.op && ent.op.update, it.name,
|
|
329
|
+
it.name === idF ? ent.name + '_id' : it.name)},\n`).join('')
|
|
295
330
|
Content(`\`\`\`ts
|
|
296
331
|
const result = await client.${ent.Name}().update({
|
|
297
|
-
|
|
298
|
-
// Fields to update
|
|
332
|
+
${updateLines} // Fields to update
|
|
299
333
|
})
|
|
300
334
|
\`\`\`
|
|
301
335
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, packageName, envName, entityIdField, entityOps, opRequestShape, safeVarName } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
nom,
|
|
8
8
|
} from '@voxgig/apidef'
|
|
9
9
|
|
|
10
|
+
import { exampleValue } from './utility_ts'
|
|
11
|
+
|
|
10
12
|
|
|
11
13
|
const ReadmeTopQuick = cmp(function ReadmeTopQuick(props: any) {
|
|
12
14
|
const { target, ctx$: { model } } = props
|
|
@@ -14,45 +16,82 @@ const ReadmeTopQuick = cmp(function ReadmeTopQuick(props: any) {
|
|
|
14
16
|
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
15
17
|
const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
|
|
16
18
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
:
|
|
19
|
+
const authActive = isAuthActive(model)
|
|
20
|
+
const ctor = authActive
|
|
21
|
+
? `new ${model.const.Name}SDK({\n apikey: process.env.${envName(model)}_APIKEY,\n})`
|
|
22
|
+
: `new ${model.const.Name}SDK()`
|
|
20
23
|
|
|
21
24
|
Content(`\`\`\`ts
|
|
22
|
-
import { ${model.const.Name}SDK } from '${target.
|
|
25
|
+
import { ${model.const.Name}SDK } from '${packageName(model, target.name)}'
|
|
23
26
|
|
|
24
|
-
const client =
|
|
27
|
+
const client = ${ctor}
|
|
25
28
|
|
|
26
29
|
`)
|
|
27
30
|
|
|
28
31
|
if (exampleEntity) {
|
|
29
32
|
const eName = nom(exampleEntity, 'Name')
|
|
30
|
-
const
|
|
33
|
+
const eVar = safeVarName(eName.toLowerCase(), 'ts')
|
|
34
|
+
const opnames = entityOps(exampleEntity)
|
|
35
|
+
|
|
36
|
+
let hasCall = false
|
|
31
37
|
|
|
32
38
|
if (opnames.includes('list')) {
|
|
33
|
-
Content(`// List all ${eName.toLowerCase()}s
|
|
34
|
-
const ${
|
|
39
|
+
Content(`// List all ${eName.toLowerCase()}s (returns ${eName}[])
|
|
40
|
+
const ${eVar}s = await client.${eName}().list()
|
|
41
|
+
for (const ${eVar} of ${eVar}s) {
|
|
42
|
+
console.log(${eVar})
|
|
43
|
+
}
|
|
35
44
|
`)
|
|
45
|
+
hasCall = true
|
|
36
46
|
}
|
|
37
47
|
|
|
38
|
-
// Find a nested entity for a more interesting example
|
|
48
|
+
// Find a nested entity for a more interesting example: one with a parent
|
|
49
|
+
// chain, an active load op of its OWN, and a required non-id load param
|
|
50
|
+
// to demonstrate (the parent key, e.g. page_id).
|
|
39
51
|
const nestedEntity = Object.values(entity).find((e: any) =>
|
|
40
|
-
e.active !== false &&
|
|
52
|
+
e.active !== false &&
|
|
53
|
+
e.relations && e.relations.ancestors && 0 < e.relations.ancestors.length &&
|
|
54
|
+
entityOps(e).includes('load') &&
|
|
55
|
+
opRequestShape(e, 'load').items.some((it: any) =>
|
|
56
|
+
!it.optional && it.name !== entityIdField(e))
|
|
41
57
|
) as any
|
|
42
58
|
|
|
43
|
-
if (nestedEntity
|
|
59
|
+
if (nestedEntity) {
|
|
44
60
|
const neName = nom(nestedEntity, 'Name')
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
61
|
+
const neVar = safeVarName(neName.toLowerCase(), 'ts')
|
|
62
|
+
const loadOp = nestedEntity.op && nestedEntity.op.load
|
|
63
|
+
|
|
64
|
+
// Every REQUIRED load-match key (parent keys first, own id last) — the
|
|
65
|
+
// same shape that generates <Name>LoadMatch, so the example
|
|
66
|
+
// type-checks.
|
|
67
|
+
const neIdF = entityIdField(nestedEntity)
|
|
68
|
+
const neMatchLines = opRequestShape(nestedEntity, 'load').items
|
|
69
|
+
.filter((it: any) => !it.optional || it.name === neIdF)
|
|
70
|
+
.sort((a: any, b: any) =>
|
|
71
|
+
(a.name === neIdF ? 1 : 0) - (b.name === neIdF ? 1 : 0))
|
|
72
|
+
.map((it: any) =>
|
|
73
|
+
` ${it.name}: ${exampleValue(nestedEntity, loadOp, it.name,
|
|
74
|
+
it.name === neIdF ? 'example_id' : 'example_' + it.name)},`)
|
|
48
75
|
|
|
49
76
|
Content(`
|
|
50
|
-
// Load a specific ${neName.toLowerCase()}
|
|
51
|
-
const ${
|
|
52
|
-
|
|
53
|
-
id: 'example_id',
|
|
77
|
+
// Load a specific ${neName.toLowerCase()} (returns a ${neName})
|
|
78
|
+
const ${neVar} = await client.${neName}().load({
|
|
79
|
+
${neMatchLines.join('\n')}
|
|
54
80
|
})
|
|
81
|
+
console.log(${neVar})
|
|
82
|
+
`)
|
|
83
|
+
hasCall = true
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Fallback: APIs with only `load` (no list, no nested) — most public
|
|
87
|
+
// read-only services. Still show one concrete call. `load()` with no
|
|
88
|
+
// match is always valid (the match arg is optional).
|
|
89
|
+
if (!hasCall && opnames.includes('load')) {
|
|
90
|
+
Content(`// Load ${eName.toLowerCase()} data (returns a ${eName})
|
|
91
|
+
const ${eVar} = await client.${eName}().load()
|
|
92
|
+
console.log(${eVar})
|
|
55
93
|
`)
|
|
94
|
+
hasCall = true
|
|
56
95
|
}
|
|
57
96
|
}
|
|
58
97
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, entityIdField, entityPrimaryOp, opRequestShape, safeVarName } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
nom,
|
|
8
8
|
} from '@voxgig/apidef'
|
|
9
9
|
|
|
10
|
+
import { exampleValue } from './utility_ts'
|
|
11
|
+
|
|
10
12
|
|
|
11
13
|
const ReadmeTopTest = cmp(function ReadmeTopTest(props: any) {
|
|
12
14
|
const { target, ctx$: { model } } = props
|
|
@@ -20,8 +22,38 @@ const client = ${model.const.Name}SDK.test()
|
|
|
20
22
|
|
|
21
23
|
if (exampleEntity) {
|
|
22
24
|
const eName = nom(exampleEntity, 'Name')
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
+
// Drive the test-mode example off the entity's PRIMARY op (never a
|
|
26
|
+
// hardcoded `load` a create-only entity lacks).
|
|
27
|
+
const primaryOp = entityPrimaryOp(exampleEntity) || 'load'
|
|
28
|
+
// A list() result is an array — name the variable accordingly.
|
|
29
|
+
const eVar = safeVarName(eName.toLowerCase(), 'ts') +
|
|
30
|
+
('list' === primaryOp ? 's' : '')
|
|
31
|
+
const primaryOpDef = exampleEntity.op && exampleEntity.op[primaryOp]
|
|
32
|
+
const idF = entityIdField(exampleEntity)
|
|
33
|
+
let arg = ''
|
|
34
|
+
if ('load' === primaryOp || 'remove' === primaryOp) {
|
|
35
|
+
// Every REQUIRED match key (id first) — the same shape that generates
|
|
36
|
+
// the op's Match type, so the block type-checks.
|
|
37
|
+
const items = opRequestShape(exampleEntity, primaryOp).items
|
|
38
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
39
|
+
.sort((a: any, b: any) =>
|
|
40
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
41
|
+
arg = 0 < items.length
|
|
42
|
+
? `{ ${items.map((it: any) =>
|
|
43
|
+
`${it.name}: ${exampleValue(exampleEntity, primaryOpDef, it.name,
|
|
44
|
+
it.name === idF ? 'test01' : 'example_' + it.name)}`).join(', ')} }`
|
|
45
|
+
: ''
|
|
46
|
+
} else if ('create' === primaryOp || 'update' === primaryOp) {
|
|
47
|
+
const items = opRequestShape(exampleEntity, primaryOp).items
|
|
48
|
+
.filter((it: any) => it.name !== idF && it.name !== 'id')
|
|
49
|
+
const required = items.filter((it: any) => !it.optional)
|
|
50
|
+
const chosen = required.length ? required : items.slice(0, 3)
|
|
51
|
+
arg = `{ ${chosen.map((it: any) =>
|
|
52
|
+
`${it.name}: ${exampleValue(exampleEntity, primaryOpDef, it.name, 'example_' + it.name)}`).join(', ')} }`
|
|
53
|
+
}
|
|
54
|
+
Content(`const ${eVar} = await client.${eName}().${primaryOp}(${arg})
|
|
55
|
+
// ${eVar} is ${'list' === primaryOp ? `an array of bare ${eName} records` : `a bare ${eName}`} populated with mock data
|
|
56
|
+
console.log(${eVar})
|
|
25
57
|
`)
|
|
26
58
|
}
|
|
27
59
|
|
|
@@ -398,7 +398,7 @@ const generateUpdate: OpGen = (ctx, step, index) => {
|
|
|
398
398
|
const fieldvalue = spec.def.mark
|
|
399
399
|
Content(`
|
|
400
400
|
const ${markdefvar} = { name: '${fieldname}', value: '${fieldvalue}_' + setup.now }
|
|
401
|
-
${datavar} [${markdefvar}.name] = ${markdefvar}.value
|
|
401
|
+
;(${datavar} as any)[${markdefvar}.name] = ${markdefvar}.value
|
|
402
402
|
`)
|
|
403
403
|
}
|
|
404
404
|
}
|
|
@@ -419,7 +419,7 @@ const generateUpdate: OpGen = (ctx, step, index) => {
|
|
|
419
419
|
const spec = step.spec[sI]
|
|
420
420
|
if ('TextFieldMark' === spec.apply && null != step.input.textfield) {
|
|
421
421
|
Content(`
|
|
422
|
-
assert(${resdatavar}[${markdefvar}.name] === ${markdefvar}.value)
|
|
422
|
+
assert((${resdatavar} as any)[${markdefvar}.name] === ${markdefvar}.value)
|
|
423
423
|
`)
|
|
424
424
|
}
|
|
425
425
|
}
|
|
@@ -15,6 +15,8 @@ import { cmp, each, Folder } from '@voxgig/sdkgen'
|
|
|
15
15
|
// import { TestMain } from './TestMain_ts'
|
|
16
16
|
import { TestDirect } from './TestDirect_ts'
|
|
17
17
|
import { TestEntity } from './TestEntity_ts'
|
|
18
|
+
import { ReadmeExampleTest } from './ReadmeExampleTest_ts'
|
|
19
|
+
import { ReadmeExamplesTest } from './ReadmeExamplesTest_ts'
|
|
18
20
|
|
|
19
21
|
|
|
20
22
|
const Test = cmp(function Test(props: any) {
|
|
@@ -25,6 +27,9 @@ const Test = cmp(function Test(props: any) {
|
|
|
25
27
|
// Quick({ target })
|
|
26
28
|
// TestMain({ target })
|
|
27
29
|
|
|
30
|
+
ReadmeExampleTest({ target })
|
|
31
|
+
ReadmeExamplesTest({ target })
|
|
32
|
+
|
|
28
33
|
Folder({ name: 'entity' }, () => {
|
|
29
34
|
each(model.main[KIT].entity, (entity: ModelEntity) => {
|
|
30
35
|
TestEntity({ target, entity })
|
|
@@ -14,9 +14,11 @@ import type {
|
|
|
14
14
|
Control,
|
|
15
15
|
} from '../types'
|
|
16
16
|
|
|
17
|
+
// #TypeImports
|
|
18
|
+
|
|
17
19
|
|
|
18
20
|
// TODO: needs Entity superclass
|
|
19
|
-
class EntityNameEntity extends ProjectNameEntityBase {
|
|
21
|
+
class EntityNameEntity extends ProjectNameEntityBase<EntityName> {
|
|
20
22
|
|
|
21
23
|
constructor(client: ProjectNameSDK, entopts: any) {
|
|
22
24
|
super(client, entopts)
|
|
@@ -15,7 +15,9 @@ import type {
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
// TODO: needs Entity superclass
|
|
18
|
-
|
|
18
|
+
// `D` is the entity's typed data model (e.g. Advice); subclasses bind it via
|
|
19
|
+
// `class AdviceEntity extends ProjectNameEntityBase<Advice>`.
|
|
20
|
+
class ProjectNameEntityBase<D = any> {
|
|
19
21
|
name = ''
|
|
20
22
|
name_ = ''
|
|
21
23
|
Name = ''
|
|
@@ -23,8 +25,11 @@ class ProjectNameEntityBase {
|
|
|
23
25
|
_client: ProjectNameSDK
|
|
24
26
|
_utility: Utility
|
|
25
27
|
_entopts: any
|
|
26
|
-
_data
|
|
27
|
-
|
|
28
|
+
// `_data`/`_match` hold accreted partial state (they start `{}` and fill in
|
|
29
|
+
// as ops resolve), so they are `Partial<D>` — the full `D` is only asserted
|
|
30
|
+
// at the `data()` return boundary.
|
|
31
|
+
_data: Partial<D>
|
|
32
|
+
_match: Partial<D>
|
|
28
33
|
_entctx: Context
|
|
29
34
|
|
|
30
35
|
|
|
@@ -58,7 +63,7 @@ class ProjectNameEntityBase {
|
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
|
|
61
|
-
data(this: any, data?:
|
|
66
|
+
data(this: any, data?: Partial<D>): D {
|
|
62
67
|
const struct = this._utility.struct
|
|
63
68
|
const featureHook = this._utility.featureHook
|
|
64
69
|
|
|
@@ -74,7 +79,7 @@ class ProjectNameEntityBase {
|
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
|
|
77
|
-
match(match?:
|
|
82
|
+
match(this: any, match?: Partial<D>): Partial<D> {
|
|
78
83
|
const struct = this._utility.struct
|
|
79
84
|
const featureHook = this._utility.featureHook
|
|
80
85
|
|
|
@@ -10,7 +10,7 @@ class EntityOperation {
|
|
|
10
10
|
|
|
11
11
|
// EJECT-START
|
|
12
12
|
|
|
13
|
-
async create(this: any, reqdata?:
|
|
13
|
+
async create(this: any, reqdata?: EntityNameCreateData, ctrl?: Control): Promise<EntityName> {
|
|
14
14
|
|
|
15
15
|
const utility = this._utility
|
|
16
16
|
const {
|
|
@@ -95,7 +95,9 @@ class EntityOperation {
|
|
|
95
95
|
throw err
|
|
96
96
|
}
|
|
97
97
|
else {
|
|
98
|
-
|
|
98
|
+
// Off-happy-path (throw disabled): typed as any so the method's
|
|
99
|
+
// Promise<EntityName> return stays clean under strict null checks.
|
|
100
|
+
return undefined as any
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
}
|
|
@@ -10,7 +10,7 @@ class EntityOperation {
|
|
|
10
10
|
|
|
11
11
|
// EJECT-START
|
|
12
12
|
|
|
13
|
-
async list(this: any, reqmatch?:
|
|
13
|
+
async list(this: any, reqmatch?: EntityNameListMatch, ctrl?: Control): Promise<EntityName[]> {
|
|
14
14
|
|
|
15
15
|
const utility = this._utility
|
|
16
16
|
|
|
@@ -96,7 +96,9 @@ class EntityOperation {
|
|
|
96
96
|
throw err
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
|
-
|
|
99
|
+
// Off-happy-path (throw disabled): typed as any so the method's
|
|
100
|
+
// Promise<EntityName[]> return stays clean under strict null checks.
|
|
101
|
+
return undefined as any
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
}
|
|
@@ -10,7 +10,7 @@ class EntityOperation {
|
|
|
10
10
|
|
|
11
11
|
// EJECT-START
|
|
12
12
|
|
|
13
|
-
async load(this: any, reqmatch?:
|
|
13
|
+
async load(this: any, reqmatch?: EntityNameLoadMatch, ctrl?: Control): Promise<EntityName> {
|
|
14
14
|
|
|
15
15
|
const utility = this._utility
|
|
16
16
|
|
|
@@ -100,7 +100,9 @@ class EntityOperation {
|
|
|
100
100
|
throw err
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
103
|
-
|
|
103
|
+
// Off-happy-path (throw disabled): typed as any so the method's
|
|
104
|
+
// Promise<EntityName> return stays clean under strict null checks.
|
|
105
|
+
return undefined as any
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
108
|
}
|
|
@@ -10,7 +10,7 @@ class EntityOperation {
|
|
|
10
10
|
|
|
11
11
|
// EJECT-START
|
|
12
12
|
|
|
13
|
-
async remove(this: any, reqmatch?:
|
|
13
|
+
async remove(this: any, reqmatch?: EntityNameRemoveMatch, ctrl?: Control): Promise<EntityName> {
|
|
14
14
|
|
|
15
15
|
const utility = this._utility
|
|
16
16
|
|
|
@@ -101,7 +101,9 @@ class EntityOperation {
|
|
|
101
101
|
throw err
|
|
102
102
|
}
|
|
103
103
|
else {
|
|
104
|
-
|
|
104
|
+
// Off-happy-path (throw disabled): typed as any so the method's
|
|
105
|
+
// Promise<EntityName> return stays clean under strict null checks.
|
|
106
|
+
return undefined as any
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
}
|
|
@@ -10,7 +10,7 @@ class EntityOperation {
|
|
|
10
10
|
|
|
11
11
|
// EJECT-START
|
|
12
12
|
|
|
13
|
-
async update(this: any, reqdata?:
|
|
13
|
+
async update(this: any, reqdata?: EntityNameUpdateData, ctrl?: Control): Promise<EntityName> {
|
|
14
14
|
|
|
15
15
|
const utility = this._utility
|
|
16
16
|
|
|
@@ -101,7 +101,9 @@ class EntityOperation {
|
|
|
101
101
|
throw err
|
|
102
102
|
}
|
|
103
103
|
else {
|
|
104
|
-
|
|
104
|
+
// Off-happy-path (throw disabled): typed as any so the method's
|
|
105
|
+
// Promise<EntityName> return stays clean under strict null checks.
|
|
106
|
+
return undefined as any
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
}
|
|
@@ -2,12 +2,70 @@
|
|
|
2
2
|
import * as Path from 'node:path'
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
import {
|
|
6
|
+
canonKey,
|
|
7
|
+
each,
|
|
8
|
+
} from '@voxgig/sdkgen'
|
|
9
|
+
|
|
5
10
|
import {
|
|
6
11
|
clone,
|
|
7
12
|
walk,
|
|
8
13
|
} from '@voxgig/struct'
|
|
9
14
|
|
|
10
15
|
|
|
16
|
+
// --- Model-driven example literals -----------------------------------------
|
|
17
|
+
// Doc snippets must use example values whose TYPE matches the generated
|
|
18
|
+
// TypeScript types, or the snippet does not compile. The id/match params of
|
|
19
|
+
// load/remove/update are the common trap: their generated
|
|
20
|
+
// `<Name><Op>Match` / `<Name><Op>Data` type is built from the op's params
|
|
21
|
+
// (see EntityTypes_ts.ts), so a `number` id shown as a quoted string is a
|
|
22
|
+
// TS2322 error. These helpers derive the example literal from the SAME model
|
|
23
|
+
// source, so the docs and the generated types can never disagree.
|
|
24
|
+
|
|
25
|
+
// The declared canon-type sentinel of a named parameter of an op — looked up
|
|
26
|
+
// in the op's `points[].args.params[]` exactly as the typed-model generator
|
|
27
|
+
// does. Falls back to the entity field of the same name (used when the op
|
|
28
|
+
// has no params and the generated match type is `Partial<Entity>`). Returns
|
|
29
|
+
// undefined when neither is present.
|
|
30
|
+
function paramCanonType(entity: any, op: any, paramName: string): unknown {
|
|
31
|
+
const points = op && op.points ? each(op.points) : []
|
|
32
|
+
for (const pt of points as any[]) {
|
|
33
|
+
const params = pt && pt.args && pt.args.params ? each(pt.args.params) : []
|
|
34
|
+
const found = (params as any[]).find((p: any) => p && p.name === paramName)
|
|
35
|
+
if (found) {
|
|
36
|
+
return found.type
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const field = (entity && entity.fields ? each(entity.fields) : [])
|
|
40
|
+
.find((f: any) => f && f.name === paramName) as any
|
|
41
|
+
return field && field.type
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
// A type-correct example literal for a named match/data parameter of an op,
|
|
46
|
+
// derived entirely from the model. INTEGER/NUMBER render as the bare number
|
|
47
|
+
// `1` (a quoted string on a `number` field is a compile error), BOOLEAN as
|
|
48
|
+
// `true`, ARRAY as the empty `[]` and OBJECT as the empty `{}` (a quoted
|
|
49
|
+
// string is not assignable to `any[]` / `Record<string, any>`), everything
|
|
50
|
+
// else (STRING, unknown, missing) as the quoted `placeholder`.
|
|
51
|
+
function exampleValue(entity: any, op: any, paramName: string, placeholder: string): string {
|
|
52
|
+
const key = canonKey(paramCanonType(entity, op, paramName))
|
|
53
|
+
if ('INTEGER' === key || 'NUMBER' === key) {
|
|
54
|
+
return '1'
|
|
55
|
+
}
|
|
56
|
+
if ('BOOLEAN' === key) {
|
|
57
|
+
return 'true'
|
|
58
|
+
}
|
|
59
|
+
if ('ARRAY' === key) {
|
|
60
|
+
return '[]'
|
|
61
|
+
}
|
|
62
|
+
if ('OBJECT' === key) {
|
|
63
|
+
return '{}'
|
|
64
|
+
}
|
|
65
|
+
return `'${placeholder}'`
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
11
69
|
function projectPath(suffix?: string): string {
|
|
12
70
|
return Path.normalize(Path.join(__dirname, '../../..', suffix ?? ''))
|
|
13
71
|
}
|
|
@@ -61,4 +119,5 @@ export {
|
|
|
61
119
|
formatJSONSrc,
|
|
62
120
|
formatJson,
|
|
63
121
|
projectPath,
|
|
122
|
+
exampleValue,
|
|
64
123
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.PHONY: test build clean
|
|
1
|
+
.PHONY: test build clean publish
|
|
2
2
|
|
|
3
3
|
test:
|
|
4
4
|
go test ./... -v
|
|
@@ -8,3 +8,38 @@ build:
|
|
|
8
8
|
|
|
9
9
|
clean:
|
|
10
10
|
go clean ./...
|
|
11
|
+
|
|
12
|
+
# --- Release: tag for the Go module proxy (pkg.go.dev) --------------------
|
|
13
|
+
# Go modules have no registry upload — publishing a version means pushing the
|
|
14
|
+
# tag go/vX.Y.Z (this module is the go/ subdir, and Go's submodule-tag
|
|
15
|
+
# convention is <subdir>/vX.Y.Z), which the module proxy + pkg.go.dev pick up on
|
|
16
|
+
# first fetch. Run headless under the aql key vault, which injects the GitHub
|
|
17
|
+
# token so nothing lands on disk or argv:
|
|
18
|
+
# aql vault exec --for=github=<alias> -- make publish
|
|
19
|
+
# aql `--dry-run` injects a filler token we detect to rehearse (no tag/push).
|
|
20
|
+
# set -e + tag-last: a failed push never leaves a tag behind.
|
|
21
|
+
#
|
|
22
|
+
# NOTE: publishing the git tag is deliberately NOT gated on `go test` (every
|
|
23
|
+
# other target's deploy just pushes its tag; a generated-test quirk must not
|
|
24
|
+
# block the module tag). Run `make test` separately in CI to gate quality.
|
|
25
|
+
VERSION := $(shell cat VERSION)
|
|
26
|
+
TAG := go/v$(VERSION)
|
|
27
|
+
AQL_DRY_RUN_FILLER := AQL-DRY-RUN-FILLER-NOT-A-REAL-SECRET
|
|
28
|
+
publish:
|
|
29
|
+
@if git rev-parse -q --verify "refs/tags/$(TAG)" >/dev/null; then \
|
|
30
|
+
echo "tag $(TAG) already exists — bump VERSION first"; exit 1; fi
|
|
31
|
+
@set -e; \
|
|
32
|
+
token="$${GITHUB_TOKEN:-$$GH_TOKEN}"; \
|
|
33
|
+
if [ "$$token" = "$(AQL_DRY_RUN_FILLER)" ]; then \
|
|
34
|
+
echo "[dry-run] aql filler token detected: would tag $(TAG) for pkg.go.dev; nothing pushed."; \
|
|
35
|
+
exit 0; \
|
|
36
|
+
fi; \
|
|
37
|
+
git tag -a "$(TAG)" -m "go v$(VERSION)"; \
|
|
38
|
+
url=$$(git remote get-url origin | sed -E 's#^git@github.com:#https://github.com/#'); \
|
|
39
|
+
if [ -n "$$token" ] && printf '%s' "$$url" | grep -q '^https://github.com/'; then \
|
|
40
|
+
hdr="AUTHORIZATION: basic $$(printf 'x-access-token:%s' "$$token" | base64 | tr -d '\n')"; \
|
|
41
|
+
git -c http.extraheader="$$hdr" push "$$url" "$(TAG)"; \
|
|
42
|
+
else \
|
|
43
|
+
git push origin "$(TAG)"; \
|
|
44
|
+
fi; \
|
|
45
|
+
echo "Tagged $(TAG) for pkg.go.dev."
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.0.1
|