@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,86 @@
|
|
|
1
|
+
-- ProjectName SDK test runner
|
|
2
|
+
|
|
3
|
+
local json = require("dkjson")
|
|
4
|
+
local vs = require("utility.struct.struct")
|
|
5
|
+
|
|
6
|
+
local runner = {}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
function runner.load_env_local()
|
|
10
|
+
local f = io.open("../../.env.local", "r")
|
|
11
|
+
if f == nil then
|
|
12
|
+
return
|
|
13
|
+
end
|
|
14
|
+
local content = f:read("*a")
|
|
15
|
+
f:close()
|
|
16
|
+
for line in content:gmatch("[^\r\n]+") do
|
|
17
|
+
line = line:match("^%s*(.-)%s*$")
|
|
18
|
+
if line ~= "" and not line:match("^#") then
|
|
19
|
+
local key, val = line:match("^([^=]+)=(.*)$")
|
|
20
|
+
if key and val then
|
|
21
|
+
key = key:match("^%s*(.-)%s*$")
|
|
22
|
+
val = val:match("^%s*(.-)%s*$")
|
|
23
|
+
-- Set as env variable (platform-dependent, stored in table)
|
|
24
|
+
runner._env[key] = val
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
runner._env = {}
|
|
31
|
+
|
|
32
|
+
function runner.getenv(key)
|
|
33
|
+
return runner._env[key] or os.getenv(key)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
function runner.env_override(m)
|
|
38
|
+
local live = runner.getenv("PROJECTNAME_TEST_LIVE")
|
|
39
|
+
local override = runner.getenv("PROJECTNAME_TEST_OVERRIDE")
|
|
40
|
+
|
|
41
|
+
if live == "TRUE" or override == "TRUE" then
|
|
42
|
+
for key, _ in pairs(m) do
|
|
43
|
+
local envval = runner.getenv(key)
|
|
44
|
+
if envval ~= nil and envval ~= "" then
|
|
45
|
+
envval = envval:match("^%s*(.-)%s*$")
|
|
46
|
+
if envval:sub(1, 1) == "{" then
|
|
47
|
+
local parsed = json.decode(envval)
|
|
48
|
+
if parsed ~= nil then
|
|
49
|
+
m[key] = parsed
|
|
50
|
+
goto continue
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
m[key] = envval
|
|
54
|
+
::continue::
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
local explain = runner.getenv("PROJECTNAME_TEST_EXPLAIN")
|
|
60
|
+
if explain ~= nil and explain ~= "" then
|
|
61
|
+
m["PROJECTNAME_TEST_EXPLAIN"] = explain
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
return m
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
function runner.entity_list_to_data(list)
|
|
69
|
+
local out = {}
|
|
70
|
+
for _, item in ipairs(list) do
|
|
71
|
+
if type(item) == "table" then
|
|
72
|
+
if type(item.data_get) == "function" then
|
|
73
|
+
local d = item:data_get()
|
|
74
|
+
if type(d) == "table" then
|
|
75
|
+
table.insert(out, d)
|
|
76
|
+
end
|
|
77
|
+
else
|
|
78
|
+
table.insert(out, item)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
return out
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
return runner
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
-- ProjectName SDK utility: done
|
|
2
|
+
|
|
3
|
+
local function done_util(ctx)
|
|
4
|
+
if ctx.ctrl.explain ~= nil then
|
|
5
|
+
ctx.ctrl.explain = ctx.utility.clean(ctx, ctx.ctrl.explain)
|
|
6
|
+
local explain_result = ctx.ctrl.explain["result"]
|
|
7
|
+
if type(explain_result) == "table" then
|
|
8
|
+
explain_result["err"] = nil
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
if ctx.result ~= nil and ctx.result.ok then
|
|
13
|
+
return ctx.result.resdata, nil
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
return ctx.utility.make_error(ctx, nil)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
return done_util
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- ProjectName SDK utility: feature_hook
|
|
2
|
+
|
|
3
|
+
local function feature_hook_util(ctx, name)
|
|
4
|
+
local client = ctx.client
|
|
5
|
+
if client == nil then
|
|
6
|
+
return
|
|
7
|
+
end
|
|
8
|
+
local features = client.features
|
|
9
|
+
if features == nil then
|
|
10
|
+
return
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
for _, f in ipairs(features) do
|
|
14
|
+
local method = f[name]
|
|
15
|
+
if type(method) == "function" then
|
|
16
|
+
method(f, ctx)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
return feature_hook_util
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
-- ProjectName SDK utility: feature_init
|
|
2
|
+
|
|
3
|
+
local vs = require("utility.struct.struct")
|
|
4
|
+
|
|
5
|
+
local function feature_init_util(ctx, f)
|
|
6
|
+
local fname = f:get_name()
|
|
7
|
+
local fopts = {}
|
|
8
|
+
|
|
9
|
+
if ctx.options ~= nil then
|
|
10
|
+
local feature_opts = vs.getprop(ctx.options, "feature")
|
|
11
|
+
if type(feature_opts) == "table" then
|
|
12
|
+
local fo = vs.getprop(feature_opts, fname)
|
|
13
|
+
if type(fo) == "table" then
|
|
14
|
+
fopts = fo
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
if fopts["active"] == true then
|
|
20
|
+
f:init(ctx, fopts)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
return feature_init_util
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
-- ProjectName SDK utility: fetcher
|
|
2
|
+
|
|
3
|
+
local vs = require("utility.struct.struct")
|
|
4
|
+
local json = require("dkjson")
|
|
5
|
+
|
|
6
|
+
local function default_http_fetch(fullurl, fetchdef)
|
|
7
|
+
-- Use LuaSocket or similar for real HTTP requests.
|
|
8
|
+
-- This is the default live implementation.
|
|
9
|
+
local http_ok, http = pcall(require, "socket.http")
|
|
10
|
+
local ltn12_ok, ltn12 = pcall(require, "ltn12")
|
|
11
|
+
|
|
12
|
+
if not http_ok or not ltn12_ok then
|
|
13
|
+
return nil, "HTTP library not available (install luasocket)"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
local method = fetchdef["method"] or "GET"
|
|
17
|
+
local body_str = fetchdef["body"]
|
|
18
|
+
local headers = fetchdef["headers"] or {}
|
|
19
|
+
|
|
20
|
+
if type(body_str) ~= "string" then
|
|
21
|
+
body_str = nil
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
if body_str ~= nil then
|
|
25
|
+
headers["content-length"] = tostring(#body_str)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
local response_body = {}
|
|
29
|
+
local res, code, response_headers = http.request({
|
|
30
|
+
url = fullurl,
|
|
31
|
+
method = method,
|
|
32
|
+
headers = headers,
|
|
33
|
+
source = body_str and ltn12.source.string(body_str) or nil,
|
|
34
|
+
sink = ltn12.sink.table(response_body),
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
if not res then
|
|
38
|
+
return nil, code
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
local body = table.concat(response_body)
|
|
42
|
+
local resp_headers = {}
|
|
43
|
+
if type(response_headers) == "table" then
|
|
44
|
+
for k, v in pairs(response_headers) do
|
|
45
|
+
resp_headers[string.lower(k)] = v
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
local json_body = nil
|
|
50
|
+
if #body > 0 then
|
|
51
|
+
json_body = json.decode(body)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
local status_text = "OK"
|
|
55
|
+
if code >= 400 then
|
|
56
|
+
status_text = "Error"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
status = code,
|
|
61
|
+
statusText = status_text,
|
|
62
|
+
headers = resp_headers,
|
|
63
|
+
json = function() return json_body end,
|
|
64
|
+
body = body,
|
|
65
|
+
}, nil
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
local function fetcher_util(ctx, fullurl, fetchdef)
|
|
70
|
+
if ctx.client.mode ~= "live" then
|
|
71
|
+
return nil, ctx:make_error("fetch_mode_block",
|
|
72
|
+
'Request blocked by mode: "' .. ctx.client.mode ..
|
|
73
|
+
'" (URL was: "' .. fullurl .. '")')
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
local options = ctx.client:options_map()
|
|
77
|
+
if vs.getpath(options, "feature.test.active") == true then
|
|
78
|
+
return nil, ctx:make_error("fetch_test_block",
|
|
79
|
+
'Request blocked as test feature is active' ..
|
|
80
|
+
' (URL was: "' .. fullurl .. '")')
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
local sys_fetch = vs.getpath(options, "system.fetch")
|
|
84
|
+
|
|
85
|
+
if sys_fetch == nil then
|
|
86
|
+
return default_http_fetch(fullurl, fetchdef)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
if type(sys_fetch) == "function" then
|
|
90
|
+
return sys_fetch(fullurl, fetchdef)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
return nil, ctx:make_error("fetch_invalid", "system.fetch is not a valid function")
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
return fetcher_util
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
-- ProjectName SDK utility: make_error
|
|
2
|
+
|
|
3
|
+
local Operation = require("core.operation")
|
|
4
|
+
local Result = require("core.result")
|
|
5
|
+
local Control = require("core.control")
|
|
6
|
+
local ProjectNameError = require("core.error")
|
|
7
|
+
|
|
8
|
+
local function make_error_util(ctx, err)
|
|
9
|
+
if ctx == nil then
|
|
10
|
+
local Context = require("core.context")
|
|
11
|
+
ctx = Context.new({}, nil)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
local op = ctx.op
|
|
15
|
+
if op == nil then
|
|
16
|
+
op = Operation.new({})
|
|
17
|
+
end
|
|
18
|
+
local opname = op.name
|
|
19
|
+
if opname == "" or opname == "_" then
|
|
20
|
+
opname = "unknown operation"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
local result = ctx.result
|
|
24
|
+
if result == nil then
|
|
25
|
+
result = Result.new({})
|
|
26
|
+
end
|
|
27
|
+
result.ok = false
|
|
28
|
+
|
|
29
|
+
if err == nil then
|
|
30
|
+
err = result.err
|
|
31
|
+
end
|
|
32
|
+
if err == nil then
|
|
33
|
+
err = ctx:make_error("unknown", "unknown error")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
local errmsg = ""
|
|
37
|
+
if type(err) == "table" and err.msg ~= nil then
|
|
38
|
+
errmsg = err.msg
|
|
39
|
+
elseif type(err) == "string" then
|
|
40
|
+
errmsg = err
|
|
41
|
+
else
|
|
42
|
+
errmsg = tostring(err)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
local msg = "ProjectNameSDK: " .. opname .. ": " .. errmsg
|
|
46
|
+
msg = ctx.utility.clean(ctx, msg)
|
|
47
|
+
|
|
48
|
+
result.err = nil
|
|
49
|
+
|
|
50
|
+
local spec = ctx.spec
|
|
51
|
+
|
|
52
|
+
if ctx.ctrl.explain ~= nil then
|
|
53
|
+
ctx.ctrl.explain["err"] = { message = msg }
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
local sdk_err = ProjectNameError.new("", msg, ctx)
|
|
57
|
+
sdk_err.result = ctx.utility.clean(ctx, result)
|
|
58
|
+
sdk_err.spec = ctx.utility.clean(ctx, spec)
|
|
59
|
+
|
|
60
|
+
if type(err) == "table" and getmetatable(err) == ProjectNameError then
|
|
61
|
+
sdk_err.code = err.code
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
ctx.ctrl.err = sdk_err
|
|
65
|
+
|
|
66
|
+
if ctx.ctrl.throw_err == false then
|
|
67
|
+
return result.resdata, nil
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
return nil, sdk_err
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
return make_error_util
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
-- ProjectName SDK utility: make_fetch_def
|
|
2
|
+
|
|
3
|
+
local vs = require("utility.struct.struct")
|
|
4
|
+
|
|
5
|
+
local function make_fetch_def_util(ctx)
|
|
6
|
+
local spec = ctx.spec
|
|
7
|
+
if spec == nil then
|
|
8
|
+
return nil, ctx:make_error("fetchdef_no_spec",
|
|
9
|
+
"Expected context spec property to be defined.")
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
local Result = require("core.result")
|
|
13
|
+
if ctx.result == nil then
|
|
14
|
+
ctx.result = Result.new({})
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
spec.step = "prepare"
|
|
18
|
+
|
|
19
|
+
local url, err = ctx.utility.make_url(ctx)
|
|
20
|
+
if err ~= nil then
|
|
21
|
+
return nil, err
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
spec.url = url
|
|
25
|
+
|
|
26
|
+
local fetchdef = {
|
|
27
|
+
url = url,
|
|
28
|
+
method = spec.method,
|
|
29
|
+
headers = spec.headers,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if spec.body ~= nil then
|
|
33
|
+
if type(spec.body) == "table" then
|
|
34
|
+
fetchdef["body"] = vs.jsonify(spec.body)
|
|
35
|
+
else
|
|
36
|
+
fetchdef["body"] = spec.body
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
return fetchdef, nil
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
return make_fetch_def_util
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
-- ProjectName SDK utility: make_options
|
|
2
|
+
|
|
3
|
+
local vs = require("utility.struct.struct")
|
|
4
|
+
|
|
5
|
+
local function make_options_util(ctx)
|
|
6
|
+
local options = ctx.options or {}
|
|
7
|
+
|
|
8
|
+
-- Merge custom utility overrides.
|
|
9
|
+
local custom_utils = vs.getprop(options, "utility")
|
|
10
|
+
if type(custom_utils) == "table" then
|
|
11
|
+
local utility = ctx.utility
|
|
12
|
+
if utility ~= nil then
|
|
13
|
+
for key, val in pairs(custom_utils) do
|
|
14
|
+
utility.custom[key] = val
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
local opts = vs.clone(options)
|
|
20
|
+
if type(opts) ~= "table" then
|
|
21
|
+
opts = {}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
local config = ctx.config or {}
|
|
25
|
+
local cfgopts = {}
|
|
26
|
+
local co = config["options"]
|
|
27
|
+
if type(co) == "table" then
|
|
28
|
+
cfgopts = co
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
local optspec = {
|
|
32
|
+
apikey = "",
|
|
33
|
+
base = "http://localhost:8000",
|
|
34
|
+
prefix = "",
|
|
35
|
+
suffix = "",
|
|
36
|
+
auth = {
|
|
37
|
+
prefix = "",
|
|
38
|
+
},
|
|
39
|
+
headers = {
|
|
40
|
+
["`$CHILD`"] = "`$STRING`",
|
|
41
|
+
},
|
|
42
|
+
allow = {
|
|
43
|
+
method = "GET,PUT,POST,PATCH,DELETE,OPTIONS",
|
|
44
|
+
op = "create,update,load,list,remove,command,direct",
|
|
45
|
+
},
|
|
46
|
+
entity = {
|
|
47
|
+
["`$CHILD`"] = {
|
|
48
|
+
["`$OPEN`"] = true,
|
|
49
|
+
active = false,
|
|
50
|
+
alias = {},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
feature = {
|
|
54
|
+
["`$CHILD`"] = {
|
|
55
|
+
["`$OPEN`"] = true,
|
|
56
|
+
active = false,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
utility = {},
|
|
60
|
+
system = {},
|
|
61
|
+
test = {
|
|
62
|
+
active = false,
|
|
63
|
+
entity = {
|
|
64
|
+
["`$OPEN`"] = true,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
clean = {
|
|
68
|
+
keys = "key,token,id",
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
-- Preserve system.fetch before merge/validate.
|
|
73
|
+
local sys_fetch = vs.getpath(opts, "system.fetch")
|
|
74
|
+
|
|
75
|
+
local merged = vs.merge({ {}, cfgopts, opts })
|
|
76
|
+
local validated = vs.validate(merged, optspec)
|
|
77
|
+
if type(validated) ~= "table" then
|
|
78
|
+
validated = {}
|
|
79
|
+
end
|
|
80
|
+
opts = validated
|
|
81
|
+
|
|
82
|
+
-- Restore system.fetch.
|
|
83
|
+
if sys_fetch ~= nil then
|
|
84
|
+
if type(opts["system"]) == "table" then
|
|
85
|
+
opts["system"]["fetch"] = sys_fetch
|
|
86
|
+
else
|
|
87
|
+
opts["system"] = { fetch = sys_fetch }
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
-- Derived clean config.
|
|
92
|
+
local clean_keys = "key,token,id"
|
|
93
|
+
local ck = vs.getpath(opts, "clean.keys")
|
|
94
|
+
if type(ck) == "string" then
|
|
95
|
+
clean_keys = ck
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
local parts = {}
|
|
99
|
+
for part in string.gmatch(clean_keys, "[^,]+") do
|
|
100
|
+
local trimmed = part:match("^%s*(.-)%s*$")
|
|
101
|
+
if trimmed ~= "" then
|
|
102
|
+
table.insert(parts, vs.escre(trimmed))
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
local keyre = table.concat(parts, "|")
|
|
106
|
+
|
|
107
|
+
local derived = { clean = {} }
|
|
108
|
+
if keyre ~= "" then
|
|
109
|
+
derived.clean = { keyre = keyre }
|
|
110
|
+
end
|
|
111
|
+
opts["__derived__"] = derived
|
|
112
|
+
|
|
113
|
+
return opts
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
return make_options_util
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
-- ProjectName SDK utility: make_point
|
|
2
|
+
|
|
3
|
+
local vs = require("utility.struct.struct")
|
|
4
|
+
local helpers = require("core.helpers")
|
|
5
|
+
|
|
6
|
+
local function make_point_util(ctx)
|
|
7
|
+
if ctx.out["point"] ~= nil then
|
|
8
|
+
ctx.point = ctx.out["point"]
|
|
9
|
+
return ctx.point, nil
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
local op = ctx.op
|
|
13
|
+
local options = ctx.options
|
|
14
|
+
|
|
15
|
+
local allow_op = vs.getpath(options, "allow.op") or ""
|
|
16
|
+
if type(allow_op) == "string" and not string.find(allow_op, op.name, 1, true) then
|
|
17
|
+
return nil, ctx:make_error("point_op_allow",
|
|
18
|
+
'Operation "' .. op.name ..
|
|
19
|
+
'" not allowed by SDK option allow.op value: "' .. allow_op .. '"')
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
if #op.points == 0 then
|
|
23
|
+
return nil, ctx:make_error("point_no_points",
|
|
24
|
+
'Operation "' .. op.name .. '" has no endpoint definitions.')
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
if #op.points == 1 then
|
|
28
|
+
ctx.point = op.points[1]
|
|
29
|
+
else
|
|
30
|
+
local reqselector, selector
|
|
31
|
+
if op.input == "data" then
|
|
32
|
+
reqselector = ctx.reqdata
|
|
33
|
+
selector = ctx.data
|
|
34
|
+
else
|
|
35
|
+
reqselector = ctx.reqmatch
|
|
36
|
+
selector = ctx.match
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
local point = nil
|
|
40
|
+
for i = 1, #op.points do
|
|
41
|
+
point = op.points[i]
|
|
42
|
+
local select_def = helpers.to_map(vs.getprop(point, "select"))
|
|
43
|
+
local found = true
|
|
44
|
+
|
|
45
|
+
if selector ~= nil and select_def ~= nil then
|
|
46
|
+
local exist = vs.getprop(select_def, "exist")
|
|
47
|
+
if type(exist) == "table" then
|
|
48
|
+
for _, ek in ipairs(exist) do
|
|
49
|
+
local existkey = tostring(ek)
|
|
50
|
+
local rv = vs.getprop(reqselector, existkey)
|
|
51
|
+
local sv = vs.getprop(selector, existkey)
|
|
52
|
+
if rv == nil and sv == nil then
|
|
53
|
+
found = false
|
|
54
|
+
break
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
if found then
|
|
61
|
+
local req_action = vs.getprop(reqselector, "$action")
|
|
62
|
+
local select_action = vs.getprop(select_def, "$action")
|
|
63
|
+
if req_action ~= select_action then
|
|
64
|
+
found = false
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
if found then
|
|
69
|
+
break
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
if reqselector ~= nil then
|
|
74
|
+
local req_action = vs.getprop(reqselector, "$action")
|
|
75
|
+
if req_action ~= nil and point ~= nil then
|
|
76
|
+
local point_select = helpers.to_map(vs.getprop(point, "select"))
|
|
77
|
+
local point_action = vs.getprop(point_select, "$action")
|
|
78
|
+
if req_action ~= point_action then
|
|
79
|
+
return nil, ctx:make_error("point_action_invalid",
|
|
80
|
+
'Operation "' .. op.name ..
|
|
81
|
+
'" action "' .. vs.stringify(req_action) .. '" is not valid.')
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
ctx.point = point
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
return ctx.point, nil
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
return make_point_util
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
-- ProjectName SDK utility: make_request
|
|
2
|
+
|
|
3
|
+
local Response = require("core.response")
|
|
4
|
+
local Result = require("core.result")
|
|
5
|
+
|
|
6
|
+
local function make_request_util(ctx)
|
|
7
|
+
if ctx.out["request"] ~= nil then
|
|
8
|
+
return ctx.out["request"], nil
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
local spec = ctx.spec
|
|
12
|
+
local utility = ctx.utility
|
|
13
|
+
|
|
14
|
+
local response = Response.new({})
|
|
15
|
+
local result = Result.new({})
|
|
16
|
+
ctx.result = result
|
|
17
|
+
|
|
18
|
+
if spec == nil then
|
|
19
|
+
return nil, ctx:make_error("request_no_spec",
|
|
20
|
+
"Expected context spec property to be defined.")
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
local fetchdef, err = utility.make_fetch_def(ctx)
|
|
24
|
+
if err ~= nil then
|
|
25
|
+
response.err = err
|
|
26
|
+
ctx.response = response
|
|
27
|
+
spec.step = "postrequest"
|
|
28
|
+
return response, nil
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
if ctx.ctrl.explain ~= nil then
|
|
32
|
+
ctx.ctrl.explain["fetchdef"] = fetchdef
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
spec.step = "prerequest"
|
|
36
|
+
|
|
37
|
+
local url = fetchdef["url"] or ""
|
|
38
|
+
local fetched, fetch_err = utility.fetcher(ctx, url, fetchdef)
|
|
39
|
+
|
|
40
|
+
if fetch_err ~= nil then
|
|
41
|
+
response.err = fetch_err
|
|
42
|
+
elseif fetched == nil then
|
|
43
|
+
response = Response.new({
|
|
44
|
+
err = ctx:make_error("request_no_response", "response: undefined"),
|
|
45
|
+
})
|
|
46
|
+
elseif type(fetched) == "table" then
|
|
47
|
+
response = Response.new(fetched)
|
|
48
|
+
else
|
|
49
|
+
response.err = ctx:make_error("request_invalid_response", "response: invalid type")
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
spec.step = "postrequest"
|
|
53
|
+
ctx.response = response
|
|
54
|
+
|
|
55
|
+
return response, nil
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
return make_request_util
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
-- ProjectName SDK utility: make_response
|
|
2
|
+
|
|
3
|
+
local function make_response_util(ctx)
|
|
4
|
+
if ctx.out["response"] ~= nil then
|
|
5
|
+
return ctx.out["response"], nil
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
local utility = ctx.utility
|
|
9
|
+
local spec = ctx.spec
|
|
10
|
+
local result = ctx.result
|
|
11
|
+
local response = ctx.response
|
|
12
|
+
|
|
13
|
+
if spec == nil then
|
|
14
|
+
return nil, ctx:make_error("response_no_spec",
|
|
15
|
+
"Expected context spec property to be defined.")
|
|
16
|
+
end
|
|
17
|
+
if response == nil then
|
|
18
|
+
return nil, ctx:make_error("response_no_response",
|
|
19
|
+
"Expected context response property to be defined.")
|
|
20
|
+
end
|
|
21
|
+
if result == nil then
|
|
22
|
+
return nil, ctx:make_error("response_no_result",
|
|
23
|
+
"Expected context result property to be defined.")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
spec.step = "response"
|
|
27
|
+
|
|
28
|
+
utility.result_basic(ctx)
|
|
29
|
+
utility.result_headers(ctx)
|
|
30
|
+
utility.result_body(ctx)
|
|
31
|
+
utility.transform_response(ctx)
|
|
32
|
+
|
|
33
|
+
if result.err == nil then
|
|
34
|
+
result.ok = true
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
if ctx.ctrl.explain ~= nil then
|
|
38
|
+
ctx.ctrl.explain["result"] = result
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
return response, nil
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
return make_response_util
|