@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, 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,16 @@ import {
|
|
|
8
8
|
} from '@voxgig/apidef'
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
// A type-correct PHP literal for a field's canonical type.
|
|
12
|
+
function phpLit(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 || 'OBJECT' === k) return '[]'
|
|
17
|
+
return '"example"'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
11
21
|
const ReadmeTopTest = cmp(function ReadmeTopTest(props: any) {
|
|
12
22
|
const { target, ctx$: { model } } = props
|
|
13
23
|
|
|
@@ -15,20 +25,51 @@ const ReadmeTopTest = cmp(function ReadmeTopTest(props: any) {
|
|
|
15
25
|
|
|
16
26
|
const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
|
|
17
27
|
|
|
18
|
-
Content(`\`\`\`php
|
|
19
|
-
$client = ${model.const.Name}SDK::test(null, null);
|
|
20
|
-
`)
|
|
21
|
-
|
|
22
28
|
if (exampleEntity) {
|
|
23
29
|
const eName = nom(exampleEntity, 'Name')
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
)
|
|
30
|
+
const ename = eName.toLowerCase()
|
|
31
|
+
// Model-driven id key: null when the entity has no id-like field.
|
|
32
|
+
const idF = entityIdField(exampleEntity)
|
|
33
|
+
// Drive the test-mode example off the entity's PRIMARY op (never a hardcoded
|
|
34
|
+
// `load` a create-only entity lacks).
|
|
35
|
+
const primaryOp = entityPrimaryOp(exampleEntity) || 'load'
|
|
36
|
+
const isMatchOp = 'load' === primaryOp || 'remove' === primaryOp
|
|
37
|
+
const recBody = idF ? `["${idF}" => "test01"]` : '[]'
|
|
38
|
+
let callArg = ''
|
|
39
|
+
if (isMatchOp) {
|
|
40
|
+
// Every REQUIRED match key (id first, then parent path params like
|
|
41
|
+
// page_id) — the same shape the runtime resolves path params from.
|
|
42
|
+
const items = opRequestShape(exampleEntity, primaryOp).items
|
|
43
|
+
.filter((it: any) => !it.optional || it.name === idF)
|
|
44
|
+
.sort((a: any, b: any) =>
|
|
45
|
+
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
46
|
+
callArg = 0 < items.length
|
|
47
|
+
? `[${items.map((it: any) =>
|
|
48
|
+
`"${it.name}" => ${it.name === idF ? '"test01"' : phpLit(it.type)}`).join(', ')}]`
|
|
49
|
+
: ''
|
|
50
|
+
} else if ('create' === primaryOp || 'update' === primaryOp) {
|
|
51
|
+
const items = opRequestShape(exampleEntity, primaryOp).items
|
|
52
|
+
.filter((it: any) => it.name !== idF && it.name !== 'id')
|
|
53
|
+
const required = items.filter((it: any) => !it.optional)
|
|
54
|
+
const chosen = required.length ? required : items.slice(0, 3)
|
|
55
|
+
callArg = `[${chosen.map((it: any) => `"${it.name}" => ${phpLit(it.type)}`).join(', ')}]`
|
|
56
|
+
}
|
|
57
|
+
// A list result is an array — name the variable accordingly.
|
|
58
|
+
const eVar = ename + ('list' === primaryOp ? 's' : '')
|
|
59
|
+
Content(`\`\`\`php
|
|
60
|
+
// Seed fixture data so offline calls resolve without a live server.
|
|
61
|
+
$client = ${model.const.Name}SDK::test([
|
|
62
|
+
"entity" => ["${ename}" => ["test01" => ${recBody}]],
|
|
63
|
+
]);
|
|
64
|
+
$${eVar} = $client->${eName}()->${primaryOp}(${callArg});
|
|
65
|
+
\`\`\`
|
|
27
66
|
`)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
67
|
+
} else {
|
|
68
|
+
Content(`\`\`\`php
|
|
69
|
+
$client = ${model.const.Name}SDK::test();
|
|
70
|
+
\`\`\`
|
|
31
71
|
`)
|
|
72
|
+
}
|
|
32
73
|
|
|
33
74
|
})
|
|
34
75
|
|
|
@@ -190,7 +190,7 @@ ${listSkipBlock} $client = $setup["client"];
|
|
|
190
190
|
`)
|
|
191
191
|
}
|
|
192
192
|
Content(`
|
|
193
|
-
|
|
193
|
+
$result = $client->direct([
|
|
194
194
|
"path" => "${listPath}",
|
|
195
195
|
"method" => "GET",
|
|
196
196
|
"params" => $params,
|
|
@@ -198,7 +198,7 @@ ${listSkipBlock} $client = $setup["client"];
|
|
|
198
198
|
`)
|
|
199
199
|
} else {
|
|
200
200
|
Content(`
|
|
201
|
-
|
|
201
|
+
$result = $client->direct([
|
|
202
202
|
"path" => "${listPath}",
|
|
203
203
|
"method" => "GET",
|
|
204
204
|
"params" => [],
|
|
@@ -210,8 +210,8 @@ ${listSkipBlock} $client = $setup["client"];
|
|
|
210
210
|
// Live mode is lenient: synthetic IDs frequently 4xx and the
|
|
211
211
|
// list-response shape varies wildly across public APIs. Skip
|
|
212
212
|
// rather than fail when the call doesn't return a usable list.
|
|
213
|
-
if ($err
|
|
214
|
-
$this->markTestSkipped("list call failed (likely synthetic IDs against live API): " . (string)$err);
|
|
213
|
+
if (!empty($result["err"])) {
|
|
214
|
+
$this->markTestSkipped("list call failed (likely synthetic IDs against live API): " . (string)$result["err"]);
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
217
|
if (empty($result["ok"])) {
|
|
@@ -224,7 +224,7 @@ ${listSkipBlock} $client = $setup["client"];
|
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
226
|
} else {
|
|
227
|
-
$this->
|
|
227
|
+
$this->assertArrayNotHasKey("err", $result);
|
|
228
228
|
$this->assertTrue($result["ok"]);
|
|
229
229
|
$this->assertEquals(200, Helpers::to_int($result["status"]));
|
|
230
230
|
$this->assertIsArray($result["data"]);
|
|
@@ -300,7 +300,7 @@ ${loadLiveQueryLines}
|
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
Content(`
|
|
303
|
-
|
|
303
|
+
$result = $client->direct([
|
|
304
304
|
"path" => "${loadPath}",
|
|
305
305
|
"method" => "GET",
|
|
306
306
|
`)
|
|
@@ -317,8 +317,8 @@ ${loadLiveQueryLines}
|
|
|
317
317
|
// Live mode is lenient: synthetic IDs frequently 4xx. Skip
|
|
318
318
|
// rather than fail when the load endpoint isn't reachable
|
|
319
319
|
// with the IDs we can construct from setup.idmap.
|
|
320
|
-
if ($err
|
|
321
|
-
$this->markTestSkipped("load call failed (likely synthetic IDs against live API): " . (string)$err);
|
|
320
|
+
if (!empty($result["err"])) {
|
|
321
|
+
$this->markTestSkipped("load call failed (likely synthetic IDs against live API): " . (string)$result["err"]);
|
|
322
322
|
return;
|
|
323
323
|
}
|
|
324
324
|
if (empty($result["ok"])) {
|
|
@@ -331,7 +331,7 @@ ${loadLiveQueryLines}
|
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
333
333
|
} else {
|
|
334
|
-
$this->
|
|
334
|
+
$this->assertArrayNotHasKey("err", $result);
|
|
335
335
|
$this->assertTrue($result["ok"]);
|
|
336
336
|
$this->assertEquals(200, Helpers::to_int($result["status"]));
|
|
337
337
|
$this->assertNotNull($result["data"]);
|
|
@@ -278,8 +278,7 @@ const generateCreate: OpGen = (ctx, step, index) => {
|
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
Content(`
|
|
281
|
-
|
|
282
|
-
$this->assertNull($err);
|
|
281
|
+
$${datavar}_result = $${entvar}->create($${datavar}, null);
|
|
283
282
|
$${datavar} = Helpers::to_map($${datavar}_result);
|
|
284
283
|
$this->assertNotNull($${datavar});
|
|
285
284
|
`)
|
|
@@ -324,8 +323,7 @@ const generateList: OpGen = (ctx, step, index) => {
|
|
|
324
323
|
}
|
|
325
324
|
|
|
326
325
|
Content(`
|
|
327
|
-
|
|
328
|
-
$this->assertNull($err);
|
|
326
|
+
$${listvar}_result = $${entvar}->list($${matchvar}, null);
|
|
329
327
|
$this->assertIsArray($${listvar}_result);
|
|
330
328
|
`)
|
|
331
329
|
|
|
@@ -413,8 +411,7 @@ const generateUpdate: OpGen = (ctx, step, index) => {
|
|
|
413
411
|
}
|
|
414
412
|
|
|
415
413
|
Content(`
|
|
416
|
-
|
|
417
|
-
$this->assertNull($err);
|
|
414
|
+
$${resdatavar}_result = $${entvar}->update($${datavar}_up, null);
|
|
418
415
|
$${resdatavar} = Helpers::to_map($${resdatavar}_result);
|
|
419
416
|
$this->assertNotNull($${resdatavar});
|
|
420
417
|
`)
|
|
@@ -479,8 +476,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
479
476
|
Content(` $${matchvar} = [
|
|
480
477
|
"id" => $${srcdatavar}["id"],
|
|
481
478
|
];
|
|
482
|
-
|
|
483
|
-
$this->assertNull($err);
|
|
479
|
+
$${datavar}_loaded = $${entvar}->load($${matchvar}, null);
|
|
484
480
|
$${datavar}_load_result = Helpers::to_map($${datavar}_loaded);
|
|
485
481
|
$this->assertNotNull($${datavar}_load_result);
|
|
486
482
|
$this->assertEquals($${datavar}_load_result["id"], $${srcdatavar}["id"]);
|
|
@@ -488,8 +484,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
488
484
|
}
|
|
489
485
|
else {
|
|
490
486
|
Content(` $${matchvar} = [];
|
|
491
|
-
|
|
492
|
-
$this->assertNull($err);
|
|
487
|
+
$${datavar}_loaded = $${entvar}->load($${matchvar}, null);
|
|
493
488
|
$this->assertNotNull($${datavar}_loaded);
|
|
494
489
|
`)
|
|
495
490
|
}
|
|
@@ -517,8 +512,7 @@ const generateRemove: OpGen = (ctx, step, index) => {
|
|
|
517
512
|
Content(` $${matchvar} = [
|
|
518
513
|
"id" => $${srcdatavar}["id"],
|
|
519
514
|
];
|
|
520
|
-
|
|
521
|
-
$this->assertNull($err);
|
|
515
|
+
$${entvar}->remove($${matchvar}, null);
|
|
522
516
|
`)
|
|
523
517
|
}
|
|
524
518
|
|
|
@@ -13,6 +13,7 @@ import { cmp, each, Folder, File, Content } from '@voxgig/sdkgen'
|
|
|
13
13
|
|
|
14
14
|
import { TestEntity } from './TestEntity_php'
|
|
15
15
|
import { TestDirect } from './TestDirect_php'
|
|
16
|
+
import { ReadmeExamplesTest } from './ReadmeExamplesTest_php'
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
const Test = cmp(function Test(props: any) {
|
|
@@ -47,6 +48,9 @@ class ExistsTest extends TestCase
|
|
|
47
48
|
TestEntity({ target, entity })
|
|
48
49
|
TestDirect({ target, entity })
|
|
49
50
|
})
|
|
51
|
+
|
|
52
|
+
// README example snippet test (syntax + offline test-mode run).
|
|
53
|
+
ReadmeExamplesTest({ target })
|
|
50
54
|
})
|
|
51
55
|
})
|
|
52
56
|
|
|
@@ -55,6 +55,9 @@ class EntityNameEntity
|
|
|
55
55
|
return new EntityNameEntity($this->_client, $opts);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* @param EntityName|array $args EntityName data (assoc-array) to store.
|
|
60
|
+
*/
|
|
58
61
|
public function data_set($args): void
|
|
59
62
|
{
|
|
60
63
|
if ($args) {
|
|
@@ -63,12 +66,18 @@ class EntityNameEntity
|
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
68
|
|
|
69
|
+
/**
|
|
70
|
+
* @return EntityName|array The current EntityName data as an assoc-array.
|
|
71
|
+
*/
|
|
66
72
|
public function data_get()
|
|
67
73
|
{
|
|
68
74
|
($this->_utility->feature_hook)($this->_entctx, "GetData");
|
|
69
75
|
return Struct::clone($this->_data);
|
|
70
76
|
}
|
|
71
77
|
|
|
78
|
+
/**
|
|
79
|
+
* @param array $args Match filter (any subset of EntityName fields).
|
|
80
|
+
*/
|
|
72
81
|
public function match_set($args): void
|
|
73
82
|
{
|
|
74
83
|
if ($args) {
|
|
@@ -77,6 +86,9 @@ class EntityNameEntity
|
|
|
77
86
|
}
|
|
78
87
|
}
|
|
79
88
|
|
|
89
|
+
/**
|
|
90
|
+
* @return array The current match filter (any subset of EntityName fields).
|
|
91
|
+
*/
|
|
80
92
|
public function match_get()
|
|
81
93
|
{
|
|
82
94
|
($this->_utility->feature_hook)($this->_entctx, "GetMatch");
|
|
@@ -93,7 +105,7 @@ class EntityNameEntity
|
|
|
93
105
|
|
|
94
106
|
// #RemoveOp
|
|
95
107
|
|
|
96
|
-
private function _run_op($ctx, callable $post_done):
|
|
108
|
+
private function _run_op($ctx, callable $post_done): mixed
|
|
97
109
|
{
|
|
98
110
|
$utility = $this->_utility;
|
|
99
111
|
|
|
@@ -3,7 +3,16 @@ require_once __DIR__ . '/../core/Helpers.php';
|
|
|
3
3
|
|
|
4
4
|
// EJECT-START
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Create a new EntityName.
|
|
8
|
+
*
|
|
9
|
+
* @param EntityNameCreateData|array|null $reqdata Body data as an assoc-array;
|
|
10
|
+
* a typed EntityNameCreateData names the shape.
|
|
11
|
+
* @param mixed $ctrl Optional per-call control overrides.
|
|
12
|
+
* @return EntityName|array The created EntityName as an assoc-array at the
|
|
13
|
+
* SDK boundary; throws ProjectNameError on failure (item-5 convention).
|
|
14
|
+
*/
|
|
15
|
+
public function create(?array $reqdata = null, $ctrl = null): mixed
|
|
7
16
|
{
|
|
8
17
|
$utility = $this->_utility;
|
|
9
18
|
$ctx = ($utility->make_context)([
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
// EJECT-START
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* List EntityName items matching the given filter.
|
|
5
|
+
*
|
|
6
|
+
* @param EntityNameListMatch|array|null $reqmatch Match filter (any subset
|
|
7
|
+
* of EntityName fields) as an assoc-array; EntityNameListMatch names the shape.
|
|
8
|
+
* @param mixed $ctrl Optional per-call control overrides.
|
|
9
|
+
* @return EntityName[]|array A list of EntityName items as assoc-arrays at
|
|
10
|
+
* the SDK boundary; throws ProjectNameError on failure (item-5 convention).
|
|
11
|
+
*/
|
|
12
|
+
public function list(?array $reqmatch = null, $ctrl = null): mixed
|
|
4
13
|
{
|
|
5
14
|
$utility = $this->_utility;
|
|
6
15
|
$ctx = ($utility->make_context)([
|
|
@@ -3,7 +3,16 @@ require_once __DIR__ . '/../core/Helpers.php';
|
|
|
3
3
|
|
|
4
4
|
// EJECT-START
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Load a single EntityName.
|
|
8
|
+
*
|
|
9
|
+
* @param EntityNameLoadMatch|array|null $reqmatch Match criteria (id/query
|
|
10
|
+
* fields) as an assoc-array; a typed EntityNameLoadMatch names the shape.
|
|
11
|
+
* @param mixed $ctrl Optional per-call control overrides.
|
|
12
|
+
* @return EntityName|array The loaded EntityName as an assoc-array at the
|
|
13
|
+
* SDK boundary; throws ProjectNameError on failure (item-5 convention).
|
|
14
|
+
*/
|
|
15
|
+
public function load(?array $reqmatch = null, $ctrl = null): mixed
|
|
7
16
|
{
|
|
8
17
|
$utility = $this->_utility;
|
|
9
18
|
$ctx = ($utility->make_context)([
|
|
@@ -3,7 +3,16 @@ require_once __DIR__ . '/../core/Helpers.php';
|
|
|
3
3
|
|
|
4
4
|
// EJECT-START
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Remove an EntityName matching the given criteria.
|
|
8
|
+
*
|
|
9
|
+
* @param EntityNameRemoveMatch|array|null $reqmatch Match criteria (id/query
|
|
10
|
+
* fields) as an assoc-array; EntityNameRemoveMatch names the shape.
|
|
11
|
+
* @param mixed $ctrl Optional per-call control overrides.
|
|
12
|
+
* @return EntityName|array The removed EntityName as an assoc-array at the
|
|
13
|
+
* SDK boundary; throws ProjectNameError on failure (item-5 convention).
|
|
14
|
+
*/
|
|
15
|
+
public function remove(?array $reqmatch = null, $ctrl = null): mixed
|
|
7
16
|
{
|
|
8
17
|
$utility = $this->_utility;
|
|
9
18
|
$ctx = ($utility->make_context)([
|
|
@@ -3,7 +3,16 @@ require_once __DIR__ . '/../core/Helpers.php';
|
|
|
3
3
|
|
|
4
4
|
// EJECT-START
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Update an existing EntityName.
|
|
8
|
+
*
|
|
9
|
+
* @param EntityNameUpdateData|array|null $reqdata Body data as an assoc-array;
|
|
10
|
+
* a typed EntityNameUpdateData names the shape.
|
|
11
|
+
* @param mixed $ctrl Optional per-call control overrides.
|
|
12
|
+
* @return EntityName|array The updated EntityName as an assoc-array at the
|
|
13
|
+
* SDK boundary; throws ProjectNameError on failure (item-5 convention).
|
|
14
|
+
*/
|
|
15
|
+
public function update(?array $reqdata = null, $ctrl = null): mixed
|
|
7
16
|
{
|
|
8
17
|
$utility = $this->_utility;
|
|
9
18
|
$ctx = ($utility->make_context)([
|
|
@@ -103,7 +103,7 @@ class ProjectNameSDK
|
|
|
103
103
|
return $this->_rootctx;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
public function prepare(array $fetchargs = []):
|
|
106
|
+
public function prepare(array $fetchargs = []): mixed
|
|
107
107
|
{
|
|
108
108
|
$utility = $this->_utility;
|
|
109
109
|
$fetchargs = $fetchargs ?? [];
|
|
@@ -149,19 +149,27 @@ class ProjectNameSDK
|
|
|
149
149
|
|
|
150
150
|
[$_, $err] = ($utility->prepare_auth)($ctx);
|
|
151
151
|
if ($err) {
|
|
152
|
-
return
|
|
152
|
+
return ($utility->make_error)($ctx, $err);
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
[$fetchdef, $fd_err] = ($utility->make_fetch_def)($ctx);
|
|
156
|
+
if ($fd_err) {
|
|
157
|
+
return ($utility->make_error)($ctx, $fd_err);
|
|
158
|
+
}
|
|
159
|
+
return $fetchdef;
|
|
156
160
|
}
|
|
157
161
|
|
|
158
|
-
public function direct(array $fetchargs = []):
|
|
162
|
+
public function direct(array $fetchargs = []): mixed
|
|
159
163
|
{
|
|
160
164
|
$utility = $this->_utility;
|
|
161
165
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
166
|
+
// direct() is the raw-HTTP escape hatch: it never throws, it returns
|
|
167
|
+
// an {ok, err, ...} dict. prepare() now raises on error, so catch it
|
|
168
|
+
// and surface the failure through the dict instead.
|
|
169
|
+
try {
|
|
170
|
+
$fetchdef = $this->prepare($fetchargs);
|
|
171
|
+
} catch (\Throwable $err) {
|
|
172
|
+
return ["ok" => false, "err" => $err];
|
|
165
173
|
}
|
|
166
174
|
|
|
167
175
|
$fetchargs = $fetchargs ?? [];
|
|
@@ -176,14 +184,14 @@ class ProjectNameSDK
|
|
|
176
184
|
[$fetched, $fetch_err] = ($utility->fetcher)($ctx, $url, $fetchdef);
|
|
177
185
|
|
|
178
186
|
if ($fetch_err) {
|
|
179
|
-
return [
|
|
187
|
+
return ["ok" => false, "err" => $fetch_err];
|
|
180
188
|
}
|
|
181
189
|
|
|
182
190
|
if ($fetched === null) {
|
|
183
|
-
return [
|
|
191
|
+
return [
|
|
184
192
|
"ok" => false,
|
|
185
193
|
"err" => $ctx->make_error("direct_no_response", "response: undefined"),
|
|
186
|
-
]
|
|
194
|
+
];
|
|
187
195
|
}
|
|
188
196
|
|
|
189
197
|
if (is_array($fetched)) {
|
|
@@ -208,18 +216,18 @@ class ProjectNameSDK
|
|
|
208
216
|
}
|
|
209
217
|
}
|
|
210
218
|
|
|
211
|
-
return [
|
|
219
|
+
return [
|
|
212
220
|
"ok" => $status >= 200 && $status < 300,
|
|
213
221
|
"status" => $status,
|
|
214
222
|
"headers" => Struct::getprop($fetched, "headers"),
|
|
215
223
|
"data" => $json_data,
|
|
216
|
-
]
|
|
224
|
+
];
|
|
217
225
|
}
|
|
218
226
|
|
|
219
|
-
return [
|
|
227
|
+
return [
|
|
220
228
|
"ok" => false,
|
|
221
229
|
"err" => $ctx->make_error("direct_invalid", "invalid response type"),
|
|
222
|
-
]
|
|
230
|
+
];
|
|
223
231
|
}
|
|
224
232
|
|
|
225
233
|
// <[SLOT]>
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
cmp,
|
|
11
11
|
each,
|
|
12
12
|
isAuthActive,
|
|
13
|
+
resolveAuthPrefix,
|
|
13
14
|
} from '@voxgig/sdkgen'
|
|
14
15
|
|
|
15
16
|
|
|
@@ -39,8 +40,8 @@ const Config = cmp(async function Config(props: any) {
|
|
|
39
40
|
const headers = getModelPath(model, `main.${KIT}.config.headers`) || {}
|
|
40
41
|
|
|
41
42
|
const authActive = isAuthActive(model)
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
// config.auth.prefix override -> spec-derived info.security.prefix -> 'Bearer'
|
|
44
|
+
const authPrefix = resolveAuthPrefix(model)
|
|
44
45
|
|
|
45
46
|
let baseUrl = ''
|
|
46
47
|
try { baseUrl = getModelPath(model, `main.${KIT}.info.servers.0.url`) } catch (_e) { }
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
// Typed-model generator (Python target). Port of EntityTypes_ts.ts.
|
|
4
|
+
//
|
|
5
|
+
// Reads main.<KIT>.entity.<e>.fields[] and per-op params
|
|
6
|
+
// (op.<name>.points[].args.params[]) and emits one module, <sdk>_types.py,
|
|
7
|
+
// with a `class <Name>(TypedDict):` per active entity plus a request/match type
|
|
8
|
+
// per active op. Field/param sentinels ($STRING, $INTEGER, ...) are turned into
|
|
9
|
+
// real Python types by the shared sdkgen helper `canonToType` (source of truth:
|
|
10
|
+
// @voxgig/apidef VALID_CANON).
|
|
11
|
+
//
|
|
12
|
+
// TYPE CHOICE: `TypedDict`, not `@dataclass`. The generated ops return/accept
|
|
13
|
+
// plain runtime dicts (data_get/match_get return `vs.clone(self._data)`; ops
|
|
14
|
+
// take/return dicts), so a `@dataclass` annotation is only aspirational — a
|
|
15
|
+
// strict checker at a call site would see dict-vs-dataclass. A TypedDict *is* a
|
|
16
|
+
// dict shape, so annotating these dict-returning/-accepting ops with TypedDict
|
|
17
|
+
// makes the TYPES MATCH the runtime. Runtime behaviour is unchanged.
|
|
18
|
+
//
|
|
19
|
+
// OPTIONAL FIELDS: a `req:false` field/param is a key that MAY be absent, which
|
|
20
|
+
// is exactly TypedDict `total=False` (key optionality), not `Optional[T]` (a
|
|
21
|
+
// None value). To express required AND optional keys on py>=3.8 WITHOUT a
|
|
22
|
+
// typing_extensions dependency (no `NotRequired`), a type with both splits into
|
|
23
|
+
// a required base `class <Name>Required(TypedDict): ...` and a `total=False`
|
|
24
|
+
// subclass `class <Name>(<Name>Required, total=False): ...` that carries the
|
|
25
|
+
// public name and adds the optional keys. Degenerate shapes collapse to a
|
|
26
|
+
// single class (all-required, all-optional, or empty). The all-optional
|
|
27
|
+
// collapse also serves the match-mirror types (the Python analogue of TS
|
|
28
|
+
// `Partial<${Name}>`).
|
|
29
|
+
//
|
|
30
|
+
// Keep the SAME type-name scheme as every other language: <Name>,
|
|
31
|
+
// <Name>LoadMatch, <Name>ListMatch, <Name>CreateData, <Name>UpdateData,
|
|
32
|
+
// <Name>RemoveMatch.
|
|
33
|
+
|
|
34
|
+
import {
|
|
35
|
+
cmp, each,
|
|
36
|
+
File, Content,
|
|
37
|
+
} from '@voxgig/sdkgen'
|
|
38
|
+
|
|
39
|
+
import { canonToType, opTypeName, opRequestShape } from '@voxgig/sdkgen'
|
|
40
|
+
|
|
41
|
+
import {
|
|
42
|
+
KIT,
|
|
43
|
+
getModelPath,
|
|
44
|
+
} from '@voxgig/apidef'
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
const LANG = 'py'
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
// Python keywords that cannot be used as class-syntax TypedDict field names.
|
|
51
|
+
const PY_KEYWORDS = new Set([
|
|
52
|
+
'False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break',
|
|
53
|
+
'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally',
|
|
54
|
+
'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal',
|
|
55
|
+
'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield',
|
|
56
|
+
])
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
// A name usable as a class-syntax TypedDict key (valid identifier, not a
|
|
60
|
+
// keyword). Non-identifier/keyword field names have no safe class-syntax
|
|
61
|
+
// rendering, so they are skipped (they remain reachable via the runtime dict).
|
|
62
|
+
function pyIdent(name: string): boolean {
|
|
63
|
+
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(name) && !PY_KEYWORDS.has(name)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
// Emit a TypedDict named `typeName` from a list of {name, type, optional}
|
|
68
|
+
// items (optionality already decided by the caller — the shared partiality
|
|
69
|
+
// policy for op types, or `req` for the entity data type). Required items
|
|
70
|
+
// become required keys; optional items become not-required keys via a
|
|
71
|
+
// `total=False` extension.
|
|
72
|
+
//
|
|
73
|
+
// Shape selection (see file header for the rationale):
|
|
74
|
+
// both required + optional -> `<typeName>Required` base + `total=False` sub
|
|
75
|
+
// only required -> single `class <typeName>(TypedDict):`
|
|
76
|
+
// only optional -> single `class <typeName>(TypedDict, total=False):`
|
|
77
|
+
// no usable keys -> single `class <typeName>(TypedDict): pass`
|
|
78
|
+
function emitTypedDict(typeName: string, items: any[]): void {
|
|
79
|
+
const usable = items.filter((it: any) => it && null != it.name && pyIdent(it.name))
|
|
80
|
+
|
|
81
|
+
const required = usable.filter((it: any) => !it.optional)
|
|
82
|
+
const optional = usable.filter((it: any) => it.optional)
|
|
83
|
+
|
|
84
|
+
const field = (it: any) => ` ${it.name}: ${canonToType(it.type, LANG)}
|
|
85
|
+
`
|
|
86
|
+
|
|
87
|
+
if (0 === usable.length) {
|
|
88
|
+
Content(`class ${typeName}(TypedDict):
|
|
89
|
+
pass
|
|
90
|
+
`)
|
|
91
|
+
return
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (0 === required.length) {
|
|
95
|
+
Content(`class ${typeName}(TypedDict, total=False):
|
|
96
|
+
`)
|
|
97
|
+
optional.forEach((it: any) => Content(field(it)))
|
|
98
|
+
return
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (0 === optional.length) {
|
|
102
|
+
Content(`class ${typeName}(TypedDict):
|
|
103
|
+
`)
|
|
104
|
+
required.forEach((it: any) => Content(field(it)))
|
|
105
|
+
return
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
Content(`class ${typeName}Required(TypedDict):
|
|
109
|
+
`)
|
|
110
|
+
required.forEach((it: any) => Content(field(it)))
|
|
111
|
+
Content(`
|
|
112
|
+
|
|
113
|
+
class ${typeName}(${typeName}Required, total=False):
|
|
114
|
+
`)
|
|
115
|
+
optional.forEach((it: any) => Content(field(it)))
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
const EntityTypes = cmp(function EntityTypes(props: any) {
|
|
120
|
+
const { model } = props.ctx$
|
|
121
|
+
const target = props.target || {}
|
|
122
|
+
const ext = target.ext || LANG
|
|
123
|
+
|
|
124
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
125
|
+
const entityList = each(entity).filter((e: any) => e.active !== false)
|
|
126
|
+
|
|
127
|
+
File({ name: model.const.Name.toLowerCase() + '_types.' + ext }, () => {
|
|
128
|
+
|
|
129
|
+
Content(`# Typed models for the ${model.const.Name} SDK.
|
|
130
|
+
#
|
|
131
|
+
# GENERATED from the API model: main.${KIT}.entity.<e>.fields[] and per-op
|
|
132
|
+
# params (op.<name>.points[].args.params[]). Field/param types come from the
|
|
133
|
+
# canonical type sentinels via @voxgig/sdkgen canonToType (source of truth:
|
|
134
|
+
# @voxgig/apidef VALID_CANON). Do not edit by hand.
|
|
135
|
+
#
|
|
136
|
+
# These are TypedDicts, not dataclasses: the SDK ops return/accept plain dicts
|
|
137
|
+
# at runtime, and a TypedDict IS a dict shape, so the types match the runtime.
|
|
138
|
+
# Optional (req:false) keys are modelled as TypedDict key-optionality
|
|
139
|
+
# (total=False), split into a required base + total=False subclass when a type
|
|
140
|
+
# has both required and optional keys.
|
|
141
|
+
|
|
142
|
+
from __future__ import annotations
|
|
143
|
+
|
|
144
|
+
from typing import TypedDict, Any
|
|
145
|
+
`)
|
|
146
|
+
|
|
147
|
+
entityList.forEach((ent: any) => {
|
|
148
|
+
const Name = ent.Name
|
|
149
|
+
const fields = (ent.fields ? each(ent.fields) : [])
|
|
150
|
+
.filter((f: any) => f.active !== false)
|
|
151
|
+
|
|
152
|
+
// Entity data model: one key per field, `req:false` -> optional key.
|
|
153
|
+
Content(`
|
|
154
|
+
|
|
155
|
+
`)
|
|
156
|
+
emitTypedDict(Name, fields.map((f: any) => ({
|
|
157
|
+
name: f.name, type: f.type, optional: false === f.req,
|
|
158
|
+
})))
|
|
159
|
+
|
|
160
|
+
// Per active op: a request/match type. Members and their optionality come
|
|
161
|
+
// from the shared partiality policy (opRequestShape); this file only
|
|
162
|
+
// renders them as a TypedDict.
|
|
163
|
+
const ops = ent.op || {}
|
|
164
|
+
;['load', 'list', 'create', 'update', 'remove'].forEach((opname: string) => {
|
|
165
|
+
if (null == ops[opname]) {
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const typeName = opTypeName(Name, opname)
|
|
170
|
+
const { items } = opRequestShape(ent, opname)
|
|
171
|
+
|
|
172
|
+
Content(`
|
|
173
|
+
|
|
174
|
+
`)
|
|
175
|
+
emitTypedDict(typeName, items)
|
|
176
|
+
})
|
|
177
|
+
})
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
export {
|
|
183
|
+
EntityTypes,
|
|
184
|
+
}
|