@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,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, File, isAuthActive } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, File, isAuthActive, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -7,31 +7,44 @@ import {
|
|
|
7
7
|
} from '@voxgig/apidef'
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
// A type-correct, JSON-serialisable Python literal — never an Ellipsis (`...`),
|
|
11
|
+
// which is not JSON-serialisable when a create body is executed by the doc
|
|
12
|
+
// test. Strings render the quoted placeholder.
|
|
13
|
+
function pyLit(type: any, placeholder: string = 'example'): string {
|
|
14
|
+
const k = canonKey(type)
|
|
15
|
+
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
16
|
+
if ('BOOLEAN' === k) return 'True'
|
|
17
|
+
if ('ARRAY' === k) return '[]'
|
|
18
|
+
if ('OBJECT' === k) return '{}'
|
|
19
|
+
return `"${placeholder}"`
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
10
23
|
const OP_SIGNATURES: Record<string, { sig: string, returns: string, desc: string }> = {
|
|
11
24
|
load: {
|
|
12
|
-
sig: 'load(reqmatch, ctrl=None) ->
|
|
13
|
-
returns: '
|
|
14
|
-
desc: 'Load a single entity matching the given criteria.',
|
|
25
|
+
sig: 'load(reqmatch, ctrl=None) -> dict',
|
|
26
|
+
returns: 'the entity data',
|
|
27
|
+
desc: 'Load a single entity matching the given criteria. Returns the entity data and raises on error.',
|
|
15
28
|
},
|
|
16
29
|
list: {
|
|
17
|
-
sig: 'list(reqmatch, ctrl=None) ->
|
|
18
|
-
returns: '
|
|
19
|
-
desc: 'List entities matching the given criteria. Returns
|
|
30
|
+
sig: 'list(reqmatch=None, ctrl=None) -> list',
|
|
31
|
+
returns: 'a list of entities',
|
|
32
|
+
desc: 'List entities matching the given criteria. The match is optional — call `list()` with no argument to list all records. Returns a list and raises on error.',
|
|
20
33
|
},
|
|
21
34
|
create: {
|
|
22
|
-
sig: 'create(reqdata, ctrl=None) ->
|
|
23
|
-
returns: '
|
|
24
|
-
desc: 'Create a new entity with the given data.',
|
|
35
|
+
sig: 'create(reqdata, ctrl=None) -> dict',
|
|
36
|
+
returns: 'the created entity data',
|
|
37
|
+
desc: 'Create a new entity with the given data. Returns the created entity data and raises on error.',
|
|
25
38
|
},
|
|
26
39
|
update: {
|
|
27
|
-
sig: 'update(reqdata, ctrl=None) ->
|
|
28
|
-
returns: '
|
|
29
|
-
desc: 'Update an existing entity. The data must include the entity `id`.',
|
|
40
|
+
sig: 'update(reqdata, ctrl=None) -> dict',
|
|
41
|
+
returns: 'the updated entity data',
|
|
42
|
+
desc: 'Update an existing entity. The data must include the entity `id`. Returns the updated entity data and raises on error.',
|
|
30
43
|
},
|
|
31
44
|
remove: {
|
|
32
|
-
sig: 'remove(reqmatch, ctrl=None) ->
|
|
33
|
-
returns: '
|
|
34
|
-
desc: 'Remove the entity matching the given criteria.',
|
|
45
|
+
sig: 'remove(reqmatch, ctrl=None) -> dict',
|
|
46
|
+
returns: 'the removed entity data',
|
|
47
|
+
desc: 'Remove the entity matching the given criteria. Raises on error.',
|
|
35
48
|
},
|
|
36
49
|
}
|
|
37
50
|
|
|
@@ -60,7 +73,7 @@ Complete API reference for the ${model.Name} ${target.title} SDK.
|
|
|
60
73
|
`)
|
|
61
74
|
|
|
62
75
|
Content(`\`\`\`python
|
|
63
|
-
from ${model.
|
|
76
|
+
from ${model.const.Name.toLowerCase()}_sdk import ${model.const.Name}SDK
|
|
64
77
|
|
|
65
78
|
client = ${model.const.Name}SDK(options)
|
|
66
79
|
\`\`\`
|
|
@@ -72,8 +85,7 @@ Create a new SDK client instance.
|
|
|
72
85
|
| Name | Type | Description |
|
|
73
86
|
| --- | --- | --- |
|
|
74
87
|
| \`options\` | \`dict\` | SDK configuration options. |
|
|
75
|
-
| \`options["apikey"]\` | \`str\` | API key for authentication. |
|
|
76
|
-
| \`options["base"]\` | \`str\` | Base URL for API requests. |
|
|
88
|
+
${isAuthActive(model) ? '| \`options["apikey"]\` | \`str\` | API key for authentication. |\n' : ''}| \`options["base"]\` | \`str\` | Base URL for API requests. |
|
|
77
89
|
| \`options["prefix"]\` | \`str\` | URL prefix appended after base. |
|
|
78
90
|
| \`options["suffix"]\` | \`str\` | URL suffix appended after path. |
|
|
79
91
|
| \`options["headers"]\` | \`dict\` | Custom headers for all requests. |
|
|
@@ -123,9 +135,9 @@ Return a deep copy of the current SDK options.
|
|
|
123
135
|
|
|
124
136
|
Return a copy of the SDK utility object.
|
|
125
137
|
|
|
126
|
-
#### \`direct(fetchargs=None) ->
|
|
138
|
+
#### \`direct(fetchargs=None) -> dict\`
|
|
127
139
|
|
|
128
|
-
Make a direct HTTP request to any API endpoint. Returns \`(
|
|
140
|
+
Make a direct HTTP request to any API endpoint. Returns a result \`dict\` with \`ok\`, \`status\`, \`headers\`, and \`data\` (or \`err\` on failure). This escape hatch never raises — branch on \`result["ok"]\`.
|
|
129
141
|
|
|
130
142
|
**Parameters:**
|
|
131
143
|
|
|
@@ -138,11 +150,11 @@ Make a direct HTTP request to any API endpoint. Returns \`(result, err)\`.
|
|
|
138
150
|
| \`fetchargs["headers"]\` | \`dict\` | Request headers (merged with defaults). |
|
|
139
151
|
| \`fetchargs["body"]\` | \`any\` | Request body (dicts are JSON-serialized). |
|
|
140
152
|
|
|
141
|
-
**Returns:** \`
|
|
153
|
+
**Returns:** \`result_dict\`
|
|
142
154
|
|
|
143
|
-
#### \`prepare(fetchargs=None) ->
|
|
155
|
+
#### \`prepare(fetchargs=None) -> dict\`
|
|
144
156
|
|
|
145
|
-
Prepare a fetch definition without sending. Returns \`
|
|
157
|
+
Prepare a fetch definition without sending. Returns the \`fetchdef\` and raises on error.
|
|
146
158
|
|
|
147
159
|
`)
|
|
148
160
|
|
|
@@ -151,6 +163,9 @@ Prepare a fetch definition without sending. Returns \`(fetchdef, err)\`.
|
|
|
151
163
|
publishedEntities.map((ent: any) => {
|
|
152
164
|
const opnames = Object.keys(ent.op || {})
|
|
153
165
|
const fields = ent.fields || []
|
|
166
|
+
// Model-driven id key: null when this entity has no id-like field, in
|
|
167
|
+
// which case load/remove match on no argument and update omits the id.
|
|
168
|
+
const idF = entityIdField(ent)
|
|
154
169
|
|
|
155
170
|
Content(`
|
|
156
171
|
---
|
|
@@ -182,7 +197,7 @@ ${ent.name} = client.${ent.Name}()
|
|
|
182
197
|
each(fields, (field: any) => {
|
|
183
198
|
const req = field.req ? 'Yes' : 'No'
|
|
184
199
|
const desc = field.short || ''
|
|
185
|
-
Content(`| \`${field.name}\` | \`${field.type
|
|
200
|
+
Content(`| \`${field.name}\` | \`${canonToType(field.type, target.name)}\` | ${req} | ${desc} |
|
|
186
201
|
`)
|
|
187
202
|
})
|
|
188
203
|
|
|
@@ -192,15 +207,18 @@ ${ent.name} = client.${ent.Name}()
|
|
|
192
207
|
// Field operations breakdown
|
|
193
208
|
const hasFieldOps = fields.some((f: any) => f.op && Object.keys(f.op).length > 0)
|
|
194
209
|
if (hasFieldOps) {
|
|
210
|
+
// Only emit columns for operations this entity actually exposes —
|
|
211
|
+
// never advertise a create/update/remove column the entity lacks.
|
|
212
|
+
const opcols = ['load', 'list', 'create', 'update', 'remove']
|
|
213
|
+
.filter((op: string) => opnames.includes(op) && ent.op[op]?.active !== false)
|
|
195
214
|
Content(`### Field Usage by Operation
|
|
196
215
|
|
|
197
|
-
| Field |
|
|
198
|
-
| --- |
|
|
216
|
+
| Field | ${opcols.join(' | ')} |
|
|
217
|
+
| --- | ${opcols.map(() => '---').join(' | ')} |
|
|
199
218
|
`)
|
|
200
219
|
each(fields, (field: any) => {
|
|
201
220
|
const fops = field.op || {}
|
|
202
|
-
const cols =
|
|
203
|
-
if (!opnames.includes(op)) return '-'
|
|
221
|
+
const cols = opcols.map((op: string) => {
|
|
204
222
|
const fop = fops[op]
|
|
205
223
|
if (null == fop) return '-'
|
|
206
224
|
if (fop.active === false) return '-'
|
|
@@ -232,30 +250,50 @@ ${info.desc}
|
|
|
232
250
|
|
|
233
251
|
`)
|
|
234
252
|
|
|
235
|
-
// Show example
|
|
253
|
+
// Show example. Entity ops return the bare result and raise on
|
|
254
|
+
// error; direct() is the only method that returns a result dict.
|
|
236
255
|
if ('load' === opname || 'remove' === opname) {
|
|
256
|
+
// The id key plus every REQUIRED match key (parent path params
|
|
257
|
+
// like page_id) — the same shape the runtime resolves path
|
|
258
|
+
// params from, so the example always works.
|
|
259
|
+
const matchItems = opRequestShape(ent, opname).items
|
|
260
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
261
|
+
.sort((a: any, b: any) =>
|
|
262
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
263
|
+
const arg = 0 < matchItems.length
|
|
264
|
+
? `{${matchItems.map((it: any) =>
|
|
265
|
+
`"${it.name}": ${pyLit(it.type,
|
|
266
|
+
it.name === idF ? ent.name + '_id' : it.name)}`).join(', ')}}`
|
|
267
|
+
: ''
|
|
237
268
|
Content(`\`\`\`python
|
|
238
|
-
result
|
|
269
|
+
result = client.${ent.Name}().${opname}(${arg})
|
|
239
270
|
\`\`\`
|
|
240
271
|
|
|
241
272
|
`)
|
|
242
273
|
}
|
|
243
274
|
else if ('list' === opname) {
|
|
244
275
|
Content(`\`\`\`python
|
|
245
|
-
results
|
|
276
|
+
results = client.${ent.Name}().list()
|
|
277
|
+
for ${ent.name} in results:
|
|
278
|
+
print(${ent.name})
|
|
246
279
|
\`\`\`
|
|
247
280
|
|
|
248
281
|
`)
|
|
249
282
|
}
|
|
250
283
|
else if ('create' === opname) {
|
|
284
|
+
// Members come from the SAME shape the runtime validates
|
|
285
|
+
// (opRequestShape): every required member must appear — including
|
|
286
|
+
// a required id and parent keys like page_id — with a real,
|
|
287
|
+
// executable literal (the doc test RUNS this block, so a comment
|
|
288
|
+
// placeholder would break it).
|
|
289
|
+
const createItems = opRequestShape(ent, 'create').items
|
|
290
|
+
.filter((it: any) => !it.optional)
|
|
251
291
|
Content(`\`\`\`python
|
|
252
|
-
result
|
|
292
|
+
result = client.${ent.Name}().create({
|
|
253
293
|
`)
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
Content(` "${field.name}": # ${field.type || 'value'},
|
|
294
|
+
createItems.map((it: any) => {
|
|
295
|
+
Content(` "${it.name}": ${pyLit(it.type, 'example_' + it.name)}, # ${canonToType(it.type, target.name)}
|
|
257
296
|
`)
|
|
258
|
-
}
|
|
259
297
|
})
|
|
260
298
|
Content(`})
|
|
261
299
|
\`\`\`
|
|
@@ -263,10 +301,18 @@ result, err = client.${ent.Name}().create({
|
|
|
263
301
|
`)
|
|
264
302
|
}
|
|
265
303
|
else if ('update' === opname) {
|
|
304
|
+
// The id key plus every REQUIRED data member — the same shape the
|
|
305
|
+
// runtime validates — then the patch-fields note.
|
|
306
|
+
const updateItems = opRequestShape(ent, 'update').items
|
|
307
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
308
|
+
.sort((a: any, b: any) =>
|
|
309
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
310
|
+
const updateLines = updateItems.map((it: any) =>
|
|
311
|
+
` "${it.name}": ${pyLit(it.type,
|
|
312
|
+
it.name === idF ? ent.name + '_id' : it.name)},\n`).join('')
|
|
266
313
|
Content(`\`\`\`python
|
|
267
|
-
result
|
|
268
|
-
|
|
269
|
-
# Fields to update
|
|
314
|
+
result = client.${ent.Name}().update({
|
|
315
|
+
${updateLines} # Fields to update
|
|
270
316
|
})
|
|
271
317
|
\`\`\`
|
|
272
318
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -8,6 +8,20 @@ import {
|
|
|
8
8
|
} from '@voxgig/apidef'
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
// A type-correct, executable Python literal for a param: numeric/boolean/
|
|
12
|
+
// array/object params render a typed literal; strings render the quoted
|
|
13
|
+
// placeholder (the doc test EXECUTES this block, so a comment placeholder
|
|
14
|
+
// would break it).
|
|
15
|
+
function pyLit(type: any, placeholder: string = 'example'): string {
|
|
16
|
+
const k = canonKey(type)
|
|
17
|
+
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
18
|
+
if ('BOOLEAN' === k) return 'True'
|
|
19
|
+
if ('ARRAY' === k) return '[]'
|
|
20
|
+
if ('OBJECT' === k) return '{}'
|
|
21
|
+
return `"${placeholder}"`
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
11
25
|
const ReadmeTopQuick = cmp(function ReadmeTopQuick(props: any) {
|
|
12
26
|
const { target, ctx$: { model } } = props
|
|
13
27
|
|
|
@@ -17,34 +31,54 @@ const ReadmeTopQuick = cmp(function ReadmeTopQuick(props: any) {
|
|
|
17
31
|
|
|
18
32
|
const authActive = isAuthActive(model)
|
|
19
33
|
const apikeyImport = authActive ? `import os\n` : ''
|
|
20
|
-
const
|
|
21
|
-
?
|
|
22
|
-
:
|
|
34
|
+
const ctor = authActive
|
|
35
|
+
? `${model.const.Name}SDK({\n "apikey": os.environ.get("${envName(model)}_APIKEY"),\n})`
|
|
36
|
+
: `${model.const.Name}SDK()`
|
|
23
37
|
|
|
24
38
|
Content(`\`\`\`python
|
|
25
39
|
${apikeyImport}from ${model.const.Name.toLowerCase()}_sdk import ${model.const.Name}SDK
|
|
26
40
|
|
|
27
|
-
client = ${
|
|
41
|
+
client = ${ctor}
|
|
28
42
|
|
|
29
43
|
`)
|
|
30
44
|
|
|
31
45
|
if (exampleEntity) {
|
|
32
46
|
const eName = nom(exampleEntity, 'Name')
|
|
33
47
|
const opnames = Object.keys(exampleEntity.op || {})
|
|
48
|
+
// Model-driven id key: null when the entity has no id-like field, in which
|
|
49
|
+
// case the load example takes no match argument.
|
|
50
|
+
const idF = entityIdField(exampleEntity)
|
|
51
|
+
|
|
52
|
+
let hasCall = false
|
|
34
53
|
|
|
35
54
|
if (opnames.includes('list')) {
|
|
36
|
-
Content(`# List all ${eName.toLowerCase()}s
|
|
37
|
-
${eName.toLowerCase()}s
|
|
55
|
+
Content(`# List all ${eName.toLowerCase()}s (returns a list, raises on error)
|
|
56
|
+
${eName.toLowerCase()}s = client.${eName}().list()
|
|
57
|
+
for ${eName.toLowerCase()} in ${eName.toLowerCase()}s:
|
|
58
|
+
print(${eName.toLowerCase()})
|
|
38
59
|
`)
|
|
60
|
+
hasCall = true
|
|
39
61
|
}
|
|
40
62
|
|
|
41
63
|
if (opnames.includes('load')) {
|
|
64
|
+
// Every REQUIRED load-match key (id first, then parent path params like
|
|
65
|
+
// page_id) — the same shape the runtime resolves path params from, so
|
|
66
|
+
// the example always works.
|
|
67
|
+
const loadItems = opRequestShape(exampleEntity, 'load').items
|
|
68
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
69
|
+
.sort((a: any, b: any) =>
|
|
70
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
71
|
+
const loadArg = 0 < loadItems.length
|
|
72
|
+
? `{${loadItems.map((it: any) =>
|
|
73
|
+
`"${it.name}": ${pyLit(it.type,
|
|
74
|
+
it.name === idF ? 'example_id' : 'example_' + it.name)}`).join(', ')}}`
|
|
75
|
+
: ''
|
|
42
76
|
Content(`
|
|
43
|
-
# Load a specific ${eName.toLowerCase()}
|
|
44
|
-
${eName.toLowerCase()}
|
|
45
|
-
|
|
46
|
-
)
|
|
77
|
+
# Load a specific ${eName.toLowerCase()} (returns the record, raises on error)
|
|
78
|
+
${eName.toLowerCase()} = client.${eName}().load(${loadArg})
|
|
79
|
+
print(${eName.toLowerCase()})
|
|
47
80
|
`)
|
|
81
|
+
hasCall = true
|
|
48
82
|
}
|
|
49
83
|
}
|
|
50
84
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, canonKey, entityIdField, entityPrimaryOp, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -8,6 +8,17 @@ import {
|
|
|
8
8
|
} from '@voxgig/apidef'
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
// A type-correct Python literal for a field's canonical type.
|
|
12
|
+
function pyLit(type: any): string {
|
|
13
|
+
const k = canonKey(type)
|
|
14
|
+
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
15
|
+
if ('BOOLEAN' === k) return 'True'
|
|
16
|
+
if ('ARRAY' === k) return '[]'
|
|
17
|
+
if ('OBJECT' === k) return '{}'
|
|
18
|
+
return '"example"'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
11
22
|
const ReadmeTopTest = cmp(function ReadmeTopTest(props: any) {
|
|
12
23
|
const { target, ctx$: { model } } = props
|
|
13
24
|
|
|
@@ -16,14 +27,41 @@ const ReadmeTopTest = cmp(function ReadmeTopTest(props: any) {
|
|
|
16
27
|
const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
|
|
17
28
|
|
|
18
29
|
Content(`\`\`\`python
|
|
19
|
-
client = ${model.const.Name}SDK.test(
|
|
30
|
+
client = ${model.const.Name}SDK.test()
|
|
20
31
|
`)
|
|
21
32
|
|
|
22
33
|
if (exampleEntity) {
|
|
23
34
|
const eName = nom(exampleEntity, 'Name')
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
)
|
|
35
|
+
// Drive the test-mode example off the entity's PRIMARY op (never a
|
|
36
|
+
// hardcoded `load` a create-only entity lacks).
|
|
37
|
+
const idF = entityIdField(exampleEntity)
|
|
38
|
+
const primaryOp = entityPrimaryOp(exampleEntity) || 'load'
|
|
39
|
+
const isMatchOp = 'load' === primaryOp || 'remove' === primaryOp
|
|
40
|
+
let arg = ''
|
|
41
|
+
if (isMatchOp) {
|
|
42
|
+
// Every REQUIRED match key (id first) — the same shape that generates
|
|
43
|
+
// the op's Match type, so the block also satisfies the mypy doc gate.
|
|
44
|
+
const items = opRequestShape(exampleEntity, primaryOp).items
|
|
45
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
46
|
+
.sort((a: any, b: any) =>
|
|
47
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
48
|
+
arg = 0 < items.length
|
|
49
|
+
? `{${items.map((it: any) =>
|
|
50
|
+
`"${it.name}": ${it.name === idF ? '"test01"' : pyLit(it.type)}`).join(', ')}}`
|
|
51
|
+
: ''
|
|
52
|
+
} else if ('create' === primaryOp || 'update' === primaryOp) {
|
|
53
|
+
const items = opRequestShape(exampleEntity, primaryOp).items
|
|
54
|
+
.filter((it: any) => it.name !== idF && it.name !== 'id')
|
|
55
|
+
const required = items.filter((it: any) => !it.optional)
|
|
56
|
+
const chosen = required.length ? required : items.slice(0, 3)
|
|
57
|
+
arg = `{${chosen.map((it: any) => `"${it.name}": ${pyLit(it.type)}`).join(', ')}}`
|
|
58
|
+
}
|
|
59
|
+
// A list() result is a list — name the variable accordingly (the root
|
|
60
|
+
// README doc gate concatenates blocks, so reusing the singular name for
|
|
61
|
+
// a different type is a mypy assignment error).
|
|
62
|
+
const eVar = eName.toLowerCase() + ('list' === primaryOp ? 's' : '')
|
|
63
|
+
Content(`${eVar} = client.${eName}().${primaryOp}(${arg})
|
|
64
|
+
print(${eVar})
|
|
27
65
|
`)
|
|
28
66
|
}
|
|
29
67
|
|
|
@@ -192,7 +192,7 @@ ${listSkipBlock} client = setup["client"]
|
|
|
192
192
|
`)
|
|
193
193
|
}
|
|
194
194
|
Content(`
|
|
195
|
-
result
|
|
195
|
+
result = client.direct({
|
|
196
196
|
"path": "${listPath}",
|
|
197
197
|
"method": "GET",
|
|
198
198
|
"params": params,
|
|
@@ -200,7 +200,7 @@ ${listSkipBlock} client = setup["client"]
|
|
|
200
200
|
`)
|
|
201
201
|
} else {
|
|
202
202
|
Content(`
|
|
203
|
-
result
|
|
203
|
+
result = client.direct({
|
|
204
204
|
"path": "${listPath}",
|
|
205
205
|
"method": "GET",
|
|
206
206
|
"params": {},
|
|
@@ -212,8 +212,8 @@ ${listSkipBlock} client = setup["client"]
|
|
|
212
212
|
# Live mode is lenient: synthetic IDs frequently 4xx and the
|
|
213
213
|
# list-response shape varies wildly across public APIs. Skip
|
|
214
214
|
# rather than fail when the call doesn't return a usable list.
|
|
215
|
-
if err is not None:
|
|
216
|
-
pytest.skip(f"list call failed (likely synthetic IDs against live API): {err}")
|
|
215
|
+
if result.get("err") is not None:
|
|
216
|
+
pytest.skip(f"list call failed (likely synthetic IDs against live API): {result.get('err')}")
|
|
217
217
|
return
|
|
218
218
|
if not result.get("ok"):
|
|
219
219
|
pytest.skip("list call not ok (likely synthetic IDs against live API)")
|
|
@@ -223,7 +223,6 @@ ${listSkipBlock} client = setup["client"]
|
|
|
223
223
|
pytest.skip(f"expected 2xx status, got {status}")
|
|
224
224
|
return
|
|
225
225
|
else:
|
|
226
|
-
assert err is None
|
|
227
226
|
assert result["ok"] is True
|
|
228
227
|
assert helpers.to_int(result["status"]) == 200
|
|
229
228
|
assert isinstance(result["data"], list)
|
|
@@ -291,7 +290,7 @@ ${loadLiveQueryLines}
|
|
|
291
290
|
}
|
|
292
291
|
|
|
293
292
|
Content(`
|
|
294
|
-
result
|
|
293
|
+
result = client.direct({
|
|
295
294
|
"path": "${loadPath}",
|
|
296
295
|
"method": "GET",
|
|
297
296
|
`)
|
|
@@ -308,8 +307,8 @@ ${loadLiveQueryLines}
|
|
|
308
307
|
# Live mode is lenient: synthetic IDs frequently 4xx. Skip
|
|
309
308
|
# rather than fail when the load endpoint isn't reachable
|
|
310
309
|
# with the IDs we can construct from setup.idmap.
|
|
311
|
-
if err is not None:
|
|
312
|
-
pytest.skip(f"load call failed (likely synthetic IDs against live API): {err}")
|
|
310
|
+
if result.get("err") is not None:
|
|
311
|
+
pytest.skip(f"load call failed (likely synthetic IDs against live API): {result.get('err')}")
|
|
313
312
|
return
|
|
314
313
|
if not result.get("ok"):
|
|
315
314
|
pytest.skip("load call not ok (likely synthetic IDs against live API)")
|
|
@@ -319,7 +318,6 @@ ${loadLiveQueryLines}
|
|
|
319
318
|
pytest.skip(f"expected 2xx status, got {status}")
|
|
320
319
|
return
|
|
321
320
|
else:
|
|
322
|
-
assert err is None
|
|
323
321
|
assert result["ok"] is True
|
|
324
322
|
assert helpers.to_int(result["status"]) == 200
|
|
325
323
|
assert result["data"] is not None
|
|
@@ -272,9 +272,7 @@ const generateCreate: OpGen = (ctx, step, index) => {
|
|
|
272
272
|
const hasEntIdC = null != ctx.entity.id
|
|
273
273
|
|
|
274
274
|
Content(`
|
|
275
|
-
${datavar}
|
|
276
|
-
assert err is None
|
|
277
|
-
${datavar} = helpers.to_map(${datavar}_result)
|
|
275
|
+
${datavar} = helpers.to_map(${entvar}.create(${datavar}, None))
|
|
278
276
|
assert ${datavar} is not None
|
|
279
277
|
`)
|
|
280
278
|
if (hasEntIdC) {
|
|
@@ -318,8 +316,7 @@ const generateList: OpGen = (ctx, step, index) => {
|
|
|
318
316
|
}
|
|
319
317
|
|
|
320
318
|
Content(`
|
|
321
|
-
${listvar}_result
|
|
322
|
-
assert err is None
|
|
319
|
+
${listvar}_result = ${entvar}.list(${matchvar}, None)
|
|
323
320
|
assert isinstance(${listvar}_result, list)
|
|
324
321
|
`)
|
|
325
322
|
|
|
@@ -407,9 +404,7 @@ const generateUpdate: OpGen = (ctx, step, index) => {
|
|
|
407
404
|
}
|
|
408
405
|
|
|
409
406
|
Content(`
|
|
410
|
-
${resdatavar}
|
|
411
|
-
assert err is None
|
|
412
|
-
${resdatavar} = helpers.to_map(${resdatavar}_result)
|
|
407
|
+
${resdatavar} = helpers.to_map(${entvar}.update(${datavar}_up, None))
|
|
413
408
|
assert ${resdatavar} is not None
|
|
414
409
|
`)
|
|
415
410
|
if (hasEntIdU) {
|
|
@@ -472,8 +467,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
472
467
|
Content(` ${matchvar} = {
|
|
473
468
|
"id": ${srcdatavar}["id"],
|
|
474
469
|
}
|
|
475
|
-
${datavar}_loaded
|
|
476
|
-
assert err is None
|
|
470
|
+
${datavar}_loaded = ${entvar}.load(${matchvar}, None)
|
|
477
471
|
${datavar}_load_result = helpers.to_map(${datavar}_loaded)
|
|
478
472
|
assert ${datavar}_load_result is not None
|
|
479
473
|
assert ${datavar}_load_result["id"] == ${srcdatavar}["id"]
|
|
@@ -481,8 +475,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
481
475
|
}
|
|
482
476
|
else {
|
|
483
477
|
Content(` ${matchvar} = {}
|
|
484
|
-
${datavar}_loaded
|
|
485
|
-
assert err is None
|
|
478
|
+
${datavar}_loaded = ${entvar}.load(${matchvar}, None)
|
|
486
479
|
assert ${datavar}_loaded is not None
|
|
487
480
|
`)
|
|
488
481
|
}
|
|
@@ -510,8 +503,7 @@ const generateRemove: OpGen = (ctx, step, index) => {
|
|
|
510
503
|
Content(` ${matchvar} = {
|
|
511
504
|
"id": ${srcdatavar}["id"],
|
|
512
505
|
}
|
|
513
|
-
|
|
514
|
-
assert err is None
|
|
506
|
+
${entvar}.remove(${matchvar}, None)
|
|
515
507
|
`)
|
|
516
508
|
}
|
|
517
509
|
|
|
@@ -13,6 +13,7 @@ import { cmp, each, Folder, File, Content } from '@voxgig/sdkgen'
|
|
|
13
13
|
|
|
14
14
|
import { TestEntity } from './TestEntity_py'
|
|
15
15
|
import { TestDirect } from './TestDirect_py'
|
|
16
|
+
import { ReadmeExamplesTest } from './ReadmeExamplesTest_py'
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
const Test = cmp(function Test(props: any) {
|
|
@@ -46,6 +47,9 @@ class TestExists:
|
|
|
46
47
|
TestEntity({ target, entity })
|
|
47
48
|
TestDirect({ target, entity })
|
|
48
49
|
})
|
|
50
|
+
|
|
51
|
+
// Validate the documented python examples in the root README.
|
|
52
|
+
ReadmeExamplesTest({ target })
|
|
49
53
|
})
|
|
50
54
|
})
|
|
51
55
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
# ProjectName SDK EntityName entity
|
|
2
2
|
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
3
5
|
from utility.voxgig_struct import voxgig_struct as vs
|
|
4
6
|
from core import helpers
|
|
7
|
+
# #TypeImports
|
|
5
8
|
|
|
6
9
|
|
|
7
10
|
class EntityNameEntity:
|
|
@@ -44,7 +47,7 @@ class EntityNameEntity:
|
|
|
44
47
|
self._data = helpers.to_map(vs.clone(args)) or {}
|
|
45
48
|
self._utility.feature_hook(self._entctx, "SetData")
|
|
46
49
|
|
|
47
|
-
def data_get(self):
|
|
50
|
+
def data_get(self) -> EntityName:
|
|
48
51
|
self._utility.feature_hook(self._entctx, "GetData")
|
|
49
52
|
return vs.clone(self._data)
|
|
50
53
|
|
|
@@ -53,7 +56,7 @@ class EntityNameEntity:
|
|
|
53
56
|
self._match = helpers.to_map(vs.clone(args)) or {}
|
|
54
57
|
self._utility.feature_hook(self._entctx, "SetMatch")
|
|
55
58
|
|
|
56
|
-
def match_get(self):
|
|
59
|
+
def match_get(self) -> EntityName:
|
|
57
60
|
self._utility.feature_hook(self._entctx, "GetMatch")
|
|
58
61
|
return vs.clone(self._match)
|
|
59
62
|
|
|
@@ -2,8 +2,12 @@ entity_list_op = None
|
|
|
2
2
|
|
|
3
3
|
# EJECT-START
|
|
4
4
|
|
|
5
|
-
def list(self, reqmatch, ctrl=None):
|
|
5
|
+
def list(self, reqmatch=None, ctrl=None) -> list[EntityName]:
|
|
6
6
|
utility = self._utility
|
|
7
|
+
# reqmatch is optional: an omitted match lists all records. Treat None
|
|
8
|
+
# as an empty match so client.EntityName().list() works with no args.
|
|
9
|
+
if reqmatch is None:
|
|
10
|
+
reqmatch = {}
|
|
7
11
|
ctx = utility.make_context({
|
|
8
12
|
"opname": "list",
|
|
9
13
|
"ctrl": ctrl,
|
|
@@ -5,8 +5,13 @@ entity_load_op = None
|
|
|
5
5
|
|
|
6
6
|
# EJECT-START
|
|
7
7
|
|
|
8
|
-
def load(self, reqmatch, ctrl=None):
|
|
8
|
+
def load(self, reqmatch=None, ctrl=None) -> EntityName:
|
|
9
9
|
utility = self._utility
|
|
10
|
+
# reqmatch is optional: an entity with no id-like key loads with no
|
|
11
|
+
# match. Treat None as an empty match so client.EntityName().load()
|
|
12
|
+
# works with no args.
|
|
13
|
+
if reqmatch is None:
|
|
14
|
+
reqmatch = {}
|
|
10
15
|
ctx = utility.make_context({
|
|
11
16
|
"opname": "load",
|
|
12
17
|
"ctrl": ctrl,
|
|
@@ -5,8 +5,13 @@ entity_remove_op = None
|
|
|
5
5
|
|
|
6
6
|
# EJECT-START
|
|
7
7
|
|
|
8
|
-
def remove(self, reqmatch, ctrl=None):
|
|
8
|
+
def remove(self, reqmatch=None, ctrl=None) -> EntityName:
|
|
9
9
|
utility = self._utility
|
|
10
|
+
# reqmatch is optional: an entity with no id-like key removes with no
|
|
11
|
+
# match. Treat None as an empty match so client.EntityName().remove()
|
|
12
|
+
# works with no args.
|
|
13
|
+
if reqmatch is None:
|
|
14
|
+
reqmatch = {}
|
|
10
15
|
ctx = utility.make_context({
|
|
11
16
|
"opname": "remove",
|
|
12
17
|
"ctrl": ctrl,
|