@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
|
@@ -14,10 +14,14 @@ const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
|
|
|
14
14
|
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
15
15
|
|
|
16
16
|
// Find the first published entity for examples
|
|
17
|
-
const exampleEntity = Object.values(entity).find((e: any) => e.
|
|
17
|
+
const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
// Find a nested entity if available
|
|
20
|
+
const nestedEntity = Object.values(entity).find((e: any) =>
|
|
21
|
+
e.active !== false && e.ancestors && e.ancestors.length > 0
|
|
22
|
+
) as any
|
|
23
|
+
|
|
24
|
+
Content(`### 1. Create a client
|
|
21
25
|
|
|
22
26
|
\`\`\`ts
|
|
23
27
|
import { ${model.const.Name}SDK } from '${target.module.name}'
|
|
@@ -26,6 +30,7 @@ const client = new ${model.const.Name}SDK({
|
|
|
26
30
|
apikey: process.env.${model.NAME}_APIKEY,
|
|
27
31
|
})
|
|
28
32
|
\`\`\`
|
|
33
|
+
|
|
29
34
|
`)
|
|
30
35
|
|
|
31
36
|
|
|
@@ -33,85 +38,95 @@ const client = new ${model.const.Name}SDK({
|
|
|
33
38
|
const eName = nom(exampleEntity, 'Name')
|
|
34
39
|
const opnames = Object.keys(exampleEntity.op || {})
|
|
35
40
|
|
|
36
|
-
if (opnames.includes('
|
|
37
|
-
Content(
|
|
38
|
-
### Load a ${eName}
|
|
41
|
+
if (opnames.includes('list')) {
|
|
42
|
+
Content(`### 2. List ${eName.toLowerCase()}s
|
|
39
43
|
|
|
40
44
|
\`\`\`ts
|
|
41
|
-
const
|
|
42
|
-
|
|
45
|
+
const result = await client.${eName}().list()
|
|
46
|
+
|
|
47
|
+
if (result.ok) {
|
|
48
|
+
for (const item of result.data) {
|
|
49
|
+
console.log(item.id, item.name)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
43
52
|
\`\`\`
|
|
53
|
+
|
|
44
54
|
`)
|
|
45
55
|
}
|
|
46
56
|
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
if (nestedEntity) {
|
|
58
|
+
const neName = nom(nestedEntity, 'Name')
|
|
59
|
+
const parentFields = (nestedEntity.fields || [])
|
|
60
|
+
.filter((f: any) => f.name !== 'id' && f.name.endsWith('_id'))
|
|
61
|
+
const parentParam = parentFields.length > 0 ? parentFields[0].name : 'parent_id'
|
|
50
62
|
|
|
51
|
-
|
|
52
|
-
const ${exampleEntity.name}s = await client.${eName}().list()
|
|
53
|
-
console.log(${exampleEntity.name}s)
|
|
54
|
-
\`\`\`
|
|
55
|
-
`)
|
|
56
|
-
}
|
|
63
|
+
Content(`### 3. Load a ${neName.toLowerCase()}
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
Content(`
|
|
60
|
-
### Create a ${eName}
|
|
65
|
+
${neName} is nested under ${eName}, so provide the \`${parentParam}\`:
|
|
61
66
|
|
|
62
67
|
\`\`\`ts
|
|
63
|
-
const
|
|
64
|
-
|
|
68
|
+
const ${neName.toLowerCase()} = client.${neName}()
|
|
69
|
+
const result = await ${neName.toLowerCase()}.load({
|
|
70
|
+
${parentParam}: 'example',
|
|
71
|
+
id: 'example_id',
|
|
65
72
|
})
|
|
66
|
-
|
|
73
|
+
|
|
74
|
+
if (result.ok) {
|
|
75
|
+
console.log(result.data)
|
|
76
|
+
}
|
|
67
77
|
\`\`\`
|
|
78
|
+
|
|
68
79
|
`)
|
|
69
80
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
Content(`
|
|
73
|
-
### Update a ${eName}
|
|
81
|
+
else if (opnames.includes('load')) {
|
|
82
|
+
Content(`### 3. Load a ${eName.toLowerCase()}
|
|
74
83
|
|
|
75
84
|
\`\`\`ts
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
85
|
+
const result = await client.${eName}().load({ id: 'example_id' })
|
|
86
|
+
|
|
87
|
+
if (result.ok) {
|
|
88
|
+
console.log(result.data)
|
|
89
|
+
}
|
|
81
90
|
\`\`\`
|
|
91
|
+
|
|
82
92
|
`)
|
|
83
93
|
}
|
|
84
94
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
95
|
+
// CRUD operations
|
|
96
|
+
if (opnames.includes('create') || opnames.includes('update') || opnames.includes('remove')) {
|
|
97
|
+
Content(`### 4. Create, update, and remove
|
|
88
98
|
|
|
89
99
|
\`\`\`ts
|
|
90
|
-
await client.${eName}().remove({ id: '${exampleEntity.name}_id' })
|
|
91
|
-
\`\`\`
|
|
92
100
|
`)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
### Direct API Access
|
|
99
|
-
|
|
100
|
-
Use \`client.direct()\` to call any API endpoint directly:
|
|
101
|
+
if (opnames.includes('create')) {
|
|
102
|
+
Content(`// Create
|
|
103
|
+
const created = await client.${eName}().create({
|
|
104
|
+
name: 'Example',
|
|
105
|
+
})
|
|
101
106
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
`)
|
|
108
|
+
}
|
|
109
|
+
if (opnames.includes('update')) {
|
|
110
|
+
Content(`// Update
|
|
111
|
+
const updated = await client.${eName}().update({
|
|
112
|
+
id: created.data.id,
|
|
113
|
+
name: 'Example-Renamed',
|
|
107
114
|
})
|
|
108
115
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
116
|
+
`)
|
|
117
|
+
}
|
|
118
|
+
if (opnames.includes('remove')) {
|
|
119
|
+
Content(`// Remove
|
|
120
|
+
const removed = await client.${eName}().remove({
|
|
121
|
+
id: created.data.id,
|
|
122
|
+
})
|
|
123
|
+
`)
|
|
124
|
+
}
|
|
125
|
+
Content(`\`\`\`
|
|
113
126
|
|
|
114
127
|
`)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
115
130
|
|
|
116
131
|
})
|
|
117
132
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const ReadmeTopHowto = cmp(function ReadmeTopHowto(props: any) {
|
|
6
|
+
const { target } = props
|
|
7
|
+
|
|
8
|
+
Content(`**TypeScript:**
|
|
9
|
+
\`\`\`ts
|
|
10
|
+
const result = await client.direct({
|
|
11
|
+
path: '/api/resource/{id}',
|
|
12
|
+
method: 'GET',
|
|
13
|
+
params: { id: 'example' },
|
|
14
|
+
})
|
|
15
|
+
console.log(result.data)
|
|
16
|
+
\`\`\`
|
|
17
|
+
|
|
18
|
+
`)
|
|
19
|
+
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
ReadmeTopHowto
|
|
25
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
KIT,
|
|
6
|
+
getModelPath,
|
|
7
|
+
nom,
|
|
8
|
+
} from '@voxgig/apidef'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const ReadmeTopQuick = cmp(function ReadmeTopQuick(props: any) {
|
|
12
|
+
const { target, ctx$: { model } } = props
|
|
13
|
+
|
|
14
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
15
|
+
const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
|
|
16
|
+
|
|
17
|
+
Content(`\`\`\`ts
|
|
18
|
+
import { ${model.const.Name}SDK } from '${target.module.name}'
|
|
19
|
+
|
|
20
|
+
const client = new ${model.const.Name}SDK({
|
|
21
|
+
apikey: process.env.${model.NAME}_APIKEY,
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
`)
|
|
25
|
+
|
|
26
|
+
if (exampleEntity) {
|
|
27
|
+
const eName = nom(exampleEntity, 'Name')
|
|
28
|
+
const opnames = Object.keys(exampleEntity.op || {})
|
|
29
|
+
|
|
30
|
+
if (opnames.includes('list')) {
|
|
31
|
+
Content(`// List all ${eName.toLowerCase()}s
|
|
32
|
+
const ${eName.toLowerCase()}s = await client.${eName}().list()
|
|
33
|
+
`)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Find a nested entity for a more interesting example
|
|
37
|
+
const nestedEntity = Object.values(entity).find((e: any) =>
|
|
38
|
+
e.active !== false && e.ancestors && e.ancestors.length > 0
|
|
39
|
+
) as any
|
|
40
|
+
|
|
41
|
+
if (nestedEntity && opnames.includes('load')) {
|
|
42
|
+
const neName = nom(nestedEntity, 'Name')
|
|
43
|
+
const parentFields = (nestedEntity.fields || [])
|
|
44
|
+
.filter((f: any) => f.name !== 'id' && f.name.endsWith('_id'))
|
|
45
|
+
const parentParam = parentFields.length > 0 ? parentFields[0].name : 'parent_id'
|
|
46
|
+
|
|
47
|
+
Content(`
|
|
48
|
+
// Load a specific ${neName.toLowerCase()}
|
|
49
|
+
const ${neName.toLowerCase()} = await client.${neName}().load({
|
|
50
|
+
${parentParam}: 'example',
|
|
51
|
+
id: 'example_id',
|
|
52
|
+
})
|
|
53
|
+
`)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
Content(`\`\`\`
|
|
58
|
+
`)
|
|
59
|
+
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
ReadmeTopQuick
|
|
65
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
import { cmp, Content } from '@voxgig/sdkgen'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
KIT,
|
|
6
|
+
getModelPath,
|
|
7
|
+
nom,
|
|
8
|
+
} from '@voxgig/apidef'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const ReadmeTopTest = cmp(function ReadmeTopTest(props: any) {
|
|
12
|
+
const { target, ctx$: { model } } = props
|
|
13
|
+
|
|
14
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
15
|
+
const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
|
|
16
|
+
|
|
17
|
+
Content(`\`\`\`ts
|
|
18
|
+
const client = ${model.const.Name}SDK.test()
|
|
19
|
+
`)
|
|
20
|
+
|
|
21
|
+
if (exampleEntity) {
|
|
22
|
+
const eName = nom(exampleEntity, 'Name')
|
|
23
|
+
Content(`const result = await client.${eName}().load({ id: 'test01' })
|
|
24
|
+
// result.ok === true, result.data contains mock data
|
|
25
|
+
`)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Content(`\`\`\`
|
|
29
|
+
`)
|
|
30
|
+
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
ReadmeTopTest
|
|
36
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
package feature
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"log/slog"
|
|
5
|
+
"os"
|
|
6
|
+
|
|
7
|
+
"GOMODULE/core"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
type LogFeature struct {
|
|
11
|
+
BaseFeature
|
|
12
|
+
client *core.ProjectNameSDK
|
|
13
|
+
options map[string]any
|
|
14
|
+
logger *slog.Logger
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
func NewLogFeature() *LogFeature {
|
|
18
|
+
return &LogFeature{
|
|
19
|
+
BaseFeature: BaseFeature{
|
|
20
|
+
Version: "0.0.1",
|
|
21
|
+
Name: "log",
|
|
22
|
+
Active: true,
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
func (f *LogFeature) Init(ctx *core.Context, options map[string]any) {
|
|
28
|
+
f.client = ctx.Client
|
|
29
|
+
f.options = options
|
|
30
|
+
|
|
31
|
+
if active, ok := options["active"].(bool); ok {
|
|
32
|
+
f.Active = active
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if f.Active {
|
|
36
|
+
if logger, ok := options["logger"].(*slog.Logger); ok && logger != nil {
|
|
37
|
+
f.logger = logger
|
|
38
|
+
} else {
|
|
39
|
+
level := slog.LevelInfo
|
|
40
|
+
if lvl, ok := options["level"].(string); ok {
|
|
41
|
+
switch lvl {
|
|
42
|
+
case "debug":
|
|
43
|
+
level = slog.LevelDebug
|
|
44
|
+
case "warn":
|
|
45
|
+
level = slog.LevelWarn
|
|
46
|
+
case "error":
|
|
47
|
+
level = slog.LevelError
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
f.logger = slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
|
|
52
|
+
Level: level,
|
|
53
|
+
})).With("name", "log")
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
func (f *LogFeature) PostConstruct(ctx *core.Context) {
|
|
59
|
+
f.loghook("PostConstruct", ctx, "")
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
func (f *LogFeature) PostConstructEntity(ctx *core.Context) {
|
|
63
|
+
f.loghook("PostConstructEntity", ctx, "")
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
func (f *LogFeature) SetData(ctx *core.Context) {
|
|
67
|
+
f.loghook("SetData", ctx, "")
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
func (f *LogFeature) GetData(ctx *core.Context) {
|
|
71
|
+
f.loghook("GetData", ctx, "")
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
func (f *LogFeature) SetMatch(ctx *core.Context) {
|
|
75
|
+
f.loghook("SetMatch", ctx, "")
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
func (f *LogFeature) GetMatch(ctx *core.Context) {
|
|
79
|
+
f.loghook("GetMatch", ctx, "")
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
func (f *LogFeature) PrePoint(ctx *core.Context) {
|
|
83
|
+
f.loghook("PrePoint", ctx, "")
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
func (f *LogFeature) PreSpec(ctx *core.Context) {
|
|
87
|
+
f.loghook("PreSpec", ctx, "")
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
func (f *LogFeature) PreRequest(ctx *core.Context) {
|
|
91
|
+
f.loghook("PreRequest", ctx, "")
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
func (f *LogFeature) PreResponse(ctx *core.Context) {
|
|
95
|
+
f.loghook("PreResponse", ctx, "")
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
func (f *LogFeature) PreResult(ctx *core.Context) {
|
|
99
|
+
f.loghook("PreResult", ctx, "")
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
func (f *LogFeature) loghook(hook string, ctx *core.Context, level string) {
|
|
103
|
+
if f.logger == nil {
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if level == "" {
|
|
108
|
+
level = "info"
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
attrs := []any{
|
|
112
|
+
"hook", hook,
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if ctx.Op != nil {
|
|
116
|
+
attrs = append(attrs, "op", ctx.Op.Name)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if ctx.Spec != nil {
|
|
120
|
+
attrs = append(attrs, "spec", ctx.Spec.Name)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
switch level {
|
|
124
|
+
case "debug":
|
|
125
|
+
f.logger.Debug("hook", attrs...)
|
|
126
|
+
case "warn":
|
|
127
|
+
f.logger.Warn("hook", attrs...)
|
|
128
|
+
case "error":
|
|
129
|
+
f.logger.Error("hook", attrs...)
|
|
130
|
+
default:
|
|
131
|
+
f.logger.Info("hook", attrs...)
|
|
132
|
+
}
|
|
133
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) $$const.year$$ $$const.Name$$
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
-- ProjectName SDK context
|
|
2
|
+
|
|
3
|
+
local vs = require("utility.struct.struct")
|
|
4
|
+
local Control = require("core.control")
|
|
5
|
+
local Operation = require("core.operation")
|
|
6
|
+
local Spec = require("core.spec")
|
|
7
|
+
local Result = require("core.result")
|
|
8
|
+
local Response = require("core.response")
|
|
9
|
+
local ProjectNameError = require("core.error")
|
|
10
|
+
local helpers = require("core.helpers")
|
|
11
|
+
|
|
12
|
+
local Context = {}
|
|
13
|
+
Context.__index = Context
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
function Context.new(ctxmap, basectx)
|
|
17
|
+
local self = setmetatable({}, Context)
|
|
18
|
+
|
|
19
|
+
self.id = "C" .. tostring(math.random(10000000, 99999999))
|
|
20
|
+
self.out = {}
|
|
21
|
+
|
|
22
|
+
ctxmap = ctxmap or {}
|
|
23
|
+
|
|
24
|
+
-- Client
|
|
25
|
+
local c = helpers.get_ctx_prop(ctxmap, "client")
|
|
26
|
+
if c ~= nil then
|
|
27
|
+
self.client = c
|
|
28
|
+
elseif basectx ~= nil then
|
|
29
|
+
self.client = basectx.client
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
-- Utility
|
|
33
|
+
local u = helpers.get_ctx_prop(ctxmap, "utility")
|
|
34
|
+
if u ~= nil then
|
|
35
|
+
self.utility = u
|
|
36
|
+
elseif basectx ~= nil then
|
|
37
|
+
self.utility = basectx.utility
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
-- Ctrl
|
|
41
|
+
self.ctrl = Control.new()
|
|
42
|
+
local ctrl_raw = helpers.get_ctx_prop(ctxmap, "ctrl")
|
|
43
|
+
if type(ctrl_raw) == "table" then
|
|
44
|
+
if ctrl_raw.throw_err ~= nil then
|
|
45
|
+
self.ctrl.throw_err = ctrl_raw.throw_err
|
|
46
|
+
elseif type(ctrl_raw["throw"]) == "boolean" then
|
|
47
|
+
self.ctrl.throw_err = ctrl_raw["throw"]
|
|
48
|
+
end
|
|
49
|
+
if type(ctrl_raw.explain) == "table" then
|
|
50
|
+
self.ctrl.explain = ctrl_raw.explain
|
|
51
|
+
end
|
|
52
|
+
elseif basectx ~= nil and basectx.ctrl ~= nil then
|
|
53
|
+
self.ctrl = basectx.ctrl
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
-- Meta
|
|
57
|
+
self.meta = {}
|
|
58
|
+
local m = helpers.get_ctx_prop(ctxmap, "meta")
|
|
59
|
+
if type(m) == "table" then
|
|
60
|
+
self.meta = m
|
|
61
|
+
elseif basectx ~= nil and basectx.meta ~= nil then
|
|
62
|
+
self.meta = basectx.meta
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
-- Config
|
|
66
|
+
local cfg = helpers.get_ctx_prop(ctxmap, "config")
|
|
67
|
+
if type(cfg) == "table" then
|
|
68
|
+
self.config = cfg
|
|
69
|
+
elseif basectx ~= nil then
|
|
70
|
+
self.config = basectx.config
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
-- Entopts
|
|
74
|
+
local eo = helpers.get_ctx_prop(ctxmap, "entopts")
|
|
75
|
+
if type(eo) == "table" then
|
|
76
|
+
self.entopts = eo
|
|
77
|
+
elseif basectx ~= nil then
|
|
78
|
+
self.entopts = basectx.entopts
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
-- Options
|
|
82
|
+
local o = helpers.get_ctx_prop(ctxmap, "options")
|
|
83
|
+
if type(o) == "table" then
|
|
84
|
+
self.options = o
|
|
85
|
+
elseif basectx ~= nil then
|
|
86
|
+
self.options = basectx.options
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
-- Entity
|
|
90
|
+
local e = helpers.get_ctx_prop(ctxmap, "entity")
|
|
91
|
+
if e ~= nil then
|
|
92
|
+
self.entity = e
|
|
93
|
+
elseif basectx ~= nil then
|
|
94
|
+
self.entity = basectx.entity
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
-- Shared
|
|
98
|
+
local s = helpers.get_ctx_prop(ctxmap, "shared")
|
|
99
|
+
if type(s) == "table" then
|
|
100
|
+
self.shared = s
|
|
101
|
+
elseif basectx ~= nil then
|
|
102
|
+
self.shared = basectx.shared
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
-- Opmap
|
|
106
|
+
local om = helpers.get_ctx_prop(ctxmap, "opmap")
|
|
107
|
+
if type(om) == "table" then
|
|
108
|
+
self.opmap = om
|
|
109
|
+
elseif basectx ~= nil then
|
|
110
|
+
self.opmap = basectx.opmap
|
|
111
|
+
end
|
|
112
|
+
if self.opmap == nil then
|
|
113
|
+
self.opmap = {}
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
-- Data
|
|
117
|
+
self.data = helpers.to_map(helpers.get_ctx_prop(ctxmap, "data")) or {}
|
|
118
|
+
self.reqdata = helpers.to_map(helpers.get_ctx_prop(ctxmap, "reqdata")) or {}
|
|
119
|
+
self.match = helpers.to_map(helpers.get_ctx_prop(ctxmap, "match")) or {}
|
|
120
|
+
self.reqmatch = helpers.to_map(helpers.get_ctx_prop(ctxmap, "reqmatch")) or {}
|
|
121
|
+
|
|
122
|
+
-- Point
|
|
123
|
+
local pt = helpers.get_ctx_prop(ctxmap, "point")
|
|
124
|
+
if type(pt) == "table" then
|
|
125
|
+
self.point = pt
|
|
126
|
+
elseif basectx ~= nil then
|
|
127
|
+
self.point = basectx.point
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
-- Spec
|
|
131
|
+
local sp = helpers.get_ctx_prop(ctxmap, "spec")
|
|
132
|
+
if sp ~= nil and getmetatable(sp) == Spec then
|
|
133
|
+
self.spec = sp
|
|
134
|
+
elseif basectx ~= nil then
|
|
135
|
+
self.spec = basectx.spec
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
-- Result
|
|
139
|
+
local r = helpers.get_ctx_prop(ctxmap, "result")
|
|
140
|
+
if r ~= nil and getmetatable(r) == Result then
|
|
141
|
+
self.result = r
|
|
142
|
+
elseif basectx ~= nil then
|
|
143
|
+
self.result = basectx.result
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
-- Response
|
|
147
|
+
local rp = helpers.get_ctx_prop(ctxmap, "response")
|
|
148
|
+
if rp ~= nil and getmetatable(rp) == Response then
|
|
149
|
+
self.response = rp
|
|
150
|
+
elseif basectx ~= nil then
|
|
151
|
+
self.response = basectx.response
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
-- Resolve operation
|
|
155
|
+
local opname = helpers.get_ctx_prop(ctxmap, "opname") or ""
|
|
156
|
+
self.op = self:resolve_op(opname)
|
|
157
|
+
|
|
158
|
+
return self
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
function Context:resolve_op(opname)
|
|
163
|
+
if self.opmap[opname] ~= nil then
|
|
164
|
+
return self.opmap[opname]
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
if opname == "" then
|
|
168
|
+
return Operation.new({})
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
local entname = "_"
|
|
172
|
+
if self.entity ~= nil and type(self.entity.get_name) == "function" then
|
|
173
|
+
entname = self.entity:get_name()
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
local opcfg = vs.getpath(self.config, "entity." .. entname .. ".op." .. opname)
|
|
177
|
+
|
|
178
|
+
local input = "match"
|
|
179
|
+
if opname == "update" or opname == "create" then
|
|
180
|
+
input = "data"
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
local points = {}
|
|
184
|
+
if type(opcfg) == "table" then
|
|
185
|
+
local t = vs.getprop(opcfg, "points")
|
|
186
|
+
if type(t) == "table" then
|
|
187
|
+
points = t
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
local op = Operation.new({
|
|
192
|
+
entity = entname,
|
|
193
|
+
name = opname,
|
|
194
|
+
input = input,
|
|
195
|
+
points = points,
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
self.opmap[opname] = op
|
|
199
|
+
return op
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
function Context:make_error(code, msg)
|
|
204
|
+
return ProjectNameError.new(code, msg, self)
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
return Context
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
-- ProjectName SDK control
|
|
2
|
+
|
|
3
|
+
local Control = {}
|
|
4
|
+
Control.__index = Control
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function Control.new(opts)
|
|
8
|
+
opts = opts or {}
|
|
9
|
+
local self = setmetatable({}, Control)
|
|
10
|
+
self.throw_err = opts.throw_err
|
|
11
|
+
self.err = nil
|
|
12
|
+
self.explain = opts.explain
|
|
13
|
+
return self
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
return Control
|