@voxgig/sdkgen 1.2.0 → 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 +13 -6
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, entityIdField } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -17,34 +17,42 @@ const ReadmeTopQuick = cmp(function ReadmeTopQuick(props: any) {
|
|
|
17
17
|
|
|
18
18
|
const authActive = isAuthActive(model)
|
|
19
19
|
const apikeyImport = authActive ? `import os\n` : ''
|
|
20
|
-
const
|
|
21
|
-
?
|
|
22
|
-
:
|
|
20
|
+
const ctor = authActive
|
|
21
|
+
? `${model.const.Name}SDK({\n "apikey": os.environ.get("${envName(model)}_APIKEY"),\n})`
|
|
22
|
+
: `${model.const.Name}SDK()`
|
|
23
23
|
|
|
24
24
|
Content(`\`\`\`python
|
|
25
25
|
${apikeyImport}from ${model.const.Name.toLowerCase()}_sdk import ${model.const.Name}SDK
|
|
26
26
|
|
|
27
|
-
client = ${
|
|
27
|
+
client = ${ctor}
|
|
28
28
|
|
|
29
29
|
`)
|
|
30
30
|
|
|
31
31
|
if (exampleEntity) {
|
|
32
32
|
const eName = nom(exampleEntity, 'Name')
|
|
33
33
|
const opnames = Object.keys(exampleEntity.op || {})
|
|
34
|
+
// Model-driven id key: null when the entity has no id-like field, in which
|
|
35
|
+
// case the load example takes no match argument.
|
|
36
|
+
const idF = entityIdField(exampleEntity)
|
|
37
|
+
|
|
38
|
+
let hasCall = false
|
|
34
39
|
|
|
35
40
|
if (opnames.includes('list')) {
|
|
36
|
-
Content(`# List all ${eName.toLowerCase()}s
|
|
37
|
-
${eName.toLowerCase()}s
|
|
41
|
+
Content(`# List all ${eName.toLowerCase()}s (returns a list, raises on error)
|
|
42
|
+
${eName.toLowerCase()}s = client.${eName}().list()
|
|
43
|
+
for ${eName.toLowerCase()} in ${eName.toLowerCase()}s:
|
|
44
|
+
print(${eName.toLowerCase()})
|
|
38
45
|
`)
|
|
46
|
+
hasCall = true
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
if (opnames.includes('load')) {
|
|
42
50
|
Content(`
|
|
43
|
-
# Load a specific ${eName.toLowerCase()}
|
|
44
|
-
${eName.toLowerCase()}
|
|
45
|
-
|
|
46
|
-
)
|
|
51
|
+
# Load a specific ${eName.toLowerCase()} (returns the record, raises on error)
|
|
52
|
+
${eName.toLowerCase()} = client.${eName}().load(${idF ? `{"${idF}": "example_id"}` : ''})
|
|
53
|
+
print(${eName.toLowerCase()})
|
|
47
54
|
`)
|
|
55
|
+
hasCall = true
|
|
48
56
|
}
|
|
49
57
|
}
|
|
50
58
|
|
|
@@ -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,28 @@ 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
|
+
arg = idF ? `{"${idF}": "test01"}` : ''
|
|
43
|
+
} else if ('create' === primaryOp || 'update' === primaryOp) {
|
|
44
|
+
const items = opRequestShape(exampleEntity, primaryOp).items
|
|
45
|
+
.filter((it: any) => it.name !== idF && it.name !== 'id')
|
|
46
|
+
const required = items.filter((it: any) => !it.optional)
|
|
47
|
+
const chosen = required.length ? required : items.slice(0, 3)
|
|
48
|
+
arg = `{${chosen.map((it: any) => `"${it.name}": ${pyLit(it.type)}`).join(', ')}}`
|
|
49
|
+
}
|
|
50
|
+
Content(`${eName.toLowerCase()} = client.${eName}().${primaryOp}(${arg})
|
|
51
|
+
print(${eName.toLowerCase()})
|
|
27
52
|
`)
|
|
28
53
|
}
|
|
29
54
|
|
|
@@ -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,
|
|
@@ -144,16 +144,23 @@ class ProjectNameSDK:
|
|
|
144
144
|
|
|
145
145
|
_, err = utility.prepare_auth(ctx)
|
|
146
146
|
if err is not None:
|
|
147
|
-
|
|
147
|
+
raise err
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
fetchdef, err = utility.make_fetch_def(ctx)
|
|
150
|
+
if err is not None:
|
|
151
|
+
raise err
|
|
152
|
+
|
|
153
|
+
return fetchdef
|
|
150
154
|
|
|
151
155
|
def direct(self, fetchargs=None):
|
|
152
156
|
utility = self._utility
|
|
153
157
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
158
|
+
try:
|
|
159
|
+
fetchdef = self.prepare(fetchargs)
|
|
160
|
+
except Exception as err:
|
|
161
|
+
# direct() is the raw-HTTP escape hatch: it never raises, it
|
|
162
|
+
# returns a result object callers branch on via result["ok"].
|
|
163
|
+
return {"ok": False, "err": err}
|
|
157
164
|
|
|
158
165
|
if fetchargs is None:
|
|
159
166
|
fetchargs = {}
|
|
@@ -170,13 +177,13 @@ class ProjectNameSDK:
|
|
|
170
177
|
fetched, fetch_err = utility.fetcher(ctx, url, fetchdef)
|
|
171
178
|
|
|
172
179
|
if fetch_err is not None:
|
|
173
|
-
return {"ok": False, "err": fetch_err}
|
|
180
|
+
return {"ok": False, "err": fetch_err}
|
|
174
181
|
|
|
175
182
|
if fetched is None:
|
|
176
183
|
return {
|
|
177
184
|
"ok": False,
|
|
178
185
|
"err": ctx.make_error("direct_no_response", "response: undefined"),
|
|
179
|
-
}
|
|
186
|
+
}
|
|
180
187
|
|
|
181
188
|
if isinstance(fetched, dict):
|
|
182
189
|
status = helpers.to_int(vs.getprop(fetched, "status"))
|
|
@@ -205,17 +212,17 @@ class ProjectNameSDK:
|
|
|
205
212
|
"status": status,
|
|
206
213
|
"headers": headers,
|
|
207
214
|
"data": json_data,
|
|
208
|
-
}
|
|
215
|
+
}
|
|
209
216
|
|
|
210
217
|
return {
|
|
211
218
|
"ok": False,
|
|
212
219
|
"err": ctx.make_error("direct_invalid", "invalid response type"),
|
|
213
|
-
}
|
|
220
|
+
}
|
|
214
221
|
|
|
215
222
|
# <[SLOT]>
|
|
216
223
|
|
|
217
224
|
@classmethod
|
|
218
|
-
def test(cls, testopts=None, sdkopts=None):
|
|
225
|
+
def test(cls, testopts=None, sdkopts=None) -> "ProjectNameSDK":
|
|
219
226
|
if sdkopts is None:
|
|
220
227
|
sdkopts = {}
|
|
221
228
|
sdkopts = vs.clone(sdkopts)
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
// Typed-model generator (Ruby target).
|
|
4
|
+
//
|
|
5
|
+
// Ported from the TypeScript reference EntityTypes_ts.ts. Reads
|
|
6
|
+
// main.<KIT>.entity.<e>.fields[] and per-op params (op.<name>.points[].args.params[])
|
|
7
|
+
// and emits one file, <Sdk>_types.rb, containing a keyword-init Struct per active
|
|
8
|
+
// entity plus a request/match Struct per active op. Ruby has no enforced static
|
|
9
|
+
// types, so each member carries a YARD `@!attribute`/`@return` annotation whose
|
|
10
|
+
// element type comes from the canonical sentinels via the shared sdkgen helper
|
|
11
|
+
// `canonToType` (source of truth: @voxgig/apidef VALID_CANON):
|
|
12
|
+
// $STRING -> String, $INTEGER -> Integer, $NUMBER -> Float, $BOOLEAN -> Boolean,
|
|
13
|
+
// $OBJECT -> Hash, $ARRAY -> Array, unknown -> Object.
|
|
14
|
+
//
|
|
15
|
+
// Type-name scheme (IDENTICAL to TS): data type = <Name>; per-op request
|
|
16
|
+
// <Name>LoadMatch / <Name>ListMatch / <Name>RemoveMatch (query/id ops),
|
|
17
|
+
// <Name>CreateData / <Name>UpdateData (body ops). An op WITH params -> a Struct of
|
|
18
|
+
// those params (reqd:false -> annotated `[Type, nil]`). An op WITHOUT params -> a
|
|
19
|
+
// Struct over the entity fields (Struct members are always optional/nil, so this is
|
|
20
|
+
// the Ruby stand-in for TS `Partial<Name>`; callers may equally pass a plain Hash).
|
|
21
|
+
//
|
|
22
|
+
// Struct.new(keyword_init: true) gives value objects usable as `Advice.new(id: ...)`.
|
|
23
|
+
// The file is required by the main SDK module so these constants are always loaded.
|
|
24
|
+
|
|
25
|
+
import {
|
|
26
|
+
cmp, each,
|
|
27
|
+
File, Content,
|
|
28
|
+
} from '@voxgig/sdkgen'
|
|
29
|
+
|
|
30
|
+
import { canonToType, opTypeName, opRequestShape } from '@voxgig/sdkgen'
|
|
31
|
+
|
|
32
|
+
import {
|
|
33
|
+
KIT,
|
|
34
|
+
getModelPath,
|
|
35
|
+
} from '@voxgig/apidef'
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
const LANG = 'rb'
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
// A Ruby symbol literal for a member name: bare for identifiers, quoted otherwise.
|
|
42
|
+
function symName(name: string): string {
|
|
43
|
+
return /^[A-Za-z_][A-Za-z0-9_]*[?!=]?$/.test(name) ? ':' + name : ':"' + name + '"'
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
// Emit one typed value class: a YARD @!attribute block plus a keyword-init
|
|
48
|
+
// Struct. Ruby's `Struct.new` rejects zero members, so an empty shape falls
|
|
49
|
+
// back to a plain empty class (keeps the type name available).
|
|
50
|
+
function emitStruct(
|
|
51
|
+
typeName: string,
|
|
52
|
+
doc: string,
|
|
53
|
+
members: Array<{ name: string, type: unknown, optional: boolean }>,
|
|
54
|
+
) {
|
|
55
|
+
let block = `# ${doc}\n`
|
|
56
|
+
|
|
57
|
+
members.forEach((m) => {
|
|
58
|
+
const t = canonToType(m.type, LANG)
|
|
59
|
+
const ret = m.optional ? `[${t}, nil]` : `[${t}]`
|
|
60
|
+
block += `#\n# @!attribute [rw] ${m.name}\n# @return ${ret}\n`
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
if (0 === members.length) {
|
|
64
|
+
block += `class ${typeName}\nend\n\n`
|
|
65
|
+
Content(block)
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
block += `${typeName} = Struct.new(\n`
|
|
70
|
+
members.forEach((m) => {
|
|
71
|
+
block += ` ${symName(m.name)},\n`
|
|
72
|
+
})
|
|
73
|
+
block += ` keyword_init: true\n)\n\n`
|
|
74
|
+
|
|
75
|
+
Content(block)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
const EntityTypes = cmp(function EntityTypes(props: any) {
|
|
80
|
+
const { model } = props.ctx$
|
|
81
|
+
|
|
82
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
83
|
+
const entityList = each(entity).filter((e: any) => e.active !== false)
|
|
84
|
+
|
|
85
|
+
File({ name: model.const.Name + '_types.' + LANG }, () => {
|
|
86
|
+
|
|
87
|
+
Content(`# frozen_string_literal: true
|
|
88
|
+
|
|
89
|
+
# Typed models for the ${model.const.Name} SDK.
|
|
90
|
+
#
|
|
91
|
+
# GENERATED from the API model: main.${KIT}.entity.<e>.fields[] and per-op
|
|
92
|
+
# params (op.<name>.points[].args.params[]). Member types come from the
|
|
93
|
+
# canonical type sentinels via @voxgig/sdkgen canonToType (source of truth:
|
|
94
|
+
# @voxgig/apidef VALID_CANON). Ruby types are unenforced; these YARD
|
|
95
|
+
# annotations document the shapes. Do not edit by hand.
|
|
96
|
+
|
|
97
|
+
`)
|
|
98
|
+
|
|
99
|
+
entityList.forEach((ent: any) => {
|
|
100
|
+
const Name = ent.Name
|
|
101
|
+
const fields = (ent.fields ? each(ent.fields) : [])
|
|
102
|
+
.filter((f: any) => f.active !== false)
|
|
103
|
+
|
|
104
|
+
// Entity data model: one member per field (`req:false` -> nilable).
|
|
105
|
+
emitStruct(
|
|
106
|
+
Name,
|
|
107
|
+
`${Name} entity data model.`,
|
|
108
|
+
fields.map((f: any) => ({ name: f.name, type: f.type, optional: false === f.req })),
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
// Per active op: a request/match Struct. Members and their optionality
|
|
112
|
+
// come from the shared partiality policy (opRequestShape); this file only
|
|
113
|
+
// renders them as a keyword-init Struct.
|
|
114
|
+
const ops = ent.op || {}
|
|
115
|
+
;['load', 'list', 'create', 'update', 'remove'].forEach((opname: string) => {
|
|
116
|
+
if (null == ops[opname]) {
|
|
117
|
+
return
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const typeName = opTypeName(Name, opname)
|
|
121
|
+
const { items } = opRequestShape(ent, opname)
|
|
122
|
+
|
|
123
|
+
emitStruct(
|
|
124
|
+
typeName,
|
|
125
|
+
`Request payload for ${Name}#${opname}.`,
|
|
126
|
+
items,
|
|
127
|
+
)
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
export {
|
|
135
|
+
EntityTypes,
|
|
136
|
+
}
|
|
@@ -8,6 +8,7 @@ const MainEntity = cmp(async function MainEntity(props: any) {
|
|
|
8
8
|
const { model } = props.ctx$
|
|
9
9
|
|
|
10
10
|
Content(`
|
|
11
|
+
# Canonical facade: client.${entity.Name}.list / client.${entity.Name}.load({ "id" => ... })
|
|
11
12
|
def ${entity.Name}(data = nil)
|
|
12
13
|
require_relative 'entity/${entity.name}_entity'
|
|
13
14
|
${entity.Name}Entity.new(self, data)
|
|
@@ -22,6 +22,7 @@ import { Package } from './Package_rb'
|
|
|
22
22
|
import { Config } from './Config_rb'
|
|
23
23
|
import { Gitignore } from './Gitignore_rb'
|
|
24
24
|
import { MainEntity } from './MainEntity_rb'
|
|
25
|
+
import { EntityTypes } from './EntityTypes_rb'
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
const Main = cmp(async function Main(props: any) {
|
|
@@ -84,6 +85,9 @@ utility.feature_hook.call(@_rootctx, "${name}")
|
|
|
84
85
|
Config({ target })
|
|
85
86
|
})
|
|
86
87
|
|
|
88
|
+
// Generate typed models (<Sdk>_types.rb) — required by the main SDK file.
|
|
89
|
+
EntityTypes({ target })
|
|
90
|
+
|
|
87
91
|
// Generate feature factory module
|
|
88
92
|
File({ name: 'features.' + target.ext }, () => {
|
|
89
93
|
Content(`# ${model.const.Name} SDK feature factory
|
|
@@ -4,6 +4,8 @@ import {
|
|
|
4
4
|
File,
|
|
5
5
|
cmp,
|
|
6
6
|
collectDeps,
|
|
7
|
+
pkgDescription,
|
|
8
|
+
repoInfo,
|
|
7
9
|
} from '@voxgig/sdkgen'
|
|
8
10
|
|
|
9
11
|
|
|
@@ -24,6 +26,7 @@ const Package = cmp(async function Package(props: any) {
|
|
|
24
26
|
const ns = model.origin || 'voxgig-sdk'
|
|
25
27
|
const pkgBase = ns.endsWith('-sdk') ? model.name : `${model.name}-sdk`
|
|
26
28
|
const gemName = `${ns}-${pkgBase}`
|
|
29
|
+
const { repoUrl, issuesUrl, changelogUrl } = repoInfo(model)
|
|
27
30
|
|
|
28
31
|
const versionOf = (d: { version: string; source: 'feature' | 'target' }) =>
|
|
29
32
|
d.source === 'target' ? (d.version || '0.0') : d.version
|
|
@@ -44,23 +47,47 @@ gemspec
|
|
|
44
47
|
|
|
45
48
|
// Generate gemspec
|
|
46
49
|
File({ name: model.const.Name + '_sdk.gemspec' }, () => {
|
|
50
|
+
// RubyGems rejects a gemspec that declares the same runtime dependency
|
|
51
|
+
// twice (Gem::InvalidSpecificationException at `gem build`), so the
|
|
52
|
+
// unconstrained json fallback is only emitted when the model's own
|
|
53
|
+
// dependency list doesn't already declare json.
|
|
54
|
+
const deps = collectDeps(model, target.name, target.deps)
|
|
55
|
+
const hasJson = deps.some((d: any) => 'json' === d.name)
|
|
56
|
+
|
|
47
57
|
Content(`Gem::Specification.new do |spec|
|
|
48
58
|
spec.name = "${gemName}"
|
|
49
59
|
spec.version = "0.0.1"
|
|
50
60
|
spec.authors = ["Voxgig"]
|
|
51
|
-
spec.summary = "${model
|
|
61
|
+
spec.summary = "${pkgDescription(model, 'rb')}"
|
|
62
|
+
spec.description = "${pkgDescription(model, 'rb')}"
|
|
52
63
|
spec.license = "MIT"
|
|
53
|
-
spec.homepage = "
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
spec.homepage = "${repoUrl}"
|
|
65
|
+
spec.metadata = {
|
|
66
|
+
"homepage_uri" => "${repoUrl}",
|
|
67
|
+
"source_code_uri" => "${repoUrl}",
|
|
68
|
+
"bug_tracker_uri" => "${issuesUrl}",
|
|
69
|
+
"changelog_uri" => "${changelogUrl}",
|
|
70
|
+
"rubygems_mfa_required" => "true"
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
spec.files = Dir[
|
|
74
|
+
"*.rb",
|
|
75
|
+
"core/**/*.rb",
|
|
76
|
+
"entity/**/*.rb",
|
|
77
|
+
"feature/**/*.rb",
|
|
78
|
+
"utility/**/*.rb",
|
|
79
|
+
"LICENSE",
|
|
80
|
+
"README.md",
|
|
81
|
+
"REFERENCE.md"
|
|
82
|
+
]
|
|
56
83
|
spec.require_paths = ["."]
|
|
57
84
|
|
|
58
85
|
spec.required_ruby_version = ">= 3.0"
|
|
59
|
-
|
|
86
|
+
${hasJson ? '' : `
|
|
60
87
|
spec.add_dependency "json"
|
|
61
|
-
`)
|
|
88
|
+
`}`)
|
|
62
89
|
|
|
63
|
-
for (const d of
|
|
90
|
+
for (const d of deps) {
|
|
64
91
|
Content(` spec.add_dependency "${d.name}", "~> ${versionOf(d)}"
|
|
65
92
|
`)
|
|
66
93
|
}
|