@voxgig/sdkgen 1.2.1 → 1.3.1
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 +2 -1
- package/dist/action/action.js +15 -9
- package/dist/action/action.js.map +1 -1
- package/dist/action/feature.js +6 -3
- package/dist/action/feature.js.map +1 -1
- package/dist/action/target.d.ts +7 -1
- package/dist/action/target.js +13 -6
- 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 +193 -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 +11 -1
- package/dist/sdkgen.js +57 -18
- 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.js +20 -11
- package/dist/utility.js.map +1 -1
- package/model/sdkgen.aontu +137 -0
- package/package.json +11 -5
- package/project/.sdk/model/target/go-cli.jsonic +47 -0
- package/project/.sdk/model/target/go-mcp.jsonic +41 -0
- package/project/.sdk/model/target/go.jsonic +9 -3
- package/project/.sdk/model/target/js.jsonic +13 -0
- package/project/.sdk/model/target/lua.jsonic +13 -0
- package/project/.sdk/model/target/php.jsonic +13 -0
- package/project/.sdk/model/target/py.jsonic +13 -0
- package/project/.sdk/model/target/rb.jsonic +13 -0
- package/project/.sdk/model/target/ts.jsonic +13 -0
- 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 +18 -6
- package/project/.sdk/src/cmp/go/ReadmeExamplesTest_go.ts +684 -0
- package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +1 -1
- package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +48 -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 +63 -17
- package/project/.sdk/src/cmp/go/ReadmeOptions_go.ts +4 -3
- package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +124 -115
- package/project/.sdk/src/cmp/go/ReadmeRef_go.ts +28 -15
- package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +33 -9
- 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-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/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 +13 -7
- 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 +45 -19
- package/project/.sdk/src/cmp/js/ReadmeRef_js.ts +24 -13
- package/project/.sdk/src/cmp/js/ReadmeTopHowto_js.ts +3 -0
- package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +28 -12
- package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +23 -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/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 +12 -10
- 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 +79 -18
- package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +25 -20
- package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +17 -9
- package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +32 -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/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 +15 -11
- 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 +80 -22
- package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +51 -42
- package/project/.sdk/src/cmp/php/ReadmeTopHowto_php.ts +1 -1
- package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +19 -11
- package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +41 -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/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 +27 -11
- 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 +73 -24
- package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +57 -37
- package/project/.sdk/src/cmp/py/ReadmeTopHowto_py.ts +1 -1
- package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +19 -11
- package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +30 -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/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 +26 -10
- 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 +85 -22
- package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +56 -37
- package/project/.sdk/src/cmp/rb/ReadmeTopHowto_rb.ts +1 -1
- package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +19 -11
- package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +43 -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/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 +13 -7
- 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 +95 -40
- package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +24 -13
- package/project/.sdk/src/cmp/ts/ReadmeTopHowto_ts.ts +3 -0
- package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +44 -12
- package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +23 -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/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 +33 -1
- 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 +17 -10
- package/src/action/feature.ts +8 -6
- package/src/action/target.ts +17 -8
- 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 +236 -0
- package/src/helpers/packageMeta.ts +236 -0
- package/src/sdkgen.ts +87 -20
- package/src/tsconfig.json +1 -0
- package/src/types.ts +85 -2
- package/src/utility.ts +22 -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/tm/go/utility/struct/go.mod +0 -3
|
@@ -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]>
|
|
@@ -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
|
+
}
|
|
@@ -9,6 +9,12 @@ import {
|
|
|
9
9
|
import { EntityOperation } from './EntityOperation_py'
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
// Op -> generated request-type suffix (keep in sync with EntityTypes_py.ts).
|
|
13
|
+
const OP_SUFFIX: Record<string, 'Match' | 'Data'> = {
|
|
14
|
+
load: 'Match', list: 'Match', remove: 'Match', create: 'Data', update: 'Data',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
12
18
|
const Entity = cmp(function Entity(props: any) {
|
|
13
19
|
const { model, stdrep } = props.ctx$
|
|
14
20
|
const { target, entity } = props
|
|
@@ -19,6 +25,22 @@ const Entity = cmp(function Entity(props: any) {
|
|
|
19
25
|
|
|
20
26
|
names(entrep, entity.Name, 'EntityName')
|
|
21
27
|
|
|
28
|
+
// Import exactly the typed models this entity references: its data type plus
|
|
29
|
+
// one request type per ACTIVE op (matches what EntityTypes_py.ts emits).
|
|
30
|
+
const typeNames = [entity.Name]
|
|
31
|
+
const opnamesAll = Object.keys(entity.op || {})
|
|
32
|
+
;['load', 'list', 'create', 'update', 'remove'].forEach((opname: string) => {
|
|
33
|
+
if (opnamesAll.includes(opname)) {
|
|
34
|
+
const suffix = OP_SUFFIX[opname] || 'Match'
|
|
35
|
+
const cap = opname.charAt(0).toUpperCase() + opname.slice(1)
|
|
36
|
+
typeNames.push(entity.Name + cap + suffix)
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
const typesModule = model.const.Name.toLowerCase() + '_types'
|
|
40
|
+
const typeImport =
|
|
41
|
+
'from ' + typesModule + ' import (\n ' +
|
|
42
|
+
typeNames.join(',\n ') + ',\n)'
|
|
43
|
+
|
|
22
44
|
const ff = Path.normalize(__dirname + '/../../../src/cmp/py/fragment/')
|
|
23
45
|
|
|
24
46
|
// Entity files go to entity/ folder
|
|
@@ -44,6 +66,11 @@ const Entity = cmp(function Entity(props: any) {
|
|
|
44
66
|
EntityName: entity.Name,
|
|
45
67
|
entityname: entity.name,
|
|
46
68
|
|
|
69
|
+
// Literal-marker slot (jostraca's `#Name` tag pattern is hardcoded to
|
|
70
|
+
// `//` comments, so Python uses a `# #`-prefixed literal like the op
|
|
71
|
+
// frag slots) — fills in the typed-model import for this entity.
|
|
72
|
+
'# #TypeImports': typeImport,
|
|
73
|
+
|
|
47
74
|
'#Entity-Hook': ({ name, indent }: any) =>
|
|
48
75
|
Content({ indent }, `utility.feature_hook(ctx, "${name}")`),
|
|
49
76
|
|
|
@@ -8,7 +8,8 @@ const MainEntity = cmp(async function MainEntity(props: any) {
|
|
|
8
8
|
const { model } = props.ctx$
|
|
9
9
|
|
|
10
10
|
Content(`
|
|
11
|
-
def ${entity.Name}(self, data=None):
|
|
11
|
+
def ${entity.Name}(self, data=None) -> "${entity.Name}Entity":
|
|
12
|
+
"""Entity factory: client.${entity.Name}().list() / client.${entity.Name}().load({"id": ...})."""
|
|
12
13
|
from entity.${entity.name}_entity import ${entity.Name}Entity
|
|
13
14
|
return ${entity.Name}Entity(self, data)
|
|
14
15
|
|
|
@@ -22,6 +22,7 @@ import { Package } from './Package_py'
|
|
|
22
22
|
import { Config } from './Config_py'
|
|
23
23
|
import { Gitignore } from './Gitignore_py'
|
|
24
24
|
import { MainEntity } from './MainEntity_py'
|
|
25
|
+
import { EntityTypes } from './EntityTypes_py'
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
const Main = cmp(async function Main(props: any) {
|
|
@@ -77,6 +78,35 @@ self._utility.feature_hook(self._rootctx, "${name}")
|
|
|
77
78
|
MainEntity(entprops)
|
|
78
79
|
})
|
|
79
80
|
})
|
|
81
|
+
|
|
82
|
+
// Type-checker-only imports for the entity factory return annotations
|
|
83
|
+
// (def <Entity>(...) -> "<Entity>Entity"). Guarded by TYPE_CHECKING so
|
|
84
|
+
// there is no eager runtime import (the factories still import lazily in
|
|
85
|
+
// their bodies); this lets mypy resolve list()/load() return types on
|
|
86
|
+
// client.<Entity>() results — e.g. flagging `.data` on a list() result.
|
|
87
|
+
const entnames = each(entity)
|
|
88
|
+
if (entnames.length > 0) {
|
|
89
|
+
Content(`
|
|
90
|
+
|
|
91
|
+
from typing import TYPE_CHECKING
|
|
92
|
+
|
|
93
|
+
if TYPE_CHECKING:
|
|
94
|
+
`)
|
|
95
|
+
each(entity, (ent: any) => {
|
|
96
|
+
Content(` from entity.${ent.name}_entity import ${ent.Name}Entity
|
|
97
|
+
`)
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
// Generate the typed-model module (<sdk>_types.py) next to the main SDK file.
|
|
103
|
+
EntityTypes({ target })
|
|
104
|
+
|
|
105
|
+
// PEP 561 marker so the inline type hints ship to consumers. Emitted at the
|
|
106
|
+
// language root (documents intent for the top-level modules) and inside the
|
|
107
|
+
// entity package (the type-bearing package, included via package-data).
|
|
108
|
+
File({ name: 'py.typed' }, () => {
|
|
109
|
+
Content(``)
|
|
80
110
|
})
|
|
81
111
|
|
|
82
112
|
// Generate config module
|
|
@@ -137,6 +167,11 @@ def _make_feature(name):
|
|
|
137
167
|
File({ name: '__init__.' + target.ext }, () => {
|
|
138
168
|
Content(``)
|
|
139
169
|
})
|
|
170
|
+
// PEP 561 marker inside the type-bearing package so setuptools package-data
|
|
171
|
+
// ("*" = ["py.typed"]) bundles it into the wheel.
|
|
172
|
+
File({ name: 'py.typed' }, () => {
|
|
173
|
+
Content(``)
|
|
174
|
+
})
|
|
140
175
|
})
|
|
141
176
|
|
|
142
177
|
Folder({ name: 'feature' }, () => {
|
|
@@ -4,6 +4,9 @@ import {
|
|
|
4
4
|
File,
|
|
5
5
|
cmp,
|
|
6
6
|
collectDeps,
|
|
7
|
+
pkgDescription,
|
|
8
|
+
keywords,
|
|
9
|
+
repoInfo,
|
|
7
10
|
} from '@voxgig/sdkgen'
|
|
8
11
|
|
|
9
12
|
|
|
@@ -24,6 +27,8 @@ const Package = cmp(async function Package(props: any) {
|
|
|
24
27
|
const ns = model.origin || 'voxgig-sdk'
|
|
25
28
|
const pkgBase = ns.endsWith('-sdk') ? model.name : `${model.name}-sdk`
|
|
26
29
|
const distName = `${ns}-${pkgBase}`
|
|
30
|
+
const { repoUrl, issuesUrl } = repoInfo(model)
|
|
31
|
+
const kw = keywords(model).map((k) => `"${k}"`).join(', ')
|
|
27
32
|
|
|
28
33
|
File({ name: 'pyproject.toml' }, () => {
|
|
29
34
|
Content(`[build-system]
|
|
@@ -33,14 +38,18 @@ build-backend = "setuptools.build_meta"
|
|
|
33
38
|
[project]
|
|
34
39
|
name = "${distName}"
|
|
35
40
|
version = "0.0.1"
|
|
36
|
-
description = "${model
|
|
41
|
+
description = "${pkgDescription(model, 'py')}"
|
|
42
|
+
readme = "README.md"
|
|
37
43
|
license = "MIT"
|
|
38
44
|
requires-python = ">=3.8"
|
|
45
|
+
keywords = [${kw}]
|
|
39
46
|
dependencies = [
|
|
40
|
-
"requests>=2.33",
|
|
41
47
|
`)
|
|
42
48
|
|
|
49
|
+
const seen = new Set<string>()
|
|
43
50
|
for (const d of collectDeps(model, target.name, target.deps)) {
|
|
51
|
+
if (seen.has(d.name)) continue
|
|
52
|
+
seen.add(d.name)
|
|
44
53
|
const v = d.source === 'target' ? (d.version || '0.0') : d.version
|
|
45
54
|
Content(` "${d.name}>=${v}",
|
|
46
55
|
`)
|
|
@@ -49,12 +58,24 @@ dependencies = [
|
|
|
49
58
|
Content(`]
|
|
50
59
|
|
|
51
60
|
[project.urls]
|
|
52
|
-
Homepage = "
|
|
61
|
+
Homepage = "${repoUrl}"
|
|
62
|
+
Repository = "${repoUrl}"
|
|
63
|
+
Issues = "${issuesUrl}"
|
|
64
|
+
|
|
65
|
+
# Ship the top-level single-file modules (setuptools find only discovers
|
|
66
|
+
# package dirs, never these) so the documented import actually installs.
|
|
67
|
+
# ${model.const.Name.toLowerCase()}_types holds the generated @dataclass models.
|
|
68
|
+
[tool.setuptools]
|
|
69
|
+
py-modules = ["${model.const.Name.toLowerCase()}_sdk", "${model.const.Name.toLowerCase()}_types", "config", "features"]
|
|
53
70
|
|
|
54
71
|
# Explicit package list — setuptools auto-discovery refuses to pick when
|
|
55
72
|
# multiple top-level dirs (core/entity/feature/utility) are present.
|
|
56
73
|
[tool.setuptools.packages.find]
|
|
57
74
|
include = ["core*", "entity*", "feature*", "utility*"]
|
|
75
|
+
|
|
76
|
+
# Ship the PEP 561 py.typed marker(s) so the inline type hints reach consumers.
|
|
77
|
+
[tool.setuptools.package-data]
|
|
78
|
+
"*" = ["py.typed"]
|
|
58
79
|
`)
|
|
59
80
|
})
|
|
60
81
|
})
|