@voxgig/sdkgen 0.35.2 → 0.36.0
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 +1 -1
- package/dist/cmp/Readme.js +5 -5
- package/dist/cmp/Readme.js.map +1 -1
- package/dist/cmp/ReadmeEntity.js +74 -24
- package/dist/cmp/ReadmeEntity.js.map +1 -1
- package/dist/cmp/ReadmeExplanation.d.ts +2 -0
- package/dist/cmp/ReadmeExplanation.js +308 -0
- package/dist/cmp/ReadmeExplanation.js.map +1 -0
- package/dist/cmp/ReadmeHowto.d.ts +2 -0
- package/dist/cmp/ReadmeHowto.js +18 -0
- package/dist/cmp/ReadmeHowto.js.map +1 -0
- package/dist/cmp/ReadmeIntro.js +8 -23
- package/dist/cmp/ReadmeIntro.js.map +1 -1
- package/dist/cmp/ReadmeModel.js +55 -91
- package/dist/cmp/ReadmeModel.js.map +1 -1
- package/dist/cmp/ReadmeOptions.js +35 -11
- package/dist/cmp/ReadmeOptions.js.map +1 -1
- package/dist/cmp/ReadmeQuick.js +4 -1
- package/dist/cmp/ReadmeQuick.js.map +1 -1
- package/dist/cmp/ReadmeRef.js +1042 -40
- package/dist/cmp/ReadmeRef.js.map +1 -1
- package/dist/cmp/ReadmeTop.d.ts +2 -0
- package/dist/cmp/ReadmeTop.js +171 -0
- package/dist/cmp/ReadmeTop.js.map +1 -0
- package/dist/sdkgen.d.ts +7 -1
- package/dist/sdkgen.js +13 -1
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/project/.sdk/model/feature/feature-index.jsonic +5 -0
- package/project/.sdk/model/feature/log.jsonic +5 -1
- package/project/.sdk/model/feature/test.jsonic +1 -1
- package/project/.sdk/model/target/lua.jsonic +23 -0
- package/project/.sdk/model/target/php.jsonic +22 -0
- package/project/.sdk/model/target/py.jsonic +23 -0
- package/project/.sdk/model/target/rb.jsonic +23 -0
- package/project/.sdk/src/cmp/go/Main_go.ts +2 -6
- package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +42 -0
- package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +112 -0
- package/project/.sdk/src/cmp/go/ReadmeInstall_go.ts +29 -0
- package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +129 -0
- package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +163 -0
- package/project/.sdk/src/cmp/go/ReadmeTopHowto_go.ts +24 -0
- package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +67 -0
- package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +40 -0
- package/project/.sdk/src/cmp/go/TestDirect_go.ts +46 -2
- package/project/.sdk/src/cmp/go/TestEntity_go.ts +360 -160
- package/project/.sdk/src/cmp/go/Test_go.ts +24 -1
- package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +1 -1
- package/project/.sdk/src/cmp/lua/Config_lua.ts +112 -0
- package/project/.sdk/src/cmp/lua/EntityOperation_lua.ts +44 -0
- package/project/.sdk/src/cmp/lua/Entity_lua.ts +62 -0
- package/project/.sdk/src/cmp/lua/MainEntity_lua.ts +23 -0
- package/project/.sdk/src/cmp/lua/Main_lua.ts +133 -0
- package/project/.sdk/src/cmp/lua/Package_lua.ts +80 -0
- package/project/.sdk/src/cmp/lua/ReadmeExplanation_lua.ts +42 -0
- package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +100 -0
- package/project/.sdk/src/cmp/lua/ReadmeInstall_lua.ts +26 -0
- package/project/.sdk/src/cmp/lua/ReadmeModel_lua.ts +129 -0
- package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +99 -0
- package/project/.sdk/src/cmp/lua/ReadmeTopHowto_lua.ts +24 -0
- package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +55 -0
- package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +38 -0
- package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +261 -0
- package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +483 -0
- package/project/.sdk/src/cmp/lua/Test_lua.ts +49 -0
- package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +147 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityCreateOp.fragment.lua +27 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityListOp.fragment.lua +24 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityLoadOp.fragment.lua +30 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityRemoveOp.fragment.lua +30 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityUpdateOp.fragment.lua +30 -0
- package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +256 -0
- package/project/.sdk/src/cmp/lua/fragment/SdkError.fragment.lua +26 -0
- package/project/.sdk/src/cmp/lua/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/lua/utility_lua.ts +84 -0
- package/project/.sdk/src/cmp/php/Config_php.ts +107 -0
- package/project/.sdk/src/cmp/php/EntityOperation_php.ts +44 -0
- package/project/.sdk/src/cmp/php/Entity_php.ts +62 -0
- package/project/.sdk/src/cmp/php/MainEntity_php.ts +24 -0
- package/project/.sdk/src/cmp/php/Main_php.ts +135 -0
- package/project/.sdk/src/cmp/php/Package_php.ts +87 -0
- package/project/.sdk/src/cmp/php/ReadmeExplanation_php.ts +42 -0
- package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +101 -0
- package/project/.sdk/src/cmp/php/ReadmeInstall_php.ts +19 -0
- package/project/.sdk/src/cmp/php/ReadmeModel_php.ts +129 -0
- package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +100 -0
- package/project/.sdk/src/cmp/php/ReadmeTopHowto_php.ts +24 -0
- package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +56 -0
- package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +38 -0
- package/project/.sdk/src/cmp/php/TestDirect_php.ts +270 -0
- package/project/.sdk/src/cmp/php/TestEntity_php.ts +484 -0
- package/project/.sdk/src/cmp/php/Test_php.ts +56 -0
- package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +146 -0
- package/project/.sdk/src/cmp/php/fragment/EntityCreateOp.fragment.php +26 -0
- package/project/.sdk/src/cmp/php/fragment/EntityListOp.fragment.php +23 -0
- package/project/.sdk/src/cmp/php/fragment/EntityLoadOp.fragment.php +29 -0
- package/project/.sdk/src/cmp/php/fragment/EntityRemoveOp.fragment.php +29 -0
- package/project/.sdk/src/cmp/php/fragment/EntityUpdateOp.fragment.php +29 -0
- package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +233 -0
- package/project/.sdk/src/cmp/php/fragment/SdkError.fragment.php +24 -0
- package/project/.sdk/src/cmp/php/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/php/utility_php.ts +85 -0
- package/project/.sdk/src/cmp/py/Config_py.ts +93 -0
- package/project/.sdk/src/cmp/py/EntityOperation_py.ts +44 -0
- package/project/.sdk/src/cmp/py/Entity_py.ts +62 -0
- package/project/.sdk/src/cmp/py/MainEntity_py.ts +22 -0
- package/project/.sdk/src/cmp/py/Main_py.ts +156 -0
- package/project/.sdk/src/cmp/py/Package_py.ts +75 -0
- package/project/.sdk/src/cmp/py/ReadmeExplanation_py.ts +41 -0
- package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +98 -0
- package/project/.sdk/src/cmp/py/ReadmeInstall_py.ts +25 -0
- package/project/.sdk/src/cmp/py/ReadmeModel_py.ts +130 -0
- package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +100 -0
- package/project/.sdk/src/cmp/py/ReadmeTopHowto_py.ts +24 -0
- package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +56 -0
- package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +38 -0
- package/project/.sdk/src/cmp/py/TestDirect_py.ts +248 -0
- package/project/.sdk/src/cmp/py/TestEntity_py.ts +475 -0
- package/project/.sdk/src/cmp/py/Test_py.ts +55 -0
- package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +112 -0
- package/project/.sdk/src/cmp/py/fragment/EntityCreateOp.fragment.py +25 -0
- package/project/.sdk/src/cmp/py/fragment/EntityListOp.fragment.py +22 -0
- package/project/.sdk/src/cmp/py/fragment/EntityLoadOp.fragment.py +27 -0
- package/project/.sdk/src/cmp/py/fragment/EntityRemoveOp.fragment.py +27 -0
- package/project/.sdk/src/cmp/py/fragment/EntityUpdateOp.fragment.py +27 -0
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +222 -0
- package/project/.sdk/src/cmp/py/fragment/SdkError.fragment.py +16 -0
- package/project/.sdk/src/cmp/py/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/py/utility_py.ts +84 -0
- package/project/.sdk/src/cmp/rb/Config_rb.ts +101 -0
- package/project/.sdk/src/cmp/rb/EntityOperation_rb.ts +44 -0
- package/project/.sdk/src/cmp/rb/Entity_rb.ts +62 -0
- package/project/.sdk/src/cmp/rb/MainEntity_rb.ts +23 -0
- package/project/.sdk/src/cmp/rb/Main_rb.ts +130 -0
- package/project/.sdk/src/cmp/rb/Package_rb.ts +111 -0
- package/project/.sdk/src/cmp/rb/ReadmeExplanation_rb.ts +42 -0
- package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +98 -0
- package/project/.sdk/src/cmp/rb/ReadmeInstall_rb.ts +31 -0
- package/project/.sdk/src/cmp/rb/ReadmeModel_rb.ts +129 -0
- package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +99 -0
- package/project/.sdk/src/cmp/rb/ReadmeTopHowto_rb.ts +24 -0
- package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +55 -0
- package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +38 -0
- package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +260 -0
- package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +476 -0
- package/project/.sdk/src/cmp/rb/Test_rb.ts +50 -0
- package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +116 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityCreateOp.fragment.rb +25 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityListOp.fragment.rb +20 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityLoadOp.fragment.rb +26 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityRemoveOp.fragment.rb +26 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityUpdateOp.fragment.rb +26 -0
- package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +203 -0
- package/project/.sdk/src/cmp/rb/fragment/SdkError.fragment.rb +16 -0
- package/project/.sdk/src/cmp/rb/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/rb/utility_rb.ts +84 -0
- package/project/.sdk/src/cmp/ts/ReadmeExplanation_ts.ts +34 -0
- package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +123 -0
- package/project/.sdk/src/cmp/ts/ReadmeInstall_ts.ts +1 -1
- package/project/.sdk/src/cmp/ts/ReadmeModel_ts.ts +159 -0
- package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +69 -54
- package/project/.sdk/src/cmp/ts/ReadmeTopHowto_ts.ts +25 -0
- package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +65 -0
- package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +36 -0
- package/project/.sdk/tm/go/feature/log_feature.go +133 -0
- package/project/.sdk/tm/go/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/lua/LICENSE +22 -0
- package/project/.sdk/tm/lua/Makefile +10 -0
- package/project/.sdk/tm/lua/core/context.lua +208 -0
- package/project/.sdk/tm/lua/core/control.lua +17 -0
- package/project/.sdk/tm/lua/core/error.lua +30 -0
- package/project/.sdk/tm/lua/core/helpers.lua +30 -0
- package/project/.sdk/tm/lua/core/operation.lua +51 -0
- package/project/.sdk/tm/lua/core/response.lua +45 -0
- package/project/.sdk/tm/lua/core/result.lua +58 -0
- package/project/.sdk/tm/lua/core/spec.lua +29 -0
- package/project/.sdk/tm/lua/core/utility_type.lua +90 -0
- package/project/.sdk/tm/lua/feature/base_feature.lua +35 -0
- package/project/.sdk/tm/lua/feature/log_feature.lua +80 -0
- package/project/.sdk/tm/lua/feature/test_feature.lua +202 -0
- package/project/.sdk/tm/lua/src/feature/README.md +3 -0
- package/project/.sdk/tm/lua/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/lua/test/runner.lua +86 -0
- package/project/.sdk/tm/lua/utility/clean.lua +7 -0
- package/project/.sdk/tm/lua/utility/done.lua +19 -0
- package/project/.sdk/tm/lua/utility/feature_add.lua +8 -0
- package/project/.sdk/tm/lua/utility/feature_hook.lua +21 -0
- package/project/.sdk/tm/lua/utility/feature_init.lua +24 -0
- package/project/.sdk/tm/lua/utility/fetcher.lua +96 -0
- package/project/.sdk/tm/lua/utility/make_context.lua +9 -0
- package/project/.sdk/tm/lua/utility/make_error.lua +73 -0
- package/project/.sdk/tm/lua/utility/make_fetch_def.lua +43 -0
- package/project/.sdk/tm/lua/utility/make_options.lua +116 -0
- package/project/.sdk/tm/lua/utility/make_point.lua +92 -0
- package/project/.sdk/tm/lua/utility/make_request.lua +58 -0
- package/project/.sdk/tm/lua/utility/make_response.lua +44 -0
- package/project/.sdk/tm/lua/utility/make_result.lua +51 -0
- package/project/.sdk/tm/lua/utility/make_spec.lua +72 -0
- package/project/.sdk/tm/lua/utility/make_url.lua +46 -0
- package/project/.sdk/tm/lua/utility/param.lua +68 -0
- package/project/.sdk/tm/lua/utility/prepare_auth.lua +39 -0
- package/project/.sdk/tm/lua/utility/prepare_body.lua +14 -0
- package/project/.sdk/tm/lua/utility/prepare_headers.lua +20 -0
- package/project/.sdk/tm/lua/utility/prepare_method.lua +17 -0
- package/project/.sdk/tm/lua/utility/prepare_params.lua +36 -0
- package/project/.sdk/tm/lua/utility/prepare_path.lua +19 -0
- package/project/.sdk/tm/lua/utility/prepare_query.lua +41 -0
- package/project/.sdk/tm/lua/utility/register.lua +71 -0
- package/project/.sdk/tm/lua/utility/result_basic.lua +32 -0
- package/project/.sdk/tm/lua/utility/result_body.lua +17 -0
- package/project/.sdk/tm/lua/utility/result_headers.lua +22 -0
- package/project/.sdk/tm/lua/utility/struct/struct.lua +3417 -0
- package/project/.sdk/tm/lua/utility/transform_request.lua +31 -0
- package/project/.sdk/tm/lua/utility/transform_response.lua +44 -0
- package/project/.sdk/tm/php/LICENSE +22 -0
- package/project/.sdk/tm/php/Makefile +10 -0
- package/project/.sdk/tm/php/core/Context.php +139 -0
- package/project/.sdk/tm/php/core/Control.php +18 -0
- package/project/.sdk/tm/php/core/Error.php +37 -0
- package/project/.sdk/tm/php/core/Helpers.php +25 -0
- package/project/.sdk/tm/php/core/Operation.php +36 -0
- package/project/.sdk/tm/php/core/Response.php +30 -0
- package/project/.sdk/tm/php/core/Result.php +35 -0
- package/project/.sdk/tm/php/core/Spec.php +38 -0
- package/project/.sdk/tm/php/core/UtilityType.php +89 -0
- package/project/.sdk/tm/php/feature/BaseFeature.php +37 -0
- package/project/.sdk/tm/php/feature/LogFeature.php +65 -0
- package/project/.sdk/tm/php/feature/TestFeature.php +193 -0
- package/project/.sdk/tm/php/src/feature/README.md +3 -0
- package/project/.sdk/tm/php/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/php/test/Runner.php +89 -0
- package/project/.sdk/tm/php/utility/Clean.php +12 -0
- package/project/.sdk/tm/php/utility/Done.php +26 -0
- package/project/.sdk/tm/php/utility/FeatureAdd.php +12 -0
- package/project/.sdk/tm/php/utility/FeatureHook.php +23 -0
- package/project/.sdk/tm/php/utility/FeatureInit.php +25 -0
- package/project/.sdk/tm/php/utility/Fetcher.php +101 -0
- package/project/.sdk/tm/php/utility/MakeContext.php +14 -0
- package/project/.sdk/tm/php/utility/MakeError.php +59 -0
- package/project/.sdk/tm/php/utility/MakeFetchDef.php +36 -0
- package/project/.sdk/tm/php/utility/MakeOptions.php +98 -0
- package/project/.sdk/tm/php/utility/MakePoint.php +87 -0
- package/project/.sdk/tm/php/utility/MakeRequest.php +57 -0
- package/project/.sdk/tm/php/utility/MakeResponse.php +43 -0
- package/project/.sdk/tm/php/utility/MakeResult.php +50 -0
- package/project/.sdk/tm/php/utility/MakeSpec.php +64 -0
- package/project/.sdk/tm/php/utility/MakeUrl.php +41 -0
- package/project/.sdk/tm/php/utility/Param.php +66 -0
- package/project/.sdk/tm/php/utility/PrepareAuth.php +33 -0
- package/project/.sdk/tm/php/utility/PrepareBody.php +15 -0
- package/project/.sdk/tm/php/utility/PrepareHeaders.php +18 -0
- package/project/.sdk/tm/php/utility/PrepareMethod.php +21 -0
- package/project/.sdk/tm/php/utility/PrepareParams.php +34 -0
- package/project/.sdk/tm/php/utility/PreparePath.php +20 -0
- package/project/.sdk/tm/php/utility/PrepareQuery.php +32 -0
- package/project/.sdk/tm/php/utility/Register.php +67 -0
- package/project/.sdk/tm/php/utility/ResultBasic.php +29 -0
- package/project/.sdk/tm/php/utility/ResultBody.php +17 -0
- package/project/.sdk/tm/php/utility/ResultHeaders.php +21 -0
- package/project/.sdk/tm/php/utility/TransformRequest.php +27 -0
- package/project/.sdk/tm/php/utility/TransformResponse.php +42 -0
- package/project/.sdk/tm/php/utility/struct/Struct.php +3431 -0
- package/project/.sdk/tm/py/Makefile +10 -0
- package/project/.sdk/tm/py/core/__init__.py +0 -0
- package/project/.sdk/tm/py/core/context.py +199 -0
- package/project/.sdk/tm/py/core/control.py +12 -0
- package/project/.sdk/tm/py/core/error.py +18 -0
- package/project/.sdk/tm/py/core/helpers.py +15 -0
- package/project/.sdk/tm/py/core/operation.py +37 -0
- package/project/.sdk/tm/py/core/response.py +34 -0
- package/project/.sdk/tm/py/core/result.py +44 -0
- package/project/.sdk/tm/py/core/spec.py +23 -0
- package/project/.sdk/tm/py/core/utility_type.py +82 -0
- package/project/.sdk/tm/py/entity/__init__.py +0 -0
- package/project/.sdk/tm/py/feature/__init__.py +0 -0
- package/project/.sdk/tm/py/feature/base_feature.py +61 -0
- package/project/.sdk/tm/py/feature/log_feature.py +84 -0
- package/project/.sdk/tm/py/feature/test_feature.py +164 -0
- package/project/.sdk/tm/py/src/feature/README.md +3 -0
- package/project/.sdk/tm/py/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/py/test/__init__.py +0 -0
- package/project/.sdk/tm/py/test/runner.py +77 -0
- package/project/.sdk/tm/py/utility/__init__.py +0 -0
- package/project/.sdk/tm/py/utility/clean.py +5 -0
- package/project/.sdk/tm/py/utility/done.py +14 -0
- package/project/.sdk/tm/py/utility/feature_add.py +6 -0
- package/project/.sdk/tm/py/utility/feature_hook.py +15 -0
- package/project/.sdk/tm/py/utility/feature_init.py +18 -0
- package/project/.sdk/tm/py/utility/fetcher.py +95 -0
- package/project/.sdk/tm/py/utility/make_context.py +7 -0
- package/project/.sdk/tm/py/utility/make_error.py +64 -0
- package/project/.sdk/tm/py/utility/make_fetch_def.py +37 -0
- package/project/.sdk/tm/py/utility/make_options.py +103 -0
- package/project/.sdk/tm/py/utility/make_point.py +74 -0
- package/project/.sdk/tm/py/utility/make_request.py +52 -0
- package/project/.sdk/tm/py/utility/make_response.py +36 -0
- package/project/.sdk/tm/py/utility/make_result.py +41 -0
- package/project/.sdk/tm/py/utility/make_spec.py +68 -0
- package/project/.sdk/tm/py/utility/make_url.py +34 -0
- package/project/.sdk/tm/py/utility/param.py +55 -0
- package/project/.sdk/tm/py/utility/prepare_auth.py +34 -0
- package/project/.sdk/tm/py/utility/prepare_body.py +11 -0
- package/project/.sdk/tm/py/utility/prepare_headers.py +17 -0
- package/project/.sdk/tm/py/utility/prepare_method.py +15 -0
- package/project/.sdk/tm/py/utility/prepare_params.py +28 -0
- package/project/.sdk/tm/py/utility/prepare_path.py +16 -0
- package/project/.sdk/tm/py/utility/prepare_query.py +33 -0
- package/project/.sdk/tm/py/utility/register.py +68 -0
- package/project/.sdk/tm/py/utility/result_basic.py +26 -0
- package/project/.sdk/tm/py/utility/result_body.py +13 -0
- package/project/.sdk/tm/py/utility/result_headers.py +17 -0
- package/project/.sdk/tm/py/utility/transform_request.py +27 -0
- package/project/.sdk/tm/py/utility/transform_response.py +39 -0
- package/project/.sdk/tm/py/utility/voxgig_struct/__init__.py +72 -0
- package/project/.sdk/tm/py/utility/voxgig_struct/voxgig_struct.py +2770 -0
- package/project/.sdk/tm/rb/Gemfile +4 -0
- package/project/.sdk/tm/rb/LICENSE +22 -0
- package/project/.sdk/tm/rb/Makefile +10 -0
- package/project/.sdk/tm/rb/core/context.rb +105 -0
- package/project/.sdk/tm/rb/core/control.rb +11 -0
- package/project/.sdk/tm/rb/core/error.rb +24 -0
- package/project/.sdk/tm/rb/core/helpers.rb +16 -0
- package/project/.sdk/tm/rb/core/operation.rb +26 -0
- package/project/.sdk/tm/rb/core/response.rb +20 -0
- package/project/.sdk/tm/rb/core/result.rb +23 -0
- package/project/.sdk/tm/rb/core/spec.rb +23 -0
- package/project/.sdk/tm/rb/core/utility_type.rb +32 -0
- package/project/.sdk/tm/rb/feature/base_feature.rb +30 -0
- package/project/.sdk/tm/rb/feature/log_feature.rb +50 -0
- package/project/.sdk/tm/rb/feature/test_feature.rb +154 -0
- package/project/.sdk/tm/rb/src/feature/README.md +3 -0
- package/project/.sdk/tm/rb/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/rb/test/runner.rb +65 -0
- package/project/.sdk/tm/rb/utility/clean.rb +4 -0
- package/project/.sdk/tm/rb/utility/done.rb +14 -0
- package/project/.sdk/tm/rb/utility/feature_add.rb +6 -0
- package/project/.sdk/tm/rb/utility/feature_hook.rb +11 -0
- package/project/.sdk/tm/rb/utility/feature_init.rb +16 -0
- package/project/.sdk/tm/rb/utility/fetcher.rb +67 -0
- package/project/.sdk/tm/rb/utility/make_context.rb +7 -0
- package/project/.sdk/tm/rb/utility/make_error.rb +44 -0
- package/project/.sdk/tm/rb/utility/make_fetch_def.rb +24 -0
- package/project/.sdk/tm/rb/utility/make_options.rb +57 -0
- package/project/.sdk/tm/rb/utility/make_point.rb +77 -0
- package/project/.sdk/tm/rb/utility/make_request.rb +44 -0
- package/project/.sdk/tm/rb/utility/make_response.rb +25 -0
- package/project/.sdk/tm/rb/utility/make_result.rb +33 -0
- package/project/.sdk/tm/rb/utility/make_spec.rb +50 -0
- package/project/.sdk/tm/rb/utility/make_url.rb +32 -0
- package/project/.sdk/tm/rb/utility/param.rb +48 -0
- package/project/.sdk/tm/rb/utility/prepare_auth.rb +26 -0
- package/project/.sdk/tm/rb/utility/prepare_body.rb +6 -0
- package/project/.sdk/tm/rb/utility/prepare_headers.rb +11 -0
- package/project/.sdk/tm/rb/utility/prepare_method.rb +5 -0
- package/project/.sdk/tm/rb/utility/prepare_params.rb +25 -0
- package/project/.sdk/tm/rb/utility/prepare_path.rb +13 -0
- package/project/.sdk/tm/rb/utility/prepare_query.rb +22 -0
- package/project/.sdk/tm/rb/utility/register.rb +63 -0
- package/project/.sdk/tm/rb/utility/result_basic.rb +23 -0
- package/project/.sdk/tm/rb/utility/result_body.rb +11 -0
- package/project/.sdk/tm/rb/utility/result_headers.rb +15 -0
- package/project/.sdk/tm/rb/utility/struct/voxgig_struct.rb +2256 -0
- package/project/.sdk/tm/rb/utility/transform_request.rb +15 -0
- package/project/.sdk/tm/rb/utility/transform_response.rb +23 -0
- package/src/cmp/Readme.ts +5 -5
- package/src/cmp/ReadmeEntity.ts +77 -25
- package/src/cmp/ReadmeExplanation.ts +333 -0
- package/src/cmp/ReadmeHowto.ts +28 -0
- package/src/cmp/ReadmeIntro.ts +10 -24
- package/src/cmp/ReadmeModel.ts +57 -88
- package/src/cmp/ReadmeOptions.ts +40 -11
- package/src/cmp/ReadmeQuick.ts +4 -1
- package/src/cmp/ReadmeRef.ts +1057 -40
- package/src/cmp/ReadmeTop.ts +213 -0
- package/src/sdkgen.ts +12 -0
- package/project/.sdk/tm/go/test/exists_test.go +0 -16
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require_relative '../utility/struct/voxgig_struct'
|
|
2
|
+
require_relative '../core/helpers'
|
|
3
|
+
|
|
4
|
+
# EJECT-START
|
|
5
|
+
|
|
6
|
+
def remove(reqmatch, ctrl = nil)
|
|
7
|
+
utility = @_utility
|
|
8
|
+
ctx = utility.make_context.call({
|
|
9
|
+
"opname" => "remove",
|
|
10
|
+
"ctrl" => ctrl,
|
|
11
|
+
"match" => @_match,
|
|
12
|
+
"data" => @_data,
|
|
13
|
+
"reqmatch" => reqmatch,
|
|
14
|
+
}, @_entctx)
|
|
15
|
+
|
|
16
|
+
_run_op(ctx) do
|
|
17
|
+
if ctx.result
|
|
18
|
+
@_match = ctx.result.resmatch if ctx.result.resmatch
|
|
19
|
+
if ctx.result.resdata
|
|
20
|
+
@_data = ProjectNameHelpers.to_map(VoxgigStruct.clone(ctx.result.resdata)) || {}
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# EJECT-END
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require_relative '../utility/struct/voxgig_struct'
|
|
2
|
+
require_relative '../core/helpers'
|
|
3
|
+
|
|
4
|
+
# EJECT-START
|
|
5
|
+
|
|
6
|
+
def update(reqdata, ctrl = nil)
|
|
7
|
+
utility = @_utility
|
|
8
|
+
ctx = utility.make_context.call({
|
|
9
|
+
"opname" => "update",
|
|
10
|
+
"ctrl" => ctrl,
|
|
11
|
+
"match" => @_match,
|
|
12
|
+
"data" => @_data,
|
|
13
|
+
"reqdata" => reqdata,
|
|
14
|
+
}, @_entctx)
|
|
15
|
+
|
|
16
|
+
_run_op(ctx) do
|
|
17
|
+
if ctx.result
|
|
18
|
+
@_match = ctx.result.resmatch if ctx.result.resmatch
|
|
19
|
+
if ctx.result.resdata
|
|
20
|
+
@_data = ProjectNameHelpers.to_map(VoxgigStruct.clone(ctx.result.resdata)) || {}
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# EJECT-END
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# ProjectName SDK
|
|
2
|
+
|
|
3
|
+
require_relative 'utility/struct/voxgig_struct'
|
|
4
|
+
require_relative 'core/utility_type'
|
|
5
|
+
require_relative 'core/spec'
|
|
6
|
+
require_relative 'core/helpers'
|
|
7
|
+
|
|
8
|
+
# Load utility registration
|
|
9
|
+
require_relative 'utility/register'
|
|
10
|
+
|
|
11
|
+
# Load config and features
|
|
12
|
+
require_relative 'config'
|
|
13
|
+
require_relative 'feature/base_feature'
|
|
14
|
+
require_relative 'features'
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ProjectNameSDK
|
|
18
|
+
attr_accessor :mode, :features, :options
|
|
19
|
+
|
|
20
|
+
def initialize(options = {})
|
|
21
|
+
@mode = "live"
|
|
22
|
+
@features = []
|
|
23
|
+
@options = nil
|
|
24
|
+
|
|
25
|
+
utility = ProjectNameUtility.new
|
|
26
|
+
@_utility = utility
|
|
27
|
+
|
|
28
|
+
config = ProjectNameConfig.make_config
|
|
29
|
+
|
|
30
|
+
@_rootctx = utility.make_context.call({
|
|
31
|
+
"client" => self,
|
|
32
|
+
"utility" => utility,
|
|
33
|
+
"config" => config,
|
|
34
|
+
"options" => options || {},
|
|
35
|
+
"shared" => {},
|
|
36
|
+
}, nil)
|
|
37
|
+
|
|
38
|
+
@options = utility.make_options.call(@_rootctx)
|
|
39
|
+
|
|
40
|
+
if VoxgigStruct.getpath(@options, "feature.test.active") == true
|
|
41
|
+
@mode = "test"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
@_rootctx.options = @options
|
|
45
|
+
|
|
46
|
+
# Add features from config.
|
|
47
|
+
feature_opts = ProjectNameHelpers.to_map(VoxgigStruct.getprop(@options, "feature"))
|
|
48
|
+
if feature_opts
|
|
49
|
+
items = VoxgigStruct.items(feature_opts)
|
|
50
|
+
if items
|
|
51
|
+
items.each do |item|
|
|
52
|
+
fname = item[0]
|
|
53
|
+
fopts = ProjectNameHelpers.to_map(item[1])
|
|
54
|
+
if fopts && fopts["active"] == true
|
|
55
|
+
utility.feature_add.call(@_rootctx, ProjectNameFeatures.make_feature(fname))
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Add extension features.
|
|
62
|
+
extend_val = VoxgigStruct.getprop(@options, "extend")
|
|
63
|
+
if extend_val.is_a?(Array)
|
|
64
|
+
extend_val.each do |f|
|
|
65
|
+
if f.respond_to?(:get_name)
|
|
66
|
+
utility.feature_add.call(@_rootctx, f)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Initialize features.
|
|
72
|
+
@features.each do |f|
|
|
73
|
+
utility.feature_init.call(@_rootctx, f)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
utility.feature_hook.call(@_rootctx, "PostConstruct")
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def options_map
|
|
80
|
+
out = VoxgigStruct.clone(@options)
|
|
81
|
+
out.is_a?(Hash) ? out : {}
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def get_utility
|
|
85
|
+
ProjectNameUtility.copy(@_utility)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def get_root_ctx
|
|
89
|
+
@_rootctx
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def prepare(fetchargs = {})
|
|
93
|
+
utility = @_utility
|
|
94
|
+
fetchargs ||= {}
|
|
95
|
+
|
|
96
|
+
ctrl = ProjectNameHelpers.to_map(VoxgigStruct.getprop(fetchargs, "ctrl")) || {}
|
|
97
|
+
|
|
98
|
+
ctx = utility.make_context.call({
|
|
99
|
+
"opname" => "prepare",
|
|
100
|
+
"ctrl" => ctrl,
|
|
101
|
+
}, @_rootctx)
|
|
102
|
+
|
|
103
|
+
opts = @options
|
|
104
|
+
path = VoxgigStruct.getprop(fetchargs, "path") || ""
|
|
105
|
+
path = "" unless path.is_a?(String)
|
|
106
|
+
method_val = VoxgigStruct.getprop(fetchargs, "method") || "GET"
|
|
107
|
+
method_val = "GET" unless method_val.is_a?(String)
|
|
108
|
+
params = ProjectNameHelpers.to_map(VoxgigStruct.getprop(fetchargs, "params")) || {}
|
|
109
|
+
query = ProjectNameHelpers.to_map(VoxgigStruct.getprop(fetchargs, "query")) || {}
|
|
110
|
+
headers = utility.prepare_headers.call(ctx)
|
|
111
|
+
|
|
112
|
+
base = VoxgigStruct.getprop(opts, "base") || ""
|
|
113
|
+
base = "" unless base.is_a?(String)
|
|
114
|
+
prefix = VoxgigStruct.getprop(opts, "prefix") || ""
|
|
115
|
+
prefix = "" unless prefix.is_a?(String)
|
|
116
|
+
suffix = VoxgigStruct.getprop(opts, "suffix") || ""
|
|
117
|
+
suffix = "" unless suffix.is_a?(String)
|
|
118
|
+
|
|
119
|
+
ctx.spec = ProjectNameSpec.new({
|
|
120
|
+
"base" => base, "prefix" => prefix, "suffix" => suffix,
|
|
121
|
+
"path" => path, "method" => method_val,
|
|
122
|
+
"params" => params, "query" => query, "headers" => headers,
|
|
123
|
+
"body" => VoxgigStruct.getprop(fetchargs, "body"),
|
|
124
|
+
"step" => "start",
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
# Merge user-provided headers.
|
|
128
|
+
uh = VoxgigStruct.getprop(fetchargs, "headers")
|
|
129
|
+
if uh.is_a?(Hash)
|
|
130
|
+
uh.each { |k, v| ctx.spec.headers[k] = v }
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
_, err = utility.prepare_auth.call(ctx)
|
|
134
|
+
return nil, err if err
|
|
135
|
+
|
|
136
|
+
utility.make_fetch_def.call(ctx)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def direct(fetchargs = {})
|
|
140
|
+
utility = @_utility
|
|
141
|
+
|
|
142
|
+
fetchdef, err = prepare(fetchargs)
|
|
143
|
+
return { "ok" => false, "err" => err }, nil if err
|
|
144
|
+
|
|
145
|
+
fetchargs ||= {}
|
|
146
|
+
ctrl = ProjectNameHelpers.to_map(VoxgigStruct.getprop(fetchargs, "ctrl")) || {}
|
|
147
|
+
|
|
148
|
+
ctx = utility.make_context.call({
|
|
149
|
+
"opname" => "direct",
|
|
150
|
+
"ctrl" => ctrl,
|
|
151
|
+
}, @_rootctx)
|
|
152
|
+
|
|
153
|
+
url = fetchdef["url"] || ""
|
|
154
|
+
fetched, fetch_err = utility.fetcher.call(ctx, url, fetchdef)
|
|
155
|
+
|
|
156
|
+
return { "ok" => false, "err" => fetch_err }, nil if fetch_err
|
|
157
|
+
|
|
158
|
+
if fetched.nil?
|
|
159
|
+
return {
|
|
160
|
+
"ok" => false,
|
|
161
|
+
"err" => ctx.make_error("direct_no_response", "response: undefined"),
|
|
162
|
+
}, nil
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
if fetched.is_a?(Hash)
|
|
166
|
+
status = ProjectNameHelpers.to_int(VoxgigStruct.getprop(fetched, "status"))
|
|
167
|
+
json_data = nil
|
|
168
|
+
jf = VoxgigStruct.getprop(fetched, "json")
|
|
169
|
+
json_data = jf.call if jf.is_a?(Proc)
|
|
170
|
+
|
|
171
|
+
return {
|
|
172
|
+
"ok" => status >= 200 && status < 300,
|
|
173
|
+
"status" => status,
|
|
174
|
+
"headers" => VoxgigStruct.getprop(fetched, "headers"),
|
|
175
|
+
"data" => json_data,
|
|
176
|
+
}, nil
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
"ok" => false,
|
|
181
|
+
"err" => ctx.make_error("direct_invalid", "invalid response type"),
|
|
182
|
+
}, nil
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# <[SLOT]>
|
|
186
|
+
|
|
187
|
+
def self.test(testopts = nil, sdkopts = nil)
|
|
188
|
+
sdkopts = sdkopts || {}
|
|
189
|
+
sdkopts = VoxgigStruct.clone(sdkopts)
|
|
190
|
+
sdkopts = {} unless sdkopts.is_a?(Hash)
|
|
191
|
+
|
|
192
|
+
testopts = testopts || {}
|
|
193
|
+
testopts = VoxgigStruct.clone(testopts)
|
|
194
|
+
testopts = {} unless testopts.is_a?(Hash)
|
|
195
|
+
testopts["active"] = true
|
|
196
|
+
|
|
197
|
+
VoxgigStruct.setpath(sdkopts, "feature.test", testopts)
|
|
198
|
+
|
|
199
|
+
sdk = ProjectNameSDK.new(sdkopts)
|
|
200
|
+
sdk.mode = "test"
|
|
201
|
+
sdk
|
|
202
|
+
end
|
|
203
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# ProjectName SDK error
|
|
2
|
+
|
|
3
|
+
class ProjectNameError < StandardError
|
|
4
|
+
attr_accessor :code, :msg, :sdk
|
|
5
|
+
|
|
6
|
+
def initialize(code = "", msg = "")
|
|
7
|
+
super(msg)
|
|
8
|
+
@code = code
|
|
9
|
+
@msg = msg
|
|
10
|
+
@sdk = "ProjectName"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def error
|
|
14
|
+
"#{@sdk}: #{@code}: #{@msg}"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"esModuleInterop": true,
|
|
4
|
+
"module": "nodenext",
|
|
5
|
+
"noEmitOnError": true,
|
|
6
|
+
"outDir":"../dist",
|
|
7
|
+
"rootDir":".",
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"target": "es2022",
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"declarationDir": "../dist"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
|
|
2
|
+
import * as Path from 'node:path'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
clone,
|
|
6
|
+
walk,
|
|
7
|
+
} from '@voxgig/struct'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
function projectPath(suffix?: string): string {
|
|
11
|
+
return Path.normalize(Path.join(__dirname, '../../..', suffix ?? ''))
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
function formatRubyHash(obj: any, indent: number = 0): string {
|
|
16
|
+
if (obj == null) {
|
|
17
|
+
return 'nil'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const pad = ' '.repeat(indent)
|
|
21
|
+
const padInner = ' '.repeat(indent + 1)
|
|
22
|
+
|
|
23
|
+
if (Array.isArray(obj)) {
|
|
24
|
+
if (obj.length === 0) {
|
|
25
|
+
return '[]'
|
|
26
|
+
}
|
|
27
|
+
const items = obj.map(v => padInner + formatRubyValue(v, indent + 1)).join(',\n')
|
|
28
|
+
return `[\n${items},\n${pad}]`
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (typeof obj === 'object') {
|
|
32
|
+
const entries = Object.entries(obj)
|
|
33
|
+
if (entries.length === 0) {
|
|
34
|
+
return '{}'
|
|
35
|
+
}
|
|
36
|
+
const items = entries
|
|
37
|
+
.map(([k, v]) => `${padInner}"${k}" => ${formatRubyValue(v, indent + 1)}`)
|
|
38
|
+
.join(',\n')
|
|
39
|
+
return `{\n${items},\n${pad}}`
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return formatRubyValue(obj, indent)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
function formatRubyValue(val: any, indent: number = 0): string {
|
|
47
|
+
if (val === null || val === undefined) {
|
|
48
|
+
return 'nil'
|
|
49
|
+
}
|
|
50
|
+
if (typeof val === 'string') {
|
|
51
|
+
return `"${val.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`
|
|
52
|
+
}
|
|
53
|
+
if (typeof val === 'number') {
|
|
54
|
+
return String(val)
|
|
55
|
+
}
|
|
56
|
+
if (typeof val === 'boolean') {
|
|
57
|
+
return val ? 'true' : 'false'
|
|
58
|
+
}
|
|
59
|
+
if (Array.isArray(val)) {
|
|
60
|
+
return formatRubyHash(val, indent)
|
|
61
|
+
}
|
|
62
|
+
if (typeof val === 'object') {
|
|
63
|
+
return formatRubyHash(val, indent)
|
|
64
|
+
}
|
|
65
|
+
return String(val)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
function clean(o: any) {
|
|
70
|
+
return walk(clone(o), (k: any, v: any, p: any) => {
|
|
71
|
+
if (null != k && k.endsWith('$')) {
|
|
72
|
+
delete p[k]
|
|
73
|
+
}
|
|
74
|
+
return v
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
export {
|
|
80
|
+
clean,
|
|
81
|
+
formatRubyHash,
|
|
82
|
+
formatRubyValue,
|
|
83
|
+
projectPath,
|
|
84
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const ReadmeExplanation = cmp(function ReadmeExplanation(props: any) {
|
|
6
|
+
const { target, ctx$: { model } } = props
|
|
7
|
+
|
|
8
|
+
Content(`### Module structure
|
|
9
|
+
|
|
10
|
+
\`\`\`
|
|
11
|
+
${model.name}/
|
|
12
|
+
├── src/
|
|
13
|
+
│ ├── ${model.Name}SDK.ts # Main SDK class
|
|
14
|
+
│ ├── entity/ # Entity implementations
|
|
15
|
+
│ ├── feature/ # Built-in features (Base, Test, Log)
|
|
16
|
+
│ └── utility/ # Utility functions
|
|
17
|
+
├── test/ # Test suites
|
|
18
|
+
└── dist/ # Compiled output
|
|
19
|
+
\`\`\`
|
|
20
|
+
|
|
21
|
+
Import the SDK from the package root:
|
|
22
|
+
|
|
23
|
+
\`\`\`ts
|
|
24
|
+
import { ${model.Name}SDK } from '${model.name}'
|
|
25
|
+
\`\`\`
|
|
26
|
+
|
|
27
|
+
`)
|
|
28
|
+
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
ReadmeExplanation
|
|
34
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
KIT,
|
|
6
|
+
getModelPath,
|
|
7
|
+
} from '@voxgig/apidef'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
|
|
11
|
+
const { target, ctx$: { model } } = props
|
|
12
|
+
|
|
13
|
+
Content(`### Make a direct HTTP request
|
|
14
|
+
|
|
15
|
+
For endpoints not covered by entity methods:
|
|
16
|
+
|
|
17
|
+
\`\`\`ts
|
|
18
|
+
const result = await client.direct({
|
|
19
|
+
path: '/api/resource/{id}',
|
|
20
|
+
method: 'GET',
|
|
21
|
+
params: { id: 'example' },
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
if (result.ok) {
|
|
25
|
+
console.log(result.status) // 200
|
|
26
|
+
console.log(result.data) // response body
|
|
27
|
+
}
|
|
28
|
+
\`\`\`
|
|
29
|
+
|
|
30
|
+
### Prepare a request without sending it
|
|
31
|
+
|
|
32
|
+
\`\`\`ts
|
|
33
|
+
const fetchdef = await client.prepare({
|
|
34
|
+
path: '/api/resource/{id}',
|
|
35
|
+
method: 'DELETE',
|
|
36
|
+
params: { id: 'example' },
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// Inspect before sending
|
|
40
|
+
console.log(fetchdef.url)
|
|
41
|
+
console.log(fetchdef.method)
|
|
42
|
+
console.log(fetchdef.headers)
|
|
43
|
+
\`\`\`
|
|
44
|
+
|
|
45
|
+
### Use test mode
|
|
46
|
+
|
|
47
|
+
Create a mock client for unit testing \u2014 no server required:
|
|
48
|
+
|
|
49
|
+
\`\`\`ts
|
|
50
|
+
const client = ${model.const.Name}SDK.test()
|
|
51
|
+
|
|
52
|
+
const result = await client.Planet().load({ id: 'test01' })
|
|
53
|
+
// result.ok === true
|
|
54
|
+
// result.data contains mock response data
|
|
55
|
+
\`\`\`
|
|
56
|
+
|
|
57
|
+
You can also use the instance method:
|
|
58
|
+
|
|
59
|
+
\`\`\`ts
|
|
60
|
+
const client = new ${model.const.Name}SDK({ apikey: '...' })
|
|
61
|
+
const testClient = client.tester()
|
|
62
|
+
\`\`\`
|
|
63
|
+
|
|
64
|
+
### Retain entity state across calls
|
|
65
|
+
|
|
66
|
+
Entity instances remember their last match and data:
|
|
67
|
+
|
|
68
|
+
\`\`\`ts
|
|
69
|
+
const entity = client.Planet()
|
|
70
|
+
|
|
71
|
+
// First call sets internal match
|
|
72
|
+
await entity.load({ id: 'example' })
|
|
73
|
+
|
|
74
|
+
// Subsequent calls reuse the stored match
|
|
75
|
+
const data = entity.data()
|
|
76
|
+
console.log(data.id) // 'example'
|
|
77
|
+
\`\`\`
|
|
78
|
+
|
|
79
|
+
### Add custom middleware
|
|
80
|
+
|
|
81
|
+
Pass features via the \`extend\` option:
|
|
82
|
+
|
|
83
|
+
\`\`\`ts
|
|
84
|
+
const logger = {
|
|
85
|
+
hooks: {
|
|
86
|
+
PreRequest: (ctx: any) => {
|
|
87
|
+
console.log('Requesting:', ctx.spec.method, ctx.spec.path)
|
|
88
|
+
},
|
|
89
|
+
PreResponse: (ctx: any) => {
|
|
90
|
+
console.log('Status:', ctx.out.request?.status)
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const client = new ${model.const.Name}SDK({
|
|
96
|
+
apikey: '...',
|
|
97
|
+
extend: [logger],
|
|
98
|
+
})
|
|
99
|
+
\`\`\`
|
|
100
|
+
|
|
101
|
+
### Run live tests
|
|
102
|
+
|
|
103
|
+
Create a \`.env.local\` file at the project root:
|
|
104
|
+
|
|
105
|
+
\`\`\`
|
|
106
|
+
${model.NAME}_TEST_LIVE=TRUE
|
|
107
|
+
${model.NAME}_APIKEY=<your-key>
|
|
108
|
+
\`\`\`
|
|
109
|
+
|
|
110
|
+
Then run:
|
|
111
|
+
|
|
112
|
+
\`\`\`bash
|
|
113
|
+
cd ts && npm test
|
|
114
|
+
\`\`\`
|
|
115
|
+
|
|
116
|
+
`)
|
|
117
|
+
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
export {
|
|
122
|
+
ReadmeHowto
|
|
123
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, each, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
KIT,
|
|
6
|
+
getModelPath,
|
|
7
|
+
} from '@voxgig/apidef'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const ReadmeModel = cmp(function ReadmeModel(props: any) {
|
|
11
|
+
const { target, ctx$: { model } } = props
|
|
12
|
+
|
|
13
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
14
|
+
const entityList = each(entity).filter((e: any) => e.active !== false)
|
|
15
|
+
|
|
16
|
+
Content(`### ${model.const.Name}SDK
|
|
17
|
+
|
|
18
|
+
#### Constructor
|
|
19
|
+
|
|
20
|
+
\`\`\`ts
|
|
21
|
+
new ${model.const.Name}SDK(options?: {
|
|
22
|
+
apikey?: string
|
|
23
|
+
base?: string
|
|
24
|
+
prefix?: string
|
|
25
|
+
suffix?: string
|
|
26
|
+
feature?: Record<string, { active: boolean }>
|
|
27
|
+
extend?: Feature[]
|
|
28
|
+
})
|
|
29
|
+
\`\`\`
|
|
30
|
+
|
|
31
|
+
| Option | Type | Description |
|
|
32
|
+
| --- | --- | --- |
|
|
33
|
+
| \`apikey\` | \`string\` | API key for authentication. |
|
|
34
|
+
| \`base\` | \`string\` | Base URL of the API server. |
|
|
35
|
+
| \`prefix\` | \`string\` | URL path prefix prepended to all requests. |
|
|
36
|
+
| \`suffix\` | \`string\` | URL path suffix appended to all requests. |
|
|
37
|
+
| \`feature\` | \`object\` | Feature activation flags (e.g. \`{ test: { active: true } }\`). |
|
|
38
|
+
| \`extend\` | \`Feature[]\` | Additional feature instances to load. |
|
|
39
|
+
|
|
40
|
+
#### Methods
|
|
41
|
+
|
|
42
|
+
| Method | Returns | Description |
|
|
43
|
+
| --- | --- | --- |
|
|
44
|
+
| \`options()\` | \`object\` | Deep copy of current SDK options. |
|
|
45
|
+
| \`utility()\` | \`Utility\` | Deep copy of the SDK utility object. |
|
|
46
|
+
| \`prepare(fetchargs?)\` | \`Promise<FetchDef>\` | Build an HTTP request definition without sending it. |
|
|
47
|
+
| \`direct(fetchargs?)\` | \`Promise<DirectResult>\` | Build and send an HTTP request. |
|
|
48
|
+
`)
|
|
49
|
+
|
|
50
|
+
each(entityList, (ent: any) => {
|
|
51
|
+
Content(`| \`${ent.Name}(data?)\` | \`${ent.Name}Entity\` | Create a ${ent.Name} entity instance. |
|
|
52
|
+
`)
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
Content(`| \`tester(testopts?, sdkopts?)\` | \`${model.const.Name}SDK\` | Create a test-mode client instance. |
|
|
56
|
+
|
|
57
|
+
#### Static methods
|
|
58
|
+
|
|
59
|
+
| Method | Returns | Description |
|
|
60
|
+
| --- | --- | --- |
|
|
61
|
+
| \`${model.const.Name}SDK.test(testopts?, sdkopts?)\` | \`${model.const.Name}SDK\` | Create a test-mode client. |
|
|
62
|
+
|
|
63
|
+
### Entity interface
|
|
64
|
+
|
|
65
|
+
All entities share the same interface.
|
|
66
|
+
|
|
67
|
+
#### Methods
|
|
68
|
+
|
|
69
|
+
| Method | Signature | Description |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| \`load\` | \`load(reqmatch?, ctrl?): Promise<Result>\` | Load a single entity by match criteria. |
|
|
72
|
+
| \`list\` | \`list(reqmatch?, ctrl?): Promise<Result>\` | List entities matching the criteria. |
|
|
73
|
+
| \`create\` | \`create(reqdata?, ctrl?): Promise<Result>\` | Create a new entity. |
|
|
74
|
+
| \`update\` | \`update(reqdata?, ctrl?): Promise<Result>\` | Update an existing entity. |
|
|
75
|
+
| \`remove\` | \`remove(reqmatch?, ctrl?): Promise<Result>\` | Remove an entity. |
|
|
76
|
+
| \`data\` | \`data(data?): any\` | Get or set entity data. |
|
|
77
|
+
| \`match\` | \`match(match?): any\` | Get or set entity match criteria. |
|
|
78
|
+
| \`make\` | \`make(): Entity\` | Create a new instance with the same options. |
|
|
79
|
+
| \`client\` | \`client(): ${model.const.Name}SDK\` | Return the parent SDK client. |
|
|
80
|
+
| \`entopts\` | \`entopts(): object\` | Return a copy of the entity options. |
|
|
81
|
+
|
|
82
|
+
#### Result shape
|
|
83
|
+
|
|
84
|
+
All entity operations return a Result object:
|
|
85
|
+
|
|
86
|
+
\`\`\`ts
|
|
87
|
+
{
|
|
88
|
+
ok: boolean // true if the HTTP status is 2xx
|
|
89
|
+
status: number // HTTP status code
|
|
90
|
+
headers: object // response headers
|
|
91
|
+
data: any // parsed JSON response body
|
|
92
|
+
}
|
|
93
|
+
\`\`\`
|
|
94
|
+
|
|
95
|
+
### DirectResult shape
|
|
96
|
+
|
|
97
|
+
The \`direct()\` method returns:
|
|
98
|
+
|
|
99
|
+
\`\`\`ts
|
|
100
|
+
{
|
|
101
|
+
ok: boolean
|
|
102
|
+
status: number
|
|
103
|
+
headers: object
|
|
104
|
+
data: any
|
|
105
|
+
}
|
|
106
|
+
\`\`\`
|
|
107
|
+
|
|
108
|
+
On error, \`ok\` is \`false\` and an \`err\` property contains the error.
|
|
109
|
+
|
|
110
|
+
### FetchDef shape
|
|
111
|
+
|
|
112
|
+
The \`prepare()\` method returns:
|
|
113
|
+
|
|
114
|
+
\`\`\`ts
|
|
115
|
+
{
|
|
116
|
+
url: string
|
|
117
|
+
method: string
|
|
118
|
+
headers: Record<string, string>
|
|
119
|
+
body?: any
|
|
120
|
+
}
|
|
121
|
+
\`\`\`
|
|
122
|
+
|
|
123
|
+
### Entities
|
|
124
|
+
|
|
125
|
+
`)
|
|
126
|
+
|
|
127
|
+
each(entityList, (ent: any) => {
|
|
128
|
+
const fields = ent.fields || []
|
|
129
|
+
const opnames = Object.keys(ent.op || {})
|
|
130
|
+
const ops = ent.op || {}
|
|
131
|
+
const points = each(ops).map((op: any) =>
|
|
132
|
+
op.points ? each(op.points) : []
|
|
133
|
+
).flat()
|
|
134
|
+
const path = points.length > 0 ? (points[0] as any).orig || '' : ''
|
|
135
|
+
|
|
136
|
+
Content(`#### ${ent.Name}
|
|
137
|
+
|
|
138
|
+
| Field | Description |
|
|
139
|
+
| --- | --- |
|
|
140
|
+
`)
|
|
141
|
+
each(fields, (field: any) => {
|
|
142
|
+
Content(`| \`${field.name}\` | ${field.short || ''} |
|
|
143
|
+
`)
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
Content(`
|
|
147
|
+
Operations: ${opnames.join(', ')}.
|
|
148
|
+
|
|
149
|
+
API path: \`${path}\`
|
|
150
|
+
|
|
151
|
+
`)
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
export {
|
|
158
|
+
ReadmeModel
|
|
159
|
+
}
|