@voxgig/sdkgen 0.35.2 → 0.37.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/Main.js +0 -12
- package/dist/cmp/Main.js.map +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/Config_go.ts +6 -2
- 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/EntityBase_js.ts +34 -0
- package/project/.sdk/src/cmp/js/Main_js.ts +10 -0
- package/project/.sdk/src/cmp/js/ReadmeExplanation_js.ts +33 -0
- package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +123 -0
- package/project/.sdk/src/cmp/js/ReadmeModel_js.ts +152 -0
- package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +1 -1
- package/project/.sdk/src/cmp/js/ReadmeTopHowto_js.ts +25 -0
- package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +65 -0
- package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +36 -0
- package/project/.sdk/src/cmp/js/TestDirect_js.ts +53 -5
- package/project/.sdk/src/cmp/js/TestEntity_js.ts +114 -20
- package/project/.sdk/src/cmp/js/fragment/Entity.fragment.js +7 -139
- package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +149 -0
- package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +6 -10
- package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +6 -10
- package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +7 -11
- package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +7 -11
- package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +7 -11
- package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +2 -0
- package/project/.sdk/src/cmp/js/fragment/SdkError.fragment.js +0 -2
- package/project/.sdk/src/cmp/lua/Config_lua.ts +116 -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 +485 -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 +111 -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 +479 -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 +97 -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 +477 -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 +105 -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/Main_ts.ts +7 -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/go/test/runner_test.go +16 -2
- package/project/.sdk/tm/js/src/Context.js +142 -0
- package/project/.sdk/tm/js/src/Control.js +16 -0
- package/project/.sdk/tm/js/src/Operation.js +19 -0
- package/project/.sdk/tm/js/src/Point.js +24 -0
- package/project/.sdk/tm/js/src/README.md +1 -0
- package/project/.sdk/tm/js/src/Response.js +19 -0
- package/project/.sdk/tm/js/src/Result.js +21 -0
- package/project/.sdk/tm/js/src/Spec.js +26 -0
- package/project/.sdk/tm/js/src/feature/README.md +1 -0
- package/project/.sdk/tm/js/src/feature/base/BaseFeature.js +45 -0
- package/project/.sdk/tm/js/src/feature/log/LogFeature.js +46 -47
- package/project/.sdk/tm/js/src/feature/test/TestFeature.js +207 -0
- package/project/.sdk/tm/js/src/types.js +22 -0
- package/project/.sdk/tm/js/src/utility/CleanUtility.js +31 -0
- package/project/.sdk/tm/js/src/utility/DoneUtility.js +11 -4
- package/project/.sdk/tm/js/src/utility/FeatureAddUtility.js +42 -0
- package/project/.sdk/tm/js/src/utility/FeatureHookUtility.js +25 -0
- package/project/.sdk/tm/js/src/utility/FeatureInitUtility.js +11 -0
- package/project/.sdk/tm/js/src/utility/FetcherUtility.js +28 -0
- package/project/.sdk/tm/js/src/utility/MakeContextUtility.js +11 -0
- package/project/.sdk/tm/js/src/utility/MakeErrorUtility.js +55 -0
- package/project/.sdk/tm/js/src/utility/MakeFetchDefUtility.js +44 -0
- package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +93 -0
- package/project/.sdk/tm/js/src/utility/MakePointUtility.js +77 -0
- package/project/.sdk/tm/js/src/utility/MakeRequestUtility.js +63 -0
- package/project/.sdk/tm/js/src/utility/MakeResponseUtility.js +55 -0
- package/project/.sdk/tm/js/src/utility/MakeResultUtility.js +54 -0
- package/project/.sdk/tm/js/src/utility/MakeSpecUtility.js +58 -0
- package/project/.sdk/tm/js/src/utility/MakeUrlUtility.js +40 -0
- package/project/.sdk/tm/js/src/utility/ParamUtility.js +61 -0
- package/project/.sdk/tm/js/src/utility/PrepareAuthUtility.js +41 -0
- package/project/.sdk/tm/js/src/utility/PrepareBodyUtility.js +25 -0
- package/project/.sdk/tm/js/src/utility/PrepareHeadersUtility.js +18 -0
- package/project/.sdk/tm/js/src/utility/{MethodUtility.js → PrepareMethodUtility.js} +7 -7
- package/project/.sdk/tm/js/src/utility/PrepareParamsUtility.js +25 -0
- package/project/.sdk/tm/js/src/utility/PreparePathUtility.js +13 -0
- package/project/.sdk/tm/js/src/utility/PrepareQueryUtility.js +26 -0
- package/project/.sdk/tm/js/src/utility/README.md +1 -0
- package/project/.sdk/tm/js/src/utility/ResultBasicUtility.js +34 -0
- package/project/.sdk/tm/js/src/utility/ResultBodyUtility.js +18 -0
- package/project/.sdk/tm/js/src/utility/ResultHeadersUtility.js +22 -0
- package/project/.sdk/tm/js/src/utility/StructUtility.js +2219 -1078
- package/project/.sdk/tm/js/src/utility/TransformRequestUtility.js +28 -0
- package/project/.sdk/tm/js/src/utility/TransformResponseUtility.js +31 -0
- package/project/.sdk/tm/js/src/utility/Utility.js +61 -61
- package/project/.sdk/tm/js/test/README.md +1 -0
- package/project/.sdk/tm/js/test/exists.test.js +16 -0
- package/project/.sdk/tm/js/test/runner.js +323 -107
- package/project/.sdk/tm/js/test/utility/Custom.test.js +41 -63
- package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +390 -116
- package/project/.sdk/tm/js/test/utility/StructUtility.test.js +728 -175
- package/project/.sdk/tm/js/test/utility/index.js +9 -0
- package/project/.sdk/tm/js/test/utility.js +72 -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/primary_utility_test.lua +1213 -0
- package/project/.sdk/tm/lua/test/runner.lua +86 -0
- package/project/.sdk/tm/lua/test/struct_runner.lua +602 -0
- package/project/.sdk/tm/lua/test/struct_utility_test.lua +959 -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 +3427 -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 +156 -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/PrimaryUtilityTest.php +1309 -0
- package/project/.sdk/tm/php/test/Runner.php +112 -0
- package/project/.sdk/tm/php/test/StructRunner.php +275 -0
- package/project/.sdk/tm/php/test/StructUtilityTest.php +1336 -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 +105 -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 +102 -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 +53 -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 +68 -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 +3535 -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 +90 -0
- package/project/.sdk/tm/py/test/struct_runner.py +411 -0
- package/project/.sdk/tm/py/test/test_primary_utility.py +1101 -0
- package/project/.sdk/tm/py/test/test_struct_utility.py +751 -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/primary_utility_test.rb +1083 -0
- package/project/.sdk/tm/rb/test/runner.rb +70 -0
- package/project/.sdk/tm/rb/test/struct_runner.rb +309 -0
- package/project/.sdk/tm/rb/test/struct_utility_test.rb +670 -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/Main.ts +1 -16
- 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/src/cmp/js/Quick_js.ts +0 -78
- package/project/.sdk/src/cmp/js/TestAcceptEntity_js.ts +0 -13
- package/project/.sdk/src/cmp/js/TestAccept_js.ts +0 -18
- package/project/.sdk/tm/go/test/exists_test.go +0 -16
- package/project/.sdk/tm/js/src/utility/AuthUtility.js +0 -21
- package/project/.sdk/tm/js/src/utility/BodyUtility.js +0 -29
- package/project/.sdk/tm/js/src/utility/ErrorUtility.js +0 -33
- package/project/.sdk/tm/js/src/utility/FindparamUtility.js +0 -31
- package/project/.sdk/tm/js/src/utility/FullurlUtility.js +0 -39
- package/project/.sdk/tm/js/src/utility/HeadersUtility.js +0 -13
- package/project/.sdk/tm/js/src/utility/JoinurlUtility.js +0 -14
- package/project/.sdk/tm/js/src/utility/OperatorUtility.js +0 -44
- package/project/.sdk/tm/js/src/utility/OptionsUtility.js +0 -54
- package/project/.sdk/tm/js/src/utility/ParamsUtility.js +0 -21
- package/project/.sdk/tm/js/src/utility/QueryUtility.js +0 -21
- package/project/.sdk/tm/js/src/utility/ReqformUtility.js +0 -32
- package/project/.sdk/tm/js/src/utility/RequestUtility.js +0 -48
- package/project/.sdk/tm/js/src/utility/ResbasicUtility.js +0 -27
- package/project/.sdk/tm/js/src/utility/ResbodyUtility.js +0 -15
- package/project/.sdk/tm/js/src/utility/ResformUtility.js +0 -34
- package/project/.sdk/tm/js/src/utility/ResheadersUtility.js +0 -19
- package/project/.sdk/tm/js/src/utility/ResponseUtility.js +0 -37
- package/project/.sdk/tm/js/src/utility/ResultUtility.js +0 -28
- package/project/.sdk/tm/js/src/utility/SpecUtility.js +0 -35
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
flatten,
|
|
4
|
+
items,
|
|
5
|
+
join,
|
|
6
|
+
} from '@voxgig/struct'
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
KIT,
|
|
10
|
+
getModelPath,
|
|
11
|
+
} from '@voxgig/apidef'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
Content,
|
|
16
|
+
File,
|
|
17
|
+
cmp,
|
|
18
|
+
each,
|
|
19
|
+
} from '@voxgig/sdkgen'
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
type OpGen = (ctx: GenCtx, step: any, index: any) => void
|
|
23
|
+
|
|
24
|
+
type GenCtx = {
|
|
25
|
+
model: any
|
|
26
|
+
entity: any
|
|
27
|
+
flow: any
|
|
28
|
+
PROJUPPER: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
const TestEntity = cmp(function TestEntity(props: any) {
|
|
33
|
+
const ctx$ = props.ctx$
|
|
34
|
+
const model = ctx$.model
|
|
35
|
+
|
|
36
|
+
const target = props.target
|
|
37
|
+
const entity = props.entity
|
|
38
|
+
|
|
39
|
+
const basicflow = getModelPath(model, `main.${KIT}.flow.Basic${entity.Name}Flow`)
|
|
40
|
+
const dobasic = basicflow && true === basicflow.active
|
|
41
|
+
|
|
42
|
+
if (!dobasic) {
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const PROJUPPER = model.const.Name.toUpperCase().replace(/[^A-Z_]/g, '_')
|
|
47
|
+
|
|
48
|
+
const ancestors = (entity.relations?.ancestors || []).flat()
|
|
49
|
+
|
|
50
|
+
// Build idmap names
|
|
51
|
+
const idnames: string[] = []
|
|
52
|
+
for (let i = 1; i <= 3; i++) idnames.push(`${entity.name}0${i}`)
|
|
53
|
+
for (const anc of ancestors) {
|
|
54
|
+
for (let i = 1; i <= 3; i++) idnames.push(`${anc}0${i}`)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const idnamesStr = idnames.map(n => `"${n}"`).join(', ')
|
|
58
|
+
|
|
59
|
+
const allSteps = Object.values(basicflow.step) as any[]
|
|
60
|
+
const updateStep = allSteps.find((s: any) => s.op === 'update')
|
|
61
|
+
const updateData = updateStep?.data
|
|
62
|
+
? Object.entries(updateStep.data).filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
|
|
63
|
+
: []
|
|
64
|
+
const aliases = updateData.map(([k, v]: any) => [k, v])
|
|
65
|
+
|
|
66
|
+
const genCtx: GenCtx = { model, entity, flow: basicflow, PROJUPPER }
|
|
67
|
+
|
|
68
|
+
File({ name: entity.Name + 'EntityTest.' + target.ext }, () => {
|
|
69
|
+
|
|
70
|
+
Content(`<?php
|
|
71
|
+
declare(strict_types=1);
|
|
72
|
+
|
|
73
|
+
// ${entity.Name} entity test
|
|
74
|
+
|
|
75
|
+
require_once __DIR__ . '/../${model.name}_sdk.php';
|
|
76
|
+
require_once __DIR__ . '/Runner.php';
|
|
77
|
+
|
|
78
|
+
use PHPUnit\\Framework\\TestCase;
|
|
79
|
+
use Voxgig\\Struct\\Struct as Vs;
|
|
80
|
+
|
|
81
|
+
class ${entity.Name}EntityTest extends TestCase
|
|
82
|
+
{
|
|
83
|
+
public function test_create_instance(): void
|
|
84
|
+
{
|
|
85
|
+
$testsdk = ${model.const.Name}SDK::test(null, null);
|
|
86
|
+
$ent = $testsdk->${entity.Name}(null);
|
|
87
|
+
$this->assertNotNull($ent);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
public function test_basic_flow(): void
|
|
91
|
+
{
|
|
92
|
+
$setup = ${entity.name}_basic_setup(null);
|
|
93
|
+
$client = $setup["client"];
|
|
94
|
+
|
|
95
|
+
`)
|
|
96
|
+
|
|
97
|
+
// Check if the flow has a create step
|
|
98
|
+
const flowHasCreate = allSteps.some((s: any) => s.op === 'create')
|
|
99
|
+
if (!flowHasCreate) {
|
|
100
|
+
Content(` // Bootstrap entity data from existing test data.
|
|
101
|
+
$${entity.name}_ref01_data_raw = Vs::items(Helpers::to_map(
|
|
102
|
+
Vs::getprop($setup["data"], "existing.${entity.name}")));
|
|
103
|
+
$${entity.name}_ref01_data = null;
|
|
104
|
+
if (count($${entity.name}_ref01_data_raw) > 0) {
|
|
105
|
+
$${entity.name}_ref01_data = Helpers::to_map($${entity.name}_ref01_data_raw[0][1]);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
`)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Model-driven step iteration
|
|
112
|
+
each(basicflow.step, (step: any, index: any) => {
|
|
113
|
+
const opgen: OpGen = GENERATE_OP[step.op]
|
|
114
|
+
if (opgen) {
|
|
115
|
+
opgen(genCtx, step, index)
|
|
116
|
+
Content('\n')
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
Content(` }
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
`)
|
|
124
|
+
|
|
125
|
+
// Generate setup function
|
|
126
|
+
Content(`function ${entity.name}_basic_setup($extra)
|
|
127
|
+
{
|
|
128
|
+
Runner::load_env_local();
|
|
129
|
+
|
|
130
|
+
$entity_data_file = __DIR__ . '/../../.sdk/test/entity/${entity.name}/${entity.Name}TestData.json';
|
|
131
|
+
$entity_data_source = file_get_contents($entity_data_file);
|
|
132
|
+
$entity_data = json_decode($entity_data_source, true);
|
|
133
|
+
|
|
134
|
+
$options = [];
|
|
135
|
+
$options["entity"] = $entity_data["existing"];
|
|
136
|
+
|
|
137
|
+
$client = ${model.const.Name}SDK::test($options, $extra);
|
|
138
|
+
|
|
139
|
+
`)
|
|
140
|
+
|
|
141
|
+
// Generate idmap: key => UPPER(key)
|
|
142
|
+
Content(` // Generate idmap.
|
|
143
|
+
$idmap = [];
|
|
144
|
+
foreach ([${idnamesStr}] as $k) {
|
|
145
|
+
$idmap[$k] = strtoupper($k);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
`)
|
|
149
|
+
|
|
150
|
+
Content(` $env = Runner::env_override([
|
|
151
|
+
"${PROJUPPER}_TEST_${entity.name.toUpperCase().replace(/[^A-Z_]/g, '_')}_ENTID" => $idmap,
|
|
152
|
+
"${PROJUPPER}_TEST_LIVE" => "FALSE",
|
|
153
|
+
"${PROJUPPER}_TEST_EXPLAIN" => "FALSE",
|
|
154
|
+
"${PROJUPPER}_APIKEY" => "NONE",
|
|
155
|
+
]);
|
|
156
|
+
|
|
157
|
+
$idmap_resolved = Helpers::to_map(
|
|
158
|
+
$env["${PROJUPPER}_TEST_${entity.name.toUpperCase().replace(/[^A-Z_]/g, '_')}_ENTID"]);
|
|
159
|
+
if ($idmap_resolved === null) {
|
|
160
|
+
$idmap_resolved = Helpers::to_map($idmap);
|
|
161
|
+
}
|
|
162
|
+
`)
|
|
163
|
+
|
|
164
|
+
// Add aliases
|
|
165
|
+
for (const [key, val] of aliases) {
|
|
166
|
+
Content(` if (!isset($idmap_resolved["${key}"])) {
|
|
167
|
+
$idmap_resolved["${key}"] = $idmap_resolved["${val}"];
|
|
168
|
+
}
|
|
169
|
+
`)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
Content(`
|
|
173
|
+
if ($env["${PROJUPPER}_TEST_LIVE"] === "TRUE") {
|
|
174
|
+
$merged_opts = Vs::merge([
|
|
175
|
+
[
|
|
176
|
+
"apikey" => $env["${PROJUPPER}_APIKEY"],
|
|
177
|
+
],
|
|
178
|
+
$extra ?? [],
|
|
179
|
+
]);
|
|
180
|
+
$client = new ${model.const.Name}SDK(Helpers::to_map($merged_opts));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return [
|
|
184
|
+
"client" => $client,
|
|
185
|
+
"data" => $entity_data,
|
|
186
|
+
"idmap" => $idmap_resolved,
|
|
187
|
+
"env" => $env,
|
|
188
|
+
"explain" => $env["${PROJUPPER}_TEST_EXPLAIN"] === "TRUE",
|
|
189
|
+
"now" => (int)(microtime(true) * 1000),
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
`)
|
|
193
|
+
})
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
function getMatchEntries(step: any): [string, any][] {
|
|
198
|
+
if (!step?.match) return []
|
|
199
|
+
return Object.entries(step.match).filter(([k]: any) => !k.endsWith('$'))
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
const generateCreate: OpGen = (ctx, step, index) => {
|
|
204
|
+
const { entity, flow } = ctx
|
|
205
|
+
const ref = step.input?.ref ?? entity.name + '_ref01'
|
|
206
|
+
const entvar = step.input?.entvar ?? ref + '_ent'
|
|
207
|
+
const datavar = step.input?.datavar ?? (ref + '_data' + (step.input?.suffix ?? ''))
|
|
208
|
+
|
|
209
|
+
const priorSteps = Object.values(flow.step).slice(0, Number(index)) as any[]
|
|
210
|
+
const needsEnt = !priorSteps.some((s: any) =>
|
|
211
|
+
['create', 'list', 'load', 'update', 'remove'].includes(s.op))
|
|
212
|
+
|
|
213
|
+
const hasDatvar = priorSteps.some((s: any) => {
|
|
214
|
+
if ('create' === s.op) {
|
|
215
|
+
const priorRef = s.input?.ref ?? entity.name + '_ref01'
|
|
216
|
+
const priorDatvar = s.input?.datavar ?? (priorRef + '_data' + (s.input?.suffix ?? ''))
|
|
217
|
+
return priorDatvar === datavar
|
|
218
|
+
}
|
|
219
|
+
return false
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
Content(` // CREATE
|
|
223
|
+
`)
|
|
224
|
+
if (needsEnt) {
|
|
225
|
+
Content(` $${entvar} = $client->${entity.Name}(null);
|
|
226
|
+
`)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (hasDatvar) {
|
|
230
|
+
Content(` $${datavar} = Helpers::to_map(Vs::getprop(
|
|
231
|
+
Vs::getpath($setup["data"], "new.${entity.name}"), "${ref}"));
|
|
232
|
+
`)
|
|
233
|
+
} else {
|
|
234
|
+
Content(` $${datavar} = Helpers::to_map(Vs::getprop(
|
|
235
|
+
Vs::getpath($setup["data"], "new.${entity.name}"), "${ref}"));
|
|
236
|
+
`)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const matchEntries = getMatchEntries(step)
|
|
240
|
+
for (const [key, val] of matchEntries) {
|
|
241
|
+
Content(` $${datavar}["${key}"] = $setup["idmap"]["${val}"];
|
|
242
|
+
`)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
Content(`
|
|
246
|
+
[$${datavar}_result, $err] = $${entvar}->create($${datavar}, null);
|
|
247
|
+
$this->assertNull($err);
|
|
248
|
+
$${datavar} = Helpers::to_map($${datavar}_result);
|
|
249
|
+
$this->assertNotNull($${datavar});
|
|
250
|
+
$this->assertNotNull($${datavar}["id"]);
|
|
251
|
+
`)
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
const generateList: OpGen = (ctx, step, index) => {
|
|
256
|
+
const { entity, flow } = ctx
|
|
257
|
+
const ref = step.input?.ref ?? entity.name + '_ref01'
|
|
258
|
+
const entvar = step.input?.entvar ?? ref + '_ent'
|
|
259
|
+
const matchvar = step.input?.matchvar ?? (ref + '_match' + (step.input?.suffix ?? ''))
|
|
260
|
+
const listvar = step.input?.listvar ?? (ref + '_list' + (step.input?.suffix ?? ''))
|
|
261
|
+
|
|
262
|
+
const priorSteps = Object.values(flow.step).slice(0, Number(index)) as any[]
|
|
263
|
+
const needsEnt = !priorSteps.some((s: any) =>
|
|
264
|
+
['create', 'list', 'load', 'update', 'remove'].includes(s.op))
|
|
265
|
+
|
|
266
|
+
Content(` // LIST
|
|
267
|
+
`)
|
|
268
|
+
if (needsEnt) {
|
|
269
|
+
Content(` $${entvar} = $client->${entity.Name}(null);
|
|
270
|
+
`)
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const matchEntries = getMatchEntries(step)
|
|
274
|
+
if (matchEntries.length === 0) {
|
|
275
|
+
Content(` $${matchvar} = [];
|
|
276
|
+
`)
|
|
277
|
+
} else {
|
|
278
|
+
Content(` $${matchvar} = [
|
|
279
|
+
`)
|
|
280
|
+
for (const [key, val] of matchEntries) {
|
|
281
|
+
Content(` "${key}" => $setup["idmap"]["${val}"],
|
|
282
|
+
`)
|
|
283
|
+
}
|
|
284
|
+
Content(` ];
|
|
285
|
+
`)
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
Content(`
|
|
289
|
+
[$${listvar}_result, $err] = $${entvar}->list($${matchvar}, null);
|
|
290
|
+
$this->assertNull($err);
|
|
291
|
+
$this->assertIsArray($${listvar}_result);
|
|
292
|
+
`)
|
|
293
|
+
|
|
294
|
+
// Handle validators
|
|
295
|
+
const allSteps = Object.values(flow.step) as any[]
|
|
296
|
+
if (step.valid) {
|
|
297
|
+
for (const validator of step.valid) {
|
|
298
|
+
const validRef = validator.def?.ref
|
|
299
|
+
const hasRefData = validRef && allSteps.some((s: any) => 'create' === s.op &&
|
|
300
|
+
((s.input?.ref ?? entity.name + '_ref01') === validRef))
|
|
301
|
+
|
|
302
|
+
if ('ItemExists' === validator.apply && hasRefData) {
|
|
303
|
+
const refDataVar = validRef + '_data'
|
|
304
|
+
Content(`
|
|
305
|
+
$found_item = sdk_select(
|
|
306
|
+
Runner::entity_list_to_data($${listvar}_result),
|
|
307
|
+
["id" => $${refDataVar}["id"]]);
|
|
308
|
+
$this->assertNotEmpty($found_item);
|
|
309
|
+
`)
|
|
310
|
+
} else if ('ItemNotExists' === validator.apply && hasRefData) {
|
|
311
|
+
const refDataVar = validRef + '_data'
|
|
312
|
+
Content(`
|
|
313
|
+
$not_found_item = sdk_select(
|
|
314
|
+
Runner::entity_list_to_data($${listvar}_result),
|
|
315
|
+
["id" => $${refDataVar}["id"]]);
|
|
316
|
+
$this->assertEmpty($not_found_item);
|
|
317
|
+
`)
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
const generateUpdate: OpGen = (ctx, step, index) => {
|
|
325
|
+
const { entity, flow } = ctx
|
|
326
|
+
const ref = step.input?.ref ?? entity.name + '_ref01'
|
|
327
|
+
const entvar = step.input?.entvar ?? ref + '_ent'
|
|
328
|
+
const datavar = step.input?.datavar ?? (ref + '_data' + (step.input?.suffix ?? ''))
|
|
329
|
+
const resdatavar = step.input?.resdatavar ?? (ref + '_resdata' + (step.input?.suffix ?? ''))
|
|
330
|
+
const markdefvar = step.input?.markdefvar ?? (ref + '_markdef' + (step.input?.suffix ?? ''))
|
|
331
|
+
const srcdatavar = step.input?.srcdatavar ?? (ref + '_data' + (step.input?.suffix ?? ''))
|
|
332
|
+
|
|
333
|
+
const priorSteps = Object.values(flow.step).slice(0, Number(index)) as any[]
|
|
334
|
+
const needsEnt = !priorSteps.some((s: any) =>
|
|
335
|
+
['create', 'list', 'load', 'update', 'remove'].includes(s.op))
|
|
336
|
+
|
|
337
|
+
Content(` // UPDATE
|
|
338
|
+
`)
|
|
339
|
+
if (needsEnt) {
|
|
340
|
+
Content(` $${entvar} = $client->${entity.Name}(null);
|
|
341
|
+
`)
|
|
342
|
+
}
|
|
343
|
+
Content(` $${datavar}_up = [
|
|
344
|
+
"id" => $${srcdatavar}["id"],
|
|
345
|
+
`)
|
|
346
|
+
|
|
347
|
+
if (step.data) {
|
|
348
|
+
const dataEntries = Object.entries(step.data).filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
|
|
349
|
+
for (const [key] of dataEntries) {
|
|
350
|
+
Content(` "${key}" => $setup["idmap"]["${key}"],
|
|
351
|
+
`)
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
Content(` ];
|
|
356
|
+
`)
|
|
357
|
+
|
|
358
|
+
if (step.spec) {
|
|
359
|
+
for (const spec of step.spec) {
|
|
360
|
+
if ('TextFieldMark' === spec.apply && null != step.input?.textfield) {
|
|
361
|
+
const fieldname = step.input.textfield
|
|
362
|
+
const fieldvalue = spec.def?.mark ?? `Mark01-${ref}`
|
|
363
|
+
Content(`
|
|
364
|
+
$${markdefvar}_name = "${fieldname}";
|
|
365
|
+
$${markdefvar}_value = "${fieldvalue}_" . $setup["now"];
|
|
366
|
+
$${datavar}_up[$${markdefvar}_name] = $${markdefvar}_value;
|
|
367
|
+
`)
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
Content(`
|
|
373
|
+
[$${resdatavar}_result, $err] = $${entvar}->update($${datavar}_up, null);
|
|
374
|
+
$this->assertNull($err);
|
|
375
|
+
$${resdatavar} = Helpers::to_map($${resdatavar}_result);
|
|
376
|
+
$this->assertNotNull($${resdatavar});
|
|
377
|
+
$this->assertEquals($${resdatavar}["id"], $${datavar}_up["id"]);
|
|
378
|
+
`)
|
|
379
|
+
|
|
380
|
+
if (step.spec) {
|
|
381
|
+
for (const spec of step.spec) {
|
|
382
|
+
if ('TextFieldMark' === spec.apply && null != step.input?.textfield) {
|
|
383
|
+
Content(` $this->assertEquals($${resdatavar}[$${markdefvar}_name], $${markdefvar}_value);
|
|
384
|
+
`)
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
const generateLoad: OpGen = (ctx, step, index) => {
|
|
392
|
+
const { entity, flow } = ctx
|
|
393
|
+
const ref = step.input?.ref ?? entity.name + '_ref01'
|
|
394
|
+
const entvar = step.input?.entvar ?? ref + '_ent'
|
|
395
|
+
const matchvar = step.input?.matchvar ?? (ref + '_match' + (step.input?.suffix ?? ''))
|
|
396
|
+
const datavar = step.input?.datavar ?? (ref + '_data' + (step.input?.suffix ?? ''))
|
|
397
|
+
const srcdatavar = step.input?.srcdatavar ?? (ref + '_data' + (step.input?.suffix ?? ''))
|
|
398
|
+
|
|
399
|
+
const priorSteps = Object.values(flow.step).slice(0, Number(index)) as any[]
|
|
400
|
+
const hasEntVar = priorSteps.some((s: any) =>
|
|
401
|
+
['create', 'list', 'load', 'update', 'remove'].includes(s.op))
|
|
402
|
+
|
|
403
|
+
const flowHasCreate = Object.values(flow.step).some((s: any) => (s as any).op === 'create')
|
|
404
|
+
const preambleRef = entity.name + '_ref01'
|
|
405
|
+
const hasSrcData = (!flowHasCreate && srcdatavar === (preambleRef + '_data')) ||
|
|
406
|
+
priorSteps.some((s: any) => {
|
|
407
|
+
if ('create' === s.op) {
|
|
408
|
+
const priorRef = s.input?.ref ?? entity.name + '_ref01'
|
|
409
|
+
const priorDatvar = s.input?.datavar ?? (priorRef + '_data' + (s.input?.suffix ?? ''))
|
|
410
|
+
return priorDatvar === srcdatavar
|
|
411
|
+
}
|
|
412
|
+
return false
|
|
413
|
+
})
|
|
414
|
+
|
|
415
|
+
Content(` // LOAD
|
|
416
|
+
`)
|
|
417
|
+
if (!hasEntVar) {
|
|
418
|
+
Content(` $${entvar} = $client->${entity.Name}(null);
|
|
419
|
+
`)
|
|
420
|
+
}
|
|
421
|
+
if (!hasSrcData) {
|
|
422
|
+
Content(` $${srcdatavar}_raw = Vs::items(Helpers::to_map(
|
|
423
|
+
Vs::getprop($setup["data"], "existing.${entity.name}")));
|
|
424
|
+
$${srcdatavar} = null;
|
|
425
|
+
if (count($${srcdatavar}_raw) > 0) {
|
|
426
|
+
$${srcdatavar} = Helpers::to_map($${srcdatavar}_raw[0][1]);
|
|
427
|
+
}
|
|
428
|
+
`)
|
|
429
|
+
}
|
|
430
|
+
Content(` $${matchvar} = [
|
|
431
|
+
"id" => $${srcdatavar}["id"],
|
|
432
|
+
];
|
|
433
|
+
[$${datavar}_loaded, $err] = $${entvar}->load($${matchvar}, null);
|
|
434
|
+
$this->assertNull($err);
|
|
435
|
+
$${datavar}_load_result = Helpers::to_map($${datavar}_loaded);
|
|
436
|
+
$this->assertNotNull($${datavar}_load_result);
|
|
437
|
+
$this->assertEquals($${datavar}_load_result["id"], $${srcdatavar}["id"]);
|
|
438
|
+
`)
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
const generateRemove: OpGen = (ctx, step, index) => {
|
|
443
|
+
const { entity, flow } = ctx
|
|
444
|
+
const ref = step.input?.ref ?? entity.name + '_ref01'
|
|
445
|
+
const entvar = step.input?.entvar ?? ref + '_ent'
|
|
446
|
+
const matchvar = step.input?.matchvar ?? (ref + '_match' + (step.input?.suffix ?? ''))
|
|
447
|
+
const srcdatavar = step.input?.srcdatavar ?? (ref + '_data')
|
|
448
|
+
|
|
449
|
+
const priorSteps = Object.values(flow.step).slice(0, Number(index)) as any[]
|
|
450
|
+
const needsEnt = !priorSteps.some((s: any) =>
|
|
451
|
+
['create', 'list', 'load', 'update', 'remove'].includes(s.op))
|
|
452
|
+
|
|
453
|
+
Content(` // REMOVE
|
|
454
|
+
`)
|
|
455
|
+
if (needsEnt) {
|
|
456
|
+
Content(` $${entvar} = $client->${entity.Name}(null);
|
|
457
|
+
`)
|
|
458
|
+
}
|
|
459
|
+
Content(` $${matchvar} = [
|
|
460
|
+
"id" => $${srcdatavar}["id"],
|
|
461
|
+
];
|
|
462
|
+
[$_, $err] = $${entvar}->remove($${matchvar}, null);
|
|
463
|
+
$this->assertNull($err);
|
|
464
|
+
`)
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
const GENERATE_OP: Record<string, OpGen> = {
|
|
469
|
+
create: generateCreate,
|
|
470
|
+
list: generateList,
|
|
471
|
+
update: generateUpdate,
|
|
472
|
+
load: generateLoad,
|
|
473
|
+
remove: generateRemove,
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
export {
|
|
478
|
+
TestEntity
|
|
479
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
KIT,
|
|
4
|
+
getModelPath
|
|
5
|
+
} from '@voxgig/apidef'
|
|
6
|
+
|
|
7
|
+
import type {
|
|
8
|
+
ModelEntity
|
|
9
|
+
} from '@voxgig/apidef'
|
|
10
|
+
|
|
11
|
+
import { cmp, each, Folder, File, Content } from '@voxgig/sdkgen'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
import { TestEntity } from './TestEntity_php'
|
|
15
|
+
import { TestDirect } from './TestDirect_php'
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const Test = cmp(function Test(props: any) {
|
|
19
|
+
const { model, stdrep } = props.ctx$
|
|
20
|
+
const { target } = props
|
|
21
|
+
|
|
22
|
+
Folder({ name: 'test' }, () => {
|
|
23
|
+
|
|
24
|
+
// Generate exists test
|
|
25
|
+
File({ name: 'ExistsTest.' + target.ext }, () => {
|
|
26
|
+
Content(`<?php
|
|
27
|
+
declare(strict_types=1);
|
|
28
|
+
|
|
29
|
+
// ${model.const.Name} SDK exists test
|
|
30
|
+
|
|
31
|
+
require_once __DIR__ . '/../${model.name}_sdk.php';
|
|
32
|
+
|
|
33
|
+
use PHPUnit\\Framework\\TestCase;
|
|
34
|
+
|
|
35
|
+
class ExistsTest extends TestCase
|
|
36
|
+
{
|
|
37
|
+
public function test_create_test_sdk(): void
|
|
38
|
+
{
|
|
39
|
+
$testsdk = ${model.const.Name}SDK::test(null, null);
|
|
40
|
+
$this->assertNotNull($testsdk);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`)
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
each(model.main[KIT].entity, (entity: ModelEntity) => {
|
|
47
|
+
TestEntity({ target, entity })
|
|
48
|
+
TestDirect({ target, entity })
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
Test
|
|
56
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
declare(strict_types=1);
|
|
3
|
+
|
|
4
|
+
// ProjectName SDK EntityName entity
|
|
5
|
+
|
|
6
|
+
require_once __DIR__ . '/../utility/struct/Struct.php';
|
|
7
|
+
require_once __DIR__ . '/../core/Helpers.php';
|
|
8
|
+
|
|
9
|
+
use Voxgig\Struct\Struct;
|
|
10
|
+
|
|
11
|
+
class EntityNameEntity
|
|
12
|
+
{
|
|
13
|
+
private string $_name;
|
|
14
|
+
private $_client;
|
|
15
|
+
private $_utility;
|
|
16
|
+
private array $_entopts;
|
|
17
|
+
private array $_data;
|
|
18
|
+
private array $_match;
|
|
19
|
+
private $_entctx;
|
|
20
|
+
|
|
21
|
+
public function __construct($client, ?array $entopts = null)
|
|
22
|
+
{
|
|
23
|
+
$entopts = $entopts ?? [];
|
|
24
|
+
if (!isset($entopts["active"])) {
|
|
25
|
+
$entopts["active"] = true;
|
|
26
|
+
} elseif ($entopts["active"] === false) {
|
|
27
|
+
// keep false
|
|
28
|
+
} else {
|
|
29
|
+
$entopts["active"] = true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
$this->_name = "entityname";
|
|
33
|
+
$this->_client = $client;
|
|
34
|
+
$this->_utility = $client->get_utility();
|
|
35
|
+
$this->_entopts = $entopts;
|
|
36
|
+
$this->_data = [];
|
|
37
|
+
$this->_match = [];
|
|
38
|
+
|
|
39
|
+
$this->_entctx = ($this->_utility->make_context)([
|
|
40
|
+
"entity" => $this,
|
|
41
|
+
"entopts" => $entopts,
|
|
42
|
+
], $client->get_root_ctx());
|
|
43
|
+
|
|
44
|
+
($this->_utility->feature_hook)($this->_entctx, "PostConstructEntity");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public function get_name(): string
|
|
48
|
+
{
|
|
49
|
+
return $this->_name;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public function make(): self
|
|
53
|
+
{
|
|
54
|
+
$opts = $this->_entopts;
|
|
55
|
+
return new EntityNameEntity($this->_client, $opts);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public function data_set($args): void
|
|
59
|
+
{
|
|
60
|
+
if ($args) {
|
|
61
|
+
$this->_data = ProjectNameHelpers::to_map(Struct::clone($args)) ?? [];
|
|
62
|
+
($this->_utility->feature_hook)($this->_entctx, "SetData");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public function data_get()
|
|
67
|
+
{
|
|
68
|
+
($this->_utility->feature_hook)($this->_entctx, "GetData");
|
|
69
|
+
return Struct::clone($this->_data);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public function match_set($args): void
|
|
73
|
+
{
|
|
74
|
+
if ($args) {
|
|
75
|
+
$this->_match = ProjectNameHelpers::to_map(Struct::clone($args)) ?? [];
|
|
76
|
+
($this->_utility->feature_hook)($this->_entctx, "SetMatch");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public function match_get()
|
|
81
|
+
{
|
|
82
|
+
($this->_utility->feature_hook)($this->_entctx, "GetMatch");
|
|
83
|
+
return Struct::clone($this->_match);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// #LoadOp
|
|
87
|
+
|
|
88
|
+
// #ListOp
|
|
89
|
+
|
|
90
|
+
// #CreateOp
|
|
91
|
+
|
|
92
|
+
// #UpdateOp
|
|
93
|
+
|
|
94
|
+
// #RemoveOp
|
|
95
|
+
|
|
96
|
+
private function _run_op($ctx, callable $post_done): array
|
|
97
|
+
{
|
|
98
|
+
$utility = $this->_utility;
|
|
99
|
+
|
|
100
|
+
// #PrePoint-Hook
|
|
101
|
+
|
|
102
|
+
[$point, $err] = ($utility->make_point)($ctx);
|
|
103
|
+
$ctx->out["point"] = $point;
|
|
104
|
+
if ($err) {
|
|
105
|
+
return ($utility->make_error)($ctx, $err);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// #PreSpec-Hook
|
|
109
|
+
|
|
110
|
+
[$spec, $err] = ($utility->make_spec)($ctx);
|
|
111
|
+
$ctx->out["spec"] = $spec;
|
|
112
|
+
if ($err) {
|
|
113
|
+
return ($utility->make_error)($ctx, $err);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// #PreRequest-Hook
|
|
117
|
+
|
|
118
|
+
[$resp, $err] = ($utility->make_request)($ctx);
|
|
119
|
+
$ctx->out["request"] = $resp;
|
|
120
|
+
if ($err) {
|
|
121
|
+
return ($utility->make_error)($ctx, $err);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// #PreResponse-Hook
|
|
125
|
+
|
|
126
|
+
[$resp2, $err] = ($utility->make_response)($ctx);
|
|
127
|
+
$ctx->out["response"] = $resp2;
|
|
128
|
+
if ($err) {
|
|
129
|
+
return ($utility->make_error)($ctx, $err);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// #PreResult-Hook
|
|
133
|
+
|
|
134
|
+
[$result, $err] = ($utility->make_result)($ctx);
|
|
135
|
+
$ctx->out["result"] = $result;
|
|
136
|
+
if ($err) {
|
|
137
|
+
return ($utility->make_error)($ctx, $err);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// #PreDone-Hook
|
|
141
|
+
|
|
142
|
+
$post_done();
|
|
143
|
+
|
|
144
|
+
return ($utility->done)($ctx);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require_once __DIR__ . '/../utility/struct/Struct.php';
|
|
2
|
+
require_once __DIR__ . '/../core/Helpers.php';
|
|
3
|
+
|
|
4
|
+
// EJECT-START
|
|
5
|
+
|
|
6
|
+
public function create($reqdata, $ctrl = null): array
|
|
7
|
+
{
|
|
8
|
+
$utility = $this->_utility;
|
|
9
|
+
$ctx = ($utility->make_context)([
|
|
10
|
+
"opname" => "create",
|
|
11
|
+
"ctrl" => $ctrl,
|
|
12
|
+
"match" => $this->_match,
|
|
13
|
+
"data" => $this->_data,
|
|
14
|
+
"reqdata" => $reqdata,
|
|
15
|
+
], $this->_entctx);
|
|
16
|
+
|
|
17
|
+
return $this->_run_op($ctx, function () use ($ctx) {
|
|
18
|
+
if ($ctx->result) {
|
|
19
|
+
if ($ctx->result->resdata) {
|
|
20
|
+
$this->_data = ProjectNameHelpers::to_map(Struct::clone($ctx->result->resdata)) ?? [];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// EJECT-END
|