@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
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
// Typed-model generator (JavaScript target).
|
|
4
|
+
//
|
|
5
|
+
// JavaScript is dynamically typed, so the "types" are JSDoc typedefs
|
|
6
|
+
// (@typedef / @property) for editor/tooling DX only — no runtime effect.
|
|
7
|
+
//
|
|
8
|
+
// Reads main.<KIT>.entity.<e>.fields[] and per-op params
|
|
9
|
+
// (op.<name>.points[].args.params[]) and emits one file, src/<Sdk>Types.js,
|
|
10
|
+
// with a `@typedef {Object} <Name>` per active entity plus a request/match
|
|
11
|
+
// typedef per active op. Field/param sentinels ($STRING, $INTEGER, ...) are
|
|
12
|
+
// turned into JSDoc types by the shared sdkgen helper `canonToType`
|
|
13
|
+
// ('js' column: Object / Array / * for open shapes).
|
|
14
|
+
//
|
|
15
|
+
// The typedefs are emitted at file (script) scope so they are GLOBAL across
|
|
16
|
+
// the SDK's JS program — the op fragments reference them by bare name
|
|
17
|
+
// (@param {AdviceLoadMatch} / @returns {Promise<Advice>}). Keeps the SAME
|
|
18
|
+
// type-name scheme as the TS reference (<Name>, <Name>LoadMatch,
|
|
19
|
+
// <Name>ListMatch, <Name>CreateData, <Name>UpdateData, <Name>RemoveMatch).
|
|
20
|
+
|
|
21
|
+
import {
|
|
22
|
+
cmp, each,
|
|
23
|
+
File, Content,
|
|
24
|
+
} from '@voxgig/sdkgen'
|
|
25
|
+
|
|
26
|
+
import { canonToType, opTypeName, opRequestShape } from '@voxgig/sdkgen'
|
|
27
|
+
|
|
28
|
+
import {
|
|
29
|
+
KIT,
|
|
30
|
+
getModelPath,
|
|
31
|
+
} from '@voxgig/apidef'
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const LANG = 'js'
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
// A bare JSDoc property key, or a quoted string literal for anything that is
|
|
38
|
+
// not a plain identifier.
|
|
39
|
+
function propKey(name: string): string {
|
|
40
|
+
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) ? name : JSON.stringify(name)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
const EntityTypes = cmp(function EntityTypes(props: any) {
|
|
45
|
+
const { model } = props.ctx$
|
|
46
|
+
|
|
47
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
48
|
+
const entityList = each(entity).filter((e: any) => e.active !== false)
|
|
49
|
+
|
|
50
|
+
File({ name: model.const.Name + 'Types.' + LANG }, () => {
|
|
51
|
+
|
|
52
|
+
Content(`// Typed models for the ${model.const.Name} SDK (JSDoc typedefs).
|
|
53
|
+
//
|
|
54
|
+
// GENERATED from the API model: main.${KIT}.entity.<e>.fields[] and per-op
|
|
55
|
+
// params (op.<name>.points[].args.params[]). Field/param types come from the
|
|
56
|
+
// canonical type sentinels via @voxgig/sdkgen canonToType (source of truth:
|
|
57
|
+
// @voxgig/apidef VALID_CANON). Annotations only — no runtime effect. Do not
|
|
58
|
+
// edit by hand.
|
|
59
|
+
|
|
60
|
+
`)
|
|
61
|
+
|
|
62
|
+
entityList.forEach((ent: any) => {
|
|
63
|
+
const Name = ent.Name
|
|
64
|
+
const fields = (ent.fields ? each(ent.fields) : [])
|
|
65
|
+
.filter((f: any) => f.active !== false)
|
|
66
|
+
|
|
67
|
+
// Entity data model: one @property per field, `req:false` -> optional [].
|
|
68
|
+
Content(`/**
|
|
69
|
+
* @typedef {Object} ${Name}
|
|
70
|
+
`)
|
|
71
|
+
fields.forEach((f: any) => {
|
|
72
|
+
const key = false === f.req ? '[' + propKey(f.name) + ']' : propKey(f.name)
|
|
73
|
+
Content(` * @property {${canonToType(f.type, LANG)}} ${key}
|
|
74
|
+
`)
|
|
75
|
+
})
|
|
76
|
+
Content(` */
|
|
77
|
+
|
|
78
|
+
`)
|
|
79
|
+
|
|
80
|
+
// Per active op: a request/match typedef. Members and their optionality
|
|
81
|
+
// come from the shared partiality policy (opRequestShape); this file only
|
|
82
|
+
// renders them as JSDoc @property lines (optional -> [bracketed] key).
|
|
83
|
+
const ops = ent.op || {}
|
|
84
|
+
;['load', 'list', 'create', 'update', 'remove'].forEach((opname: string) => {
|
|
85
|
+
if (null == ops[opname]) {
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const typeName = opTypeName(Name, opname)
|
|
90
|
+
const { items } = opRequestShape(ent, opname)
|
|
91
|
+
|
|
92
|
+
Content(`/**
|
|
93
|
+
* @typedef {Object} ${typeName}
|
|
94
|
+
`)
|
|
95
|
+
items.forEach((it: any) => {
|
|
96
|
+
const key = it.optional ? '[' + propKey(it.name) + ']' : propKey(it.name)
|
|
97
|
+
Content(` * @property {${canonToType(it.type, LANG)}} ${key}
|
|
98
|
+
`)
|
|
99
|
+
})
|
|
100
|
+
Content(` */
|
|
101
|
+
|
|
102
|
+
`)
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
export {
|
|
110
|
+
EntityTypes,
|
|
111
|
+
}
|
|
@@ -7,6 +7,7 @@ const MainEntity = cmp(async function MainEntity(props: any) {
|
|
|
7
7
|
const { entity } = props
|
|
8
8
|
|
|
9
9
|
Content(`
|
|
10
|
+
// Entity access: \`client.${entity.Name}().list()\` / \`client.${entity.Name}().load({ id })\`.
|
|
10
11
|
${entity.Name}(data) {
|
|
11
12
|
const self = this
|
|
12
13
|
return new ${entity.Name}Entity(self,data)
|
|
@@ -24,6 +24,7 @@ import { Gitignore } from './Gitignore_js'
|
|
|
24
24
|
import { MainEntity } from './MainEntity_js'
|
|
25
25
|
import { SdkError } from './SdkError_js'
|
|
26
26
|
import { EntityBase } from './EntityBase_js'
|
|
27
|
+
import { EntityTypes } from './EntityTypes_js'
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
const Main = cmp(async function Main(props: any) {
|
|
@@ -101,6 +102,8 @@ if (fres instanceof Promise) { await fres }
|
|
|
101
102
|
|
|
102
103
|
EntityBase({ target })
|
|
103
104
|
|
|
105
|
+
EntityTypes({ target })
|
|
106
|
+
|
|
104
107
|
})
|
|
105
108
|
})
|
|
106
109
|
|
|
@@ -5,6 +5,12 @@ import {
|
|
|
5
5
|
cmp,
|
|
6
6
|
each,
|
|
7
7
|
omap,
|
|
8
|
+
packageName,
|
|
9
|
+
pkgDescription,
|
|
10
|
+
keywords,
|
|
11
|
+
repoInfo,
|
|
12
|
+
PUBLISHER,
|
|
13
|
+
PUBLISHER_URL,
|
|
8
14
|
} from '@voxgig/sdkgen'
|
|
9
15
|
|
|
10
16
|
|
|
@@ -43,16 +49,19 @@ const Package = cmp(async function Package(props: any) {
|
|
|
43
49
|
dev: only('dev', target.deps),
|
|
44
50
|
})
|
|
45
51
|
|
|
46
|
-
const sdkname = model.name
|
|
47
52
|
const SdkName = nom(model, 'Name')
|
|
48
|
-
const
|
|
49
|
-
const sdknamesuffix = model.origin?.endsWith('-sdk') ? '' : '-sdk'
|
|
53
|
+
const { repoUrl, issuesUrl } = repoInfo(model)
|
|
50
54
|
|
|
51
|
-
// TODO: complete SDK meta data in model and use here
|
|
52
55
|
const pkg = {
|
|
53
|
-
name
|
|
56
|
+
// The ts target publishes the canonical scoped npm name; the js target
|
|
57
|
+
// appends `-js` so the two never collide on npm.
|
|
58
|
+
name: packageName(model, 'js'),
|
|
54
59
|
version: `0.0.1`,
|
|
55
|
-
description:
|
|
60
|
+
description: pkgDescription(model, target.name),
|
|
61
|
+
keywords: keywords(model),
|
|
62
|
+
homepage: `${repoUrl}#readme`,
|
|
63
|
+
repository: { type: 'git', url: `git+${repoUrl}.git` },
|
|
64
|
+
bugs: { url: issuesUrl },
|
|
56
65
|
main: `src/${SdkName}SDK.js`,
|
|
57
66
|
type: 'commonjs',
|
|
58
67
|
scripts: {
|
|
@@ -64,7 +73,7 @@ const Package = cmp(async function Package(props: any) {
|
|
|
64
73
|
"clean": "rm -rf node_modules yarn.lock package-lock.json",
|
|
65
74
|
"reset": "npm run clean && npm i && npm test",
|
|
66
75
|
},
|
|
67
|
-
author:
|
|
76
|
+
author: { name: PUBLISHER, url: PUBLISHER_URL },
|
|
68
77
|
|
|
69
78
|
// TODO: needs to be config
|
|
70
79
|
license: 'MIT',
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, entityIdField, safeVarName } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
6
6
|
getModelPath,
|
|
7
7
|
} from '@voxgig/apidef'
|
|
8
8
|
|
|
9
|
+
import { exampleValue } from './utility_js'
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
// Operation method spelling differs between Go and other languages — Go
|
|
11
13
|
// uses PascalCase methods with explicit ctrl arg, others use lowercase
|
|
@@ -41,6 +43,10 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
|
|
|
41
43
|
publishedEntities.map((entity: any) => {
|
|
42
44
|
const opnames = Object.keys(entity.op || {})
|
|
43
45
|
const fields = entity.fields || []
|
|
46
|
+
// Model-driven id key: null when this entity has no id-like field.
|
|
47
|
+
const idF = entityIdField(entity)
|
|
48
|
+
// Variable-safe lowercase name (a `Delete` entity must not bind `delete`).
|
|
49
|
+
const eVar = safeVarName(entity.name, 'js')
|
|
44
50
|
|
|
45
51
|
Content(`
|
|
46
52
|
### ${entity.Name}
|
|
@@ -53,7 +59,7 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
|
|
|
53
59
|
`)
|
|
54
60
|
}
|
|
55
61
|
|
|
56
|
-
Content(`Create an instance: \`const ${
|
|
62
|
+
Content(`Create an instance: \`const ${eVar} = client.${entity.Name}()\`
|
|
57
63
|
|
|
58
64
|
`)
|
|
59
65
|
|
|
@@ -84,7 +90,7 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
|
|
|
84
90
|
|
|
85
91
|
each(fields, (field: any) => {
|
|
86
92
|
const desc = field.short || ''
|
|
87
|
-
Content(`| \`${field.name}\` | \`${field.type
|
|
93
|
+
Content(`| \`${field.name}\` | \`${canonToType(field.type, target.name)}\` | ${desc} |
|
|
88
94
|
`)
|
|
89
95
|
})
|
|
90
96
|
|
|
@@ -96,7 +102,7 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
|
|
|
96
102
|
Content(`#### Example: Load
|
|
97
103
|
|
|
98
104
|
\`\`\`ts
|
|
99
|
-
const ${
|
|
105
|
+
const ${eVar} = await client.${entity.Name}().load(${idF ? `{ ${idF}: ${exampleValue(entity, entity.op && entity.op.load, idF, entity.name + '_id')} }` : ''})
|
|
100
106
|
\`\`\`
|
|
101
107
|
|
|
102
108
|
`)
|
|
@@ -106,7 +112,7 @@ const ${entity.name} = await client.${entity.Name}().load({ id: '${entity.name}_
|
|
|
106
112
|
Content(`#### Example: List
|
|
107
113
|
|
|
108
114
|
\`\`\`ts
|
|
109
|
-
const ${
|
|
115
|
+
const ${eVar}s = await client.${entity.Name}().list()
|
|
110
116
|
\`\`\`
|
|
111
117
|
|
|
112
118
|
`)
|
|
@@ -116,11 +122,11 @@ const ${entity.name}s = await client.${entity.Name}().list()
|
|
|
116
122
|
Content(`#### Example: Create
|
|
117
123
|
|
|
118
124
|
\`\`\`ts
|
|
119
|
-
const ${
|
|
125
|
+
const ${eVar} = await client.${entity.Name}().create({
|
|
120
126
|
`)
|
|
121
127
|
each(fields, (field: any) => {
|
|
122
128
|
if ('id' !== field.name && field.req) {
|
|
123
|
-
Content(` ${field.name}: /* ${field.type
|
|
129
|
+
Content(` ${field.name}: /* ${canonToType(field.type, target.name)} */,
|
|
124
130
|
`)
|
|
125
131
|
}
|
|
126
132
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, packageName } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
const ReadmeExplanation = cmp(function ReadmeExplanation(props: any) {
|
|
@@ -20,7 +20,7 @@ ${model.name}/
|
|
|
20
20
|
Import the SDK from the package root:
|
|
21
21
|
|
|
22
22
|
\`\`\`js
|
|
23
|
-
const { ${model.Name}SDK } = require('${model.name}')
|
|
23
|
+
const { ${model.Name}SDK } = require('${packageName(model, target.name)}')
|
|
24
24
|
\`\`\`
|
|
25
25
|
|
|
26
26
|
`)
|
|
@@ -1,21 +1,59 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, entityIdField, entityDataIdField, entityPrimaryOp, opRequestShape, safeVarName } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
6
6
|
getModelPath,
|
|
7
|
+
nom,
|
|
7
8
|
} from '@voxgig/apidef'
|
|
8
9
|
|
|
10
|
+
import { exampleValue } from './utility_js'
|
|
11
|
+
|
|
9
12
|
|
|
10
13
|
const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
|
|
11
14
|
const { target, ctx$: { model } } = props
|
|
12
15
|
|
|
16
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
17
|
+
const exampleEntity = Object.values(entity || {}).find((e: any) => e && e.active !== false) as any
|
|
18
|
+
const eName = exampleEntity ? nom(exampleEntity, 'Name') : 'Entity'
|
|
19
|
+
const eVar = safeVarName(eName.toLowerCase(), 'js')
|
|
20
|
+
|
|
21
|
+
// Drive the test-mode / stateful examples off the entity's PRIMARY op — an op
|
|
22
|
+
// it actually exposes — never a hardcoded `load` a create-only entity lacks.
|
|
23
|
+
const primaryOp = exampleEntity ? (entityPrimaryOp(exampleEntity) || 'load') : 'load'
|
|
24
|
+
const primaryOpDef = exampleEntity && exampleEntity.op && exampleEntity.op[primaryOp]
|
|
25
|
+
const isMatchOp = 'load' === primaryOp || 'remove' === primaryOp
|
|
26
|
+
// idF is the MATCH key; dataIdF is the id on the RETURNED record's data type
|
|
27
|
+
// (guard `.id` reads off a returned record on this, not the match key).
|
|
28
|
+
const idF = exampleEntity ? entityIdField(exampleEntity) : null
|
|
29
|
+
const dataIdF = exampleEntity ? entityDataIdField(exampleEntity) : null
|
|
30
|
+
|
|
31
|
+
const primaryArg = (idPlaceholder: string): string => {
|
|
32
|
+
if (!exampleEntity) return ''
|
|
33
|
+
if ('list' === primaryOp) return ''
|
|
34
|
+
if (isMatchOp) {
|
|
35
|
+
return idF ? `{ ${idF}: ${exampleValue(exampleEntity, primaryOpDef, idF, idPlaceholder)} }` : ''
|
|
36
|
+
}
|
|
37
|
+
const items = opRequestShape(exampleEntity, primaryOp).items
|
|
38
|
+
.filter((it: any) => it.name !== idF && it.name !== 'id')
|
|
39
|
+
const required = items.filter((it: any) => !it.optional)
|
|
40
|
+
const chosen = required.length ? required : items.slice(0, 3)
|
|
41
|
+
const pairs = chosen.map((it: any) =>
|
|
42
|
+
`${it.name}: ${exampleValue(exampleEntity, primaryOpDef, it.name, 'example_' + it.name)}`)
|
|
43
|
+
return `{ ${pairs.join(', ')} }`
|
|
44
|
+
}
|
|
45
|
+
const testCallArg = primaryArg('test01')
|
|
46
|
+
const stateCallArg = primaryArg('example')
|
|
47
|
+
const stateDataLine = dataIdF
|
|
48
|
+
? `console.log(data.${dataIdF})`
|
|
49
|
+
: `console.log(data)`
|
|
50
|
+
|
|
13
51
|
const authActive = isAuthActive(model)
|
|
14
52
|
const apikeyTesterCtor = authActive
|
|
15
53
|
? `new ${model.const.Name}SDK({ apikey: '...' })`
|
|
16
54
|
: `new ${model.const.Name}SDK()`
|
|
17
55
|
const apikeyExtendField = authActive ? `\n apikey: '...',` : ''
|
|
18
|
-
const apikeyEnvLine = authActive ? `\n${model
|
|
56
|
+
const apikeyEnvLine = authActive ? `\n${envName(model)}_APIKEY=<your-key>` : ''
|
|
19
57
|
|
|
20
58
|
Content(`### Make a direct HTTP request
|
|
21
59
|
|
|
@@ -28,6 +66,9 @@ const result = await client.direct({
|
|
|
28
66
|
params: { id: 'example' },
|
|
29
67
|
})
|
|
30
68
|
|
|
69
|
+
if (result instanceof Error) {
|
|
70
|
+
throw result
|
|
71
|
+
}
|
|
31
72
|
if (result.ok) {
|
|
32
73
|
console.log(result.status) // 200
|
|
33
74
|
console.log(result.data) // response body
|
|
@@ -56,9 +97,9 @@ Create a mock client for unit testing — no server required:
|
|
|
56
97
|
\`\`\`js
|
|
57
98
|
const client = ${model.const.Name}SDK.test()
|
|
58
99
|
|
|
59
|
-
const
|
|
60
|
-
//
|
|
61
|
-
|
|
100
|
+
const ${eVar} = await client.${eName}().${primaryOp}(${testCallArg})
|
|
101
|
+
// ${eVar} is a bare entity populated with mock response data
|
|
102
|
+
console.log(${eVar})
|
|
62
103
|
\`\`\`
|
|
63
104
|
|
|
64
105
|
You can also use the instance method:
|
|
@@ -73,14 +114,14 @@ const testClient = client.tester()
|
|
|
73
114
|
Entity instances remember their last match and data:
|
|
74
115
|
|
|
75
116
|
\`\`\`js
|
|
76
|
-
const entity = client
|
|
117
|
+
const entity = client.${eName}()
|
|
77
118
|
|
|
78
|
-
// First call
|
|
79
|
-
await entity
|
|
119
|
+
// First call runs the operation and stores its result
|
|
120
|
+
await entity.${primaryOp}(${stateCallArg})
|
|
80
121
|
|
|
81
|
-
// Subsequent calls reuse the stored
|
|
122
|
+
// Subsequent calls reuse the stored state
|
|
82
123
|
const data = entity.data()
|
|
83
|
-
|
|
124
|
+
${stateDataLine}
|
|
84
125
|
\`\`\`
|
|
85
126
|
|
|
86
127
|
### Add custom middleware
|
|
@@ -109,7 +150,7 @@ const client = new ${model.const.Name}SDK({${apikeyExtendField}
|
|
|
109
150
|
Create a \`.env.local\` file at the project root:
|
|
110
151
|
|
|
111
152
|
\`\`\`
|
|
112
|
-
${model
|
|
153
|
+
${envName(model)}_TEST_LIVE=TRUE${apikeyEnvLine}
|
|
113
154
|
\`\`\`
|
|
114
155
|
|
|
115
156
|
Then run:
|
|
@@ -1,13 +1,51 @@
|
|
|
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
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
17
|
+
const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
|
|
18
|
+
const eName = exampleEntity ? nom(exampleEntity, 'Name') : 'Entity'
|
|
19
|
+
|
|
20
|
+
// Model-driven op list — only the operations the active entities actually
|
|
21
|
+
// expose (a read-only entity has just list+load); never claim
|
|
22
|
+
// create/update/remove exist when no entity has them.
|
|
23
|
+
const CANON_OPS = ['list', 'load', 'create', 'update', 'remove']
|
|
24
|
+
const opSet = new Set<string>()
|
|
25
|
+
Object.values(entity || {}).forEach((e: any) => {
|
|
26
|
+
if (!e || e.active === false) return
|
|
27
|
+
Object.keys(e.op || {}).forEach((o: string) => {
|
|
28
|
+
if (e.op[o] && e.op[o].active !== false) opSet.add(o)
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
const opNames = CANON_OPS.filter((o) => opSet.has(o))
|
|
32
|
+
.concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
|
|
33
|
+
const opList = (opNames.length ? opNames : ['list', 'load'])
|
|
34
|
+
.map((o) => '`' + o + '`').join(', ')
|
|
7
35
|
|
|
8
36
|
Content(`# ${model.Name} ${target.title} SDK
|
|
9
37
|
|
|
10
|
-
|
|
38
|
+
${tagline}
|
|
39
|
+
|
|
40
|
+
The ${target.title} SDK for the ${model.Name} API — an entity-oriented client with full async/await support.
|
|
41
|
+
|
|
42
|
+
The API is exposed as capitalised, semantic **Entities** — e.g.
|
|
43
|
+
\`client.${eName}()\` — each with a small set of operations (${opList})
|
|
44
|
+
instead of raw URL paths and query parameters. This keeps the surface
|
|
45
|
+
predictable and low-friction for both humans and AI agents.
|
|
46
|
+
|
|
47
|
+
> Other languages, the CLI, and MCP server live alongside this one — see
|
|
48
|
+
> the [top-level README](../README.md).
|
|
11
49
|
|
|
12
50
|
`)
|
|
13
51
|
})
|
|
@@ -13,6 +13,43 @@ const ReadmeModel = cmp(function ReadmeModel(props: any) {
|
|
|
13
13
|
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
14
14
|
const entityList = each(entity).filter((e: any) => e.active !== false)
|
|
15
15
|
|
|
16
|
+
// Model-driven op rows for the shared entity interface: emit a
|
|
17
|
+
// load/list/create/update/remove row only for operations at least one active
|
|
18
|
+
// entity actually exposes (a read-only entity has just list+load) — never
|
|
19
|
+
// document an operation no entity has.
|
|
20
|
+
const opUnion = new Set<string>()
|
|
21
|
+
entityList.forEach((e: any) => Object.keys(e.op || {})
|
|
22
|
+
.forEach((o: string) => { if (e.op[o] && e.op[o].active !== false) opUnion.add(o) }))
|
|
23
|
+
const opRowDefs: Record<string, string> = {
|
|
24
|
+
load: '| `load` | `load(reqmatch?, ctrl?): Promise<Entity>` | Load a single entity by match criteria. |',
|
|
25
|
+
list: '| `list` | `list(reqmatch?, ctrl?): Promise<Entity[]>` | List entities matching the criteria. |',
|
|
26
|
+
create: '| `create` | `create(reqdata?, ctrl?): Promise<Entity>` | Create a new entity. |',
|
|
27
|
+
update: '| `update` | `update(reqdata?, ctrl?): Promise<Entity>` | Update an existing entity. |',
|
|
28
|
+
remove: '| `remove` | `remove(reqmatch?, ctrl?): Promise<void>` | Remove an entity. |',
|
|
29
|
+
}
|
|
30
|
+
const opRows = ['load', 'list', 'create', 'update', 'remove']
|
|
31
|
+
.filter((o) => opUnion.has(o)).map((o) => opRowDefs[o]).join('\n')
|
|
32
|
+
|
|
33
|
+
// Model-driven return-value bullets: describe only the operations that
|
|
34
|
+
// actually exist (single-object ops among load/create/update, plus
|
|
35
|
+
// list/remove) — never document return semantics for a missing op.
|
|
36
|
+
const singleOps = ['load', 'create', 'update'].filter((o) => opUnion.has(o))
|
|
37
|
+
.map((o) => '`' + o + '`')
|
|
38
|
+
const retBullets: string[] = []
|
|
39
|
+
if (singleOps.length) {
|
|
40
|
+
const joined = singleOps.length > 1
|
|
41
|
+
? singleOps.slice(0, -1).join(', ') + ' and ' + singleOps[singleOps.length - 1]
|
|
42
|
+
: singleOps[0]
|
|
43
|
+
retBullets.push(`- ${joined} ${singleOps.length > 1 ? 'resolve' : 'resolves'} to a single entity object.`)
|
|
44
|
+
}
|
|
45
|
+
if (opUnion.has('list')) {
|
|
46
|
+
retBullets.push('- `list` resolves to an **array** of entity objects (iterate it directly;\n there is no `.data` and no `.ok`).')
|
|
47
|
+
}
|
|
48
|
+
if (opUnion.has('remove')) {
|
|
49
|
+
retBullets.push('- `remove` resolves to `undefined`.')
|
|
50
|
+
}
|
|
51
|
+
const returnBullets = retBullets.join('\n')
|
|
52
|
+
|
|
16
53
|
const apikeyOptionRow = isAuthActive(model)
|
|
17
54
|
? '| `apikey` | `string` | API key for authentication. |\n'
|
|
18
55
|
: ''
|
|
@@ -44,7 +81,8 @@ ${apikeyOptionRow}| \`base\` | \`string\` | Base URL of the API server. |
|
|
|
44
81
|
`)
|
|
45
82
|
|
|
46
83
|
each(entityList, (ent: any) => {
|
|
47
|
-
|
|
84
|
+
const article = /^[aeiou]/i.test(ent.Name) ? 'an' : 'a'
|
|
85
|
+
Content(`| \`${ent.Name}(data?)\` | \`${ent.Name}Entity\` | Create ${article} ${ent.Name} entity instance. |
|
|
48
86
|
`)
|
|
49
87
|
})
|
|
50
88
|
|
|
@@ -64,29 +102,23 @@ All entities share the same interface.
|
|
|
64
102
|
|
|
65
103
|
| Method | Signature | Description |
|
|
66
104
|
| --- | --- | --- |
|
|
67
|
-
|
|
68
|
-
| \`
|
|
69
|
-
| \`
|
|
70
|
-
| \`update\` | \`update(reqdata?, ctrl?): Promise<Result>\` | Update an existing entity. |
|
|
71
|
-
| \`remove\` | \`remove(reqmatch?, ctrl?): Promise<Result>\` | Remove an entity. |
|
|
72
|
-
| \`data\` | \`data(data?): any\` | Get or set entity data. |
|
|
73
|
-
| \`match\` | \`match(match?): any\` | Get or set entity match criteria. |
|
|
105
|
+
${opRows}
|
|
106
|
+
| \`data\` | \`data(data?: Partial<Entity>): Entity\` | Get or set entity data. |
|
|
107
|
+
| \`match\` | \`match(match?: Partial<Entity>): Partial<Entity>\` | Get or set entity match criteria. |
|
|
74
108
|
| \`make\` | \`make(): Entity\` | Create a new instance with the same options. |
|
|
75
109
|
| \`client\` | \`client(): ${model.const.Name}SDK\` | Return the parent SDK client. |
|
|
76
110
|
| \`entopts\` | \`entopts(): object\` | Return a copy of the entity options. |
|
|
77
111
|
|
|
78
|
-
####
|
|
112
|
+
#### Return values
|
|
79
113
|
|
|
80
|
-
|
|
114
|
+
Entity operations resolve to the entity data directly — there is no
|
|
115
|
+
result envelope:
|
|
81
116
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
data: {} // parsed JSON response body
|
|
88
|
-
}
|
|
89
|
-
\`\`\`
|
|
117
|
+
${returnBullets}
|
|
118
|
+
|
|
119
|
+
On a failed request these methods **throw**, so wrap calls in
|
|
120
|
+
\`try\`/\`catch\` to handle errors. Only \`direct()\` returns the result
|
|
121
|
+
envelope described below.
|
|
90
122
|
|
|
91
123
|
### DirectResult shape
|
|
92
124
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, envName, isAuthActive } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
const ReadmeOptions = cmp(function ReadmeOptions(props: any) {
|
|
6
6
|
const { target } = props
|
|
7
7
|
const { model } = props.ctx$
|
|
8
8
|
|
|
9
|
-
const publishedOptions = each(target.options).filter((option: any) =>
|
|
9
|
+
const publishedOptions = each(target.options).filter((option: any) =>
|
|
10
|
+
option.publish && ('apikey' !== option.name || isAuthActive(model)))
|
|
10
11
|
if (0 === publishedOptions.length) {
|
|
11
12
|
return
|
|
12
13
|
}
|
|
@@ -25,7 +26,7 @@ const client = new ${model.Name}SDK({
|
|
|
25
26
|
|
|
26
27
|
publishedOptions.map((option: any) => {
|
|
27
28
|
if ('apikey' === option.name) {
|
|
28
|
-
Content(` ${option.name}: process.env.${model
|
|
29
|
+
Content(` ${option.name}: process.env.${envName(model)}_APIKEY,
|
|
29
30
|
`)
|
|
30
31
|
}
|
|
31
32
|
else {
|