@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
|
@@ -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,23 +27,39 @@ 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 rockName = `${ns}-${pkgBase}`
|
|
30
|
+
const { repoUrl, issuesUrl } = repoInfo(model)
|
|
31
|
+
const labels = keywords(model).map((k) => `"${k}"`).join(', ')
|
|
32
|
+
|
|
33
|
+
// Single source for the version so the rockspec version and the source.tag
|
|
34
|
+
// (which `make publish` pushes as lua/v<rockVersion>) can never drift apart.
|
|
35
|
+
const rockVersion = '0.0.1'
|
|
27
36
|
|
|
28
37
|
File({ name: model.name + '.rockspec' }, () => {
|
|
29
38
|
Content(`package = "${rockName}"
|
|
30
|
-
version = "
|
|
39
|
+
version = "${rockVersion}-1"
|
|
31
40
|
source = {
|
|
32
|
-
|
|
41
|
+
-- git+https (GitHub dropped git:// in 2022); pin the install to the release
|
|
42
|
+
-- tag pushed by \`make publish\`, and point at the lua/ subdir of the monorepo.
|
|
43
|
+
url = "git+https://github.com/${ns}/${model.name}-sdk.git",
|
|
44
|
+
tag = "lua/v${rockVersion}",
|
|
45
|
+
dir = "${model.name}-sdk/lua"
|
|
33
46
|
}
|
|
34
47
|
description = {
|
|
35
|
-
summary = "${model
|
|
36
|
-
|
|
48
|
+
summary = "${pkgDescription(model, 'lua')}",
|
|
49
|
+
homepage = "${repoUrl}",
|
|
50
|
+
issues_url = "${issuesUrl}",
|
|
51
|
+
license = "MIT",
|
|
52
|
+
labels = { ${labels} }
|
|
37
53
|
}
|
|
38
54
|
dependencies = {
|
|
39
55
|
"lua >= 5.3",
|
|
40
56
|
"dkjson >= 2.5",
|
|
41
57
|
`)
|
|
42
58
|
|
|
59
|
+
const seen = new Set<string>(['lua', 'dkjson'])
|
|
43
60
|
for (const d of collectDeps(model, target.name, target.deps)) {
|
|
61
|
+
if (seen.has(d.name)) continue
|
|
62
|
+
seen.add(d.name)
|
|
44
63
|
const v = d.source === 'target' ? (d.version || '0.0') : d.version
|
|
45
64
|
Content(` "${d.name} >= ${v}",
|
|
46
65
|
`)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, entityIdField } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -41,6 +41,8 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
|
|
|
41
41
|
publishedEntities.map((entity: any) => {
|
|
42
42
|
const opnames = Object.keys(entity.op || {})
|
|
43
43
|
const fields = entity.fields || []
|
|
44
|
+
// Model-driven id key: null when this entity has no id-like field.
|
|
45
|
+
const idF = entityIdField(entity)
|
|
44
46
|
|
|
45
47
|
Content(`
|
|
46
48
|
### ${entity.Name}
|
|
@@ -53,7 +55,7 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
|
|
|
53
55
|
`)
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
Content(`Create an instance: \`
|
|
58
|
+
Content(`Create an instance: \`local ${entity.name} = client:${entity.Name}(nil)\`
|
|
57
59
|
|
|
58
60
|
`)
|
|
59
61
|
|
|
@@ -84,7 +86,7 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
|
|
|
84
86
|
|
|
85
87
|
each(fields, (field: any) => {
|
|
86
88
|
const desc = field.short || ''
|
|
87
|
-
Content(`| \`${field.name}\` | \`${field.type
|
|
89
|
+
Content(`| \`${field.name}\` | \`${canonToType(field.type, target.name)}\` | ${desc} |
|
|
88
90
|
`)
|
|
89
91
|
})
|
|
90
92
|
|
|
@@ -95,8 +97,8 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
|
|
|
95
97
|
if (opnames.includes('load')) {
|
|
96
98
|
Content(`#### Example: Load
|
|
97
99
|
|
|
98
|
-
\`\`\`
|
|
99
|
-
|
|
100
|
+
\`\`\`lua
|
|
101
|
+
local ${entity.name}, err = client:${entity.Name}():load(${idF ? `{ ${idF} = "${entity.name}_id" }` : ''})
|
|
100
102
|
\`\`\`
|
|
101
103
|
|
|
102
104
|
`)
|
|
@@ -105,8 +107,8 @@ const ${entity.name} = await client.${entity.Name}().load({ id: '${entity.name}_
|
|
|
105
107
|
if (opnames.includes('list')) {
|
|
106
108
|
Content(`#### Example: List
|
|
107
109
|
|
|
108
|
-
\`\`\`
|
|
109
|
-
|
|
110
|
+
\`\`\`lua
|
|
111
|
+
local ${entity.name}s, err = client:${entity.Name}():list()
|
|
110
112
|
\`\`\`
|
|
111
113
|
|
|
112
114
|
`)
|
|
@@ -115,12 +117,12 @@ const ${entity.name}s = await client.${entity.Name}().list()
|
|
|
115
117
|
if (opnames.includes('create')) {
|
|
116
118
|
Content(`#### Example: Create
|
|
117
119
|
|
|
118
|
-
\`\`\`
|
|
119
|
-
|
|
120
|
+
\`\`\`lua
|
|
121
|
+
local ${entity.name}, err = client:${entity.Name}():create({
|
|
120
122
|
`)
|
|
121
123
|
each(fields, (field: any) => {
|
|
122
124
|
if ('id' !== field.name && field.req) {
|
|
123
|
-
Content(` ${field.name}
|
|
125
|
+
Content(` ${field.name} = nil, -- ${canonToType(field.type, target.name)}
|
|
124
126
|
`)
|
|
125
127
|
}
|
|
126
128
|
})
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { cmp, Content, File } from '@voxgig/sdkgen'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
KIT,
|
|
5
|
+
getModelPath,
|
|
6
|
+
} from '@voxgig/apidef'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// Emits lua/test/readme_examples_test.lua — a busted spec that is a
|
|
10
|
+
// COMPLETENESS GATE over every ```lua block in ALL THREE docs that ship
|
|
11
|
+
// lua examples:
|
|
12
|
+
// - the root README.md (top-level, multi-language quick start)
|
|
13
|
+
// - the per-language lua/README.md
|
|
14
|
+
// - the per-language lua/REFERENCE.md
|
|
15
|
+
//
|
|
16
|
+
// For every ```lua block, tagged by (source doc, index):
|
|
17
|
+
// 1. Syntax: it must compile with Lua's load() — catches malformed
|
|
18
|
+
// example code (missing end, bad token, ...).
|
|
19
|
+
// 2. Offline run: every RUNNABLE block (one that builds a client via
|
|
20
|
+
// sdk.new/sdk.test or references `client`) is EXECUTED with the mock
|
|
21
|
+
// transport (no network). Each client constructor is rewritten to the
|
|
22
|
+
// seeded test-mode form, and fragments that only use `client` get a
|
|
23
|
+
// seeded test client injected. A call to a method that does not exist
|
|
24
|
+
// — e.g. a lowercase entity accessor after the API capitalised it to
|
|
25
|
+
// client:Entity() — raises "call a nil value" and FAILS the test.
|
|
26
|
+
// Entity operations return a (value, err) tuple, so a seeded-fixture
|
|
27
|
+
// miss surfaces as a tolerated (nil, err) not-found domain error.
|
|
28
|
+
// 3. Completeness: every block is partitioned into {executed, illustration}
|
|
29
|
+
// and total == executed + illustration is asserted per doc. A block that
|
|
30
|
+
// is neither runnable nor a NARROW explicit illustration (a comment-only
|
|
31
|
+
// / --[[ ]] placeholder) is a silently-untested example and FAILS the
|
|
32
|
+
// gate — "illustration" is never a catch-all.
|
|
33
|
+
const ReadmeExamplesTest = cmp(function ReadmeExamplesTest(props: any) {
|
|
34
|
+
const { ctx$: { model } } = props
|
|
35
|
+
|
|
36
|
+
// Every active entity, keyed by its model name, is seeded with a `test01`
|
|
37
|
+
// fixture whose id is `test01` — so a load({ id = "test01" }) in a doc
|
|
38
|
+
// resolves offline. Bracket-string keys keep the literal valid for any
|
|
39
|
+
// entity name.
|
|
40
|
+
const entity = getModelPath(model, `main.${KIT}.entity`) || {}
|
|
41
|
+
const entnames = Object.values(entity)
|
|
42
|
+
.filter((e: any) => e && e.active !== false)
|
|
43
|
+
.map((e: any) => e.name)
|
|
44
|
+
|
|
45
|
+
const seedEntries = entnames
|
|
46
|
+
.map((n: string) => `["${n}"] = { ["test01"] = { id = "test01" } }`)
|
|
47
|
+
.join(', ')
|
|
48
|
+
const seedLiteral = `{ entity = { ${seedEntries} } }`
|
|
49
|
+
|
|
50
|
+
File({ name: 'readme_examples_test.lua' }, () => {
|
|
51
|
+
Content(`-- README lua example snippets check. Generated by @voxgig/sdkgen.
|
|
52
|
+
--
|
|
53
|
+
-- COMPLETENESS GATE over every \`\`\`lua block in all three docs that ship
|
|
54
|
+
-- lua examples: the root README.md, the lua/README.md, and the
|
|
55
|
+
-- lua/REFERENCE.md. For every block:
|
|
56
|
+
-- 1. Syntax: each block must compile with Lua's load().
|
|
57
|
+
-- 2. Offline run: every runnable block (one that builds a client or
|
|
58
|
+
-- references \`client\`) is EXECUTED with the mock transport (no
|
|
59
|
+
-- network). Each client constructor is rewritten to the seeded
|
|
60
|
+
-- test-mode form, and fragments that only use \`client\` get a seeded
|
|
61
|
+
-- test client injected. A call to a method that does not exist raises
|
|
62
|
+
-- "call a nil value" and FAILS the test. A seeded-fixture miss surfaces
|
|
63
|
+
-- as a tolerated (nil, err) not-found domain error, not a raised error.
|
|
64
|
+
-- 3. Completeness: total == executed + illustration per doc. A block that
|
|
65
|
+
-- is neither runnable nor an explicit comment-only placeholder FAILS
|
|
66
|
+
-- the gate, so no runnable example can be silently skipped.
|
|
67
|
+
|
|
68
|
+
local SDK_MODULE = "${model.name}_sdk"
|
|
69
|
+
|
|
70
|
+
-- A test-mode client seeded with a fixture for every entity. The constructor
|
|
71
|
+
-- of each runnable snippet is rewritten to this form so the offline mock has
|
|
72
|
+
-- data to return.
|
|
73
|
+
local TEST_SEED = '${seedLiteral}'
|
|
74
|
+
local TEST_CTOR = "sdk.test(" .. TEST_SEED .. ")"
|
|
75
|
+
|
|
76
|
+
local function script_dir()
|
|
77
|
+
local src = debug.getinfo(1, "S").source
|
|
78
|
+
local path = src:sub(1, 1) == "@" and src:sub(2) or src
|
|
79
|
+
return path:match("^(.*)[/\\\\][^/\\\\]*$") or "."
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
-- Read a doc by its path relative to this test file's directory (which is
|
|
83
|
+
-- <repo>/lua/test). The root README is two levels up; the lua docs are one.
|
|
84
|
+
local function read_doc(relpath)
|
|
85
|
+
local dir = script_dir()
|
|
86
|
+
local candidates = {
|
|
87
|
+
dir .. "/" .. relpath,
|
|
88
|
+
relpath,
|
|
89
|
+
}
|
|
90
|
+
for _, p in ipairs(candidates) do
|
|
91
|
+
local f = io.open(p, "r")
|
|
92
|
+
if f then
|
|
93
|
+
local data = f:read("*a")
|
|
94
|
+
f:close()
|
|
95
|
+
return data, p
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
return nil
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
local function trim(s)
|
|
102
|
+
return (s:gsub("^%s+", ""):gsub("%s+$", ""))
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
local function extract_blocks(md, lang)
|
|
106
|
+
local blocks = {}
|
|
107
|
+
local open = "\`\`\`" .. lang
|
|
108
|
+
local in_block = false
|
|
109
|
+
local cur = {}
|
|
110
|
+
for line in (md .. "\\n"):gmatch("([^\\n]*)\\n") do
|
|
111
|
+
local t = trim(line)
|
|
112
|
+
if not in_block then
|
|
113
|
+
if t == open then
|
|
114
|
+
in_block = true
|
|
115
|
+
cur = {}
|
|
116
|
+
end
|
|
117
|
+
else
|
|
118
|
+
if t == "\`\`\`" then
|
|
119
|
+
table.insert(blocks, table.concat(cur, "\\n"))
|
|
120
|
+
in_block = false
|
|
121
|
+
else
|
|
122
|
+
table.insert(cur, line)
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
return blocks
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
-- A block is runnable if it builds a client (sdk.new / sdk.test) or uses one
|
|
130
|
+
-- (references \`client\`). These are the blocks we EXECUTE offline.
|
|
131
|
+
local function is_runnable(block)
|
|
132
|
+
return block:find("sdk%s*%.%s*new") ~= nil
|
|
133
|
+
or block:find("sdk%s*%.%s*test") ~= nil
|
|
134
|
+
or block:find("client") ~= nil
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
-- NARROW illustration class:
|
|
138
|
+
-- - a comment-only block (nothing remains after stripping lua comments), or
|
|
139
|
+
-- - a --[[ ]] value-slot placeholder template (e.g. field = --[[ type ]]):
|
|
140
|
+
-- the placeholder stands in for a value, so the block does not parse.
|
|
141
|
+
-- Everything else must be runnable and is executed; a non-runnable,
|
|
142
|
+
-- non-illustration block is a silently-untested example and fails the
|
|
143
|
+
-- completeness gate.
|
|
144
|
+
local function is_illustration(block)
|
|
145
|
+
local stripped = block:gsub("%-%-%[%[.-%]%]", "") -- block comments
|
|
146
|
+
stripped = stripped:gsub("%-%-[^\\n]*", "") -- line comments
|
|
147
|
+
if trim(stripped) == "" then
|
|
148
|
+
return true
|
|
149
|
+
end
|
|
150
|
+
if block:find("%-%-%[%[") and load(block) == nil then
|
|
151
|
+
return true
|
|
152
|
+
end
|
|
153
|
+
return false
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
-- Transform a README block into an executable offline snippet: rewrite any
|
|
157
|
+
-- client constructor to the seeded test-mode form, inject a seeded client for
|
|
158
|
+
-- bare fragments, and ensure \`sdk\` is in scope.
|
|
159
|
+
local function make_runnable(block)
|
|
160
|
+
local src = block
|
|
161
|
+
|
|
162
|
+
local constructs = block:find("sdk%s*%.%s*new") ~= nil
|
|
163
|
+
or block:find("sdk%s*%.%s*test") ~= nil
|
|
164
|
+
|
|
165
|
+
if constructs then
|
|
166
|
+
-- %b() matches a balanced ( ... ) argument list, so nested tables/parens
|
|
167
|
+
-- in the original constructor call are replaced wholesale.
|
|
168
|
+
src = src:gsub("sdk%s*%.%s*new%s*%b()", function() return TEST_CTOR end)
|
|
169
|
+
src = src:gsub("sdk%s*%.%s*test%s*%b()", function() return TEST_CTOR end)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
local prelude = {}
|
|
173
|
+
if not src:find("require%s*%(") then
|
|
174
|
+
table.insert(prelude, 'local sdk = require("' .. SDK_MODULE .. '")')
|
|
175
|
+
end
|
|
176
|
+
if not constructs and src:find("client") then
|
|
177
|
+
table.insert(prelude, "local client = " .. TEST_CTOR)
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
if #prelude > 0 then
|
|
181
|
+
src = table.concat(prelude, "\\n") .. "\\n" .. src
|
|
182
|
+
end
|
|
183
|
+
return src
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
-- All three docs are checked identically. relpath is resolved against this
|
|
187
|
+
-- test file's directory (<repo>/lua/test).
|
|
188
|
+
local DOCS = {
|
|
189
|
+
{ label = "root README", relpath = "../../README.md" },
|
|
190
|
+
{ label = "lua/README", relpath = "../README.md" },
|
|
191
|
+
{ label = "lua/REFERENCE", relpath = "../REFERENCE.md" },
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
for _, doc in ipairs(DOCS) do
|
|
195
|
+
describe("lua doc examples (" .. doc.label .. ")", function()
|
|
196
|
+
local md = read_doc(doc.relpath)
|
|
197
|
+
|
|
198
|
+
it(doc.label .. " is present", function()
|
|
199
|
+
assert.is_not_nil(md, "could not read " .. doc.label ..
|
|
200
|
+
" (" .. doc.relpath .. ")")
|
|
201
|
+
end)
|
|
202
|
+
|
|
203
|
+
if not md then
|
|
204
|
+
return
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
local blocks = extract_blocks(md, "lua")
|
|
208
|
+
|
|
209
|
+
it(doc.label .. " has lua example blocks", function()
|
|
210
|
+
assert.is_true(#blocks > 0, "no lua code blocks found in " .. doc.label)
|
|
211
|
+
end)
|
|
212
|
+
|
|
213
|
+
it(doc.label .. ": every lua block is syntactically valid", function()
|
|
214
|
+
for i, block in ipairs(blocks) do
|
|
215
|
+
-- Illustration placeholders (--[[ type ]] templates) intentionally do
|
|
216
|
+
-- not parse; every other block must.
|
|
217
|
+
if not is_illustration(block) then
|
|
218
|
+
local chunk, err = load(block, "=" .. doc.label .. "-lua-" .. i)
|
|
219
|
+
assert.is_not_nil(chunk,
|
|
220
|
+
doc.label .. " lua block #" .. i .. " has a syntax error: " ..
|
|
221
|
+
tostring(err) .. "\\n----\\n" .. block .. "\\n----")
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
end)
|
|
225
|
+
|
|
226
|
+
it(doc.label .. ": every runnable lua block runs offline in test mode",
|
|
227
|
+
function()
|
|
228
|
+
local ran = 0
|
|
229
|
+
for i, block in ipairs(blocks) do
|
|
230
|
+
if is_runnable(block) and not is_illustration(block) then
|
|
231
|
+
local src = make_runnable(block)
|
|
232
|
+
local chunk, err = load(src, "=" .. doc.label .. "-run-" .. i)
|
|
233
|
+
assert.is_not_nil(chunk,
|
|
234
|
+
doc.label .. " runnable block #" .. i .. " failed to compile: " ..
|
|
235
|
+
tostring(err) .. "\\n----\\n" .. src .. "\\n----")
|
|
236
|
+
local ok, e = pcall(chunk)
|
|
237
|
+
if not ok then
|
|
238
|
+
local msg = tostring(e)
|
|
239
|
+
-- A nil accessor / missing method / bad index is a real doc bug:
|
|
240
|
+
-- the documented call does not exist.
|
|
241
|
+
if msg:find("nil value") or msg:find("attempt to call")
|
|
242
|
+
or msg:find("attempt to index") then
|
|
243
|
+
assert.is_true(false,
|
|
244
|
+
doc.label .. " runnable block #" .. i .. " hit a runtime " ..
|
|
245
|
+
"error (missing method / nil call): " .. msg ..
|
|
246
|
+
"\\n----\\n" .. src .. "\\n----")
|
|
247
|
+
end
|
|
248
|
+
-- Other runtime errors (a seeded-fixture miss surfaces as a
|
|
249
|
+
-- tolerated not-found domain error, e.g. "request: 404") are
|
|
250
|
+
-- expected offline and tolerated.
|
|
251
|
+
end
|
|
252
|
+
ran = ran + 1
|
|
253
|
+
end
|
|
254
|
+
end
|
|
255
|
+
assert.is_true(ran > 0,
|
|
256
|
+
"expected at least one runnable lua block in " .. doc.label)
|
|
257
|
+
end)
|
|
258
|
+
|
|
259
|
+
it(doc.label .. ": every lua block is executed or an explicit " ..
|
|
260
|
+
"illustration (completeness)", function()
|
|
261
|
+
local executed, illustration = 0, 0
|
|
262
|
+
local unclassified = {}
|
|
263
|
+
for i, block in ipairs(blocks) do
|
|
264
|
+
if is_illustration(block) then
|
|
265
|
+
illustration = illustration + 1
|
|
266
|
+
elseif is_runnable(block) then
|
|
267
|
+
executed = executed + 1
|
|
268
|
+
else
|
|
269
|
+
table.insert(unclassified, i)
|
|
270
|
+
end
|
|
271
|
+
end
|
|
272
|
+
assert.is_true(#unclassified == 0,
|
|
273
|
+
doc.label .. " has lua block(s) that are neither runnable nor a " ..
|
|
274
|
+
"recognized illustration and would be silently untested: #" ..
|
|
275
|
+
table.concat(unclassified, ", #"))
|
|
276
|
+
assert.are.equal(#blocks, executed + illustration,
|
|
277
|
+
doc.label .. " completeness: total " .. #blocks ..
|
|
278
|
+
" != executed " .. executed .. " + illustration " .. illustration)
|
|
279
|
+
print(string.format(
|
|
280
|
+
"[readme-lua] %s: total=%d executed=%d illustration=%d",
|
|
281
|
+
doc.label, #blocks, executed, illustration))
|
|
282
|
+
end)
|
|
283
|
+
end)
|
|
284
|
+
end
|
|
285
|
+
`)
|
|
286
|
+
})
|
|
287
|
+
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
export {
|
|
292
|
+
ReadmeExamplesTest
|
|
293
|
+
}
|
|
@@ -1,12 +1,52 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, entityPrimaryOp, opRequestShape } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
KIT,
|
|
6
|
+
getModelPath,
|
|
7
|
+
nom,
|
|
8
|
+
} from '@voxgig/apidef'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// A type-correct Lua literal for a field's canonical type.
|
|
12
|
+
function luaLit(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
|
+
function luaKey(name: string): string {
|
|
21
|
+
return /^[A-Za-z_]\w*$/.test(name) ? name : `["${name}"]`
|
|
22
|
+
}
|
|
3
23
|
|
|
4
24
|
|
|
5
25
|
const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
|
|
6
26
|
const { target, ctx$: { model } } = props
|
|
7
27
|
|
|
28
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
29
|
+
const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
|
|
30
|
+
const eName = exampleEntity ? nom(exampleEntity, 'Name') : 'Entity'
|
|
31
|
+
// Model-driven id key: null when the entity has no id-like field.
|
|
32
|
+
const idF = exampleEntity ? entityIdField(exampleEntity) : null
|
|
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 = exampleEntity ? (entityPrimaryOp(exampleEntity) || 'load') : 'load'
|
|
36
|
+
const isMatchOp = 'load' === primaryOp || 'remove' === primaryOp
|
|
37
|
+
let testCallArg = ''
|
|
38
|
+
if (exampleEntity && isMatchOp) {
|
|
39
|
+
testCallArg = idF ? `{ ${idF} = "test01" }` : ''
|
|
40
|
+
} else if (exampleEntity && ('create' === primaryOp || 'update' === primaryOp)) {
|
|
41
|
+
const items = opRequestShape(exampleEntity, primaryOp).items
|
|
42
|
+
.filter((it: any) => it.name !== idF && it.name !== 'id')
|
|
43
|
+
const required = items.filter((it: any) => !it.optional)
|
|
44
|
+
const chosen = required.length ? required : items.slice(0, 3)
|
|
45
|
+
testCallArg = `{ ${chosen.map((it: any) => `${luaKey(it.name)} = ${luaLit(it.type)}`).join(', ')} }`
|
|
46
|
+
}
|
|
47
|
+
|
|
8
48
|
const apikeyEnvLine = isAuthActive(model)
|
|
9
|
-
? `\n${model
|
|
49
|
+
? `\n${envName(model)}_APIKEY=<your-key>`
|
|
10
50
|
: ''
|
|
11
51
|
|
|
12
52
|
Content(`### Make a direct HTTP request
|
|
@@ -47,12 +87,10 @@ print(fetchdef["headers"])
|
|
|
47
87
|
Create a mock client for unit testing — no server required:
|
|
48
88
|
|
|
49
89
|
\`\`\`lua
|
|
50
|
-
local client = sdk.test(
|
|
90
|
+
local client = sdk.test()
|
|
51
91
|
|
|
52
|
-
local result, err = client:${
|
|
53
|
-
|
|
54
|
-
)
|
|
55
|
-
-- result contains mock response data
|
|
92
|
+
local result, err = client:${eName}():${primaryOp}(${testCallArg})
|
|
93
|
+
-- result is the returned data; err is set on failure
|
|
56
94
|
\`\`\`
|
|
57
95
|
|
|
58
96
|
### Use a custom fetch function
|
|
@@ -84,7 +122,7 @@ local client = sdk.new({
|
|
|
84
122
|
Create a \`.env.local\` file at the project root:
|
|
85
123
|
|
|
86
124
|
\`\`\`
|
|
87
|
-
${model
|
|
125
|
+
${envName(model)}_TEST_LIVE=TRUE${apikeyEnvLine}
|
|
88
126
|
\`\`\`
|
|
89
127
|
|
|
90
128
|
Then run:
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, installCommand, isPublished, repoInfo } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
const ReadmeInstall = cmp(function ReadmeInstall(props: any) {
|
|
6
6
|
const { target, ctx$ } = props
|
|
7
7
|
const { model } = ctx$
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
if (isPublished(model, target.name)) {
|
|
10
|
+
Content(`\`\`\`bash
|
|
11
|
+
${installCommand(model, target.name)}
|
|
11
12
|
\`\`\`
|
|
12
13
|
|
|
13
14
|
If the module is not yet published, add the source directory to
|
|
@@ -17,6 +18,21 @@ your \`LUA_PATH\`:
|
|
|
17
18
|
export LUA_PATH="path/to/lua/?.lua;path/to/lua/?/init.lua;;"
|
|
18
19
|
\`\`\`
|
|
19
20
|
|
|
21
|
+
`)
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Publish pending: not yet on LuaRocks. Install from the git release tag,
|
|
26
|
+
// or add the source directory to LUA_PATH.
|
|
27
|
+
const { releasesUrl } = repoInfo(model)
|
|
28
|
+
Content(`This package is not yet published to LuaRocks. Install it from the
|
|
29
|
+
GitHub release tag (\`${target.name}/vX.Y.Z\`, see [Releases](${releasesUrl})),
|
|
30
|
+
or add the source directory to your \`LUA_PATH\`:
|
|
31
|
+
|
|
32
|
+
\`\`\`bash
|
|
33
|
+
export LUA_PATH="path/to/lua/?.lua;path/to/lua/?/init.lua;;"
|
|
34
|
+
\`\`\`
|
|
35
|
+
|
|
20
36
|
`)
|
|
21
37
|
})
|
|
22
38
|
|
|
@@ -1,13 +1,50 @@
|
|
|
1
1
|
|
|
2
2
|
import { cmp, Content } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
|
+
import {
|
|
5
|
+
KIT,
|
|
6
|
+
getModelPath,
|
|
7
|
+
nom,
|
|
8
|
+
} from '@voxgig/apidef'
|
|
9
|
+
|
|
4
10
|
|
|
5
11
|
const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
|
|
6
12
|
const { target, ctx$: { model } } = props
|
|
13
|
+
const info = (model.main && model.main.kit && model.main.kit.info) || {}
|
|
14
|
+
const tagline = info.tagline || ''
|
|
15
|
+
|
|
16
|
+
// Derive a real entity accessor from the model for the semantic-entity
|
|
17
|
+
// note (fall back to a generic name if the model has no entities).
|
|
18
|
+
const entity = getModelPath(model, `main.${KIT}.entity`) || {}
|
|
19
|
+
const exampleEntity = Object.values(entity).find((e: any) => e && e.active !== false) as any
|
|
20
|
+
const eName = exampleEntity ? nom(exampleEntity, 'Name') : 'Entity'
|
|
21
|
+
|
|
22
|
+
// Model-driven op list — only the operations the active entities actually
|
|
23
|
+
// expose (a read-only entity has just list+load); never claim
|
|
24
|
+
// create/update/remove exist when no entity has them.
|
|
25
|
+
const CANON_OPS = ['list', 'load', 'create', 'update', 'remove']
|
|
26
|
+
const opSet = new Set<string>()
|
|
27
|
+
Object.values(entity || {}).forEach((e: any) => {
|
|
28
|
+
if (!e || e.active === false) return
|
|
29
|
+
Object.keys(e.op || {}).forEach((o: string) => {
|
|
30
|
+
if (e.op[o] && e.op[o].active !== false) opSet.add(o)
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
const opNames = CANON_OPS.filter((o) => opSet.has(o))
|
|
34
|
+
.concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
|
|
35
|
+
const opList = (opNames.length ? opNames : ['list', 'load'])
|
|
36
|
+
.map((o) => '`' + o + '`').join(', ')
|
|
7
37
|
|
|
8
38
|
Content(`# ${model.Name} ${target.title} SDK
|
|
9
39
|
|
|
10
|
-
|
|
40
|
+
${tagline}
|
|
41
|
+
|
|
42
|
+
The ${target.title} SDK for the ${model.Name} API — an entity-oriented client using Lua conventions.
|
|
43
|
+
|
|
44
|
+
It exposes the API as capitalised, semantic **Entities** — e.g. \`client:${eName}()\` — each with the same small set of operations (${opList}) instead of raw URL paths and query strings. You call meaning, not endpoints, which keeps the cognitive load low.
|
|
45
|
+
|
|
46
|
+
> Other languages, the CLI, and MCP server live alongside this one — see
|
|
47
|
+
> the [top-level README](../README.md).
|
|
11
48
|
|
|
12
49
|
`)
|
|
13
50
|
})
|